[llvm] [ASAN] Add "sanitized_padded_global" llvm ir attribute to identify sanitizer instrumented globals (PR #68865)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 00:26:42 PST 2023


MaskRay wrote:

(I will be out for about 2 weeks and my response time will be slow.)

Most object file formats don't have a symbol size field.
Although ELF introduced `st_size`, it's scarcely utilized.
Its primary use pertains to copy relocations, which are discouraged and gradually being phased out.
The other, albeit minor, usage involves symbolization, where identifying whether `st_size` is zero can occasionally be helpful.

Consequently, I feel a bit nervous seeing a substantial reliance on `st_size`.
I wonder whether you can avoid relying on this symbol field. I am not familiar with AMDGPU, but for other architectures, symbols are completely optional and can be freely stripped if they are not used for dynamic linking.

Here is an idea using a separate metadata section:
```
.quad sym[0].hash; .long sym[0].size; .quad sym[1].hash; .long sym[1].size; 
```

The runtime can build a map correlating hashes to sizes, which can be used to answer variable size queries.


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


More information about the llvm-commits mailing list