From nobody Mon May 25 08:12:01 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 83AB3383C85 for ; Fri, 15 May 2026 19:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874126; cv=none; b=CATNNw7owbF7DAMXwYE5xlI5W8ZIIo/cEb857dKGm9LL2+3XFNXK4Sp4EH59CfYXslLs0SzXbfMJ0hhX2TX+AJNwGs3naW3IUoWgNjgSgIDBi6G5Fos/tAqpw+UTCJ2ts6Le45t/2K3bAetJ+gxdLrZSnUDFt645JTr/Xc+q38w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874126; c=relaxed/simple; bh=Ulq4Me1sfWuuHA3AMTGfQmfiOXh1ef+JNR2f7IkNv/M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eY1uPnOi2FMpgX8dXehqtNVjseXAUozwpv7L18mbM6i0ngZkbcVnJo0iBgaajM5r4rrRTdf3kbz5uY6LXYb4y3mvEl4OW03bNsArvbPu8pKX+9SslC1z+mESvbTgQ/jtb/08o8sIC3dO8imtvHs5IYrvczUK0EhuirSyulU5aos= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TfJbbeJ+; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TfJbbeJ+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778874124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=smZehZ4R4GekK+a7uEBnX02LbnOGqDpqzyo4HnU8/6g=; b=TfJbbeJ+SEiKQiD6Ccw8kIEQTEzXGOoAfaJuhep5+LddE/jAyeM6F6oHhIy7gjObop+QEN 40uHzT0qs4zlT+/t23iFlug5091OYj0Xx/3ysMjcehZoc0akmuJaq/uy+b+IrX9feFkPtL MgeFmI/A0WsNWIqszq4NGYbRc1xdOv4= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-fCsQ77UPM7C_HAiQEoXW7w-1; Fri, 15 May 2026 15:42:00 -0400 X-MC-Unique: fCsQ77UPM7C_HAiQEoXW7w-1 X-Mimecast-MFC-AGG-ID: fCsQ77UPM7C_HAiQEoXW7w_1778874118 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2B2DD18005B6; Fri, 15 May 2026 19:41:58 +0000 (UTC) Received: from ashelat-thinkpadp1gen5.boston.csb (unknown [10.22.80.109]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 17B5B1956053; Fri, 15 May 2026 19:41:54 +0000 (UTC) From: Anubhav Shelat To: mpetlan@redhat.com, Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Thomas Falcon , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v4 1/3] perf evsel: don't set PERF_SAMPLE_IP for unprivileged tracepoints Date: Fri, 15 May 2026 15:40:05 -0400 Message-ID: <20260515194010.93725-3-ashelat@redhat.com> In-Reply-To: <20260515194010.93725-2-ashelat@redhat.com> References: <20260515194010.93725-2-ashelat@redhat.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 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" For tracepoint events the IP is a static kernel address. It doesn't vary by sample and provides no useful information for unprivileged users. Skipping setting PERF_SAMPLE_IP for unprivileged tracepoints avoids exposing a kernel address that reveals the KASLR base offset. Make an exception for uprobes, which are registered as PERF_TYPE_TRACEPOINT, because the IP is important for their functionality and is a safe userspace address. Detect them with __probe_ip (entry) and __probe_ret_ip (return) using evsel__field(). Assisted-by: Claude:claude-sonnet-4.5 Signed-off-by: Anubhav Shelat --- tools/perf/util/evsel.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 2ee87fd84d3e..bf66e0c78451 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1509,7 +1509,19 @@ void evsel__config(struct evsel *evsel, const struct= record_opts *opts, attr->write_backward =3D opts->overwrite ? 1 : 0; attr->read_format =3D PERF_FORMAT_LOST; =20 - evsel__set_sample_bit(evsel, IP); + /* + * Don't set PERF_SAMPLE_IP for unprivileged kernel tracepoints to + * avoid exposing kernel addresses. Uprobes expose only userspace + * addresses so they're safe. Detect entry and return uprobes. + */ + if (attr->type !=3D PERF_TYPE_TRACEPOINT || perf_event_paranoid_check(1) +#ifdef HAVE_LIBTRACEEVENT + || evsel__field(evsel, "__probe_ip") + || evsel__field(evsel, "__probe_ret_ip") +#endif + ) + evsel__set_sample_bit(evsel, IP); + evsel__set_sample_bit(evsel, TID); =20 if (evsel->sample_read) { --=20 2.54.0 From nobody Mon May 25 08:12:01 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 1EEEA317148 for ; Fri, 15 May 2026 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874133; cv=none; b=Ezr/SgUUbsMWZs4QXizHOVw3QKlMdFeZLZqviUs85Aqr+sUq938sxnRF4c1kXyDNzD/ZmyOGm+ZJ4JxxlrvDZ2hatZDpgAztkyoasbESKmU1JvLvAyRjfr4IhxDbnb/tmFipjcXMkNx976rslqtUdDYlaGO8px4gGb20dlDqJQY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874133; c=relaxed/simple; bh=RZzinb8wPxlvXfXvn9/c2jxj5+Q9BtBLM+Amx3gxCBY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ogwW4R0JorQ1jz51MY5FyPRilgwfI+PP+4x9PASLOMj0oxQcYnDDXJfcWlWZ7Xlt+exI0LCGx8SBMNvmQnd0Z8GGqwjVfPYif7Gyj6imtEHEbdKUrwaYV/XSjS4qx0hGp8ChhvZfJbuM+ZLXuTXwFIxmnc+1ysoBjZ8boViv3ug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=X4xJtEcF; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="X4xJtEcF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778874131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HmfrO3S2sd5h9l3v0OdWSyyvWkGpnH45ni/babXstNc=; b=X4xJtEcFBrz2e5rcxuIc9pwpVtw/YrFbWEB8OMYzp5bnXQ2Wm+cJyQLvPB+W301cAsDHxE T43wFqFfIm4njyrQohEOKnKBJLmmmPH5LLsubmrpyRhIWVBmDicYkGPZHlx0LQHK2Dru4s XgIvjnA+ykJSSfayH5kbdDKwr0pSXQ0= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-225-68pOIMEBPo21rWCBkHY1Kw-1; Fri, 15 May 2026 15:42:04 -0400 X-MC-Unique: 68pOIMEBPo21rWCBkHY1Kw-1 X-Mimecast-MFC-AGG-ID: 68pOIMEBPo21rWCBkHY1Kw_1778874122 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D10CF18002D6; Fri, 15 May 2026 19:42:01 +0000 (UTC) Received: from ashelat-thinkpadp1gen5.boston.csb (unknown [10.22.80.109]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 448661956053; Fri, 15 May 2026 19:41:59 +0000 (UTC) From: Anubhav Shelat To: mpetlan@redhat.com, Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Thomas Falcon , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v4 2/3] perf: enable unprivileged syscall tracing with perf trace Date: Fri, 15 May 2026 15:40:06 -0400 Message-ID: <20260515194010.93725-4-ashelat@redhat.com> In-Reply-To: <20260515194010.93725-2-ashelat@redhat.com> References: <20260515194010.93725-2-ashelat@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Allow unprivileged users to trace their own processes' syscalls using perf trace, similar to strace without the intrusive overhead of ptrace(). Currently, perf trace requires CAP_PERFMON or paranoid level =E2=89=A4 1 ev= en though the kernel has existing infrastructure (TRACE_EVENT_FL_CAP_ANY) specifically designed to mark syscall tracepoints as safe for unprivileged access. To fix this: 1. Loosen the condition in perf_event_open() which requires privileges for all events with exclude_kernel=3D0. This allows perf_event_open() to bypass the paranoid check for task-attached tracepoint events. Ensure that sample types which can expose kernel addresses to unprivileged users are blocked. Ensure the PERF_SECURITY_KERNEL LSM hook is preserved. 2. Make the format and id tracefs files world-readable only for tracepoints with TRACE_EVENT_FL_CAP_ANY, allowing unprivileged users to see syscall tracepoint ids without exposing sensitive information. 3. Add a check to perf_trace_event_perm() to block PERF_SAMPLE_IP on kernel tracepoints for unprivileged users to prevent KASLR bypass. We do this here rather than in kaddr_leak because perf_trace_event_perm() can distinguish between kernel tracepoints and uprobe tracepoints, where the IP is a safe user space address and is necessary for uprobe functionality. 4. Restrict pure counting events (no PERF_SAMPLE_RAW) to TRACE_EVENT_FL_CAP_ANY tracepoints preventing unprivileged users from counting internal kernel tracepoints while preserving current behavior for exclude_kernel=3D1 events. Example usage after this change: $ perf trace ls # works as unprivileged user $ perf trace # system-wide, still requires privileges $ perf trace -p 1234 # requires ptrace permission on pid 1234 Assisted-by: Claude:claude-sonnet-4.5 Signed-off-by: Anubhav Shelat --- kernel/events/core.c | 28 +++++++++++++++++++++++++--- kernel/trace/trace_event_perf.c | 21 ++++++++++++++++++++- kernel/trace/trace_events.c | 16 ++++++++++++++-- 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 7935d5663944..ff2d1e9a0b79 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -13873,9 +13873,31 @@ SYSCALL_DEFINE5(perf_event_open, return err; =20 if (!attr.exclude_kernel) { - err =3D perf_allow_kernel(); - if (err) - return err; + bool tp_bypass =3D false; + + /* Check unprivileged tracepoints */ + if (attr.type =3D=3D PERF_TYPE_TRACEPOINT && pid !=3D -1) { + /* + * Block sample types that expose kernel addresses to + * prevent KASLR bypass + */ + u64 kaddr_leak =3D PERF_SAMPLE_CALLCHAIN | + PERF_SAMPLE_BRANCH_STACK | + PERF_SAMPLE_ADDR | + PERF_SAMPLE_REGS_INTR; + + tp_bypass =3D !(attr.sample_type & kaddr_leak); + } + + if (!tp_bypass) { + err =3D perf_allow_kernel(); + if (err) + return err; + } else { + err =3D security_perf_event_open(PERF_SECURITY_KERNEL); + if (err) + return err; + } } =20 if (attr.namespaces) { diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_per= f.c index a6bb7577e8c5..466007ed2869 100644 --- a/kernel/trace/trace_event_perf.c +++ b/kernel/trace/trace_event_perf.c @@ -72,9 +72,28 @@ static int perf_trace_event_perm(struct trace_event_call= *tp_event, return -EINVAL; } =20 + /* + * PERF_SAMPLE_IP on kernel tracepoints exposes a kernel text + * address, weakening KASLR. Block for unprivileged users unless + * the tracepoint is a uprobe (userspace IP, safe to expose). + */ + if ((p_event->attr.sample_type & PERF_SAMPLE_IP) && + !p_event->attr.exclude_kernel && + !(tp_event->flags & TRACE_EVENT_FL_UPROBE) && + sysctl_perf_event_paranoid > 1 && !perfmon_capable()) + return -EACCES; + /* No tracing, just counting, so no obvious leak */ - if (!(p_event->attr.sample_type & PERF_SAMPLE_RAW)) + if (!(p_event->attr.sample_type & PERF_SAMPLE_RAW)) { + /* Prevent unprivileged users from counting kernel tracepoints */ + if (!p_event->attr.exclude_kernel && + sysctl_perf_event_paranoid > 1 && !perfmon_capable()) { + if (!(p_event->attach_state =3D=3D PERF_ATTACH_TASK && + (tp_event->flags & TRACE_EVENT_FL_CAP_ANY))) + return -EACCES; + } return 0; + } =20 /* Some events are ok to be traced by non-root users... */ if (p_event->attach_state =3D=3D PERF_ATTACH_TASK) { diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index c46e623e7e0d..cbd07e2ec528 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -3050,7 +3050,13 @@ static int event_callback(const char *name, umode_t = *mode, void **data, struct trace_event_call *call =3D file->event_call; =20 if (strcmp(name, "format") =3D=3D 0) { - *mode =3D TRACE_MODE_READ; + /* + * Make format tracefs file world readable for tracepoints with + * TRACE_EVENT_FL_CAP_ANY + */ + *mode =3D (call->flags & TRACE_EVENT_FL_CAP_ANY) ? + (TRACE_MODE_READ | 0004) : + TRACE_MODE_READ; *fops =3D &ftrace_event_format_fops; return 1; } @@ -3086,7 +3092,13 @@ static int event_callback(const char *name, umode_t = *mode, void **data, #ifdef CONFIG_PERF_EVENTS if (call->event.type && call->class->reg && strcmp(name, "id") =3D=3D 0) { - *mode =3D TRACE_MODE_READ; + /* + * Make id tracefs file world readable for tracepoints with + * TRACE_EVENT_FL_CAP_ANY + */ + *mode =3D (call->flags & TRACE_EVENT_FL_CAP_ANY) ? + (TRACE_MODE_READ | 0004) : + TRACE_MODE_READ; *data =3D (void *)(long)call->event.type; *fops =3D &ftrace_event_id_fops; return 1; --=20 2.54.0 From nobody Mon May 25 08:12:01 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 1EF7C3803DE for ; Fri, 15 May 2026 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874133; cv=none; b=UqkAjHMsIKCvPKy8hGrAqsBlfT8OecYjbTPhcNAdNVk/7ybs/uOen2l75PPhpTP1qWH2HhPYJ/QViVHrUrUtlKW194xRFz/g03l7jh6Q9vYoekSR2UR0Oe4L/RpECArfP6JhX26Lz3NvhUZGEH0QsT9qVHosOBfHwdkOt4+m22c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874133; c=relaxed/simple; bh=GB7uYwlJ1jSkZyTTm42CbIZkwxhi7MhCoqEqceJHYZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JWHYV+DRpbS2FVhfCri7ds4TJXeVjSuowTTuwzx86hiNeUbB5fM0jtsCYzh2bKOKpC9uKWNuL85dDVS2I4zSGMrkR88k/uXpGZaBBf6h/O+Hm4TC4Kv5RZAv1PZVzJO+YfbX4PmukHIPt9h7bmhXE2hTiFiqEwlGkU8dO2qyAqg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AtHSy3hl; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AtHSy3hl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778874131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SPYYWfo6YyDgCo6bIAWDHWB7M/pdv+lxEMFGgnS1HbA=; b=AtHSy3hlxEIGxkiHg8r9F7qWEi2rmFxobXnK98CkRiRRmIaWyWr8K4bHYMnXmS58j0Oby0 FoUipU98QG/A7STLztOluPUrJrsKDFKw06J3Vm1U6XGdS/DTAhwr8q2LUQlhmiv370hYza dJnudrYvK3KK9YWr1xRXXSV/JBlbCVs= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-449-3XA6R_euOFqCIUw-X8MxTg-1; Fri, 15 May 2026 15:42:07 -0400 X-MC-Unique: 3XA6R_euOFqCIUw-X8MxTg-1 X-Mimecast-MFC-AGG-ID: 3XA6R_euOFqCIUw-X8MxTg_1778874125 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 932B119560A7; Fri, 15 May 2026 19:42:05 +0000 (UTC) Received: from ashelat-thinkpadp1gen5.boston.csb (unknown [10.22.80.109]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EC8321956053; Fri, 15 May 2026 19:42:02 +0000 (UTC) From: Anubhav Shelat To: mpetlan@redhat.com, Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Thomas Falcon , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v4 3/3] tracefs: make root directory world-traversable Date: Fri, 15 May 2026 15:40:07 -0400 Message-ID: <20260515194010.93725-5-ashelat@redhat.com> In-Reply-To: <20260515194010.93725-2-ashelat@redhat.com> References: <20260515194010.93725-2-ashelat@redhat.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 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Change the default tracefs mount mode from 0700 to 0755. This allows unprivileged users to access the eventfs directories underneath which already use 0755. Tracing data files use mode 0440 and 0640 so they are not exposed by this change. Only the format and id files, which have been marked as work-readable, become accessible. Directory listings of kprobes and uprobes, which contain functions or binaries, become visible to unprivileged users but do not contain kernel addresses. Admins using probes can restore the previous behavior with chmod or mount -o mode=3D700. Signed-off-by: Anubhav Shelat --- fs/tracefs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index f3d6188a3b7b..3a6a0c800a8b 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -23,7 +23,7 @@ #include #include "internal.h" =20 -#define TRACEFS_DEFAULT_MODE 0700 +#define TRACEFS_DEFAULT_MODE 0755 static struct kmem_cache *tracefs_inode_cachep __ro_after_init; =20 static struct vfsmount *tracefs_mount; --=20 2.54.0