Skip to content

Commit

Permalink
Merge pull request #4246 from sohankunkerkar/runc-fips
Browse files Browse the repository at this point in the history
libcontainer: force apps to think fips is enabled/disabled for testing
  • Loading branch information
lifubang authored Apr 12, 2024
2 parents f2bd184 + cde1d09 commit d0f803e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions libcontainer/rootfs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ func checkProcMount(rootfs, dest string, m mountEntry) error {
"/proc/slabinfo",
"/proc/net/dev",
"/proc/sys/kernel/ns_last_pid",
"/proc/sys/crypto/fips_enabled",
}
for _, valid := range validProcMounts {
path, err := filepath.Rel(filepath.Join(rootfs, valid), dest)
Expand Down
15 changes: 15 additions & 0 deletions libcontainer/rootfs_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ func TestCheckMountDestNsLastPid(t *testing.T) {
}
}

func TestCheckCryptoFipsEnabled(t *testing.T) {
m := mountEntry{
Mount: &configs.Mount{
Destination: "/proc/sys/crypto/fips_enabled",
Source: "tmpfs",
Device: "tmpfs",
},
}
dest := "/rootfs/proc/sys/crypto/fips_enabled"
err := checkProcMount("/rootfs", dest, m)
if err != nil {
t.Fatalf("/proc/sys/crypto/fips_enabled should not return an error: %v", err)
}
}

func TestNeedsSetupDev(t *testing.T) {
config := &configs.Config{
Mounts: []*configs.Mount{
Expand Down

0 comments on commit d0f803e

Please sign in to comment.