Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp668797pxk; Thu, 3 Sep 2020 09:34:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCo46ju5kP5YrpkYF7ZN8UAvzKYl77pb+2p7Dhz009ehvlSuTGXsX86Mr2DK6s/3mkd4mg X-Received: by 2002:a50:aa94:: with SMTP id q20mr3894957edc.119.1599150850315; Thu, 03 Sep 2020 09:34:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599150850; cv=none; d=google.com; s=arc-20160816; b=oeZGvmunXrL2pkdBf00qB6dqfEG3uYe8WzJL6cSTc+dWw9MByZb9+uU+u07DZKjjYv UOf6XoOL6KCUJGHcoyKhehMDRXZurgr+ISE+iOQIHorFfLnvP1NUcortuyKGvtFMMjV7 eiFKOli2du6wV2fDq4nGEzX6w/6/5Vf0UO5416AdnnuYqEr0OZ1BtbYpYiew0c7A4NO7 IKMNjL6DD1bvLUvbjj5R0giR4z8aQdppugwnbUFYlzPbzpShtH89a/lmh8fSHckH3GN/ 8+jBVsMtheAyEpIkKeEaPfUgT+nwBB94+ORu3BHjo6VSWHiaXw7PdNep7KHfcXy4u7K2 7jGw== 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=jtdibQDP8qkQMUT59Y1ocuURJTCp+ZUJF6MY5FP0nZA=; b=SBAGHsQbdwI3bnFFECrH8j7dlzmq5Ok4Y/OsCmELCncGnkcailaMlF8EQ49n9aMTIO D81YT/3AL/lo62QxOvcgY9rYdKOorFEtoVKpjqyggxISx8+mXovldk+XHim2WBUyvH0k Hg4PsDi5m4181jri9iNqrm+EHS0ValhM51m00U97kSyf8R350OFyaGX9qKw/PnqxI6ID Yynpnk8Tedy66M8fRrA+7b3v9yO4JA89LcIN/xrf144pFcGPzEiOPQCoPYIQE2JxnsKr 7IzOQTAhIKu8iPZfI1isYROhW12lpk0VLh3i5UOsRJ5cU533FtJPvWertFLZUrjvgeo2 3EIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Az/MpPSl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si2250196ejs.101.2020.09.03.09.33.47; Thu, 03 Sep 2020 09:34:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Az/MpPSl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728849AbgICQcw (ORCPT + 99 others); Thu, 3 Sep 2020 12:32:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:52104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbgICQcu (ORCPT ); Thu, 3 Sep 2020 12:32:50 -0400 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 9879B208B3 for ; Thu, 3 Sep 2020 16:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599150769; bh=ccAhlXDIqzUfCS53Ih6BJ5ZMtmY6cQaap0Ayu6dveG0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Az/MpPSlsSfqamSllDS7ZNWPhfS4KgkXOA3gryVz+eAyhYeE+aMjmDr7ofkeHByrx zuMUDT2GigowU+B95JFfh5cfn4WwTn8bqgEtfkHWHr/NPVjktIUvZ966hfd2QwKrgW PuuvmJSICVCp9UZCLkw74xyp4iJIeGS5prLzJ+O0= Received: by mail-wr1-f46.google.com with SMTP id k15so3887695wrn.10 for ; Thu, 03 Sep 2020 09:32:49 -0700 (PDT) X-Gm-Message-State: AOAM532dEAMa4H3GikLwoXvE9YzjEOQnDMB5qFxH9wsWBfv/X3IYGp4v 9YhlzfLNwJjrtaT0FCCPs4Cen53k2RgH46is+q2NPQ== X-Received: by 2002:a05:6000:11c5:: with SMTP id i5mr3428679wrx.18.1599150768256; Thu, 03 Sep 2020 09:32:48 -0700 (PDT) MIME-Version: 1.0 References: <46e42e5e-0bca-5f3f-efc9-5ab15827cc0b@intel.com> <40BC093A-F430-4DCC-8DC0-2BA90A6FC3FA@amacapital.net> <88261152-2de1-fe8d-7ab0-acb108e97e04@intel.com> <1b51d89c-c7de-2032-df23-e138d1369ffa@intel.com> <21491d05-6306-0a6f-58a7-8bf29feae8c7@intel.com> In-Reply-To: <21491d05-6306-0a6f-58a7-8bf29feae8c7@intel.com> From: Andy Lutomirski Date: Thu, 3 Sep 2020 09:32:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v11 6/9] x86/cet: Add PTRACE interface for CET To: Dave Hansen Cc: Andy Lutomirski , "Yu, Yu-cheng" , Jann Horn , "the arch/x86 maintainers" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , kernel list , "open list:DOCUMENTATION" , Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang 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, Sep 3, 2020 at 9:25 AM Dave Hansen wrote: > > On 9/3/20 9:15 AM, Andy Lutomirski wrote: > > On Thu, Sep 3, 2020 at 9:12 AM Dave Hansen wrote: > >> > >> On 9/3/20 9:09 AM, Yu, Yu-cheng wrote: > >>> If the debugger is going to write an MSR, only in the third case would > >>> this make a slight sense. For example, if the system has CET enabled, > >>> but the task does not have CET enabled, and GDB is writing to a CET MSR. > >>> But still, this is strange to me. > >> > >> If this is strange, then why do we even _implement_ writes? > > > > Well, if gdb wants to force a tracee to return early from a function, > > wouldn't it want the ability to modify SSP? > > That's true. > > Yu-cheng, can you take a look through and see for the other setregs > users what they do for logically crazy, strange things? Is there > precedent for refusing a write which is possible but illogical or > strange? If so, which error code do they use? > > Taking the config register out of the init state is illogical, as is > writing to SSP while the config register is in its init state. What's so special about the INIT state? It's optimized by XSAVES, but it's just a number, right? So taking the register out of the INIT state is kind of like saying "gdb wanted to set xmm0 to (0,0,0,1), but it was in the INIT state to begin with", right?