lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJ0+==pXHdMBcAXDd4MFDMvtFQhajKWWKj5kX7gU+NtTw@mail.gmail.com>
Date: Tue, 21 Jan 2025 16:35:40 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Stephan Wurm <stephan.wurm@...berle.de>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org, eric.dumazet@...il.com, 
	syzbot+671e2853f9851d039551@...kaller.appspotmail.com, 
	WingMan Kwok <w-kwok2@...com>, Murali Karicheri <m-karicheri2@...com>, 
	MD Danish Anwar <danishanwar@...com>, Jiri Pirko <jiri@...dia.com>, 
	George McCollister <george.mccollister@...il.com>
Subject: Re: [PATCH net] net: hsr: avoid potential out-of-bound access in fill_frame_info()

On Tue, Jan 21, 2025 at 4:15 PM Stephan Wurm <stephan.wurm@...berle.de> wrote:

> I did some additional experiments.
>
> First, I was able to get v6.13 running on the system, although it did
> not fix my issue.
>
> Then I played around with VLAN interfaces.
>
> I created an explicit VLAN interface on top of the prp interface. In that
> case the VLAN header gets transparently attached to the tx frames and
> forwarding through the interface layers works as expected.
>
> It was even possible to get my application working on top of the vlan
> interface, but it resulted in two VLAN headers - the inner from the
> application, the outer from the vlan interface.
>
> So when sending vlan tagged frames directly from an application through
> a prp interface the mac_len field does not get updated, even though the
> VLAN protocol header is properly detected; when sending frames through
> an explicit vlan interface, the mac_len seems to be properly parsed
> into the skb.
>
> Now I am running out of ideas how to proceed.
>
> For the time being I would locally revert this fix, to make my
> application working again.
> But I can support in testing proposed solutions.


If mac_len can not be used, we need yet another pskb_may_pull()

I am unsure why hsr_get_node() is working, since it also uses skb->mac_len

Please test the following patch :

diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
index 87bb3a91598ee96b825f7aaff53aafb32ffe4f9..8942592130c151f2c948308e1ae16a6736822d5
100644
--- a/net/hsr/hsr_forward.c
+++ b/net/hsr/hsr_forward.c
@@ -700,9 +700,11 @@ static int fill_frame_info(struct hsr_frame_info *frame,
                frame->is_vlan = true;

        if (frame->is_vlan) {
-               if (skb->mac_len < offsetofend(struct hsr_vlan_ethhdr, vlanhdr))
+               if (pskb_may_pull(skb,
+                                 skb_mac_offset(skb) +
+                                 offsetofend(struct hsr_vlan_ethhdr, vlanhdr)))
                        return -EINVAL;
-               vlan_hdr = (struct hsr_vlan_ethhdr *)ethhdr;
+               vlan_hdr = (struct hsr_vlan_ethhdr *)skb_mac_header(skb);
                proto = vlan_hdr->vlanhdr.h_vlan_encapsulated_proto;
        }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