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:   Tue, 17 Jan 2017 11:03:20 -0800
From:   John Fastabend <john.fastabend@...il.com>
To:     David Miller <davem@...emloft.net>
Cc:     jasowang@...hat.com, mst@...hat.com, john.r.fastabend@...el.com,
        netdev@...r.kernel.org, alexei.starovoitov@...il.com,
        daniel@...earbox.net
Subject: Re: [net PATCH v4 2/6] virtio_net: wrap rtnl_lock in test for calling
 with lock already held

On 17-01-17 08:57 AM, David Miller wrote:
> From: John Fastabend <john.fastabend@...il.com>
> Date: Sun, 15 Jan 2017 15:59:47 -0800
> 
>> @@ -2358,7 +2371,10 @@ static void remove_vq_common(struct virtnet_info *vi)
>>  	/* Free unused buffers in both send and recv, if any. */
>>  	free_unused_bufs(vi);
>>  
>> -	free_receive_bufs(vi);
>> +	if (rtnl_is_locked())
>> +		_free_receive_bufs(vi);
>> +	else
>> +		free_receive_bufs(vi);
>>  
>>  	free_receive_page_frags(vi);
>>  
> 
> This doesn't work.  rtnl_is_locked() doesn't tell if _you_ own the mutex, it
> just says that someone does.
> 
> So if we now execute this code without taking the RTNL lock just because some
> other thread of control holds it, we introduce a race.
> 

yeah this bit is junk. dang. Trying to get this locking right without duplicate
code or pushing around lock_me variables is getting tricky.

.John

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