[PATCH] lib: sbi_domain: Avoid overwriting coldboot hart's scratch->arg1

Bin Meng bmeng at tinylab.org
Fri Jan 13 05:25:46 PST 2023


On 2023/1/13 20:42:13, "Anup Patel" <anup at brainfault.org> wrote:

>On Fri, Dec 30, 2022 at 9:56 PM Samuel Holland <samuel at sholland.org> wrote:
>>
>>  Hi Bin,
>>
>>  On 12/29/22 22:26, Bin Meng wrote:
>>  > In sbi_domain_finalize(), when locating the coldboot hart's domain,
>>  > the coldboot hart's scratch->arg1 will be overwritten by the domain
>>  > configuration. scratch->arg1 holds the FDT address of the coldboot
>>  > hart, and in later boot process OpenSBI codes still read the FDT
>>  > here and there, which leads to a crash.
>>
>>  It sounds to me like the bug is in fdt_get_address(), not here. We
>>  should save off the FDT address in some global variable, and not
>>  continue getting it from next_arg1. Then there is no problem updating
>>  next_arg1 from the domain configuration.
>
>I agree with your suggestion.
>
>The fdt_get_address() should return root domains next_arg1 as the
>FDT pointer.
>
>@Bin, will you be sending a v2 patch ?
>

Yes, will do.

Regards,
Bin



More information about the opensbi mailing list