[compiler-rt] [compiler-rt][rtsan] mremap for Linux interception. (PR #124234)
Chris Apple via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 04:00:41 PST 2025
================
@@ -850,6 +851,32 @@ INTERCEPTOR(void *, mmap64, void *addr, size_t length, int prot, int flags,
#define RTSAN_MAYBE_INTERCEPT_MMAP64
#endif // SANITIZER_INTERCEPT_MMAP64
+#if SANITIZER_LINUX
+// Note that even if rtsan is ported to netbsd, it has a different signature
+// still
+INTERCEPTOR(void *, mremap, void *oaddr, size_t olength, size_t nlength,
+ int flags, ...) {
+ __rtsan_notify_intercepted_call("mremap");
+
+ void *naddr = nullptr;
+
+ // the last optional argument is only used in this case
+ // as the new page region will be assigned to. Is ignored otherwise.
+ if (flags & MREMAP_FIXED) {
+ va_list args;
+
+ va_start(args, flags);
+ naddr = va_arg(args, void *);
+ va_end(args);
----------------
cjappl wrote:
For this will you follow the pattern set forth in our `open`/`openat` interceptor? that is, call REAL in two places so we don't have to pass in nullptr on 873?
https://github.com/llvm/llvm-project/pull/124234
More information about the llvm-commits
mailing list