From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 2/2] arm64: mm: apply r/o permissions of VM areas to its linear alias as well
Date: Wed, 7 Nov 2018 14:55:11 +0000 [thread overview]
Message-ID: <20181107145510.GB2623@brain-police> (raw)
In-Reply-To: <20181107103620.16054-3-ard.biesheuvel@linaro.org>
On Wed, Nov 07, 2018 at 11:36:20AM +0100, Ard Biesheuvel wrote:
> On arm64, we use block mappings and contiguous hints to map the linear
> region, to minimize the TLB footprint. However, this means that the
> entire region is mapped using read/write permissions, which we cannot
> modify at page granularity without having to take intrusive measures to
> prevent TLB conflicts.
>
> This means the linear aliases of pages belonging to read-only mappings
> (executable or otherwise) in the vmalloc region are also mapped read/write,
> and could potentially be abused to modify things like module code, bpf JIT
> code or other read-only data.
>
> So let's fix this, by extending the set_memory_ro/rw routines to take
> the linear alias into account. The consequence of enabling this is
> that we can no longer use block mappings or contiguous hints, so in
> cases where the TLB footprint of the linear region is a bottleneck,
> performance may be affected.
>
> Therefore, allow this feature to be runtime en/disabled, by setting
> rodata=full (or 'on' to disable just this enhancement, or 'off' to
> disable read-only mappings for code and r/o data entirely) on the
> kernel command line. Also, allow the default value to be set via a
> Kconfig option.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> arch/arm64/Kconfig | 14 ++++++++++++++
> arch/arm64/include/asm/mmu_context.h | 2 ++
> arch/arm64/mm/mmu.c | 16 ++++++++++++++--
> arch/arm64/mm/pageattr.c | 15 +++++++++++++++
> 4 files changed, 45 insertions(+), 2 deletions(-)
Acked-by: Will Deacon <will.deacon@arm.com>
Thanks!
Will
next prev parent reply other threads:[~2018-11-07 14:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-07 10:36 [PATCH v4 0/2] get rid of writable linear aliases of read-only vmalloc mappings Ard Biesheuvel
2018-11-07 10:36 ` [PATCH v4 1/2] arm64: mm: purge lazily unmapped vm regions before changing permissions Ard Biesheuvel
2018-11-07 10:36 ` [PATCH v4 2/2] arm64: mm: apply r/o permissions of VM areas to its linear alias as well Ard Biesheuvel
2018-11-07 14:55 ` Will Deacon [this message]
2018-11-07 23:17 ` Laura Abbott
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=20181107145510.GB2623@brain-police \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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