cgroups: Make struct cftype instances write-rarely
As found in PaX, mark struct cftype with __do_const and add helpers
to deal with rare writes. This is a more complex example of a write-rarely
structure, which needs to use list helpers and blocks of enable/disable
pairs to perform the needed updates.
With this change and the constify plugin enabled, the before/after
section byte sizes show:
before:
rodata: 0x2cc2f0
data: 0x130d00
after:
rodata: 0x2cf2f0 (+74478)
data: 0x12e5c0 (-65710)
Signed-off-by: Kees Cook <keescook@chromium.org>
2 files changed