All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Lukasz Stelmach <l.stelmach@samsung.com>
Cc: Kees Cook <keescook@chromium.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Ben Dooks <ben-linux@fluff.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Enrico Weigelt <info@metux.net>, Ingo Molnar <mingo@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH 1/5] arm: decompressor: set malloc pool size for the decompressor
Date: Mon, 1 Jun 2020 16:10:31 +0100	[thread overview]
Message-ID: <20200601151031.GM1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <dleftj367eu95j.fsf%l.stelmach@samsung.com>

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@samsung.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.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Lukasz Stelmach <l.stelmach@samsung.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Enrico Weigelt <info@metux.net>,
	Kees Cook <keescook@chromium.org>, Ingo Molnar <mingo@kernel.org>,
	Ben Dooks <ben-linux@fluff.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH 1/5] arm: decompressor: set malloc pool size for the decompressor
Date: Mon, 1 Jun 2020 16:10:31 +0100	[thread overview]
Message-ID: <20200601151031.GM1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <dleftj367eu95j.fsf%l.stelmach@samsung.com>

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@samsung.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.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up

  reply	other threads:[~2020-06-01 15:10 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200601142806eucas1p2680c5625411e7a695d8469760a926520@eucas1p2.samsung.com>
2020-06-01 14:27 ` [PATCH 0/5] kexec_file_load() for arm Łukasz Stelmach
2020-06-01 14:27   ` Łukasz Stelmach
2020-06-01 14:27   ` [PATCH 1/5] arm: decompressor: set malloc pool size for the decompressor Łukasz Stelmach
2020-06-01 14:27     ` Łukasz Stelmach
2020-06-01 14:46     ` Russell King - ARM Linux admin
2020-06-01 14:46       ` Russell King - ARM Linux admin
2020-06-01 14:56       ` Lukasz Stelmach
2020-06-01 14:56         ` Lukasz Stelmach
2020-06-01 15:10         ` Russell King - ARM Linux admin [this message]
2020-06-01 15:10           ` Russell King - ARM Linux admin
2020-06-01 16:54           ` Lukasz Stelmach
2020-06-01 16:54             ` Lukasz Stelmach
2020-06-01 14:27   ` [PATCH 2/5] arm: add image header definitions Łukasz Stelmach
2020-06-01 14:27     ` Łukasz Stelmach
2020-06-01 14:27   ` [PATCH 3/5] arm: decompressor: define a new zImage tag Łukasz Stelmach
2020-06-01 14:27     ` Łukasz Stelmach
2020-06-01 14:55     ` Russell King - ARM Linux admin
2020-06-01 14:55       ` Russell King - ARM Linux admin
2020-06-01 16:19       ` Lukasz Stelmach
2020-06-01 16:19         ` Lukasz Stelmach
2020-06-01 18:25         ` Russell King - ARM Linux admin
2020-06-01 18:25           ` Russell King - ARM Linux admin
2020-06-01 20:27           ` Lukasz Stelmach
2020-06-01 20:27             ` Lukasz Stelmach
2020-06-01 20:41             ` Russell King - ARM Linux admin
2020-06-01 20:41               ` Russell King - ARM Linux admin
2020-06-02 16:17               ` Lukasz Stelmach
2020-06-02 16:17                 ` Lukasz Stelmach
2020-06-01 14:27   ` [PATCH 4/5] arm: Add kexec_image_info Łukasz Stelmach
2020-06-01 14:27     ` Łukasz Stelmach
2020-06-01 14:56     ` Russell King - ARM Linux admin
2020-06-01 14:56       ` Russell King - ARM Linux admin
2020-06-01 16:30       ` Lukasz Stelmach
2020-06-01 16:30         ` Lukasz Stelmach
2020-06-01 14:27   ` [PATCH 5/5] arm: kexec_file: load zImage or uImage, initrd and dtb Łukasz Stelmach
2020-06-01 14:27     ` Łukasz Stelmach
2020-06-01 15:07     ` Russell King - ARM Linux admin
2020-06-01 15:07       ` Russell King - ARM Linux admin
2020-06-01 15:14       ` Russell King - ARM Linux admin
2020-06-01 15:14         ` Russell King - ARM Linux admin
2020-06-01 16:46         ` Lukasz Stelmach
2020-06-01 16:46           ` Lukasz Stelmach
2020-06-01 18:48       ` Lukasz Stelmach
2020-06-01 18:48         ` Lukasz Stelmach
2020-06-02 16:17   ` [PATCH v2 0/5] kexec_file_load() for arm Łukasz Stelmach
2020-06-02 16:17     ` Łukasz Stelmach
2020-06-02 16:17     ` [PATCH v2 1/5] arm: decompressor: set malloc pool size for the decompressor Łukasz Stelmach
2020-06-02 16:17       ` Łukasz Stelmach
2020-06-02 16:17     ` [PATCH v2 2/5] arm: add image header definitions Łukasz Stelmach
2020-06-02 16:17       ` Łukasz Stelmach
2020-06-02 16:17     ` [PATCH v2 3/5] arm: decompressor: define a new zImage tag Łukasz Stelmach
2020-06-02 16:17       ` Łukasz Stelmach
2020-06-02 16:17     ` [PATCH v2 4/5] arm: Add kexec_image_info Łukasz Stelmach
2020-06-02 16:17       ` Łukasz Stelmach
2020-06-02 16:17     ` [PATCH v2 5/5] arm: kexec_file: load zImage or uImage, initrd and dtb Łukasz Stelmach
2020-06-02 16:17       ` Łukasz Stelmach
2020-06-11 10:37   ` [PATCH 0/5] kexec_file_load() for arm Dave Young
2020-06-11 10:37     ` Dave Young
2020-06-11 10:37     ` Dave Young
2020-09-30 18:34   ` [PATCH v3 0/4] " Łukasz Stelmach
2020-09-30 18:34     ` Łukasz Stelmach
2020-09-30 18:34     ` Łukasz Stelmach
2020-09-30 18:34     ` [PATCH v3 1/4] arm: add image header definitions Łukasz Stelmach
2020-09-30 18:34       ` Łukasz Stelmach
2020-09-30 18:34       ` Łukasz Stelmach
2020-09-30 18:34     ` [PATCH v3 2/4] arm: decompressor: define a new zImage tag Łukasz Stelmach
2020-09-30 18:34       ` Łukasz Stelmach
2020-09-30 18:34       ` Łukasz Stelmach
2020-09-30 18:34     ` [PATCH v3 3/4] arm: Add kexec_image_info Łukasz Stelmach
2020-09-30 18:34       ` Łukasz Stelmach
2020-09-30 18:34       ` Łukasz Stelmach
2020-09-30 18:34     ` [PATCH v3 4/4] arm: kexec_file: load zImage or uImage, initrd and dtb Łukasz Stelmach
2020-09-30 18:34       ` Łukasz Stelmach
2020-09-30 18:34       ` Łukasz Stelmach
2020-10-01 10:09       ` kernel test robot
2020-10-01 10:09         ` kernel test robot

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=20200601151031.GM1551@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=b.zolnierkie@samsung.com \
    --cc=ben-linux@fluff.org \
    --cc=info@metux.net \
    --cc=keescook@chromium.org \
    --cc=l.stelmach@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=masahiroy@kernel.org \
    --cc=mingo@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=takahiro.akashi@linaro.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.