WARNING in __proc_create

30 views
Skip to first unread message

syzbot

unread,
Mar 9, 2018, 4:59:02 PM3/9/18
to core...@netfilter.org, da...@davemloft.net, f...@strlen.de, kad...@blackhole.kfki.hu, linux-...@vger.kernel.org, net...@vger.kernel.org, netfilt...@vger.kernel.org, pa...@netfilter.org, syzkall...@googlegroups.com
Hello,

syzbot hit the following crash on net-next commit
617aebe6a97efa539cc4b8a52adccd89596e6be0 (Sun Feb 4 00:25:42 2018 +0000)
Merge tag 'usercopy-v4.16-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

So far this crash happened 12 times on net-next, upstream.
C reproducer is attached.
syzkaller reproducer is attached.
Raw console output is attached.
compiler: gcc (GCC) 7.1.1 20170620
.config is attached.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+0502b0...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

audit: type=1400 audit(1518223777.419:7): avc: denied { map } for
pid=4159 comm="syzkaller598581" path="/root/syzkaller598581546" dev="sda1"
ino=16481 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
------------[ cut here ]------------
name len 0
WARNING: CPU: 0 PID: 4159 at fs/proc/generic.c:354
__proc_create+0x696/0x880 fs/proc/generic.c:354
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 4159 Comm: syzkaller598581 Not tainted 4.15.0+ #221
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:53
panic+0x1e4/0x41c kernel/panic.c:183
__warn+0x1dc/0x200 kernel/panic.c:547
report_bug+0x211/0x2d0 lib/bug.c:184
fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178
fixup_bug arch/x86/kernel/traps.c:247 [inline]
do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:1097
RIP: 0010:__proc_create+0x696/0x880 fs/proc/generic.c:354
RSP: 0018:ffff8801d3167418 EFLAGS: 00010282
RAX: dffffc0000000008 RBX: 1ffff1003a62ce88 RCX: ffffffff815a57ae
RDX: 0000000000000000 RSI: 1ffff1003a62ce33 RDI: 1ffff1003a62ce08
RBP: ffff8801d3167588 R08: 1ffff1003a62cdca R09: 0000000000000000
R10: ffff8801d31672d0 R11: 0000000000000000 R12: ffff8801b1ee9a70
R13: ffff8801d3167560 R14: 0000000000000000 R15: ffff8801d3167520
proc_create_data+0x76/0x180 fs/proc/generic.c:488
htable_create net/netfilter/xt_hashlimit.c:333 [inline]
hashlimit_mt_check_common.isra.9+0xaee/0x1420
net/netfilter/xt_hashlimit.c:900
hashlimit_mt_check_v1+0x48d/0x640 net/netfilter/xt_hashlimit.c:926
xt_check_match+0x231/0x7d0 net/netfilter/x_tables.c:470
check_match net/ipv6/netfilter/ip6_tables.c:492 [inline]
find_check_match net/ipv6/netfilter/ip6_tables.c:509 [inline]
find_check_entry.isra.7+0x42d/0xcf0 net/ipv6/netfilter/ip6_tables.c:560
translate_table+0xf52/0x1690 net/ipv6/netfilter/ip6_tables.c:744
do_replace net/ipv6/netfilter/ip6_tables.c:1160 [inline]
do_ip6t_set_ctl+0x370/0x5f0 net/ipv6/netfilter/ip6_tables.c:1686
nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115
ipv6_setsockopt+0x10b/0x130 net/ipv6/ipv6_sockglue.c:927
rawv6_setsockopt+0x4a/0xf0 net/ipv6/raw.c:1060
sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2975
SYSC_setsockopt net/socket.c:1849 [inline]
SyS_setsockopt+0x189/0x360 net/socket.c:1828
entry_SYSCALL_64_fastpath+0x29/0xa0
RIP: 0033:0x441319
RSP: 002b:00007ffde3898248 EFLAGS: 00000203 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 0000000000441319
RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003
RBP: 00000000006cb018 R08: 00000000000005c8 R09: 0000000000000000
R10: 0000000020ee3a38 R11: 0000000000000203 R12: 0000000000402c40
R13: 0000000000402cd0 R14: 0000000000000000 R15: 0000000000000000
Dumping ftrace buffer:
(ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzk...@googlegroups.com.

syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is
merged
into any tree, please reply to this email with:
#syz fix: exact-commit-title
If you want to test a patch for this bug, please reply with:
#syz test: git://repo/address.git branch
and provide the patch inline or as an attachment.
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug
report.
Note: all commands must start from beginning of the line in the email body.
raw.log.txt
repro.syz.txt
repro.c.txt
config.txt

Cong Wang

unread,
Mar 9, 2018, 5:48:34 PM3/9/18
to syzbot, core...@netfilter.org, David Miller, Florian Westphal, Jozsef Kadlecsik, LKML, Linux Kernel Network Developers, netfilt...@vger.kernel.org, Pablo Neira Ayuso, syzkall...@googlegroups.com
We need to reject empty names.

Eric Dumazet

unread,
Mar 9, 2018, 5:56:10 PM3/9/18
to Cong Wang, syzbot, core...@netfilter.org, David Miller, Florian Westphal, Jozsef Kadlecsik, LKML, Linux Kernel Network Developers, netfilt...@vger.kernel.org, Pablo Neira Ayuso, syzkall...@googlegroups.com
I sent a patch a while back, but Pablo/Florian wanted more than that
simple fix.

We also need to filter special characters like '/'

Or maybe I am mixing with something else.

Eric Dumazet

unread,
Mar 9, 2018, 5:58:45 PM3/9/18
to Cong Wang, syzbot, core...@netfilter.org, David Miller, Florian Westphal, Jozsef Kadlecsik, LKML, Linux Kernel Network Developers, netfilt...@vger.kernel.org, Pablo Neira Ayuso, syzkall...@googlegroups.com


On 03/09/2018 02:56 PM, Eric Dumazet wrote:

>
> I sent a patch a while back, but Pablo/Florian wanted more than that
> simple fix.
>
> We also need to filter special characters like '/'
>
> Or maybe I am mixing with something else.

Yes, Florian mentioned that we also had to reject "." and ".."

Florian Westphal

unread,
Mar 9, 2018, 6:02:22 PM3/9/18
to Eric Dumazet, Cong Wang, syzbot, core...@netfilter.org, David Miller, Florian Westphal, Jozsef Kadlecsik, LKML, Linux Kernel Network Developers, netfilt...@vger.kernel.org, Pablo Neira Ayuso, syzkall...@googlegroups.com
Eric Dumazet <eric.d...@gmail.com> wrote:
> >>fs/proc/generic.c:354
> >
> >We need to reject empty names.
> >
>
> I sent a patch a while back, but Pablo/Florian wanted more than that simple
> fix.
>
> We also need to filter special characters like '/'
>
> Or maybe I am mixing with something else.

Argh, sorry, this fell off the truck it seems :(

I'll work on this tomorrow unless someone else does it today ;)

Cong Wang

unread,
Mar 9, 2018, 6:05:30 PM3/9/18
to Eric Dumazet, syzbot, core...@netfilter.org, David Miller, Florian Westphal, Jozsef Kadlecsik, LKML, Linux Kernel Network Developers, netfilt...@vger.kernel.org, Pablo Neira Ayuso, syzkall...@googlegroups.com
On Fri, Mar 9, 2018 at 2:58 PM, Eric Dumazet <eric.d...@gmail.com> wrote:
>
>
> On 03/09/2018 02:56 PM, Eric Dumazet wrote:
>
>>
>> I sent a patch a while back, but Pablo/Florian wanted more than that
>> simple fix.
>>
>> We also need to filter special characters like '/'

proc_create_data() itself accepts '/', so it must be xt_hashlimit doesn't
want it.

>>
>> Or maybe I am mixing with something else.
>
>
> Yes, Florian mentioned that we also had to reject "." and ".."
>

It could be, but looks like not as trivial as just strstr(".")?

BTW, the warning itself is all about empty names, so perhaps
it's better to fix them separately.

Florian Westphal

unread,
Mar 9, 2018, 6:19:11 PM3/9/18
to Cong Wang, Eric Dumazet, syzbot, core...@netfilter.org, David Miller, Florian Westphal, Jozsef Kadlecsik, LKML, Linux Kernel Network Developers, netfilt...@vger.kernel.org, Pablo Neira Ayuso, syzkall...@googlegroups.com
Cong Wang <xiyou.w...@gmail.com> wrote:
> On Fri, Mar 9, 2018 at 2:58 PM, Eric Dumazet <eric.d...@gmail.com> wrote:
> >
> >
> > On 03/09/2018 02:56 PM, Eric Dumazet wrote:
> >
> >>
> >> I sent a patch a while back, but Pablo/Florian wanted more than that
> >> simple fix.
> >>
> >> We also need to filter special characters like '/'
>
> proc_create_data() itself accepts '/', so it must be xt_hashlimit doesn't
> want it.

--hashimit-name / also triggers WARN for me.
. or .. "work", (no crash), but cause appearance of 2nd ./.. in
/proc/net/ipt_hashlimit , so I think its better to disallow that too.
Reply all
Reply to author
Forward
0 new messages