lkml.org 
[lkml]   [2019]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] fork: check exit_signal passed in clone3() call
On 09/11, Eugene Syromiatnikov wrote:
>
> @@ -2562,6 +2564,15 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
> if (copy_from_user(&args, uargs, size))
> return -EFAULT;
>
> + /*
> + * Two separate checks are needed, as valid_signal() takes unsigned long
> + * as an argument, and struct kernel_clone_args uses int type
> + * for the exit_signal field.
> + */
> + if (unlikely((args.exit_signal > UINT_MAX) ||
> + !valid_signal(args.exit_signal)))
> + return -EINVAL;

OK, I equally agree with this version. Although I'd simply do

if (args.exit_signal > _NSIG)
return -EINVAL;

but this is cosmetic.

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

\
 
 \ /
  Last update: 2019-09-12 18:51    [W:0.059 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site