Skip to content
This repository has been archived by the owner on Aug 8, 2022. It is now read-only.

Commit

Permalink
Sync with -ARCH
Browse files Browse the repository at this point in the history
  • Loading branch information
sirlucjan committed Dec 8, 2017
1 parent fe80772 commit b4b708d
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 48 deletions.
3 changes: 2 additions & 1 deletion Files
Expand Up @@ -2,6 +2,7 @@
├── Files
├── README.md
└── linux-rt-bfq
├── 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
├── 0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch
├── 60-linux.hook
├── 90-linux.hook
Expand All @@ -12,4 +13,4 @@
├── linux.install
└── linux.preset

1 directory, 11 files
1 directory, 12 files
8 changes: 5 additions & 3 deletions linux-rt-bfq/.SRCINFO
@@ -1,8 +1,8 @@
# Generated by makepkg 5.0.2
# Tue Dec 5 14:38:56 UTC 2017
# Fri Dec 8 11:54:05 UTC 2017
pkgbase = linux-rt-bfq
pkgver = 4.14.3.5
pkgrel = 2
pkgrel = 3
url = https://github.com/Algodev-github/bfq-mq/
arch = x86_64
license = GPL2
Expand Down Expand Up @@ -36,6 +36,7 @@ pkgbase = linux-rt-bfq
source = 99-linux.hook
source = linux.preset
source = 0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch
source = 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
validpgpkeys = 64254695FFF0AA4466CC19E67B96E8162A8CF5D1
Expand All @@ -60,12 +61,13 @@ pkgbase = linux-rt-bfq
sha512sums = a1ccc22354a420467fb912f822585ed4573e68f4694f02ab83d7c8e352da88be495acb3cb4c451c27ca0cf0befe5925b8734d37205bb3dfdaf86d2dedef0798f
sha512sums = 5ca7ae20245a54caa71fb570d971d6872d4e888f35c6123b93fbca16baf9a0e2500d6ec931f3906e4faecaaca9cad0d593694d9cab617efd0cb7b5fc09c0fa48
sha512sums = 86f717f596c613db3bc40624fd956ed379b8a2a20d1d99e076ae9061251fe9afba39cf536623eccd970258e124b8c2c05643e3d539f37bd910e02dc5dd498749
sha512sums = 858af40e897318dc9f781ebe29c498e03161d5b6956daff9db1a44177b5934bc95618d6f36366ca4b9d73f13a203f3d42174f55f77b8e1bc9002fb1713e6cdad
sha512sums = 89c31b11957b0295014b36b96d980bd6ae6658003b27f373a44109f46e0008c3a7a166fb3fd06d30714480285af363e49445cc1eacf23e7176badc3a8ea18d92
sha512sums = 7ad5be75ee422dda3b80edd2eb614d8a9181e2c8228cd68b3881e2fb95953bf2dea6cbe7900ce1013c9de89b2802574b7b24869fc5d7a95d3cc3112c4d27063a
sha512sums = 4a8b324aee4cccf3a512ad04ce1a272d14e5b05c8de90feb82075f55ea3845948d817e1b0c6f298f5816834ddd3e5ce0a0e2619866289f3c1ab8fd2f35f04f44
sha512sums = 6346b66f54652256571ef65da8e46db49a95ac5978ecd57a507c6b2a28aee70bb3ff87045ac493f54257c9965da1046a28b72cb5abb0087204d257f14b91fd74
sha512sums = 2dc6b0ba8f7dbf19d2446c5c5f1823587de89f4e28e9595937dd51a87755099656f2acec50e3e2546ea633ad1bfd1c722e0c2b91eef1d609103d8abdc0a7cbaf
sha512sums = d1eb35e93c317a5d0b764cf3a6c183f17f9fadd9a9295dc36f0b9482b89fa6f2aba2b3011b2f3166282a7e3b2ed10f68ec824cb647f2e119ce014d31ba987d8d
sha512sums = 6fd42090bd39228ac625d0c2074ae55ac3e8368de63f550951c3ac6e6bfdbaf47ab67e018e21890b8ad75bb6706eff5dce05070ad6c281ecedf2a353d8871d96

