Re: [PATCH 07/12] x86/entry/64: Always run ptregs-using syscalls on the slow path

From: Brian Gerst
Date: Wed Dec 09 2015 - 07:52:28 EST


On Wed, Dec 9, 2015 at 1:21 AM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> On Tue, Dec 8, 2015 at 9:45 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>> On Tue, Dec 8, 2015 at 8:43 PM, Brian Gerst <brgerst@xxxxxxxxx> wrote:
>>> On Mon, Dec 7, 2015 at 4:51 PM, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>>>> 64-bit syscalls currently have an optimization in which they are
>>>> called with partial pt_regs. A small handful require full pt_regs.
>>>>
>>>> In the 32-bit and compat cases, I cleaned this up by forcing full
>>>> pt_regs for all syscalls. The performance hit doesn't really matter.
>>>>
>>>> I want to clean up the 64-bit case as well, but I don't want to hurt
>>>> fast path performance. To do that, I want to force the syscalls
>>>> that use pt_regs onto the slow path. This will enable us to make
>>>> slow path syscalls be real ABI-compliant C functions.
>>>>
>>>> Use the new syscall entry qualification machinery for this.
>>>> stub_clone is now stub_clone/ptregs.
>>>>
>>>> The next patch will eliminate the stubs, and we'll just have
>>>> sys_clone/ptregs.
>>>>
>>>> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
>>>
>>> Fails to boot, bisected to this patch:
>>> [ 32.675319] kernel BUG at kernel/auditsc.c:1504!
>>> [ 32.675325] invalid opcode: 0000 [#65] SMP
>>> [ 32.675328] Modules linked in:
>>> [ 32.675333] CPU: 1 PID: 216 Comm: systemd-cgroups Tainted: G D
>>> 4.3.0-rc4+ #7
>>> [ 32.675336] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
>>> [ 32.675339] task: ffff880000075340 ti: ffff880036520000 task.ti:
>>> ffff880036520000
>>> [ 32.675350] RIP: 0010:[<ffffffff8113d9ed>] [<ffffffff8113d9ed>]
>>> __audit_syscall_entry+0xcd/0xf0
>>> [ 32.675353] RSP: 0018:ffff880036523ef0 EFLAGS: 00010202
>>> [ 32.675355] RAX: 000000000000000c RBX: ffff8800797b3000 RCX: 00007ffef8504e88
>>> [ 32.675357] RDX: 000056172f37cfd0 RSI: 0000000000000000 RDI: 000000000000000c
>>> [ 32.675359] RBP: ffff880036523f00 R08: 0000000000000001 R09: ffff880000075340
>>> [ 32.675361] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
>>> [ 32.675363] R13: 00000000c000003e R14: 0000000000000001 R15: 0000000000001000
>>> [ 32.675380] FS: 00007f02b4ff48c0(0000) GS:ffff88007fc80000(0000)
>>> knlGS:0000000000000000
>>> [ 32.675383] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>>> [ 32.675385] CR2: 00007f93d47ea0e0 CR3: 0000000036aa9000 CR4: 00000000000006e0
>>> [ 32.675391] Stack:
>>> [ 32.675396] ffff880036523f58 0000000000000000 ffff880036523f10
>>> ffffffff8100321b
>>> [ 32.675401] ffff880036523f48 ffffffff81003ad0 000056172f374040
>>> 00007f93d45c9990
>>> [ 32.675404] 0000000000000001 0000000000000001 0000000000001000
>>> 000000000000000a
>>> [ 32.675405] Call Trace:
>>> [ 32.675414] [<ffffffff8100321b>] do_audit_syscall_entry+0x4b/0x70
>>> [ 32.675420] [<ffffffff81003ad0>] syscall_trace_enter_phase2+0x110/0x1d0
>>> [ 32.675425] [<ffffffff81761d94>] tracesys+0x3a/0x96
>>> [ 32.675464] Code: 00 00 00 00 e8 a5 e0 fc ff c7 43 04 01 00 00 00
>>> 48 89 43 18 48 89 53 20 44 89 63 0c c7 83 94 02 00 00 00 00 00 00 5b
>>> 41 5c 5d c3 <0f> 0b 48 c7 43 50 00 00 00 00 48 c7 c2 60 b4 c5 81 48 89
>>> de 4c
>>> [ 32.675469] RIP [<ffffffff8113d9ed>] __audit_syscall_entry+0xcd/0xf0
>>> [ 32.675471] RSP <ffff880036523ef0>
>>
>> I'm not reproducing this, even with audit manually enabled. Can you
>> send a .config?
>
> Never mind, I found the bug by inspection. I'll send a fixed up
> series tomorrow.
>
> Can you send the boot failure you got with the full series applied,
> though? I think that the bug I found is only triggerable part-way
> through the series -- I think I inadvertently fixed it later on.

I can't reproduce it now. It was a hang, or I just didn't get the
oops displayed on the screen. Could have been somethng unrelated.

--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/