Received: by 10.223.176.5 with SMTP id f5csp950330wra; Fri, 9 Feb 2018 09:50:45 -0800 (PST) X-Google-Smtp-Source: AH8x224PUbPaQnZ9Mgclf9yMixPuyv95KtlTFZrIexcdnXR1k/h5Aee+L0IqaW6TZPSwTG1tVOWi X-Received: by 10.98.201.129 with SMTP id l1mr2003815pfk.76.1518198645862; Fri, 09 Feb 2018 09:50:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518198645; cv=none; d=google.com; s=arc-20160816; b=zpAmorLRyiKY89ViFRCuwHqczXQ5rmGvXr7/hM5sVmuAuLa5DbeDxkC5ZPk8+pu1GZ 8bWUrHDnWbfi82j0cfYfceDEYxuYsd+hLISLiG+mjeHnw/C3kQmjh6/e76o/GK3C3OT0 8onlU1kxn3xu2Fm5NuNMEuRMDJ9dq+mpTfZkAxRnFOU8UT3iWpe0w63zWGDPO1FDEj8u PKPOq56H5Kfc7oszXnN2LCZAdDWh2LMNIUeO96Dn+rJUi0U8Jnf3yzFVaSH0XDz6Q372 W8hmqxXNsbtobvSV562stD5hXXkZhYpLqsCQfSzxM61DmH2X9HPGRo5IEqVS+SzoRJTw rpsg== 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 :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=7CrjGlQm4rePqdkfzRtRSGReBaJXbwKvLm/0Pw366Ek=; b=iZdf0fyCZExxSSB8FzwCN1fjtxyriSSa18WG1RL0UKleWANwjUINyzpW9/6WIjUbrv l79ZauvtrJa0SkoWyzPRrYXmGmv00qppviV3TK2wI/14Sroh6syK4KiNl6ChaBgQGymj 5uw23ltbUi1DaWJ+aSPGd+ISSH6OoU+pAo4A5d6CLkLjqcpfGmjaQokF86us8KbCg0gI CTs8EHkozuQ6inHPxW5MKDYDb3foNOmbeqSyjgNxOcvqhhJLFdcbfFDNjye9KPE0bDDI P2JgeIJLMnqWqYmZhtQ1FAMoQaohIJzZ9IHziW4urnKAE57d3KeQj8pLBhDl33383Sn/ PrmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3-v6si1771887plz.745.2018.02.09.09.50.31; Fri, 09 Feb 2018 09:50:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752167AbeBIRs7 (ORCPT + 99 others); Fri, 9 Feb 2018 12:48:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:57006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751248AbeBIRs6 (ORCPT ); Fri, 9 Feb 2018 12:48:58 -0500 Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) (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 A564A217BC for ; Fri, 9 Feb 2018 17:48:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A564A217BC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-it0-f50.google.com with SMTP id k131so11921346ith.4 for ; Fri, 09 Feb 2018 09:48:57 -0800 (PST) X-Gm-Message-State: APf1xPAf/dsFvwPdUIWiLpFmdglbya757k6lzOvq8y/O3biDXVqvB99h TA0vHw3FFmuLKL0N6h9kivMpJ2j0dhDTl3VdK6GNcA== X-Received: by 10.36.190.8 with SMTP id i8mr4712087itf.26.1518198537114; Fri, 09 Feb 2018 09:48:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.176.212 with HTTP; Fri, 9 Feb 2018 09:48:36 -0800 (PST) In-Reply-To: <1518168340-9392-21-git-send-email-joro@8bytes.org> References: <1518168340-9392-1-git-send-email-joro@8bytes.org> <1518168340-9392-21-git-send-email-joro@8bytes.org> From: Andy Lutomirski Date: Fri, 9 Feb 2018 17:48:36 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 20/31] x86/mm/pae: Populate the user page-table with user pgd's To: Joerg Roedel Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek , Joerg Roedel 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 Fri, Feb 9, 2018 at 9:25 AM, Joerg Roedel wrote: > From: Joerg Roedel > > When we populate a PGD entry, make sure we populate it in > the user page-table too. > > Signed-off-by: Joerg Roedel > --- > arch/x86/include/asm/pgtable-3level.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h > index bc4af54..1a0661b 100644 > --- a/arch/x86/include/asm/pgtable-3level.h > +++ b/arch/x86/include/asm/pgtable-3level.h > @@ -98,6 +98,9 @@ static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd) > > static inline void native_set_pud(pud_t *pudp, pud_t pud) > { > +#ifdef CONFIG_PAGE_TABLE_ISOLATION > + pud.p4d.pgd = pti_set_user_pgd(&pudp->p4d.pgd, pud.p4d.pgd); > +#endif > set_64bit((unsigned long long *)(pudp), native_pud_val(pud)); > } > > @@ -194,6 +197,10 @@ static inline pud_t native_pudp_get_and_clear(pud_t *pudp) > { > union split_pud res, *orig = (union split_pud *)pudp; > > +#ifdef CONFIG_PAGE_TABLE_ISOLATION > + pti_set_user_pgd(&pudp->p4d.pgd, __pgd(0)); > +#endif > + > /* xchg acts as a barrier before setting of the high bits */ > res.pud_low = xchg(&orig->pud_low, 0); > res.pud_high = orig->pud_high; Can you rename the helper from pti_set_user_pgd() to pti_set_user_top_level_entry() or similar? The name was already a bit absurd, but now it's just nuts.