From nobody Thu Nov 28 19:41:19 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 16C3619ABBF; Mon, 30 Sep 2024 19:26:34 +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=1727724396; cv=none; b=PHCq563g4HfitRoK49q1xrKuMkUWLO6jjh/lhxx6gQmsmEZJvnpTwOW6Fi0QbVNcaP0WVKBIqGcv8wx0ANVbY3RejIx0wA7Ddlejk19aDhzYFU1Dn5SdwtpfJgc8aULsdsMrNrIwSflK6RmVL5Vz3V7JunUdUEYvLqDs4emyN8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727724396; c=relaxed/simple; bh=uJq5iVZHWqF4O/NYGe5n5RCWahHYrd6IuFGzrAbE8HA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sBijP6yIbUesc5uNBwkvbgdMVkRPkibtqQNUfgvgMTswimhSNrdZhGMhzuKH/XzVc1eBKlirk7W8PSGXIrprw9EOO2g+1GD7XL+/19Gckre5ZpdULoyR5as/c7oXKSyWOIOOG2pAZuT9yPXnUBeLv0BdndwAMusYPcvUK/OBuP0= 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=DzJswE9l; 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="DzJswE9l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1727724393; bh=uJq5iVZHWqF4O/NYGe5n5RCWahHYrd6IuFGzrAbE8HA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DzJswE9lhCMGSOmCKReyUyVVhmOBXeU8K7m5f+lyNu0uePwzjqSoUt4H3LhZn16nR MYQCedfyWFqOsjs63WEcrb4y+sPH4rMAL69I4C6JiguQSrHEBxYP8bTzxzgeHPKzdG +5IX8WKYVa365SqASWSDXDwQjnXyTpAgkw+8WG7C12mnUYQ087ayDTQTgVwqd7eTOA KMoEFQUpJaC2TWMKG4Fu9KPaBJcdPaVdejqFvMTARMp8zqAu8w7qNShZ5s5k7nDl3q puQu1HsYtyRdNYL8xVvYPbrDFwGYIQsv7zIPv7DouQzaVnDlXCg7S32khXhQvWdzc/ glhDjNq1zDNpw== 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 4XHWK509WCzQPm; Mon, 30 Sep 2024 15:26:33 -0400 (EDT) From: Mathieu Desnoyers To: Steven Rostedt , Masami Hiramatsu Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 , linux-trace-kernel@vger.kernel.org, Michael Jeanson Subject: [PATCH resend 7/8] tracing/perf: Add might_fault check to syscall probes Date: Mon, 30 Sep 2024 15:23:56 -0400 Message-Id: <20240930192357.1154417-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240930192357.1154417-1-mathieu.desnoyers@efficios.com> References: <20240930192357.1154417-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" Add a might_fault() check to validate that the perf sys_enter/sys_exit probe callbacks are indeed called from a context where page faults can be handled. Signed-off-by: Mathieu Desnoyers 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 --- include/trace/perf.h | 1 + kernel/trace/trace_syscalls.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/trace/perf.h b/include/trace/perf.h index 5650c1bad088..321bfd7919f6 100644 --- a/include/trace/perf.h +++ b/include/trace/perf.h @@ -84,6 +84,7 @@ perf_trace_##call(void *__data, proto) \ u64 __count __attribute__((unused)); \ struct task_struct *__task __attribute__((unused)); \ \ + might_fault(); \ guard(preempt_notrace)(); \ do_perf_trace_##call(__data, args); \ } diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 0430890cbb42..53faa791c735 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -600,6 +600,7 @@ static void perf_syscall_enter(void *ignore, struct pt_= regs *regs, long id) * Syscall probe called with preemption enabled, but the ring * buffer and per-cpu data require preemption to be disabled. */ + might_fault(); guard(preempt_notrace)(); =20 syscall_nr =3D trace_get_syscall_nr(current, regs); @@ -706,6 +707,7 @@ static void perf_syscall_exit(void *ignore, struct pt_r= egs *regs, long ret) * Syscall probe called with preemption enabled, but the ring * buffer and per-cpu data require preemption to be disabled. */ + might_fault(); guard(preempt_notrace)(); =20 syscall_nr =3D trace_get_syscall_nr(current, regs); --=20 2.39.2