All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] early setup
@ 2003-12-23 15:12 Geert Uytterhoeven
  2003-12-23 17:46 ` Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2003-12-23 15:12 UTC (permalink / raw)
  To: User-mode Linux Kernel Development


From time to time I continue my work on gdkfb, a frame buffer device for UML
using GTK/X11...

It appears that just calling the GTK initialization routine gtk_init_check()
during kernel init causes UML to crash later, while user space is already
running. A reliable way to crash it is reading anything in /proc:

| (none):~# cat /proc/mounts
| Kernel panic: Kernel mode fault at addr 0x890856a3, ip 0x400d9304

Which is inside libgtk:

| tux$ ldd linux
|         libutil.so.1 => /lib/libutil.so.1 (0x40018000)
|         libgtk-1.2.so.0 => /usr/lib/libgtk-1.2.so.0 (0x4002a000)
|         libgdk-1.2.so.0 => /usr/lib/libgdk-1.2.so.0 (0x40148000)
|         libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4017c000)
|         libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40243000)
|         libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4024b000)
|         libglib-1.2.so.0 => /usr/lib/libglib-1.2.so.0 (0x40259000)
|         libgmodule-1.2.so.0 => /usr/lib/libgmodule-1.2.so.0 (0x4027a000)
|         libdl.so.2 => /lib/libdl.so.2 (0x4027d000)
|         libm.so.6 => /lib/libm.so.6 (0x40281000)
|         libc.so.6 => /lib/libc.so.6 (0x402a3000)
|         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
| tux$

Running UML in gdb doesn't help much, UML just quits and setting a break point
doesn't work (can I single-step automatically until the PC is at 0x400d9304 so
I can get a backtrace?).

On the other hand, if I call gtk_init_check() really early (from a
__uml_setup() routine), UML works fine!

Any good reason why?  I'm using SKAS mode, since TT gave me even more headaches
(cfr. the libpthread problem from a few months ago).

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [uml-devel] early setup
  2003-12-23 15:12 [uml-devel] early setup Geert Uytterhoeven
@ 2003-12-23 17:46 ` Jeff Dike
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2003-12-23 17:46 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: User-mode Linux Kernel Development

On Tue, Dec 23, 2003 at 04:12:33PM +0100, Geert Uytterhoeven wrote:
> On the other hand, if I call gtk_init_check() really early (from a
> __uml_setup() routine), UML works fine!
> 
> Any good reason why?  I'm using SKAS mode, since TT gave me even more headaches

UML arranges its physical memory so that it's contiguous starting from the
beginning of the binary out to the end of its VM.  In the middle of that is the
heap.  The brk is rounded up to the nearest 4M or something.  Everything after 
that is usable kernel physical memory, everything before that is reserved and
unusable.

In order to prevent malloc from being used to allocate memory after the kernel
has taken over its memory, malloc et al are wrapped, and if the kernel is
running, the wrapper calls kmalloc instead.  So, if gtk is managing its own
heap, then it may be evading the wrapper, and causing the brk to impinge on
kernel memory.  The fact that everything works if gtk_init_check is called
early enough backs this up.  That will allocate memory and push out the brk
before UML decides where usable memory begins.

				Jeff


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-23 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-23 15:12 [uml-devel] early setup Geert Uytterhoeven
2003-12-23 17:46 ` Jeff Dike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.