linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@ozlabs.org
Cc: aneesh.kumar@linux.vnet.ibm.com
Subject: Re: [1/6] powerpc/mm/radix: Fix off-by-one in split mapping logic
Date: Mon, 22 Oct 2018 20:39:52 +1100 (AEDT)	[thread overview]
Message-ID: <42ds1j1lVQz9sDC@ozlabs.org> (raw)
In-Reply-To: <20181019041334.4945-1-mpe@ellerman.id.au>

On Fri, 2018-10-19 at 04:13:29 UTC, Michael Ellerman wrote:
> When we have CONFIG_STRICT_KERNEL_RWX enabled, we try to split the
> kernel linear (1:1) mapping so that the kernel text is in a separate
> page to kernel data, so we can mark the former read-only.
> 
> We could achieve that just by always using 64K pages for the linear
> mapping, but we try to be smarter. Instead we use huge pages when
> possible, and only switch to smaller pages when necessary.
> 
> However we have an off-by-one bug in that logic, which causes us to
> calculate the wrong boundary between text and data.
> 
> For example with the end of the kernel text at 16M we see:
> 
>   radix-mmu: Mapped 0x0000000000000000-0x0000000001200000 with 64.0 KiB pages
>   radix-mmu: Mapped 0x0000000001200000-0x0000000040000000 with 2.00 MiB pages
>   radix-mmu: Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
> 
> ie. we mapped from 0 to 18M with 64K pages, even though the boundary
> between text and data is at 16M.
> 
> With the fix we see we're correctly hitting the 16M boundary:
> 
>   radix-mmu: Mapped 0x0000000000000000-0x0000000001000000 with 64.0 KiB pages
>   radix-mmu: Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages
>   radix-mmu: Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Series applied to powerpc next.

https://git.kernel.org/powerpc/c/5c6499b7041b43807dfaeda28aa87f

cheers

      parent reply	other threads:[~2018-10-22 10:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19  4:13 [PATCH 1/6] powerpc/mm/radix: Fix off-by-one in split mapping logic Michael Ellerman
2018-10-19  4:13 ` [PATCH 2/6] powerpc/mm/radix: Fix overuse of small pages in splitting logic Michael Ellerman
2018-10-19  4:13 ` [PATCH 3/6] powerpc/mm/radix: Fix small page at boundary when splitting Michael Ellerman
2018-10-19  4:13 ` [PATCH 4/6] powerpc/mm/radix: Remove the retry in the split mapping logic Michael Ellerman
2018-10-19  4:13 ` [PATCH 5/6] powerpc/mm/radix: Simplify " Michael Ellerman
2018-10-19  4:13 ` [PATCH 6/6] powerpc/mm/radix: Display if mappings are exec or not Michael Ellerman
2018-10-22  9:39 ` Michael Ellerman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42ds1j1lVQz9sDC@ozlabs.org \
    --to=patch-notifications@ellerman.id.au \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).