pkgname = linux-rt-bfq
pkgdesc = Linux Kernel and modules with the RT patch and the BFQ scheduler.
Expand Down
@@ -0,0 +1,102 @@
From 5ec2dd3a095442ec1a21d86042a4994f2ba24e63 Mon Sep 17 00:00:00 2001
Message-Id: <5ec2dd3a095442ec1a21d86042a4994f2ba24e63.1512651251.git.jan.steffens@gmail.com>
From: Serge Hallyn <serge.hallyn@canonical.com>
Date: Fri, 31 May 2013 19:12:12 +0100
Subject: [PATCH] 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 07cc743698d3668e..4011d68a8ff9305c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -102,6 +102,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
@@ -1555,6 +1560,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.
@@ -2348,6 +2357,12 @@ SYSCALL_DEFINE1(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 b86520ed3fb60fbf..f7dab3760839f1a1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -105,6 +105,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;
@@ -513,6 +516,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 c490f1e4313b998a..dd03bd39d7bf194d 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -24,6 +24,9 @@
#include <linux/projid.h>
#include <linux/fs_struct.h>

+/* sysctl */
+int unprivileged_userns_clone;
+
static struct kmem_cache *user_ns_cachep __read_mostly;
static DEFINE_MUTEX(userns_state_mutex);

--
2.15.1

14 changes: 10 additions & 4 deletions linux-rt-bfq/PKGBUILD
Expand Up @@ -68,7 +68,7 @@ _pkgver=4.14.3
_rtver=5
_rtpatchver=rt${_rtver}
pkgver=${_pkgver}.${_rtver}
pkgrel=2
pkgrel=3
arch=('x86_64')
url="https://github.com/Algodev-github/bfq-mq/"
license=('GPL2')
Expand Down Expand Up @@ -110,7 +110,8 @@ source=("https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz"
'99-linux.hook'
# standard config files for mkinitcpio ramdisk
'linux.preset'
'0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch')
'0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch'
'0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch')

_kernelname=${pkgbase#linux}

Expand All @@ -129,6 +130,10 @@ prepare() {
msg "Fix bug #56207"
patch -Np1 -i ../0001-platform-x86-hp-wmi-Fix-tablet-mode-detection-for-co.patch

### Disable USER_NS for non-root users by default
msg "Disable USER_NS for non-root users by default"
patch -Np1 -i ../0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch

### A patch to fix a problem that ought to be fixed in the NVIDIA source code.
# Stops X from hanging on certain NVIDIA cards
msg "Fix-race-in-PRT-wait-for-completion-simple-wait-code_Nvidia-RT.patch"
Expand Down Expand Up @@ -449,12 +454,13 @@ sha512sums=('77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b
'a1ccc22354a420467fb912f822585ed4573e68f4694f02ab83d7c8e352da88be495acb3cb4c451c27ca0cf0befe5925b8734d37205bb3dfdaf86d2dedef0798f'
'5ca7ae20245a54caa71fb570d971d6872d4e888f35c6123b93fbca16baf9a0e2500d6ec931f3906e4faecaaca9cad0d593694d9cab617efd0cb7b5fc09c0fa48'
'86f717f596c613db3bc40624fd956ed379b8a2a20d1d99e076ae9061251fe9afba39cf536623eccd970258e124b8c2c05643e3d539f37bd910e02dc5dd498749'
'858af40e897318dc9f781ebe29c498e03161d5b6956daff9db1a44177b5934bc95618d6f36366ca4b9d73f13a203f3d42174f55f77b8e1bc9002fb1713e6cdad'
'89c31b11957b0295014b36b96d980bd6ae6658003b27f373a44109f46e0008c3a7a166fb3fd06d30714480285af363e49445cc1eacf23e7176badc3a8ea18d92'
'7ad5be75ee422dda3b80edd2eb614d8a9181e2c8228cd68b3881e2fb95953bf2dea6cbe7900ce1013c9de89b2802574b7b24869fc5d7a95d3cc3112c4d27063a'
'4a8b324aee4cccf3a512ad04ce1a272d14e5b05c8de90feb82075f55ea3845948d817e1b0c6f298f5816834ddd3e5ce0a0e2619866289f3c1ab8fd2f35f04f44'
'6346b66f54652256571ef65da8e46db49a95ac5978ecd57a507c6b2a28aee70bb3ff87045ac493f54257c9965da1046a28b72cb5abb0087204d257f14b91fd74'
'2dc6b0ba8f7dbf19d2446c5c5f1823587de89f4e28e9595937dd51a87755099656f2acec50e3e2546ea633ad1bfd1c722e0c2b91eef1d609103d8abdc0a7cbaf'
'd1eb35e93c317a5d0b764cf3a6c183f17f9fadd9a9295dc36f0b9482b89fa6f2aba2b3011b2f3166282a7e3b2ed10f68ec824cb647f2e119ce014d31ba987d8d')
'd1eb35e93c317a5d0b764cf3a6c183f17f9fadd9a9295dc36f0b9482b89fa6f2aba2b3011b2f3166282a7e3b2ed10f68ec824cb647f2e119ce014d31ba987d8d'
'6fd42090bd39228ac625d0c2074ae55ac3e8368de63f550951c3ac6e6bfdbaf47ab67e018e21890b8ad75bb6706eff5dce05070ad6c281ecedf2a353d8871d96')

validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
Expand Down

0 comments on commit b4b708d

Please sign in to comment.