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: <20230130235939.5kuau4d7agbmxqal@treble>
Date:   Mon, 30 Jan 2023 15:59:39 -0800
From:   Josh Poimboeuf <jpoimboe@...nel.org>
To:     Thomas Weißschuh <linux@...ssschuh.net>
Cc:     Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/8] objtool: reduce memory usage of struct reloc

On Tue, Dec 27, 2022 at 04:01:01PM +0000, Thomas Weißschuh wrote:
>  void elf_reloc_set_type(struct reloc *reloc, int type)
>  {
> +	if (type >= (1U << (8 * sizeof(reloc->type))))
> +		WARN("reloc->type out of range: %d", type);
> +
>  	reloc->type = type;
>  }
> diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
> index 33ec6cf72325..2b5becad5a0a 100644
> --- a/tools/objtool/include/objtool/elf.h
> +++ b/tools/objtool/include/objtool/elf.h
> @@ -77,10 +77,10 @@ struct reloc {
>  	struct symbol *sym;
>  	struct list_head sym_reloc_entry;
>  	unsigned long offset;
> -	unsigned int type;
>  	s64 addend;
>  	int idx;
>  	bool jump_table_start;
> +	unsigned char type;
>  };

I'd rather not because

  a) the helper function isn't very intuitive and we'll probably forget
     to use it

  b) some arches need more than 256 types (see for example aarch64 which
     objtool may need to support one of these days)

That said, feel free to rearrange the struct fields to at least get some
of those bytes back.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