Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Segmentation fault in warp TLS on ARM platform #499
Apologies if this is not the right place to ask about platform-specific issues.
I have an easy to reproduce crash (segfault), this is the smallest piece of code I could narrow it down to: https://gist.github.com/andreyk0/5ffd9dd97fca4a02f22d
Threaded runtime seems significant (can't get it to crash without -threaded flag), on a single-cpu ARM board it takes a few tries, on a dual-core (A20) board it crashes on the first try.
I'm not sure how to produce a fully debug-enabled binary (including all the libs) with stack lts build.
Thanks for taking a look!
I've tried to narrow it down a bit more, it crashes because 'pread' in warp/Network/Wai/Handler/Warp/SendFile.hs returns -1 (error).
E.g. running strace
Offset is messed up and -1 taken as a result causes it to crash down the line inside encryption methods.
What's weird is that offset value from the app POV is actually 0.
I have no idea how to debug it beyond that, maybe someone with the knowledge of GHC and ARM will read this...
Still, even if you dismiss it as a platform-specific fluke, positionRead could probably benefit from adding an error check for -1 or at least an assert.