david jhon | 5 Mar 10:21 2015
Picon

[uml-user] Making a module for user-mode-linux and debugging it with gdb

Hi,

I have been doing pretty hard since last few days to set up user-mode-linux in my ubuntu-14.04 LTS host. I am a noob on this and want to debug openvswitch kernel module by using user-mode-linux. Currently I am following these links to up my uml:
    http://www.opensourceforu.com/2010/09/user-mode-linux-setup-and-debug/
    http://www.landley.net/code/UML.html
    https://help.ubuntu.com/community/UserModeLinux

but after I run this command linux-3.13/linux rootfstype=linux-3.13/uml-root-trusty it is Aborted with the following  output:

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.../run/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 24801280 bytes to physical memory to account for exec-shield gap
Initialized stdio console driver
Using a channel type which is configured out of UML
setup_one_line failed for device 1 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 2 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 3 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 4 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 5 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 6 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 7 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 8 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 9 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 10 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 11 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 12 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 13 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 14 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 15 : Configuration failed
Console initialized on /dev/tty0
console [tty0] enabled
console [mc-1] enabled
VFS: Cannot open root device "98:0" or unknown-block(98,0): error -19
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(98,0)
CPU: 0 PID: 1 Comm: swapper Not tainted 3.13.0 #1
Stack:
 63037d50 00000002 60238906 00000002
 60238947 60147ad0 601ad287 00008001
 600d8900 63172000 63037d60 601af835
Call Trace:
 [<60147ad0>] ? bust_spinlocks+0x0/0x60
 [<601ad287>] ? printk+0x0/0xa0
 [<600d8900>] ? SyS_mount+0x0/0x110
 [<601af835>] dump_stack+0x2a/0x2c
 [<601ac99c>] panic+0x137/0x286
 [<601ac865>] ? panic+0x0/0x286
 [<60024ac0>] ? unblock_signals+0x0/0xb0
 [<600d89e8>] ? SyS_mount+0xe8/0x110
 [<601ad287>] ? printk+0x0/0xa0
 [<600d8900>] ? SyS_mount+0x0/0x110
 [<6000211b>] mount_root+0x0/0x82
 [<60015290>] ? do_one_initcall+0x0/0x190
 [<60015290>] ? do_one_initcall+0x0/0x190
 [<601429d0>] ? strcpy+0x0/0x30
 [<60002199>] mount_root+0x7e/0x82
 [<6000211b>] ? mount_root+0x0/0x82
 [<60142ab0>] ? strncmp+0x0/0x60
 [<60002380>] prepare_namespace+0x1e3/0x22b
 [<60024ac0>] ? unblock_signals+0x0/0xb0
 [<600d3f60>] ? SyS_dup+0x0/0x70
 [<60015290>] ? do_one_initcall+0x0/0x190
 [<60001c8b>] kernel_init_freeable+0x27c/0x297
 [<600011b7>] ? repair_env_string+0x0/0xbd
 [<6005325d>] ? finish_task_switch.isra.71+0x2d/0x80
 [<601ac1f5>] kernel_init+0x15/0x1b0
 [<60016d61>] new_thread_handler+0x81/0xb0

Aborted (core dumped)

Secondly. I did also install user-mode-linux and other relavant utilities with apt-get and when I run linux rootfstype=hostfs rw init=/bin/bash it works but I am not understanding how to compile my required module and debug it in this scenario.

I'll be really grateful for your help to get it fixed or your suggestions. Thank you in advance!

kind Regards;
david

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
Julien Iguchi-Cartigny | 10 Feb 15:53 2015
Picon
Picon

[uml-user] start a xterm on con1 fails

Hello,

I'm maintaining Netkit-NG, a set of scripts to boot and configure small
networks using UML machines for teaching purposes.

<https://netkit-ng.github.io/>

This set of scripts is based on Netkit

<http://www.netkit.org/>

which was using kernel from Debian Lenny. Starting UML with con1=xterm
was working at this time. But now, using the same configuration to boot
Debian Wheezy UML kernel with a xterm on con1 fails.

