UBSAN: undefined-behaviour in hash_netiface_create

5 views
Skip to first unread message

syzbot

unread,
Sep 21, 2020, 3:38:23 PM9/21/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 015e94d0 Linux 4.19.146
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10f6929b900000
kernel config: https://syzkaller.appspot.com/x/.config?x=243dd74ad58a8a57
dashboard link: https://syzkaller.appspot.com/bug?extid=0934b11b500495c0f896
compiler: gcc (GCC) 10.1.0-syz 20200507

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+0934b1...@syzkaller.appspotmail.com

================================================================================
UBSAN: Undefined behaviour in net/netfilter/ipset/ip_set_hash_gen.h:125:6
shift exponent 32 is too large for 32-bit type 'unsigned int'
CPU: 0 PID: 1773 Comm: syz-executor.0 Not tainted 4.19.146-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x22c/0x33e lib/dump_stack.c:118
ubsan_epilogue+0xe/0x3a lib/ubsan.c:161
__ubsan_handle_shift_out_of_bounds.cold+0x1c4/0x250 lib/ubsan.c:422
htable_bits net/netfilter/ipset/ip_set_hash_gen.h:125 [inline]
hash_netiface_create.cold+0x1a/0x1f net/netfilter/ipset/ip_set_hash_gen.h:1290
ip_set_create+0x70e/0x1380 net/netfilter/ipset/ip_set_core.c:940
nfnetlink_rcv_msg+0xeff/0x1210 net/netfilter/nfnetlink.c:233
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2455
nfnetlink_rcv+0x1b2/0x41b net/netfilter/nfnetlink.c:565
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x717/0xcc0 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:622 [inline]
sock_sendmsg+0xc7/0x130 net/socket.c:632
___sys_sendmsg+0x7bb/0x8f0 net/socket.c:2115
__sys_sendmsg net/socket.c:2153 [inline]
__do_sys_sendmsg net/socket.c:2162 [inline]
__se_sys_sendmsg net/socket.c:2160 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2160
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45d5f9
Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fcce42e2c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000029680 RCX: 000000000045d5f9
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000008
RBP: 000000000118d020 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118cfec
R13: 00007ffe1b999d8f R14: 00007fcce42e39c0 R15: 000000000118cfec
================================================================================
syz-executor.0: vmalloc: allocation failure: 17179869200 bytes, mode:0x6080c0(GFP_KERNEL|__GFP_ZERO), nodemask=(null)
syz-executor.0 cpuset=/ mems_allowed=0-1
CPU: 0 PID: 1845 Comm: syz-executor.0 Not tainted 4.19.146-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x22c/0x33e lib/dump_stack.c:118
warn_alloc.cold+0x7b/0x18f mm/page_alloc.c:3456
__vmalloc_node_range mm/vmalloc.c:1775 [inline]
__vmalloc_node mm/vmalloc.c:1804 [inline]
__vmalloc_node_flags mm/vmalloc.c:1818 [inline]
vzalloc+0x15c/0x1a0 mm/vmalloc.c:1857
ip_set_alloc+0x54/0x70 net/netfilter/ipset/ip_set_core.c:265
hash_netiface_create+0x42d/0xa50 net/netfilter/ipset/ip_set_hash_gen.h:1296
ip_set_create+0x70e/0x1380 net/netfilter/ipset/ip_set_core.c:940
nfnetlink_rcv_msg+0xeff/0x1210 net/netfilter/nfnetlink.c:233
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2455
nfnetlink_rcv+0x1b2/0x41b net/netfilter/nfnetlink.c:565
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x717/0xcc0 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:622 [inline]
sock_sendmsg+0xc7/0x130 net/socket.c:632
___sys_sendmsg+0x7bb/0x8f0 net/socket.c:2115
__sys_sendmsg net/socket.c:2153 [inline]
__do_sys_sendmsg net/socket.c:2162 [inline]
__se_sys_sendmsg net/socket.c:2160 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2160
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45d5f9
Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fcce4303c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000029680 RCX: 000000000045d5f9
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000008
RBP: 000000000118cf80 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118cf4c
R13: 00007ffe1b999d8f R14: 00007fcce43049c0 R15: 000000000118cf4c
warn_alloc_show_mem: 1 callbacks suppressed
Mem-Info:
active_anon:104222 inactive_anon:12300 isolated_anon:0
active_file:2276 inactive_file:46094 isolated_file:0
unevictable:0 dirty:224 writeback:0 unstable:0
slab_reclaimable:16618 slab_unreclaimable:255749
mapped:64764 shmem:12484 pagetables:1080 bounce:0
free:1078560 free_pcp:466 free_cma:0
Node 0 active_anon:421388kB inactive_anon:49200kB active_file:9100kB inactive_file:184376kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:260256kB dirty:896kB writeback:0kB shmem:49936kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 141312kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes
Node 1 active_anon:0kB inactive_anon:0kB active_file:4kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 0kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes
netlink: 'syz-executor.1': attribute type 19 has an invalid length.
Node 0 DMA free:15812kB min:220kB low:272kB high:324kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
netlink: 'syz-executor.1': attribute type 19 has an invalid length.
lowmem_reserve[]: 0 2501 2503 2503 2503
Node 0 DMA32 free:517792kB min:35784kB low:44728kB high:53672kB active_anon:419800kB inactive_anon:49200kB active_file:9100kB inactive_file:184376kB unevictable:0kB writepending:896kB present:3129332kB managed:2564816kB mlocked:0kB kernel_stack:7680kB pagetables:4616kB bounce:0kB free_pcp:1776kB local_pcp:1144kB free_cma:0kB
lowmem_reserve[]: 0 0 2 2 2
Node 0 Normal free:12kB min:32kB low:40kB high:48kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:786432kB managed:2420kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
lowmem_reserve[]: 0 0 0 0 0
Node 1 Normal free:3778152kB min:54068kB low:67584kB high:81100kB active_anon:0kB inactive_anon:0kB active_file:4kB inactive_file:0kB unevictable:0kB writepending:0kB present:3932160kB managed:3870168kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
lowmem_reserve[]: 0 0 0 0 0
Node 0 DMA: 11*4kB (UE) 17*8kB (UE) 13*16kB (UE) 14*32kB (UE) 10*64kB (UE) 8*128kB (UE) 6*256kB (UE) 3*512kB (UE) 2*1024kB (UE) 2*2048kB (ME) 1*4096kB (U) = 15812kB
Node 0 DMA32: 3558*4kB (UME) 1117*8kB (UME) 1530*16kB (UMEH) 1931*32kB (UMEH) 727*64kB (UME) 358*128kB (UMEH) 211*256kB (UMEH) 120*512kB (UMH) 59*1024kB (UMH) 44*2048kB (UM) 13*4096kB (UM) = 521024kB
Node 0 Normal: 1*4kB (U) 1*8kB (U) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 12kB
Node 1 Normal: 74*4kB (UE) 376*8kB (UME) 298*16kB (UME) 61*32kB (U) 23*64kB (UME) 13*128kB (UME) 11*256kB (UM) 6*512kB (UME) 5*1024kB (UM) 3*2048kB (U) 915*4096kB (UM) = 3778152kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Node 1 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Node 1 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
21155 total pagecache pages
0 pages in swap cache
Swap cache stats: add 0, delete 0, find 0/0
Free swap = 0kB
Total swap = 0kB
1965979 pages RAM
0 pages HighMem/MovableOnly
352651 pages reserved
0 pages cma reserved
nla_parse: 64 callbacks suppressed
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 40 bytes leftover after parsing attributes in process `syz-executor.3'.
netlink: 20 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 20 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 40 bytes leftover after parsing attributes in process `syz-executor.3'.
netlink: 'syz-executor.0': attribute type 5 has an invalid length.
netlink: 'syz-executor.0': attribute type 5 has an invalid length.
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=1016 sclass=netlink_route_socket pid=2397 comm=syz-executor.1
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=1016 sclass=netlink_route_socket pid=2386 comm=syz-executor.1
Invalid UDP bearer configuration
Enabling of bearer <udp:syz1> rejected, failed to enable media
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=43 sclass=netlink_route_socket pid=2539 comm=syz-executor.1
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=43 sclass=netlink_route_socket pid=2571 comm=syz-executor.1
Invalid UDP bearer configuration
Enabling of bearer <udp:syz1> rejected, failed to enable media
audit: type=1800 audit(1600717047.086:26): pid=2620 uid=0 auid=0 ses=4 subj=system_u:system_r:kernel_t:s0 op=collect_data cause=failed(directio) comm="syz-executor.1" name="cgroup.controllers" dev="sda1" ino=16314 res=0
audit: type=1804 audit(1600717047.166:27): pid=2609 uid=0 auid=0 ses=4 subj=system_u:system_r:kernel_t:s0 op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir735973126/syzkaller.tgT8pz/1581/cgroup.controllers" dev="sda1" ino=16314 res=1
nla_parse: 105 callbacks suppressed
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor.3'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'.
netlink: 20 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.3'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'.
netlink: 36 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor.3'.


