Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3035125ybe; Sun, 8 Sep 2019 05:53:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyj9992Xh7sPw8yDk2Y6JyDWQSgCqsazqcNoPBAeJr3rbBSPRZO8gRfUaqcGLKxbu30ezLT X-Received: by 2002:a17:906:d922:: with SMTP id rn2mr14971499ejb.169.1567947238245; Sun, 08 Sep 2019 05:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567947238; cv=none; d=google.com; s=arc-20160816; b=sm3ca6eioDLlRd0TFAqNBsIn2vZjajsa+emo/5XBdxeOtXJgF88JhIjYPX726O4CFW lTFeVMNELoVj6+2diOM1jawpdCiCdurfjjTOlmadT9aACxwwOzp35DK9tucDfBhKtgSJ ehsHCvNEN2qTNACo8btmxgFk5sZ4S9I7SzEWUdRkComX9sPvvnL6NRiMiv80IeQAqkCW B4PD72KNB5vFOvAI2UkiEmUbrE1wdn0+ncg07IQFjCDIfS0fhabDJmUclNQosuxt24wv g7mMO9gwTnIuPmt8nC0EIgs+P0vG3FRkjM/T5vhiIvSqTkFphSxwSvaM/ixGldWzR7RR Yn3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=wnT2gaFZc0jqhDgRrPa0oUwOWW0QAMg3FoBpT0uWeaQ=; b=Y/p7K5uBxYVgLfNJZpJ04KYThMfxlI/XiHPLxFNvGD4mHcM2uJH5vseHmzAYbd3d4z 3USKXLQKHfb5P8IS8bkCda+cjUbm43KI7j/qJWStb5ADeS/92sCCNIHU7yoiNYdpES7u E44knjj8IOTSTCORrLp0j4mnWhptV9O+j3qu5rb+o43m1H22QVRucCfm9KvnpLwXf3Vy ba1vTTr0Cn9hMWT2R4whvvog38O4seLiprcpVsF3A6OSXm5G119ZVTLj7Yd4zv2JI3Rj vrKeq0zhIPzCcYqPrLwXQQgXC3jEHUEgFNQiFqmXVxck6LYiL78jhkBV0Eq0+ojvi77T fDJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p32si7517004edc.259.2019.09.08.05.53.34; Sun, 08 Sep 2019 05:53:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389909AbfIGSIB (ORCPT + 99 others); Sat, 7 Sep 2019 14:08:01 -0400 Received: from correo.us.es ([193.147.175.20]:40076 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730739AbfIGSIB (ORCPT ); Sat, 7 Sep 2019 14:08:01 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 34E2511EB2B for ; Sat, 7 Sep 2019 20:07:55 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 1FA05FF6EC for ; Sat, 7 Sep 2019 20:07:55 +0200 (CEST) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id 12522FF6DE; Sat, 7 Sep 2019 20:07:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id C82DAB8004; Sat, 7 Sep 2019 20:07:52 +0200 (CEST) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Sat, 07 Sep 2019 20:07:52 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from us.es (sys.soleta.eu [212.170.55.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 1984lsi) by entrada.int (Postfix) with ESMTPSA id 99FD04265A5A; Sat, 7 Sep 2019 20:07:52 +0200 (CEST) Date: Sat, 7 Sep 2019 20:07:54 +0200 X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: Arnd Bergmann Cc: Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Jakub Kicinski , wenxu , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] netfilter: nf_tables: avoid excessive stack usage Message-ID: <20190907180754.dz7gstqfj7djlbrs@salvia> References: <20190906151242.1115282-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="lclypf5uqwm62nbj" Content-Disposition: inline In-Reply-To: <20190906151242.1115282-1-arnd@arndb.de> User-Agent: NeoMutt/20170113 (1.7.2) X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --lclypf5uqwm62nbj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Arnd, On Fri, Sep 06, 2019 at 05:12:30PM +0200, Arnd Bergmann wrote: > The nft_offload_ctx structure is much too large to put on the > stack: > > net/netfilter/nf_tables_offload.c:31:23: error: stack frame size of 1200 bytes in function 'nft_flow_rule_create' [-Werror,-Wframe-larger-than=] > > Use dynamic allocation here, as we do elsewhere in the same > function. > > Fixes: c9626a2cbdb2 ("netfilter: nf_tables: add hardware offload support") > Signed-off-by: Arnd Bergmann > --- > Since we only really care about two members of the structure, an > alternative would be a larger rewrite, but that is probably too > late for v5.4. Thanks for this patch. I'm attaching a patch to reduce this structure size a bit. Do you think this alternative patch is ok until this alternative rewrite happens? Anyway I agree we should to get this structure away from the stack, even after this is still large, so your patch (or a variant of it) will be useful sooner than later I think. --lclypf5uqwm62nbj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="x.patch" diff --git a/include/net/netfilter/nf_tables_offload.h b/include/net/netfilter/nf_tables_offload.h index db104665a9e4..cc44d29e9fd7 100644 --- a/include/net/netfilter/nf_tables_offload.h +++ b/include/net/netfilter/nf_tables_offload.h @@ -5,10 +5,10 @@ #include struct nft_offload_reg { - u32 key; - u32 len; - u32 base_offset; - u32 offset; + u8 key; + u8 len; + u8 base_offset; + u8 offset; struct nft_data data; struct nft_data mask; }; --lclypf5uqwm62nbj--