From: Steffen Klassert <steffen.klassert@secunet.com>
To: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<herbert@gondor.apana.org.au>, <davem@davemloft.net>
Subject: Re: [PATCH v2 net-next] xfrm: Fix unaligned access to stats in copy_to_user_state()
Date: Fri, 23 Oct 2015 12:33:17 +0200 [thread overview]
Message-ID: <20151023103317.GN7701@secunet.com> (raw)
In-Reply-To: <20151021154722.GA14667@oracle.com>
On Wed, Oct 21, 2015 at 11:48:25AM -0400, Sowmini Varadhan wrote:
>
> On sparc, deleting established SAs (e.g., by restarting ipsec)
> results in unaligned access messages via xfrm_del_sa ->
> km_state_notify -> xfrm_send_state_notify().
>
> Even though struct xfrm_usersa_info is aligned on 8-byte boundaries,
> netlink attributes are fundamentally only 4 byte aligned, and this
> cannot be changed for nla_data() that is passed up to userspace.
> As a result, the put_unaligned() macro needs to be used to
> set up potentially unaligned fields such as the xfrm_stats in
> copy_to_user_state()
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> ---
> v2: review comment from thread: cannot use PTR_ALIGN as this would break
> userspace assumptions about 4 byte alignment. Use *_unaligned() macros
> as needed, instead.
This works on intel 32-bit and 64-bit as expected.
Patch applied to ipsec-next, thanks!
prev parent reply other threads:[~2015-10-23 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-21 15:48 [PATCH v2 net-next] xfrm: Fix unaligned access to stats in copy_to_user_state() Sowmini Varadhan
2015-10-23 10:33 ` Steffen Klassert [this message]
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=20151023103317.GN7701@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sowmini.varadhan@oracle.com \
/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).