Opened 5 weeks ago

Closed 7 days ago

#11258 closed defect (duplicate)

7.1 regression: illegal instruction on riscv64

Reported by: Sebastian Ramacher Owned by:
Priority: normal Component: undetermined
Version: 7.1 Keywords:
Cc: Sebastian Ramacher Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

7.1 regressed on riscv64 on Debian. When running the test suite, many tests fail with illegal instructions:

TEST    srtp
/<<PKGBUILDDIR>>/tests/fate-run.sh fate-srtp "" "" "/<<PKGBUILDDIR>>/debian/standard" 'run libavformat/tests/srtp' '' '' '' '1' '' '' '' '' '' '' '' '' '' ''
 /<<PKGBUILDDIR>>/debian/standard/libavformat/tests/srtp
--- /<<PKGBUILDDIR>>/tests/ref/fate/srtp	2020-04-27 21:48:16.000000000 +0000
+++ tests/data/fate/srtp	2024-10-22 03:53:21.670605546 +0000
@@ -1,12 +0,0 @@
-80e0123412345678123456780102030405
-Decrypted content matches input
-Decrypted content matches input
-Decrypted content matches input
-81c90007123456788765432100000000000012340000069ec73069ba000001fd
-Decrypted content matches input
-Decrypted content matches input
-Decrypted content matches input
-80e0123412345678123456780102030405
-81c90007123456788765432100000000000012340000069ec73069ba000001fd
-80e0123412345678123456780102030405
-81c90007123456788765432100000000000012340000069ec73069ba000001fd
Test srtp failed. Look at tests/data/fate/srtp.err for details.
Illegal instruction
threads=1
make[2]: *** [/<<PKGBUILDDIR>>/tests/Makefile:311: fate-srtp] Error 132

srtp is just the first test to fail. There are many more. See https://buildd.debian.org/status/fetch.php?pkg=ffmpeg&arch=riscv64&ver=7%3A7.1-2&stamp=1729570917&raw=0 for the full list.

Change History (3)

comment:1 by Sebastian Ramacher, 3 weeks ago

Here now with a backtrace:

hread 6 "enc0:0:mp2fixed" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x3ff5200180 (LWP 229613)]
put_bits_no_assert (s=0x2aad416fd0, n=2, value=2) at src/libavcodec/put_bits.h:228
228                 AV_WBBUF(s->buf_ptr, bit_buf);
(gdb) bt
#0  put_bits_no_assert (s=0x2aad416fd0, n=2, value=2) at src/libavcodec/put_bits.h:228
#1  put_bits (s=0x2aad416fd0, n=2, value=2) at src/libavcodec/put_bits.h:250
#2  encode_frame (s=0x2aad416fd0, bit_alloc=0x3ff51ff1f0, padding=8) at src/libavcodec/mpegaudioenc_template.c:640
#3  MPA_encode_frame (avctx=<optimized out>, avpkt=<optimized out>, frame=0x3fe8000dd0, got_packet_ptr=0x3ff51ff4cc)
    at src/libavcodec/mpegaudioenc_template.c:764
#4  0x0000002aab0c2308 in ff_encode_encode_cb (avctx=avctx@entry=0x2aad3f8810, avpkt=avpkt@entry=0x3fe8002970, 
    frame=0x3fe8000dd0, got_packet=got_packet@entry=0x3ff51ff4cc) at src/libavcodec/encode.c:254
#5  0x0000002aab0c25f8 in encode_simple_internal (avctx=0x2aad3f8810, avpkt=0x3fe8002970)
    at src/libavcodec/encode.c:340
#6  encode_simple_receive_packet (avctx=<optimized out>, avpkt=<optimized out>) at src/libavcodec/encode.c:354
#7  encode_receive_packet_internal (avctx=avctx@entry=0x2aad3f8810, avpkt=0x3fe8002970) at src/libavcodec/encode.c:388
#8  0x0000002aab0c27c8 in avcodec_send_frame (avctx=avctx@entry=0x2aad3f8810, frame=frame@entry=0x3ff0000b70)
    at src/libavcodec/encode.c:531
#9  0x0000002aaac44ace in encode_frame (of=of@entry=0x2aad415780, ost=ost@entry=0x2aad416c70, 
    frame=frame@entry=0x3ff0000b70, pkt=pkt@entry=0x3ff0000d30) at src/fftools/ffmpeg_enc.c:645
#10 0x0000002aaac45250 in frame_encode (ost=0x2aad416c70, frame=0x3ff0000b70, pkt=0x3ff0000d30)
    at src/fftools/ffmpeg_enc.c:813
#11 encoder_thread (arg=0x2aad416c70) at src/fftools/ffmpeg_enc.c:899

The instruction causing the SIGILL according to gdb is:

=> 0x2aab26d9c8 <MPA_encode_frame+7654>:        .insn   4, 0x6b855793

git bisect suggests the commit at fault is 324899b7483529c336f399022c63721df14663ef.

comment:2 by Steven Keuchel, 3 weeks ago

Duplicate of https://trac.ffmpeg.org/ticket/11251. There are additional commits producing the same error in different parts of the code:

https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=324899b7483529c336f399022c63721df14663ef
https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=98db1409102c5443491c2738aa601531f7f9b938
https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=f6d0a41c8ca67672f8e4b3c6e16cb3abd9f379bf

A (temporary) fix is to add __volatile__ to the __asm__ blocks to avoid compiling the runtime check of ff_rv_zbb_support away.

comment:3 by Rémi Denis-Courmont, 7 days ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.