1. 13 Apr, 2023 3 commits
    • Nick Alcock's avatar
      irqchip/al-fic: remove MODULE_LICENSE in non-modules · 655cc3a6
      Nick Alcock authored
      Since commit 8b41fc44 ("kbuild: create modules.builtin without
      Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
      are used to identify modules. As a consequence, uses of the macro
      in non-modules will cause modprobe to misidentify their containing
      object file as a module when it is not (false positives), and modprobe
      might succeed rather than failing with a suitable error message.
      
      So remove it in the files in this commit, none of which can be built as
      modules.
      Signed-off-by: default avatarNick Alcock <nick.alcock@oracle.com>
      Suggested-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: linux-modules@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
      Cc: Talel Shenhar <talel@amazon.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Marc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      655cc3a6
    • Nick Alcock's avatar
      mfd: altera-sysmgr: remove MODULE_LICENSE in non-modules · 9e0d360f
      Nick Alcock authored
      Since commit 8b41fc44 ("kbuild: create modules.builtin without
      Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
      are used to identify modules. As a consequence, uses of the macro
      in non-modules will cause modprobe to misidentify their containing
      object file as a module when it is not (false positives), and modprobe
      might succeed rather than failing with a suitable error message.
      
      So remove it in the files in this commit, none of which can be built as
      modules.
      Signed-off-by: default avatarNick Alcock <nick.alcock@oracle.com>
      Suggested-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: linux-modules@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
      Cc: Thor Thayer <thor.thayer@linux.intel.com>
      Cc: Lee Jones <lee@kernel.org>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      9e0d360f
    • Nick Alcock's avatar
      soc: fujitsu: remove MODULE_LICENSE in non-modules · 066ff7db
      Nick Alcock authored
      Since commit 8b41fc44 ("kbuild: create modules.builtin without
      Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
      are used to identify modules. As a consequence, uses of the macro
      in non-modules will cause modprobe to misidentify their containing
      object file as a module when it is not (false positives), and modprobe
      might succeed rather than failing with a suitable error message.
      
      So remove it in the files in this commit, none of which can be built as
      modules.
      Signed-off-by: default avatarNick Alcock <nick.alcock@oracle.com>
      Suggested-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: linux-modules@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      066ff7db
  2. 24 Mar, 2023 22 commits
  3. 22 Mar, 2023 1 commit
  4. 19 Mar, 2023 2 commits
    • Zhen Lei's avatar
      kallsyms: Delete an unused parameter related to {module_}kallsyms_on_each_symbol() · 3703bd54
      Zhen Lei authored
      The parameter 'struct module *' in the hook function associated with
      {module_}kallsyms_on_each_symbol() is no longer used. Delete it.
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Reviewed-by: default avatarVincenzo Palazzo <vincenzopalazzodev@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      3703bd54
    • Jason Baron's avatar
      dyndbg: cleanup dynamic usage in ib_srp.c · 7ce93729
      Jason Baron authored
      Currently, in dynamic_debug.h we only provide
      DEFINE_DYNAMIC_DEBUG_METADATA() and DYNAMIC_DEBUG_BRANCH()
      definitions if CONFIG_DYNAMIC_CORE is enabled. Thus, drivers
      such as infiniband srp (see: drivers/infiniband/ulp/srp/ib_srp.c)
      must provide their own definitions for !CONFIG_DYNAMIC_CORE.
      
      Thus, let's move this !CONFIG_DYNAMIC_CORE case into dynamic_debug.h.
      However, the dynamic debug interfaces should really only be defined
      if CONFIG_DYNAMIC_DEBUG is set or CONFIG_DYNAMIC_CORE is set along
      with DYNAMIC_DEBUG_MODULE, (see:
      Documentation/admin-guide/dynamic-debug-howto.rst). Thus, the
      undefined case becomes: !((CONFIG_DYNAMIC_DEBUG ||
      (CONFIG_DYNAMIC_CORE && DYNAMIC_DEBUG_MODULE)).
      With those changes in place, we can remove the !CONFIG_DYNAMIC_CORE
      case from ib_srp.c
      
      This change was prompted by a build breakeage in ib_srp.c stemming
      from the inclusion of dynamic_debug.h unconditionally in module.h, due
      to commit 7deabd67 ("dyndbg: use the module notifier callbacks").
      In that case, if we have CONFIG_DYNAMIC_CORE=y and
      CONFIG_DYNAMIC_DEBUG=n then the definitions for
      DEFINE_DYNAMIC_DEBUG_METADATA() and DYNAMIC_DEBUG_BRANCH() are defined
      once in ib_srp.c and then again in the dynamic_debug.h. This had been
      working prior to the above referenced commit because dynamic_debug.h
      was only pulled into ib_srp.c conditinally via printk.h if
      CONFIG_DYNAMIC_DEBUG was set.
      
      Also, the exported functions in lib/dynamic_debug.c itself may
      not have a prototype if CONFIG_DYNAMIC_DEBUG=n and
      CONFIG_DYNAMIC_CORE=y. This would trigger the -Wmissing-prototypes
      warning.
      
      The exported functions are behind (include/linux/dynamic_debug.h):
      
      if defined(CONFIG_DYNAMIC_DEBUG) || \
       (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
      
      Thus, by adding -DDYNAMIC_CONFIG_MODULE to the lib/Makefile we
      can ensure that the exported functions have a prototype in all cases,
      since lib/dynamic_debug.c is built whenever
      CONFIG_DYNAMIC_DEBUG_CORE=y.
      
      Fixes: 7deabd67 ("dyndbg: use the module notifier callbacks")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/oe-kbuild-all/202303071444.sIbZTDCy-lkp@intel.com/Signed-off-by: default avatarJason Baron <jbaron@akamai.com>
      [mcgrof: adjust commit log, and remove urldefense from URL]
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      7ce93729
  5. 10 Mar, 2023 2 commits
    • Luis Chamberlain's avatar
      kernel/module: add documentation for try_module_get() · 557aafac
      Luis Chamberlain authored
      There is quite a bit of tribal knowledge around proper use of try_module_get()
      and requiring *somehow* the module to still exist to use this call in a way
      that is safe. Document this bit of tribal knowledge. To be clear, you should
      only use try_module_get() *iff* you are 100% sure the module already does
      exist and is not on its way out.
      
      You can be sure the module still exists and is alive through:
      
      1) Direct protection with its refcount: you know some earlier caller called
         __module_get() safely
      2) Implied protection: there is an implied protection against module removal
      
      Having an idea of when you are sure __module_get() might be called earlier is
      easy to understand however the implied protection requires an example. We use
      sysfs an an example for implied protection without a direct module reference
      count bump. kernfs / sysfs uses its own internal reference counting for files
      being actively used, when such file are active they completely prevent
      the module from being removed. kernfs protects this with its kernfs_active().
      Effort has been put into verifying the kernfs implied protection works by
      using a currently out-of-tree test_sysfs selftest test #32 [0]:
      
      ./tools/testing/selftests/sysfs/sysfs.sh -t 0032
      
      Without kernfs / sysfs preventing module removal through its active reference
      count (kernfs_active()) the write would fail or worse, a crash would happen in
      this test and it does not.
      
      Similar safeguards are required for other users of try_module_get() *iff*
      they are not ensuring the above rule 1) is followed.
      
      [0] https://lore.kernel.org/lkml/20211029184500.2821444-4-mcgrof@kernel.org/Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      557aafac
    • Arnd Bergmann's avatar
      ARM: dyndbg: allow including dyndbg.h in decompressor · 05777499
      Arnd Bergmann authored
      After a change to linux/module.h, dyndbg.h is now included
      indirectly from the decompressor for lz4 support, which in turn
      causes a build failure on 32-bit Arm:
      
      In file included from include/linux/module.h:30,
                       from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:39,
                       from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10,
                       from arch/arm/boot/compressed/decompress.c:59:
      include/linux/dynamic_debug.h: In function 'ddebug_dyndbg_module_param_cb':
      include/linux/dynamic_debug.h:307:14: error: implicit declaration of function 'strcmp' [-Werror=implicit-function-declaration]
        307 |         if (!strcmp(param, "dyndbg")) {
            |              ^~~~~~
      include/linux/dynamic_debug.h:1:1: note: 'strcmp' is defined in header '<string.h>'; did you forget to '#include <string.h>'?
        +++ |+#include <string.h>
      
      The decompressor has its own replacement for the linux/string.h contents,
      so the normal declaration is not visible here. Since the function is
      not actually called, it is sufficient to add a declaration, and this
      is in fact the correct one as it matches the definition in
      arch/arm/boot/compressed/string.c.
      
      Fixes: 7deabd67 ("dyndbg: use the module notifier callbacks")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarJason Baron <jbaron@akamai.com>
      Reviewed-by: default avatarVincenzo Palazzo <vincenzopalazzodev@gmail.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      05777499
  6. 09 Mar, 2023 6 commits
  7. 05 Mar, 2023 4 commits
    • Linus Torvalds's avatar
      Linux 6.3-rc1 · fe15c26e
      Linus Torvalds authored
      fe15c26e
    • Linus Torvalds's avatar
      cpumask: re-introduce constant-sized cpumask optimizations · 596ff4a0
      Linus Torvalds authored
      Commit aa47a7c2 ("lib/cpumask: deprecate nr_cpumask_bits") resulted
      in the cpumask operations potentially becoming hugely less efficient,
      because suddenly the cpumask was always considered to be variable-sized.
      
      The optimization was then later added back in a limited form by commit
      6f9c07be ("lib/cpumask: add FORCE_NR_CPUS config option"), but that
      FORCE_NR_CPUS option is not useful in a generic kernel and more of a
      special case for embedded situations with fixed hardware.
      
      Instead, just re-introduce the optimization, with some changes.
      
      Instead of depending on CPUMASK_OFFSTACK being false, and then always
      using the full constant cpumask width, this introduces three different
      cpumask "sizes":
      
       - the exact size (nr_cpumask_bits) remains identical to nr_cpu_ids.
      
         This is used for situations where we should use the exact size.
      
       - the "small" size (small_cpumask_bits) is the NR_CPUS constant if it
         fits in a single word and the bitmap operations thus end up able
         to trigger the "small_const_nbits()" optimizations.
      
         This is used for the operations that have optimized single-word
         cases that get inlined, notably the bit find and scanning functions.
      
       - the "large" size (large_cpumask_bits) is the NR_CPUS constant if it
         is an sufficiently small constant that makes simple "copy" and
         "clear" operations more efficient.
      
         This is arbitrarily set at four words or less.
      
      As a an example of this situation, without this fixed size optimization,
      cpumask_clear() will generate code like
      
              movl    nr_cpu_ids(%rip), %edx
              addq    $63, %rdx
              shrq    $3, %rdx
              andl    $-8, %edx
              callq   memset@PLT
      
      on x86-64, because it would calculate the "exact" number of longwords
      that need to be cleared.
      
      In contrast, with this patch, using a MAX_CPU of 64 (which is quite a
      reasonable value to use), the above becomes a single
      
      	movq $0,cpumask
      
      instruction instead, because instead of caring to figure out exactly how
      many CPU's the system has, it just knows that the cpumask will be a
      single word and can just clear it all.
      
      Note that this does end up tightening the rules a bit from the original
      version in another way: operations that set bits in the cpumask are now
      limited to the actual nr_cpu_ids limit, whereas we used to do the
      nr_cpumask_bits thing almost everywhere in the cpumask code.
      
      But if you just clear bits, or scan for bits, we can use the simpler
      compile-time constants.
      
      In the process, remove 'cpumask_complement()' and 'for_each_cpu_not()'
      which were not useful, and which fundamentally have to be limited to
      'nr_cpu_ids'.  Better remove them now than have somebody introduce use
      of them later.
      
      Of course, on x86-64 with MAXSMP there is no sane small compile-time
      constant for the cpumask sizes, and we end up using the actual CPU bits,
      and will generate the above kind of horrors regardless.  Please don't
      use MAXSMP unless you really expect to have machines with thousands of
      cores.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      596ff4a0
    • Linus Torvalds's avatar
      Merge tag 'v6.3-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · f915322f
      Linus Torvalds authored
      Pull crypto fix from Herbert Xu:
       "Fix a regression in the caam driver"
      
      * tag 'v6.3-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: caam - Fix edesc/iv ordering mixup
      f915322f
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7f9ec7d8
      Linus Torvalds authored
      Pull x86 updates from Thomas Gleixner:
       "A small set of updates for x86:
      
         - Return -EIO instead of success when the certificate buffer for SEV
           guests is not large enough
      
         - Allow STIPB to be enabled with legacy IBSR. Legacy IBRS is cleared
           on return to userspace for performance reasons, but the leaves user
           space vulnerable to cross-thread attacks which STIBP prevents.
           Update the documentation accordingly"
      
      * tag 'x86-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        virt/sev-guest: Return -EIO if certificate buffer is not large enough
        Documentation/hw-vuln: Document the interaction between IBRS and STIBP
        x86/speculation: Allow enabling STIBP with legacy IBRS
      7f9ec7d8