Why does Linux on x86 use different segments for user processes and the kernel?

前端 未结 4 370
旧时难觅i
旧时难觅i 2020-12-24 03:16

So, I know that Linux uses four default segments for an x86 processor (kernel code, kernel data, user code, user data), but they all have the same base and limit (0x00000000

4条回答
  •  一生所求
    2020-12-24 03:28

    Kernel memory should not be readable from programs running in user space.

    Program data is often not executable (DEP, a processor feature, which helps guard against executing an overflowed buffer and other malicious attacks).

    It's all about access control - different segments have different rights. That's why accessing the wrong segment will give you a "segmentation fault".

提交回复
热议问题