[f2fs:dev-test 48/48] fs/f2fs/super.c:3303:12: warning: stack frame size of 2064 bytes in function 'f2fs_fill_super'

3 views
Skip to first unread message

kernel test robot

unread,
Jun 5, 2020, 5:16:12 AM6/5/20
to Eric Biggers, kbuil...@lists.01.org, clang-bu...@googlegroups.com, linux-f2...@lists.sourceforge.net, Jaegeuk Kim
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
head: adf3d3a53cf13d0998c699ba43d8582c875179e3
commit: adf3d3a53cf13d0998c699ba43d8582c875179e3 [48/48] f2fs: don't return vmalloc() memory from f2fs_kmalloc()
config: powerpc64-randconfig-r011-20200605 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project ac47588bc4ff5927a01ed6fcd269ce86aba52a7c)
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
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
git checkout adf3d3a53cf13d0998c699ba43d8582c875179e3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:605:
arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:602:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; ^~~~~~~~~~~~~~
<scratch space>:50:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:543:56: note: expanded from macro '__do_insw'
#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/f2fs/super.c:12:
In file included from include/linux/buffer_head.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:9:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:605:
arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:602:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; ^~~~~~~~~~~~~~
<scratch space>:52:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:544:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/f2fs/super.c:12:
In file included from include/linux/buffer_head.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:9:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:605:
arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:602:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; ^~~~~~~~~~~~~~
<scratch space>:54:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:545:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/f2fs/super.c:12:
In file included from include/linux/buffer_head.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:9:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:605:
arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:602:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; ^~~~~~~~~~~~~~
<scratch space>:56:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:546:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/f2fs/super.c:12:
In file included from include/linux/buffer_head.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:9:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:605:
arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:602:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; ^~~~~~~~~~~~~~
<scratch space>:58:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:547:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
>> fs/f2fs/super.c:3303:12: warning: stack frame size of 2064 bytes in function 'f2fs_fill_super' [-Wframe-larger-than=]
static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
^
13 warnings generated.

vim +/f2fs_fill_super +3303 fs/f2fs/super.c