So far I'm stuck with the following command lines.

This one works (starts a xterm with UML):

xterm -e /home/kartoch/works/netkit/netkit-ng/kernel/netkit-kernel
modules=/home/kartoch/works/netkit/netkit-ng/kernel/modules name=dummy
title=dummy umid=dummy mem=36M
ubd0=/home/kartoch/tmp/tmp/dummy.disk,/home/kartoch/works/netkit/netkit-ng/fs/netkit-fs
root=98:0 uml_dir=/home/kartoch/.netkit/mconsole hosthome=/home/kartoch
quiet con0=fd:0,fd:1 con1=null SELINUX_INIT=0

But if I want to start UML with a second xterm on the con1, i.e.
replacing con1= null by con1=xterm in the commad line, no second xterm
is started. This was the expected behavior in the original netkit (and
it worked).

I'm looking for help, especially about how to debug this problem (so far
no error messages in messages or dmesg in the host or the UML machine)
and how port-helper works on this case.

I think UML cannot found xterm or port-helper, as if UML is started with
xterm on con0 and con1 it block after display the amount of physical
memory. The command line is:

/home/kartoch/works/netkit/netkit-ng/kernel/netkit-kernel
modules=/home/kartoch/works/netkit/netkit-ng/kernel/modules name=dummy
title=dummy umid=dummy mem=36M
ubd0=/home/kartoch/tmp/tmp/dummy.disk,/home/kartoch/works/netkit/netkit-ng/fs/netkit-fs
root=98:0 uml_dir=/home/kartoch/.netkit/mconsole hosthome=/home/kartoch
quiet con0=xterm con1=xterm

Thanks for your help.

Regards.

Julien

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
Picon

[uml-user] Run 2.6 kernel on 2.4 host

Hi,

I need to run some recent software on a legacy server running 2.4.18 
kernel. Sadly it is not possible to rebuild the sotware to run natively 
with that kernel (our code requires boost, boost requires gcc 4.5+, 
gcc4.5+ doesn't like old glibc and recent glibc doesnt build for 2.4 
kernel).
So I'm trying to run UML 2.6 kernel on 2.4 system. I tried prebuilt 
2.6.27 kernel from (http://uml.devloop.org.uk/kernels.html) but it 
refused to run on 2.4 ("ERROR: kernel too old"). Next, I tried to build 
it on the Debian Woody VM with gcc 2.95 & 3.4 and glibc 2.2 but got 
dozens of errors.
Is it possible to build and run 2.6 on 2.4? What environment is 
required? What are the limitations if any?

Thank you!

--

-- 
Best regards,
Vladimir

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
Eduardo Grosclaude | 24 Oct 04:27 2014
Picon

[uml-user] Simulating network failures

Hello people here, I have joined the list only to ask this question, please bear with me. :) I made myself sure to read JD's book but can't find any deeper technical advice regarding this question there. 

Short version: How do you simulate a network failure in UML?

Long version: I'm a CS teacher trying to setup a very simple Netkit lab to show off Ethernet bonding in action. As you certainly know, Netkit is based on UML.

I can't seem to figure out how to properly go about failure injection in an active-backup (mode 1) bond interface. More generally, what's the proper way to simulate a link drop in UML (so as to - for instance - cause a bond failover)?

My virtual lab is built with three UML nodes, called A, B and S. S has four Ethernet interfaces enslaved into a bridge (to simulate a switch). Node A has two NICs, Node B has only one. B is there only to ping node A. A's eth0 and eth1 are linked by separate collision domains (default for Netkit) to eth0 and eth1 of the virtual switch. B goes to another switch interface. Both A's eth0 and eth1 are bonded into bond0, and eth0 is normally the active one. Ping works. 

If the link between A and S fails, I should see the backup link take over. I assume I could take down the S's NIC, A's NIC, or the link proper. However, no "ifconfig down" command does the job, nor do I know how to take down the virtual link. As a teacher showing off HA, I'd prefer some sort of external, asynchronic, mysterious event to come into scene by will of Fate, but I'll be glad if I can just go and pull out the fine cable and see the primary and secondary swap roles.

