[Makedumpfile Patch v2 7/7] mem-usage: allow to work only with -f for kernel version < 4.11
Atsushi Kumagai
ats-kumagai at wm.jp.nec.com
Wed Mar 1 20:49:42 PST 2017
Hello Pratyush,
>PT_LOAD of kcore does not have valid p_paddr values for kernel version
>less that v4.11. Therefore, older kernel will no long work for mem-usage
>with current makedumpfile code. They can only work when they are patched
>with fix to "update physical address for kcore ram and text".
>
>This patch fixes the makedumpfile so that it does not allow to work
>older kernel for --mem-usage until someone is sure that kernel is
>rightly patched and so uses -f in command line.
>
>Signed-off-by: Pratyush Anand <panand at redhat.com>
>---
> makedumpfile.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/makedumpfile.c b/makedumpfile.c
>index 3b8e9810468d..bf006ea5dd5f 100644
>--- a/makedumpfile.c
>+++ b/makedumpfile.c
>@@ -11269,6 +11269,12 @@ main(int argc, char *argv[])
> MSG("Try `makedumpfile --help' for more information.\n");
> goto out;
> }
>+ if (info->kernel_version < KERNEL_VERSION(4, 11, 0) &&
>+ !info->flag_force) {
>+ MSG("mem-usage not supported for this kernel.\n");
>+ MSG("You can try with -f if your kernel's kcore has valid p_paddr\n");
>+ return COMPLETED;
>+ }
Should use "goto out" to prevent memory leaks since some heap blocks are
allocated at the head of main().
BTW, the descriptions of -f option in man and print_usage() don't mention this usage:
-f Force existing DUMPFILE to be overwritten.
Example:
# makedumpfile -f -d 31 -x vmlinux /proc/vmcore dumpfile
This command overwrites DUMPFILE even if it already exists.
so they should be updated.
Thanks,
Atsushi Kumagai
More information about the kexec
mailing list