From patchwork Tue Aug 15 03:51:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tycho Andersen X-Patchwork-Id: 9900869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D7566038C for ; Tue, 15 Aug 2017 03:51:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EE4F286D7 for ; Tue, 15 Aug 2017 03:51:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 123362873A; Tue, 15 Aug 2017 03:51:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 5577C28711 for ; Tue, 15 Aug 2017 03:51:53 +0000 (UTC) Received: (qmail 9449 invoked by uid 550); 15 Aug 2017 03:51:52 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 9419 invoked from network); 15 Aug 2017 03:51:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=docker.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=d7ZC7v8u9NynWPQXly3tIpA/v81dYs2GXY8j/A0jLZI=; b=FzBXt9xmaLDNYtIwi8Giryg9MKTWSVrPUXXGVwAgDc4rT7uTxPoCNhbRTmWf391sP6 x8e2qsrzoLuXDR9hy04MHrHsomxQQfiOSVZLSPbTIPF+fZZp++iBB0DYK2UWE8jtQTlH eKNyoEjs3IQq7Gl0rPkUHU4k0lxuTAtDjXnhE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=d7ZC7v8u9NynWPQXly3tIpA/v81dYs2GXY8j/A0jLZI=; b=X8O1j/QCyAc+6aFd4mdg7sqART2F7cRSKrYnJRWT2OJ/9Psysi/ER1AgFP8aoI7a9r lTogdS4OEUJIBB1gspdpO+tWyGTZNyj4P/7BLNBgcGlbwEqWOw2w3HN/AKD/xyEGKche BZgkzzQiVPiJgP+caIRlFiphWNq/yctV72iPhjuEHu+7LaWs83KxDrqm6xT++th30Oec UMYEUcPccnfI5DFNGuKEFPFAPt32tAYuKtnovt++59Soy2upFxKw+MUoJkG+4Hp4Xakn qDZyd4aYFoBfSQBy3ZCRYntQfLfUckfWtHqgCsYnuuBOHF0VKIW38P3z6MmNkrS78oXt /Z1Q== X-Gm-Message-State: AHYfb5hdqRdKBYlvTaJODYXnWFzxfjPbK5tcQecBzWkM6RB87hOP5iSG Xm3yfqnSaogQkjHv X-Received: by 10.36.69.138 with SMTP id c10mr942331itd.149.1502769099913; Mon, 14 Aug 2017 20:51:39 -0700 (PDT) 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 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-Disposition: inline In-Reply-To: <20170815034718.o6fej2gqkmypxtl2@smitten> User-Agent: NeoMutt/20170113 (1.7.2) Subject: [kernel-hardening] Re: [PATCH v5 02/10] mm, x86: Add support for eXclusive Page Frame Ownership (XPFO) X-Virus-Scanned: ClamAV using ClamSMTP 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(), Tycho 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;