[U-Boot] [PATCH] ARM: rmobile: Convert to bootm_size

Simon Goldschmidt simon.k.r.goldschmidt at gmail.com
Tue Nov 27 07:03:04 UTC 2018


On Tue, Nov 27, 2018 at 1:11 AM Marek Vasut <marek.vasut at gmail.com> wrote:
>
> Convert all Renesas R-Car boards to bootm_size of 256 MiB and drop both
> fdt_high and initrd_high. This change implies that the FDT and initrd
> will always be copied into the first 256 MiB of RAM instead of being
> used in place, which can cause various kinds of inobvious problems.
>
> The simpler problems include FDT or initrd being overwritten or being
> used from unaligned addresses, especially on ARM64. The overhead of
> copying the FDT to aligned location is negligible and these problems
> go away, so the benefit is significant.
>
> Regarding alignment problems with fitImage. The alignment of DT properties
> is always 32 bits, which implies that the alignment of the "data" property
> in fitImage is also 32 bits. The /incbin/ syntax plays no role here. The
> kernel expects all elements, including DT and initrd, to be aligned to
> 64 bits on ARM64, thus using them in place may not be possible. Using the
> bootm_size assures correct alignment, again with negligible overhead.

In my opinion, all of these raw addresses defined in scripts or config
should be removed: They are probably vulnerable to overwriting
themselves as they only provide an address, not a range.

Just out of curiosity: is it required to put fdt and initrd into the
first 256 MiB or is this just some 'random' limit to ensure we use lmb
but don't overwrite U-Boot (text, heap, stack, etc)? Because if so, my
series to fix the recent CVE issues improves lmb to not overwrite
U-Boot and other reserved addresses and you might be able to remove
'bootm_size', too. The improved lmb code would just allocate an
aligned address somewhere in the available RAM.

Simon

>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
> Cc: Tom Rini <trini at konsulko.com>
> ---
>  include/configs/alt.h              | 3 +--
>  include/configs/gose.h             | 3 +--
>  include/configs/koelsch.h          | 3 +--
>  include/configs/lager.h            | 3 +--
>  include/configs/porter.h           | 3 +--
>  include/configs/rcar-gen3-common.h | 3 +--
>  include/configs/silk.h             | 3 +--
>  include/configs/stout.h            | 3 +--
>  8 files changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/include/configs/alt.h b/include/configs/alt.h
> index cc6a7bf638..3f7f379e06 100644
> --- a/include/configs/alt.h
> +++ b/include/configs/alt.h
> @@ -39,8 +39,7 @@
>  #define CONFIG_SYS_CLK_FREQ    RMOBILE_XTAL_CLK
>
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
> -       "fdt_high=0xffffffff\0"         \
> -       "initrd_high=0xffffffff\0"
> +       "bootm_size=0x10000000\0"
>
>  /* SPL support */
>  #define CONFIG_SPL_TEXT_BASE           0xe6300000
> diff --git a/include/configs/gose.h b/include/configs/gose.h
> index 36ac88a20d..8f0e378488 100644
> --- a/include/configs/gose.h
> +++ b/include/configs/gose.h
> @@ -35,8 +35,7 @@
>  #define CONFIG_SYS_CLK_FREQ    RMOBILE_XTAL_CLK
>
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
> -       "fdt_high=0xffffffff\0"         \
> -       "initrd_high=0xffffffff\0"
> +       "bootm_size=0x10000000\0"
>
>  /* SPL support */
>  #define CONFIG_SPL_TEXT_BASE           0xe6300000
> diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
> index ef26a144a9..33c8bd4149 100644
> --- a/include/configs/koelsch.h
> +++ b/include/configs/koelsch.h
> @@ -35,8 +35,7 @@
>  #define CONFIG_SYS_CLK_FREQ    RMOBILE_XTAL_CLK
>
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
> -       "fdt_high=0xffffffff\0"         \
> -       "initrd_high=0xffffffff\0"
> +       "bootm_size=0x10000000\0"
>
>  /* SPL support */
>  #define CONFIG_SPL_TEXT_BASE           0xe6300000
> diff --git a/include/configs/lager.h b/include/configs/lager.h
> index 08498c6d81..89c5d01d3c 100644
> --- a/include/configs/lager.h
> +++ b/include/configs/lager.h
> @@ -36,8 +36,7 @@
>  #define CONFIG_SYS_CLK_FREQ    RMOBILE_XTAL_CLK
>
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
> -       "fdt_high=0xffffffff\0"         \
> -       "initrd_high=0xffffffff\0"
> +       "bootm_size=0x10000000\0"
>
>  /* SPL support */
>  #define CONFIG_SPL_TEXT_BASE           0xe6300000
> diff --git a/include/configs/porter.h b/include/configs/porter.h
> index e56dc3f1ec..9950f80afd 100644
> --- a/include/configs/porter.h
> +++ b/include/configs/porter.h
> @@ -40,8 +40,7 @@
>  #define CONFIG_SYS_CLK_FREQ    RMOBILE_XTAL_CLK
>
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
> -       "fdt_high=0xffffffff\0"         \
> -       "initrd_high=0xffffffff\0"
> +       "bootm_size=0x10000000\0"
>
>  /* SPL support */
>  #define CONFIG_SPL_TEXT_BASE           0xe6300000
> diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h
> index 435d108628..6c2fa6a63c 100644
> --- a/include/configs/rcar-gen3-common.h
> +++ b/include/configs/rcar-gen3-common.h
> @@ -59,8 +59,7 @@
>  #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
>
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
> -       "fdt_high=0xffffffffffffffff\0" \
> -       "initrd_high=0xffffffffffffffff\0"
> +       "bootm_size=0x10000000\0"
>
>  #define CONFIG_BOOTCOMMAND     \
>         "tftp 0x48080000 Image; " \
> diff --git a/include/configs/silk.h b/include/configs/silk.h
> index a94928bd16..112806c342 100644
> --- a/include/configs/silk.h
> +++ b/include/configs/silk.h
> @@ -40,8 +40,7 @@
>  #define CONFIG_SYS_CLK_FREQ    RMOBILE_XTAL_CLK
>
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
> -       "fdt_high=0xffffffff\0"         \
> -       "initrd_high=0xffffffff\0"
> +       "bootm_size=0x10000000\0"
>
>  /* SPL support */
>  #define CONFIG_SPL_TEXT_BASE           0xe6300000
> diff --git a/include/configs/stout.h b/include/configs/stout.h
> index b72b565c33..93d980569c 100644
> --- a/include/configs/stout.h
> +++ b/include/configs/stout.h
> @@ -44,8 +44,7 @@
>  #define CONFIG_SYS_CLK_FREQ    RMOBILE_XTAL_CLK
>
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
> -       "fdt_high=0xffffffff\0"         \
> -       "initrd_high=0xffffffff\0"
> +       "bootm_size=0x10000000\0"
>
>  /* SPL support */
>  #define CONFIG_SPL_TEXT_BASE           0xe6300000
> --
> 2.18.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list