netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Florian Westphal <fw@strlen.de>, syzkaller <syzkaller@googlegroups.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	syzbot <syzbot+e86f7c428c8c50db65b4@syzkaller.appspotmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	coreteam@netfilter.org, David Miller <davem@davemloft.net>,
	Jakub Jelinek <jakub@redhat.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>,
	NetFilter <netfilter-devel@vger.kernel.org>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Peter Zijlstra <peterz@infradead.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	Tejun Heo <tj@kernel.org>
Subject: Re: kernel BUG at lib/string.c:LINE! (6)
Date: Wed, 23 Dec 2020 12:25:23 +0100	[thread overview]
Message-ID: <CACT4Y+Z65uJgMETo-rpu0HbvbSOBRqO0+606UsvdGN=AxNQD+Q@mail.gmail.com> (raw)
In-Reply-To: <20201222220719.GB9639@breakpoint.cc>

On Tue, Dec 22, 2020 at 11:07 PM Florian Westphal <fw@strlen.de> wrote:
>
> Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > On Tue, Dec 22, 2020 at 6:44 AM syzbot
> > <syzbot+e86f7c428c8c50db65b4@syzkaller.appspotmail.com> wrote:
> > >
> > > The issue was bisected to:
> > >
> > > commit 2f78788b55ba ("ilog2: improve ilog2 for constant arguments")
> >
> > That looks unlikely, although possibly some constant folding
> > improvement might make the fortify code notice something with it.
> >
> > > detected buffer overflow in strlen
> > > ------------[ cut here ]------------
> > > kernel BUG at lib/string.c:1149!
> > > Call Trace:
> > >  strlen include/linux/string.h:325 [inline]
> > >  strlcpy include/linux/string.h:348 [inline]
> > >  xt_rateest_tg_checkentry+0x2a5/0x6b0 net/netfilter/xt_RATEEST.c:143
> >
> > Honestly, this just looks like the traditional bug in "strlcpy()".
>
> Yes, thats exactly what this is, no idea why the bisection points
> at ilog2 changes.

The end result is usually clear from the bisection log:

> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=1584f137500000

In this case it looks like the most common cause of diverted bisection
-- interference from other kernel bugs, this __queue_work issue that
happened on ilog2 commit:

[03f4935135b9efeb780b970ba023c201f81cf4e6] checkpatch: fix unescaped left brace
testing commit 03f4935135b9efeb780b970ba023c201f81cf4e6 with gcc (GCC) 8.1.0
all runs: crashed: kernel BUG at lib/string.c:LINE!
# git bisect bad 03f4935135b9efeb780b970ba023c201f81cf4e6

Bisecting: 21 revisions left to test after this (roughly 5 steps)
[2f78788b55baa3410b1ec91a576286abe1ad4d6a] ilog2: improve ilog2 for
constant arguments
testing commit 2f78788b55baa3410b1ec91a576286abe1ad4d6a with gcc (GCC) 8.1.0
run #0: crashed: WARNING in __queue_work
# git bisect bad 2f78788b55baa3410b1ec91a576286abe1ad4d6a




> > That BSD function is complete garbage, exactly because it doesn't
> > limit the source length. People tend to _think_ it does ("what's that
> > size_t argument for?") but strlcpy() only limits the *destination*
> > size, and the source is always read fully.
>
> Right, I'll send a patch shortly.

  reply	other threads:[~2020-12-23 11:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 14:44 kernel BUG at lib/string.c:LINE! (6) syzbot
2020-12-22 22:01 ` Linus Torvalds
2020-12-22 22:07   ` Florian Westphal
2020-12-23 11:25     ` Dmitry Vyukov [this message]
2020-12-22 22:23 ` [PATCH nf] netfilter: xt_RATEEST: reject non-null terminated string from userspace Florian Westphal
2020-12-22 22:29   ` Linus Torvalds
2020-12-22 22:50     ` Florian Westphal
2020-12-27 10:53   ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACT4Y+Z65uJgMETo-rpu0HbvbSOBRqO0+606UsvdGN=AxNQD+Q@mail.gmail.com' \
    --to=dvyukov@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=jakub@redhat.com \
    --cc=jiangshanlai@gmail.com \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=peterz@infradead.org \
    --cc=syzbot+e86f7c428c8c50db65b4@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=syzkaller@googlegroups.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).