Thread View: linux.kernel.netdev
5 messages
5 total messages
Started by Hyunjung Ko
Tue, 17 Nov 2026 09:21
[PATCH net] l2tp: reject short IPv6 address attributes
Author: Hyunjung Ko
Date: Tue, 17 Nov 2026 09:21
Date: Tue, 17 Nov 2026 09:21
44 lines
12384 bytes
12384 bytes
L2TP_ATTR_IP6_SADDR and L2TP_ATTR_IP6_DADDR are NLA_BINARY with .len set
to sizeof(struct in6_addr), which only bounds the attribute from above.
l2tp_tunnel_sock_create() then copies a full in6_addr out of each one,
so a shorter attribute makes it read past the payload. If the attribute
is the last one in the message this picks up whatever lies behind the
skb tail (stale heap data unless init_on_alloc is set), which ends up
in the socket address and can be read back with L2TP_CMD_TUNNEL_GET.
The commands are GENL_UNS_ADMIN_PERM, so this is reachable from a user
namespace.
Require the exact length.
Fixes: f9bac8df908d ("l2tp: netlink api for l2tpv3 ipv6 unmanaged tunnels")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
---
net/l2tp/l2tp_netlink.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 89ef04c78787..a07009d4cb00 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -910,14 +910,8 @@ static const struct nla_policy l2tp_nl_policy[L2TP_ATTR_MAX + 1] = {
[L2TP_ATTR_MTU] = { .type = NLA_U16, },
[L2TP_ATTR_MRU] = { .type = NLA_U16, },
[L2TP_ATTR_STATS] = { .type = NLA_NESTED, },
- [L2TP_ATTR_IP6_SADDR] = {
- .type = NLA_BINARY,
- .len = sizeof(struct in6_addr),
- },
- [L2TP_ATTR_IP6_DADDR] = {
- .type = NLA_BINARY,
- .len = sizeof(struct in6_addr),
- },
+ [L2TP_ATTR_IP6_SADDR] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)),
+ [L2TP_ATTR_IP6_DADDR] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)),
[L2TP_ATTR_IFNAME] = {
.type = NLA_NUL_STRING,
.len = IFNAMSIZ - 1,
--
2.43.0
Re: [PATCH net] l2tp: reject short IPv6 address attributes
Author: netdev-bot+sinfo
Date: Tue, 17 Nov 2026 09:27
Date: Tue, 17 Nov 2026 09:27
23 lines
8752 bytes
8752 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. *IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages. -- The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH net] l2tp: reject short IPv6 address attributes
Author: khj
Date: Tue, 17 Nov 2026 09:34
Date: Tue, 17 Nov 2026 09:34
41 lines
13951 bytes
13951 bytes
The issue was found by a static analysis scan (pattern rules for NLA_BINARY attributes that are read with a fixed size, LLM-assisted), then confirmed by reading the code. It was triggered at runtime on 7.4-rc1 in QEMU: an unprivileged user in its own user+net namespace creates an L2TPv3 IPv6 tunnel with a 0 or 4 byte L2TP_ATTR_IP6_DADDR, and L2TP_CMD_TUNNEL_GET returns 16 bytes, the missing ones being stale heap data: sent 0 byte(s): 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 sent 4 byte(s): 20 20 20 20 41 41 41 41 41 41 41 41 41 41 41 41 There is no KASAN report, since the read stays inside the skb head allocation. The leaked bytes are non-zero only with init_on_alloc=0. 2026년 11월 17일 (화) 오후 6:27, <netdev-bot+sinfo@kernel.org>님이 작성: > > Hi! > > This is an automated message. This series looks like a fix, but its > commit messages seem to be missing some information: > > - How the issue was discovered, e.g. hit in production, hit during > development, syzbot report, manual code inspection, LLM or static > analysis tool scan. > > - Whether the issue was actually triggered, or is only theoretical > (e.g. found by LLM and not proven at runtime). If it was triggered > please include the symptoms, like the stack trace or kernel messages. > > Please do not repost the series just to address the above. Instead, > reply to this email with the missing information, so that reviewers > can take it into account. > > *IMPORTANT*: If you do repost (for other reasons) - please include > the relevant info in the cover letter or commit messages. > -- > The evaluation is done by an LLM so it may be wrong, if you think > that is the case please reply and explain.
Re: [PATCH net] l2tp: reject short IPv6 address attributes
Author: Hangbin Liu
Date: Wed, 18 Nov 2026 01:50
Date: Wed, 18 Nov 2026 01:50
48 lines
10128 bytes
10128 bytes
On Tue, Nov 17, 2026 at 06:21:57PM +0900, Hyunjung Ko wrote:
> L2TP_ATTR_IP6_SADDR and L2TP_ATTR_IP6_DADDR are NLA_BINARY with .len set
> to sizeof(struct in6_addr), which only bounds the attribute from above.
> l2tp_tunnel_sock_create() then copies a full in6_addr out of each one,
> so a shorter attribute makes it read past the payload. If the attribute
> is the last one in the message this picks up whatever lies behind the
> skb tail (stale heap data unless init_on_alloc is set), which ends up
> in the socket address and can be read back with L2TP_CMD_TUNNEL_GET.
>
> The commands are GENL_UNS_ADMIN_PERM, so this is reachable from a user
> namespace.
>
> Require the exact length.
>
> Fixes: f9bac8df908d ("l2tp: netlink api for l2tpv3 ipv6 unmanaged tunnels")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
> ---
> net/l2tp/l2tp_netlink.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
> index 89ef04c78787..a07009d4cb00 100644
> --- a/net/l2tp/l2tp_netlink.c
> +++ b/net/l2tp/l2tp_netlink.c
> @@ -910,14 +910,8 @@ static const struct nla_policy l2tp_nl_policy[L2TP_ATTR_MAX + 1] = {
> [L2TP_ATTR_MTU] = { .type = NLA_U16, },
> [L2TP_ATTR_MRU] = { .type = NLA_U16, },
> [L2TP_ATTR_STATS] = { .type = NLA_NESTED, },
> - [L2TP_ATTR_IP6_SADDR] = {
> - .type = NLA_BINARY,
> - .len = sizeof(struct in6_addr),
> - },
> - [L2TP_ATTR_IP6_DADDR] = {
> - .type = NLA_BINARY,
> - .len = sizeof(struct in6_addr),
> - },
> + [L2TP_ATTR_IP6_SADDR] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)),
> + [L2TP_ATTR_IP6_DADDR] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)),
> [L2TP_ATTR_IFNAME] = {
> .type = NLA_NUL_STRING,
> .len = IFNAMSIZ - 1,
> --
> 2.43.0
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Re: [PATCH net] l2tp: reject short IPv6 address attributes
Author: patchwork-bot+netdevbpf
Date: Fri, 20 Nov 2026 02:30
Date: Fri, 20 Nov 2026 02:30
25 lines
8817 bytes
8817 bytes
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 17 Nov 2026 18:21:57 +0900 you wrote:
> L2TP_ATTR_IP6_SADDR and L2TP_ATTR_IP6_DADDR are NLA_BINARY with .len set
> to sizeof(struct in6_addr), which only bounds the attribute from above.
> l2tp_tunnel_sock_create() then copies a full in6_addr out of each one,
> so a shorter attribute makes it read past the payload. If the attribute
> is the last one in the message this picks up whatever lies behind the
> skb tail (stale heap data unless init_on_alloc is set), which ends up
> in the socket address and can be read back with L2TP_CMD_TUNNEL_GET.
>
> [...]
Here is the summary with links:
- [net] l2tp: reject short IPv6 address attributes
https://git.kernel.org/netdev/net/c/3bf0ed569563
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads