summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2023-01-19 07:01:10 +0300
committerAndrew Morton <akpm@linux-foundation.org>2023-02-03 09:33:25 +0300
commit6061e740822530a4ef443548b19c4e0bc6342c7a (patch)
treed808393e8df943d0d95dbf5c3b29f76d0df15307 /block
parent4cf1fe34fd18b752ae2403927277715d4444f331 (diff)
downloadlinux-6061e740822530a4ef443548b19c4e0bc6342c7a.tar.xz
mm/kmemleak: simplify kmemleak_cond_resched() usage
Patch series "mm/kmemleak: Simplify kmemleak_cond_resched() & fix UAF", v2. 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. This patch (of 2): The presence of a pinned argument and the 64k loop count make kmemleak_cond_resched() a bit more complex to read. The pinned argument is used only by first kmemleak_scan() loop. Simplify the usage of kmemleak_cond_resched() by removing the pinned argument and always do a get_object()/put_object() sequence. In addition, the 64k loop is removed by using need_resched() to decide if kmemleak_cond_resched() should be called. Link: https://lkml.kernel.org/r/20230119040111.350923-1-longman@redhat.com Link: https://lkml.kernel.org/r/20230119040111.350923-2-longman@redhat.com Signed-off-by: Waiman Long <longman@redhat.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Muchun Song <songmuchun@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'block')
0 files changed, 0 insertions, 0 deletions