diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2021-04-09 11:22:51 -0500 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2021-04-17 09:15:15 +0200 |
commit | bb6f6f107190f2e6e90a272ea26edb172c37c452 (patch) | |
tree | 3fc40a87d4a52a41f1c7e392da0479335697042f /kexec/arch/ppc64/crashdump-ppc64.c | |
parent | 0b69943f26ca4e126c46d52a7a94efdd82729511 (diff) |
kexec: Remove the error prone kernel_version function
During kexec there are two kernel versions at play. The version of
the running kernel and the version of the kernel that will be booted.
On powerpc it appears people have been using the version of the
running kernel to attempt to detect properties of the kernel to be
booted which is just wrong. As the linux kernel version that is being
detected is a no longer supported kernel just remove that buggy and
confused code.
On x86_64 the kernel_version is used to compute the starting virtual
address of the running kernel so a proper core dump may be generated.
Using the kernel_version stopped working a while ago when the starting
virtual address became randomized.
The old code was kept for the case where the kernel was not built with
randomization support, but there is nothing in reading /proc/kcore
that won't work to detect the starting virtual address even there.
In fact /proc/kcore must have the starting virtual address or a
debugger can not make sense of the running kernel.
So just make computing the starting virtual address on x86_64
unconditional. With a hard coded fallback just in case something went
wrong.
Doing something with kernel_version() has become important as recent
stable kernels have seen the minor version to > 255. Just removing
kernel_version() looks like the best option.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/ppc64/crashdump-ppc64.c')
-rw-r--r-- | kexec/arch/ppc64/crashdump-ppc64.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c index 26f9a01..addd769 100644 --- a/kexec/arch/ppc64/crashdump-ppc64.c +++ b/kexec/arch/ppc64/crashdump-ppc64.c @@ -478,8 +478,7 @@ static int add_cmdline_param(char *cmdline, uint64_t addr, char *cmdstr, strcat(str, byte); len = strlen(str); cmdlen = strlen(cmdline) + len; - cmdline_size = (kernel_version() < KERNEL_VERSION(3, 15, 0) ? - 512 : COMMAND_LINE_SIZE); + cmdline_size = COMMAND_LINE_SIZE; if (cmdlen > (cmdline_size - 1)) die("Command line overflow\n"); strcat(cmdline, str); |