• Y
    Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" · 13031a84
    Yee Lee 提交于
    stable inclusion
    from stable-v5.10.143
    commit a14f1799ce373b435a2a6253747dedc23ea35abc
    category: bugfix
    bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0U6
    
    Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a14f1799ce373b435a2a6253747dedc23ea35abc
    
    --------------------------------
    
    This reverts commit 23c2d497.
    
    Commit 23c2d497 ("mm: kmemleak: take a full lowmem check in
    kmemleak_*_phys()") brought false leak alarms on some archs like arm64
    that does not init pfn boundary in early booting. The final solution
    lands on linux-6.0: commit 0c24e061 ("mm: kmemleak: add rbtree and
    store physical address for objects allocated with PA").
    
    Revert this commit before linux-6.0. The original issue of invalid PA
    can be mitigated by additional check in devicetree.
    
    The false alarm report is as following: Kmemleak output: (Qemu/arm64)
    unreferenced object 0xffff0000c0170a00 (size 128):
      comm "swapper/0", pid 1, jiffies 4294892404 (age 126.208s)
      hex dump (first 32 bytes):
     62 61 73 65 00 00 00 00 00 00 00 00 00 00 00 00  base............
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<(____ptrval____)>] __kmalloc_track_caller+0x1b0/0x2e4
        [<(____ptrval____)>] kstrdup_const+0x8c/0xc4
        [<(____ptrval____)>] kvasprintf_const+0xbc/0xec
        [<(____ptrval____)>] kobject_set_name_vargs+0x58/0xe4
        [<(____ptrval____)>] kobject_add+0x84/0x100
        [<(____ptrval____)>] __of_attach_node_sysfs+0x78/0xec
        [<(____ptrval____)>] of_core_init+0x68/0x104
        [<(____ptrval____)>] driver_init+0x28/0x48
        [<(____ptrval____)>] do_basic_setup+0x14/0x28
        [<(____ptrval____)>] kernel_init_freeable+0x110/0x178
        [<(____ptrval____)>] kernel_init+0x20/0x1a0
        [<(____ptrval____)>] ret_from_fork+0x10/0x20
    
    This pacth is also applicable to linux-5.17.y/linux-5.18.y/linux-5.19.y
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: NYee Lee <yee.lee@mediatek.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
    Reviewed-by: NZheng Zengkai <zhengzengkai@huawei.com>
    13031a84
kmemleak.c 56.5 KB