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=1796380436; b=3RXHVGGDkO6+bDpX79OfFj58vJMllDy3vhoEvw+BZPgH8F92ZS7wgDR2fkTln9SgNjXz a2/nug198P9Yh7fF/x6pnxJ6J8f/sdeMxWrCJTZ1hJ8WPW4TTa9qSw4G5RmQvcZPAZ/rU TxSzBoxvj2mmz7mN76jm3SYlX4+XBUiWPbmiy/OlkbJS3L/bvIudBfmWvMzNDVkzU8pfP M/GgCGXFH3UuyZiRiD+Fq20XODiB0ID2NDi6CHurG9JxCoRFJfbXZ5X6YvQi09CHMo2iY Gr3pRfqmzATZkS2R5aZsgR0gQaotSfTjie5iUSzpd9fUTiVEVJvvnNHK5JWkicHF7mw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380436; 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=qIJWNd7qpOykj1pa0Tlxh0RbgbRiSbcPCIhqE60BGmU=; b=xSSlMpSfRMPkKnj0KNgypkShTjrykBkxT/CovpvIgC4QWGZYjnk5iFktjYCMa6HsiekI eSec/jslOJxcK6cpLdtY5QVxzZv4h6KhC5WkiJPDPWT9OfvKsdIl+SctNakG3Mr5h0Nk4 4fJpvIo/Dgke45IISxsPGwnwW15dhLzDYuxSf9HjPXklTHdfL31IaCV71jJlTj6FN2tdU fQxUz9WQFwvsHnJwZKbIWjXyu0co5nMn24F4MWmsDeuqHohzDkGy90iLauB+joaGGHKYU K+gwQoEW+vycH44VJbKSc1hoEn2wZerIMIoDrSRirWSGi2a1wvBCgwDtsn+PZp38fJA== 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=nPHnsyyf; 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 35DFE606A687; Fri, 4 Dec 2026 10:33:56 +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=nPHnsyyf Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C8611F000CE; Fri, 4 Dec 2026 10:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380435; bh=qIJWNd7qpOykj1pa0Tlxh0RbgbRiSbcPCIhqE60BGmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nPHnsyyfznP0TjrcdIgJkYfXbFemce4NgCIuWSB8mcY1jkM7V5x3wrQ+x8AnKzPmL x3lzTD842HVx5rWc32SyK+Nd3B+cHku/zWPMBH0gUnCcSXoj1VoYWWepIP0KUV6fp3 iM1km8IACBVHHvY8X1Sq5WJlu/O4DBCZ/GrV6opc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexei Starovoitov , Sasha Levin Subject: [PATCH 7.3 273/742] bpf: Reserve cookie and ip in the trampoline for tail calls Date: Fri, 4 Dec 2026 19:02:17 +0900 Message-ID: <20261204100642.303509307@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexei Starovoitov [ Upstream commit bf675c92165500367509fc126338ef3dea4611ed ] The trampoline has a session cookie and the address of the function only when the program that is attached asks for them. After a tail call bpf_get_func_ip() returns what is on the stack, and bpf_session_cookie() points to the first argument, which the trampoline passes to the function: KASAN: maybe wild-memory-access in range [0x4141414141414148-0x414141414141414f] RIP: 0010:vfs_truncate+0x32/0x450 Ask for both when the program has a tail call. Fixes: 9b99edcae5c8 ("bpf: Add bpf_get_func_ip helper for tracing programs") Fixes: eeee4239dbb1 ("bpf: support fsession for bpf_session_cookie") Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20261125032938.670542-9-alexei.starovoitov@gmail.com Signed-off-by: Sasha Levin --- kernel/bpf/fixups.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/bpf/fixups.c b/kernel/bpf/fixups.c index 524e6d3de0776..927078bda67be 100644 --- a/kernel/bpf/fixups.c +++ b/kernel/bpf/fixups.c @@ -2018,6 +2018,10 @@ int bpf_do_misc_fixups(struct bpf_verifier_env *env) * the program array. */ prog->cb_access = 1; + prog->call_get_func_ip = 1; + if (prog_type == BPF_PROG_TYPE_TRACING && + (eatype == BPF_TRACE_FSESSION || eatype == BPF_TRACE_FSESSION_MULTI)) + prog->call_session_cookie = 1; if (!bpf_allow_tail_call_in_subprogs(env)) prog->aux->stack_depth = MAX_BPF_STACK; prog->aux->max_pkt_offset = MAX_PACKET_OFF; -- 2.53.0