Skip to contentSkip to conversation

linux-user: fix broken cpu_copy()

PATCH In review Leon Alrae 3 participants 4 messages Mar 23, 2015

lore
Share & tools
lore

Leon Alrae

author
#0 lore raw

PATCH 1/1 linux-user: fix broken cpu_copy()

New threads always point at the same env which is incorrect and usually leads to a crash.

---
Hi,

This patch fixes the bug introduced in:

commit 2994fd96d986578a342f2342501b4ad30f6d0a85
Author: Eduardo Habkost <[email protected]>

cpu: Make cpu_init() return QOM CPUState object

Regards,
Leon

---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/main.c +1 -1
index 6e446de..04668e8 100644
@@ -3453,7 +3453,7 @@ CPUArchState *cpu_copy(CPUArchState *env)
 {
     CPUState *cpu = ENV_GET_CPU(env);
     CPUState *new_cpu = cpu_init(cpu_model);
-    CPUArchState *new_env = cpu->env_ptr;
+    CPUArchState *new_env = new_cpu->env_ptr;
     CPUBreakpoint *bp;
     CPUWatchpoint *wp;
 
Signature · 1 line
2.1.0
Reviewed-by on v1 1/1
#1 lore raw

Am 23.03.2015 um 13:55 schrieb Leon Alrae:

Quoted 25 lines

New threads always point at the same env which is incorrect and usually leads to a crash.

---
Hi,

This patch fixes the bug introduced in:

commit 2994fd96d986578a342f2342501b4ad30f6d0a85
Author: Eduardo Habkost <[email protected]>

cpu: Make cpu_init() return QOM CPUState object

Regards,
Leon

---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/main.c +0 -0
index 6e446de..04668e8 100644

linux-user/main.c CPUArchState *cpu_copy(CPUArchState *env) · line 3459

Quoted 8 lines
linux-user/main.c +1 -1
@@ -3453,7 +3453,7 @@ CPUArchState *cpu_copy(CPUArchState *env)
 {
     CPUState *cpu = ENV_GET_CPU(env);
     CPUState *new_cpu = cpu_init(cpu_model);
-    CPUArchState *new_env = cpu->env_ptr;
+    CPUArchState *new_env = new_cpu->env_ptr;
     CPUBreakpoint *bp;
     CPUWatchpoint *wp;
 

Clearly my fault and might explain some breakage in our OBS,

Riku, are you queuing this (-rc1 tomorrow!) or should I take it for a CPU pull?

Thanks,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#2 lore raw

Am 23.03.2015 um 14:02 schrieb Andreas Färber:

Quoted 2 lines

Am 23.03.2015 um 13:55 schrieb Leon Alrae:

Quoted 1 line

New threads always point at the same env which is incorrect and usually leads

Please remember to break after 76 chars. (Look at git log output.)

Andreas

Quoted 42 lines
Quoted 24 lines

to a crash.

---
Hi,

This patch fixes the bug introduced in:

commit 2994fd96d986578a342f2342501b4ad30f6d0a85
Author: Eduardo Habkost <[email protected]>

cpu: Make cpu_init() return QOM CPUState object

Regards,
Leon

---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/main.c +0 -0
index 6e446de..04668e8 100644

linux-user/main.c CPUArchState *cpu_copy(CPUArchState *env) · line 3459

Quoted 8 lines
linux-user/main.c +1 -1
@@ -3453,7 +3453,7 @@ CPUArchState *cpu_copy(CPUArchState *env)
 {
     CPUState *cpu = ENV_GET_CPU(env);
     CPUState *new_cpu = cpu_init(cpu_model);
-    CPUArchState *new_env = cpu->env_ptr;
+    CPUArchState *new_env = new_cpu->env_ptr;
     CPUBreakpoint *bp;
     CPUWatchpoint *wp;
 

Clearly my fault and might explain some breakage in our OBS,

Riku, are you queuing this (-rc1 tomorrow!) or should I take it for a CPU pull?

Thanks,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#3 lore raw
In reply to Andreas Färber
Quoted 8 lines · Andreas Färber

Am 23.03.2015 um 13:55 schrieb Leon Alrae:

Quoted 6 lines

New threads always point at the same env which is incorrect and usually leads to a crash.

---
Hi, ...

Quoted 6 lines

Clearly my fault and might explain some breakage in our OBS,

Riku, are you queuing this (-rc1 tomorrow!) or should I take it for a CPU pull?

I can add this, I only have two patches so far qued.

Riku