diff options
Diffstat (limited to 'libre/linux-libre-lts')
-rw-r--r-- | libre/linux-libre-lts/0001-add-sysctl-and-CONFIG-for-unprivileged_userns_clone.patch | 132 | ||||
-rw-r--r-- | libre/linux-libre-lts/PKGBUILD | 22 | ||||
-rw-r--r-- | libre/linux-libre-lts/config.armv7h | 5 | ||||
-rw-r--r-- | libre/linux-libre-lts/config.i686 | 4 | ||||
-rw-r--r-- | libre/linux-libre-lts/config.x86_64 | 3 |
5 files changed, 152 insertions, 14 deletions
diff --git a/libre/linux-libre-lts/0001-add-sysctl-and-CONFIG-for-unprivileged_userns_clone.patch b/libre/linux-libre-lts/0001-add-sysctl-and-CONFIG-for-unprivileged_userns_clone.patch new file mode 100644 index 000000000..f93022e50 --- /dev/null +++ b/libre/linux-libre-lts/0001-add-sysctl-and-CONFIG-for-unprivileged_userns_clone.patch @@ -0,0 +1,132 @@ +From 6136ffb3d88e9f044260f8288d2d0a1edd64379e Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> +Date: Mon, 16 Sep 2019 04:53:20 +0200 +Subject: [PATCH] ZEN: Add sysctl and CONFIG to disallow unprivileged + CLONE_NEWUSER + +Our default behavior continues to match the vanilla kernel. +--- + init/Kconfig | 16 ++++++++++++++++ + kernel/fork.c | 15 +++++++++++++++ + kernel/sysctl.c | 12 ++++++++++++ + kernel/user_namespace.c | 7 +++++++ + 4 files changed, 50 insertions(+) + +diff --git a/init/Kconfig b/init/Kconfig +index bd7d650d4a99..658f9c052151 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1091,6 +1091,22 @@ config USER_NS + + If unsure, say N. + ++config USER_NS_UNPRIVILEGED ++ bool "Allow unprivileged users to create namespaces" ++ default y ++ depends on USER_NS ++ help ++ When disabled, unprivileged users will not be able to create ++ new namespaces. Allowing users to create their own namespaces ++ has been part of several recent local privilege escalation ++ exploits, so if you need user namespaces but are ++ paranoid^Wsecurity-conscious you want to disable this. ++ ++ This setting can be overridden at runtime via the ++ kernel.unprivileged_userns_clone sysctl. ++ ++ If unsure, say Y. ++ + config PID_NS + bool "PID Namespaces" + default y +diff --git a/kernel/fork.c b/kernel/fork.c +index 541fd805fb88..ffd57c812153 100644 +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -106,6 +106,11 @@ + + #define CREATE_TRACE_POINTS + #include <trace/events/task.h> ++#ifdef CONFIG_USER_NS ++extern int unprivileged_userns_clone; ++#else ++#define unprivileged_userns_clone 0 ++#endif + + /* + * Minimum number of threads to boot the kernel +@@ -1788,6 +1793,10 @@ static __latent_entropy struct task_struct *copy_process( + if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS)) + return ERR_PTR(-EINVAL); + ++ if ((clone_flags & CLONE_NEWUSER) && !unprivileged_userns_clone) ++ if (!capable(CAP_SYS_ADMIN)) ++ return ERR_PTR(-EPERM); ++ + /* + * Thread groups must share signals as well, and detached threads + * can only be started up within the thread group. +@@ -2819,6 +2828,12 @@ int ksys_unshare(unsigned long unshare_flags) + if (unshare_flags & CLONE_NEWNS) + unshare_flags |= CLONE_FS; + ++ if ((unshare_flags & CLONE_NEWUSER) && !unprivileged_userns_clone) { ++ err = -EPERM; ++ if (!capable(CAP_SYS_ADMIN)) ++ goto bad_unshare_out; ++ } ++ + err = check_unshare_flags(unshare_flags); + if (err) + goto bad_unshare_out; +diff --git a/kernel/sysctl.c b/kernel/sysctl.c +index 078950d9605b..baead3605bbe 100644 +--- a/kernel/sysctl.c ++++ b/kernel/sysctl.c +@@ -110,6 +110,9 @@ extern int core_uses_pid; + extern char core_pattern[]; + extern unsigned int core_pipe_limit; + #endif ++#ifdef CONFIG_USER_NS ++extern int unprivileged_userns_clone; ++#endif + extern int pid_max; + extern int pid_max_min, pid_max_max; + extern int percpu_pagelist_fraction; +@@ -545,6 +548,15 @@ static struct ctl_table kern_table[] = { + .proc_handler = proc_dointvec, + }, + #endif ++#ifdef CONFIG_USER_NS ++ { ++ .procname = "unprivileged_userns_clone", ++ .data = &unprivileged_userns_clone, ++ .maxlen = sizeof(int), ++ .mode = 0644, ++ .proc_handler = proc_dointvec, ++ }, ++#endif + #ifdef CONFIG_PROC_SYSCTL + { + .procname = "tainted", +diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c +index 8eadadc478f9..c36ecd19562c 100644 +--- a/kernel/user_namespace.c ++++ b/kernel/user_namespace.c +@@ -21,6 +21,13 @@ + #include <linux/bsearch.h> + #include <linux/sort.h> + ++/* sysctl */ ++#ifdef CONFIG_USER_NS_UNPRIVILEGED ++int unprivileged_userns_clone = 1; ++#else ++int unprivileged_userns_clone; ++#endif ++ + static struct kmem_cache *user_ns_cachep __read_mostly; + static DEFINE_MUTEX(userns_state_mutex); + +-- +2.23.0 + diff --git a/libre/linux-libre-lts/PKGBUILD b/libre/linux-libre-lts/PKGBUILD index 36bf92dc4..d3edc0b02 100644 --- a/libre/linux-libre-lts/PKGBUILD +++ b/libre/linux-libre-lts/PKGBUILD @@ -14,11 +14,11 @@ _replacesoldkernels=() # '%' gets replaced with kernel suffix _replacesoldmodules=() # '%' gets replaced with kernel suffix pkgbase=linux-libre-lts -pkgver=5.4.23 +pkgver=5.4.27 pkgrel=1 pkgdesc='LTS Linux-libre' -rcnver=5.4.23 -rcnrel=armv7-x19 +rcnver=5.4.24 +rcnrel=armv7-x20 url='https://linux-libre.fsfla.org/' arch=(i686 x86_64 armv7h) license=(GPL2) @@ -42,6 +42,9 @@ source=( # https://labs.parabola.nu/issues/877 # http://www.fsfla.org/pipermail/linux-libre/2015-November/003202.html 0002-fix-Atmel-maXTouch-touchscreen-support.patch + + # Arch's linux-lts patches + 0001-add-sysctl-and-CONFIG-for-unprivileged_userns_clone.patch ) source_armv7h=( # RCN patch (CM3 firmware deblobbed and bloatware removed) @@ -63,7 +66,7 @@ validpgpkeys=( ) sha512sums=('0d0915133864eb031adfc6700066147dcf3e768a50a31c39754950c95ef4fd322dc701cd50af49c403ef0325adfcb07e354d5e46c1be3dcdd719a7a55c963f37' 'SKIP' - '1913d3aae6b5eecf1a6240661eb2d201c4ced3ffb3b93758e642251a576e225be450e90deb7ce739fdeb63ec1e1276dd7bb4026dc75b7872ca743f19447b272a' + 'd21e75878ac5c3fdb651815d0aad5c70e4186eb0e6591a3dc182aa12a56f28ba1bb2312e64a487688abb4dad59d18b00e0e7380a57df5d8ba3e37f0f04b45612' 'SKIP' '13cb5bc42542e7b8bb104d5f68253f6609e463b6799800418af33eb0272cc269aaa36163c3e6f0aacbdaaa1d05e2827a4a7c4a08a029238439ed08b89c564bb3' 'SKIP' @@ -71,13 +74,14 @@ sha512sums=('0d0915133864eb031adfc6700066147dcf3e768a50a31c39754950c95ef4fd322dc 'SKIP' '267295aa0cea65684968420c68b32f1a66a22d018b9d2b2c1ef14267bcf4cb68aaf7099d073cbfefe6c25c8608bdcbbd45f7ac8893fdcecbf1e621abdfe9ecc1' 'SKIP' - '37f775d44c15aca1ed62cfff0c99bfb7e0c53b8bfcb6b848934a929278f8f0330298e434d05f2305c4625a96b06438c8e656c8806cd2b1e5c46b60a9d50ac078' - '944ce7474a2a969d09764d3259986afed8522cf9301d99d0273184f9e21d4441aa7df475bf35a04aa7b1726e110f4c106a1f835f33a086b9f3b59a3506065560' - '2b69e711072c1ec1d7a8e243aa2aea65ea30def29be737ccdf34f4b3354eb04a0c1dbca57977988b930e6be035caf8442025443ba206bae4464013aa57be6ca7' + '68d3c778423084c906a3b4138608737e9e36ac55b2c985833c23fa37620ff55ad1a8d458fbb1c6f76ec54f72eb66401aff59accb235c06294b0cfba48565cb6d' + '00fc844dcbf683b16cc5f187e597451e31273f418924ac87439536c8ba2d8f4e2ed902db4a02322ffd3df389f73cda94443f8a7b8133b7af714e56cbe00c6d76' + '1079d81e3eb69273022c601b50fce575b41a8042d8f91f95618ffce4cd01f948c69d52fbb2d3b05d9efe58e12fcef1b06498399dc0bda4bef38ab288047b18e1' 'aca591b5a2e838754e3c5fd2c0e50098ad54c2d0f990de5bf9cff8608e881daf0e37132294ed1a0e0a7b9e1c194c0b89f95da001d94febdb25a01c409060e3ac' '02af4dd2a007e41db0c63822c8ab3b80b5d25646af1906dc85d0ad9bb8bbf5236f8e381d7f91cf99ed4b0978c50aee37cb9567cdeef65b7ec3d91b882852b1af' - 'b8fe56e14006ab866970ddbd501c054ae37186ddc065bb869cf7d18db8c0d455118d5bda3255fb66a0dde38b544655cfe9040ffe46e41d19830b47959b2fb168') -sha512sums_armv7h=('944ac95a7f49c253effc4bd0ce560180b5fe0c06ef71573d82691fceda69985612145138b8ec28c629cc78715df9894e1aba8c572065c56c4a0c1e9af68bbc2e' + 'b8fe56e14006ab866970ddbd501c054ae37186ddc065bb869cf7d18db8c0d455118d5bda3255fb66a0dde38b544655cfe9040ffe46e41d19830b47959b2fb168' + '5f196378d50dd737d727e424d8f31b7fa8a6b92ba88f0a1467ef79bc37a097160da1fc1fd5cfb4b8983f36f2afdf27eb229ec61b35a15ac2343d660eb416a230') +sha512sums_armv7h=('a3e30f4cd4cfc30e06a7f4345c14d5ac4426cecb8b36db810effb84b03fcddc059f01562b2f426c27786ab9a5e2c970b5c2d52e6c7964aa9b63cb033c04c0877' 'SKIP' 'b576a9c40ba59485c350f71b9234d9e71f245e25b26382bd2f67019f3309c3b5705a6020eae0a9dfccacc763fb2056a5937c0a8ff4e64f99ba1d60f0b2acb03f' '85a13a274d4cbaca3ddbe8eaf883f1a1184765f8d09d6d40bb32defbe0876cb0153513e8db8671d7fc053e383ced793b74245ff29364a760e1a52bb36ebc8e85' diff --git a/libre/linux-libre-lts/config.armv7h b/libre/linux-libre-lts/config.armv7h index 14b7a4ed1..995b8758e 100644 --- a/libre/linux-libre-lts/config.armv7h +++ b/libre/linux-libre-lts/config.armv7h @@ -1,10 +1,10 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.4.21-gnu Kernel Configuration +# Linux/arm 5.4.27-gnu Kernel Configuration # # -# Compiler: arm-linux-gnueabi-gcc (GCC) 9.2.0 +# Compiler: gcc (GCC) 9.2.0 # CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=90200 @@ -162,6 +162,7 @@ CONFIG_NAMESPACES=y CONFIG_UTS_NS=y CONFIG_IPC_NS=y CONFIG_USER_NS=y +CONFIG_USER_NS_UNPRIVILEGED=y CONFIG_PID_NS=y CONFIG_NET_NS=y CONFIG_CHECKPOINT_RESTORE=y diff --git a/libre/linux-libre-lts/config.i686 b/libre/linux-libre-lts/config.i686 index c373bcb1d..170607e91 100644 --- a/libre/linux-libre-lts/config.i686 +++ b/libre/linux-libre-lts/config.i686 @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 5.4.21-gnu Kernel Configuration +# Linux/x86 5.4.27-gnu Kernel Configuration # # @@ -22,7 +22,6 @@ CONFIG_THREAD_INFO_IN_TASK=y # CONFIG_INIT_ENV_ARG_LIMIT=32 # CONFIG_COMPILE_TEST is not set -# CONFIG_HEADER_TEST is not set CONFIG_LOCALVERSION="" CONFIG_LOCALVERSION_AUTO=y CONFIG_BUILD_SALT="" @@ -175,6 +174,7 @@ CONFIG_NAMESPACES=y CONFIG_UTS_NS=y CONFIG_IPC_NS=y CONFIG_USER_NS=y +CONFIG_USER_NS_UNPRIVILEGED=y CONFIG_PID_NS=y CONFIG_NET_NS=y CONFIG_CHECKPOINT_RESTORE=y diff --git a/libre/linux-libre-lts/config.x86_64 b/libre/linux-libre-lts/config.x86_64 index 745637d63..d7ba19de1 100644 --- a/libre/linux-libre-lts/config.x86_64 +++ b/libre/linux-libre-lts/config.x86_64 @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 5.4.21-gnu Kernel Configuration +# Linux/x86 5.4.27-gnu Kernel Configuration # # @@ -181,6 +181,7 @@ CONFIG_NAMESPACES=y CONFIG_UTS_NS=y CONFIG_IPC_NS=y CONFIG_USER_NS=y +CONFIG_USER_NS_UNPRIVILEGED=y CONFIG_PID_NS=y CONFIG_NET_NS=y CONFIG_CHECKPOINT_RESTORE=y |