about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2019-12-26 21:41:58 +0100
committerGitHub <noreply@github.com>2019-12-26 21:41:58 +0100
commit50ece2521b860de07067a4d84efb8a7a1f89f04a (patch)
tree2b10b4fa282134e50e2484fd71e8281f34c8a8cd
parenta2d2e3bd87636c2ccca1afecc5c7c20360aa43fa (diff)
parent0f867b44e05b3a0422d0d4348e969caa222e8a50 (diff)
downloadmiasm-50ece2521b860de07067a4d84efb8a7a1f89f04a.tar.gz
miasm-50ece2521b860de07067a4d84efb8a7a1f89f04a.zip
Merge pull request #1118 from Sh3idan/add/linux_env/mmap
mmap: ignore offset if MAP_ANONYMOUS set
-rw-r--r--miasm/os_dep/linux/environment.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/miasm/os_dep/linux/environment.py b/miasm/os_dep/linux/environment.py
index 4d24e85a..07a7c9d4 100644
--- a/miasm/os_dep/linux/environment.py
+++ b/miasm/os_dep/linux/environment.py
@@ -623,9 +623,10 @@ class LinuxEnvironment(object):
                 "mmap allocated"
             )
 
-
         if fd == 0xffffffff:
-            if off != 0:
+            MAP_ANONYMOUS = 0x20    # mman.h
+            # fd and offset are ignored if MAP_ANONYMOUS flag is present
+            if not(flags & MAP_ANONYMOUS) and off != 0:
                 raise RuntimeError("Not implemented")
             data = b"\x00" * len_
         else: