diff mbox series

target/i386: fix shadowed variable pasto

Message ID 20231011135350.438492-1-pbonzini@redhat.com
State New
Headers show
Series target/i386: fix shadowed variable pasto | expand

Commit Message

Paolo Bonzini Oct. 11, 2023, 1:53 p.m. UTC
Commit a908985971a ("target/i386/seg_helper: introduce tss_set_busy",
2023-09-26) failed to use the tss_selector argument of the new function,
which was therefore unused.

This shows up as a #GP fault when booting old versions of 32-bit
Linux.

Fixes: a908985971a ("target/i386/seg_helper: introduce tss_set_busy", 2023-09-26)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/tcg/seg_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Oct. 11, 2023, 2:03 p.m. UTC | #1
On 11/10/23 15:53, Paolo Bonzini wrote:
> Commit a908985971a ("target/i386/seg_helper: introduce tss_set_busy",
> 2023-09-26) failed to use the tss_selector argument of the new function,
> which was therefore unused.
> 
> This shows up as a #GP fault when booting old versions of 32-bit
> Linux.
> 
> Fixes: a908985971a ("target/i386/seg_helper: introduce tss_set_busy", 2023-09-26)
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   target/i386/tcg/seg_helper.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Markus Armbruster Oct. 11, 2023, 2:57 p.m. UTC | #2
Paolo Bonzini <pbonzini@redhat.com> writes:

> Commit a908985971a ("target/i386/seg_helper: introduce tss_set_busy",
> 2023-09-26) failed to use the tss_selector argument of the new function,
> which was therefore unused.
>
> This shows up as a #GP fault when booting old versions of 32-bit
> Linux.
>
> Fixes: a908985971a ("target/i386/seg_helper: introduce tss_set_busy", 2023-09-26)
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Queued.  Thanks!
diff mbox series

Patch

diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c
index 2b92aee2073..eb29a1fd4e7 100644
--- a/target/i386/tcg/seg_helper.c
+++ b/target/i386/tcg/seg_helper.c
@@ -229,7 +229,7 @@  static void tss_load_seg(CPUX86State *env, X86Seg seg_reg, int selector,
 static void tss_set_busy(CPUX86State *env, int tss_selector, bool value,
                          uintptr_t retaddr)
 {
-    target_ulong ptr = env->gdt.base + (env->tr.selector & ~7);
+    target_ulong ptr = env->gdt.base + (tss_selector & ~7);
     uint32_t e2 = cpu_ldl_kernel_ra(env, ptr + 4, retaddr);
 
     if (value) {