Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1478558pxu; Thu, 8 Oct 2020 12:28:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIKteZYXW/5eMy81qbms8Diyyh33YcB12fTw6HkACVPB2FZOVMevRRyZwwGtVo2BjCJIdE X-Received: by 2002:a17:906:2e8b:: with SMTP id o11mr10759535eji.128.1602185302135; Thu, 08 Oct 2020 12:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602185302; cv=none; d=google.com; s=arc-20160816; b=U8wIbskg0+IDAE+fuvD28edmoSKFt/5g77U28yTJn9fcMgREX4C720CG1rX9d2lnP6 Tk8JhiibJ2GAWE0piutfg7mFZD/z3zmnPL9zY1sH7ok2U7aNii/mQdBVZgRq9m4ekQ7V IF4vTOfTzst6VQBFZf5KnW4o5cee60kdys5qk4sUAsUJ4bjZdJ5wVs0FzAzbiqPrwOgt tMuXkH5BoujXBy9uABSC6UnKn917YzErcdOgAUlp6MA9DZwiT5GICBzZHt/2bDitcoR5 tFdqha9Q3GxCziXNEXTY4PmxjhziGoZMb2Uni6jiy9IG+axZNqnpaEx4groDUHcoH7um Dp4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from; bh=sQZnPgFNOhXnxga8xwHOY9phqXPulCRt6m3xzpnof9I=; b=1EvA/XUqbE5fNkIe303/gT4ytfpW1kJ16/q0pl0SyPv+1MfbHIqEF7kB5WWSTEcIoW GOiPyFj9SkEOaZXkMM46A+VUKKvzxt4W2qsBEoRe0i8Iz7/i+cxiq1ezVsXaTp4jRlms R6bQZXY4AxczySfnEx6c8QjU1hpUlQ2keoHjn6LhpdW7erJysHZjSP5n7B4eg/ajoqPZ oe06wjzfBt8Wlqwdj3rtcZxhYqwNHwc+4B60wjaYaWHaZ0NZa1HdXqXwQj0E5kcHVPuo EWWX51b8A8+wCHSoubuXY8xIK+dPy2MNPo8EIrExqwUDTKMDzdjgRyz53Fb+hCkT/CHT ETxQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si5453120eji.711.2020.10.08.12.27.59; Thu, 08 Oct 2020 12:28:22 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728243AbgJHT0v (ORCPT + 99 others); Thu, 8 Oct 2020 15:26:51 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:36632 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725616AbgJHT0u (ORCPT ); Thu, 8 Oct 2020 15:26:50 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id EB80529DAB8 From: Gabriel Krisman Bertazi To: Eric Biggers Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Daniel Rosenberg , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, syzkaller-bugs@googlegroups.com, syzbot+05139c4039d0679e19ff@syzkaller.appspotmail.com Subject: Re: [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature Organization: Collabora References: <00000000000085be6f05b12a1366@google.com> <20201008191522.1948889-1-ebiggers@kernel.org> Date: Thu, 08 Oct 2020 15:26:45 -0400 In-Reply-To: <20201008191522.1948889-1-ebiggers@kernel.org> (Eric Biggers's message of "Thu, 8 Oct 2020 12:15:22 -0700") Message-ID: <87ft6oldsa.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Biggers writes: > 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 Looks good. For the record, this is fixed on ext4 already. Reviewed-by: Gabriel Krisman Bertazi -- Gabriel Krisman Bertazi