瀏覽代碼

oss-fuzz: Try harder to fix build

Apparently memfd_create() is newish in glibc, and oss-fuzz
uses Ubuntu 16.04 as base for its docker images, which doens't
yet have memfd_create(). But, not to worry, it does have the syscall
define and that's all we really need :/
Nico Weber 4 年之前
父節點
當前提交
65570216b4
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      Userland/Libraries/LibCore/AnonymousBuffer.cpp

+ 10 - 0
Userland/Libraries/LibCore/AnonymousBuffer.cpp

@@ -37,6 +37,16 @@
 #    include <serenity.h>
 #    include <serenity.h>
 #endif
 #endif
 
 
+#if defined(__linux__) && !defined(MFD_CLOEXEC)
+#    include <linux/memfd.h>
+#    include <sys/syscall.h>
+
+static int memfd_create(const char* name, unsigned int flags)
+{
+    return syscall(SYS_memfd_create, name, flags);
+}
+#endif
+
 namespace Core {
 namespace Core {
 
 
 AnonymousBuffer AnonymousBuffer::create_with_size(size_t size)
 AnonymousBuffer AnonymousBuffer::create_with_size(size_t size)