89luca89 / distrobox

Use any linux distribution inside your terminal. Enable both backward and forward compatibility with software and freedom to use whatever distribution you’re more comfortable with. Mirror available at: https://gitlab.com/89luca89/distrobox
https://distrobox.it/
GNU General Public License v3.0
9.79k stars 398 forks source link

[Error] Segfault with some Vapoursynth plugins #765

Closed nalsai closed 1 year ago

nalsai commented 1 year ago

Describe the bug Some Vapoursynth plugins don't work inside distrobox. They just quit and on fish they show the following message:

fish: Process 586546, 'vspipe' from job 1, 'vspipe filter.vpy - -c y4m --ar…' terminated by signal SIGSEGV (Address boundary error)

I'm using podman on Fedora 38. The same thing happens rootless and with root.

To Reproduce

Here is the script I run in init-hooks: https://github.com/nalsai/dotfiles/blob/b1a6ebecab80386d08790ce84378529395da7701/linux/scripts/distrobox-arch.sh

distrobox create -Y -n arch -i archlinux --init-hooks "bash $HOME/.dotfiles/linux/scripts/distrobox-arch.sh"

distrobox enter arch

paru -S --needed --noconfirm --overwrite \* vapoursynth-plugin-fmtconv-git vapoursynth-plugin-havsfunc-git vapoursynth-plugin-fvsfunc-git vapoursynth-plugin-vsdehalo-git vapoursynth-plugin-vsmasktools-git
vspipe filter.vpy - -c y4m | ffmpeg -i - "out.mkv"

filter.vpy:

import vapoursynth as vs
from vapoursynth import core
import havsfunc as haf

src = core.ffms2.Source(test.mp4)

qtgmced = haf.QTGMC(src, InputType=1)

qtgmced.set_output()

There needs to be a video file to process, called test.mp4.

Expected behavior I'd like for it to run without an issue. It works correctly inside a docker container or directly on the system.

Logs

ffmpeg quits with fd:: Invalid data found when processing input, as vapoursynth doesn't give it the data.

valgrind shows the following:

==585350== Thread 19:
==585350== Invalid write of size 8
==585350==    at 0x18F72D71: HorizontalWiener_avx2(unsigned char*, unsigned char const*, long, long, long, long) (in /usr/lib/vapoursynth/libmvtools.so)
==585350==    by 0x18CCDABE: mvsuperGetFrame (in /usr/lib/vapoursynth/libmvtools.so)
==585350==    by 0x5EB9311: UnknownInlinedFun (vscore.cpp:952)
==585350==    by 0x5EB9311: VSThreadPool::runTasks(std::atomic<bool>&) (vsthreadpool.cpp:174)
==585350==    by 0x494A942: execute_native_thread_routine (thread.cc:104)
==585350==    by 0x4B9044A: start_thread (pthread_create.c:444)
==585350==    by 0x4C13D63: clone (clone.S:100)
==585350==  Address 0x4aceb0ba is 1,376,314 bytes inside a block of size 1,376,320 alloc'd
==585350==    at 0x4847219: posix_memalign (vg_replace_malloc.c:2032)
==585350==    by 0x5EA6121: UnknownInlinedFun (VSHelper4.h:76)
==585350==    by 0x5EA6121: UnknownInlinedFun (memoryuse.cpp:105)
==585350==    by 0x5EA6121: UnknownInlinedFun (memoryuse.cpp:122)
==585350==    by 0x5EA6121: UnknownInlinedFun (memoryuse.cpp:226)
==585350==    by 0x5EA6121: VSPlaneData::VSPlaneData(unsigned long, vs::MemoryUse&) (vscore.cpp:140)
==585350==    by 0x5EA62BD: VSFrame::VSFrame(VSVideoFormat const&, int, int, VSFrame const*, VSCore*) (vscore.cpp:199)
==585350==    by 0x5E91913: newVideoFrame3(vs3::VSVideoFormat const*, int, int, VSFrame const*, VSCore*) [clone .lto_priv.0] (vsapi.cpp:192)
==585350==    by 0x18CCD162: mvsuperGetFrame (in /usr/lib/vapoursynth/libmvtools.so)
==585350==    by 0x5EB9311: UnknownInlinedFun (vscore.cpp:952)
==585350==    by 0x5EB9311: VSThreadPool::runTasks(std::atomic<bool>&) (vsthreadpool.cpp:174)
==585350==    by 0x494A942: execute_native_thread_routine (thread.cc:104)
==585350==    by 0x4B9044A: start_thread (pthread_create.c:444)
==585350==    by 0x4C13D63: clone (clone.S:100)
==585350==

podman logs don't show anything.

Desktop (please complete the following information):

Client:       Podman Engine
Version:      4.5.0
API Version:  4.5.0
Go Version:   go1.20.2
Built:        Fri Apr 14 17:42:22 2023
OS/Arch:      linux/amd64

distrobox: 1.4.2.1

Additional context Here is HorizontalWiener_avx2: https://github.com/dubhater/vapoursynth-mvtools/blob/d2c491b3030415c4b416f048e236f5f327d7cb89/src/MVFrame_AVX2.cpp#L186 It's uses avx2, could that maybe be a problem with distrobox or podman?

nalsai commented 1 year ago

Haven't solved it, but it's probably a bug in Vapoursynth