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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4737C433F5 for ; Wed, 18 May 2022 11:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235790AbiERLsL (ORCPT ); Wed, 18 May 2022 07:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235781AbiERLsL (ORCPT ); Wed, 18 May 2022 07:48:11 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 421BB179C19 for ; Wed, 18 May 2022 04:48:09 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1nrI9v-0000PD-CZ; Wed, 18 May 2022 13:48:07 +0200 Date: Wed, 18 May 2022 13:48:07 +0200 From: Florian Westphal To: Phil Sutter , Pablo Neira Ayuso , netfilter-devel@vger.kernel.org, fw@strlen.de Subject: Re: [PATCH] netfilter: nf_tables: restrict expression reduction to first expression Message-ID: <20220518114807.GE4316@breakpoint.cc> References: <20220518100842.1950-1-pablo@netfilter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Phil Sutter wrote: > > > | reduce = reduce && expr->ops->type->reduce; > > > > Could you elaborate? > > Well, an expression which may set verdict register to NFT_BREAK should > prevent reduction of later expressions in same rule as it may stop rule > evaluation at run-time. This is obvious for nft_cmp, but nft_meta is > also a candidate: NFT_META_IFTYPE causes NFT_BREAK if pkt->skb->dev is > NULL. The optimizer must not assume later expressions are evaluated. This all seems fragile to me, with huge potential to add subtle bugs that will be hard to track down.