Hello Mikhail, Philipp and Gerald,
For the first time today I'm testing a 5.2.0-0.rc1 kernel that has
been configured with CONFIG_RANDOMIZE_BASE=y, and I have verified
that it runs live using the KERNELOFFSET value from the /proc/kcore
VMCOREINFO as the --kalsr argument.
For live system analysis, it seems that the existing kaslr
code in symbols.c should be able to calculate the offset
by comparing the _stext values from /proc/kallsyms and the
the vmlinux file. But obviously it doesn't, although I
haven't investigate why not.
Also, I can't create a kdump dumpfile, so I can't test that,
so it's not clear whether the initial patchset also requires
the -kaslr argument for vmcores?
Anyway, are you guys planning to post a follow-on patch to make
things work automagically both live and with kdumps?
Thanks,
Dave
----- Original Message -----
>
> Add --kaslr support for s390x kernels configured with
> CONFIG_RANDOMIZE_BASE. Only kdumps or ELF dumps with
> vmcoreinfo are supported.
>
> Suggested-by: Gerald Schaefer <gerald schaefer de ibm com>
> Signed-off-by: Mikhail Zaslonko <zaslonko linux ibm com>
> ---
> help.c | 2 +-
> main.c | 3 ++-
> symbols.c | 9 +++++----
> 3 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/help.c b/help.c
> index ba15dec..47058ed 100644
> --- a/help.c
> +++ b/help.c
> @@ -335,7 +335,7 @@ char *program_usage_info[] = {
> " and verification. The default count is 32768.",
> "",
> " --kaslr offset | auto",
> - " If an x86 or x86_64 kernel was configured with
> CONFIG_RANDOMIZE_BASE,",
> + " If x86, x86_64 or s390x kernel was configured with
> CONFIG_RANDOMIZE_BASE,",
> " the offset value is equal to the difference between the symbol
> values ",
> " compiled into the vmlinux file and their relocated KASLR value.
> If",
> " set to auto, the KASLR offset value will be automatically
> calculated.",
> diff --git a/main.c b/main.c
> index cd282cd..83ccd31 100644
> --- a/main.c
> +++ b/main.c
> @@ -227,7 +227,8 @@ main(int argc, char **argv)
> }
> } else if (STREQ(long_options[option_index].name,
> "kaslr")) {
> if (!machine_type("X86_64") &&
> - !machine_type("ARM64") &&
> !machine_type("X86"))
> + !machine_type("ARM64") &&
> !machine_type("X86") &&
> + !machine_type("S390X"))
> error(INFO, "--kaslr not valid "
> "with this machine type.\n");
> else if (STREQ(optarg, "auto"))
> diff --git a/symbols.c b/symbols.c
> index 77f45f9..1ed75fe 100644
> --- a/symbols.c
> +++ b/symbols.c
> @@ -593,8 +593,8 @@ kaslr_init(void)
> {
> char *string;
>
> - if ((!machine_type("X86_64") && !machine_type("ARM64") &&
> !machine_type("X86")) ||
> - (kt->flags & RELOC_SET))
> + if ((!machine_type("X86_64") && !machine_type("ARM64") &&
> !machine_type("X86") &&
> + !machine_type("S390X")) || (kt->flags & RELOC_SET))
> return;
>
> /*
> @@ -751,7 +751,8 @@ store_symbols(bfd *abfd, int dynamic, void *minisyms,
> long symcount,
> fromend, size, store);
> } else if (!(kt->flags & RELOC_SET))
> kt->flags |= RELOC_FORCE;
> - } else if (machine_type("X86_64") || machine_type("ARM64")) {
> + } else if (machine_type("X86_64") || machine_type("ARM64") ||
> + machine_type("S390X")) {
> if ((kt->flags2 & RELOC_AUTO) && !(kt->flags & RELOC_SET))
> derive_kaslr_offset(abfd, dynamic, from,
> fromend, size, store);
> @@ -823,7 +824,7 @@ store_sysmap_symbols(void)
> strerror(errno));
>
> if (!machine_type("X86") && !machine_type("X86_64") &&
> - !machine_type("ARM64"))
> + !machine_type("ARM64") && !machine_type("S390X"))
> kt->flags &= ~RELOC_SET;
>
> first = 0;
> --
> 2.16.4
>
>
--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility