Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1668613pxu; Thu, 8 Oct 2020 18:32:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznPPSAEkIT5oioeoK1fGGcFfM+ujrVRDZGIB6hoNk/pm/aHuhqwZKZyA03rsa/ekTB+0cm X-Received: by 2002:a50:ef0e:: with SMTP id m14mr12089100eds.5.1602207149778; Thu, 08 Oct 2020 18:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602207149; cv=none; d=google.com; s=arc-20160816; b=p8c1sl779C05TEEY283mO9Noa7bl2hvtAt3udLdsQvZ034WfUAeEzrAGAMfPyhRVnM xQlJZ7yVjnxOwsYan4kORg02Jg+3JZ6nz11nTlt3we52h0lFGBVTZykI8HekaLokF9bJ CcfqviU7R+HbOVZzshncTrc68dYB30pcQTMPO6y2P0VbJuoKtVP3MS4rVXBQSmMerQCN GSboMgjrhyyPGydFoTebTWdiP/xxiuhbDTp5CXpWEj8/vypBYDC3UBH8/rH1yMBicg5M kD5n4KCLbWLz+v7yQZkl0R0DXodgbyjE49gxjJ0PfT1yvCBtPKSVbPm1RDe8jyj7Aw8w nWgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=kgUyrOvSiqRiqDFaXTdTBNiJckRQIsJ3NieITb5HWRk=; b=Clv/ylkmCfHB/r9QdCu40kwoPhsQivULPDQmQhomrYggeJmSS7ZCpgFHW9xmw9BoWa N+4ctTkTt9eOZMf3DKinCAbKrzaiCgzq38VH06lx+LoGPfV1/bOVDeGdktUUKPW0oYl9 z0oqAs/GtNPprjqPCojB4qgJ2fJQ0PoO0Lmiu1KYRz/coLV+ToJcAtsoeHob79bNZMtY PUj5mok7AaCHIogEOyNjUR9umjFRHmDmetlx+ORWNYp98VWK72lcEZ+Nww54LGghvVvV INEsY/68zE56PpXvkOVFMemVd6sp0AHuUGFxYB2GcroLrhakD9pY1BBB+LXYizot+xCr ZOxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a24si4896258ejs.437.2020.10.08.18.32.04; Thu, 08 Oct 2020 18:32:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730009AbgJIBaU (ORCPT + 99 others); Thu, 8 Oct 2020 21:30:20 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:39218 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725979AbgJIBaU (ORCPT ); Thu, 8 Oct 2020 21:30:20 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 15DA58DAC5AD0225ECCE; Fri, 9 Oct 2020 09:30:18 +0800 (CST) Received: from [10.136.114.67] (10.136.114.67) by smtp.huawei.com (10.3.19.206) with Microsoft SMTP Server (TLS) id 14.3.487.0; Fri, 9 Oct 2020 09:30:15 +0800 Subject: Re: [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature To: Eric Biggers , Jaegeuk Kim , "Chao Yu" , CC: Daniel Rosenberg , Gabriel Krisman Bertazi , , , , References: <00000000000085be6f05b12a1366@google.com> <20201008191522.1948889-1-ebiggers@kernel.org> From: Chao Yu Message-ID: Date: Fri, 9 Oct 2020 09:30:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20201008191522.1948889-1-ebiggers@kernel.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.136.114.67] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/10/9 3:15, Eric Biggers wrote: > From: Eric Biggers > > syzbot reported: > > general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN > KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] > CPU: 0 PID: 6860 Comm: syz-executor835 Not tainted 5.9.0-rc8-syzkaller #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 > RIP: 0010:utf8_casefold+0x43/0x1b0 fs/unicode/utf8-core.c:107 > [...] > Call Trace: > f2fs_init_casefolded_name fs/f2fs/dir.c:85 [inline] > __f2fs_setup_filename fs/f2fs/dir.c:118 [inline] > f2fs_prepare_lookup+0x3bf/0x640 fs/f2fs/dir.c:163 > f2fs_lookup+0x10d/0x920 fs/f2fs/namei.c:494 > __lookup_hash+0x115/0x240 fs/namei.c:1445 > filename_create+0x14b/0x630 fs/namei.c:3467 > user_path_create fs/namei.c:3524 [inline] > do_mkdirat+0x56/0x310 fs/namei.c:3664 > do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > [...] > > The problem is that an inode has F2FS_CASEFOLD_FL set, but the > filesystem doesn't have the casefold feature flag set, and therefore > super_block::s_encoding is NULL. > > Fix this by making sanity_check_inode() reject inodes that have > F2FS_CASEFOLD_FL when the filesystem doesn't have the casefold feature. > > Reported-by: syzbot+05139c4039d0679e19ff@syzkaller.appspotmail.com > Fixes: 2c2eb7a300cd ("f2fs: Support case-insensitive file name lookups") > Signed-off-by: Eric Biggers Reviewed-by: Chao Yu Thanks,