What is "the kernel address space"?

6.7k views Asked by At

From Understanding The Linux Kernel, here is some discussion about kernel thread vs user process i.e. regular process:

Besides user processes, Unix systems include a few privileged processes called kernel threads with the following characteristics:

• They run in Kernel Mode in the kernel address space.

• They do not interact with users, and thus do not require terminal devices.

• They are usually created during system startup and remain alive until the system is shut down.

...

In Linux, kernel threads differ from regular processes in the following ways:

• Kernel threads run only in Kernel Mode, while regular processes run alternatively in Kernel Mode and in User Mode.

• Because kernel threads run only in Kernel Mode, they use only linear addresses greater than PAGE_OFFSET. Regular processes, on the other hand, use all four gigabytes of linear addresses, in either User Mode or Kernel Mode.

I have heard about the virtual address space of a user process i.e. regular process, and a portion of the address space is mapped to the kernel code and data.

My Questions:

  • I was wondering what "the kernel address space" in the above quote mean?
  • Is it not the part of the virtual address space of a user process?
  • Does it mean that the kernel have its own virtual address space, just like a user process has its own virtual address space?
1

There are 1 answers

0
Hadi Brais On

The book uses the term "kernel address space" to refer to the partition of the virtual address space that is allocated for the kernel.

Recently, Linux and other OSes have implemented page-table isolation (PTI) to mitigate the Meltdown security vulnerability. With PTI, the kernel does have its own address space (as the image from Wikipedia shows). But since the book is old, it's written at a time when PTI was not even invented yet.

                               

So it's definitely referring to the kernel partition of the virtual address space, which also contains the user partition.