Thread (8 messages) flat view 8 messages, 5 authors, 2020-12-27

Re: kernel BUG at lib/string.c:LINE! (6)

From: Florian Westphal <fw@strlen.de>
Date: 2020-12-22 22:08:25
Also in: lkml, netfilter-devel

Linus Torvalds [off-list ref] wrote:
On Tue, Dec 22, 2020 at 6:44 AM syzbot
[off-list ref] wrote:
quoted
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.
quoted
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.
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help