arm64: mm: apply r/o permissions of VM areas to its linear alias as well
Ard Biesheuvel authored

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.
Tested-by: default avatarLaura Abbott <labbott@redhat.com>
Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
c55191e9
Name Last commit Last update
Documentation Merge tag 'pm-4.20-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
LICENSES Merge tag 'docs-4.20' of git://git.lwn.net/linux
arch arm64: mm: apply r/o permissions of VM areas to its linear alias as well
block SCSI: fix queue cleanup race before queue initialization is done
certs export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR()
crypto crypto: user - Zeroize whole structure given to user space
drivers Merge tag 'libnvdimm-fixes-4.20-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
firmware kbuild: remove all dummy assignments to obj-
fs ocfs2: free up write context when direct IO failed
include Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
init memblock: stop using implicit alignment to SMP_CACHE_BYTES
ipc ipc: IPCMNI limit check for semmni
kernel Merge branch 'akpm' (patches from Andrew)
lib lib/ubsan.c: don't mark __ubsan_handle_builtin_unreachable as noreturn
mm mm/memblock.c: fix a typo in __next_mem_pfn_range() comments
net Merge tag 'nfs-for-4.20-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
samples Merge tag 'vfio-v4.20-rc1.v2' of git://github.com/awilliam/linux-vfio
scripts scripts/spdxcheck.py: make python3 compliant
security Merge tag 'selinux-pr-20181115' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
sound ALSA: hda - Fix incorrect clearance of thinkpad_acpi hooks
tools Merge tag 'libnvdimm-fixes-4.20-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
usr initramfs: move gen_initramfs_list.sh from scripts/ to usr/
virt Revert "mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks"
.clang-format page cache: Convert find_get_pages_contig to XArray
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.