Skip to content

Commit d0f803e

Browse files
authored
Merge pull request #4246 from sohankunkerkar/runc-fips
libcontainer: force apps to think fips is enabled/disabled for testing
2 parents f2bd184 + cde1d09 commit d0f803e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

libcontainer/rootfs_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ func checkProcMount(rootfs, dest string, m mountEntry) error {
783783
"/proc/slabinfo",
784784
"/proc/net/dev",
785785
"/proc/sys/kernel/ns_last_pid",
786+
"/proc/sys/crypto/fips_enabled",
786787
}
787788
for _, valid := range validProcMounts {
788789
path, err := filepath.Rel(filepath.Join(rootfs, valid), dest)

libcontainer/rootfs_linux_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ func TestCheckMountDestNsLastPid(t *testing.T) {
134134
}
135135
}
136136

137+
func TestCheckCryptoFipsEnabled(t *testing.T) {
138+
m := mountEntry{
139+
Mount: &configs.Mount{
140+
Destination: "/proc/sys/crypto/fips_enabled",
141+
Source: "tmpfs",
142+
Device: "tmpfs",
143+
},
144+
}
145+
dest := "/rootfs/proc/sys/crypto/fips_enabled"
146+
err := checkProcMount("/rootfs", dest, m)
147+
if err != nil {
148+
t.Fatalf("/proc/sys/crypto/fips_enabled should not return an error: %v", err)
149+
}
150+
}
151+
137152
func TestNeedsSetupDev(t *testing.T) {
138153
config := &configs.Config{
139154
Mounts: []*configs.Mount{

0 commit comments

Comments
 (0)