Bug 245722 - multimedia/gstreamer1: Segmentation fault
Summary: multimedia/gstreamer1: Segmentation fault
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-18 13:31 UTC by Sergey
Modified: 2020-08-07 10:23 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)


Attachments
Output of "GST_DEBUG=*:6 gdb --args gst-inspect-1.0 /usr/local/lib/gstreamer-1.0/libgstvaapi.so" command (203.78 KB, application/x-xz)
2020-04-18 13:31 UTC, Sergey
no flags Details
svn diff to disable udev parent checking (1.52 KB, patch)
2020-08-05 16:08 UTC, Oleg Sidorkin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey 2020-04-18 13:31:57 UTC
Created attachment 213531 [details]
Output of "GST_DEBUG=*:6 gdb --args gst-inspect-1.0 /usr/local/lib/gstreamer-1.0/libgstvaapi.so" command

Hi.
I'm using www/surf browser (on FreeBSD 12.1 STABLE) which leverages www/webkit2-gtk3 and multimedia/gstreamer1 as a backend. I get a segfault when I install multimedia/gstreamer1-vaapi (I use Thinkpad T430), without it videos plays fine.

$ surf youtube.com

ERROR: Caught a segmentation fault while loading plugin file:
/usr/local/lib/gstreamer-1.0/libgstvaapi.so

Please either:
- remove it and restart.
- run with --gst-disable-segtrap --gst-disable-registry-fork and debug.

$ uname -a
FreeBSD KPECT 12.1-STABLE FreeBSD 12.1-STABLE GENERIC  amd64

$ pkg query -a "%n-%v" | grep gstreamer
gstreamer1-1.16.2
gstreamer1-libav-1.16.2
gstreamer1-plugins-1.16.2
gstreamer1-plugins-bad-1.16.2
gstreamer1-plugins-gl-1.16.2
gstreamer1-plugins-good-1.16.2
gstreamer1-vaapi-1.16.2

BR,
Sergey.
Comment 1 Sergey 2020-04-22 17:56:01 UTC
Look that crash takes place in devel/libudev-devd. Please check https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/issues/241
Comment 2 Sergey 2020-04-22 17:57:13 UTC
Please assign to x11@FreeBSD.org
Comment 3 Gleb Popov freebsd_committer freebsd_triage 2020-04-22 18:01:25 UTC
Sensible backtrace is still required. Compile libudev-devd with debugging symbols.
Comment 4 Niclas Zeising freebsd_committer freebsd_triage 2020-04-22 18:32:35 UTC
We need way more than that if we're going to debug this.  Start with a proper backtrace with debug symbols.

Can you also open an issue in github, in the libudev-devd repo, that makes it much easier for us to track.
Comment 5 Sergey 2020-04-23 16:18:09 UTC
Hello,
Below is what i got:

Program received signal SIGSEGV, Segmentation fault.
0x00000008006dc896 in ?? () from /lib/libc.so.7
(gdb) bt
#0  0x00000008006dc896 in ?? () from /lib/libc.so.7
#1  0x000000080062c2db in fnmatch () from /lib/libc.so.7
#2  0x0000000801276050 in get_subsystem_config_by_syspath (
    path=0x38 <error: Cannot access memory at address 0x38>) at ../udev-utils.c:148
#3  0x0000000801275fa5 in get_subsystem_by_syspath (
    syspath=0x38 <error: Cannot access memory at address 0x38>) at ../udev-utils.c:175
#4  0x00000008012719ed in udev_device_get_subsystem (ud=0x0) at ../udev-device.c:306
#5  0x00000008015642fc in get_default_device_path (display=0x801cb90f0)
    at gstvaapidisplay_drm.c:114
#6  0x00000008015640f9 in set_device_path (display=0x801cb90f0, device_path=0x0)
    at gstvaapidisplay_drm.c:171
#7  0x0000000801563b79 in gst_vaapi_display_drm_open_display (display=0x801cb90f0, name=0x0)
    at gstvaapidisplay_drm.c:280
#8  0x00000008014efddb in gst_vaapi_display_create (display=0x801cb90f0, 
    init_type=GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, data=0x0) at gstvaapidisplay.c:883
#9  0x00000008014efca7 in gst_vaapi_display_config (display=0x801cb90f0, 
    init_type=GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, init_value=0x0) at gstvaapidisplay.c:1172
