[clang] [ASAN] Adjust asan instrumented GlobalVariable size to not include redzone (PR #66666)

Mitch Phillips via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 05:11:41 PDT 2023


hctim wrote:

My gut feeling is that it's a really bad idea to have a global variable whose symtab size differs from the underlying GV size. So I tested against lld, gold, and ld, and they all seem to end up with `int`-typed GVs having a filesize of 32 bytes and an ELF `st_size` of 4 bytes, and the runtime seems okay, but I think this breaks ELF rules:

https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-79797/index.html#:~:text=Symbol%20Values%22.-,st_size,-Many%20symbols%20have

> st_size: Many symbols have associated sizes. For example, a data object's size is the number of bytes contained in the object. This member holds 0 if the symbol has no size or an unknown size.

I suspect this could break relinkers and various other things.

It doesn't seem clear to me *why* amdgpu has problems with copying the extra redzone padding. We may also actually use the redzone for metadata and would expect that it would be consistent.

https://github.com/llvm/llvm-project/pull/66666


More information about the cfe-commits mailing list