Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1706979rwb; Thu, 29 Sep 2022 00:42:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5K09DXcUMUBwjk1c7KG7j0/0LPx4YMPs5RH1h9Iuu9GFpMByeVp7yJXlBVPtLvABiikN9/ X-Received: by 2002:a17:907:782:b0:740:7120:c6e7 with SMTP id xd2-20020a170907078200b007407120c6e7mr1597111ejb.313.1664437330984; Thu, 29 Sep 2022 00:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664437330; cv=none; d=google.com; s=arc-20160816; b=vuo3gSqWoHNJnA1lxfzMbsoWc6eC0rnGpW+AGcvT78SSt+Vzg8Cd4I6Ed+PPXNazlR goezBChm3aoCXfdB8ELysg62W59zCotRBiHpX/OEABuq2h85vTbl1ghTo44y2xTC4B9h /yL5kbS2tnFMUpkvMIGu8i5SJr1UCn11xNIoknNfgd56qs92K/MucPa+5RGZ4gijPY+Q 2OA+d+PNcpYR0g239RptPZgy0GexKskBFqpx6TmL5f9222sOq6lj2BUQptFFjQb2Bom5 51EA77TTaetiIOZLF+kmm+x5Pheo7X6su9Nr7sDTr2c3rsszLD0A+n6UlBtMvW7sJEfJ 4fsw== 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=JdG01qgpob25lZ0JCaKwxwnDHY1QTmy8Q4WU70sIFsA=; b=pgYnxwqpMeSJMQ+NbJPUoNMD6X9WpIcWUEJn5h7vE9IhCj9Io+Q0SUOgz9iRZfHRa3 DHRj7Cnqk2uLbOQ363uhCDCMV2Gi7mEbPUloRhwmonz99XVMIfhmvyx+QmTlOEgu+RSo r/u9K+GqKadybpCrl4ADtmSos0XUOZfsKAgqt29+UqCE/DGEodfRvxkw5D28Nt/+mX8S 7Z1cRqU/DqJ8uZE9+zUfz9ZNHx/N3VON4gc18T7/YYDMnQuJk0NdZETqHAgoH6BlFq2G EJLGvBV3ZwVXKAYGmmsRPBufxvHc2cALCh6f+FJ7kOl/gviIlrLdzKEfZvZVswlDYaCa +7Ew== 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 k12-20020a508acc000000b0044ec8f9905asi7533501edk.403.2022.09.29.00.41.40; Thu, 29 Sep 2022 00:42:10 -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 S235334AbiI2HkG (ORCPT + 99 others); Thu, 29 Sep 2022 03:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235351AbiI2HkC (ORCPT ); Thu, 29 Sep 2022 03:40:02 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 022E941D22 for ; Thu, 29 Sep 2022 00:40:00 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MdQB53d1PzHtdn; Thu, 29 Sep 2022 15:35:09 +0800 (CST) Received: from dggpeml500016.china.huawei.com (7.185.36.70) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 15:39:57 +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; Thu, 29 Sep 2022 15:39:57 +0800 Message-ID: <4ffe3143-fc53-7178-cf44-f3481eb96ae4@huawei.com> Date: Thu, 29 Sep 2022 15:39:57 +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: , , linfeilong From: zhanchengbin Subject: [bug report] 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: dggpeml100003.china.huawei.com (7.185.36.120) 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 Hi Tytso, 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. execute: if (noexecute) pid = -1; inst->pid = pid; // Find the end of the list, so we add the instance on at the end. kill_all: for (inst = instance_list; inst; inst = inst->next) { kill(inst->pid, signum); } misc/fsck.c: main: ->PRS case 'N': noexecute++; for (num_devices) { if (cancel_requested) { ->kill_all(SIGTERM); } ->fsck_device ->execute } (gdb) bt #0 execute (type=, type@entry=0x412cd0 "ext4", device=0x412b00 "/root/a.img", mntpt=, interactive=interactive@entry=1) at fsck.c:523 #1 0x0000000000404959 in fsck_device (fs=fs@entry=0x412ac0, interactive=interactive@entry=1) at fsck.c:727 #2 0x0000000000402704 in main (argc=, argv=) at fsck.c:1333 (gdb) p inst->pid $7 = -1 regards, Zhan Chengbin