[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dleftjimgasp4z.fsf%l.stelmach@samsung.com>
Date: Mon, 01 Jun 2020 18:54:20 +0200
From: Lukasz Stelmach <l.stelmach@...sung.com>
To: Russell King - ARM Linux admin <linux@...linux.org.uk>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Enrico Weigelt <info@...ux.net>,
Kees Cook <keescook@...omium.org>,
Ingo Molnar <mingo@...nel.org>,
Ben Dooks <ben-linux@...ff.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
AKASHI Takahiro <takahiro.akashi@...aro.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: [PATCH 1/5] arm: decompressor: set malloc pool size for the
decompressor
It was <2020-06-01 pon 16:10>, when Russell King - ARM Linux admin wrote:
> On Mon, Jun 01, 2020 at 04:56:40PM +0200, Lukasz Stelmach wrote:
>> It was <2020-06-01 pon 15:46>, when Russell King - ARM Linux admin wrote:
>> > On Mon, Jun 01, 2020 at 04:27:50PM +0200, Łukasz Stelmach wrote:
>> >> Move the definition of malloc pool size of the decompressor to
>> >> a single place. This value will be exposed later for kexec_file loader.
>> >>
>> >> Signed-off-by: Łukasz Stelmach <l.stelmach@...sung.com>
>> >> ---
>> >> arch/arm/boot/compressed/Makefile | 2 ++
>> >> arch/arm/boot/compressed/head.S | 6 ++++--
>> >> 2 files changed, 6 insertions(+), 2 deletions(-)
>> >>
>> >> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
>> >> index 9c11e7490292..b3594cd1588c 100644
>> >> --- a/arch/arm/boot/compressed/Makefile
>> >> +++ b/arch/arm/boot/compressed/Makefile
>> >> @@ -125,6 +125,8 @@ KBSS_SZ = $(shell echo $$(($$($(NM) $(obj)/../../../../vmlinux | \
>> >> sed -n -e 's/^\([^ ]*\) [AB] __bss_start$$/-0x\1/p' \
>> >> -e 's/^\([^ ]*\) [AB] __bss_stop$$/+0x\1/p') )) )
>> >> LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
>> >> +# malloc pool size
>> >> +LDFLAGS_vmlinux += --defsym _malloc_size=0x10000
>> >> # Supply ZRELADDR to the decompressor via a linker symbol.
>> >> ifneq ($(CONFIG_AUTO_ZRELADDR),y)
>> >> LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
>> >> diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
>> >> index e8e1c866e413..dcc1afa60fb9 100644
>> >> --- a/arch/arm/boot/compressed/head.S
>> >> +++ b/arch/arm/boot/compressed/head.S
>> >> @@ -309,7 +309,8 @@ restart: adr r0, LC0
>> >> #ifndef CONFIG_ZBOOT_ROM
>> >> /* malloc space is above the relocated stack (64k max) */
>> >> add sp, sp, r0
>> >> - add r10, sp, #0x10000
>> >> + ldr r10, =_malloc_size
>> >> + add r10, r10, sp
>> >
>> > This says "locate _malloc_size in a literal pool somewhere, and load it
>> > using a PC-relative offset". Are you sure that the literal pool is
>> > sensibly located?
>> >
>> > Would it be better to use a definition for this?
>>
>> I've followed ZRELADDR way. I think both values should be handled the
>> same way (it makes it easier to comprehend IMHO). Is there any reason
>> not to? Should I change ZRELADDR for v2 too?
>
> There's a good reason. ZRELADDR can be a constant that does not fit
> into the ARMs immediate constants (8 bits of significant data plus
> a multiple of a 2-bit shift), whereas the size of the malloc space
> is guaranteed to fit. So, ZRELADDR has to use a literal load.
> This doesn't.
Indeed this is how TEXT_OFFSET works. Done.
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics
Download attachment "signature.asc" of type "application/pgp-signature" (488 bytes)
Powered by blists - more mailing lists