lkml.org 
[lkml]   [2020]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH RFC 1/8] riscv/kaslr: add interface to get kaslr offset
Date
On 3/24/20 3:30 AM, Zong Li wrote:
> Add interface to get the random offset.
>
> Signed-off-by: Zong Li <zong.li@sifive.com>
> ---
> arch/riscv/include/asm/page.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
> index 92848e172a40..e2c2020f0a8d 100644
> --- a/arch/riscv/include/asm/page.h
> +++ b/arch/riscv/include/asm/page.h
> @@ -101,6 +101,11 @@ extern unsigned long kernel_virt_addr;
> extern unsigned long max_low_pfn;
> extern unsigned long min_low_pfn;
>
> +static inline unsigned long get_kaslr_offset(void)
> +{
> + return kernel_virt_addr - PAGE_OFFSET;
> +}
> +
> #define __pa_to_va_nodebug(x) ((void *)((unsigned long) (x) + va_pa_offset))
> #define __va_to_pa_nodebug(x) ((unsigned long)(x) - va_pa_offset)
>
>

No problem for this one:

Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>

Thanks,

Alex

\
 
 \ /
  Last update: 2020-04-07 07:08    [W:0.082 / U:6.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site