vmlinux.lds.h: Move NOTES into RO_DATA
authorKees Cook <keescook@chromium.org>
Tue, 29 Oct 2019 21:13:32 +0000 (14:13 -0700)
committerBorislav Petkov <bp@suse.de>
Mon, 4 Nov 2019 14:34:41 +0000 (15:34 +0100)
The .notes section should be non-executable read-only data. As such,
move it to the RO_DATA macro instead of being per-architecture defined.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # s390
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: linux-alpha@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-ia64@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Will Deacon <will@kernel.org>
Cc: x86-ml <x86@kernel.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: https://lkml.kernel.org/r/20191029211351.13243-11-keescook@chromium.org
26 files changed:
arch/alpha/kernel/vmlinux.lds.S
arch/arc/kernel/vmlinux.lds.S
arch/arm/kernel/vmlinux-xip.lds.S
arch/arm/kernel/vmlinux.lds.S
arch/arm64/kernel/vmlinux.lds.S
arch/c6x/kernel/vmlinux.lds.S
arch/csky/kernel/vmlinux.lds.S
arch/h8300/kernel/vmlinux.lds.S
arch/hexagon/kernel/vmlinux.lds.S
arch/ia64/kernel/vmlinux.lds.S
arch/microblaze/kernel/vmlinux.lds.S
arch/mips/kernel/vmlinux.lds.S
arch/nds32/kernel/vmlinux.lds.S
arch/nios2/kernel/vmlinux.lds.S
arch/openrisc/kernel/vmlinux.lds.S
arch/parisc/kernel/vmlinux.lds.S
arch/powerpc/kernel/vmlinux.lds.S
arch/riscv/kernel/vmlinux.lds.S
arch/s390/kernel/vmlinux.lds.S
arch/sh/kernel/vmlinux.lds.S
arch/sparc/kernel/vmlinux.lds.S
arch/um/include/asm/common.lds.S
arch/unicore32/kernel/vmlinux.lds.S
arch/x86/kernel/vmlinux.lds.S
arch/xtensa/kernel/vmlinux.lds.S
include/asm-generic/vmlinux.lds.h

index cdfdc91ce64c75d974380a4079a9937db2750a4b..bf28043485f6e369a5ca836e4336b9df2e884cee 100644 (file)
@@ -34,8 +34,6 @@ SECTIONS
        swapper_pg_dir = SWAPPER_PGD;
        _etext = .;     /* End of text section */
 
-       NOTES
-
        RODATA
        EXCEPTION_TABLE(16)
 
index 6c693a9d29b6d79c3f09af1bb3176b41103e7b8f..1d6eef4b69762ba9ca51653814c2858839999b45 100644 (file)
@@ -118,8 +118,6 @@ SECTIONS
        /DISCARD/ : {   *(.eh_frame) }
 #endif
 
-       NOTES
-
        . = ALIGN(PAGE_SIZE);
        _end = . ;
 
index 8c74037ade22958688e4766e4ef762a6cad514d9..d2a9651c24ad3e4f47df9cf5bb320afdfe3e541f 100644 (file)
@@ -70,8 +70,6 @@ SECTIONS
        ARM_UNWIND_SECTIONS
 #endif
 
-       NOTES
-
        _etext = .;                     /* End of text and rodata section */
 
        ARM_VECTORS
index 23150c0f0f4d4f81ec816798ab0415a3ac00d68b..068db6860867f0cefadb7b6aedd5af8d07b33322 100644 (file)
@@ -81,8 +81,6 @@ SECTIONS
        ARM_UNWIND_SECTIONS
 #endif
 
-       NOTES
-
 #ifdef CONFIG_STRICT_KERNEL_RWX
        . = ALIGN(1<<SECTION_SHIFT);
 #else
index aa76f725966853ec8f2c6418bbc3fccf80920f16..e7dafc29b1fa0951d8ebc89c1029da76884d3730 100644 (file)
@@ -137,7 +137,6 @@ SECTIONS
 
        RO_DATA(PAGE_SIZE)              /* everything from this point to     */
        EXCEPTION_TABLE(8)              /* __init_begin will be marked RO NX */
-       NOTES
 
        . = ALIGN(PAGE_SIZE);
        idmap_pg_dir = .;