Now, bonding can do fault detect using ARP broadcasts or MII signaling. When using MII my bonds do always believe all is OK, no matter what. I have to keep using failure detection by ARP instead of MII because of this. 

To break the virtual link I resorted to kill -STOP the uml_switch process who implements the link. That triggers the bond failover by absence of ARP responses, but then the bond flaps its active between eth0 vs eth1 eternally as if MII keeps contradicting ARP's information. Other signals behave alike, but STOP/CONT can (sometimes) bring the link back as if the failure has been corrected, which holds a value for my lesson.

So, in this synthetic setup, what should I do to simulate a network failure? Can I make MII detection to work? What mistake am I making?

Thank you very much in advance!

--
Eduardo Grosclaude
Universidad Nacional del Comahue
Neuquen, Argentina
------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
Nicolas Iooss | 12 Oct 13:02 2014

[uml-user] [PATCH 1/3] um: Create asm/sections.h

arch/um/kernel/dyn.lds.S and arch/um/kernel/uml.lds.S define some
UML-specific symbols.  These symbols are used in the kernel part of UML
with extern declarations.

Move these declarations to a new header, asm/sections.h, like other
architectures do.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux <at> m4x.org>
---
 arch/um/include/asm/Kbuild     | 1 -
 arch/um/include/asm/sections.h | 9 +++++++++
 arch/um/kernel/physmem.c       | 3 +--
 arch/um/kernel/skas/mmu.c      | 3 +--
 arch/um/kernel/um_arch.c       | 2 --
 5 files changed, 11 insertions(+), 7 deletions(-)
 create mode 100644 arch/um/include/asm/sections.h

diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index 244b12c8cb39..21fd5c647442 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
 <at>  <at>  -23,7 +23,6  <at>  <at>  generic-y += pci.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += scatterlist.h
-generic-y += sections.h
 generic-y += switch_to.h
 generic-y += topology.h
 generic-y += trace_clock.h
diff --git a/arch/um/include/asm/sections.h b/arch/um/include/asm/sections.h
new file mode 100644
index 000000000000..3a6ebcc65519
--- /dev/null
+++ b/arch/um/include/asm/sections.h
 <at>  <at>  -0,0 +1,9  <at>  <at> 
+#ifndef __UM_SECTIONS_H
+#define __UM_SECTIONS_H
+
+#include <asm-generic/sections.h>
+
+extern char __binary_start;
+extern int __syscall_stub_start, __syscall_stub_end;
+
+#endif
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 30fdd5d0067b..db05c067665a 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
 <at>  <at>  -8,6 +8,7  <at>  <at> 
 #include <linux/mm.h>
 #include <linux/pfn.h>
 #include <asm/page.h>
+#include <asm/sections.h>
 #include <as-layout.h>
 #include <init.h>
 #include <kern.h>
 <at>  <at>  -75,8 +76,6  <at>  <at>  void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
 	}
 }

