Messages in this thread | | | From | Alex Ghiti <> | Subject | Re: [PATCH RFC 1/8] riscv/kaslr: add interface to get kaslr offset | Date | Tue, 7 Apr 2020 01:08:13 -0400 |
| |
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
| |