[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPza5qdn=5zOAjHdyK-iHrmP=sEL150Mrgz=w_wgEcL5MBWZRw@mail.gmail.com>
Date: Wed, 10 Jul 2024 13:15:34 +0800
From: Chengen Du <chengen.du@...onical.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Michal Kubiak <michal.kubiak@...el.com>, Florian Westphal <fw@...len.de>, jhs@...atatu.com,
xiyou.wangcong@...il.com, jiri@...nulli.us, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, ozsh@...dia.com, paulb@...dia.com,
marcelo.leitner@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Gerald Yang <gerald.yang@...onical.com>
Subject: Re: [PATCH net v2] net/sched: Fix UAF when resolving a clash
On Tue, Jul 9, 2024 at 6:40 PM Paolo Abeni <pabeni@...hat.com> wrote:
>
> On Mon, 2024-07-08 at 17:39 +0800, Chengen Du wrote:
> > On Mon, Jul 8, 2024 at 4:33 PM Michal Kubiak <michal.kubiak@...el.com> wrote:
> > > For example, if "nf_conntrack_confirm()" returns NF_ACCEPT, (even after
> > > the clash resolving), I would not expect calling "goto drop".
> > > That is why I suggested a less invasive solution which is just blocking
> > > calling "tcf_ct_flow_table_process_conn()" where there is a risk of UAF.
> > > So, I asked if such solution would work in case of this function.
> >
> > Thank you for expressing your concerns in detail.
> >
> > In my humble opinion, skipping the addition of an entry in the flow
> > table is controlled by other logic and may not be suitable to mix with
> > error handling. If nf_conntrack_confirm returns NF_ACCEPT, I believe
> > there is no reason for nf_ct_get to fail. The nf_ct_get function
> > simply converts skb->_nfct into a struct nf_conn type. The only
> > instance it might fail is when CONFIG_NF_CONNTRACK is disabled. The
> > CONFIG_NET_ACT_CT depends on this configuration and determines whether
> > act_ct.c needs to be compiled. Actually, the "goto drop" logic is
> > included for completeness and might only be relevant if the memory is
> > corrupted. Perhaps we could wrap the judgment with "unlikely" to
> > emphasize this point?
>
> I agree with Michal, I think it should be better to just skip
> tcf_ct_flow_table_process_conn() in case of clash to avoid potential
> behavior changes.
Based on your suggestions, I took a deeper look at the code and found
that the drop logic simply adds a count to qstats->drops. It did not
work as I expected in terms of dropping the packet. I apologize for
any confusion this may have caused in our discussion. I will send a v3
to modify the error handling. Thank you for your advice.
>
> Thanks,
>
> Paolo
>
Powered by blists - more mailing lists