84b89e5d943d8d Jaegeuk Kim 2018-02-22 3302
aff063e266cbf4 Jaegeuk Kim 2012-11-02 @3303 static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3304 {
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3305 struct f2fs_sb_info *sbi;
da554e48caab95 hujianyang 2015-05-21 3306 struct f2fs_super_block *raw_super;
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3307 struct inode *root;
99e3e858a486cc Sheng Yong 2016-05-11 3308 int err;
aa2c8c43e4a5c2 Chao Yu 2019-02-19 3309 bool skip_recovery = false, need_fsck = false;
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3310 char *options = NULL;
e8240f656d4d5d Chao Yu 2015-12-15 3311 int recovery, i, valid_super_block;
8f1dbbbbdfe9ba Shuoran Liu 2016-01-27 3312 struct curseg_info *seg_i;
aa2c8c43e4a5c2 Chao Yu 2019-02-19 3313 int retry_cnt = 1;
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3314
ed2e621a95d704 Jaegeuk Kim 2014-08-08 3315 try_onemore:
da554e48caab95 hujianyang 2015-05-21 3316 err = -EINVAL;
da554e48caab95 hujianyang 2015-05-21 3317 raw_super = NULL;
e8240f656d4d5d Chao Yu 2015-12-15 3318 valid_super_block = -1;
da554e48caab95 hujianyang 2015-05-21 3319 recovery = 0;
da554e48caab95 hujianyang 2015-05-21 3320
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3321 /* allocate memory for f2fs-specific super block info */
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3322 sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL);
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3323 if (!sbi)
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3324 return -ENOMEM;
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3325
df728b0f6954c3 Jaegeuk Kim 2016-03-23 3326 sbi->sb = sb;
df728b0f6954c3 Jaegeuk Kim 2016-03-23 3327
43b6573bac95d7 Keith Mok 2016-03-02 3328 /* Load the checksum driver */
43b6573bac95d7 Keith Mok 2016-03-02 3329 sbi->s_chksum_driver = crypto_alloc_shash("crc32", 0, 0);
43b6573bac95d7 Keith Mok 2016-03-02 3330 if (IS_ERR(sbi->s_chksum_driver)) {
dcbb4c10e6d969 Joe Perches 2019-06-18 3331 f2fs_err(sbi, "Cannot load crc32 driver.");
43b6573bac95d7 Keith Mok 2016-03-02 3332 err = PTR_ERR(sbi->s_chksum_driver);
43b6573bac95d7 Keith Mok 2016-03-02 3333 sbi->s_chksum_driver = NULL;
43b6573bac95d7 Keith Mok 2016-03-02 3334 goto free_sbi;
43b6573bac95d7 Keith Mok 2016-03-02 3335 }
43b6573bac95d7 Keith Mok 2016-03-02 3336
ff9234ad4e9747 Namjae Jeon 2013-01-12 3337 /* set a block size */
6bacf52fb58aeb Jaegeuk Kim 2013-12-06 3338 if (unlikely(!sb_set_blocksize(sb, F2FS_BLKSIZE))) {
dcbb4c10e6d969 Joe Perches 2019-06-18 3339 f2fs_err(sbi, "unable to set blocksize");
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3340 goto free_sbi;
a07ef784356cf9 Namjae Jeon 2012-12-30 3341 }
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3342
df728b0f6954c3 Jaegeuk Kim 2016-03-23 3343 err = read_raw_super_block(sbi, &raw_super, &valid_super_block,
e8240f656d4d5d Chao Yu 2015-12-15 3344 &recovery);
c0d39e65ba3243 Namjae Jeon 2013-03-17 3345 if (err)
9076a75f8e0f23 Gu Zheng 2013-10-14 3346 goto free_sbi;
9076a75f8e0f23 Gu Zheng 2013-10-14 3347
5fb08372a68936 Gu Zheng 2013-06-07 3348 sb->s_fs_info = sbi;
52763a4b7a2112 Jaegeuk Kim 2016-06-13 3349 sbi->raw_super = raw_super;
52763a4b7a2112 Jaegeuk Kim 2016-06-13 3350
704956ecf5bcdc Chao Yu 2017-07-31 3351 /* precompute checksum seed for metadata */
7beb01f74415c5 Chao Yu 2018-10-24 3352 if (f2fs_sb_has_inode_chksum(sbi))
704956ecf5bcdc Chao Yu 2017-07-31 3353 sbi->s_chksum_seed = f2fs_chksum(sbi, ~0, raw_super->uuid,
704956ecf5bcdc Chao Yu 2017-07-31 3354 sizeof(raw_super->uuid));
704956ecf5bcdc Chao Yu 2017-07-31 3355
d1b959c8770260 Damien Le Moal 2016-10-28 3356 /*
d1b959c8770260 Damien Le Moal 2016-10-28 3357 * The BLKZONED feature indicates that the drive was formatted with
d1b959c8770260 Damien Le Moal 2016-10-28 3358 * zone alignment optimization. This is optional for host-aware
d1b959c8770260 Damien Le Moal 2016-10-28 3359 * devices, but mandatory for host-managed zoned block devices.
d1b959c8770260 Damien Le Moal 2016-10-28 3360 */
d1b959c8770260 Damien Le Moal 2016-10-28 3361 #ifndef CONFIG_BLK_DEV_ZONED
7beb01f74415c5 Chao Yu 2018-10-24 3362 if (f2fs_sb_has_blkzoned(sbi)) {
dcbb4c10e6d969 Joe Perches 2019-06-18 3363 f2fs_err(sbi, "Zoned block device support is not enabled");
1727f317219bfc Chao Yu 2017-06-12 3364 err = -EOPNOTSUPP;
d1b959c8770260 Damien Le Moal 2016-10-28 3365 goto free_sb_buf;
d1b959c8770260 Damien Le Moal 2016-10-28 3366 }
d1b959c8770260 Damien Le Moal 2016-10-28 3367 #endif
498c5e9fcd10c8 Yunlei He 2015-05-07 3368 default_options(sbi);
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3369 /* parse mount options */
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3370 options = kstrdup((const char *)data, GFP_KERNEL);
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3371 if (data && !options) {
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3372 err = -ENOMEM;
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3373 goto free_sb_buf;
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3374 }
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3375
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3376 err = parse_options(sb, options);
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3377 if (err)
dabc4a5c60f796 Jaegeuk Kim 2015-01-23 3378 goto free_options;
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3379
e0afc4d6d0d3e7 Chao Yu 2015-12-31 3380 sbi->max_file_blocks = max_file_blocks();
e0afc4d6d0d3e7 Chao Yu 2015-12-31 3381 sb->s_maxbytes = sbi->max_file_blocks <<
e0afc4d6d0d3e7 Chao Yu 2015-12-31 3382 le32_to_cpu(raw_super->log_blocksize);
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3383 sb->s_max_links = F2FS_LINK_MAX;
aff063e266cbf4 Jaegeuk Kim 2012-11-02 3384
5aba54302a46fd Daniel Rosenberg 2019-07-23 3385 err = f2fs_setup_casefold(sbi);
5aba54302a46fd Daniel Rosenberg 2019-07-23 3386 if (err)
5aba54302a46fd Daniel Rosenberg 2019-07-23 3387 goto free_options;
5aba54302a46fd Daniel Rosenberg 2019-07-23 3388

