Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) # SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) config HAVE_ARCH_KFENCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 	bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) menuconfig KFENCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 	bool "KFENCE: low-overhead sampling-based memory safety error detector"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 	depends on HAVE_ARCH_KFENCE && (SLAB || SLUB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 	select STACKTRACE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	select IRQ_WORK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	  KFENCE is a low-overhead sampling-based detector of heap out-of-bounds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	  access, use-after-free, and invalid-free errors. KFENCE is designed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	  to have negligible cost to permit enabling it in production
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	  environments.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	  See <file:Documentation/dev-tools/kfence.rst> for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	  Note that, KFENCE is not a substitute for explicit testing with tools
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	  such as KASAN. KFENCE can detect a subset of bugs that KASAN can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	  detect, albeit at very different performance profiles. If you can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	  afford to use KASAN, continue using KASAN, for example in test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	  environments. If your kernel targets production use, and cannot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	  enable KASAN due to its cost, consider using KFENCE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) if KFENCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) config KFENCE_STATIC_KEYS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	bool "Use static keys to set up allocations"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	default y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	depends on JUMP_LABEL # To ensure performance, require jump labels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	  Use static keys (static branches) to set up KFENCE allocations. Using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	  static keys is normally recommended, because it avoids a dynamic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	  branch in the allocator's fast path. However, with very low sample
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	  intervals, or on systems that do not support jump labels, a dynamic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	  branch may still be an acceptable performance trade-off.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) config KFENCE_SAMPLE_INTERVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	int "Default sample interval in milliseconds"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	default 100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	  The KFENCE sample interval determines the frequency with which heap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	  allocations will be guarded by KFENCE. May be overridden via boot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	  parameter "kfence.sample_interval".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	  Set this to 0 to disable KFENCE by default, in which case only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	  setting "kfence.sample_interval" to a non-zero value enables KFENCE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) config KFENCE_NUM_OBJECTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	int "Number of guarded objects available"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	range 1 65535
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	default 255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	  The number of guarded objects available. For each KFENCE object, 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	  pages are required; with one containing the object and two adjacent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	  ones used as guard pages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) config KFENCE_STRESS_TEST_FAULTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	int "Stress testing of fault handling and error reporting" if EXPERT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	default 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	  The inverse probability with which to randomly protect KFENCE object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	  pages, resulting in spurious use-after-frees. The main purpose of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	  this option is to stress test KFENCE with concurrent error reports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	  and allocations/frees. A value of 0 disables stress testing logic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	  Only for KFENCE testing; set to 0 if you are not a KFENCE developer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) config KFENCE_KUNIT_TEST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	tristate "KFENCE integration test suite" if !KUNIT_ALL_TESTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	default KUNIT_ALL_TESTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	depends on TRACEPOINTS && KUNIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	  Test suite for KFENCE, testing various error detection scenarios with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	  various allocation types, and checking that reports are correctly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	  output to console.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	  Say Y here if you want the test to be built into the kernel and run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 	  during boot; say M if you want the test to build as a module; say N
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 	  if you are unsure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) endif # KFENCE