From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753649AbeDSQCd (ORCPT ); Thu, 19 Apr 2018 12:02:33 -0400 Received: from mga01.intel.com ([192.55.52.88]:20999 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753633AbeDSQCc (ORCPT ); Thu, 19 Apr 2018 12:02:32 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,469,1517904000"; d="scan'208";a="217852409" Subject: Re: [PATCH 11/11] x86/pti: leave kernel text global for !PCID To: Kees Cook References: <20180406205501.24A1A4E7@viggo.jf.intel.com> <20180406205518.E3D989EB@viggo.jf.intel.com> Cc: LKML , Linux-MM , Andrea Arcangeli , Andy Lutomirski , Linus Torvalds , Hugh Dickins , Juergen Gross , X86 ML , namit@vmware.com From: Dave Hansen Message-ID: Date: Thu, 19 Apr 2018 09:02:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/18/2018 05:11 PM, Kees Cook wrote: > On Fri, Apr 6, 2018 at 1:55 PM, Dave Hansen wrote: >> +/* >> + * For some configurations, map all of kernel text into the user page >> + * tables. This reduces TLB misses, especially on non-PCID systems. >> + */ >> +void pti_clone_kernel_text(void) >> +{ >> + unsigned long start = PFN_ALIGN(_text); >> + unsigned long end = ALIGN((unsigned long)_end, PMD_PAGE_SIZE); > I think this is too much set global: _end is after data, bss, and brk, > and all kinds of other stuff that could hold secrets. I think this > should match what mark_rodata_ro() is doing and use > __end_rodata_hpage_align. (And on i386, this should be maybe _etext.) Sounds reasonable to me. This does assume that there are no secrets built into the kernel image, right?