index 584bab2bace6e22d59619434f86f95ee41a04e62..d6e3802536b3c1fe5d67266c46b6fa55d108a147 100644 (file)
@@ -81,7 +81,6 @@ SECTIONS
        }
 
        EXCEPTION_TABLE(16)
-       NOTES
 
        RO_DATA_SECTION(PAGE_SIZE)
        .const :
index ae7961b973f26e8794a7597773fb9758b335a2bc..75dd31412242c334835f264810d74eef5757b02c 100644 (file)
@@ -53,7 +53,6 @@ SECTIONS
        RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
        _edata = .;
 
-       NOTES
        EXCEPTION_TABLE(L1_CACHE_BYTES)
        BSS_SECTION(L1_CACHE_BYTES, PAGE_SIZE, L1_CACHE_BYTES)
        VBR_BASE
index 49f716c0a1df977d5981c6b80dc4e126c282cb83..88776e785245015f54796cab4f39cf9a17095aa1 100644 (file)
@@ -38,7 +38,6 @@ SECTIONS
        _etext = . ;
        }
        EXCEPTION_TABLE(16)
-       NOTES
        RO_DATA_SECTION(4)
        ROMEND = .;
 #if defined(CONFIG_ROMKERNEL)
index 78f2418e97c8425dc2898d5d1fee76b4da30f708..6a6e8fc422eef4e37d03ffb0c4b7b7b0dca17dfe 100644 (file)
@@ -54,7 +54,6 @@ SECTIONS
        _edata = .;
 
        EXCEPTION_TABLE(16)
-       NOTES
 
        BSS_SECTION(_PAGE_SIZE, _PAGE_SIZE, _PAGE_SIZE)
 
index bfc937ec168c37eea3056a2e45164d9bca3f22fb..fae077595756bbb52b612891e973cfe3d3f8901c 100644 (file)
@@ -70,8 +70,6 @@ SECTIONS {
        /*
         * Read-only data
         */
-       NOTES
-
        EXCEPTION_TABLE(16)
 
        /* MCA table */
index e1f3e8741292e4db61e4e6861985a23591ef1686..d008e50bb212a7284f44d17d6070a46a03672d0f 100644 (file)
@@ -53,7 +53,6 @@ SECTIONS {
        . = ALIGN(16);
        RODATA
        EXCEPTION_TABLE(16)
-       NOTES
 
        /*
         * sdata2 section can go anywhere, but must be word aligned
index 6a22f531d815c2599e153671376a9f5fbd086a81..91e566defc1689a78ebd4a96d45b0d1d121df9ab 100644 (file)
@@ -81,8 +81,6 @@ SECTIONS
                __stop___dbe_table = .;
        }
 
-       NOTES
-
        _sdata = .;                     /* Start of data section */
        RODATA
 
index 9e90f30a181d7d9c9b06dc04d230c02bfde67b78..c4f1c5a604c34d432e1441d0c1537c19cbd7cd3f 100644 (file)
@@ -58,7 +58,6 @@ SECTIONS
        _edata  =  .;
 
        EXCEPTION_TABLE(16)
-       NOTES
        BSS_SECTION(4, 4, 4)
        _end = .;
 
index 6ad64f14617d3d5e09db4887967b5013fad1d632..20e4078b3477db47210350f81094a289c043639b 100644 (file)
@@ -58,7 +58,6 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
-       NOTES
 
        DISCARDS
 }
index 2e2c72c157f3caecc0dba26729397017776196ce..142c51c994f5694794c589bd716220266ec2e883 100644 (file)
@@ -79,7 +79,6 @@ SECTIONS
         _edata  =  .;
 
        EXCEPTION_TABLE(4)
-       NOTES
 
        /* Init code and data */
        . = ALIGN(PAGE_SIZE);
index 99cd24f2ea01bb35013c3c0f00ce5b5a481d96cd..168d12b2ebb858b61462f66df2af04021b2c34e7 100644 (file)
@@ -131,7 +131,6 @@ SECTIONS
 
        /* RO because of BUILDTIME_EXTABLE_SORT */
        EXCEPTION_TABLE(8)
-       NOTES
 
        /* unwind info */
        .PARISC.unwind : {
index 4f19d814d59298cb89148d3ad88218bc453cf24a..4e7cec088c8bf1c2e41a016bbbaa16bc7bf311bd 100644 (file)
@@ -164,8 +164,6 @@ SECTIONS
 #endif
        EXCEPTION_TABLE(0)
 
-       NOTES
-
 /*
  * Init sections discarded at runtime
  */
index 23cd1a9e52a10dec19820d0f8f3e6df4121a4229..df5229c4034db8961b632c351d03a4360c10b8de 100644 (file)
@@ -69,7 +69,6 @@ SECTIONS
        BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
 
        EXCEPTION_TABLE(0x10)
-       NOTES
 
        .rel.dyn : {
                *(.rel.dyn*)
index f88eedeb915a3d20669fa2d134a33e6403b6392e..beb4df053e20bb9a4af5a711435efc4801f9ba99 100644 (file)
@@ -52,8 +52,6 @@ SECTIONS
                _etext = .;             /* End of text section */
        } :text = 0x0700
 
-       NOTES
-
        RO_DATA_SECTION(PAGE_SIZE)
 
        . = ALIGN(PAGE_SIZE);
index 77a59d8c6b4d41a8f2597805cfac6d750ca5eebd..fef39054cc70ee9a05a62d7c57fbc1cc3830a170 100644 (file)
@@ -48,7 +48,6 @@ SECTIONS
        } = 0x0009
 
        EXCEPTION_TABLE(16)
-       NOTES
 
        _sdata = .;
        RO_DATA(PAGE_SIZE)
index 61afd787bd0c7a7f82fef18f69aa7da6c1898425..8929fbc35a80f04062f6772929e88ea812152bcf 100644 (file)
@@ -78,7 +78,6 @@ SECTIONS
                __stop___fixup = .;
        }
        EXCEPTION_TABLE(16)
