Science Fair Project Encyclopedia
SIGILL
ILL_ILLOPN
| illegal operand |
ILL_ADR
| illegal addressing mode |
ILL_ILLTRP
| illegal trap |
ILL_PRVOPC
| privileged opcode |
ILL_PRVREG
| privileged register |
ILL_COPROC
| coprocessor error |
ILL_BADSTK
| internal stack error |
SIGILL is the symbolic signal name for the signal sent to computer programs that attempt to execute malformed, unknown, or privileged instructions on POSIX compliant platforms. SIGILL is a symbolic constant defined in signal.h. Symbolic signal names are used as signal numbers can vary across platforms.
| Contents |
Etymology
SIG- is a common prefix for signal names, ILL is a Contraction of Illegal Instruction.
Description
There are many possible reasons for receiving a SIGILL, a common mistake involves accidentally overwriting stack data with a return address that points to data not meant to be executed. Other problems might involve compiler (toolchain) bugs, filesystem corruption or attempting to execute instructions that require special privileges.
Many platforms implement new instructions or provide additional registers on subsequent hardware revisions, applications compiled for more recent hardware may generate Illegal Instructions on previous revisions that do not recognise the new opcodes. An example might be attempting to use MMX instructions on an Intel 80486 processor that didn't support the feature.
SIGILL can also be generated by users with the appropriate permissions, using the kill() system call.
SIGILL can be handled, that is, programmers can specify the action they would like to occur on receiving a SIGILL, such as execute a subroutine, ignore the event, or restore the default behaviour.
Note that under certain circumstances, attempting to ignore a SIGILL can result in Nasal demons.
Example
Here is an example of an ANSI C program that should attempt to execute an Illegal Instruction on platforms where 0xffffffff is not an valid opcode.
int main()
{
unsigned char insn[4] = { 0xff, 0xff, 0xff, 0xff };
void (*function)() = (void (*)()) insn;
function();
}
Compiling and running it on IA-32 with Linux produces the following:
$ gcc -o sigill sigill.c $ ./sigill Illegal instruction (core dumped)
Program received signal SIGILL, Illegal instruction. 0xbfffede4 in ?? () (gdb) bt #0 0xbfffede4 in ?? () #1 0x0804837f in main () (gdb) display /i $eip 1: x/i $eip 0xbfffede4: (bad)
note (bad), indicating the opcodes do not make sense, the mnemonic representing the instruction would normally be displayed here.
Compare
See Also
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details


