Skip to content

Commit

Permalink
oci/spec: deny /sys/devices/virtual/powercap
Browse files Browse the repository at this point in the history
The ability to read these files may offer a power-based sidechannel
attack against any workloads running on the same kernel.

This was originally [CVE-2020-8694][1], which was fixed in
[949dd0104c496fa7c14991a23c03c62e44637e71][2] by restricting read access
to root. However, since many containers run as root, this is not
sufficient for our use case.

While untrusted code should ideally never be run, we can add some
defense in depth here by masking out the device class by default.

[Other mechanisms][3] to access this hardware exist, but they should not
be accessible to a container due to other safeguards in the
kernel/container stack (e.g. capabilities, perf paranoia).

[1]: https://nvd.nist.gov/vuln/detail/CVE-2020-8694
[2]: torvalds/linux@949dd01
[3]: https://web.eece.maine.edu/~vweaver/projects/rapl/

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
(cherry picked from commit 106a9b7)
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
  • Loading branch information
neersighted committed Sep 18, 2023
1 parent 091922f commit 40162a5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions oci/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ func populateDefaultUnixSpec(ctx context.Context, s *Spec, id string) error {
"/proc/timer_stats",
"/proc/sched_debug",
"/sys/firmware",
"/sys/devices/virtual/powercap",
"/proc/scsi",
},
ReadonlyPaths: []string{
Expand Down

0 comments on commit 40162a5

Please sign in to comment.