Reputation: 359
In linux, when an interrupt or exception occur, if CUrrent Privilege Level (CPL) is lower privilege than Description Privilege Level (DPL).General Protection will be raised! but what is the function of General Protection Fault in this situation? please help me!
Upvotes: 3
Views: 10098
Reputation: 4446
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
Upvotes: 14