• Peter Zijlstra's avatar
    x86/kvm: Fix SETcc emulation for return thunks · af2e140f
    Peter Zijlstra authored
    Prepare the SETcc fastop stuff for when RET can be larger still.
    
    The tricky bit here is that the expressions should not only be
    constant C expressions, but also absolute GAS expressions. This means
    no ?: and 'true' is ~0.
    
    Also ensure em_setcc() has the same alignment as the actual FOP_SETCC()
    ops, this ensures there cannot be an alignment hole between em_setcc()
    and the first op.
    
    Additionally, add a .skip directive to the FOP_SETCC() macro to fill
    any remaining space with INT3 traps; however the primary purpose of
    this directive is to generate AS warnings when the remaining space
    goes negative. Which is a very good indication the alignment magic
    went side-ways.
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Reviewed-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    af2e140f
emulate.c 149 KB