2022-06-11 16:52:36

by kernel test robot

[permalink] [raw]
Subject: lib/overflow_kunit.c:644:1: warning: the frame size of 2832 bytes is larger than 1024 bytes

Hi Kees,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0885eacdc81f920c3e0554d5615e69a66504a28d
commit: 617f55e20743fc50c989b498f9dee289eb644cfd lib: overflow: Convert to Kunit
date: 3 months ago
config: powerpc-buildonly-randconfig-r006-20220611 (https://download.01.org/0day-ci/archive/20220612/[email protected]/config)
compiler: powerpc-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=617f55e20743fc50c989b498f9dee289eb644cfd
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 617f55e20743fc50c989b498f9dee289eb644cfd
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

lib/overflow_kunit.c:191:19: warning: 's64_tests' defined but not used [-Wunused-const-variable=]
191 | DEFINE_TEST_ARRAY(s64) = {
| ^~~
lib/overflow_kunit.c:24:11: note: in definition of macro 'DEFINE_TEST_ARRAY'
24 | } t ## _tests[]
| ^
lib/overflow_kunit.c:94:19: warning: 'u64_tests' defined but not used [-Wunused-const-variable=]
94 | DEFINE_TEST_ARRAY(u64) = {
| ^~~
lib/overflow_kunit.c:24:11: note: in definition of macro 'DEFINE_TEST_ARRAY'
24 | } t ## _tests[]
| ^
lib/overflow_kunit.c: In function 'overflow_size_helpers_test':
>> lib/overflow_kunit.c:644:1: warning: the frame size of 2832 bytes is larger than 1024 bytes [-Wframe-larger-than=]
644 | }
| ^
lib/overflow_kunit.c: In function 'overflow_shift_test':
lib/overflow_kunit.c:451:1: warning: the frame size of 7232 bytes is larger than 1024 bytes [-Wframe-larger-than=]
451 | }
| ^


vim +644 lib/overflow_kunit.c

