i386: clean up user_mode() use
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ingo Molnar
Acked-byQuoted 22 lines · * [email protected] <[email protected]> wrote:
on i386 there're two macros used for testing the userland execution
mode:user_mode()anduser_mode_vm(), which is not intuitive as on many (all?) other architectures there's onlyuser_mode()and architecture independent code is written withuser_mode()only, and even on i386 someone can make the wrong assumption thatuser_mode()works as it does on other archs.two cases in point:
drivers/oprofile/cpu_buffer.c:oprofile_add_sample() usesuser_mode()which can lead to incorrect results if the interrupted task was in v86 mode with a code segment fooling theuser_mode()selector RPL check. also, arch/i386/kernel/kprobes.c:kprobe_exceptions_notify() used to useuser_mode()whereas it really meantuser_mode_vm(), this is in fact incorrect until 2.6.17.to avoid such mistakes in the future, the suggested solution is to make
user_mode()on i386 consistent with the generic expectation and make it detect any user mode execution context, that is, it should take the role ofuser_mode_vm()and a newuser_mode_novm()is introduced for the i386 specific cases where v86 mode can be excluded. in short, the patch simply does a
Quoted 6 lines
user_mode_vm->user_mode
user_mode->user_mode_novmsubstitution as appropriate.
Signed-off-by PaX Team <[email protected]>
agreed!
Ingo