Skip to content
  • Kees Cook's avatar
    gcc-plugins: structleak: Generalize to all variable types · 81a56f6d
    Kees Cook authored
    This adjusts structleak to also work with non-struct types when they
    are passed by reference, since those variables may leak just like
    anything else. This is exposed via an improved set of Kconfig options.
    (This does mean structleak is slightly misnamed now.)
    
    Building with CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL should give the
    kernel complete initialization coverage of all stack variables passed
    by reference, including padding (see lib/test_stackinit.c).
    
    Using CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE to count added initializations
    under defconfig:
    
    	..._BYREF:      5945 added initializations
    	..._BYREF_ALL: 16606 added initializations
    
    There is virtually no change to text+data size (both have less than 0.05%
    growth):
    
       text    data     bss     dec     hex filename
    19502103        5051456 1917000 26470559        193e89f vmlinux.stock
    19513412        5051456 1908808 26473676        193f4cc vmlinux.byref
    19516974        5047360 1900616 26464950       ...
    81a56f6d