Ritesh Raj Sarraf | 20 Jul 19:04 2016
Picon
Gravatar

User Mode Linux


Hello Jeff, Richard and the UML Team.

Me and Mattia are maintainers for UML in the Debian Distribution.

Recently, during a refresh of the package, we realized that the User Mode Linux
website, which hosts useful documentation, doesn't seem to have been updated in
years.

The documentation which still is active and useful[1] is marked as "old" on the
website.
The wiki [2] on the other hand, points to a link with no content at all.

Could you please share on what the roadmap and future plans for UML are?
And for the documentation on the old site, do you have it in a Source Markup
Language? What we've used now is a dump of the website from [1]

[1] http://user-mode-linux.sourceforge.net/old/
[2] http://uml.harlowhill.com/

--

-- 
Ritesh Raj Sarraf | http://people.debian.org/~rrs
Debian - The Universal Operating System
Mattia Dongili | 13 Jul 05:02 2016
Picon

UML tools anywhere?

Hi,

Does anybody knows if there is any newer version of the tools package
(the one with tunctl, uml_mount and friends)?

I'm maintaining[1] the package in Debian and I was wondering whether the
original code is hosted somewhere.

Thanks
--

-- 
mattia
:wq!

[1]: with varying degrees of consistency

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
Picon

ubd is slow. I want to try fixing it

Greetings.

Apparently, ubd is too slow for practical use.
I'm getting 0.8 Mb/s write speed, while hostfs does 25 Mb/s (and on
the host itself it's similar).
This is rather frustrating for such a great project as UML is, and i'd
like to try fixing this.

So, two questions.

First, am i missing something?
Is it actually normal for ubd to be that slow?
I looked around, and apparently it is slow due to design. There even
were some ancient patches to try to fix that.

Second, why is this problem hard?
This was going on for over a decade, and no one made a better version,
which implies a hard problem.
I would love to hear from someone who is familiar with how the code
works, about what the problems are (instead of hitting my head against
them later).
Specifically, why use the IO thread?
Hostfs seem to work just fine with calling the native read/write directly.

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
(Continue reading)

Mark Kica | 6 Jul 13:31 2016
Picon

How to properly load debug symbols for module and set breakpoint

I have build custom 64bit UML Linux kernel with TUN/TAP kernel module (tun.ko) and then I have installed it on small root filesystem with busybox . These module and kernel seems to work and I would like to make simple changes in TUN module and measure it's performance .

So I have tried to follow guide from http://user-mode-linux.sourceforge.net/hacking.html which explains how to attach gdb to UML and set breakpoint for module init function .

(gdb) p modules $1 = {next = 0x6385cf38, prev = 0x6385cf38} (gdb) p *((struct module *)0x6385cf30) $2 = {state = MODULE_STATE_LIVE, list = {next = 0x6036aee0, prev = 0x6036aee0}, name = "tun", '\000' <repeats 52 times>, mkobj = {kobj = {name = 0x62e95b00 "tun", entry = {next = 0x62c30440, prev = 0x62c30148}, parent = 0x62c30450, kset = 0x62c30440, ktype = 0x603694d0, sd = 0x62dd6fa0, kref = {refcount = {counter = 3}}, state_initialized = 1, state_in_sysfs = 1, state_add_uevent_sent = 1, state_remove_uevent_sent = 0, uevent_suppress = 0}, mod = 0x6385cf30, drivers_dir = 0x0, mp = 0x0}, modinfo_attrs = 0x62ea0400, version = 0x0, srcversion = 0x0, holders_dir = 0x62da7400, syms = 0x0, crcs = 0x0, num_syms = 0, kp = 0x0, num_kp = 0, num_gpl_syms = 1, gpl_syms = 0x6385c260, gpl_crcs = 0x0, gpl_future_syms = 0x0, gpl_future_crcs = 0x0, num_gpl_future_syms = 0, num_exentries = 0, extable = 0x0, init = 0x63860000, module_init = 0x0, module_core = 0x6385a000, init_size = 0, core_size = 13990, init_text_size = 0, core_text_size = 8244, init_ro_size = 127, core_ro_size = 11432, arch = {<No data fields>}, taints = 0, num_bugs = 0, bug_list = {next = 0x60376a40, prev = 0x60376a40}, bug_table = 0x0, symtab = 0x6385d120, core_symtab = 0x6385d120, num_symtab = 37, core_num_syms = 37, strtab = 0x6385d498 "", core_strtab = 0x6385d498 "", sect_attrs = 0x62c52000, notes_attrs = 0x62e98240, args = 0x62e95b20 " ", source_list = { next = 0x6385d0e0, prev = 0x6385d0e0}, target_list = {next = 0x6385d0f0, prev = 0x6385d0f0}, waiter = 0x62ea10c0, exit = 0x6385a101, refptr = 0x62176ca0} (gdb) add-symbol-file /home/mark/playground/linux-2.6.39.3/drivers/net/tun.ko 0x6385a000 add symbol table from file "/home/mark/playground/linux-2.6.39.3/drivers/net/tun.ko" at .text_addr = 0x6385a000 (y or n) Please answer y or n. (y or n) y Reading symbols from /home/mark/playground/linux-2.6.39.3/drivers/net/tun.ko...done. (gdb) p tun_init $3 = {int (void)} 0x24 <tun_init> (gdb) break tun_init Cannot access memory at address 0x24



