Re: linux-next: umh: fix processed error when UMH_WAIT_PROC is used seems to break linux bridge on s390x (bisected)

From: Tetsuo Handa
Date: Thu Jul 02 2020 - 00:28:38 EST


On 2020/07/02 0:38, Luis Chamberlain wrote:
> @@ -156,6 +156,18 @@ static void call_usermodehelper_exec_sync(struct subprocess_info *sub_info)
> */
> if (KWIFEXITED(ret))
> sub_info->retval = KWEXITSTATUS(ret);
> + /*
> + * Do we really want to be passing the signal, or do we pass
> + * a single error code for all cases?
> + */
> + else if (KWIFSIGNALED(ret))
> + sub_info->retval = KWTERMSIG(ret);

No, this is bad. Caller of usermode helper is unable to distinguish exit(9)
and e.g. SIGKILL'ed by the OOM-killer. Please pass raw exit status value.

I feel that caller of usermode helper should not use exit status value.
For example, call_sbin_request_key() is checking

test_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags) || key_validate(key) < 0

condition (if usermode helper was invoked) in order to "ignore any errors from
userspace if the key was instantiated".

> + /* Same here */
> + else if (KWIFSTOPPED((ret)))
> + sub_info->retval = KWSTOPSIG(ret);
> + /* And are we really sure we want this? */
> + else if (KWIFCONTINUED((ret)))
> + sub_info->retval = 0;
> }
>
> /* Restore default kernel sig handler */
>