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>] [day] [month] [year] [list]
Message-Id: <1290614272-3213-1-git-send-email-namhyung@gmail.com>
Date:	Thu, 25 Nov 2010 00:57:52 +0900
From:	Namhyung Kim <namhyung@...il.com>
To:	Jens Axboe <jaxboe@...ionio.com>, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Dan Carpenter <error27@...il.com>,
	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH v2] generic-ipi: add lock context annotations

The ipi_call_[un]lock[_irq] functions grab/release a spin lock
but were missing proper annotations. Add them. This fixes
following sparse warnings:

 kernel/smp.c:513:6: warning: context imbalance in 'ipi_call_lock' - wrong count at exit
 kernel/smp.c:518:6: warning: context imbalance in 'ipi_call_unlock' - unexpected unlock
 kernel/smp.c:523:6: warning: context imbalance in 'ipi_call_lock_irq' - wrong count at exit
 kernel/smp.c:528:6: warning: context imbalance in 'ipi_call_unlock_irq' - unexpected unlock

Signed-off-by: Namhyung Kim <namhyung@...il.com>
---
 include/linux/smp.h |    8 ++++----
 kernel/smp.c        |    4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 6dc95ca..f969345 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -86,10 +86,10 @@ int smp_call_function_any(const struct cpumask *mask,
 #ifdef CONFIG_USE_GENERIC_SMP_HELPERS
 void generic_smp_call_function_single_interrupt(void);
 void generic_smp_call_function_interrupt(void);
-void ipi_call_lock(void);
-void ipi_call_unlock(void);
-void ipi_call_lock_irq(void);
-void ipi_call_unlock_irq(void);
+void ipi_call_lock(void) __acquires(call_function.lock);
+void ipi_call_unlock(void) __releases(call_function.lock);
+void ipi_call_lock_irq(void) __acquires(call_function.lock);
+void ipi_call_unlock_irq(void) __releases(call_function.lock);
 #endif
 
 /*
diff --git a/kernel/smp.c b/kernel/smp.c
index 12ed8b0..5a62f1f 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -511,21 +511,25 @@ int smp_call_function(smp_call_func_t func, void *info, int wait)
 EXPORT_SYMBOL(smp_call_function);
 
 void ipi_call_lock(void)
+	__acquires(call_function.lock)
 {
 	raw_spin_lock(&call_function.lock);
 }
 
 void ipi_call_unlock(void)
+	__releases(call_function.lock)
 {
 	raw_spin_unlock(&call_function.lock);
 }
 
 void ipi_call_lock_irq(void)
+	__acquires(call_function.lock)
 {
 	raw_spin_lock_irq(&call_function.lock);
 }
 
 void ipi_call_unlock_irq(void)
+	__releases(call_function.lock)
 {
 	raw_spin_unlock_irq(&call_function.lock);
 }
-- 
1.7.0.4

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