[llvm-branch-commits] [sanitizer] Add TryMemCpy (PR #112668)

Florian Mayer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Oct 17 10:30:00 PDT 2024


================
@@ -325,6 +325,44 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size) {
   return true;
 }
 
+bool TryMemCpy(void *dest, const void *src, uptr n) {
+  int sock_pair[2];
+  if (pipe(sock_pair))
+    return false;
+
+  auto cleanup = at_scope_exit([&]() {
+    internal_close(sock_pair[0]);
+    internal_close(sock_pair[1]);
+  });
+
+  SetNonBlock(sock_pair[0]);
----------------
fmayer wrote:

We need to handle EAGAIN if we set Nonblock

https://github.com/llvm/llvm-project/pull/112668


More information about the llvm-branch-commits mailing list