Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1710227

Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section mappings if XPFO is enabled

From Mark Rutland <mark.rutland@arm.com>
Newsgroups linux.kernel
Subject Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section mappings if XPFO is enabled
Date 2017-08-12 13:20 +0200
Message-ID <udCCu-8pQ-1@gated-at.bofh.it> (permalink)
References <ucFsJ-3Hw-3@gated-at.bofh.it> <ucFsJ-3Hw-11@gated-at.bofh.it> <udlUZ-6mk-19@gated-at.bofh.it> <udpvA-6M-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On Fri, Aug 11, 2017 at 03:13:02PM -0600, Tycho Andersen wrote:
> On Fri, Aug 11, 2017 at 10:25:14AM -0700, Laura Abbott wrote:
> > On 08/09/2017 01:07 PM, Tycho Andersen wrote:
> > > @@ -190,7 +202,7 @@ static void init_pmd(pud_t *pud, unsigned long addr, unsigned long end,
> > >  		next = pmd_addr_end(addr, end);
> > >  
> > >  		/* try section mapping first */
> > > -		if (((addr | next | phys) & ~SECTION_MASK) == 0 &&
> > > +		if (use_section_mapping(addr, next, phys) &&
> > >  		    (flags & NO_BLOCK_MAPPINGS) == 0) {
> > >  			pmd_set_huge(pmd, phys, prot);
> > >  
> > > 
> > 
> > There is already similar logic to disable section mappings for
> > debug_pagealloc at the start of map_mem, can you take advantage
> > of that?
> 
> You're suggesting something like this instead? Seems to work fine.
> 
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 38026b3ccb46..3b2c17bbbf12 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -434,6 +434,8 @@ static void __init map_mem(pgd_t *pgd)
>  
>  	if (debug_pagealloc_enabled())
>  		flags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
> +	if (IS_ENABLED(CONFIG_XPFO))
> +		flags |= NO_BLOCK_MAPPINGS;
>  

IIUC, XPFO carves out individual pages just like DEBUG_PAGEALLOC, so you'll
also need NO_CONT_MAPPINGS.

Thanks
Mark.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 06/10] arm64/mm: Disable section mappings if XPFO is enabled Tycho Andersen <tycho@docker.com> - 2017-08-09 22:10 +0200
  Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section  mappings if XPFO is enabled Laura Abbott <labbott@redhat.com> - 2017-08-11 19:30 +0200
    Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section  mappings if XPFO is enabled Tycho Andersen <tycho@docker.com> - 2017-08-11 23:20 +0200
      Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section  mappings if XPFO is enabled Tycho Andersen <tycho@docker.com> - 2017-08-12 00:00 +0200
      Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section  mappings if XPFO is enabled Mark Rutland <mark.rutland@arm.com> - 2017-08-12 13:20 +0200
        Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section  mappings if XPFO is enabled Tycho Andersen <tycho@docker.com> - 2017-08-14 18:30 +0200
          Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section  mappings if XPFO is enabled Laura Abbott <labbott@redhat.com> - 2017-08-14 20:50 +0200
            Re: [kernel-hardening] [PATCH v5 06/10] arm64/mm: Disable section  mappings if XPFO is enabled Tycho Andersen <tycho@docker.com> - 2017-08-14 22:30 +0200

csiph-web