All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] m68knommu: align BSS section to 4-byte boundaries
@ 2020-10-12  4:34 Greg Ungerer
  2020-10-12 13:34 ` Philippe De Muyter
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Ungerer @ 2020-10-12  4:34 UTC (permalink / raw)
  To: linux-m68k; +Cc: 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
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.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
 arch/m68k/kernel/vmlinux-nommu.lds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/kernel/vmlinux-nommu.lds b/arch/m68k/kernel/vmlinux-nommu.lds
index 7b975420c3d9..730bb653f9c1 100644
--- a/arch/m68k/kernel/vmlinux-nommu.lds
+++ b/arch/m68k/kernel/vmlinux-nommu.lds
@@ -82,7 +82,7 @@ SECTIONS {
 		__init_end = .;
 	}
 
-	BSS_SECTION(0, 0, 0)
+	BSS_SECTION(4, 0, 4)
 
 	_end = .;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] m68knommu: align BSS section to 4-byte boundaries
  2020-10-12  4:34 [PATCH] m68knommu: align BSS section to 4-byte boundaries Greg Ungerer
@ 2020-10-12 13:34 ` Philippe De Muyter
  2020-10-12 14:00   ` Greg Ungerer
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe De Muyter @ 2020-10-12 13:34 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: linux-m68k

On Mon, Oct 12, 2020 at 02:34:32PM +1000, Greg Ungerer wrote:
> 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

-- 
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] m68knommu: align BSS section to 4-byte boundaries
  2020-10-12 13:34 ` Philippe De Muyter
@ 2020-10-12 14:00   ` Greg Ungerer
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Ungerer @ 2020-10-12 14:00 UTC (permalink / raw)
  To: Philippe De Muyter; +Cc: linux-m68k

Hi Philippe,

On 12/10/20 11:34 pm, Philippe De Muyter wrote:
> On Mon, Oct 12, 2020 at 02:34:32PM +1000, Greg Ungerer wrote:
>> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-12 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12  4:34 [PATCH] m68knommu: align BSS section to 4-byte boundaries Greg Ungerer
2020-10-12 13:34 ` Philippe De Muyter
2020-10-12 14:00   ` Greg Ungerer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.