From patchwork Wed Oct 9 01:07:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13827319 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 064B0383B1; Wed, 9 Oct 2024 01:09:30 +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=1728436171; cv=none; b=PiJRetNTpXzGf8BYTh/UvQckh2avzCBohGXIAfo3og3quZhsSaEEIv2aqheOuCbZg7w3eAe8BMg0+aZaxSSG4io1zMNNycW/2E10DHRvPTFdykuBkEQl2crQBkOfBGQwSLOUyI/IGi7f5Cdcbc8V32Pa2szZSLs/2jrv4Xu9E1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728436171; c=relaxed/simple; bh=ieiW2kYGqwsBuNVmGoUBbM2HLuyk7hfkKWRZ6NViJy8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dZuTyvp+doxsZIBOjuvqk/LZlTs5NuTWNDfJBYvtZLjFLgrN1ZvuBfG3miR6knF5o8r7UxTC0z+sCOX1/KARLRtukdjDAYGdncnjxUC/Avg5ylqaavSwu7e5A4qbYS7dWx82nur4NblVaZ/Hl3Dv1emORQgDXt8PJYUQl08X2Ak= 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=t0lKLsnR; 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="t0lKLsnR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1728436168; bh=ieiW2kYGqwsBuNVmGoUBbM2HLuyk7hfkKWRZ6NViJy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t0lKLsnR5PjRVE0rV8J95kTGmugjuFnX82nnUotyy/l8Tb9gLPItOh79byMsWF3BN 4R2D7Z6Y9tGe7zzLq9f/dJBbUWUWdGa0ShEgWP1J7xeTkKWeqYFqUlsC+bu6mXvIVP V6DTRECU1wRSxcpLUIyEWJ5qtAtZTJ0imSuJUzCPA8uRIDt9WfIRYs5VDJx+WfEe31 jq1ZLJRlWSIsCDmU32M2S7BRbSliiWTFMI54k/8qE/sam9hgWYOQ5kpJysOhmqDmwG ZBOte3dwY1cd5h1J7B7Yl5/g5jnKbA6eJx9X/z+g0shU8cPl1lOK6cKX7hEP9pbKS2 VjsyGFK3DBEMA== Received: from thinkos.internal.efficios.com (unknown [IPv6:2606:6d00:100:4000:cacb:9855:de1f:ded2]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4XNZY43Br3zS26; Tue, 8 Oct 2024 21:09:28 -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, Andrii Nakryiko , Michael Jeanson Subject: [PATCH v4 8/8] tracing/bpf: Add might_fault check to syscall probes Date: Tue, 8 Oct 2024 21:07:18 -0400 Message-Id: <20241009010718.2050182-9-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241009010718.2050182-1-mathieu.desnoyers@efficios.com> References: <20241009010718.2050182-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a might_fault() check to validate that the bpf sys_enter/sys_exit probe callbacks are indeed called from a context where page faults can be handled. Signed-off-by: Mathieu Desnoyers Acked-by: Andrii Nakryiko Tested-by: Andrii Nakryiko # BPF parts 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/bpf_probe.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/trace/bpf_probe.h b/include/trace/bpf_probe.h index fec97c93e1c9..183fa2aa2935 100644 --- a/include/trace/bpf_probe.h +++ b/include/trace/bpf_probe.h @@ -57,6 +57,7 @@ __bpf_trace_##call(void *__data, proto) \ static notrace void \ __bpf_trace_##call(void *__data, proto) \ { \ + might_fault(); \ preempt_disable_notrace(); \ CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(__data, CAST_TO_U64(args)); \ preempt_enable_notrace(); \