[Crash-utility] Re: linux_banner problem in 2.6.20/Ubuntu
Dave Anderson
anderson at redhat.com
Mon Mar 12 17:25:21 UTC 2007
Alex Sidorenko wrote:
> Hi Dave,
>
> trying the latest crash-4.0-3.20 on the latest Ubuntu/feisty kernel
> 2.6.20-9-generic I have found that live access does not work because of the
> following mismatch:
>
> /proc/version:
> Linux version 2.6.20-9-generic (root at rothera) (gcc version 4.1.2 (Ubuntu
> 4.1.2-0ubuntu3)) #2 SMP Mon Feb 26 03:01:44 UTC 2007
> linux_banner:
> Linux version 2.6.20-9-generic (root at rothera) (gcc version 4.1.2 (Ubuntu
> 4.1.2-0ubuntu3)) #2 SMP Mon Feb 26 03:01:44 UTC 2007 (Ubuntu
> 2.6.20-9.16-generic)
>
> Looking at 2.6.20 sources (as provided in Ubuntu package) we see:
>
> ----------------------------------------------------------------------------------------
> const char linux_banner[] =
> "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
> LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION
> #ifdef CONFIG_VERSION_SIGNATURE
> " (" CONFIG_VERSION_SIGNATURE ")"
> #endif
> "\n";
>
> const char linux_proc_banner[] =
> "%s version %s"
> " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
> " (" LINUX_COMPILER ") %s\n";
> ----------------------------------------------------------------------------------------
>
> As a result, these two strings will be different if CONFIG_VERSION_SIGNATURE
> is defined as non-empty string.
>
> The comparison crash uses is (kernel.c):
>
> if (strlen(kt->proc_version) && !STREQ(buf, kt->proc_version)) {
> if (CRASHDEBUG(1)) {
> fprintf(fp, "/proc/version:\n%s",
> kt->proc_version);
> fprintf(fp, "linux_banner:\n%s\n", buf);
> }
> goto bad_match;
>
> I tried to fix the problem by replacing STREQ with STRNEQ. Unfortunately, this
> does not work as both strings are LF-terminated. So I had to use
>
> --- kernel.c.orig 2007-02-21 15:52:01.000000000 -0500
> +++ kernel.c 2007-03-11 08:20:38.468024104 -0400
> @@ -498,7 +498,8 @@
> error(WARNING, "cannot read linux_banner string\n");
>
> if (ACTIVE()) {
> - if (strlen(kt->proc_version) && !STREQ(buf, kt->proc_version))
> {
> + int cmplen = strlen(kt->proc_version)-1;
> + if (cmplen>0 && strncmp(buf, kt->proc_version, cmplen) != 0) {
> if (CRASHDEBUG(1)) {
> fprintf(fp, "/proc/version:\n%s",
> kt->proc_version);
>
> Please note that this seems to be Ubuntu-specific problem - the generic
> 2.6.20.2 has linux_banner definition without CONFIG_VERSION_SIGNATURE.
> Searching Google for "linux CONFIG_VERSION_SIGNATURE" I can see only results
> related to Ubuntu.
>
> Regards,
> Alex
Hi Alex,
This looks fine -- queued for the next release.
Thanks,
Dave
More information about the Crash-utility
mailing list