lkml.org 
[lkml]   [2019]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
    drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled

    Xen needs to do HV calls with AC=1 for hysterical raisins. Make the
    warning go away.

    XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
    ANNOTATE_IGNORE_ALTERNATIVE.

    Cc: andrew.cooper3@citrix.com
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    ---
    arch/x86/include/asm/xen/hypercall.h | 26 ++++++++++++++++++++++----
    1 file changed, 22 insertions(+), 4 deletions(-)

    --- a/arch/x86/include/asm/xen/hypercall.h
    +++ b/arch/x86/include/asm/xen/hypercall.h
    @@ -214,6 +214,24 @@ xen_single_call(unsigned int call,
    return (long)__res;
    }

    +static __always_inline void __xen_stac(void)
    +{
    + /*
    + * This is just about as horrible as this interface; we abuse the
    + * nospec alternative annotation to supress objtool seeing the
    + * STAC/CLAC and getting confused about it calling random code with
    + * AC=1.
    + */
    + asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
    + ASM_STAC ::: "memory", "flags");
    +}
    +
    +static __always_inline void __xen_clac(void)
    +{
    + asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
    + ASM_CLAC ::: "memory", "flags");
    +}
    +
    static inline long
    privcmd_call(unsigned int call,
    unsigned long a1, unsigned long a2,
    @@ -222,9 +240,9 @@ privcmd_call(unsigned int call,
    {
    long res;

    - stac();
    + __xen_stac();
    res = xen_single_call(call, a1, a2, a3, a4, a5);
    - clac();
    + __xen_clac();

    return res;
    }
    @@ -430,9 +448,9 @@ HYPERVISOR_dm_op(
    domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
    {
    int ret;
    - stac();
    + __xen_stac();
    ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs);
    - clac();
    + __xen_clac();
    return ret;
    }


    \
     
     \ /
      Last update: 2019-03-07 12:54    [W:4.748 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site