netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/3] Permission checks for dynamic POSIX clocks
@ 2025-02-17  9:50 Wojtek Wasko
  2025-02-17  9:50 ` [PATCH net-next v3 1/3] posix-clock: Store file pointer in struct posix_clock_context Wojtek Wasko
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Wojtek Wasko @ 2025-02-17  9:50 UTC (permalink / raw)
  To: netdev
  Cc: richardcochran, vadim.fedorenko, kuba, horms, anna-maria,
	frederic, pabeni, tglx

Dynamic clocks - such as PTP clocks - extend beyond the standard POSIX
clock API by using ioctl calls. While file permissions are enforced for
standard POSIX operations, they are not implemented for ioctl calls,
since the POSIX layer cannot differentiate between calls which modify
the clock's state (like enabling PPS output generation) and those that
don't (such as retrieving the clock's PPS capabilities).

On the other hand, drivers implementing the dynamic clocks lack the
necessary information context to enforce permission checks themselves.

Add a struct file pointer to the POSIX clock context and use it to
implement the appropriate permission checks on PTP chardevs. Add a
readonly option to testptp.

Changes in v3:
- Reword the log message for commit against posix-clock and fix
  documentation of struct posix_clock_context, as suggested by Thomas

Changes in v2:
- Store file pointer in POSIX clock context rather than fmode in the PTP
  clock's private data, as suggested by Richard.
- Move testptp.c changes into separate patch.

Wojtek Wasko (3):
  posix-clock: Store file pointer in struct posix_clock_context
  ptp: Add file permission checks on PHCs
  testptp: add option to open PHC in readonly mode

 drivers/ptp/ptp_chardev.c             | 16 ++++++++++++
 include/linux/posix-clock.h           |  6 ++++-
 kernel/time/posix-clock.c             |  1 +
 tools/testing/selftests/ptp/testptp.c | 37 +++++++++++++++++----------
 4 files changed, 45 insertions(+), 15 deletions(-)

-- 
2.39.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-02-20 14:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17  9:50 [PATCH net-next v3 0/3] Permission checks for dynamic POSIX clocks Wojtek Wasko
2025-02-17  9:50 ` [PATCH net-next v3 1/3] posix-clock: Store file pointer in struct posix_clock_context Wojtek Wasko
2025-02-17 20:23   ` Thomas Gleixner
2025-02-17  9:50 ` [PATCH net-next v3 2/3] ptp: Add file permission checks on PHCs Wojtek Wasko
2025-02-17 20:24   ` Thomas Gleixner
2025-02-19  9:45     ` Wojtek Wasko
2025-02-20 12:53       ` Thomas Gleixner
2025-02-20 14:07         ` Wojtek Wasko
2025-02-17  9:50 ` [PATCH net-next v3 3/3] testptp: add option to open PHC in readonly mode Wojtek Wasko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).