This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Remove unnecessary IFUNC dispatch for __memset_chk.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: 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 21:31:33 +0200
- Subject: Re: [PATCH] Remove unnecessary IFUNC dispatch for __memset_chk.
- Authentication-results: sourceware.org; auth=none
- References: <55C78525 dot 40402 at panix dot com> <CAMe9rOrKg8nzB67+OCXz5n1u7ZLnJncpX7J6KkEXqe0Bra843w at mail dot gmail dot com> <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>
On Tue, Aug 11, 2015 at 12:09:55PM -0700, H.J. Lu wrote:
> On Tue, Aug 11, 2015 at 12:03 PM, OndÅej BÃlka <neleai@seznam.cz> wrote:
> > On Tue, Aug 11, 2015 at 10:00:39AM -0700, H.J. Lu wrote:
> >> On Tue, Aug 11, 2015 at 1:04 AM, OndÅej BÃlka <neleai@seznam.cz> wrote:
> >> >>
> >> > Simple, we return null. Following causes segmentation fault.
> >> >
> >> > gcc -fPIC -shared x.c -o libx.so
> >> > void foo (int x) __attribute__ ((ifunc ("resolve_foo")));
> >> >
> >> > int foo_impl(int x)
> >> ^^^^^^^^^^^^^^^^^^^^
> >>
> >> This should be static.
> >>
> > 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.
>
While dubious its still either a bug or user error. So we should clarify
that user error or somebody will in future enter this issue into
bugzilla.
While dubious some user could decide its good idea to save space by
packing avx2 variant of function on separate library that overrides
resolver when present and replace that by dummy library when user's
processor doesn't have avx2.