Skip to content

Commit

Permalink
kernel: use kernel_wait4() instead of sys_wait4()
Browse files Browse the repository at this point in the history
All call sites of sys_wait4() set *rusage to NULL. Therefore, there is
no need for the copy_to_user() handling of *rusage, and we can use
kernel_wait4() directly.

This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/[email protected]

Acked-by: Luis R. Rodriguez <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed Apr 2, 2018
1 parent 819671f commit d300b61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ SYSCALL_DEFINE4(wait4, pid_t, upid, int __user *, stat_addr,
*/
SYSCALL_DEFINE3(waitpid, pid_t, pid, int __user *, stat_addr, int, options)
{
return sys_wait4(pid, stat_addr, options, NULL);
return kernel_wait4(pid, stat_addr, options, NULL);
}

#endif
Expand Down
6 changes: 3 additions & 3 deletions kernel/pid_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,16 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)

/*
* Reap the EXIT_ZOMBIE children we had before we ignored SIGCHLD.
* sys_wait4() will also block until our children traced from the
* kernel_wait4() will also block until our children traced from the
* parent namespace are detached and become EXIT_DEAD.
*/
do {
clear_thread_flag(TIF_SIGPENDING);
rc = sys_wait4(-1, NULL, __WALL, NULL);
rc = kernel_wait4(-1, NULL, __WALL, NULL);
} while (rc != -ECHILD);

/*
* sys_wait4() above can't reap the EXIT_DEAD children but we do not
* kernel_wait4() above can't reap the EXIT_DEAD children but we do not
* really care, we could reparent them to the global init. We could
* exit and reap ->child_reaper even if it is not the last thread in
* this pid_ns, free_pid(pid_allocated == 0) calls proc_cleanup_work(),
Expand Down
4 changes: 2 additions & 2 deletions kernel/umh.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void call_usermodehelper_exec_sync(struct subprocess_info *sub_info)
{
pid_t pid;

/* If SIGCLD is ignored sys_wait4 won't populate the status. */
/* If SIGCLD is ignored kernel_wait4 won't populate the status. */
kernel_sigaction(SIGCHLD, SIG_DFL);
pid = kernel_thread(call_usermodehelper_exec_async, sub_info, SIGCHLD);
if (pid < 0) {
Expand All @@ -135,7 +135,7 @@ static void call_usermodehelper_exec_sync(struct subprocess_info *sub_info)
*
* Thus the __user pointer cast is valid here.
*/
sys_wait4(pid, (int __user *)&ret, 0, NULL);
kernel_wait4(pid, (int __user *)&ret, 0, NULL);

/*
* If ret is 0, either call_usermodehelper_exec_async failed and
Expand Down

0 comments on commit d300b61

Please sign in to comment.