libsanitizer: Restore internal_readlink for x32
authorH.J. Lu <hongjiu.lu@intel.com>
Wed, 20 Feb 2019 16:20:50 +0000 (16:20 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Wed, 20 Feb 2019 16:20:50 +0000 (08:20 -0800)
commit4dfc5b351f70e6c9a393a6a2a53eda22a5cf422b
tree66bcb3bf32df716c5aff1a48aacd95858bb180b3
parent9e8fc96cdcd909a9ead698696e4fae76bd43b27f
libsanitizer: Restore internal_readlink for x32

Cherry-pick compiler-rt revision 354451:

r316591 has

@@ -389,13 +383,11 @@ uptr internal_dup2(int oldfd, int newfd) {
 }

 uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
-#if SANITIZER_NETBSD
-  return internal_syscall_ptr(SYSCALL(readlink), path, buf, bufsize);
-#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
   return internal_syscall(SYSCALL(readlinkat), AT_FDCWD,
                           (uptr)path, (uptr)buf, bufsize);
 #else
-  return internal_syscall(SYSCALL(readlink), (uptr)path, (uptr)buf, bufsize);
+  return internal_syscall_ptr(SYSCALL(readlink), path, buf, bufsize);
 #endif
 }

which dropped the (uptr) cast and broke x32.  This patch puts back the
(uptr) cast to restore x32 and fixes:

https://bugs.llvm.org/show_bug.cgi?id=40783

Differential Revision: https://reviews.llvm.org/D58413

PR sanitizer/89409
* sanitizer_common/sanitizer_linux.cc (internal_readlink):
Cherry-pick compiler-rt r354451.

From-SVN: r269042
libsanitizer/ChangeLog
libsanitizer/sanitizer_common/sanitizer_linux.cc