You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gendwarfksyms: Add support for reserved structure fields
Distributions that want to maintain a stable kABI need the ability to
add reserved fields to kernel data structures that they anticipate
will be modified during the ABI support timeframe, either by LTS
updates or backports.
With genksyms, developers would typically hide changes to the reserved
fields from version calculation with #ifndef __GENKSYMS__, which would
result in the symbol version not changing even though the actual type
of the reserved field changes. When we process precompiled object
files, this is again not an option.
To support stable symbol versions for reserved fields, change the
union type processing to recognize field name prefixes, and if the
union contains a field name that starts with __kabi_reserved, only use
the type of that field for computing symbol versions. In other words,
let's assume we have a structure where we want to reserve space for
future changes:
struct struct1 {
long a;
long __kabi_reserved_0; /* reserved for future use */
};
struct struct1 exported;
gendwarfksyms --debug produces the following output:
variable structure_type struct1 {
member base_type long int byte_size(8) encoding(5) data_member_location(0),
member base_type long int byte_size(8) encoding(5) data_member_location(8),
} byte_size(16);
#SYMVER exported 0x67997f89
To take the reserved field into use, a distribution would replace it
with a union, with one of the fields keeping the __kabi_reserved name
prefix for the original type:
struct struct1 {
long a;
union {
long __kabi_reserved_0;
struct {
int b;
int v;
};
};
gendwarfksyms --debug now produces the following output:
variable structure_type struct1 {
member base_type long int byte_size(8) encoding(5) data_member_location(0),
member union_type <unnamed> {
member base_type long int byte_size(8) encoding(5),
member structure_type <unnamed> {
member base_type int byte_size(4) encoding(5) data_member_location(0),
member base_type int byte_size(4) encoding(5) data_member_location(4),
} byte_size(8),
} byte_size(8) data_member_location(8),
} byte_size(16);
#SYMVER exported 0x66916c41
But with --stable, gendwarfksyms only uses the reserved field for the
version calculation, thus leaving the symbol version unchanged:
variable structure_type struct1 {
member base_type long int byte_size(8) encoding(5) data_member_location(0),
member base_type long int byte_size(8) encoding(5) data_member_location(8),
} byte_size(16);
#SYMVER exported 0x67997f89
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
0 commit comments