Hello,

I have a UML configuration that worked fine with the 4.10.0-rc8 version
in my previous laptop (i7-2740 cpu, blabla.. does it really matters?).
With "worked fine" I mean that I was able to boot in my custom Archlinux
image (on an Archlinux host perfectly updated).

I then copied the image and the config in a new laptop (new i7-7700),
run the make for the kernel, got the kernel binary. 
When trying to start, I get the following message: (Sorry for the long message!)

$ ./linux mem=512M ubd0=/home/nat/Work/Linux_UML/fs/fs.ext4
Core dump limits :
        soft - NONE
        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 environment variables for a tempdir.../tmp/nat
Checking if /tmp/nat is on tmpfs...OK
Checking PROT_EXEC mmap in /tmp/nat...OK
Adding 11587584 bytes to physical memory to account for exec-shield gap
Linux version 4.10.0-rc8-uml-00205-g7089db84e356-dirty (nat@judith) (gcc 
version 6.3.1 20170109 (GCC) ) #16 Mon Feb 13 15:35:51 CET 2017
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 131808
Kernel command line: mem=512M ubd0=/home/nat/Work/Linux_UML/fs/fs.ext4 root=98:0
PID hash table entries: 4096 (order: 3, 32768 bytes)
Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
Memory: 509848K/535604K available (2647K kernel code, 697K rwdata, 772K rodata, 
111K init, 171K bss, 25756K reserved, 0K cma-reserved)
NR_IRQS:15
clocksource: timer: mask: 0xffffffffffffffff max_cycles: 0x1cd42e205, 
max_idle_ns: 881590404426 ns
Calibrating delay loop... 6889.47 BogoMIPS (lpj=34447360)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 2, 16384 bytes)
Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes)
Checking that host ptys support output SIGIO...Yes
Checking that host ptys support SIGIO on close...No, enabling workaround
devtmpfs: initialized
Using 2.6 host AIO
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 
19112604462750000 ns
NET: Registered protocol family 16
clocksource: Switched to clocksource timer
VFS: Disk quotas dquot_6.6.0
VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
console [stderr0] disabled
mconsole (version 2) initialized on /home/nat/.uml/FdImtj/mconsole
Checking host MADV_REMOVE support...OK
futex hash table entries: 256 (order: 0, 6144 bytes)
workingset: timestamp_bits=46 max_order=17 bucket_order=0
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered (default)
NET: Registered protocol family 17
Initialized stdio console driver
Console initialized on /dev/tty0
console [tty0] enabled
Initializing software serial port version 1
console [mc-1] enabled
EXT4-fs (ubda): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (ubda): couldn't mount as ext2 due to feature incompatibilities
EXT4-fs (ubda): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) readonly on device 98:0.
devtmpfs: mounted
This architecture does not have kernel memory protection.
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

CPU: 0 PID: 1 Comm: init Not tainted 4.10.0-rc8-uml-00205-g7089db84e356-dirty 
#16
Stack:
 80433ba0 60064332 80430b00 6031bae8
 600905cc 601d4673 80433bb0 601c9a41
 80433cd0 60090332 80433be0 6002d3b1
Call Trace:
 [<600905cc>] ? 
printk+0x0/0x94
 [<6001af21>] 
show_stack+0x108/0x15e
 [<60064332>] ? 
dump_stack_print_info+0xe4/0xed
 [<600905cc>] ? 
printk+0x0/0x94
 [<601d4673>] ? 
bust_spinlocks+0x0/0x3b
 [<601c9a41>] 
dump_stack+0x2a/0x2c
 [<60090332>] 
panic+0x170/0x311
 [<6002d3b1>] ? 
set_signals+0x28/0x40
 [<600f2c29>] ? 
mntput+0x2f/0x31
 [<600d723f>] ? 
__fput+0x1d3/0x1e2
 [<602aa6ec>] ? 
_cond_resched+0x0/0x42
 [<600d7292>] ? 
____fput+0x10/0x12
 [<60089c12>] ? 
cgroup_exit+0x8c/0xcb
 [<600901c2>] ? 
panic+0x0/0x311
 [<60038a29>] 
do_exit+0x3c3/0x89d
 [<60038fd7>] 
do_group_exit+0x8f/0x106
 [<6002d1ac>] ? 
block_signals+0x0/0x16
 [<6002d1ac>] ? 
block_signals+0x0/0x16
 [<600423ae>] 
get_signal+0x4af/0x4e3
 [<6001ac75>] 
do_signal+0x27/0x121
 [<6002d3b1>] ? 
set_signals+0x28/0x40
 [<6002d389>] ? 
set_signals+0x0/0x40
 [<6004131d>] ? 
force_sig+0x18/0x1a
 [<60041932>] ? 
force_sigsegv+0x5f/0x69
 [<6001c2d8>] 
fatal_sigsegv+0x46/0x52
 [<60032a5f>] ? 
put_fp_registers+0x10/0x12
 [<6002fed5>] 
userspace+0x12b/0x447
 [<60019d6f>] ? 
interrupt_end+0x0/0xa0
 [<600dca10>] ? 
do_execveat_common+0x519/0x649
 [<600c9ce1>] ? 
kmem_cache_alloc+0x0/0x103
 [<600dcb61>] ? 
do_execve+0x21/0x23
 [<600183e4>] ? 
run_init_process+0x3e/0x42
 [<600183e8>] ? 
try_to_run_init_process+0x0/0x44
 [<600183fe>] ? 
try_to_run_init_process+0x16/0x44
 [<600183e8>] ? 
try_to_run_init_process+0x0/0x44
 [<60019b98>] 
new_thread_handler+0xa1/0xa3

I have investigated it, and the problem is in arch/x86/um/os-Linux/registers.c :

 49 int restore_fp_registers(int pid, unsigned long *fp_regs)
 50 {
 51   struct iovec iov;
 52 
 53   if (have_xstate_support) {
 54     iov.iov_base = fp_regs;
 55     iov.iov_len = sizeof(struct _xstate);
 56     if (ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov) < 0)
 57       return -errno;
 58     return 0;
 59   } else {
 60     return restore_i387_registers(pid, fp_regs);
 61   }
 62 }

At line 56, there is a ptrace call. This call exits with -14. The 14
number means EFAULT. Well, after some tries, I patched the function to
always enter the else branch, and then calling restore_i387_registers .
With my big surprise, using this function allows me to boot correctly
the system.

Why I can't successfully boot with the stock kernel, with
have_xstate_support ?

Thank you
N.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to