* [f2fs-dev] [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature
[not found] <00000000000085be6f05b12a1366@google.com>
@ 2020-10-08 19:15 ` Eric Biggers
2020-10-08 19:26 ` Gabriel Krisman Bertazi
2020-10-09 1:30 ` Chao Yu
2020-10-09 2:40 ` [f2fs-dev] general protection fault in utf8_casefold syzbot
1 sibling, 2 replies; 4+ messages in thread
From: Eric Biggers @ 2020-10-08 19:15 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel
Cc: Daniel Rosenberg, syzkaller-bugs, linux-kernel, linux-fsdevel,
syzbot+05139c4039d0679e19ff, Gabriel Krisman Bertazi
From: Eric Biggers <ebiggers@google.com>
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 <ebiggers@google.com>
---
fs/f2fs/inode.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 2ed935c13aed..d5664bc7d6c6 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -287,6 +287,13 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
return false;
}
+ if ((fi->i_flags & F2FS_CASEFOLD_FL) && !f2fs_sb_has_casefold(sbi)) {
+ set_sbi_flag(sbi, SBI_NEED_FSCK);
+ f2fs_warn(sbi, "%s: inode (ino=%lx) has casefold flag, but casefold feature is off",
+ __func__, inode->i_ino);
+ return false;
+ }
+
if (f2fs_has_extra_attr(inode) && f2fs_sb_has_compression(sbi) &&
fi->i_flags & F2FS_COMPR_FL &&
F2FS_FITS_IN_INODE(ri, fi->i_extra_isize,
base-commit: db40330b0de9a9d9939178f48cd5fc5e3fab14de
--
2.28.0.1011.ga647a8990f-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature
2020-10-08 19:15 ` [f2fs-dev] [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature Eric Biggers
@ 2020-10-08 19:26 ` Gabriel Krisman Bertazi
2020-10-09 1:30 ` Chao Yu
1 sibling, 0 replies; 4+ messages in thread
From: Gabriel Krisman Bertazi @ 2020-10-08 19:26 UTC (permalink / raw)
To: Eric Biggers
Cc: Daniel Rosenberg, syzkaller-bugs, linux-kernel, linux-f2fs-devel,
syzbot+05139c4039d0679e19ff, linux-fsdevel, Jaegeuk Kim
Eric Biggers <ebiggers@kernel.org> writes:
> From: Eric Biggers <ebiggers@google.com>
>
> 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 <ebiggers@google.com>
Looks good. For the record, this is fixed on ext4 already.
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
--
Gabriel Krisman Bertazi
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature
2020-10-08 19:15 ` [f2fs-dev] [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature Eric Biggers
2020-10-08 19:26 ` Gabriel Krisman Bertazi
@ 2020-10-09 1:30 ` Chao Yu
1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2020-10-09 1:30 UTC (permalink / raw)
To: Eric Biggers, Jaegeuk Kim, Chao Yu, linux-f2fs-devel
Cc: Daniel Rosenberg, syzkaller-bugs, linux-kernel, linux-fsdevel,
syzbot+05139c4039d0679e19ff, Gabriel Krisman Bertazi
On 2020/10/9 3:15, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> 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 <ebiggers@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] general protection fault in utf8_casefold
[not found] <00000000000085be6f05b12a1366@google.com>
2020-10-08 19:15 ` [f2fs-dev] [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature Eric Biggers
@ 2020-10-09 2:40 ` syzbot
1 sibling, 0 replies; 4+ messages in thread
From: syzbot @ 2020-10-09 2:40 UTC (permalink / raw)
To: Su.Chung, alexander.deucher, chao, drosen, ebiggers, jaegeuk,
jun.lei, krisman, linux-f2fs-devel, linux-fsdevel, linux-kernel,
su.chung, sunpeng.li, syzkaller-bugs, viro, yuchao0
syzbot has bisected this issue to:
commit 91db9311945f01901ddb9813ce11364de214a156
Author: Su Sung Chung <Su.Chung@amd.com>
Date: Mon Jul 8 15:31:39 2019 +0000
drm/amd/display: refactor gpio to allocate hw_container in constructor
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1012ee8b900000
start commit: c85fb28b Merge tag 'arm64-fixes' of git://git.kernel.org/p..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=1212ee8b900000
console output: https://syzkaller.appspot.com/x/log.txt?x=1412ee8b900000
kernel config: https://syzkaller.appspot.com/x/.config?x=de7f697da23057c7
dashboard link: https://syzkaller.appspot.com/bug?extid=05139c4039d0679e19ff
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12316e00500000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16e80420500000
Reported-by: syzbot+05139c4039d0679e19ff@syzkaller.appspotmail.com
Fixes: 91db9311945f ("drm/amd/display: refactor gpio to allocate hw_container in constructor")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-09 2:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <00000000000085be6f05b12a1366@google.com>
2020-10-08 19:15 ` [f2fs-dev] [PATCH] f2fs: reject CASEFOLD inode flag without casefold feature Eric Biggers
2020-10-08 19:26 ` Gabriel Krisman Bertazi
2020-10-09 1:30 ` Chao Yu
2020-10-09 2:40 ` [f2fs-dev] general protection fault in utf8_casefold syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).