https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64742
Bug ID: 64742 Summary: Incorrect size of UBSan type descriptors Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: y.gribov at samsung dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, ryabinin.a.a at gmail dot com Created attachment 34542 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34542&action=edit Proposed patch UBSan uses incomplete type for all UBSan type descriptors: struct { short __typekind; short __typeinfo; char __typename[]; }; and this causes DECL_SIZE to return invalid (too short) values for generated globals. This later causes ASan to report invalid (again, too short) size to __asan_register_globals when UBSan is enabled together with ASan. This may not be a problem for userspace (because only libubsan accesses these descriptors and it's not sanitized) but causes false positives for kernel (https://lkml.org/lkml/2015/1/22/670). I attach a silly fix - if it looks more or less fine, I'll do the regtesting and fw to gcc-patches.