Re: [PATCH v2 1/1] Support member offset uts_namespace.name

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

 



Hi Alex,

Thanks for updating this.

-----Original Message-----
> The offset of the field 'init_uts_ns.name' has changed
> since commit 9a56493f6942 ("uts: Use generic ns_common::count").
> 
> Link: https://lore.kernel.org/r/159644978167.604812.1773586504374412107.stgit@localhost.localdomain
> 

> Read the offset from VMCOREINFO if present. This requires a linux version
> which exports the requisite offset in VMCOREINFO.

ah, no, the crash utility doesn't read the offset from vmcoreinfo with
MEMBER_OFFSET_INIT(), but reads it from vmlinux (with debug info), so
this sentence should be fixed.  I can fix it when applying, so no need
to resend though.

Otherwise, the patch looks good to me.

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

Thanks,
Kazu

> 
> Signed-off-by: Alexander Egorenkov <egorenar@xxxxxxxxxxxxx>
> ---
> 
> v1 -> v2:
>  * Use offset from VMCOREINFO
>  * Initialize corresponding entry in offset_table
> 
>  defs.h    |  1 +
>  kernel.c  | 15 ++++++++++-----
>  symbols.c |  3 +++
>  3 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/defs.h b/defs.h
> index c899fe2..9a8030a 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -2104,6 +2104,7 @@ struct offset_table {                    /* stash of commonly-used offsets */
>  	long inode_i_sb_list;
>  	long irq_common_data_affinity;
>  	long irq_desc_irq_common_data;
> +	long uts_namespace_name;
>  };
> 
>  struct size_table {         /* stash of commonly-used sizes */
> diff --git a/kernel.c b/kernel.c
> index 5ae8cf1..9871637 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -230,16 +230,21 @@ kernel_init()
>  		fprintf(fp, "%s\n\n", ctime_tz(&kt->date.tv_sec));
>  		clean_exit(0);
>  	}
> -
> +
> +	MEMBER_OFFSET_INIT(uts_namespace_name, "uts_namespace", "name");
>  	if (symbol_exists("system_utsname"))
>          	readmem(symbol_value("system_utsname"), KVADDR, &kt->utsname,
>                  	sizeof(struct new_utsname), "system_utsname",
>  			RETURN_ON_ERROR);
> -	else if (symbol_exists("init_uts_ns"))
> -		readmem(symbol_value("init_uts_ns") + sizeof(int),
> -			KVADDR,  &kt->utsname, sizeof(struct new_utsname),
> +	else if (symbol_exists("init_uts_ns")) {
> +		long offset = sizeof(int);
> +		if (VALID_MEMBER(uts_namespace_name))
> +			offset = OFFSET(uts_namespace_name);
> +
> +		readmem(symbol_value("init_uts_ns") + offset,
> +			KVADDR,  &kt->utsname, sizeof(struct new_utsname),
>  			"init_uts_ns", RETURN_ON_ERROR);
> -	else
> +	} else
>  		error(INFO, "cannot access utsname information\n\n");
> 
>  	if (CRASHDEBUG(1)) {
> diff --git a/symbols.c b/symbols.c
> index d22fb1d..3dd5fa1 100644
> --- a/symbols.c
> +++ b/symbols.c
> @@ -10585,6 +10585,9 @@ dump_offset_table(char *spec, ulong makestruct)
>  	fprintf(fp, "                 xa_node_shift: %ld\n",
>  		OFFSET(xa_node_shift));
> 
> +	fprintf(fp, "            uts_namespace_name: %ld\n",
> +		OFFSET(uts_namespace_name));
> +
>  	fprintf(fp, "\n                    size_table:\n");
>  	fprintf(fp, "                          page: %ld\n", SIZE(page));
>  	fprintf(fp, "                    page_flags: %ld\n", SIZE(page_flags));
> --
> 2.26.2


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




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

 

Powered by Linux