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]
Date:   Thu, 29 Jun 2023 07:18:19 -0700
From:   Josh Poimboeuf <jpoimboe@...nel.org>
To:     Michal Kubecek <mkubecek@...e.cz>
Cc:     Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] objtool: initialize all of struct elf

On Thu, Jun 29, 2023 at 12:05:05PM +0200, Michal Kubecek wrote:
> Function elf_open_read() only zero initializes the initial part of
> allocated struct elf; num_relocs member was recently added outside the
> zeroed part so that it was left uninitialized, resulting in build failures
> on some systems.
> 
> The partial initialization is a relic of times when struct elf had large
> hash tables embedded. This is no longer the case so remove the trap and
> initialize the whole structure instead.
> 
> Fixes: eb0481bbc4ce ("objtool: Fix reloc_hash size")
> Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
> ---
>  tools/objtool/elf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
> index d420b5d2e2b6..081befa4674b 100644
> --- a/tools/objtool/elf.c
> +++ b/tools/objtool/elf.c
> @@ -1005,7 +1005,7 @@ struct elf *elf_open_read(const char *name, int flags)
>  		perror("malloc");
>  		return NULL;
>  	}
> -	memset(elf, 0, offsetof(struct elf, sections));
> +	memset(elf, 0, sizeof(*elf));
>  
>  	INIT_LIST_HEAD(&elf->sections);

Thanks!

Acked-by: Josh Poimboeuf <jpoimboe@...nel.org>

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