Skip to content

Commit

Permalink
i/builtin: allow accessing real-time clock device nodes via symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewphelpsj committed Oct 1, 2024
1 parent 0a99a8d commit bf5062e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions interfaces/builtin/time_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ capability sys_time,
/sys/class/rtc/*/ rw,
/sys/class/rtc/*/** rw,
# Nodes in /sys/class/rtc could be symlinks under /sys/devices
/sys/devices/**/rtc/*/** rw,
# Allow access to pps
# https://www.kernel.org/doc/html/latest/driver-api/pps.html
/dev/pps[0-9]* rw,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ apps:
date:
command: bin/date
plugs: [time-control]
shell:
command: bin/sh
plugs: [time-control]
3 changes: 3 additions & 0 deletions tests/main/interfaces-time-control/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ execute: |
not test-snapd-timedate-control-consumer.date "$now" 2> call.error
# EPERM because date gets blocked by the seccomp profile
MATCH "cannot set date: Operation not permitted" < call.error
# make sure that we can access the files in /sys/class/rtc
test-snapd-timedate-control-consumer.shell -c "cat /sys/class/rtc/rtc0/wakealarm"

0 comments on commit bf5062e

Please sign in to comment.