[PATCH] Call _dl_open_check after relocation is finished [BZ #24259]
Florian Weimer
fweimer@redhat.com
Tue Mar 5 14:00:00 GMT 2019
* H. J. Lu:
>> If you report the error at this, doesn't this mean the object is still
>> around and in a bad state? This looks related to this bug:
>
> Yes.
>
>> <https://sourceware.org/bugzilla/show_bug.cgi?id=20839>
>>
>> Would the CET bug go away if we got rid after the object without trace
>> after a failure in _dl_open_check?
>
> Yes.
>
>> I can look into fixing the other bug, but I don't know how hard that's
>> going to be.
I did that now and the required infrastructure changes are fairly
involved. So I think we should add something that works today.
A natural place for the CET compatibility check would be
elf_machine_reject_phdr_p (currently used only on MIPS). This way, we
can continue searching for a CET-compatible library along the search
path.
>> > diff --git a/sysdeps/x86/tst-cet-legacy-5.c b/sysdeps/x86/tst-cet-legacy-5.c
>> > new file mode 100644
>> > index 0000000000..fbf640f664
>> > --- /dev/null
>> > +++ b/sysdeps/x86/tst-cet-legacy-5.c
>>
>> > +static void
>> > +do_test_1 (const char *modname, bool fail)
>> > +{
>> > + int (*fp) (void);
>> > + void *h;
>> > +
>> > + h = dlopen (modname, RTLD_LAZY);
>> > + if (h == NULL)
>> > + {
>> > + if (fail)
>> > + {
>> > + const char *err = dlerror ();
>> > + if (strstr (err, "shadow stack isn't enabled") == NULL)
>> > + {
>> > + printf ("incorrect dlopen '%s' error: %s\n", modname,
>> > + dlerror ());
>> > + exit (1);
>> > + }
>> > +
>> > + return;
>> > + }
>>
>> Is the return supposed to be taken if running on non-CET hardware? I'm
>> looking for the UNSUPPORTED case.
>
> This path is taken only on CET hardware. For non-CET hardware, 'h' shouldn't
> be NULL.
Please add logging to the test for the unsupported case, so that the aim
of the test is clearer and when it fails to achieve its objective.
Thanks,
Florian
More information about the Libc-alpha
mailing list