From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796399508; b=GxtknonFZGYp+4QRkjZwNAETvHI9qBCXKoisuapceDzItPjJqsAR9o8eE2Str5QpFOOs dBBgox7eR3rzh90w2YhzFV90fV6cpbm/ikdQPKKvUOK2xCp528w90uRb+d+Jkb93eqgiF 7G1I8UGKLIosCPpevzBC5rp1ZxuHiY4fzPPbhi4NI3uqupd3eTs7hufpDL9vXC2kqdw6G WB1IS62sHcQKKdOG2S+eeGf1+qsw/ewltdd/Y+/q0ofmb46I6pbuL1QH786t2nfz5HSw6 8MQt0kv8r+9wOBmDn89gV6tfh0XLpW1kgQHznp2Wvk3usVJ0tR+ho+ckGzcJ09TMf9Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796399508; 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:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=sXUOA0qyB1Zo7PYKrgfh77cbqCaXZz2488xGtyAxRbw=; b=qNARq80DzHvc8NjJN8Rh2dtoEwppDsydf88aPIrHySosVk39ObHTTHFzJV4aMScR+sLg nPlqDWXBgsc34Hus/IVPm4b+7WJNXBmfP69N+Hze9F4LLDmiAmQDsQVBdeTK3wqjGf59S 0HrvsEgp/s+X8HQ1UEUWg9gEVNlqparki83xEsgxyRf1b0ucZbqIgXYMKlAMX+VhZ+02t 8tC+UlJ04WCsvOfrIRKVRR52PknjpB+D1ZiKLS/Yp0U5xcv7bBV56qrifo9tJrRALTtcL BhumwrsIjKDRtr7eSeRi1kZQBMSlXXNweIv9se/MGs4WoCnoO1uF3Vc6Kv83Apx0gXw== 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="x/mB8Is0"; arc=none smtp.remote-ip=209.85.128.43 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 A7DAF606A32D for ; Fri, 4 Dec 2026 15:51:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A7DAF606A32D 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=x/mB8Is0 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4a35a60499eso6818275e9.0 for ; Fri, 04 Dec 2026 07:51:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796399506; x=1797004306; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sXUOA0qyB1Zo7PYKrgfh77cbqCaXZz2488xGtyAxRbw=; b=x/mB8Is0Qhtu4sbsIrM3hOw0Dva2EjAmraTcuEdrsmsrzI9T92l8ynTfFm3dApxJDK WBOhhrwtY3+IvA9xdPjRHWzNSMVLEN+qG5E343d4eGXTW3qHcl8gzkbjTo64bfZDPfuh RD4+/3zwIxf1C4SEEZk7hoIgGGYGhU4LJ2YDIl9EeLArjcYhXw/9VUJGtDph2OZFpJng loENhblFOpHTd6Uf+6S9OGAL4KmJgNQ6AZh9DlhzvZ/xSq97TrrBXs0NFy6KdbnMxuV0 ak+tX8qfo6fP923CLQdBxA9zjxEfZz9ZdtoIqNwegiXOHxffQHg3JwlufEgdSxdpbrF8 v9qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796399506; x=1797004306; h=content-transfer-encoding:mime-version:references:in-reply-to :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=sXUOA0qyB1Zo7PYKrgfh77cbqCaXZz2488xGtyAxRbw=; b=vaJMrXeuT5htpTCWiwvJeDCR0G8dugcwvoTBCxTomKNRhjVqLp4Ws6x6AzMd1LVeZE 3yhk3mBJ4HOPCrU/aK3E7drbhjoR6Ku8C/5Q0iHPNb5N85S8pKs5+ppOce5H/LrhQnHh 7uClEyDOVFz9gyie2ZiNuMDlAPBTyuJjHkKAfYQ1k4vq4O7R1V1dmUAo3DBORrzaQS9O PpuLGpR7x4Mrb/YvQctpVvxbmeRvIc7n9VkxSuFbxvhEp+HHHZyecjYiPp3+d65andQ3 Ivz//gDO1xL4H8H4VNjzWclTM/hu1v+GsfFso+dJDgr9kt942G/pZRdTlBIZ6Y4fU+7y rpFw== X-Forwarded-Encrypted: i=1; AL+hErED8fSqXGUePc2iQ2LkBxcRcQrwua46zCqHxW++11RVb/VsJcp6YBgCAj57cIoBmsA1K4gqXQGXCvCfyVE=@vger.kernel.org X-Gm-Message-State: APuU4Z8qAuiGAMHAQFKg+JyHOs4DAhg4+hml87TPlGrrPne87y/IoOEG g80q7OeYYHHjhoG1ATKTNZuRoioJvhJPY5bY3qZfLW2xgHgGK6QppYae X-Gm-Gg: AZFdTZdT4dmxdwRLzrAtAmhTkze/75VzcghUznDZ4DBlJK2FrAiFoD7BhunaIp2JxHH 7yvD4UwLbCOKhTzOOHbKqFFcHfrXHIRD2glDiTuID3/ACY/JLkTzOB7kdV3DXegLNaYyDcYvKHF T7JrI0OZfNI4Kshf4Vv9tRPVKDB4j835IqCJc6hJIigUWO/Rs84fhskGg4RASHVDtFNMpcPA29I 1Vt/q1Rd9ujR8nMjxWDw4cp/WPKx94W3V8t3mzpeM0ETyOMkI+zswc09wwlYTA99ayCctJzGFEW BnaNFWdE/drWltpFx9G1BnFMH8jUXO5rDTpVlnipCjsprnofmuSal1L4MilzpHE0EH1FfSontqH G0Fx+BK0vb2N5GPERzzLu+p0lQ4IZ+E2aGGGujHH1ZImPFhqDPgvI3mGFQJfMSjD/G1qOPFGJhJ 8Vn/9kJGUB0DqmvrFwpicp89N5RF68SWelNTIN4iSSY3Jp91x6rv6GowG3O4RhBDa0lGj0bazSi 5y1r4AXyXSF+XLzFaEKRxqhBqdg+ot5InGk7DjqAfkBdOnIqbBAUNpPg54E11iDaftlySTsIqfY jUBv155HLuOLTtkv8xvQrPFmLIcNkI0HlN1ATGEorHfzVRzqwSy1F+4yjgB4J8Q8hqXvaVTrw90 V X-Received: by 2002:a05:600c:1d0d:b0:4bb:5c97:f4b1 with SMTP id 5b1f17b1804b1-4bbeb8e0cb7mr52511615e9.24.1796399505833; Fri, 04 Dec 2026 07:51:45 -0800 (PST) Received: from andreayoga.wind3.hub ([31.189.39.21]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbeb6fb7casm39406875e9.4.2026.12.04.07.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 07:51:45 -0800 (PST) From: Andrea Parri To: Mathieu Desnoyers Cc: Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH 0/2] tracepoint: Fix stale probe data in system call tracepoints Date: Fri, 4 Dec 2026 16:51:29 +0100 Message-ID: <20261204155131.24670-1-parri.andrea@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: <20261204153452.17096-1-parri.andrea@gmail.com> 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 On Fri, Dec 04, 2026 at 10:41:13AM -0500, Mathieu Desnoyers wrote: > Why not just fix tp_rcu_cond_sync() to handle the rcu tasks trace > sychronization which seems to be missing ? That was my first version: tp_rcu_get_state() also took a polled snapshot of rcu_tasks_trace_srcu_struct for faultable tracepoints, and tp_rcu_cond_sync() waited for it if it had not elapsed yet. It closes the race, but the wait runs under tracepoints_mutex, and the read-side sections of the system call tracepoints are not bounded: their probes can fault in user memory, and sleepable BPF programs can attach there too. How long a fault takes is up to whoever backs the memory, a userfaultfd handler for example. With a sys_enter_write probe parked in a userfaultfd fault, I disabled that event and then attached a BPF raw tracepoint to sched_switch. The attach blocked until the fault was resolved (it was still blocked after 3 s, on v7.4-rc4): __synchronize_srcu+0x92/0xd0 tracepoint_add_func+0x2b5/0x480 tracepoint_probe_register_prio_may_exist+0x6d/0xa0 bpf_raw_tp_link_attach+0x1c2/0x2a0 The snapshots are shared by all tracepoints, so the wait also hits registrations on unrelated tracepoints such as sched_switch. Keeping the Tasks Trace snapshot per tracepoint would avoid that, but a sys_enter or sys_exit registration could still sleep on the fault with tracepoints_mutex held, and every other probe registration and unregistration would queue behind it. Keeping the iterator for faultable tracepoints removes the need for that wait, at the cost of an indirect call while the tracepoint has a single probe. Thanks, Andrea