Commit 9eaf45a2 authored by Muchun Song's avatar Muchun Song Committed by Treehugger Robot
Browse files

UPSTREAM: mm: kfence: fix missing objcg housekeeping for SLAB

The objcg is not cleared and put for kfence object when it is freed,
which could lead to memory leak for struct obj_cgroup and wrong
statistics of NR_SLAB_RECLAIMABLE_B or NR_SLAB_UNRECLAIMABLE_B.

Since the last freed object's objcg is not cleared,
mem_cgroup_from_obj() could return the wrong memcg when this kfence
object, which is not charged to any objcgs, is reallocated to other
users.

A real word issue [1] is caused by this bug.

Bug: 254441685
Link: https://lore.kernel.org/all/000000000000cabcb505dae9e577@google.com/

 [1]
Reported-by: default avatar <syzbot+f8c45ccc7d5d45fc5965@syzkaller.appspotmail.com>
Fixes: d3fb45f3 ("mm, kfence: insert KFENCE hooks for SLAB")
Signed-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit ae085d7f)
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: Ia8822dd14b0d9105c42a7a7cfbd8d12ce0ea5194
parent 7923c77f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment