From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5AD5C25B4F for ; Wed, 16 Aug 2023 20:33:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346167AbjHPUdS (ORCPT ); Wed, 16 Aug 2023 16:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346247AbjHPUdJ (ORCPT ); Wed, 16 Aug 2023 16:33:09 -0400 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B26126BB for ; Wed, 16 Aug 2023 13:33:04 -0700 (PDT) Received: from in02.mta.xmission.com ([166.70.13.52]:51116) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1qWNCP-001osj-Ga; Wed, 16 Aug 2023 14:33:01 -0600 Received: from ip68-227-168-167.om.om.cox.net ([68.227.168.167]:40368 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1qWNCO-00B6Ui-Ma; Wed, 16 Aug 2023 14:33:01 -0600 From: "Eric W. Biederman" To: Oleg Nesterov Cc: David Laight , Petr Skocik , Kees Cook , Thomas Gleixner , Peter Zijlstra , Marco Elver , "linux-kernel@vger.kernel.org" References: <20221122161240.137570-1-pskocik@gmail.com> <202211220913.AF86992@keescook> <878rai7u0l.fsf@email.froward.int.ebiederm.org> <336ae9be-c66c-d87f-61fe-b916e9f04ffc@gmail.com> <87pm3t2rvl.fsf@email.froward.int.ebiederm.org> <87jzu12pjh.fsf_-_@email.froward.int.ebiederm.org> <20230814140652.GA30596@redhat.com> <20230814154351.GA4203@redhat.com> <3b14ae8091e3403bbc4ef1bee6dcf4f6@AcuMS.aculab.com> <20230815151149.GA29072@redhat.com> Date: Wed, 16 Aug 2023 15:32:26 -0500 In-Reply-To: <20230815151149.GA29072@redhat.com> (Oleg Nesterov's message of "Tue, 15 Aug 2023 17:11:50 +0200") Message-ID: <87fs4ig23p.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1qWNCO-00B6Ui-Ma;;;mid=<87fs4ig23p.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.168.167;;;frm=ebiederm@xmission.com;;;spf=pass X-XM-AID: U2FsdGVkX1/03hSznMFp9LtVGdXJGlIQ7ZUXkm5I7t0= X-SA-Exim-Connect-IP: 68.227.168.167 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH] signal: Fix the error return of kill -1 X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov writes: > On 08/15, David Laight wrote: >> >> or maybe even: >> } else { >> struct task_struct * p; >> int err; >> ret = -ESRCH; >> >> for_each_process(p) { >> if (task_pid_vnr(p) > 1 && >> !same_thread_group(p, current)) { >> err = group_send_sig_info(sig, info, p, >> PIDTYPE_MAX); >> if (ret) >> ret = err; > > Hmm, indeed ;) > > and "err" can be declared inside the loop. We can't remove the success case, from my posted patch. A signal is considered as successfully delivered if at least one process receives it. That is something the current code for kill -1 actually gets wrong (but hides because it ignores -EPERM). Otherwise yes I expect we can simplify the use of variables as suggested. Eric