:::::: The code at line 3303 was first introduced by commit
:::::: aff063e266cbf4754021d8e5d16ee418560906fd f2fs: add super block operations

:::::: TO: Jaegeuk Kim <jaege...@samsung.com>
:::::: CC: Jaegeuk Kim <jaege...@samsung.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuil...@lists.01.org
.config.gz

Jaegeuk Kim

unread,
Jun 5, 2020, 10:55:47 AM6/5/20
to kernel test robot, Eric Biggers, kbuil...@lists.01.org, clang-bu...@googlegroups.com, linux-f2...@lists.sourceforge.net
Eric,

Could you PTAL?

Eric Biggers

unread,
Jun 5, 2020, 12:08:32 PM6/5/20
to Jaegeuk Kim, kernel test robot, clang-bu...@googlegroups.com, kbuil...@lists.01.org, linux-f2...@lists.sourceforge.net
On Fri, Jun 05, 2020 at 07:55:46AM -0700, Jaegeuk Kim wrote:
> Eric,
>
> Could you PTAL?
>
> On 06/05, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
> > head: adf3d3a53cf13d0998c699ba43d8582c875179e3
> > commit: adf3d3a53cf13d0998c699ba43d8582c875179e3 [48/48] f2fs: don't return vmalloc() memory from f2fs_kmalloc()
> > config: powerpc64-randconfig-r011-20200605 (attached as .config)
> > compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project ac47588bc4ff5927a01ed6fcd269ce86aba52a7c)
> > 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
> > # install powerpc64 cross compiling tool for clang build
> > # apt-get install binutils-powerpc64-linux-gnu
> > git checkout adf3d3a53cf13d0998c699ba43d8582c875179e3
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <l...@intel.com>

I don't know what's causing this. It doesn't look at all related to my commit,
and I don't see what's using so much stack in f2fs_fill_super().

@kernel test robot: the directions given above don't actually work.
First I got an error due to powerpc64-linux-gnu-elfedit not existing.
So I had to build binutils for powerpc64 myself.

Then I still got an error:

make: *** No rule to make target 'arch/powerpc64/Makefile'. Stop.

- Eric

Nick Desaulniers

unread,
Jun 5, 2020, 12:45:56 PM6/5/20
to Eric Biggers, Jaegeuk Kim, kernel test robot, clang-built-linux, kbuil...@lists.01.org, linux-f2...@lists.sourceforge.net
If you have the config, then
$ ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu- make CC=clang -j71
If you recompile with CONFIG_DEBUG_INFO, you can get the stack frame
information. I wrote a tool to parse this for these cryptic warnings.
https://github.com/ClangBuiltLinux/frame-larger-than

