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]
Message-ID: <12305071-c136-f39f-9450-bdaad08137b2@gmail.com>
Date:   Tue, 28 Feb 2023 09:48:11 +0800
From:   Hangyu Hua <hbh25y@...il.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     Sabrina Dubroca <sd@...asysnail.net>,
        Florian Westphal <fw@...len.de>, borisp@...dia.com,
        john.fastabend@...il.com, davem@...emloft.net, edumazet@...gle.com,
        pabeni@...hat.com, davejwatson@...com, aviadye@...lanox.com,
        ilyal@...lanox.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: tls: fix possible race condition between
 do_tls_getsockopt_conf() and do_tls_setsockopt_conf()

On 28/2/2023 03:07, Jakub Kicinski wrote:
> On Mon, 27 Feb 2023 11:26:18 +0800 Hangyu Hua wrote:
>> In order to reduce ambiguity, I think it may be a good idea only to
>> lock do_tls_getsockopt_conf() like we did in do_tls_setsockopt()
>>
>> It will look like:
>>
>> static int do_tls_getsockopt(struct sock *sk, int optname,
>> 			     char __user *optval, int __user *optlen)
>> {
>> 	int rc = 0;
>>
>> 	switch (optname) {
>> 	case TLS_TX:
>> 	case TLS_RX:
>> +		lock_sock(sk);
>> 		rc = do_tls_getsockopt_conf(sk, optval, optlen,
>> 					    optname == TLS_TX);
>> +		release_sock(sk);
>> 		break;
>> 	case TLS_TX_ZEROCOPY_RO:
>> 		rc = do_tls_getsockopt_tx_zc(sk, optval, optlen);
>> 		break;
>> 	case TLS_RX_EXPECT_NO_PAD:
>> 		rc = do_tls_getsockopt_no_pad(sk, optval, optlen);
>> 		break;
>> 	default:
>> 		rc = -ENOPROTOOPT;
>> 		break;
>> 	}
>> 	return rc;
>> }
>>
>> Of cause, I will clean the lock in do_tls_getsockopt_conf(). What do you
>> guys think?
> 
> I'd suggest to take the lock around the entire switch statement.

I get it. I will send a v2 later.

Thanks,
Hangyu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