Re: [PATCH v3] fork: check exit_signal passed in clone3() call

2019-09-13 Thread Christian Brauner
On Wed, Sep 11, 2019 at 06:45:40PM +0100, Eugene Syromiatnikov wrote: > Previously, higher 32 bits of exit_signal fields were lost when > copied to the kernel args structure (that uses int as a type for the > respective field). Moreover, as Oleg has noted[1], exit_signal is used > unchecked, so it

Re: [PATCH v3] fork: check exit_signal passed in clone3() call

2019-09-12 Thread Oleg Nesterov
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_signa

[PATCH v3] fork: check exit_signal passed in clone3() call

2019-09-11 Thread Eugene Syromiatnikov
Previously, higher 32 bits of exit_signal fields were lost when copied to the kernel args structure (that uses int as a type for the respective field). Moreover, as Oleg has noted[1], exit_signal is used unchecked, so it has to be checked for sanity before use; for the legacy syscalls, applying CS

[PATCH v3] fork: check exit_signal passed in clone3() call

2019-09-11 Thread Eugene Syromiatnikov
Hello. As was agreed[1][2], clone3 should fail if the provided exit_signal value fails valid_signal() check, hence the new version. Changees since v2[3][4]: - Rewrite the check to check exit_signal against valid_signal(). Changes since v1[5]: - Check changed to comparison against negated CSIGN