From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796457333; b=tQxnK/huihX3Ly6ruys4WEEvic5Wab//GNvYirYTbPZCH14TbONiojNoUvWrI1I2DGOd lcnnhq4U+gfG1lKtPCRXuFIzQ/1OwwSoGJw68sjia9Ebsd2c1P3dB+u6TiCqaqdJg77wT n553syiilZb52Cj7h/19C1WrdzivuRjpuGWyp7XCCl/ZmaMlcXyTA2lj0wGqnXoue6Luj uYl3wTe4FSLg1Xavk1w4VRCvsDAu0Bznw4sHR7O4FiZHR4hEejBGDCNP6j2MBFHCBOPoC pFMTwsGB/7eaD86xxXg7AOcuTXgM3QAhQVqMkFnZu5QIBr0vqg53xK4MgbjYqThqyGQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796457333; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Mime-Version: Content-Transfer-Encoding:Content-Type:Date:Message-Id:To:Cc:Subject: From:X-Mailer:References:In-Reply-To; bh=FYksnz24np+NBQ/zFHyNbTdRIGFjdOTn5HEIv/Ffhxw=; b=mgDB8E5q3CG1pcrIZf+EW1XEOh28KBYDMRedHl5A0KDuj8t9/CAt+pU2o3WQGGfakpjP A/nvM3VoUBqYfihWTA1HCQsil7sn3NLYxXZQPE47gwHnW623zILHfq8L7LFBvzozbEQ9I vJyjibBhi+VXrkzATCDQuqZVgGvky1iseCXOY2hKfrjy75VeqhjhnZxseRax97KrjWlYx Xh4zXYJ326Q8b3bw7XBdUhbqf2vdPYwX5KSPTXJQl0jZZn+3zvWm3xiWwvCxpF4vyVvMC AJ2oUkqmo8c2q3jvE2O664k+PVHEaVOGW4Xr0fVvfp0qJ1s9BXF5V4zb8PmBZwHWNpw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WQqMlshv; arc=none smtp.remote-ip=209.85.215.174 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55F8B606A322 for ; Sat, 5 Dec 2026 07:55:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55F8B606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WQqMlshv Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-ce13249fff8so211132a12.0 for ; Fri, 04 Dec 2026 23:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796457332; x=1797062132; darn=vger.kernel.org; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=FYksnz24np+NBQ/zFHyNbTdRIGFjdOTn5HEIv/Ffhxw=; b=WQqMlshvbsX3CaAhftePWzOI8xZZFLWIwHB4KPmoxqDCpDTWevv10jMbPPY5zwpP5i Wk3ItYO0Hjn2pm+IvFfPfsPlTZbl9neikg/4ZAD+MakTNIzc6bHDU3E+N12QSjB/EMju fFXpVR8YzD9sk5yIu9HUtZFDCJJjpIwEH3YJIUjEI18agtB+dRqzcpSYdjqywQMkwtuR 3q4LosoZPi1aUSqIg7WWOzKw9/8uzvz/MuDTL3qM9fL54k7aLy8YCTdEHwp9Jw94m6j7 l99IfWGn8cH5rRRZ9HvR+ADoxkiA3p6w2fiDtt+NFqqaaCX3Z8QT3kwmqwu4/xGA9I1b gz4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796457332; x=1797062132; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=FYksnz24np+NBQ/zFHyNbTdRIGFjdOTn5HEIv/Ffhxw=; b=h9XCDRtk6SZMsnjN7xeW1h8Z5I2SEORoNalAdO9+2nu9ZMiHgyLe9SP7/22dGR+09f xNZ6JBYKwi11Z5yN3otzV0oBQ5RtNAAe9nUyvEKvCqaRknmQ+rVrVkc/LwToQScOLHzW Q6MHhvzT81X+xtxW6EapWlIaF6kdbGLtXrUKtHCViOp9t7RPaYA1EpuwfJBr0d5mn//h 1XY/hKyPGKrg9kjNcn9j5H34GmJ6LUIzvfcl0pd5av+oB0TooY0wAV8nxbs3Xe9sfCcY qWewBXj1O2uGx6GHlWizrS7LUwcWKlIgRTYcZ4jtMt+eAO5IyAt6t4grqD5FwLA22pwz i73w== X-Gm-Message-State: APuU4Z8i9Xtf4LJAo1h4b2HvfmcNge6i0LTfY9NYzcI9rEyk6Pht9VtW a1sWmGTkcQaG/+7ZW1CZ3TkunIhbwwqzHf6+AhtRfb0Tzl9Xv+5NjlD4 X-Gm-Gg: AZFdTZfYm6J+07tXoDI/y2+ktv/LKRO7irLSoZDdlHIrT4yUnnYHWczMFlmVA1w+J6j 3UbYbhf2FrVHcVMftmMCfAc1F478NnsKdj8pdiouB3oy0yWxT+9zzb0IgyDeRQyRhpiop0YEqPY fYZopInB7v5V9ffFoo0+UJkWh6MyXR0e4dT3oEfiGVCY0T3cVr4PZ87dcYBbM6qweW5nz3d0yFx 3xf04letnt9dy7Kv5SetWXGb04Od934rw1V5vcsoC+I0seyi9d7kACs0xbZLIc1vYom7pGI28BD 4ZQkrouCF5flFNAh3F5eW83PA/a4jhNHgBRmWawqJDB+LAa++G1xLSkuhr8alCFb1HbOZ3NDqAE FvfbFtFxM2kAcOHFFJOEsV/FMOTkY4/BP8GsbBWmQlBsGVl8nlV0BQ2ZB1AaAZw1C2g1XQIMxm4 oiNYJGpD7hY1xzDRemo/Tje8HaOsp2x723lc1wfSPmVuf+TMwlKssUbc245ge74ZVZS02adwnVh rJBjMEkH5mVmZPnGVSbnxJvns15JTZlcgrHj77yVoxVJT9S4N4WlxEe3hJjclyc6dYeTHRZM1G3 GnlzcwZ8H041GdxZDaYL1i7hdiAlPdAvP75NdqMQ5JCegEiCvLw7dSqQ9m5rRjYCu8j4dBfMfGS T3Hjj40UdMyH+2XjElFP1niHqvRbw649n7g== X-Received: by 2002:a05:6a21:8287:b0:3e2:d2d5:68c5 with SMTP id adf61e73a8af0-413fb5c8c5fmr6399551637.49.1796457332466; Fri, 04 Dec 2026 23:55:32 -0800 (PST) Received: from localhost ([153.61.198.249]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ce1237f8df2sm2482964a12.28.2026.12.04.23.55.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 23:55:32 -0800 (PST) X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Sat, 05 Dec 2026 07:55:31 +0000 Message-Id: To: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , "Alexei Starovoitov" , "Daniel Borkmann" , "Andrii Nakryiko" , "Eduard Zingerman" , "Kumar Kartikeya Dwivedi" , "Martin KaFai Lau" , "Song Liu" , "Yonghong Song" , "Jiri Olsa" , "Emil Tsalapatis" , "Ihor Solodrai" , "John Fastabend" Cc: Subject: Re: [PATCH bpf-next v5 0/6] Improvements to access module BTF with bpf_token From: "Alexei Starovoitov" X-Mailer: aerc 0.20.1-357-ga8fcb8d99360 References: <20261130-bpf-relax-get-next-id-v5-0-0a5507bc4d6e@toke.dk> In-Reply-To: <20261130-bpf-relax-get-next-id-v5-0-0a5507bc4d6e@toke.dk> On Mon Nov 30, 2026 at 11:56 AM UTC, Toke H=C3=B8iland-J=C3=B8rgensen wrote= : > This series helps seamlessly run an application inside a user namespace > with a bpf_token delegation. The need for these changes was discussed at > my talk at this yeas's LPC: > > https://lpc.events/event/20/contributions/2441/ > > The problem the series aims to fix is one we discovered while developing > the bpf-rbacd application discussed in the talk: when delegating > permissions with a bpf_token, a libbpf-based tracing application works > seamlessly when it is attaching an fentry program to a function that is > in vmlinux, but fails if it tries to attach the same program to a > function that's defined in a module. There are two reasons for this: > > (1) When trying to find the BTF ID to attach to in the module, libbpf > uses the BPF_BTF_GET_NEXT_ID command for the bpf() syscall, which > requires global CAP_SYS_ADMIN. > > (2) Even with the issue above fixed, libbpf does not have the token > available at the time it does the BTF iteration. > > The first patch relaxes the kernel's permission check to make it > possible to iterate BTF objects with bpf_token permissions, fixing > issue (1) above. > > Patches 2-4 changes libbpf's behaviour around accessing tokens so that > token loading is done on object creation instead of on load, and passes > in the token when iterating BTF objects in the kernel, fixing issue (2) > above. my bots found few bugs, but overall the series look good to me and the bugs can be fixed in the follow ups. Andrii, please take a look. This is something we discussed for quite some time. > The change in patch 4 temporarily breaks the token selftests because it > relies on the old behaviour. Patch 5 updates the selftests to fix this > up. Finally, patch 6 adds a new test that checks that we can attach > fentry programs to module functions inside a user namespace, which was > the original issue resolved by this series. it's fine.