diff mbox series

libsanitizer: Restore internal_readlink for x32

Message ID 20190220115337.10419-1-hjl.tools@gmail.com
State New
Headers show
Series libsanitizer: Restore internal_readlink for x32 | expand

Commit Message

H.J. Lu Feb. 20, 2019, 11:53 a.m. UTC
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): Put
	back the (uptr) cast on path and buf.
---
 libsanitizer/sanitizer_common/sanitizer_linux.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Jelinek Feb. 20, 2019, 4:16 p.m. UTC | #1
On Wed, Feb 20, 2019 at 03:53:37AM -0800, H.J. Lu wrote:
> Cherry-pick compiler-rt revision 354451:
> 
> 	PR sanitizer/89409
> 	* sanitizer_common/sanitizer_linux.cc (internal_readlink): Put
> 	back the (uptr) cast on path and buf.

Please use the above in the ChangeLog, so
 	PR sanitizer/89409
 	* sanitizer_common/sanitizer_linux.cc (internal_readlink): Cherry-pick
	compiler-rt r354451.

Ok with that change.

>  libsanitizer/sanitizer_common/sanitizer_linux.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
> index 244b5c3ff83..14e732fe110 100644
> --- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
> +++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
> @@ -395,7 +395,7 @@ uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
>    return internal_syscall(SYSCALL(readlinkat), AT_FDCWD, (uptr)path, (uptr)buf,
>                            bufsize);
>  #else
> -  return internal_syscall(SYSCALL(readlink), path, buf, bufsize);
> +  return internal_syscall(SYSCALL(readlink), (uptr)path, (uptr)buf, bufsize);
>  #endif
>  }

	Jakub
diff mbox series

Patch

diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index 244b5c3ff83..14e732fe110 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -395,7 +395,7 @@  uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
   return internal_syscall(SYSCALL(readlinkat), AT_FDCWD, (uptr)path, (uptr)buf,
                           bufsize);
 #else
-  return internal_syscall(SYSCALL(readlink), path, buf, bufsize);
+  return internal_syscall(SYSCALL(readlink), (uptr)path, (uptr)buf, bufsize);
 #endif
 }