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=1796382113; b=TmFasj12DgaOkuTBIu2BigfNVWKHbC5NTHDBNyXDrlFGqxaFldx07pFKZGT6gaam80bE Qd/wOKVwqvGv63HYFCC6/VUDdAIIdGIAoOkxA9KxWNtEerD9FSQIU5sJFtrYcJiSf1wG/ Z3XkhBnkx7LId4JYYvWlwKpZKJOgBlh4Q1DXivuVTRxjgWkKr8S6Neb+K/0RvNLyszQIq p9DGZHtv9zK/z6V77rkA4ZrqWBK/PrjhVDqhH8cfZ8GXFWM3hj5YqJp5lSYCAX45Ztz9i 07Uf0XK30+h0PBU3b7Tf9Hv6HkTBhSs15XDdRxTPkDvt9CL7YPiVEiSu/Blg3mQQkzg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382113; 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=7KarJhLWdr0k00AfqURh1XKQ6CGzuaeBx9seZgGc5SY=; b=D1aojnkDis5aN1Hes/c+fjC8xoOAcyTCAT7mB8fKTjlXo6+VJ/NneRUnGy7MlNsbmAjW dTdYb5Bm6m1CTGahRJM8o0xh942dtMOFdmcJ1xruQGRjZBWTEZIjGERUl25h1DJPgIh7r VoHGosOY6L6nyfLrk/WdhkHJsrqmHulyStJUvue8fZFbbgUmz0Dv+E7G/NtKbuttH6IZW tM+RGGIk/2u+CzK0Dx8Fx7A4WwK2N3mfTj3++s/Ogi9qA1YAfnI2RfBcnlJZQ48OKuvyy 7H51MtrgZY9A43tumRh+ovadi3v8IeMG+zMAm7LY4gG7IdwQzI7HjBbTU5vS35jXj1Q== 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=fWKXvMHD; 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 A9353606A334; Fri, 4 Dec 2026 11:01:53 +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=fWKXvMHD Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5F4D1F000CE; Fri, 4 Dec 2026 11:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382113; bh=7KarJhLWdr0k00AfqURh1XKQ6CGzuaeBx9seZgGc5SY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fWKXvMHDFC+faAZzuZ15z0KZqlQ6Fg0fpbgId5vBVB39ZmjWAhJDqeLrmjRzg2Bj/ x1i1D3JirJrD2w8Z9hfbevhBhS7oaPAc7HseeINwbaW2YQ8dzvIgd3IMXr1RlT08ak h5Z6VYd/2PU47oF3/17iHP5/zQs6j3iL9RxmgZS0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Max Altgelt , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.18 312/703] bpf: dont skip other information if xlated_prog_insns is skipped Date: Fri, 4 Dec 2026 19:03:31 +0900 Message-ID: <20261204100636.081666758@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Altgelt, Max (Nextron) [ Upstream commit 4722981cca373a338bbcf3a93ecf7144a892b03b ] If xlated_prog_insns should not be exposed, other information (such as func_info) still can and should be filled in. Therefore, instead of directly terminating in this case, continue with the normal flow. Signed-off-by: Max Altgelt Link: https://lore.kernel.org/r/efd00fcec5e3e247af551632726e2a90c105fbd8.camel@nextron-systems.com Signed-off-by: Alexei Starovoitov Stable-dep-of: b8aa487429d4 ("bpf: Require CAP_PERFMON for dumps of xlated insns") Signed-off-by: Sasha Levin --- kernel/bpf/syscall.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 24a853c777cef..40738a2354d10 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5092,19 +5092,19 @@ 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)) { + if (!prog->blinded || bpf_dump_raw_ok(file->f_cred)) { + insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred); + if (!insns_sanitized) + return -ENOMEM; + uinsns = u64_to_user_ptr(info.xlated_prog_insns); + ulen = min_t(u32, info.xlated_prog_len, ulen); + fault = copy_to_user(uinsns, insns_sanitized, ulen); + kfree(insns_sanitized); + if (fault) + return -EFAULT; + } else { info.xlated_prog_insns = 0; - goto done; } - insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred); - if (!insns_sanitized) - return -ENOMEM; - uinsns = u64_to_user_ptr(info.xlated_prog_insns); - ulen = min_t(u32, info.xlated_prog_len, ulen); - fault = copy_to_user(uinsns, insns_sanitized, ulen); - kfree(insns_sanitized); - if (fault) - return -EFAULT; } if (bpf_prog_is_offloaded(prog->aux)) { -- 2.53.0