From patchwork Fri Dec 4 11:36:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Revest X-Patchwork-Id: 11951525 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A383C0018C for ; Fri, 4 Dec 2020 11:37:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9F5D22519 for ; Fri, 4 Dec 2020 11:37:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729925AbgLDLhl (ORCPT ); Fri, 4 Dec 2020 06:37:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbgLDLhl (ORCPT ); Fri, 4 Dec 2020 06:37:41 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE405C08C5F2 for ; Fri, 4 Dec 2020 03:36:21 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id g185so6728308wmf.3 for ; Fri, 04 Dec 2020 03:36:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vXUt9QR6W/2xypB9zqeID7fSJysj66ekgYEFFzk0u3s=; b=M8VVpn2j0Mamn/J9XrTVaYx67YMPiKTCcqkORGZkkY2bPk4iBr7PVQQW13pMhqSEfb A+3S8KjGCgOOKa/vbCMYBmO/jGdGQBjK502cJ5zsmmjnbLPUUSHZjdBbXfA+/rxhKBkg AEtLmeyaz25uSLlhre7xQqu8pFIefO1fNpmQ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vXUt9QR6W/2xypB9zqeID7fSJysj66ekgYEFFzk0u3s=; b=FZ50xZ+Ks6Uz013YoAbbzR5eFtv6a5E4nS60J5KAJ3tRUCZLTIaq6dc4MZblVfKig/ rHvcwihgcn+U5WfhOzvUuzF48IGXLe7/gnvIpeKVXK+TBcj5FzfXhRZO/76m919JF5EX 48skqLdw5r5pSf1eSV7Vnu1A7num7j4i0Ev9yoBh0tM92qCn+KjkrK0HtuC60wjVI9bd izirAwdrVtTsj08eASj/A62KwLGiDxypSJKYcMPSSGU2c5PqKxWAT6elsVe22o81K+zP gsuTIVbd4PDfzz0VRAgNEhHGLFj2543HnVzhw49IDOVRNG40lXNwH1m72IV5ZjIdZ1er 51PQ== X-Gm-Message-State: AOAM5309wvPEzhyqL5xDaYn6sd85s4a0TYA2mmn5W6EpKhGLbwz5Ch7K kxkDt1sX82bN19PxWHzah/2JQF2l5UoSIw== X-Google-Smtp-Source: ABdhPJye4B8dDFbmGY6ImaaUYrrR2Sy5uuk2eixv15LJmLNAfKjKJZizosdgZvxiAMQfc6I5y0CtnQ== X-Received: by 2002:a1c:3d86:: with SMTP id k128mr3629454wma.66.1607081780439; Fri, 04 Dec 2020 03:36:20 -0800 (PST) Received: from revest.zrh.corp.google.com ([2a00:79e0:42:204:f693:9fff:fef4:a569]) by smtp.gmail.com with ESMTPSA id j6sm3202750wrq.38.2020.12.04.03.36.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 03:36:19 -0800 (PST) From: Florent Revest X-Google-Original-From: Florent Revest To: bpf@vger.kernel.org Cc: viro@zeniv.linux.org.uk, davem@davemloft.net, kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net, kafai@fb.com, yhs@fb.com, andrii@kernel.org, kpsingh@chromium.org, revest@google.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, KP Singh Subject: [PATCH bpf-next v5 3/6] bpf: Expose bpf_sk_storage_* to iterator programs Date: Fri, 4 Dec 2020 12:36:06 +0100 Message-Id: <20201204113609.1850150-3-revest@google.com> X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog In-Reply-To: <20201204113609.1850150-1-revest@google.com> References: <20201204113609.1850150-1-revest@google.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net Iterators are currently used to expose kernel information to userspace over fast procfs-like files but iterators could also be used to manipulate local storage. For example, the task_file iterator could be used to initialize a socket local storage with associations between processes and sockets or to selectively delete local storage values. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau Acked-by: KP Singh --- net/core/bpf_sk_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a32037daa933..4edd033e899c 100644 --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -394,6 +394,7 @@ static bool bpf_sk_storage_tracing_allowed(const struct bpf_prog *prog) * use the bpf_sk_storage_(get|delete) helper. */ switch (prog->expected_attach_type) { + case BPF_TRACE_ITER: case BPF_TRACE_RAW_TP: /* bpf_sk_storage has no trace point */ return true;