Nicolas Thill | 3 May 01:58 2010
Picon

[PATCH] UML: x86_64: fix memcpy export

./arch/um/sys-x86_64/ksyms.c exports memcpy or __memcpy depending on the gcc
version, use the same logic in ./arch/um/os-Linux/user_syms.c

Signed-off-by: Nicolas Thill <nico <at> openwrt.org>
---
 arch/um/os-Linux/user_syms.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 89b48a1..e3a12dd 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
 <at>  <at>  -23,7 +23,8  <at>  <at>  extern int printf(const char *, ...);
 EXPORT_SYMBOL(strstr);
 #endif

-#ifndef __x86_64__
+#if !defined(__x86_64) || \
+	(__GNUC__ == 4 && __GNUC_MINOR__ < 3) || (__GNUC__ < 4)
 extern void *memcpy(void *, const void *, size_t);
 EXPORT_SYMBOL(memcpy);
 #endif
--

-- 
1.6.0.4

Lukas Czerner | 10 May 17:38 2010
Picon

uml: Error with Linked list debugging on

Hi,

I have got an error when booting uml with Linked list manipulation
debugging turned on. The crash occurs in the exact moment when the
consoles are showing up - it just blinks and crush. Here is the
backtrace:

#0  0x0000003cb8233e14 in abort () from /lib64/libc.so.6
#1  0x00000000600220b2 in os_dump_core () at arch/um/os-Linux/util.c:119
#2  0x00000000600147c1 in panic_exit (self=<value optimized out>, unused1=<value optimized out>, 
    unused2=<value optimized out>) at arch/um/kernel/um_arch.c:233
#3  0x0000000060045996 in notifier_call_chain (nl=<value optimized out>, val=0, v=0x602ffb40, 
nr_to_call=-2, nr_calls=<value optimized out>) at kernel/notifier.c:93
#4  0x00000000600459e4 in __atomic_notifier_call_chain (nh=<value optimized out>, 
val=<value optimized out>, v=<value optimized out>) at kernel/notifier.c:182
#5  atomic_notifier_call_chain (nh=<value optimized out>, val=<value optimized out>, 
v=<value optimized out>) at kernel/notifier.c:191
#6  0x00000000601a56d0 in panic (fmt=0x601f3050 "Kernel mode fault at addr 0x%lx, ip 0x%lx")
at kernel/panic.c:115
#7  0x00000000600145df in segv (fi=..., ip=1611852984, is_user=0, regs=0x6024fa10)
at arch/um/kernel/trap.c:201
#8  0x000000006001463e in segv_handler (sig=<value optimized out>, regs=<value optimized out>)
at arch/um/kernel/trap.c:147
#9  0x00000000600211a4 in sig_handler_common (sig=11, sc=0x6024fbe8) at arch/um/os-Linux/signal.c:49
#10 0x00000000600212ea in sig_handler (sig=<value optimized out>, sc=<value optimized out>)
at arch/um/os-Linux/signal.c:226
#11 0x000000006002151c in handle_signal (sig=<value optimized out>, sc=0x6024fbe8)
    at arch/um/os-Linux/signal.c:158
#12 0x0000000060022e9c in hard_handler (sig=<value optimized out>)
at arch/um/os-Linux/sys-x86_64/signal.c:15
(Continue reading)

Lukas Czerner | 10 May 18:58 2010
Picon

Re: uml: Error with Linked list debugging on

On Mon, 10 May 2010, Lukas Czerner wrote:

