From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0B3BC3857835; Fri, 17 Feb 2023 14:40:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B3BC3857835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676644800; bh=BMU4QS35d7ol3ZqPbCl/PmT+Re2+83dp5Tv50o9Nv50=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xE2pVMiusF2snPwX0+poaQYMo6f0usjVsC/hWhQSFVnnOKj50H3bP89ZRs5wuaQbU AChegQHSGTYYu4dN+BdwjYsQUqsi80+38JMd73fmeS3IV/zCA5iiWSI9NEAlcMKvRo UQsLcncywaNwOYvQNtI0BxIDj8n3y35nNWTzJlIE= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/108834] LTO: ltrans temporary file is used as module name in ASAN Date: Fri, 17 Feb 2023 14:39:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108834 --- Comment #3 from Jakub Jelinek --- This is in the arrays passed to __asan_{,un}register_globals. Now, we emit /* Build struct __asan_global { const void *__beg; uptr __size; uptr __size_with_redzone; const void *__name; const void *__module_name; uptr __has_dynamic_init; __asan_global_source_location *__location; char *__odr_indicator; } type. */ so __module_name should be the filename the global appeared in (so for LTO DECL_NAME of corresponding TRANSLATION_UNIT_DECL?), while __location has mo= re details. But, looking on the libsanitizer side, it has // This structure describes an instrumented global variable. struct __asan_global { uptr beg; // The address of the global. uptr size; // The original size of the global. uptr size_with_redzone; // The size with the redzone. const char *name; // Name as a C string. const char *module_name; // Module name as a C string. This pointer is a // unique identifier of a module. uptr has_dynamic_init; // Non-zero if the global has dynamic initiali= zer. uptr windows_padding; // TODO: Figure out how to remove this padding // that's simply here to make the MSVC increme= ntal // linker happy... uptr odr_indicator; // The address of the ODR indicator symbol. }; so I wonder if emitting the locations isn't just wasted .rodata if libasan considers it being a windows_padding. In GCC 12 libsanitizer it was still location: --- gcc-12/libsanitizer/asan/asan_interface_internal.h 2022-04-28 15:56:17.730640966 +0200 +++ gcc/libsanitizer/asan/asan_interface_internal.h 2022-11-15 22:57:18.450207911 +0100 @@ -53,8 +53,9 @@ extern "C" { const char *module_name; // Module name as a C string. This pointer is= a // unique identifier of a module. uptr has_dynamic_init; // Non-zero if the global has dynamic initializer. - __asan_global_source_location *location; // Source location of a glob= al, - // or NULL if it is unknown. + uptr windows_padding; // TODO: Figure out how to remove this padding + // that's simply here to make the MSVC incremental + // linker happy... uptr odr_indicator; // The address of the ODR indicator symbol. }; So I wonder what kind of mess upstream introduced again.=