From 1ac83a6d95a5e3033cd95f7598ea68115caee501 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Thu, 15 Feb 2024 10:50:59 +0100 Subject: [PATCH] Add patch for docker/for-mac/issues/7172 Signed-off-by: David Gageot --- docker-bake.hcl | 2 +- .../0001-incorrect-alignment-pretcode.patch | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 patches/pretcode/0001-incorrect-alignment-pretcode.patch diff --git a/docker-bake.hcl b/docker-bake.hcl index 0b4a2100..f5da15a8 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -80,7 +80,7 @@ target "buildkit-test" { target "desktop" { inherits = ["mainline"] args = { - QEMU_PATCHES = "${QEMU_PATCHES},subreaper-prctl" + QEMU_PATCHES = "${QEMU_PATCHES},subreaper-prctl,pretcode" } cache-from = ["${REPO}:desktop-master"] } diff --git a/patches/pretcode/0001-incorrect-alignment-pretcode.patch b/patches/pretcode/0001-incorrect-alignment-pretcode.patch new file mode 100644 index 00000000..10a82176 --- /dev/null +++ b/patches/pretcode/0001-incorrect-alignment-pretcode.patch @@ -0,0 +1,51 @@ +From: fanwj +Subject: [PATCH] linux-user: fix incorrect alignment of pretcode +Date: Fri, 12 May 2023 23:38:34 +0800 (GMT+08:00) +sigframe::pretcode & rt_sigframe::pretcode must align of 16n-sizeof(void*) +instead of 16n, Because rsp align of 16n before instruction "call" in caller, +After "call", push address of "call" in caller. sp of begin in callee is +16n-sizeof(void*) + +Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1648 +Signed-off-by: Fan WenJie + +--- + linux-user/i386/signal.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c +index 60fa07d6f9c..1f019689ae7 100644 +--- a/linux-user/i386/signal.c ++++ b/linux-user/i386/signal.c +@@ -197,7 +197,8 @@ struct sigframe { + * to it ensures that the base of the frame has an appropriate alignment + * too. + */ +- struct target_fpstate fpstate QEMU_ALIGNED(8); ++ abi_ulong unused QEMU_ALIGNED(8); ++ struct target_fpstate fpstate; + }; + #define TARGET_SIGFRAME_FXSAVE_OFFSET ( \ + offsetof(struct sigframe, fpstate) + TARGET_FPSTATE_FXSAVE_OFFSET) +@@ -210,7 +211,8 @@ struct rt_sigframe { + struct target_siginfo info; + struct target_ucontext uc; + char retcode[8]; +- struct target_fpstate fpstate QEMU_ALIGNED(8); ++ abi_ulong unused QEMU_ALIGNED(8); ++ struct target_fpstate fpstate; + }; + #define TARGET_RT_SIGFRAME_FXSAVE_OFFSET ( \ + offsetof(struct rt_sigframe, fpstate) + TARGET_FPSTATE_FXSAVE_OFFSET) +@@ -220,7 +222,8 @@ struct rt_sigframe { + abi_ulong pretcode; + struct target_ucontext uc; + struct target_siginfo info; +- struct target_fpstate fpstate QEMU_ALIGNED(16); ++ abi_ulong unused QEMU_ALIGNED(16); ++ struct target_fpstate fpstate; + }; + #define TARGET_RT_SIGFRAME_FXSAVE_OFFSET ( \ + offsetof(struct rt_sigframe, fpstate) + TARGET_FPSTATE_FXSAVE_OFFSET) +-- +2.40.1