Thread (4 messages) 4 messages, 3 authors, 2018-02-05

[PATCH v1] arm64: setup: Check for overlapping dtb and Image load addresses

From: mark.rutland@arm.com (Mark Rutland)
Date: 2018-02-05 11:13:44
Also in: linux-arm-msm

Hi,

On Mon, Feb 05, 2018 at 01:36:12PM +0530, Chandra Sekhar Lingutla wrote:
On 1/29/2018 9:18 PM, Will Deacon wrote:
quoted
On Wed, Jan 24, 2018 at 02:53:45PM +0530, Lingutla Chandrasekhar wrote:
quoted
Sometime kernel image and dtb load offsets can overlap due to
dynamically increased Image or dtb size if both load addresses
are near to each other, which leads to bootup failures.

So validate dtb load address and kernel image, if they overlap
do not proceed to boot.

Signed-off-by: Lingutla Chandrasekhar <redacted>
---

Changes since v0:
- Print overlap bytes.
- Simplify ovelap checks.
This all feels a bit fragile to me, since we're relying on some portion of
the Image and .dtb working in order to run this code successfully.  I'd
rather not pretend to detect this exact scenario, particularly as I can't
see it being useful for anybody other than firmware developers (who are in a
better position to check whether or not this is happening).
Yes, it is useful for boot loaders, adding one more condition to current checks
for bootloader failures, so that boot loader developers can easily identify the
real issue(Image size increased dynamically).
It would be better if your bootloader checked the image_size header in
the kernel Image (see Documentation/arm64/booting.txt). Then it can
either bail out, or decide where to place the DTB dynamically.
quoted
More generally, is there not some .dtb checksum failure that detects
corruption there? Perhaps we could do something like that for the Image
too?
In boot loader, first we load Image and then dtb to corresponding DDR offset right,
so not sure checksum would help here.
If that's the case, it's possible that the DTB gets placed over the code
performing this check in the kernel.

It is not possibleto detect this overlap in the bootloader? Both the
kernel Image and DTB have size fields.

Thanks,
Mark.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help