All of lore.kernel.org
 help / color / mirror / Atom feed
* WARNING in pstore_kill_sb
@ 2021-02-13 16:58 syzbot
  2021-02-14  3:13 ` [PATCH] pstore: fix warning in pstore_kill_sb() Tetsuo Handa
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2021-02-13 16:58 UTC (permalink / raw)
  To: anton, ccross, keescook, linux-kernel, syzkaller-bugs, tony.luck

Hello,

syzbot found the following issue on:

HEAD commit:    e0756cfc Merge tag 'trace-v5.11-rc7' of git://git.kernel.o..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10692850d00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=b9a66c874a03a1ed
dashboard link: https://syzkaller.appspot.com/bug?extid=d0cf0ad6513e9a1da5df
userspace arch: arm

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d0cf0ad6513e9a1da5df@syzkaller.appspotmail.com

 do_el0_svc_compat+0x40/0x80 arch/arm64/kernel/syscall.c:204
 el0_svc_compat+0x20/0x30 arch/arm64/kernel/entry-common.c:442
 el0_sync_compat_handler+0x90/0x140 arch/arm64/kernel/entry-common.c:451
 el0_sync_compat+0x178/0x180 arch/arm64/kernel/entry.S:708
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5780 at fs/pstore/inode.c:470 pstore_kill_sb+0x88/0x90 fs/pstore/inode.c:480
Modules linked in:
CPU: 0 PID: 5780 Comm: syz-executor.1 Not tainted 5.11.0-rc7-syzkaller-00002-ge0756cfc7d7c #0
Hardware name: linux,dummy-virt (DT)
pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--)
pc : pstore_kill_sb+0x88/0x90 fs/pstore/inode.c:470
lr : pstore_kill_sb+0x30/0x90 fs/pstore/inode.c:469
sp : ffff00001d1e7a70
x29: ffff00001d1e7a70 x28: 0000000000000004 
x27: 0000000000008000 x26: ffff000016070a00 
x25: 0000000000000000 x24: ffff00000df2e068 
x23: 1fffe00001be5c0d x22: ffff800011edf070 
x21: ffff80001bbea000 x20: ffff00000df2e000 
x19: ffff800019a97a20 x18: 0000000000000000 
x17: 0000000000000000 x16: 0000000000000002 
x15: ffff800019c06380 x14: 1fffe00003a3cee8 
x13: 0000000000000000 x12: ffff700003352f45 
x11: 1ffff00003352f44 x10: ffff700003352f44 
x9 : dfff800000000000 x8 : ffff800019a97a27 
x7 : 0000000000000001 x6 : 00008ffffccad0bc 
x5 : ffff800019a97a20 x4 : 1fffe00001de59a9 
x3 : 0000000000000000 x2 : 0000000000000000 
x1 : ffff00000ef2cd40 x0 : 0000000000000000 
Call trace:
 pstore_kill_sb+0x88/0x90 fs/pstore/inode.c:480
 deactivate_locked_super+0x94/0x154 fs/super.c:335
 mount_single+0x114/0x180 fs/super.c:1470
 pstore_mount+0x1c/0x30 fs/pstore/inode.c:464
 legacy_get_tree+0xd0/0x190 fs/fs_context.c:592
 vfs_get_tree+0x74/0x2a0 fs/super.c:1496
 do_new_mount fs/namespace.c:2881 [inline]
 path_mount+0xf64/0x2170 fs/namespace.c:3211
 do_mount fs/namespace.c:3224 [inline]
 __do_sys_mount fs/namespace.c:3432 [inline]
 __se_sys_mount fs/namespace.c:3409 [inline]
 __arm64_sys_mount+0x2ec/0x520 fs/namespace.c:3409
 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
 invoke_syscall arch/arm64/kernel/syscall.c:49 [inline]
 el0_svc_common.constprop.0+0x110/0x3c0 arch/arm64/kernel/syscall.c:159
 do_el0_svc_compat+0x40/0x80 arch/arm64/kernel/syscall.c:204
 el0_svc_compat+0x20/0x30 arch/arm64/kernel/entry-common.c:442
 el0_sync_compat_handler+0x90/0x140 arch/arm64/kernel/entry-common.c:451
 el0_sync_compat+0x178/0x180 arch/arm64/kernel/entry.S:708


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] pstore: fix warning in pstore_kill_sb()
  2021-02-13 16:58 WARNING in pstore_kill_sb syzbot
@ 2021-02-14  3:13 ` Tetsuo Handa
  2021-02-23 17:30   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Tetsuo Handa @ 2021-02-14  3:13 UTC (permalink / raw)
  To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck
  Cc: linux-kernel, Tetsuo Handa, syzbot

syzbot is hitting WARN_ON(pstore_sb != sb) at pstore_kill_sb() [1], for the
assumption that pstore_sb != NULL is wrong because pstore_fill_super() will
not assign pstore_sb = sb when new_inode() for d_make_root() returned NULL
(due to memory allocation fault injection).

Since mount_single() calls pstore_kill_sb() when pstore_fill_super()
failed, pstore_kill_sb() needs to be aware of such failure path.

[1] https://syzkaller.appspot.com/bug?id=6abacb8da5137cb47a416f2bef95719ed60508a0

Reported-by: syzbot <syzbot+d0cf0ad6513e9a1da5df@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 fs/pstore/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 93a217e4f563..14658b009f1b 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -467,7 +467,7 @@ static struct dentry *pstore_mount(struct file_system_type *fs_type,
 static void pstore_kill_sb(struct super_block *sb)
 {
 	mutex_lock(&pstore_sb_lock);
-	WARN_ON(pstore_sb != sb);
+	WARN_ON(pstore_sb && pstore_sb != sb);
 
 	kill_litter_super(sb);
 	pstore_sb = NULL;
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pstore: fix warning in pstore_kill_sb()
  2021-02-14  3:13 ` [PATCH] pstore: fix warning in pstore_kill_sb() Tetsuo Handa
@ 2021-02-23 17:30   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2021-02-23 17:30 UTC (permalink / raw)
  To: Anton Vorontsov, Tetsuo Handa, Colin Cross, Tony Luck
  Cc: Kees Cook, linux-kernel, syzbot

On Sun, 14 Feb 2021 12:13:07 +0900, Tetsuo Handa wrote:
> syzbot is hitting WARN_ON(pstore_sb != sb) at pstore_kill_sb() [1], for the
> assumption that pstore_sb != NULL is wrong because pstore_fill_super() will
> not assign pstore_sb = sb when new_inode() for d_make_root() returned NULL
> (due to memory allocation fault injection).
> 
> Since mount_single() calls pstore_kill_sb() when pstore_fill_super()
> failed, pstore_kill_sb() needs to be aware of such failure path.
> 
> [...]

Applied to for-next/pstore, thanks!

[1/1] pstore: Fix warning in pstore_kill_sb()
      https://git.kernel.org/kees/c/9c7d83ae6ba6

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-23 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-13 16:58 WARNING in pstore_kill_sb syzbot
2021-02-14  3:13 ` [PATCH] pstore: fix warning in pstore_kill_sb() Tetsuo Handa
2021-02-23 17:30   ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.