[PATCH v2 5/8] gelf_getshdr.c, elfNN_getshdr.c: Remove hotpath locks

Mark Wielaard mark@klomp.org
Fri Oct 16 17:12:33 GMT 2026


Hi Aaron,

On Wed, 2026-09-30 at 15:05 -0400, Aaron Merey wrote:
> Check whether the target shdr has already been loaded without using
> scn->elf->lock.  Otherwise use this lock only for the one-time lazy
> loading of the shdr.
> 
> VALGRIND_HG_DISABLE_CHECKING is used on shdr pointers before their
> atomic_store_release call to prevent helgrind false positives since
> there is no definite order to whether lock-free loads of the shdr
> pointers occur before or after this store.
> 
> Signed-off-by: Aaron Merey <amerey@redhat.com>
> 
> ---
> v2 getshdr: Set section 0 pointer last, add valgrind annotation

Looks good. We went through the whole locking/atomic changes for v1 and
I believe that is indeed correct. The setting of sections zero last is
a good idea.

Kind of the same question about the VALGRIND_HG_DISABLE_CHECKING for
scns.data state, is this the right place or could it be put where data
is originally allocated?

Thanks,

Mark


More information about the Elfutils-devel mailing list