From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756715AbZBTKZZ (ORCPT ); Fri, 20 Feb 2009 05:25:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753845AbZBTKZM (ORCPT ); Fri, 20 Feb 2009 05:25:12 -0500 Received: from mx3.mail.elte.hu ([157.181.1.138]:48018 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753782AbZBTKZK (ORCPT ); Fri, 20 Feb 2009 05:25:10 -0500 Date: Fri, 20 Feb 2009 11:24:34 +0100 From: Ingo Molnar To: Linus Torvalds Cc: Steven Rostedt , Huang Ying , Thomas Gleixner , Linux Kernel Mailing List , Andrew Morton , Peter Zijlstra , Frederic Weisbecker , Arjan van de Ven , Rusty Russell , Mathieu Desnoyers , "H. Peter Anvin" Subject: Re: [PATCH, v2] x86: use the right protections for split-up pagetables Message-ID: <20090220102434.GA24020@elte.hu> References: <20090220011316.379904625@goodmis.org> <20090220072915.GB28085@elte.hu> <20090220073932.GA17648@elte.hu> <20090220080246.GA28669@elte.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090220080246.GA28669@elte.hu> User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ingo Molnar wrote: > [...] There's never any good reason to play protection games > with higher-level pagetable entries. We dont do it to > user-space pagetables either - we just populate them to > _PAGE_TABLE and that's it. btw., this means that we could probably even use _PAGE_TABLE here (i.e. with the _PAGE_USER bit set), and rely on the PTE clearing the user bit ... but in this case that tiny bit of paranoia seems justified. Btw., i also checked when this bug got introduced, and it got introduced 5 years ago (in May 2004) in 2.6.7-rc1, via this commit [historic-git sha1]: fb75a3d: [PATCH] x86-64 updates Date: Fri May 14 20:40:53 2004 -0700 [...] - Handle NX bit for code pages correctly in change_page_attr() [...] - set_pte(kpte,mk_pte(split, PAGE_KERNEL)); + set_pte(kpte,mk_pte(split, ref_prot)); ( That 'set_pte(kpte,...)' sequence is not a pte update but a _pmd_ update, it is the ex-largepage pte, i.e. the pmd. ) So it's an ancient, dormant bug in the CPA code that nobody ever triggered, and we didnt notice when we rewrote that code either. Ingo