From 27b982cfc22ad4570cfcedb6bcdf8b6da71e54fb Mon Sep 17 00:00:00 2001 From: Aisha Tammy Date: Thu, 23 Dec 2021 14:54:47 +0000 Subject: [PATCH] sys-kernel/uek-sources: unbreakable enterprise kernel from oracle Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Aisha Tammy --- sys-kernel/uek-sources/Manifest | 4 + ....4.17.2136.303.1-ip6_sock_set_v6only.patch | 77 +++++++++++++++++++ sys-kernel/uek-sources/metadata.xml | 12 +++ .../uek-sources-5.4.17.2136.303.2.ebuild | 66 ++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 sys-kernel/uek-sources/Manifest create mode 100644 sys-kernel/uek-sources/files/uek-sources-5.4.17.2136.303.1-ip6_sock_set_v6only.patch create mode 100644 sys-kernel/uek-sources/metadata.xml create mode 100644 sys-kernel/uek-sources/uek-sources-5.4.17.2136.303.2.ebuild diff --git a/sys-kernel/uek-sources/Manifest b/sys-kernel/uek-sources/Manifest new file mode 100644 index 0000000000..31399fb85f --- /dev/null +++ b/sys-kernel/uek-sources/Manifest @@ -0,0 +1,4 @@ +DIST genpatches-5.4-160.base.tar.xz 4078816 BLAKE2B 478bc44ce285e02c37b4452fae6948ca61d0ae841328444e91403a517d398c416cd91a232d057c27a2c3994df19626475566e832457310744d20b700a854ab43 SHA512 ab1500a95a8f9295a6f5ebb7f9c0beb24bf1d0f6d67ca03e1135dc6724e74fe33f5025fba96ba2fd1d96078a20e5099ba1c1e0f1be149d01ebcaa991ff5c2dae +DIST genpatches-5.4-160.experimental.tar.xz 16900 BLAKE2B 70a2f442ad7309b617b0dd98a00e35ec195674a3dbbb5b88afd404fe1672e32a0b28182f6646ef325166b8cc9fda570104045d96afcf316bf13bc80df0ed5d68 SHA512 3f8cc1082156159bb7100997de0f0ecaa440928a0eed9cf81e3ad93fe2b6e10f9f180acc501e9bbf816a8e05c07d15d94e5719dfe48b829f5045861a4a25e4ef +DIST genpatches-5.4-160.extras.tar.xz 1784 BLAKE2B 8184089c122bb794bc18181ed165b2d03b301f336730b3579c92780b8a551d75963051a0c3c2ce8015a8e7102fda224e7a069ddc5fb5ea90d313637879602270 SHA512 f304a0b349c1a2f42297595ef732a6e31a7babfc71031b56e7e81e14b030cbbcefc25b49429381b47bb60676f63a3ca86b24de333a4ca928825fb2fb59109839 +DIST linux-uek-5.4.17-2136.303.2.tar.gz 175372092 BLAKE2B f1ba14a01690c839ccf0a508cc899870d6c932fc081132f35cc5d35ce1dd3d083deb9e7d3d57f9ef11eef547d0511f83edee3e5003183321d2e4aec802e31509 SHA512 1f53296cac7d2f9e406947182cb7a1836669b1132b72ad551102a19bb3c21b62353381c7d5b6da39e9faf2c014b1860278ae51941af365447b6a8e409e40a118 diff --git a/sys-kernel/uek-sources/files/uek-sources-5.4.17.2136.303.1-ip6_sock_set_v6only.patch b/sys-kernel/uek-sources/files/uek-sources-5.4.17.2136.303.1-ip6_sock_set_v6only.patch new file mode 100644 index 0000000000..c794320ebb --- /dev/null +++ b/sys-kernel/uek-sources/files/uek-sources-5.4.17.2136.303.1-ip6_sock_set_v6only.patch @@ -0,0 +1,77 @@ +From 9b115749acb24d11083ded4fe947ddd654a940e3 Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig +Date: Thu, 28 May 2020 07:12:31 +0200 +Subject: [PATCH] ipv6: add ip6_sock_set_v6only + +Add a helper to directly set the IPV6_V6ONLY sockopt from kernel space +without going through a fake uaccess. + +Signed-off-by: Christoph Hellwig +Signed-off-by: David S. Miller +--- + include/net/ipv6.h | 11 +++++++++++ + net/ipv6/ip6_udp_tunnel.c | 5 +---- + net/sunrpc/svcsock.c | 6 +----- + 3 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/include/net/ipv6.h b/include/net/ipv6.h +index 39a00d3ef5e220..9b91188c9a74c7 100644 +--- a/include/net/ipv6.h ++++ b/include/net/ipv6.h +@@ -1177,4 +1177,15 @@ int ipv6_sock_mc_join_ssm(struct sock *sk, int ifindex, + const struct in6_addr *addr, unsigned int mode); + int ipv6_sock_mc_drop(struct sock *sk, int ifindex, + const struct in6_addr *addr); ++ ++static inline int ip6_sock_set_v6only(struct sock *sk) ++{ ++ if (inet_sk(sk)->inet_num) ++ return -EINVAL; ++ lock_sock(sk); ++ sk->sk_ipv6only = true; ++ release_sock(sk); ++ return 0; ++} ++ + #endif /* _NET_IPV6_H */ +diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c +index 6523609516d25a..2e0ad1bc84a835 100644 +--- a/net/ipv6/ip6_udp_tunnel.c ++++ b/net/ipv6/ip6_udp_tunnel.c +@@ -25,10 +25,7 @@ int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg, + goto error; + + if (cfg->ipv6_v6only) { +- int val = 1; +- +- err = kernel_setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, +- (char *) &val, sizeof(val)); ++ err = ip6_sock_set_v6only(sock->sk); + if (err < 0) + goto error; + } +diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c +index 7a805d165689c3..a391892977cd27 100644 +--- a/net/sunrpc/svcsock.c ++++ b/net/sunrpc/svcsock.c +@@ -1328,7 +1328,6 @@ static struct svc_xprt *svc_create_socket(struct svc_serv *serv, + struct sockaddr *newsin = (struct sockaddr *)&addr; + int newlen; + int family; +- int val; + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); + + dprintk("svc: svc_create_socket(%s, %d, %s)\n", +@@ -1364,11 +1363,8 @@ static struct svc_xprt *svc_create_socket(struct svc_serv *serv, + * getting requests from IPv4 remotes. Those should + * be shunted to a PF_INET listener via rpcbind. + */ +- val = 1; + if (family == PF_INET6) +- kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, +- (char *)&val, sizeof(val)); +- ++ ip6_sock_set_v6only(sock->sk); + if (type == SOCK_STREAM) + sock->sk->sk_reuse = SK_CAN_REUSE; /* allow address reuse */ + error = kernel_bind(sock, sin, len); diff --git a/sys-kernel/uek-sources/metadata.xml b/sys-kernel/uek-sources/metadata.xml new file mode 100644 index 0000000000..e0dd3f97bb --- /dev/null +++ b/sys-kernel/uek-sources/metadata.xml @@ -0,0 +1,12 @@ + + + + + gentoo@aisha.cc + Aisha Tammy + + + apply base gentoo genpatches + apply experimental gentoo genpatches + + diff --git a/sys-kernel/uek-sources/uek-sources-5.4.17.2136.303.2.ebuild b/sys-kernel/uek-sources/uek-sources-5.4.17.2136.303.2.ebuild new file mode 100644 index 0000000000..2688c1c443 --- /dev/null +++ b/sys-kernel/uek-sources/uek-sources-5.4.17.2136.303.2.ebuild @@ -0,0 +1,66 @@ +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +KERNEL_VERSION=$(ver_cut 1-3) +KERNEL_TRUNK=$(ver_cut 1-2) +UEK_PATCH_VERSION=$(ver_cut 4-6) +UEK_VERSION="${KERNEL_VERSION}-${UEK_PATCH_VERSION}" + +ETYPE="sources" + +K_GENPATCHES_VER="160" +K_SECURITY_UNSUPPORTED="1" +CKV="${KERNEL_VERSION}_p${UEK_PATCH_VERSION}" + +inherit kernel-2 +detect_version +detect_arch + +DESCRIPTION="Unbreakable Enterprise Kernel (UEK) sources built from Oracle" +HOMEPAGE="https://github.com/oracle/linux-uek" +SRC_URI=" + https://github.com/oracle/linux-uek/archive/refs/tags/v${UEK_VERSION}.tar.gz + -> linux-uek-${UEK_VERSION}.tar.gz + https://dev.gentoo.org/~mpagano/genpatches/tarballs/genpatches-${KERNEL_TRUNK}-${K_GENPATCHES_VER}.base.tar.xz + https://dev.gentoo.org/~mpagano/genpatches/tarballs/genpatches-${KERNEL_TRUNK}-${K_GENPATCHES_VER}.experimental.tar.xz + https://dev.gentoo.org/~mpagano/genpatches/tarballs/genpatches-${KERNEL_TRUNK}-${K_GENPATCHES_VER}.extras.tar.xz +" +S="${WORKDIR}/linux-uek-${UEK_VERSION}" + +LICENSE="GPL-2" +KEYWORDS="~amd64" +IUSE="+gentoo experimental" + +PATCHES=( + "${FILESDIR}"/uek-sources-5.4.17.2136.303.1-ip6_sock_set_v6only.patch +) + +src_unpack() { + default + + # remove all backup files + find . -iname "*~" -print -exec rm {} \; 2>/dev/null + + unpack_set_extraversion + unpack_fix_install_path + + env_setup_xmakeopts +} + +src_prepare() { + use gentoo && PATCHES+=( + "${WORKDIR}"/1500_XATTR_USER_PREFIX.patch + "${WORKDIR}"/1510_fs-enable-link-security-restrictions-by-default.patch + "${WORKDIR}"/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch + "${WORKDIR}"/2600_enable-key-swapping-for-apple-mac.patch + "${WORKDIR}"/2920_sign-file-patch-for-libressl.patch + "${WORKDIR}"/4567_distro-Gentoo-Kconfig.patch + ) + use experimental && PATCHES+=( + "${WORKDIR}"/5000_shifts-ubuntu-20.04.patch + "${WORKDIR}"/5010_enable-cpu-optimizations-universal.patch + ) + default +}