Skip to content

Permission checks for dynamic POSIX clocks

Wojtek Wasko netdev 3 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 1 replyApplied 3/3
  2. v33 patches 5 repliesSuperseded
  3. v23 patches 5 repliesSuperseded

Changes in v4 from the cover letter

- Allow readonly adjtime() for dynamic clocks, as suggested by Thomas

Patches in v4 All 3 applied

#Subject and filesSizeRepliesApplied
1/3posix-clock: Store file pointer in struct posix_clock_contextinclude/linux/posix-clock.h kernel/time/posix-clock.c+6 -10 repliesApplied
2/3ptp: Add PHC file mode checks. Allow RO adjtime() without FMODE_WRITE.drivers/ptp/ptp_chardev.c kernel/time/posix-clock.c+17 -11 replyApplied
3/3testptp: Add option to open PHC in readonly modetools/testing/selftests/ptp/testptp.c+23 -140 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchRichard CochranVadim FedorenkoThomas Gleixner
1/3A-b R-b R-b
2/3A-b R-b R-b
3/3A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH net-next v4 0/3] 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.

Wojtek Wasko (3):
posix-clock: Store file pointer in struct posix_clock_context
ptp: Add PHC file mode checks. Allow RO adjtime() without FMODE_WRITE.
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             |  3 ++-
 tools/testing/selftests/ptp/testptp.c | 37 +++++++++++++++++----------
 4 files changed, 46 insertions(+), 16 deletions(-)
Signature · 1 line
2.43.5