All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged] rcu-make-call_rcu-print-mem_dump_obj-info-for-double-freed-callback.patch removed from -mm tree
@ 2021-01-07 22:32 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-01-07 22:32 UTC (permalink / raw)
  To: andrii, axboe, cl, iamjoonsoo.kim, ming.lei, mm-commits, paulmck,
	penberg, rientjes, vbabka


The patch titled
     Subject: rcu: make call_rcu() print mem_dump_obj() info for double-freed callback
has been removed from the -mm tree.  Its filename was
     rcu-make-call_rcu-print-mem_dump_obj-info-for-double-freed-callback.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: "Paul E. McKenney" <paulmck@kernel.org>
Subject: rcu: make call_rcu() print mem_dump_obj() info for double-freed callback

The debug-object double-free checks in __call_rcu() print out the RCU
callback function, which is usually sufficient to track down the double
free.  However, all uses of things like queue_rcu_work() will have the
same RCU callback function (rcu_work_rcufn() in this case), so a
diagnostic message for a double queue_rcu_work() needs more than just the
callback function.

This commit therefore calls mem_dump_obj() to dump out any additional
available information on the double-freed callback.

Link: https://lkml.kernel.org/r/20210106011750.13709-5-paulmck@kernel.org
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reported-by: Andrii Nakryiko <andrii@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/rcu/tree.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/kernel/rcu/tree.c~rcu-make-call_rcu-print-mem_dump_obj-info-for-double-freed-callback
+++ a/kernel/rcu/tree.c
@@ -2941,6 +2941,7 @@ static void check_cb_ovld(struct rcu_dat
 static void
 __call_rcu(struct rcu_head *head, rcu_callback_t func)
 {
+	static atomic_t doublefrees;
 	unsigned long flags;
 	struct rcu_data *rdp;
 	bool was_alldone;
@@ -2954,8 +2955,10 @@ __call_rcu(struct rcu_head *head, rcu_ca
 		 * Use rcu:rcu_callback trace event to find the previous
 		 * time callback was passed to __call_rcu().
 		 */
-		WARN_ONCE(1, "__call_rcu(): Double-freed CB %p->%pS()!!!\n",
-			  head, head->func);
+		if (atomic_inc_return(&doublefrees) < 4) {
+			pr_err("%s(): Double-freed CB %p->%pS()!!!  ", __func__, head, head->func);
+			mem_dump_obj(head);
+		}
 		WRITE_ONCE(head->func, rcu_leak_callback);
 		return;
 	}
_

Patches currently in -mm which might be from paulmck@kernel.org are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-07 22:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 22:32 [merged] rcu-make-call_rcu-print-mem_dump_obj-info-for-double-freed-callback.patch removed from -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.