lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210428100229.GA8374@localhost.localdomain>
Date:   Wed, 28 Apr 2021 18:02:29 +0800
From:   Baoquan He <bhe@...hat.com>
To:     Stephen Boyd <swboyd@...omium.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Jessica Yu <jeyu@...nel.org>,
        Evan Green <evgreen@...omium.org>,
        Hsin-Yi Wang <hsinyi@...omium.org>,
        Dave Young <dyoung@...hat.com>,
        Vivek Goyal <vgoyal@...hat.com>, kexec@...ts.infradead.org
Subject: Re: [PATCH v5 03/13] buildid: Stash away kernels build ID on init

On 04/20/21 at 02:49pm, Stephen Boyd wrote:
> Parse the kernel's build ID at initialization so that other code can
> print a hex format string representation of the running kernel's build
> ID. This will be used in the kdump and dump_stack code so that
> developers can easily locate the vmlinux debug symbols for a
> crash/stacktrace.
> 
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Alexei Starovoitov <ast@...nel.org>
> Cc: Jessica Yu <jeyu@...nel.org>
> Cc: Evan Green <evgreen@...omium.org>
> Cc: Hsin-Yi Wang <hsinyi@...omium.org>
> Cc: Dave Young <dyoung@...hat.com>
> Cc: Baoquan He <bhe@...hat.com>
> Cc: Vivek Goyal <vgoyal@...hat.com>
> Cc: <kexec@...ts.infradead.org>
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> ---
>  include/linux/buildid.h |  3 +++
>  init/main.c             |  1 +
>  lib/buildid.c           | 15 +++++++++++++++
>  3 files changed, 19 insertions(+)
> 
> diff --git a/include/linux/buildid.h b/include/linux/buildid.h
> index ebce93f26d06..f375900cf9ed 100644
> --- a/include/linux/buildid.h
> +++ b/include/linux/buildid.h
> @@ -10,4 +10,7 @@ int build_id_parse(struct vm_area_struct *vma, unsigned char *build_id,
>  		   __u32 *size);
>  int build_id_parse_buf(const void *buf, unsigned char *build_id, u32 buf_size);
>  
> +extern unsigned char vmlinux_build_id[BUILD_ID_SIZE_MAX];
> +void init_vmlinux_build_id(void);
> +
>  #endif
> diff --git a/init/main.c b/init/main.c
> index 53b278845b88..eaede2f41327 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -857,6 +857,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
>  	set_task_stack_end_magic(&init_task);
>  	smp_setup_processor_id();
>  	debug_objects_early_init();
> +	init_vmlinux_build_id();
>  
>  	cgroup_init_early();
>  
> diff --git a/lib/buildid.c b/lib/buildid.c
> index 6aea1c4e5e85..1103ed46214f 100644
> --- a/lib/buildid.c
> +++ b/lib/buildid.c
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
>  #include <linux/buildid.h>
> +#include <linux/cache.h>
>  #include <linux/elf.h>
>  #include <linux/kernel.h>
>  #include <linux/pagemap.h>
> @@ -172,3 +173,17 @@ int build_id_parse_buf(const void *buf, unsigned char *build_id, u32 buf_size)
>  {
>  	return parse_build_id_buf(build_id, NULL, buf, buf_size);
>  }
> +
> +unsigned char vmlinux_build_id[BUILD_ID_SIZE_MAX] __ro_after_init;
> +
> +/**
> + * init_vmlinux_build_id - Compute and stash the running kernel's build ID
> + */
> +void __init init_vmlinux_build_id(void)
> +{
> +	extern const void __start_notes __weak;
> +	extern const void __stop_notes __weak;
> +	unsigned int size = &__stop_notes - &__start_notes;
> +
> +	build_id_parse_buf(&__start_notes, vmlinux_build_id, size);
> +}

LGTM, thx.

Acked-by: Baoquan He <bhe@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