3

在linux中,当发生中断或异常时,如果CUrrent Privilege Level (CPL) 的权限低于Description Privilege Level (DPL)。一般保护将被提升!但是在这种情况下,一般保护故障的作用是什么?请帮我!

4

1 回答 1

14

The processor does not permit transfer of execution to an exception or interrupt-handler procedure in a less privileged code segment than the CPL. An attempt to violate this rule results in a general-protection exception (#GP). more on that(http://www.lpthe.jussieu.fr/~talon/pentium3.pdf)

Inside the kernel each exception is handled by a specific exception handler, which usually sends a Unix signal to the process that caused the exception.

In our case : the kernel will generate a signal SIGSEV. The exception handler in this case is general_protection( ) (https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/traps.h)

EDIT : in this link you can get a great explanation about how the kernel compare DPL, CPL and RPL:

http://duartes.org/gustavo/blog/post/cpu-rings-privilege-and-protection

Another good link:

http://www.logix.cz/michal/doc/i386/chp06-03.htm

于 2012-08-16T10:30:57.817 回答