Skip to contentSkip to conversation

vmlinux header for savecrash.

parisc-linux Bruno Vidal 6 participants 15 messages Jan 21, 2002 – Jan 22, 2002

lore
Share & tools
lore
#0 lore raw

Hi
As I said few days ago, I've a dump driver ready. Now I'm working on a savecrash command. It works fine for the dump, but I need to save with the dump some informations like the running kernel at dump time. So in the dump I've got this informations:
utsname_release and utsname_version. Now, how can I found the right kernel in /boot ? In other word, how can I retrieve utsname informations in a binary file (without system.map and gdb) ?

Thanks.

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]

begin:vcard
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:[email protected]
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

#1 lore raw
Quoted 4 lines · Bruno Vidal

As I said few days ago, I've a dump driver ready. Now I'm working on a savecrash command. It works fine for the dump, but I need to save with the dump some informations like the running kernel at dump time.

Bruno - this is great!

Quoted 5 lines

So in the dump I've got this informations:
utsname_release and utsname_version. Now, how can I found the right kernel in /boot ? In other word, how can I retrieve utsname informations in a binary file (without system.map and gdb) ?

A couple of ideas/hacks:
o assume it's /boot/System.map + /boot/vmlinux. Tell people if they want to use dump/savecrash, that's what they have to do.

o assume it's in /boot. Use fgrep to find the matching strings. Something like

	#!/bin/sh
	cd /boot
	for i in *
	do
		fgrep $1 $i > /dev/null 2>&1
		if [ $? -eq 0 ]
		then
			echo $i
			exit 0
		fi
	done
	exit 1

The case that /boot might not be mounted could cause problems.

Since klogd seems to want System.map, perhaps savecrash could use the same heuristics to find the "right" System.map.
See Documentation/oops-tracing.txt for more details.

hth,
grant

#14 lore raw
In reply to Bruno Vidal

I think the palo command line is listed in dmesg. That will tell exactly which kernel was booted.

Quoted 17 lines · Bruno Vidal

Hi
As I said few days ago, I've a dump driver ready. Now I'm working on a savecrash command. It works fine for the dump, but I need to save with the dump some informations like the running kernel at dump time. So in the dump I've got this informations:
utsname_release and utsname_version. Now, how can I found the right kernel in /boot ? In other word, how can I retrieve utsname informations in a binary file (without system.map and gdb) ?

Thanks.

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]
Signature · 8 lines
James P. Kinney III   \Changing the mobile computing world/
President and COO      \          one Linux user         /
Local Net Solutions,LLC \           at a time.          /
770-493-8244             \.___________________________./

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<[email protected]>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 
#2 lore raw
In reply to Grant Grundler

Sorry, but on my system, fgrep gives nothing
(and by using strings, I found nothing also). And I can't use dmesg buffer, because by definition it is a buffer, so after running sometime, the palo boot strings is not in the buffer anymore. Some new ideas ?

Thanks.

Quoted 42 lines · Grant Grundler
Quoted 4 lines · Bruno Vidal

As I said few days ago, I've a dump driver ready. Now I'm working on a savecrash command. It works fine for the dump, but I need to save with the dump some informations like the running kernel at dump time.

Bruno - this is great!

Quoted 5 lines

So in the dump I've got this informations:
utsname_release and utsname_version. Now, how can I found the right kernel in /boot ? In other word, how can I retrieve utsname informations in a binary file (without system.map and gdb) ?

A couple of ideas/hacks:
o assume it's /boot/System.map + /boot/vmlinux. Tell people if they want to use dump/savecrash, that's what they have to do.

o assume it's in /boot. Use fgrep to find the matching strings. Something like

        #!/bin/sh
        cd /boot
        for i in *
        do
                fgrep $1 $i > /dev/null 2>&1
                if [ $? -eq 0 ]
                then
                        echo $i
                        exit 0
                fi
        done
        exit 1

The case that /boot might not be mounted could cause problems.

Since klogd seems to want System.map, perhaps savecrash could use the same heuristics to find the "right" System.map.
See Documentation/oops-tracing.txt for more details.

hth,
grant

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]

begin:vcard
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:[email protected]
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

#3 lore raw
Quoted 5 lines · Bruno Vidal

Sorry, but on my system, fgrep gives nothing
(and by using strings, I found nothing also). And I can't use dmesg buffer, because by definition it is a buffer, so after running sometime, the palo boot strings is not in the buffer anymore. Some new ideas ?

