linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kmemleak: fix check for softirq context
@ 2019-05-17 17:15 Dmitry Vyukov
  2019-05-17 21:37 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Vyukov @ 2019-05-17 17:15 UTC (permalink / raw)
  To: catalin.marinas, akpm; +Cc: Dmitry Vyukov, linux-mm, linux-kernel

From: Dmitry Vyukov <dvyukov@google.com>

in_softirq() is a wrong predicate to check if we are in a softirq context.
It also returns true if we have BH disabled, so objects are falsely
stamped with "softirq" comm. The correct predicate is in_serving_softirq().

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
---
 mm/kmemleak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index e57bf810f7983..6584ff9778895 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -588,7 +588,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
 	if (in_irq()) {
 		object->pid = 0;
 		strncpy(object->comm, "hardirq", sizeof(object->comm));
-	} else if (in_softirq()) {
+	} else if (in_serving_softirq()) {
 		object->pid = 0;
 		strncpy(object->comm, "softirq", sizeof(object->comm));
 	} else {
-- 
2.21.0.1020.gf2820cf01a-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-18  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-17 17:15 [PATCH] kmemleak: fix check for softirq context Dmitry Vyukov
2019-05-17 21:37 ` Andrew Morton
2019-05-18  7:10   ` Dmitry Vyukov
2019-05-18  9:47     ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).