[Bug runtime/31699] UBSAN errors for systemtap map functions with Fedora Rawhide and Fedora 39 6.8.8 kernels

wcohen at redhat dot com sourceware-bugzilla@sourceware.org
Fri May 3 23:59:10 GMT 2024


https://sourceware.org/bugzilla/show_bug.cgi?id=31699

--- Comment #1 from William Cohen <wcohen at redhat dot com> ---
The variable sized structs are handled in the kernel is by using a
__counted_by() attribute to indicate which member of describes the variable
sized array at the end of the struct:

https://elixir.bootlin.com/linux/v6.9-rc6/source/include/linux/compiler_attributes.h#L105

#if __has_attribute(__counted_by__)
# define __counted_by(member)           __attribute__((__counted_by__(member)))
#else
# define __counted_by(member)
#endif

And example use
https://elixir.bootlin.com/linux/v6.9-rc6/source/arch/x86/events/rapl.c#L118

struct rapl_pmus {
        struct pmu              pmu;
        unsigned int            maxdie;
        struct rapl_pmu         *pmus[] __counted_by(maxdie);
};

For systemtap it looks like will need to the same for MAP (struct map_root).

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Systemtap mailing list