This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Correct alignment of x32 __sanitizer_siginfo
ClosedPublic

Authored by hjl.tools on Apr 26 2023, 4:46 PM.

Details

Summary

Since alignment of x32 siginfo_t is 8 bytes, not 4 bytes, use u64 in
sanitizer_siginfo_pad to align x32 sanitizer_siginfo to 8 bytes.

Fixes https://github.com/llvm/llvm-project/issues/62394

Diff Detail

Event Timeline

hjl.tools created this revision.Apr 26 2023, 4:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2023, 4:46 PM
Herald added a subscriber: Enna1. · View Herald Transcript
hjl.tools requested review of this revision.Apr 26 2023, 4:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2023, 4:46 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
MaskRay accepted this revision.EditedApr 26 2023, 4:54 PM

Thanks for the patch. If I read sysdeps/unix/sysv/linux/bits/types/siginfo_t.h and sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h correct, the x32 ABI does use 8-byte alignment for siginfo_t.

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
587

If x32 is the canonical spelling

This revision is now accepted and ready to land.Apr 26 2023, 4:54 PM

D142117 changed(fixed?) the alignment to 4 for x86-32. Any idea why COMPILER_CHECK(alignof(siginfo_t) == alignof(__sanitizer_siginfo)); did not fail for x86-32?

hjl.tools added inline comments.Apr 26 2023, 6:01 PM
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
587

If x32 is the canonical spelling

Will update.

D142117 changed(fixed?) the alignment to 4 for x86-32. Any idea why COMPILER_CHECK(alignof(siginfo_t) == alignof(__sanitizer_siginfo)); did not fail for x86-32?

x86-32 siginfo_t is 4-byte aligned.

hjl.tools updated this revision to Diff 517414.Apr 26 2023, 6:04 PM
MaskRay accepted this revision.Apr 26 2023, 6:13 PM
This revision was landed with ongoing or failed builds.Apr 26 2023, 6:29 PM
This revision was automatically updated to reflect the committed changes.