Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 5 Nov 2012 16:34:47 +0200
From: Paul Schutte <sjpschutte@...il.com>
To: musl@...ts.openwall.com
Subject: A few issues on MIPS

Hi Everyone,

I am struggling to get sqlite3 and mongoose-3.3 to work on MIPS.
I started out with a chroot environment based on aboriginal linux for MIPS
where I replaced the default C-library from uclibc to musl as per the
INSTALL instructions in the musl sources. I am using static linking.

I can compile most things just fine and it is working ok, but I am having
trouble with sqlite3 and mongoose.
I am using http://sqlite.org/sqlite-autoconf-3071000.tar.gz
It compiles without a problem, but when I run it, I get disk io errors (On
both physical and virtual machines):

root@...ato:/root# ./sqlite3 file
SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema
Error: disk I/O error
sqlite>

This is the strace that I get:

execve("./sqlite3", ["./sqlite3", "file"], [/* 28 vars */]) = 0
ioctl(0, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 16) = 0
set_thread_area(0x4c9b14)               = 0
set_tid_address(0x4c2a84)               = 16812
rt_sigaction(SIGINT, {0x14000000, [RT_68 RT_69 RT_70 RT_72 RT_78 RT_82
RT_84 RT_87], 0x407190 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_70 RT_72
RT_78 RT_82 RT_84 RT_87], 0}, 16) = 0
access("file", F_OK)                    = 0
brk(0)                                  = 0x4c3000
brk(0x4c4000)                           = 0x4c4000
getcwd("/root", 512)                    = 6
stat64("/root/file", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/root/file", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
fcntl64(3, F_GETFD)                     = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "", 100)                        = 0
brk(0x4c5000)                           = 0x4c5000
brk(0x4d5000)                           = 0x4d5000
getuid()                                = 0
open("/etc/passwd", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
readv(4, [{"", 0}, {"root::0:0:root:/home/root:/bin/s"..., 1024}], 2) = 76
_llseek(4, -42, [34], SEEK_CUR)         = 0
close(4)                                = 0
open("/home/root/.sqliterc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory)
ioctl(1, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
writev(1, [{"SQLite version 3.7.10 2012-01-16"..., 41}, {"\nEnter \".help\"
for instructions\n"..., 75}], 2SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
) = 116
getuid()                                = 0
open("/etc/passwd", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
readv(4, [{"", 0}, {"root::0:0:root:/home/root:/bin/s"..., 1024}], 2) = 76
_llseek(4, -42, [34], SEEK_CUR)         = 0
close(4)                                = 0
writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
readv(0, [{"", 0},
{".schema\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024}], 2)
= 8
brk(0x4d6000)                           = 0x4d6000
fcntl64(3, 0xd /* F_??? */, 0x7fc84210) = -1 EINVAL (Invalid argument)
writev(2, [{"Error: disk I/O error\n", 22}, {NULL, 0}], 2Error: disk I/O
error
) = 22
writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8


When using uclibc I do not get the error:

-- snip --
write(1, "SQLite version 3.7.10 2012-01-16"..., 116SQLite version 3.7.10
2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
) = 116
getuid()                                = 0
open("/etc/passwd", O_RDONLY)           = 4
ioctl(4, TIOCNXCL, 0x7ff2aee0)          = -1 ENOTTY (Inappropriate ioctl
for device)
read(4, "root::0:0:root:/home/root:/bin/s"..., 4096) = 76
close(4)                                = 0
write(1, "sqlite> ", 8sqlite> )                 = 8
read(0,".schema\n", 4096)              = 8
brk(0x6d1000)                           = 0x6d1000
fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741824,
len=1}, 0x7ff28fd0) = 0
fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741826,
len=510}, 0x7ff28fd0) = 0
fcntl64(3, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=1073741824,
len=1}, 0x7ff28fd0) = 0
access("/home/sqlite-autoconf-3071000/file-journal", F_OK) = -1 ENOENT (No
such file or directory)
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
unlink("/home/sqlite-autoconf-3071000/file-wal") = -1 ENOENT (No such file
or directory)
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x6d2000)                           = 0x6d2000
fcntl64(3, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0},
0x7ff28aa0) = 0
brk(0x6d3000)                           = 0x6d3000
fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741824,
len=1}, 0x7ff29250) = 0
fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741826,
len=510}, 0x7ff29250) = 0
fcntl64(3, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=1073741824,
len=1}, 0x7ff29250) = 0
access("/home/sqlite-autoconf-3071000/file-journal", F_OK) = -1 ENOENT (No
such file or directory)
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
unlink("/home/sqlite-autoconf-3071000/file-wal") = -1 ENOENT (No such file
or directory)
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x6d4000)                           = 0x6d4000
fcntl64(3, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0},
0x7ff29250) = 0
write(1, "sqlite> ", 8sqlite> )                 = 8

If I compile it on amd64/i386 using musl and the same procedure, I also do
not get the problem.

