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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F8A6C5479D for ; Wed, 11 Jan 2023 18:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235478AbjAKSKt (ORCPT ); Wed, 11 Jan 2023 13:10:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235547AbjAKSKl (ORCPT ); Wed, 11 Jan 2023 13:10:41 -0500 Received: from mail.netfilter.org (mail.netfilter.org [217.70.188.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 323B31C939; Wed, 11 Jan 2023 10:10:39 -0800 (PST) Date: Wed, 11 Jan 2023 19:10:35 +0100 From: Pablo Neira Ayuso To: Simon Horman Cc: Gavrilov Ilia , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "netfilter-devel@vger.kernel.org" , "coreteam@netfilter.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" Subject: Re: [PATCH v2] netfilter: ipset: Fix overflow before widen in the bitmap_ip_create() function. Message-ID: References: <20230111115741.3347031-1-Ilia.Gavrilov@infotecs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jan 11, 2023 at 01:00:53PM +0100, Simon Horman wrote: > On Wed, Jan 11, 2023 at 11:57:39AM +0000, Gavrilov Ilia wrote: > > [You don't often get email from ilia.gavrilov@infotecs.ru. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > > > When first_ip is 0, last_ip is 0xFFFFFFFF, and netmask is 31, the value of > > an arithmetic expression 2 << (netmask - mask_bits - 1) is subject > > to overflow due to a failure casting operands to a larger data type > > before performing the arithmetic. > > > > Note that it's harmless since the value will be checked at the next step. > > > > Found by InfoTeCS on behalf of Linux Verification Center > > (linuxtesting.org) with SVACE. > > > > Fixes: b9fed748185a ("netfilter: ipset: Check and reject crazy /0 input parameters") > > Signed-off-by: Ilia.Gavrilov > > Reviewed-by: Simon Horman Applied, thanks