From f2cc3eb133baa2e9dc8efd40f417106b2ee520f3 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Fri, 8 Feb 2008 04:19:06 -0800 Subject: [PATCH] do_wait: fix security checks Imho, the current usage of security_task_wait() is not logical. Suppose we have the single child p, and security_task_wait(p) return -EANY. In that case waitpid(-1) returns this error. Why? Isn't it better to return ECHLD? We don't really have reapable children. Now suppose that child was stolen by gdb. In that case we find this child on ->ptrace_children and set flag = 1, but we don't check that the child was denied. So, do_wait(..., WNOHANG) returns 0, this doesn't match the behaviour above. Without WNOHANG do_wait() blocks only to return the error later, when the child will be untraced. Inho, really strange. I think eligible_child() should return the error only if the child's pid was requested explicitly, otherwise we should silently ignore the tasks which were nacked by security_task_wait(). Signed-off-by: Oleg Nesterov Cc: Roland McGrath Cc: Chris Wright Cc: Eric Paris Cc: James Morris Cc: Stephen Smalley Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-format-patch failed