This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: BZ #14557: __kernel_vsyscall unwind info is incorrect


On Fri, Sep 28, 2012 at 12:47 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> The _ns_loaded list is for ld.so and doesn't support libc.a.  For
>> example, ld.so calls its own malloc routines to manage memory before
>> entering main.  We can't easily do that in libc.a since we need to set up
>> a few things for malloc first.  Unless there is a specific issue we need
>> to address, I'd like to use the existing patch.  OK to install?
>
> If statically-linked programs are going to know about the vDSO at all,
> then they should support it fully.  That means a static program can use
> -ldl and use dlsym to access the vDSO, for example.
>
> The rtld.c code that sets up dl_sysinfo_map can move into a new internal
> function in a new dl-foo.c file built both for ld.so and for libc.a.  For
> static, that function can be called by some __attribute__((constructor))
> function that is defined in the same file as the definition of some data
> variables that only -ldl code or dl_iterate_phdr will use, so it's not
> included in a static link that doesn't need it.  Surely a static program's
> __attribute__((constructor)) functions can call malloc (if they can't, then
> that's a preexisting bug we should fix first).
>

Here are 4 patches I checked into hjl/pr14557/map branch:

Patch 1:  Set up the data structures for the system-supplied DSO early
in _dl_non_dynamic_init,  so they can influence _dl_init_paths.  I
extracted elf_get_dynamic_info from dynamic-link.h into
get-dynamic-info.h so that it can be used in _dl_non_dynamic_init.
Patch 2:  It allows _ns_loaded == dl_sysinfo_map if SHARED isn't defined.
Otherwise it will trigger

assert (nsid < GL(dl_nns));

in _dl_map_object in static executables.
Patch 3: Test cases for BZ #14557.
Patch 4: Use the same _dl_important_hwcaps in ld.so and
libc.a.

Tested on x86-64 and ia32.  OK to install?

Thanks.

-- 
H.J.

Attachment: 0001-Set-up-the-data-structures-for-vDSO-in-libc.a.patch
Description: Binary data

Attachment: 0002-Allow-_ns_loaded-dl_sysinfo_map-in-libc.a.patch
Description: Binary data

Attachment: 0003-Add-test-cases-for-BZ-14557.patch
Description: Binary data

Attachment: 0004-Move-_dl_important_hwcaps-to-dl-hwcaps.c.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]