[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230628193231.GX83892@hirez.programming.kicks-ass.net>
Date: Wed, 28 Jun 2023 21:32:31 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Michal Kubecek <mkubecek@...e.cz>, linux-kernel@...r.kernel.org
Subject: Re: build failure after commit eb0481bbc4ce ("objtool: Fix
reloc_hash size")
On Wed, Jun 28, 2023 at 11:10:19AM -0700, Josh Poimboeuf wrote:
> On Wed, Jun 28, 2023 at 07:26:59PM +0200, Michal Kubecek wrote:
> > I digged some more and my guess is that the problem is that
> > elf_open_read() does
> >
> > memset(elf, 0, offsetof(struct elf, sections));
> >
> > but commit eb0481bbc4ce ("objtool: Fix reloc_hash size") added
> > num_relocs after sections so that it is not zeroed (0xbabababababababa
> > is probably some kind of poison).
>
> Argh, that memset() is subtle as heck. Peter, why?!?
Well, at the time struct elf had a bunch of fairly large hash tables
embedded inside it. memset() on those was a significant performance fail
-- esp. since we called objtool on every .o file.
struct elf {
Elf *elf;
GElf_Ehdr ehdr;
int fd;
char *name;
struct list_head sections;
DECLARE_HASHTABLE(symbol_hash, 20);
DECLARE_HASHTABLE(symbol_name_hash, 20);
DECLARE_HASHTABLE(section_hash, 16);
DECLARE_HASHTABLE(section_name_hash, 16);
DECLARE_HASHTABLE(rela_hash, 20);
};
Those embedded hash-tables have gone away, but apparently someone forgot
about this thing :/
Yes, this can go, struct elf is no longer like that.
Powered by blists - more mailing lists