linux - Null pointer dereference in User space and kernel space -
what happen if dereference null pointer in user space , kernel space?
from understanding behaviour based on compiler,architecture,etc.
but in general every user space program allocated virtual memory , paging used translate virtual address physical address using page tables.
so if dereferencing null pointer in user space,that address invalid context switch happen , in kernel based on interrupt null pointer dereference 'segmentation fault come or page fault error come'.
in kernel space:
if dereference null pointer there possibility of crashing system or kernel may not able return call.
is understanding correct?or other informations missing means please explain.
ref:i have understood "what happens in os when dereference null pointer in c?"
the kernel maps page @ virtual address 0 processes no permission bits set. when try access page, page fault. kernel routine handles issues sigsegv
signal process. if have no handler sigsegv
registered, core dumped , see "segmentation fault" message.
kernel side, things bit different. after all, kernel supposed robust:
- if dereference happens , recovery possible (e.g. trackpad driver did offence), kernel oops generated. kernel continues running (for now).
- if dereference occurs no recovery possible, oops leads kernel panic. reboot necessary.
- if reason, there data mapped @ page zero, corrupt memory. lead panic down way, go unnoticed or abused privilege escalation attack.
Comments
Post a Comment