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:	Wed, 14 Oct 2009 17:32:51 +0800
From:	Cong Wang <amwang@...hat.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	linux-kernel@...r.kernel.org, Ben Woodard <bwoodard@...l.gov>,
	David Howells <dhowells@...hat.com>,
	Brian Behlendorf <behlendorf1@...l.gov>
Subject: Re: [Patch v4] rwsem: fix rwsem_is_locked() bugs

Andrew Morton wrote:
> On Thu, 8 Oct 2009 05:23:53 -0400
> Amerigo Wang <amwang@...hat.com> wrote:
> 
>> --- a/include/linux/rwsem-spinlock.h
>> +++ b/include/linux/rwsem-spinlock.h
>> @@ -71,7 +71,13 @@ extern void __downgrade_write(struct rw_semaphore *sem);
>>  
>>  static inline int rwsem_is_locked(struct rw_semaphore *sem)
>>  {
>> -	return (sem->activity != 0);
>> +	int ret = 1;
>> +
>> +	if (spin_trylock_irq(&sem->wait_lock)) {
>> +		ret = (sem->activity != 0);
>> +		spin_unlock_irq(&sem->wait_lock);
>> +	}
>> +	return ret;
>>  }
> 
> a) probably to large to be inlined


Yeah, maybe, I forgot spin_trylock_irq() and spin_unlock_irq
are macros.

> 
> b) the function will now cause bugs if called under
>    local_irq_disable().  That wasn't the case before.  Fixable via
>    spin_lock_irqsave().
> 
> In the present kernel there don't appear to be any irqs-off callers. 
> There may of course be some out-of-tree ones which will get bitten by
> this semantic change.
> 
> If we decide to leave this new rule in place then we should add a
> WARN_ON(irqs_disabled()) to prevent hitting people with a nasty, subtle
> bug.
> 
> Methinks that _irqsave() is better.


My bad, I misunderstood spin_lock_irqsave(), thus used spin_lock_irq().
:( Will update the patch now.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