Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2119411rdb; Sun, 24 Dec 2023 18:56:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDYfcTuffrhz29afzJdH1+qUzGAEc/PDBOli3cJekzPX5fxHp+gtfw+iALuXTp45m/gmi2 X-Received: by 2002:a0c:f743:0:b0:67f:ae17:8ec4 with SMTP id e3-20020a0cf743000000b0067fae178ec4mr4179948qvo.122.1703473001726; Sun, 24 Dec 2023 18:56:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703473001; cv=none; d=google.com; s=arc-20160816; b=tweO6VsMCPNBn+tn28X+yQV9c8ULhLFiJdZuCw3ySkEidIeYWagFZw9suHUYY0T6w6 6WRDYAN1NndnQ8uSzTHzsZtwedtqHNgWtxPB3LriCWtwcD9RPGbTFvADv41RxDjTeeuX 9g276+xvguBKo+L/VDkZIWJDvLVYTFO6rEIdlY7pTY+9mJ477SJ31RLLS22uzjuhFo74 2OYlg9HwHMFLsZ+gpI/4qLhKdlp9xvD4b9IhLUk0Rb8uRtGiBBIHeHaq50VIxE6n39Go A8Xei56LMdqgVFLZOXXYMk5k7/ZOuuZ8Y+8oxs9FL4bEbvNidzCl7k6wJIUrDCKKucpt FCZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Af58TctT4K7jUR8Ol6arjg7tCIE1WP2jnWiz/VfnTxk=; fh=N9HFtcUntw3Yhw1I/i1gHdCod66k4wOx/svumPySzpk=; b=L0J5VZwrnFn1PWwtNkd6XI5nocyY1bYJAo4bxxR5NhFUUXRqCaKIpiRfB2g38AUion awhb/EtGqKHT2b0WsuKeO0J5Dxo0xFzArkEwin5X7VI6S6zGdn+uBwlc2c+dtW+nBdBz 66/5PwauJ7zM/A1Ng7zAIuF9kOOLDRqtp9WJz3tpCADJi21JHtM08gIQIZxOCDkgdwLL TQgNVZeWgVgP3ud7ew2revXGeNoXaOvkIX6QETI7TmGUOkQPRiyS6uQnHqmaGSN6KYSn g9SBZr3sM64acgveSlJ0bQ4wynCAYEdeCaT1DJsO4i5t6lXyZzbUAg3ZNiUYfkGP+hcR 0MoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-572-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v3-20020a0cf903000000b0067f31f63fc4si9996236qvn.612.2023.12.24.18.56.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 18:56:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-572-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-572-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 79FEA1C20F7C for ; Mon, 25 Dec 2023 02:56:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39D73A56; Mon, 25 Dec 2023 02:56:34 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B40BC804; Mon, 25 Dec 2023 02:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Sz2bR4tfVzsS7B; Mon, 25 Dec 2023 10:56:03 +0800 (CST) Received: from dggpeml500021.china.huawei.com (unknown [7.185.36.21]) by mail.maildlp.com (Postfix) with ESMTPS id CC1951800BB; Mon, 25 Dec 2023 10:56:26 +0800 (CST) Received: from [10.174.177.174] (10.174.177.174) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 25 Dec 2023 10:56:26 +0800 Message-ID: <33830a07-ffa9-d5da-d082-be1037d53ad8@huawei.com> Date: Mon, 25 Dec 2023 10:56:25 +0800 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH] ext4: fix WARNING in lock_two_nondirectories Content-Language: en-US To: Theodore Ts'o CC: Al Viro , Edward Adam Davis , , , , , , , yangerkun , Baokun Li References: <000000000000e17185060c8caaad@google.com> <20231225020754.GE1674809@ZenIV> <20231225024906.GD491196@mit.edu> From: Baokun Li In-Reply-To: <20231225024906.GD491196@mit.edu> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500021.china.huawei.com (7.185.36.21) On 2023/12/25 10:49, Theodore Ts'o wrote: > On Mon, Dec 25, 2023 at 10:33:20AM +0800, Baokun Li wrote: >> Since in the current logic we update the boot loader file via >> swap_inode_boot_loader(), however the boot loader inode on disk >> may be uninitialized and may be garbage data, so we allow to get a >> bad boot loader inode and then initialize it and swap it with the boot >> loader file to be set. >> When reinitializing the bad boot loader inode, something like an >> inode type conversion may occur. > Yes, but the boot laoder inode is *either* all zeros, or a regular > file. If it's a directory, then it's a malicious syzbot trying to > mess with our minds. > > Aside from the warning, it's pretty harmless, but it will very likely > result in a corrupted file system --- but the file system was > corrupted in the first place. So who cares? > > Just check to make sure that i_mode is either 0, or regular file, and > return EFSCORRUPTEd, and we're done. > > - Ted Yes, this seems to work, but for that matter, when i_mode is 0, we still trigger the WARN_ON_ONCE in lock_two_nondirectories(). Merry Christmas! -- With Best Regards, Baokun Li .