1. 22 Jan, 2021 2 commits
    • Yanteng Si's avatar
      MIPS: mm: Add prototype for function __update_cache · a2fa4ced
      Yanteng Si authored
      This commit adds a prototype to fix error at W=1:
      
      arch/mips/mm/cache.c:129:6: error: no previous prototype
      for '__update_cache' [-Werror=missing-prototypes]
      Signed-off-by: default avatarYanteng Si <siyanteng@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      a2fa4ced
    • Thomas Bogendoerfer's avatar
      MIPS: mm: abort uaccess retries upon fatal signal · fceb90bb
      Thomas Bogendoerfer authored
      When there's a fatal signal pending, MIPS's do_page_fault()
      implementation returns. The intent is that we'll return to the
      faulting userspace instruction, delivering the signal on the way.
      
      However, if we take a fatal signal during fixing up a uaccess, this
      results in a return to the faulting kernel instruction, which will be
      instantly retried, resulting in the same fault being taken forever. As
      the task never reaches userspace, the signal is not delivered, and the
      task is left unkillable. While the task is stuck in this state, it can
      inhibit the forward progress of the system.
      
      To avoid this, we must ensure that when a fatal signal is pending, we
      apply any necessary fixup for a faulting kernel instruction. Thus we
      will return to an error path, and it is up to that code to make forward
      progress towards delivering the fatal signal.
      
      [ Description taken from commit 746a272e ("ARM: 8692/1: mm: abort
         uaccess retries upon fatal signal") ]
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      fceb90bb
  2. 19 Jan, 2021 2 commits
  3. 18 Jan, 2021 4 commits
    • Alexander Lobakin's avatar
      MIPS: relocatable: optimize the relocation process · d9e84fb1
      Alexander Lobakin authored
      For now, vmlinux relocation functions for relocatable kernel are
      implemented as an array of handlers of a particular type.
      
      Convert that array into a single switch-case function to:
       - remove unused arguments;
       - change the return type of simple handlers to void;
       - remove the array and don't use any data at all;
       - avoid using indirect calls;
       - allow the compiler to inline and greatly optimize
         the relocation function[s];
      
      and also mark do_relocations() and show_kernel_relocation() static
      as they aren't used anywhere else.
      
      The result on MIPS32 R2 with GCC 10.2 -O2 is:
      
      scripts/bloat-o-meter -c arch/mips/kernel/__relocate.o arch/mips/kernel/relocate.o
      add/remove: 0/6 grow/shrink: 1/0 up/down: 356/-640 (-284)
      Function                                     old     new   delta
      relocate_kernel                              852    1208    +356
      apply_r_mips_32_rel                           20       -     -20
      apply_r_mips_hi16_rel                         40       -     -40
      apply_r_mips_64_rel                           44       -     -44
      apply_r_mips_26_rel                          144       -    -144
      show_kernel_relocation                       164       -    -164
      do_relocations                               228       -    -228
      Total: Before=1780, After=1496, chg -15.96%
      add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-76 (-76)
      Data                                         old     new   delta
      reloc_handlers_rel                            76       -     -76
      Total: Before=92, After=16, chg -82.61%
      add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
      RO Data                                      old     new   delta
      Total: Before=0, After=0, chg +0.00%
      
      All functions were collapsed into the main one, relocate_kernel().
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      d9e84fb1
    • Alexander Lobakin's avatar
      MIPS: module: optimize module relocations processing · 049a68ef
      Alexander Lobakin authored
      For now, module relocation functions are implemented as an array
      of handlers of type reloc_handler_t.
      
      Convert that array into a single switch-case function to:
       - remove unused arguments;
       - change the return type of simple handlers to void;
       - remove the array and don't use any data at all;
       - avoid using indirect calls;
       - allow the compiler to inline and greatly optimize
         the relocation function[s].
      
      The result on MIPS32 R2 with GCC 10.2 -O2 is:
      
      scripts/bloat-o-meter -c arch/mips/kernel/__module.o arch/mips/kernel/module.o
      add/remove: 1/11 grow/shrink: 1/0 up/down: 876/-1436 (-560)
      Function                                     old     new   delta
      apply_relocate                               456    1148    +692
      apply_r_mips_pc                                -     184    +184
      apply_r_mips_none                              8       -      -8
      apply_r_mips_32                               16       -     -16
      apply_r_mips_64                               76       -     -76
      apply_r_mips_highest                          88       -     -88
      apply_r_mips_higher                          108       -    -108
      apply_r_mips_26                              132       -    -132
      apply_r_mips_pc26                            160       -    -160
      apply_r_mips_pc21                            160       -    -160
      apply_r_mips_pc16                            160       -    -160
      apply_r_mips_hi16                            172       -    -172
      apply_r_mips_lo16                            356       -    -356
      Total: Before=2608, After=2048, chg -21.47%
      add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
      Data                                         old     new   delta
      Total: Before=12, After=12, chg +0.00%
      add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-248 (-248)
      RO Data                                      old     new   delta
      reloc_handlers                               248       -    -248
      Total: Before=248, After=0, chg -100.00%
      
      All functions were collapsed into a single one that is called
      directly by $(srctree)/kernel/module.c.
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      049a68ef
    • Nathan Chancellor's avatar
      MIPS: VDSO: Use CLANG_FLAGS instead of filtering out '--target=' · 76d7fff2
      Nathan Chancellor authored
      Commit ee67855e ("MIPS: vdso: Allow clang's --target flag in VDSO
      cflags") allowed the '--target=' flag from the main Makefile to filter
      through to the vDSO. However, it did not bring any of the other clang
      specific flags for controlling the integrated assembler and the GNU
      tools locations (--prefix=, --gcc-toolchain=, and -no-integrated-as).
      Without these, we will get a warning (visible with tinyconfig):
      
      arch/mips/vdso/elf.S:14:1: warning: DWARF2 only supports one section per
      compilation unit
      .pushsection .note.Linux, "a",@note ; .balign 4 ; .long 2f - 1f ; .long
      4484f - 3f ; .long 0 ; 1:.asciz "Linux" ; 2:.balign 4 ; 3:
      ^
      arch/mips/vdso/elf.S:34:2: warning: DWARF2 only supports one section per
      compilation unit
       .section .mips_abiflags, "a"
       ^
      
      All of these flags are bundled up under CLANG_FLAGS in the main Makefile
      and exported so that they can be added to Makefiles that set their own
      CFLAGS. Use this value instead of filtering out '--target=' so there is
      no warning and all of the tools are properly used.
      
      Cc: stable@vger.kernel.org
      Fixes: ee67855e ("MIPS: vdso: Allow clang's --target flag in VDSO cflags")
      Link: https://github.com/ClangBuiltLinux/linux/issues/1256Reported-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Tested-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      76d7fff2
    • Paul Cercueil's avatar
      MIPS: Ingenic: Disable HPTLB for D0 XBurst CPUs too · a5360958
      Paul Cercueil authored
      The JZ4760 has the HPTLB as well, but has a XBurst CPU with a D0 CPUID.
      
      Disable the HPTLB for all XBurst CPUs with a D0 CPUID. In the case where
      there is no HPTLB (e.g. for older SoCs), this won't have any side
      effect.
      
      Fixes: b02efeb0 ("MIPS: Ingenic: Disable abandoned HPTLB function.")
      Cc: <stable@vger.kernel.org> # 5.4
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Reviewed-by: default avatar周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      a5360958
  4. 15 Jan, 2021 13 commits
    • Aurelien Jarno's avatar
      MIPS: Support binutils configured with --enable-mips-fix-loongson3-llsc=yes · 5373ae67
      Aurelien Jarno authored
      From version 2.35, binutils can be configured with
      --enable-mips-fix-loongson3-llsc=yes, which means it defaults to
      -mfix-loongson3-llsc. This breaks labels which might then point at the
      wrong instruction.
      
      The workaround to explicitly pass -mno-fix-loongson3-llsc has been
      added in Linux version 5.1, but is only enabled when building a Loongson
      64 kernel. As vendors might use a common toolchain for building Loongson
      and non-Loongson kernels, just move that workaround to
      arch/mips/Makefile. At the same time update the comments to reflect the
      current status.
      
      Cc: stable@vger.kernel.org # 5.1+
      Cc: YunQiang Su <syq@debian.org>
      Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      5373ae67
    • Nathan Chancellor's avatar
      MIPS: Compare __SYNC_loongson3_war against 0 · 8790ccf8
      Nathan Chancellor authored
      When building with clang when CONFIG_CPU_LOONGSON3_WORKAROUNDS is
      enabled:
      
       In file included from lib/errseq.c:4:
       In file included from ./include/linux/atomic.h:7:
       ./arch/mips/include/asm/atomic.h:52:1: warning: converting the result of
       '<<' to a boolean always evaluates to true
       [-Wtautological-constant-compare]
       ATOMIC_OPS(atomic64, s64)
       ^
       ./arch/mips/include/asm/atomic.h:40:9: note: expanded from macro
       'ATOMIC_OPS'
               return cmpxchg(&v->counter, o, n);
                      ^
       ./arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro
       'cmpxchg'
               if (!__SYNC_loongson3_war)
                    ^
       ./arch/mips/include/asm/sync.h:147:34: note: expanded from macro
       '__SYNC_loongson3_war'
       # define __SYNC_loongson3_war   (1 << 31)
                                          ^
      
      While it is not wrong that the result of this shift is always true in a
      boolean context, it is not a problem here. Regardless, the warning is
      really noisy so rather than making the shift a boolean implicitly, use
      it in an equality comparison so the shift is used as an integer value.
      
      Fixes: 4d1dbfe6 ("MIPS: atomic: Emit Loongson3 sync workarounds within asm")
      Fixes: a91f2a1d ("MIPS: cmpxchg: Omit redundant barriers for Loongson3")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Acked-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      8790ccf8
    • Alexander Lobakin's avatar
      MIPS: pgtable: fix -Wshadow in asm/pgtable.h · cabcff9b
      Alexander Lobakin authored
      Solves the following repetitive warning when building with -Wshadow:
      
      In file included from ./include/linux/pgtable.h:6,
                       from ./include/linux/mm.h:33,
                       from ./include/linux/dax.h:6,
                       from ./include/linux/mempolicy.h:11,
                       from kernel/fork.c:34:
      ./arch/mips/include/asm/mmu_context.h: In function ‘switch_mm’:
      ./arch/mips/include/asm/pgtable.h:97:16: warning: declaration of ‘flags’ shadows a previous local [-Wshadow]
         97 |  unsigned long flags;      \
            |                ^~~~~
      ./arch/mips/include/asm/mmu_context.h:162:2: note: in expansion of macro ‘htw_stop’
        162 |  htw_stop();
            |  ^~~~~~~~
      In file included from kernel/fork.c:102:
      ./arch/mips/include/asm/mmu_context.h:159:16: note: shadowed declaration is here
        159 |  unsigned long flags;
            |                ^~~~~
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      cabcff9b
    • Alexander Lobakin's avatar
      MIPS: bitops: fix -Wshadow in asm/bitops.h · 97c97c6a
      Alexander Lobakin authored
      Solves the following repetitive warning when building with -Wshadow:
      
      In file included from ./include/linux/bitops.h:32,
                       from ./include/linux/kernel.h:11,
                       from ./include/linux/skbuff.h:13,
                       from ./include/linux/if_ether.h:19,
                       from ./include/linux/etherdevice.h:20:
      ./arch/mips/include/asm/bitops.h: In function ‘test_and_set_bit_lock’:
      ./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow]
         46 |  unsigned long orig, temp;    \
            |                ^~~~
      ./arch/mips/include/asm/bitops.h:190:10: note: in expansion of macro ‘__test_bit_op’
        190 |   orig = __test_bit_op(*m, "%0",
            |          ^~~~~~~~~~~~~
      ./arch/mips/include/asm/bitops.h:185:21: note: shadowed declaration is here
        185 |  unsigned long res, orig;
            |                     ^~~~
      ./arch/mips/include/asm/bitops.h: In function ‘test_and_clear_bit’:
      ./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow]
         46 |  unsigned long orig, temp;    \
            |                ^~~~
      ./arch/mips/include/asm/bitops.h:236:9: note: in expansion of macro ‘__test_bit_op’
        236 |   res = __test_bit_op(*m, "%1",
            |         ^~~~~~~~~~~~~
      ./arch/mips/include/asm/bitops.h:229:21: note: shadowed declaration is here
        229 |  unsigned long res, orig;
            |                     ^~~~
      ./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow]
         46 |  unsigned long orig, temp;    \
            |                ^~~~
      ./arch/mips/include/asm/bitops.h:241:10: note: in expansion of macro ‘__test_bit_op’
        241 |   orig = __test_bit_op(*m, "%0",
            |          ^~~~~~~~~~~~~
      ./arch/mips/include/asm/bitops.h:229:21: note: shadowed declaration is here
        229 |  unsigned long res, orig;
            |                     ^~~~
      ./arch/mips/include/asm/bitops.h: In function ‘test_and_change_bit’:
      ./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow]
         46 |  unsigned long orig, temp;    \
            |                ^~~~
      ./arch/mips/include/asm/bitops.h:273:10: note: in expansion of macro ‘__test_bit_op’
        273 |   orig = __test_bit_op(*m, "%0",
            |          ^~~~~~~~~~~~~
      ./arch/mips/include/asm/bitops.h:266:21: note: shadowed declaration is here
        266 |  unsigned long res, orig;
            |                     ^~~~
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      97c97c6a
    • Alexander Lobakin's avatar
      MIPS: select ARCH_WANT_LD_ORPHAN_WARN · d3a4e0f1
      Alexander Lobakin authored
      Now, after that all the sections are explicitly described and
      declared in vmlinux.lds.S, we can enable ld orphan warnings to
      prevent from missing any new sections in future.
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      d3a4e0f1
    • Alexander Lobakin's avatar
      vmlinux.lds.h: catch UBSAN's "unnamed data" into data · f41b233d
      Alexander Lobakin authored
      When building kernel with both LD_DEAD_CODE_DATA_ELIMINATION and
      UBSAN, LLVM stack generates lots of "unnamed data" sections:
      
      ld.lld: warning: net/built-in.a(netfilter/utils.o): (.data.$__unnamed_2)
      is being placed in '.data.$__unnamed_2'
      ld.lld: warning: net/built-in.a(netfilter/utils.o): (.data.$__unnamed_3)
      is being placed in '.data.$__unnamed_3'
      ld.lld: warning: net/built-in.a(netfilter/utils.o): (.data.$__unnamed_4)
      is being placed in '.data.$__unnamed_4'
      ld.lld: warning: net/built-in.a(netfilter/utils.o): (.data.$__unnamed_5)
      is being placed in '.data.$__unnamed_5'
      
      [...]
      
      Also handle this by adding the related sections to generic definitions.
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      f41b233d
    • Alexander Lobakin's avatar
      vmlinux.lds.h: catch compound literals into data and BSS · 9a427556
      Alexander Lobakin authored
      When building kernel with LD_DEAD_CODE_DATA_ELIMINATION, LLVM stack
      generates separate sections for compound literals, just like in case
      with enabled LTO [0]:
      
      ld.lld: warning: drivers/built-in.a(mtd/nand/spi/gigadevice.o):
      (.data..compoundliteral.14) is being placed in
      '.data..compoundliteral.14'
      ld.lld: warning: drivers/built-in.a(mtd/nand/spi/gigadevice.o):
      (.data..compoundliteral.15) is being placed in
      '.data..compoundliteral.15'
      ld.lld: warning: drivers/built-in.a(mtd/nand/spi/gigadevice.o):
      (.data..compoundliteral.16) is being placed in
      '.data..compoundliteral.16'
      ld.lld: warning: drivers/built-in.a(mtd/nand/spi/gigadevice.o):
      (.data..compoundliteral.17) is being placed in
      '.data..compoundliteral.17'
      
      [...]
      
      Handle this by adding the related sections to generic definitions
      as suggested by Sami [0].
      
      [0] https://lore.kernel.org/lkml/20201211184633.3213045-3-samitolvanen@google.comSuggested-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Suggested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      9a427556
    • Alexander Lobakin's avatar
      MIPS: vmlinux.lds.S: explicitly declare .got table · 795b3a36
      Alexander Lobakin authored
      LLVM stack generates GOT table when building the kernel:
      
      ld.lld: warning: <internal>:(.got) is being placed in '.got'
      
      According to the debug assertions, it's not zero-sized and thus can't
      be handled the way it's done for x86.
      Also use the ARM64 path here and place it at the end of .text section.
      Reported-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      795b3a36
    • Alexander Lobakin's avatar
      MIPS: vmlinux.lds.S: explicitly catch .rel.dyn symbols · 008c3cbd
      Alexander Lobakin authored
      According to linker warnings, both GCC and LLVM generate '.rel.dyn'
      symbols:
      
      mips-alpine-linux-musl-ld: warning: orphan section `.rel.dyn'
      from `init/main.o' being placed in section `.rel.dyn'
      
      Link-time assertion shows that this section is sometimes empty,
      sometimes not, depending on machine bitness and the compiler [0]:
      
        LD      .tmp_vmlinux.kallsyms1
      mips64-linux-gnu-ld: Unexpected run-time relocations (.rel) detected!
      
      Just use the ARM64 approach and declare it in vmlinux.lds.S closer
      to __init_end.
      
      [0] https://lore.kernel.org/linux-mips/20210109111259.GA4213@alpha.franken.deReported-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      008c3cbd
    • Alexander Lobakin's avatar
      MIPS: properly stop .eh_frame generation · 894ef530
      Alexander Lobakin authored
      Commit 866b6a89 ("MIPS: Add DWARF unwinding to assembly") added
      -fno-asynchronous-unwind-tables to KBUILD_CFLAGS to prevent compiler
      from emitting .eh_frame symbols.
      However, as MIPS heavily uses CFI, that's not enough. Use the
      approach taken for x86 (as it also uses CFI) and explicitly put CFI
      symbols into the .debug_frame section (except for VDSO).
      This allows us to drop .eh_frame from DISCARDS as it's no longer
      being generated.
      
      Fixes: 866b6a89 ("MIPS: Add DWARF unwinding to assembly")
      Suggested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      894ef530
    • Alexander Lobakin's avatar
      MIPS: vmlinux.lds.S: add ".gnu.attributes" to DISCARDS · 5629d418
      Alexander Lobakin authored
      Discard GNU attributes (MIPS FP type, GNU Hash etc.) at link time
      as kernel doesn't use it at all.
      Solves a dozen of the following ld warnings (one per every file):
      
      mips-alpine-linux-musl-ld: warning: orphan section `.gnu.attributes'
      from `arch/mips/kernel/head.o' being placed in section
      `.gnu.attributes'
      mips-alpine-linux-musl-ld: warning: orphan section `.gnu.attributes'
      from `init/main.o' being placed in section `.gnu.attributes'
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      5629d418
    • Alexander Lobakin's avatar
      MIPS: CPS: don't create redundant .text.cps-vec section · ee90fef1
      Alexander Lobakin authored
      A number of symbols from arch/mips/kernel/cps-vec.S is explicitly
      placed into '.text.cps-vec' section.
      There are no direct references to this section, so there's no need
      to form it. '.balign 0x1000' directive will work anyway.
      
      Moreover, this section was being placed in vmlinux differently
      depending on CONFIG_LD_DEAD_CODE_DATA_ELIMINATION:
       - with this option enabled, '.text.cps-vec' was being caught
         by '.text.[0-9a-zA-Z_]*' from include/asm-generic/vmlinux.lds.h;
       - without this option, '.text.cps-vec' was being caught
         by discouraging '.text.*' from arch/mips/kernel/vmlinux.lds.S.
      
      '.text.*' should not be used in vmlinux linker scripts at all as it
      silently catches any orphan text sections.
      So, remove both '.section .text.cps-vec' and '.text.*' from cps-vec.S
      and vmlinux.lds.S respectively. As said, this does not affect related
      functions alignment:
      
      80116000 T mips_cps_core_entry
      80116028 t not_nmi
      80116200 T excep_tlbfill
      80116280 T excep_xtlbfill
      80116300 T excep_cache
      80116380 T excep_genex
      80116400 T excep_intex
      80116480 T excep_ejtag
      80116490 T mips_cps_core_init
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      ee90fef1
    • Alexander Lobakin's avatar
      MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section · 8ac7c87a
      Alexander Lobakin authored
      MIPS uses its own declaration of rwdata, and thus it should be kept
      in sync with the asm-generic one. Currently PAGE_ALIGNED_DATA() is
      missing from the linker script, which emits the following ld
      warnings:
      
      mips-alpine-linux-musl-ld: warning: orphan section
      `.data..page_aligned' from `arch/mips/kernel/vdso.o' being placed
      in section `.data..page_aligned'
      mips-alpine-linux-musl-ld: warning: orphan section
      `.data..page_aligned' from `arch/mips/vdso/vdso-image.o' being placed
      in section `.data..page_aligned'
      
      Add the necessary declaration, so the mentioned structures will be
      placed in vmlinux as intended:
      
      ffffffff80630580 D __end_once
      ffffffff80630580 D __start___dyndbg
      ffffffff80630580 D __start_once
      ffffffff80630580 D __stop___dyndbg
      ffffffff80634000 d mips_vdso_data
      ffffffff80638000 d vdso_data
      ffffffff80638580 D _gp
      ffffffff8063c000 T __init_begin
      ffffffff8063c000 D _edata
      ffffffff8063c000 T _sinittext
      
      ->
      
      ffffffff805a4000 D __end_init_task
      ffffffff805a4000 D __nosave_begin
      ffffffff805a4000 D __nosave_end
      ffffffff805a4000 d mips_vdso_data
      ffffffff805a8000 d vdso_data
      ffffffff805ac000 D mmlist_lock
      ffffffff805ac080 D tasklist_lock
      
      Fixes: ebb5e78c ("MIPS: Initial implementation of a VDSO")
      Signed-off-by: default avatarAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Cc: stable@vger.kernel.org # 4.4+
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      8ac7c87a
  5. 13 Jan, 2021 5 commits
  6. 09 Jan, 2021 1 commit
  7. 07 Jan, 2021 7 commits
  8. 04 Jan, 2021 6 commits