Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda