This is an archive of the discontinued LLVM Phabricator instance.

Improve fix for PR21476 (sanitizer_common not building on AArch64 with <=3.15 kernels)
AcceptedPublic

Authored by davidlt on Jan 6 2015, 7:25 AM.

Details

Reviewers
kcc
eugenis
Summary

A fix for PR21476 is currently in compiler-rt as r223925 / 429de66ac351c8b1e9a1bdd9da4d2fe78c14df05

The same issue is breaking GCC trunk on AArch64 systems. __kernel_old_uid_t is not intended to be used in native 64-bit tasks. It's only used by compat (32-bit) applications running on 64-bit kernel (multi-lib setup).

From Will Deacon (ARM):

AArch64 tasks only have 32-bit UIDs, so the getuid syscall (174) operates
only on 32-bit UIDs. I don't think glibc exposes a 16-bit wrapper, so I
can't see the old_uid_t being used for native applications.

There are a number of syscalls with "16" suffix. Those are only applicable for 32-bit tasks. In ARMv8 case, it must be running in AArch32 mode. AArch64 (LP64 and ILP32) tasks will not use them (confirmed by Andrew Pinski (Cavium)). ILP32 will use standard syscalls.

All syscalls with "16" suffix are available if kernel is configured with CONFIG_COMPAT, which then enables CONFIG_HAVE_UID16.

To summarize, only 32-bit sanitizer needs to have those as 64-bit tasks don't use them.

I only tested it with GCC trunk on 3.12.0 kernel, and in QEMU (user-mode) with 3.17.0 headers. Will test build with Clang also.

Diff Detail

Event Timeline

davidlt updated this revision to Diff 17831.Jan 6 2015, 7:25 AM
davidlt retitled this revision from to Improve fix for PR21476 (sanitizer_common not building on AArch64 with <=3.15 kernels).
davidlt updated this object.
davidlt edited the test plan for this revision. (Show Details)
davidlt added a reviewer: eugenis.
davidlt added subscribers: Unknown Object (MLST), eugenis.
kcc accepted this revision.Jan 6 2015, 10:54 AM
kcc added a reviewer: kcc.
kcc added a subscriber: kcc.

LGTM
But please do test with clang before committing.

This revision is now accepted and ready to land.Jan 6 2015, 10:54 AM
eugenis accepted this revision.Jan 12 2015, 1:38 AM
eugenis edited edge metadata.

LGTM, but please disable the definitions of __kernel_old_*_t on 32-bit platforms in sanitizer_platform_limits_posix.h as well.

Probably this patch is obsolete. Current code rely on SANITIZER_USES_UID16_SYSCALLS condition.