--
Thanks,
~Nick Desaulniers

Eric Biggers

unread,
Jun 5, 2020, 3:34:02 PM6/5/20
to Nick Desaulniers, Jaegeuk Kim, kernel test robot, clang-built-linux, kbuil...@lists.01.org, linux-f2...@lists.sourceforge.net
I can build the file and get the warning now, but the frame_larger_than.py
script doesn't work:

$ ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu- make CC=clang fs/f2fs/super.o
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
CC [M] fs/f2fs/super.o
fs/f2fs/super.c:3303:12: warning: stack frame size of 2064 bytes in function 'f2fs_fill_super' [-Wframe-larger-than=]
static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
^
1 warning generated.

$ python3 ~/src/frame-larger-than/frame_larger_than.py fs/f2fs/super.o f2fs_fill_super
failed to parse elf: Unsupported relocation type: 1

Nick Desaulniers

unread,
Jun 5, 2020, 3:43:10 PM6/5/20
to Eric Biggers, Jaegeuk Kim, kernel test robot, clang-built-linux, kbuil...@lists.01.org, linux-f2...@lists.sourceforge.net
Looks like the python library I'm using to parse the DWARF debug info
doesn't understand some ppc64 specific relocation kind, and is
throwing an ELFError. Let me report it upstream.

The hard part for these is inlining; it can be hard to tell which
child has a large local allocation when looking at the warning about
the parent.

Then again, my script is just nicer output than `llvm-dwarfdump foo.o`
or `readelf --debug-dump=info foo.o` for this specific issue.

--
Thanks,
~Nick Desaulniers

Eric Biggers

unread,
Jun 5, 2020, 3:57:17 PM6/5/20
to Nick Desaulniers, Jaegeuk Kim, kernel test robot, clang-built-linux, kbuil...@lists.01.org, linux-f2...@lists.sourceforge.net
I did confirm that my commit "f2fs: don't return vmalloc() memory from
f2fs_kmalloc()" actually caused this, in particular the following part:

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a71da699cb2d55..f3c15116954218 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3033,7 +3033,7 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
if (nr_sectors & (bdev_zone_sectors(bdev) - 1))
FDEV(devi).nr_blkz++;