-- snip --
writev(1, [{"SQLite version 3.7.10 2012-01-16"..., 41}, {"\nEnter \".help\"
for instructions\n"..., 75}], 2SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
) = 116
getuid()                                = 1000
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
brk(0x1d40000)                          = 0x1d40000
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
readv(4, [{"", 0}, {"root:x:0:0:root:/root:/bin/bash\n"..., 1024}], 2) =
1024
readv(4, [{"", 0}, {"/lib/avahi-autoipd:/bin/false\nav"..., 1024}], 2) = 891
lseek(4, -187, SEEK_CUR)                = 1728
close(4)                                = 0
writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
readv(0, [{"", 0},
{".schema\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024}], 2)
= 8
brk(0x1d41000)                          = 0x1d41000
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1})
= 0
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741826,
len=510}) = 0
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=1073741824, len=1})
= 0
access("/home/paul/Downloads/sqlite-autoconf-3071000/file-journal", F_OK) =
-1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
unlink("/home/paul/Downloads/sqlite-autoconf-3071000/file-wal") = -1 ENOENT
(No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x1d42000)                          = 0x1d42000
brk(0x1d43000)                          = 0x1d43000
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
brk(0x1d44000)                          = 0x1d44000
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1})
= 0
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741826,
len=510}) = 0
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=1073741824, len=1})
= 0
access("/home/paul/Downloads/sqlite-autoconf-3071000/file-journal", F_OK) =
-1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
unlink("/home/paul/Downloads/sqlite-autoconf-3071000/file-wal") = -1 ENOENT
(No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x1d45000)                          = 0x1d45000
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8


I have setup a cross compile environment according to
http://cmer.uoguelph.ca/apklinux/, which work very well, but give the same
result. I also tried this in the MIPS aboriginal image virtual machine,
instead of the physical hardware. I still get the same issue.


I also statically compiled mongoose-3.3 and get a different problem there.
(Port 8080 is available):


execve("./mongoose", ["./mongoose"], [/* 28 vars */]) = 0
open("./mongoose.conf", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 16) = 0
set_thread_area(0x448974)               = 0
set_tid_address(0x4418e4)               = 16807
rt_sigaction(SIGTERM, {0x14000000, [RT_68 RT_69 RT_71 RT_72 RT_80 RT_82
RT_87], 0x4002f0 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_71 RT_72 RT_80
RT_82 RT_87], 0}, 16) = 0
rt_sigaction(SIGINT, {0x14000000, [RT_68 RT_69 RT_71 RT_72 RT_80 RT_82
RT_87], 0x4002f0 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_71 RT_72 RT_80
RT_82 RT_87], 0}, 16) = 0
brk(0)                                  = 0x442000
brk(0x443000)                           = 0x443000
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SO_DEBUG, 2, [1], 4)      = -1 ENOPROTOOPT (Protocol not
available)
close(3)                                = 0
ioctl(1, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
writev(1, [{"set_ports_option: cannot bind to"..., 70}, {"\n", 1}],
2set_ports_option: cannot bind to 8080: Cannot assign requested address
) = 71
writev(2, [{"Failed to start Mongoose.\n", 26}, {NULL, 0}], 2Failed to
start Mongoose.
) = 26
exit_group(1)                           = ?
+++ exited with 1 +++

On a different architecture (amd64) it works:

execve("./mongoose", ["./mongoose"], [/* 39 vars */]) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
arch_prctl(ARCH_SET_FS, 0x621960)       = 0
set_tid_address(0x621990)               = 9789
open("./mongoose.conf", O_RDONLY)       = -1 ENOENT (No such file or
directory)
rt_sigaction(SIGTERM, {0x4001f4, [], SA_RESTORER|SA_RESTART, 0x418ea8},
{SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x4001f4, [], SA_RESTORER|SA_RESTART, 0x418ea8},
{SIG_DFL, [], 0}, 8) = 0
brk(0)                                  = 0x1aab000
brk(0x1aac000)                          = 0x1aac000
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
bind(3, {sa_family=AF_INET, sin_port=htons(8080),
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(3, 128)                          = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0


Just for completeness this is the MIPS hardware:
root@...ato:/root# cat /proc/version
Linux version 2.6.22.19 (root@...ato) (gcc version 4.2.4) #21 Sat Sep 1
04:19:40 CEST 2012

root@...ato:/root# cat /proc/cpuinfo
system type             : Broadcom BCM4716 chip rev 1 pkg 10
processor               : 0
cpu model               : MIPS 74K V4.0
BogoMIPS                : 239.20
cpu MHz                 : 480
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 64
extra interrupt vector  : no
hardware watchpoint     : yes
ASEs implemented        : mips16 dsp
shadow register sets    : 1
VCED exceptions         : not available
VCEI exceptions         : not available

unaligned_instructions  : 12
root@...ato:/root#


This is the qemu aboriginal linux image info:
(mipsel:1) /home # cat /proc/version
Linux version 3.5.0 (landley@...llig)
(libc/sysdeps/linux/mips/crt1.S:(.text+0x1c): undefined reference to
`main') #1 Thu Aug 23 02:33:15 CDT 2012

(mipsel:1) /home # cat /proc/cpuinfo
system type        : MIPS Malta
processor        : 0
cpu model        : MIPS 24Kc V0.0  FPU V0.0
BogoMIPS        : 1179.64
wait instruction    : yes
microsecond timers    : yes
tlb_entries        : 16
extra interrupt vector    : yes
hardware watchpoint    : yes, count: 1, address/irw mask: [0x0ff8]
ASEs implemented    : mips16
shadow register sets    : 1
kscratch registers    : 0
core            : 0
VCED exceptions        : not available
VCEI exceptions        : not available


It is quite likely that I messed up, but if have tried several different
ways on both physical and virtual machines, with native and cross
compiling. I get the same result every time. BTW I have compiled LuaJit
statically using the same method and it works fine. (I can run scimark.lua).

Regards
Paul

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.