lkml.org 
[lkml]   [2009]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Fix ARCH=um segfault on x86-64.
Date
Apparently, nobody other than me has ever attempted to use User Mode Linux 
built from 2.6.28 on x86-64, because it doesn't work. It still doesn't work
in current git. I complained about it not working back in January:

http://sourceforge.net/mailarchive/forum.php?thread_name=200901130159.04389.rob%40landley.net&forum_name=user-
mode-linux-devel
http://lkml.indiana.edu/hypermail/linux/kernel/0901.2/00669.html

And today, I bothered to track down why.

This is the commit that broke it, when Peter Anvin merged x86 and x86-64 for
ARCH=um: http://kernel.org/hg/linux-2.6/rev/117978

Here's a patch that fixes it for me:

Signed-off-by: Rob Landley <rob@landley.net>

diff -r 178a096e9e38 arch/um/Kconfig.x86
--- a/arch/um/Kconfig.x86 Fri Feb 27 16:49:46 2009 -0800
+++ b/arch/um/Kconfig.x86 Thu Mar 05 23:35:55 2009 -0600
@@ -26,9 +26,8 @@
def_bool !X86_XADD

config 3_LEVEL_PGTABLES
- bool "Three-level pagetables (EXPERIMENTAL)" if !64BIT
+ bool
default 64BIT
- depends on EXPERIMENTAL
help
Three-level pagetables will let UML have more than 4G of physical
memory. All the memory that can't be mapped directly will be treated
What changed is that the resulting .config no longer contains the line
"CONFIG_3_LEVEL_PGTABLES=y" (it's not visible, and thus not written out into
the config file file). Without that symbol defined, x86-64 dies trying to
boot. If you tweak the Kconfig so the symbol gets written out, it starts
working again.

I have no idea how ANYBODY has EVER managed to use 2.6.28 User Mode Linux on
an x86-64 host. My theory is that nobody ever did. I suspect that very few
people use UML anymore now that KVM and the rustyvisor and such are available,
and those legacy users still fiddling with it are apparently all either using
old versions or 32-bit hosts. (I still like being able to stick printfs into
the kernel.)

Here's the panic, in case you're wondering:

$ ./linux rw init=/bin/bash rootfstype=hostfs
Core dump limits :
soft - 0
hard - NONE
Checking that ptrace can change system call numbers...OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking for tmpfs mount on /dev/shm...OK
Checking PROT_EXEC mmap in /dev/shm/...OK
Checking for the skas3 patch in the host:
- /proc/mm...not found: No such file or directory
- PTRACE_FAULTINFO...not found
- PTRACE_LDT...not found
UML running in SKAS0 mode
Adding 4390912 bytes to physical memory to account for exec-shield gap
Linux version 2.6.29-rc7 (landley@driftwood) (gcc version 4.3.2 (Ubuntu
4.3.2-1ubuntu11) ) #1 Thu Mar 5 21:20:14 CST 2009
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 9137
Kernel command line: rw init=/bin/bash rootfstype=hostfs root=98:0
PID hash table entries: 256 (order: 8, 2048 bytes)
Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
Inode-cache hash table entries: 4096 (order: 3, 32768 bytes)
Memory: 29244k available
SLUB: Genslabs=12, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 209.30 BogoMIPS (lpj=1046528)
Mount-cache hash table entries: 256
Checking that host ptys support output SIGIO...Yes
Checking that host ptys support SIGIO on close...No, enabling workaround
Using 2.6 host AIO
bio: create slab <bio-0> at 0
Switched to NOHz mode on CPU #0
io scheduler noop registered (default)
loop: module loaded
Initialized stdio console driver
Using a channel type which is configured out of UML
parse_chan_pair failed for device 1 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 2 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 3 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 4 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 5 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 6 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 7 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 8 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 9 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 10 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 11 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 12 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 13 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 14 : Configuration failed
Using a channel type which is configured out of UML
parse_chan_pair failed for device 15 : Configuration failed
Console initialized on /dev/tty0
console [tty0] enabled
VFS: Mounted root (hostfs filesystem) on device 0:8.
IRQ 3/console-write: IRQF_DISABLED is not guaranteed on shared IRQs
IRQ 2/console: IRQF_DISABLED is not guaranteed on shared IRQs
IRQ 10/winch: IRQF_DISABLED is not guaranteed on shared IRQs

