MQ
2006-10-06 11:33:06 UTC
Ok, im trying to get my head around the use of CPL, DPL and RPL in
protected mode privilege checks. The concept of the CPL and DPL make
sense to me. Obviously you need to have a privilege state for the
currently executing program, and each segment needs to be marked with a
privilege level so that access checks can occur by comparing CPL and
DPL. I still can't really see the point of RPLs in privilege checks.
For example, when attempting to access a data segment, if you specify
an RPL lower than the CPL it will always be overriden by the CPL
anyway. And what purpose is there to making RPL > CPL?? Let's say
that we are running at CPL=2 and we attempt to access a data segment
with DPL=2. You could make RPL=2 or 3, but what difference would it
make what RPL you used? You would get the same access to the segment,
right?
For transfer of execution to code segments, RPL seems to be redundant
in all cases. Only the CPL seems to be useful. RPLs in this case just
seem to be a nuisance that you have to make the same as the CPL...
Finally, when far pointers are passed to a privileged routine from a
non-privileged routine (eg call to ring 0 from ring 3), the RPL of the
far pointer needs to be checked and adjusted to the same value as the
calling codes CPL with ARPL instruction if you want to be sure the RPL
is secure. Again, this seems so pointless and painful. Why provide an
RPL if you don't (and you shouldn't) trust it's value anyway.
Perhaps there is some reason for RPLs but I cannot see it. Any help
appreciated.
cheers
MQ
protected mode privilege checks. The concept of the CPL and DPL make
sense to me. Obviously you need to have a privilege state for the
currently executing program, and each segment needs to be marked with a
privilege level so that access checks can occur by comparing CPL and
DPL. I still can't really see the point of RPLs in privilege checks.
For example, when attempting to access a data segment, if you specify
an RPL lower than the CPL it will always be overriden by the CPL
anyway. And what purpose is there to making RPL > CPL?? Let's say
that we are running at CPL=2 and we attempt to access a data segment
with DPL=2. You could make RPL=2 or 3, but what difference would it
make what RPL you used? You would get the same access to the segment,
right?
For transfer of execution to code segments, RPL seems to be redundant
in all cases. Only the CPL seems to be useful. RPLs in this case just
seem to be a nuisance that you have to make the same as the CPL...
Finally, when far pointers are passed to a privileged routine from a
non-privileged routine (eg call to ring 0 from ring 3), the RPL of the
far pointer needs to be checked and adjusted to the same value as the
calling codes CPL with ARPL instruction if you want to be sure the RPL
is secure. Again, this seems so pointless and painful. Why provide an
RPL if you don't (and you shouldn't) trust it's value anyway.
Perhaps there is some reason for RPLs but I cannot see it. Any help
appreciated.
cheers
MQ