[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGiJo8RzhDgfP9hcND4fGjtA4RRGhZVdxWmJmXas_azuxwqZaA@mail.gmail.com>
Date: Tue, 29 Oct 2024 14:34:55 -0700
From: Daniel Yang <danielyangkang@...il.com>
To: Alexander Lobakin <aleksander.lobakin@...el.com>
Cc: Martin KaFai Lau <martin.lau@...ux.dev>, Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>, Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>, Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
"open list:BPF [NETWORKING] (tcx & tc BPF, sock_addr)" <bpf@...r.kernel.org>,
"open list:BPF [NETWORKING] (tcx & tc BPF, sock_addr)" <netdev@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>,
syzbot+346474e3bf0b26bd3090@...kaller.appspotmail.com
Subject: Re: [PATCH net] Drop packets with invalid headers to prevent KMSAN infoleak
On Tue, Oct 29, 2024 at 9:41 AM Alexander Lobakin
<aleksander.lobakin@...el.com> wrote:
> > + if (unlikely(skb->len < dev->min_header_len ||
> > + skb_mac_header_len(skb) < dev->min_header_len ||
> > + skb_mac_header_len(skb) > dev->hard_header_len)) {
> > + kfree_skb(skb);
> > + return -ERANGE;
> > + }
>
> I believe this should go under IS_ENABLED(CONFIG_KMSAN) or
> CONFIG_DEBUG_NET or so to not affect the regular configurations.
> Or does this fix some real bug?
Well in my opinion, an infoleak is still an infoleak. But, this would
likely not get triggered as long as an skb with a properly initialized
eth header is passed into the bpf_clone_redirect function. We could
initialize the memory to 0 but the performance hit would be too much.
If the bpf_clone_redirect() function cannot be called from user space
with user-crafted skbs as input, I don't think this is really an issue
and we can just put it under the macros to get rid of the syzbot
error.
- Daniel
Powered by blists - more mailing lists