Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9853178rwl; Wed, 11 Jan 2023 10:52:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXvW8HOD/5Mjbs5lJsZTRzlnfsQ8KGm5Gy4Lkttt639SAqj+2qbp1Srnj5LlrK4apQSb4km/ X-Received: by 2002:a17:90b:344a:b0:219:20b4:9a0e with SMTP id lj10-20020a17090b344a00b0021920b49a0emr3509890pjb.24.1673463164631; Wed, 11 Jan 2023 10:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673463164; cv=none; d=google.com; s=arc-20160816; b=B3KW038nxJYGtgvqGH/LDob3xBX/DSn39aI4sP8ma5lsrlJkf6PnZ6AszNj1A7FV26 Qk2kdh2j3V7Rghv5I4FE1UUd+ycbCHLSW0LHTR94dxez/6YYBmQ91i51cp56zhgwauu7 ipvYAbpaa04n00RDEGZ2oad4tcFC3al3uVN7WvBpS+87vs8yaVPRTFKAxjl8Brmko1qV c4fStDMVANgn9wf/cEViYPsZjo8M2TfqZQ9U2fc6PBrb8RF7KrkyNdTRzZZZI+9v6NSJ RZko2XH4o7ryENXmdIdE453u1QfASzF814FW4kzCvib+FYJv4woQrG3aY+lmpIJ9fMVU ra/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=xO7pQyrtZHkSJWk7k5kJ+oE6CDi44wsAUoZ7Zf2iBjQ=; b=D4TFf8pYxUfRD2mi527a2gTTVwulUMF5Y7Ndk9nNDNnU1CbsKP+0n/X/R0uG2AkfXy b15Yf4tsEVHqtlUJi/dR7X14Vtoe96mIFugVgjYJOHDMfmNPVkLAI8dHIHu7ZgcI8X3L rtkOZEl78JYk4JEx5QA9Zn2mK0nAOYAZH1EHEmZDniRfYSS7x6kgcunEtr83Ihgt2Ich et+PcHS1Oxvk5z0LByT7aTEKG1ye0sY/KmxKwZCNLZoi7t0sMnIGnYFGIhcJSq4X+Lfx q4Ka93XpphohBJGSwXAtJUdXFh9SC9Pb9FBt0yJodv0LJXcsfqjrHNzuPrRJEdoq/E0Y dA2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a17090a800100b002134d2f9848si13972117pjn.9.2023.01.11.10.52.37; Wed, 11 Jan 2023 10:52:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232556AbjAKSKu (ORCPT + 51 others); Wed, 11 Jan 2023 13:10:50 -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: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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