lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 15 Apr 2022 10:23:44 +0530
From:   Anup Patel <apatel@...tanamicro.com>
To:     潘庆霖 <panqinglin2020@...as.ac.cn>
Cc:     Palmer Dabbelt <palmer@...belt.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Alexandre Ghiti <alexandre.ghiti@...onical.com>,
        Atish Patra <atishp@...shpatra.org>,
        Alistair Francis <Alistair.Francis@....com>,
        Anup Patel <anup@...infault.org>,
        linux-riscv <linux-riscv@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org List" <linux-kernel@...r.kernel.org>,
        Mayuresh Chitale <mchitale@...tanamicro.com>
Subject: Re: [PATCH] RISC-V: mm: Fix set_satp_mode() for platform not having Sv57

On Fri, Apr 15, 2022 at 10:18 AM 潘庆霖 <panqinglin2020@...as.ac.cn> wrote:
>
> Hi Anup,
>
> &gt;
> &gt; When Sv57 is not available the satp.MODE test in set_satp_mode() will
> &gt; fail and lead to pgdir re-programming for Sv48. The pgdir re-programming
> &gt; will fail as well due to pre-existing pgdir entry used for Sv57 and as
> &gt; a result kernel fails to boot on RISC-V platform not having Sv57.
> &gt;
> &gt; To fix above issue, we should clear the pgdir memory in set_satp_mode()
> &gt; before re-programming.
> &gt;
> &gt; Fixes: 011f09d12052 ("riscv: mm: Set sv57 on defaultly")
> &gt; Reported-by: Mayuresh Chitale <mchitale@...tanamicro.com>
> &gt; Signed-off-by: Anup Patel <apatel@...tanamicro.com>
> &gt; ---
> &gt;  arch/riscv/mm/init.c | 1 +
> &gt;  1 file changed, 1 insertion(+)
> &gt;
> &gt; diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> &gt; index 9535bea8688c..b0793dc0c291 100644
> &gt; --- a/arch/riscv/mm/init.c
> &gt; +++ b/arch/riscv/mm/init.c
> &gt; @@ -718,6 +718,7 @@ static __init void set_satp_mode(void)
> &gt;            if (!check_l4) {
> &gt;                    disable_pgtable_l5();
> &gt;                    check_l4 = true;
> &gt; +                  memset(early_pg_dir, 0, PAGE_SIZE);
> &gt;                    goto retry;
> &gt;            }
> &gt;            disable_pgtable_l4();
> &gt; --
>
>
> I find it that the set_satp_mode function is in .init.text section which begins at 0x80800000.
> And its pgd_index in both Sv48 and Sv57 will be 0. So it may not be necessary to clear the
> early_pg_dir when the kernel find Sv57 is not supported? And may I get the steps of reproduction
> from you?

We can't assume that it will be the same pgd_index for Sv48 and Sv57.

For example, some hypothetical SoC might have RAM starting after 1TB space.

We should ensure that early_pg_dir is cleaned entirely for detecting the next
mode.

Regards,
Anup

>
> Yours,
> Qinglin
> </apatel@...tanamicro.com></mchitale@...tanamicro.com>

Powered by blists - more mailing lists