Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6568716ybx; Mon, 11 Nov 2019 11:06:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxOaX4bHWqJBf7dZgNO5CpH0xlkoNYqJFF9VUv5QzIF9aFtgFIBYVUXYfI4pvFA2Oyddm5K X-Received: by 2002:aa7:c518:: with SMTP id o24mr27402675edq.110.1573499163842; Mon, 11 Nov 2019 11:06:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573499163; cv=none; d=google.com; s=arc-20160816; b=HXXOm0B5/CFVa4Z57jTzi5ZSg/E2UKtcDcQ20QAA7AhLV/7f6P6WQw5zoCpV3un1J+ iLIkC93L2k/fvur5f8pWITG3wYguX7QOQEpU4BbFOLRoMDpI10kKplyZpXCG1RTNn1dk MbYP5BKeJDMK6T4XYQHkKoEv2s4IdyoBnErEUT/vAiU8cIupgdBmaq+FtJUSr3iY4aUy V1jfQsYHB635Ci/vvVFWG6rP6iXeGzsIJyCpKxRtNkYoACFEH7kpb5gKPYPywxZfIKHV BZkpr1CNfy9jAr0lyWSCsMsIOhxFKpz8KW16ykMSPU4pkeICDA9cg1NwuFnOX/VuFtuy loEw== 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=ZwR0OMnwUR4OTpM23OWjrodla0X7sBmp4CrkJw80Ykg=; b=nVzeKpUkMoyensANZMaMTeanMLCjF4kzeYc8oaamfOnElyLqDwq51pFYR7bdxMkiQy +02Zfzvwz/+BcgFmhq0EW/QY5jdE1KZVegup51JjpLRdPtfjp2viSU7Zd+XxIIkjyIro VsLD8vWmucvU7oYxzMttTrr7I+0KV/t7Y4sHQHNwQkOL+dsQQy7MG2asDaJM7gCHv7eL kcjTDxD6iL0M/4xYJSzLBtDqHggguRbfVX85/FiROMOZruev5sMIkzhvSJdzy0dy+kg6 +E71RnCKQlrRU8Wuijp0n0co49fgcClj5gpy4nJh6Jpw1P+vq0Bg0KDjmZ6KjEmkaNbU h+/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=moNMfn89; 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 f8si11588553edf.428.2019.11.11.11.05.39; Mon, 11 Nov 2019 11:06:03 -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=moNMfn89; 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 S1729560AbfKKSm7 (ORCPT + 99 others); Mon, 11 Nov 2019 13:42:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:34188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729573AbfKKSm5 (ORCPT ); Mon, 11 Nov 2019 13:42:57 -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 3662E20659; Mon, 11 Nov 2019 18:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497776; bh=ibielPTVX6L6wy/SX4BvmaBES0L1Ql3a0zwQalMi0Wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=moNMfn89F4QqdnKpSppkECS7eyKcMFtTz2y7d9uyJMJUYUyyR3uxXqbgxemU6MVbW iI5wMCCYVkPEQDh02B1d4DHlSspVXz93YciNWRrI67+uw7tyPsf9FlAcc2oBQ8Y6rN SaNQACmnOf48lX0JkctkbKqEVJflNOK7epcF7yCY= 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 4.19 037/125] netfilter: nf_tables: Align nft_expr private data to 64-bit Date: Mon, 11 Nov 2019 19:27:56 +0100 Message-Id: <20191111181445.452053046@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181438.945353076@linuxfoundation.org> References: <20191111181438.945353076@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 @@ -793,7 +793,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)