Skip to content
  1. Sep 02, 2023
    • Helge Deller's avatar
      io_uring/parisc: Adjust pgoff in io_uring mmap() for parisc · 5d54040e
      Helge Deller authored
      Vidra Jonas reported issues on parisc with libuv which then triggers
      build errors with cmake. Debugging shows that those issues stem from
      io_uring().
      
      I was not able to easily pull in upstream commits directly, so here
      is IMHO the least invasive manual backport of the following upstream
      commits to fix the cache aliasing issues on parisc on kernel 6.1
      with io_uring:
      
      56675f8b ("io_uring/parisc: Adjust pgoff in io_uring mmap() for parisc")
      32832a40 ("io_uring: Fix io_uring mmap() by using architecture-provided get_unmapped_area()")
      d808459b
      
       ("io_uring: Adjust mapping wrt architecture aliasing requirements")
      
      With this patch kernel 6.1 has all relevant mmap changes and is
      identical to kernel 6.5 with regard to mmap() in io_uring.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Reported-by: default avatar <Vidra.Jonas@seznam.cz>
      Link: https://lore.kernel.org/linux-parisc/520.NvTX.6mXZpmfh4Ju.1awpAS@seznam.cz/
      
      
      Cc: Sam James <sam@gentoo.org>
      Cc: John David Anglin <dave.anglin@bell.net>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d54040e
    • Helge Deller's avatar
    • John David Anglin's avatar
      parisc: Cleanup mmap implementation regarding color alignment · e8ac4be7
      John David Anglin authored
      commit 567b3515
      
       upstream.
      
      This change simplifies the randomization of file mapping regions. It
      reworks the code to remove duplication. The flow is now similar to
      that for mips. Finally, we consistently use the do_color_align variable
      to determine when color alignment is needed.
      
      Tested on rp3440.
      
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e8ac4be7
    • Helge Deller's avatar
      lockdep: fix static memory detection even more · b3d099df
      Helge Deller authored
      commit 0a6b58c5 upstream.
      
      On the parisc architecture, lockdep reports for all static objects which
      are in the __initdata section (e.g. "setup_done" in devtmpfs,
      "kthreadd_done" in init/main.c) this warning:
      
      	INFO: trying to register non-static key.
      
      The warning itself is wrong, because those objects are in the __initdata
      section, but the section itself is on parisc outside of range from
      _stext to _end, which is why the static_obj() functions returns a wrong
      answer.
      
      While fixing this issue, I noticed that the whole existing check can
      be simplified a lot.
      Instead of checking against the _stext and _end symbols (which include
      code areas too) just check for the .data and .bss segments (since we check a
      data object). This can be done with the existing is_kernel_core_data()
      macro.
      
      In addition objects in the __initdata section can be checked with
      init_section_contains(), and is_kernel_rodata() allows keys to be in the
      _ro_after_init section.
      
      This partly reverts and simplifies commit bac59d18 ("x86/setup: Fix static
      memory detection").
      
      Link: https://lkml.kernel.org/r/ZNqrLRaOi/3wPAdp@p100
      Fixes: bac59d18
      
       ("x86/setup: Fix static memory detection")
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b3d099df
    • James Morse's avatar
      ARM: module: Use module_init_layout_section() to spot init sections · 1cb79e7e
      James Morse authored
      commit a6846234 upstream.
      
      Today module_frob_arch_sections() spots init sections from their
      'init' prefix, and uses this to keep the init PLTs separate from the rest.
      
      get_module_plt() uses within_module_init() to determine if a
      location is in the init text or not, but this depends on whether
      core code thought this was an init section.
      
      Naturally the logic is different.
      
      module_init_layout_section() groups the init and exit text together if
      module unloading is disabled, as the exit code will never run. The result
      is kernels with this configuration can't load all their modules because
      there are not enough PLTs for the combined init+exit section.
      
      A previous patch exposed module_init_layout_section(), use that so the
      logic is the same.
      
      Fixes: 055f23b7
      
       ("module: check for exit sections in layout_sections() instead of module_init_section()")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1cb79e7e
    • James Morse's avatar
      arm64: module: Use module_init_layout_section() to spot init sections · 8d99105d
      James Morse authored
      commit f928f8b1
      
       upstream.
      
      Today module_frob_arch_sections() spots init sections from their
      'init' prefix, and uses this to keep the init PLTs separate from the rest.
      
      module_emit_plt_entry() uses within_module_init() to determine if a
      location is in the init text or not, but this depends on whether
      core code thought this was an init section.
      
      Naturally the logic is different.
      
      module_init_layout_section() groups the init and exit text together if
      module unloading is disabled, as the exit code will never run. The result
      is kernels with this configuration can't load all their modules because
      there are not enough PLTs for the combined init+exit section.
      
      This results in the following:
      | WARNING: CPU: 2 PID: 51 at arch/arm64/kernel/module-plts.c:99 module_emit_plt_entry+0x184/0x1cc
      | Modules linked in: crct10dif_common
      | CPU: 2 PID: 51 Comm: modprobe Not tainted 6.5.0-rc4-yocto-standard-dirty #15208
      | Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
      | pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      | pc : module_emit_plt_entry+0x184/0x1cc
      | lr : module_emit_plt_entry+0x94/0x1cc
      | sp : ffffffc0803bba60
      [...]
      | Call trace:
      |  module_emit_plt_entry+0x184/0x1cc
      |  apply_relocate_add+0x2bc/0x8e4
      |  load_module+0xe34/0x1bd4
      |  init_module_from_file+0x84/0xc0
      |  __arm64_sys_finit_module+0x1b8/0x27c
      |  invoke_syscall.constprop.0+0x5c/0x104
      |  do_el0_svc+0x58/0x160
      |  el0_svc+0x38/0x110
      |  el0t_64_sync_handler+0xc0/0xc4
      |  el0t_64_sync+0x190/0x194
      
      A previous patch exposed module_init_layout_section(), use that so the
      logic is the same.
      
      Reported-by: default avatarAdam Johnston <adam.johnston@arm.com>
      Tested-by: default avatarAdam Johnston <adam.johnston@arm.com>
      Fixes: 055f23b7 ("module: check for exit sections in layout_sections() instead of module_init_section()")
      Cc: <stable@vger.kernel.org> # 5.15.x: 60a0aab7
      
       arm64: module-plts: inline linux/moduleloader.h
      Cc: <stable@vger.kernel.org> # 5.15.x
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8d99105d
    • Arnd Bergmann's avatar
      arm64: module-plts: inline linux/moduleloader.h · 42efdb35
      Arnd Bergmann authored
      commit 60a0aab7
      
       upstream.
      
      module_frob_arch_sections() is declared in moduleloader.h, but
      that is not included before the definition:
      
      arch/arm64/kernel/module-plts.c:286:5: error: no previous prototype for 'module_frob_arch_sections' [-Werror=missing-prototypes]
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Link: https://lore.kernel.org/r/20230516160642.523862-11-arnd@kernel.org
      
      
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42efdb35
    • James Morse's avatar
      module: Expose module_init_layout_section() · 207e228b
      James Morse authored
      commit 2abcc4b5
      
       upstream.
      
      module_init_layout_section() choses whether the core module loader
      considers a section as init or not. This affects the placement of the
      exit section when module unloading is disabled. This code will never run,
      so it can be free()d once the module has been initialised.
      
      arm and arm64 need to count the number of PLTs they need before applying
      relocations based on the section name. The init PLTs are stored separately
      so they can be free()d. arm and arm64 both use within_module_init() to
      decide which list of PLTs to use when applying the relocation.
      
      Because within_module_init()'s behaviour changes when module unloading
      is disabled, both architecture would need to take this into account when
      counting the PLTs.
      
      Today neither architecture does this, meaning when module unloading is
      disabled there are insufficient PLTs in the init section to load some
      modules, resulting in warnings:
      | WARNING: CPU: 2 PID: 51 at arch/arm64/kernel/module-plts.c:99 module_emit_plt_entry+0x184/0x1cc
      | Modules linked in: crct10dif_common
      | CPU: 2 PID: 51 Comm: modprobe Not tainted 6.5.0-rc4-yocto-standard-dirty #15208
      | Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
      | pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      | pc : module_emit_plt_entry+0x184/0x1cc
      | lr : module_emit_plt_entry+0x94/0x1cc
      | sp : ffffffc0803bba60
      [...]
      | Call trace:
      |  module_emit_plt_entry+0x184/0x1cc
      |  apply_relocate_add+0x2bc/0x8e4
      |  load_module+0xe34/0x1bd4
      |  init_module_from_file+0x84/0xc0
      |  __arm64_sys_finit_module+0x1b8/0x27c
      |  invoke_syscall.constprop.0+0x5c/0x104
      |  do_el0_svc+0x58/0x160
      |  el0_svc+0x38/0x110
      |  el0t_64_sync_handler+0xc0/0xc4
      |  el0t_64_sync+0x190/0x194
      
      Instead of duplicating module_init_layout_section()s logic, expose it.
      
      Reported-by: default avatarAdam Johnston <adam.johnston@arm.com>
      Fixes: 055f23b7
      
       ("module: check for exit sections in layout_sections() instead of module_init_section()")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      207e228b
    • Mario Limonciello's avatar
      ACPI: thermal: Drop nocrt parameter · b0dc0aac
      Mario Limonciello authored
      commit 5f641174 upstream.
      
      The `nocrt` module parameter has no code associated with it and does
      nothing.  As `crt=-1` has same functionality as what nocrt should be
      doing drop `nocrt` and associated documentation.
      
      This should fix a quirk for Gigabyte GA-7ZX that used `nocrt` and
      thus didn't function properly.
      
      Fixes: 8c99fdce
      
       ("ACPI: thermal: set "thermal.nocrt" via DMI on Gigabyte GA-7ZX")
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0dc0aac
  2. Aug 30, 2023