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: [PATCHv4][PING][BZ #17833] _dl_close_worker() does not release inconsistent objects.


On Wed, May 27, 2015 at 2:38 PM, Pavel Kopyl <p.kopyl@samsung.com> wrote:
>
>>>>>
>>>>> AFAIU DF_1_NODELETE change is necessary. Otherwise unique symbols force
>>>>> library to remain loaded in half-initialized state (with missing
>>>>> dependencies). This usecase is demonstrated by the testcase in patch.
>>>>>
>>>> But unique symbols != DF_1_NODELETE:
>>>
>>>
>>> DF_1_NODELETE is set in do_lookup_unique at runtime (Paul, am I right?):
>>>
>>>        enter_unique_sym (entries, size,
>>>                          new_hash, strtab + sym->st_name, sym, map);
>>>
>>>        if (map->l_type == lt_loaded)
>>>          /* Make sure we don't unload this object by
>>>             setting the appropriate flag.  */
>>>          ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;
>>>
>>> -Y
>>
>> Should we set DF_1_NODELETE when dlopen fails?  What happens
>> when dlopen a  DF_1_NODELETE fails?  Do we keep it in memory
>> even when dopen fails?
>>
> As I know there are following ways how to set DF_1_NODELETE flag for a
> library.
>
> 1. Unique symbols.
> 2, Load with RTLD_NODELETE flag.
> 3. Link with "-z nodelete" option.
>
> As for RTLD_NODELETE, there is no problem: dlopen exits in case of error
> before DF_1_NODELETE is set.
> If dlopen fails both in first and third cases this leads to locking
> libraries in half-initialized state. I think this is a bug.
> Suggested patch fixes both usecases.

Assume there is a problem with DF_1_NODELETE, which can be
set explicitly as well as implicitly.  Your testcase only covers
implicitly DF_1_NODELETE, not explicitly  DF_1_NODELETE.
I think we should verify the status of explicitly  DF_1_NODELETE.

If explicitly  DF_1_NODELETE works fine, then we only have a
problem with implicitly DF_1_NODELETE.

If explicitly  DF_1_NODELETE doesn't work, we need to fix it
first and implicitly DF_1_NODELETE may just work.


-- 
H.J.


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