x86 IA-32
In my understanding accessing memory from user space program does not involve operating system.. Otherwise it would be slow.
So if paging enabled or not CPU should know somehow that this segment/page can be accessed by currently running code.
Let's say paging is off - so the only thing CPU can refer to (to determine access rights) is Segment Descriptor in GDT. But does Segment Descriptor contains any info about which process can use which segment?
Paging is on - Does Page Table Entry contains any info about who can access this particular page?
Bit 2 (U/S) User/supervisor; if 0, user-mode accesses are not allowed to the 4-KByte page referenced by this entry
It does contain privilege level, but it's not enough to determine does current code have access to this particular page.
How does CPU+MMU protect memory accesses without involving OS on every memory read/write?
What if some malicious process loads its own value in Segment selector?
Does MMU have some data structures that OS fills up on process creation/context switch?