From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796398508; b=dFmyMIIcekw086IDHOooCdBa9GL8QuDaqFGQLEgaB/V89+POdKwUQNKvRHr1tsNKOah2 eoo+IJhjZAjooZTCduetxIMFEievWGr32B6TpoN5JXKlPXUMcKF8+yZvWMHuhkkE3Hjlx xs/Os72wnnNVpHrUZOGBXTpl1EznT0tfdp5lbOeOO2ubQgRvZMI+Ld/yNMmvL8fqvIeK9 1jy4gz3aPXdIC9KgZfDfRGxvQ5qHLScw8W3nPW3VTuIh+fn6Bup5KbzxKZRwfP0S0+h5H OAp2c7uhMzewY8pF2FeB3JRkIfGpwQog03fp+lNEGFKgHknuX+C0a9atSR3gtWmJhNw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796398508; 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=S1kKArmFbRbifSni5jmhmr4y94LFZ+hWy30i4STK+42NAH6N78Tp2lo9A3DHbDhIWt1p MxIs5GUwBf+84RlfvulvlPUsapuSrVCKEbjj5yE67ZqeSP9TjKaUvK7AKU5DBIJ7xtAzS Rh2dbAPdcWJ3HMIBr/Lp/sV6LVEH4KORN3EY0gvBzjn14ZSuFgecMuK1fP3JCkbTD3Omb /PalJ3vE9b72qUDVLyl9aPWGgCppEu+Mnfk8Rja+6CUHa8Xtv3Lspc15wyFBUhAR+W6Fs 0rnsYo4W9kIXh0jFy57sL6w+N8qlbRE/ivAteF5jQp8MQ06Vsthk+UdF4kE8IZXiL8g== 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.47 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 7DB15606A32D for ; Fri, 4 Dec 2026 15:35:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7DB15606A32D 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-f47.google.com with SMTP id ffacd0b85a97d-4c84abcb7bdso679829f8f.1 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=yFnfsQiOM4vAiMBM516Y3JWbTWCpES2bsGqvz7xpikSj4pAqEddSjdASQuZO5+qWoG Boxdoo4ub30LoaCd6tlUZRdQ238ou/AKe1qa7bIBs2u1ZPQIcTADFpYWhl82cQzCQ1ID BA3U37lTuQUV+zdVbMJ16rqaKiY4oT1jN4UPWAoYA91g+rB9rnkiU9q1CvqwcKo6HsSf +Fm8IPa0nRkRE7srGZGPeHnHjLHC2LQTZt9TgzIMMTfI+1ECfR6R9Z7ZQEFbag0s+oUE +zMiZPwcSMKOJx2sMY8IhQ/v1PldxAm5vLy7Czlv0hWb7xVe88xTQRcJ4C3XKBE6psde l4nA== X-Forwarded-Encrypted: i=1; AL+hErGE4tabD315mQnKGvQg1E6KE1lzvnK1Czulpbsy/bui6yJS+cED69sbuo0aAUOl9lJWqGYq6FquYi+LbJM=@vger.kernel.org X-Gm-Message-State: AB4q+uFwe9Mc5BtDk0CJedsz9bicu3xk4vwXAy4j9BYuGVaCAWozoU3A n8M2SQt8HLEci/ycEIYONzuDCjnM8l9AD48D2FvVL1BAnw5Lp7Hdp290 X-Gm-Gg: AZFdTZeA+qU4oJR0SXoz+3KTXQxleK+BGYH+1ERXACGV24VtBqP1l3bNNquiuSfVodE YdDdUulmN3hfHU3SWFCd16gTXry0Gz29Zg9qtfZLoBW3iCRDT5y3VnuzwJnuO2Nf9wmeHtx6/i8 6jJ2ThNuu7gG3FXLX1xF9DjYDPd9lYj/+caQiMjzlIrx54gJGmPbDH6VpRlb1JJE14RfzIGu8Nh gMABDh7sJ1E14xWj/hdexyHtBE0qEBhJtIk1eKtnOIFG+6awgfHKetaNrKbgcyA/vdKPAwTHFK0 W9ferxUwYm92INhWHAxE4Syhnvh8Dizr1S2n57QnXq4w4vKl+RfGSOJtzUZXr4+1CaI1Z1sWLHu pVVeYvwxRJuuComL1xQ3ZhM2KoCpbWxTUnt3BWMaNKGfXPUqhYszIKaDpHvKcDkRQ9hhwwstkKw W50k1oEC+kNe3Ga16nfx8O/uQy9ZVGnTjG+TbPay0a5P58i9EJzXoVz0OzHY5nClvSOqbwYKXFF 3vGv3y+ctmR1a6j8r+0JLuqW8UYIh9xFdSXM7Zqnq0dzn0CeBH829Alwhw1+dckfp88fALbBhpj M/bNBRcm2pB8md0QRDvAcWYZgTSnB5NMC5fWDVFUSdudLC66Spu6K6uYx1HHoOcHV5ViYJPkuUi SRjOgeakefdgDIxNonW7A2A== 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-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