diff --git a/documentation/linux_configuration.pdf b/documentation/linux_configuration.pdf index 5073ef8..cfd29fd 100644 --- a/documentation/linux_configuration.pdf +++ b/documentation/linux_configuration.pdf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ecc7e523e5b60a98fc748c5e17e9ce5e07078849a8ec1988ceb9e62342ee5c3 -size 237799 +oid sha256:db4242e0bb7e8957ea42dac29bb2904c898c918cf289b79c70a368b1cb798266 +size 3377728 diff --git a/documentation/linux_configuration.tex b/documentation/linux_configuration.tex index 21800a5..ec7c048 100644 --- a/documentation/linux_configuration.tex +++ b/documentation/linux_configuration.tex @@ -9,19 +9,19 @@ % pacman -S hyphen hyphen-de % pacman -S texlive-mathscience -\includeonly{ +%\includeonly{ %linux_configuration_04_mitigations_for_speculative_execution_vulnerabilities, %linux_configuration_05_power_management_and_acpi_options, %linux_configuration_09_general_architecture-dependent_options, %linux_configuration_11_enable_the_block_layer, %linux_configuration_12_executable_file_formats, - linux_configuration_13_memory_management_options, + %linux_configuration_13_memory_management_options, %linux_configuration_14_networking_support, %linux_configuration_15_device_drivers, %linux_configuration_16_file_systems, %linux_configuration_17_security_options, %linux_configuration_18_cryptographic_API -} +%} \documentclass[10pt,a4paper]{article} %\documentclass[12pt,a4paper]{report} diff --git a/documentation/linux_configuration_13_memory_management_options.tex b/documentation/linux_configuration_13_memory_management_options.tex index f57ff62..fab2546 100644 --- a/documentation/linux_configuration_13_memory_management_options.tex +++ b/documentation/linux_configuration_13_memory_management_options.tex @@ -188,24 +188,31 @@ For more information, see zsmalloc documentation.} %13.3 \subsection{Slab allocator options \texorpdfstring{$\rightarrow$}{->}} +Dies ermöglicht die Auswahl eines Slab-Allokators. -\subsubsection{Choose SLAB allocator (SLUB (Unqueued Allocator)) \texorpdfstring{$\rightarrow$}{->}} -Diese Option ermöglicht die Auswahl eines Slab-Allokators. +%\paragraph{SLAB (DEPRECATEDUnqueued Allocator)}$~$\\ +%CONFIG\_SLAB\_DEPRECATED [=n] \textbf{[N]}\\ +%Veraltet und soll in ein paar Zyklen entfernt werden. Ersetzt durch SLUB. Wenn Sie nicht auf SLUB umsteigen +%können, wenden Sie sich bitte an linux-mm@kvack.org und an die Personen, die im Abschnitt SLAB ALLOCATOR der +%MAINTAINERS-Datei aufgeführt sind, und erläutern Sie die Gründe. Der reguläre Slab-Allokator, der sich +%bewährt hat und bekanntermaßen in allen Umgebungen gut funktioniert. Er organisiert Cache-Hot-Objekte in +%Warteschlangen pro CPU und pro Knoten. -\paragraph{SLAB (DEPRECATEDUnqueued Allocator)}$~$\\ -CONFIG\_SLAB\_DEPRECATED [=n] \textbf{[N]}\\ -Veraltet und soll in ein paar Zyklen entfernt werden. Ersetzt durch SLUB. Wenn Sie nicht auf SLUB umsteigen -können, wenden Sie sich bitte an linux-mm@kvack.org und an die Personen, die im Abschnitt SLAB ALLOCATOR der -MAINTAINERS-Datei aufgeführt sind, und erläutern Sie die Gründe. Der reguläre Slab-Allokator, der sich -bewährt hat und bekanntermaßen in allen Umgebungen gut funktioniert. Er organisiert Cache-Hot-Objekte in -Warteschlangen pro CPU und pro Knoten. +%\paragraph{SLUB (Unqueued Allocator)}$~$\\ +%CONFIG\_SLUB [=y] \textbf{[Y]}\\ +%SLUB ist ein Slab-Allokator, der die Nutzung von Cache-Zeilen minimiert, anstatt Warteschlangen von gecachten +%Objekten zu verwalten (SLAB-Ansatz). Die Zwischenspeicherung pro CPU wird durch Slabs von Objekten anstelle +%von Objekt-Warteschlangen realisiert. SLUB kann den Speicher effizient nutzen und verfügt über verbesserte +%Diagnosefunktionen. SLUB ist die Standardwahl für einen Slab-Allokator. -\paragraph{SLUB (Unqueued Allocator)}$~$\\ -CONFIG\_SLUB [=y] \textbf{[Y]}\\ -SLUB ist ein Slab-Allokator, der die Nutzung von Cache-Zeilen minimiert, anstatt Warteschlangen von gecachten -Objekten zu verwalten (SLAB-Ansatz). Die Zwischenspeicherung pro CPU wird durch Slabs von Objekten anstelle -von Objekt-Warteschlangen realisiert. SLUB kann den Speicher effizient nutzen und verfügt über verbesserte -Diagnosefunktionen. SLUB ist die Standardwahl für einen Slab-Allokator. +\subsubsection{Configure for minimal memory footprint \tiny{seit 6.8}} +CONFIG\_SLUB\_TINY [=n] \textbf{[N]}\\* +Konfiguriert den Slab-Allokator so, dass ein minimaler Speicherbedarf erreicht wird, was zu Lasten der Skalierbarkeit, der Fehlersuche und anderer Funktionen geht. +Dies ist nur für das kleinste System gedacht, das die SLOB-Zuweisung verwendet hat, und wird für Systeme mit mehr als 16 MB RAM nicht empfohlen. +Wenn Sie unsicher sind, sagen Sie N. +\english{Configures the slab allocator in a way to achieve minimal memory footprint, sacrificing scalability, debugging and other features. +This is intended only for the smallest system that had used the SLOB allocator and is not recommended for systems with more than 16MB RAM.\\ +If unsure, say N.} \subsubsection{Allow slab caches to be merged} CONFIG\_SLAB\_MERGE\_DEFAULT [=y] \textbf{[Y]}\\ @@ -216,11 +223,18 @@ wodurch solche Heap-Angriffe von Angreifern leichter ausgenutzt werden können. werden, können diese Arten von Angriffen normalerweise nur Objekte im selben Cache beschädigen. Um die Zusammenführung zur Laufzeit zu deaktivieren, kann \texttt{slab\_nomerge} in der Kernel-Befehlszeile übergeben werden. +\english{For reduced kernel memory fragmentation, slab caches can be merged when they share the same size and other characteristics. +This carries a risk of kernel heap overflows being able to overwrite objects from merged caches (and more easily control cache layout), +which makes such heap attacks easier to exploit by attackers. +By keeping caches unmerged, these kinds of exploits can usually only damage objects in the same cache. +To disable merging at runtime, ``slab\_nomerge'' can be passed on the kernel command line.} \subsubsection{Randomize slab freelist} CONFIG\_SLAB\_FREELIST\_RANDOM [=y] \textbf{[Y]}\\ Die Reihenfolge der Freelist bei der Erstellung neuer Seiten wird zufällig festgelegt. Dieses Sicherheitsmerkmal verringert die Vorhersagbarkeit der Kernel-Slab-Zuweisung gegen Heap-Überläufe. +\english{Randomizes the freelist order used on creating new pages. +This security feature reduces the predictability of the kernel slab allocator against heap overflows.} \subsubsection{Harden slab freelist metadata} CONFIG\_SLAB\_FREELIST\_HARDENED [=y] \textbf{[Y]}\\ @@ -228,21 +242,43 @@ Viele Kernel-Heap-Angriffe zielen auf Slab-Cache-Metadaten und andere Infrastruk Diese Optionen bringen geringfügige Leistungseinbußen mit sich, um den Kernel-Slab-Allokator gegen gängige Freelist-Angriffsmethoden zu härten. Einige Slab-Implementierungen haben mehr Sanity-Checking als andere. Diese Option ist am effektivsten mit CONFIG\_SLUB. +\english{Many kernel heap attacks try to target slab cache metadata and other infrastructure. +This options makes minor performance sacrifices to harden the kernel slab allocator against common freelist exploit methods.} -\subsubsection{Enable SLUB performance statistics} +\subsubsection{Support allocation from separate kmalloc buckets \tiny{seit 6.11}} +CONFIG\_SLAB\_BUCKETS [=y] \textbf{[Y]}\\* +Angriffe auf den Kernel-Heap hängen häufig davon ab, dass man in der Lage ist, speziell dimensionierte Zuweisungen mit benutzergesteuertem Inhalt zu erstellen, +die in denselben kmalloc-Bucket wie ein Zielobjekt zugewiesen werden. +Um die gemeinsame Nutzung dieser Zuweisungsbereiche zu vermeiden, sollte ein explizit getrennter Satz von Bereichen +für benutzergesteuerte Zuweisungen bereitgestellt werden. +Dies kann die Speicherfragmentierung geringfügig erhöhen, obwohl es sich in der Praxis nur um eine Handvoll zusätzlicher Seiten handelt, +da der Großteil der benutzergesteuerten Zuweisungen relativ langlebig ist.\\ +Wenn Sie unsicher sind, sagen Sie Y. +\english{Kernel heap attacks frequently depend on being able to create specifically-sized allocations with user-controlled contents +that will be allocated into the same kmalloc bucket as a target object. +To avoid sharing these allocation buckets, provide an explicitly separated set of buckets to be used for user-controlled allocations. +This may very slightly increase memory fragmentation, though in practice it's only a handful of extra pages since the bulk of user-controlled +allocations are relatively long-lived.\\ +If unsure, say Y.} + +\subsubsection{Enable performance statistics} CONFIG\_SLUB\_STATS [=n] \textbf{[N]}\\ SLUB-Statistiken sind nützlich, um das Zuweisungsverhalten von SLUBs zu debuggen und Wege zur Optimierung der Zuweisungsfunktion zu finden. Diese Funktion sollte niemals für den produktiven Einsatz aktiviert werden, da die Führung von Statistiken die Zuweisungsfunktion um einige Prozentpunkte verlangsamt. Der Befehl \texttt{slabinfo} unterstützt die Ermittlung der aktivsten Slabs, um herauszufinden, welche Slabs für eine bestimmte Last relevant sind. Versuchen Sie Folgendes: \texttt{slabinfo -DA} +\english{The statistics are useful to debug slab allocation behavior in order find ways to optimize the allocator. +This should never be enabled for production use since keeping statistics slows down the allocator by a few percentage points. +The slabinfo command supports the determination of the most active slabs to figure out which slabs are relevant to a particular load. +Try running: \texttt{slabinfo -DA}} -\subsubsection{SLUB per cpu partial cache} -CONFIG\_SLUB\_CPU\_PARTIAL [=y] \textbf{[Y]}\\ -Partielle Zwischenspeicher pro CPU beschleunigen die Zuweisung und Freigabe von Objekten, die lokal auf einem -Prozessor liegen, zum Preis einer größeren Unbestimmtheit bei der Latenzzeit der Freigabe. Bei Überlauf -werden diese Caches geleert, was das Einnehmen von Sperren erfordert, die Latenzspitzen verursachen können. -Normalerweise würde man sich bei einem Echtzeitsystem für nein entscheiden. +%\subsubsection{SLUB per cpu partial cache} +%CONFIG\_SLUB\_CPU\_PARTIAL [=y] \textbf{[Y]}\\ +%Partielle Zwischenspeicher pro CPU beschleunigen die Zuweisung und Freigabe von Objekten, die lokal auf einem +%Prozessor liegen, zum Preis einer größeren Unbestimmtheit bei der Latenzzeit der Freigabe. Bei Überlauf +%werden diese Caches geleert, was das Einnehmen von Sperren erfordert, die Latenzspitzen verursachen können. +%Normalerweise würde man sich bei einem Echtzeitsystem für nein entscheiden. \subsubsection{Randomize slab caches for normal kmalloc} CONFIG\_RANDOM\_KMALLOC\_CACHES [=n] \textbf{[N]}\\ @@ -253,6 +289,10 @@ Gegenwärtig ist die Anzahl der Kopien auf 16 festgelegt, ein angemessen großer Subsysteme oder Module zugewiesenen Speicherobjekte effektiv in verschiedene Caches aufteilt, und zwar auf Kosten eines begrenzten Grades an Speicher- und CPU-Overhead, der mit der Hardware und der Systemauslastung zusammenhängt. +\english{A hardening feature that creates multiple copies of slab caches for normal kmalloc allocation and makes kmalloc randomly pick one based on code address, +which makes the attackers more difficult to spray vulnerable memory objects on the heap for the purpose of exploiting memory vulnerabilities.\\ +Currently the number of copies is set to 16, a reasonably large value that effectively diverges the memory objects allocated for different +subsystems or modules into different caches, at the expense of a limited degree of memory and CPU overhead that relates to hardware and system workload.} %13.4 \subsection{Page allocator randomization} @@ -268,6 +308,15 @@ die Arbeitslast auswirken. Aus diesem Grund wird die Randomisierung standardmä Laufzeit ein direkt zugeordneter Memory-Side-Cache erkannt wird. Andernfalls kann die Randomisierung mit dem Kernel-Befehlszeilenparameter \texttt{page\_alloc.shuffle} zwangsweise aktiviert werden. Sagen Sie Y, wenn Sie unsicher sind. +\english{Randomization of the page allocator improves the average utilization of a direct-mapped memory-side-cache. +See section 5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI 6.2a specification for an example of how a platform advertises +the presence of a memory-side-cache. +There are also incidental security benefits as it reduces the predictability of page allocations to compliment SLAB\_FREELIST\_RANDOM, but the default +granularity of shuffling on the MAX\_PAGE\_ORDER i.e, 10th order of pages is selected based on cache utilization benefits on x86.\\ +While the randomization improves cache utilization it may negatively impact workloads on platforms without a cache. +For this reason, by default, the randomization is not enabled even if SHUFFLE\_PAGE\_ALLOCATOR=y. +The randomization may be force enabled with the `page\_alloc.shuffle' kernel command line parameter.\\ +Say Y if unsure.} %13.5 \subsection{Disable heap randomization} @@ -277,6 +326,10 @@ Binärdateien (einschließlich aller libc5-basierten) kaputt. Diese Option ände Booten auf Heap-Randomisierung deaktiviert und kann zur Laufzeit überschrieben werden, indem /proc/sys/kernel/randomize\_va\_space auf 2 gesetzt wird. Auf nicht-alten Distributionen (nach 2000) ist N normalerweise eine sichere Wahl. +\english{Randomizing heap placement makes heap exploits harder, but it also breaks ancient binaries (including anything libc5 based). +This option changes the bootup default to heap randomization disabled, and can be overridden at runtime by setting +\texttt{/proc/sys/kernel/randomize\_va\_space} to 2.\\ +On non-ancient distros (post-2000 ones) N is usually a safe choice.} %13.6 \subsection{Sparse Memory virtual memmap} @@ -284,11 +337,14 @@ CONFIG\_SPARSEMEM\_VMEMMAP [=y] \textbf{[Y]}\\ SPARSEMEM\_VMEMMAP verwendet eine virtuell gemappte Memmap, um texttt{pfn\_to\_page} und\\ \texttt{page\_to\_pfn} Operationen zu optimieren. Dies ist die effizienteste Option, wenn genügend Kernel-Res\-sour\-cen verfügbar sind. +\english{SPARSEMEM\_VMEMMAP uses a virtually mapped memmap to optimise pfn\_to\_page and page\_to\_pfn operations. +This is the most efficient option when sufficient kernel resources are available.} %13.7 \subsection{Memory hotplug \texorpdfstring{$\rightarrow$}{->}} CONFIG\_HOTPLUG [=y] \textbf{[Y]}\\ \textit{Für diese Option gibt es keine Hilfe.} +\english{There is no help available for this option.} \subsubsection{Memory Hotplug Default Online Type () \texorpdfstring{$\rightarrow$}{->}} Standard-Speichertyp für Hotplug"=Speicher.\\