Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1272187rwd; Wed, 31 May 2023 11:35:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7RfR7a7c5MiDWNNnFpZ31e+FItCyNVO4Gy3IqwBoMnMvf7bNmSzYa5zy+Hzt1t4b/4ewfQ X-Received: by 2002:a17:90b:2301:b0:256:797b:5039 with SMTP id mt1-20020a17090b230100b00256797b5039mr6459589pjb.9.1685558117034; Wed, 31 May 2023 11:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685558117; cv=none; d=google.com; s=arc-20160816; b=A+s/H4USfF7mB6/IMZZ48MwmQ0jUgH3srVys8l4M2y0/hfKpWMX/DI3JM2cugL72zT RMhB78moc/znW0UkWfuEeLjP5CHRVy83m5L8sq6O1OVPqgx80LUIcMKAsTYQn/E8rve0 cpBYrmsabbh85fw/D3KkmjWoeoITDhJ/lDkwxjPYeptvDJGVtDP47drxA4Z7wPU5esMG u5YoOKO7hhHWc9IV6Zx2Kp/FSI1Nisfz7skUW4BYForM5pUnrgeLCqUWWcw2c+IFCd0O 6g1WAe7e9Uobw2QFQw6501HVBeEGZUfxDGNGxm0PLAYHR/wXiUVci6NbEXTMFj+8qWmA YwTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ShXFZDFEDmPlX5Y3XBvXdK5GQ9yQ1nqotnDFM/A0v50=; b=TgyPOCK7NmOJfVWO/Dp6td1MdcxH7kRoEBnFW7iWvmubty8izuwMeD6LaEccYoKWIP xuGb2nxZNNBKpe1UfODlW6qsF7BRy+l60JMy10u06wGEIYcPh0Ssjf9NFJ2u5nFba72Q hiZ7dxwfWNqbky6PjCkwsYA0eSwbiCXSWIr8JiOyYAIjFJGWAqPXbiv6rQv/C6L7wtjJ qdBNnwjTKpqH3nsMtGZzbEWMAylaWVbueYfA+pLI4vpd7dlAm6QYXvPFOwQqEvMY1liW lqQAImXN/BhS1iihE9x57xykkd6mOLbrvNCVEwfT0Y3UpTx7w5Jj3EjDyUEAg2PBSDbz wfdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@alien8.de header.s=dkim header.b=pSEmarCJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y5-20020a17090a134500b0025546028cbesi1423401pjf.31.2023.05.31.11.35.04; Wed, 31 May 2023 11:35:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@alien8.de header.s=dkim header.b=pSEmarCJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230130AbjEaSOd (ORCPT + 99 others); Wed, 31 May 2023 14:14:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230124AbjEaSOa (ORCPT ); Wed, 31 May 2023 14:14:30 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CAE9132 for ; Wed, 31 May 2023 11:14:19 -0700 (PDT) Received: from zn.tnic (pd9530d32.dip0.t-ipconnect.de [217.83.13.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 9779C1EC042D; Wed, 31 May 2023 20:14:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1685556857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ShXFZDFEDmPlX5Y3XBvXdK5GQ9yQ1nqotnDFM/A0v50=; b=pSEmarCJ7ae6RE2dRKTy4kIE02HMibao+y7kGU9agAA2DuF8wAfoL5qq1I+OlPHwsjAX8h c43XOwoKhOSLLUUBEzqTdf3i49wT0Excdpw2bFcleHfp+yxHzMJqYSc8wNl6UpluFmcUYq WO9QuqV6jYjwZkzRbDAZ7cGF6gVIWU8= Date: Wed, 31 May 2023 20:14:12 +0200 From: Borislav Petkov To: Janusz Krzysztofik , Juergen Gross Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Morton , David Hildenbrand , Yu Zhao , linux-kernel@vger.kernel.org, Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= , Andi Shyti , drm-intel@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: Re: [RESUBMIT][PATCH] x86/mm: Fix PAT bit missing from page protection modify mask Message-ID: <20230531181412.GFZHeOdMHIGOXB2hwL@fat_crate.local> References: <20230519183634.190364-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230519183634.190364-1-janusz.krzysztofik@linux.intel.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 19, 2023 at 08:36:34PM +0200, Janusz Krzysztofik wrote: > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h > index 15ae4d6ba4768..56466afd04307 100644 > --- a/arch/x86/include/asm/pgtable.h > +++ b/arch/x86/include/asm/pgtable.h > @@ -654,8 +654,10 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) > #define pgprot_modify pgprot_modify > static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) > { > - pgprotval_t preservebits = pgprot_val(oldprot) & _PAGE_CHG_MASK; > - pgprotval_t addbits = pgprot_val(newprot) & ~_PAGE_CHG_MASK; > + unsigned long mask = _PAGE_CHG_MASK | _PAGE_CACHE_MASK; > + > + pgprotval_t preservebits = pgprot_val(oldprot) & mask; > + pgprotval_t addbits = pgprot_val(newprot) & ~mask; > return __pgprot(preservebits | addbits); > } > > -- This certainly needs Jürgen and he's on CC already, moving him to To:. Also, why isn't this a Xen-specific fix but you're keeping _PAGE_PAT for baremetal too, i.e., modifying the generic function? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette