-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xmm7360.c compile error on 5.18 kernel #31
Comments
sys-oak
pushed a commit
that referenced
this issue
Aug 5, 2022
local_irq_save/restore() pairs should be replaced by local_irq_save_full() calls when pipelining, not hard_local_irq_save/restore(), so that lockdep does not complain about inconsistent irq state (the hard_* form does not invoke the trace_irq* API). This fixes this kind of splat at boot: [ 0.124134] Switched APIC routing to physical flat. [ 0.125066] ------------[ cut here ]------------ [ 0.125353] DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled()) [ 0.125369] WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:5521 check_flags+0x102/0x1b0 [ 0.126203] Modules linked in: [ 0.126395] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.14.0-rc1+ #31 [ 0.126779] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-4.fc34 04/01/2014 [ 0.127302] RIP: 0010:check_flags+0x102/0x1b0 [ 0.127565] Code: ff ff e8 a1 ff aa ff 85 c0 74 21 44 8b 0d 5e b0 bd 00 45 85 c9 75 15 48 c7 c6 78 73 2d 82 48 c7 c7 88 dd 2b 82 e8 b9 75 fb ff <0f> 0b 48 c7 c7 08 89 2d 82 e8 81 e6 fb ff eb 9e 85 c0 0f 85 42 ff [ 0.128670] RSP: 0000:ffffffff82403cb0 EFLAGS: 00010082 [ 0.128983] RAX: 000000000000002f RBX: 0000000000000000 RCX: 0000000000000000 [ 0.129409] RDX: 0000000000000003 RSI: 00000000ffffffea RDI: 00000000ffffffff [ 0.129888] RBP: 0000000000000001 R08: ffffffff825573c8 R09: 00000000ffffdfff [ 0.130318] R10: ffffffff824773e0 R11: ffffffff824773e0 R12: ffffffff82461bd8 [ 0.130741] R13: 0000000000000046 R14: 0000000000000000 R15: 0000000000000000 [ 0.131166] FS: 0000000000000000(0000) GS:ffff888233e00000(0000) knlGS:0000000000000000 [ 0.131649] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.131993] CR2: ffff88823ffff000 CR3: 0000000002424000 CR4: 00000000000406b0 [ 0.132420] Call Trace: [ 0.132572] lock_acquire.part.0+0x52/0x1f0 [ 0.132832] ? _raw_spin_unlock_irqrestore+0x55/0x70 [ 0.133134] ? rcu_read_lock_sched_held+0xa/0x70 [ 0.133419] ? lock_acquire+0xa0/0x140 [ 0.133647] ? mask_8259A_irq+0x14/0x60 [ 0.133883] _raw_spin_lock_irqsave+0x43/0x90 [ 0.134146] ? mask_8259A_irq+0x14/0x60 [ 0.134383] mask_8259A_irq+0x14/0x60 [ 0.134606] mp_irqdomain_alloc+0x1a7/0x260 [ 0.134862] __irq_domain_alloc_irqs+0x154/0x410 [ 0.135144] alloc_isa_irq_from_domain.constprop.0+0xa0/0xe0 [ 0.135486] mp_map_pin_to_irq+0x1a9/0x310 [ 0.135735] setup_IO_APIC+0x121/0x1d0 [ 0.135971] apic_intr_mode_init+0xff/0x105 [ 0.136224] x86_late_time_init+0x20/0x30 [ 0.136469] start_kernel+0x45f/0x4f8 [ 0.136692] secondary_startup_64_no_verify+0xb0/0xbb Signed-off-by: Philippe Gerum <[email protected]>
sys-oak
pushed a commit
that referenced
this issue
Sep 19, 2022
local_irq_save/restore() pairs should be replaced by local_irq_save_full() calls when pipelining, not hard_local_irq_save/restore(), so that lockdep does not complain about inconsistent irq state (the hard_* form does not invoke the trace_irq* API). This fixes this kind of splat at boot: [ 0.124134] Switched APIC routing to physical flat. [ 0.125066] ------------[ cut here ]------------ [ 0.125353] DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled()) [ 0.125369] WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:5521 check_flags+0x102/0x1b0 [ 0.126203] Modules linked in: [ 0.126395] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.14.0-rc1+ #31 [ 0.126779] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-4.fc34 04/01/2014 [ 0.127302] RIP: 0010:check_flags+0x102/0x1b0 [ 0.127565] Code: ff ff e8 a1 ff aa ff 85 c0 74 21 44 8b 0d 5e b0 bd 00 45 85 c9 75 15 48 c7 c6 78 73 2d 82 48 c7 c7 88 dd 2b 82 e8 b9 75 fb ff <0f> 0b 48 c7 c7 08 89 2d 82 e8 81 e6 fb ff eb 9e 85 c0 0f 85 42 ff [ 0.128670] RSP: 0000:ffffffff82403cb0 EFLAGS: 00010082 [ 0.128983] RAX: 000000000000002f RBX: 0000000000000000 RCX: 0000000000000000 [ 0.129409] RDX: 0000000000000003 RSI: 00000000ffffffea RDI: 00000000ffffffff [ 0.129888] RBP: 0000000000000001 R08: ffffffff825573c8 R09: 00000000ffffdfff [ 0.130318] R10: ffffffff824773e0 R11: ffffffff824773e0 R12: ffffffff82461bd8 [ 0.130741] R13: 0000000000000046 R14: 0000000000000000 R15: 0000000000000000 [ 0.131166] FS: 0000000000000000(0000) GS:ffff888233e00000(0000) knlGS:0000000000000000 [ 0.131649] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.131993] CR2: ffff88823ffff000 CR3: 0000000002424000 CR4: 00000000000406b0 [ 0.132420] Call Trace: [ 0.132572] lock_acquire.part.0+0x52/0x1f0 [ 0.132832] ? _raw_spin_unlock_irqrestore+0x55/0x70 [ 0.133134] ? rcu_read_lock_sched_held+0xa/0x70 [ 0.133419] ? lock_acquire+0xa0/0x140 [ 0.133647] ? mask_8259A_irq+0x14/0x60 [ 0.133883] _raw_spin_lock_irqsave+0x43/0x90 [ 0.134146] ? mask_8259A_irq+0x14/0x60 [ 0.134383] mask_8259A_irq+0x14/0x60 [ 0.134606] mp_irqdomain_alloc+0x1a7/0x260 [ 0.134862] __irq_domain_alloc_irqs+0x154/0x410 [ 0.135144] alloc_isa_irq_from_domain.constprop.0+0xa0/0xe0 [ 0.135486] mp_map_pin_to_irq+0x1a9/0x310 [ 0.135735] setup_IO_APIC+0x121/0x1d0 [ 0.135971] apic_intr_mode_init+0xff/0x105 [ 0.136224] x86_late_time_init+0x20/0x30 [ 0.136469] start_kernel+0x45f/0x4f8 [ 0.136692] secondary_startup_64_no_verify+0xb0/0xbb Signed-off-by: Philippe Gerum <[email protected]>
sys-oak
pushed a commit
that referenced
this issue
Sep 29, 2022
local_irq_save/restore() pairs should be replaced by local_irq_save_full() calls when pipelining, not hard_local_irq_save/restore(), so that lockdep does not complain about inconsistent irq state (the hard_* form does not invoke the trace_irq* API). This fixes this kind of splat at boot: [ 0.124134] Switched APIC routing to physical flat. [ 0.125066] ------------[ cut here ]------------ [ 0.125353] DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled()) [ 0.125369] WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:5521 check_flags+0x102/0x1b0 [ 0.126203] Modules linked in: [ 0.126395] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.14.0-rc1+ #31 [ 0.126779] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-4.fc34 04/01/2014 [ 0.127302] RIP: 0010:check_flags+0x102/0x1b0 [ 0.127565] Code: ff ff e8 a1 ff aa ff 85 c0 74 21 44 8b 0d 5e b0 bd 00 45 85 c9 75 15 48 c7 c6 78 73 2d 82 48 c7 c7 88 dd 2b 82 e8 b9 75 fb ff <0f> 0b 48 c7 c7 08 89 2d 82 e8 81 e6 fb ff eb 9e 85 c0 0f 85 42 ff [ 0.128670] RSP: 0000:ffffffff82403cb0 EFLAGS: 00010082 [ 0.128983] RAX: 000000000000002f RBX: 0000000000000000 RCX: 0000000000000000 [ 0.129409] RDX: 0000000000000003 RSI: 00000000ffffffea RDI: 00000000ffffffff [ 0.129888] RBP: 0000000000000001 R08: ffffffff825573c8 R09: 00000000ffffdfff [ 0.130318] R10: ffffffff824773e0 R11: ffffffff824773e0 R12: ffffffff82461bd8 [ 0.130741] R13: 0000000000000046 R14: 0000000000000000 R15: 0000000000000000 [ 0.131166] FS: 0000000000000000(0000) GS:ffff888233e00000(0000) knlGS:0000000000000000 [ 0.131649] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.131993] CR2: ffff88823ffff000 CR3: 0000000002424000 CR4: 00000000000406b0 [ 0.132420] Call Trace: [ 0.132572] lock_acquire.part.0+0x52/0x1f0 [ 0.132832] ? _raw_spin_unlock_irqrestore+0x55/0x70 [ 0.133134] ? rcu_read_lock_sched_held+0xa/0x70 [ 0.133419] ? lock_acquire+0xa0/0x140 [ 0.133647] ? mask_8259A_irq+0x14/0x60 [ 0.133883] _raw_spin_lock_irqsave+0x43/0x90 [ 0.134146] ? mask_8259A_irq+0x14/0x60 [ 0.134383] mask_8259A_irq+0x14/0x60 [ 0.134606] mp_irqdomain_alloc+0x1a7/0x260 [ 0.134862] __irq_domain_alloc_irqs+0x154/0x410 [ 0.135144] alloc_isa_irq_from_domain.constprop.0+0xa0/0xe0 [ 0.135486] mp_map_pin_to_irq+0x1a9/0x310 [ 0.135735] setup_IO_APIC+0x121/0x1d0 [ 0.135971] apic_intr_mode_init+0xff/0x105 [ 0.136224] x86_late_time_init+0x20/0x30 [ 0.136469] start_kernel+0x45f/0x4f8 [ 0.136692] secondary_startup_64_no_verify+0xb0/0xbb Signed-off-by: Philippe Gerum <[email protected]>
sys-oak
pushed a commit
that referenced
this issue
May 5, 2023
local_irq_save/restore() pairs should be replaced by local_irq_save_full() calls when pipelining, not hard_local_irq_save/restore(), so that lockdep does not complain about inconsistent irq state (the hard_* form does not invoke the trace_irq* API). This fixes this kind of splat at boot: [ 0.124134] Switched APIC routing to physical flat. [ 0.125066] ------------[ cut here ]------------ [ 0.125353] DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled()) [ 0.125369] WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:5521 check_flags+0x102/0x1b0 [ 0.126203] Modules linked in: [ 0.126395] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.14.0-rc1+ #31 [ 0.126779] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-4.fc34 04/01/2014 [ 0.127302] RIP: 0010:check_flags+0x102/0x1b0 [ 0.127565] Code: ff ff e8 a1 ff aa ff 85 c0 74 21 44 8b 0d 5e b0 bd 00 45 85 c9 75 15 48 c7 c6 78 73 2d 82 48 c7 c7 88 dd 2b 82 e8 b9 75 fb ff <0f> 0b 48 c7 c7 08 89 2d 82 e8 81 e6 fb ff eb 9e 85 c0 0f 85 42 ff [ 0.128670] RSP: 0000:ffffffff82403cb0 EFLAGS: 00010082 [ 0.128983] RAX: 000000000000002f RBX: 0000000000000000 RCX: 0000000000000000 [ 0.129409] RDX: 0000000000000003 RSI: 00000000ffffffea RDI: 00000000ffffffff [ 0.129888] RBP: 0000000000000001 R08: ffffffff825573c8 R09: 00000000ffffdfff [ 0.130318] R10: ffffffff824773e0 R11: ffffffff824773e0 R12: ffffffff82461bd8 [ 0.130741] R13: 0000000000000046 R14: 0000000000000000 R15: 0000000000000000 [ 0.131166] FS: 0000000000000000(0000) GS:ffff888233e00000(0000) knlGS:0000000000000000 [ 0.131649] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.131993] CR2: ffff88823ffff000 CR3: 0000000002424000 CR4: 00000000000406b0 [ 0.132420] Call Trace: [ 0.132572] lock_acquire.part.0+0x52/0x1f0 [ 0.132832] ? _raw_spin_unlock_irqrestore+0x55/0x70 [ 0.133134] ? rcu_read_lock_sched_held+0xa/0x70 [ 0.133419] ? lock_acquire+0xa0/0x140 [ 0.133647] ? mask_8259A_irq+0x14/0x60 [ 0.133883] _raw_spin_lock_irqsave+0x43/0x90 [ 0.134146] ? mask_8259A_irq+0x14/0x60 [ 0.134383] mask_8259A_irq+0x14/0x60 [ 0.134606] mp_irqdomain_alloc+0x1a7/0x260 [ 0.134862] __irq_domain_alloc_irqs+0x154/0x410 [ 0.135144] alloc_isa_irq_from_domain.constprop.0+0xa0/0xe0 [ 0.135486] mp_map_pin_to_irq+0x1a9/0x310 [ 0.135735] setup_IO_APIC+0x121/0x1d0 [ 0.135971] apic_intr_mode_init+0xff/0x105 [ 0.136224] x86_late_time_init+0x20/0x30 [ 0.136469] start_kernel+0x45f/0x4f8 [ 0.136692] secondary_startup_64_no_verify+0xb0/0xbb Signed-off-by: Philippe Gerum <[email protected]>
sys-oak
pushed a commit
that referenced
this issue
Mar 13, 2024
[ Upstream commit a7d6027 ] syzkaller reported an overflown write in arp_req_get(). [0] When ioctl(SIOCGARP) is issued, arp_req_get() looks up an neighbour entry and copies neigh->ha to struct arpreq.arp_ha.sa_data. The arp_ha here is struct sockaddr, not struct sockaddr_storage, so the sa_data buffer is just 14 bytes. In the splat below, 2 bytes are overflown to the next int field, arp_flags. We initialise the field just after the memcpy(), so it's not a problem. However, when dev->addr_len is greater than 22 (e.g. MAX_ADDR_LEN), arp_netmask is overwritten, which could be set as htonl(0xFFFFFFFFUL) in arp_ioctl() before calling arp_req_get(). To avoid the overflow, let's limit the max length of memcpy(). Note that commit b5f0de6 ("net: dev: Convert sa_data to flexible array in struct sockaddr") just silenced syzkaller. [0]: memcpy: detected field-spanning write (size 16) of single field "r->arp_ha.sa_data" at net/ipv4/arp.c:1128 (size 14) WARNING: CPU: 0 PID: 144638 at net/ipv4/arp.c:1128 arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Modules linked in: CPU: 0 PID: 144638 Comm: syz-executor.4 Not tainted 6.1.74 #31 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 RIP: 0010:arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Code: fd ff ff e8 41 42 de fb b9 0e 00 00 00 4c 89 fe 48 c7 c2 20 6d ab 87 48 c7 c7 80 6d ab 87 c6 05 25 af 72 04 01 e8 5f 8d ad fb <0f> 0b e9 6c fd ff ff e8 13 42 de fb be 03 00 00 00 4c 89 e7 e8 a6 RSP: 0018:ffffc900050b7998 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff88803a815000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff8641a44a RDI: 0000000000000001 RBP: ffffc900050b7a98 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 203a7970636d656d R12: ffff888039c54000 R13: 1ffff92000a16f37 R14: ffff88803a815084 R15: 0000000000000010 FS: 00007f172bf306c0(0000) GS:ffff88805aa00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f172b3569f0 CR3: 0000000057f12005 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> arp_ioctl+0x33f/0x4b0 net/ipv4/arp.c:1261 inet_ioctl+0x314/0x3a0 net/ipv4/af_inet.c:981 sock_do_ioctl+0xdf/0x260 net/socket.c:1204 sock_ioctl+0x3ef/0x650 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x18e/0x220 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x37/0x90 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x64/0xce RIP: 0033:0x7f172b262b8d Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f172bf300b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f172b3abf80 RCX: 00007f172b262b8d RDX: 0000000020000000 RSI: 0000000000008954 RDI: 0000000000000003 RBP: 00007f172b2d3493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f172b3abf80 R15: 00007f172bf10000 </TASK> Reported-by: syzkaller <[email protected]> Reported-by: Bjoern Doebel <[email protected]> Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
sys-oak
pushed a commit
that referenced
this issue
Mar 26, 2024
commit a7d6027 upstream. syzkaller reported an overflown write in arp_req_get(). [0] When ioctl(SIOCGARP) is issued, arp_req_get() looks up an neighbour entry and copies neigh->ha to struct arpreq.arp_ha.sa_data. The arp_ha here is struct sockaddr, not struct sockaddr_storage, so the sa_data buffer is just 14 bytes. In the splat below, 2 bytes are overflown to the next int field, arp_flags. We initialise the field just after the memcpy(), so it's not a problem. However, when dev->addr_len is greater than 22 (e.g. MAX_ADDR_LEN), arp_netmask is overwritten, which could be set as htonl(0xFFFFFFFFUL) in arp_ioctl() before calling arp_req_get(). To avoid the overflow, let's limit the max length of memcpy(). Note that commit b5f0de6 ("net: dev: Convert sa_data to flexible array in struct sockaddr") just silenced syzkaller. [0]: memcpy: detected field-spanning write (size 16) of single field "r->arp_ha.sa_data" at net/ipv4/arp.c:1128 (size 14) WARNING: CPU: 0 PID: 144638 at net/ipv4/arp.c:1128 arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Modules linked in: CPU: 0 PID: 144638 Comm: syz-executor.4 Not tainted 6.1.74 #31 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 RIP: 0010:arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Code: fd ff ff e8 41 42 de fb b9 0e 00 00 00 4c 89 fe 48 c7 c2 20 6d ab 87 48 c7 c7 80 6d ab 87 c6 05 25 af 72 04 01 e8 5f 8d ad fb <0f> 0b e9 6c fd ff ff e8 13 42 de fb be 03 00 00 00 4c 89 e7 e8 a6 RSP: 0018:ffffc900050b7998 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff88803a815000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff8641a44a RDI: 0000000000000001 RBP: ffffc900050b7a98 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 203a7970636d656d R12: ffff888039c54000 R13: 1ffff92000a16f37 R14: ffff88803a815084 R15: 0000000000000010 FS: 00007f172bf306c0(0000) GS:ffff88805aa00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f172b3569f0 CR3: 0000000057f12005 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> arp_ioctl+0x33f/0x4b0 net/ipv4/arp.c:1261 inet_ioctl+0x314/0x3a0 net/ipv4/af_inet.c:981 sock_do_ioctl+0xdf/0x260 net/socket.c:1204 sock_ioctl+0x3ef/0x650 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x18e/0x220 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x37/0x90 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x64/0xce RIP: 0033:0x7f172b262b8d Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f172bf300b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f172b3abf80 RCX: 00007f172b262b8d RDX: 0000000020000000 RSI: 0000000000008954 RDI: 0000000000000003 RBP: 00007f172b2d3493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f172b3abf80 R15: 00007f172bf10000 </TASK> Reported-by: syzkaller <[email protected]> Reported-by: Bjoern Doebel <[email protected]> Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
sys-oak
pushed a commit
that referenced
this issue
Jul 31, 2024
commit a7d6027 upstream. syzkaller reported an overflown write in arp_req_get(). [0] When ioctl(SIOCGARP) is issued, arp_req_get() looks up an neighbour entry and copies neigh->ha to struct arpreq.arp_ha.sa_data. The arp_ha here is struct sockaddr, not struct sockaddr_storage, so the sa_data buffer is just 14 bytes. In the splat below, 2 bytes are overflown to the next int field, arp_flags. We initialise the field just after the memcpy(), so it's not a problem. However, when dev->addr_len is greater than 22 (e.g. MAX_ADDR_LEN), arp_netmask is overwritten, which could be set as htonl(0xFFFFFFFFUL) in arp_ioctl() before calling arp_req_get(). To avoid the overflow, let's limit the max length of memcpy(). Note that commit b5f0de6 ("net: dev: Convert sa_data to flexible array in struct sockaddr") just silenced syzkaller. [0]: memcpy: detected field-spanning write (size 16) of single field "r->arp_ha.sa_data" at net/ipv4/arp.c:1128 (size 14) WARNING: CPU: 0 PID: 144638 at net/ipv4/arp.c:1128 arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Modules linked in: CPU: 0 PID: 144638 Comm: syz-executor.4 Not tainted 6.1.74 #31 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 RIP: 0010:arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Code: fd ff ff e8 41 42 de fb b9 0e 00 00 00 4c 89 fe 48 c7 c2 20 6d ab 87 48 c7 c7 80 6d ab 87 c6 05 25 af 72 04 01 e8 5f 8d ad fb <0f> 0b e9 6c fd ff ff e8 13 42 de fb be 03 00 00 00 4c 89 e7 e8 a6 RSP: 0018:ffffc900050b7998 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff88803a815000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff8641a44a RDI: 0000000000000001 RBP: ffffc900050b7a98 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 203a7970636d656d R12: ffff888039c54000 R13: 1ffff92000a16f37 R14: ffff88803a815084 R15: 0000000000000010 FS: 00007f172bf306c0(0000) GS:ffff88805aa00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f172b3569f0 CR3: 0000000057f12005 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> arp_ioctl+0x33f/0x4b0 net/ipv4/arp.c:1261 inet_ioctl+0x314/0x3a0 net/ipv4/af_inet.c:981 sock_do_ioctl+0xdf/0x260 net/socket.c:1204 sock_ioctl+0x3ef/0x650 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x18e/0x220 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x37/0x90 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x64/0xce RIP: 0033:0x7f172b262b8d Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f172bf300b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f172b3abf80 RCX: 00007f172b262b8d RDX: 0000000020000000 RSI: 0000000000008954 RDI: 0000000000000003 RBP: 00007f172b2d3493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f172b3abf80 R15: 00007f172bf10000 </TASK> Reported-by: syzkaller <[email protected]> Reported-by: Bjoern Doebel <[email protected]> Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, I tried to compile on a 5.18 kernel and got the following error:
my kernel is Linux bewardeb 5.18.0-trunk-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18-1~exp1 (2022-05-23) x86_64 GNU/Linux
cheers
The text was updated successfully, but these errors were encountered: