From: Milton Miller <[EMAIL PROTECTED]>
Bcc: Milton Miller <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [Fastboot} X86 Segmentation Violation due to /proc/iomem

I tried to run kboot (version 10) on my 486 laptop, and was
getting a Segmentation Violation.   The stack trace below
shows that malloc is getting corrupted.  The strace showed
a successful brk change from 0x8068000 to 0x806f000, just
the same as running in the chroot on my development machine.
I finally copied /proc/iomem to my chroot and was able to
replicate the fail.  I then determinted that add a reserved
entry ending at 0x9ffff and would prevent the core dump.

I copied the modified iomem to the 486 and was able to run
kexec -l without segfaulting, and then was able to successfully
kexec -e into the loaded kernel.

To recreate, build kboot-10  (kexec-tools-1.101 plus
kexec-tools-1.101-fix-real-mode-entry-vivek.patch built against
uClibc).  You can copy the below to proc/iomem and a bzImage into
the build root, and chroot into it.  I am using a 2.6.18-rc1
bzImage to load, I can supply the config if needed.

milton


The failing /proc/iomem
00000000-0009efff : System RAM
000a0000-000bffff : Video RAM area
000e0000-000effff : Extension ROM
000f0000-000fffff : System ROM
00100000-01c2ffff : System RAM
   00100000-00227710 : Kernel code
   00227711-00285053 : Kernel data


I added this line as the second line to make it work:
0009f000-0009ffff : reserved

Here is some info from the core dump:

gdb ../kexec-tools-1.101/objdir-i686/build/sbin/kexec /tmp/core
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and 
you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for 
details.
This GDB was configured as "i386-linux"...Using host libthread_db 
library "/lib/tls/libthread_db.so.1".

Core was generated by `kexec -l 
/mnt/tmp/b358eff335ec33c12e76e78381c44ceb/linux'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /UNIONFS/lib/libc.so.0...done.
Loaded symbols for /lib/libc.so.0
Reading symbols from /UNIONFS/lib/ld-uClibc.so.0...done.
Loaded symbols for /lib/ld-uClibc.so.0
#0  0xb7f34490 in malloc () from /lib/libc.so.0
(gdb) where
#0  0xb7f34490 in malloc () from /lib/libc.so.0
#1  0x08048c12 in xmalloc (size=5632) at kexec/kexec.c:59
#2  0x0804e792 in do_bzImage_load (info=0xbfab2c90, kernel=0xb7e3a008 
"fÍ\b",
     kernel_len=871864, command_line=0x0, command_line_len=0, initrd=0x0,
     initrd_len=0, real_mode_entry=0, debug=0)
     at kexec/arch/i386/kexec-bzImage.c:140
#3  0x0804ed37 in bzImage_load (argc=3, argv=0xbfab2e64,
     buf=0xb7e3a008 "fÍ\b", len=871864, info=0xbfab2c90)
     at kexec/arch/i386/kexec-bzImage.c:289
#4  0x08049ded in my_load (type=0x0, fileind=2, argc=3, argv=0xbfab2e64,
     kexec_flags=0) at kexec/kexec.c:562
#5  0x0804a53d in main (argc=3, argv=0xbfab2e64) at kexec/kexec.c:791
(gdb) up 2
#2  0x0804e792 in do_bzImage_load (info=0xbfab2c90, kernel=0xb7e3a008 
"fÍ\b",
     kernel_len=871864, command_line=0x0, command_line_len=0, initrd=0x0,
     initrd_len=0, real_mode_entry=0, debug=0)
     at kexec/arch/i386/kexec-bzImage.c:140
140             real_mode = xmalloc(setup_size);
(gdb) print *info
$1 = {segment = 0x806e5d8, nr_segments = 1, entry = 0x95498, rhdr = {
     ei_class = 1, ei_data = 1, e_type = 1, e_machine = 3, e_version = 1,
     e_flags = 0, e_phnum = 0, e_shnum = 27, e_shstrndx = 24, e_entry = 
611480,
     e_phoff = 0, e_shoff = 39412, e_notenum = 4, e_phdr = 0x0,
     e_shdr = 0x8066008, e_note = 0x80664b0, rel_addr = 610304,
     rel_size = 40960}}
(gdb) print memory_ranges
$2 = 2
(gdb) print memory_range[0]
$3 = {start = 256, end = 651264, type = 0}
(gdb) print memory_range[1]
$4 = {start = 1048576, end = 29556736, type = 0}
(gdb) print memory_range[2]
$5 = {start = 0, end = 0, type = 0}
(gdb) quit


_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to