[syzbot] kernel panic: corrupted stack end in openat

Arnd Bergmann arnd at arndb.de
Tue Mar 16 15:44:45 GMT 2021


On Tue, Mar 16, 2021 at 11:17 AM Dmitry Vyukov <dvyukov at google.com> wrote:
> On Tue, Mar 16, 2021 at 11:02 AM Arnd Bergmann <arnd at arndb.de> wrote:
> > > On Tue, Mar 16, 2021 at 8:18 AM syzbot
>
> > > > [<8073772c>] (integrity_kernel_read) from [<8073a904>] (ima_calc_file_hash_tfm+0x178/0x228 security/integrity/ima/ima_crypto.c:484)
> > > > [<8073a78c>] (ima_calc_file_hash_tfm) from [<8073ae2c>] (ima_calc_file_shash security/integrity/ima/ima_crypto.c:515 [inline])
> > > > [<8073a78c>] (ima_calc_file_hash_tfm) from [<8073ae2c>] (ima_calc_file_hash+0x124/0x8b8 security/integrity/ima/ima_crypto.c:572)
> >
> > ima_calc_file_hash_tfm() has a SHASH_DESC_ON_STACK(), which by itself can
> > use up 512 bytes, but KASAN sometimes triples this number. However, I see
> > you do not actually have KASAN enabled, so there is probably more to it.
>
> The compiler is gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Ok, building with Ubuntu 10.2.1-1ubuntu1 20201207 locally, that's
the closest I have installed, and I think the Debian and Ubuntu versions
are generally quite close in case of gcc since they are maintained by
the same packagers.

I see ima_calc_field_array_hash_tfm() shows up as one of the larger
stack users, but not alarmingly high:
../security/integrity/ima/ima_crypto.c: In function
‘ima_calc_field_array_hash_tfm’:
../security/integrity/ima/ima_crypto.c:624:1: warning: the frame size
of 664 bytes is larger than 600 bytes [-Wframe-larger-than=]
none of the other functions from the call chain have more than 600 bytes
in this combination of config/compiler/sourcetree.

In combination, I don't get to more than ~2300 bytes:

    [<818033d8>] (panic)
 52 [<8181f5b8>] (__schedule)
  0 [<81820430>] (preempt_schedule_common)
  0 [<818204dc>] (preempt_schedule)
  0 [<8048c7c0>] (kernel_init_free_pages)
148 [<804916ac>] (get_page_from_freelist
212 [<80493264>] (__alloc_pages_nodemask)
 44 [<8042f034>] (page_cache_ra_unbounded)
 36 [<8042f2c8>] (do_page_cache_ra)
 28 [<8042f418>] (ondemand_readahead)
  0 [<8042f894>] (page_cache_async_ra)
 68 [<80420ac8>] (filemap_get_pages)
120 [<80421110>] (filemap_read)
 36 [<804215f0>] (generic_file_read_iter)
  8 [<805ff430>] (ext4_file_read_iter)
 96 [<804da3cc>] (__kernel_read)
  8 [<8073772c>] (integrity_kernel_read)
412 [<8073a78c>] (ima_calc_file_hash_tfm)
164 [<8073ad08>] (ima_calc_file_hash)
106 [<8073bf84>] (ima_collect_measurement)
332 [<80738fec>] (process_measurement)
 24 [<8073979c>] (ima_file_check)
172 [<804ec66c>] (path_openat)
152 [<804ef670>] (do_filp_open)
 40 [<804d79c4>] (do_sys_openat2)

> Re printing FP, syzbot does not use custom patches:
> http://bit.do/syzbot#no-custom-patches
> But this does not seem to be syzbot-specific. It seems that any arm32
> stack overflow report will be unactionable, so I think it would be
> useful to include this into the mainline kernel to make overflow
> reports useful for everybody (and for syzbot as a side effect).

ok.

       Arnd



More information about the linux-arm-kernel mailing list