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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 6 Jul 2022 16:07:19 +0200
From:   Eric Dumazet <edumazet@...gle.com>
To:     Paolo Abeni <pabeni@...hat.com>
Cc:     서세욱 <ssewook@...il.com>,
        Sewook Seo <sewookseo@...gle.com>,
        Linux Network Development Mailing List 
        <netdev@...r.kernel.org>, "David S . Miller" <davem@...emloft.net>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        David Ahern <dsahern@...nel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        Maciej Żenczykowski <maze@...gle.com>,
        Steffen Klassert <steffen.klassert@...unet.com>,
        Sehee Lee <seheele@...gle.com>
Subject: Re: [PATCH v2] net-tcp: Find dst with sk's xfrm policy not ctl_sk

On Wed, Jul 6, 2022 at 4:02 PM Paolo Abeni <pabeni@...hat.com> wrote:
>
>
> Hello,
> On Wed, 2022-07-06 at 03:10 +0000, 서세욱 wrote:
> > On Tue, Jul 5, 2022 at 5:25 PM Paolo Abeni <pabeni@...hat.com> wrote:
> > > If you are targting net, please add a suitable Fixes: tag.
> > I'm targeting net-next, and will update the subject.
> >
> > > It looks like the cloned policy will be overwrited by later resets and
> > > possibly leaked? nobody calls xfrm_sk_free_policy() on the old policy
>
> > Is it possible that a later reset overwrites sk_ctl's sk_policy? I
> > thought ctl_sk is a percpu variable and it's preempted. Maybe I might
> > miss something, please let me know if my understanding is wrong.
>
> I mean: what happesn when there are 2 tcp_v4_send_reset() on the same
> CPU (with different sk argument)?

This is not possible, because we block BH

local_bh_disable();
ctl_sk = this_cpu_read(ipv4_tcp_sk);
...
<write over tcl_sk>
local_bh_enable();


>
> It looks like that after the first call to xfrm_sk_clone_policy(),
> sk_ctl->sk_policy will be set to the newly allocated (cloned) policy.
>
> The next call will first clear the sk_ctl->sk_policy - without freeing
> the old value - and later set it again.
>
> It looks like a memory leak. Am I missing something?
>
> Thanks!
>
> Paolo
>

Powered by blists - more mailing lists