Skip to content
Snippets Groups Projects
  1. Oct 12, 2023
  2. Sep 17, 2023
    • Song Liu's avatar
      x86/purgatory: Remove LTO flags · 75b2f7e4
      Song Liu authored
      
      -flto* implies -ffunction-sections. With LTO enabled, ld.lld generates
      multiple .text sections for purgatory.ro:
      
        $ readelf -S purgatory.ro  | grep " .text"
          [ 1] .text             PROGBITS         0000000000000000  00000040
          [ 7] .text.purgatory   PROGBITS         0000000000000000  000020e0
          [ 9] .text.warn        PROGBITS         0000000000000000  000021c0
          [13] .text.sha256_upda PROGBITS         0000000000000000  000022f0
          [15] .text.sha224_upda PROGBITS         0000000000000000  00002be0
          [17] .text.sha256_fina PROGBITS         0000000000000000  00002bf0
          [19] .text.sha224_fina PROGBITS         0000000000000000  00002cc0
      
      This causes WARNING from kexec_purgatory_setup_sechdrs():
      
        WARNING: CPU: 26 PID: 110894 at kernel/kexec_file.c:919
        kexec_load_purgatory+0x37f/0x390
      
      Fix this by disabling LTO for purgatory.
      
      [ AFAICT, x86 is the only arch that supports LTO and purgatory. ]
      
      We could also fix this with an explicit linker script to rejoin .text.*
      sections back into .text. However, given the benefit of LTOing purgatory
      is small, simply disable the production of more .text.* sections for now.
      
      Fixes: b33fff07 ("x86, build: allow LTO to be selected")
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Link: https://lore.kernel.org/r/20230914170138.995606-1-song@kernel.org
      75b2f7e4
    • Kirill A. Shutemov's avatar
      x86/boot/compressed: Reserve more memory for page tables · f530ee95
      Kirill A. Shutemov authored
      
      The decompressor has a hard limit on the number of page tables it can
      allocate. This limit is defined at compile-time and will cause boot
      failure if it is reached.
      
      The kernel is very strict and calculates the limit precisely for the
      worst-case scenario based on the current configuration. However, it is
      easy to forget to adjust the limit when a new use-case arises. The
      worst-case scenario is rarely encountered during sanity checks.
      
      In the case of enabling 5-level paging, a use-case was overlooked. The
      limit needs to be increased by one to accommodate the additional level.
      This oversight went unnoticed until Aaron attempted to run the kernel
      via kexec with 5-level paging and unaccepted memory enabled.
      
      Update wost-case calculations to include 5-level paging.
      
      To address this issue, let's allocate some extra space for page tables.
      128K should be sufficient for any use-case. The logic can be simplified
      by using a single value for all kernel configurations.
      
      [ Also add a warning, should this memory run low - by Dave Hansen. ]
      
      Fixes: 34bbb000 ("x86/boot/compressed: Enable 5-level paging during decompression stage")
      Reported-by: default avatarAaron Lu <aaron.lu@intel.com>
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20230915070221.10266-1-kirill.shutemov@linux.intel.com
      f530ee95
  3. Sep 13, 2023
  4. Sep 12, 2023
  5. Sep 11, 2023
    • Steve Wahl's avatar
      x86/platform/uv: Use alternate source for socket to node data · 5290e88b
      Steve Wahl authored
      
      The UV code attempts to build a set of tables to allow it to do
      bidirectional socket<=>node lookups.
      
      But when nr_cpus is set to a smaller number than actually present, the
      cpu_to_node() mapping information for unused CPUs is not available to
      build_socket_tables(). This results in skipping some nodes or sockets
      when creating the tables and leaving some -1's for later code to trip.
      over, causing oopses.
      
      The problem is that the socket<=>node lookups are created by doing a
      loop over all CPUs, then looking up the CPU's APICID and socket. But
      if a CPU is not present, there is no way to start this lookup.
      
      Instead of looping over all CPUs, take CPUs out of the equation
      entirely. Loop over all APICIDs which are mapped to a valid NUMA node.
      Then just extract the socket-id from the APICID.
      
      This avoid tripping over disabled CPUs.
      
      Fixes: 8a50c585 ("x86/platform/uv: UV support for sub-NUMA clustering")
      Signed-off-by: default avatarSteve Wahl <steve.wahl@hpe.com>
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/all/20230807141730.1117278-1-steve.wahl%40hpe.com
      5290e88b
    • Ard Biesheuvel's avatar
      efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec · aba7e066
      Ard Biesheuvel authored
      
      CONFIG_EFI_RUNTIME_MAP needs to be enabled in order for kexec to be able
      to provide the required information about the EFI runtime mappings to
      the incoming kernel, regardless of whether kexec_load() or
      kexec_file_load() is being used. Without this information, kexec boot in
      EFI mode is not possible.
      
      The CONFIG_EFI_RUNTIME_MAP option is currently directly configurable if
      CONFIG_EXPERT is enabled, so that it can be turned on for debugging
      purposes even if KEXEC is not enabled. However, the upshot of this is
      that it can also be disabled even when it shouldn't.
      
      So tweak the Kconfig declarations to avoid this situation.
      
      Reported-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      aba7e066
    • Ard Biesheuvel's avatar
      efi/x86: Move EFI runtime call setup/teardown helpers out of line · 762f169f
      Ard Biesheuvel authored
      
      Only the arch_efi_call_virt() macro that some architectures override
      needs to be a macro, given that it is variadic and encapsulates calls
      via function pointers that have different prototypes.
      
      The associated setup and teardown code are not special in this regard,
      and don't need to be instantiated at each call site. So turn them into
      ordinary C functions and move them out of line.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      762f169f
  6. Sep 09, 2023
  7. Sep 08, 2023
  8. Sep 07, 2023
    • Will Deacon's avatar
      arm64: csum: Fix OoB access in IP checksum code for negative lengths · 8bd795fe
      Will Deacon authored
      
      Although commit c2c24edb ("arm64: csum: Fix pathological zero-length
      calls") added an early return for zero-length input, syzkaller has
      popped up with an example of a _negative_ length which causes an
      undefined shift and an out-of-bounds read:
      
       | BUG: KASAN: slab-out-of-bounds in do_csum+0x44/0x254 arch/arm64/lib/csum.c:39
       | Read of size 4294966928 at addr ffff0000d7ac0170 by task syz-executor412/5975
       |
       | CPU: 0 PID: 5975 Comm: syz-executor412 Not tainted 6.4.0-rc4-syzkaller-g908f31f2a05b #0
       | Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
       | Call trace:
       |  dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233
       |  show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240
       |  __dump_stack lib/dump_stack.c:88 [inline]
       |  dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
       |  print_address_description mm/kasan/report.c:351 [inline]
       |  print_report+0x174/0x514 mm/kasan/report.c:462
       |  kasan_report+0xd4/0x130 mm/kasan/report.c:572
       |  kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:187
       |  __kasan_check_read+0x20/0x30 mm/kasan/shadow.c:31
       |  do_csum+0x44/0x254 arch/arm64/lib/csum.c:39
       |  csum_partial+0x30/0x58 lib/checksum.c:128
       |  gso_make_checksum include/linux/skbuff.h:4928 [inline]
       |  __udp_gso_segment+0xaf4/0x1bc4 net/ipv4/udp_offload.c:332
       |  udp6_ufo_fragment+0x540/0xca0 net/ipv6/udp_offload.c:47
       |  ipv6_gso_segment+0x5cc/0x1760 net/ipv6/ip6_offload.c:119
       |  skb_mac_gso_segment+0x2b4/0x5b0 net/core/gro.c:141
       |  __skb_gso_segment+0x250/0x3d0 net/core/dev.c:3401
       |  skb_gso_segment include/linux/netdevice.h:4859 [inline]
       |  validate_xmit_skb+0x364/0xdbc net/core/dev.c:3659
       |  validate_xmit_skb_list+0x94/0x130 net/core/dev.c:3709
       |  sch_direct_xmit+0xe8/0x548 net/sched/sch_generic.c:327
       |  __dev_xmit_skb net/core/dev.c:3805 [inline]
       |  __dev_queue_xmit+0x147c/0x3318 net/core/dev.c:4210
       |  dev_queue_xmit include/linux/netdevice.h:3085 [inline]
       |  packet_xmit+0x6c/0x318 net/packet/af_packet.c:276
       |  packet_snd net/packet/af_packet.c:3081 [inline]
       |  packet_sendmsg+0x376c/0x4c98 net/packet/af_packet.c:3113
       |  sock_sendmsg_nosec net/socket.c:724 [inline]
       |  sock_sendmsg net/socket.c:747 [inline]
       |  __sys_sendto+0x3b4/0x538 net/socket.c:2144
      
      Extend the early return to reject negative lengths as well, aligning our
      implementation with the generic code in lib/checksum.c
      
      Cc: Robin Murphy <robin.murphy@arm.com>
      Fixes: 5777eaed ("arm64: Implement optimised checksum routine")
      Reported-by: default avatar <syzbot+4a9f9820bd8d302e22f7@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/r/000000000000e0e94c0603f8d213@google.com
      
      
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      8bd795fe
    • Helge Deller's avatar
      parisc: BTLB: Initialize BTLB tables at CPU startup · e5ef93d0
      Helge Deller authored
      
      Initialize the BTLB entries when starting up a CPU.
      Note that BTLBs are not available on 64-bit CPUs.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      e5ef93d0
    • Helge Deller's avatar
      parisc: firmware: Simplify calling non-PA20 functions · 3756597a
      Helge Deller authored
      
      Instead of usig #ifdefs, simply return PDC_BAD_PROC for functions
      which aren't available on 64-bit CPUs.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      3756597a
    • Helge Deller's avatar
    • Helge Deller's avatar
    • Helge Deller's avatar
      parisc: BTLB: Clear possibly existing BTLB entries · eda20521
      Helge Deller authored
      
      Call PDC to remove all existing BTLB entries (which may exist from
      some previous operating system runs) before switching to virtual mode.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      eda20521
    • Helge Deller's avatar
      parisc: Prepare for Block-TLB support on 32-bit kernel · 70bd68d5
      Helge Deller authored
      
      Change HUGEPAGE_SIZE to become 4 MB on 32-bit kernels, which leads
      that kernel code and kernel data will start on 4 MB boundaries.
      
      Although a 32-bit kernel does not support huge pages, most
      machines have support for Block-TLBs (BTLB) which allow to
      configure the system to use large pages (block TLBs) to minimize
      the TLB contention. This is done through calls to PDC and the
      32-bit kernel can then call BTLB PDC functions to tell
      the machine to optimize the TLBs.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      70bd68d5
    • Helge Deller's avatar
      parisc: shmparam.h: Document aliasing requirements of PA-RISC · 3f091387
      Helge Deller authored
      
      Add some documentation why PA-RISC uses SHMLBA and SHM_COLOUR.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      3f091387
    • Huacai Chen's avatar
      LoongArch: Update Loongson-3 default config file · 671eae93
      Huacai Chen authored
      
      1, Enable LSX and LASX.
      2, Enable KASLR (CONFIG_RANDOMIZE_BASE).
      3, Enable jump label (patching mechanism for static key).
      4, Enable LoongArch CRC32(c) Acceleration.
      5, Enable Loongson-specific drivers: I2C/RTC/DRM/SOC/CLK/PINCTRL/GPIO/SPI.
      6, Enable EXFAT/NTFS3/JFS/GFS2/OCFS2/UBIFS/EROFS/CEPH file systems.
      7, Enable WangXun NGBE/TXGBE NIC drivers.
      8, Enable some IPVS options.
      9, Remove CONFIG_SYSFS_DEPRECATED since it is removed in Kconfig.
      10, Remove CONFIG_IP_NF_TARGET_CLUSTERIP since it is removed in Kconfig.
      11, Remove CONFIG_NFT_OBJREF since it is removed in Kconfig.
      12, Remove CONFIG_R8188EU since it is replaced by CONFIG_RTL8XXXU.
      
      Signed-off-by: default avatarTrevor Woerner <twoerner@gmail.com>
      Signed-off-by: default avatarXuewen Wang <wangxuewen@kylinos.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      671eae93
  9. Sep 06, 2023
Loading