diff options
| author | Thomas Weißschuh <linux@weissschuh.net> | 2025-10-29 09:12:12 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-11-26 15:16:35 +0100 |
| commit | 02ac5335a55111d87a7a618355261b4407ed0f7f (patch) | |
| tree | 75db4532922530c28803598fb0a5d75d2ee714c4 /fs/sysfs/group.c | |
| parent | 964c93b1eef37e3bbe0edb37346c076217d71fe7 (diff) | |
sysfs: introduce __SYSFS_FUNCTION_ALTERNATIVE()
For the constification phase of 'struct attribute' various callback
struct members will need to exist in both const and non-const variants.
Keeping both members in a union avoids memory and CPU overhead but will
be detected and trapped by Control Flow Integrity (CFI). By deciding
between a struct and a union depending whether CFI is enabled, most
configurations can avoid this overhead. Code using these callbacks will
still need to be updated to handle both members explicitly.
In the union case the compiler will recognize that testing for one union
member is enough and optimize away the code for the other one.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20251029-sysfs-const-attr-prep-v5-3-ea7d745acff4@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/sysfs/group.c')
0 files changed, 0 insertions, 0 deletions