I don't understand why tun_init is located at 0x24 and not at 0x6385a000 ? Can somebody point what I am doing wrong and how to load debug symbols and set breakpoint ?

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Richard Weinberger | 12 Jun 22:04 2016
Picon

[PATCH 1/2] um: Use asm-generic/irqflags.h

From: Daniel Wagner <daniel.wagner <at> bmw-carit.de>

Instead proving its own arch_local_irq_save() and arch_irqs_disabled()
version use the generic version from asm-generic/irqflags.h.

A nice side effect is that um gets a few additional arch_ functions
as well.

One problem though is the include for the signals. I could figured out
which header file to pick without trigger a bunch of header include
clashes. Leaving it away works though it is surely not the best
practice.

Signed-off-by: Daniel Wagner <daniel.wagner <at> bmw-carit.de>
Signed-off-by: Richard Weinberger <richard <at> nod.at>
---
 arch/um/include/asm/irqflags.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/um/include/asm/irqflags.h b/arch/um/include/asm/irqflags.h
index c780d8a..71c2d64 100644
--- a/arch/um/include/asm/irqflags.h
+++ b/arch/um/include/asm/irqflags.h
 <at>  <at>  -6,37 +6,35  <at>  <at>  extern int set_signals(int enable);
 extern void block_signals(void);
 extern void unblock_signals(void);

+#define arch_local_save_flags arch_local_save_flags
 static inline unsigned long arch_local_save_flags(void)
 {
 	return get_signals();
 }

+#define arch_local_irq_restore arch_local_irq_restore
 static inline void arch_local_irq_restore(unsigned long flags)
 {
 	set_signals(flags);
 }

+#define arch_local_irq_enable arch_local_irq_enable
 static inline void arch_local_irq_enable(void)
 {
 	unblock_signals();
 }

+#define arch_local_irq_disable arch_local_irq_disable
 static inline void arch_local_irq_disable(void)
 {
 	block_signals();
 }

-static inline unsigned long arch_local_irq_save(void)
-{
-	unsigned long flags;
-	flags = arch_local_save_flags();
-	arch_local_irq_disable();
-	return flags;
-}
+/* #include <uapi/asm/signal.h> */

-static inline bool arch_irqs_disabled(void)
-{
-	return arch_local_save_flags() == 0;
-}
+#define ARCH_IRQ_DISABLED	0
+#define ARCh_IRQ_ENABLED	(SIGIO|SIGVTALRM)
+
+#include <asm-generic/irqflags.h>

 #endif
--

-- 
2.7.3

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
Richard Weinberger | 12 Jun 22:03 2016
Picon

[PATCH] uml: Fix possible deadlock in sig_handler_common()

We are in atomic context and must not sleep.
Sleeping here is possible since malloc() maps
to kmalloc() with GFP_KERNEL.

Signed-off-by: Richard Weinberger <richard <at> nod.at>
---
 arch/um/os-Linux/signal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 8acaf4e..a86d7cc 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
 <at>  <at>  -15,6 +15,7  <at>  <at> 
 #include <kern_util.h>
 #include <os.h>
 #include <sysdep/mcontext.h>
+#include <um_malloc.h>

 void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = {
 	[SIGTRAP]	= relay_signal,
 <at>  <at>  -32,7 +33,7  <at>  <at>  static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc)
 	struct uml_pt_regs *r;
 	int save_errno = errno;

