This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Remove unnecessary IFUNC dispatch for __memset_chk.
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: Alexander Monakov <amonakov at ispras dot ru>, Zack Weinberg <zackw at panix dot com>, Andreas Schwab <schwab at linux-m68k dot org>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 11 Aug 2015 13:52:35 -0700
- Subject: Re: [PATCH] Remove unnecessary IFUNC dispatch for __memset_chk.
- Authentication-results: sourceware.org; auth=none
- References: <55C79AD8 dot 3070301 at panix dot com> <20150810030920 dot GE23550 at vapier> <20150810211200 dot GA17734 at domone> <CAKCAbMia4RCA7X0YHYeXC6eAGCxzDqhWrMiGS4NxA-cDxFioVw at mail dot gmail dot com> <20150811080451 dot GA6280 at domone> <CAMe9rOpjYBG9vHPFmJNAPQ02fhq_F_ZqoNprVsAkGCS=ZHEpqQ at mail dot gmail dot com> <20150811190303 dot GA4134 at domone> <CAMe9rOqFYTSxDcDPocD7iMb7+F=mkMXhqgVg+RfjX35+KVw1hg at mail dot gmail dot com> <alpine dot LNX dot 2 dot 20 dot 1508112218480 dot 29573 at monopod dot intra dot ispras dot ru> <CAMe9rOp=zkYotu4DK5wDQpMRUtBiCFV+hwEcapCCYwzjL+SLvw at mail dot gmail dot com> <20150811203001 dot GD4134 at domone>
On Tue, Aug 11, 2015 at 1:30 PM, OndÅej BÃlka <firstname.lastname@example.org> wrote:
> On Tue, Aug 11, 2015 at 12:55:31PM -0700, H.J. Lu wrote:
>> On Tue, Aug 11, 2015 at 12:41 PM, Alexander Monakov <email@example.com> wrote:
>> > On Tue, 11 Aug 2015, H.J. Lu wrote:
>> >> > Didn't know its explicitly forbidden to use nonstatic resolvers. Do we document that requirement somewhere?
>> >> > If not then we should add it to documentation.
>> >> It makes no senses for IFUNC selector to return the address of
>> >> a global function, which may be preempted at run-time.
>> > That would be imposing a policy while providing a mechanism.
>> > I think there are plausible scenarios where returning a global function from
>> > an ifunc resolver would be natural.
>> > To give a specific example, imagine an ifunc symbol
>> > 'printf_fortified_opportunistically', which resolves to 'printf_chk' if it is
>> > available in the global namespace, or normal 'printf' otherwise.
>> > Such a symbol could be in any DSO, not necessarily libc, and thus it has to be
>> > able to pick up global symbol definitions.
>> By the nature of preemption, you have NO control over which definition
>> will be used at run-time. It can be literally anything, including segfault.
> Could you document that somewhere? Sorry for earlier confusion where I
> thought you meant resolver must be static. Its about that users could
> have similar ideas like making symbol global for silly reasons like
> be able to profile variant with LD_PRELOAD.
If the returned function has non-local binding, the run-time behavior
as it may be preempted at run-time.