2012-04-20 14:45:54 +01:00
|
|
|
menu "Kernel hacking"
|
|
|
|
|
|
|
|
source "lib/Kconfig.debug"
|
|
|
|
|
2014-11-26 00:28:39 +00:00
|
|
|
config ARM64_PTDUMP
|
|
|
|
bool "Export kernel pagetable layout to userspace via debugfs"
|
|
|
|
depends on DEBUG_KERNEL
|
|
|
|
select DEBUG_FS
|
|
|
|
help
|
|
|
|
Say Y here if you want to show the kernel pagetable layout in a
|
|
|
|
debugfs file. This information is only useful for kernel developers
|
|
|
|
who are working in architecture specific areas of the kernel.
|
|
|
|
It is probably not a good idea to enable this feature in a production
|
|
|
|
kernel.
|
|
|
|
If in doubt, say "N"
|
|
|
|
|
2014-04-05 01:30:50 +01:00
|
|
|
config STRICT_DEVMEM
|
|
|
|
bool "Filter access to /dev/mem"
|
|
|
|
depends on MMU
|
|
|
|
help
|
|
|
|
If this option is disabled, you allow userspace (root) access to all
|
|
|
|
of memory, including kernel and userspace memory. Accidental
|
|
|
|
access to this is obviously disastrous, but specific access can
|
|
|
|
be used by people debugging the kernel.
|
|
|
|
|
|
|
|
If this option is switched on, the /dev/mem file only allows
|
|
|
|
userspace access to memory mapped peripherals.
|
|
|
|
|
|
|
|
If in doubt, say Y.
|
|
|
|
|
2013-01-17 12:31:45 +00:00
|
|
|
config PID_IN_CONTEXTIDR
|
|
|
|
bool "Write the current PID to the CONTEXTIDR register"
|
|
|
|
help
|
|
|
|
Enabling this option causes the kernel to write the current PID to
|
|
|
|
the CONTEXTIDR register, at the expense of some additional
|
|
|
|
instructions during context switch. Say Y here only if you are
|
|
|
|
planning to use hardware trace tools with this kernel.
|
|
|
|
|
2014-06-24 16:51:37 +01:00
|
|
|
config ARM64_RANDOMIZE_TEXT_OFFSET
|
|
|
|
bool "Randomize TEXT_OFFSET at build time"
|
|
|
|
help
|
|
|
|
Say Y here if you want the image load offset (AKA TEXT_OFFSET)
|
|
|
|
of the kernel to be randomized at build-time. When selected,
|
|
|
|
this option will cause TEXT_OFFSET to be randomized upon any
|
|
|
|
build of the kernel, and the offset will be reflected in the
|
|
|
|
text_offset field of the resulting Image. This can be used to
|
|
|
|
fuzz-test bootloaders which respect text_offset.
|
|
|
|
|
|
|
|
This option is intended for bootloader and/or kernel testing
|
|
|
|
only. Bootloaders must make no assumptions regarding the value
|
|
|
|
of TEXT_OFFSET and platforms must not require a specific
|
|
|
|
value.
|
|
|
|
|
2014-08-19 20:41:43 +01:00
|
|
|
config DEBUG_SET_MODULE_RONX
|
|
|
|
bool "Set loadable kernel module data as NX and text as RO"
|
|
|
|
depends on MODULES
|
|
|
|
help
|
|
|
|
This option helps catch unintended modifications to loadable
|
|
|
|
kernel module's text and read-only data. It also prevents execution
|
|
|
|
of module data. Such protection may interfere with run-time code
|
|
|
|
patching and dynamic kernel tracing - and they might also protect
|
|
|
|
against certain classes of kernel exploits.
|
|
|
|
If in doubt, say "N".
|
|
|
|
|
2015-01-21 17:36:06 -08:00
|
|
|
config DEBUG_RODATA
|
|
|
|
bool "Make kernel text and rodata read-only"
|
UPSTREAM: arm64: enable CONFIG_DEBUG_RODATA by default
(Cherry picked from commit 57efac2f7108e3255d0dfe512290c9896f4ed55f)
In spite of its name, CONFIG_DEBUG_RODATA is an important hardening feature
for production kernels, and distros all enable it by default in their
kernel configs. However, since enabling it used to result in more granular,
and thus less efficient kernel mappings, it is not enabled by default for
performance reasons.
However, since commit 2f39b5f91eb4 ("arm64: mm: Mark .rodata as RO"), the
various kernel segments (.text, .rodata, .init and .data) are already
mapped individually, and the only effect of setting CONFIG_DEBUG_RODATA is
that the existing .text and .rodata mappings are updated late in the boot
sequence to have their read-only attributes set, which means that any
performance concerns related to enabling CONFIG_DEBUG_RODATA are no longer
valid.
So from now on, make CONFIG_DEBUG_RODATA default to 'y'
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2016-03-03 15:10:59 +01:00
|
|
|
default y
|
2015-01-21 17:36:06 -08:00
|
|
|
help
|
|
|
|
If this is set, kernel text and rodata will be made read-only. This
|
|
|
|
is to help catch accidental or malicious attempts to change the
|
UPSTREAM: arm64: enable CONFIG_DEBUG_RODATA by default
(Cherry picked from commit 57efac2f7108e3255d0dfe512290c9896f4ed55f)
In spite of its name, CONFIG_DEBUG_RODATA is an important hardening feature
for production kernels, and distros all enable it by default in their
kernel configs. However, since enabling it used to result in more granular,
and thus less efficient kernel mappings, it is not enabled by default for
performance reasons.
However, since commit 2f39b5f91eb4 ("arm64: mm: Mark .rodata as RO"), the
various kernel segments (.text, .rodata, .init and .data) are already
mapped individually, and the only effect of setting CONFIG_DEBUG_RODATA is
that the existing .text and .rodata mappings are updated late in the boot
sequence to have their read-only attributes set, which means that any
performance concerns related to enabling CONFIG_DEBUG_RODATA are no longer
valid.
So from now on, make CONFIG_DEBUG_RODATA default to 'y'
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2016-03-03 15:10:59 +01:00
|
|
|
kernel's executable code.
|
2015-01-21 17:36:06 -08:00
|
|
|
|
UPSTREAM: arm64: enable CONFIG_DEBUG_RODATA by default
(Cherry picked from commit 57efac2f7108e3255d0dfe512290c9896f4ed55f)
In spite of its name, CONFIG_DEBUG_RODATA is an important hardening feature
for production kernels, and distros all enable it by default in their
kernel configs. However, since enabling it used to result in more granular,
and thus less efficient kernel mappings, it is not enabled by default for
performance reasons.
However, since commit 2f39b5f91eb4 ("arm64: mm: Mark .rodata as RO"), the
various kernel segments (.text, .rodata, .init and .data) are already
mapped individually, and the only effect of setting CONFIG_DEBUG_RODATA is
that the existing .text and .rodata mappings are updated late in the boot
sequence to have their read-only attributes set, which means that any
performance concerns related to enabling CONFIG_DEBUG_RODATA are no longer
valid.
So from now on, make CONFIG_DEBUG_RODATA default to 'y'
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2016-03-03 15:10:59 +01:00
|
|
|
If in doubt, say Y
|
2015-01-21 17:36:06 -08:00
|
|
|
|
|
|
|
config DEBUG_ALIGN_RODATA
|
arm64: simplify kernel segment mapping granularity
The mapping of the kernel consist of four segments, each of which is mapped
with different permission attributes and/or lifetimes. To optimize the TLB
and translation table footprint, we define various opaque constants in the
linker script that resolve to different aligment values depending on the
page size and whether CONFIG_DEBUG_ALIGN_RODATA is set.
Considering that
- a 4 KB granule kernel benefits from a 64 KB segment alignment (due to
the fact that it allows the use of the contiguous bit),
- the minimum alignment of the .data segment is THREAD_SIZE already, not
PAGE_SIZE (i.e., we already have padding between _data and the start of
the .data payload in many cases),
- 2 MB is a suitable alignment value on all granule sizes, either for
mapping directly (level 2 on 4 KB), or via the contiguous bit (level 3 on
16 KB and 64 KB),
- anything beyond 2 MB exceeds the minimum alignment mandated by the boot
protocol, and can only be mapped efficiently if the physical alignment
happens to be the same,
we can simplify this by standardizing on 64 KB (or 2 MB) explicitly, i.e.,
regardless of granule size, all segments are aligned either to 64 KB, or to
2 MB if CONFIG_DEBUG_ALIGN_RODATA=y. This also means we can drop the Kconfig
dependency of CONFIG_DEBUG_ALIGN_RODATA on CONFIG_ARM64_4K_PAGES.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 97740051dd31d200a0efaa84544fe5e4713aac40)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-03-30 17:43:09 +02:00
|
|
|
depends on DEBUG_RODATA
|
2015-01-21 17:36:06 -08:00
|
|
|
bool "Align linker sections up to SECTION_SIZE"
|
|
|
|
help
|
|
|
|
If this option is enabled, sections that may potentially be marked as
|
|
|
|
read only or non-executable will be aligned up to the section size of
|
|
|
|
the kernel. This prevents sections from being split into pages and
|
|
|
|
avoids a potential TLB penalty. The downside is an increase in
|
|
|
|
alignment and potentially wasted space. Turn on this option if
|
|
|
|
performance is more important than memory pressure.
|
|
|
|
|
|
|
|
If in doubt, say N
|
|
|
|
|
2014-06-25 17:17:35 -07:00
|
|
|
config FORCE_PAGES
|
|
|
|
bool "Force lowmem to be mapped with 4K pages"
|
|
|
|
help
|
|
|
|
There are some advanced debug features that can only be done when
|
|
|
|
memory is mapped with pages instead of sections. Enable this option
|
|
|
|
to always map lowmem pages with pages. This may have a performance
|
|
|
|
cost due to increased TLB pressure.
|
|
|
|
|
|
|
|
If unsure say N.
|
|
|
|
|
2014-06-30 14:47:51 -07:00
|
|
|
config FREE_PAGES_RDONLY
|
|
|
|
bool "Set pages as read only while on the buddy list"
|
|
|
|
select FORCE_PAGES
|
|
|
|
select DEBUG_PAGEALLOC
|
|
|
|
help
|
|
|
|
Pages are always mapped in the kernel. This means that anyone
|
|
|
|
can write to the page if they have the address. Enable this option
|
|
|
|
to mark pages as read only to trigger a fault if any code attempts
|
|
|
|
to write to a page on the buddy list. This may have a performance
|
|
|
|
impact.
|
|
|
|
|
|
|
|
If unsure, say N.
|
|
|
|
|
2014-10-31 20:53:08 -07:00
|
|
|
config KERNEL_TEXT_RDONLY
|
|
|
|
bool "Set kernel text section pages as read only"
|
|
|
|
depends on FREE_PAGES_RDONLY
|
2017-05-12 08:47:47 -07:00
|
|
|
depends on !DEBUG_RODATA
|
2014-10-31 20:53:08 -07:00
|
|
|
help
|
|
|
|
The kernel text pages are always mapped in the kernel.
|
|
|
|
This means that anyone can write to the page if they have
|
|
|
|
the address. Enable this option to mark the kernel text pages
|
|
|
|
as read only to trigger a fault if any code attempts to write
|
|
|
|
to a page part of the kernel text section. This may have a
|
|
|
|
performance impact.
|
|
|
|
|
|
|
|
If unsure, say N.
|
|
|
|
|
2014-08-29 18:28:54 +01:00
|
|
|
config ARM64_STRICT_BREAK_BEFORE_MAKE
|
|
|
|
bool "Enforce strict break-before-make on page table updates "
|
|
|
|
|
2015-03-30 14:13:41 -06:00
|
|
|
source "drivers/hwtracing/coresight/Kconfig"
|
2015-03-30 14:13:36 -06:00
|
|
|
|
2012-04-20 14:45:54 +01:00
|
|
|
endmenu
|