Browse Source

[LibOS] Remove `reserve` argument from init_stack()

Isaku Yamahata 4 years ago
parent
commit
0f0c64c4af
3 changed files with 5 additions and 7 deletions
  1. 1 1
      LibOS/shim/include/shim_thread.h
  2. 3 3
      LibOS/shim/src/shim_init.c
  3. 1 3
      LibOS/shim/src/sys/shim_exec.c

+ 1 - 1
LibOS/shim/include/shim_thread.h

@@ -360,6 +360,6 @@ bool check_on_stack (struct shim_thread * cur_thread, void * mem)
 
 int init_stack (const char ** argv, const char ** envp,
                 int ** argcpp, const char *** argpp,
-                elf_auxv_t ** auxpp, size_t reserve);
+                elf_auxv_t ** auxpp);
 
 #endif /* _SHIM_THREAD_H_ */

+ 3 - 3
LibOS/shim/src/shim_init.c

@@ -374,7 +374,7 @@ copy_envp:
 
 int init_stack (const char ** argv, const char ** envp,
                 int ** argcpp, const char *** argpp,
-                elf_auxv_t ** auxpp, size_t reserve)
+                elf_auxv_t ** auxpp)
 {
     uint64_t stack_size = get_rlimit_cur(RLIMIT_STACK);
 
@@ -398,7 +398,7 @@ int init_stack (const char ** argv, const char ** envp,
     if (initial_envp)
         envp = initial_envp;
 
-    int ret = populate_user_stack(stack, stack_size - reserve,
+    int ret = populate_user_stack(stack, stack_size,
                                   auxpp, argcpp, &argv, &envp);
     if (ret < 0)
         return ret;
@@ -771,7 +771,7 @@ noreturn void* shim_init (int argc, void * args)
     RUN_INIT(init_mount);
     RUN_INIT(init_important_handles);
     RUN_INIT(init_async);
-    RUN_INIT(init_stack, argv, envp, &argcp, &argp, &auxp, 0);
+    RUN_INIT(init_stack, argv, envp, &argcp, &argp, &auxp);
     RUN_INIT(init_loader);
     RUN_INIT(init_ipc_helper);
     RUN_INIT(init_signal);

+ 1 - 3
LibOS/shim/src/sys/shim_exec.c

@@ -212,9 +212,7 @@ static int shim_do_execve_rtld (struct shim_handle * hdl, const char ** argv,
     int * new_argcp = &new_argc;
     const char ** new_argp;
     elf_auxv_t * new_auxp;
-    size_t reserve = 0;
-    if ((ret = init_stack(argv, envp, &new_argcp, &new_argp, &new_auxp,
-                          reserve)) < 0)
+    if ((ret = init_stack(argv, envp, &new_argcp, &new_argp, &new_auxp)) < 0)
         return ret;
 
     __disable_preempt(shim_get_tls()); // Temporarily disable preemption