- FDEV(devi).blkz_seq = f2fs_kzalloc(sbi,
+ FDEV(devi).blkz_seq = f2fs_kvzalloc(sbi,
BITS_TO_LONGS(FDEV(devi).nr_blkz)
* sizeof(unsigned long),
GFP_KERNEL);

This is inlined as:

f2fs_fill_super()
=> f2fs_scan_devices()
=> init_blkz_info()
=> f2fs_kvzalloc()

Somehow this change increased the frame size of f2fs_fill_super() from 1984 to
2064 bytes. That exceeds the 2048-byte limit, triggering the warning.

So, f2fs_fill_super() was very close to the limit already. I'm not sure why; I
don't see any huge stack allocations in it or in static functions it calls.
Maybe there is a kconfig option that is increasing the stack usage?

If I add noinline_for_stack to f2fs_scan_devices(), the frame drops to 1744
bytes. Or if I add noinline_for_stack to read_raw_super_block(), the frame
drops to 1776 bytes. We could do either (or both) of those to avoid the
warning. But we'd still wouldn't be that far from this 2048-byte "limit".

- Eric

Nick Desaulniers

unread,
Jun 5, 2020, 4:03:06 PM6/5/20
to Eric Biggers, Jaegeuk Kim, kernel test robot, clang-built-linux, kbuil...@lists.01.org, linux-f2...@lists.sourceforge.net
Right, so my script would have printed out the list of all local
variables in f2fs_fill_super() and their sizes. With that information
handy, we could assess if there were any smoking guns of clearly
incorrect large stack allocations vs death by a thousand cuts. Your
change may not have added a new large local allocation, simply tipped
the scale or changed inlining decisions. They may be other local
variables in this call chain that we should reassess allocation
strategy; ie. dynamic or static rather than local, to avoid the
potential for exhausting kernel stack.
--
Thanks,
~Nick Desaulniers

Eric Biggers

unread,
Jun 5, 2020, 4:33:43 PM6/5/20
to Nick Desaulniers, Jaegeuk Kim, kernel test robot, clang-built-linux, kbuil...@lists.01.org, linux-f2...@lists.sourceforge.net
On Fri, Jun 05, 2020 at 01:02:54PM -0700, Nick Desaulniers wrote:
> Right, so my script would have printed out the list of all local
> variables in f2fs_fill_super() and their sizes. With that information
> handy, we could assess if there were any smoking guns of clearly
> incorrect large stack allocations vs death by a thousand cuts. Your
> change may not have added a new large local allocation, simply tipped
> the scale or changed inlining decisions. They may be other local
> variables in this call chain that we should reassess allocation
> strategy; ie. dynamic or static rather than local, to avoid the
> potential for exhausting kernel stack.

For comparison, I also tried building for x86_64 (with gcc 10.1.0) and running
your script. But it crashed:

f2fs_fill_super:
8 struct f2fs_sb_info* sbi
8 struct f2fs_super_block* raw_super
8 struct inode* root
4 int err
Unsupported type info for bool, implement me!
DIE DW_TAG_typedef, size=12, has_children=False
|DW_AT_name : AttributeValue(name='DW_AT_name', form='DW_FORM_strp', value=b'bool', raw_value=2068, offset=691)
|DW_AT_decl_file : AttributeValue(name='DW_AT_decl_file', form='DW_FORM_data1', value=36, raw_value=36, offset=695)
|DW_AT_decl_line : AttributeValue(name='DW_AT_decl_line', form='DW_FORM_data1', value=30, raw_value=30, offset=696)
|DW_AT_decl_column : AttributeValue(name='DW_AT_decl_column', form='DW_FORM_data1', value=17, raw_value=17, offset=697)
|DW_AT_type : AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=702, raw_value=702, offset=698)

0 None skip_recovery
Unsupported type info for bool, implement me!
DIE DW_TAG_typedef, size=12, has_children=False
|DW_AT_name : AttributeValue(name='DW_AT_name', form='DW_FORM_strp', value=b'bool', raw_value=2068, offset=691)
|DW_AT_decl_file : AttributeValue(name='DW_AT_decl_file', form='DW_FORM_data1', value=36, raw_value=36, offset=695)
|DW_AT_decl_line : AttributeValue(name='DW_AT_decl_line', form='DW_FORM_data1', value=30, raw_value=30, offset=696)
|DW_AT_decl_column : AttributeValue(name='DW_AT_decl_column', form='DW_FORM_data1', value=17, raw_value=17, offset=697)
|DW_AT_type : AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=702, raw_value=702, offset=698)

0 None need_fsck
8 char* options
4 int recovery
4 int i
4 int valid_super_block
8 struct curseg_info* seg_i
4 int retry_cnt
0 struct lock_class_key __key
0 struct lock_class_key __key
0 struct lock_class_key __key
0 struct lock_class_key __key
0 struct lock_class_key __key
4 int n
4 int j
0 struct lock_class_key __key
0 struct lock_class_key __key
array_size:
Unsupported type info for size_t, implement me!
DIE DW_TAG_typedef, size=12, has_children=False
|DW_AT_name : AttributeValue(name='DW_AT_name', form='DW_FORM_strp', value=b'size_t', raw_value=1942, offset=746)
|DW_AT_decl_file : AttributeValue(name='DW_AT_decl_file', form='DW_FORM_data1', value=36, raw_value=36, offset=750)
|DW_AT_decl_line : AttributeValue(name='DW_AT_decl_line', form='DW_FORM_data1', value=55, raw_value=55, offset=751)
|DW_AT_decl_column : AttributeValue(name='DW_AT_decl_column', form='DW_FORM_data1', value=26, raw_value=26, offset=752)
|DW_AT_type : AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=441, raw_value=441, offset=753)

