* [PATCH] target/i386: Fix CR2 handling for non-canonical addresses
@ 2025-06-12 14:21 Mathias Krause
2025-07-21 10:17 ` Mathias Krause
2025-10-11 6:59 ` Paolo Bonzini
0 siblings, 2 replies; 5+ messages in thread
From: Mathias Krause @ 2025-06-12 14:21 UTC (permalink / raw)
To: Paolo Bonzini, Richard Henderson, Eduardo Habkost
Cc: qemu-devel, Mathias Krause
Commit 3563362ddfae ("target/i386: Introduce structures for mmu_translate")
accidentally modified CR2 for non-canonical address exceptions while these
should lead to a #GP / #SS instead -- without changing CR2.
Fix that.
A KUT test for this was submitted as [1].
[1] https://lore.kernel.org/kvm/20250612141637.131314-1-minipli@grsecurity.net/
Fixes: 3563362ddfae ("target/i386: Introduce structures for mmu_translate")
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
---
target/i386/tcg/system/excp_helper.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/target/i386/tcg/system/excp_helper.c b/target/i386/tcg/system/excp_helper.c
index c16262158774..5f1023937fa8 100644
--- a/target/i386/tcg/system/excp_helper.c
+++ b/target/i386/tcg/system/excp_helper.c
@@ -593,7 +593,8 @@ static bool get_physical_address(CPUX86State *env, vaddr addr,
if (sext != 0 && sext != -1) {
*err = (TranslateFault){
.exception_index = EXCP0D_GPF,
- .cr2 = addr,
+ /* non-canonical #GP doesn't change CR2 */
+ .cr2 = env->cr[2],
};
return false;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] target/i386: Fix CR2 handling for non-canonical addresses
2025-06-12 14:21 [PATCH] target/i386: Fix CR2 handling for non-canonical addresses Mathias Krause
@ 2025-07-21 10:17 ` Mathias Krause
2025-10-10 6:23 ` Mathias Krause
2025-10-11 6:59 ` Paolo Bonzini
1 sibling, 1 reply; 5+ messages in thread
From: Mathias Krause @ 2025-07-21 10:17 UTC (permalink / raw)
To: Paolo Bonzini, Richard Henderson; +Cc: Eduardo Habkost, qemu-devel
On 12.06.25 16:21, Mathias Krause wrote:
> Commit 3563362ddfae ("target/i386: Introduce structures for mmu_translate")
> accidentally modified CR2 for non-canonical address exceptions while these
> should lead to a #GP / #SS instead -- without changing CR2.
>
> Fix that.
>
> A KUT test for this was submitted as [1].
>
> [1] https://lore.kernel.org/kvm/20250612141637.131314-1-minipli@grsecurity.net/
>
> Fixes: 3563362ddfae ("target/i386: Introduce structures for mmu_translate")
> Signed-off-by: Mathias Krause <minipli@grsecurity.net>
> ---
Ping!
Paolo, Richard, any take on the patch? It's a regression fix that can
easily be verified with the KUT test failing after the commit mentioned
in the Fixes tag and succeeding again with the below fix applied.
Thanks,
Mathias
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] target/i386: Fix CR2 handling for non-canonical addresses
2025-07-21 10:17 ` Mathias Krause
@ 2025-10-10 6:23 ` Mathias Krause
2025-10-10 7:32 ` Michael Tokarev
0 siblings, 1 reply; 5+ messages in thread
From: Mathias Krause @ 2025-10-10 6:23 UTC (permalink / raw)
To: Paolo Bonzini, Richard Henderson; +Cc: Eduardo Habkost, qemu-devel
On 7/21/25 12:17, Mathias Krause wrote:
> On 12.06.25 16:21, Mathias Krause wrote:
>> Commit 3563362ddfae ("target/i386: Introduce structures for mmu_translate")
>> accidentally modified CR2 for non-canonical address exceptions while these
>> should lead to a #GP / #SS instead -- without changing CR2.
>>
>> Fix that.
>>
>> A KUT test for this was submitted as [1].
>>
>> [1] https://lore.kernel.org/kvm/20250612141637.131314-1-minipli@grsecurity.net/
>>
>> Fixes: 3563362ddfae ("target/i386: Introduce structures for mmu_translate")
>> Signed-off-by: Mathias Krause <minipli@grsecurity.net>
>> ---
>
> Ping!
>
> Paolo, Richard, any take on the patch? It's a regression fix that can
> easily be verified with the KUT test failing after the commit mentioned
> in the Fixes tag and succeeding again with the below fix applied.
Ping, once more...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] target/i386: Fix CR2 handling for non-canonical addresses
2025-10-10 6:23 ` Mathias Krause
@ 2025-10-10 7:32 ` Michael Tokarev
0 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2025-10-10 7:32 UTC (permalink / raw)
To: Mathias Krause, Paolo Bonzini, Richard Henderson
Cc: Eduardo Habkost, qemu-devel, qemu-stable
On 10/10/25 09:23, Mathias Krause wrote:
> On 7/21/25 12:17, Mathias Krause wrote:
>> On 12.06.25 16:21, Mathias Krause wrote:
>>> Commit 3563362ddfae ("target/i386: Introduce structures for mmu_translate")
>>> accidentally modified CR2 for non-canonical address exceptions while these
>>> should lead to a #GP / #SS instead -- without changing CR2.
>>>
>>> Fix that.
>>>
>>> A KUT test for this was submitted as [1].
>>>
>>> [1] https://lore.kernel.org/kvm/20250612141637.131314-1-minipli@grsecurity.net/
>>>
>>> Fixes: 3563362ddfae ("target/i386: Introduce structures for mmu_translate")
>>> Signed-off-by: Mathias Krause <minipli@grsecurity.net>
That feels like it should go to qemu-stable as well (for all active
stable qemu releases) (Cc'ing).
/mjt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] target/i386: Fix CR2 handling for non-canonical addresses
2025-06-12 14:21 [PATCH] target/i386: Fix CR2 handling for non-canonical addresses Mathias Krause
2025-07-21 10:17 ` Mathias Krause
@ 2025-10-11 6:59 ` Paolo Bonzini
1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2025-10-11 6:59 UTC (permalink / raw)
To: Mathias Krause; +Cc: Richard Henderson, Eduardo Habkost, qemu-devel
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-11 7:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 14:21 [PATCH] target/i386: Fix CR2 handling for non-canonical addresses Mathias Krause
2025-07-21 10:17 ` Mathias Krause
2025-10-10 6:23 ` Mathias Krause
2025-10-10 7:32 ` Michael Tokarev
2025-10-11 6:59 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).