From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BAFEC433DB for ; Tue, 22 Dec 2020 22:08:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50B0622CB2 for ; Tue, 22 Dec 2020 22:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727693AbgLVWIJ (ORCPT ); Tue, 22 Dec 2020 17:08:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbgLVWII (ORCPT ); Tue, 22 Dec 2020 17:08:08 -0500 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D604C0613D3; Tue, 22 Dec 2020 14:07:28 -0800 (PST) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1krpoN-0001oG-Lf; Tue, 22 Dec 2020 23:07:19 +0100 Date: Tue, 22 Dec 2020 23:07:19 +0100 From: Florian Westphal To: Linus Torvalds Cc: syzbot , Andrew Morton , coreteam@netfilter.org, David Miller , Florian Westphal , Jakub Jelinek , Lai Jiangshan , Jozsef Kadlecsik , Jakub Kicinski , Linux Kernel Mailing List , Netdev , NetFilter , Pablo Neira Ayuso , Peter Zijlstra , syzkaller-bugs , Tejun Heo Subject: Re: kernel BUG at lib/string.c:LINE! (6) Message-ID: <20201222220719.GB9639@breakpoint.cc> References: <000000000000fcbe0705b70e9bd9@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Linus Torvalds wrote: > On Tue, Dec 22, 2020 at 6:44 AM syzbot > 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. > 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.