> Hi,
> 
> I have got an error when booting uml with Linked list manipulation
> debugging turned on. The crash occurs in the exact moment when the
> consoles are showing up - it just blinks and crush. Here is the
> backtrace:
> 
> 
> #0  0x0000003cb8233e14 in abort () from /lib64/libc.so.6
> #1  0x00000000600220b2 in os_dump_core () at arch/um/os-Linux/util.c:119
> #2  0x00000000600147c1 in panic_exit (self=<value optimized out>, unused1=<value optimized out>, 
>     unused2=<value optimized out>) at arch/um/kernel/um_arch.c:233
> #3  0x0000000060045996 in notifier_call_chain (nl=<value optimized out>, val=0, v=0x602ffb40, 
> nr_to_call=-2, nr_calls=<value optimized out>) at kernel/notifier.c:93
> #4  0x00000000600459e4 in __atomic_notifier_call_chain (nh=<value optimized out>, 
> val=<value optimized out>, v=<value optimized out>) at kernel/notifier.c:182
> #5  atomic_notifier_call_chain (nh=<value optimized out>, val=<value optimized out>, 
> v=<value optimized out>) at kernel/notifier.c:191
> #6  0x00000000601a56d0 in panic (fmt=0x601f3050 "Kernel mode fault at addr 0x%lx, ip 0x%lx")
> at kernel/panic.c:115
> #7  0x00000000600145df in segv (fi=..., ip=1611852984, is_user=0, regs=0x6024fa10)
> at arch/um/kernel/trap.c:201
> #8  0x000000006001463e in segv_handler (sig=<value optimized out>, regs=<value optimized out>)
> at arch/um/kernel/trap.c:147
> #9  0x00000000600211a4 in sig_handler_common (sig=11, sc=0x6024fbe8) at arch/um/os-Linux/signal.c:49
> #10 0x00000000600212ea in sig_handler (sig=<value optimized out>, sc=<value optimized out>)
> at arch/um/os-Linux/signal.c:226
> #11 0x000000006002151c in handle_signal (sig=<value optimized out>, sc=0x6024fbe8)
(Continue reading)

Jan Kiszka | 10 May 19:43 2010
Picon

Re: uml: Error with Linked list debugging on

Lukas Czerner wrote:
> Hi,
> 
> I have got an error when booting uml with Linked list manipulation
> debugging turned on. The crash occurs in the exact moment when the
> consoles are showing up - it just blinks and crush. Here is the
> backtrace:
> 
> 
> #0  0x0000003cb8233e14 in abort () from /lib64/libc.so.6
> #1  0x00000000600220b2 in os_dump_core () at arch/um/os-Linux/util.c:119
> #2  0x00000000600147c1 in panic_exit (self=<value optimized out>, unused1=<value optimized out>, 
>     unused2=<value optimized out>) at arch/um/kernel/um_arch.c:233
> #3  0x0000000060045996 in notifier_call_chain (nl=<value optimized out>, val=0, v=0x602ffb40, 
> nr_to_call=-2, nr_calls=<value optimized out>) at kernel/notifier.c:93
> #4  0x00000000600459e4 in __atomic_notifier_call_chain (nh=<value optimized out>, 
> val=<value optimized out>, v=<value optimized out>) at kernel/notifier.c:182
> #5  atomic_notifier_call_chain (nh=<value optimized out>, val=<value optimized out>, 
> v=<value optimized out>) at kernel/notifier.c:191
> #6  0x00000000601a56d0 in panic (fmt=0x601f3050 "Kernel mode fault at addr 0x%lx, ip 0x%lx")
> at kernel/panic.c:115
> #7  0x00000000600145df in segv (fi=..., ip=1611852984, is_user=0, regs=0x6024fa10)
> at arch/um/kernel/trap.c:201
> #8  0x000000006001463e in segv_handler (sig=<value optimized out>, regs=<value optimized out>)
> at arch/um/kernel/trap.c:147
> #9  0x00000000600211a4 in sig_handler_common (sig=11, sc=0x6024fbe8) at arch/um/os-Linux/signal.c:49
> #10 0x00000000600212ea in sig_handler (sig=<value optimized out>, sc=<value optimized out>)
> at arch/um/os-Linux/signal.c:226
> #11 0x000000006002151c in handle_signal (sig=<value optimized out>, sc=0x6024fbe8)
>     at arch/um/os-Linux/signal.c:158
(Continue reading)

