Skip to content
Snippets Groups Projects
  1. Jul 03, 2022
  2. Jun 26, 2022
  3. Jun 25, 2022
  4. Jun 19, 2022
  5. Jun 12, 2022
  6. Jun 09, 2022
    • Linus Torvalds's avatar
      gcc-12: disable '-Warray-bounds' universally for now · f0be87c4
      Linus Torvalds authored
      
      In commit 8b202ee2 ("s390: disable -Warray-bounds") the s390 people
      disabled the '-Warray-bounds' warning for gcc-12, because the new logic
      in gcc would cause warnings for their use of the S390_lowcore macro,
      which accesses absolute pointers.
      
      It turns out gcc-12 has many other issues in this area, so this takes
      that s390 warning disable logic, and turns it into a kernel build config
      entry instead.
      
      Part of the intent is that we can make this all much more targeted, and
      use this conflig flag to disable it in only particular configurations
      that cause problems, with the s390 case as an example:
      
              select GCC12_NO_ARRAY_BOUNDS
      
      and we could do that for other configuration cases that cause issues.
      
      Or we could possibly use the CONFIG_CC_NO_ARRAY_BOUNDS thing in a more
      targeted way, and disable the warning only for particular uses: again
      the s390 case as an example:
      
        KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds)
      
      but this ends up just doing it globally in the top-level Makefile, since
      the current issues are spread fairly widely all over:
      
        KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
      
      We'll try to limit this later, since the gcc-12 problems are rare enough
      that *much* of the kernel can be built with it without disabling this
      warning.
      
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f0be87c4
    • Linus Torvalds's avatar
      gcc-12: disable '-Wdangling-pointer' warning for now · 49beadbd
      Linus Torvalds authored
      
      While the concept of checking for dangling pointers to local variables
      at function exit is really interesting, the gcc-12 implementation is not
      compatible with reality, and results in false positives.
      
      For example, gcc sees us putting things on a local list head allocated
      on the stack, which involves exactly those kinds of pointers to the
      local stack entry:
      
        In function ‘__list_add’,
            inlined from ‘list_add_tail’ at include/linux/list.h:102:2,
            inlined from ‘rebuild_snap_realms’ at fs/ceph/snap.c:434:2:
        include/linux/list.h:74:19: warning: storing the address of local variable ‘realm_queue’ in ‘*&realm_27(D)->rebuild_item.prev’ [-Wdangling-pointer=]
           74 |         new->prev = prev;
              |         ~~~~~~~~~~^~~~~~
      
      But then gcc - understandably - doesn't really understand the big
      picture how the doubly linked list works, so doesn't see how we then end
      up emptying said list head in a loop and the pointer we added has been
      removed.
      
      Gcc also complains about us (intentionally) using this as a way to store
      a kind of fake stack trace, eg
      
        drivers/acpi/acpica/utdebug.c:40:38: warning: storing the address of local variable ‘current_sp’ in ‘acpi_gbl_entry_stack_pointer’ [-Wdangling-pointer=]
           40 |         acpi_gbl_entry_stack_pointer = &current_sp;
              |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
      
      which is entirely reasonable from a compiler standpoint, and we may want
      to change those kinds of patterns, but not not.
      
      So this is one of those "it would be lovely if the compiler were to
      complain about us leaving dangling pointers to the stack", but not this
      way.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      49beadbd
  7. Jun 06, 2022
  8. Jun 04, 2022
    • Masahiro Yamada's avatar
      kbuild: clean .tmp_* pattern by make clean · b0d6207b
      Masahiro Yamada authored
      
      Change the "make clean" rule to remove all the .tmp_* files.
      
      .tmp_objdiff is the only exception, which should be removed by
      "make mrproper".
      
      Rename the record directory of objdiff, .tmp_objdiff to .objdiff to
      avoid the removal by "make clean".
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64)
      b0d6207b
  9. May 22, 2022
  10. May 16, 2022
  11. May 11, 2022
  12. May 08, 2022
  13. May 07, 2022
  14. May 01, 2022
  15. Apr 24, 2022
  16. Apr 22, 2022
  17. Apr 17, 2022
  18. Apr 11, 2022
  19. Apr 05, 2022
  20. Apr 03, 2022
  21. Apr 01, 2022
    • Nathan Chancellor's avatar
      kbuild: Remove '-mno-global-merge' · cf300b83
      Nathan Chancellor authored
      
      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: default avatarNathan Chancellor <nathan@kernel.org>
      Tested-by: default avatarDavid Gow <davidgow@google.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Reviewed-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      cf300b83
  22. Mar 31, 2022
    • Nathan Chancellor's avatar
      kbuild: Make $(LLVM) more flexible · e9c28192
      Nathan Chancellor authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e9c28192
  23. Mar 20, 2022
  24. Mar 13, 2022
  25. Mar 06, 2022
  26. Feb 27, 2022
  27. Feb 20, 2022
  28. Feb 15, 2022
    • Masahiro Yamada's avatar
      kbuild: replace $(if A,A,B) with $(or A,B) · 5c816641
      Masahiro Yamada authored
      
      $(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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      5c816641
  29. Feb 14, 2022
  30. Feb 13, 2022
Loading