Re: [PATCHv2] arm64: deduce the start address of kernel code, based on kernel version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
> After kernel commit e2a073dde921 ("arm64: omit [_text, _stext) from
> permanent kernel mapping"), the range [_text, _stext] is reclaimed. But
> the current crash code still assumes kernel starting from "_text".
> 
> This change only affects the vmalloced area on arm64 and may result a
> false in arm64_IS_VMALLOC_ADDR().
> 
> Since vmcore has no extra information about this trival change, it can
> only be deduced from kernel version, which means ms->kimage_text can not
> be correctly initialized until kernel_init() finishes. Here on arm64, it
> can be done at the point machdep_init(POST_GDB). This is fine
> since there is no access to vmalloced area at this stage.
> 
> Signed-off-by: Pingfan Liu <piliu@xxxxxxxxxx>

Thanks for the v2.  Assuming the patch was tested,

Acked-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>

Kazu


> ---
>  arm64.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/arm64.c b/arm64.c
> index de1038a..3ab8489 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -92,6 +92,20 @@ static void arm64_calc_VA_BITS(void);
>  static int arm64_is_uvaddr(ulong, struct task_context *);
>  static void arm64_calc_KERNELPACMASK(void);
> 
> +static void arm64_calc_kernel_start(void)
> +{
> +	struct machine_specific *ms = machdep->machspec;
> +	struct syment *sp;
> +
> +	if (THIS_KERNEL_VERSION >= LINUX(5,11,0))
> +		sp = kernel_symbol_search("_stext");
> +	else
> +		sp = kernel_symbol_search("_text");
> +
> +	ms->kimage_text = (sp ? sp->value : 0);
> +	sp = kernel_symbol_search("_end");
> +	ms->kimage_end = (sp ? sp->value : 0);
> +}
> 
>  /*
>   * Do all necessary machine-specific setup here. This is called several times
> @@ -241,6 +255,7 @@ arm64_init(int when)
>  		if (machdep->flags & NEW_VMEMMAP) {
>  			struct syment *sp;
> 
> +			/* It is finally decided in arm64_calc_kernel_start() */
>  			sp = kernel_symbol_search("_text");
>  			ms->kimage_text = (sp ? sp->value : 0);
>  			sp = kernel_symbol_search("_end");
> @@ -387,6 +402,8 @@ arm64_init(int when)
>  		break;
> 
>  	case POST_GDB:
> +		/* Rely on kernel version to decide the kernel start address */
> +		arm64_calc_kernel_start();
>  		arm64_calc_virtual_memory_ranges();
>  		arm64_get_section_size_bits();
> 
> --
> 2.31.1


--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux