mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 13:14:07 +08:00
01dc0386ef
Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC to allow architectures to request having modules data in vmalloc area instead of module area. This is required on powerpc book3s/32 in order to set data non executable, because it is not possible to set executability on page basis, this is done per 256 Mbytes segments. The module area has exec right, vmalloc area has noexec. This can also be useful on other powerpc/32 in order to maximize the chance of code being close enough to kernel core to avoid branch trampolines. Cc: Jason Wessel <jason.wessel@windriver.com> Acked-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Douglas Anderson <dianders@chromium.org> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> [mcgrof: rebased in light of kernel/module/kdb.c move] Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
63 lines
1.4 KiB
C
63 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Module kdb support
|
|
*
|
|
* Copyright (C) 2010 Jason Wessel
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/kdb.h>
|
|
#include "internal.h"
|
|
|
|
/*
|
|
* kdb_lsmod - This function implements the 'lsmod' command. Lists
|
|
* currently loaded kernel modules.
|
|
* Mostly taken from userland lsmod.
|
|
*/
|
|
int kdb_lsmod(int argc, const char **argv)
|
|
{
|
|
struct module *mod;
|
|
|
|
if (argc != 0)
|
|
return KDB_ARGCOUNT;
|
|
|
|
kdb_printf("Module Size modstruct Used by\n");
|
|
list_for_each_entry(mod, &modules, list) {
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
|
|
kdb_printf("%-20s%8u", mod->name, mod->core_layout.size);
|
|
#ifdef CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC
|
|
kdb_printf("/%8u", mod->data_layout.size);
|
|
#endif
|
|
kdb_printf(" 0x%px ", (void *)mod);
|
|
#ifdef CONFIG_MODULE_UNLOAD
|
|
kdb_printf("%4d ", module_refcount(mod));
|
|
#endif
|
|
if (mod->state == MODULE_STATE_GOING)
|
|
kdb_printf(" (Unloading)");
|
|
else if (mod->state == MODULE_STATE_COMING)
|
|
kdb_printf(" (Loading)");
|
|
else
|
|
kdb_printf(" (Live)");
|
|
kdb_printf(" 0x%px", mod->core_layout.base);
|
|
#ifdef CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC
|
|
kdb_printf("/0x%px", mod->data_layout.base);
|
|
#endif
|
|
|
|
#ifdef CONFIG_MODULE_UNLOAD
|
|
{
|
|
struct module_use *use;
|
|
|
|
kdb_printf(" [ ");
|
|
list_for_each_entry(use, &mod->source_list,
|
|
source_list)
|
|
kdb_printf("%s ", use->target->name);
|
|
kdb_printf("]\n");
|
|
}
|
|
#endif
|
|
}
|
|
|
|
return 0;
|
|
}
|