linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH v2 0/2] mm/kmemleak: Simplify kmemleak_cond_resched() & fix UAF
@ 2023-01-19  4:01 Waiman Long
  2023-01-19  4:01 ` [RESEND PATCH v2 1/2] mm/kmemleak: Simplify kmemleak_cond_resched() usage Waiman Long
  2023-01-19  4:01 ` [RESEND PATCH v2 2/2] mm/kmemleak: Fix UAF bug in kmemleak_scan() Waiman Long
  0 siblings, 2 replies; 7+ messages in thread
From: Waiman Long @ 2023-01-19  4:01 UTC (permalink / raw)
  To: Catalin Marinas, Andrew Morton
  Cc: linux-mm, linux-kernel, Muchun Song, Waiman Long

It was found that a KASAN use-after-free error was reported in the
kmemleak_scan() function. After further examination, it is believe
that even though a reference is taken from the current object, it does
not prevent the object pointed to by the next pointer from going away
after a cond_resched().

To fix that, additional flags are added to make sure that the current
object won't be removed from the object_list during the duration of
the cond_resched() to ensure the validity of the next pointer.

While making the change, I also simplify the current usage of
kmemleak_cond_resched() to make it easier to understand.

Waiman Long (2):
  mm/kmemleak: Simplify kmemleak_cond_resched() usage
  mm/kmemleak: Fix UAF bug in kmemleak_scan()

 [v2: Update patch 2 to prevent object_list removal of current object]

 mm/kmemleak.c | 83 +++++++++++++++++++++++++--------------------------
 1 file changed, 41 insertions(+), 42 deletions(-)

-- 
2.31.1



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

end of thread, other threads:[~2023-01-23 19:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19  4:01 [RESEND PATCH v2 0/2] mm/kmemleak: Simplify kmemleak_cond_resched() & fix UAF Waiman Long
2023-01-19  4:01 ` [RESEND PATCH v2 1/2] mm/kmemleak: Simplify kmemleak_cond_resched() usage Waiman Long
2023-01-19  4:01 ` [RESEND PATCH v2 2/2] mm/kmemleak: Fix UAF bug in kmemleak_scan() Waiman Long
2023-01-20 19:18   ` Catalin Marinas
2023-01-20 22:54     ` Waiman Long
2023-01-23 19:24       ` Catalin Marinas
2023-01-23 19:40         ` Waiman Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox