Re: [PATCH 00/16] Entry stuff, in decent shape now

From: Ingo Molnar
Date: Tue Nov 21 2017 - 02:33:28 EST



* Andy Lutomirski <luto@xxxxxxxxxx> wrote:

> This sets up stack switching, including for SYSCALL. I think it's
> in decent shape.
>
> Known issues:
> - KASAN is likely to be busted. This could be fixed either by teaching
> KASAN that cpu_entry_area contains valid stacks (I have no clue how
> to go about doing this) or by rigging up the IST entry code to switch
> RSP to point to the direct-mapped copy of the stacks before calling
> into non-KASAN-excluded C code.
>
> - 32-bit kernels are failing the sigreturn_32 test. But they're also
> failing without the patches, so I'm not sure this is a bug in the
> series per se. Needs further investigation. (Off the top of my head,
> this could be further fallout from Thomas's IDT rework.)
>
> - I think we're going to want a way to turn the stack switching on and
> off either at boot time or at runtime. It should be fairly straightforward
> to make it work.
>
> - I think the ORC unwinder isn't so good at dealing with stack overflows.
> It bails too early (I think), resulting in lots of ? entries. This
> isn't a regression with this series -- it's just something that could
> be improved.

Another problem I just found: IRQ tracing appears busted on 64-bit kernels - with
lockdep enabled I get this boot warning:

[ 4.309026] WARNING: CPU: 10 PID: 222 at kernel/locking/lockdep.c:3924 check_flags.part.45+0x1a5/0x1b0
...
[ 4.309026] possible reason: unannotated irqs-off.

That's on a x86-64 defconfig-ish kernel with CONFIG_PROVE_LOCKING=y, running on an
AMD system. Full splat below.

Thanks,

Ingo

[ 4.272197] LVT offset 0 assigned for vector 0x400
[ 4.278486] perf: AMD IBS detected (0x000000ff)
[ 4.284786] kvm: Nested Virtualization enabled
[ 4.289447] kvm: Nested Paging enabled
[ 4.308496] DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)
[ 4.308512] ------------[ cut here ]------------
[ 4.309026] WARNING: CPU: 10 PID: 222 at kernel/locking/lockdep.c:3924 check_flags.part.45+0x1a5/0x1b0
[ 4.309026] Modules linked in:
[ 4.309026] CPU: 10 PID: 222 Comm: modprobe Not tainted 4.14.0-01345-g9490674-dirty #1
[ 4.309026] Hardware name: Supermicro H8DG6/H8DGi/H8DG6/H8DGi, BIOS 2.0b 03/01/2012
[ 4.309026] task: ffff880814b08000 task.stack: ffffc90007dcc000
[ 4.309026] RIP: 0010:check_flags.part.45+0x1a5/0x1b0
[ 4.309026] RSP: 0018:ffffc90007dcfeb0 EFLAGS: 00010082
[ 4.309026] RAX: 000000000000002e RBX: ffff880814b08000 RCX: 0000000000000000
[ 4.309026] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffffffff81152e76
[ 4.309026] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
[ 4.309026] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 4.309026] R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000000
[ 4.309026] FS: 0000000000000000(0000) GS:ffff880817c80000(0000) knlGS:0000000000000000
[ 4.309026] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4.309026] CR2: 00007f8badc39218 CR3: 000000081584b000 CR4: 00000000000406e0
[ 4.309026] Call Trace:
[ 4.309026] lock_acquire+0x11a/0x1d0
[ 4.309026] vtime_user_exit+0x3c/0xa0
[ 4.309026] ? __context_tracking_exit.part.4+0x45/0x130
[ 4.309026] __context_tracking_exit.part.4+0x45/0x130
[ 4.309026] do_syscall_64+0x13f/0x220
[ 4.309026] entry_SYSCALL64_slow_path+0x25/0x25
[ 4.309026] RIP: 0033:0x7f8bada2e42a
[ 4.309026] RSP: 002b:00007fffba194e38 EFLAGS: 00000246 ORIG_RAX: 000000000000000c
[ 4.309026] RAX: ffffffffffffffda RBX: 0000000000400040 RCX: 00007f8bada2e42a
[ 4.309026] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 4.309026] RBP: 0000000000000009 R08: 000000000000037f R09: 0000000000000064
[ 4.309026] R10: 00000000178bfbff R11: 0000000000000246 R12: 00007f8bada19ce0
[ 4.309026] R13: 0000000000000000 R14: 0000000000403308 R15: 0000000000001000
[ 4.309026] Code: c6 9c f6 ed 81 48 c7 c7 e2 88 ed 81 e8 a0 32 01 00 0f ff e9 ef fe ff ff 48 c7 c6 9d f6 ed 81 48 c7 c7 e2 88 ed 81 e8 86 32 01 00 <0f> ff e9 5f ff ff ff 0f 1f 40 00 41 57 41 56 41 55 41 54 55 53
[ 4.309026] ---[ end trace bdfbcef9b01b1cbb ]---
[ 4.309026] possible reason: unannotated irqs-off.
[ 4.309026] irq event stamp: 445
[ 4.309026] hardirqs last enabled at (445): [<ffffffff81a4ae23>] swapgs_restore_regs_and_return_to_usermode+0x0/0x3c
[ 4.309026] hardirqs last disabled at (444): [<ffffffff81a4bac6>] error_exit+0x6/0x20
[ 4.309026] softirqs last enabled at (24): [<ffffffff81a4e6f7>] __do_softirq+0x3b7/0x468
[ 4.309026] softirqs last disabled at (7): [<ffffffff810ebec4>] irq_exit+0xc4/0xd0
[ 4.572172] audit: initializing netlink subsys (disabled)
[ 4.577846] audit: type=2000 audit(1511245386.576:1): state=initialized audit_enabled=0 res=1
[ 4.578742] workingset: timestamp_bits=53 max_order=24 bucket_order=0
[ 4.582656] SELinux: Registering netfilter hooks
[ 4.606349] NET: Registered protocol family 38