Skip to content

ext4: Copied preprocessed code when it shouldn't #17

@marcosps

Description

@marcosps

When trying to create a livepatch for function ext4_reconfigure, file fs/ext4/super.c, on upstream, it generates the following code:

__attribute__((gnu_inline)) __attribute__((unused)) __attribute__((no_instrument_function)) static inline bool ext4_has_feature_metadata_csum(struct super_block *sb) {                                                                                                   
    return ((EXT4_SB(sb)->s_es->s_feature_ro_compat & ((__le32)(__u32)(1024))) != 0);                                                
}  

The original code, a macro in this case, has the following code on file fs/ext4/ext4.h:

...
static inline bool ext4_has_feature_##name(struct super_block *sb) \                                                                 
{ \                                                                                                                                  
        return ((EXT4_SB(sb)->s_es->s_feature_compat & \                                                                             
                cpu_to_le32(EXT4_FEATURE_COMPAT_##flagname)) != 0); \                                                                
} \     
...

For this livepatch specifically it should be good to import the code as it was written, instead of copying the preprocessed one. When a livepatch is generated for multiple architectures, resolving cpu_to_le32 is problematic, since it changes according the machine architecture it's being generated on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingkernelIssue found on Linux Kernel

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions