From patchwork Mon Sep 9 20:16:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13797547 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 D5BB918A949; Mon, 9 Sep 2024 20:17:19 +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=1725913041; cv=none; b=MWqEf895b4NfgZ41ZwMa8pdIS0P3xCYbLXV4JJ41zqWUyglC1K3Uvuzy2KxzxjSDnCHhEHpKm59u04AI3wVUgn1Ph4ds7KvcfVBFbtyWZVpVkwPS6Ha4kq1EM4NEk6zks8E1Stvupo+cejumKHMYGwAcRFO9SI/9eT8xC//pILk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725913041; c=relaxed/simple; bh=5w5atC/L2ENxXyVQRtgR6s4glzcuw7sYXRIo0prEmhc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d1ZUJ8X5DWpWowOJ7Vkio6+HRpIP9nYIQsMuZHZlkOzWfEdNQVjFEKkPyBj9kaLB8EiT5jOJ3MFAwzYyAMeh5bbkKEHv79u5o65G9V2avD8AFfYdUhPyrBFZ5rdiMhZP9gtkB3a5LVjyOv5zg0dbCCKeqN01CJrAZteFrx7NMZE= 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=oFRABRR0; 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="oFRABRR0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1725913038; bh=5w5atC/L2ENxXyVQRtgR6s4glzcuw7sYXRIo0prEmhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oFRABRR0Xuxpf1DM28exZ+a9fqhCTt0grXZL9/gPRSA3Gv+WVM0ve4eSeipFFMYjO S4n41aya4Nl00Yl8G5pgNkvYn8oj+GixaVsMMCDhlt3IYpvyJ/ESONgy/6YPRHpxW9 ZgyUHnl6nWnKBlHj9Wmh3UhhKwxSOXpHdbv2QJMvpyNMV1O4YqFN4AIRHUqkCP2cQc NQG6aN+FxrrsPj6PlEsZAGT4C78HPrOw8Drpckj4AJ5WgOo2vlf/obIuihGVGARPLJ byIBwqXT5BNlCcxT88EUuBeDMKKeehYcC+WxFCOxEe5iLzgTcW23tuhosVfcaWdF69 BQJMgwhRGtmHw== 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 4X2dRL0vTVz1KwG; Mon, 9 Sep 2024 16:17:18 -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 8/8] tracing/bpf: Add might_fault check to syscall probes Date: Mon, 9 Sep 2024 16:16:52 -0400 Message-Id: <20240909201652.319406-9-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240909201652.319406-1-mathieu.desnoyers@efficios.com> References: <20240909201652.319406-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@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 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 Acked-by: Andrii Nakryiko --- 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 211b98d45fc6..099df5c3e38a 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(); \ guard(preempt_notrace)(); \ CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(__data, CAST_TO_U64(args)); \ }