lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1665d54c-178f-ff72-e627-776e7c76798b@redhat.com>
Date: Tue, 14 Jan 2025 19:07:30 +0100 (CET)
From: Mikulas Patocka <mpatocka@...hat.com>
To: Luis Chamberlain <mcgrof@...nel.org>, Petr Pavlu <petr.pavlu@...e.com>, 
    Sami Tolvanen <samitolvanen@...gle.com>, 
    Daniel Gomez <da.gomez@...sung.com>
cc: "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>, 
    Helge Deller <deller@....de>, linux-modules@...r.kernel.org, 
    linux-kernel@...r.kernel.org, linux-parisc@...r.kernel.org
Subject: Unaligned accesses when loading modules

Hi

On PA-RISC, with the kernel 6.12.9, I get unaligned pointer warnings when 
a module is loaded. The warnings are caused by the fact that the 
.gnu.linkonce.this_module section is not aligned to the appropriate 
boundary. If I dump the module content with "objdump -h configs.ko", I get 
this. Note that the .gnu.linkonce.this_module has "File off 000042d2" and 
"Algn 2**4".

On x86-64, the same misalignment can be seen, but it doesn't cause 
warnings because unaligned pointers are handled in hardware.

This seems to be a bug in the linker, because when I compile an old kernel 
with a new linker, I also get the misalignment. Do you have an idea how to 
work around this bug?

Mikulas


kernel-6.12.9, binutils from Debian ports:

configs.ko:     file format elf64-hppa-linux

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         00000040  0000000000000000  0000000000000000  00000040  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .init.text    00000070  0000000000000000  0000000000000000  00000080  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  2 .exit.text    00000028  0000000000000000  0000000000000000  000000f0  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  3 .rodata       00004015  0000000000000000  0000000000000000  00000118  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .rodata.str1.8 00000010  0000000000000000  0000000000000000  0000412d  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .PARISC.unwind 00000030  0000000000000000  0000000000000000  0000413d  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  6 .modinfo      000000a1  0000000000000000  0000000000000000  0000416d  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .note.gnu.build-id 00000024  0000000000000000  0000000000000000  0000420e  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .note.Linux   00000030  0000000000000000  0000000000000000  00004232  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .data         00000000  0000000000000030  0000000000000030  00004262  2**0
                  CONTENTS, ALLOC, LOAD, DATA
 10 .exit.data    00000008  0000000000000000  0000000000000000  00004262  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 11 .init.data    00000008  0000000000000000  0000000000000000  0000426a  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 12 .data.rel.ro  00000060  0000000000000000  0000000000000000  00004272  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 13 .gnu.linkonce.this_module 000002d0  0000000000000000  0000000000000000  000042d2  2**4
                  CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD
 14 .bss          00000000  0000000000000000  0000000000000000  000045a2  2**0
                  ALLOC
 15 .comment      00000039  0000000000000000  0000000000000000  000045a2  2**0
                  CONTENTS, READONLY
 16 .note.GNU-stack 00000000  0000000000000000  0000000000000000  000045db  2**0
                  CONTENTS, READONLY

With the kernel 6.10, I get this - the ".gnu.linkonce.this_module" 
sections has "File off 00004210" and "Algn 2**4" - so, it is properly 
aligned.

kernel 6.10, older binutils:

configs.ko:     file format elf64-hppa-linux

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .note.gnu.build-id 00000024  0000000000000000  0000000000000000  00000040  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.Linux   00000030  0000000000000000  0000000000000000  00000064  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .text         00000040  0000000000000000  0000000000000000  00000098  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  3 .init.text    00000070  0000000000000000  0000000000000000  000000d8  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  4 .exit.text    00000028  0000000000000000  0000000000000000  00000148  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  5 .rodata       00003f45  0000000000000000  0000000000000000  00000170  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .rodata.str1.8 00000010  0000000000000000  0000000000000000  000040b8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .PARISC.unwind 00000030  0000000000000000  0000000000000000  000040c8  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  8 .modinfo      000000a1  0000000000000000  0000000000000000  000040f8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .data         00000007  00000000000000a1  00000000000000a1  00004199  2**0
                  CONTENTS, ALLOC, LOAD, DATA
 10 .exit.data    00000008  0000000000000000  0000000000000000  000041a0  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 11 .init.data    00000008  0000000000000000  0000000000000000  000041a8  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 12 .data.rel.ro  00000060  0000000000000000  0000000000000000  000041b0  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 13 .gnu.linkonce.this_module 000002d0  0000000000000000  0000000000000000  00004210  2**4
                  CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD
 14 .bss          00000000  0000000000000000  0000000000000000  000044e0  2**0
                  ALLOC
 15 .comment      00000026  0000000000000000  0000000000000000  000044e0  2**0
                  CONTENTS, READONLY
 16 .note.GNU-stack 00000000  0000000000000000  0000000000000000  00004506  2**0
                  CONTENTS, READONLY


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