Re: [PATCH] copy_process: cosmetic ->ioprio tweak

Oleg Nesterov
2006-08-22T14:03:04Z

On 08/21, Andrew Morton wrote:
>
> On Sun, 20 Aug 2006 18:53:21 +0400
> Oleg Nesterov <oleg@tv-sign.ru> wrote:
>
> > copy_process:
> > // holds tasklist_lock + ->siglock
> > /*
> > * inherit ioprio
> > */
> > p->ioprio = current->ioprio;
> >
> > Why? ->ioprio was already copied in dup_task_struct().
>
> It might just be a thinko.
>
> > I guess this is needed
> > to ensure that the child can't escape sys_ioprio_set(IOPRIO_WHO_{PGRP,USER}),
> > yes?
>
> How could the child escape that if this assignment was not present?

It is possible that sys_ioprio_set(IOPRIO_WHO_PGRP) was called after
copy_process() already did dup_task_struct(), but before it takes
tasklist_lock. Documentation/block/ioprio.txt doesn't say should
ioprio_set() be "atomic" or not. If not, we can kill this line, and
(more importantly) drop tasklist_lock in fs/ioprio.c

Oleg.