Skip to content

SIGILL signal or Illegal instruction message #513

@kimjs29

Description

@kimjs29

I want to catch SIGILL signal or receive "Illegal instruction" on stderr.

The following test code corrupts returning address on stack intensionally, which generates on Linux SIGILL signal on the executable stack or SIGSEGV signal on the non-executable stack, respectively.

void foo(int n) {
    long buf[] = {-1};
    buf[n] = (long)buf;
}

int main() {
    foo(3);
}

The executable stack can be set by using execstack -s command and verified by using readelf -l command.

On WSL the above code generates only SIGSEGV signal in both cases. I know mprotect(... PROT_GROWSDOWN) is not supported on WSL, but I think this case should be distinguished.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions