Re: + syscalls-x86-add-__nr_kcmp-syscall-v8.patch added to -mm tree

Cyrill Gorcunov
2012-02-15T15:10:16Z

On Wed, Feb 15, 2012 at 03:36:06PM +0100, Oleg Nesterov wrote:
>
> task->files can be NULL, we can race with exit_files().

So I need to call get_files_struct. Thanks Oleg!

>
> > + fdt = files_fdtable(task->files);
> > + if (idx < fdt->max_fds)
> > + file = fdt->fd[idx];
>
> You can probably rely on rcu instead of ->file_lock, but this is minor.
>

I think so. I'll be updating the patch anyway (on top of current
one) so I'll address this comment too. Thanks!

> > +
> > + /*
> > + * One should have enough rights to inspect task details.
> > + */
> > + if (!ptrace_may_access(task1, PTRACE_MODE_READ) ||
> > + !ptrace_may_access(task2, PTRACE_MODE_READ)) {
> > + ret = -EACCES;
>
> Well, probably this is fine... but may be you can add a comment.
> The task can change its credentials right after ptrace_may_access()
> succeeds. This _looks_ wrong, perhaps it makes sense to add the
> "we do not care" note.
>

Wait, how it's differ from other ptrace_may_access calls all over
the kernel? I suppose I'm missing something obvious?

Cyrill