This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv4][PING][BZ #17833] _dl_close_worker() does not release inconsistent objects.
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Pavel Kopyl <p dot kopyl at samsung dot com>
- Cc: Yury Gribov <y dot gribov at samsung dot com>, GNU C Library <libc-alpha at sourceware dot org>, "Carlos O'Donell" <carlos at redhat dot com>, Roland McGrath <roland at hack dot frob dot com>, Viacheslav Garbuzov <v dot garbuzov at samsung dot com>
- Date: Wed, 27 May 2015 15:06:42 -0700
- Subject: Re: [PATCHv4][PING][BZ #17833] _dl_close_worker() does not release inconsistent objects.
- Authentication-results: sourceware.org; auth=none
- References: <54BD4F65 dot 2090108 at samsung dot com> <54BEF851 dot 70902 at redhat dot com> <54DBC3CB dot 5080703 at samsung dot com> <54F071DB dot 9040106 at samsung dot com> <20150301191710 dot GB19363 at vapier> <54F57B52 dot 6080202 at samsung dot com> <553A1BEE dot 6070705 at samsung dot com> <CAMe9rOqiyuyNAtJDZGbfs+0kk0j16-Vowp5f0z_x2zfsd76fMQ at mail dot gmail dot com> <5553382F dot 3020906 at samsung dot com> <5565B5E5 dot 7060101 at samsung dot com> <CAMe9rOr8yDpnHtRFbL3M56Sx5FWX-FVqEstnwsgtW6H+khvziQ at mail dot gmail dot com> <5565C2A8 dot 60306 at samsung dot com> <CAMe9rOq++pD-ugdYFEte49v8TLZEM505J+=WzPTOT_Lo-MdDHQ at mail dot gmail dot com> <5565C862 dot 1040003 at samsung dot com> <CAMe9rOo7TStj3SX8OK8s3H3G=2Pyr1WKTW=R-=SzVFBWY8PF0A at mail dot gmail dot com> <5566395A dot 3090605 at samsung dot com>
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.