Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2724361ybl; Thu, 19 Dec 2019 19:49:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzSKXL8SMpRhOxOdu6PCFuAJX+fRMBSls/FkIV/DG1ULoemoBiKc0fmNedIxNWYcLM29d39 X-Received: by 2002:a05:6830:1f95:: with SMTP id v21mr3833282otr.325.1576813756378; Thu, 19 Dec 2019 19:49:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576813756; cv=none; d=google.com; s=arc-20160816; b=mZMkEkXwGcy7nQ20jYtpfYgUIfAw3fLfeaDPhMZ8Qb1ORiOWaIAYJ8MMfI12b5IOI+ wSsMxtE1N4vqLLadUaIEqa9Xz9jxu756PW/SpE6BKJ/cGVsFG7Bl0q0ojSD+Dtduq1oS NWjMbqF9MdD5cRTQ/m6LvCzuJtQcmAxVm4e0oCF3H1HqMBeR8SRb5ZL1WJF96bAwxBHF eRGmqOhWkvl0BEMxn+1Ee7qI1uS0Qb6aysol7l3tPHToIE+MY45lC9RJ/VsrpcIBkLTt Yt6VZwTxAxYNc3YwLieZepH1X4APFcVmbxpH4eztV+jYMn++X8eVegVaXKxJFk5p/wbF YKmw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=/5xRolE5dJvA7tdJmuE0DTxJx+uRpisDGCBUfeRMXSM=; b=ukOs6g5be8HnJGhzvy+qR/6/gniUpg6W0YffbQwuQS9sHFR9I3f312WNRMWxSipAQP Aj4d6m005eYuRyMRw1SdB7tZFopsZVV8UKhjerGZ/kRU3qUhq9eQ/qihsH9Df7+vWP4W 4NGchOEA6eQa7Ak6RPJ3jj9vGSlKXmlI2gzBysp9wN2wxyRxlRKpauaMQcZmSG2v7wFZ b4jrfoc7If7p5Xr252GNX1Uhrg9ROFMV+V0TkXgY8z7E2+IB0rwgr2zT6lX4i+pphnqH eS7ocANqP79WYKMY8yw/u41qoAcNARgdAgraMMwM6SorQgmD1rZ7m9O/ChvypSW1JGvP s1Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K7xtH7YC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j16si4421985otp.316.2019.12.19.19.49.05; Thu, 19 Dec 2019 19:49:16 -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=pass header.i=@gmail.com header.s=20161025 header.b=K7xtH7YC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727169AbfLTDsZ (ORCPT + 99 others); Thu, 19 Dec 2019 22:48:25 -0500 Received: from mail-io1-f67.google.com ([209.85.166.67]:42453 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727020AbfLTDsZ (ORCPT ); Thu, 19 Dec 2019 22:48:25 -0500 Received: by mail-io1-f67.google.com with SMTP id n11so1311765iom.9 for ; Thu, 19 Dec 2019 19:48:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/5xRolE5dJvA7tdJmuE0DTxJx+uRpisDGCBUfeRMXSM=; b=K7xtH7YCSSZQ096YgPc5qIj9YHYxNW7cmkptjfJEDK3oxVfF6gislTzqxlNYnS8yZn cCgJoc+Gsu4kVIct/nNcP3H+Q0Un0h2GNn8HRpBdArpfg5D7EmR10Ne4ZxRPdXaE0ihI io81vp5+n9v3osGZrTjmzbMCy9OPTsFLywAS9aHXgFIrqAmXD41/GfXSEkfCWEzD4e2e NUFtpJfQqQwTQ+bULiaEOwmptPCIKgv8tBPZNySNkU5YDGVNsvN/SIiLqKhbjjdJ07ON ZvCNf+x9H9ISgmIZ3R9Caxb5hNrxFa2O+FTKb8h5h3b439NTowJ8jhso1uL3sKSpGnsj zjpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/5xRolE5dJvA7tdJmuE0DTxJx+uRpisDGCBUfeRMXSM=; b=swt2mk7tSvyOkv/nO3nwCHC3DLhhSOwNsz4OActFBZkNIYjNj+8O06Z/ymDGwo0ffB Egzqgm4voOXFEXdwJqhsLpFzIOtGWmj6HyTy+LtWKymqRtC7qgWgVkVoSeoYIYal3AQZ gkUlRcYH6XZEjxIuu5vIHmLwdMAuHvYSizmvUicxBLO54/+bcIdm4Behsvm9zJPxUrUY Z7ylG27xkBwQw7+LSgbSqF7a0rG69SPsvGj3gdcdiB/D9oDnGiWbbCPotTEn+ViQf/fK 0J8/9RVgY3dNGSHCZ7wBQUJUPDXgC72uTEtCcDinNEEjzEo/wfx0VGWzyXaQNtpYSm8K VX5Q== X-Gm-Message-State: APjAAAV2DUDUyBOjjSeka+tnf4pgOlrfel2/KgKg2pQcxXxFmeEE/E3E IK1LD6CLJ/cDOZYztoGuciE+8pmbVueKffygLK3t X-Received: by 2002:a6b:b717:: with SMTP id h23mr8598334iof.273.1576813704203; Thu, 19 Dec 2019 19:48:24 -0800 (PST) MIME-Version: 1.0 References: <20191219115812.102620-1-brgerst@gmail.com> In-Reply-To: From: Brian Gerst Date: Thu, 19 Dec 2019 22:48:13 -0500 Message-ID: Subject: Re: [PATCH] x86: Remove force_iret() To: Andy Lutomirski Cc: X86 ML , LKML , Ingo Molnar , "H . Peter Anvin" , Boris Ostrovsky , Oleg Nesterov 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, Dec 19, 2019 at 8:50 PM Andy Lutomirski wrote: > > On Thu, Dec 19, 2019 at 3:58 AM Brian Gerst wrote: > > > > force_iret() was originally intended to prevent the return to user mode with > > the SYSRET or SYSEXIT instructions, in cases where the register state could > > have been changed to be incompatible with those instructions. > > It's more than that. Before the big syscall rework, we didn't restore > the caller-saved regs. See: > > commit 21d375b6b34ff511a507de27bf316b3dde6938d9 > Author: Andy Lutomirski > Date: Sun Jan 28 10:38:49 2018 -0800 > > x86/entry/64: Remove the SYSCALL64 fast path > > So if you changed r12, for example, the change would get lost. force_iret() specifically dealt with changes to CS, SS and EFLAGS. Saving and restoring the extra registers was a different problem although it affected the same functions like ptrace, signals, and exec. -- Brian Gerst