From 14654ab7f56631ebf367baf817fe48a103c4807d Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Wed, 11 Jun 2025 22:34:42 +0200 Subject: [PATCH] device: Move selinux compile fix to shared patches Prepare for this patch to be used by other kernels. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6670 --- ...locate-ss_initialized-and-selinux_e.patch} | 0 .../downstream/linux-oneplus-billie2/APKBUILD | 4 +- ...elocate-ss_initialized-and-selinux_e.patch | 1 + ...elocate-ss_initialized-and-selinux_e.patch | 82 ------------------- device/downstream/linux-xiaomi-monet/APKBUILD | 4 +- ...elocate-ss_initialized-and-selinux_e.patch | 1 + 6 files changed, 6 insertions(+), 86 deletions(-) rename device/{downstream/linux-oneplus-billie2/0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch => .shared-patches/linux/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch} (100%) create mode 120000 device/downstream/linux-oneplus-billie2/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch delete mode 100644 device/downstream/linux-xiaomi-monet/0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch create mode 120000 device/downstream/linux-xiaomi-monet/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch diff --git a/device/downstream/linux-oneplus-billie2/0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch b/device/.shared-patches/linux/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch similarity index 100% rename from device/downstream/linux-oneplus-billie2/0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch rename to device/.shared-patches/linux/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch diff --git a/device/downstream/linux-oneplus-billie2/APKBUILD b/device/downstream/linux-oneplus-billie2/APKBUILD index 876e3cf18..d75604bc0 100644 --- a/device/downstream/linux-oneplus-billie2/APKBUILD +++ b/device/downstream/linux-oneplus-billie2/APKBUILD @@ -27,7 +27,7 @@ source=" 0005-Remove-inline-from-external-functions.patch 0006-Suppress-error-about-static-buffer-overflow.patch 0007-linux4.17-gcc10-extern_YYLOC_global_declaration.patch - 0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch + Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch " builddir="$srcdir/$_repository-$_commit" _outdir="out" @@ -71,5 +71,5 @@ f8727c9c3b6c42ac921bd31fd05dc507e02a53c1c158fe7b67e75db482067b77ab9e2ffe33088c04 aba7ae12986a2df81c6993f369390c6b3f5586fa70ab747e03d59aaf08cb79482a44eab723aed4469e98cadea0f70912f4e67caaf67cc279e1dc85e485b93a0f 0005-Remove-inline-from-external-functions.patch 3835f7e4fca12aaba82fe21cc9632f0e569a8c4405231d137aea4f2640190d919e1a44612082decfbaaa41faa3c6a3ff0442086afb81d59c984a5697fdb9cac9 0006-Suppress-error-about-static-buffer-overflow.patch 27827877040007fc1c4c719f7e2e19e5c272d44972415cfc53feba0313d87e4074f8204bdb13cbc5fe21ea61bf595314b68f10c081e7b7bac3c888b60f008acf 0007-linux4.17-gcc10-extern_YYLOC_global_declaration.patch -16459200092a2fa68054a758ad8fb175c86e6cdaa49e81c0c91568082cd0348526d43b9dfe0faac8b21465240f44253683f9c475c6f7350d7ef74149aa9c1dba 0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch +16459200092a2fa68054a758ad8fb175c86e6cdaa49e81c0c91568082cd0348526d43b9dfe0faac8b21465240f44253683f9c475c6f7350d7ef74149aa9c1dba Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch " diff --git a/device/downstream/linux-oneplus-billie2/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch b/device/downstream/linux-oneplus-billie2/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch new file mode 120000 index 000000000..88826a287 --- /dev/null +++ b/device/downstream/linux-oneplus-billie2/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch @@ -0,0 +1 @@ +../../.shared-patches/linux/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch \ No newline at end of file diff --git a/device/downstream/linux-xiaomi-monet/0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch b/device/downstream/linux-xiaomi-monet/0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch deleted file mode 100644 index b34e55fd7..000000000 --- a/device/downstream/linux-xiaomi-monet/0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch +++ /dev/null @@ -1,82 +0,0 @@ -From ce0249eb837abad6d8829d5f964a3338be8aca67 Mon Sep 17 00:00:00 2001 -From: Nick Desaulniers -Date: Tue, 10 Mar 2020 15:36:45 -0700 -Subject: [PATCH] Revert "selinux: Relocate ss_initialized and - selinux_enforcing to separate 4k" - -This reverts commit 50240fa8416f5fd183cb147fd3c66aeaeb74a1f8. - -That out of tree patch causes the resulting kernel image to be too -large, causing ld.lld to error; since .bss is specified twice. - -Fixes the observed error: -ld.lld: error: output file too large: 18446743524330100280 bytes - -when using LLD without LTO enabled. - -Bug: 151154720 -Reported-by: Matthias Maennich -Debugged-by: Fangrui Song -Signed-off-by: Nick Desaulniers -Change-Id: Iebb8135630132cd4ae49f3d2d1e85bd61cfa6111 ---- - arch/arm64/kernel/vmlinux.lds.S | 8 -------- - include/linux/init.h | 2 -- - security/selinux/hooks.c | 2 +- - 3 files changed, 1 insertion(+), 11 deletions(-) - -diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S -index 86a57e2fa9af..05df6fffedea 100644 ---- a/arch/arm64/kernel/vmlinux.lds.S -+++ b/arch/arm64/kernel/vmlinux.lds.S -@@ -76,10 +76,6 @@ jiffies = jiffies_64; - #define TRAMP_TEXT - #endif - --#define RTIC_BSS \ -- . = ALIGN(PAGE_SIZE); \ -- KEEP(*(.bss.rtic)); \ -- . = ALIGN(PAGE_SIZE); \ - /* - * The size of the PE/COFF section that covers the kernel image, which - * runs from stext to _edata, must be a round multiple of the PE/COFF -@@ -260,10 +256,6 @@ SECTIONS - STABS_DEBUG - - HEAD_SYMBOLS -- -- .bss : { /* bss segment */ -- RTIC_BSS -- } - } - - /* -diff --git a/include/linux/init.h b/include/linux/init.h -index bc719c7da735..586dd187e22f 100644 ---- a/include/linux/init.h -+++ b/include/linux/init.h -@@ -322,8 +322,6 @@ void __init parse_early_options(char *cmdline); - /* Data marked not to be saved by software suspend */ - #define __nosavedata __section(.data..nosave) - --#define __rticdata __attribute__((section(".bss.rtic"))) -- - #ifdef MODULE - #define __exit_p(x) x - #else -diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c -index 305890cab97b..d4e1e63a55d6 100644 ---- a/security/selinux/hooks.c -+++ b/security/selinux/hooks.c -@@ -100,7 +100,7 @@ - #include "audit.h" - #include "avc_ss.h" - --struct selinux_state selinux_state __rticdata; -+struct selinux_state selinux_state; - - /* SECMARK reference count */ - static atomic_t selinux_secmark_refcount = ATOMIC_INIT(0); --- -2.39.2 - diff --git a/device/downstream/linux-xiaomi-monet/APKBUILD b/device/downstream/linux-xiaomi-monet/APKBUILD index 9f1db857b..8e0b91aa9 100644 --- a/device/downstream/linux-xiaomi-monet/APKBUILD +++ b/device/downstream/linux-xiaomi-monet/APKBUILD @@ -32,7 +32,7 @@ source=" Remove-gcc-python-wrapper.patch selinux_include_generated_headers.patch Suppress-error-about-static-buffer-overflow.patch - 0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch + Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch " builddir="$srcdir/$_repository-$_commit" @@ -63,5 +63,5 @@ sha512sums=" 359f619b7aac5bab061311f0806018ed04ce96a2233584a507b14c50ce616dfbc1681dd465ca3f0182165a6fc6c7b87435615bd1bd93efe174b95deba071f5fc Remove-gcc-python-wrapper.patch 6ab9db01d35f7f5cc2c19ebe5f65a7dc479a1c68de587300cdde9a6c759d34610666c72f0f321cd450cf56c13df3b54a774e0f7ebdbf0f8608fbfd66b49d04e7 selinux_include_generated_headers.patch 4e7a73a1c6e8424a34d317899525ca3d783de1a5e65cc0ecdf6334bbb233d165b476107e599cbd86868ed91a5a60d2ef0eff975861d61cb2c403b572314b4a94 Suppress-error-about-static-buffer-overflow.patch -16459200092a2fa68054a758ad8fb175c86e6cdaa49e81c0c91568082cd0348526d43b9dfe0faac8b21465240f44253683f9c475c6f7350d7ef74149aa9c1dba 0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch +16459200092a2fa68054a758ad8fb175c86e6cdaa49e81c0c91568082cd0348526d43b9dfe0faac8b21465240f44253683f9c475c6f7350d7ef74149aa9c1dba Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch " diff --git a/device/downstream/linux-xiaomi-monet/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch b/device/downstream/linux-xiaomi-monet/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch new file mode 120000 index 000000000..88826a287 --- /dev/null +++ b/device/downstream/linux-xiaomi-monet/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch @@ -0,0 +1 @@ +../../.shared-patches/linux/Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch \ No newline at end of file