Commit 4fc0f0e9 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

x86/uaccess, xen: Suppress SMAP warnings

drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled

Some Xen hypercalls allow parameter buffers in user land, so they need
to set AC=1. Avoid the warning for those cases.
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: andrew.cooper3@citrix.com
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent ff05ab23
...@@ -214,6 +214,22 @@ xen_single_call(unsigned int call, ...@@ -214,6 +214,22 @@ xen_single_call(unsigned int call,
return (long)__res; return (long)__res;
} }
static __always_inline void __xen_stac(void)
{
/*
* Suppress objtool seeing the STAC/CLAC and getting confused about it
* calling random code with AC=1.
*/
asm volatile(ANNOTATE_IGNORE_ALTERNATIVE
ASM_STAC ::: "memory", "flags");
}
static __always_inline void __xen_clac(void)
{
asm volatile(ANNOTATE_IGNORE_ALTERNATIVE
ASM_CLAC ::: "memory", "flags");
}
static inline long static inline long
privcmd_call(unsigned int call, privcmd_call(unsigned int call,
unsigned long a1, unsigned long a2, unsigned long a1, unsigned long a2,
...@@ -222,9 +238,9 @@ privcmd_call(unsigned int call, ...@@ -222,9 +238,9 @@ privcmd_call(unsigned int call,
{ {
long res; long res;
stac(); __xen_stac();
res = xen_single_call(call, a1, a2, a3, a4, a5); res = xen_single_call(call, a1, a2, a3, a4, a5);
clac(); __xen_clac();
return res; return res;
} }
...@@ -421,9 +437,9 @@ HYPERVISOR_dm_op( ...@@ -421,9 +437,9 @@ HYPERVISOR_dm_op(
domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs) domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
{ {
int ret; int ret;
stac(); __xen_stac();
ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs); ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs);
clac(); __xen_clac();
return ret; return ret;
} }
......
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