[PATCH v2 6/7] riscv: Ensure gp is NULL or points to valid data

Bin Meng bmeng.cn at gmail.com
Tue Sep 15 08:50:41 CEST 2020


On Mon, Sep 14, 2020 at 10:23 PM Sean Anderson <seanga2 at gmail.com> wrote:
>
> This allows code to use a construct like `if (gd & gd->...) { ... }` when
> accessing the global data pointer. Without this change, it was possible for
> a very early trap to cause _exit_trap to read arbitrary memory. This could
> cause a second trap, preventing show_regs from being printed.
>
> XIP cannot use locks because flash is not writable. This leaves it
> vulnerable to the same class of bugs regarding already-pending IPIs as
> before this series. Fixing that would require finding another method of
> synchronization, which is outside the scope of this series.
>
> Fixes: 7c6ca03eae ("riscv: additional crash information")
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> ---
>
> Changes in v2:
> - Set gp early with XIP
>
>  arch/riscv/cpu/start.S      | 26 +++++++++++++++++++++++---
>  arch/riscv/lib/interrupts.c |  3 ++-
>  2 files changed, 25 insertions(+), 4 deletions(-)
>

Reviewed-by: Bin Meng <bin.meng at windriver.com>


More information about the U-Boot mailing list