lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250514143622.4104588-1-wwasko@nvidia.com>
Date: Wed, 14 May 2025 17:36:21 +0300
From: Wojtek Wasko <wwasko@...dia.com>
To: richardcochran@...il.com,
	vadim.fedorenko@...ux.dev
Cc: netdev@...r.kernel.org,
	Wojtek Wasko <wwasko@...dia.com>
Subject: [PATCH] ptp: Add sysfs attribute to show clock is safe to open RO

Recent patches introduced in 6.15 implement permissions checks for PTP
clocks. Prior to those, a process with readonly access could modify the
state of PTP devices, in particular the generation and consumption of
PPS signals.

Userspace (e.g. udev) managing the ownership and permissions of device
nodes lacks information as to whether kernel implements the necessary
security checks and whether it is safe to expose readonly access to
PTP devices to unprivileged users. Kernel version checks are cumbersome
and prone to failure, especially if backports are considered [1].

Add a readonly sysfs attribute to PTP clocks, "ro_safe", backed by a
static string.

[1] https://github.com/systemd/systemd/pull/37302#issuecomment-2850510329
---
 drivers/ptp/ptp_sysfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 6b1b8f57cd95..763fc54cf267 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -28,6 +28,8 @@ static ssize_t max_phase_adjustment_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(max_phase_adjustment);
 
+static DEVICE_STRING_ATTR_RO(ro_safe, 0444, "1\n");
+
 #define PTP_SHOW_INT(name, var)						\
 static ssize_t var##_show(struct device *dev,				\
 			   struct device_attribute *attr, char *page)	\
@@ -320,6 +322,7 @@ static DEVICE_ATTR_RW(max_vclocks);
 
 static struct attribute *ptp_attrs[] = {
 	&dev_attr_clock_name.attr,
+	&dev_attr_ro_safe.attr.attr,
 
 	&dev_attr_max_adjustment.attr,
 	&dev_attr_max_phase_adjustment.attr,
-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