-	r = malloc(sizeof(struct uml_pt_regs));
+	r = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC);
 	if (!r)
 		panic("out of memory");

 <at>  <at>  -91,7 +92,7  <at>  <at>  static void timer_real_alarm_handler(mcontext_t *mc)
 {
 	struct uml_pt_regs *regs;

-	regs = malloc(sizeof(struct uml_pt_regs));
+	regs = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC);
 	if (!regs)
 		panic("out of memory");

--

-- 
2.7.3

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
Richard Weinberger | 12 Jun 21:56 2016
Picon

[PATCH 1/2] um: Setup physical memory in setup_arch()

Currently UML sets up physical memory very early,
long before setup_arch() was called by the kernel main
function.
This can cause problems when code paths in UML's memory setup
code assume that the kernel is already running.
i.e. when kmemleak is enabled it will evaluate current()
in free_bootmem(). That early current() is undefined and
UML explodes.

Solve the problem by setting up physical memory in setup_arch(),
at this stage the kernel has materialized and basic infrastructure
such as current() works.

Signed-off-by: Richard Weinberger <richard <at> nod.at>
---
 arch/um/kernel/um_arch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 16630e7..e8175a8 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
 <at>  <at>  -319,9 +319,6  <at>  <at>  int __init linux_main(int argc, char **argv)

 	start_vm = VMALLOC_START;

-	setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
-	mem_total_pages(physmem_size, iomem_size, highmem);
-
 	virtmem_size = physmem_size;
 	stack = (unsigned long) argv;
 	stack &= ~(1024 * 1024 - 1);
 <at>  <at>  -334,7 +331,6  <at>  <at>  int __init linux_main(int argc, char **argv)
 		printf("Kernel virtual memory size shrunk to %lu bytes\n",
 		       virtmem_size);

-	stack_protections((unsigned long) &init_thread_info);
 	os_flush_stdout();

 	return start_uml();
 <at>  <at>  -342,6 +338,10  <at>  <at>  int __init linux_main(int argc, char **argv)

 void __init setup_arch(char **cmdline_p)
 {
+	stack_protections((unsigned long) &init_thread_info);
+	setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
+	mem_total_pages(physmem_size, iomem_size, highmem);
+
 	paging_init();
 	strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = command_line;
--

-- 
2.7.3

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
Vegard Nossum | 21 May 17:46 2016
Picon

[PATCH v2] um: support kcov

This adds support for kcov to UML.

There is a small problem where UML will randomly segfault during boot;
this is because current_thread_info() occasionally returns an invalid
(non-NULL) pointer and we try to dereference it in
__sanitizer_cov_trace_pc(). I consider this a bug in UML itself and this
patch merely exposes it.

[v2: disable instrumentation in UML-specific code]

Cc: Quentin Casasnovas <quentin.casasnovas <at> oracle.com>
Cc: Richard Weinberger <richard <at> nod.at>
Cc: Thomas Meyer <thomas <at> m3y3r.de>
Cc: user-mode-linux-devel <user-mode-linux-devel <at> lists.sourceforge.net>
Cc: Dmitry Vyukov <dvyukov <at> google.com>
Signed-off-by: Vegard Nossum <vegard.nossum <at> oracle.com>
---
 arch/um/Kconfig.common    | 1 +
 arch/um/kernel/Makefile   | 5 +++++
 arch/um/os-Linux/Makefile | 3 +++
 arch/x86/um/vdso/Makefile | 3 +++
 4 files changed, 12 insertions(+)

diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index cc00134..64c1d46 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
 <at>  <at>  -1,6 +1,7  <at>  <at> 
 config UML
 	bool
 	default y
+	select ARCH_HAS_KCOV
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_SECCOMP_FILTER
 	select HAVE_UID16
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index a6a5e42..2f36d51 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
 <at>  <at>  -3,6 +3,11  <at>  <at> 
 # Licensed under the GPL
 #

+# Don't instrument UML-specific code; without this, we may crash when
+# accessing the instrumentation buffer for the first time from the
+# kernel.
+KCOV_INSTRUMENT                := n
+
 CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START)		\
                         -DELF_ARCH=$(LDS_ELF_ARCH)	\
                         -DELF_FORMAT=$(LDS_ELF_FORMAT)	\
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index 08ff509..ada473b 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
 <at>  <at>  -3,6 +3,9  <at>  <at> 
 # Licensed under the GPL
 #

+# Don't instrument UML-specific code
+KCOV_INSTRUMENT                := n
+
 obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
 	registers.o sigio.o signal.o start_up.o time.o tty.o \
 	umid.o user_syms.o util.o drivers/ skas/
diff --git a/arch/x86/um/vdso/Makefile b/arch/x86/um/vdso/Makefile
index 6c803ca..d72dec4 100644
--- a/arch/x86/um/vdso/Makefile
+++ b/arch/x86/um/vdso/Makefile
 <at>  <at>  -2,6 +2,9  <at>  <at> 
 # Building vDSO images for x86.
 #

+# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
+KCOV_INSTRUMENT                := n
+
 VDSO64-y		:= y

 vdso-install-$(VDSO64-y)	+= vdso.so
--

-- 
1.9.1

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
Vegard Nossum | 21 May 16:12 2016
Picon

Re: [PATCH] um: support kcov

On 05/21/2016 04:05 PM, Dmitry Vyukov wrote:
> On Sat, May 21, 2016 at 4:03 PM, Vegard Nossum <vegard.nossum <at> oracle.com
> <mailto:vegard.nossum <at> oracle.com>> wrote:
>
>     This adds support for kcov to UML.
>
[...]
> Acked-by: Dmitry Vyukov <dvyukov <at> google.com <mailto:dvyukov <at> google.com>>
>
> Cool! How do you plan to use it?

We have a patch for kcov itself adding the AFL mode coming up very soon
:-) We've been doing almost all our filesystem (and other) AFL fuzzing
in UML instances as we found it gave a really big performance boost over
KVM.

Vegard

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
Vegard Nossum | 21 May 16:03 2016
Picon

[PATCH] um: support kcov

This adds support for kcov to UML.

There is a small problem where UML will randomly segfault during boot;
this is because current_thread_info() occasionally returns an invalid
(non-NULL) pointer and we try to dereference it in
__sanitizer_cov_trace_pc(). I consider this a bug in UML itself and this
patch merely exposes it.

Cc: Quentin Casasnovas <quentin.casasnovas <at> oracle.com>
Cc: Richard Weinberger <richard <at> nod.at>
Cc: Thomas Meyer <thomas <at> m3y3r.de>
Cc: user-mode-linux-devel <user-mode-linux-devel <at> lists.sourceforge.net>
Cc: Dmitry Vyukov <dvyukov <at> google.com>
Signed-off-by: Vegard Nossum <vegard.nossum <at> oracle.com>
---
 arch/um/Kconfig.common    | 1 +
 arch/x86/um/vdso/Makefile | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index cc00134..64c1d46 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
 <at>  <at>  -1,6 +1,7  <at>  <at> 
 config UML
 	bool
 	default y
+	select ARCH_HAS_KCOV
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_SECCOMP_FILTER
 	select HAVE_UID16
diff --git a/arch/x86/um/vdso/Makefile b/arch/x86/um/vdso/Makefile
index 6c803ca..d72dec4 100644
--- a/arch/x86/um/vdso/Makefile
+++ b/arch/x86/um/vdso/Makefile
 <at>  <at>  -2,6 +2,9  <at>  <at> 
 # Building vDSO images for x86.
 #

+# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
+KCOV_INSTRUMENT                := n
+
 VDSO64-y		:= y

 vdso-install-$(VDSO64-y)	+= vdso.so
--

-- 
1.9.1

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
Vegard Nossum | 21 May 15:51 2016
Picon

current_thread_info() returns invalid pointer in early UML boot code

Hi people,

I'm having some trouble with using current_thread_info() during UML
early boot. Sometimes it works just fine, but often I get segfaults
because current_thread_info() is returning an invalid pointer. It
looks random: 0x202118, 0x1003e0003, 0xd33b90b3, 0x6db043, etc.

I found an earlier thread which described the same problem:
http://permalink.gmane.org/gmane.linux.uml.devel/14642

However, I think the patch there is a bit hacky/papers over an
underlying bug, since it just uses is_kernel_addr() before deciding
whether to return the pointer from current_thread_info() or not. The
fact that the crash is random leads me to think it's some sort of race
during the UML boot.

Does anybody understand fully what's going on here, why it returns
those invalid (seemingly random) values? If the problem is that we're
on a wrong stack, can we switch stacks earlier during boot or
something to make current_thread_info() always return a valid
thread_info pointer?

Thanks,

Vegard

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j

Gmane