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=1796383621; b=XsqS8TIbqeOHzU7M+0UFzTRRU0nL3iwKshLVIA8WG3deGNza3hSGWbSe6rEYsBZaerKs fHzooY4NV3WPtNP0wNx+Eyp5/pCi+oGPyagD3Sw+bu/N8RgPuRw7iQDvfvoLBiOTCj5Ch Cey4f1vJyO8Z/xiFjosjI3gIMCjXf406Nvr1cmwtEnz9KhQciIakjP3IAOj1fDc64NgM7 FSV6hVvMRRT+nkZV6j9NHsT0S9QW9rVZv3iy90taQQLtrO3c6lwMiYtcHb0moiEHlrj/l 3PQYtBAEKveD6pUOOR3eKwHdPEeOtmExqsXtoYAkYzm/+osJtALki9EzcUSzR2XIPBg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383621; 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=FWeRMNTHL731MLGG+PEbb0dPWHYo39lZzvbAtIL9VFQ=; b=RowKc9tlsyVJASeXUrVeeOQ2fenwdKcDao2bFF1AY1oQcdH5jnAB26lmQLQH/kda+BkE +Rln075muH/DD5vwbYuUcQbkI6I1tIbLGEJBWqAy8QoFb1SYfry1f5W5BcD3VFhz9p67P ZxRX3pXK5vjzOm5TimMiQqgX0+YSJ+nUMT+/RVWw4WCMIC3ecKAR/WX3/8Wp7kgIVlUe9 K6r78zQIm/bQeugRcqHnE7q9YZdXiJABC5lTtjd56luu4s8vSeiVULt7zAoxiXsJpQ4md C6cp04Y3vVMOIpMdSDtY9tCJB4SrDKRPPL3UuKJ6Cw880jCAPpBaYQiJnmM0T+gTNlw== 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=JIGKMHce; 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 D772D606A32F; Fri, 4 Dec 2026 11:27:01 +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=JIGKMHce Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39E751F00934; Fri, 4 Dec 2026 11:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383621; bh=FWeRMNTHL731MLGG+PEbb0dPWHYo39lZzvbAtIL9VFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JIGKMHceMjMx2nY2ziKYwDA+wK/cjd9UvUfIwOxN/NVdqCzvEB0IdKnD/MzExopDI xMsrSx56LFDyI95itFLCf5enz49yT02Sm13NbGgOoU/KeAylC87HU2snBtfXgcT2hM WC95dQ3sfGbItIIbgMLIEE2Tf97qIAjPfHri8GrY= 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.12 300/555] bpf: dont skip other information if xlated_prog_insns is skipped Date: Fri, 4 Dec 2026 19:05:43 +0900 Message-ID: <20261204100620.774649259@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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 f7a06b3179c57..dbc2646e96a14 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -4795,19 +4795,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