-extern int __syscall_stub_start;
-
 void __init setup_physmem(unsigned long start, unsigned long reserve_end,
 			  unsigned long len, unsigned long long highmem)
 {
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 007d5503f49b..d2a0a4c0cd91 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
 <at>  <at>  -8,12 +8,11  <at>  <at> 
 #include <linux/slab.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
+#include <asm/sections.h>
 #include <as-layout.h>
 #include <os.h>
 #include <skas.h>

-extern int __syscall_stub_start;
-
 static int init_stub_pte(struct mm_struct *mm, unsigned long proc,
 			 unsigned long kernel)
 {
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 016adf0985d5..02c21f6e0983 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
 <at>  <at>  -259,8 +259,6  <at>  <at>  EXPORT_SYMBOL(end_iomem);

 #define MIN_VMALLOC (32 * 1024 * 1024)

-extern char __binary_start;
-
 int __init linux_main(int argc, char **argv)
 {
 	unsigned long avail, diff;
--

-- 
2.1.1

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
Clemens Eisserer | 1 Sep 00:19 2014
Picon

[uml-user] Is the ARM9-architecture supported by UML?

Hi,

I would like to use a current version of debian on my Nokia-770 (linux 2.6.16.27) in a chroot-environment, however everything past lenny (5.0, unsupported since mid 2012) requires a newer kernel - which can't be easily upgraded due to proprietary wlan drivers and other specific patches.

Does user mode linux support the ARM9 architecture with 2.6.16.27 as host?

Thanks, Clemens
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
Thomas Meyer | 23 Aug 14:14 2014
Picon

[uml-user] Long loop in __getnsdayoftime() after resume from ram

Hello,

in UML kernel 3.16.1 I get a long loop in __getnstimeofday()
(kernel/time/timekeeping.c:315) in the call of timespec_add_ns(),
because it seems like the tk->xtime_sec wasn't updated yet, but the
nsecs were. nsecs can be as high as 8111000111000111000l when left the
host kernel suspended to ram over night.

then the function timespec_add_ns() (include/linux/time.h:266)
will call __iter_div_u64_rem() which has an optimized loop for the case
that the dividend is not much bigger as the divisior.
but this isn't the case for resume from ram on the host kernel.

any ideas how to fix this? is it possible to intercept the resume from
ram and update the timekeeper->xtime_sec somehow?
or can the um arch somehow overwrite timespec_add_ns() to always use
div_u64_rem() instead?

how does the host kernel deal with this? are there some .suspend/.resume
callbacks missing in the um "itimer" clocksource?

with kind regards
thomas

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
Thomas Meyer | 19 Aug 20:53 2014
Picon

[uml-user] 3.16 build without optimization fails

Hi,

the build with -O0 fails with:

make -f scripts/Makefile.build obj=init
  gcc -Wp,-MD,init/.main.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.3/include
-I./arch/um/include -Iarch/um/include/generated  -Iinclude -I./arch/um/include/uapi
-Iarch/um/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include
./include/linux/kconfig.h -D__KERNEL__ -m64 -I./arch/x86/um -I./arch/x86/include
-I./arch/x86/include/uapi -Iarch/x86/include/generated -Iarch/x86/include/generated/uapi
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security -mcmodel=large -fno-builtin -m64
-funit-at-a-time -D__arch_um__ -I./arch/um/include/shared -I./arch/x86/um/shared
-I./arch/um/include/shared/skas -Dvmap=kernel_vmap
-Din6addr_loopback=kernel_in6addr_loopback -Din6addr_any=ker
 nel_in6addr_any -Dstrrchr=kernel_strrchr -D_LARGEFILE64_SOURCE -Derrno=kernel_errno
-Dsigprocmask=kernel_sigprocmask -Dmktime=kernel_mktime -fno-delete-null-pointer-checks -O0
-Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable
-fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g
-Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack
-Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO    -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(main)"  -D"KBUILD_MODNAME=KBUILD_STR(main)" -c -o init/main.o init/main.c
In file included from ./arch/um/include/asm/fixmap.h:58:0,
                 from ./arch/um/include/asm/pgtable.h:11,
                 from include/linux/mm.h:51,
                 from include/linux/ring_buffer.h:5,
                 from include/linux/ftrace_event.h:5,
                 from include/trace/syscall.h:6,
                 from include/linux/syscalls.h:80,
                 from init/main.c:18:
include/asm-generic/fixmap.h: In function 'fix_to_virt':
include/asm-generic/fixmap.h:31:2: error: size of unnamed array is negative
  BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
  ^
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2

bug or feature?

any ideas?

switching BUILD_BUG_ON unconditionally to BUILD_BUG_ON_MSG - which uses compiletime_assert() -
breaks the build a bit later here:

  gcc -Wp,-MD,arch/um/kernel/skas/.uaccess.o.d  -nostdinc -isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include -I./arch/um/include
-Iarch/um/include/generated  -Iinclude -I./arch/um/include/uapi
-Iarch/um/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include
./include/linux/kconfig.h -D__KERNEL__ -m64 -I./arch/x86/um -I./arch/x86/include
-I./arch/x86/include/uapi -Iarch/x86/include/generated -Iarch/x86/include/generated/uapi
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security -mcmodel=large -fno-builtin -m64
-funit-at-a-time -D__arch_um__ -I./arch/um/include/shared -I./arch/x86/um/shared
-I./arch/um/include/shared/skas -Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback
  -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr -D_LARGEFILE64_SOURCE
-Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask -Dmktime=kernel_mktime
-fno-delete-null-pointer-checks -O0 -Wframe-larger-than=1024 -fno-stack-protector
-Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls
-fno-var-tracking-assignments -g -Wdeclaration-after-statement -Wno-pointer-sign
-fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes
-DCC_HAVE_ASM_GOTO    -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(uaccess)" 
-D"KBUILD_MODNAME=KBUILD_STR(uaccess)" -c -o arch/um/kernel/skas/uaccess.o arch/um/kernel/skas/uaccess.c
In file included from include/linux/err.h:4:0,
                 from arch/um/kernel/skas/uaccess.c:6:
arch/um/kernel/skas/uaccess.c: In function 'do_op_one_page':
include/linux/compiler.h:346:20: error: call to '__compiletime_assert_85' declared with attribute
error: BUILD_BUG_ON failed: __same_type(((void *)addr), struct page *)
    prefix ## suffix();    \
                    ^
include/linux/compiler.h:351:2: note: in expansion of macro '__compiletime_assert'
  __compiletime_assert(condition, msg, prefix, suffix)
  ^
include/linux/compiler.h:363:2: note: in expansion of macro '_compiletime_assert'
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^
include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert'
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^
include/linux/bug.h:74:1: note: in expansion of macro 'BUILD_BUG_ON_MSG'
 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
 ^
include/linux/highmem.h:125:2: note: in expansion of macro 'BUILD_BUG_ON'
  BUILD_BUG_ON(__same_type((addr), struct page *));       \
  ^
arch/um/kernel/skas/uaccess.c:85:2: note: in expansion of macro 'kunmap_atomic'
  kunmap_atomic((void *)addr);
  ^
make[2]: *** [arch/um/kernel/skas/uaccess.o] Error 1
make[1]: *** [arch/um/kernel/skas] Error 2
make: *** [arch/um/kernel] Error 2

------------------------------------------------------------------------------
Real Name | 16 Aug 17:27 2014
Picon

[uml-user] can't trace kmem_cache_init with gdb

hi,

 I can't trace kmem_cache_init function with GDB, because gdb jump to wrong source line. Is there anyone
know how to fix this issue?

[real <at> name tmp]$ tar -Jxf linux-3.12.6.tar.xz 
[real <at> name tmp]$ cd linux-3.12.6/
[real <at> name linux-3.12.6]$ make ARCH=um defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --defconfig arch/x86/um/Kconfig
#
# configuration written to .config
#
[real <at> name linux-3.12.6]$ make ARCH=um linux 1>log.txt
arch/um/kernel/ptrace.c: In function ‘syscall_trace_enter’:
arch/um/kernel/ptrace.c:178:32: warning: ignoring return value of
‘tracehook_report_syscall_entry’, declared with attribute warn_unused_result [-Wunused-result]
  tracehook_report_syscall_entry(regs);
                                ^

[real <at> name linux-3.12.6]$ 
[real <at> name linux-3.12.6]$ cat gdb.txt 
file linux
handle SIGSEGV pass nostop noprint
handle SIGUSR1 pass nostop noprint

b kmem_cache_init
b create_boot_cache

r ubda=/home/real/uml/linux-3.12.6/Fedora20-x86-root_fs mem=256m
[real <at> name linux-3.12.6]$ 

[real <at> name linux-3.12.6]$ gdb -q  -x gdb.txt
Breakpoint 1 at 0x8050a57: file mm/slab.c, line 1512.
Breakpoint 2 at 0x804f7c5: file mm/slab_common.c, line 296.
Locating the bottom of the address space ... 0x10000
Locating the top of the address space ... 0xffffd000
Core dump limits :
	soft - 0
	hard - NONE
Checking that ptrace can change system call numbers...Detaching after fork from child process 16850.
OK
Checking syscall emulation patch for ptrace...Detaching after fork from child process 16851.
OK
Checking advanced syscall emulation patch for ptrace...Detaching after fork from child process 16852.
OK
Checking for tmpfs mount on /dev/shm.../dev/shm...nothing mounted on /dev/shm
Checking PROT_EXEC mmap in /tmp/...OK
Detaching after fork from child process 16853.
Checking for the skas3 patch in the host:
  - /proc/mm...not found: No such file or directory
  - PTRACE_FAULTINFO...Detaching after fork from child process 16854.
not found
  - PTRACE_LDT...Detaching after fork from child process 16855.
not found
UML running in SKAS0 mode

Breakpoint 1, kmem_cache_init () at mm/slab.c:1512
1512	{
Missing separate debuginfos, use: debuginfo-install glibc-2.17-20.fc19.i686
(gdb) c
Continuing.

Breakpoint 2, create_boot_cache (s=0x82bdaf8 <kmem_cache_boot>, name=0x82650f5 "kmem_cache",
size=92, 
    flags=8192) at mm/slab_common.c:296
296	{
(gdb) n
299		s->name = name;
(gdb) 
296	{
(gdb) 
299		s->name = name;
(gdb) 
300		s->size = s->object_size = size;
(gdb) 
301		s->align = calculate_alignment(flags, ARCH_KMALLOC_MINALIGN, size);
(gdb) 
302		err = __kmem_cache_create(s, flags);
(gdb) s
__kmem_cache_create (cachep=0x82bdaf8 <kmem_cache_boot>, flags=8192) at mm/slab.c:2222
2222	{
(gdb) n
2226		size_t size = cachep->size;
(gdb) 
2251		if (size & (BYTES_PER_WORD - 1)) {
(gdb) 
2264		if (flags & SLAB_RED_ZONE) {
(gdb) 
2273		if (ralign < cachep->align) {
(gdb) 
2278			flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
(gdb) 
2282		cachep->align = ralign;
(gdb) 
2284		if (slab_is_available())
(gdb) p slab_state
$1 = DOWN
(gdb) where
#0  __kmem_cache_create (cachep=0x82bdaf8 <kmem_cache_boot>, flags=8192) at mm/slab.c:2284
#1  0x0804f7f6 in create_boot_cache (s=0x82bdaf8 <kmem_cache_boot>, name=0x82650f5 "kmem_cache", 
    size=92, flags=8192) at mm/slab_common.c:302
#2  0x08050b1b in kmem_cache_init () at mm/slab.c:1559
#3  0x08049486 in mm_init () at init/main.c:468
#4  start_kernel () at init/main.c:532
#5  0x0804a6d8 in start_kernel_proc (unused=0x0) at arch/um/kernel/skas/process.c:46
#6  0x08059323 in new_thread_handler () at arch/um/kernel/process.c:140
#7  0x00000000 in ?? ()
(gdb) l mm/slab.c:2284
2279		/*
2280		 * 4) Store it.
2281		 */
2282		cachep->align = ralign;
2283	
2284		if (slab_is_available())
2285			gfp = GFP_KERNEL;
2286		else
2287			gfp = GFP_NOWAIT;
2288	

(gdb) p slab_state
$2 = DOWN
(gdb) n
2285			gfp = GFP_KERNEL;
(gdb) n
2289		setup_node_pointer(cachep);
(gdb) n
2285			gfp = GFP_KERNEL;

Start from 2289, gdb start jump to wrong source line. GDB should jump to 
"2287			gfp = GFP_NOWAIT;"
But it never hit it. And from here, gdb can't match the execuable UML kernel with source.

(gdb) n
2327		if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init &&

And I found that "file" command says the file format is different.
[real <at> name mm]$ pwd
/tmp/linux-3.12.6/mm
[real <at> name mm]$ file *.c | sort -k 2
percpu-vm.c:          ASCII text
filemap.c:            assembler source, ASCII text
memcontrol.c:         assembler source, ASCII text
ksm.c:                C source, ASCII text
mmap.c:               C source, ASCII text
rmap.c:               C source, ASCII text
slab.c:               C source, ASCII text
slob.c:               C source, ASCII text
slub.c:               C source, ASCII text

Why percpu-vm.c, filemap.c and memcontrol.c has different format?

thanks

------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
Real Name | 4 Jun 10:26 2014
Picon

[uml-user] How to run UML with valgrind and GDB?

Hi,
  I tried to run UML (linux-3.12.6-x86) kernel with valgrind and GDB. 
But valgrind always terminated because SIGSEGV signal. I searched with 
google, just got some very old resource about run linux-2.6.xx with valgrind.

 So, is it possible to run linux (>3.12) with valgrind? If yes, how to do it?

thanks

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
enjoy mindful | 30 May 09:29 2014
Picon

[uml-user] how to find out which functions have been record in exception table?

Hi, all
  I build linux-3.12.6 uml with default configure.

tar -jxf linux-3.12.6.tar.bz2
cd linux-3.12.6
make ARCH=um defconfig
make ARCH=um linux

I'm confused about the exception table of the uml kernel.

$ objdump --full-contents --section=__ex_table linux

linux:     file format elf32-i386

Contents of section __ex_table:
 82a5048 3e6fdcff bcbaf6ff 396fdcff b4baf6ff  >o......9o......
 82a5058 336fdcff acbaf6ff 306fdcff bfbaf6ff  3o......0o......
 82a5068 2b6fdcff 9cbaf6ff 286fdcff afbaf6ff  +o......(o......
 82a5078 236fdcff 8cbaf6ff 206fdcff 9fbaf6ff  #o...... o......
 82a5088 1b6fdcff 7cbaf6ff 186fdcff 8fbaf6ff  .o..|....o......
 82a5098 136fdcff 6cbaf6ff 106fdcff 7fbaf6ff  .o..l....o......
 82a50a8 0b6fdcff 5cbaf6ff 086fdcff 6fbaf6ff  .o..\....o..o...
 82a50b8 036fdcff 4cbaf6ff 006fdcff 5fbaf6ff  .o..L....o.._...
 82a50c8 fb6edcff 3cbaf6ff f86edcff 4fbaf6ff  .n..<....n..O...
 82a50d8 f36edcff 2cbaf6ff f06edcff 3fbaf6ff  .n..,....n..?...
 82a50e8 eb6edcff 1cbaf6ff e86edcff 2fbaf6ff  .n.......n../...
 82a50f8 e36edcff 0cbaf6ff e06edcff 1fbaf6ff  .n.......n......
 82a5108 db6edcff fcb9f6ff d86edcff 0fbaf6ff  .n.......n......
 82a5118 d36edcff ecb9f6ff d06edcff ffb9f6ff  .n.......n......
 82a5128 cb6edcff dcb9f6ff c86edcff efb9f6ff  .n.......n......
 82a5138 c36edcff ccb9f6ff c06edcff dfb9f6ff  .n.......n......
 82a5148 bb6edcff bcb9f6ff b86edcff cfb9f6ff  .n.......n......
 82a5158 ce6edcff acb9f6ff cc6edcff bfb9f6ff  .n.......n......
 82a5168 cf6edcff 9cb9f6ff c96edcff afb9f6ff  .n.......n......

Let pick the first instruction location '3e6fdcff' (in human readable
is 0xffdc6f3e). My question is how to find which function in UML
kernel has an instruction in location 0xffdc6f3e?

In i386 platform, the kernel address greater than the __PAGE_OFFSET
(0xC0000000). However, as skas0 sperate the uml kernel and user
process address space, it dose work by search address greater than the
__PAGE_OFFSET for UML.

thanks

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet

Gmane