From nobody Mon Nov 25 10:41:06 2024 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1287E1E0DB2; Mon, 28 Oct 2024 19:11:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142679; cv=none; b=cJWws71NPvnbC1HBuEhKFX+v9o+6isjfSq3uXQIjyF5G+BP8guTaz62VDHtRxe72jnsm1093ra03ExScPFv6o4y4LeV33gm8gbPfNiL7t+xmr+GB9lq1TvI4riYI4dIc2C5TqJedo9ig1WVGV0htU7RS4/5CGEba2+N4xw7LDdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730142679; c=relaxed/simple; bh=oe4SEYpQcTZHF0AxYZqODo9TxSAdD2NyXwBNnVcz1u0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=unX5GeQSF06/njLEcYxMuebrjCVOtgUxyNRe0FLe2IIYfNWmKcPq1E44XPnlC9AR2RDsvuwCWTKqK2blRgWCIFq4c0yHZBKIZ1KxQncaySeA809bFTR1Ye0Gl8BGzfWrD0rpE5MuKYa1aJFlTlPiZT3Q0lUpg8fyxOIreeGnGvI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=nHdTMwJX; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="nHdTMwJX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1730142676; bh=oe4SEYpQcTZHF0AxYZqODo9TxSAdD2NyXwBNnVcz1u0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nHdTMwJXTbvmuXGKKeTxcGet3NeRKeaG41zIXPHPhwWibKhpHTCzvWNfTOjcz2ybW pWaR7k1xxbPmj4oQD2W2PQ1O3gQwPPgG6soAhOD9biW/+p90IPVFPrP+qKxJW7WqvH FMMsxM/RQ4pg+1rC++s0MGzdN1O86Na6ERsggzoD0q+iKPcVWwAsGbqZds/EOBQQG6 SnE7xV/DEjzlvlvd91333KyHh67ChHI4P80Z4bXBVBU+OVO+whqbz0OLpwmrKMvZFH ykAb/8ng42EGPr9X8u0sDfh5pwRMWoKBMbs+fVqBMGk0g2c5H5HcHnY1vKLW1A2UG0 TwRRWVuXiiV4g== Received: from thinkos.internal.efficios.com (96-127-217-162.qc.cable.ebox.net [96.127.217.162]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4XcjfW5Xtlzs8q; Mon, 28 Oct 2024 15:11:15 -0400 (EDT) From: Mathieu Desnoyers To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Thomas Gleixner , Michael Jeanson , Masami Hiramatsu , Peter Zijlstra , Alexei Starovoitov , Yonghong Song , "Paul E . McKenney" , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Andrii Nakryiko , bpf@vger.kernel.org, Joel Fernandes , Jordan Rife Subject: [RFC PATCH v4 4/4] tracing: Add might_fault() check in __DO_TRACE() for syscall Date: Mon, 28 Oct 2024 15:09:27 -0400 Message-Id: <20241028190927.648953-5-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241028190927.648953-1-mathieu.desnoyers@efficios.com> References: <20241028190927.648953-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Catch incorrect use of syscall tracepoints even if no probes are registered by adding a might_fault() check in __DO_TRACE() when syscall=3D1. Suggested-by: Thomas Gleixner Signed-off-by: Mathieu Desnoyers Cc: Thomas Gleixner Cc: Michael Jeanson Cc: Steven Rostedt Cc: Masami Hiramatsu Cc: Peter Zijlstra Cc: Alexei Starovoitov Cc: Yonghong Song Cc: Paul E. McKenney Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Namhyung Kim Cc: Andrii Nakryiko Cc: bpf@vger.kernel.org Cc: Joel Fernandes Cc: Jordan Rife Tested-by: Jordan Rife --- include/linux/tracepoint.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 259f0ab4ece6..7bed499b7055 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -226,10 +226,12 @@ static inline struct tracepoint *tracepoint_ptr_deref= (tracepoint_ptr_t *p) if (!(cond)) \ return; \ \ - if (syscall) \ + if (syscall) { \ rcu_read_lock_trace(); \ - else \ + might_fault(); \ + } else { \ preempt_disable_notrace(); \ + } \ \ __DO_TRACE_CALL(name, TP_ARGS(args)); \ \ --=20 2.39.5