This is an archive of the discontinued LLVM Phabricator instance.

Fix sanitizer-common build with glibc 2.31
ClosedPublic

Authored by jakubjelinek on Nov 25 2019, 2:25 AM.

Details

Summary

As mentioned in D69104, glibc changed ABI recently with the 2f959dfe change.
D69104 dealt with just 32-bit ARM, but that is just one of the many affected architectures.
E.g. x86_64, i?86, riscv64, sparc 32-bit, s390 31-bit are affected too (and various others).

This patch instead of adding a long list of further architectures that wouldn't be checked ever next to arm 32-bit changes the structures to match the 2.31 layout and performs the checking on Linux for ipc_perm mode position/size only on non-Linux or on Linux with glibc 2.31 or later. I think this matches what is done for aarch64 already.
If needed, we could list architectures that haven't changed ABI (e.g. powerpc), so that they would be checked even with older glibcs. AFAIK sanitizers don't actually use ipc_perm.mode and
so all they care about is the size and alignment of the whole structure.

Note, s390 31-bit and arm 32-bit big-endian changed ABI even further, there will now be shmctl with old symbol version and shmctl@@GLIBC_2.31 which will be incompatible. I'm afraid this isn't really solvable unless the sanitizer libraries are symbol versioned and use matching symbol versions to glibc symbols for stuff they intercept, plus use dlvsym.
This patch doesn't try to address that.

Diff Detail

Event Timeline

jakubjelinek created this revision.Nov 25 2019, 2:25 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 25 2019, 2:25 AM
Herald added subscribers: llvm-commits, Restricted Project, steven.zhang and 6 others. · View Herald Transcript
eugenis accepted this revision.Nov 25 2019, 1:32 PM

LGTM

This revision is now accepted and ready to land.Nov 25 2019, 1:32 PM

Can somebody please commit it? I don't have access to llvm repo. Thanks.

This revision was automatically updated to reflect the committed changes.