Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Segmentation Fault in hello_video (OMX_Deinit()) and vchiq_test #146

Closed
code-guru opened this Issue · 9 comments

3 participants

@code-guru

Hi,
Starting from commit 76d0ac3 Dec28, I get segmentation fault when running hello_video sample code. It seems the error happens when invoking OMX_Deinit(). I'm using RPi Model B. rev1 with lastest official Raspbian Image (2012-12-16-wheezy-raspbian.zip). I use rpi-update script for updates.
Thank you for your consideration.

@licaon-kter

logs of any kind? strace ?

@code-guru

The problem also exists in the most recent official image 2013-02-09-wheezy-raspbian.zip without even updating the firmware (rpi-update). Just download the image, write it to the SD card, compile and run hello_video.
I'm not sure if my device model (B) or Rev.(1) has anything to do with this issue.

It seems strace doesn't show the error. However gdb returns a generic error.

pi@raspberrypi /opt/vc/src/hello_pi/hello_video $ gdb ./hello_video.bin
(gdb) run test.h264
Starting program: /opt/vc/src/hello_pi/hello_video/hello_video.bin test.h264
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xb6d54470 (LWP 2336)]
[New Thread 0xb6554470 (LWP 2337)]
[New Thread 0xb5d54470 (LWP 2338)]
[New Thread 0xb5554470 (LWP 2339)]
[New Thread 0xb4d54470 (LWP 2340)]
[New Thread 0xb4554470 (LWP 2341)]
[New Thread 0xb3d54470 (LWP 2342)]
[Thread 0xb4d54470 (LWP 2340) exited]
[Thread 0xb3d54470 (LWP 2342) exited]
[Thread 0xb4554470 (LWP 2341) exited]
[Thread 0xb5554470 (LWP 2339) exited]
[Thread 0xb5d54470 (LWP 2338) exited]
[Thread 0xb6554470 (LWP 2337) exited]
[Thread 0xb6ff9000 (LWP 2333) exited]
Cannot find user-level thread for LWP 2336: generic error

I've tried gdb with the enviroment without segfault, and gdb doesn't show the above error.

@code-guru

The problem seems to come from the VCHIQ driver library, since running vchiq_test also exit with segfault.
here is strace and gdb output for command 'vchiq_test -v -f 1' .