Jiri Kosina | 10 May 23:38 2010
Picon

Re: [PATCH 4/5] uml: i386: Avoid redefinition of NR_syscalls

On Wed, 21 Apr 2010, Amerigo Wang wrote:

> >> Where?
> >
> >Not sure if this answers your question:
> >
> >  CC      arch/um/kernel/skas/syscall.o
> >/data/linux-2.6/arch/um/kernel/skas/syscall.c:13:1: warning:
> >"NR_syscalls" redefined
> >In file included from /data/linux-2.6/arch/x86/include/asm/unistd.h:3,
> >                 from
> >/data/linux-2.6/arch/um/sys-i386/shared/sysdep/syscalls.h:6,
> >                 from /data/linux-2.6/arch/um/kernel/skas/syscall.c:10:
> >/data/linux-2.6/arch/x86/include/asm/unistd_32.h:349:1: warning: this is
> >the location of the previous definition
> >
> 
> Ah, sure. I misunderstood your purpose, please do include the warning
> messages you are trying to fix in your patch description.

The patch doesn't seem to be present in linux-next as of today. I have 
applied it to my queue.

Thanks,

--

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
Paolo Giarrusso | 16 May 14:43 2010
Picon

Re: uml: Error with Linked list debugging on

On Mon, May 10, 2010 at 19:43, Jan Kiszka <jan.kiszka <at> web.de> wrote:
> Lukas Czerner wrote:
>> Hi,
>>
>> I have got an error when booting uml with Linked list manipulation
>> debugging turned on. The crash occurs in the exact moment when the
>> consoles are showing up - it just blinks and crush. Here is the
>> backtrace:
>>
>>
>> #0  0x0000003cb8233e14 in abort () from /lib64/libc.so.6
>> #1  0x00000000600220b2 in os_dump_core () at arch/um/os-Linux/util.c:119
>> #2  0x00000000600147c1 in panic_exit (self=<value optimized out>, unused1=<value optimized out>,
>>     unused2=<value optimized out>) at arch/um/kernel/um_arch.c:233
>> #3  0x0000000060045996 in notifier_call_chain (nl=<value optimized out>, val=0, v=0x602ffb40,
>> nr_to_call=-2, nr_calls=<value optimized out>) at kernel/notifier.c:93
>> #4  0x00000000600459e4 in __atomic_notifier_call_chain (nh=<value optimized out>,
>> val=<value optimized out>, v=<value optimized out>) at kernel/notifier.c:182
>> #5  atomic_notifier_call_chain (nh=<value optimized out>, val=<value optimized out>,
>> v=<value optimized out>) at kernel/notifier.c:191
>> #6  0x00000000601a56d0 in panic (fmt=0x601f3050 "Kernel mode fault at addr 0x%lx, ip 0x%lx")
>> at kernel/panic.c:115
>> #7  0x00000000600145df in segv (fi=..., ip=1611852984, is_user=0, regs=0x6024fa10)
>> at arch/um/kernel/trap.c:201
>> #8  0x000000006001463e in segv_handler (sig=<value optimized out>, regs=<value optimized out>)
>> at arch/um/kernel/trap.c:147
>> #9  0x00000000600211a4 in sig_handler_common (sig=11, sc=0x6024fbe8) at arch/um/os-Linux/signal.c:49
>> #10 0x00000000600212ea in sig_handler (sig=<value optimized out>, sc=<value optimized out>)
>> at arch/um/os-Linux/signal.c:226
>> #11 0x000000006002151c in handle_signal (sig=<value optimized out>, sc=0x6024fbe8)
(Continue reading)

Jan Kiszka | 16 May 15:16 2010
Picon

Re: uml: Error with Linked list debugging on

