Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250822151402.GH1827@brightrain.aerifal.cx>
Date: Fri, 22 Aug 2025 11:14:02 -0400
From: Rich Felker <dalias@...c.org>
To: tombo <hulata@...art.tech>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH v2] vdso: add support for GNU hash tables

On Fri, Aug 22, 2025 at 10:05:50AM -0400, Rich Felker wrote:
> On Fri, Aug 22, 2025 at 01:57:32PM +0200, tombo wrote:
> > The previous submission had formatting issues, sorry.
> > 
> > On some kernels (e.g. AWS Ubuntu's Graviton official AMIs) the arm64 vDSO
> > exports symbols with DT_GNU_HASH but omits DT_HASH.  musl's
> > __vdsosym resolver only understands SysV hash, so vDSO symbols
> > fail to resolve and clock_gettime falls back to syscalls.
> > 
> > This patch adds a minimal GNU hash lookup implementation to
> > __vdsosym, fixing vDSO usage on affected systems.
> 
> One immediate comment I have: it's not minimal. This is code that
> needs to be linked into every single (static linked) program, and
> that's searching for at most a couple symbols in a symbol table that
> has at most 10 or so symbols in it. There's no need to waste space on
> checking a bloom filter. Simply go straight to gnu_lookup without the
> gnu_lookup_filtered wrapper, which is taking up space and not
> providing anything of value.
> 
> Also, it looks like for the sysv hash table we skipped the hash
> entirely and just did a linear search over the hash table. This should
> be possible with the gnu hash table too, and doing that should allow
> folding all of the code into just one copy of the logic rather than
> duplicating it in two codepaths.

Indeed all you need to do is extract the length of the symbol table.
This is easy for sysv hash - it's stored at offset 1 in the sysv hash
table. Unfortunatley gnu hash omits it, but you can compute it via the
count_syms function in dynlink.c. Once you have that, you just use it
instead of hashtab[1] in the for loop at the end of __vdsosym.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.