Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752831AbbH2QLI (ORCPT ); Sat, 29 Aug 2015 12:11:08 -0400 Received: from mail-oi0-f47.google.com ([209.85.218.47]:35736 "EHLO mail-oi0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691AbbH2QLF (ORCPT ); Sat, 29 Aug 2015 12:11:05 -0400 MIME-Version: 1.0 In-Reply-To: <1440861626-27008-1-git-send-email-brgerst@gmail.com> References: <1440861626-27008-1-git-send-email-brgerst@gmail.com> From: Andy Lutomirski Date: Sat, 29 Aug 2015 09:10:45 -0700 Message-ID: Subject: Re: [PATCH 0/7] x86 vdso32 cleanups To: Brian Gerst Cc: X86 ML , "linux-kernel@vger.kernel.org" , Ingo Molnar , "H. Peter Anvin" , Denys Vlasenko , Linus Torvalds Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2148 Lines: 75 On Sat, Aug 29, 2015 at 8:20 AM, Brian Gerst wrote: > This patch set contains several cleanups to the 32-bit VDSO. The > main change is to only build one VDSO image, and select the syscall > entry point at runtime. Oh no, we have dueling patches! I have a 2/3 finished series that cleans up the AT_SYSINFO mess differently, as I outlined earlier. I've only done the compat and common bits (no 32-bit native support quite yet), and it enters successfully on Intel using SYSENTER and on (fake) AMD using SYSCALL. The SYSRET bit isn't there yet. Other than some ifdeffery, the final system_call.S looks like this: https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/tree/arch/x86/entry/vdso/vdso32/system_call.S?h=x86/entry_compat The meat is (sorry for whitespace damage): .text .globl __kernel_vsyscall .type __kernel_vsyscall,@function ALIGN __kernel_vsyscall: CFI_STARTPROC /* * Reshuffle regs so that all of any of the entry instructions * will preserve enough state. */ pushl %edx CFI_ADJUST_CFA_OFFSET 4 CFI_REL_OFFSET edx, 0 pushl %ecx CFI_ADJUST_CFA_OFFSET 4 CFI_REL_OFFSET ecx, 0 movl %esp, %ecx #ifdef CONFIG_X86_64 /* If SYSENTER is available, use it. */ ALTERNATIVE_2 "", "sysenter", X86_FEATURE_SYSENTER32, \ "syscall", X86_FEATURE_SYSCALL32 #endif /* Enter using int $0x80 */ movl (%esp), %ecx int $0x80 GLOBAL(int80_landing_pad) /* Restore ECX and EDX in case they were clobbered. */ popl %ecx CFI_RESTORE ecx CFI_ADJUST_CFA_OFFSET -4 popl %edx CFI_RESTORE edx CFI_ADJUST_CFA_OFFSET -4 ret CFI_ENDPROC .size __kernel_vsyscall,.-__kernel_vsyscall .previous And that's it. What do you think? This comes with massively cleaned up kernel-side asm as well as a test case that actually validates the CFI directives. Certainly, a bunch of your patches make sense regardless, and I'll review them and add them to my queue soon. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/