1. 11 4月, 2022 1 次提交
  2. 04 4月, 2022 1 次提交
  3. 01 4月, 2022 1 次提交
    • N
      kbuild: Remove '-mno-global-merge' · cf300b83
      Nathan Chancellor 提交于
      This flag is specific to clang, where it is only used by the 32-bit and
      64-bit ARM backends. In certain situations, the presence of this flag
      will cause a warning, as shown by commit 6580c5c1 ("um: clang: Strip
      out -mno-global-merge from USER_CFLAGS").
      
      Since commit 61163efa ("kbuild: LLVMLinux: Add Kbuild support for
      building kernel with Clang") that added this flag back in 2014, there
      have been quite a few changes to the GlobalMerge pass in LLVM. Building
      several different ARCH=arm and ARCH=arm64 configurations with LLVM 11
      (minimum) and 15 (current main version) with this flag removed (i.e.,
      with the default of '-mglobal-merge') reveals no modpost warnings, so it
      is likely that the issue noted in the comment is no longer relevant due
      to changes in LLVM or modpost, meaning this flag can be removed.
      
      If any new warnings show up that are a result of the removal of this
      flag, it can be added back under arch/arm{,64}/Makefile to avoid
      warnings on other architectures.
      Signed-off-by: NNathan Chancellor <nathan@kernel.org>
      Tested-by: NDavid Gow <davidgow@google.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Tested-by: NSedat Dilek <sedat.dilek@gmail.com>
      Reviewed-by: NSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      cf300b83
  4. 31 3月, 2022 1 次提交
    • N
      kbuild: Make $(LLVM) more flexible · e9c28192
      Nathan Chancellor 提交于
      The LLVM make variable allows a developer to quickly switch between the
      GNU and LLVM tools. However, it does not handle versioned binaries, such
      as the ones shipped by Debian, as LLVM=1 just defines the tool variables
      with the unversioned binaries.
      
      There was some discussion during the review of the patch that introduces
      LLVM=1 around versioned binaries, ultimately coming to the conclusion
      that developers can just add the folder that contains the unversioned
      binaries to their PATH, as Debian's versioned suffixed binaries are
      really just symlinks to the unversioned binaries in /usr/lib/llvm-#/bin:
      
      $ realpath /usr/bin/clang-14
      /usr/lib/llvm-14/bin/clang
      
      $ PATH=/usr/lib/llvm-14/bin:$PATH make ... LLVM=1
      
      However, that can be cumbersome to developers who are constantly testing
      series with different toolchains and versions. It is simple enough to
      support these versioned binaries directly in the Kbuild system by
      allowing the developer to specify the version suffix with LLVM=, which
      is shorter than the above suggestion:
      
      $ make ... LLVM=-14
      
      It does not change the meaning of LLVM=1 (which will continue to use
      unversioned binaries) and it does not add too much additional complexity
      to the existing $(LLVM) code, while allowing developers to quickly test
      their series with different versions of the whole LLVM suite of tools.
      
      Some developers may build LLVM from source but not add the binaries to
      their PATH, as they may not want to use that toolchain systemwide.
      Support those developers by allowing them to supply the directory that
      the LLVM tools are available in, as it is no more complex to support
      than the version suffix change above.
      
      $ make ... LLVM=/path/to/llvm/
      
      Update and reorder the documentation to reflect these new additions.
      At the same time, notate that LLVM=0 is not the same as just omitting it
      altogether, which has confused people in the past.
      
      Link: https://lore.kernel.org/r/20200317215515.226917-1-ndesaulniers@google.com/
      Link: https://lore.kernel.org/r/20220224151322.072632223@infradead.org/Suggested-by: NMasahiro Yamada <masahiroy@kernel.org>
      Suggested-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NNathan Chancellor <nathan@kernel.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      e9c28192
  5. 21 3月, 2022 1 次提交
  6. 14 3月, 2022 1 次提交
  7. 13 3月, 2022 3 次提交
  8. 07 3月, 2022 1 次提交
  9. 28 2月, 2022 1 次提交
  10. 21 2月, 2022 1 次提交
  11. 15 2月, 2022 1 次提交
    • M
      kbuild: replace $(if A,A,B) with $(or A,B) · 5c816641
      Masahiro Yamada 提交于
      $(or ...) is available since GNU Make 3.81, and useful to shorten the
      code in some places.
      
      Covert as follows:
      
        $(if A,A,B)  -->  $(or A,B)
      
      This patch also converts:
      
        $(if A, A, B) --> $(or A, B)
      
      Strictly speaking, the latter is not an equivalent conversion because
      GNU Make keeps spaces after commas; if A is not empty, $(if A, A, B)
      expands to " A", while $(or A, B) expands to "A".
      
      Anyway, preceding spaces are not significant in the code hunks I touched.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      5c816641
  12. 14 2月, 2022 4 次提交
  13. 07 2月, 2022 1 次提交
  14. 30 1月, 2022 1 次提交
  15. 23 1月, 2022 1 次提交
  16. 22 1月, 2022 1 次提交
  17. 10 1月, 2022 1 次提交
  18. 08 1月, 2022 3 次提交
    • M
      kbuild: do not quote string values in include/config/auto.conf · 129ab0d2
      Masahiro Yamada 提交于
      The previous commit fixed up all shell scripts to not include
      include/config/auto.conf.
      
      Now that include/config/auto.conf is only included by Makefiles,
      we can change it into a more Make-friendly form.
      
      Previously, Kconfig output string values enclosed with double-quotes
      (both in the .config and include/config/auto.conf):
      
          CONFIG_X="foo bar"
      
      Unlike shell, Make handles double-quotes (and single-quotes as well)
      verbatim. We must rip them off when used.
      
      There are some patterns:
      
        [1] $(patsubst "%",%,$(CONFIG_X))
        [2] $(CONFIG_X:"%"=%)
        [3] $(subst ",,$(CONFIG_X))
        [4] $(shell echo $(CONFIG_X))
      
      These are not only ugly, but also fragile.
      
      [1] and [2] do not work if the value contains spaces, like
         CONFIG_X=" foo bar "
      
      [3] does not work correctly if the value contains double-quotes like
         CONFIG_X="foo\"bar"
      
      [4] seems to work better, but has a cost of forking a process.
      
      Anyway, quoted strings were always PITA for our Makefiles.
      
      This commit changes Kconfig to stop quoting in include/config/auto.conf.
      
      These are the string type symbols referenced in Makefiles or scripts:
      
          ACPI_CUSTOM_DSDT_FILE
          ARC_BUILTIN_DTB_NAME
          ARC_TUNE_MCPU
          BUILTIN_DTB_SOURCE
          CC_IMPLICIT_FALLTHROUGH
          CC_VERSION_TEXT
          CFG80211_EXTRA_REGDB_KEYDIR
          EXTRA_FIRMWARE
          EXTRA_FIRMWARE_DIR
          EXTRA_TARGETS
          H8300_BUILTIN_DTB
          INITRAMFS_SOURCE
          LOCALVERSION
          MODULE_SIG_HASH
          MODULE_SIG_KEY
          NDS32_BUILTIN_DTB
          NIOS2_DTB_SOURCE
          OPENRISC_BUILTIN_DTB
          SOC_CANAAN_K210_DTB_SOURCE
          SYSTEM_BLACKLIST_HASH_LIST
          SYSTEM_REVOCATION_KEYS
          SYSTEM_TRUSTED_KEYS
          TARGET_CPU
          UNUSED_KSYMS_WHITELIST
          XILINX_MICROBLAZE0_FAMILY
          XILINX_MICROBLAZE0_HW_VER
          XTENSA_VARIANT_NAME
      
      I checked them one by one, and fixed up the code where necessary.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      129ab0d2
    • M
      certs: refactor file cleaning · 5cca3606
      Masahiro Yamada 提交于
      'make clean' removes files listed in 'targets'. It is redundant to
      specify both 'targets' and 'clean-files'.
      
      Move 'targets' assignments out of the ifeq-conditionals so
      scripts/Makefile.clean can see them.
      
      One effective change is that certs/certs/signing_key.x509 is now
      deleted by 'make clean' instead of 'make mrproper. This certificate
      is embedded in the kernel. It is not used in any way by external
      module builds.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNicolas Schier <n.schier@avm.de>
      5cca3606
    • M
      kbuild: remove headers_check stub · 4fbce819
      Masahiro Yamada 提交于
      Linux 5.15 is out. Remove this stub now.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      4fbce819
  19. 03 1月, 2022 1 次提交
  20. 27 12月, 2021 1 次提交
  21. 20 12月, 2021 1 次提交
  22. 13 12月, 2021 1 次提交
  23. 09 12月, 2021 1 次提交
  24. 08 12月, 2021 1 次提交
  25. 07 12月, 2021 1 次提交
  26. 06 12月, 2021 1 次提交
  27. 29 11月, 2021 1 次提交
  28. 22 11月, 2021 1 次提交
  29. 16 11月, 2021 1 次提交
  30. 15 11月, 2021 2 次提交
  31. 07 11月, 2021 1 次提交
    • K
      Compiler Attributes: add __alloc_size() for better bounds checking · 86cffecd
      Kees Cook 提交于
      GCC and Clang can use the "alloc_size" attribute to better inform the
      results of __builtin_object_size() (for compile-time constant values).
      Clang can additionally use alloc_size to inform the results of
      __builtin_dynamic_object_size() (for run-time values).
      
      Because GCC sees the frequent use of struct_size() as an allocator size
      argument, and notices it can return SIZE_MAX (the overflow indication),
      it complains about these call sites overflowing (since SIZE_MAX is
      greater than the default -Walloc-size-larger-than=PTRDIFF_MAX).  This
      isn't helpful since we already know a SIZE_MAX will be caught at
      run-time (this was an intentional design).  To deal with this, we must
      disable this check as it is both a false positive and redundant.  (Clang
      does not have this warning option.)
      
      Unfortunately, just checking the -Wno-alloc-size-larger-than is not
      sufficient to make the __alloc_size attribute behave correctly under
      older GCC versions.  The attribute itself must be disabled in those
      situations too, as there appears to be no way to reliably silence the
      SIZE_MAX constant expression cases for GCC versions less than 9.1:
      
         In file included from ./include/linux/resource_ext.h:11,
                          from ./include/linux/pci.h:40,
                          from drivers/net/ethernet/intel/ixgbe/ixgbe.h:9,
                          from drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c:4:
         In function 'kmalloc_node',
             inlined from 'ixgbe_alloc_q_vector' at ./include/linux/slab.h:743:9:
         ./include/linux/slab.h:618:9: error: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
           return __kmalloc_node(size, flags, node);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         ./include/linux/slab.h: In function 'ixgbe_alloc_q_vector':
         ./include/linux/slab.h:455:7: note: in a call to allocation function '__kmalloc_node' declared here
          void *__kmalloc_node(size_t size, gfp_t flags, int node) __assume_slab_alignment __malloc;
                ^~~~~~~~~~~~~~
      
      Specifically:
       '-Wno-alloc-size-larger-than' is not correctly handled by GCC < 9.1
          https://godbolt.org/z/hqsfG7q84 (doesn't disable)
          https://godbolt.org/z/P9jdrPTYh (doesn't admit to not knowing about option)
          https://godbolt.org/z/465TPMWKb (only warns when other warnings appear)
      
       '-Walloc-size-larger-than=18446744073709551615' is not handled by GCC < 8.2
          https://godbolt.org/z/73hh1EPxz (ignores numeric value)
      
      Since anything marked with __alloc_size would also qualify for marking
      with __malloc, just include __malloc along with it to avoid redundant
      markings.  (Suggested by Linus Torvalds.)
      
      Finally, make sure checkpatch.pl doesn't get confused about finding the
      __alloc_size attribute on functions.  (Thanks to Joe Perches.)
      
      Link: https://lkml.kernel.org/r/20210930222704.2631604-3-keescook@chromium.orgSigned-off-by: NKees Cook <keescook@chromium.org>
      Tested-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Andy Whitcroft <apw@canonical.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Daniel Micay <danielmicay@gmail.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Alexandre Bounine <alex.bou9@gmail.com>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Cc: Jing Xiangfeng <jingxiangfeng@huawei.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: kernel test robot <lkp@intel.com>
      Cc: Matt Porter <mporter@kernel.crashing.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Souptick Joarder <jrdr.linux@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      86cffecd
  32. 02 11月, 2021 1 次提交