From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386458; b=5oTNB2o5cMf4F/STex5D3QRTg73Zg3zFJSf2OTe6xTL9e+JM67HShGky9ZhOhYs+vjXU CFCUiaPnfLxmk1CGVuVWFp25Vif0w2bSa3vZYnrbXHr2s22qP6uZUSKXrCPfeh8pO4Bqa EOAahUA1tCnwKiYSE9LB60tZOJI2cTsHCkqz8IHJ6iNSlFY1es/OUxh9tSBFZAfUJQZW9 Kl1wmwFGIeaMAyDMq/lcpYOVNGJSSbVpE+6sIqpIKbkyrKZoxMybFoSXiRARiQlWeVT/r apo40UP76//lKZcNCFt1z7uBOHXEVxfuDTzZhlubj6pSZ0xVEZ9ORol7WUR3ODYY3Fw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386458; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=AnajyG7dR0g37YJ0j4IbeycjEkQLiv0ezJP258Vg5CI=; b=DNccc2BLzUO/DOMmtUL2tV8YXPuoaF+9jG4XV8Zsn/ysV+O+plpxxDxrNAJtoTZ4DMrb 8OUFK0Xmj28jsUdVrtKKkCjkXxzNT9/6ueF+31OcrIrtUow2z7pkIUiRusRQKmk8GT0st QK0XEDySHnNnhwQ0CiySRl6Dvx51nh2hOvIhf51gZLLVYR5YZjjll28E0kdSzf0dKnkVs FprCFq1nsce03x78qnbQSkIOgFoQH7Fo8D4xGhnhbjsyJd6fq53+WeUKWqyv6DM8JeqNX lSCJu7kHPkeObxmYQ/00di7P90cFFWR6yyCcGo+FJhzOyP/s0ISryUStBfjGrtDWkfQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=RXHDb58A; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 455E3606A332; Fri, 4 Dec 2026 12:14:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=RXHDb58A Received: by smtp.kernel.org (Postfix) with ESMTPSA id B829C1F000C2; Fri, 4 Dec 2026 12:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386458; bh=AnajyG7dR0g37YJ0j4IbeycjEkQLiv0ezJP258Vg5CI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RXHDb58ANYjdWVMJwSKtSh/66Dt/3m9fIz50Pv9HsuVW3hGTYU+bKtrwb2x8cW89J NM9oowst4mQX3NXcDkn/9PJUc861kLobesth1CLfMI7yqj3QV95PZ/qV1pUkG877EV Bv/Bn/rLZdv9vNLGk4ZNe99iiZ0eZwcDjMn+YZOo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.6 0970/1167] bpf: Require CAP_PERFMON for dumps of xlated insns Date: Fri, 4 Dec 2026 19:06:37 +0900 Message-ID: <20261204100727.458436503@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexei Starovoitov [ Upstream commit b8aa487429d46a72881933c026a6ca2a8e72d6d2 ] The verifier puts addresses of the kernel to insns: for ksyms, inlined helpers and hidden arguments. The dump of xlated insns hides the ones of maps and calls only, the others look like constants by then. Give no dump, as for a blinded program, to who has no CAP_PERFMON and can't read kallsyms. Fixes: 2c78ee898d8f ("bpf: Implement CAP_BPF") Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20261125032938.670542-30-alexei.starovoitov@gmail.com Signed-off-by: Sasha Levin --- kernel/bpf/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 3dfc46a261f58..1b3cb088061f0 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -4622,7 +4622,8 @@ static int bpf_prog_get_info_by_fd(struct file *file, struct bpf_insn *insns_sanitized; bool fault; - if (!prog->blinded || bpf_dump_raw_ok(file->f_cred)) { + /* The verifier puts addresses to ld_imm64 and mov insns */ + if (bpf_dump_raw_ok(file->f_cred) || (!prog->blinded && perfmon_capable())) { insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred); if (!insns_sanitized) return -ENOMEM; -- 2.53.0