Subject: Re: kernel panic messages
To: Martin Husemann <email@example.com>
From: Greg A. Woods <firstname.lastname@example.org>
Date: 05/04/2003 20:15:56
[ On Sunday, May 4, 2003 at 10:42:25 (+0200), Martin Husemann wrote: ]
> Subject: Re: kernel panic messages
> Besides that I like Greg's suggestion pretty much. Let me rephrase how I read
> - make panic() a macro, maybe going through the tree once to add double
> - maybe use proper #ifdef __gcc__ and friends if we somehow end up needing
> to use gcc-ism's
It seems neither GCC-only, nor ISO C99-only, features would be needed
with the double-parens trick (or alternately with global variable
assignments in a sequential evaluation (comma) expression with the final
value being the function address).
> - make the macro use __LINE__ and, if available the __KERNEL_RCSID string
> - if the rcsid is not available, fall back to either an empty string or
> __FILE__, maybe even depending on a kernel compile option.
> Now the problem is that the rcsid strings are in .note sections only, and
> don't get loaded into the "live" kernel. And I guess we don't want panic(9)
> [or the function it eventually calls] have to call the loader to get
> additional strings out of the kernel ELF image (which might not even be
> This, unfortunately, sounds like an unsolvable problem to me.
If I'm not mistaken the __KERNEL_RCSID() strings go in .ident, not
.note, at least on ELF. (they seem to be in the .data segment on AOUT)
Regardless though it does seem as if on ELF, at least, they are not
currently loaded into main memory on boot.
However I don't see why they can't be loaded at boot time, say right
after the BSS segment and be treated from a memory managemt viewpoint as
just an extension of that segment.
The only trick I skimmed over and haven't yet figured out (not that I've
spent any real effort trying yet ;-), is how to get a relocatable
pointer to the right part of the .ident section (or an offset into it
that can be reset to the right value after the final full .ident section
has been put together from all the .o files) for use in the function
call. I have been assuming the same technique can be used as is used
for BSS, but maybe that'll require extra linker support.....
The quick "fix" is to simply modify __KERNEL_RCSID() to not use the
.ident section and instead simply declare static char pointers to the
string and then everything should "just work".
Greg A. Woods
+1 416 218-0098; <email@example.com>; <firstname.lastname@example.org>
Planix, Inc. <email@example.com>; VE3TCP; Secrets of the Weird <firstname.lastname@example.org>