From nobody Mon Nov 25 05:10:18 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 50FE61F427F; Wed, 30 Oct 2024 14:48:18 +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=1730299700; cv=none; b=mmtDhJbvSAydyOwA0ZffmaL7DNGisj23qIeiSuuPgKHGWneUd/VVdMtCBQTY0jwC+1CXGeGBS2BDhbSOx4RXOGeKxAt5hwQHU/+fuSYWlO2quSyNIKnvp5mc8WQzi8wv1GWW6bStdqMClsWkiUUp0/d6V+Ex5FYAYwmmAl0FKzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730299700; c=relaxed/simple; bh=fZ4aXsvx9pf6rtAgOnrIQ2yOSxwJ5B0XGke7hbnZHrA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F4sa2RB/LK2RIACZQzhgwiHU71PW43L2qfS8mPpCUZ6q0/ghn0Q5rD+FWN5ZBFIUMN7RbfVDVznavFOWmKjUsF+8edBOZdBrU7XVOLMVVzT9EcbFZtv7QB4otGh/asB9F2YTVK9KYD9CMzuqwmbLHvbbQJDe1YaEdc+14sWKv3g= 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=X1xVI4KX; 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="X1xVI4KX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1730299697; bh=fZ4aXsvx9pf6rtAgOnrIQ2yOSxwJ5B0XGke7hbnZHrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1xVI4KXD5WGCrUqrtHtzsSmRw7bZlyK/DVPDejOoaFqVc6mjCyIHq2l2rhQ9JMx2 ikYEPrdOpApryDWpVMrlFApAbudYJWmgvY8CIWF905Hl63o+m7guPatxoPDzT1DXLp nikxWQkGqfRx4zIOuSV2anayN3TjnePiTAZPOYo/9W5R5tgnJHvrcPEpfl3uJ1O2yv 2Z9WWSD38e1VWpUvkn5TJJmZ9IO0Q2upOtnF2/PnuO7LIsmMtndehfYOHa/y0n1MSV ZOKtM6IFBMOclefZXb7kMooK7n5AJG+CZlpPj5mdLM9Qhj463zr6KaOgVSTWdLDfs9 VuYnP28by7IiA== 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 4Xdqk86zmpzL6D; Wed, 30 Oct 2024 10:48:16 -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: [PATCH v5 4/4] tracing: Add might_fault() check in __DECLARE_TRACE_SYSCALL Date: Wed, 30 Oct 2024 10:46:34 -0400 Message-Id: <20241030144634.721630-5-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241030144634.721630-1-mathieu.desnoyers@efficios.com> References: <20241030144634.721630-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 trace_##name() emitted by __DECLARE_TRACE_SYSCALL. Suggested-by: Thomas Gleixner Tested-by: Jordan Rife 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 --- Changes since v4: - Move might_fault() to trace_##name() emitted by __DECLARE_TRACE_SYSCALL so it is validated even when the tracepoint is disabled. --- include/linux/tracepoint.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 906f3091d23d..425123e921ac 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -301,6 +301,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(t= racepoint_ptr_t *p) __DECLARE_TRACE_COMMON(name, PARAMS(proto), PARAMS(args), cond, PARAMS(da= ta_proto)) \ static inline void trace_##name(proto) \ { \ + might_fault(); \ if (static_branch_unlikely(&__tracepoint_##name.key)) \ __DO_TRACE(name, \ TP_ARGS(args), \ --=20 2.39.5