Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1839035rwb; Fri, 7 Oct 2022 20:22:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54jL/BoJWjxcVoxWRhx5WgnMsrNHmYqJU1pzx6Mk52g4C+ZeMLb4osP1zHUIR9qdyukabp X-Received: by 2002:aa7:838a:0:b0:536:101a:9ccf with SMTP id u10-20020aa7838a000000b00536101a9ccfmr8363468pfm.18.1665199375331; Fri, 07 Oct 2022 20:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665199375; cv=none; d=google.com; s=arc-20160816; b=jO1fuwqdT3bpO+Gtcru6/VN5dY1fVJF6AX/Hjar/4acJznIv6ldgMeNK1+fD24c/R+ Mnnd7xRa4oZalQ5W3O7b3wRIuJmfqVxdxb+KErXv9eFP9cnOCxfC4V24QTcvvwtG5YAe JRvF/l1pje5gj9xYIWq4HpLTtWVaHqVwHcllgFe5/jsqcAnZi7tpB2SKPWR3f28AzTR+ NUhic2GTiv+KXt/UZJQhHtvEE5mT9hFUYmMtqJonlZDEso6ZKUmXUB0DlCB88ifHEzTZ Opqr+6NXozP/rQudcsoTapoQzMenTmhEjpv7E854jBISR7jX0PN2yoTWZJxPs+8gja25 h4MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :user-agent:mime-version:date:message-id; bh=Zcvnw6426rZqrTvGA1A95BHfZ5NXVTgnPlZpAFYtuYw=; b=Gcmx7qhA1ZuaFOQ04VamVbwlPngqLV3oQy9V4xIoNRXOU9+8CyhXJaVNlK1KcHdMuB CAqmzvNFkD3jymn3K7zcWjmkOEnRj66uUjRDuVf+hhrXVqb1QoIoHeopGvAa03Rjj9iS avXyuEXm7CpzIYtp5Gv16TtIZ1+8CEnamKmvStcjF4cqG6fi1c4n/F0X8ZT84ikwaS8c /I3Bb44+WdWVPyt46owwnRIhe7OrefL/T/6lJyUtU6y0j+3rwQdoUlVfRJfMeHyk4GBC 4uv3lf+qwQVySOaCrAAHWWkoaQSqweiTsropdISCtFm0x/xCETPiEVVHhxGp6nU36PFu c2aQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a056a0024d200b00557a43656c6si4388466pfv.109.2022.10.07.20.22.35; Fri, 07 Oct 2022 20:22:55 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229459AbiJHDF7 (ORCPT + 99 others); Fri, 7 Oct 2022 23:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbiJHDF5 (ORCPT ); Fri, 7 Oct 2022 23:05:57 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEEAF7D7B7 for ; Fri, 7 Oct 2022 20:05:50 -0700 (PDT) Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mkqgz6gvTzlXh8; Sat, 8 Oct 2022 11:01:19 +0800 (CST) Received: from dggpeml500016.china.huawei.com (7.185.36.70) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 8 Oct 2022 11:05:49 +0800 Received: from [10.174.176.102] (10.174.176.102) by dggpeml500016.china.huawei.com (7.185.36.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 8 Oct 2022 11:05:48 +0800 Message-ID: <01783b8c-2a39-73ec-c537-cc1df82643e2@huawei.com> Date: Sat, 8 Oct 2022 11:05:48 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 To: Theodore Ts'o CC: , Lukas Czerner , , linfeilong From: zhanchengbin Subject: [PATCH] misc/fsck.c: Processes may kill other processes. Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.102] X-ClientProxiedBy: dggpeml500017.china.huawei.com (7.185.36.243) To dggpeml500016.china.huawei.com (7.185.36.70) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 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. Signed-off-by: zhanchengbin --- misc/fsck.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/fsck.c b/misc/fsck.c index 4efe10ec..faf7789d 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 == -1) + continue; kill(inst->pid, signum); n++; } -- 2.27.0