]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Merge branch 'dynamic-possix-clocks-permission-checks'
authorDavid S. Miller <davem@davemloft.net>
Wed, 5 Mar 2025 12:43:55 +0000 (12:43 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Mar 2025 12:43:55 +0000 (12:43 +0000)
commitc62e6f056ea308d6382450c1cb32e41727375885
tree026d00dfc472150b7680404ecade3fd715c20d0a
parentf252f23ab657cd224cb8334ba69966396f3f629b
parent76868642e42795353106197abf9c607ad80f4c9e
Merge branch 'dynamic-possix-clocks-permission-checks'

Wojtek Wasko says:

====================
Permission checks for dynamic POSIX clocks

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.

Additionally, POSIX clock layer requires the WRITE permission even for
readonly adjtime() operations before invoking the callback.

Add a struct file pointer to the POSIX clock context and use it to
implement the appropriate permission checks on PTP chardevs. Permit
readonly adjtime() for dynamic clocks. Add a readonly option to testptp.

Changes in v4:
- Allow readonly adjtime() for dynamic clocks, as suggested by Thomas

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.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>