m68knommu: align BSS section to 4-byte boundaries
PATCH 1/1 m68knommu: align BSS section to 4-byte boundaries
The kernel start up code for all of the nommu m68k types expects the BSS section to be on a 4-byte boundary, and to be a whole number of 32bit words. The BSS initialization loop sets 32bit sized quantities and has no provision for odd or unaligned accesses.
Although this has always been the case, in practice the BSS was typically aligned and sized this way. The problem was first observed after commit 7273ad2b08f8 ("kbuild: link lib-y objects to vmlinux forcibly when CONFIG_MODULES=y"). Some kernel builds, depending on exact configuration, then tended to generate even sized BSS sections - which is valid on m68k - but our BSS init code could not handle properly.
The simplest and smallest solution is to align the BSS appropriately.
--- arch/m68k/kernel/vmlinux-nommu.lds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/vmlinux-nommu.lds +1 -1
@@ -82,7 +82,7 @@ SECTIONS { __init_end = .; } - BSS_SECTION(0, 0, 0) + BSS_SECTION(4, 0, 4) _end = .;
Signature · 1 line
2.25.1
Quoted 7 lines · Greg Ungerer
The kernel start up code for all of the nommu m68k types expects the BSS section to be on a 4-byte boundary, and to be a whole number of 32bit words. The BSS initialization loop sets 32bit sized quantities and has no provision for odd or unaligned accesses.
Although this has always been the case, in practice the BSS was typically aligned and sized this way. The problem was first observed after commit
not aligned and sized ... ?
Best regards
Philippe
Signature · 1 line
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles
Hi Philippe,
Quoted 10 lines · Philippe De Muyter
Quoted 7 lines · Greg Ungerer
The kernel start up code for all of the nommu m68k types expects the BSS section to be on a 4-byte boundary, and to be a whole number of 32bit words. The BSS initialization loop sets 32bit sized quantities and has no provision for odd or unaligned accesses.
Although this has always been the case, in practice the BSS was typically aligned and sized this way. The problem was first observed after commit
not aligned and sized ... ?
No, I really was saying that it typically worked out that the BSS was aligned and sized to 4-bytes. So it almost always worked ok.
Perhaps if I reword it to make it clearer:
The BSS copy has always been coded this way, and by luck, the alignment and size of the BSS has historically worked out to be 4-byte aligned.
Regards
Greg