From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.173 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796112270; b=iKoLPwmHXxoqx1u0tNuAG9BGssOztWeLI71aNB20YsIdkcVoTl2k2viKuQmoFzAKewVc d4yYL79PWXQfJfk4FzJZSOJ6/myelXDWRpqN8xHn5PKonlrb7xaeBjFNYYcemGOV52o9U wGcnVvvqsQ2eE0yA3nSsu8kJvXEt5ouLJpOXUAlL6ln9DH1ngfcKOC3MMGmrJyH8Fl1sV 3cCagSObt1Igri13ZloSR0mY1YQ+oVvjKxaW1CRdbsuxjPsTXw820jJpYlldLhXwOs8UB LBN5SgTu5DhPZO/Tn1lxUds2CQ6DMUNE/nmXDg5xpJ7QLW+ATr43xo6xvTLhru+gixg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796112270; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding; bh=aYZxuPaRUhSbaDzNKpPWPKkCrQQKp9pQbNWTbtyQsQo=; b=tLkPXnQOmndeLNMyWH5EvsIfnFWjFvV2MJYvrIcp2lRy8NDkhHfYIZKZ4ztgaFbGTy+K hHInSDcESG2pM0eFhw94AULmiim8yFEG+OWcKpUuz/AIaV095p/OrIpjXOhuFbTH6KaPB 0awu6AmXcuD+NinOM3JYdBKpurJV7veak05Ckek8PG29cFRq0wVCCWlibUywa+jKZQLAe Mz7YrDwy/8gzksxuNt0ZEVDfuVaOz5VsFgamXzE9qW7W+GauqOQT2iqTOHqcrNhLnutiI ZwACDQrSCGGYQV8Zh8tiD7F6VPmxpb6uP9PRwIB5Sk/iwvMyb6kuUmOWWgRirTF6asQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="D/qyUkyK"; arc=none smtp.remote-ip=74.125.82.173 Received: from mail-dy1-f173.google.com (mail-dy1-f173.google.com [74.125.82.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD14E606A31A for ; Tue, 1 Dec 2026 08:04:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DD14E606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=D/qyUkyK Received: by mail-dy1-f173.google.com with SMTP id 5a478bee46e88-386b8f2f671so6800279eec.1 for ; Tue, 01 Dec 2026 00:04:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796112269; x=1796717069; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=aYZxuPaRUhSbaDzNKpPWPKkCrQQKp9pQbNWTbtyQsQo=; b=D/qyUkyKDLd/Pdy6G/9mVKyfU0nFWLtb7SbpAiLzX2HkKznJtdFU3pmbptsnzHP89C Gh23E+n/D/onDAbNTRrJQgy0ftMhd3MQ20uKZW5m6ldRbdezD8yHrg+lf3BYfkXMYRqA K4y71NX2HZO97mlOWM5shE7gGGECKZSvX0a0JOdsmGPgRhdva+dB3MulgsHpy7Kw65if nk/3gDYagqqV33wJY9R9zejSX7f5gmbdHbBmnzomUhsYadNOgaDUBT5JEsed1k++uZIy B2Lm9qW+FYlgPa1dBXS5fNbBZSGahXuFoH0SxT6v0mULNOBRm53knMzwutP/hcsCDyn3 k8+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796112269; x=1796717069; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=aYZxuPaRUhSbaDzNKpPWPKkCrQQKp9pQbNWTbtyQsQo=; b=RLgeDvmD8gxmFkR9eO7WjSrqp0euzEhRP/9CF+92UMHNrGVAFhxT7XHMSYR6ulsPO+ vIYXnrG/8aiWMAhTzhcshx7XxLUoKeGmHt69FbdvdsUg3PRqzKngofFrCBnO1tw7BYbb bSJ+AXcB4ypEnqcVSEWG2/b3ctHzVobl/msTb6o/PAiFQGy9gnwNeyaoc7miphiqlrs+ oHCftmvX4qJqzK64qO5ZVLpbIJ0n4tleB1edrC4qZQ6mH8CXmX7TgsLGNlj4mDd49BKG zSKfLtxJitaDvHYg44LTMfszsQS5j6yGaVnDYZF86pGz1wN1AdQi0JvUHSm4qXxLpxyE fe7g== X-Forwarded-Encrypted: i=1; AL+hErFUFQcH1foyLNlHoLk/r8ezBcqo0FXVFMGl3qpGg6sDfSad44Skz1suOVhdzmBsF7L0IrNxORc=@vger.kernel.org X-Gm-Message-State: APuU4Z8quWnMb4Cj81tz2rF6P/Zjfqoo1uZBA/caNaVhyXb3fQr+PqRp mmCBYdUy/TPSAfb2EtGt24NFuvLlQOSPlNhUB3wtkHIiMqc7aQgNPbbd X-Gm-Gg: AZFdTZctydvSVIe0yCR9PPAhq3GDSKP3H/IiG0z4dhoKWOBzNyjALEWP3hwJXL+g1G1 OfQDoaV8f8ZhxbOo93kRx03fAs4kqMujyt4mBVrB7ncDLV+fkqiU6dB9O4Ue3IRiZLm/HttoRWk SMP548kel12rpicvoZ9Otxt/migzQ6lj3FJ2X8H4NuAhix88uXr28teJcipJLTNr+tZC442s3oa Rz9/qEKiKmp3Bjc69kurv0iNTX8Qv4QA/h+1J5iEt1RMmOiubuEEfD14dnWSXhhqDNs9LwnrJJs kRipNWyJl3mD/6oivSItSHxwyUjnwXFLsOoQ9Zp4ujoqj56oOUtqdyV01seYTajV92nlNJBWME7 VSirL/wE1FsgUMV0oTbEnYqW3jW/xGW3yLqHg9bTMdk78TO1FXSPRmOGHdgIfcwzHkuZMzjm6s6 T9ysiWlfzo3P9WkZDAWmeULWkERGOTpCaAufxBgv8sjXrMvEB2x6x/N0P0DNy/eWLaE+nmThF/e XD5b0yCR1vawaYxTI4e874730omC+Jt+jaQmV9+Ig5TWD0/RvU4rsM7SrszH5c+F6Uv3y64CZ1R fYRjgYCisav53tkoakmEwkiQtuICY0Urf5OdCekVlLEaCaVG1qsls0sNaUCu3XB9vzI= X-Received: by 2002:a05:7301:4d18:b0:37d:bd4e:c378 with SMTP id 5a478bee46e88-3857181d8ddmr34154434eec.41.1796112268721; Tue, 01 Dec 2026 00:04:28 -0800 (PST) Received: from d4082dd914b5.tail196be.ts.net (vldb.skku.ac.kr. [115.145.173.180]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38566cd46c5sm133981784eec.11.2026.12.01.00.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 00:04:28 -0800 (PST) From: Kyuwon Cho To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Willem de Bruijn , Simon Horman , David Ahern , Fourie Zhang , Aaron Conole , Eelco Chaudron , Ilya Maximets , Jiri Benc , Lin Jiapeng , netdev@vger.kernel.org Subject: [PATCH net] net: mpls: clear inner_protocol when mpls_forward() pops the last label Date: Tue, 1 Dec 2026 17:04:23 +0900 Message-ID: <179607412883.627473.3063198838105400446@gmail.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 78a86d75a70e ("net: mpls: clear inner_protocol when the last label is popped") made skb_mpls_pop() drop the inner header that skb_mpls_push() records once the packet is no longer MPLS. MPLS forwarding pops labels without skb_mpls_pop(): mpls_forward() pulls each label itself, and on the last one mpls_egress() switches skb->protocol to IPv4 or IPv6 but leaves skb->inner_protocol and skb->inner_network_header in place. A packet that had MPLS pushed by an Open vSwitch datapath, was then forwarded by MPLS routes, and reaches an OVS datapath again keeps the old record. A second push_mpls does not record a new inner header, because inner_protocol is still set, and ovs_fragment() trusts the old one. After the forwarding hops have moved skb->data past it, skb_network_offset() is negative and prepare_frag() copies (unsigned int)-2 bytes: BUG: KASAN: slab-out-of-bounds in prepare_frag+0x3ab/0x510 Read of size 4294967294 at addr ff11000013f16050 by task test/106 Call Trace: __asan_memcpy+0x23/0x60 prepare_frag+0x3ab/0x510 ovs_fragment+0x517/0x840 do_execute_actions+0x580e/0x7380 ovs_execute_actions+0xd3/0x3e0 ovs_dp_process_packet+0x21c/0x500 ovs_vport_receive+0x22e/0x380 netdev_frame_hook+0x396/0x6b0 An unprivileged user can set this up in its own user and network namespace. Clear inner_protocol in mpls_egress() once the packet is IP again, as skb_mpls_pop() does. Fixes: 48d2ab609b6b ("net: mpls: Fixups for GSO") Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Kyuwon Cho --- The issue was found by an LLM-guided test generator that we are developing as a research prototype. I sent it privately on 2026-11-18; it comes to the list now because security-bugs.rst asks for bugs found with AI assistance to be handled in public. The reproducer is available on request. Lin Jiapeng has posted a fix for the same prepare_frag() overflow reached through OVS PUSH_MPLS/POP_MPLS actions: https://lore.kernel.org/all/20261126083218.55429-1-ljp1205831794@gmail.com/ That path pops labels with skb_mpls_pop(). This one is MPLS routing: mpls_forward() pops the last label itself and never calls skb_mpls_pop(), so a check there would not cover it. Reproduced on mainline v7.4-rc5 (fe6ff8d5d675, with KASAN); the patch is against net (76fca30e8d34), and with it the reproducer runs clean. net/mpls/af_mpls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index ad4ad6f2001a..e2e5da8d757b 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -361,6 +361,9 @@ static bool mpls_egress(struct net *net, struct mpls_route *rt, break; } + if (success) + skb->inner_protocol = 0; + return success; } -- 2.43.0