Received: by 10.223.176.46 with SMTP id f43csp2682357wra; Thu, 25 Jan 2018 13:32:36 -0800 (PST) X-Google-Smtp-Source: AH8x224gWfi1/aYTYnTR3IeKMOh0ditwNPcH/L5y/NOzWiERh3RRB0M5jwK8TUAMaqiD/vhCHysl X-Received: by 2002:a17:902:147:: with SMTP id 65-v6mr10075533plb.128.1516915956189; Thu, 25 Jan 2018 13:32:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516915956; cv=none; d=google.com; s=arc-20160816; b=mWfLjvzaRnNCGxyHC/OgKwJr+Jy10aIxHODna2IjsMSgIaNR76GUBeW+zw5PK0fhWZ cFEDaA5IxJYiT0zJvZBkG91c0jxIFjuOdVHTnbIooC38Y8RvyZwXJZ6/wu3W6jQ5LwUD q7WpD9Bsq/TIvlm+50jZV6vsNyPY9TU8aIfuUxk2vvcEi15w2MNQaQ8PFIwINd4UrfxX rQ9Aq2puxhjD86qFslghPvE6b5M2diU6m0eZKnK2uA4uoN4mO3qh9/LYd0cOXzyVkl7G TpvdnZvv0HFdH3C4Z4jtQl1YEwUfbCQUPnVT2ALRmmE2K98/Sj0leJzzijPBH3CVvoj9 Y86g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=ir0dOPrgCG4XMpaMsV3ER2M2TEQAlyD7+w/h0DMOZjM=; b=mQKxILDG3Uoaxfptvk7UyUKorZA0uBzeJ/98JJAqodkpjJRHkWlVwWyCDwJj1FcByn p2UWDyG36LkT1WETiq2A5sNSijRWAhcBox401c0BENJ/bSKpA5StcMi3TenAHEKCXhio hiM/uD+mCfWW5g+bONfrGKmwPGSibGwIL3LU4h95AQm8jd8SevIAso522e62lLwKwhZa wKAKRNd4HfaAg5VwKLeaZ/rfbnki5OtIvJJGHpY+8cm8fps/wJewGZ29SKp/f2YrPtLh 2PDPD2abO144iiUfRjzFlDMliTFD3rOekWyqpEMQ/9wTqiGwpNZdxSh0PiuEKqYIZias pU7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si2046259pgq.421.2018.01.25.13.32.21; Thu, 25 Jan 2018 13:32:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751466AbeAYVbe (ORCPT + 99 others); Thu, 25 Jan 2018 16:31:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:52656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751235AbeAYVbc (ORCPT ); Thu, 25 Jan 2018 16:31:32 -0500 Received: from mail-ot0-f171.google.com (mail-ot0-f171.google.com [74.125.82.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 369E5217A0 for ; Thu, 25 Jan 2018 21:31:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 369E5217A0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-ot0-f171.google.com with SMTP id x15so8196963ote.1 for ; Thu, 25 Jan 2018 13:31:32 -0800 (PST) X-Gm-Message-State: AKwxytdOso3rd8+LspOdkriK2c3pNgmfetW6kpaVTGNNbsK2k4gY6nTg 7UuuaqGC149lKW5IH9T9CFi8/zBpJHByEGQVIwUqyg== X-Received: by 10.157.113.81 with SMTP id y17mr460833otj.306.1516915891456; Thu, 25 Jan 2018 13:31:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.66.36 with HTTP; Thu, 25 Jan 2018 13:31:11 -0800 (PST) In-Reply-To: References: <503224b776b9513885453756e44bab235221124e.1516644136.git.luto@kernel.org> From: Andy Lutomirski Date: Thu, 25 Jan 2018 13:31:11 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86/retpoline/entry: Disable the entire SYSCALL64 fast path with retpolines on To: Linus Torvalds Cc: Andy Lutomirski , "the arch/x86 maintainers" , LKML , Greg Kroah-Hartman , Alan Cox , Jann Horn , Samuel Neves , Dan Williams , Kernel Hardening , Borislav Petkov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 25, 2018 at 1:20 PM, Linus Torvalds wrote: > On Thu, Jan 25, 2018 at 1:08 PM, Andy Lutomirski wrote: >> >> With retpoline, the retpoline in the trampoline sucks. I don't need >> perf for that -- I've benchmarked it both ways. It sucks. I'll fix >> it, but it'll be kind of complicated. > > Ahh, I'd forgotten about that (and obviously didn't see it in the profiles). > > But yeah, that is fixable even if it does require a page per CPU. Or > did you have some clever scheme in mind? Nothing clever. I was going to see if I could get actual binutils-generated relocations to work in the trampoline. We already have code to parse ELF relocations and turn them into a simple table, and it shouldn't be *that* hard to run a separate pass on the entry trampoline. Another potentially useful if rather minor optimization would be to rejigger the SYSCALL_DEFINE macros a bit. Currently we treat all syscalls like this: long func(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5); I wonder if we'd be better off doing: long func(const struct pt_regs *regs); and autogenerating: static long SyS_read(const struct pt_regs *regs) { return sys_reg(regs->di, ...); }