Skip to content

Flexible Array Transformations and Array-bounds Checking - Gustavo A. R. Silva, The Linux Foundation

Flexible Array TransformationsArray-bounds Checking

Blue TeamLinux Security Summit Europe46 minAdvancedOpen on YouTube ↗

Evaluates flexible Array Transformations and Array-bounds Checking - Gustavo A. R. Silva, The Linux Foundation and evaluates key implications for security practitioners.

Summary

Kernel Background

Gustavo Silva of the Linux kernel self-protection project and Google OSS security explains how C arrays, trailing arrays, and flexible structures underpin much kernel code—and many bugs.

Flexible Array History

Kernel code historically declared variable-length trailing data using one-element or zero-length array hacks predating C99 flexible array members. One-element arrays skew size calculations and invite off-by-one allocation mistakes.

True vs Fake Flex Arrays

C99 flexible array members are the standards-based approach, unlike GNU zero-length extensions or deprecated one-element patterns. Silva shows why developers must subtract phantom element sizes or use struct_size helpers when allocating.

Project Goals

Multiple incompatible flexible-array styles block reliable bounds checking across the tree. The ongoing transformation work audits size usage, updates user API call sites, and aims to remove ambiguity so the kernel can enforce safer array access.

Related talks