Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] ubsan/overflow: Enable ignorelist parsing and add type filter
@ 2025-03-18  0:51 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-03-18  0:51 UTC (permalink / raw)
  Cc: oe-kbuild-all, llvm

In-Reply-To: <20250307041914.937329-3-kees@kernel.org>
References: <20250307041914.937329-3-kees@kernel.org>
TO: Kees Cook <kees@kernel.org>

Hi Kees,

kernel test robot noticed the following build errors:

[auto build test ERROR on kees/for-next/hardening]
[also build test ERROR on masahiroy-kbuild/for-next masahiroy-kbuild/fixes kees/for-next/pstore linus/master v6.14-rc7]
[cannot apply to kees/for-next/kspp next-20250317]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Kees-Cook/ubsan-overflow-Rework-integer-overflow-sanitizer-option-to-turn-on-everything/20250307-122130
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
patch link:    https://lore.kernel.org/r/20250307041914.937329-3-kees%40kernel.org
patch subject: [PATCH 3/3] ubsan/overflow: Enable ignorelist parsing and add type filter
config: x86_64-randconfig-074-20250318 (https://download.01.org/0day-ci/archive/20250318/202503180815.hABxOEAV-lkp@intel.com/config)
compiler: clang version 20.1.0 (https://github.com/llvm/llvm-project 24a30daaa559829ad079f2ff7f73eb4e18095f88)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250318/202503180815.hABxOEAV-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503180815.hABxOEAV-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from lib/fortify_kunit.c:43:
   In file included from include/kunit/device.h:16:
   In file included from include/kunit/test.h:22:
   In file included from include/linux/kref.h:16:
   In file included from include/linux/spinlock.h:59:
   In file included from include/linux/irqflags.h:18:
   In file included from arch/x86/include/asm/irqflags.h:80:
   In file included from arch/x86/include/asm/paravirt.h:21:
   In file included from include/linux/cpumask.h:12:
   In file included from include/linux/bitmap.h:13:
   In file included from include/linux/string.h:392:
>> include/linux/fortify-string.h:719:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter)
     719 |                         __read_overflow();
         |                         ^
   1 error generated.


vim +719 include/linux/fortify-string.h

a28a6e860c6cf2 Francis Laniel 2021-02-25  710  
92df138a8d663c Kees Cook      2022-02-08  711  __FORTIFY_INLINE __diagnose_as(__builtin_memcmp, 1, 2, 3)
281d0c962752fb Kees Cook      2022-02-08  712  int memcmp(const void * const POS0 p, const void * const POS0 q, __kernel_size_t size)
a28a6e860c6cf2 Francis Laniel 2021-02-25  713  {
21a2c74b0a2a78 Kees Cook      2023-04-07  714  	const size_t p_size = __struct_size(p);
21a2c74b0a2a78 Kees Cook      2023-04-07  715  	const size_t q_size = __struct_size(q);
a28a6e860c6cf2 Francis Laniel 2021-02-25  716  
a28a6e860c6cf2 Francis Laniel 2021-02-25  717  	if (__builtin_constant_p(size)) {
fa35198f39571b Kees Cook      2022-09-19  718  		if (__compiletime_lessthan(p_size, size))
a28a6e860c6cf2 Francis Laniel 2021-02-25 @719  			__read_overflow();
fa35198f39571b Kees Cook      2022-09-19  720  		if (__compiletime_lessthan(q_size, size))
a28a6e860c6cf2 Francis Laniel 2021-02-25  721  			__read_overflow2();
a28a6e860c6cf2 Francis Laniel 2021-02-25  722  	}
3d965b33e40d97 Kees Cook      2023-04-07  723  	if (p_size < size)
3d965b33e40d97 Kees Cook      2023-04-07  724  		fortify_panic(FORTIFY_FUNC_memcmp, FORTIFY_READ, p_size, size, INT_MIN);
3d965b33e40d97 Kees Cook      2023-04-07  725  	else if (q_size < size)
3d965b33e40d97 Kees Cook      2023-04-07  726  		fortify_panic(FORTIFY_FUNC_memcmp, FORTIFY_READ, q_size, size, INT_MIN);
a28a6e860c6cf2 Francis Laniel 2021-02-25  727  	return __underlying_memcmp(p, q, size);
a28a6e860c6cf2 Francis Laniel 2021-02-25  728  }
a28a6e860c6cf2 Francis Laniel 2021-02-25  729  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 0/3] ubsan/overflow: Enable pattern exclusions
@ 2025-03-07  4:19 Kees Cook
  2025-03-07  4:19 ` [PATCH 3/3] ubsan/overflow: Enable ignorelist parsing and add type filter Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2025-03-07  4:19 UTC (permalink / raw)
  To: Justin Stitt
  Cc: Kees Cook, Gustavo A. R. Silva, Andrew Morton, Marco Elver,
	Andrey Konovalov, Andrey Ryabinin, Masahiro Yamada,
	Nathan Chancellor, Nicolas Schier, Miguel Ojeda, Nick Desaulniers,
	Hao Luo, Przemek Kitszel, Bill Wendling, Jakub Kicinski,
	Tony Ambardar, Alexander Potapenko, Jan Hendrik Farr,
	Alexander Lobakin, linux-kernel, linux-hardening, kasan-dev,
	linux-kbuild, llvm

Hi,

This brings Linux's integer overflow mitigation integration up to the
current set of features available in Clang for handling things sanely
(i.e. pattern exclusions). While this isn't over yet, it puts all the
infrastructure in place to continue keeping up to date with current
Clang development. The next step is to add support for the coming
canonical wrapping and non-wrapping types[1].

-Kees

[1] https://discourse.llvm.org/t/rfc-clang-canonical-wrapping-and-non-wrapping-types/84356

Kees Cook (3):
  ubsan/overflow: Rework integer overflow sanitizer option to turn on
    everything
  ubsan/overflow: Enable pattern exclusions
  ubsan/overflow: Enable ignorelist parsing and add type filter

 include/linux/compiler_types.h  |  2 +-
 kernel/configs/hardening.config |  2 +-
 lib/Kconfig.ubsan               | 25 +++++++++++++------------
 lib/test_ubsan.c                | 18 ++++++++++++++----
 lib/ubsan.c                     | 28 ++++++++++++++++++++++++++--
 lib/ubsan.h                     |  8 ++++++++
 scripts/Makefile.lib            |  4 ++--
 scripts/Makefile.ubsan          | 10 ++++++++--
 scripts/integer-wrap-ignore.scl |  3 +++
 9 files changed, 76 insertions(+), 24 deletions(-)
 create mode 100644 scripts/integer-wrap-ignore.scl

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-18  0:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18  0:51 [PATCH 3/3] ubsan/overflow: Enable ignorelist parsing and add type filter kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-03-07  4:19 [PATCH 0/3] ubsan/overflow: Enable pattern exclusions Kees Cook
2025-03-07  4:19 ` [PATCH 3/3] ubsan/overflow: Enable ignorelist parsing and add type filter Kees Cook
2025-03-07 23:33   ` Justin Stitt
2025-03-07 23:39   ` Justin Stitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox