Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1111511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:33:32+00:00 2026-05-17T02:33:32+00:00

For a class assignment, we are writing a custom syscall which pulls certain information

  • 0

For a class assignment, we are writing a custom syscall which pulls certain information about the existing process tree. The syscall is working fine for the most part and gets the appropriate information. However, a few processes it, in crashes with the error message, “Unable to handle kernel NULL pointer dereference at virtual address [address]”. What I don’t understand is that I’m testing if the pointer is NULL before accessing it, and yet, it still fails.

Example: In the code below, current_process is a valid pointer to a task_struct and k_buf is valid

printk("Setting parent process\n");
parent_process = current_process->real_parent;
printk("Parent process set\n");
if (parent_process != NULL) {
printk("Parent process is not null and getting pid\n");
    k_buf[i].parent_pid = parent_process->pid;
} else {
    k_buf[i].parent_pid = 0;
}
printk("Done with parent process\n");

When run, the program prints:

Setting parent process
Parent process set
Parent process is not null and getting pid
Done with parent process

a couple of times, and then

Setting parent process
Parent process set
Parent process is not null and getting pid

before throwing the error and going into kernel panic.

What am I doing wrong? Any thoughts?

EDIT:

For the time being, I commented out the above code so I could continue working on the rest of the system call. When I try to access the pid of a child process (again after a couple of successful attempts), it gives me a “Unable to handle kernel paging request at virtual address” error. As far as I understand, I have the correct locks in place for reading this data. However, is there something else I need to do to check the memory before I access it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:33:33+00:00Added an answer on May 17, 2026 at 2:33 am

    I’m speculating here but could parent_process->pid being NULL be the cause of your “kernel panic”? If so, you could check for that too.

    Its either that, or some issue with accessing the ith element of k_buf array ie. *(k_buf+i)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a program for a class assignment on learning about pointers and
I am currently writing a custom context menu class which utilizes jQuery largely. We
i'm working on a network programming assignment about writing a simple IM system (pretty
I am doing an assignment for an information systems class and the professor decided
I am working on an assignment for my Operating System class (Posix & C),
We are working on a toy operating system as a assignment for a class.
Working on a class assignment in C#, I came across a program crash without
I'm working on a C++ class assignment and I'd like some input. I'm not
I'm writing an assignment for a databases class, and we're required to migrate our
I'm writing a wrapper for a REST API (which is a static class with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.