[compiler-rt] [compiler-rt] Call __sys_mmap in internal_mmap on FreeBSD (PR #84438)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 23:37:47 PST 2024
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/84438
>From 728e333cbf2de55ea6b9ddca1ee30be0b09633cf Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Thu, 7 Mar 2024 23:32:59 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
=?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.6-beta.1
---
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 5d2dd3a7a658fe..b100e3ffb765d7 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -197,12 +197,17 @@ ScopedBlockSignals::~ScopedBlockSignals() { SetSigProcMask(&saved_, nullptr); }
# include "sanitizer_syscall_generic.inc"
# endif
+extern "C" void *__sys_mmap(void *addr, size_t len, int prot, int flags, int fd,
+ off_t offset);
+
// --------------- sanitizer_libc.h
# if !SANITIZER_SOLARIS && !SANITIZER_NETBSD
# if !SANITIZER_S390
uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd,
u64 offset) {
-# if SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS
+# if SANITIZER_FREEBSD
+ return (uptr)__sys_mmap(addr, length, prot, flags, fd, offset);
+# elif SANITIZER_LINUX_USES_64BIT_SYSCALLS
return internal_syscall(SYSCALL(mmap), (uptr)addr, length, prot, flags, fd,
offset);
# else
>From 384954d939e16534e1a31121cbd1bd185c2450a0 Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Thu, 7 Mar 2024 23:37:30 -0800
Subject: [PATCH 2/2] move decl to freebsd block
Created using spr 1.3.6-beta.1
---
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index b100e3ffb765d7..71d1cf33e54a34 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -147,6 +147,8 @@ const int FUTEX_WAKE_PRIVATE = FUTEX_WAKE | FUTEX_PRIVATE_FLAG;
# if SANITIZER_FREEBSD
# define SANITIZER_USE_GETENTROPY 1
+extern "C" void *__sys_mmap(void *addr, size_t len, int prot, int flags, int fd,
+ off_t offset);
# endif
namespace __sanitizer {
@@ -197,9 +199,6 @@ ScopedBlockSignals::~ScopedBlockSignals() { SetSigProcMask(&saved_, nullptr); }
# include "sanitizer_syscall_generic.inc"
# endif
-extern "C" void *__sys_mmap(void *addr, size_t len, int prot, int flags, int fd,
- off_t offset);
-
// --------------- sanitizer_libc.h
# if !SANITIZER_SOLARIS && !SANITIZER_NETBSD
# if !SANITIZER_S390
More information about the llvm-commits
mailing list