---
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 syzk...@googlegroups.com.

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

syzbot

unread,
Sep 21, 2020, 3:54:18 PM9/21/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 015e94d0 Linux 4.19.146
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=121b704b900000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=129c69ab900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12d43881900000

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

audit: type=1400 audit(1600717900.743:8): avc: denied { execmem } for pid=6475 comm="syz-executor477" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=1
================================================================================
UBSAN: Undefined behaviour in net/netfilter/ipset/ip_set_hash_gen.h:125:6
shift exponent 32 is too large for 32-bit type 'unsigned int'
CPU: 0 PID: 6475 Comm: syz-executor477 Not tainted 4.19.146-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x22c/0x33e lib/dump_stack.c:118
ubsan_epilogue+0xe/0x3a lib/ubsan.c:161
__ubsan_handle_shift_out_of_bounds.cold+0x1c4/0x250 lib/ubsan.c:422
htable_bits net/netfilter/ipset/ip_set_hash_gen.h:125 [inline]
hash_netiface_create.cold+0x1a/0x1f net/netfilter/ipset/ip_set_hash_gen.h:1290
ip_set_create+0x70e/0x1380 net/netfilter/ipset/ip_set_core.c:940
nfnetlink_rcv_msg+0xeff/0x1210 net/netfilter/nfnetlink.c:233
netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2455
nfnetlink_rcv+0x1b2/0x41b net/netfilter/nfnetlink.c:565
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x717/0xcc0 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:622 [inline]
sock_sendmsg+0xc7/0x130 net/socket.c:632
___sys_sendmsg+0x7bb/0x8f0 net/socket.c:2115
__sys_sendmsg net/socket.c:2153 [inline]
__do_sys_sendmsg net/socket.c:2162 [inline]
__se_sys_sendmsg net/socket.c:2160 [inline]
__x64_sys_sendmsg+0x132/0x220 net/socket.c:2160
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440429
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 0f 83 7b 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffe288bb6f8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000

Reply all
Reply to author
Forward
0 new messages