https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105614
--- Comment #11 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- > Removing my "fix" resolves the issue for GCC 12 but I suspect something like > the suggestion from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105614#c7 > might resolve the issue properly. I don't think so. We have: # define POST_WRITE(p, s) COMMON_SYSCALL_POST_WRITE_RANGE(p, s) and the description of COMMON_SYSCALL_POST_WRITE_RANGE is: // COMMON_SYSCALL_POST_WRITE_RANGE // Called in posthook for regions that were written to by the kernel // and are now initialized. and, libsanitizer does *not* intercept syscalls, but intercepts libc calls. So the size value is used by determine if the *libc function call* will overwrite the buffer, and the size from glibc header shall be used, not the kernel header. The name "struct_kernel_stat_sz" is just misleading, should be "struct_stat_sz" or "struct_libc_stat_sz".