Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp782792rdb; Fri, 1 Sep 2023 04:16:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcWKbKHCviD8gthH4+ZmJsMONsBquSv/Tr5SJtE88WJh7tKGNXnzVgwJnfFCfyacz1lISD X-Received: by 2002:a17:906:74c3:b0:9a2:185b:5375 with SMTP id z3-20020a17090674c300b009a2185b5375mr1637073ejl.18.1693567002269; Fri, 01 Sep 2023 04:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693567002; cv=none; d=google.com; s=arc-20160816; b=FPXIrr2tu+eA4NJXPbLfmfT1E0slx6O8jtkCauDY003FfMnH0Sj6cNpVYeUkrbfEfM 8CpQnep7GRW2mmu61bFdkMF3/RgwQip26IXs2c+pJsXpqp3jMfcqFkdRtXQlaNqcIoxr Kl1HKh1KLt0UEUBT525KdIHUS4VKgBn8bd8KbScOLi3/Gk7o5QV8W+JDY++Wh/Z6fDjO ppsZE5k2cGHr+l3IQx5YPj0ok/31YAnDUitB1TIoSkTDF7XMufqWvnbSnpfXqkQq+BNx Be5/jQdm/mw0uDmu5NIMgyY8B01VRA8w1NyczjgIsHnoynA5NfDZkFDn/AL9tN7UMccg 40Qg== 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=y46mKbhIrkrVl5X+pb9bsdmkEMJZUdt/s0gZLC7Tv+8=; fh=mT8ciEIE0vNYjfqRVhwlA7kxeQRuGLzO2sdNZA6M+Uw=; b=wu2WlGMTXUvAMU9WHOhER3+c+fNa60h1Jj595Yf/iUQNy2R9IQhz+IL45qGLC5lnpr KlYNH4KQA29YhddHoHLx3yxHh0de2CayxfPU9Wsj2kX1RcYzzMU1iSEoe2Ok2VKD1T0m s0IRbb/0eLe7NzUYOJ/z9hCT4XY0drbxJ5FTxGIMRmpxdJvPcwZQNit8x6QnKCbj7OhN 4HX8N0yGKvjd7Mw5H8Zjph3kL/t2co9flhnCuTUlDm7I6pwUjr3MdVXIvVJ6ndFsvE8F M6dXSkNxrtP5hoEZZ/EWhraul3SekKUILLEmHQKPndS64ZiKN3EZt/IrzHI1EKrExE0q ez5A== 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 jx20-20020a170906ca5400b0099bd8bc3fa2si2308506ejb.530.2023.09.01.04.16.13; Fri, 01 Sep 2023 04:16:42 -0700 (PDT) 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 S232382AbjIAIPU (ORCPT + 99 others); Fri, 1 Sep 2023 04:15:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjIAIPT (ORCPT ); Fri, 1 Sep 2023 04:15:19 -0400 Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A6048F; Fri, 1 Sep 2023 01:15:16 -0700 (PDT) Received: from [78.30.34.192] (port=39840 helo=gnumonks.org) by ganesha.gnumonks.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qbzJ5-00AEiB-H4; Fri, 01 Sep 2023 10:15:10 +0200 Date: Fri, 1 Sep 2023 10:15:06 +0200 From: Pablo Neira Ayuso To: Jakub Kicinski Cc: joao@overdrivepizza.com, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kadlec@netfilter.org, fw@strlen.de, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, rkannoth@marvell.com, wojciech.drewek@intel.com, steen.hegenlund@microhip.com, keescook@chromium.org, Joao Moreira Subject: Re: [PATCH 0/2] Prevent potential write out of bounds Message-ID: References: <20230901010437.126631-1-joao@overdrivepizza.com> <20230831182800.25e5d4d9@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230831182800.25e5d4d9@kernel.org> X-Spam-Score: -1.9 (-) X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Thu, Aug 31, 2023 at 06:28:00PM -0700, Jakub Kicinski wrote: > On Thu, 31 Aug 2023 18:04:35 -0700 joao@overdrivepizza.com wrote: > > The function flow_rule_alloc in net/core/flow_offload.c [2] gets an > > unsigned int num_actions (line 10) and later traverses the actions in > > the rule (line 24) setting hw.stats to FLOW_ACTION_HW_STATS_DONT_CARE. > > > > Within the same file, the loop in the line 24 compares a signed int > > (i) to an unsigned int (num_actions), and then uses i as an array > > index. If an integer overflow happens, then the array within the loop > > is wrongly indexed, causing a write out of bounds. > > > > After checking with maintainers, it seems that the front-end caps the > > maximum value of num_action, thus it is not possible to reach the given > > write out of bounds, yet, still, to prevent disasters it is better to > > fix the signedness here. > > How did you find this? The commit messages should include info > about how the issue was discovered. This is net-next material IMO, none of the existing interfaces uses such a large number of actions for this to be an issue.