Spaced-Retrieval Study Deck

GL-C01 · Linux Systems I/O & Buffering in C — 145 engineering cards. Reveal the answer with Space or Enter, then rate recall with 1 again to 4 easy.

Mastered 0 / 145 · Due 145

box 1: 145 box 2: 0 box 3: 0 box 4: 0

Active study card

flashcard — 1/145 · Course-wide
1/145 definition Course-wide box 1 · due

? What is Application Binary Interface (ABI)?

Browse all cards

Show all 145 cards (full Q&A reference table)
# Module Kind Front Back Schedule
1Course-widedefinitionWhat is Application Binary Interface (ABI)?Named as the binary counterpart to a source-level Application Programming Interface, an ABI fixes register assignments, stack alignment (16-byte on x86-64 System V, 8-byte on ARMv7 AAPCS), struct padding, and syscall trap conventions (syscall on x86-64, `svcbox 1 · due
2M1 · Series Orientation, Kernel Boundary & C ToolchaindefinitionWhat is Auxiliary Vector (auxv)?Named for the auxiliary (key, value) pairs appended by the Linux kernel execve() loader immediately after envp[] on the initial user stack, delivering hardware capabilities, AT_PAGESZ, and the AT_SYSINFO_EHDR base address of linux-vdso.so.1 without extra syscalls.box 1 · due
3Course-widedefinitionWhat is Container-Of Macro (CONTAINER_OF)?Named from intrusive object containment in the Linux kernel (include/linux/container_of.h), a compile-time type-checked macro combining _Generic or typeof with offsetof(type, member) over char * arithmetic to recover an enclosing structure pointer from an embedded field pointer.box 1 · due
4Course-widedefinitionWhat is Cyclic Redundancy Check (CRC32)?Coined by W. Wesley Peterson in 1961 from polynomial division over $GF(2)$, the reflected IEEE 802.3 CRC32 (0xEDB88320U) detects burst bit errors, torn writes, and stale zeroed sectors inside binary Write-Ahead Log frames.box 1 · due
5Course-widedefinitionWhat is Direct I/O (O_DIRECT)?Named for bypassing the Linux kernel page cache so user-space buffers transfer directly via storage controller Direct Memory Access (DMA), requiring memory address, transfer length, and file offset alignment to statx() STATX_DIOALIGN boundaries.box 1 · due
6M3 · Kernel Open-File Internals, Errors & Sparse FilesdefinitionWhat is Directory Entry (dentry)?Coined in the Linux Virtual File System (VFS) for a human-readable (name, inode_number) mapping cached in the kernel dcache; unlinking a dentry decrements st_nlink, whereas storage blocks persist until both st_nlink == 0 and open struct file references drop to zero.box 1 · due
7Course-widedefinitionWhat is Dynamic Loader Trampoline (.plt / .got.plt)?Named for the Executable and Linkable Format (ELF) Procedure Linkage Table and Global Offset Table, an indirect jump table patched by ld-linux so position-independent user code resolves shared glibc symbols at runtime.box 1 · due
8Course-widedefinitionWhat is End-Of-File Sentinel (EOF)?Named in standard <stdio.h> for the negative int sentinel (typically -1) returned by fgetc() outside the 256 valid unsigned char byte values (0x00..0xFF), requiring an int receiver variable rather than char to prevent 0xFF truncation or sign-extension bugs.box 1 · due
9M1 · Series Orientation, Kernel Boundary & C ToolchaindefinitionWhat is Executable and Linkable Format (ELF)?Standardized by the Unix System Laboratories ABI for relocatable (.o), executable, and shared (.so) binaries, separating read-only instructions (.text), initialized data (.data), zero-initialized storage (.bss), and symbol tables (.symtab, .dynsym).box 1 · due
10Course-widedefinitionWhat is Feature Test Macro (_POSIX_C_SOURCE)?Standardized by IEEE Std 1003.1 (POSIX) to gate which declarations system headers expose above baseline ISO C11; it must be defined before the very first #include directive in every translation unit.box 1 · due
11Course-widedefinitionWhat is File Creation Mask (umask)?Named from "user file-creation mode mask" in Version 7 Unix, a per-process octal bitmask stored in current->fs->umask that clears permission bits during open(..., O_CREAT, mode) via effective_mode = mode & ~umask.box 1 · due
12Course-widedefinitionWhat is File Data Synchronization (fdatasync)?Standardized by POSIX.1b real-time extensions to flush dirty page-cache folios and only metadata required to retrieve those bytes (such as st_size changes), skipping non-essential timestamp journal commits incurred by full fsync().box 1 · due
13M2 · Core Unbuffered POSIX File I/OdefinitionWhat is File Descriptor (fd)?Coined in early Unix for a non-negative int array index into a process's private files_struct descriptor table (0 STDIN_FILENO, 1 STDOUT_FILENO, 2 STDERR_FILENO), allocated from the lowest unused slot unless pinned via dup2() or dup3().box 1 · due
14M3 · Kernel Open-File Internals, Errors & Sparse FilesdefinitionWhat is Index Node (inode)?Named by Dennis Ritchie for "index node" in the original Unix filesystem, the metadata record storing numeric ownership, st_mode, st_size, st_blocks, link count (st_nlink), and physical block extents—intentionally excluding filenames.box 1 · due
15M2 · Core Unbuffered POSIX File I/OdefinitionWhat is Open File Description (struct file)?The middle tier of the Linux kernel three-table VFS hierarchy allocated per openat() call, holding mutable session state (f_pos byte offset, f_flags status bits, f_op dispatch table, and f_count reference count across dup() and fork()).box 1 · due
16M2 · Core Unbuffered POSIX File I/OdefinitionWhat is Page Cache?The RAM-resident radix/XArray folio cache (struct address_space) managed by the Linux kernel between VFS read()/write() syscalls and block devices; dirty pages survive SIGKILL of a user process but vanish on sudden power loss unless flushed via fsync() or fdatasync().box 1 · due
17M4 · File Sharing, Atomic Operations & Descriptor ControldefinitionWhat is Positional I/O (pread / pwrite)?Introduced in UNIX System V Release 4 and POSIX.1-2001 ("positional read/write") to transfer bytes at an explicit off_t offset in a single atomic syscall without reading or mutating the shared struct file.f_pos cursor.box 1 · due
18Course-widedefinitionWhat is Signed Byte Count (ssize_t)?Standardized by POSIX ("signed size type") with ceiling SSIZE_MAX so read(), write(), pread(), and pwrite() can return a non-negative byte count (0..MAX_RW_COUNT, 0x7ffff000 on Linux) alongside the -1 error sentinel.box 1 · due
19Course-widedefinitionWhat is Sparse File Extent Hole?A logical byte range created by advancing f_pos past EOF with lseek() (or ftruncate()) without writing bytes; the filesystem allocates 0 physical 512-byte sectors (st_blocks) for the hole while VFS synthesizes 0x00 bytes on read.box 1 · due
20M5 · Standard C Library (stdio) Streams & Formatted I/OdefinitionWhat is Standard I/O Stream (FILE)?An opaque user-space control block managed by glibc <stdio.h> containing a heap or caller-supplied byte buffer, read/write cursors, _IOFBF/_IOLBF/_IONBF mode flags, sticky EOF/error indicators, and an underlying POSIX fd.box 1 · due
21Course-widedefinitionWhat is Thread-Local Error Number (errno)?Originally a global int in early Unix and redefined since ISO C99/POSIX threads as a modifiable thread-local lvalue (*__errno_location()), populated by glibc wrappers only when a raw kernel syscall returns an architecture-specific negative -errno value.box 1 · due
22M4 · File Sharing, Atomic Operations & Descriptor ControldefinitionWhat is Time-Of-Check to Time-Of-Use (TOCTOU)?Coined in 1970s operating-system security audits for a race window between inspecting a pathname (access() or stat()) and acting on it (open()), eliminated by atomic single-lookup kernel primitives (O_CREAT | O_EXCL and directory-pinned openat()).box 1 · due
23M1 · Series Orientation, Kernel Boundary & C ToolchaindefinitionWhat is Undefined Behavior (UB)?Defined in ISO/IEC 9899:2011 (C11 §3.4.3) as constructs—such as signed integer overflow, strict-aliasing violations, uninitialized reads, or shifting 1 << 31—for which the standard imposes zero requirements, permitting optimizing compilers to elide surrounding safety checks.box 1 · due
24Course-widedefinitionWhat is Virtual Dynamic Shared Object (vDSO)?Mapped into every user address space as linux-vdso.so.1 by the Linux kernel execve() loader, exposing read-only kernel timekeeper pages and Ring 3 helper functions (clock_gettime, gettimeofday) that read hardware counters with zero Ring 0 trap overhead.box 1 · due
25M1 · Series Orientation, Kernel Boundary & C ToolchaindefinitionWhat is Write-Ahead Log (WAL)?Originated in ARIES database recovery architecture, an append-only binary log where every mutation is framed with magic bytes, a monotonic 64-bit sequence number, payload lengths, and a CRC32 checksum and flushed via fdatasync() before acknowledgment so startup ftruncate() heals torn tails deterministically.box 1 · due
26M1 · Series Orientation, Kernel Boundary & C ToolchaindefinitionDefine vDSO Shared User-Space Timekeeping Page.Read-only kernel-mapped ELF object (linux-vdso.so.1, exposed via AT_SYSINFO_EHDR) allowing latency-critical queries like clock_gettime() to read kernel timekeeper sequence counters in Ring 3 / EL0 with zero privilege-switching traps.box 1 · due
27M1 · Series Orientation, Kernel Boundary & C ToolchainmisconceptionMisconception check: vDSO Shared User-Space Timekeeping Page. What do people get wrong, and why is it wrong?Assuming every POSIX system interface visible in section-2 documentation triggers a kernel trap in strace, causing engineers to misdiagnose missing clock_gettime() lines in strace or over-budget timestamping overhead.box 1 · due
28M1 · Series Orientation, Kernel Boundary & C ToolchaindefinitionDefine ISO C11 Behavior Taxonomy & Sanitizer Gate.Partition of ISO C11 semantics into Well-Defined, Unspecified, Implementation-Defined (such as ARM unsigned char vs x86_64 signed char), and Undefined Behavior (signed overflow, shift >= width, strict-aliasing violations), verified dynamically via -fsanitize=address,undefined.box 1 · due
29M1 · Series Orientation, Kernel Boundary & C ToolchainmisconceptionMisconception check: ISO C11 Behavior Taxonomy & Sanitizer Gate. What do people get wrong, and why is it wrong?Treating signed integer overflow or pointer type-punning as benign hardware behavior, only to have GCC -O2 delete overflow/NULL guards under the C11 as-if rule or reorder loads under -fstrict-aliasing.box 1 · due
30Course-widedefinitionDefine Tentative Definitions & ELF Symbol Visibility.C11 linkage rule where uninitialized file-scope declarations without extern emit distinct .bss symbols that collide under GCC 10+ -fno-common, paired with static/visibility control over STB_LOCAL vs STB_GLOBAL ELF symbol tables.box 1 · due
31Course-widemisconceptionMisconception check: Tentative Definitions & ELF Symbol Visibility. What do people get wrong, and why is it wrong?Placing int err_count; in a shared header without extern, triggering multiple-definition linker failures on modern GCC toolchains after compiling cleanly on legacy -fcommon compilers.box 1 · due
32M1 · Series Orientation, Kernel Boundary & C ToolchaindefinitionDefine ELF PT_INTERP, GOT/PLT Relocation & Interposition.Dynamic-linking mechanism routing shared-library calls through Procedure Linkage Table (.plt) stubs and Global Offset Table (.got.plt) jump slots populated by the PT_INTERP loader (ld-linux), inspectable via readelf -rW and objdump -d.box 1 · due
33M1 · Series Orientation, Kernel Boundary & C ToolchainmisconceptionMisconception check: ELF PT_INTERP, GOT/PLT Relocation & Interposition. What do people get wrong, and why is it wrong?Misinterpreting execve returning ENOENT ('No such file or directory') on an existing binary when its ELF PT_INTERP dynamic loader path (/lib/ld-linux-armhf.so.3) is missing from a rootfs or container.box 1 · due
34Course-widedefinitionDefine CRT Initial Stack Frame & .init_array Lifecycle.Kernel-constructed execve() user stack holding argc, argv[], envp[], and Elf_auxv_t records handed to _start (crt1.o) and __libc_start_main() to run .init_array constructors before main() and .fini_array / atexit() teardown afterward.box 1 · due
35Course-widemisconceptionMisconception check: CRT Initial Stack Frame & .init_array Lifecycle. What do people get wrong, and why is it wrong?Assuming C globals initialize by magic or that main() is the first instruction executed, causing crashes in constructor hooks or custom -nostdlib builds that misalign RSP/SP or skip .bss clearing.box 1 · due
36M2 · Core Unbuffered POSIX File I/OdefinitionDefine UB-Free Unsigned Bitmasks & Width-Safe Bit Rotation.Unsigned bit-manipulation discipline using 1U << bit / UINT32_C(1) and masked shift counts (n & 31U) with (-n & 31U) to prevent signed sign-bit overflow and shift-by-width Undefined Behavior.box 1 · due
37M2 · Core Unbuffered POSIX File I/OmisconceptionMisconception check: UB-Free Unsigned Bitmasks & Width-Safe Bit Rotation. What do people get wrong, and why is it wrong?Writing (1 << 31) for bit 31 on 32-bit int or (x << n) | (x >> (32 - n)) in hash/CRC helpers, triggering C11 Undefined Behavior and UBSan failures when n == 0.box 1 · due
38M2 · Core Unbuffered POSIX File I/OdefinitionDefine Linux MAX_RW_COUNT Cap & Signed ssize_t Guard.Linux kernel VFS transfer ceiling (MAX_RW_COUNT = 0x7ffff000 = 2,147,479,552 bytes) capping every single read() or write() call even on 64-bit regular files, requiring signed ssize_t retry loops.box 1 · due
39M2 · Core Unbuffered POSIX File I/OmisconceptionMisconception check: Linux MAX_RW_COUNT Cap & Signed ssize_t Guard. What do people get wrong, and why is it wrong?Assuming read() or write() on a local disk file never returns a short count, or storing the return value in unsigned size_t where -1 converts to SIZE_MAX and corrupts pointer arithmetic.box 1 · due
40M2 · Core Unbuffered POSIX File I/OdefinitionDefine off_t Overflow Guards & SEEK_DATA / SEEK_HOLE.Signed 64-bit off_t pre-addition bounds validation (cur > INT64_MAX - delta) paired with Linux lseek() SEEK_DATA and SEEK_HOLE modes that walk sparse filesystem extent trees in O(extents) without reading zero holes.box 1 · due
41M2 · Core Unbuffered POSIX File I/OmisconceptionMisconception check: off_t Overflow Guards & SEEK_DATA / SEEK_HOLE. What do people get wrong, and why is it wrong?Scanning sparse VM images or database files with read() loops to locate non-zero regions, polluting the page cache and wasting I/O bandwidth instead of walking extents via SEEK_DATA and SEEK_HOLE.box 1 · due
42M3 · Kernel Open-File Internals, Errors & Sparse FilesdefinitionDefine VFS Function Vtables & Intrusive container_of.Zero-overhead C polymorphism in Linux VFS pairing struct file_operations function-pointer tables with intrusive struct embedding recovered via offsetof(type, member) and pointer-to-pointer (struct node **pp) list surgery.box 1 · due
43M3 · Kernel Open-File Internals, Errors & Sparse FilesmisconceptionMisconception check: VFS Function Vtables & Intrusive container_of. What do people get wrong, and why is it wrong?Allocating separate void * heap wrapper nodes with extra pointer indirection and unchecked casts instead of embedding anchor members inside domain structs and recovering the enclosing type via offsetof.box 1 · due
44M3 · Kernel Open-File Internals, Errors & Sparse FilesdefinitionDefine LIFO goto Unwinding & Scope Cleanup Guards.Structured single-exit C resource teardown unwinding acquired descriptors, mappings, and heap buffers in reverse LIFO order via numbered goto out_* labels initialized with rc = -1 (or __attribute__((cleanup))).box 1 · due
45M3 · Kernel Open-File Internals, Errors & Sparse FilesmisconceptionMisconception check: LIFO goto Unwinding & Scope Cleanup Guards. What do people get wrong, and why is it wrong?Initializing int rc = 0 before validation and jumping to out: without setting rc = -1 (silently returning success on failure!), or jumping over a pointer's initialization to a label that calls free() on uninitialized stack garbage.box 1 · due
46M4 · File Sharing, Atomic Operations & Descriptor ControldefinitionDefine Directory-Pinned *at() & Crash-Safe File Replacement.Path-race-immune VFS operations anchored to a verified O_DIRECTORY descriptor (openat with O_NOFOLLOW | O_CLOEXEC, O_TMPFILE, renameat / renameat2) combined with fdatasync(tfd) + renameat() + fsync(dfd) atomic replacement.box 1 · due
47M4 · File Sharing, Atomic Operations & Descriptor ControlmisconceptionMisconception check: Directory-Pinned *at() & Crash-Safe File Replacement. What do people get wrong, and why is it wrong?Using path-based open() on predictable /tmp filenames without O_NOFOLLOW or directory-descriptor pinning, or calling rename() without syncing both the staged file and the parent directory descriptor.box 1 · due
48M4 · File Sharing, Atomic Operations & Descriptor ControldefinitionDefine ABI-Stable ioctl Struct Encoding & Padding.Linux _IOC/_IOR/_IOW/_IOWR 32-bit command encoding embedding sizeof(struct) into bits [29:16], requiring fixed-width <stdint.h> types, explicit zeroed reserved fields, and _Static_assert(sizeof(...)) verification.box 1 · due
49M4 · File Sharing, Atomic Operations & Descriptor ControlmisconceptionMisconception check: ABI-Stable ioctl Struct Encoding & Padding. What do people get wrong, and why is it wrong?Placing unsigned long, raw pointers, or implicit compiler padding holes inside ioctl UAPI structs, changing the encoded command code across 32/64-bit builds (ENOTTY) and leaking kernel stack bytes if padding is not zeroed.box 1 · due
50M5 · Standard C Library (stdio) Streams & Formatted I/OdefinitionDefine Memory-Backed FILE Streams (open_memstream & fmemopen).POSIX.1-2008 interfaces binding glibc's internal FILE read/write cursor vtable onto dynamic heap buffers (open_memstream) or fixed caller RAM slices (fmemopen) with zero /tmp filesystem side effects.box 1 · due
51M5 · Standard C Library (stdio) Streams & Formatted I/OmisconceptionMisconception check: Memory-Backed FILE Streams (open_memstream & fmemopen). What do people get wrong, and why is it wrong?Creating fragile /tmp scratch files just to invoke or test C APIs that accept FILE * streams, when open_memstream(&buf, &len) and fmemopen() stream directly in RAM.box 1 · due
52M5 · Standard C Library (stdio) Streams & Formatted I/OdefinitionDefine fgetc() 257-State int Contract vs ARM Unsigned char Trap.ISO C stream rule where fgetc() and getchar() return unsigned char [0..255] widened to int plus (int)-1 for EOF; storing the return in plain char truncates 0xFF to -1 on x86_64 and loops forever at EOF on ARMv7 unsigned char.box 1 · due
53M5 · Standard C Library (stdio) Streams & Formatted I/OmisconceptionMisconception check: fgetc() 257-State int Contract vs ARM Unsigned char Trap. What do people get wrong, and why is it wrong?Writing char c; while ((c = fgetc(fp)) != EOF) on x86_64, passing ASCII tests, and deploying to 32-bit ARM Cortex-A7 where plain char is unsigned (0..255 != -1) and the loop spins at 100% CPU forever.box 1 · due
54M6 · Two-Layer I/O Buffering, Durability & Capstone EnginedefinitionDefine STATX_DIOALIGN, posix_fadvise & Demand-Paged mmap Faults.Linux 6.12 page-cache and direct-I/O control combining statx(STATX_DIOALIGN) dynamic alignment queries, posix_fadvise(POSIX_FADV_DONTNEED) cache eviction, and demand-paged mmap (MAP_SHARED aliasing vs MAP_PRIVATE CoW, minflt/majflt).box 1 · due
55M6 · Two-Layer I/O Buffering, Durability & Capstone EnginemisconceptionMisconception check: STATX_DIOALIGN, posix_fadvise & Demand-Paged mmap Faults. What do people get wrong, and why is it wrong?Hardcoding 512-byte O_DIRECT alignment on 4Kn NVMe media (failing with EINVAL), polluting RAM during one-pass scans, or confusing MAP_PRIVATE Copy-on-Write shadow pages with MAP_SHARED page-cache write-through.box 1 · due
56M6 · Two-Layer I/O Buffering, Durability & Capstone EnginedefinitionDefine Branchless Reflected CRC32 & Monotonic WAL Epochs.LSB-first IEEE 802.3 CRC32 polynomial (0xEDB88320U) evaluated via constant-time mask -(crc & 1U) paired with a strictly monotonic 64-bit epoch/sequence counter to detect stale frames in recycled WAL sectors.box 1 · due
57M6 · Two-Layer I/O Buffering, Durability & Capstone EnginemisconceptionMisconception check: Branchless Reflected CRC32 & Monotonic WAL Epochs. What do people get wrong, and why is it wrong?Relying on CRC32 alone when recycling pre-allocated circular WAL files, where an interrupted overwrite leaves an intact, valid-CRC frame from a previous epoch that masquerades as current committed data.box 1 · due
58M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l01_privilege_rings, con_m01_l01_syscall_gate): GL-C01 opens the 4-course Linux Systems Programming in C series by est…GL-C01 opens the 4-course Linux Systems Programming in C series by establishing the toolchain, VFS descriptor, and stdio buffering foundation used across filesystems, IPC, sockets, and /dev peripherals.box 1 · due
59M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l01_privilege_rings, con_m01_l01_syscall_gate): Bare-metal firmware mixes user logic and raw MMIO register writes in o…Bare-metal firmware mixes user logic and raw MMIO register writes in one flat address space, whereas Linux isolates Ring 3 / EL0 user processes from Ring 0 / EL1 struct file_operations drivers via the MMU.box 1 · due
60M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l01_privilege_rings, con_m01_l01_syscall_gate): The Linux kernel mediates hardware and shared resources across seven c…The Linux kernel mediates hardware and shared resources across seven core subsystems: system calls, VFS, virtual memory, scheduling, IPC, networking, and device drivers.box 1 · due
61M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l01_privilege_rings, con_m01_l01_syscall_gate): Standard user-space C code compiles cleanly across x86_64 workstations…Standard user-space C code compiles cleanly across x86_64 workstations and embedded ARM targets when built with strict -std=c11 -Wall -Wextra -Werror discipline.box 1 · due
62M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l02_gcc_four_stage, con_m01_l02_feature_macros): Compile multi-file systems C projects explicitly across preprocessing …Compile multi-file systems C projects explicitly across preprocessing (-E), compilation (-S), assembly (-c), archiving (ar rcs), and linking with -std=c11 -Wall -Wextra -Werror.box 1 · due
63M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l02_gcc_four_stage, con_m01_l02_feature_macros): Define feature-test macros (_POSIX_C_SOURCE 200809L, _FILE_OFFSET_BITS…Define feature-test macros (_POSIX_C_SOURCE 200809L, _FILE_OFFSET_BITS 64) before the very first #include in every .c translation unit.box 1 · due
64M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l02_gcc_four_stage, con_m01_l02_feature_macros): Consult man 2 for Linux kernel syscalls and man 3 for glibc functions,…Consult man 2 for Linux kernel syscalls and man 3 for glibc functions, verifying SYNOPSIS, RETURN VALUE, and ERRORS before coding.box 1 · due
65M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l02_gcc_four_stage, con_m01_l02_feature_macros): Pair unsigned size_t capacities with signed ssize_t / off_t return che…Pair unsigned size_t capacities with signed ssize_t / off_t return checks, pass explicit (ptr, len) pairs for uint8_t binary buffers, and write octal mode_t literals (0644).box 1 · due
66M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l03_glibc_wrapper, con_m01_l03_pure_lib_fn): glibc (libc.so.6) separates pure Ring 3 memory/string helpers (strlen(…glibc (libc.so.6) separates pure Ring 3 memory/string helpers (strlen(), memcpy(), snprintf()) from Ring 0 syscall wrappers (write(), read(), open()) observable with strace.box 1 · due
67M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l03_glibc_wrapper, con_m01_l03_pure_lib_fn): Every POSIX process inherits STDIN_FILENO (0), STDOUT_FILENO (1), and …Every POSIX process inherits STDIN_FILENO (0), STDOUT_FILENO (1), and STDERR_FILENO (2) from startup.box 1 · due
68M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l03_glibc_wrapper, con_m01_l03_pure_lib_fn): When a syscall fails, the Linux kernel returns -errno and the glibc wr…When a syscall fails, the Linux kernel returns -errno and the glibc wrapper sets positive thread-local errno (EBADF, EINTR, formatted via perror() / strerror()) and returns -1.box 1 · due
69M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_m01_l03_glibc_wrapper, con_m01_l03_pure_lib_fn): ELF binaries enter at _start (crt1.o) -> __libc_start_main(), guarante…ELF binaries enter at _start (crt1.o) -> __libc_start_main(), guaranteeing argv[argc] == NULL and forwarding main()'s 8-bit status (EXIT_SUCCESS / EXIT_FAILURE) to shell $?.box 1 · due
70M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l01_fd_lowest_slot, con_m02_l01_open_flags_bitmask): Every process indexes open VFS objects through non-negative int file d…Every process indexes open VFS objects through non-negative int file descriptors (0..RLIMIT_NOFILE-1), pre-populating 0, 1, 2 and always allocating the lowest unused integer.box 1 · due
71M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l01_fd_lowest_slot, con_m02_l01_open_flags_bitmask): open() requires one access mode (O_RDONLY, O_WRONLY, or O_RDWR, tested…open() requires one access mode (O_RDONLY, O_WRONLY, or O_RDWR, tested via O_ACCMODE) combined with creation/status flags such as O_CREAT, O_EXCL, O_TRUNC, O_APPEND, and O_CLOEXEC.box 1 · due
72M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l01_fd_lowest_slot, con_m02_l01_open_flags_bitmask): Whenever O_CREAT or O_TMPFILE is present, pass the third mode_t argume…Whenever O_CREAT or O_TMPFILE is present, pass the third mode_t argument (0644 or S_I* macros); the kernel applies effective_mode = mode & ~umask.box 1 · due
73M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l01_fd_lowest_slot, con_m02_l01_open_flags_bitmask): Close descriptors in reverse acquisition order on error paths so long-…Close descriptors in reverse acquisition order on error paths so long-running processes never hit EMFILE.box 1 · due
74M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l02_short_counts, con_m02_l02_raw_byte_transfer): write() and read() return signed ssize_t across four regimes: full cou…write() and read() return signed ssize_t across four regimes: full count, positive short count (0 < n < count), 0 (clean EOF on read()), and -1 (EINTR retry vs fatal errno).box 1 · due
75M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l02_short_counts, con_m02_l02_raw_byte_transfer): Wrap binary I/O in write_all() and read_full() helpers that cast void …Wrap binary I/O in write_all() and read_full() helpers that cast void * to uint8_t * and advance pointers by (size_t)n.box 1 · due
76M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l02_short_counts, con_m02_l02_raw_byte_transfer): Never pass raw read() buffers to C string functions without explicit b…Never pass raw read() buffers to C string functions without explicit bounds or buf[n] = '\0' termination.box 1 · due
77M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l02_short_counts, con_m02_l02_raw_byte_transfer): Always call close(fd), check close(fd) == -1 for deferred EIO errors, …Always call close(fd), check close(fd) == -1 for deferred EIO errors, and never retry close(fd) on the Linux kernel.box 1 · due
78M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l03_shared_fpos, con_m02_l03_lseek_whence): Sequential read() and write() calls automatically advance the descript…Sequential read() and write() calls automatically advance the descriptor's shared byte offset f_pos by the transferred count.box 1 · due
79M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l03_shared_fpos, con_m02_l03_lseek_whence): lseek(fd, offset, whence) repositions f_pos relative to SEEK_SET, SEEK…lseek(fd, offset, whence) repositions f_pos relative to SEEK_SET, SEEK_CUR (lseek(fd, 0, SEEK_CUR) queries position), or SEEK_END (lseek(fd, 0, SEEK_END) queries file size).box 1 · due
80M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l03_shared_fpos, con_m02_l03_lseek_whence): lseek() returns (off_t)-1 with EINVAL on negative resulting offsets an…lseek() returns (off_t)-1 with EINVAL on negative resulting offsets and ESPIPE on pipes, FIFOs, and sockets; define _FILE_OFFSET_BITS 64 for 32-bit ARM safety.box 1 · due
81M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_m02_l03_shared_fpos, con_m02_l03_lseek_whence): Combine ENOENT probes, O_CREAT | O_EXCL atomic creation, O_TRUNC overw…Combine ENOENT probes, O_CREAT | O_EXCL atomic creation, O_TRUNC overwrites, and pre-validated SEEK_END bounds checks to build side-effect-safe binary slice tools.box 1 · due
82M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l01_dentry_vs_inode, con_m03_l01_three_tier_vfs): Block storage groups 512-byte sectors into 4 KiB blocks organized into…Block storage groups 512-byte sectors into 4 KiB blocks organized into boot block, superblock, inode table (metadata + extents, never filenames), and directory/data blocks.box 1 · due
83M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l01_dentry_vs_inode, con_m03_l01_three_tier_vfs): Directory entries map filenames to st_ino numbers (ls -i, stat()), all…Directory entries map filenames to st_ino numbers (ls -i, stat()), allowing hard links (link()) to share one underlying inode (st_nlink >= 2).box 1 · due
84M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l01_dentry_vs_inode, con_m03_l01_three_tier_vfs): Calling open() links three dynamic kernel RAM tiers: per-process files…Calling open() links three dynamic kernel RAM tiers: per-process files_struct (fd, FD_CLOEXEC) -> system-wide struct file (f_flags, f_pos, f_count) -> shared VFS struct inode + page cache.box 1 · due
85M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l01_dentry_vs_inode, con_m03_l01_three_tier_vfs): /proc/self/fdinfo/<fd> exposes live kernel pos: and octal flags: for a…/proc/self/fdinfo/<fd> exposes live kernel pos: and octal flags: for any open descriptor, and disk blocks are freed only when both st_nlink == 0 and f_count == 0.box 1 · due
86M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l02_tls_errno, con_m03_l02_strerror_r): Failed Linux kernel syscalls return -errno in registers; glibc wrapper…Failed Linux kernel syscalls return -errno in registers; glibc wrappers store the positive error code in thread-local errno (<errno.h>) and return -1.box 1 · due
87M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l02_tls_errno, con_m03_l02_strerror_r): Successful calls never reset errno to 0; always check ret == -1 first,…Successful calls never reset errno to 0; always check ret == -1 first, capture int saved_errno = errno; immediately, and format via perror() or thread-safe strerror_r().box 1 · due
88M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l02_tls_errno, con_m03_l02_strerror_r): Memorize the high-frequency diagnostic codes: ENOENT (2), EINTR (4), E…Memorize the high-frequency diagnostic codes: ENOENT (2), EINTR (4), EIO (5), EBADF (9), EAGAIN (11), EACCES (13), EEXIST (17), EINVAL (22), ENOSPC (28), and ESPIPE (29).box 1 · due
89M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l02_tls_errno, con_m03_l02_strerror_r): return in main and exit() run atexit() handlers (LIFO) and flush stdio…return in main and exit() run atexit() handlers (LIFO) and flush stdio streams, whereas _exit() / _Exit() trap directly to the kernel without user-space buffer flushing.box 1 · due
90M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l03_sparse_hole, con_m03_l03_st_blocks_units): Seeking past EOF with lseek() and calling write() creates a sparse hol…Seeking past EOF with lseek() and calling write() creates a sparse hole file: read() across unallocated holes returns VFS-synthesized 0x00 bytes without consuming physical disk blocks.box 1 · due
91M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l03_sparse_hole, con_m03_l03_st_blocks_units): fstat() separates logical byte length st.st_size (ls -lh) from physica…fstat() separates logical byte length st.st_size (ls -lh) from physical storage (long long)st.st_blocks * 512LL (du -h, always counted in 512-byte POSIX units).box 1 · due
92M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l03_sparse_hole, con_m03_l03_st_blocks_units): O_TRUNC (with O_WRONLY or O_RDWR) resets st_size to 0 and reclaims all…O_TRUNC (with O_WRONLY or O_RDWR) resets st_size to 0 and reclaims allocated blocks during open().box 1 · due
93M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_m03_l03_sparse_hole, con_m03_l03_st_blocks_units): O_APPEND leaves read() seekable via lseek(), but forces every write() …O_APPEND leaves read() seekable via lseek(), but forces every write() inside the Linux kernel to jump atomically to EOF, ignoring any prior lseek() offset.box 1 · due
94M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_dual_open_tables, con_m04_dup_shared_file): Two open() calls on the same path create two independent struct file e…Two open() calls on the same path create two independent struct file entries with separate f_pos cursors over one shared struct inode and page cache.box 1 · due
95M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_dual_open_tables, con_m04_dup_shared_file): dup(), dup2(), and dup3() bind multiple descriptor integers to a singl…dup(), dup2(), and dup3() bind multiple descriptor integers to a single struct file, sharing f_pos and f_flags while keeping FD_CLOEXEC private to each descriptor slot.box 1 · due
96M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_dual_open_tables, con_m04_dup_shared_file): dup2(fd, fd) is a safe no-op returning fd, whereas dup3(fd, fd, O_CLOE…dup2(fd, fd) is a safe no-op returning fd, whereas dup3(fd, fd, O_CLOEXEC) returns -1 with errno == EINVAL.box 1 · due
97M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_dual_open_tables, con_m04_dup_shared_file): Redirecting STDOUT_FILENO safely requires saving the original descript…Redirecting STDOUT_FILENO safely requires saving the original descriptor with dup(), rebinding with dup2(), calling fflush(stdout) before restoring, and closing the saved duplicate.box 1 · due
98M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_toctou_oexcl, con_m04_stateless_pread_pwrite): Any file invariant split across two user-space syscalls (access + open…Any file invariant split across two user-space syscalls (access + open, or lseek + write) is vulnerable to kernel scheduler preemption races.box 1 · due
99M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_toctou_oexcl, con_m04_stateless_pread_pwrite): open(..., O_CREAT | O_EXCL, mode) fuses existence testing and inode cr…open(..., O_CREAT | O_EXCL, mode) fuses existence testing and inode creation into one atomic VFS directory operation that fails with EEXIST on collision.box 1 · due
100M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_toctou_oexcl, con_m04_stateless_pread_pwrite): pread() and pwrite() transfer bytes at an explicit off_t coordinate wi…pread() and pwrite() transfer bytes at an explicit off_t coordinate without reading or mutating struct file.f_pos (provided O_APPEND is not set on Linux).box 1 · due
101M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_toctou_oexcl, con_m04_stateless_pread_pwrite): Opening log descriptors with O_APPEND serializes offset placement (f_p…Opening log descriptors with O_APPEND serializes offset placement (f_pos = i_size) and payload copy under the kernel inode write lock.box 1 · due
102M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_fcntl_flag_tiers, con_m04_ioctl_out_of_band): fcntl() separates per-descriptor table control (F_DUPFD_CLOEXEC, F_GET…fcntl() separates per-descriptor table control (F_DUPFD_CLOEXEC, F_GETFD/F_SETFD for FD_CLOEXEC) from shared struct file status flags (F_GETFL/F_SETFL).box 1 · due
103M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_fcntl_flag_tiers, con_m04_ioctl_out_of_band): F_SETFL can toggle O_APPEND, O_NONBLOCK, O_ASYNC, O_DIRECT, and O_NOAT…F_SETFL can toggle O_APPEND, O_NONBLOCK, O_ASYNC, O_DIRECT, and O_NOATIME via read-modify-write, whereas (flags & O_ACCMODE) is immutable after open().box 1 · due
104M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_fcntl_flag_tiers, con_m04_ioctl_out_of_band): ioctl() dispatches out-of-band driver and kernel queries (FIONREAD, TI…ioctl() dispatches out-of-band driver and kernel queries (FIONREAD, TIOCGWINSZ) and fails with ENOTTY when applied to an inappropriate file type.box 1 · due
105M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_m04_fcntl_flag_tiers, con_m04_ioctl_out_of_band): ftruncate() (requiring a writable fd) and truncate() shrink or zero-ex…ftruncate() (requiring a writable fd) and truncate() shrink or zero-extend regular files directly without modifying struct file.f_pos.box 1 · due
106M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_file_stream_struct, con_m05_fopen_mode_mapping): glibc FILE streams wrap integer file descriptors with user-space buffe…glibc FILE streams wrap integer file descriptors with user-space buffers and sticky status flags to amortize user-to-kernel syscall overhead across small I/O operations.box 1 · due
107M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_file_stream_struct, con_m05_fopen_mode_mapping): Every C process begins with pre-opened stdin (0), stdout (1), and stde…Every C process begins with pre-opened stdin (0), stdout (1), and stderr (2) streams declared in <stdio.h>.box 1 · due
108M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_file_stream_struct, con_m05_fopen_mode_mapping): fopen() modes "r", "r+", "w", "w+", "a", and "a+" map deterministicall…fopen() modes "r", "r+", "w", "w+", "a", and "a+" map deterministically to O_RDONLY/O_RDWR/O_WRONLY plus O_CREAT, O_TRUNC, or O_APPEND, while "b" is a POSIX no-op.box 1 · due
109M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_file_stream_struct, con_m05_fopen_mode_mapping): Linux glibc extensions "e" (O_CLOEXEC) and "x" (O_EXCL) close descript…Linux glibc extensions "e" (O_CLOEXEC) and "x" (O_EXCL) close descriptor-leak and file-creation race windows inside the initial openat() syscall.box 1 · due
110M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_item_counted_io, con_m05_fseeko_turnaround): fread() and fwrite() return counts of complete items (0..nmemb); use s…fread() and fwrite() return counts of complete items (0..nmemb); use size = 1 for raw byte buffers or size = sizeof(struct) for fixed binary records.box 1 · due
111M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_item_counted_io, con_m05_fseeko_turnaround): Prefer 64-bit fseeko() and ftello() (off_t), and remember rewind(fp) r…Prefer 64-bit fseeko() and ftello() (off_t), and remember rewind(fp) resets both position 0 and sticky stream error/end-of-file indicators.box 1 · due
112M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_item_counted_io, con_m05_fseeko_turnaround): On update ("+") streams, always insert fseeko() (or fflush() after wri…On update ("+") streams, always insert fseeko() (or fflush() after writes) when switching between fwrite() and fread().box 1 · due
113M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_item_counted_io, con_m05_fseeko_turnaround): Drive read loops with while (fread(...) == 1) rather than while (!feof…Drive read loops with while (fread(...) == 1) rather than while (!feof(fp)), then inspect ferror(fp) vs feof(fp) after the loop terminates.box 1 · due
114M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_snprintf_truncation, con_m05_portable_format_macros): Never call sprintf(); always bound output with snprintf(buf, sz, ...) …Never call sprintf(); always bound output with snprintf(buf, sz, ...) (or emit directly to a descriptor via dprintf(fd, ...)) and test ret < 0 || (size_t)ret >= sz.box 1 · due
115M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_snprintf_truncation, con_m05_portable_format_macros): Match exact C types to length modifiers (%zu/%zd for size_t/ssize_t, P…Match exact C types to length modifiers (%zu/%zd for size_t/ssize_t, PRId64/PRIu64 for 64-bit integers) so -Wformat -Werror passes across 32-bit and 64-bit targets.box 1 · due
116M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_snprintf_truncation, con_m05_portable_format_macros): Set scanf/sscanf string and scanset widths to sizeof(buf) - 1 (%31[^\n…Set scanf/sscanf string and scanset widths to sizeof(buf) - 1 (%31[^\n] for char[32]) to reserve room for the terminating '\0'.box 1 · due
117M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_m05_snprintf_truncation, con_m05_portable_format_macros): Parse text streams line-first with fgets() (draining oversized lines) …Parse text streams line-first with fgets() (draining oversized lines) plus sscanf()/strtol() so malformed records never wedge the input stream.box 1 · due
118M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_page_cache_writeback, con_m06_fdatasync_dirsync): A successful write() only places bytes in the volatile Linux kernel pa…A successful write() only places bytes in the volatile Linux kernel page cache; surviving power loss requires an explicit persistence barrier.box 1 · due
119M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_page_cache_writeback, con_m06_fdatasync_dirsync): fsync(fd) flushes data and all inode metadata, fdatasync(fd) skips non…fsync(fd) flushes data and all inode metadata, fdatasync(fd) skips non-essential timestamp flushes for higher commit throughput, and fsync(dir_fd) hardens newly created or renamed directory entries.box 1 · due
120M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_page_cache_writeback, con_m06_fdatasync_dirsync): O_SYNC and O_DSYNC apply fsync or fdatasync semantics automatically on…O_SYNC and O_DSYNC apply fsync or fdatasync semantics automatically on every write() to that open file description.box 1 · due
121M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_page_cache_writeback, con_m06_fdatasync_dirsync): O_DIRECT bypasses the page cache via posix_memalign() buffers when mem…O_DIRECT bypasses the page cache via posix_memalign() buffers when memory address, transfer size, and file offset are all block-aligned (falling back cleanly if tmpfs returns EINVAL).box 1 · due
122M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_setvbuf_modes, con_m06_two_stage_durability): glibc FILE streams support _IOFBF (full, default on files/pipes), _IOL…glibc FILE streams support _IOFBF (full, default on files/pipes), _IOLBF (line, default on terminals), and _IONBF (unbuffered, default on stderr), configured via setvbuf() before any I/O.box 1 · due
123M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_setvbuf_modes, con_m06_two_stage_durability): Normal exit() flushes all user-space FILE streams, whereas _exit() ter…Normal exit() flushes all user-space FILE streams, whereas _exit() terminates immediately in the kernel and drops unflushed user-space buffers (and fflush(NULL) must precede fork()).box 1 · due
124M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_setvbuf_modes, con_m06_two_stage_durability): Power-safe stdio durability requires the strict two-stage barrier fwri…Power-safe stdio durability requires the strict two-stage barrier fwrite() -> fflush(fp) -> fdatasync(fileno(fp)) -> fclose(fp).box 1 · due
125M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_setvbuf_modes, con_m06_two_stage_durability): fdopen(fd, mode) transfers descriptor ownership to fp (fclose(fp) clos…fdopen(fd, mode) transfers descriptor ownership to fp (fclose(fp) closes fd); fileno(fp) borrows the integer without transferring ownership.box 1 · due
126M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_crc32_wal_framing, con_m06_torn_tail_ftruncate): A crash-safe Write-Ahead Log synthesizes O_CLOEXEC handle hygiene, bin…A crash-safe Write-Ahead Log synthesizes O_CLOEXEC handle hygiene, binary length-prefixed CRC32 framing, fdatasync() + directory fsync() durability barriers, ftruncate() torn-tail healing, and stateless pread() indexed reads.box 1 · due
127M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_crc32_wal_framing, con_m06_torn_tail_ftruncate): Checksumming both header lengths and payload bytes lets startup recove…Checksumming both header lengths and payload bytes lets startup recovery distinguish committed transactions from torn or corrupted crash tails deterministically.box 1 · due
128M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_crc32_wal_framing, con_m06_torn_tail_ftruncate): Append-only immutable frames turn overwrites into sequential tail appe…Append-only immutable frames turn overwrites into sequential tail appends, preventing in-place power-loss corruption while allowing lock-free pread() lookups on committed offsets.box 1 · due
129M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_m06_crc32_wal_framing, con_m06_torn_tail_ftruncate): With Linux file I/O, kernel descriptor tables, stdio codecs, and two-l…With Linux file I/O, kernel descriptor tables, stdio codecs, and two-layer durability mastered in GL-C01, you are ready for filesystems, signals, processes, and threads in GL-C02.box 1 · due
130M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_sys_001_vdso_fastpath): Standard system calls cross from Ring 3 / EL0 user mode into Ring 0 / …Standard system calls cross from Ring 3 / EL0 user mode into Ring 0 / EL1 Linux kernel mode via synchronous CPU trap instructions (syscall on x86_64, svc #0 on ARM), flushing pipeline state and switching stacks, whereas the Linux kernel maps linux-vdso.so.1 (passed via ELF auxiliary vector AT_SYSINFO_EHDR and visible in /proc/self/maps) as a read-only shared kernel page so latency-critical queries like clock_gettime(CLOCK_MONOTONIC) and gettimeofday() read timekeeper sequence data directly in user space with zero privilege switches and 0 strace syscall traps.box 1 · due
131M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_sys_002_c11_ub_taxonomy): ISO C11 distinguishes well-defined unsigned modulo arithmetic, unspeci…ISO C11 distinguishes well-defined unsigned modulo arithmetic, unspecified evaluation order, implementation-defined choices (plain char is unsigned [0..255] on ARM EABI vs signed [-128..127] on x86_64 System V), and Undefined Behavior (signed integer overflow, shifts < 0 or >= bit-width, null/dangling dereference, and -fstrict-aliasing pointer type-punning). Under the C11 as-if rule, GCC -O2 assumes UB never occurs and deletes downstream guards like (len + hdr < len), whereas zero-cost type-punning uses memcpy(&dst, &src, sizeof(dst)), struct layout obeys _Alignof and offsetof padding rules, and host builds verify memory and arithmetic safety with -fsanitize=address,undefined (ASan and UBSan).box 1 · due
132M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_sys_003_fno_common_visibility): In ISO C11, an uninitialized file-scope declaration such as int status…In ISO C11, an uninitialized file-scope declaration such as int status; without extern is a tentative definition that emits an allocated .bss symbol per translation unit under GCC 10+ (-fno-common default), causing multiple-definition linker errors unless headers declare extern int status; and exactly one .c file defines it. Static archives (ar rcs libfoo.a) must appear after callers on the link line, while static linkage and visibility attributes separate module-private STB_LOCAL symbols from exported STB_GLOBAL and STB_WEAK symbols in nm and readelf -sW.box 1 · due
133M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_sys_004_plt_got_interp): Position-Independent Code (PIC) routes external shared-library calls s…Position-Independent Code (PIC) routes external shared-library calls such as write@plt through Procedure Linkage Table (.plt) trampolines and Global Offset Table (.got.plt / .got) slots populated by the ELF PT_INTERP runtime loader (ld-linux) via JUMP_SLOT relocations (inspected with readelf -l -rW -d, objdump -d, and LD_DEBUG=bindings), enabling symbol interposition via LD_PRELOAD or ld --wrap=sym. If the PT_INTERP dynamic loader path encoded in the ELF header is absent from a container or target rootfs, execve() fails with ENOENT even though the binary file itself exists.box 1 · due
134M1 · Series Orientation, Kernel Boundary & C ToolchainfactComplete the statement (fact: con_sys_005_crt_auxv_abi): During execve(), the Linux kernel ELF loader maps .text (read-execute)…During execve(), the Linux kernel ELF loader maps .text (read-execute), .rodata (read-only), and .data/.bss (read-write VMA segments) and builds the initial user stack containing argc, argv[] pointers, NULL, envp[] pointers, NULL, and Elf_auxv_t key-value pairs before jumping to _start (crt1.o), which aligns the stack pointer to ABI boundaries and calls __libc_start_main() to execute .init_array constructors prior to main() and .fini_array / atexit() handlers on normal return.box 1 · due
135M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_sys_006_unsigned_bitops): Bitwise flag composition and register masks must operate on unsigned i…Bitwise flag composition and register masks must operate on unsigned integer types (1U << 31, UINT32_C(1) << bit) because shifting into the sign bit of a 32-bit signed int (1 << 31) or shifting by >= bit-width (x >> 32 when n == 0) is ISO C11 Undefined Behavior. Masking 32-bit left rotation as (x << (n & 31U)) | (x >> ((-n) & 31U)) eliminates the n == 0 UB edge and lowers under GCC -O2 to a single hardware rotate instruction.box 1 · due
136M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_sys_007_max_rw_count): POSIX read() and write() return signed ssize_t (-1 on error), and the …POSIX read() and write() return signed ssize_t (-1 on error), and the Linux kernel caps every single read() or write() transfer—even on 64-bit local regular files—to MAX_RW_COUNT (0x7ffff000 = 2,147,479,552 bytes, one 4 KiB page below 2 GiB). Storing the return value in unsigned size_t promotes -1 into SIZE_MAX, wrapping pointer arithmetic (p += n; left -= n) into segmentation faults, whereas signed ssize_t retry loops transfer multi-gigabyte payloads safely.box 1 · due
137M2 · Core Unbuffered POSIX File I/OfactComplete the statement (fact: con_sys_008_seek_data_hole): Under _FILE_OFFSET_BITS=64, off_t is a signed 64-bit integer so negati…Under _FILE_OFFSET_BITS=64, off_t is a signed 64-bit integer so negative SEEK_CUR deltas and (off_t)-1 errors remain representable; checking (delta > 0 && cur > INT64_MAX - delta) prevents signed overflow UB before lseek(). On Linux (_GNU_SOURCE), lseek(fd, cur, SEEK_DATA) and lseek(fd, data_off, SEEK_HOLE) query filesystem extent trees directly in O(extents) time (returning ENXIO at EOF) without reading unallocated sparse zero blocks into RAM.box 1 · due
138M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_sys_009_vfs_container_of): The Linux VFS implements zero-overhead polymorphism in ISO C by dispat…The Linux VFS implements zero-overhead polymorphism in ISO C by dispatching generic read(), write(), and lseek() calls through struct file_operations and struct inode_operations vtables across ext4, pipefs, procfs, and character drivers, while subsystems embed anchor structs intrusively and recover the enclosing parent struct via offsetof(type, member) with compile-time pointer-type checking (CONTAINER_OF) and remove list nodes without special-case head branches via indirect pointers (struct node **pp).box 1 · due
139M3 · Kernel Open-File Internals, Errors & Sparse FilesfactComplete the statement (fact: con_sys_010_lifo_goto_cleanup): Multi-resource C functions (open -> mmap -> malloc) prevent leaks with…Multi-resource C functions (open -> mmap -> malloc) prevent leaks without deeply nested branches by initializing int rc = -1, pre-initializing pointers/descriptors to NULL/-1, and unwinding in strict reverse acquisition (LIFO) order via numbered goto labels (goto out_buf; goto out_fd;)—avoiding the two classic goto defects of returning rc = 0 on failure or calling free() on uninitialized stack slots—or by binding GCC __attribute__((cleanup(fn))) scope guards (mirrored by Linux 6.12 <linux/cleanup.h>).box 1 · due
140M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_sys_011_dir_pinned_at_ops): Path-based syscalls re-walk directory prefixes on every call, allowing…Path-based syscalls re-walk directory prefixes on every call, allowing a concurrent attacker or cleaner to swap a parent path with a symlink; pinning operations to an O_RDONLY | O_DIRECTORY | O_CLOEXEC descriptor via openat(dfd, name, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, 0600), O_TMPFILE + linkat(), and renameat() / renameat2(..., RENAME_NOREPLACE) eliminates path-prefix TOCTOU races, and pairing write_all() + fdatasync(tfd) + close(tfd) + renameat(dfd, tmp, dfd, dst) + fsync(dfd) achieves crash-safe atomic file replacement.box 1 · due
141M4 · File Sharing, Atomic Operations & Descriptor ControlfactComplete the statement (fact: con_sys_012_ioctl_abi_layout): Linux _IOR, _IOW, and _IOWR macros encode direction [31:30], payload b…Linux _IOR, _IOW, and _IOWR macros encode direction [31:30], payload byte size sizeof(struct) [29:16], magic type [15:8], and command number [7:0] directly into the 32-bit ioctl request code (_IOC_SIZE(cmd)). Using long, pointers, or implicit padding holes alters sizeof(struct) between 32-bit ARM and 64-bit x86_64 builds (causing ENOTTY) and risks kernel stack infoleaks unless UAPI structs use fixed-width uint32_t/uint64_t fields, explicit zero-checked reserved fields, memset(&cfg, 0, sizeof(cfg)), and _Static_assert(sizeof(...) == expected).box 1 · due
142M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_sys_013_memstream_file_vtable): A glibc FILE control block maintains user-space _IO_read_ptr/_IO_read_…A glibc FILE control block maintains user-space _IO_read_ptr/_IO_read_end and _IO_write_ptr/_IO_write_end cursors plus an internal lock so fgetc() and fputc() advance RAM pointers until buffer refill/flush; POSIX.1-2008 open_memstream(&buf, &sz) and fmemopen(buf, len, mode) attach that exact FILE interface onto dynamic heap or caller-owned memory buffers (with fileno(mfp) returning -1 and errno == EBADF), eliminating fragile temporary files when testing or driving FILE *-based serializers.box 1 · due
143M5 · Standard C Library (stdio) Streams & Formatted I/OfactComplete the statement (fact: con_sys_014_fgetc_eof_char_trap): ISO C11 specifies that fgetc() and getchar() read the next byte as uns…ISO C11 specifies that fgetc() and getchar() read the next byte as unsigned char [0..255] converted to int, reserving negative (int)-1 for EOF—257 distinct outcomes that cannot fit inside any 8-bit char. Assigning the result to char c causes valid binary byte 0xFF to sign-extend to -1 on x86_64 (premature false EOF) and causes (c != EOF) to evaluate true forever on ARM EABI / -funsigned-char where unsigned char [0..255] never equals -1; always capture int ch = fgetc(fp); check ch != EOF, and cast (uint8_t)ch.box 1 · due
144M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_sys_015_statx_dio_mmap_faults): Buffered I/O dirties page-cache folios governed by vm.dirty_background…Buffered I/O dirties page-cache folios governed by vm.dirty_background_ratio and vm.dirty_ratio, whereas Linux 6.1+ statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &sx) queries exact stx_dio_mem_align and stx_dio_offset_align boundaries for O_DIRECT DMA, and posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED) evicts cold sequential cache pages. The same VFS page cache backs demand-paged mmap(): first-touch PTE population records minor faults (ru_minflt / /proc/self/stat minflt) when pages reside in RAM versus major faults (ru_majflt / majflt) on storage reads, while MAP_SHARED aliases page-cache frames directly and MAP_PRIVATE clones private Copy-on-Write pages on store.box 1 · due
145M6 · Two-Layer I/O Buffering, Durability & Capstone EnginefactComplete the statement (fact: con_sys_016_crc32_wal_epoch): Reflected IEEE 802.3 CRC32 (polynomial 0xEDB88320U) processes bits LSB…Reflected IEEE 802.3 CRC32 (polynomial 0xEDB88320U) processes bits LSB-first to match little-endian byte order using the branchless mask crc = (crc >> 1) ^ (0xEDB88320U & -(crc & 1U)) without data-dependent branch mispredictions. When Write-Ahead Log files pre-allocate or recycle sectors without truncating to zero, pairing magic + crc32 with a strictly monotonic 64-bit seq/epoch header field ensures recovery stops immediately if an interrupted overwrite exposes a syntactically valid CRC frame left over from an older epoch.box 1 · due

search — fzf

0/0 ───────────────────────────────────────────

keyboard shortcuts — less

/
search
f
focus mode
[
previous
]
next
?
help
Esc
close

figure