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: <20190829115315.5686c18f@cakuba.netronome.com>
Date:   Thu, 29 Aug 2019 11:53:15 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     John Fastabend <john.fastabend@...il.com>
Cc:     Hillf Danton <hdanton@...a.com>,
        syzbot <syzbot+7a6ee4d0078eac6bf782@...kaller.appspotmail.com>,
        aviadye@...lanox.com, borisp@...lanox.com, daniel@...earbox.net,
        davejwatson@...com, davem@...emloft.net,
        linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        syzkaller-bugs@...glegroups.com
Subject: Re: general protection fault in tls_sk_proto_close (2)

On Thu, 29 Aug 2019 11:48:32 -0700, John Fastabend wrote:
> Jakub Kicinski wrote:
> > On Thu, 29 Aug 2019 11:52:00 +0800, Hillf Danton wrote:  
> > > Alternatively work is done if sock is closed again. Anyway ctx is reset
> > > under sock's callback lock in write mode.
> > > 
> > > --- a/net/tls/tls_main.c
> > > +++ b/net/tls/tls_main.c
> > > @@ -295,6 +295,8 @@ static void tls_sk_proto_close(struct so
> > >  	long timeo = sock_sndtimeo(sk, 0);
> > >  	bool free_ctx;
> > >  
> > > +	if (!ctx)
> > > +		return;
> > >  	if (ctx->tx_conf == TLS_SW)
> > >  		tls_sw_cancel_work_tx(ctx);  
> > 
> > That's no bueno, the real socket's close will never get called.  
> 
> Seems when we refactored BPF side we dropped the check for ULP on one
> path so I'll add that back now. It would be nice and seems we are
> getting closer now that tls side is a bit more dynamic if the ordering
> didn't matter.

We'd probably need some more generic way of communicating the changes
in sk_proto stack, e.g. by moving the update into one of sk_proto
callbacks? but yes.

> diff --git a/net/core/sock_map.c b/net/core/sock_map.c
> index 1330a7442e5b..30d11558740e 100644
> --- a/net/core/sock_map.c
> +++ b/net/core/sock_map.c
> @@ -666,6 +666,8 @@ static int sock_hash_update_common(struct bpf_map *map, void *key,
>         WARN_ON_ONCE(!rcu_read_lock_held());
>         if (unlikely(flags > BPF_EXIST))
>                 return -EINVAL;
> +       if (unlikely(icsk->icsk_ulp_data))
> +               return -EINVAL;
> 
>         link = sk_psock_init_link();
>         if (!link)

Thanks! That looks good, if you feel like submitting officially feel
free to add my Reviewed-by!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