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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 14644C433E0 for ; Fri, 26 Jun 2020 15:09:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E2C0A206DD for ; Fri, 26 Jun 2020 15:09:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2C0A206DD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jopyK-00040f-KQ; Fri, 26 Jun 2020 15:08:56 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jopyJ-00040Y-Qt for xen-devel@lists.xenproject.org; Fri, 26 Jun 2020 15:08:55 +0000 X-Inumbo-ID: f3a1576a-b7be-11ea-82cf-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f3a1576a-b7be-11ea-82cf-12813bfff9fa; Fri, 26 Jun 2020 15:08:55 +0000 (UTC) Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: KMAP5/iI7KGQCDicV0q8qkboU0msafPKyb4nfgXGC33TfWdFltZwZOxT6YmjI/3ACs5e8CKQbQ gHlzfm/rAS65StxHRdwjXCWxyuKrxWOAB1tfJdyLbJEWjO4O9Py05rzm5q9TNzdBKOohwoI/q8 wfmrKqUMhenhumtwbGZlzm6jl+CA2hL8i5iR0OFYDa14Gfty+0CZEbq0T5aLciZg6ghMDH9OjR riIh4OmolRQslEAvEsBQtlYTusfSGLFUMd1q4aiZ2PEAnFNWXrlZ2N0qNP12H98dwCMR0bcG+P rZk= X-SBRS: 2.7 X-MesageID: 21043473 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.75,284,1589256000"; d="scan'208";a="21043473" Subject: Re: [PATCH v2 for-4.14] x86/livepatch: Make livepatching compatible with CET Shadow Stacks To: Ross Lagerwall , Jan Beulich References: <20200626122408.19151-1-andrew.cooper3@citrix.com> <4bd8ab3e-37d0-fde9-10a3-b6b2f9ca4da6@citrix.com> <29ae3614-a73e-de01-f10f-8f3a32c3372a@suse.com> <5756a404-2d0a-3146-0682-dc89ad4a3c61@citrix.com> <2e0f93a1-29da-9457-a548-41e2c51ce75b@citrix.com> From: Andrew Cooper Message-ID: Date: Fri, 26 Jun 2020 16:08:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <2e0f93a1-29da-9457-a548-41e2c51ce75b@citrix.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Paul Durrant , Konrad Rzeszutek Wilk , Pawel Wieczorkiewicz , Xen-devel , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 26/06/2020 16:07, Ross Lagerwall wrote: > On 2020-06-26 15:46, Andrew Cooper wrote: >> On 26/06/2020 15:26, Jan Beulich wrote: >>> On 26.06.2020 15:59, Ross Lagerwall wrote: >>>> On 2020-06-26 13:24, Andrew Cooper wrote: >>>>> @@ -56,18 +57,48 @@ int arch_livepatch_safety_check(void) >>>>> return -EBUSY; >>>>> } >>>>> >>>>> -int arch_livepatch_quiesce(void) >>>>> +int noinline arch_livepatch_quiesce(void) >>>>> { >>>>> + /* If Shadow Stacks are in use, disable CR4.CET so we can modify CR0.WP. */ >>>>> + if ( cpu_has_xen_shstk ) >>>> Should this be: >>>> if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk ) >>>> >>>> to match arch_livepatch_revive? >>> While it may look a little asymmetric, I think it's preferable >>> to is IS_ENABLED() only where really needed, i.e. here it >>> guarding code that otherwise may not build. >> The reason for the asymmetry is because of the asm() block, which needs >> compiling out when we detect that we don't have a compatible assembler. >> > In that case, > > Reviewed-by: Ross Lagerwall Thanks.  I've decided to clean this up in the (growing) series of 4.15 changes. ~Andrew