0
votes

I may be wrong, but based on what I have read, the DPL and the RPL in addition to the CPL are used to prevent or to allow a process to access some memory area when using memory segmentation.

But modern operating systems (for example: Linux) don't use memory segmentation, instead they use paging, and a process's page table allows you to specify that some memory areas can only be accessed while the CPU is in kernel mode (and whether the CPU is in user mode or in kernel mode is only determined by the CPL).

Am I correct that the the DPL and the RPL don't matter when using paging, and only the CPL is the one that matters?

1

1 Answers

2
votes

It's a matter of segmentation configuration. Memory access is granted when both segmentation and page translation access checks pass (in that order).

It is true that nowadays segmentation is rarely used for what it was designed, it isn't true that segmentation is somehow non-existent when page translation is enabled. It's just that page translation does the work far better and so the segments are set up in such a way that they simply get out of the way.

There are several key problems with x86 segments:

  • compilers need to support far pointers, which is messy (it was messier in 16-bit protected mode, where segments needed to be managed by applications and the OS)
  • they can't have holes or subregions with different attributes and many segments are problematic not only to manage but also to have (the GDT and LDT provide space for up to 8191 segment descriptors each)