Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp367252rwi; Mon, 10 Oct 2022 01:12:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77AvyFYKywR1kqU+AkYkFtQumP0OIti+B4fo6+AWzGxs6hUzUSCq9EMtTNmAQ2cdmMgRNb X-Received: by 2002:aa7:88c2:0:b0:562:6ca0:2f7a with SMTP id k2-20020aa788c2000000b005626ca02f7amr18606225pff.72.1665389578082; Mon, 10 Oct 2022 01:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665389578; cv=none; d=google.com; s=arc-20160816; b=hDQn/3+3SP3zSfbbf4VKswS5vJaYFr3IRBR0XIa/gnHm8W3OFF+7x8mmD1YsRwqXoY qrVeYAOTmKlwK/p33mVe5xSSWI057WUfrb9G7ARLXxdaqPLais7LU2ZihD5jR4baZlRE 0NDzO23G7qUferGSB65DyB0fixEZBLJ3HBQ2wDwYnoa4TlwaRaU0LqYGdJYbCBMcdE2h qRurToGOdFcJa9xmTiT8xcZHkaaya2kMA6tx3ilPk7VneHX7azS1yiCf+w+SmnS0HD/I PcjQaV+rTXPyohLodl/72l7d6FMmH9VZ5FPLfMjz3/TpJpBJZ26mHB3wjg+0kGEGSSzJ c7Ag== 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=QXM4F3eZALWq7+DWrWfi8eA7nzSxYJCpBdpBXH6ZUYw=; b=gZ22UTFl8+TZAWKO56pkNHAgFGhmjB7l5/FRgANml4wso/7IcrSS8K/qXQXWhkJSbD IZEnKfpgASN6A1pJf1eXH2toV1O8ISnttv4fHNjxs24XdNRNt5vgqm5hDvasC7Q1b111 GkkIlIGoR9gqKfZCM5BW93ehGXnoejBaMh7Y6CV0LlArUnCrG490lEtWLGrPiqn6bOIC zJ4LS9b41URGJ+TNp5vB3paSCPsEsErv8ANj/ZlWgBQQt+bZb1PPAFyQqcNo0YGQOnLA BGCkpLc1FT7OhsHDionL1Rts8Pfxz56n7kBxchP7Vi2CkjNBcpKpYrBpd9oYKMSh/Ts7 HJvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cv39onD2; 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 p20-20020a634f54000000b00450200a1087si10865365pgl.61.2022.10.10.01.12.40; Mon, 10 Oct 2022 01:12:58 -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=Cv39onD2; 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 S231909AbiJJIKB (ORCPT + 99 others); Mon, 10 Oct 2022 04:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231278AbiJJIJ6 (ORCPT ); Mon, 10 Oct 2022 04:09:58 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D4C4AE7F for ; Mon, 10 Oct 2022 01:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665389393; 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=QXM4F3eZALWq7+DWrWfi8eA7nzSxYJCpBdpBXH6ZUYw=; b=Cv39onD2/9wfg8BTsbNN2vckhLHsSY6tAyAg4bZYBVXgp/AbeQ84Pbt2HCmoLq57W2T+hw HTqIO8ZAqgSQgX3MRlC8Qq1YwaCmzITXk3liIzFqj01MZ1UJkbFR67ZSgcnLU3/aXGqPCT opvQd7WQSop9F4X6Q82uMieiBgBR0TE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-320-z0yR_T0eNsaOPpDwSaxGlg-1; Mon, 10 Oct 2022 04:09:48 -0400 X-MC-Unique: z0yR_T0eNsaOPpDwSaxGlg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2E0411C0514F; Mon, 10 Oct 2022 08:09:48 +0000 (UTC) Received: from ws.net.home (unknown [10.40.192.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB14440E992D; Mon, 10 Oct 2022 08:09:46 +0000 (UTC) Date: Mon, 10 Oct 2022 10:09:44 +0200 From: Karel Zak To: Lukas Czerner Cc: zhanchengbin , Theodore Ts'o , linux-ext4@vger.kernel.org, liuzhiqiang26@huawei.com, linfeilong Subject: Re: [bug report] misc/fsck.c: Processes may kill other processes. Message-ID: <20221010080944.u447ovrfpmpjwj6q@ws.net.home> References: <4ffe3143-fc53-7178-cf44-f3481eb96ae4@huawei.com> <20220929112813.6aqtktwaff2m7fh2@fedora> <470ea2ee-54fd-3dd5-2500-36fb82665c11@huawei.com> <20220930072042.dwakvbnefctk2jyd@fedora> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220930072042.dwakvbnefctk2jyd@fedora> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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 Fri, Sep 30, 2022 at 09:20:42AM +0200, Lukas Czerner wrote: > On Fri, Sep 30, 2022 at 09:42:52AM +0800, zhanchengbin wrote: > > > > > > On 2022/9/29 19:28, Lukas Czerner wrote: > > > Hi, > > > > > > indeed we'd like to avoid killing the instance that was not ran because > > > of noexecute. Can you try the following patch? > > > > > > Thanks! > > > -Lukas > > > > Yes, you're right, I think we can fix it in this way. > > > > diff --git a/misc/fsck.c b/misc/fsck.c > > index 1f6ec7d9..91edbf17 100644 > > --- a/misc/fsck.c > > +++ b/misc/fsck.c > > @@ -547,6 +547,8 @@ static int kill_all(int signum) > > for (inst = instance_list; inst; inst = inst->next) { > > if (inst->flags & FLAG_DONE) > > continue; > > + if (inst->pid == -1) > > + continue; > > Yeah, that works as well although I find the "if (noexecute)" condition > more obvious. We can do both. Also rather than checking for -1 we can > check for <= 0 since anything other than real pid at this point is a bug. > > Feel free to send a proper patch. Yes, please. It would be nice to have the same solution in the both (e2fsprogs and util-linux) trees. Karel -- Karel Zak http://karelzak.blogspot.com