From 52de63b5deeb64a0897b7933fe883a2a67c8fd27 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 26 Mar 2023 09:28:19 +0200 Subject: added adapted version of linux-lts510 (for 32-bit) --- adapted/linux-lts510/.SRCINFO | 52 + ...ctl-and-CONFIG-to-disallow-unprivileged-C.patch | 151 + adapted/linux-lts510/PKGBUILD | 265 + adapted/linux-lts510/config | 10348 +++++++++++++++++++ adapted/linux-lts510/config.pentium4 | 10192 ++++++++++++++++++ adapted/linux-lts510/no-ultra-zstd.patch | 12 + 6 files changed, 21020 insertions(+) create mode 100644 adapted/linux-lts510/.SRCINFO create mode 100644 adapted/linux-lts510/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch create mode 100644 adapted/linux-lts510/PKGBUILD create mode 100644 adapted/linux-lts510/config create mode 100644 adapted/linux-lts510/config.pentium4 create mode 100644 adapted/linux-lts510/no-ultra-zstd.patch (limited to 'adapted') diff --git a/adapted/linux-lts510/.SRCINFO b/adapted/linux-lts510/.SRCINFO new file mode 100644 index 0000000..6251451 --- /dev/null +++ b/adapted/linux-lts510/.SRCINFO @@ -0,0 +1,52 @@ +pkgbase = linux-lts510 + pkgdesc = LTS 5.10 Linux + pkgver = 5.10.174 + pkgrel = 1 + url = https://www.kernel.org/ + arch = x86_64 + license = GPL2 + makedepends = bc + makedepends = kmod + makedepends = libelf + makedepends = pahole + makedepends = cpio + makedepends = perl + makedepends = tar + makedepends = xz + makedepends = xmlto + makedepends = python-sphinx + makedepends = python-sphinx_rtd_theme + makedepends = python-six + makedepends = graphviz + makedepends = imagemagick + options = !strip + source = https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.174.tar.xz + source = https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.174.tar.sign + source = config + source = 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch + validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 + validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E + md5sums = 49849fe2fe687ce3b65a9f551a9b5cac + md5sums = SKIP + md5sums = 8b8fa773fe9c7938a76ba07ca2933ed8 + md5sums = d31360693fb06a0d69c1f126350baa6d + sha256sums = 2f8a0cd000d5839f0ff44ba0f3b4f9a3253ea5f78ae2a1c7484ad3fb1e8a4a24 + sha256sums = SKIP + sha256sums = ddc8d7c604a2f8373a25674d06cd377fdf80adca9bd426f4c8a50f3d52403001 + sha256sums = 96a72e1652314215da7140956c3abcf495cafd00811eda3cf4ce03ec5f791f1e + +pkgname = linux-lts510 + pkgdesc = The LTS 5.10 Linux kernel and modules + depends = coreutils + depends = kmod + depends = initramfs + optdepends = crda: to set the correct wireless channels of your country + optdepends = linux-firmware: firmware images needed for some devices + provides = VIRTUALBOX-GUEST-MODULES + provides = WIREGUARD-MODULE + +pkgname = linux-lts510-headers + pkgdesc = Headers and scripts for building modules for the LTS 5.10 Linux kernel + +pkgname = linux-lts510-docs + pkgdesc = Documentation for the LTS 5.10 Linux kernel diff --git a/adapted/linux-lts510/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch b/adapted/linux-lts510/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch new file mode 100644 index 0000000..5e275b0 --- /dev/null +++ b/adapted/linux-lts510/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch @@ -0,0 +1,151 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +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. +--- + include/linux/user_namespace.h | 4 ++++ + init/Kconfig | 16 ++++++++++++++++ + kernel/fork.c | 14 ++++++++++++++ + kernel/sysctl.c | 12 ++++++++++++ + kernel/user_namespace.c | 7 +++++++ + 5 files changed, 53 insertions(+) + +diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h +index 7616c7bf4b24..bdbfcfe5df1e 100644 +--- a/include/linux/user_namespace.h ++++ b/include/linux/user_namespace.h +@@ -109,6 +109,8 @@ void dec_ucount(struct ucounts *ucounts, enum ucount_type type); + + #ifdef CONFIG_USER_NS + ++extern int unprivileged_userns_clone; ++ + static inline struct user_namespace *get_user_ns(struct user_namespace *ns) + { + if (ns) +@@ -142,6 +144,8 @@ extern bool current_in_userns(const struct user_namespace *target_ns); + struct ns_common *ns_get_owner(struct ns_common *ns); + #else + ++#define unprivileged_userns_clone 0 ++ + static inline struct user_namespace *get_user_ns(struct user_namespace *ns) + { + return &init_user_ns; +diff --git a/init/Kconfig b/init/Kconfig +index fc4c9f416fad..3707cc8b4d7b 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1172,6 +1172,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 7c044d377926..3c70b2fe5946 100644 +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -97,6 +97,10 @@ + #include + #include + ++#ifdef CONFIG_USER_NS ++#include ++#endif ++ + #include + #include + #include +@@ -1871,6 +1875,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. +@@ -2936,6 +2944,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 b9306d2bb426..891b250db88e 100644 +--- a/kernel/sysctl.c ++++ b/kernel/sysctl.c +@@ -103,6 +103,9 @@ + #ifdef CONFIG_LOCKUP_DETECTOR + #include + #endif ++#ifdef CONFIG_USER_NS ++#include ++#endif + + #if defined(CONFIG_SYSCTL) + +@@ -1902,6 +1905,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 ce396ea4de60..c3a6ef1f10ed 100644 +--- a/kernel/user_namespace.c ++++ b/kernel/user_namespace.c +@@ -21,6 +21,13 @@ + #include + #include + ++/* 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); + diff --git a/adapted/linux-lts510/PKGBUILD b/adapted/linux-lts510/PKGBUILD new file mode 100644 index 0000000..71ee099 --- /dev/null +++ b/adapted/linux-lts510/PKGBUILD @@ -0,0 +1,265 @@ +# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com +# Contributor: Jonathon Fernyhough +# Contributor: Andreas Radke + +pkgbase=linux-lts510 +pkgver=5.10.176 +pkgrel=2 +pkgdesc='LTS 5.10 Linux' +url="https://www.kernel.org/" +arch=(x86_64 pentium4 i686 i486) +license=(GPL2) +makedepends=( + bc kmod libelf pahole cpio perl tar xz + xmlto python-sphinx python-sphinx_rtd_theme python-six graphviz imagemagick +) +options=('!strip') +_srcname=linux-$pkgver +source=( + https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.{xz,sign} + config # the main kernel config file + 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch +) +validpgpkeys=( + 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds + '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman +) +# https://www.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc +sha256sums=('ce072c60ba04173e05b2a1de3fefdeba5ac8b28b1958d92d21bdbf9b736ef793' + 'SKIP' + '83a9abaa95fb30465e630cf44020300c68b44247e6d7933efaf756d10d93d063' + '96a72e1652314215da7140956c3abcf495cafd00811eda3cf4ce03ec5f791f1e') + +export KBUILD_BUILD_HOST=archlinux +export KBUILD_BUILD_USER=$pkgbase +export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" + +prepare() { + cd $_srcname + + echo "Setting version..." + scripts/setlocalversion --save-scmversion + echo "-$pkgrel" > localversion.10-pkgrel + echo "${pkgbase#linux}" > localversion.20-pkgname + + local src + for src in "${source[@]}"; do + src="${src%%::*}" + src="${src##*/}" + [[ $src = *.patch ]] || continue + echo "Applying patch $src..." + patch -Np1 < "../$src" + done + + echo "Setting config..." + cp ../config .config + make olddefconfig + + make -s kernelrelease > version + echo "Prepared $pkgbase version $( $@ + + quiet_cmd_zstd22 = ZSTD22 $@ +- cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@ ++ cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@ + + # ASM offsets + # --------------------------------------------------------------------------- -- cgit v1.2.3-54-g00ecf