e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 577
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 578 var = 4;
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 579 check_one_size_helper(20, size_mul, var++, 5);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 580 check_one_size_helper(20, size_mul, 4, var++);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 581 check_one_size_helper(0, size_mul, 0, 3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 582 check_one_size_helper(0, size_mul, 3, 0);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 583 check_one_size_helper(6, size_mul, 2, 3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 584 check_one_size_helper(SIZE_MAX, size_mul, SIZE_MAX, 1);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 585 check_one_size_helper(SIZE_MAX, size_mul, SIZE_MAX, 3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 586 check_one_size_helper(SIZE_MAX, size_mul, SIZE_MAX, -3);
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 587
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 588 var = 4;
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 589 check_one_size_helper(9, size_add, var++, 5);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 590 check_one_size_helper(9, size_add, 4, var++);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 591 check_one_size_helper(9, size_add, 9, 0);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 592 check_one_size_helper(9, size_add, 0, 9);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 593 check_one_size_helper(5, size_add, 2, 3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 594 check_one_size_helper(SIZE_MAX, size_add, SIZE_MAX, 1);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 595 check_one_size_helper(SIZE_MAX, size_add, SIZE_MAX, 3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 596 check_one_size_helper(SIZE_MAX, size_add, SIZE_MAX, -3);
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 597
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 598 var = 4;
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 599 check_one_size_helper(1, size_sub, var--, 3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 600 check_one_size_helper(1, size_sub, 4, var--);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 601 check_one_size_helper(1, size_sub, 3, 2);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 602 check_one_size_helper(9, size_sub, 9, 0);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 603 check_one_size_helper(SIZE_MAX, size_sub, 9, -3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 604 check_one_size_helper(SIZE_MAX, size_sub, 0, 9);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 605 check_one_size_helper(SIZE_MAX, size_sub, 2, 3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 606 check_one_size_helper(SIZE_MAX, size_sub, SIZE_MAX, 0);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 607 check_one_size_helper(SIZE_MAX, size_sub, SIZE_MAX, 10);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 608 check_one_size_helper(SIZE_MAX, size_sub, 0, SIZE_MAX);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 609 check_one_size_helper(SIZE_MAX, size_sub, 14, SIZE_MAX);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 610 check_one_size_helper(SIZE_MAX - 2, size_sub, SIZE_MAX - 1, 1);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 611 check_one_size_helper(SIZE_MAX - 4, size_sub, SIZE_MAX - 1, 3);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 612 check_one_size_helper(1, size_sub, SIZE_MAX - 1, -3);
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 613
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 614 var = 4;
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 615 check_one_size_helper(4 * sizeof(*obj->data),
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 616 flex_array_size, obj, data, var++);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 617 check_one_size_helper(5 * sizeof(*obj->data),
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 618 flex_array_size, obj, data, var++);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 619 check_one_size_helper(0, flex_array_size, obj, data, 0 + unconst);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 620 check_one_size_helper(sizeof(*obj->data),
230f6fa2c1db6a lib/test_overflow.c Kees Cook 2022-02-09 621 flex_array_size, obj, data, 1 + unconst);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 622 check_one_size_helper(7 * sizeof(*obj->data),
230f6fa2c1db6a lib/test_overflow.c Kees Cook 2022-02-09 623 flex_array_size, obj, data, 7 + unconst);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 624 check_one_size_helper(SIZE_MAX,
230f6fa2c1db6a lib/test_overflow.c Kees Cook 2022-02-09 625 flex_array_size, obj, data, -1 + unconst);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 626 check_one_size_helper(SIZE_MAX,
230f6fa2c1db6a lib/test_overflow.c Kees Cook 2022-02-09 627 flex_array_size, obj, data, SIZE_MAX - 4 + unconst);
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 628
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 629 var = 4;
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 630 check_one_size_helper(sizeof(*obj) + (4 * sizeof(*obj->data)),
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 631 struct_size, obj, data, var++);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 632 check_one_size_helper(sizeof(*obj) + (5 * sizeof(*obj->data)),
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 633 struct_size, obj, data, var++);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 634 check_one_size_helper(sizeof(*obj), struct_size, obj, data, 0 + unconst);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 635 check_one_size_helper(sizeof(*obj) + sizeof(*obj->data),
230f6fa2c1db6a lib/test_overflow.c Kees Cook 2022-02-09 636 struct_size, obj, data, 1 + unconst);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 637 check_one_size_helper(SIZE_MAX,
230f6fa2c1db6a lib/test_overflow.c Kees Cook 2022-02-09 638 struct_size, obj, data, -3 + unconst);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 639 check_one_size_helper(SIZE_MAX,
230f6fa2c1db6a lib/test_overflow.c Kees Cook 2022-02-09 640 struct_size, obj, data, SIZE_MAX - 3 + unconst);
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 641
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 642 kunit_info(test, "%d overflow size helper tests finished\n", count);
617f55e20743fc lib/overflow_kunit.c Kees Cook 2022-02-16 643 #undef check_one_size_helper
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 @644 }
e1be43d9b5d0d1 lib/test_overflow.c Kees Cook 2021-09-18 645

:::::: The code at line 644 was first introduced by commit
:::::: e1be43d9b5d0d1310dbd90185a8e5c7145dde40f overflow: Implement size_t saturating arithmetic helpers

:::::: TO: Kees Cook <[email protected]>
:::::: CC: Kees Cook <[email protected]>

--
0-DAY CI Kernel Test Service
https://01.org/lkp


2022-06-13 20:08:17

by Daniel Latypov

[permalink] [raw]
Subject: Re: lib/overflow_kunit.c:644:1: warning: the frame size of 2832 bytes is larger than 1024 bytes

On Sat, Jun 11, 2022 at 9:44 AM kernel test robot <[email protected]> wrote:
>
> Hi Kees,
>
> First bad commit (maybe != root cause):
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 0885eacdc81f920c3e0554d5615e69a66504a28d
> commit: 617f55e20743fc50c989b498f9dee289eb644cfd lib: overflow: Convert to Kunit
> date: 3 months ago
> config: powerpc-buildonly-randconfig-r006-20220611 (https://download.01.org/0day-ci/archive/20220612/[email protected]/config)
> compiler: powerpc-linux-gcc (GCC) 11.3.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=617f55e20743fc50c989b498f9dee289eb644cfd
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 617f55e20743fc50c989b498f9dee289eb644cfd
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <[email protected]>
>
> All warnings (new ones prefixed by >>):
>
> lib/overflow_kunit.c:191:19: warning: 's64_tests' defined but not used [-Wunused-const-variable=]
> 191 | DEFINE_TEST_ARRAY(s64) = {
> | ^~~
> lib/overflow_kunit.c:24:11: note: in definition of macro 'DEFINE_TEST_ARRAY'
> 24 | } t ## _tests[]
> | ^
> lib/overflow_kunit.c:94:19: warning: 'u64_tests' defined but not used [-Wunused-const-variable=]
> 94 | DEFINE_TEST_ARRAY(u64) = {
> | ^~~
> lib/overflow_kunit.c:24:11: note: in definition of macro 'DEFINE_TEST_ARRAY'
> 24 | } t ## _tests[]
> | ^
> lib/overflow_kunit.c: In function 'overflow_size_helpers_test':
> >> lib/overflow_kunit.c:644:1: warning: the frame size of 2832 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> 644 | }
> | ^
> lib/overflow_kunit.c: In function 'overflow_shift_test':
> lib/overflow_kunit.c:451:1: warning: the frame size of 7232 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> 451 | }
> | ^

I have an RFC series out to reduce the stack usage of KUNIT_EXPECT_*
even further, but they won't help enough here.
https://lore.kernel.org/linux-kselftest/[email protected]/

So If we want to try and "fix" this, I think the only answer would be
to split up the test funcs as appropriate.
But I don't really know if that's warranted to fix this warning here,
which largely indicates a compiler quality problem over a code quality
one.

Daniel

2022-06-15 19:15:42

by Kees Cook

[permalink] [raw]
Subject: Re: lib/overflow_kunit.c:644:1: warning: the frame size of 2832 bytes is larger than 1024 bytes

On Mon, Jun 13, 2022 at 10:55:02AM -0700, Daniel Latypov wrote:
> On Sat, Jun 11, 2022 at 9:44 AM kernel test robot <[email protected]> wrote:
> >
> > Hi Kees,
> >
> > First bad commit (maybe != root cause):
> >
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 0885eacdc81f920c3e0554d5615e69a66504a28d
> > commit: 617f55e20743fc50c989b498f9dee289eb644cfd lib: overflow: Convert to Kunit
> > date: 3 months ago
> > config: powerpc-buildonly-randconfig-r006-20220611 (https://download.01.org/0day-ci/archive/20220612/[email protected]/config)
> > compiler: powerpc-linux-gcc (GCC) 11.3.0
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=617f55e20743fc50c989b498f9dee289eb644cfd
> > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > git fetch --no-tags linus master
> > git checkout 617f55e20743fc50c989b498f9dee289eb644cfd
> > # save the config file
> > mkdir build_dir && cp config build_dir/.config
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash
> >
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <[email protected]>
> >
> > All warnings (new ones prefixed by >>):
> >
> > lib/overflow_kunit.c:191:19: warning: 's64_tests' defined but not used [-Wunused-const-variable=]
> > 191 | DEFINE_TEST_ARRAY(s64) = {
> > | ^~~
> > lib/overflow_kunit.c:24:11: note: in definition of macro 'DEFINE_TEST_ARRAY'
> > 24 | } t ## _tests[]
> > | ^
> > lib/overflow_kunit.c:94:19: warning: 'u64_tests' defined but not used [-Wunused-const-variable=]
> > 94 | DEFINE_TEST_ARRAY(u64) = {
> > | ^~~
> > lib/overflow_kunit.c:24:11: note: in definition of macro 'DEFINE_TEST_ARRAY'
> > 24 | } t ## _tests[]
> > | ^
> > lib/overflow_kunit.c: In function 'overflow_size_helpers_test':
> > >> lib/overflow_kunit.c:644:1: warning: the frame size of 2832 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> > 644 | }
> > | ^
> > lib/overflow_kunit.c: In function 'overflow_shift_test':
> > lib/overflow_kunit.c:451:1: warning: the frame size of 7232 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> > 451 | }
> > | ^
>
> I have an RFC series out to reduce the stack usage of KUNIT_EXPECT_*
> even further, but they won't help enough here.
> https://lore.kernel.org/linux-kselftest/[email protected]/
>
> So If we want to try and "fix" this, I think the only answer would be
> to split up the test funcs as appropriate.
> But I don't really know if that's warranted to fix this warning here,
> which largely indicates a compiler quality problem over a code quality
> one.

I'm happy to review patches, but it does seem more like a compiler
issue. Hmmm.

--
Kees Cook