Take the 2-minute tour ×

If I read/write/jump to an ummapped address ie.

    .global _start
     movl   $1,%edx
     jmp     *%edx

this causes a segmentation fault.

I wonder, what's the actual part of the system (kernel) that intercepts reads/writes to unmapped addresses (how ?) and throws the "user mode" signal ?

share|improve this question
Well there's hardware support for the how, perhaps duartes.org/gustavo/blog/post/… For the where, I guess you should look for the interrupt handler? –  wds Jun 24 '09 at 9:26

3 Answers 3

up vote 4 down vote accepted

Everything flows from the architectures trap table. This is usually called entry.S (split on x86 between entry_32 and entry_64.S) and has assembler linkage that does a number of things (depending on config) before heading into the C code of the kernel proper.

So an invalid memory access should enter through either page_fault or general_protection and will probably end up doing force_sig_info before finally being queued back to user space in send_signal (kernel/signal.c).

share|improve this answer

It is implemented for different architecture. For example, on x86, you can check the source at:

do_page_fault: linux/arch/x86/mm/fault.c
share|improve this answer
Page faults and segmentation faults are completely different things. –  SoapBox Apr 9 '10 at 11:08

In PowerPC chips that are not "Book E" (e.g., recent chips for embedded systems), a segmentation fault starts with an exception 0x300 (for data) or 0x400 (for instructions.) The user/supervisor mode flag is set to supervisor, the MMU is turned off, and the CPU jumps to address 0x300 or 0x400, giving control to the operating system.

share|improve this answer

Your Answer


