Hi,

there seems to be a problem with usermode linux when started
with an initial ramdisk (argument initrd=file). Here is what
happens:

------------------------------------

Locating the bottom of the address space ... 0x1000
Locating the top of the address space ... Checking that ptrace can change 
system call numbers...0xc0000000
Core dump limits :
        soft - 0
        hard - NONE
OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking environment variables for a tempdir...none found
Checking if /dev/shm is on tmpfs...OK
Checking PROT_EXEC mmap in /dev/shm...OK
Adding 8470528 bytes to physical memory to account for exec-shield gap
kmsg_dump:
<1>bootmem alloc of 140 bytes failed!
<0>Kernel panic - not syncing: Out of memory
<4>CPU: 0 PID: 0 Comm: swapper Not tainted 4.9.0-um #3
<6>Stack:
<4> 081eb922 081eb922 0822d547 00000000 08222000 00000000 0817fe48 00000000
<4> 0822bf6c 080bd1a7 00000007 0829c600 081f113d 0822bfbc 082220fc 00000000
<4> 00000000 00000000 0805393d 081f113d 0000008c 0804c88e 0000008c 00000080
<6>Call Trace:
<6> [<0805cffb>] ? 
<4>show_stack+0x9d/0x157
<6> [<0817fe48>] ? 
<4>dump_stack+0x23/0x2b
<6> [<080bd1a7>] ? 
<4>panic+0x9e/0x1b4
<6> [<0805393d>] ? 
<4>__alloc_bootmem+0x3f/0x43
<6> [<0804c88e>] ? 
<4>read_initrd+0x6a/0x101
<6> [<08096fa5>] ? 
<4>kmsg_dump_register+0x37/0x65
<6> [<0805e8a9>] ? 
<4>uml_finishsetup+0x27/0x3b
<6>

---------------------------------


Function read_initrd() calls alloc_bootmem(), but at this point 
memory hasn't been initialized yet.

A quick solution is to move uml_postsetup() (the function
that calls read_initrd()) right after the memory has been
initialized. This may be wrong since uml_postsetup() may call
other functions besides read_initrd(), but worked for me:
the initial ramdisk is loaded and init run.


--- linux-4.9.0/arch/um/kernel/um_arch.c        2016-12-11 20:17:54.000000000 
+0100
+++ linux-4.9.0-um/arch/um/kernel/um_arch.c     2017-01-15 11:16:32.000000000 
+0100
@@ -231,7 +231,7 @@
        atomic_notifier_chain_register(&panic_notifier_list,
                                       &panic_exit_notifier);

-       uml_postsetup();
+       // uml_postsetup();

        new_thread_handler();
  }
@@ -340,6 +340,7 @@
  {
        stack_protections((unsigned long) &init_thread_info);
        setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
+       uml_postsetup();
        mem_total_pages(physmem_size, iomem_size, highmem);

        paging_init();

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to