Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6567889ybx; Mon, 11 Nov 2019 11:05:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwOt0C6aLeWiqgop1bn4Q3re+c3CBbOZhGLo3AbatasAqVjJTBTtLu8nDabZ2nmCeq6khPf X-Received: by 2002:a50:bac2:: with SMTP id x60mr27588728ede.114.1573499121517; Mon, 11 Nov 2019 11:05:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573499121; cv=none; d=google.com; s=arc-20160816; b=zLqou+FQCJaCV3wVrv3+RlzLiiybm79B9JNXsIp3o43WU0cwWS51L3a6aPDqyBdCOH /B9WKzJ/dZ2jeHvX1ye1UTCRCseGzMdLnm/DDVNU5s3t4E8YqSnJLEYe7ch05sBH7A+h Oda36/bC+Tmpm+SrkUX+H+vNvCFAAUHZ5iwgBxtrTj9bkX+3E4u3nKpzfwQ8/Ue3LHf/ s81ZSyF7JLW3pDhlKBl29LpuOKgdNlacwYVuvMNiSm1ngVcCZjVY7PlABkviHqsb4TYZ 0oQr+JAvnpqAuuD0/LbcqhGTJ+hQxNsem8f7FWi5WdiYXIr+IKSUyTXK1lMrsSGc3e3b eb3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wakGU9CP6ud7hE42aOO+R4RWx70t5NkKPOPhw5/nFYE=; b=zwNvQgFOb2AsGw2SFZQLcLPiRqCzO4Hw9P5W5sMb27h7OrZtNiS2BFi1ceFPkJTjI2 fT720aJIzUo0Jsw5nNh11OPI18pnsA1v0Oxiws6b7bDN3Wlusr2zjFw6dXyBQwINB2wI DRJzysrEL06WW007AofAv7YjeJc4PwZnxUCqN6g16Yxly2j0yASh5MKSrX1SSTC4hx54 mdatpKUAihxTPyeenC1xfzekYOdw8C3gWTAHhZsE8GTdZmC+o3/GjIHSDiP6PlJhRf0c dkw6Z5CZ5D4hsrDrtu6crjGUkWvHjdtETt316bZa2NYFZPqWmOlrp0xDbKZfcpjICFMd kaUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QM+S8LUO; 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 o48si12268285edc.151.2019.11.11.11.04.52; Mon, 11 Nov 2019 11:05:21 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=QM+S8LUO; 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 S1730197AbfKKSuz (ORCPT + 99 others); Mon, 11 Nov 2019 13:50:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:44772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730372AbfKKSuv (ORCPT ); Mon, 11 Nov 2019 13:50:51 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 534A7214E0; Mon, 11 Nov 2019 18:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573498250; bh=AxjSEsBuqLMR7CGO0L2PJe8Z58LIy3vQxJ+3lq10mw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QM+S8LUO0es9TxyGUoIlElFHgCPi52BMHJO5aQqyAZ8X6OSNw+UYAGtbayo+ypkel CQ3agWQeSFTd9Lvr516LNaIm0HpZk/iGx6hGqsY3cesCVzs31KKvQHMFZ0/ZWxSy8/ FbUcGmOJfVYw3IQWwL1i+QIRS/kSDpm/sWpCfynY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Pablo Neira Ayuso Subject: [PATCH 5.3 064/193] netfilter: nf_tables: Align nft_expr private data to 64-bit Date: Mon, 11 Nov 2019 19:27:26 +0100 Message-Id: <20191111181505.729127861@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181459.850623879@linuxfoundation.org> References: <20191111181459.850623879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukas Wunner commit 250367c59e6ba0d79d702a059712d66edacd4a1a upstream. Invoking the following commands on a 32-bit architecture with strict alignment requirements (such as an ARMv7-based Raspberry Pi) results in an alignment exception: # nft add table ip test-ip4 # nft add chain ip test-ip4 output { type filter hook output priority 0; } # nft add rule ip test-ip4 output quota 1025 bytes Alignment trap: not handling instruction e1b26f9f at [<7f4473f8>] Unhandled fault: alignment exception (0x001) at 0xb832e824 Internal error: : 1 [#1] PREEMPT SMP ARM Hardware name: BCM2835 [<7f4473fc>] (nft_quota_do_init [nft_quota]) [<7f447448>] (nft_quota_init [nft_quota]) [<7f4260d0>] (nf_tables_newrule [nf_tables]) [<7f4168dc>] (nfnetlink_rcv_batch [nfnetlink]) [<7f416bd0>] (nfnetlink_rcv [nfnetlink]) [<8078b334>] (netlink_unicast) [<8078b664>] (netlink_sendmsg) [<8071b47c>] (sock_sendmsg) [<8071bd18>] (___sys_sendmsg) [<8071ce3c>] (__sys_sendmsg) [<8071ce94>] (sys_sendmsg) The reason is that nft_quota_do_init() calls atomic64_set() on an atomic64_t which is only aligned to 32-bit, not 64-bit, because it succeeds struct nft_expr in memory which only contains a 32-bit pointer. Fix by aligning the nft_expr private data to 64-bit. Fixes: 96518518cc41 ("netfilter: add nftables") Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org # v3.13+ Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- include/net/netfilter/nf_tables.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h @@ -801,7 +801,8 @@ struct nft_expr_ops { */ struct nft_expr { const struct nft_expr_ops *ops; - unsigned char data[]; + unsigned char data[] + __attribute__((aligned(__alignof__(u64)))); }; static inline void *nft_expr_priv(const struct nft_expr *expr)