4 ms·
In case the author sees this: > Of course, my patch isn’t perfect. It can’t handle some anonymous structs, enums, const ints, or amazing things like using SIGI
by yjftsjthsd-h 3y ago
In case the author sees this:
> Of course, my patch isn’t perfect. It can’t handle some anonymous structs, enums, const ints, or amazing things like using SIGILL as an array index [...]
Is "SIGILL" a typo?
- hkgjjgjfjfjfjf 3y ago[dead]
- inglor_cz 3y agoThe SIGILL signal is raised when an attempt is made to execute an invalid, privileged, or ill-formed instruction. SIGILL is usually caused by a program error that overlays code with data or by a call to a function that is not linked into the program load module. [0] https://support.sas.com/documentation/onlinedoc/ccompiler/doc700/html/lr1/z2005346.htm https://support.sas.com/documentation/onlinedoc/ccompiler/do...
- yjftsjthsd-h 3y agoThanks, didn't know that was an actual signal!
- spacechild1 3y agoAnother common cause is trying to execute instructions that the CPU doesn't support, e.g. trying to run AVX2 code on a machine that only supports SSE4.
- inglor_cz 3y agoYeah, the only situation when I saw SIGILL "live" was my attempt to run some AES instructions on an emulator that didn't support them.
- ahgamut 3y agoSIGILL is for "illegal instruction", according to https://man7.org/linux/man-pages/man7/signal.7.html https://man7.org/linux/man-pages/man7/signal.7.html I too thought it was a typo when I caused it to occur while building BLIS, but then I found out it was because I had added some AVX thing to the config that my local computer did not have.
- flohofwoe 3y agoSome compilers (like gcc) emit an 'ud' instruction (https://www.felixcloutier.com/x86/ud https://www.felixcloutier.com/x86/ud) in some situations where the compiler detects undefined behaviour. IIRC this instruction triggers SIGILL on Linux.
- jeroenhd 3y agoI ran into this a few days ago when I was running some else's old code that didn't return a value at the end of a method expecting a return value in C. The program would crash with a core dump and the debugger wasn't very clear either. It's been a while since I've needed to dig into the disassembly view. I don't understand why the compiler wouldn't just error out if it generates code that will never actually succeed, but I'm sure there's some C programmer's explanation for it.
- flohofwoe 3y agoI'm a C programmer and I don't understand it either to be honest. The compiler obviously knows that it encounters UB in this case because it specifically inserts an ud instruction. It could at least warn about it (and if it doesn't have the information to generate a useful warning or error at that point where the ud instruction is inserted, then that's obviously a problem that needs fixing).
- cratermoon 3y agoAn array of, say, strings, or functions, indexed according to IPC signal numbers. So array[SIGHUP] would be the same as array[2] so SIGILL would be array[4], or the 5th element of the array.