Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753366AbdHODvm (ORCPT ); Mon, 14 Aug 2017 23:51:42 -0400 Received: from mail-it0-f45.google.com ([209.85.214.45]:38430 "EHLO mail-it0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753249AbdHODvk (ORCPT ); Mon, 14 Aug 2017 23:51:40 -0400 Date: Mon, 14 Aug 2017 21:51:38 -0600 From: Tycho Andersen To: Laura Abbott Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com, Marco Benatto , Juerg Haefliger , Juerg Haefliger Subject: Re: [PATCH v5 02/10] mm, x86: Add support for eXclusive Page Frame Ownership (XPFO) Message-ID: <20170815035138.qylh4mhpqom5g6qx@smitten> References: <20170809200755.11234-1-tycho@docker.com> <20170809200755.11234-3-tycho@docker.com> <910adbb5-c5d7-3091-1c92-996f73dd6221@redhat.com> <20170815034718.o6fej2gqkmypxtl2@smitten> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170815034718.o6fej2gqkmypxtl2@smitten> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 827 Lines: 28 On Mon, Aug 14, 2017 at 09:47:18PM -0600, Tycho Andersen wrote: > I'll do that for the next version Actually looking closer, I think we just need to mirror the debug_pagealloc_enabled() checks in set_kpte() from split_large_page(), diff --git a/arch/x86/mm/xpfo.c b/arch/x86/mm/xpfo.c index a1344f27406c..c962bd7f34cc 100644 --- a/arch/x86/mm/xpfo.c +++ b/arch/x86/mm/xpfo.c @@ -54,9 +54,11 @@ inline void set_kpte(void *kaddr, struct page *page, pgprot_t prot) do_split = try_preserve_large_page(pte, (unsigned long)kaddr, &cpa); if (do_split) { - spin_lock(&cpa_lock); + if (!debug_pagealloc_enabled()) + spin_lock(&cpa_lock); BUG_ON(split_large_page(&cpa, pte, (unsigned long)kaddr)); - spin_unlock(&cpa_lock); + if (!debug_pagealloc_enabled()) + spin_unlock(&cpa_lock); } break; Tycho