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, 08 Apr 2008 16:56:53 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	rjw@...k.pl
Cc:	linux-kernel@...r.kernel.org, marcus@...ter.se
Subject: Re: [Bug #10326] inconsistent lock state in net_rx_action

From: "Rafael J. Wysocki" <rjw@...k.pl>
Date: Wed,  9 Apr 2008 01:02:09 +0200 (CEST)

> Bug-Entry	: http://bugzilla.kernel.org/show_bug.cgi?id=10326
> Subject		: inconsistent lock state in net_rx_action
> Submitter	: Marcus Better <marcus@...ter.se>
> Date		: 2008-03-25 13:21 (15 days old)
> Patch		: http://bugzilla.kernel.org/show_bug.cgi?id=10326#c20

This is already fixed by:

commit 50fd4407b8bfbde7c1a0bfe4f24de7df37164342
Author: David S. Miller <davem@...emloft.net>
Date:   Thu Mar 27 17:42:50 2008 -0700

    [NET]: Use local_irq_{save,restore}() in napi_complete().
    
    Based upon a lockdep report.
    
    Since ->poll() can be invoked from netpoll with interrupts
    disabled, we must not unconditionally enable interrupts
    in napi_complete().
    
    Instead we must use local_irq_{save,restore}().
    
    Noticed by Peter Zijlstra:
    
    <irqs disabled>
    
      netpoll_poll()
        poll_napi()
          spin_trylock(&napi->poll_lock)
          poll_one_napi()
            napi->poll() := sky2_poll()
              napi_complete()
                local_irq_disable()
                local_irq_enable() <--- *BUG*
    
      <irq>
        irq_exit()
          do_softirq()
            net_rx_action()
              spin_lock(&napi->poll_lock) <--- Deadlock!
    
    Because we still hold the lock....
    
    Signed-off-by: David S. Miller <davem@...emloft.net>

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a2f0032..fae6a7e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -383,9 +383,11 @@ static inline void __napi_complete(struct napi_struct *n)
 
 static inline void napi_complete(struct napi_struct *n)
 {
-	local_irq_disable();
+	unsigned long flags;
+
+	local_irq_save(flags);
 	__napi_complete(n);
-	local_irq_enable();
+	local_irq_restore(flags);
 }
 
 /**
--
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