[PATCH v3] elf: Test dlopen (NULL, RTLD_LAZY) from an ELF constructor
Sam James
sam@gentoo.org
Mon Dec 30 16:41:34 GMT 2024
Florian Weimer <fweimer@redhat.com> writes:
> * Sam James:
>
>>> diff --git a/elf/tst-dlopen-constructor-null.c b/elf/tst-dlopen-constructor-null.c
>>> new file mode 100644
>>> index 0000000000..58c4660c7d
>>> --- /dev/null
>>> +++ b/elf/tst-dlopen-constructor-null.c
>>> @@ -0,0 +1,38 @@
>>> +/* Verify that dlopen (NULL, RTLD_LAZY) does not complete initialization.
>>> + Copyright (C) 2024 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <https://www.gnu.org/licenses/>. */
>>> +
>>> +/* This test mimics what the glvndSetupPthreads function in libglvnd
>>> + does. */
>>
>> Have you confirmed that reverting the fixes breaks the test?
>
> If I cherry-pick the changes from commit 9897ced8e78db5d813166a7ccccfd
> (minus the elf/Makefile update for the tests, due to conflicts), I get
> this:
>
> FAIL: elf/tst-dlopen-constructor-null
> original exit status 1
> info: tst-dlopen-constructor-null-mod1.so constructor
> info: tst-dlopen-constructor-null-mod2.so constructor (mod1_status=0)error: mod1_status == 1 && mod2_status == 0 expected
>
> So I assume the test does exercise the bug.
>
>>> +#include <stdlib.h>
>>> +#include <support/check.h>
>>> +
>>> +/* Defined an initialized in the shared objects. */
>>
>> "an initialized"?
>
> “and initialized”. Fixed locally, thanks.
Thanks. You can consider this a review to unblock you given this
seems straightforward, or wait for someone else to look.
(Just giving the caveat as I don't want to mislead with my confidence on
it. I don't think there's anything wrong with the test.)
More information about the Libc-alpha
mailing list