Paolo Giarrusso wrote:
> On Mon, May 10, 2010 at 19:43, Jan Kiszka <jan.kiszka <at> web.de> wrote:
>> Lukas Czerner wrote:
>>> Hi,
>>>
>>> I have got an error when booting uml with Linked list manipulation
>>> debugging turned on. The crash occurs in the exact moment when the
>>> consoles are showing up - it just blinks and crush. Here is the
>>> backtrace:
>>>
>>>
>>> #0  0x0000003cb8233e14 in abort () from /lib64/libc.so.6
>>> #1  0x00000000600220b2 in os_dump_core () at arch/um/os-Linux/util.c:119
>>> #2  0x00000000600147c1 in panic_exit (self=<value optimized out>, unused1=<value optimized out>,
>>>     unused2=<value optimized out>) at arch/um/kernel/um_arch.c:233
>>> #3  0x0000000060045996 in notifier_call_chain (nl=<value optimized out>, val=0, v=0x602ffb40,
>>> nr_to_call=-2, nr_calls=<value optimized out>) at kernel/notifier.c:93
>>> #4  0x00000000600459e4 in __atomic_notifier_call_chain (nh=<value optimized out>,
>>> val=<value optimized out>, v=<value optimized out>) at kernel/notifier.c:182
>>> #5  atomic_notifier_call_chain (nh=<value optimized out>, val=<value optimized out>,
>>> v=<value optimized out>) at kernel/notifier.c:191
>>> #6  0x00000000601a56d0 in panic (fmt=0x601f3050 "Kernel mode fault at addr 0x%lx, ip 0x%lx")
>>> at kernel/panic.c:115
>>> #7  0x00000000600145df in segv (fi=..., ip=1611852984, is_user=0, regs=0x6024fa10)
>>> at arch/um/kernel/trap.c:201
>>> #8  0x000000006001463e in segv_handler (sig=<value optimized out>, regs=<value optimized out>)
>>> at arch/um/kernel/trap.c:147
>>> #9  0x00000000600211a4 in sig_handler_common (sig=11, sc=0x6024fbe8) at arch/um/os-Linux/signal.c:49
>>> #10 0x00000000600212ea in sig_handler (sig=<value optimized out>, sc=<value optimized out>)
>>> at arch/um/os-Linux/signal.c:226
(Continue reading)

Jan Kiszka | 16 May 16:07 2010
Picon

Re: uml: Error with Linked list debugging on

Jan Kiszka wrote:
> Paolo Giarrusso wrote:
>> On Mon, May 10, 2010 at 19:43, Jan Kiszka <jan.kiszka <at> web.de> wrote:
>>> Lukas Czerner wrote:
>>>> Hi,
>>>>
>>>> I have got an error when booting uml with Linked list manipulation
>>>> debugging turned on. The crash occurs in the exact moment when the
>>>> consoles are showing up - it just blinks and crush. Here is the
>>>> backtrace:
>>>>
>>>>
>>>> #0  0x0000003cb8233e14 in abort () from /lib64/libc.so.6
>>>> #1  0x00000000600220b2 in os_dump_core () at arch/um/os-Linux/util.c:119
>>>> #2  0x00000000600147c1 in panic_exit (self=<value optimized out>, unused1=<value optimized out>,
>>>>     unused2=<value optimized out>) at arch/um/kernel/um_arch.c:233
>>>> #3  0x0000000060045996 in notifier_call_chain (nl=<value optimized out>, val=0, v=0x602ffb40,
>>>> nr_to_call=-2, nr_calls=<value optimized out>) at kernel/notifier.c:93
>>>> #4  0x00000000600459e4 in __atomic_notifier_call_chain (nh=<value optimized out>,
>>>> val=<value optimized out>, v=<value optimized out>) at kernel/notifier.c:182
>>>> #5  atomic_notifier_call_chain (nh=<value optimized out>, val=<value optimized out>,
>>>> v=<value optimized out>) at kernel/notifier.c:191
>>>> #6  0x00000000601a56d0 in panic (fmt=0x601f3050 "Kernel mode fault at addr 0x%lx, ip 0x%lx")
>>>> at kernel/panic.c:115
>>>> #7  0x00000000600145df in segv (fi=..., ip=1611852984, is_user=0, regs=0x6024fa10)
>>>> at arch/um/kernel/trap.c:201
>>>> #8  0x000000006001463e in segv_handler (sig=<value optimized out>, regs=<value optimized out>)
>>>> at arch/um/kernel/trap.c:147
>>>> #9  0x00000000600211a4 in sig_handler_common (sig=11, sc=0x6024fbe8) at arch/um/os-Linux/signal.c:49
>>>> #10 0x00000000600212ea in sig_handler (sig=<value optimized out>, sc=<value optimized out>)
(Continue reading)

