• Linus Torvalds's avatar
    asm alternatives: remove incorrect alignment notes · a7f934d4
    Linus Torvalds authored
    On x86-64, they were just wasteful: with the explicitly added (now
    unnecessary) padding, the size of the alternatives structure was 16
    bytes, and an alignment of 8 bytes didn't hurt much.
    
    However, it was still silly, since the natural size and alignment for
    the structure is actually just 12 bytes, 4-byte aligned since commit
    59e97e4d ("x86: Make alternative instruction pointers relative").
    So removing the padding, and removing the extra alignment is just a good
    idea.
    
    On x86-32, the alignment of 4 bytes was correct, but was incorrectly
    hardcoded as 8 bytes in <asm/alternative-asm.h>.  That header file had
    used to be an x86-64 only header file, but various unification efforts
    have made it be used for x86-32 too (ie the unification of rwlock and
    rwsem).
    
    That in turn caused x86-32 boot failures, because the extra alignment
    would result in random zero-filled words in the altinstructions section,
    causing oopses early at boot when doing alternative instruction
    replacement.
    
    So just remove all the alignment noise entirely.  It's wrong, and it's
    unnecessary.  The section itself is already properly aligned by the
    linker scripts, and all additions to the section had better be of the
    proper 12-byte format, keeping it aligned.  So if the align directive
    were to ever make a difference, that would be an indication of a serious
    bug to begin with.
    Reported-by: default avatarWerner Landgraf <w.landgraf@ru.r>
    Acked-by: default avatarAndrew Lutomirski <luto@mit.edu>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    a7f934d4
alternative.h 6.58 KB