aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/helpers.c
diff options
context:
space:
mode:
authorWojtek Wasko <[email protected]>2025-03-03 16:13:44 +0000
committerDavid S. Miller <[email protected]>2025-03-05 12:43:54 +0000
commitb4e53b15c04e3852949003752f48f7a14ae39e86 (patch)
tree7c98e86bf5326992acb15a4fa0ea1ba3a2fd94cb /rust/helpers/helpers.c
parentposix-clock: Store file pointer in struct posix_clock_context (diff)
downloadkernel-b4e53b15c04e3852949003752f48f7a14ae39e86.tar.gz
kernel-b4e53b15c04e3852949003752f48f7a14ae39e86.zip
ptp: Add PHC file mode checks. Allow RO adjtime() without FMODE_WRITE.
Many devices implement highly accurate clocks, which the kernel manages as PTP Hardware Clocks (PHCs). Userspace applications rely on these clocks to timestamp events, trace workload execution, correlate timescales across devices, and keep various clocks in sync. The kernel’s current implementation of PTP clocks does not enforce file permissions checks for most device operations except for POSIX clock operations, where file mode is verified in the POSIX layer before forwarding the call to the PTP subsystem. Consequently, it is common practice to not give unprivileged userspace applications any access to PTP clocks whatsoever by giving the PTP chardevs 600 permissions. An example of users running into this limitation is documented in [1]. Additionally, POSIX layer requires WRITE permission even for readonly adjtime() calls which are used in PTP layer to return current frequency offset applied to the PHC. Add permission checks for functions that modify the state of a PTP device. Continue enforcing permission checks for POSIX clock operations (settime, adjtime) in the POSIX layer. Only require WRITE access for dynamic clocks adjtime() if any flags are set in the modes field. [1] https://lists.nwtime.org/sympa/arc/linuxptp-users/2024-01/msg00036.html Changes in v4: - Require FMODE_WRITE in ajtime() only for calls modifying the clock in any way. Acked-by: Richard Cochran <[email protected]> Reviewed-by: Vadim Fedorenko <[email protected]> Signed-off-by: Wojtek Wasko <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions