Skip to content

Commit 5fc80fb

Browse files
committed
selinux: always check the file label in selinux_kernel_read_file()
Commit 2039bda ("LSM: Add "contents" flag to kernel_read_file hook") added a new flag to the security_kernel_read_file() LSM hook, "contents", which was set if a file was being read in its entirety or if it was the first chunk read in a multi-step process. The SELinux LSM callback was updated to only check against the file label if this "contents" flag was set, meaning that in multi-step reads the file label was not considered in the access control decision after the initial chunk. Thankfully the only in-tree user that performs a multi-step read is the "bcm-vk" driver and it is loading firmware, not a kernel module, so there are no security regressions to worry about. However, we still want to ensure that the SELinux code does the right thing, and *always* checks the file label, especially as there is a chance the file could change between chunk reads. Fixes: 2039bda ("LSM: Add "contents" flag to kernel_read_file hook") Signed-off-by: Paul Moore <[email protected]>
1 parent 75eb39f commit 5fc80fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/selinux/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4134,7 +4134,7 @@ static int selinux_kernel_read_file(struct file *file,
41344134

41354135
switch (id) {
41364136
case READING_MODULE:
4137-
rc = selinux_kernel_module_from_file(contents ? file : NULL);
4137+
rc = selinux_kernel_module_from_file(file);
41384138
break;
41394139
default:
41404140
break;

0 commit comments

Comments
 (0)