From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Russell King <rmk+kernel@armlinux.org.uk>
Cc: coreteam@netfilter.org, netfilter-devel@vger.kernel.org,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Florian Westphal <fw@strlen.de>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH] netfiler: ipset: fix unaligned atomic access
Date: Mon, 22 Jun 2020 10:26:33 +0200 [thread overview]
Message-ID: <20200622082633.GA4512@salvia> (raw)
In-Reply-To: <E1jj7gl-0008Bq-BQ@rmk-PC.armlinux.org.uk>
On Wed, Jun 10, 2020 at 09:51:11PM +0100, Russell King wrote:
> When using ip_set with counters and comment, traffic causes the kernel
> to panic on 32-bit ARM:
>
> Alignment trap: not handling instruction e1b82f9f at [<bf01b0dc>]
> Unhandled fault: alignment exception (0x221) at 0xea08133c
> PC is at ip_set_match_extensions+0xe0/0x224 [ip_set]
>
> The problem occurs when we try to update the 64-bit counters - the
> faulting address above is not 64-bit aligned. The problem occurs
> due to the way elements are allocated, for example:
>
> set->dsize = ip_set_elem_len(set, tb, 0, 0);
> map = ip_set_alloc(sizeof(*map) + elements * set->dsize);
>
> If the element has a requirement for a member to be 64-bit aligned,
> and set->dsize is not a multiple of 8, but is a multiple of four,
> then every odd numbered elements will be misaligned - and hitting
> an atomic64_add() on that element will cause the kernel to panic.
>
> ip_set_elem_len() must return a size that is rounded to the maximum
> alignment of any extension field stored in the element. This change
> ensures that is the case.
Applied, thanks.
next prev parent reply other threads:[~2020-06-22 8:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 20:51 [PATCH] netfiler: ipset: fix unaligned atomic access Russell King
2020-06-21 19:45 ` Russell King - ARM Linux admin
2020-06-21 20:24 ` Pablo Neira Ayuso
2020-06-21 21:05 ` Jozsef Kadlecsik
2020-06-22 8:26 ` Pablo Neira Ayuso [this message]
2020-06-22 9:06 ` Russell King - ARM Linux admin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200622082633.GA4512@salvia \
--to=pablo@netfilter.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).