llvm / llvm/llvm-project

Stack misalignment while executing SSE code

Open
#181,865 0 comments 0 reactions 0 assignees View on GitHub
incomplete
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Void Linux, x64 bit, latest LLVM, 32-bit executable initializing Mesa, segfaulting with:

```
#0 0xeeb9eefe in llvm::xxh3_64bits(llvm::ArrayRef) () from /usr/lib32/libLLVM.so.21.1
#1 0xeeb45426 in llvm::StringMapImpl::hash(llvm::StringRef) () from /usr/lib32/libLLVM.so.21.1
#2 0xeead3031 in ?? () from /usr/lib32/libLLVM.so.21.1
#3 0xeeac32d9 in llvm::cl::Option::addArgument() () from /usr/lib32/libLLVM.so.21.1
```

Likely due to misaligned stack (stack is aligned in the caller `llvm::StringMapImpl::hash`):

```
=> 0xeeb9eefe <_ZN4llvm11xxh3_64bitsENS_8ArrayRefIhEE+430>: movdqa XMMWORD PTR [esp+0x20],xmm0
0xeeb9ef04 <_ZN4llvm11xxh3_64bitsENS_8ArrayRefIhEE+436>: punpckldq xmm0,xmm4
0xeeb9ef08 <_ZN4llvm11xxh3_64bitsENS_8ArrayRefIhEE+440>: movdqa xmm5,xmm1
0xeeb9ef0c <_ZN4llvm11xxh3_64bitsENS_8ArrayRefIhEE+444>: punpcklqdq xmm5,xmm0

$esp = (void *) 0xffffbeb4
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the 32-bit Mesa initialization crash on Void Linux with the reported LLVM build, then inspect the call path through llvm::StringMapImpl::hash, llvm::xxh3_64bits, and llvm::cl::Option::addArgument. Confirm whether the SSE instruction is reached with a misaligned stack and document a fix that prevents the segfault.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.