linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Fix zImage file size not aligned with CONFIG_EFI_STUB enabled
Date: Mon, 23 Oct 2017 11:50:46 +0100	[thread overview]
Message-ID: <20171023105046.GT20805@n2100.armlinux.org.uk> (raw)
In-Reply-To: <59EDC34C.40109@rock-chips.com>

On Mon, Oct 23, 2017 at 06:24:12PM +0800, jeffy wrote:
> Hi Russell,
> 
> Thanks for your reply.
> 
> On 10/23/2017 04:50 PM, Russell King - ARM Linux wrote:
> >>>
> >>>hmm, right, didn't notice the data is already aligned...
> >>>so it's indeed caused by the ksym:
> >>>
> >>>   [ 9] .data             PROGBITS        006ce000 6d6000 000200 00  WA  0
> >>>0 4096
> >>>   [10] ___ksymtab+sort   PROGBITS        006ce200 6d6200 000008 00  WA  0
> >>>0  4
> >>>   [11] .bss              NOBITS          006ce208 6d6208 00001c 00  WA  0
> >>>0  4
> >It's earlier - look for __ksymtab_strings.
> 
> the problem i meet is the appended dtb code found dtb invalid. i thought
> that is because of unaligned zImage size, but i was wrong...

Hmm, you really ought not to be using the appended dtb code for modern
systems - the appended dtb system is there for old boot loaders that
are incapable of dealing with a dtb.  As is said in the option's help
text:

  This is meant as a backward compatibility convenience for those
  systems with a bootloader that can't be upgraded to accommodate
  the documented boot protocol using a device tree.

  Beware that there is very little in terms of protection against
  this option being confused by leftover garbage in memory that might
  look like a DTB header after a reboot if no actual DTB is appended
  to zImage.  Do not leave this option active in a production kernel
  if you don't intend to always append a DTB.  Proper passing of the
  location into r2 of a bootloader provided DTB is always preferable
  to this option.

If you rely on it, and you have something that looks like a dtb after
the image, then things will go wrong, so it's better _not_ to use it
and to keep it disabled.

That aside, thanks for doing a more in-depth analysis of what is going
on, which helps to understand /why/ Ard's fix works (whereas before
it was rather nebulous.)

I wonder whether we ought to tell the linker to discard any unknown
sections by adding at the bottom:

	/DISCARD/ { *(*) }

but I do think we need to document this, specifically that _edata must
point to the first byte after the binary file, and that the only
sections after it are allowed to be the .bss and stack sections.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

  reply	other threads:[~2017-10-23 10:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18  5:01 [PATCH] ARM: Fix zImage file size not aligned with CONFIG_EFI_STUB enabled Jeffy Chen
2017-10-18  6:19 ` Chris Zhong
2017-10-22 11:01 ` Ard Biesheuvel
2017-10-22 12:47   ` Russell King - ARM Linux
2017-10-22 13:01     ` Ard Biesheuvel
2017-10-23  3:26       ` jeffy
2017-10-23  8:50         ` Russell King - ARM Linux
2017-10-23 10:24           ` jeffy
2017-10-23 10:50             ` Russell King - ARM Linux [this message]
2017-10-23 11:45               ` Russell King - ARM Linux
2017-10-24  8:09                 ` Ard Biesheuvel
2017-10-24  9:09                   ` Russell King - ARM Linux
2017-10-24  9:13                     ` Ard Biesheuvel
2017-10-24  9:22                       ` Russell King - ARM Linux
2017-10-24  9:26                         ` Ard Biesheuvel
2017-10-24  9:30                           ` Ard Biesheuvel
2017-10-24  9:38                             ` Russell King - ARM Linux
2017-10-24  9:44                               ` Ard Biesheuvel
2017-10-24  9:54                                 ` Russell King - ARM Linux
2017-10-24 10:03                                   ` Ard Biesheuvel
2017-10-24  9:16                   ` jeffy

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=20171023105046.GT20805@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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).