root@raspberrypi:~# strace vchiq_test -v -f 1
execve("/usr/bin/vchiq_test", ["vchiq_test", "-v", "-f", "1"], [/* 12 vars */]) = 0
brk(0)                                  = 0xc1c000
uname({sys="Linux", node="raspberrypi", ...}) = 0
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) = 0xb6f24000
access("/etc/ld.so.preload", R_OK)      = 0
open("/etc/ld.so.preload", O_RDONLY)    = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=44, ...}) = 0
mmap2(NULL, 44, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0xb6f23000
close(3)                                = 0
open("/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\260\4\0\0004\0\0\0"..., 512) = 512
lseek(3, 5716, SEEK_SET)                = 5716
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 920) = 920
lseek(3, 5468, SEEK_SET)                = 5468
read(3, "A0\0\0\0aeabi\0\1&\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 49) = 49
fstat64(3, {st_mode=S_IFREG|0644, st_size=6636, ...}) = 0
mmap2(NULL, 38240, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6ef7000
mprotect(0xb6ef9000, 28672, PROT_NONE)  = 0
mmap2(0xb6f00000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xb6f00000
close(3)                                = 0
munmap(0xb6f23000, 44)                  = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=39399, ...}) = 0
mmap2(NULL, 39399, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6eed000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/opt/vc/lib/libvchiq_arm.so", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0008\26\0\0004\0\0\0"..., 512) = 512
lseek(3, 21308, SEEK_SET)               = 21308
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1080) = 1080
lseek(3, 21015, SEEK_SET)               = 21015
read(3, "A?\0\0\0aeabi\0\0015\0\0\0\5ARM1176JZF-S\0\6\7"..., 64) = 64
fstat64(3, {st_mode=S_IFREG|0644, st_size=29707, ...}) = 0
mmap2(NULL, 55448, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6edf000
mprotect(0xb6ee4000, 32768, PROT_NONE)  = 0
mmap2(0xb6eec000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5) = 0xb6eec000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/opt/vc/lib/libvcos.so", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250*\0\0004\0\0\0"..., 512) = 512
lseek(3, 161444, SEEK_SET)              = 161444
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1400) = 1400
lseek(3, 37803, SEEK_SET)               = 37803
read(3, "A?\0\0\0aeabi\0\0015\0\0\0\5ARM1176JZF-S\0\6\7"..., 64) = 64
fstat64(3, {st_mode=S_IFREG|0644, st_size=177330, ...}) = 0
mmap2(NULL, 72848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6ecd000
mprotect(0xb6ed6000, 32768, PROT_NONE)  = 0
mmap2(0xb6ede000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9) = 0xb6ede000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\274V\0\0004\0\0\0"..., 512) = 512
lseek(3, 82712, SEEK_SET)               = 82712
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1400) = 1400
lseek(3, 82308, SEEK_SET)               = 82308
read(3, "A0\0\0\0aeabi\0\1&\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 49) = 49
fstat64(3, {st_mode=S_IFREG|0755, st_size=116462, ...}) = 0
mmap2(NULL, 123412, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6eae000
mprotect(0xb6ec2000, 28672, PROT_NONE)  = 0
mmap2(0xb6ec9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13) = 0xb6ec9000
mmap2(0xb6ecb000, 4628, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6ecb000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libdl.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0(\t\0\0004\0\0\0"..., 512) = 512
lseek(3, 8652, SEEK_SET)                = 8652
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1160) = 1160
lseek(3, 8320, SEEK_SET)                = 8320
read(3, "A0\0\0\0aeabi\0\1&\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 49) = 49
fstat64(3, {st_mode=S_IFREG|0644, st_size=9812, ...}) = 0
mmap2(NULL, 41136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6ea3000
mprotect(0xb6ea5000, 28672, PROT_NONE)  = 0
mmap2(0xb6eac000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xb6eac000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/librt.so.1", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\300\26\0\0004\0\0\0"..., 512) = 512
lseek(3, 25312, SEEK_SET)               = 25312
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1320) = 1320
lseek(3, 24924, SEEK_SET)               = 24924
read(3, "A0\0\0\0aeabi\0\1&\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 49) = 49
fstat64(3, {st_mode=S_IFREG|0644, st_size=26632, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f23000
mmap2(NULL, 57876, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e94000
mprotect(0xb6e9a000, 28672, PROT_NONE)  = 0
mmap2(0xb6ea1000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5) = 0xb6ea1000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\214y\1\0004\0\0\0"..., 512) = 512
lseek(3, 1194784, SEEK_SET)             = 1194784
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1360) = 1360
lseek(3, 1194348, SEEK_SET)             = 1194348
read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 47) = 47
fstat64(3, {st_mode=S_IFREG|0755, st_size=1196144, ...}) = 0
mmap2(NULL, 1238312, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6d65000
mprotect(0xb6e87000, 28672, PROT_NONE)  = 0
mmap2(0xb6e8e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x121) = 0xb6e8e000
mmap2(0xb6e91000, 9512, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6e91000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f22000
set_tls(0xb6f224c0, 0xb6f22b98, 0xb6f27048, 0xb6f224c0, 0xb6f27048) = 0
mprotect(0xb6e8e000, 8192, PROT_READ)   = 0
mprotect(0xb6ea1000, 4096, PROT_READ)   = 0
mprotect(0xb6eac000, 4096, PROT_READ)   = 0
mprotect(0xb6ec9000, 4096, PROT_READ)   = 0
mprotect(0xb6f26000, 4096, PROT_READ)   = 0
munmap(0xb6eed000, 39399)               = 0
set_tid_address(0xb6f22068)             = 2020
set_robust_list(0xb6f22070, 0xc)        = 0
futex(0xbecaad58, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, b6eca000) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0xb6eb320c, [], SA_SIGINFO|0x4000000}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0xb6eb30b4, [], SA_RESTART|SA_SIGINFO|0x4000000}, 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
futex(0xb6ede450, FUTEX_WAKE_PRIVATE, 2147483647) = 0
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) = 0xb6f21000
write(1, "Functional test - iters:1\n", 26Functional test - iters:1
) = 26
write(1, "======== iteration 1 ========\n", 30======== iteration 1 ========
) = 30
open("/dev/vchiq", O_RDWR)              = 3
ioctl(3, 0xc008c40a, 0xbecaab88)        = 0
write(1, "vchiq_test: 776: vchiq_initialis"..., 62vchiq_test: 776: vchiq_initialise(&instance) == VCHIQ_SUCCESS
) = 62
ioctl(3, 0xc008c40a, 0xbecaabb8)        = 0
write(1, "vchiq_test: 777: vchiq_get_confi"..., 90vchiq_test: 777: vchiq_get_config(instance, sizeof(config) - 1, &config) == VCHIQ_SUCCESS
) = 90
ioctl(3, 0xc008c40a, 0xbecaabb8)        = -1 EINVAL (Invalid argument)
write(1, "vchiq_test: 778: vchiq_get_confi"..., 88vchiq_test: 778: vchiq_get_config(instance, sizeof(config) + 1, &config) == VCHIQ_ERROR
) = 88
ioctl(3, 0xc008c40a, 0xbecaabb8)        = 0
write(1, "vchiq_test: 779: vchiq_get_confi"..., 86vchiq_test: 779: vchiq_get_config(instance, sizeof(config), &config) == VCHIQ_SUCCESS
) = 86
write(1, "vchiq_test: 780: config.max_msg_"..., 59vchiq_test: 780: config.max_msg_size == VCHIQ_MAX_MSG_SIZE
) = 59
ioctl(3, 0xc01cc402, 0xbecaab54)        = 0
write(1, "vchiq_test: 783: vchiq_add_servi"..., 89vchiq_test: 783: vchiq_add_service(instance, &service_params, &service) == VCHIQ_SUCCESS
) = 89
ioctl(3, 0xc01cc402, 0xbecaab54)        = 0
write(1, "vchiq_test: 786: vchiq_add_servi"..., 90vchiq_test: 786: vchiq_add_service(instance, &service_params, &service2) == VCHIQ_SUCCESS
) = 90
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Segmentation fault

root@raspberrypi:~# gdb vchiq_test
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/vchiq_test...(no debugging symbols found)...done.
(gdb) run -v -f 1
Starting program: /usr/bin/vchiq_test -v -f 1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Functional test - iters:1
======== iteration 1 ========
vchiq_test: 776: vchiq_initialise(&instance) == VCHIQ_SUCCESS
vchiq_test: 777: vchiq_get_config(instance, sizeof(config) - 1, &config) == VCHIQ_SUCCESS
vchiq_test: 778: vchiq_get_config(instance, sizeof(config) + 1, &config) == VCHIQ_ERROR
vchiq_test: 779: vchiq_get_config(instance, sizeof(config), &config) == VCHIQ_SUCCESS
vchiq_test: 780: config.max_msg_size == VCHIQ_MAX_MSG_SIZE
vchiq_test: 783: vchiq_add_service(instance, &service_params, &service) == VCHIQ_SUCCESS
vchiq_test: 786: vchiq_add_service(instance, &service_params, &service2) == VCHIQ_SUCCESS

Program received signal SIGSEGV, Segmentation fault.
0xb6fb8b9c in create_service.constprop.5 () from /opt/vc/lib/libvchiq_arm.so
(gdb)
@popcornmix
Owner

I see the problem. st can be NULL on the close message callback. I've got a fix - will be in next firmware update.
The vchiq_test failure is something else (possibly a bug in test - I'm not sure I've ever run it with -f).

@code-guru

Thanks for your confirmation :+1:
waiting for the next update.

It's a irrelevant question, but I think you're the one who can answer me best. Where can I find documentation for MMAL api ?

@popcornmix
Owner

So far we're not encouraging use of mmal on Pi as it's largely untested (although believed to be function).
The camera board will use mmal, and at that point we'll get some documentation released by then,

@popcornmix
Owner

rpi-update firmware (and userland repo) has been updated with this fix.
Please test.

@code-guru

Thanks. The OMX_Deinit error seems to be solved.
Don't the corresponding source code in the userland respository need change for this fix?
By the way, vchiq_test command problem persist, of course, as you said it's another problem, but just saying ;-)
Thank you again.

@popcornmix
Owner

userland is updated

@code-guru code-guru closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.