b319cea805
commit ac3b432839
("module: replace module_layout with module_memory")
introduced a set of memory regions for the module layout sharing the
same attributes. However, it didn't update the kmemleak scanned areas
which intended to limit kmemleak scan to sections containing writable
data. This means sections such as .text and .rodata are scanned by
kmemleak.
Refine the scanned areas for modules by limiting it to MOD_TEXT and
MOD_INIT_TEXT mod_mem regions.
CC: Song Liu <song@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
21 lines
465 B
C
21 lines
465 B
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Module kmemleak support
|
|
*
|
|
* Copyright (C) 2009 Catalin Marinas
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/kmemleak.h>
|
|
#include "internal.h"
|
|
|
|
void kmemleak_load_module(const struct module *mod,
|
|
const struct load_info *info)
|
|
{
|
|
/* only scan writable, non-executable sections */
|
|
for_each_mod_mem_type(type) {
|
|
if (type != MOD_DATA && type != MOD_INIT_DATA)
|
|
kmemleak_no_scan(mod->mem[type].base);
|
|
}
|
|
}
|