summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-08-11 22:08:49 +0200
committerErich Eckner <git@eckner.net>2020-08-11 22:08:49 +0200
commitb37a569729346fa4b7e2b73753978f0d3818ea6b (patch)
tree7c72d8fe13c2b6644e037228db4b52196307a1c0
parent6c165e6630fde74f4bdc786a2ac9d906cd58d77b (diff)
downloadpackages-b37a569729346fa4b7e2b73753978f0d3818ea6b.tar.xz
extra/linux-pae: drop 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
-rw-r--r--extra/linux-pae/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch93
-rw-r--r--extra/linux-pae/PKGBUILD4
2 files changed, 0 insertions, 97 deletions
diff --git a/extra/linux-pae/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch b/extra/linux-pae/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
deleted file mode 100644
index 1e64e19f..00000000
--- a/extra/linux-pae/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 9a5adbc45b1c7d43fe4b27936f2a6939660617a1 Mon Sep 17 00:00:00 2001
-Message-Id: <9a5adbc45b1c7d43fe4b27936f2a6939660617a1.1528777685.git.jan.steffens@gmail.com>
-From: Serge Hallyn <serge.hallyn@canonical.com>
-Date: Fri, 31 May 2013 19:12:12 +0100
-Subject: [PATCH 1/3] add sysctl to disallow unprivileged CLONE_NEWUSER by
- default
-
-Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
-[bwh: Remove unneeded binary sysctl bits]
-Signed-off-by: Daniel Micay <danielmicay@gmail.com>
----
- kernel/fork.c | 15 +++++++++++++++
- kernel/sysctl.c | 12 ++++++++++++
- kernel/user_namespace.c | 3 +++
- 3 files changed, 30 insertions(+)
-
-diff --git a/kernel/fork.c b/kernel/fork.c
-index a5d21c42acfc..675eb3f3a1d1 100644
---- a/kernel/fork.c
-+++ b/kernel/fork.c
-@@ -103,6 +103,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
-@@ -1592,6 +1597,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.
-@@ -2386,6 +2395,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 6a78cf70761d..35a1d24282f4 100644
---- a/kernel/sysctl.c
-+++ b/kernel/sysctl.c
-@@ -519,6 +522,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 246d4d4ce5c7..f64432b45cec 100644
---- a/kernel/user_namespace.c
-+++ b/kernel/user_namespace.c
-@@ -26,6 +26,9 @@
- #include <linux/bsearch.h>
- #include <linux/sort.h>
-
-+/* sysctl */
-+int unprivileged_userns_clone;
-+
- static struct kmem_cache *user_ns_cachep __read_mostly;
- static DEFINE_MUTEX(userns_state_mutex);
-
---
-2.17.1
-
diff --git a/extra/linux-pae/PKGBUILD b/extra/linux-pae/PKGBUILD
index 9cf7aac7..995f0c0d 100644
--- a/extra/linux-pae/PKGBUILD
+++ b/extra/linux-pae/PKGBUILD
@@ -18,7 +18,6 @@ source=(
60-linux.hook # pacman hook for depmod
90-linux.hook # pacman hook for initramfs regeneration
linux.preset # standard config files for mkinitcpio ramdisk
- 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
)
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
@@ -41,9 +40,6 @@ prepare() {
# add latest fixes from stable queue, if needed
# http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
- # disable USER_NS for non-root users by default
- patch -Np1 -i ../0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
-
cat ../config - >.config <<END
CONFIG_LOCALVERSION="${_kernelname}"
CONFIG_LOCALVERSION_AUTO=n