Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314863

Re: [PATCH 25/33] x86/kvm: Set ELF function type for fastop functions

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 25/33] x86/kvm: Set ELF function type for fastop functions
Date Fri, 22 Jan 2016 11:10:01 +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>
X-Original-To Josh Poimboeuf <jpoimboe@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=j98vKXyEEki3i6tbMyEMNqD1N03LXnepLhh39BrEm6Y=; b=YXepLJwqUGaXBPFnClx3btCSAU8Q+3VEzEHn+T7Yc4okKXH4kgGCsDfEH1MECIkE81 Y1h6oUJrZH3Nzzz+6plotr3H9JBRybAEKypIPYwFm2a9EMOu9gRYu8UA6BYN08gDYmaY vD3CgwYI5s+yE+dQx7k3kId1vxP0eC2ay5ssPhqPx/EaIhJzmzKiDKqXFp6WHtVghfnR alExrNhtYsWb+lzi1xIVJGh3kHpjPaoug5ctdAlbO0E9F8qAWEZn5QPnUh6Q5MFXsWTX Oa+T4F7DkFSArsOxJcBPTziuzNJSLQC1DQlNOrmTi7+gUoUadQDP+oHa7fCFqjASxhyK 50sQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=j98vKXyEEki3i6tbMyEMNqD1N03LXnepLhh39BrEm6Y=; b=XMhqIN5eBaRRiJMKd91xAAd2x9aLnVcDa8iq5Tek9DVYytBq6PQCNGj3HHT+qkTRZA mEgZJLJq9938clOPgWBkrdjq3K1kXYxLcPHiZQBHTX4ax2fDrIgFJFBg+U9KXTP+rsM5 Nufq4EHNXmCblit+9Rfgtg9Dp8k+pGhIl4pUDhb0hmkKAMXuq1DpGfcXAm757n1jjdVY R3Jwxf4iFYyl2jBHYEHt76Z1F9qDIMY1DLUglnf6Qv2CjvDEN7h8YwvxqjFyOfUBB3cv tzzpKkBb5kAt4G/LavHfTAv2zb5VF8fulRzl0/Ts4vE+uUyNJp+diUpCRpBE3B/CXdWF PPUw==
X-Gm-Message-State AG10YOQ0r65ktyzwnGaizZJiyve6EjSGzW6ixHxroCeOmqFXH6LeXb0n3l9Ph7d4AAIvIg==
X-Received by 10.194.115.164 with SMTP id jp4mr2267672wjb.26.1453457133397; Fri, 22 Jan 2016 02:05:33 -0800 (PST)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 95
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Michal Marek <mmarek@suse.cz>, Peter Zijlstra <peterz@infradead.org>, Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>, Linus Torvalds <torvalds@linux-foundation.org>, Andi Kleen <andi@firstfloor.org>, Pedro Alves <palves@redhat.com>, Namhyung Kim <namhyung@gmail.com>, Bernd Petrovitsch <bernd@petrovitsch.priv.at>, Chris J Arges <chris.j.arges@canonical.com>, Andrew Morton <akpm@linux-foundation.org>, Jiri Slaby <jslaby@suse.cz>, Arnaldo Carvalho de Melo <acme@kernel.org>, Gleb Natapov <gleb@kernel.org>, kvm@vger.kernel.org
X-Original-Date Fri, 22 Jan 2016 11:05:22 +0100
X-Original-Message-ID <56A1FEE2.3020605@redhat.com>
X-Original-References <cover.1453405861.git.jpoimboe@redhat.com> <e399651c89ace54906c203c0557f66ed6ea3ce8d.1453405861.git.jpoimboe@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1314863

Show key headers only | View raw



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


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