Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad access segmentation fault in AVX-512 stack as compiled with clang #8

Open
JustinTArthur opened this issue Sep 5, 2023 · 0 comments

Comments

@JustinTArthur
Copy link

JustinTArthur commented Sep 5, 2023

There may be unaligned memory involved in the AVX-512 functions. clang tends to not work around this automatically. I reproduced this in both r9 and r10 with either 8-bit and 16-bit video samples. The crash happens within updateFrame_avx512 but the offending variable or register could have been created upstream of that call.

CPU: Intel Xeon W-3235
OS: Apple macOS 13.5.1 (22G90)
C++ Toolchain:

Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix

Compilation extras: -march=cascadelake

Crash:

Crashed Thread:        59

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       UNKNOWN_0xD at 0x0000000000000000
Exception Codes:       0x000000000000000d, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [3851]

VM Region Info: 0 is not in any region.  Bytes before following region: 4397551616
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      1061d5000-1061d9000    [   16K] r-x/r-x SM=COW  .../MacOS/Python

Thread 59 Crashed:
0   libaddgrain.dylib             	       0x111bbc707 void updateFrame_avx512<unsigned char, signed char>(void const*, void*, int, int, long, int, int, AddGrainData const*) + 183
1   libaddgrain.dylib             	       0x111bbbc79 addgrainGetFrame(int, int, void*, void**, VSFrameContext*, VSCore*, VSAPI const*) + 393
2   libvapoursynth.dylib          	       0x1070c27ca VSNode::getFrameInternal(int, int, VSFrameContext*) + 144
3   libvapoursynth.dylib          	       0x1070d40d2 VSThreadPool::runTasks(std::__1::atomic<bool>&) + 870
4   libvapoursynth.dylib          	       0x1070d5ba1 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(VSThreadPool*, std::__1::atomic<bool>&), VSThreadPool*, std::__1::reference_wrapper<std::__1::atomic<bool>>>>(void*) + 44
5   libsystem_pthread.dylib       	    0x7ff8131221d3 _pthread_start + 125
6   libsystem_pthread.dylib       	    0x7ff81311dbd3 thread_start + 15

Thread 59 crashed with X86 Thread State (64-bit):
  rax: 0x00007fc372723448  rbx: 0x0000000000000000  rcx: 0x0000000000000120  rdx: 0x00000000000002d0
  rdi: 0x00007fc372788320  rsi: 0x00007fc3727c0320  rbp: 0x000070000764ec40  rsp: 0x000070000764ec30
   r8: 0x00000000000002e0   r9: 0x0000000000000000  r10: 0x0000600002208080  r11: 0x0000000000000120
  r12: 0x00007fc372788040  r13: 0x0000600002208080  r14: 0x0000000000000000  r15: 0x0000600003e31200
  rip: 0x0000000111bbc707  rfl: 0x0000000000010246  cr2: 0x00000001070aa7af
  
Logical CPU:     12
Error Code:      0x00000000 
Trap Number:     13

Thread 59 instruction stream:
  2e 0f 1f 84 00 00 00 00-00 48 63 db 62 f1 fd 48  .........Hc.b..H
  ef 14 1f 62 f1 6d 48 ec-14 18 62 f1 ed 48 ef d1  ...b.mH...b..H..
  62 f1 7d 48 e7 14 1e 41-03 5a 40 39 d3 7c da 4c  b.}H...A.Z@9.|.L
  01 c7 4c 01 c6 4b 63 5c-8a 34 48 01 d8 31 db 66  ..L..Kc\.4H..1.f
  2e 0f 1f 84 00 00 00 00-00 48 63 db 62 f1 fd 48  .........Hc.b..H
  ef 14 1f 62 f1 6d 48 ec-14 18 62 f1 ed 48 ef d1  ...b.mH...b..H..
 [62]f1 7d 48 e7 14 1e 41-03 5a 40 39 d3 7c da 4c  b.}H...A.Z@9.|.L	<==
  01 c7 4c 01 c6 4b 63 5c-8a 34 48 01 d8 41 83 c6  ..L..Kc\.4H..A..
  02 45 39 de 0f 85 6f ff-ff ff f6 c1 01 74 40 31  .E9...o......t@1
  c9 62 f1 fd 48 6f 05 3e-05 00 00 62 f2 fd 48 59  .b..Ho.>...b..HY
  0d a4 04 00 00 0f 1f 40-00 48 63 c9 62 f1 fd 48  [email protected]
  ef 14 0f 62 f1 6d 48 ec-14 08 62 f1 ed 48 ef d1  ...b.mH...b..H..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant