linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Rob Herring <robh+dt@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jessica Yu <jeyu@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Frank Rowand <frowand.list@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	David Miller <davem@davemloft.net>,
	Jakub Jelinek <jakub@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Daniel Kurtz <djkurtz@chromium.org>,
	linux-arch@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/8] of: fix linker-section match-table corruption
Date: Fri, 4 Dec 2020 15:02:53 +0100	[thread overview]
Message-ID: <X8pBjbZlbaWaOFxe@localhost> (raw)
In-Reply-To: <20201123102319.8090-2-johan@kernel.org>

Rob,

On Mon, Nov 23, 2020 at 11:23:12AM +0100, Johan Hovold wrote:
> Specify type alignment when declaring linker-section match-table entries
> to prevent gcc from increasing alignment and corrupting the various
> tables with padding (e.g. timers, irqchips, clocks, reserved memory).
> 
> This is specifically needed on x86 where gcc (typically) aligns larger
> objects like struct of_device_id with static extent on 32-byte
> boundaries which at best prevents matching on anything but the first
> entry. Specifying alignment when declaring variables suppresses this
> optimisation.
> 
> Here's a 64-bit example where all entries are corrupt as 16 bytes of
> padding has been inserted before the first entry:
> 
> 	ffffffff8266b4b0 D __clk_of_table
> 	ffffffff8266b4c0 d __of_table_fixed_factor_clk
> 	ffffffff8266b5a0 d __of_table_fixed_clk
> 	ffffffff8266b680 d __clk_of_table_sentinel
> 
> And here's a 32-bit example where the 8-byte-aligned table happens to be
> placed on a 32-byte boundary so that all but the first entry are corrupt
> due to the 28 bytes of padding inserted between entries:
> 
> 	812b3ec0 D __irqchip_of_table
> 	812b3ec0 d __of_table_irqchip1
> 	812b3fa0 d __of_table_irqchip2
> 	812b4080 d __of_table_irqchip3
> 	812b4160 d irqchip_of_match_end
> 
> Verified on x86 using gcc-9.3 and gcc-4.9 (which uses 64-byte
> alignment), and on arm using gcc-7.2.
> 
> Note that there are no in-tree users of these tables on x86 currently
> (even if they are included in the image).
> 
> Fixes: 54196ccbe0ba ("of: consolidate linker section OF match table declarations")
> Fixes: f6e916b82022 ("irqchip: add basic infrastructure")
> Cc: stable <stable@vger.kernel.org>     # 3.9
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---

Could you pick this one up for 5.11?

Johan

  reply	other threads:[~2020-12-04 14:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 10:23 [PATCH v2 0/8] linker-section array fix and clean ups Johan Hovold
2020-11-23 10:23 ` [PATCH v2 1/8] of: fix linker-section match-table corruption Johan Hovold
2020-12-04 14:02   ` Johan Hovold [this message]
2020-11-23 10:23 ` [PATCH v2 2/8] earlycon: simplify earlycon-table implementation Johan Hovold
2020-12-04 14:03   ` Johan Hovold
2020-12-04 14:44     ` Greg Kroah-Hartman
2020-11-23 10:23 ` [PATCH v2 3/8] module: drop version-attribute alignment Johan Hovold
2020-11-23 10:23 ` [PATCH v2 4/8] module: simplify version-attribute handling Johan Hovold
2020-11-23 10:23 ` [PATCH v2 5/8] init: use type alignment for kernel parameters Johan Hovold
2020-11-23 10:23 ` [PATCH v2 6/8] params: drop redundant "unused" attributes Johan Hovold
2020-11-23 10:23 ` [PATCH v2 7/8] params: use type alignment for kernel parameters Johan Hovold
2020-11-23 10:23 ` [PATCH v2 8/8] params: clean up module-param macros Johan Hovold

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=X8pBjbZlbaWaOFxe@localhost \
    --to=johan@kernel.org \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=djkurtz@chromium.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jakub@redhat.com \
    --cc=jeyu@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=peterz@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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).