From: Helge Deller <deller@gmx.de>
To: Masahiro Yamada <masahiroy@kernel.org>, deller@kernel.org
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
linux-modules@vger.kernel.org, linux-arch@vger.kernel.org,
Luis Chamberlain <mcgrof@kernel.org>
Subject: Re: [PATCH 3/4] vmlinux.lds.h: Fix alignment for __ksymtab*, __kcrctab_* and .pci_fixup sections
Date: Fri, 22 Dec 2023 10:02:20 +0100 [thread overview]
Message-ID: <7a504ceb-da00-4c0b-acc0-3ab48fb60f5e@gmx.de> (raw)
In-Reply-To: <CAK7LNARgQ0t=4dfkJXDhSzdFGbxDuN2kPGxTgDR7siCYTtGU5w@mail.gmail.com>
On 12/21/23 14:07, Masahiro Yamada wrote:
> On Thu, Nov 23, 2023 at 7:18 AM <deller@kernel.org> wrote:
>>
>> From: Helge Deller <deller@gmx.de>
>>
>> On 64-bit architectures without CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
>> (e.g. ppc64, ppc64le, parisc, s390x,...) the __KSYM_REF() macro stores
>> 64-bit pointers into the __ksymtab* sections.
>> Make sure that the start of those sections is 64-bit aligned in the vmlinux
>> executable, otherwise unaligned memory accesses may happen at runtime.
>
>
> Are you solving a real problem?
Not any longer.
I faced a problem on parisc when neither #1 and #3 were applied
because of a buggy unalignment exception handler. But this is
not something which I would count a "real generic problem".
> 1/4 already ensures the proper alignment of __ksymtab*, doesn't it?
Yes, it does.
>...
> So, my understanding is this patch is unneeded.
Yes, it's not required and I'm fine if we drop it.
But regarding __kcrctab:
>> @@ -498,6 +501,7 @@
>> } \
>> \
>> /* Kernel symbol table: Normal symbols */ \
>> + . = ALIGN(4); \
>> __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
>> __start___kcrctab = .; \
>> KEEP(*(SORT(___kcrctab+*))) \
I think this patch would be beneficial to get proper alignment:
diff --git a/include/linux/export-internal.h b/include/linux/export-internal.h
index cd253eb51d6c..d445705ac13c 100644
--- a/include/linux/export-internal.h
+++ b/include/linux/export-internal.h
@@ -64,6 +64,7 @@
#define SYMBOL_CRC(sym, crc, sec) \
asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \
+ ".balign 4" "\n" \
"__crc_" #sym ":" "\n" \
".long " #crc "\n" \
".previous" "\n")
Helge
next prev parent reply other threads:[~2023-12-22 9:02 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 22:18 [PATCH 0/4] Section alignment issues? deller
2023-11-22 22:18 ` [PATCH 1/4] linux/export: Fix alignment for 64-bit ksymtab entries deller
2023-12-21 10:22 ` Masahiro Yamada
2023-12-21 16:01 ` Masahiro Yamada
2023-12-22 6:07 ` Luis Chamberlain
2023-12-22 6:08 ` Luis Chamberlain
2023-12-22 7:01 ` Masahiro Yamada
2023-12-22 20:11 ` Luis Chamberlain
2023-12-23 14:35 ` Masahiro Yamada
2023-11-22 22:18 ` [PATCH 2/4] modules: Ensure 64-bit alignment on __ksymtab_* sections deller
2023-12-22 5:59 ` Luis Chamberlain
2023-12-22 12:13 ` Helge Deller
2023-12-22 20:10 ` Luis Chamberlain
2023-12-30 7:33 ` Helge Deller
2024-01-22 16:10 ` Luis Chamberlain
2024-01-22 16:47 ` Helge Deller
2024-01-22 18:48 ` Luis Chamberlain
2023-11-22 22:18 ` [PATCH 3/4] vmlinux.lds.h: Fix alignment for __ksymtab*, __kcrctab_* and .pci_fixup sections deller
2023-12-21 13:07 ` Masahiro Yamada
2023-12-22 9:02 ` Helge Deller [this message]
2023-12-23 4:10 ` Masahiro Yamada
2023-11-22 22:18 ` [PATCH 4/4] modules: Add missing entry for __ex_table deller
2024-01-29 18:50 ` Luis Chamberlain
2023-12-19 21:26 ` [PATCH 0/4] Section alignment issues? Luis Chamberlain
2023-12-20 19:40 ` Luis Chamberlain
2023-12-22 9:13 ` Helge Deller
2023-12-21 13:40 ` Masahiro Yamada
2023-12-21 15:42 ` Masahiro Yamada
2023-12-22 8:23 ` Helge Deller
2023-12-23 1:32 ` Masahiro Yamada
2023-12-22 9:48 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7a504ceb-da00-4c0b-acc0-3ab48fb60f5e@gmx.de \
--to=deller@gmx.de \
--cc=arnd@arndb.de \
--cc=deller@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mcgrof@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).