-       NOTES
 
        . = ALIGN(PAGE_SIZE);
        __init_begin = ALIGN(PAGE_SIZE);
index d7086b985f27882cbe7b60defc0b7eff168e9f45..91aca356095fb0fcfd83ee794928cd4c3f41570d 100644 (file)
@@ -16,7 +16,6 @@
   PROVIDE (_unprotected_end = .);
 
   . = ALIGN(4096);
-  NOTES
   EXCEPTION_TABLE(0)
 
   BUG_TABLE
index 7abf90537cd5173e70c4d89ebe1d4e608214d60a..78c4c56057b0c8dc3f8c708c4ee19f168dffb170 100644 (file)
@@ -48,7 +48,6 @@ SECTIONS
        _edata = .;
 
        EXCEPTION_TABLE(L1_CACHE_BYTES)
-       NOTES
 
        BSS_SECTION(0, 0, 0)
        _end = .;
index 8be25b09c2b7a0d6776e9856d76d893d37493bc3..41362e90142d7eef3f055e806aef881c898cecf9 100644 (file)
@@ -148,8 +148,6 @@ SECTIONS
                _etext = .;
        } :text = 0x9090
 
-       NOTES
-
        EXCEPTION_TABLE(16)
 
        /* .text should occupy whole number of pages */
index 943f10639a93321fea7c28009567503cb370a0bd..a0a8437456956a1788c27c67c8d6308ee6e9bc60 100644 (file)
@@ -131,7 +131,6 @@ SECTIONS
   .fixup   : { *(.fixup) }
 
   EXCEPTION_TABLE(16)
-  NOTES
   /* Data section */
 
   _sdata = .;
index 97d4299f14dc1dd4a3ea10c0aa79c9aa97bab367..dc3390ec6b60c8c3fc988ac6447c00c061af784d 100644 (file)
@@ -28,7 +28,6 @@
  *     _edata = .;
  *
  *     EXCEPTION_TABLE(...)
- *     NOTES
  *
  *     BSS_SECTION(0, 0, 0)
  *     _end = .;
                __start___modver = .;                                   \
                KEEP(*(__modver))                                       \
                __stop___modver = .;                                    \
-               . = ALIGN((align));                                     \
-               __end_rodata = .;                                       \
        }                                                               \
-       . = ALIGN((align));
+                                                                       \
+       NOTES                                                           \
+                                                                       \
+       . = ALIGN((align));                                             \
+       __end_rodata = .;
 
 /* RODATA & RO_DATA provided for backward compatibility.
  * All archs are supposed to use RO_DATA() */