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=-3.8 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 D896CC433DF for ; Fri, 26 Jun 2020 13:22:11 +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 A861E2075D for ; Fri, 26 Jun 2020 13:22:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b9Q7/sDz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A861E2075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 1jooIq-0002f9-3e; Fri, 26 Jun 2020 13:22:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jooIp-0002f3-7n for xen-devel@lists.xenproject.org; Fri, 26 Jun 2020 13:21:59 +0000 X-Inumbo-ID: 02bca416-b7b0-11ea-bca7-bc764e2007e4 Received: from mail-ej1-x635.google.com (unknown [2a00:1450:4864:20::635]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 02bca416-b7b0-11ea-bca7-bc764e2007e4; Fri, 26 Jun 2020 13:21:58 +0000 (UTC) Received: by mail-ej1-x635.google.com with SMTP id a1so9326719ejg.12 for ; Fri, 26 Jun 2020 06:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:content-language :thread-index; bh=35nElVfO4ruHe/my6OtnItaNY19Zq7OZe2sq8RVEalA=; b=b9Q7/sDzyTSOfvmKO2nLSsd19jiQxMb9W6PcT7xVJG2j2pTPdQuwBCOoaYtS0yVdDL tjC8NlkDeBmx3L0p97lu/sp3iw1r/lJHgU2+kqYCSBmVHfd7XBnhIiiQxwOLb7Uo1yv3 b7LJZ0dJHvMQUmOWanKOyWnCaYGmW8kTnuqHqQ/axyhca6FHPg61B9KiClpO37x4ZifD c5/YwsqDELmlEc54ykYCeAtKnNJsO9HDpMJEuv6ZIOMLdr5Mohx+xMQWlIaywNtZNDZu qXdo0ma0whoHqahnyysiGjBUTECvYU1d76YIQMlgZrMKGMkXtPgzUbs8oTdhqkpX3r8D mUbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to :subject:date:message-id:mime-version:content-transfer-encoding :content-language:thread-index; bh=35nElVfO4ruHe/my6OtnItaNY19Zq7OZe2sq8RVEalA=; b=g4MozpBTmsvqXab9/zjHNO3GrsFWn19TnGOM5YzodrPV3DcCreXI7MJ/c46byVuMBy otmhjI7hs3NUSZ6CUzrxiTUJDbRe35OU5h6/nwLuokng6163zASa7ryBQrH7f/LzJ7LJ /KbWsXVW3jg1TaD1axcSxbYEkMkrAt16EfZLcpArXpTh9Gnt8RuJ2HK+tiAAyqt05wAG Lt9Wgbj+ErbwUtzdgnzvPYtaWbcgSug9z5mSDexVefvU3bTlIqBHECg1W8Z188MuoeoQ 8lHaMngmXDBy5s3+ZovNd6vrA0BikRFxfhPLwMolskYzDNybiisCkIFDdj972Fcrhd2k LF8Q== X-Gm-Message-State: AOAM531VV2QZj7vIa+AYJ/WqnZfC/CtNgKy3eRCjfcDGQayTrvnz8AgG +gDV8WXgZ7+uM8ZoeKoz+1g= X-Google-Smtp-Source: ABdhPJwKed8mGY3+lJBzy831qAcDxGDZNnONnWWAIIyVanWbqwreTXOLPZ93/1rmppbN2vQUrUPp5Q== X-Received: by 2002:a17:907:b03:: with SMTP id h3mr2665047ejl.367.1593177717324; Fri, 26 Jun 2020 06:21:57 -0700 (PDT) Received: from CBGR90WXYV0 (54-240-197-236.amazon.com. [54.240.197.236]) by smtp.gmail.com with ESMTPSA id bz14sm18770473ejc.100.2020.06.26.06.21.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2020 06:21:56 -0700 (PDT) From: Paul Durrant X-Google-Original-From: "Paul Durrant" To: "'Jan Beulich'" , "'Andrew Cooper'" References: <20200626122408.19151-1-andrew.cooper3@citrix.com> In-Reply-To: Subject: RE: [PATCH v2 for-4.14] x86/livepatch: Make livepatching compatible with CET Shadow Stacks Date: Fri, 26 Jun 2020 14:21:55 +0100 Message-ID: <000c01d64bbc$c3f75730$4be60590$@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-gb Thread-Index: AQFni0xM86WbiVrPLWulsmYIT6MTPgHnaHqAqbknfuA= 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: , Reply-To: paul@xen.org Cc: 'Wei Liu' , 'Konrad Rzeszutek Wilk' , 'Ross Lagerwall' , 'Pawel Wieczorkiewicz' , 'Xen-devel' , =?utf-8?Q?'Roger_Pau_Monn=C3=A9'?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" > -----Original Message----- > From: Jan Beulich > Sent: 26 June 2020 14:15 > To: Andrew Cooper > Cc: Xen-devel ; Wei Liu ; = Roger Pau Monn=C3=A9 > ; Konrad Rzeszutek Wilk = ; Ross Lagerwall > ; Pawel Wieczorkiewicz ; = Paul Durrant > Subject: Re: [PATCH v2 for-4.14] x86/livepatch: Make livepatching = compatible with CET Shadow Stacks >=20 > On 26.06.2020 14:24, Andrew Cooper wrote: > > Just like the alternatives infrastructure, the livepatch = infrastructure > > disables CR0.WP to perform patching, which is not permitted with CET = active. > > > > Modify arch_livepatch_{quiesce,revive}() to disable CET before = disabling WP, > > and reset the dirty bits on all virtual regions before re-enabling = CET. > > > > One complication is that arch_livepatch_revive() has to fix up the = top of the > > shadow stack. This depends on the functions not being inlined, even = under > > LTO. Another limitation is that reset_virtual_region_perms() may = shatter the > > final superpage of .text depending on alignment. > > > > This logic, and its downsides, are temporary until the patching = infrastructure > > can be adjusted to not use CR0.WP. >=20 > In particular on this basis ... >=20 > > Signed-off-by: Andrew Cooper >=20 > Reviewed-by: Jan Beulich Release-acked-by: Paul Durrant >=20 > Jan