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]
Message-ID: <CAAhSdy3Qnx+3tCecXLDw=1m45zMU67n3K4_YTYA2127mZm+Kfg@mail.gmail.com>
Date:   Wed, 28 Apr 2021 09:10:51 +0530
From:   Anup Patel <anup@...infault.org>
To:     Palmer Dabbelt <palmer@...belt.com>
Cc:     linux-riscv <linux-riscv@...ts.infradead.org>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Atish Patra <Atish.Patra@....com>,
        Anup Patel <Anup.Patel@....com>,
        Kefeng Wang <wangkefeng.wang@...wei.com>,
        Mike Rapoport <rppt@...nel.org>,
        Vitaly Wool <vitaly.wool@...sulko.com>,
        Alexandre Ghiti <alex@...ti.fr>,
        Greentime Hu <greentime.hu@...ive.com>, 0x7f454c46@...il.com,
        chenhuang5@...wei.com,
        "linux-kernel@...r.kernel.org List" <linux-kernel@...r.kernel.org>,
        kernel-team@...roid.com, Palmer Dabbelt <palmerdabbelt@...gle.com>,
        Guenter Roeck <linux@...ck-us.net>
Subject: Re: [PATCH] RISC-V: Always define XIP_FIXUP

On Wed, Apr 28, 2021 at 9:05 AM Palmer Dabbelt <palmer@...belt.com> wrote:
>
> From: Palmer Dabbelt <palmerdabbelt@...gle.com>
>
> XIP depends on MMU, but XIP_FIXUP is defined throughout the kernel in
> order to avoid excessive ifdefs.  This just makes sure to always define
> XIP_FIXIP, which will fix MMU=n builds.
>
> Fixes: 44c922572952 ("RISC-V: enable XIP")
> Reported-by: Guenter Roeck <linux@...ck-us.net>
> Signed-off-by: Palmer Dabbelt <palmerdabbelt@...gle.com>

Looks good to me.

Reviewed-by: Anup Patel <anup@...infault.org>

Regards,
Anup

> ---
>  arch/riscv/include/asm/pgtable.h | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 2f1384e14e31..fd749351f432 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -73,18 +73,6 @@
>  #endif
>  #define FIXADDR_START    (FIXADDR_TOP - FIXADDR_SIZE)
>
> -#ifdef CONFIG_XIP_KERNEL
> -#define XIP_OFFSET             SZ_8M
> -#define XIP_FIXUP(addr) ({                                                     \
> -       uintptr_t __a = (uintptr_t)(addr);                                      \
> -       (__a >= CONFIG_XIP_PHYS_ADDR && __a < CONFIG_XIP_PHYS_ADDR + SZ_16M) ?  \
> -               __a - CONFIG_XIP_PHYS_ADDR + CONFIG_PHYS_RAM_BASE - XIP_OFFSET :\
> -               __a;                                                            \
> -       })
> -#else
> -#define XIP_FIXUP(addr)                (addr)
> -#endif /* CONFIG_XIP_KERNEL */
> -
>  #endif
>
>  #ifndef __ASSEMBLY__
> @@ -101,6 +89,18 @@
>  #include <asm/pgtable-32.h>
>  #endif /* CONFIG_64BIT */
>
> +#ifdef CONFIG_XIP_KERNEL
> +#define XIP_OFFSET             SZ_8M
> +#define XIP_FIXUP(addr) ({                                                     \
> +       uintptr_t __a = (uintptr_t)(addr);                                      \
> +       (__a >= CONFIG_XIP_PHYS_ADDR && __a < CONFIG_XIP_PHYS_ADDR + SZ_16M) ?  \
> +               __a - CONFIG_XIP_PHYS_ADDR + CONFIG_PHYS_RAM_BASE - XIP_OFFSET :\
> +               __a;                                                            \
> +       })
> +#else
> +#define XIP_FIXUP(addr)                (addr)
> +#endif /* CONFIG_XIP_KERNEL */
> +
>  #ifdef CONFIG_MMU
>  /* Number of entries in the page global directory */
>  #define PTRS_PER_PGD    (PAGE_SIZE / sizeof(pgd_t))
> --
> 2.31.1.498.g6c1eba8ee3d-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