Make SLES9 "get_kernel_version" work on the kernel binary again
As reported by Andy Whitcroft, at least the SLES9 initrd build process
depends on getting the kernel version from the kernel binary. It does
that by simply trawling the binary and looking for the signature of the
"linux_banner" string (the string "Linux version " to be exact. Which
is really broken in itself, but whatever..)
That got broken when the string was changed to allow /proc/version to
change the UTS release information dynamically, and "get_kernel_version"
thus returned "%s" (see commit a2ee8649ba
:
"[PATCH] Fix linux banner utsname information").
This just restores "linux_banner" as a static string, which should fix
the version finding. And /proc/version simply uses a different string.
To avoid wasting even that miniscule amount of memory, the early boot
string should really be marked __initdata, but that just causes the same
bug in SLES9 to re-appear, since it will then find other occurrences of
"Linux version " first.
Cc: Andy Whitcroft <apw@shadowen.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andi Kleen <ak@suse.de>
Cc: Andrew Morton <akpm@osdl.org>
Cc: Steve Fox <drfickle@us.ibm.com>
Acked-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
9202f32558
commit
8993780a6e
4 changed files with 17 additions and 10 deletions
|
@ -47,6 +47,7 @@
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
#include <linux/crash_dump.h>
|
#include <linux/crash_dump.h>
|
||||||
#include <linux/pid_namespace.h>
|
#include <linux/pid_namespace.h>
|
||||||
|
#include <linux/compile.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
@ -253,8 +254,15 @@ static int version_read_proc(char *page, char **start, off_t off,
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = sprintf(page, linux_banner,
|
/* FIXED STRING! Don't touch! */
|
||||||
utsname()->release, utsname()->version);
|
len = snprintf(page, PAGE_SIZE,
|
||||||
|
"%s version %s"
|
||||||
|
" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
|
||||||
|
" (" LINUX_COMPILER ")"
|
||||||
|
" %s\n",
|
||||||
|
utsname()->sysname,
|
||||||
|
utsname()->release,
|
||||||
|
utsname()->version);
|
||||||
return proc_calc_metrics(page, start, off, count, eof, len);
|
return proc_calc_metrics(page, start, off, count, eof, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
#include <asm/bug.h>
|
#include <asm/bug.h>
|
||||||
|
|
||||||
extern const char linux_banner[];
|
|
||||||
|
|
||||||
#define INT_MAX ((int)(~0U>>1))
|
#define INT_MAX ((int)(~0U>>1))
|
||||||
#define INT_MIN (-INT_MAX - 1)
|
#define INT_MIN (-INT_MAX - 1)
|
||||||
#define UINT_MAX (~0U)
|
#define UINT_MAX (~0U)
|
||||||
|
|
|
@ -483,6 +483,12 @@ void __init __attribute__((weak)) smp_setup_processor_id(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char linux_banner[] =
|
||||||
|
"Linux version " UTS_RELEASE
|
||||||
|
" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
|
||||||
|
" (" LINUX_COMPILER ")"
|
||||||
|
" " UTS_VERSION "\n";
|
||||||
|
|
||||||
asmlinkage void __init start_kernel(void)
|
asmlinkage void __init start_kernel(void)
|
||||||
{
|
{
|
||||||
char * command_line;
|
char * command_line;
|
||||||
|
@ -509,7 +515,7 @@ asmlinkage void __init start_kernel(void)
|
||||||
boot_cpu_init();
|
boot_cpu_init();
|
||||||
page_address_init();
|
page_address_init();
|
||||||
printk(KERN_NOTICE);
|
printk(KERN_NOTICE);
|
||||||
printk(linux_banner, UTS_RELEASE, UTS_VERSION);
|
printk(linux_banner);
|
||||||
setup_arch(&command_line);
|
setup_arch(&command_line);
|
||||||
unwind_setup();
|
unwind_setup();
|
||||||
setup_per_cpu_areas();
|
setup_per_cpu_areas();
|
||||||
|
|
|
@ -33,8 +33,3 @@ struct uts_namespace init_uts_ns = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(init_uts_ns);
|
EXPORT_SYMBOL_GPL(init_uts_ns);
|
||||||
|
|
||||||
const char linux_banner[] =
|
|
||||||
"Linux version %s (" LINUX_COMPILE_BY "@"
|
|
||||||
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") %s\n";
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue