From: Steffen Klassert <steffen.klassert@secunet.com>
To: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: <linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <herbert@gondor.apana.org.au>,
<dhowells@redhat.com>, <davem@davemloft.net>,
<zohar@linux.vnet.ibm.com>, <David.Woodhouse@intel.com>
Subject: Re: [PATCH net-next 2/2] xfrm: Fix unaligned access in xfrm_notify_sa() for DELSA
Date: Wed, 21 Oct 2015 08:57:04 +0200 [thread overview]
Message-ID: <20151021065704.GM7701@secunet.com> (raw)
In-Reply-To: <65f37efeff5af105c89493dda4f38c61e4cd495f.1445286755.git.sowmini.varadhan@oracle.com>
On Mon, Oct 19, 2015 at 05:23:29PM -0400, Sowmini Varadhan wrote:
> On sparc, deleting established SAs (e.g., by restarting ipsec
> at the peer) results in unaligned access messages via
> xfrm_del_sa -> km_state_notify -> xfrm_send_state_notify().
> Use an aligned pointer to xfrm_usersa_info for this case.
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> ---
> net/xfrm/xfrm_user.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
> index a8de9e3..158ef4a 100644
> --- a/net/xfrm/xfrm_user.c
> +++ b/net/xfrm/xfrm_user.c
> @@ -2659,7 +2659,7 @@ static int xfrm_notify_sa(struct xfrm_state *x, const struct km_event *c)
> if (attr == NULL)
> goto out_free_skb;
>
> - p = nla_data(attr);
> + p = PTR_ALIGN(nla_data(attr), __alignof__(*p));
Hm, this breaks userspace notifications on 64-bit systems.
Userspace expects this to be aligned to 4, with your patch
it is aligned to 8 on 64-bit.
Without your patch I get the correct notification when deleting a SA:
ip x m
Deleted src 172.16.0.2 dst 172.16.0.1
proto esp spi 0x00000002 reqid 2 mode tunnel
replay-window 32
auth-trunc hmac(sha1) 0x31323334353637383930 96
enc cbc(aes) 0x31323334353637383930313233343536
sel src 10.0.0.0/24 dst 192.168.0.0/24
With your patch I get for the same SA:
ip x m
Deleted src 50.0.0.0 dst 0.0.0.0
proto 0 reqid 0 mode transport
replay-window 0 flag decap-dscp
auth-trunc hmac(sha1) 0x31323334353637383930 96
enc cbc(aes) 0x31323334353637383930313233343536
sel src 0.0.0.0/0 dst 0.234.255.255/0 proto igmp
next prev parent reply other threads:[~2015-10-21 6:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-19 21:23 [PATCH 0/2] xfrm/crypto: unaligned access fixes Sowmini Varadhan
2015-10-19 21:23 ` [PATCH 1/2] crypto/x509: Fix unaligned access in x509_get_sig_params() Sowmini Varadhan
2015-10-20 9:50 ` David Howells
2015-10-20 14:26 ` Herbert Xu
2015-10-19 21:23 ` [PATCH net-next 2/2] xfrm: Fix unaligned access in xfrm_notify_sa() for DELSA Sowmini Varadhan
2015-10-21 6:57 ` Steffen Klassert [this message]
2015-10-21 10:54 ` Sowmini Varadhan
2015-10-21 12:36 ` Sowmini Varadhan
2015-10-21 13:22 ` David Miller
2015-10-21 13:11 ` Sowmini Varadhan
2015-10-21 13:17 ` David Miller
2015-10-21 13:10 ` David Miller
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=20151021065704.GM7701@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=David.Woodhouse@intel.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sowmini.varadhan@oracle.com \
--cc=zohar@linux.vnet.ibm.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).