[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230814140652.GA30596@redhat.com>
Date: Mon, 14 Aug 2023 16:06:52 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Petr Skocik <pskocik@...il.com>, Kees Cook <keescook@...omium.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Marco Elver <elver@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] signal: Fix the error return of kill -1
Hi Eric,
This change LGTM, but ...
On 08/11, Eric W. Biederman wrote:
>
> @@ -1602,7 +1603,8 @@ static int kill_something_info(int sig, struct kernel_siginfo *info, pid_t pid)
> ret = __kill_pgrp_info(sig, info,
> pid ? find_vpid(-pid) : task_pgrp(current));
> } else {
> - int retval = 0, count = 0;
> + bool found = false, success = false;
> + int retval = 0;
> struct task_struct * p;
>
> for_each_process(p) {
> @@ -1610,12 +1612,12 @@ static int kill_something_info(int sig, struct kernel_siginfo *info, pid_t pid)
> !same_thread_group(p, current)) {
> int err = group_send_sig_info(sig, info, p,
> PIDTYPE_MAX);
> - ++count;
> - if (err != -EPERM)
> - retval = err;
> + found = true;
> + success |= !err;
> + retval = err;
> }
> }
> - ret = count ? retval : -ESRCH;
> + ret = success ? 0 : (found ? retval : -ESRCH);
Why do we need the "bool found" variable ? Afacis
} else {
bool success = false;
int retval = -ESRCH;
struct task_struct * p;
for_each_process(p) {
if (task_pid_vnr(p) > 1 &&
!same_thread_group(p, current)) {
int err = group_send_sig_info(sig, info, p,
PIDTYPE_MAX);
success |= !err;
retval = err;
}
}
ret = success ? 0 : retval;
}
does the same?
Oleg.
Powered by blists - more mailing lists