Received: by 10.223.176.46 with SMTP id f43csp970036wra; Fri, 26 Jan 2018 09:41:07 -0800 (PST) X-Google-Smtp-Source: AH8x225UIGexdDHNnuVJ0g3jd+GkYB4ttDnfMVWx24IZjaNMMHdqRqHMN2Q4Hcpgq0/BeIK9/6u/ X-Received: by 10.99.125.72 with SMTP id m8mr16149303pgn.146.1516988466788; Fri, 26 Jan 2018 09:41:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516988466; cv=none; d=google.com; s=arc-20160816; b=kg0isA7fztzQ5HP0AIjuS17Sa6JW2P+Km/YeuwdGBQW+jA0vuF1/ESr5HB4jB3zbPJ Bis4uB0w/eDpyiKf1eQh5a+ddREjYnkBA0Hr6COkvOD8QP125Fwj6RdT461QHIWEeE6a K3sMf3EseYhcGvXXLo/mGtE341JCnz+i/gLfw26svDDHa/6tVq+gA2OfV/+ItC24Vw2D AXFpDUVGDhps+JdCdAMlOYEnIS03/IysimVUwaz5KqeV8aLTLFWcGj3Y+KvpgvwY9h4a tPKiKR/ASrLY5+I25SAvhm+qp+/ZBr/HsLPf7yXEou5obTAA7/hyjk8Xh0i2WTLDZQVh GqJQ== 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:dkim-signature :arc-authentication-results; bh=hRrAwqbjsN8/p+HE7uCU5a71Bwy3R/yrfjTFAmORVE0=; b=C9439xKJ8AR6X7RxuKlSRxwLIaiiUS1z3DwYgO4krrTWAlcjcsvnJwiZ1/brkS7E5F YLom/hSLZESA9BLOSXKTHc20CfpYG9I8wHl+j2O7sAW2UvzaGXZblWDT0QscvTcwHdm2 Y2zZkbBdiLWOSxBVvEX5Qtv6YS6qgR7r9vYArr3885PqBJLstwOr5DPHSrcGgYy0qhR4 O7n+4+DnLVzmId65F7MODtYNAsrf4Vd2HZQ6IfOrvdx+IsGF29JLHJhjcCKGXyDELaR6 b8c+Mdx6cOgEfFn/V/E2SmqSwbSdQljWrx8gwioEXrr6/xjYwXnSYJk8Sj62zPUJEKea JXBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fJFZH4qn; 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 ay6-v6si4000636plb.423.2018.01.26.09.40.51; Fri, 26 Jan 2018 09:41:06 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fJFZH4qn; 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 S1751594AbeAZRk0 (ORCPT + 99 others); Fri, 26 Jan 2018 12:40:26 -0500 Received: from mail-io0-f169.google.com ([209.85.223.169]:39060 "EHLO mail-io0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751296AbeAZRkZ (ORCPT ); Fri, 26 Jan 2018 12:40:25 -0500 Received: by mail-io0-f169.google.com with SMTP id b198so1214662iof.6 for ; Fri, 26 Jan 2018 09:40:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=hRrAwqbjsN8/p+HE7uCU5a71Bwy3R/yrfjTFAmORVE0=; b=fJFZH4qn+bSJufchFmTqONko1j1raqmxPNFtyYJe5YY6BYiC4bODAZBKzkV7UW7x/S Q7fju2VJ5nntidvx7iM/0GzHldYkrrzhDiUWpHoBKPMJ5zND255wa8Z+0Ot2doNrksJy QT6RPpR+IdglPOQh/at01zYVKsc8lSpMl5vIzsmCysghw4IjBiGAv04oCaF3VRbAbxA0 V7F8EVr1pyFyfoFkAUI9p26HGYjvk6tPrxmV6XfHmFoVfERo+D1vjfJmn2jL6Y3cEoC2 zN0YmxBUeWi3D4N19qN4KFW/6FGWeLaDFQEslffrrpsK5Rqb/9NFGyGCtWs/rojRvEuQ en/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=hRrAwqbjsN8/p+HE7uCU5a71Bwy3R/yrfjTFAmORVE0=; b=pJKcnRIiHF9/wnYCOXHjO3spSjYVDdTiDiPE3sOdZZsoB/8VaKNz9k2m6M4WSu8Uwd uRQLNZPGf4nT+V6APVCT/3NSrryqsQMCadYt6TqIyFufqvBd2hDKs0vrWI3LuFCxmZR9 SmLeV129PzzF9b5Qv5FaYCUYXFA+lG7xNR1mjeGDgTWHUBDtmRnADncPtzSYhzqQ+tvF zkMAg8Sj1nY7jueMQw601Bu8WRasauzNKWrJtj35SIMDBKEV2nrzoxL5yecDxO42ISzJ zIjFUPdEqfTk3xn30jjOUtD3NZhiDuSM7mA1ZxzAoleRDkwBBviyW341ERDyBZdWO8Zp UxuQ== X-Gm-Message-State: AKwxytdsdCvbG6vwpp8HNwfh1zKvY2cH/41ANe2+HGRdrIoMKTgRKHWa E1lMq/MhTe2pTyPRR66aibhHp6PYTrwLf8mnVlI= X-Received: by 10.107.78.5 with SMTP id c5mr17717769iob.120.1516988424191; Fri, 26 Jan 2018 09:40:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.59.196 with HTTP; Fri, 26 Jan 2018 09:40:23 -0800 (PST) In-Reply-To: References: <503224b776b9513885453756e44bab235221124e.1516644136.git.luto@kernel.org> <1516976647.5438.6.camel@linux.intel.com> From: Linus Torvalds Date: Fri, 26 Jan 2018 09:40:23 -0800 X-Google-Sender-Auth: tOgMCefjlxYKlWOULOsLNDUR6J0 Message-ID: Subject: Re: [PATCH] x86/retpoline/entry: Disable the entire SYSCALL64 fast path with retpolines on To: Andy Lutomirski Cc: Alan Cox , David Laight , "the arch/x86 maintainers" , LKML , Greg Kroah-Hartman , 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 Fri, Jan 26, 2018 at 7:57 AM, Andy Lutomirski wrote: > > I gave the rearrangement like this a try yesterday and it's a bit of a > mess. Part of the problem is that there are a bunch of pieces of code > that expect sys_xyz() to be actual callable functions. That's not supposed to be a mess. That's part of why we do that whole indirection through SYSC##xyz to sys##_xyz: the asm-callable ones will do the full casting of troublesome arguments (some architectures have C calling sequence rules that have security issues, so we need to make sure that the arguments actually follow the right rules and 'int' arguments are properly sign-extended etc). So that whole indirection could be made to *also* create another version of the syscall that instead took the arguments from ptregs. We already do exactly that for the tracing events: look how FTRACE_SYSCALLS ends up creating that extra metadata. The ptreg version should be done the same way: don't make 'sys_xyz()' take a struct ptregs, instead make those SYSCALL_DEFINE*() macros create a _new_ function called 'ptregs_xyz()' and then that function does the argument unpacking. Then the x86 system call table can just be switched over to call those ptreg versions instead. Linus