I think the correct way would be to use libbfd to achieve something similar to the following in "shell notation":

| objdump -t vmlinux| grep " system_utsname"
102860c0 g     O .data  00000186 system_utsname
^ start                 ^ size
| objdump --start-address=0x102860c0 --stop-address=0x10286246 vmlinux
...
102860c0 4c696e75 78000000 00000000 00000000  Linux...........
102860d0 00000000 00000000 00000000 00000000  ................
102860e0 00000000 00000000 00000000 00000000  ................
102860f0 00000000 00000000 00000000 00000000  ................
10286100 00286e6f 6e652900 00000000 00000000  .(none).........
10286110 00000000 00000000 00000000 00000000  ................
10286120 00000000 00000000 00000000 00000000  ................
10286130 00000000 00000000 00000000 00000000  ................
10286140 0000322e 342e3137 2d706131 31000000  ..2.4.17-pa11...
10286150 00000000 00000000 00000000 00000000  ................
10286160 00000000 00000000 00000000 00000000  ................
10286170 00000000 00000000 00000000 00000000  ................
10286180 00000023 3134204d 6f6e204a 616e2032  ...#14 Mon Jan 2
10286190 31203230 3a34323a 33352043 45542032  1 20:42:35 CET 2
102861a0 30303200 00000000 00000000 00000000  002.............

...

Using libbfd it should be feasible to read a "struct new_utsname" from the binaries. Sorry, but don't have the time for a better proof-of-concept than using objdump today.

Enrik

Signature · 4 lines
Enrik Berkhan                                         plan b. GmbH
                                                      Rüppurrer Straße 4
+49-721-388582 (voice)                                76137 Karlsruhe
+49-721-388581 (fax)                                  Germany
#7 lore raw
In reply to Bruno Vidal
Quoted 6 lines · Bruno Vidal

Sorry, but on my system, fgrep gives nothing
(and by using strings, I found nothing also). And I can't use dmesg buffer, because by definition it is a buffer, so after running sometime, the palo boot strings is not in the buffer anymore. Some new ideas ?

I'm not at my PaLinux box, but my intel linux has a dmesg file in /var/log. I seem to recall that HPUX uses a buffer for dmesg. I'll check the PaLinux shortly.

Signature · 8 lines
James P. Kinney III   \Changing the mobile computing world/
President and COO      \          one Linux user         /
Local Net Solutions,LLC \           at a time.          /
770-493-8244             \.___________________________./

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<[email protected]>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 
#4 lore raw
In reply to Enrik Berkhan

Hi
I think that Enrik has a good starting point, where can I find a good how-to about libbfd ? there is nothing under /usr/share/doc ? A web page ?

Thanks.

ps: I don't like any solution based on the dmesg, because by definition it is volatile (even files under /var/log). For example a server running since a long time, has always nfs file handle, or file system full, etc.... so you cannot be sure that your palo string will be there. So I greatly prefer a solution based on bfd and look under /boot (or any other directory found on palo line option)

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]

begin:vcard
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:[email protected]
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

#5 lore raw

Bruno,

Quoted 3 lines · Bruno Vidal

I think that Enrik has a good starting point, where can I find a good how-to about libbfd ? there is nothing under /usr/share/doc ? A web page ?

(assuming debian) you can install bintutils-doc´ and will be able to do info bfd´ afterwards. But it´s far from a tutorial ...

Enrik

Signature · 4 lines
Enrik Berkhan                                         plan b. GmbH
                                                      Rüppurrer Straße 4
+49-721-388582 (voice)                                76137 Karlsruhe
+49-721-388581 (fax)                                  Germany
#6 lore raw
In reply to Bruno Vidal
Quoted 4 lines · Bruno Vidal

Hi
I think that Enrik has a good starting point, where can I find a good how-to about libbfd ? there is nothing under /usr/share/doc ? A web page ?

apt-get install binutils-doc
info bfd

Signature · 1 line
Revolutions do not require corporate support.
#8 lore raw
In reply to Bruno Vidal
Quoted 2 lines · Bruno Vidal

Sorry, but on my system, fgrep gives nothing
(and by using strings, I found nothing also).

