Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp664727pxk; Thu, 3 Sep 2020 09:28:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn9sAfnNAee1r/LEaWWvGEYIBaPmfM3nWXNBigGNcfsFpQc0AvMs/jheG1B5s/7kyBVZT5 X-Received: by 2002:aa7:cb83:: with SMTP id r3mr3881784edt.35.1599150502671; Thu, 03 Sep 2020 09:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599150502; cv=none; d=google.com; s=arc-20160816; b=g2m0GeeRnVdn8ZUwPCR30og7oueU4ecwwuH4na55xfN6D8TciN5kzpXfKyBBRJ/iEX ahC25pYxL9YFRonmrKHK9Gtc3fFpM5z51gDNtI9wOrzY/Igw2eHTjbpZ8VBE53aeBw6s Wsp7TwKDALcrwBxQ5YVevp4oWYpBQZVkPAEgbESLdp4eQQARHkIAjZz71ebdcHQ5g8d+ NWcD3r0zKbQ52f9lwkC/TNkSYg4+AgGK5WaKg13mMFNYQ55pyi7b3gkPir/WrV8DlC85 NkOlR5WPpeecrcJAjDXRpQfvIxS10qkVP3aZwPPw6PIAoUprstCalYreFO3/D0/Hprvj 42gQ== 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=SX2M8ZjNOBomakJPHx/eAoRjiYE0E7vCrIP8X7wqwrE=; b=a9GIoTsfkFhvrhtBNprP3KIyS7RJrc1ySYj8UzjjXXqOWXGzG7wLYKva8oQNfvbS7o ifNqbWeyLt28jDEWCUpiY0dIGkweY1FBKxOx75E8PEHFGDi9YbWP5cS/wP5ZOgX6LIqv Vg8YDBpmKIZM5iaoeUcZtbj4s9rJpog1pAA1SOa1JDoeNzLfr3OGAX5ERK1Yk0gP6Jdw msL+0gDG1lJejKXTIF5h1pazgi+wL4tEevboV68aW5PGnHcIzX2fBQF2Wrv8N8I/JW/1 NZ7Z7CItaYw67rSbVtXDC0I1vwNxIu2Mq44pedpuqkUVIXAUgWhcAE5eOTb1cSyDGNnw u9FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=oDD0Gux3; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si2407242ejf.419.2020.09.03.09.27.58; Thu, 03 Sep 2020 09:28:22 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=oDD0Gux3; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728701AbgICQ0L (ORCPT + 99 others); Thu, 3 Sep 2020 12:26:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726368AbgICQ0G (ORCPT ); Thu, 3 Sep 2020 12:26:06 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7918FC061244 for ; Thu, 3 Sep 2020 09:26:05 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id x14so3854918wrl.12 for ; Thu, 03 Sep 2020 09:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SX2M8ZjNOBomakJPHx/eAoRjiYE0E7vCrIP8X7wqwrE=; b=oDD0Gux34thJnmZ1p9GU8/6kkTWx5e4QqShXwMd2NzdUka1D68oV585mq/L3jRJuu0 w0CSzkCCoemSUbbJ8xwFmr5CuDop+bx66FGABsb7OMciJYlYF598/kVCyzUOgEKZ6zl1 dJhzpIT78obpMOtyOQjJjAaeqiAJQhE1/6HIKz05PonttlZTZ2femjibqz5sE61+jsRU I3UGgJtnMU/bozY9Bs4Qa/anS5uwD/JAZSk1k65nv9i0c1yBndXHbXDLXLR2zmwsvmp8 C9np4SMmG6PqdfSrCNaiH9JEU2oOeHPRfT0tNA1yVhssHn+9/w/tSyzAnqTgqKR+Lf01 Zyxg== 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=SX2M8ZjNOBomakJPHx/eAoRjiYE0E7vCrIP8X7wqwrE=; b=XLsfr9u+9XVswVZg6fpc1C9bjEpI4SVM3OIzZ5XxynXHMVUu2fzne0FBsAYUE4pKSx Q7JVPDSfqZq/XVSEbwy8PAm/7ISqbt65ldZtkHFOFj1WpiVoAEc5tadAUC4FLfBy84AP PFIUPG9pZe+gNwbIxqJrek4z5fQgtUTEPGgdi8F4bg1D7XPMJKPnd552s5nrl+q/SR8R Km2cNPN1t5gx0eCyumj7eoNLfvTbvmyKzUASZTiQ7ByKoyrAnTQ/4tp1cnoAIQ9gLlPE +9H+h6W0hdlFm+rt621aAHrD5ceeY80iPNKg+9VT3G0pYzUelNaG1OYE2kr4z/wXlOAF 1FzA== X-Gm-Message-State: AOAM533kh7NIU5SeP8gzocF6vNsfQai+0iVNPGIexS3Sz7zKQxGvECGt ndfjbQFONuWzKnS30WO/WrEWXAWYZkhly1cqAMp5Bw== X-Received: by 2002:a5d:6a47:: with SMTP id t7mr3256984wrw.75.1599150364012; Thu, 03 Sep 2020 09:26:04 -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> <3967f126-f7ea-36fd-bec0-dfbbc46ef221@intel.com> In-Reply-To: <3967f126-f7ea-36fd-bec0-dfbbc46ef221@intel.com> From: Andy Lutomirski Date: Thu, 3 Sep 2020 09:25:51 -0700 Message-ID: Subject: Re: [PATCH v11 6/9] x86/cet: Add PTRACE interface for CET To: "Yu, Yu-cheng" Cc: Dave Hansen , 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 , Andy Lutomirski , 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:21 AM Yu, Yu-cheng wrote: > > On 9/3/2020 9:11 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? > > > > For example, if the task has CET enabled, and it is in a control > protection fault, the debugger can clear the task's IBT state, or unwind > the shadow stack, etc. But if the task does not have CET enabled (its > CET MSRs are in INIT state), it would make sense for the PTRACE call to > return failure than doing something else, right? What do you mean "something else"? I assume that, if GDB tells ptrace() to write some value to the CET MSR, then it should get that value. If GDB writes to it on a task that is not currently using CET, I don't see why it should fail. --Andy