brintos

brintos / linux-shallow public Read only

0
0
Text · 3.5 KiB · 6fbbebe Raw
100 lines · plain
1# SPDX-License-Identifier: GPL-2.0-only2 3config HAVE_ARCH_KFENCE4	bool5 6menuconfig KFENCE7	bool "KFENCE: low-overhead sampling-based memory safety error detector"8	depends on HAVE_ARCH_KFENCE9	select STACKTRACE10	select IRQ_WORK11	help12	  KFENCE is a low-overhead sampling-based detector of heap out-of-bounds13	  access, use-after-free, and invalid-free errors. KFENCE is designed14	  to have negligible cost to permit enabling it in production15	  environments.16 17	  See <file:Documentation/dev-tools/kfence.rst> for more details.18 19	  Note that, KFENCE is not a substitute for explicit testing with tools20	  such as KASAN. KFENCE can detect a subset of bugs that KASAN can21	  detect, albeit at very different performance profiles. If you can22	  afford to use KASAN, continue using KASAN, for example in test23	  environments. If your kernel targets production use, and cannot24	  enable KASAN due to its cost, consider using KFENCE.25 26if KFENCE27 28config KFENCE_SAMPLE_INTERVAL29	int "Default sample interval in milliseconds"30	default 10031	help32	  The KFENCE sample interval determines the frequency with which heap33	  allocations will be guarded by KFENCE. May be overridden via boot34	  parameter "kfence.sample_interval".35 36	  Set this to 0 to disable KFENCE by default, in which case only37	  setting "kfence.sample_interval" to a non-zero value enables KFENCE.38 39config KFENCE_NUM_OBJECTS40	int "Number of guarded objects available"41	range 1 6553542	default 25543	help44	  The number of guarded objects available. For each KFENCE object, 245	  pages are required; with one containing the object and two adjacent46	  ones used as guard pages.47 48config KFENCE_DEFERRABLE49	bool "Use a deferrable timer to trigger allocations"50	help51	  Use a deferrable timer to trigger allocations. This avoids forcing52	  CPU wake-ups if the system is idle, at the risk of a less predictable53	  sample interval.54 55	  Warning: The KUnit test suite fails with this option enabled - due to56	  the unpredictability of the sample interval!57 58	  Say N if you are unsure.59 60config KFENCE_STATIC_KEYS61	bool "Use static keys to set up allocations" if EXPERT62	depends on JUMP_LABEL63	help64	  Use static keys (static branches) to set up KFENCE allocations. This65	  option is only recommended when using very large sample intervals, or66	  performance has carefully been evaluated with this option.67 68	  Using static keys comes with trade-offs that need to be carefully69	  evaluated given target workloads and system architectures. Notably,70	  enabling and disabling static keys invoke IPI broadcasts, the latency71	  and impact of which is much harder to predict than a dynamic branch.72 73	  Say N if you are unsure.74 75config KFENCE_STRESS_TEST_FAULTS76	int "Stress testing of fault handling and error reporting" if EXPERT77	default 078	help79	  The inverse probability with which to randomly protect KFENCE object80	  pages, resulting in spurious use-after-frees. The main purpose of81	  this option is to stress test KFENCE with concurrent error reports82	  and allocations/frees. A value of 0 disables stress testing logic.83 84	  Only for KFENCE testing; set to 0 if you are not a KFENCE developer.85 86config KFENCE_KUNIT_TEST87	tristate "KFENCE integration test suite" if !KUNIT_ALL_TESTS88	default KUNIT_ALL_TESTS89	depends on TRACEPOINTS && KUNIT90	help91	  Test suite for KFENCE, testing various error detection scenarios with92	  various allocation types, and checking that reports are correctly93	  output to console.94 95	  Say Y here if you want the test to be built into the kernel and run96	  during boot; say M if you want the test to build as a module; say N97	  if you are unsure.98 99endif # KFENCE100