• Josh Poimboeuf's avatar
    Revert "x86/entry: Fix the end of the stack for newly forked tasks" · ebd57499
    Josh Poimboeuf authored
    Petr Mladek reported the following warning when loading the livepatch
    sample module:
    
      WARNING: CPU: 1 PID: 3699 at arch/x86/kernel/stacktrace.c:132 save_stack_trace_tsk_reliable+0x133/0x1a0
      ...
      Call Trace:
       __schedule+0x273/0x820
       schedule+0x36/0x80
       kthreadd+0x305/0x310
       ? kthread_create_on_cpu+0x80/0x80
       ? icmp_echo.part.32+0x50/0x50
       ret_from_fork+0x2c/0x40
    
    That warning means the end of the stack is no longer recognized as such
    for newly forked tasks.  The problem was introduced with the following
    commit:
    
      ff3f7e24 ("x86/entry: Fix the end of the stack for newly forked tasks")
    
    ... which was completely misguided.  It only partially fixed the
    reported issue, and it introduced another bug in the process.  None of
    the other entry code saves the frame pointer before calling into C code,
    so it doesn't make sense for ret_from_fork to do so either.
    
    Contrary to what I originally thought, the original issue wasn't related
    to newly forked tasks.  It was actually related to ftrace.  When entry
    code calls into a function which then calls into an ftrace handler, the
    stack frame looks different than normal.
    
    The original issue will be fixed in the unwinder, in a subsequent patch.
    Reported-by: default avatarPetr Mladek <pmladek@suse.com>
    Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
    Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: Dave Jones <davej@codemonkey.org.uk>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: live-patching@vger.kernel.org
    Fixes: ff3f7e24 ("x86/entry: Fix the end of the stack for newly forked tasks")
    Link: http://lkml.kernel.org/r/f350760f7e82f0750c8d1dd093456eb212751caa.1495553739.git.jpoimboe@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    ebd57499
entry_64.S 42.4 KB