Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1314863
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 25/33] x86/kvm: Set ELF function type for fastop functions |
| Date | 2016-01-22 11:10 +0100 |
| Message-ID | <qTGPf-2B3-3@gated-at.bofh.it> (permalink) |
| References | <qTwmS-3nT-7@gated-at.bofh.it> <qTwmU-3nT-51@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 21/01/2016 23:49, Josh Poimboeuf wrote:
> The callable functions created with the FOP* and FASTOP* macros are
> missing ELF function annotations, which confuses tools like stacktool.
> Properly annotate them.
>
> This adds some additional labels to the assembly, but the generated
> binary code is unchanged (with the exception of instructions which have
> embedded references to __LINE__).
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Gleb Natapov <gleb@kernel.org>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: kvm@vger.kernel.org
> ---
> arch/x86/kvm/emulate.c | 29 +++++++++++++++++++++--------
> 1 file changed, 21 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 1505587..aa4d726 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -309,23 +309,29 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
>
> static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
>
> -#define FOP_ALIGN ".align " __stringify(FASTOP_SIZE) " \n\t"
> +#define FOP_FUNC(name) \
> + ".align " __stringify(FASTOP_SIZE) " \n\t" \
> + ".type " name ", @function \n\t" \
> + name ":\n\t"
> +
> #define FOP_RET "ret \n\t"
>
> #define FOP_START(op) \
> extern void em_##op(struct fastop *fake); \
> asm(".pushsection .text, \"ax\" \n\t" \
> ".global em_" #op " \n\t" \
> - FOP_ALIGN \
> - "em_" #op ": \n\t"
> + FOP_FUNC("em_" #op)
>
> #define FOP_END \
> ".popsection")
>
> -#define FOPNOP() FOP_ALIGN FOP_RET
> +#define FOPNOP() \
> + FOP_FUNC(__stringify(__UNIQUE_ID(nop))) \
> + FOP_RET
>
> #define FOP1E(op, dst) \
> - FOP_ALIGN "10: " #op " %" #dst " \n\t" FOP_RET
> + FOP_FUNC(#op "_" #dst) \
> + "10: " #op " %" #dst " \n\t" FOP_RET
>
> #define FOP1EEX(op, dst) \
> FOP1E(op, dst) _ASM_EXTABLE(10b, kvm_fastop_exception)
> @@ -357,7 +363,8 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
> FOP_END
>
> #define FOP2E(op, dst, src) \
> - FOP_ALIGN #op " %" #src ", %" #dst " \n\t" FOP_RET
> + FOP_FUNC(#op "_" #dst "_" #src) \
> + #op " %" #src ", %" #dst " \n\t" FOP_RET
>
> #define FASTOP2(op) \
> FOP_START(op) \
> @@ -395,7 +402,8 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
> FOP_END
>
> #define FOP3E(op, dst, src, src2) \
> - FOP_ALIGN #op " %" #src2 ", %" #src ", %" #dst " \n\t" FOP_RET
> + FOP_FUNC(#op "_" #dst "_" #src "_" #src2) \
> + #op " %" #src2 ", %" #src ", %" #dst " \n\t" FOP_RET
>
> /* 3-operand, word-only, src2=cl */
> #define FASTOP3WCL(op) \
> @@ -407,7 +415,12 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
> FOP_END
>
> /* Special case for SETcc - 1 instruction per cc */
> -#define FOP_SETCC(op) ".align 4; " #op " %al; ret \n\t"
> +#define FOP_SETCC(op) \
> + ".align 4 \n\t" \
> + ".type " #op ", @function \n\t" \
> + #op ": \n\t" \
> + #op " %al \n\t" \
> + FOP_RET
>
> asm(".global kvm_fastop_exception \n"
> "kvm_fastop_exception: xor %esi, %esi; ret");
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/33] Compile-time stack metadata validation Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 25/33] x86/kvm: Set ELF function type for fastop functions Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
Re: [PATCH 25/33] x86/kvm: Set ELF function type for fastop functions Paolo Bonzini <pbonzini@redhat.com> - 2016-01-22 11:10 +0100
[PATCH 21/33] x86/uaccess: Add stack frame output operand in get_user inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 20/33] x86/asm/power: Create stack frames in hibernate_asm_64.S Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 12/33] x86/asm/crypto: Move jump_table to .rodata section Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 18/33] x86/asm: Create stack frames in rwsem functions Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 32/33] sched: Add __schedule() to stacktool whitelist Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 27/33] watchdog/hpwdt: Create stack frame in asminline_call() Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 11/33] x86/asm/crypto: Move .Lbswap_mask data to .rodata section Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 29/33] x86/stacktool: Add directory and file whitelists Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 26/33] x86/kvm: Add stack frame dependency to test_cc() inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
Re: [PATCH 26/33] x86/kvm: Add stack frame dependency to test_cc() inline asm Paolo Bonzini <pbonzini@redhat.com> - 2016-01-22 11:10 +0100
Re: [PATCH 26/33] x86/kvm: Add stack frame dependency to test_cc() inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 17:10 +0100
[PATCH v16.1 26/33] x86/kvm: Make test_cc() always inline Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 17:20 +0100
[PATCH 28/33] x86/locking: Create stack frame in PV unlock Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 22/33] x86/asm/bpf: Annotate callable functions Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:00 +0100
[PATCH 07/33] x86/asm/xen: Create stack frames in xen-asm.S Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:10 +0100
[PATCH 13/33] x86/asm/crypto: Simplify stack usage in sha-mb functions Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:10 +0100
[PATCH 02/33] kbuild/stacktool: Add CONFIG_STACK_VALIDATION option Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:10 +0100
[PATCH 04/33] x86/stacktool: Add STACKTOOL_IGNORE_FUNC macro Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:10 +0100
[PATCH 14/33] x86/asm/crypto: Don't use rbp as a scratch register Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:10 +0100
[PATCH 05/33] x86/xen: Add stack frame dependency to hypercall inline asm calls Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:10 +0100
[PATCH 06/33] x86/asm/xen: Set ELF function type for xen_adjust_exception_frame() Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 00:10 +0100
Re: [PATCH 00/33] Compile-time stack metadata validation Chris J Arges <chris.j.arges@canonical.com> - 2016-01-22 18:50 +0100
Re: [PATCH 00/33] Compile-time stack metadata validation Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 20:20 +0100
Re: [PATCH 00/33] Compile-time stack metadata validation Chris J Arges <chris.j.arges@canonical.com> - 2016-01-22 21:50 +0100
Re: [PATCH 00/33] Compile-time stack metadata validation Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-22 21:50 +0100
[PATCH 0/2] A few stacktool warning fixes. Chris J Arges <chris.j.arges@canonical.com> - 2016-01-22 22:50 +0100
[PATCH 1/2] tools/stacktool: Add __reiserfs_panic to global_noreturns list Chris J Arges <chris.j.arges@canonical.com> - 2016-01-22 22:50 +0100
Re: [PATCH 1/2] tools/stacktool: Add __reiserfs_panic to global_noreturns list Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-25 16:10 +0100
[PATCH 2/2] x86/kvm: Add output operand in vmx_handle_external_intr inline asm Chris J Arges <chris.j.arges@canonical.com> - 2016-01-22 22:50 +0100
Re: [PATCH 2/2] x86/kvm: Add output operand in vmx_handle_external_intr inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2016-01-25 16:10 +0100
csiph-web