]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/i386/tcg: Use DPL-level accesses for interrupts and call gates
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 18 Jun 2024 06:53:19 +0000 (08:53 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 18 Oct 2024 15:51:49 +0000 (18:51 +0300)
commit6ad00eb0d39526e22b6956349fdc8f17916c678f
treefecf1cb488c31bfdc8e3cc74c1b1b10a0994305a
parent9eb3cc1641b59a49a7180554de399143a8b69faf
target/i386/tcg: Use DPL-level accesses for interrupts and call gates

Stack accesses should be explicit and use the privilege level of the
target stack.  This ensures that SMAP is not applied when the target
stack is in ring 3.

This fixes a bug wherein i386/tcg assumed that an interrupt return, or a
far call using the CALL or JMP instruction, was always going from kernel
or user mode to kernel mode when using a call gate. This assumption is
violated if the call gate has a DPL that is greater than 0.

Analyzed-by: Robert R. Henry <rrh.henry@gmail.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/249
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit e136648c5c95ee4ea233cccf999c07e065bef26d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/i386/tcg/seg_helper.c