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 smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E479CCCA473 for ; Wed, 1 Jun 2022 15:26:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5AF294156F; Wed, 1 Jun 2022 15:26:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hlGXgSZwwL_6; Wed, 1 Jun 2022 15:26:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id EA7F341781; Wed, 1 Jun 2022 15:26:16 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id C88F91BF588 for ; Wed, 1 Jun 2022 15:26:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AB45440E08 for ; Wed, 1 Jun 2022 15:26:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7btjoAguIm7m for ; Wed, 1 Jun 2022 15:26:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by smtp2.osuosl.org (Postfix) with ESMTPS id AB2FA40578 for ; Wed, 1 Jun 2022 15:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654097172; x=1685633172; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=Zq18k1wXu7TLaWYFif4QTWb20oYIYjwB9mDMAFjel7c=; b=BGVYID42DQvo4o1pOSovenj66XCLPssyhhePuD0Q/jZpDp/znpkm0kA4 Nq1TxmlNtiBWgnFl+bE9yfxMf5ggYiMER9HFyMwLJHF7bRgvD9O3YTCBo CVDiKblA8Dt5rIADkoXr8nlM4728xZILiCXQ7ySm5mhmCJ+XISx7m3ijP t3YXonBXoSqM8K2kjQFjXbRzK4rGTLZ+9jhJXR9Oy1P25hqknqT9h0aJt QRmRHOxA69GvFbtahRCVkWeRTtknpEUeRl8ogkqaJzhM2W/PoKg7Bt39F YwN01KTLzoIK8GQYIZ4gHX9DwIh8VhlWrd41zatUpPnjT0sNz6n/ZuYb5 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10365"; a="274428344" X-IronPort-AV: E=Sophos;i="5.91,268,1647327600"; d="scan'208";a="274428344" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2022 08:26:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,268,1647327600"; d="scan'208";a="667474818" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by FMSMGA003.fm.intel.com with ESMTP; 01 Jun 2022 08:26:11 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 1 Jun 2022 08:26:10 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 1 Jun 2022 08:26:10 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 1 Jun 2022 08:26:10 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.108) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 1 Jun 2022 08:26:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LCPdS6G8MrCplprZeOEV/8zkfco4TH7mnu94ft09g5fCHjlX0jTrNMFnXIa4XkXnw1qyK5/TCFjjomGftdVmnEBDrNM9DmuCF0Eu+QfCGt/BC3fbdrPkDXPVP17z4uDhxMBGzgPhn22UjQ23rJVOVCX+HAmHnU8RDmlLIDA4+HkdlvNexZKUUDFIMQZVkhZHJ7C4I9Y6gXwLJ+FlzLDYM1mgbzl6nR3c9gZA3F4mvULM5GBUpRO7Nm+zf3wk6/mdJ42BKSFv/tDnkf7YbeLn1UY/RQBnrKz8V0WKcOph64ckmlv4UM03s3OXGaOVJy3Ya20w9QHo/RW3uuQIGpzk7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8FSm4geWnfeVTRt8z4UhyXDY3RC22o1NrAtAAfPJRnE=; b=KxIhqheH4XsE/vhYv4CL0e3k/sotkcyqdPOalTjB978pOz6fMUjQj0lOU+eky6l2NVNtPfx26LVH9+qJhJfyqubPNcPeul/y93Cao3W9IF4A5KB86qOVssKgKd2DM7Wj4lL+MkajO0vjUt1Vvq/6BBKf+oq2k6RbQtWxwHl9XLi0H+1OrGeDi/CdoiI7LaqHaoBxrIBglYKGicRIFvSHZyyi2TYXrrhtu/B0mnWfHH8eBRNKXvlvL7l2+DDVpX94aPQQkiqchVBnxLgnPM4t1lEtp8oI4uqVEgM6EIv808NeHB0ruNfj9SiFMbOgDHDucx0LkUn9wHrf1wrivpZkLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SN6PR11MB3229.namprd11.prod.outlook.com (2603:10b6:805:ba::28) by BL0PR11MB3345.namprd11.prod.outlook.com (2603:10b6:208:6f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Wed, 1 Jun 2022 15:26:06 +0000 Received: from SN6PR11MB3229.namprd11.prod.outlook.com ([fe80::317d:11f9:2381:a3a3]) by SN6PR11MB3229.namprd11.prod.outlook.com ([fe80::317d:11f9:2381:a3a3%6]) with mapi id 15.20.5293.019; Wed, 1 Jun 2022 15:26:06 +0000 Message-ID: <96a94d61-6fec-7df7-4358-8e16a3e9b46f@intel.com> Date: Wed, 1 Jun 2022 08:26:02 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Content-Language: en-US To: Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni References: <20220601105924.2841410-1-alexandr.lobakin@intel.com> From: Tony Nguyen In-Reply-To: <20220601105924.2841410-1-alexandr.lobakin@intel.com> X-ClientProxiedBy: MW2PR16CA0017.namprd16.prod.outlook.com (2603:10b6:907::30) To SN6PR11MB3229.namprd11.prod.outlook.com (2603:10b6:805:ba::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69088f51-b6ee-4910-b8c6-08da43e30bef X-MS-TrafficTypeDiagnostic: BL0PR11MB3345:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dU50pVsl9VvxAjHf0v2B0l9d8KVtIRxMpOGCG10M933gZaYNd+bAGSXTfS46sgVs7+0Ee+oaP7f67Tw0H2ec/Bip4TAG4qjQ+ke++AJ36kgD5Zggwwfo8TbsM2apCxwIi9j/d78xRgwNKIxCM3wGXg3fqntw72NjL1SY7vibN8P6NKqd57KsSWQgWov9FlifigDX7N8/GFiB3gZpreRAIPIqRk7tXIFRm91ZGAoxLBYrSIc9XnxK23O7QuacdfUMV9AYbbyGGVXJzR4NhSHTkM3/kAOrJRO8TTTxrF7mypmcwDuV5b7O4+WBzQrepDQrCemGuH3nhl72WSH2w71TVWx8qHDBsLsT9T497bfAkbVcnkMAdG9DvqWyz/kAioNfy9UOMeDpC7wgFJSRacfPvP+p8P3iqSxdmQjMGReelN6otV/QWuCZ1XUMPjWMP7uEeIpm4LCYxI/kmm39GN7IfUp7sLxzvsdy47ShoMXUzzATKbupUKmNpvqTQJJ4pLVgQcDFZDAj2P12Z6h/wVK0kiJdgxzPcl6SVVysdwr1AfRHnlKMS7akUbkOeZYRLibu/tvruUjwONCc5r770xZi3gYWfPowd8lg0HjopBpzqe5mu87NziFG18rqfOBafhzhYKp0O6xb75u62Ja1AutaZdtIK3gEBcnvjunvyyAgtr4GbC5VsiUHjQZ4E6Ej3xYtdsB0plaMfbD8sVAQm3lpqkmP7lREWx3XYKQ2KPAaZvo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3229.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(26005)(31686004)(6512007)(6666004)(53546011)(6506007)(31696002)(2906002)(508600001)(83380400001)(6486002)(316002)(86362001)(54906003)(36756003)(5660300002)(66946007)(38100700002)(66556008)(66476007)(82960400001)(8936002)(4326008)(8676002)(2616005)(186003)(110136005)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?a0lwR3greGUwdlpRS01yUnM2eW5tV1BmRGhVL2lpUlZnVVV5aWZCNVYyZXpH?= =?utf-8?B?WDd3N0Qyc3o2K1B3V1ZOMEN5akx4U0c0RVU4N2s5Q3piNnlnOTQzcFdUMWpJ?= =?utf-8?B?RHErQkVzS1hwUk1McXprSFZsbisrWmVNeitvSGp0Z3hzdlUrQWxLQ1d1dVNK?= =?utf-8?B?alBpTFFWUUptOGJIUkx1bXRpMFBLcXVBZVcyNER4TDRTdXREOGRqTGVIWWZl?= =?utf-8?B?dndtV1YrRW1BS0twY0ptQ0JJdlc1S1cwdUxVR1JyNWlzbVpRSG5UR2cyRC9n?= =?utf-8?B?NzdmZlNrSktkbWR0aEIycGdsRDlZSjJjWi9PNXRPdzBCeHpiUStkZFlqaExY?= =?utf-8?B?VU1JSDdsK0VuanJOTFJOZFdWUldRbG41TlI2UzhNbGthYWtHR1lLa1JBTStv?= =?utf-8?B?V1lFTDQ2ZXp4N0lPL3didVNBNjRaZytEWVU1WUVjeXNGdzRCU3c0RXlFTVd4?= =?utf-8?B?RmtqWWNhNWZLMnNpc2d5UGZMUDhZSm5uK1BLK1V5M1V6OFd3a3VSb295YUVy?= =?utf-8?B?WEJBbnJUbmY5UldyNjVKWWZzVTFCd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-Exchange-CrossTenant-Network-Message-Id: 69088f51-b6ee-4910-b8c6-08da43e30bef X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB3229.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 15:26:06.5587 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: igy8MQh5g/G4vNh9gml6+WfS3tQdGMEYfZ/ZyQ4Iu6ardG7unYVC3ZABhmxvMM2IO3md81+oQIOBjMupB7wx4YBC1R9k07FsLY1fHbxJ/IY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3345 X-OriginatorOrg: intel.com Subject: Re: [Intel-wired-lan] [PATCH net] ice: fix access-beyond-end in the switch code X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martyna Szapar-Mudlaw , netdev@vger.kernel.org, Bruce Allan , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Jeff Kirsher Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On 6/1/2022 3:59 AM, Alexander Lobakin wrote: > Global `-Warray-bounds` enablement revealed some problems, one of > which is the way we define and use AQC rules messages. > In fact, they have a shared header, followed by the actual message, > which can be of one of several different formats. So it is > straightforward enough to define that header as a separate struct > and then embed it into message structures as needed, but currently > all the formats reside in one union coupled with the header. Then, > the code allocates only the memory needed for a particular message > format, leaving the union potentially incomplete. > There are no actual reads or writes beyond the end of an allocated > chunk, but at the same time, the whole implementation is fragile and > backed by an equilibrium rather than strong type and memory checks. > > Define the structures the other way around: one for the common > header and the rest for the actual formats with the header embedded. > There are no places where several union members would be used at the > same time anyway. This allows to use proper struct_size() and let > the compiler know what is going to be done. > Finally, unsilence `-Warray-bounds` back for ice_switch.c. > > Other little things worth mentioning: > * &ice_sw_rule_vsi_list_query is not used anywhere, remove it. It's > weird anyway to talk to hardware with purely kernel types > (bitmaps); > * expand the ICE_SW_RULE_*_SIZE() macros to pass a structure > variable name to struct_size() to let it do strict typechecking; > * rename ice_sw_rule_lkup_rx_tx::hdr to ::hdr_data to keep ::hdr > for the header structure to have the same name for it constistenly > everywhere; > * drop the duplicate of %ICE_SW_RULE_RX_TX_NO_HDR_SIZE residing in > ice_switch.h. > > Fixes: 9daf8208dd4d ("ice: Add support for switch filter programming") > Fixes: 66486d8943ba ("ice: replace single-element array used for C struct hack") > Signed-off-by: Alexander Lobakin > Reviewed-by: Marcin Szycik > --- > To Tony: I'd like this to hit RC1 or RC2, so would it be okay to pass > through -net directly? Or via some quick pull request would work too > I guess :) LGTM. I'm okay with it going to net directly. Acked-by: Tony Nguyen _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan