public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-108834-4-MEZ5L8x5DK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108834-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108834

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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 more
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 initializer.
    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 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 global,
-                                              // 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.

  parent reply	other threads:[~2023-02-17 14:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 11:23 [Bug sanitizer/108834] New: " marxin at gcc dot gnu.org
2023-02-17 11:24 ` [Bug sanitizer/108834] " marxin at gcc dot gnu.org
2023-02-17 11:48 ` rguenth at gcc dot gnu.org
2023-02-17 13:32 ` marxin at gcc dot gnu.org
2023-02-17 14:39 ` jakub at gcc dot gnu.org [this message]
2023-02-17 14:43 ` jakub at gcc dot gnu.org
2023-02-17 14:59 ` marxin at gcc dot gnu.org
2023-02-20 13:59 ` marxin at gcc dot gnu.org
2023-02-20 15:40 ` marxin at gcc dot gnu.org
2023-02-20 15:44 ` jakub at gcc dot gnu.org
2023-02-20 16:03 ` marxin at gcc dot gnu.org
2023-02-20 20:10 ` marxin at gcc dot gnu.org
2023-02-24 15:23 ` cvs-commit at gcc dot gnu.org
2023-02-24 15:24 ` marxin at gcc dot gnu.org
2023-02-27  8:32 ` cvs-commit at gcc dot gnu.org
2023-02-27  8:32 ` marxin at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108834-4-MEZ5L8x5DK@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).