Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Segmentation fault
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Overview == [[File:FreeBSD kernel panic.png|thumb|Example of human generated signal]] [[File:KDE Crash Handler screenshot.png|thumb|Segmentation fault affecting [[Krita]] in [[KDE]] desktop environment]] [[File:Windows null ptr dereference.png|thumb|A [[null pointer]] [[Dereference operator|dereference]] on [[Windows 8]]]] A segmentation fault occurs when a program attempts to access a [[computer memory|memory]] location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a [[read-only memory|read-only]] location, or to overwrite part of the [[operating system]]). The term "segmentation" has various uses in computing; in the context of "segmentation fault", it refers to the address space of a ''program.''<ref>{{Cite web|title=Debugging Segmentation Faults and Pointer Problems - Cprogramming.com|url=https://www.cprogramming.com/debugging/segfaults.html|access-date=2021-02-03|website=www.cprogramming.com}}</ref> With memory protection, only the program's own address space is readable, and of this, only the [[call stack|stack]] and the read/write portion of the [[data segment]] of a program are writable, while read-only data allocated in the const segment and the [[code segment]] are not writable. Thus attempting to read outside of the program's address space, or writing to a read-only segment of the address space, results in a segmentation fault, hence the name. On systems using hardware [[memory segmentation]] to provide [[virtual memory]], a segmentation fault occurs when the hardware detects an attempt to refer to a non-existent segment, or to refer to a location outside the bounds of a segment, or to refer to a location in a fashion not allowed by the permissions granted for that segment. On systems using only [[paging]], an [[invalid page fault]] generally leads to a segmentation fault, and segmentation faults and page faults are both faults raised by the [[virtual memory]] management system. Segmentation faults can also occur independently of page faults: illegal access to a valid page is a segmentation fault, but not an invalid page fault, and segmentation faults can occur in the middle of a page (hence no page fault), for example in a [[buffer overflow]] that stays within a page but illegally overwrites memory. At the hardware level, the fault is initially raised by the [[memory management unit]] (MMU) on illegal access (if the referenced memory exists), as part of its memory protection feature, or an invalid page fault (if the referenced memory does not exist). If the problem is not an invalid logical address but instead an invalid physical address, a [[bus error]] is raised instead, though these are not always distinguished. At the operating system level, this fault is caught and a signal is passed on to the offending process, activating the process's handler for that signal. Different operating systems have different signal names to indicate that a segmentation fault has occurred. On [[Unix-like]] operating systems, a signal called SIGSEGV (abbreviated from ''segmentation violation'') is sent to the offending process. On [[Microsoft Windows]], the offending process receives a STATUS_ACCESS_VIOLATION [[exception handling|exception]].
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Segmentation fault
(section)
Add topic