Paolo Giarrusso | 17 May 02:30 2010
Picon

Re: uml: Error with Linked list debugging on

On Sun, May 16, 2010 at 16:07, Jan Kiszka <jan.kiszka <at> web.de> wrote:
> Jan Kiszka wrote:
>> Paolo Giarrusso wrote:
>>> On Mon, May 10, 2010 at 19:43, Jan Kiszka <jan.kiszka <at> web.de> wrote:
>>>> Lukas Czerner wrote:

>> Right, there was more broken. Besides the locking fix, this should do
>> the trick by avoiding the recursive free_winch call:

>> diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
>> index d85fcb9..fa66eb4 100644
>> --- a/arch/um/drivers/line.c
>> +++ b/arch/um/drivers/line.c
>>  <at>  <at>  -731,8 +731,10  <at>  <at>  static void free_winch(struct winch *winch, int free_irq_ok)
>>
>>       if (winch->pid != -1)
>>               os_kill_process(winch->pid, 1);
>> -     if (winch->fd != -1)
>> +     if (winch->fd != -1) {
>>               os_close_file(winch->fd);
>> +             winch->fd = -1;
>> +     }
>>       if (winch->stack != 0)
>>               free_stack(winch->stack, 0);
>>       if (free_irq_ok)
>>
>> (note: untested)
>
> Well, thought about it again, this is the result:

(Continue reading)

Paolo Giarrusso | 17 May 16:41 2010
Picon

Re: [uml-devel] uml: pthreads instead of manual clone()?

On Sun, Apr 18, 2010 at 19:50, Jan Kiszka <jan.kiszka <at> web.de> wrote:
> Hi Jeff,
>
> is there (still) any reason to use explicit clone() instead of pthreads
> to spawn UML kernel threads?
>
> While playing with a patch to finally move os_nsecs to proper
> CLOCK_MONOTONIC, I noticed some subtle side-effect: We need to link
> against librt for clock_gettime, but that indirectly drags in
> libpthread. Now gdb gets unhappy when you try to debug the UML kernel.
> It assumes that pthreads are used, but fails to find their IDs and
> terminates the session. So the obvious approach appears to be converting
> kernel threads to pthreads - if there aren't any know pitfalls.

I think you should better manually copy the clock_gettime syscall stub
or function (hoping it's simple enough). Basically, we don't want
glibc to do anything by his own free will, like doing TLS setup
(pthread could do that), allocating memory from the heap on its own
(we only allow it very early, and we try to make it still safe - see
the malloc replacement stuff we do through linker and
__real_malloc/_whatever_I_dont_recall_malloc). We got a bug once we
called getpid() just to get a ptrace notification, but glibc cached
the getpid() result: we have our own getpid() syscall stub (at some
point I was writing actual UML code, and I wrote some TLS code myself
- not sure whether it's the current implementation or it was
rewritten).

Then, maybe, it can be made to work, even if I really wonder about the
TLS setup stuff - we need to allow the guest userspace programs to do
basically any [gs]et_thread_area() calls. But it's really untrivial
(Continue reading)


Gmane