Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754196AbbHZFUz (ORCPT ); Wed, 26 Aug 2015 01:20:55 -0400 Received: from mail-ob0-f182.google.com ([209.85.214.182]:32953 "EHLO mail-ob0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752105AbbHZFUy (ORCPT ); Wed, 26 Aug 2015 01:20:54 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 26 Aug 2015 01:20:53 -0400 Message-ID: Subject: Re: Proposal for finishing the 64-bit x86 syscall cleanup From: Brian Gerst To: Andy Lutomirski Cc: X86 ML , Denys Vlasenko , Borislav Petkov , Linus Torvalds , "linux-kernel@vger.kernel.org" , Jan Beulich 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: 2450 Lines: 54 >>> Thing 2: vdso compilation with binutils that doesn't support .cfi directives >>> >>> Userspace debuggers really like having the vdso properly >>> CFI-annotated, and the 32-bit fast syscall entries are annotatied >>> manually in hexidecimal. AFAIK Jan Beulich is the only person who >>> understands it. >>> >>> I want to be able to change the entries a little bit to clean them up >>> (and possibly rework the SYSCALL32 and SYSENTER register tricks, which >>> currently suck), but it's really, really messy right now because of >>> the hex CFI stuff. Could we just drop the CFI annotations if the >>> binutils version is too old or even just require new enough binutils >>> to build 32-bit and compat kernels? >> >> One thing I want to do is rework the 32-bit VDSO into a single image, >> using alternatives to handle the selection of entry method. The >> open-coded CFI crap has made that near impossible to do. >> > > Yes please! > > But please don't change the actual instruction ordering at all yet, > since the SYSCALL case seems to be buggy right now. > > (If you want to be really fancy, don't use alternatives. Instead > teach vdso2c to annotate the actual dynamic table function pointers so > we can rewrite the pointers at boot time. That will save a cycle or > two.) The easiest way to select the right entry code is by changing the ELF AUX vector. That gets the normal usage, but there are two additional cases that need addressing. 1) Some code could possibly lookup the __kernel_vsyscall symbol directly and call it, but that's non-standard. If there is code out there that does this, we could update the ELF symbol table to point __kernel_vsyscall to the chosen entry point, or just remove the symbol and let the caller fall back to INT80. 2) The sigreturn trampolines. These are tricky because the sigreturn syscalls implicitly uses regs->sp to find the signal frame. That interacts badly with the SYSENTER/SYSCALL entries, which save registers on the stack. It currently uses a bare SYSCALL instruction (no pushes to the stack), but falls back to INT80 for SYSENTER. One option is to create new syscalls that takes a pointer to the signal frame as arg1. -- Brian Gerst -- 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/