Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp696407rwi; Mon, 10 Oct 2022 06:10:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vzJmg2GUTZ4u9eJrHTlZ1ya+8iCJwJG20jC6EKj7+jEpQA1S4yj4qaSRwe7yDziJktrHd X-Received: by 2002:a17:907:1c0b:b0:788:4c5:32d7 with SMTP id nc11-20020a1709071c0b00b0078804c532d7mr14473979ejc.223.1665407435036; Mon, 10 Oct 2022 06:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665407435; cv=none; d=google.com; s=arc-20160816; b=TpKp4Bm01byqDPlMXjJAMzal0u/HY9iYBYi81DVzo71GN57UNIJhS4aL7YISh1ZAqT kGlCznBeryR7QbbJioN+cgWEw3VvHucku1TskRHGj8ee8E3nhVVDpDd34kKEVkm0oP3d ItCyYgXwGEv14tuYLQqSeUqOsmIJgWqQitWxBJlrqoru90ayF//SDTVeoutaNt1ZcJlq Nco5mkhTnseRvXqZc85lyyc11E2ZK50Y2UXjcTQu6G1cV2ccwCPrciDBNI12A/0Z15rR jTpBGfmtGhXql1FFHI/Et/8tUrSW4P6nCPgMDJrGb2fB2SKE07nlcFzdAKbedt/dAR53 I0qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FNtMdWm65VKXDYsu7gJZSCkbMwJsOWFnzn/cKDTgMGk=; b=vn1UdteQVILI1uDdGcDoHxv1wKDqmMyt48D2KAtt77T5/rrfFwRZ8Hzern9vsrSW71 AAalo5sIgDbxZAgGuRdNoqDiBhQbHNUSR7+buFV/xZJMkBpdJqnVhG0+txkst1zR0Rxa wjyu1uyE6RoWofv0ID2MX6ay223vcw33rVLUI5iW49KQEiXzC6KWE/1Rd0qu61CCfeic aw3/R+8BmU3mJlNydqxahASjdDUCXSPNJgL9vyKEJ9EP1X1eSrjHfHTFVYsgCSGQRt9a cSGLkHW2VlLU8leawEjHbsEygoz6McnQVqKRfzhwiX/GCN9ULRFeTQTrgGtUuuj9m5fq R/MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cf8urhQs; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf19-20020a1709077f1300b00781bf46536bsi10608421ejc.4.2022.10.10.06.10.01; Mon, 10 Oct 2022 06:10:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cf8urhQs; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230235AbiJJNFR (ORCPT + 99 others); Mon, 10 Oct 2022 09:05:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbiJJNFN (ORCPT ); Mon, 10 Oct 2022 09:05:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 470CF2FFEB for ; Mon, 10 Oct 2022 06:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665407104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FNtMdWm65VKXDYsu7gJZSCkbMwJsOWFnzn/cKDTgMGk=; b=Cf8urhQsKprHLdfkcP22Aj+9dx8JjwutOQJCgez3xqBBPOtlKvgEeklh6ahojf98V8Lm/a jew+CEimPzyJRGlM9hNmXazCzHMVcZ4J+rAItDV8rW3z3Hpu8cE+6cEeuQ94JesUQeOHfJ OsLA0Q1txs4rfndRin9y+J3Bof0haog= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-505-YYcOpNvZMtCHMoeJd7E5ow-1; Mon, 10 Oct 2022 09:04:59 -0400 X-MC-Unique: YYcOpNvZMtCHMoeJd7E5ow-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 05E0495D688; Mon, 10 Oct 2022 13:04:59 +0000 (UTC) Received: from fedora (ovpn-195-46.brq.redhat.com [10.40.195.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1242DC210E; Mon, 10 Oct 2022 13:04:57 +0000 (UTC) Date: Mon, 10 Oct 2022 15:04:55 +0200 From: Lukas Czerner To: zhanchengbin Cc: Theodore Ts'o , linux-ext4@vger.kernel.org, liuzhiqiang26@huawei.com, linfeilong Subject: Re: [PATCH v2] misc/fsck.c: Processes may kill other processes. Message-ID: <20221010130455.2e5th5sboluwn457@fedora> References: <2c8f3b3a-b6d1-9b8b-27c7-2df51236fe8c@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c8f3b3a-b6d1-9b8b-27c7-2df51236fe8c@huawei.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Oct 10, 2022 at 04:56:58PM +0800, zhanchengbin wrote: > I find a error in misc/fsck.c, if run the fsck -N command, processes > don't execute, just show what would be done. However, the pid whose > value is -1 is added to the instance_list list in the execute > function,if the kill_all function is called later, kill(-1, signum) > is executed, Signals are sent to all processes except the number one > process and itself. Other processes will be killed if they use the > default signal processing function. Looks good thanks. > > Signed-off-by: zhanchengbin > Signed-off-by: Lukas Czerner ^^^ You can remove my Sob, but you can add Reviewed-by: Lukas Czerner Thanks! -Lukas > --- > V1->V2: > Anything <= 0 is a bug and can have unexpected consequences if > we actually call the kill(). So change inst->pid==-1 to inst->pid<=0. > > misc/fsck.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/misc/fsck.c b/misc/fsck.c > index 4efe10ec..c56d1b00 100644 > --- a/misc/fsck.c > +++ b/misc/fsck.c > @@ -546,6 +546,8 @@ static int kill_all(int signum) > for (inst = instance_list; inst; inst = inst->next) { > if (inst->flags & FLAG_DONE) > continue; > + if (inst->pid <= 0) > + continue; > kill(inst->pid, signum); > n++; > } > -- > 2.27.0 >