From: Steffen Klassert <steffen.klassert@secunet•com>
To: Zhengchuan Liang <zcliangcn@gmail•com>
Cc: <netdev@vger•kernel.org>, <herbert@gondor•apana.org.au>,
<davem@davemloft•net>, <edumazet@google•com>, <kuba@kernel•org>,
<pabeni@redhat•com>, <horms@kernel•org>,
<linux-kernel@vger•kernel.org>, <shinta.sugimoto@ericsson•com>,
<nakam@linux-ipv6•org>, <yoshfuji@linux-ipv6•org>,
<yifanwucs@gmail•com>, <tomapufckgml@gmail•com>,
<yuantan098@gmail•com>, <bird@lzu•edu.cn>, <lx24@stu•ynu.edu.cn>
Subject: Re: [PATCH net] net: af_key: zero aligned sockaddr tail in PF_KEY exports
Date: Wed, 8 Apr 2026 11:31:50 +0200 [thread overview]
Message-ID: <adYghh-SE0eftCrH@secunet.com> (raw)
In-Reply-To: <20260322184608.1048146-1-zcliangcn@gmail.com>
On Sun, Mar 22, 2026 at 11:46:08AM -0700, Zhengchuan Liang wrote:
> PF_KEY export paths use `pfkey_sockaddr_size()` when reserving sockaddr
> payload space, so IPv6 addresses occupy 32 bytes on the wire. However,
> `pfkey_sockaddr_fill()` initializes only the first 28 bytes of
> `struct sockaddr_in6`, leaving the final 4 aligned bytes uninitialized.
>
> Not every PF_KEY message is affected. The state and policy dump builders
> already zero the whole message buffer before filling the sockaddr
> payloads. Keep the fix to the export paths that still append aligned
> sockaddr payloads with plain `skb_put()`:
>
> - `SADB_ACQUIRE`
> - `SADB_X_NAT_T_NEW_MAPPING`
> - `SADB_X_MIGRATE`
>
> Fix those paths by clearing only the aligned sockaddr tail after
> `pfkey_sockaddr_fill()`.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Fixes: 08de61beab8a ("[PFKEYV2]: Extension for dynamic update of endpoint address(es)")
> Reported-by: Yifan Wu <yifanwucs@gmail•com>
> Reported-by: Juefei Pu <tomapufckgml@gmail•com>
> Co-developed-by: Yuan Tan <yuantan098@gmail•com>
> Signed-off-by: Yuan Tan <yuantan098@gmail•com>
> Suggested-by: Xin Liu <bird@lzu•edu.cn>
> Tested-by: Xiao Liu <lx24@stu•ynu.edu.cn>
> Signed-off-by: Zhengchuan Liang <zcliangcn@gmail•com>
Applied, thanks a lot!
prev parent reply other threads:[~2026-04-08 9:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 18:46 [PATCH net] net: af_key: zero aligned sockaddr tail in PF_KEY exports Zhengchuan Liang
2026-04-08 9:31 ` 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=adYghh-SE0eftCrH@secunet.com \
--to=steffen.klassert@secunet$(echo .)com \
--cc=bird@lzu$(echo .)edu.cn \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=herbert@gondor$(echo .)apana.org.au \
--cc=horms@kernel$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=lx24@stu$(echo .)ynu.edu.cn \
--cc=nakam@linux-ipv6$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=shinta.sugimoto@ericsson$(echo .)com \
--cc=tomapufckgml@gmail$(echo .)com \
--cc=yifanwucs@gmail$(echo .)com \
--cc=yoshfuji@linux-ipv6$(echo .)org \
--cc=yuantan098@gmail$(echo .)com \
--cc=zcliangcn@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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