grundler@gsyprf11:~$ uname -a
Linux gsyprf11.external.hp.com 2.4.17-pa11 #3 SMP Fri Jan 18 23:32:06 PST 2002 parisc64 unknown
grundler@gsyprf11:~$ strings /boot/vmlinux | fgrep 2.4.17
Linux version 2.4.17-pa11 (grundler@gsyprf10) (gcc version 3.0.3) #3 SMP Fri Jan 18 23:32:06 PST 2002
Linux 2.4.17-pa11
2.4.17-pa11
grundler@gsyprf11:~$ 

Perhaps a simple fgrep isn't sufficient for what you have. You might need to pick out certain fields.

Quoted 4 lines

And I
can't use dmesg buffer, because by definition it is a buffer, so after running sometime, the palo boot strings is not in the buffer anymore.

right. They should be in the /var/log/messages if they are no longer in the dmesg buffer.

Quoted 1 line

Some new ideas ?

Randolph Chung and I were wondering if dump driver could save a parameter passed in by palo: eg "boot_kernel=/boot/vmlinux-pa11". I haven't checked if something like that already exists.

grant

#9 lore raw
Quoted 3 lines

Randolph Chung and I were wondering if dump driver could save a parameter passed in by palo: eg "boot_kernel=/boot/vmlinux-pa11". I haven't checked if something like that already exists.

Is this really an arch-dependent problem? How do other architectures (I think lkcd works on i386 and alpha?) do this?

randolph

Signature · 4 lines
   @..@                                         http://www.TauSq.org/
  (----)
 ( >__< )
 ^^ ~~ ^^
#11 lore raw
In reply to Grant Grundler

Hi
I don't know how to retrieve option pass to the kernel, but give me some clue, and I'll add this information in the dump header asap, because it is a really good idea :-)

Quoted 6 lines · Grant Grundler

Randolph Chung and I were wondering if dump driver could save a parameter passed in by palo: eg "boot_kernel=/boot/vmlinux-pa11". I haven't checked if something like that already exists.

grant

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]

begin:vcard
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:[email protected]
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

#10 lore raw
In reply to Randolph Chung

lkcd is really simple, it takes /boot/vmlinux, /boot/kerntype, and /boot/System.map. It don't take care about that, it is the user problem :-(, I want to be a little more user friendly.

Quoted 14 lines · Randolph Chung
Quoted 4 lines

Randolph Chung and I were wondering if dump driver could save a parameter passed in by palo: eg "boot_kernel=/boot/vmlinux-pa11". I haven't checked if something like that already exists.

Is this really an arch-dependent problem? How do other architectures (I think lkcd works on i386 and alpha?) do this?

randolph
--
@..@ http://www.TauSq.org/
(----)
( >__< )
^^ ~~ ^^

Signature · 3 lines
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	[email protected]

begin:vcard
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:[email protected]
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

#12 lore raw
In reply to Bruno Vidal

In reference to a message from Bruno Vidal, dated Jan 22:

Quoted 4 lines

Hi
I don't know how to retrieve option pass to the kernel, but give me some clue, and I'll add this information in the dump header asap, because it is a really good idea :-)

static char *boot_kernel = "/boot/vmlinux";
MODULE_PARM(boot_kernel, "s")
MODULE_PARM_DESC(boot_kernel, "Boot kernel path")

then i guess somehwere in your dump code strcpy boot_kernel to a known location in the dump.

of course we still need to change palo to do this (pass the parameter)... paul, any comments?

randolph

Signature · 4 lines
   @..@                                         http://www.TauSq.org/
  (----)
 ( >__< )
 ^^ ~~ ^^
#13 lore raw
In reply to Bruno Vidal
Quoted 4 lines · Bruno Vidal

Hi
I don't know how to retrieve option pass to the kernel, but give me some clue, and I'll add this information in the dump header asap, because it is a really good idea :-)

(credit: Randolph brought it up first)

Look at arch/parisc/kernel/setup.c:setup_cmdline(). We can add pretty much anything we need here.

It just occurred to me that the source media (ie network, disk) needs to be identified as well.
Is the vmlinux/System.map required to be on the root file system? Would it be reasonble if savecrash told the user that /boot/vmlinux wasn't the matching kernel and where to put the right vmlinux/System.map?

Allowing users to drop the right kernel in place *after* the crash dump was recovered seems reasonable thing to do. Someone might want to move the crash dump to a bigger/faster system to do the actual analysis.

grant