linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Alex Thorlton <athorlton@sgi.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Borislav Petkov <bp@alien8.de>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Denys Vlasenko <dvlasenk@redhat.com>
Subject: Re: [GIT PULL] EFI fix
Date: Tue, 17 May 2016 12:20:49 +0200	[thread overview]
Message-ID: <20160517102049.GB26924@gmail.com> (raw)
In-Reply-To: <20160517094655.GB21993@codeblueprint.co.uk>


* Matt Fleming <matt@codeblueprint.co.uk> wrote:

> On Tue, 17 May, at 10:04:34AM, Matt Fleming wrote:
> > 
> > Now I'm wondering whether other users of FRAME_BEGIN/FRAME_END make
> > this same mistake. Coccinelle might be able to detect it perhaps.
> 
> A quick bit of sed turned up the code in arch/x86/entry/entry_64.S,
> which looks to suffer from the same bug,

That would be arch/x86/entry/thunk_64.S, but yeah, good find!

>         /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
>         .macro THUNK name, func, put_ret_addr_in_rdi=0
>         .globl \name
>         .type \name, @function
> \name:
>         FRAME_BEGIN
> 
>         /* this one pushes 9 elems, the next one would be %rIP */
>         pushq %rdi
>         pushq %rsi
>         pushq %rdx
>         pushq %rcx
>         pushq %rax
>         pushq %r8
>         pushq %r9
>         pushq %r10
>         pushq %r11
> 
>         .if \put_ret_addr_in_rdi
>         /* 9*8(%rsp) is return addr on stack */
>         movq 9*8(%rsp), %rdi
>         .endif
> 
> With CONFIG_FRAME_POINTER=y 9*8(%rsp) is actually the value of %rbp on
> entry, not the return address.

This seems to affect:

#ifdef CONFIG_TRACE_IRQFLAGS
        THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
        THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
#endif

and with TRACE_IRQFLAGS we already in most times force frame pointers, such as 
when LOCKDEP is enabled:

  config LOCKDEP
        bool
        depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
  ...
        select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE

Also, unlike the efi_call() case, this thunk_64.S bug affects the quality of 
debug/tracing information, not runtime correctness per se.

still all that is by accident, not by design - this bug should be fixed too.

Thanks,

	Ingo

  reply	other threads:[~2016-05-17 10:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 14:46 [GIT PULL] EFI fix Ingo Molnar
2016-05-16 20:05 ` Linus Torvalds
2016-05-16 20:23   ` Alex Thorlton
2016-05-16 22:40     ` Alex Thorlton
2016-05-17  6:30   ` [tip:x86/urgent] x86/efi: Fix 7-parameter efi_call()s tip-bot for Linus Torvalds
2016-05-17  9:04   ` [GIT PULL] EFI fix Matt Fleming
2016-05-17  9:46     ` Matt Fleming
2016-05-17 10:20       ` Ingo Molnar [this message]
2016-05-17 14:43         ` [PATCH] x86/asm/entry: fix stack return address retrieval in thunk Josh Poimboeuf
2016-05-17 16:31           ` Linus Torvalds
2016-05-17 16:51             ` Steven Rostedt
2016-05-17 17:21               ` Linus Torvalds
2016-05-17 17:25               ` Josh Poimboeuf
2016-05-17 18:06             ` [PATCH v2] " Josh Poimboeuf
2016-05-17 18:33               ` Linus Torvalds
2016-05-19  9:12               ` [tip:x86/urgent] x86/entry/64: Fix " tip-bot for Josh Poimboeuf
2016-05-23 12:08   ` [GIT PULL] EFI fix Matt Fleming
2016-05-23 12:33     ` Josh Poimboeuf
2016-05-24  9:03       ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2019-05-18  9:17 Ingo Molnar
2019-05-19 17:45 ` pr-tracker-bot
2019-01-11  7:46 Ingo Molnar
2019-01-11 14:22 ` Ard Biesheuvel
2019-01-11 17:55   ` Linus Torvalds
2019-01-12  8:53     ` Ingo Molnar
2019-01-11 17:47 ` Linus Torvalds
2019-01-12  8:54   ` Ingo Molnar
2018-11-30  6:21 Ingo Molnar
2018-11-30 21:00 ` pr-tracker-bot
2018-07-30 17:44 Ingo Molnar
2018-07-13 19:57 Ingo Molnar
2017-06-10  8:31 Ingo Molnar
2016-04-28 17:48 Ingo Molnar
2016-04-16  9:08 Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160517102049.GB26924@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=athorlton@sgi.com \
    --cc=bp@alien8.de \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).