[PATCH][BZ #18778] Clear DF_1_NODELETE flag only for dlopen failed library.
Maxim Ostapenko
m.ostapenko@partner.samsung.com
Mon Aug 10 11:56:00 GMT 2015
On 07/08/15 19:14, H.J. Lu wrote:
> On Fri, Aug 7, 2015 at 8:58 AM, Maxim Ostapenko
> <m.ostapenko@partner.samsung.com> wrote:
>> Hi!
>>
>> On 06/08/15 18:30, Andreas Schwab wrote:
>>> Pavel Kopyl <p.kopyl@samsung.com> writes:
>>>
>>>> diff --git a/elf/dl-close.c b/elf/dl-close.c
>>>> index 412f71d..0595675 100644
>>>> --- a/elf/dl-close.c
>>>> +++ b/elf/dl-close.c
>>>> @@ -108,7 +108,7 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list
>>>> *listp, size_t disp,
>>>> void
>>>> -_dl_close_worker (struct link_map *map)
>>>> +_dl_close_worker (struct link_map *map, bool force)
>>>> {
>>>> /* One less direct use. */
>>>> --map->l_direct_opencount;
>>>> @@ -152,6 +152,10 @@ _dl_close_worker (struct link_map *map)
>>>> l->l_idx = idx;
>>>> maps[idx] = l;
>>>> ++idx;
>>>> +
>>>> + /* clear DF_1_NODELETE to force object deletion. */
>>>> + if (force)
>>>> + l->l_flags_1 &= ~DF_1_NODELETE;
>>> This will remove the NODELETE flag from *all* loaded objects. That
>>> doesn't make sense.
>>>
>>> Andreas.
>>>
>> Indeed, we shouldn't remove NODELETE from all loaded objects, only for buggy
>> library. Here a draft patch that should fix the issue. Andreas, does this
>> look reasonable for you? If yes, I'll reformat it (e.g. add proper ChangeLog
>> entry etc) and send for review as BZ#18778 fix.
>>
> Please include a testcase to verify that the bug is fixed.
>
This patch fixes BZ #18778 issue by moving l->l_flags_1 &=
~DF_1_NODELETE out of loop through all loaded libraries and performs
this action only on inconsistent one.
No regressions on x86_64-unknown-linux-gnu, testcase is attached, OK for
master?
-Maxim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Clear-DF_1_NODELETE-flag-only-for-failed-to-load-lib.patch
Type: text/x-patch
Size: 7446 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150810/3226f2db/attachment.bin>
More information about the Libc-alpha
mailing list