Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp785077rwb; Fri, 7 Oct 2022 04:16:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ky8gs51YHyMfq6CDVm10gJa8o/EY04a45e8gFVYIzr+Ac5dL2dkF9mD7GkOzYYik/02k5 X-Received: by 2002:a17:90b:3b47:b0:202:a81f:4059 with SMTP id ot7-20020a17090b3b4700b00202a81f4059mr16139192pjb.150.1665141390710; Fri, 07 Oct 2022 04:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665141390; cv=none; d=google.com; s=arc-20160816; b=HVD9MQJ7tBvQ2lxOVyT+aM4QdyZDxUZ0mwaTFNwvry5j+YyhAgML7ZqqOu2xqnbuiW z+1UUqZlsGWvCvbGRWH9GdVMaLMyQ+IJEf7QCQmrbHvetmBbjaQPdKyWbaiHgbMj9F1T jn4pgx0hsxK1fFTWevbVUR+HK7X0Sa7PubLoV9Sv03uWNP51UZnWdlyI9YRaAAl7AKYx JHfzQ5ncRnYs59rKXhZX66tl7x5G3pqM6ujHkupXosItzOgpLNLSaO1U/yRFL+XsqCtg r4v92ZKc5gVvTff9Bi5DfyxLCAtfArcM6Z9vtvkQw+I5hnq7ZbTTHRvLuhBX4F9OuXhe wVNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=4xuYpdOCao3sDT55XW73n6bDSmtjOmU2U3ZcDnvfdKE=; b=z5Pv3E35eXSyZYtqd3qukzVdFO3DSs/1VXh33uLbrTJEQ3XlUuqltWqpp3/CKb62IC BMljMzjLdD2qyHM6QNrEreRwQ1uP2oFD31f6c2teb/zRc4uETXUFVshs/5YKd6UPm88r Id1/eLI3Plnlo1JxotfZDjMa+yqJQl/bCK09uutp0ZMge7LsDpihH4VJdoZq3khfY+nT Pe2PgzdsNcMwOSA3VbuTyCHjhR0ADT7DMQB7jNpRbNte7qTkBNcLe9pGB+oqakV8bl46 kLDRfPDtqnrkAf89r7Ws0vYUty+RWR4fSlkwqz1cG+zMuxsAcsqz4eLfcEOee0eL55U3 3Emw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BIvfQq4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t22-20020a17090aba9600b00202c850b5a8si7586324pjr.11.2022.10.07.04.16.19; Fri, 07 Oct 2022 04:16:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BIvfQq4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbiJGK7a (ORCPT + 99 others); Fri, 7 Oct 2022 06:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbiJGK7Y (ORCPT ); Fri, 7 Oct 2022 06:59:24 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5C14F4716; Fri, 7 Oct 2022 03:59:21 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id e18so2655555wmq.3; Fri, 07 Oct 2022 03:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=4xuYpdOCao3sDT55XW73n6bDSmtjOmU2U3ZcDnvfdKE=; b=BIvfQq4idd3t691vh764uDJKOGb49pL/7opERG7wAs1b2yCS8bC8clOM5yNVVAMA92 sFG47oFvt6U6o1JTvGCovCBxey4SUPq4vKSDhIehfSSN9c3Pf1jTmlYXoZFg4PB9619P AuysXMHBKLFmjLthaRtzacjUkoFypr6PLVmXwMFNtapGdOAYeQj7CVnB/sgwPBy8AZ1X OyMmWPjzRN6t5dE6yScJD8nzj99aYXvRuhmNpAIEIXGHMHd8t6hxsXx1G2wkRIxhLLL5 xBDMoJu+ZfQ4T162O9A70HAEB0Cm5uq7ABVrv1Aiw9RrRLuH84iwmzsVolm/sK46fAav 4Hlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4xuYpdOCao3sDT55XW73n6bDSmtjOmU2U3ZcDnvfdKE=; b=1JTK5jBeVrdyEs736yo1PbSI40GApkZspqtt2csLOU4x+P2lbJUOhVCtw7iUR5WtGq WRBiE9iCSMi2J+3i3zB3npNIBsThFfrBKzcmtAxRQNMQd1FWQgUsq2yWh6F8bcgsN51I arOSWpJp94cFQJlt3Pm8xoIFE709UVkHL0C5tuq9sayovCM9jLTl2uyMC2B9wzX6MB74 PgCrDxRpPMFfjm+XQwT0YnGvLMCb/+z54Gq/y+jbcithhbR7dolAOQm/wf/hi7Mit5Fb 6FS3rkMmd0vXkrOs7txUFjuzQ8MXHo43lCmMACuW6ygqp9Phjja7NTCyeY+bCyfXhLHv eeUQ== X-Gm-Message-State: ACrzQf1xFJdEZ0JYMYSbhTSi+9OuYjTH90rQWTqfuN2yK6GAe1Vn3Gzv jrkvjVEGCLDUH6WrvVJx6F8= X-Received: by 2002:a05:600c:4e4d:b0:3b4:7659:38c with SMTP id e13-20020a05600c4e4d00b003b47659038cmr9886765wmq.176.1665140360286; Fri, 07 Oct 2022 03:59:20 -0700 (PDT) Received: from krava ([193.85.244.190]) by smtp.gmail.com with ESMTPSA id p16-20020a1c5450000000b003c00203fb81sm6542310wmi.7.2022.10.07.03.59.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 03:59:20 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Fri, 7 Oct 2022 12:59:17 +0200 To: Roberto Sassu Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, mykolal@fb.com, shuah@kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Roberto Sassu Subject: Re: [PATCH v2 0/6] Add _opts variant for bpf_*_get_fd_by_id() Message-ID: References: <20221006110736.84253-1-roberto.sassu@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221006110736.84253-1-roberto.sassu@huaweicloud.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 06, 2022 at 01:07:30PM +0200, Roberto Sassu wrote: > From: Roberto Sassu > > Add the _opts variant for bpf_*_get_fd_by_id() functions, to be able to > pass to the kernel more options, when requesting a fd of an eBPF object. > > Pass the options through a newly introduced structure, > bpf_get_fd_by_id_opts, which currently contains open_flags (the other two > members are for compatibility and for padding). > > open_flags allows the caller to request specific permissions to access a > map (e.g. read-only). This is useful for example in the situation where a > map is write-protected. > > Besides patches 2-6, which introduce the new variants and the data > structure, patch 1 fixes the LIBBPF_1.0.0 declaration in libbpf.map. > > Changelog > > v1: > - Don't CC stable kernel mailing list for patch 1 (suggested by Andrii) > - Rename bpf_get_fd_opts struct to bpf_get_fd_by_id_opts (suggested by > Andrii) > - Move declaration of _opts variants after non-opts variants (suggested by > Andrii) > - Correctly initialize bpf_map_info, fix style issues, use map from > skeleton, check valid fd in the test (suggested by Andrii) > - Rename libbpf_get_fd_opts test to libbpf_get_fd_by_id_opts > > Roberto Sassu (6): > libbpf: Fix LIBBPF_1.0.0 declaration in libbpf.map > libbpf: Introduce bpf_get_fd_by_id_opts and > bpf_map_get_fd_by_id_opts() > libbpf: Introduce bpf_prog_get_fd_by_id_opts() > libbpf: Introduce bpf_btf_get_fd_by_id_opts() > libbpf: Introduce bpf_link_get_fd_by_id_opts() > selftests/bpf: Add tests for _opts variants of bpf_*_get_fd_by_id() it's not marked, but I'm assuming this goes to bpf-next, right? anyway, lgtm Acked-by: Jiri Olsa thanks, jirka > > tools/lib/bpf/bpf.c | 48 +++++++++- > tools/lib/bpf/bpf.h | 16 ++++ > tools/lib/bpf/libbpf.map | 6 +- > tools/testing/selftests/bpf/DENYLIST.s390x | 1 + > .../bpf/prog_tests/libbpf_get_fd_by_id_opts.c | 87 +++++++++++++++++++ > .../bpf/progs/test_libbpf_get_fd_by_id_opts.c | 36 ++++++++ > 6 files changed, 189 insertions(+), 5 deletions(-) > create mode 100644 tools/testing/selftests/bpf/prog_tests/libbpf_get_fd_by_id_opts.c > create mode 100644 tools/testing/selftests/bpf/progs/test_libbpf_get_fd_by_id_opts.c > > -- > 2.25.1 >