[Cluster-devel] [syzbot] kernel BUG in gfs2_glock_nq (2)
Hello, syzbot found the following issue on: HEAD commit:e47eb90a0a9a Add linux-next specific files for 20220901 git tree: linux-next console output: https://syzkaller.appspot.com/x/log.txt?x=1622f1d888 kernel config: https://syzkaller.appspot.com/x/.config?x=7933882276523081 dashboard link: https://syzkaller.appspot.com/bug?extid=70f4e455dee59ab40c80 compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2 Unfortunately, I don't have any reproducer for this issue yet. Downloadable assets: disk image: https://storage.googleapis.com/d3bf639370bc/disk-e47eb90a.raw.xz vmlinux: https://storage.googleapis.com/1c9c27c6eeef/vmlinux-e47eb90a.xz IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+70f4e455dee59ab40...@syzkaller.appspotmail.com gfs2: fsid=syz:syz.0: G: s:EX n:8/1 f:qb t:EX d:EX/0 a:0 v:0 r:5 m:20 p:0 gfs2: fsid=syz:syz.0: H: s:EX f:cH e:0 p:15361 [syz-executor.5] gfs2_quota_sync+0x2e2/0x660 fs/gfs2/quota.c:1322 [ cut here ] kernel BUG at fs/gfs2/glock.c:1541! invalid opcode: [#1] PREEMPT SMP KASAN CPU: 1 PID: 15361 Comm: syz-executor.5 Not tainted 6.0.0-rc3-next-20220901-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 RIP: 0010:add_to_queue fs/gfs2/glock.c:1541 [inline] RIP: 0010:gfs2_glock_nq.cold+0x2a1/0x2fa fs/gfs2/glock.c:1566 Code: 74 04 3c 03 7e 76 8b 53 18 44 89 f1 4c 89 ee 48 c7 c7 60 3a 3a 8a e8 8f 80 f3 ff ba 01 00 00 00 4c 89 e6 31 ff e8 fe f1 38 fa <0f> 0b e8 a7 3c 7e f8 4c 8b 04 24 e9 7f fd ff ff 45 31 f6 e9 fc fd RSP: 0018:c9000c52f7f0 EFLAGS: 00010286 RAX: RBX: 88803ee655e0 RCX: c90003e01000 RDX: 0004 RSI: 8383b5be RDI: 8a3a6fb0 RBP: 888075ee90e0 R08: 0001 R09: R10: 0001 R11: 6863657469676f6c R12: 88803ee655e0 R13: 888038445270 R14: 0001 R15: FS: 7f82a2a0a700() GS:8880b9b0() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 2100 CR3: 79881000 CR4: 003506e0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 Call Trace: gfs2_glock_nq_init fs/gfs2/glock.h:263 [inline] do_sync+0x4b9/0xcf0 fs/gfs2/quota.c:914 gfs2_quota_sync+0x2e2/0x660 fs/gfs2/quota.c:1322 gfs2_sync_fs+0x40/0xb0 fs/gfs2/super.c:642 sync_filesystem.part.0+0x75/0x1d0 fs/sync.c:56 sync_filesystem+0x8b/0xc0 fs/sync.c:43 generic_shutdown_super+0x70/0x410 fs/super.c:473 kill_block_super+0x97/0xf0 fs/super.c:1427 gfs2_kill_sb+0x104/0x160 fs/gfs2/ops_fstype.c:1733 deactivate_locked_super+0x94/0x160 fs/super.c:331 deactivate_super+0xad/0xd0 fs/super.c:362 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1186 task_work_run+0x16b/0x270 kernel/task_work.c:179 get_signal+0x1c3/0x2610 kernel/signal.c:2635 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:166 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f82a188a93a Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:7f82a2a09f88 EFLAGS: 0202 ORIG_RAX: 00a5 RAX: ffec RBX: 2200 RCX: 7f82a188a93a RDX: 2000 RSI: 2100 RDI: 7f82a2a09fe0 RBP: 7f82a2a0a020 R08: 7f82a2a0a020 R09: 2000 R10: R11: 0202 R12: 2000 R13: 2100 R14: 7f82a2a09fe0 R15: 20047a20 Modules linked in: ---[ end trace ]--- RIP: 0010:add_to_queue fs/gfs2/glock.c:1541 [inline] RIP: 0010:gfs2_glock_nq.cold+0x2a1/0x2fa fs/gfs2/glock.c:1566 Code: 74 04 3c 03 7e 76 8b 53 18 44 89 f1 4c 89 ee 48 c7 c7 60 3a 3a 8a e8 8f 80 f3 ff ba 01 00 00 00 4c 89 e6 31 ff e8 fe f1 38 fa <0f> 0b e8 a7 3c 7e f8 4c 8b 04 24 e9 7f fd ff ff 45 31 f6 e9 fc fd RSP: 0018:c9000c52f7f0 EFLAGS: 00010286 RAX: RBX: 88803ee655e0 RCX: c90003e01000 RDX: 0004 RSI: 8383b5be RDI: 8a3a6fb0 RBP: 888075ee90e0 R08: 0001 R09: R10: 0001 R11: 6863657469676f6c R12: 88803ee655e0 R13: 888038445270 R14: 0001 R15: FS: 7f82a2a0a700() GS:8880b9b0() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 2100 CR3: 79881000 CR4: 00
[Cluster-devel] [PATCH] dlm: Split memcpy() of struct dlm_message flexible array
To work around a misbehavior of the compiler's ability to see into composite flexible array structs (as detailed in the coming memcpy() hardening series[1]), split the memcpy() of the header and the payload so no false positive run-time overflow warning will be generated. [1] https://lore.kernel.org/linux-hardening/20220901065914.1417829-2-keesc...@chromium.org/ Cc: Christine Caulfield Cc: David Teigland Cc: cluster-devel@redhat.com Reported-by: "Gustavo A. R. Silva" Signed-off-by: Kees Cook --- fs/dlm/requestqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c index 036a9a0078f6..63f45c3c53a2 100644 --- a/fs/dlm/requestqueue.c +++ b/fs/dlm/requestqueue.c @@ -44,7 +44,8 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms) e->recover_seq = ls->ls_recover_seq & 0x; e->nodeid = nodeid; - memcpy(&e->request, ms, le16_to_cpu(ms->m_header.h_length)); + e->request = *ms; + memcpy(&e->request.m_extra, ms->m_extra, length); atomic_inc(&ls->ls_requestqueue_cnt); mutex_lock(&ls->ls_requestqueue_mutex); -- 2.34.1
Re: [Cluster-devel] [PATCH] dlm: Split memcpy() of struct dlm_message flexible array
On Fri, Sep 23, 2022 at 08:52:26PM -0700, Kees Cook wrote: > To work around a misbehavior of the compiler's ability to see into > composite flexible array structs (as detailed in the coming memcpy() > hardening series[1]), split the memcpy() of the header and the payload > so no false positive run-time overflow warning will be generated. > > [1] > https://lore.kernel.org/linux-hardening/20220901065914.1417829-2-keesc...@chromium.org/ > > Cc: Christine Caulfield > Cc: David Teigland > Cc: cluster-devel@redhat.com > Reported-by: "Gustavo A. R. Silva" > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks! -- Gustavo > --- > fs/dlm/requestqueue.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c > index 036a9a0078f6..63f45c3c53a2 100644 > --- a/fs/dlm/requestqueue.c > +++ b/fs/dlm/requestqueue.c > @@ -44,7 +44,8 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, > struct dlm_message *ms) > > e->recover_seq = ls->ls_recover_seq & 0x; > e->nodeid = nodeid; > - memcpy(&e->request, ms, le16_to_cpu(ms->m_header.h_length)); > + e->request = *ms; > + memcpy(&e->request.m_extra, ms->m_extra, length); > > atomic_inc(&ls->ls_requestqueue_cnt); > mutex_lock(&ls->ls_requestqueue_mutex); > -- > 2.34.1 >