Pid: 1, comm: swapper Not tainted 2.6.29-rc7
RIP: 0033:[<000000006001b342>]
RSP: 0000000062029dd0 EFLAGS: 00010216
RAX: 00000000622af800 RBX: 00000000621b0000 RCX: 0000000003ffc09f
RDX: fffffffffff02800 RSI: 0000000060313900 RDI: 00000000622af800
RBP: 0000000060d10048 R08: 0000000000000000 R09: 0000000000100000
R10: 0000000000000000 R11: 0000000060197a00 R12: 000000006211f300
R13: 000000006211f300 R14: 0000000060206440 R15: 0000000062020300
Call Trace:
602058f8: [<600160c5>] timer_one_shot+0x55/0x80
60205908: [<6000e4b9>] segv+0x2a9/0x2d0
60205918: [<6001b342>] __memcpy+0xe/0xac
60205928: [<6003f376>] tick_dev_program_event+0x36/0xb0
60205958: [<6003f5c4>] tick_check_oneshot_change+0xf4/0x100
60205968: [<6002bc6d>] run_timer_softirq+0x1cd/0x210
602059e8: [<6000e530>] segv_handler+0x50/0xe0
60205a08: [<6003f250>] tick_handle_periodic+0x10/0x60
60205a48: [<60026a7d>] do_softirq+0x4d/0x70
60205a68: [<60026bf2>] irq_exit+0x42/0xa0
60205a88: [<6000aecf>] do_IRQ+0x2f/0x50
60205aa8: [<600154e4>] sig_handler_common+0x64/0xe0
60205b30: [<6001b342>] __memcpy+0xe/0xac
60205b50: [<600ae3de>] sysfs_new_dirent+0xfe/0x120
60205bd8: [<600156aa>] sig_handler+0x1a/0x40
60205be8: [<60015983>] handle_signal+0x73/0xb0
60205c28: [<60100140>] __restore_rt+0x0/0x10
60205cd8: [<6001b342>] __memcpy+0xe/0xac
Kernel panic - not syncing: Segfault with no mm

Pid: 1, comm: swapper Not tainted 2.6.29-rc7
RIP: 0033:[<00000000601003a7>]
RSP: 00007fff8026e2a8 EFLAGS: 00000246
RAX: 0000000000000000 RBX: 0000000000001cc4 RCX: ffffffffffffffff
RDX: 0000000000000000 RSI: 0000000000000013 RDI: 0000000000001cc4
RBP: 0000000000001cc0 R08: 00007fff8026e1f0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff8026e3b8
R13: 0000000000000004 R14: 00007fff8026e580 R15: 00007fff8026e414
Call Trace:
602057b8: [<6003aacd>] up+0x1d/0x50
602057c8: [<6000e77d>] panic_exit+0x2d/0x50
602057d8: [<600214ac>] release_console_sem+0x19c/0x1e0
602057e8: [<6003ac87>] notifier_call_chain+0x37/0x70
60205818: [<60167cd7>] panic+0xd0/0x164
60205858: [<60100370>] __sigprocmask+0x10/0x40
60205878: [<60167df6>] printk+0x8b/0x95
60205898: [<6001604e>] os_nsecs+0xe/0x30
602058b8: [<6001b342>] __memcpy+0xe/0xac
602058c8: [<6000d080>] show_trace+0x60/0xc0
602058e8: [<6001b148>] show_regs+0x28/0x30
60205908: [<6000e4c5>] segv+0x2b5/0x2d0
60205918: [<6001b342>] __memcpy+0xe/0xac
60205928: [<6003f376>] tick_dev_program_event+0x36/0xb0
60205958: [<6003f5c4>] tick_check_oneshot_change+0xf4/0x100
60205968: [<6002bc6d>] run_timer_softirq+0x1cd/0x210
602059e8: [<6000e530>] segv_handler+0x50/0xe0
60205a08: [<6003f250>] tick_handle_periodic+0x10/0x60
60205a48: [<60026a7d>] do_softirq+0x4d/0x70
60205a68: [<60026bf2>] irq_exit+0x42/0xa0
60205a88: [<6000aecf>] do_IRQ+0x2f/0x50
60205aa8: [<600154e4>] sig_handler_common+0x64/0xe0
60205b30: [<6001b342>] __memcpy+0xe/0xac
60205b50: [<600ae3de>] sysfs_new_dirent+0xfe/0x120
60205bd8: [<600156aa>] sig_handler+0x1a/0x40
60205be8: [<60015983>] handle_signal+0x73/0xb0
60205c28: [<60100140>] __restore_rt+0x0/0x10
60205cd8: [<6001b342>] __memcpy+0xe/0xac
Segmentation fault

Rob
\
 
 \ /
  Last update: 2009-03-06 07:49    [W:0.062 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site