Merge tag 'hardening-v6.9-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Mar 2024 15:43:21 +0000 (08:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Mar 2024 15:43:21 +0000 (08:43 -0700)
Pull more hardening updates from Kees Cook:

 - CONFIG_MEMCPY_SLOW_KUNIT_TEST is no longer needed (Guenter Roeck)

 - Fix needless UTF-8 character in arch/Kconfig (Liu Song)

 - Improve __counted_by warning message in LKDTM (Nathan Chancellor)

 - Refactor DEFINE_FLEX() for default use of __counted_by

 - Disable signed integer overflow sanitizer on GCC < 8

* tag 'hardening-v6.9-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  lkdtm/bugs: Improve warning message for compilers without counted_by support
  overflow: Change DEFINE_FLEX to take __counted_by member
  Revert "kunit: memcpy: Split slow memcpy tests into MEMCPY_SLOW_KUNIT_TEST"
  arch/Kconfig: eliminate needless UTF-8 character in Kconfig help
  ubsan: Disable signed integer overflow sanitizer on GCC < 8

1  2 
arch/Kconfig
lib/Kconfig.debug

diff --combined arch/Kconfig
index 59dee290d94b30b9234b4ce3f83a1801025eee3c,e8d3169ce9df3625414c3dd798c689213cea0f70..9f066785bb71d93ca5da01a22d15ed2effba5901
@@@ -799,7 -799,7 +799,7 @@@ config CFI_CLAN
        depends on ARCH_SUPPORTS_CFI_CLANG
        depends on $(cc-option,-fsanitize=kcfi)
        help
-         This option enables Clangs forward-edge Control Flow Integrity
+         This option enables Clang's forward-edge Control Flow Integrity
          (CFI) checking, where the compiler injects a runtime check to each
          indirect function call to ensure the target is a valid function with
          the correct static type. This restricts possible call targets and
@@@ -1597,16 -1597,4 +1597,16 @@@ config FUNCTION_ALIGNMEN
        default 4 if FUNCTION_ALIGNMENT_4B
        default 0
  
 +config CC_HAS_MIN_FUNCTION_ALIGNMENT
 +      # Detect availability of the GCC option -fmin-function-alignment which
 +      # guarantees minimal alignment for all functions, unlike
 +      # -falign-functions which the compiler ignores for cold functions.
 +      def_bool $(cc-option, -fmin-function-alignment=8)
 +
 +config CC_HAS_SANE_FUNCTION_ALIGNMENT
 +      # Set if the guaranteed alignment with -fmin-function-alignment is
 +      # available or extra care is required in the kernel. Clang provides
 +      # strict alignment always, even with -falign-functions.
 +      def_bool CC_HAS_MIN_FUNCTION_ALIGNMENT || CC_IS_CLANG
 +
  endmenu
diff --combined lib/Kconfig.debug
index f4a12980a8da3406c4dc67f60ca11ff77a99b626,9ac4cb3eb20bbde7d203347c9acb19bd1a3c93fe..c63a5fbf1f1c2b45b67603886ef9e6f07510f61d
@@@ -2127,7 -2127,7 +2127,7 @@@ config KCOV_IRQ_AREA_SIZ
  
  menuconfig RUNTIME_TESTING_MENU
        bool "Runtime Testing"
 -      def_bool y
 +      default y
  
  if RUNTIME_TESTING_MENU
  
@@@ -2703,18 -2703,6 +2703,6 @@@ config MEMCPY_KUNIT_TES
  
          If unsure, say N.
  
- config MEMCPY_SLOW_KUNIT_TEST
-       bool "Include exhaustive memcpy tests"
-       depends on MEMCPY_KUNIT_TEST
-       default y
-       help
-         Some memcpy tests are quite exhaustive in checking for overlaps
-         and bit ranges. These can be very slow, so they are split out
-         as a separate config, in case they need to be disabled.
-         Note this config option will be replaced by the use of KUnit test
-         attributes.
  config IS_SIGNED_TYPE_KUNIT_TEST
        tristate "Test is_signed_type() macro" if !KUNIT_ALL_TESTS
        depends on KUNIT