lkml.org 
[lkml]   [2023]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] LoongArch: Add kernel address sanitizer support
From
Date
On Tue, 2023-03-28 at 19:17 +0800, Qing Zhang wrote:

/* snip */


> -void * __init relocate_kernel(void)
> +unsigned long __init relocate_kernel(void)

Why we must modify relocate_kernel for KASAN?

>  {
>         unsigned long kernel_length;
>         unsigned long random_offset = 0;
>         void *location_new = _text; /* Default to original kernel start */
> -       void *kernel_entry = start_kernel; /* Default to original kernel entry point */
>         char *cmdline = early_ioremap(fw_arg1, COMMAND_LINE_SIZE); /* Boot command line is passed in fw_arg1 */
>  
>         strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
> @@ -190,9 +189,6 @@ void * __init relocate_kernel(void)
>  
>                 reloc_offset += random_offset;
>  
> -               /* Return the new kernel's entry point */
> -               kernel_entry = RELOCATED_KASLR(start_kernel);
> -
>                 /* The current thread is now within the relocated kernel */
>                 __current_thread_info = RELOCATED_KASLR(__current_thread_info);
>  
> @@ -204,7 +200,7 @@ void * __init relocate_kernel(void)
>  
>         relocate_absolute(random_offset);
>  
> -       return kernel_entry;
> +       return random_offset;

--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
\
 
 \ /
  Last update: 2023-03-28 13:50    [W:0.163 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site