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]
Date:	Tue, 20 Apr 2010 09:21:47 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	paulmck@...ux.vnet.ibm.com
Cc:	Eric Paris <eparis@...hat.com>, Eric Paris <eparis@...isplace.org>,
	Miles Lane <miles.lane@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: INFO: suspicious rcu_dereference_check() usage -
 include/linux/cgroup.h:492 invoked rcu_dereference_check() without
 protection!

On Mon, 2010-04-19 at 20:04 -0700, Paul E. McKenney wrote:
> On Mon, Apr 19, 2010 at 09:25:29PM -0400, Eric Paris wrote:

> > That one is also fixed so feel free to add a tested or something from
> > me.  But we've got another, weeeee!  If there some way I could get all
> > of these at once?
> 
> Sure!  I -think- that if you remove the first "if" statement in
> lockdep_rcu_dereference() in kernel/lockdep.c, you will get lots of them
> all at once.  Maybe more than your console log is able to hold...
> 
> So another approach would be to print only the first 100 or some such.
> 
> It -looks- to me that you could make __debug_locks_off() atomically
> decrement a counter rather than just setting it to zero, see
> include/linux/debug_locks.h.  I suspect that atomic_dec_not_zero()
> would work very well for you here.
> 
> Peter probably knows a better approach, but those would work.

Right, so because the RCU checking stuff doesn't poke at the lockdep
class chains, but simply validates the current task state we can delay
or altogether not disable lockdep.

So something like the below, or simply remove that debug_locks_off()
thing alltogether.

---
 kernel/lockdep.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 78325f8..31c8738 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -3784,12 +3784,16 @@ void lockdep_sys_exit(void)
 	}
 }
 
+static atomic_t rcu_warns = ATOMIC_INIT(100);
+
 void lockdep_rcu_dereference(const char *file, const int line)
 {
 	struct task_struct *curr = current;
 
-	if (!debug_locks_off())
-		return;
+	if (!debug_locks || atomic_dec_and_test(&rcu_warns)) {
+		if (!debug_locks_off())
+			return;
+	}
 	printk("\n===================================================\n");
 	printk(  "[ INFO: suspicious rcu_dereference_check() usage. ]\n");
 	printk(  "---------------------------------------------------\n");


--
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