linux-mips
[Top] [All Lists]

custom kernel on lemote-3a-itx (Loongson-3A) crashes in userspace

To: linux-mips@linux-mips.org
Subject: custom kernel on lemote-3a-itx (Loongson-3A) crashes in userspace
From: Mike Frysinger <vapier@gentoo.org>
Date: Thu, 19 Feb 2015 14:46:17 -0500
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
i've got a lemote desktop with a quad core Loongson-3A in it:
http://www.lemote.com/products/computer/fulong/348.html

i'm trying to build my own kernel for it, but userspace just crashes on me :(.

the current kernel is a precompiled one from lemote themselves, and things are 
compiling/running fine with it.  but it's a bit stale and missing features i 
want (like namespaces & seccomp).
$ uname -a
Linux lemote 3.5.0-9.lemote #1465 SMP PREEMPT Mon Aug 26 14:23:38 CST 2013 
mips64 ICT Loongson-3A V0.5 FPU V0.1 lemote-3a-itx-a1101 GNU/Linux

the userland is Gentoo.  it's an o32/n32/n64 multilib with n32 as the default.  
most (if not all) of userland has been built with gcc-4.8.2 using
"-O2 -march=mips64 -mplt -pipe".
$ file /bin/bash
/bin/bash: ELF 32-bit LSB executable, MIPS, N32 MIPS64 version 1 (SYSV), 
dynamically linked, interpreter /lib32/ld.so.1, for GNU/Linux 2.6.16, stripped
$ /lib/libc.so.6 
GNU C Library (Gentoo 2.19-r1 p3) stable release version 2.19, by Roland 
McGrath et al.
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.8.2.
Compiled on a Linux 3.14.0 system on 2014-09-09.
Available extensions:
        C stubs add-on version 2.1.2
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
libc ABIs: MIPS_PLT UNIQUE
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>.

i first tried lemote's sources, which i grabbed their git tree from 
dev.lemote.com.  i started at the same git tag (3.5.0-9.lemote) and used the 
same .config as their precompiled kernel.  once it booted, most userland progs 
would crash.  some would survive (like simple ones), but most would crash.

i moved up to vanilla linux-3.18, starting with the same config, but got the 
same behavior.

i tried booting with the nofpu command line, but that didn't help.  i also 
tried manually setting cpu_has_fpu to 0 in 
arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h, but that didn't 
help.

i tried gcc-4.7.4, gcc-4.8.4, and gcc-4.9.2, but none of that helped.

i enabled the debugging in arch/mips/mm/fault.c, and you can see the attached 
dmesg with some of the example crashes.  when i looked at proc maps from other 
binaries, it looks like those crashing addresses are close to real ones, but 
slightly off (like a byte shift?).  i'm just guessing since i'm not actually 
looking at the crashing app itself ... just assuming the maps are largely 
stable 
(since they seem to be in other ones).

i tried to use strace/gdb to narrow things down, but those both crash early, so 
couldn't get anywhere :).

any pointers ?
-mike

Attachment: dmesg-crash
Description: Text document

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>