[PATCH] linux-user: main: Let each env have its own gdt table

chengang@emindsoft.com.cn posted 1 patch 4 years ago
Test docker-mingw@fedora failed
Test docker-quick@centos7 passed
Test checkpatch passed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200331081506.29037-1-chengang@emindsoft.com.cn
Maintainers: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>
linux-user/main.c | 5 +++++
1 file changed, 5 insertions(+)
[PATCH] linux-user: main: Let each env have its own gdt table
Posted by chengang@emindsoft.com.cn 4 years ago
From: Chen Gang <chengang@emindsoft.com.cn>

It is a temporary fix for thread LTS which need switch the ldt related
index in gdt table for stable-4.1 branch.

Welcome anyone providing the complete fix.

Signed-off-by: Chen Gang <chengang@emindsoft.com.cn>
---
 linux-user/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index 8ffc525195..cad261fc7b 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -194,12 +194,17 @@ CPUArchState *cpu_copy(CPUArchState *env)
     CPUArchState *new_env = new_cpu->env_ptr;
     CPUBreakpoint *bp;
     CPUWatchpoint *wp;
+    int size = sizeof(uint64_t) * TARGET_GDT_ENTRIES;
 
     /* Reset non arch specific state */
     cpu_reset(new_cpu);
 
     memcpy(new_env, env, sizeof(CPUArchState));
 
+    new_env->gdt.base = target_mmap(0, size, PROT_READ | PROT_WRITE,
+                                     MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+    memcpy(g2h(new_env->gdt.base), g2h(env->gdt.base), size);
+
     /* Clone all break/watchpoints.
        Note: Once we support ptrace with hw-debug register access, make sure
        BP_CPU break/watchpoints are handled correctly on clone. */
-- 
2.24.0.308.g228f53135a




Re: [PATCH] linux-user: main: Let each env have its own gdt table
Posted by no-reply@patchew.org 4 years ago
Patchew URL: https://patchew.org/QEMU/20200331081506.29037-1-chengang@emindsoft.com.cn/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

  GEN     /var/tmp/patchew-tester-tmp-3vo4s26o/src/docker-src.2020-03-31-07.20.41.28179/qemu.tar
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Cloning into 'dtc'...
error: RPC failed; result=7, HTTP code = 0
fatal: The remote end hung up unexpectedly
Clone of 'https://git.qemu.org/git/dtc.git' into submodule path 'dtc' failed
failed to update submodule dtc
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) unregistered for path 'dtc'
make[1]: *** [/var/tmp/patchew-tester-tmp-3vo4s26o/src/docker-src.2020-03-31-07.20.41.28179] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-3vo4s26o/src'
make: *** [docker-run-test-mingw@fedora] Error 2

real    2m13.209s
user    0m2.324s


The full log is available at
http://patchew.org/logs/20200331081506.29037-1-chengang@emindsoft.com.cn/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com