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] [day] [month] [year] [list]
Date:   Thu, 17 Mar 2022 14:08:04 +0000
From:   "liujian (CE)" <liujian56@...wei.com>
To:     Stanislav Fomichev <sdf@...gle.com>
CC:     John Fastabend <john.fastabend@...il.com>,
        Martin KaFai Lau <kafai@...com>,
        "ast@...nel.org" <ast@...nel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        "andrii@...nel.org" <andrii@...nel.org>,
        "songliubraving@...com" <songliubraving@...com>,
        "yhs@...com" <yhs@...com>,
        "kpsingh@...nel.org" <kpsingh@...nel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>
Subject: RE: [PATCH bpf-next] net: Use skb->len to check the validity of the
 parameters in bpf_skb_load_bytes



> -----Original Message-----
> From: Stanislav Fomichev [mailto:sdf@...gle.com]
> Sent: Wednesday, March 16, 2022 11:09 PM
> To: liujian (CE) <liujian56@...wei.com>
> Cc: John Fastabend <john.fastabend@...il.com>; Martin KaFai Lau
> <kafai@...com>; ast@...nel.org; daniel@...earbox.net; andrii@...nel.org;
> songliubraving@...com; yhs@...com; kpsingh@...nel.org;
> davem@...emloft.net; kuba@...nel.org; netdev@...r.kernel.org;
> bpf@...r.kernel.org
> Subject: Re: [PATCH bpf-next] net: Use skb->len to check the validity of the
> parameters in bpf_skb_load_bytes
> 
> On Wed, Mar 16, 2022 at 6:08 AM liujian (CE) <liujian56@...wei.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: John Fastabend [mailto:john.fastabend@...il.com]
> > > Sent: Wednesday, March 16, 2022 12:00 PM
> > > To: liujian (CE) <liujian56@...wei.com>; Martin KaFai Lau
> > > <kafai@...com>
> > > Cc: ast@...nel.org; daniel@...earbox.net; andrii@...nel.org;
> > > songliubraving@...com; yhs@...com; john.fastabend@...il.com;
> > > kpsingh@...nel.org; davem@...emloft.net; kuba@...nel.org;
> > > sdf@...gle.com; netdev@...r.kernel.org; bpf@...r.kernel.org
> > > Subject: RE: [PATCH bpf-next] net: Use skb->len to check the
> > > validity of the parameters in bpf_skb_load_bytes
> > >
> > > liujian (CE) wrote:
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Martin KaFai Lau [mailto:kafai@...com]
> > > > > Sent: Wednesday, March 16, 2022 3:58 AM
> > > > > To: liujian (CE) <liujian56@...wei.com>
> > > > > Cc: ast@...nel.org; daniel@...earbox.net; andrii@...nel.org;
> > > > > songliubraving@...com; yhs@...com; john.fastabend@...il.com;
> > > > > kpsingh@...nel.org; davem@...emloft.net; kuba@...nel.org;
> > > > > sdf@...gle.com; netdev@...r.kernel.org; bpf@...r.kernel.org
> > > > > Subject: Re: [PATCH bpf-next] net: Use skb->len to check the
> > > > > validity of the parameters in bpf_skb_load_bytes
> > > > >
> > > > > On Tue, Mar 15, 2022 at 08:39:16PM +0800, Liu Jian wrote:
> > > > > > The data length of skb frags + frag_list may be greater than
> > > > > > 0xffff, so here use skb->len to check the validity of the parameters.
> > > > > What is the use case that needs to look beyond 0xffff ?
> > >
> > > > I use sockmap with strparser, the stm->strp.offset (the begin of
> > > > one application layer protocol message) maybe beyond 0xffff, but i
> > > > need load the message head to do something.
> > >
> > > This would explain skb_load_bytes but not the other two right? Also
> > > if we
> > Yes, I just see that these two functions have the same judgment.
> > > are doing this why not just remove those two checks in
> > > flow_dissector_load() I think skb_header_pointer() does duplicate
> checks.
> > > Please check.
> > Yes, skb_header_pointer() have checked as below, and I will send v2 to
> remove 0xffff check.
> > ----skb_header_pointer
> > -------- __skb_header_pointer
> > ------------skb_copy_bits
> > ---------------- if (offset > (int)skb->len - len)
> > --------------------goto fault;
> >
> > Thank you~
> 
> Do we need to have at least "offset <= 0x7fffffff" check? IOW, do we need
> to enforce the unsignedness of the offset? Or does skb_header_pointer et
> all properly work with the negative offsets?
Yes, skb_header_pointer can not handle the negative offset.
I sent a new patch. Please help review it again. Thank you.
https://patchwork.kernel.org/project/netdevbpf/patch/20220317135940.358774-1-liujian56@huawei.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