General protection fault when compiled with Clang + LTO
When compiling dav1d 0.8.2 (and master) with Clang and -flto
(thin or not) libdav1d.so.5.0.1
segfaults with dav1d-frame[513136] general protection fault
in dmesg
.
No such issues occur when compiling without LTO, or when using GCC + LTO
clang version 12.0.0 ###(same with 11.1.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/12/bin
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0
CFLAGS="-march=znver2 -O2 -flto=thin -glldb -pipe"
CXXFLAGS="-march=znver2 -O2 -flto=thin -glldb -pipe"
Backtrace through lldb -- mpv BigBuckBunny-AV1.webm
(on master)
(lldb) r
Process 531832 launched: '/usr/bin/mpv' (x86_64)
(+) Video --vid=1 (*) (av1 854x480 25.000fps)
(+) Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
Process 531832 stopped
* thread #10, name = 'dav1d-tile', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00007ffff53da4b2 libdav1d.so.5`..@27186.end + 434
libdav1d.so.5`..@27186.end:
-> 0x7ffff53da4b2 <+434>: vmovdqa %ymm0, (%rsp)
0x7ffff53da4b7 <+439>: vpmulhrsw %ymm6, %ymm7, %ymm0
0x7ffff53da4bc <+444>: vpsraw $0x1, %ymm0, %ymm0
0x7ffff53da4c1 <+449>: vpavgw %ymm0, %ymm6, %ymm6
thread #14, name = 'dav1d-frame', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00007ffff53e1e92 libdav1d.so.5`dav1d_lpf_h_sb_y_avx2.loop + 258
libdav1d.so.5`dav1d_lpf_h_sb_y_avx2.loop:
-> 0x7ffff53e1e92 <+258>: vmovdqa %ymm15, 0x160(%rsp)
0x7ffff53e1e9b <+267>: vpunpcklbw %ymm1, %ymm0, %ymm15 ; ymm15 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[4],ymm1[4],ymm0[5],ymm1[5],ymm0[6],ymm1[6],ymm0[7],ymm1[7],ymm0[16],ymm1[16],ymm0[17],ymm1[17],ymm0[18],ymm1[18],ymm0[19],ymm1[19],ymm0[20],ymm1[20],ymm0[21],ymm1[21],ymm0[22],ymm1[22],ymm0[23],ymm1[23]
0x7ffff53e1e9f <+271>: vpunpckhbw %ymm1, %ymm0, %ymm0 ; ymm0 = ymm0[8],ymm1[8],ymm0[9],ymm1[9],ymm0[10],ymm1[10],ymm0[11],ymm1[11],ymm0[12],ymm1[12],ymm0[13],ymm1[13],ymm0[14],ymm1[14],ymm0[15],ymm1[15],ymm0[24],ymm1[24],ymm0[25],ymm1[25],ymm0[26],ymm1[26],ymm0[27],ymm1[27],ymm0[28],ymm1[28],ymm0[29],ymm1[29],ymm0[30],ymm1[30],ymm0[31],ymm1[31]
0x7ffff53e1ea3 <+275>: vpunpcklbw %ymm3, %ymm2, %ymm1 ; ymm1 = ymm2[0],ymm3[0],ymm2[1],ymm3[1],ymm2[2],ymm3[2],ymm2[3],ymm3[3],ymm2[4],ymm3[4],ymm2[5],ymm3[5],ymm2[6],ymm3[6],ymm2[7],ymm3[7],ymm2[16],ymm3[16],ymm2[17],ymm3[17],ymm2[18],ymm3[18],ymm2[19],ymm3[19],ymm2[20],ymm3[20],ymm2[21],ymm3[21],ymm2[22],ymm3[22],ymm2[23],ymm3[23]
(lldb) bt
* thread #10, name = 'dav1d-tile', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
* frame #0: 0x00007ffff53da4b2 libdav1d.so.5`..@27186.end + 434
frame #1: 0x00007ffff54602fe libdav1d.so.5`dav1d_recon_b_intra_8bpc(t=<unavailable>, bs=<unavailable>, intra_edge_flags=<unavailable>, b=<unavailable>) at recon_tmpl.c:1357:29 [opt]
frame #2: 0x00007ffff5423de6 libdav1d.so.5`decode_b(t=<unavailable>, bl=BL_64X64, bs=BS_64x64, bp=PARTITION_NONE, intra_edge_flags=EDGE_I444_TOP_HAS_RIGHT | EDGE_I422_TOP_HAS_RIGHT | EDGE_I420_TOP_HAS_RIGHT) at decode.c:721:13 [opt]
frame #3: 0x00007ffff541d9e8 libdav1d.so.5`decode_sb(t=<unavailable>, bl=<unavailable>, node=<unavailable>) at decode.c:2102:17 [opt]
frame #4: 0x00007ffff541cd75 libdav1d.so.5`dav1d_decode_tile_sbrow(t=<unavailable>) at decode.c:2529:17 [opt]
frame #5: 0x00007ffff5488978 libdav1d.so.5`dav1d_tile_task(data=0x00007fffe59c6040) at thread_task.c:228:35 [opt]
frame #6: 0x00007ffff58a9136 libpthread.so.0`start_thread + 214
frame #7: 0x00007ffff57d662f libc.so.6`__clone + 63
(lldb)
Build log should it be helpful (0.8.2
through Gentoo/emerge): dav1d-emerge-log.txt
Edited by Theo Anderson