Browse Source

[LibOS] Zero %rdx on entry of user program

As x86-64 unix ABI, %rdx on user program entry is a function pointer
which is registered as atexit. It should be zeroed unless LibOS needs
it. Otherwise random %rdx as function pointer is called by atexit and
can result in error. typically SEGV.

Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
Isaku Yamahata 6 years ago
parent
commit
6d50e6cdef
1 changed files with 2 additions and 2 deletions
  1. 2 2
      LibOS/shim/src/elf/shim_rtld.c

+ 2 - 2
LibOS/shim/src/elf/shim_rtld.c

@@ -1591,8 +1591,8 @@ int execute_elf_object (struct shim_handle * exec, int argc, const char ** argp,
                     :
                     : "a"(entry),
                     "b"(argp),
-                    "D"(argc)
-
+                    "D"(argc),
+                    "d"(0)
                     : "memory");
 #else
 # error "architecture not supported"