vmlinux.lds.h: Move LSM_TABLE into INIT_DATA
authorKees Cook <keescook@chromium.org>
Thu, 11 Oct 2018 00:18:22 +0000 (17:18 -0700)
committerJames Morris <james.morris@microsoft.com>
Thu, 11 Oct 2018 03:40:21 +0000 (20:40 -0700)
Since the struct lsm_info table is not an initcall, we can just move it
into INIT_DATA like all the other tables.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Reviewed-by: James Morris <james.morris@microsoft.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
arch/arc/kernel/vmlinux.lds.S
arch/arm/kernel/vmlinux-xip.lds.S
arch/arm64/kernel/vmlinux.lds.S
arch/h8300/kernel/vmlinux.lds.S
arch/microblaze/kernel/vmlinux.lds.S
arch/powerpc/kernel/vmlinux.lds.S
arch/um/include/asm/common.lds.S
arch/xtensa/kernel/vmlinux.lds.S
include/asm-generic/vmlinux.lds.h

index f35ed578e007ec4fd472c0efe6ab6849f281bea9..8fb16bdabdcf7aa06af4e2fe4ae4309ae3faf485 100644 (file)
@@ -71,7 +71,6 @@ SECTIONS
                INIT_SETUP(L1_CACHE_BYTES)
                INIT_CALLS
                CON_INITCALL
-               SECURITY_INITCALL
        }
 
        .init.arch.info : {
index 3593d5c1acd23fbbcb031ec26c270536d593b2c9..8c74037ade22958688e4766e4ef762a6cad514d9 100644 (file)
@@ -96,7 +96,6 @@ SECTIONS
                INIT_SETUP(16)
                INIT_CALLS
                CON_INITCALL
-               SECURITY_INITCALL
                INIT_RAM_FS
        }
 
index 605d1b60469c2488f28a097965a4636d46bb9d52..7d23d591b03c66c860a54eabde21de750493a418 100644 (file)
@@ -166,7 +166,6 @@ SECTIONS
                INIT_SETUP(16)
                INIT_CALLS
                CON_INITCALL
-               SECURITY_INITCALL
                INIT_RAM_FS
                *(.init.rodata.* .init.bss)     /* from the EFI stub */
        }
index 35716a3048de0b5da2a88fc03449c9d27cbe274b..49f716c0a1df977d5981c6b80dc4e126c282cb83 100644 (file)
@@ -56,7 +56,6 @@ SECTIONS
        __init_begin = .;
        INIT_TEXT_SECTION(4)
        INIT_DATA_SECTION(4)
-       SECURITY_INIT
        __init_end = .;
        _edata = . ;
        _begin_data = LOADADDR(.data);
index 289d0e7f3e3aaed8126c30d109c17c442b848f5b..e1f3e8741292e4db61e4e6861985a23591ef1686 100644 (file)
@@ -117,8 +117,6 @@ SECTIONS {
                CON_INITCALL
        }
 
-       SECURITY_INIT
-
        __init_end_before_initramfs = .;
 
        .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
index 07ae018e550e1110e2743c6e63f8e065d59db42a..105a976323aaa9dd5637c522ceedf4b1a0e994eb 100644 (file)
@@ -212,8 +212,6 @@ SECTIONS
                CON_INITCALL
        }
 
-       SECURITY_INIT
-
        . = ALIGN(8);
        __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
                __start___ftr_fixup = .;
index 7adb4e6b658a1b86cc2d879caae17d6441402a8c..4049f2c463876205ccd9ff965e03fa111df6489e 100644 (file)
@@ -53,8 +53,6 @@
        CON_INITCALL
   }
 
-  SECURITY_INIT
-
   .exitcall : {
        __exitcall_begin = .;
        *(.exitcall.exit)
index a1c3edb8ad56c0d93e3c9a7d994dc0ffd9ad7351..b727b18a68acd9ff639d9da228fc70d94dc657ff 100644 (file)
@@ -197,7 +197,6 @@ SECTIONS
     INIT_SETUP(XCHAL_ICACHE_LINESIZE)
     INIT_CALLS
     CON_INITCALL
-    SECURITY_INITCALL
     INIT_RAM_FS
   }
 
index 5079a969e612b0967edc0e5dbfe71bab974f7b8f..b31ea8bdfef9559be3266b416ce43a2de97b4258 100644 (file)
 #define EARLYCON_TABLE()
 #endif
 
+#ifdef CONFIG_SECURITY
+#define LSM_TABLE()    . = ALIGN(8);                                   \
+                       __start_lsm_info = .;                           \
+                       KEEP(*(.lsm_info.init))                         \
+                       __end_lsm_info = .;
+#else
+#define LSM_TABLE()
+#endif
+
 #define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name)
 #define __OF_TABLE(cfg, name)  ___OF_TABLE(cfg, name)
 #define OF_TABLE(cfg, name)    __OF_TABLE(IS_ENABLED(cfg), name)
        IRQCHIP_OF_MATCH_TABLE()                                        \
        ACPI_PROBE_TABLE(irqchip)                                       \
        ACPI_PROBE_TABLE(timer)                                         \
-       EARLYCON_TABLE()
+       EARLYCON_TABLE()                                                \
+       LSM_TABLE()
 
 #define INIT_TEXT                                                      \
        *(.init.text .init.text.*)                                      \
                KEEP(*(.con_initcall.init))                             \
                __con_initcall_end = .;
 
-#define SECURITY_INITCALL                                              \
-               __start_lsm_info = .;                                   \
-               KEEP(*(.lsm_info.init))                                 \
-               __end_lsm_info = .;
-
-/* Older linker script style for security init. */
-#define SECURITY_INIT                                                  \
-       .lsm_info.init : AT(ADDR(.lsm_info.init) - LOAD_OFFSET) {       \
-               LSM_INFO                                                \
-       }
-
 #ifdef CONFIG_BLK_DEV_INITRD
 #define INIT_RAM_FS                                                    \
        . = ALIGN(4);                                                   \
                INIT_SETUP(initsetup_align)                             \
                INIT_CALLS                                              \
                CON_INITCALL                                            \
-               SECURITY_INITCALL                                       \
                INIT_RAM_FS                                             \
        }