0 None bytes
Unsupported type info for size_t, implement me!
DIE DW_TAG_typedef, size=12, has_children=False
|DW_AT_name : AttributeValue(name='DW_AT_name', form='DW_FORM_strp', value=b'size_t', raw_value=1942, offset=746)
|DW_AT_decl_file : AttributeValue(name='DW_AT_decl_file', form='DW_FORM_data1', value=36, raw_value=36, offset=750)
|DW_AT_decl_line : AttributeValue(name='DW_AT_decl_line', form='DW_FORM_data1', value=55, raw_value=55, offset=751)
|DW_AT_decl_column : AttributeValue(name='DW_AT_decl_column', form='DW_FORM_data1', value=26, raw_value=26, offset=752)
|DW_AT_type : AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=441, raw_value=441, offset=753)

0 None __a
Unsupported type info for size_t, implement me!
DIE DW_TAG_typedef, size=12, has_children=False
|DW_AT_name : AttributeValue(name='DW_AT_name', form='DW_FORM_strp', value=b'size_t', raw_value=1942, offset=746)
|DW_AT_decl_file : AttributeValue(name='DW_AT_decl_file', form='DW_FORM_data1', value=36, raw_value=36, offset=750)
|DW_AT_decl_line : AttributeValue(name='DW_AT_decl_line', form='DW_FORM_data1', value=55, raw_value=55, offset=751)
|DW_AT_decl_column : AttributeValue(name='DW_AT_decl_column', form='DW_FORM_data1', value=26, raw_value=26, offset=752)
|DW_AT_type : AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=441, raw_value=441, offset=753)

0 None __b
Unsupported type info for size_t, implement me!
DIE DW_TAG_typedef, size=12, has_children=False
|DW_AT_name : AttributeValue(name='DW_AT_name', form='DW_FORM_strp', value=b'size_t', raw_value=1942, offset=746)
|DW_AT_decl_file : AttributeValue(name='DW_AT_decl_file', form='DW_FORM_data1', value=36, raw_value=36, offset=750)
|DW_AT_decl_line : AttributeValue(name='DW_AT_decl_line', form='DW_FORM_data1', value=55, raw_value=55, offset=751)
|DW_AT_decl_column : AttributeValue(name='DW_AT_decl_column', form='DW_FORM_data1', value=26, raw_value=26, offset=752)
|DW_AT_type : AttributeValue(name='DW_AT_type', form='DW_FORM_ref4', value=441, raw_value=441, offset=753)

Traceback (most recent call last):
File "/home/e/src/frame-larger-than/frame_larger_than.py", line 147, in <module>
parse_file(elffile.get_dwarf_info(), sys.argv[2])
File "/home/e/src/frame-larger-than/frame_larger_than.py", line 129, in parse_file
parse_file(dwarf_info, get_name(ti))
File "/home/e/src/frame-larger-than/frame_larger_than.py", line 125, in parse_file
print_var(dwarf_info, DIE)
File "/home/e/src/frame-larger-than/frame_larger_than.py", line 111, in print_var
type_string = get_type_string(dwarf_info, type_info)
File "/home/e/src/frame-larger-than/frame_larger_than.py", line 85, in get_type_string
return get_type_string(dwarf_info, pointed_to_type) + '*'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Nick Desaulniers

unread,
Jun 5, 2020, 5:28:56 PM6/5/20
to Eric Biggers, Jaegeuk Kim, kernel test robot, clang-built-linux, kbuil...@lists.01.org, linux-f2...@lists.sourceforge.net
Thanks for the report, I've added support for parsing DW_TAG_typedef
tags, and...
looks like broken debug info was generated, a DW_TAG_const_type tag
with no base type. As if you typed `const x = 10;` in C where `x` was
not a typedef, but an identifier. I added a workaround, and should
investigate and report to GCC that broken debug info was generated.
If you pull the latest version and rerun it shouldn't crash for that
input.

--
Thanks,
~Nick Desaulniers
Reply all
Reply to author
Forward
0 new messages