From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796398509; b=zNL+NUl5PbBwfya7tKREftrEhndcIbsSbsi63uS3UGgfcJld7JVByFYNzwbO2UQtgDMR pZz3iPSpvxuFYb19Zt1V0tdGZBZE3O3xMK8kqNvPlebCAd5nEjfnqr/B/tKBzGfVVo9BB M+eak/qSH2GRn32hc//7p0XRdSY3JoEIHQWeML/9oGF/bv6FgK888lgS1+2AHtJ0tSKWh oVPAWmBSnK+llyXXzLzNDNIxXb8otC265gWPT5be7q06SO3aD7UYHVvJS2IFo9wIspb8c kfvcSytHNbC8EVa6QRAPYa25Jr+xH7mWs63dyqKWIHbZrUerRPBl8apsxmdD2U4dyxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796398509; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=5oc7hD3C0jpVY6QB6xz/jbMFTgxFxB13aywSlFSthMU=; b=EsmF5OdmqspWh+nviuJ1MX3SRv8JLNoKHPmFNY+8UzXF0VRl9NhKTzKopPYNuvxn257w XKGo2BydFh1t/Jiw7WL0iSt9dsGIuxfaUii1xNYxpUHsyaYp7IOp35wkll8lxIBXXycpM g5ZOL99ab1ALyaUjEInOchUnVcu+611LihBP1290Bw23ed+U/wEvwwQw+bQ3NeU4X/ISv 6FxZpWGWrurTucw0/bJ9+g0rH6Pn+Pchk3NY80rlprrV+Pvm08zmQPS/GRyZOxUgncBKf T8BJ9ec3OtJPmW+tnCsm+hy9BKUm72HMsc72+n7PrQiRdtfHOjSEIQO+tcxiGBWeJ8w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=QFGUvRJ5; arc=none smtp.remote-ip=209.85.221.45 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B87A606A32C for ; Fri, 4 Dec 2026 15:35:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7B87A606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=QFGUvRJ5 Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-492fcbfaa88so690325f8f.3 for ; Fri, 04 Dec 2026 07:35:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796398507; x=1797003307; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=5oc7hD3C0jpVY6QB6xz/jbMFTgxFxB13aywSlFSthMU=; b=QFGUvRJ5fRTJsixutnKPBv8e62y76vFtUfRAgSBixZ+zyjDK0s5t75ZWkg9SlpqPvh LNZkOygU5rWeVp+xA3U/q6zja3sMNf0Mxz7buO/UwRh7PPoXjUtKyKEQpy5nB3Pa+6W8 pPzfMwv9GltsX9pbqEb5pR0FSo1eNzlS2vpouJSOHrz8PTvm9BDWErlKgV9viv89N6eq jxP5JyYU9/JtjbKN3Ebol3PNLy+md5dyLrhxlNp/s5IRNvD/N1Q/s/bsz/GNZ2DCZ7mg kM1ifpp6X5uJogVBk3z9p/t3FY70uxx39+FJ7x1qo7aaP79PJvwHwpeTCuF4vittfkiz xPdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796398507; x=1797003307; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=5oc7hD3C0jpVY6QB6xz/jbMFTgxFxB13aywSlFSthMU=; b=VggiHWN1BLpys1zL+su9XxZKntzDIm4A1QMRKlurjlZrnqH7bDIz7BsfPxY1QOy21L SUdvAPne2MG7OqvrZaZuQokIWnulfyv56lH72d/48mHtUONkaS2TGUBXiHBYB6G+IZ/J dl/LcpvXl/rQrg8DFBEffV3t41EpYM7WsWcRtQORYSiYmvFqkblnx1nbcsVOqKY68kQ7 muxEc3dwI853fxmqvvMY9OMtx4VGj2wb6uqKAL3rsrb284wYVyY6KzlLx1fR/Dlrug4q /8SbsZhzaSyF0NAyyx3aUm0PTtiDLoX/tJD2WMsY2FSS0vKIJwuUdtZvDeYvHc2WpZgC iO1A== X-Forwarded-Encrypted: i=1; AL+hErEHfRPAs+7D8YB/e6UE6hY4lNWylFQoWrXqCXzQk1kevZKTGNF2JvIZggsPGZOPF6kPQgmlOR/qjLB7YPRv6oLiOKE=@vger.kernel.org X-Gm-Message-State: AB4q+uHydDpAbkfb8rJij3ECBKZPw6vznPvaJ9KR/xcc0ruzbH5WA1A+ nHgUaq5xpkJiGBYYb6JeRBJJ86DiRC1i+IdRlRjH6bVMSCd8gTxz7kVhlGictg== X-Gm-Gg: AZFdTZe+XOmsAslFHaqw9/MNg7F8JK7FkJgc+eMIXSkm7gh/Vnq3ahd9H8KucQ8xlyZ OZmTU6cj3bXXPRAN+Vs8/KaX0Z4bwgKRool8kttfCY57csBf+Uu7w8pECkh7plszlXNhudNZYjB xu7u9ezrcNFZEwd9U0L5oyl5mNhdB/efCxn8amqatHKq4bmk533XCIt3/8j7vP3iyRhVnMK7MbS DEZPXllm40jN7Ldr07Ak2URBXEvCGOlhy98JOKZ//UWMkLFWSbobjujIJEq1mEmPCqF5+ox6WKG 4TrQlHaeXjSOvfS/TkTPyd+QL3yc/+CWA0eubmz/ffUI4+rEjbupgfYPj73L3dprbyZGKEz1Crv Bx5++6C+ZPUHdofWa5SPrlzUpQEw2i+aMt6abr9vUwfIukmYwHWvcY+cfMGQXj9G24Wbb240i/9 emNVi5h5CcYWB2KJJFt1J40ZEHtUSPrnWpVWoeDwxU49EmtBhLkwKH+F+EWeRRADvFK1XHTTFY0 Zb6fjMhSoRp5zWIQ+oREPc6mWMOXXemri+U7t2nbFBAF4zSA/kl4oQ1JsdQVaVazL4zbLvI5tf/ STyVqzlcn6a/JDFd4vbFS9WI7AyjWJGSOhpqSkllBKUYz0PkXsNXf4w4T/xHBKg9dmIhAM8HKIj p9ELwaSWwefD8vUagUKDw1A== X-Received: by 2002:a05:6000:603:b0:49a:fbfd:92c4 with SMTP id ffacd0b85a97d-4d1ea69e2ecmr4820380f8f.29.1796398506657; Fri, 04 Dec 2026 07:35:06 -0800 (PST) Received: from andreayoga.wind3.hub ([31.189.39.21]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d173ab8d22sm5874897f8f.39.2026.12.04.07.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 07:35:06 -0800 (PST) From: Andrea Parri To: Steven Rostedt , Masami Hiramatsu Cc: Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 0/2] tracepoint: Fix stale probe data in system call tracepoints Date: Fri, 4 Dec 2026 16:34:49 +0100 Message-ID: <20261204153452.17096-1-parri.andrea@gmail.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-trace-kernel@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 System call tracepoints protect their probes with RCU Tasks Trace only, but switching a static call to a single probe waits only for RCU and tracepoint_srcu readers. A preempted reader can then call the new probe with the old probe's data, and crash in ftrace_syscall_enter() or bpf_trace_run2(). Patch 1 fixes this by keeping the static call of faultable tracepoints on __traceiter_*(), which loads each probe together with its data. Patch 2 drops what faultable tracepoints no longer need: the static call update and the grace period snapshots and waits. Patch 1 alone fixes the bug, so patch 2 can wait for the next merge window, or be squashed into patch 1 if that is preferred. Tested on v7.4-rc5 in x86-64 KVM guests, with the test-only hook below the --- of patch 1, which also has the reproducer for 2 -> 1. Both race sequences oops in 3 of 3 runs without the series, and in none with patch 1 alone or with both patches. ftracetest: 164 passed, 0 failed in all three cases. With perf_syscall_enter() as the only sys_enter probe, getppid() takes 153.6 ns with the series and 153.2 ns without it. With patch 1 alone, whose reader path is the same, another pair of builds measured 155.9 and 153.7 ns: a difference of 2.2 ns, against 0.4 ns for the series. The bug was found with the help of an LLM, which was also used to write both patches, their changelogs and the tests. Andrea Parri (2): tracepoint: Always use the iterator for faultable tracepoints tracepoint: Drop static call switching for faultable tracepoints kernel/tracepoint.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) -- 2.53.0