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: <YeX0BQOQYKI+95eP@archlinux-ax161>
Date:   Mon, 17 Jan 2022 15:56:05 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Yinan Liu <yinan@...ux.alibaba.com>
Cc:     rostedt@...dmis.org, mingo@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] script/sorttable: fix some initialization problems

On Mon, Jan 17, 2022 at 02:23:44PM +0800, Yinan Liu wrote:
> elf_mcount_loc and mcount_sort_thread definitions are not
> initialized immediately within the function, which can cause
> the judgment logic to use uninitialized values when the
> initialization logic of subsequent code fails.
> 
> Link: https://lkml.kernel.org/r/20211212113358.34208-2-yinan@linux.alibaba.com
> 
> Fixes:72b3942a173c (scripts: ftrace - move the sort-processing in ftrace_init)

This should be:

Fixes: 72b3942a173c ("scripts: ftrace - move the sort-processing in ftrace_init")

You can add an alias to always get the format right, like:

$ git config --global alias.fixes 'show -s --format="Fixes: %h (\"%s\")"'

$ git fixes 72b3942a173c387b27860ba1069636726e208777
Fixes: 72b3942a173c ("scripts: ftrace - move the sort-processing in ftrace_init")

> Signed-off-by: Yinan Liu <yinan@...ux.alibaba.com>

This resolves the warnings I reported and does not introduce any new
ones. It seems reasonable to me.

Reviewed-by: Nathan Chancellor <nathan@...nel.org>
Tested-by: Nathan Chancellor <nathan@...nel.org>

> ---
>  scripts/sorttable.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/sorttable.h b/scripts/sorttable.h
> index 1e8b77928fa4..13ae3262ec96 100644
> --- a/scripts/sorttable.h
> +++ b/scripts/sorttable.h
> @@ -199,6 +199,8 @@ static int compare_extable(const void *a, const void *b)
>  	return 0;
>  }
>  #ifdef MCOUNT_SORT_ENABLED
> +pthread_t mcount_sort_thread;
> +
>  struct elf_mcount_loc {
>  	Elf_Ehdr *ehdr;
>  	Elf_Shdr *init_data_sec;
> @@ -282,10 +284,9 @@ static int do_sort(Elf_Ehdr *ehdr,
>  	unsigned int shnum;
>  	unsigned int shstrndx;
>  #ifdef MCOUNT_SORT_ENABLED
> -	struct elf_mcount_loc mstruct;
> +	struct elf_mcount_loc mstruct = {NULL, NULL, 0, 0};

Wonder if this would be better using either '= {}' or '= {0}'?

>  	uint_t _start_mcount_loc = 0;
>  	uint_t _stop_mcount_loc = 0;
> -	pthread_t mcount_sort_thread;
>  #endif
>  #if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED)
>  	unsigned int orc_ip_size = 0;
> -- 
> 2.19.1.6.gb485710b
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