#10 0x000000080156376f in gst_vaapi_display_drm_new (device_path=0x0)
    at gstvaapidisplay_drm.c:388
#11 0x00000008014adf8d in gst_vaapi_create_display (display_type=GST_VAAPI_DISPLAY_TYPE_DRM, 
    display_name=0x0) at gstvaapipluginutil.c:108
#12 0x00000008014af363 in gst_vaapi_create_test_display () at gstvaapipluginutil.c:935
#13 0x00000008014a510a in plugin_init (plugin=0x801431b10) at gstvaapi.c:202
#14 0x000000080035fe45 in gst_plugin_register_func (plugin=0x801431b10, 
    desc=0x80157b030 <gst_plugin_desc>, user_data=0x0) at gstplugin.c:525
#15 0x0000000800361baf in _priv_gst_plugin_load_file_for_registry (
    filename=0x801426540 "/usr/local/lib/gstreamer-1.0/libgstvaapi.so", registry=0x800b29150, 
    error=0x0) at gstplugin.c:886
#16 0x000000080037a953 in gst_registry_scan_plugin_file (context=0x7fffffffdf00, 
    filename=0x801426540 "/usr/local/lib/gstreamer-1.0/libgstvaapi.so", file_size=3245232, 
    file_mtime=1587658225) at gstregistry.c:1179
#17 0x000000080037a59a in gst_registry_scan_path_level (context=0x7fffffffdf00, 
    path=0x8002a8519 "/usr/local/lib/gstreamer-1.0", level=10) at gstregistry.c:1337
#18 0x000000080037887e in gst_registry_scan_path_internal (context=0x7fffffffdf00, 
    path=0x8002a8519 "/usr/local/lib/gstreamer-1.0") at gstregistry.c:1364
#19 0x000000080037aece in scan_and_update_registry (default_registry=0x800b29150, 
    registry_file=0x800ba9e40 "/home/x/.cache/gstreamer-1.0/registry.amd64.bin", 
    write_changes=1, error=0x7fffffffdff0) at gstregistry.c:1657
#20 0x000000080037913b in ensure_current_registry (error=0x7fffffffdff0) at gstregistry.c:1749
#21 0x0000000800378d16 in gst_update_registry () at gstregistry.c:1826
#22 0x00000008002d4dba in init_post (context=0x800afd520, group=0x800b4a070, data=0x0, 
    error=0x7fffffffe4b0) at gst.c:803
#23 0x0000000800508555 in g_option_context_parse () from /usr/local/lib/libglib-2.0.so.0
#24 0x0000000000206744 in main (argc=4, argv=0x7fffffffe7a8) at gst-inspect.c:2006
(gdb)
Comment 6 Sergey 2020-04-23 16:29:18 UTC
https://github.com/FreeBSDDesktop/libudev-devd/issues/19 has been opened
Comment 7 Oleg Sidorkin 2020-08-05 16:08:13 UTC
Created attachment 217029 [details]
svn diff to disable udev parent checking

Since the problem code is used to filter out multiple location of device node in linux sysfs, I think it can be safely disabled on FreeBSD.
Comment 8 commit-hook freebsd_committer freebsd_triage 2020-08-05 17:22:51 UTC
A commit references this bug:

Author: arrowd
Date: Wed Aug  5 17:22:27 UTC 2020
New revision: 544235
URL: https://svnweb.freebsd.org/changeset/ports/544235

Log:
  multimedia/gstreamer1-vaapi: Add a patch to fix a crash.

  PR:		245722
  Submitted by:	Oleg Sidorkin <osidorkin@gmail.com>
  More context:	https://github.com/FreeBSDDesktop/libudev-devd/issues/19

Changes:
  head/multimedia/gstreamer1-vaapi/Makefile
  head/multimedia/gstreamer1-vaapi/files/
  head/multimedia/gstreamer1-vaapi/files/patch-gst-libs_gst_vaapi_gstvaapidisplay__drm.c
Comment 9 Gleb Popov freebsd_committer freebsd_triage 2020-08-07 10:23:28 UTC
Once https://github.com/FreeBSDDesktop/libudev-devd/issues/19 is fixed, the patch added with this PR should be removed.