Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp343219rdf; Fri, 3 Nov 2023 02:18:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFF+t7X9fya6Jxfv7gb3f7wLCeJGQlOugjCDPyDurtImeAGR6+ZUi4qYTlQlrq/WDw3ZW9h X-Received: by 2002:a05:6870:2116:b0:1e9:a917:cf46 with SMTP id f22-20020a056870211600b001e9a917cf46mr23412284oae.19.1699003114845; Fri, 03 Nov 2023 02:18:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699003114; cv=none; d=google.com; s=arc-20160816; b=k5YGGSkIW6rh1fDgc+jv1QYtOT+yM3c6dLqLDZOViusDWjM+JHuhPOUyhQcP1nLzsG rW8yQZcGHPjM+mxMSYeTDYccgYzbH0O1V/iZCFp6JHk6RXR7JkZ9qzCjEfhcFZn6oE8Y eW2tIeajjH4+S6NK73QB5x8ZVo2zFpV13Ol5yyv4ElFineGO/d/8qbVU85xOuz6IpqSA uvuXimIvY/njXu9BGqSoEkY+eUjjF8e/FX9D3yo18ux5GKrKzyeQHsG3hNIQL8GETMs/ oqnhLkTeQVQToEO2temh95O43NurxbfpGgaQGFwcxxG7RzZr0sSIz3oRcnDxZStJq1l8 EZcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=PQhCnyNkW4mTUectLjGZkIyzCEQebNf7ZQ+vTviyj2Q=; fh=97fo5/K9QK2c61FgLyn0X1tSwTAlYcouGl3uoc0pSyI=; b=TvWXk8EuPLAtGV2L5a/N329bggdKPzlhBwICdsKGBywJMtZFAupoJo/Z7ITRuDmdBT C0ooN8TKPi/NushnpuYcvs/LZTZv2c6rg5isya2Rt56ImjT9IKzE6S5ZRr/A6XbTIH3R rkPAsUuXX02GOCfnkM68NPBDjwOkkzFMTiqUTik3dH/7tiRaj+EM2WzE5Cv6iVMe6G/J as8GEvr04JfeV5VB+AJcALm1yBJfzI99Gd4PLZ9sgQh7/bNZHXOruPtmuTZjyFNQbaaO XCTLwR3aKeWEs+zC0U8wQbyfN0xPVo8TDv1n89SecrdZwN4GCUYq6FKvYBA1fvaf/ybJ YKUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bc14-20020a656d8e000000b005b970288ac1si1252043pgb.190.2023.11.03.02.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 02:18:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 6C6D98266243; Fri, 3 Nov 2023 02:18:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346954AbjKCJS1 (ORCPT + 99 others); Fri, 3 Nov 2023 05:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346878AbjKCJSZ (ORCPT ); Fri, 3 Nov 2023 05:18:25 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:237:300::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58170DE; Fri, 3 Nov 2023 02:18:21 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1qyqJV-0004lH-Ne; Fri, 03 Nov 2023 10:18:01 +0100 Date: Fri, 3 Nov 2023 10:18:01 +0100 From: Florian Westphal To: Dan Carpenter Cc: Florian Westphal , Pablo Neira Ayuso , Jozsef Kadlecsik , "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, kernel-janitors@vger.kernel.org Subject: Re: [PATCH net] netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval() Message-ID: <20231103091801.GA8035@breakpoint.cc> References: <15fdceb5-2de5-4453-98b3-cfa9d486e8da@moroto.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15fdceb5-2de5-4453-98b3-cfa9d486e8da@moroto.mountain> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 03 Nov 2023 02:18:32 -0700 (PDT) Dan Carpenter wrote: > The problem is in nft_byteorder_eval() where we are iterating through a > loop and writing to dst[0], dst[1], dst[2] and so on... On each > iteration we are writing 8 bytes. But dst[] is an array of u32 so each > element only has space for 4 bytes. That means that every iteration > overwrites part of the previous element. > > I spotted this bug while reviewing commit caf3ef7468f7 ("netfilter: > nf_tables: prevent OOB access in nft_byteorder_eval") which is a related > issue. I think that the reason we have not detected this bug in testing > is that most of time we only write one element. LGTM, thanks Dan. We will route this via nf.git.