On 04/03, Matthew Dempsky wrote: > > On Thu, Apr 3, 2014 at 8:44 AM, Oleg Nesterov <o...@redhat.com> wrote: > > > Some notes for potential future changes... > > > > - I do not not see any potential user of ptrace_event_pid() outside > > of fork.c, so perhaps this helper should not be exported. > > > > In fact I wouldn't mind if you send v5 which moves it into fork.c > > ;) > > Like you mentioned, it's potentially used by fs/exec.c too, which I > was intending to send a followup patch for.
OK, agreed. Probably we can tolerate the extra get/put_pid() but make this code look better. > > - OTOH, calculating pid_nr in the namespace of ->parent can probably > > go into another simple (exported) helper. do_notify_parent_*() and > > exec_binprm() could use it, even they do not have the problem with > > task_active_pid_ns(parent) == NULL. Not sure. > > I think do_notify_parent_*() are safe from task_active_pid_ns(parent) > == NULL because they're under tasklist_lock, Yes, they are fine correctness-wise, just this task_pid_nr_ns(...) doesn't look readable. OK, please forget, from_kuid_munged() doesn't look better. > but it looks like > exec_binprm() is theoretically racy No (if you meant task_pid_nr_ns() == NULL). Note that __task_pid_nr_ns() checks ns != NULL. In fact this is bad, this just reminds that we have too many helpers with the subtle differences ;) But if you meant that it can report the wrong pid then yes, of course, it can race with detach/attach too. Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/