287 lines
20 KiB
TeX
287 lines
20 KiB
TeX
%since Linux 6.14
|
|
% linux_configuration_09_general_architecture-dependent_options.tex
|
|
|
|
\section{General architecture-dependent options \texorpdfstring{$\rightarrow$}{->}}
|
|
(Allgemeine architekturabhängige Optionen)
|
|
|
|
\subsection{Kprobes}
|
|
CONFIG\_KPROBES [=y] \textbf{[Y]}\\
|
|
Mit Kprobes können Sie an fast jeder Kerneladresse trappen und eine Callback-Funktion ausführen.
|
|
register\_kprobe() legt einen Probepoint fest und spezifiziert den Callback.
|
|
Kprobes ist nützlich für Kernel-Debugging, nicht-intrusive Instrumentierung und Tests.\\
|
|
Im Zweifelsfall sagen Sie N.
|
|
\english{Kprobes allows you to trap at almost any kernel address and execute a callback function.
|
|
register\_kprobe() establishes a probepoint and specifies the callback.
|
|
Kprobes is useful for kernel debugging, non-intrusive instrumentation and testing.
|
|
If in doubt, say ``N''.}
|
|
|
|
\subsection{Optimize very unlikely/likely branches}
|
|
CONFIG\_JUMP\_LABEL [=y] \textbf{[Y]}\\
|
|
Diese Option ermöglicht eine transparente Verzweigungsoptimierung, die die Ausführung bestimmter
|
|
fast-immer-wahrer oder fast-immer-falscher Verzweigungsbedingungen im Kernel noch billiger macht.
|
|
Bestimmte leistungsempfindliche Kernel-Codes wie Trace-Points, Scheduler-Funktionen, Netzwerk-Code
|
|
und KVM haben solche Verzweigungen und bieten Unterstützung für diese Optimierungstechnik.
|
|
Wenn festgestellt wird, dass der Compiler \glqq asm goto\grqq{} unterstützt, kompiliert der Kernel
|
|
solche Verzweigungen mit einer einfachen nop-Anweisung. Wenn das Bedingungsflag auf true gesetzt wird,
|
|
wird der nop-Befehl in einen Sprungbefehl umgewandelt, um den bedingten Befehlsblock auszuführen.
|
|
Diese Technik senkt den Overhead und die Belastung der Verzweigungsvorhersage des Prozessors und macht
|
|
den Kernel im Allgemeinen schneller. Die Aktualisierung der Bedingung ist zwar langsamer, aber das
|
|
kommt immer sehr selten vor. (Bei 32-Bit-x86 können die erforderlichen Optionen, die zu den
|
|
Compiler-Flags hinzugefügt werden, die Größe des Kernels leicht erhöhen).
|
|
\english{This option enables a transparent branch optimization that makes certain almost-always-true or almost-always-false branch
|
|
conditions even cheaper to execute within the kernel.\\
|
|
Certain performance-sensitive kernel code, such as trace points, scheduler functionality,
|
|
networking code and KVM have such branches and include support for this optimization technique.\\
|
|
If it is detected that the compiler has support for ``asm goto'', the kernel will compile such branches with just a nop instruction.
|
|
When the condition flag is toggled to true, the nop will be converted to a jump instruction to execute the conditional block of instructions.\\
|
|
This technique lowers overhead and stress on the branch prediction of the processor and generally makes the kernel faster.
|
|
The update of the condition is slower, but those are always very rare.\\
|
|
( On 32-bit x86, the necessary options added to the compiler flags may increase the size of the kernel slightly. )}
|
|
|
|
\subsubsection{Static key selftest}
|
|
CONFIG\_STATIC\_KEYS\_SELFTEST [=n] \textbf{[N]}\\
|
|
Bootzeit-Selbsttest des Branch-Patching-Codes.
|
|
\english{Boot time self-test of the branch patching code.}
|
|
|
|
\subsection{Static call selftest}
|
|
CONFIG\_STATIC\_CALL\_SELFTEST [=n] \textbf{[N]}\\
|
|
Bootzeit-Selbsttest des Call-Patching-Codes.
|
|
\english{Boot time self-test of the call patching code.}
|
|
|
|
\subsection{Enable seccomp to safely execute untrusted bytecode}
|
|
CONFIG\_SECCOMP [=n] \textbf{[N]}\\
|
|
Diese Kernel-Funktion ist nützlich für numerische Anwendungen, die während ihrer Ausführung
|
|
mit nicht vertrauenswürdigem Bytecode umgehen müssen. Durch die Verwendung von Pipes oder anderen
|
|
Transporten, die dem Prozess als Dateideskriptoren zur Verfügung gestellt werden und die
|
|
Lese-/Schreib-Syscalls unterstützen, ist es möglich, diese Anwendungen mit seccomp in ihrem eigenen
|
|
Adressraum zu isolieren. Sobald seccomp über prctl(PR\_SET\_SECCOMP) oder den seccomp()-Syscall
|
|
aktiviert ist, kann es nicht mehr deaktiviert werden, und die Task darf nur einige wenige sichere
|
|
Syscalls ausführen, die für jeden seccomp-Modus definiert sind. Wenn Sie unsicher sind, sagen Sie Y.
|
|
\english{This kernel feature is useful for number crunching applications that may need to handle untrusted bytecode during their execution.
|
|
By using pipes or other transports made available to the process as file descriptors supporting the read/write syscalls,
|
|
it's possible to isolate those applications in their own address space using seccomp.
|
|
Once seccomp is enabled via prctl(PR\_SET\_SECCOMP) or the seccomp() syscall, it cannot be disabled and the task is only allowed to execute
|
|
a few safe syscalls defined by each seccomp mode.\\
|
|
If unsure, say Y.}
|
|
|
|
\subsubsection{Show seccomp filter cache status in /proc/pid/seccomp\_cache}
|
|
CONFIG\_SECCOMP\_CACHE\_DEBUG [=n] \textbf{[N]}\\
|
|
Dies ermöglicht der Schnittstelle /proc/pid/seccomp\_cache die Überwachung der
|
|
seccomp-Cache-Daten. Das Dateiformat kann sich ändern. Zum Lesen der Datei ist
|
|
CAP\_SYS\_ADMIN erforderlich. Diese Option ist nur zur Fehlersuche gedacht.
|
|
Die Aktivierung birgt das Risiko, dass ein Angreifer die seccomp-Filterlogik ableiten kann.\\
|
|
Wenn Sie unsicher sind, sagen Sie N.
|
|
\english{This enables the /proc/pid/seccomp\_cache interface to monitor seccomp cache data.
|
|
The file format is subject to change.
|
|
Reading the file requires CAP\_SYS\_ADMIN.\\
|
|
This option is for debugging only.
|
|
Enabling presents the risk that an adversary may be able to infer the seccomp filter logic.\\
|
|
If unsure, say N.}
|
|
|
|
\subsection{Stack Protector buffer overflow detection}
|
|
CONFIG\_STACKPROTECTOR [=y] \textbf{[Y]}\\
|
|
Diese Option schaltet die GCC-Funktion \glqq stack-protector\grqq{} ein.
|
|
Diese Funktion legt am Anfang von Funktionen einen Canary-Wert (Kanarienvogelwert) auf den
|
|
Stack kurz vor der
|
|
Rücksprungadresse und überprüft den Wert kurz vor der eigentlichen Rückkehr. Stack-basierte
|
|
Pufferüberläufe (die diese Rücksprungadresse überschreiben müssen) überschreiben nun auch den
|
|
Canary-Wert, was erkannt wird und der Angriff wird dann durch eine Kernel-Panik neutralisiert.
|
|
Bei Funktionen, die ein 8-Byte- oder größeres Zeichenarray auf dem Stack haben, wird die Logik
|
|
des Stack-Protector-Canarys hinzugefügt. Diese Funktion erfordert gcc Version 4.2 oder höher,
|
|
oder eine gcc-Distribution, die die Funktion zurückportiert hat (\texttt{-fstack-protector}).
|
|
Auf einem x86-\glqq defconfig\grqq{}-Build fügt diese Funktion Canary-Prüfungen zu etwa \qty{3}{\percent}
|
|
aller Kernel-Funktionen hinzu, was die Kernel-Codegröße um etwa \qty{0,3}{\percent} erhöht.
|
|
\english{This option turns on the ``stack-protector'' GCC feature.
|
|
This feature puts, at the beginning of functions, a canary value on the stack just before the return address,
|
|
and validates the value just before actually returning.
|
|
Stack based buffer overflows (that need to overwrite this return address) now also overwrite the canary, which gets detected
|
|
and the attack is then neutralized via a kernel panic.\\
|
|
Functions will have the stack-protector canary logic added if they have an 8-byte or larger character array on the stack.\\
|
|
This feature requires gcc version 4.2 or above, or a distribution gcc with the feature backported (``-fstack-protector'').
|
|
On an x86 ``defconfig'' build, this feature adds canary checks to about 3\% of all kernel functions,
|
|
which increases kernel code size by about 0.3\%.}
|
|
|
|
\subsubsection{Strong Stack Protector}
|
|
CONFIG\_STACKPROTECTOR\_STRONG [=y] \textbf{[Y]}\\
|
|
Bei Funktionen wird die Stack-Protector-Canary-Logik unter einer der folgenden Bedingungen hinzugefügt:
|
|
\begin{itemize}
|
|
\item[-] die Adresse einer lokalen Variablen wird als Teil der rechten Seite einer Zuweisung oder eines
|
|
Funktionsarguments verwendet
|
|
\item[-] die lokale Variable ist ein Array (oder eine Union, die ein Array enthält), unabhängig von Typ oder Länge des Arrays
|
|
\item[-] Lokale Variablen werden als Register verwendet
|
|
\end{itemize}
|
|
Diese Funktion erfordert gcc Version 4.9 oder höher, oder eine gcc-Distribution, die die Funktion
|
|
zurück\-por\-tiert hat (\texttt{-fstack-protector-strong}).
|
|
Auf einem x86-\glqq defconfig\grqq{}-Build fügt diese Funktion Canary-Prüfungen zu etwa \qty{20}{\percent} aller
|
|
Kernel-Funktionen hinzu, was die Größe des Kernel-Codes um etwa \qty{2}{\percent} erhöht.
|
|
\english{Functions will have the stack-protector canary logic added in any of the following conditions:\\
|
|
-- local variable's address used as part of the right hand side of an assignment or function argument\\
|
|
-- local variable is an array (or union containing an array), regardless of array type or length\\
|
|
-- uses register local variables\\
|
|
This feature requires gcc version 4.9 or above, or a distribution gcc with the feature backported (``-fstack-protector-strong'').\\
|
|
On an x86 ``defconfig'' build, this feature adds canary checks to about 20\% of all kernel functions,
|
|
which increases the kernel code size by about 2\%.}
|
|
|
|
\subsection{Link Time Optimization (LTO) () \texorpdfstring{$\rightarrow$}{->}}
|
|
\textit{Optimierung der Verbindungszeit}
|
|
Diese Option aktiviert die Verbindungszeitoptimierung (Link Time Optimization, LTO), die es dem Compiler ermöglicht, Binärdateien global zu optimieren.
|
|
Wenn Sie sich nicht sicher sind, wählen Sie LTO\_NONE. Beachten Sie, dass LTO sehr ressourcenintensiv ist, daher ist sie standardmäßig deaktiviert.
|
|
\english{This option enables Link Time Optimization (LTO), which allows the compiler to optimize binaries globally.\\
|
|
If unsure, select LTO\_NONE. Note that LTO is very resource-intensive so it's disabled by default.}
|
|
|
|
\subsubsection{None}
|
|
CONFIG\_LTO\_NONE [=y] \textbf{[Y]}\\
|
|
Erstellen Sie den Kernel normal, ohne Link Time Optimization (LTO).
|
|
\english{Build the kernel normally, without Link Time Optimization (LTO).}
|
|
|
|
\subsection{Number of bits to use for ASLR of mmap base address}
|
|
CONFIG\_ARCH\_MMAP\_RND\_BITS [=32] \textbf{[32]}\\*
|
|
Dieser Wert kann verwendet werden, um die Anzahl der Bits auszuwählen, die zur Bestimmung des zufälligen Offsets zur Basisadresse
|
|
von vma-Regionen verwendet werden, die aus mmap-Zuweisungen resultieren.
|
|
Dieser Wert wird durch die von der Architektur unterstützten Mindest- und Höchstwerte begrenzt.
|
|
Dieser Wert kann nach dem Booten mit dem Tunable /proc/sys/vm/mmap\_rnd\_bits geändert werden.
|
|
\english{This value can be used to select the number of bits to use to determine the random offset
|
|
to the base address of vma regions resulting from mmap allocations.
|
|
This value will be bounded by the architecture's minimum and maximum supported values.\\
|
|
This value can be changed after boot using the /proc/sys/vm/mmap\_rnd\_bits tunable}
|
|
|
|
\subsection{Number of bits to use for ASLR of mmap base address for compatible applications}
|
|
CONFIG\_ARCH\_MMAP\_RND\_CAMPAT\_BITS [=16] \textbf{[16]}\\*
|
|
Dieser Wert kann verwendet werden, um die Anzahl der Bits auszuwählen, die zur Bestimmung des zufälligen Offsets zur Basisadresse
|
|
von vma-Regionen verwendet werden, die aus mmap-Zuweisungen resultieren.
|
|
Dieser Wert wird durch die von der Architektur unterstützten Mindest- und Höchstwerte begrenzt.
|
|
Dieser Wert kann nach dem Booten mit dem Tunable /proc/sys/vm/mmap\_rnd\_bits geändert werden.
|
|
\english{This value can be used to select the number of bits to use to determine the random offset to the base
|
|
address of vma regions resulting from mmap allocations for compatible applications
|
|
This value will be bounded by the architecture's minimum and maximum supported values.\\
|
|
This value can be changed after boot using the /proc/sys/vm/mmap\_rnd\_compat\_bits tunable}
|
|
|
|
\subsection{MMU page size () \texorpdfstring{$\rightarrow$}{->}}
|
|
Für diese Option ist keine Hilfe verfügbar.
|
|
\english{There is no help available for this option.}
|
|
|
|
\subsubsection{4KiB pages}
|
|
CONFIG\_PAGE\_SIZE\_4KB [=y] \textbf{[Y]}\\*
|
|
Diese Option wählt die Standard-Linux-Seitengröße von \qty{4}{\kibi\byte} und ist auf vielen Architekturen die einzige verfügbare Option.
|
|
Die Verwendung von 4KiB Seitengröße minimiert den Speicherverbrauch und wird daher für Systeme mit wenig Speicher empfohlen.
|
|
Einige Software, die für x86-Systeme geschrieben wurde, geht von falschen Annahmen bezüglich der Seitengröße aus und läuft nur auf \qty{4}{\kibi\byte}-Seiten.
|
|
\english{This option select the standard 4KiB Linux page size and the only available option on many architectures.
|
|
Using 4KiB page size will minimize memory consumption and is therefore recommended for low memory systems.
|
|
Some software that is written for x86 systems makes incorrect assumptions about the page size and only runs on 4KiB pages.}
|
|
|
|
\subsection{Provide system calls for 32-bit time\_t}
|
|
CONFIG\_COMPAT\_32BIT\_TIME [=y] \textbf{[Y]}\\
|
|
Dies ermöglicht die Unterstützung von 32 Bit time\_t zusätzlich zur Unterstützung von
|
|
64~Bit time\_t. Dies ist auf allen 32-Bit-Architekturen und 64-Bit-Architekturen als Teil
|
|
der Kompatibilitäts-Syscall-Behandlung relevant.
|
|
\english{This enables 32 bit time\_t support in addition to 64 bit time\_t support.
|
|
This is relevant on all 32-bit architectures, and 64-bit architectures as part of compat syscall handling.}
|
|
|
|
\subsection{Use a virtually-mapped stack}
|
|
CONFIG\_VMAP\_STACK [=y] \textbf{[Y]}\\
|
|
Aktivieren Sie dies, wenn Sie virtuell gemappte Kernel-Stacks mit Guard Pages verwenden wollen.
|
|
Dies führt dazu, dass Kernel-Stack-Überläufe sofort abgefangen werden und keine schwer zu
|
|
diagnostizierende Korruption verursachen. Um dies mit Software-KASAN-Modi zu verwenden, muss die
|
|
Architektur die Unterstützung von virtuellen Mappings mit echtem Schattenspeicher unterstützen
|
|
und KASAN\_VMALLOC muss aktiviert sein.
|
|
\english{Enable this if you want the use virtually-mapped kernel stacks with guard pages.
|
|
This causes kernel stack overflows to be caught immediately rather than causing difficult-to-diagnose corruption.\\
|
|
To use this with software KASAN modes, the architecture must support backing virtual mappings with real shadow memory, and KASAN\_VMALLOC must be enabled.}
|
|
|
|
\subsection{Support for randomizing kernel stack offset on syscall entry}
|
|
CONFIG\_RANDOMIZE\_KSTACK\_OFFSET [=y] \textbf{[Y]}\\
|
|
Der Kernel-Stack-Offset kann (nach pt\_regs) mit etwa 5~Bits Entropie randomisiert werden,
|
|
wodurch Angriffe auf Speicherbeschädigung vereitelt werden, die auf Stack-Adress-Determinismus
|
|
oder auf die Offenlegung der Adressen von Cross-Syscalls angewiesen sind.
|
|
Die Funktion wird über den Kernel-Boot-Parameter \texttt{randomize\_kstack\_offset=on/off} gesteuert
|
|
und hat, wenn sie ausgeschaltet ist, aufgrund der Verwendung von statischen Verzweigungen
|
|
(siehe JUMP\_LABEL) keinen Overhead.\\
|
|
Wenn Sie unsicher sind, sagen Sie Y.
|
|
\english{The kernel stack offset can be randomized (after pt\_regs) by roughly 5 bits of entropy,
|
|
frustrating memory corruption attacks that depend on stack address determinism or cross-syscall address exposures.\\
|
|
The feature is controlled via the ``randomize\_kstack\_offset=on/off'' kernel boot param,
|
|
and if turned off has zero overhead due to its use of static branches (see JUMP\_LABEL).\\
|
|
If unsure, say Y.}
|
|
|
|
\subsubsection{Default state of kernel stack offset randomization}
|
|
CONFIG\_RANDOMIZE\_KSTACK\_OFFSET\_DEFAULT [=y] \textbf{[Y]}\\
|
|
Die Randomisierung des Kernel-Stack-Offsets wird durch den Kernel-Boot-Parameter\\
|
|
\texttt{randomize\_kstack\_offset=on/off} gesteuert, und diese Konfiguration wählt den
|
|
Standard-Boot-Status.
|
|
\english{Kernel stack offset randomization is controlled by kernel boot param ``randomize\_kstack\_offset=on/off'',
|
|
and this config chooses the default boot state.}
|
|
|
|
\subsection{Locking event counts collection}
|
|
CONFIG\_LOCK\_EVENT\_COUNTS [=y] \textbf{[Y]}\\
|
|
Ermöglicht eine leichtgewichtige Zählung verschiedener sperrungsbezogener Ereignisse im System
|
|
mit minimalen Auswirkungen auf die Leistung. Dies verringert die Wahrscheinlichkeit, dass sich
|
|
das Anwendungsverhalten aufgrund von Zeitunterschieden ändert. Die Zählungen werden über
|
|
debugfs gemeldet.
|
|
\english{Enable light-weight counting of various locking related events in the system with minimal performance impact.
|
|
This reduces the chance of application behavior change because of timing differences.
|
|
The counts are reported via debugfs.}
|
|
|
|
\subsection{GCOV-based kernel profiling \texorpdfstring{$\rightarrow$}{->}}
|
|
(GCOV-basierte Kernel-Profilierung)
|
|
|
|
\subsubsection{Enable gcov-based kernel profiling}
|
|
CONFIG\_GCOV\_KERNEL [=n] \textbf{[N]}\\
|
|
Diese Option aktiviert die gcov-basierte Code-Profilierung (z.\,B. für Code-Abdeckungsmessungen).
|
|
Wenn Sie unsicher sind, sagen Sie N.\\[.5em]
|
|
Geben Sie zusätzlich CONFIG\_GCOV\_PROFILE\_ALL=y an, um Profilerstellungsdaten für den gesamten
|
|
Kernel zu erhalten. Um die Profilerstellung für bestimmte Dateien oder Verzeichnisse zu aktivieren,
|
|
fügen Sie eine Zeile ähnlich der folgenden in das jeweilige Makefile ein:\\[.5em]
|
|
Für eine einzelne Datei (z.\,B. main.o):\\
|
|
\indent \texttt{GCOV\_PROFILE\_main.o := y}\\[.5em]
|
|
Für alle Dateien in einem Verzeichnis:\\
|
|
\indent \texttt{GCOV\_PROFILE := y}\\[.5em]
|
|
Um Dateien von der Profilerstellung auszuschließen, auch wenn CONFIG\_GCOV\_PROFILE\_ALL
|
|
angegeben ist, verwenden Sie:\\
|
|
\indent \texttt{GCOV\_PROFILE\_main.o := n}\\[.5em]
|
|
und:\\
|
|
\indent \texttt{GCOV\_PROFILE := n}\\[.5em]
|
|
Beachten Sie, dass das debugfs-Dateisystem gemountet sein muss, um auf die Profilerstellungsdaten
|
|
zugreifen zu können.
|
|
\english{This option enables gcov-based code profiling (e.g. for code coverage measurements).\\
|
|
If unsure, say N.\\
|
|
Additionally specify CONFIG\_GCOV\_PROFILE\_ALL=y to get profiling data for the entire kernel.
|
|
To enable profiling for specific files or directories, add a line similar to the following to the respective Makefile:\\
|
|
For a single file (e.g. main.o): GCOV\_PROFILE\_main.o := y\\
|
|
For all files in one directory: GCOV\_PROFILE := y\\
|
|
To exclude files from being profiled even when CONFIG\_GCOV\_PROFILE\_ALL is specified, use:\\
|
|
GCOV\_PROFILE\_main.o := n\\
|
|
and: GCOV\_PROFILE := n\\
|
|
Note that the debugfs filesystem has to be mounted to access profiling data.}
|
|
|
|
\subsection{GCC plugins \texorpdfstring{$\rightarrow$}{->}}
|
|
CONFIG\_GCC\_PLUGINS [=y] \textbf{[Y]}\\
|
|
GCC-Plugins sind ladbare Module, die zusätzliche Funktionen für den Compiler bereitstellen.
|
|
Sie sind nützlich für die Laufzeitinstrumentierung und die statische Analyse.\\
|
|
Siehe Documentation/kbuild/gcc-plugins.rst für Details.
|
|
\english{GCC plugins are loadable modules that provide extra features to the compiler.
|
|
They are useful for runtime instrumentation and static analysis.\\
|
|
See Documentation/kbuild/gcc-plugins.rst for details.}
|
|
|
|
\subsubsection{Generate some entropy during boot and runtime}
|
|
CONFIG\_GCC\_PLUGIN\_LATENT\_ENTROPY [=n] \textbf{[N]}\\
|
|
Mit der Eingabe von Y wird der Kernel einen Teil des Kernel-Codes instrumentieren,
|
|
um sowohl aus dem ursprünglichen als auch aus dem künstlich erzeugten Programmzustand
|
|
etwas Entropie zu gewinnen.
|
|
Dies ist insbesondere bei eingebetteten Systemen hilfreich, bei denen es normalerweise wenig
|
|
\glqq natürliche\grqq{} Entropiequellen gibt.
|
|
Der Preis ist eine gewisse Verlangsamung des Boot-Prozesses (etwa 0,5~\%) und der fork- und
|
|
irq-Verarbeitung. Beachten Sie, dass die auf diese Weise extrahierte Entropie nicht
|
|
kryptografisch sicher ist!\\
|
|
Dieses Plugin wurde von grsecurity/PaX portiert. Mehr Informationen unter:
|
|
\begin{itemize}
|
|
\item[] \url{https://grsecurity.net/}
|
|
\item[] \url{https://pax.grsecurity.net/}
|
|
\end{itemize}\vspace{-0.5em}\mbox{}\vspace{-1em}
|
|
\english{By saying Y here the kernel will instrument some kernel code to extract some entropy from both original and artificially created program state.
|
|
This will help especially embedded systems where there is little `natural' source of entropy normally.
|
|
The cost is some slowdown of the boot process (about 0.5\%) and fork and irq processing.\\
|
|
Note that entropy extracted this way is not cryptographically secure!\\
|
|
This plugin was ported from grsecurity/PaX. More information at:\\
|
|
* \url{https://grsecurity.net/}\\
|
|
* \url{https://pax.grsecurity.net/}}
|