lkml.org 
[lkml]   [2019]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v10 1/2] fork: extend clone3() to support setting a PID
    On 11/14, Adrian Reber wrote:
    >
    > @@ -2600,6 +2602,15 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
    > if (err)
    > return err;
    >
    > + if (unlikely(args.set_tid_size > MAX_PID_NS_LEVEL))
    > + return -EINVAL;

    so we need this to because copy_from_user() below writes into the
    set_tid[MAX_PID_NS_LEVEL] on the caller's stack, then later alloc_pid()
    does another "correct" check... We could simply shift that check here,
    but probably this would be less clear, so I won't argue.

    > @@ -2617,8 +2628,16 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
    > .stack = args.stack,
    > .stack_size = args.stack_size,
    > .tls = args.tls,
    > + .set_tid_size = args.set_tid_size,
    > };
    ...
    > + kargs->set_tid = kset_tid;

    this looks a bit strange, you could simply do

    .set_tid_size = args.set_tid_size,
    .set_tid = kset_tid,

    but this is really minor.

    Looks good to me,

    Reviewed-by: Oleg Nesterov <oleg@redhat.com>

    \
     
     \ /
      Last update: 2019-11-14 16:51    [W:4.055 / U:1.068 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site