Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
Null pointer dereference in User space and kernel space

what will happen if we dereference the null pointer in user space and kernel space?

From my understanding the behaviour is based on compiler,architecture,etc.

but in general for every user space program allocated with virtual memory and the paging is used to translate the virtual address to physical address using page tables.

so if we are dereferencing null pointer in user space,that address is invalid so the context switch will happen and in kernel based on the interrupt for this null pointer dereference 'Segmentation fault will come or page fault error will come'.

In Kernel space:

If we dereference the NULL pointer there is a possibility of crashing the system or kernel may not able to return from that call.

Is my understanding correct?or any other informations missing means please explain.

Ref:I have understood from this "What happens in OS when we dereference a NULL pointer in C?"

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The kernel maps the page at virtual address 0 into all processes with no permission bits set. When you try to access that page, you get a page fault. The kernel routine that handles it issues a SIGSEGV signal to your process. If you have no handler for SIGSEGV registered, core is dumped and you see your "Segmentation fault" message.

Kernel side, things are a bit different. After all, the kernel is supposed to be robust:

  • If the dereference happens and recovery is possible (e.g. your trackpad driver did the offence), a kernel oops is generated. The kernel continues running (for now).
  • If the dereference occurs so that no recovery is possible, the Oops leads to a kernel panic. Reboot necessary.
  • If for some reason, there is data mapped at page zero, you will corrupt memory. Which could lead to a panic down the way, go unnoticed or even be abused for a privilege escalation attack.
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!