diff options
author | Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> | 2019-02-25 12:16:01 -0500 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2019-02-25 15:11:01 -0500 |
commit | edb64bca50cd736c6894cc6081d5263c007ce005 (patch) | |
tree | 24677adc79af060445efbc7cfe2f598fee7d1536 /arch/arc/kernel/head.S | |
parent | fbe025c3eaf5f52060c2820eddb7357363db0d27 (diff) |
ARC: u-boot args: check that magic number is correct
In case of devboards we really often disable bootloader and load
Linux image in memory via JTAG. Even if kernel tries to verify
uboot_tag and uboot_arg there is sill a chance that we treat some
garbage in registers as valid u-boot arguments in JTAG case.
E.g. it is enough to have '1' in r0 to treat any value in r2 as
a boot command line.
So check that magic number passed from u-boot is correct and drop
u-boot arguments otherwise. That helps to reduce the possibility
of using garbage as u-boot arguments in JTAG case.
We can safely check U-boot magic value (0x0) in linux passed via
r1 register as U-boot pass it from the beginning. So there is no
backward-compatibility issues.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/kernel/head.S')
-rw-r--r-- | arch/arc/kernel/head.S | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S index 36774348d23b..8f6e0447dd17 100644 --- a/arch/arc/kernel/head.S +++ b/arch/arc/kernel/head.S | |||
@@ -111,6 +111,7 @@ ENTRY(stext) | |||
111 | ; r2 = pointer to uboot provided cmdline or external DTB in mem | 111 | ; r2 = pointer to uboot provided cmdline or external DTB in mem |
112 | ; These are handled later in handle_uboot_args() | 112 | ; These are handled later in handle_uboot_args() |
113 | st r0, [@uboot_tag] | 113 | st r0, [@uboot_tag] |
114 | st r1, [@uboot_magic] | ||
114 | st r2, [@uboot_arg] | 115 | st r2, [@uboot_arg] |
115 | 116 | ||
116 | ; setup "current" tsk and optionally cache it in dedicated r25 | 117 | ; setup "current" tsk and optionally cache it in dedicated r25 |