On Mon, Mar 10, 2025 at 10:54:12AM +0800, kernel test robot wrote:
> Hi Kees,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on kees/for-next/hardening]
> [also build test WARNING on masahiroy-kbuild/for-next masahiroy-kbuild/fixes
> kees/for-next/pstore linus/master v6.14-rc6 next-20250307]
> [cannot apply to kees/for-next/kspp]
> [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-1-kees%40kernel.org
> patch subject: [PATCH 1/3] ubsan/overflow: Rework integer overflow sanitizer
> option to turn on everything
> config: s390-randconfig-r112-20250310
> (https://download.01.org/0day-ci/archive/20250310/[email protected]/config)
> compiler: s390-linux-gcc (GCC) 14.2.0
> reproduce:
> (https://download.01.org/0day-ci/archive/20250310/[email protected]/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 <[email protected]>
> | Closes:
> https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> sparse warnings: (new ones prefixed by >>)
> >> lib/test_ubsan.c:62:16: sparse: sparse: cast truncates bits from constant
> >> value (7fffffffffffffff becomes ffffffff)
> lib/test_ubsan.c:72:18: sparse: sparse: shift count is negative (-1)
Can we exclude certain source files from sparse? This whole file is
basically an endless series of intentionally bad operations. :)
-Kees
>
> vim +62 lib/test_ubsan.c
>
> 55
> 56 static void test_ubsan_truncate_signed(void)
> 57 {
> 58 volatile long val = LONG_MAX;
> 59 volatile int val2 = 0;
> 60
> 61 UBSAN_TEST(CONFIG_UBSAN_INTEGER_WRAP);
> > 62 val2 = val;
> 63 }
> 64
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
--
Kees Cook