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=1796389156; b=4g/wm/IsFhqSoqvgS8FEIZn0j/wgs9gTO2pwdUGTdLyn12Fbfkg6zhyBrZUviEm73B8j kFrkyeMf+240OHZ6h9LeBd1MRNi4Wo3JPTlaT02QKUC54fZR4EoSKyvQg8qUWlrgNu8Hw PzYKf9oEMpCbUu24Xwv0yFfNbQFwNEXgErlXNQ/yN7GdmIGKP+Js3ZjpPpAUM4FrVuUWI g8HJ14vPMKiQ2FzQDUwsOBjOnRJiw8PraxHzWBRNd8/u+zd0la7NGWPq9ctkbjadkurrt H6Ab73OkPB1SSh1hkSAOagC3eZsxqpgKKbkR3iIXOTTsgWUhtGW0DUfZUcE5b4uXwDQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389156; 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=CCS/sZs/ljOiv5XbSBd2SfXLwJwvdeddg0O6AKJrm3Q=; b=lgeXMq2RrgiOHBPjEZ6h3iUqAXJP62lW9c0ItqA7+zdjGSN+nWWwEtbfIG5cCCG06h5+ n9ggIKiCev0AdTqXWsWx+7zxwPjHVFGeWyk/Wkk4vdeP2UiTPYBoSpesCacgVaSyNcuWi ZQGAxC21otyTfy5sDirGcjx64/ZGQMU6Nknf13HwQUragw/UqG7nrQRrvMLZERCFG74rA D9ICWT1fvLVpdnhSQDnCOmQppE4TSNexrwIS/e155196FMm2X4uJmtBnWmLpDGA2miOmQ 6kcoTKBuBYAiJwnXuBfsl7+r3V8Z7oM0hrwRVMkTbITDLYxrbXcxvasUPf1hdmR/u/Q== 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=1yE0v0mN; 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 C1DFE606A338; Fri, 4 Dec 2026 12:59:16 +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=1yE0v0mN Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3695F1F00933; Fri, 4 Dec 2026 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389156; bh=CCS/sZs/ljOiv5XbSBd2SfXLwJwvdeddg0O6AKJrm3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1yE0v0mNtfMOzdilbq6TF3XjJX3SkrKZ0QDvWWCRX7M+Lz4i6Cs1pgi2FSMtUxvOP 8WzXucjcQdZSz7g6i4i4B0rK5TtzAD/cjTJI4q0+Nkf8QrIVcPLCT/j9SeItQLU7Lx JbCpvBYH7uQj+Zh7e1HDGxfHAK2kmScQ3kS8NYog= 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.1 0883/1059] bpf: dont skip other information if xlated_prog_insns is skipped Date: Fri, 4 Dec 2026 19:06:54 +0900 Message-ID: <20261204100706.887075660@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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 4d1a3523105ef..87fc358fc8775 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -4103,19 +4103,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_dev_bound(prog->aux)) { -- 2.53.0