Muli Ben-Yehuda's journal

June 8, 2004

the story of a (page) fault

Filed under: Uncategorized — Muli Ben-Yehuda @ 6:15 PM

I just added some tracing code to arch/i386/mm/fault.c:do_page_fault() and it worked on the first try. I love it when that happens!

I’m trying to figure out why a user space program that accesses the area where the kernel is supposedly mapped (above PAGE_OFFSET,
e.g. 0xC0000004) gets killed. I know (vis-a-vis the tracing code
mentioned above) that it gets a page fault, sees that it’s above PAGE_OFFSET and a user space fault, and then sends a SIGSEGV. What I am not absolutely convinced about is why the fault happens in the first place. The options are that it gets a fault because the kernel is mapped, but the protection on the ptes is such that only code running in ring 0 (i.e. the kernel) can access them, or that the kernel is not mapped while we are running in user space, and is only mapped in when we context switch to kernel space. The former makes a lot more sense, but I haven’t yet hunted down the code that does it.

This question came up in the context of our reading group at work that is reading Mel Gorman’s Understanding the Linux VM book. The books is not great for our needs (too many details, not enough overview and concepts), but provides great context for the discussions.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: