From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 737CBC433E9 for ; Thu, 3 Sep 2020 16:26:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2C08B20758 for ; Thu, 3 Sep 2020 16:26:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=amacapital-net.20150623.gappssmtp.com header.i=@amacapital-net.20150623.gappssmtp.com header.b="oDD0Gux3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C08B20758 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amacapital.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C61A76B0062; Thu, 3 Sep 2020 12:26:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C395D6B0068; Thu, 3 Sep 2020 12:26:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B51046B006C; Thu, 3 Sep 2020 12:26:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id A05176B0062 for ; Thu, 3 Sep 2020 12:26:06 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 55BF333CD for ; Thu, 3 Sep 2020 16:26:06 +0000 (UTC) X-FDA: 77222277132.05.low24_610f495270ab Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 28E951800E8EA for ; Thu, 3 Sep 2020 16:26:06 +0000 (UTC) X-HE-Tag: low24_610f495270ab X-Filterd-Recvd-Size: 5150 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Sep 2020 16:26:05 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id c18so3874746wrm.9 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=T/YluSV5qR8CJCiuCmI6IUu60D0+pQvU8Ja/hPkn/Bp9FhG+uT8cShK0JxrSHgzAzn xiE2Xe8CnFjId+JqFZlWLsRCvOLrI4mzbAjwnWyVVbBBs5KCgYYwUVRURxDxYZQm36IO fxbH1P0rAp6Z96UOSVRjcPLPKn2lHZXIh72fIN6noXLBb03wbQD9lq/yDO8i01o7Sm7B 4R3PdIGpdpzAVW/uIhJZoW/QkLQoX030czqj2RxZkG8jRBEkEjq4p4I886oaygnn270N CPP1/BChR2zcKoK+zFJu5xzIimUSVTDh78pyFrhsQWzhKW5rAWXD4xOHaPvxvcFhWR0L Ffgw== X-Gm-Message-State: AOAM531FHNjN+//o/A3GaH/6eSZBYIqTcbQQf3yS3S4h8FtRj/DYqlTQ cMj1LmHZpKsNEAM2NrduK2z2/JV4Owc25bi21bQ+Qg== X-Google-Smtp-Source: ABdhPJxcnMUlkP3dZ2TKybhF8a+O8Sm1srU3BtKK/jrCHsVYh3QnJ0h434G4rO8gv9hbnVUhv5ZzuuQkLwxiCBqscSc= 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" X-Rspamd-Queue-Id: 28E951800E8EA X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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