1. 13 Apr, 2023 6 commits
    • Nick Alcock's avatar
      ARM: tegra: remove MODULE_LICENSE in non-modules · 0ba3f797
      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: Thierry Reding <thierry.reding@gmail.com>
      Cc: Jonathan Hunter <jonathanh@nvidia.com>
      Cc: linux-tegra@vger.kernel.org
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      0ba3f797
    • Nick Alcock's avatar
      drivers/perf: remove MODULE_LICENSE in non-modules · 9016c09e
      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: Will Deacon <will@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      9016c09e
    • Nick Alcock's avatar
      bus: arm-integrator-lm: remove MODULE_LICENSE in non-modules · 591396b9
      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: Linus Walleij <linus.walleij@linaro.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      591396b9
    • 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 1 commit