Commit 901f5d48 authored by Jeff Law's avatar Jeff Law Committed by Andrei Vagin

Fix gcc9 build failures

I received this patch from Jeff Law as a fix for build failures with the
upcoming GCC 9. The following is Jeff Law's description of the patch:

 Attached you'll find the fix for criu.  You'll see it's just a matter
 of dropping the sp/esp clobber from the relevant asm statements.  THe
 details:

 criu has a macro which defines an asm which appears to want to set a new
 stack pointer, then directly issue a sigreturn call to the kernel.  Some
 variants clobber sp (aarch64, arm, x86), others do not (ppc, s390)

 While the asm does indeed set a new stack pointer, we never return from
 a sigreturn syscall -- at least not in the normal way.  We actually
 return back to the point where the process was interrupted by the
 signal.  So describing the affect of the asm on the stack pointer is
 pedantically correct, it actually has no real effect and can just be
 dropped to avoid the hard error from gcc-9.
Suggested-by: 's avatarJeff Law <law@redhat.com>
Reviewed-by: 's avatarDmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent 7fd39f96
......@@ -39,7 +39,7 @@ struct rt_sigframe {
"svc #0 \n" \
: \
: "r"(new_sp) \
: "sp", "x8", "memory")
: "x8", "memory")
/* cr_sigcontext is copied from arch/arm64/include/uapi/asm/sigcontext.h */
struct cr_sigcontext {
......
......@@ -73,7 +73,7 @@ struct rt_sigframe {
"svc #0 \n" \
: \
: "r"(new_sp) \
: "sp","memory")
: "memory")
#define RT_SIGFRAME_UC(rt_sigframe) (&rt_sigframe->sig.uc)
#define RT_SIGFRAME_REGIP(rt_sigframe) (rt_sigframe)->sig.uc.uc_mcontext.arm_ip
......
......@@ -162,7 +162,7 @@ struct rt_sigframe {
"syscall \n" \
: \
: "r"(new_sp) \
: "rax","rsp","memory")
: "rax","memory")
#define ARCH_RT_SIGRETURN_COMPAT(new_sp) \
asm volatile( \
"pushq $"__stringify(USER32_CS)" \n" \
......@@ -176,7 +176,7 @@ struct rt_sigframe {
".code64 \n" \
: \
: "rdi"(new_sp) \
: "eax","esp", "r8", "r9", "r10", "r11", "memory")
: "eax", "r8", "r9", "r10", "r11", "memory")
#define ARCH_RT_SIGRETURN(new_sp, rt_sigframe) \
do { \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment