On Fri, Jun 5, 2020 at 1:33 PM Eric Biggers <[email protected]> wrote:
>
> 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)

Thanks for the report, I've added support for parsing DW_TAG_typedef
tags, and...

>
>         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'
>

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


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to