mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [WARNING] livepatch/x86: Invalid return address when checking a stack of the schedule stuff
@ 2017-05-22 11:50 Petr Mladek
  2017-05-22 14:04 ` Josh Poimboeuf
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Mladek @ 2017-05-22 11:50 UTC (permalink / raw)
  To: Josh Poimboeuf, Jiri Slaby, Miroslav Benes
  Cc: Ingo Molnar, Andy Lutomirski, live-patching, linux-kernel, x86

Hi,

I have just tried to apply the livepatch-sample module using
the consistency model in current Linus' tree (4.12-rc2) and
got the following warning from the stack checker code:

[   28.580616] livepatch_sample: tainting kernel with TAINT_LIVEPATCH
[   28.581572] livepatch_sample: module verification failed: signature and/or required key missing - tainting kernel
[   28.589943] livepatch: enabling patch 'livepatch_sample'
[   28.592146] livepatch: 'livepatch_sample': patching...
[   28.592643] ------------[ cut here ]------------
[   28.593069] WARNING: CPU: 1 PID: 3699 at arch/x86/kernel/stacktrace.c:132 save_stack_trace_tsk_reliable+0x133/0x1a0
[   28.594006] Modules linked in: livepatch_sample(EK+)
[   28.594452] CPU: 1 PID: 3699 Comm: modprobe Tainted: G            E K 4.12.0-rc2-52.49-default #3975
[   28.595267] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[   28.595786] task: ffff8801378ad080 task.stack: ffffc90000c7c000
[   28.596009] RIP: 0010:save_stack_trace_tsk_reliable+0x133/0x1a0
[   28.596009] RSP: 0018:ffffc90000c7faf0 EFLAGS: 00010046
[   28.596009] RAX: 0000000000000000 RBX: ffffc90000c7fb90 RCX: 000000000000014f
[   28.596009] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[   28.596009] RBP: ffffc90000c7fb60 R08: ffffc90000633f40 R09: 0000000000000000
[   28.596009] R10: 0000000000000005 R11: 0000000000000001 R12: ffff880138b9c080
[   28.596009] R13: ffff880138b9c080 R14: ffff88013dd9a700 R15: ffff880138b9c7d8
[   28.596009] FS:  00007fa9ae9b6700(0000) GS:ffff88013dc80000(0000) knlGS:0000000000000000
[   28.596009] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   28.596009] CR2: 000000000064a008 CR3: 0000000137cff000 CR4: 00000000000006e0
[   28.596009] Call Trace:
[   28.596009]  klp_try_switch_task+0x10b/0x2c0
[   28.596009]  ? set_kernel_text_ro+0x3c/0x40
[   28.596009]  ? vprintk_default+0x29/0x50
[   28.596009]  ? vprintk_func+0x20/0x50
[   28.596009]  ? printk+0x48/0x4a
[   28.596009]  klp_try_complete_transition+0x88/0x1c0
[   28.596009]  __klp_enable_patch+0xbb/0xf0
[   28.596009]  klp_enable_patch+0x53/0x80
[   28.596009]  livepatch_init+0x31/0x60 [livepatch_sample]
[   28.596009]  ? livepatch_cmdline_proc_show+0x30/0x30 [livepatch_sample]
[   28.596009]  do_one_initcall+0x42/0x180
[   28.596009]  ? __vunmap+0x85/0xc0
[   28.596009]  ? do_init_module+0x27/0x202
[   28.596009]  do_init_module+0x60/0x202
[   28.596009]  load_module+0x13a3/0x1ac0
[   28.596009]  ? m_show+0x190/0x190
[   28.596009]  SYSC_finit_module+0xa0/0xb0
[   28.596009]  SyS_finit_module+0xe/0x10
[   28.596009]  entry_SYSCALL_64_fastpath+0x1a/0xa5
[   28.596009] RIP: 0033:0x7fa9ae4e6789
[   28.596009] RSP: 002b:00007fff9a96bbd8 EFLAGS: 00000206 ORIG_RAX: 0000000000000139
[   28.596009] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa9ae4e6789
[   28.596009] RDX: 0000000000000000 RSI: 00000000004195f6 RDI: 0000000000000003
[   28.596009] RBP: 00007fff9a96aab0 R08: 0000000000000000 R09: 0000000000000000
[   28.596009] R10: 0000000000000003 R11: 0000000000000206 R12: 0000000000000000
[   28.596009] R13: 0000000000000026 R14: 0000000000000000 R15: 0000000000000000
[   28.596009] Code: c6 05 3e a2 c1 00 01 0f ff 31 f6 4c 89 e7 41 bd ea ff ff ff e8 8f 45 ff ff eb c0 80 3d 24 a2 c1 00 00 75 b1 c6 05 1b a2 c1 00 01 <0f> ff 4c 89 e7 e8 73 45 ff ff eb 9e 8b 03 45 31 ed 3b 43 04 73 
[   28.596009] ---[ end trace e67087ea4a13b96c ]---
[   28.596009] Call Trace:
[   28.596009]  __schedule+0x273/0x820
[   28.596009]  schedule+0x36/0x80
[   28.596009]  kthreadd+0x305/0x310
[   28.596009]  ? kthread_create_on_cpu+0x80/0x80
[   28.596009]  ? icmp_echo.part.32+0x50/0x50
[   28.596009]  ret_from_fork+0x2c/0x40


The test done on in qemu on x86_64. The problem is 100% reproducible.
Does it ring any bell, please?

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [WARNING] livepatch/x86: Invalid return address when checking a stack of the schedule stuff
  2017-05-22 11:50 [WARNING] livepatch/x86: Invalid return address when checking a stack of the schedule stuff Petr Mladek
@ 2017-05-22 14:04 ` Josh Poimboeuf
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Poimboeuf @ 2017-05-22 14:04 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Jiri Slaby, Miroslav Benes, Ingo Molnar, Andy Lutomirski,
	live-patching, linux-kernel, x86

On Mon, May 22, 2017 at 01:50:36PM +0200, Petr Mladek wrote:
> Hi,
> 
> I have just tried to apply the livepatch-sample module using
> the consistency model in current Linus' tree (4.12-rc2) and
> got the following warning from the stack checker code:
> 
> [   28.580616] livepatch_sample: tainting kernel with TAINT_LIVEPATCH
> [   28.581572] livepatch_sample: module verification failed: signature and/or required key missing - tainting kernel
> [   28.589943] livepatch: enabling patch 'livepatch_sample'
> [   28.592146] livepatch: 'livepatch_sample': patching...
> [   28.592643] ------------[ cut here ]------------
> [   28.593069] WARNING: CPU: 1 PID: 3699 at arch/x86/kernel/stacktrace.c:132 save_stack_trace_tsk_reliable+0x133/0x1a0

Thanks, I was able to recreate it too.  We should really add
livepatch-sample loading to the kernel selftests.

This seems to be caused by:

  ff3f7e2475bb ("x86/entry: Fix the end of the stack for newly forked tasks")

I'm not sure what I was smoking when I made that patch because now it
seems completely wrong.  Need to think about it a little more.

-- 
Josh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-22 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-22 11:50 [WARNING] livepatch/x86: Invalid return address when checking a stack of the schedule stuff Petr Mladek
2017-05-22 14:04 ` Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®