Flexible Array Transformations and Array-bounds Checking
summary
Kernel code is being converted from one-element and zero-length trailing arrays into C99 flexible-array members so compilers and fortified memcpy can actually reason about sizes; transforming zero-length arrays is mostly done but one-element conversions need manual audit for off-by-one bugs and ABI-safe UAPI handling using the declare_flex_array helper. GCC currently treats all trailing arrays as flexible so __builtin_object_size returns -1; a new option -fstrict-flex-arrays (levels up to true-only) plus use of struct_size and tools like objdump and Ghidra are needed to finish enabling -Warray-bounds and hardened memcpy.
AI-written summary · about
chapters (4)
- 0:00Start
- 12:15Problems with ambiguous flexible-array variants
- 34:28The case of UAPI
- 36:19Flexible array transformations in the Linux kernel
related talks
01h 10mEnhancing Spatial Safety: Better Array-bounds Checking in C (and Linux)
46mMeaningful Bounds Checking in the Linux Kernel
37mComposite Array Types in C
52mNon-conforming C++: the Secrets the Committee Is Hiding From You
01h 30mDangerous Optimizations in C and C++ Programming Languages
01h 28mProgramming in Modern C with a Sneak Peek into C23
01h 00m“Evolving array_view and string_view for safe C++ code"
29mintegral types
