Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1314864
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 26/33] x86/kvm: Add stack frame dependency to test_cc() inline asm |
| Date | 2016-01-22 11:10 +0100 |
| Message-ID | <qTGPg-2B3-5@gated-at.bofh.it> (permalink) |
| References | <qTwmS-3nT-7@gated-at.bofh.it> <qTwmV-3nT-77@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 21/01/2016 23:49, Josh Poimboeuf wrote:
> With some configs, gcc doesn't inline test_cc(). When that happens, it
> doesn't create a stack frame before inserting the call instruction.
> This breaks frame pointer convention if CONFIG_FRAME_POINTER is enabled
> and can result in a bad stack trace.
>
> Force a stack frame to be created if CONFIG_FRAME_POINTER is enabled by
> listing the stack pointer as an output operand for the inline asm
> statement.
If an __always_inline allocation works, that would be better.
Paolo
> 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 | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index aa4d726..7dba65a 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -972,11 +972,13 @@ static int em_bsr_c(struct x86_emulate_ctxt *ctxt)
> static u8 test_cc(unsigned int condition, unsigned long flags)
> {
> u8 rc;
> + register void *__sp asm(_ASM_SP);
> void (*fop)(void) = (void *)em_setcc + 4 * (condition & 0xf);
>
> flags = (flags & EFLAGS_MASK) | X86_EFLAGS_IF;
> asm("push %[flags]; popf; call *%[fastop]"
> - : "=a"(rc) : [fastop]"r"(fop), [flags]"r"(flags));
> + : "=a"(rc), "+r"(__sp)
> + : [fastop]"r"(fop), [flags]"r"(flags));
> return rc;
> }
>
>
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