nixpkgs/pkgs/os-specific/linux/kernel/grsec-path.patch

19 lines
1,007 B
Diff
Raw Normal View History

2015-03-29 19:36:37 +02:00
diff --git a/kernel/kmod.c b/kernel/kmod.c
2015-03-29 19:15:31 +02:00
index a26e825..29baec1 100644
2015-03-29 19:36:37 +02:00
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
2015-03-29 19:15:31 +02:00
@@ -294,10 +294,9 @@ static int ____call_usermodehelper(void *data)
out the path to be used prior to this point and are now operating
on that copy
*/
- if ((strncmp(sub_info->path, "/sbin/", 6) && strncmp(sub_info->path, "/usr/lib/", 9) &&
- strncmp(sub_info->path, "/lib/", 5) && strncmp(sub_info->path, "/lib64/", 7) &&
2015-03-29 19:15:31 +02:00
- strncmp(sub_info->path, "/usr/libexec/", 13) &&
- strcmp(sub_info->path, "/usr/share/apport/apport")) || strstr(sub_info->path, "..")) {
2015-03-29 19:15:31 +02:00
+ if ((strncmp(sub_info->path, "/sbin/", 6) && strncmp(sub_info->path, "/nix/store/", 11) &&
+ strncmp(sub_info->path, "/run/current-system/systemd/lib/", 32)) ||
+ strstr(sub_info->path, "..")) {
printk(KERN_ALERT "grsec: denied exec of usermode helper binary %.950s located outside of /sbin and system library paths\n", sub_info->path);
retval = -EPERM;
2015-03-29 19:15:31 +02:00
goto out;