mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Sandbox Segfaults
@ 2011-04-22 15:43 MJ
  2011-04-25 10:23 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: MJ @ 2011-04-22 15:43 UTC (permalink / raw)
  To: barebox

Hi,

I was trying sandbox for x86 host machine from latest git repo of
barebox (master branch) and it segfaults when ran with following
command line arguments,

./barebox -e env.bin -i cramfs.bin

I have read initial documentation to create env.bin and small
filesystem. Attached is patch that fixes segfault problem but is not
helpful in creating environment and mounting filesystem.

diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 38a52a8..52212f7 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -107,7 +107,8 @@ int barebox_register_filedev(struct hf_platform_data *hf)

        dev->platform_data = hf;

-       strcpy(dev->name, "hostfile");
+       /* Registering 2 devices with same name creates problem? */
+       strcpy(dev->name, hf->filename);
        dev->size = hf->size;
        dev->map_base = hf->map_base;


Strace log for problem
=================

execve("./barebox", ["./barebox", "-e", "env.bin", "-i",
"cramfs.bin"], [/* 22 vars */]) = 0
brk(0)                                  = 0x216d1000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xa3f000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=61576, ...}) = 0
mmap2(NULL, 61576, PROT_READ, MAP_PRIVATE, 3, 0) = 0x141000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/librt.so.1", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300\30\0\0004\0\0\0"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=30684, ...}) = 0
mmap2(NULL, 33364, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0xe49000
mmap2(0xe50000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6) = 0xe50000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0
J\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=117086, ...}) = 0
mmap2(NULL, 98792, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0x4cb000
mmap2(0x4e0000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14) = 0x4e0000
mmap2(0x4e2000, 4584, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4e2000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000m\1\0004\0\0\0"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1405508, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xbad000
mmap2(NULL, 1415592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE,
3, 0) = 0x28e000
mprotect(0x3e1000, 4096, PROT_NONE)     = 0
mmap2(0x3e2000, 12288, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x153) = 0x3e2000
mmap2(0x3e5000, 10664, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3e5000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xbda000
set_thread_area({entry_number:-1 -> 6, base_addr:0xbda6c0,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0x3e2000, 8192, PROT_READ)     = 0
mprotect(0x4e0000, 4096, PROT_READ)     = 0
mprotect(0xe50000, 4096, PROT_READ)     = 0
mprotect(0x28c000, 4096, PROT_READ)     = 0
munmap(0x141000, 61576)                 = 0
set_tid_address(0xbda728)               = 9951
set_robust_list(0xbda730, 0xc)          = 0
futex(0xbf9bb9c0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0xbf9bb9c0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1,
NULL, bf9bb9d0) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0x4cf410, [], SA_SIGINFO}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x4cf8f0, [], SA_RESTART|SA_SIGINFO}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
uname({sys="Linux", node="mjain-laptop", ...}) = 0
mmap2(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0xe52000
brk(0)                                  = 0x216d1000
brk(0x216f2000)                         = 0x216f2000
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xa0c000
write(1, "add file env.bin()\n", 19add file env.bin()
)    = 19
open("env.bin", O_RDWR)                 = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=65536, ...}) = 0
mmap2(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0x110000
write(1, "add file cramfs.bin()\n", 22add file cramfs.bin()
) = 22
open("cramfs.bin", O_RDWR)              = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = 0x120000
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Segmentation fault


I would appreciate any kind help offered.

Thanks,
MJ

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Sandbox Segfaults
  2011-04-22 15:43 Sandbox Segfaults MJ
@ 2011-04-25 10:23 ` Sascha Hauer
  2011-04-25 12:11   ` MJ
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2011-04-25 10:23 UTC (permalink / raw)
  To: MJ; +Cc: barebox

Hi,

On Fri, Apr 22, 2011 at 09:13:39PM +0530, MJ wrote:
> Hi,
> 
> I was trying sandbox for x86 host machine from latest git repo of
> barebox (master branch) and it segfaults when ran with following
> command line arguments,
> 
> ./barebox -e env.bin -i cramfs.bin

Please try again with the latest master branch. I fixed this issue with
the following:


commit fcad2ff58b617340230dae8cfc1e23ebc6baf108
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Mon Apr 25 11:18:49 2011 +0200

    sandbox: Fix another uninitialized dev->id case
    
    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 38a52a8..e460d0a 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -109,6 +109,7 @@ int barebox_register_filedev(struct hf_platform_data *hf)
 
 	strcpy(dev->name, "hostfile");
 	dev->size = hf->size;
+	dev->id = -1;
 	dev->map_base = hf->map_base;
 
 	return register_device(dev);

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Sandbox Segfaults
  2011-04-25 10:23 ` Sascha Hauer
@ 2011-04-25 12:11   ` MJ
  0 siblings, 0 replies; 3+ messages in thread
From: MJ @ 2011-04-25 12:11 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, Apr 25, 2011 at 3:53 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:

[...]

>
> Please try again with the latest master branch. I fixed this issue with
> the following:

Thanks. That worked.

-- 
Thanks,
MJ

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-25 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-22 15:43 Sandbox Segfaults MJ
2011-04-25 10:23 ` Sascha Hauer
2011-04-25 12:11   ` MJ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox