config HAVE_ARCH_KMEMCHECK bool if HAVE_ARCH_KMEMCHECK menuconfig KMEMCHECK bool "kmemcheck: trap use of uninitialized memory" depends on DEBUG_KERNEL depends on !X86_USE_3DNOW depends on SLUB || SLAB depends on !CC_OPTIMIZE_FOR_SIZE depends on !FUNCTION_TRACER select FRAME_POINTER select STACKTRACE default n help This option enables tracing of dynamically allocated kernel memory to see if memory is used before it has been given an initial value. Be aware that this requires half of your memory for bookkeeping and will insert extra code at *every* read and write to tracked memory thus slow down the kernel code (but user code is unaffected). The kernel may be started with kmemcheck=0 or kmemcheck=1 to disable or enable kmemcheck at boot-time. If the kernel is started with kmemcheck=0, the large memory and CPU overhead is not incurred. choice prompt "kmemcheck: default mode at boot" depends on KMEMCHECK default KMEMCHECK_ONESHOT_BY_DEFAULT help This option controls the default behaviour of kmemcheck when the kernel boots and no kmemcheck= parameter is given. config KMEMCHECK_DISABLED_BY_DEFAULT bool "disabled" depends on KMEMCHECK config KMEMCHECK_ENABLED_BY_DEFAULT bool "enabled" depends on KMEMCHECK config KMEMCHECK_ONESHOT_BY_DEFAULT bool "one-shot" depends on KMEMCHECK help In one-shot mode, only the first error detected is reported before kmemcheck is disabled. endchoice config KMEMCHECK_QUEUE_SIZE int "kmemcheck: error queue size" depends on KMEMCHECK default 64 help Select the maximum number of errors to store in the queue. Since errors can occur virtually anywhere and in any context, we need a temporary storage area which is guarantueed not to generate any other faults. The queue will be emptied as soon as a tasklet may be scheduled. If the queue is full, new error reports will be lost. config KMEMCHECK_SHADOW_COPY_SHIFT int "kmemcheck: shadow copy size (5 => 32 bytes, 6 => 64 bytes)" depends on KMEMCHECK range 2 8 default 5 help Select the number of shadow bytes to save along with each entry of the queue. These bytes indicate what parts of an allocation are initialized, uninitialized, etc. and will be displayed when an error is detected to help the debugging of a particular problem. config KMEMCHECK_PARTIAL_OK bool "kmemcheck: allow partially uninitialized memory" depends on KMEMCHECK default y help This option works around certain GCC optimizations that produce 32-bit reads from 16-bit variables where the upper 16 bits are thrown away afterwards. This may of course also hide some real bugs. config KMEMCHECK_BITOPS_OK bool "kmemcheck: allow bit-field manipulation" depends on KMEMCHECK default n help This option silences warnings that would be generated for bit-field accesses where not all the bits are initialized at the same time. This may also hide some real bugs. endif href='/cgit.cgi/linux/net-next.git/commit/include?h=nds-private-remove&id=c8f325a59cfc718d13a50fbc746ed9b415c25e92'>include/memory
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-02-01 17:45:02 +0000
committerIngo Molnar <mingo@kernel.org>2017-02-01 21:17:49 +0100
commitc8f325a59cfc718d13a50fbc746ed9b415c25e92 (patch)
treed53fbdac9d0781e39a13b2ac6b2bd258cf3b4140 /include/memory
parentbf29bddf0417a4783da3b24e8c9e017ac649326f (diff)
efi/fdt: Avoid FDT manipulation after ExitBootServices()
Some AArch64 UEFI implementations disable the MMU in ExitBootServices(), after which unaligned accesses to RAM are no longer supported. Commit: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") fixed an issue in the memory map handling of the stub FDT code, but inadvertently created an issue with such firmware, by moving some of the FDT manipulation to after the invocation of ExitBootServices(). Given that the stub's libfdt implementation uses the ordinary, accelerated string functions, which rely on hardware handling of unaligned accesses, manipulating the FDT with the MMU off may result in alignment faults. So fix the situation by moving the update_fdt_memmap() call into the callback function invoked by efi_exit_boot_services() right before it calls the ExitBootServices() UEFI service (which is arguably a better place for it anyway) Note that disabling the MMU in ExitBootServices() is not compliant with the UEFI spec, and carries great risk due to the fact that switching from cached to uncached memory accesses halfway through compiler generated code (i.e., involving a stack) can never be done in a way that is architecturally safe. Fixes: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Riku Voipio <riku.voipio@linaro.org> Cc: <stable@vger.kernel.org> Cc: mark.rutland@arm.com Cc: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk Cc: leif.lindholm@linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1485971102-23330-2-git-send-email-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/memory')