diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c
index a8e790a29..c133c4af7 100644
--- a/sys/compat/linux/linux_mmap.c
+++ b/sys/compat/linux/linux_mmap.c
@@ -51,6 +51,16 @@
 #include <compat/linux/linux_mmap.h>
 #include <compat/linux/linux_persona.h>
 #include <compat/linux/linux_util.h>
+#if defined(__amd64__)
+#include <amd64/linux/linux.h>
+#include <amd64/linux/linux_proto.h>
+#elif defined(__i386__)
+#include <i386/linux/linux.h>
+#include <i386/linux/linux_proto.h>
+#elif defined(__aarch64__)
+#include <arm64/linux/linux.h>
+#include <arm64/linux/linux_proto.h>
+#endif
 
 #define STACK_SIZE  (2 * 1024 * 1024)
 #define GUARD_SIZE  (4 * PAGE_SIZE)
@@ -423,3 +433,26 @@ linux_fixup_prot(struct thread *td, int *prot)
 
 }
 #endif
+
+int
+linux_munmap(struct thread *td, struct linux_munmap_args *args)
+{
+    size_t length;
+
+    /* Linux requires addresses to be page aligned */
+    if ((uintptr_t)args->addr & PAGE_MASK)
+        return (EINVAL);
+
+    /* Check to see if len is 0, this is the EXACT
+     * same operation linux does to check to see
+     * if len is 0.
+     * Citing linux/mm/vma.c
+     */
+    if(args->len == 0)
+        return (EINVAL);
+
+    /* round up to next page boundary */
+    length = roundup2(args->len, PAGE_SIZE);
+
+    return (kern_munmap(td, (uintptr_t) args->addr, length));
+}
