libsigsegv - GNU Project - Free Software Foundation

submited by
Style Pass
2025-08-08 13:00:08

GNU libsigsegv is a library for handling page faults in user mode. A page fault occurs when a program tries to access to a region of memory that is currently not available. Catching and handling a page fault is a useful technique for implementing:

Some platforms don't support this functionality. In <sigsegv.h>, the preprocessor macro HAVE_SIGSEGV_RECOVERY will be defined if global and local SIGSEGV handlers are available, and the preprocessor macro HAVE_STACK_OVERFLOW_RECOVERY will be defined if stack overflow handlers are available. Note that the declared functions are available in all cases; on platforms where HAVE_SIGSEGV_RECOVERY or HAVE_STACK_OVERFLOW_RECOVERY is not defined, they will simply always return an error code or do nothing.

Installing a page fault handler is usually more efficient than doing access checks in software at every access, because it's effectively the hardware (the MMU) which checks whether a page is present or not.

Leave a Comment
Related Posts