mirror of
git://sourceware.org/git/glibc.git
synced 2025-01-30 12:31:53 +08:00
329ea513b4
Neither the <dlfcn.h> entry points, nor lazy symbol resolution, nor initial shared library load-up, are cancellation points, so ld.so should exclusively use I/O primitives that are not cancellable. We currently achieve this by having the cancellation hooks compile as no-ops when IS_IN(rtld); this patch changes to using exclusively _nocancel primitives in the source code instead, which makes the intent clearer and significantly reduces the amount of code compiled under IS_IN(rtld) as well as IS_IN(libc) -- in particular, elf/Makefile no longer thinks we require a copy of unwind.c in rtld-libc.a. (The older mechanism is preserved as a backstop.) The bulk of the change is splitting up the files that define the _nocancel I/O functions, so they don't also define the variants that *are* cancellation points; after which, the existing logic for picking out the bits of libc that need to be recompiled as part of ld.so Just Works. I did this for all of the _nocancel functions, not just the ones used by ld.so, for consistency. fcntl was a little tricky because it's only a cancellation point for certain opcodes (F_SETLKW(64), which can block), and the existing __fcntl_nocancel wasn't applying the FCNTL_ADJUST_CMD hook, which strikes me as asking for trouble, especially as the only nontrivial definition of FCNTL_ADJUST_CMD (for powerpc64) changes F_*LK* opcodes. To fix this, fcntl_common moves to fcntl_nocancel.c along with __fcntl_nocancel, and changes its name to the extern (but hidden) symbol __fcntl_nocancel_adjusted, so that regular fcntl can continue calling it. __fcntl_nocancel now applies FCNTL_ADJUST_CMD; so that both both fcntl.c and fcntl_nocancel.c can see it, the only nontrivial definition moves from sysdeps/u/s/l/powerpc/powerpc64/fcntl.c to .../powerpc64/sysdep.h and becomes entirely a macro, instead of a macro that calls an inline function. The nptl version of libpthread also changes a little, because its "compat-routines" formerly included files that defined all the _nocancel functions it uses; instead of continuing to duplicate them, I exported the relevant ones from libc.so as GLIBC_PRIVATE. Since the Linux fcntl.c calls a function defined by fcntl_nocancel.c, it can no longer be used from libpthread.so; instead, introduce a custom forwarder, pt-fcntl.c, and export __libc_fcntl from libc.so as GLIBC_PRIVATE. The nios2-linux ABI doesn't include a copy of vfork() in libpthread, and it was handling that by manipulating libpthread-routines in .../linux/nios2/Makefile; it is cleaner to do what other such ports do, and have a pt-vfork.S that defines no symbols. Right now, it appears that Hurd does not implement _nocancel I/O, so sysdeps/generic/not-cancel.h will forward everything back to the regular functions. This changed the names of some of the functions that sysdeps/mach/hurd/dl-sysdep.c needs to interpose. * elf/dl-load.c, elf/dl-misc.c, elf/dl-profile.c, elf/rtld.c * sysdeps/unix/sysv/linux/dl-sysdep.c Include not-cancel.h. Use __close_nocancel instead of __close, __open64_nocancel instead of __open, __read_nocancel instead of __libc_read, and __write_nocancel instead of __libc_write. * csu/check_fds.c (check_one_fd) * sysdeps/posix/fdopendir.c (__fdopendir) * sysdeps/posix/opendir.c (__alloc_dir): Use __fcntl_nocancel instead of __fcntl and/or __libc_fcntl. * sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np) * sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np) * sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Use __open64_nocancel instead of __open_nocancel. * sysdeps/unix/sysv/linux/not-cancel.h: Move all of the hidden_proto declarations to the end and issue them if either IS_IN(libc) or IS_IN(rtld). * sysdeps/unix/sysv/linux/Makefile [subdir=io] (sysdep_routines): Add close_nocancel, fcntl_nocancel, nanosleep_nocancel, open_nocancel, open64_nocancel, openat_nocancel, pause_nocancel, read_nocancel, waitpid_nocancel, write_nocancel. * io/Versions [GLIBC_PRIVATE]: Add __libc_fcntl, __fcntl_nocancel, __open64_nocancel, __write_nocancel. * posix/Versions: Add __nanosleep_nocancel, __pause_nocancel. * nptl/pt-fcntl.c: New file. * nptl/Makefile (pthread-compat-wrappers): Remove fcntl. (libpthread-routines): Add pt-fcntl. * include/fcntl.h (__fcntl_nocancel_adjusted): New function. (__libc_fcntl): Remove attribute_hidden. * sysdeps/unix/sysv/linux/fcntl.c (__libc_fcntl): Call __fcntl_nocancel_adjusted, not fcntl_common. (__fcntl_nocancel): Move to new file fcntl_nocancel.c. (fcntl_common): Rename to __fcntl_nocancel_adjusted; also move to fcntl_nocancel.c. * sysdeps/unix/sysv/linux/fcntl_nocancel.c: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Remove file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Define FCNTL_ADJUST_CMD here, as a self-contained macro. * sysdeps/unix/sysv/linux/close.c: Move __close_nocancel to... * sysdeps/unix/sysv/linux/close_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/nanosleep.c: Move __nanosleep_nocancel to... * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/open.c: Move __open_nocancel to... * sysdeps/unix/sysv/linux/open_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/open64.c: Move __open64_nocancel to... * sysdeps/unix/sysv/linux/open64_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/openat.c: Move __openat_nocancel to... * sysdeps/unix/sysv/linux/openat_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/openat64.c: Move __openat64_nocancel to... * sysdeps/unix/sysv/linux/openat64_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/pause.c: Move __pause_nocancel to... * sysdeps/unix/sysv/linux/pause_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/read.c: Move __read_nocancel to... * sysdeps/unix/sysv/linux/read_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/waitpid.c: Move __waitpid_nocancel to... * sysdeps/unix/sysv/linux/waitpid_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/write.c: Move __write_nocancel to... * sysdeps/unix/sysv/linux/write_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/nios2/Makefile: Don't override libpthread-routines. * sysdeps/unix/sysv/linux/nios2/pt-vfork.S: New file which defines nothing. * sysdeps/mach/hurd/dl-sysdep.c: Define __read instead of __libc_read, and __write instead of __libc_write. Define __open64 in addition to __open. |
||
---|---|---|
.. | ||
cache.c | ||
chroot_canon.c | ||
circleload1.c | ||
circlemod1.c | ||
circlemod1a.c | ||
circlemod2.c | ||
circlemod2a.c | ||
circlemod3.c | ||
circlemod3a.c | ||
constload1.c | ||
constload2.c | ||
constload3.c | ||
dblload.c | ||
dblloadmod1.c | ||
dblloadmod2.c | ||
dblloadmod3.c | ||
dblunload.c | ||
dep1.c | ||
dep2.c | ||
dep3.c | ||
dep4.c | ||
dl-addr-obj.c | ||
dl-addr.c | ||
dl-brk.c | ||
dl-cache.c | ||
dl-close.c | ||
dl-conflict.c | ||
dl-debug.c | ||
dl-deps.c | ||
dl-dst.h | ||
dl-environ.c | ||
dl-error-minimal.c | ||
dl-error-skeleton.c | ||
dl-error.c | ||
dl-exception.c | ||
dl-execstack.c | ||
dl-fini.c | ||
dl-fptr.c | ||
dl-hwcaps.c | ||
dl-hwcaps.h | ||
dl-init.c | ||
dl-iteratephdr.c | ||
dl-libc.c | ||
dl-load.c | ||
dl-load.h | ||
dl-lookup.c | ||
dl-machine-reject-phdr.h | ||
dl-map-segments.h | ||
dl-minimal.c | ||
dl-misc.c | ||
dl-object.c | ||
dl-open.c | ||
dl-origin.c | ||
dl-profile.c | ||
dl-profstub.c | ||
dl-reloc-static-pie.c | ||
dl-reloc.c | ||
dl-runtime.c | ||
dl-sbrk.c | ||
dl-scope.c | ||
dl-sort-maps.c | ||
dl-support.c | ||
dl-sym.c | ||
dl-symaddr.c | ||
dl-sysdep-open.h | ||
dl-sysdep.c | ||
dl-tls.c | ||
dl-trampoline.c | ||
dl-tunable-types.h | ||
dl-tunables.c | ||
dl-tunables.h | ||
dl-tunables.list | ||
dl-unmap-segments.h | ||
dl-version.c | ||
dl-writev.h | ||
do-rel.h | ||
dynamic-link.h | ||
elf.h | ||
enbl-secure.c | ||
failobj.c | ||
filter.c | ||
filtmod1.c | ||
filtmod2.c | ||
firstobj.c | ||
gen-trusted-dirs.awk | ||
genrtldtbl.awk | ||
get-dynamic-info.h | ||
global.c | ||
globalmod1.c | ||
ifuncdep1.c | ||
ifuncdep1pic.c | ||
ifuncdep2.c | ||
ifuncdep2pic.c | ||
ifuncdep5.c | ||
ifuncdep5pic.c | ||
ifuncmain1.c | ||
ifuncmain1pic.c | ||
ifuncmain1picstatic.c | ||
ifuncmain1pie.c | ||
ifuncmain1static.c | ||
ifuncmain1staticpic.c | ||
ifuncmain1staticpie.c | ||
ifuncmain1vis.c | ||
ifuncmain1vispic.c | ||
ifuncmain1vispie.c | ||
ifuncmain2.c | ||
ifuncmain2pic.c | ||
ifuncmain2picstatic.c | ||
ifuncmain2static.c | ||
ifuncmain3.c | ||
ifuncmain4.c | ||
ifuncmain4picstatic.c | ||
ifuncmain4static.c | ||
ifuncmain5.c | ||
ifuncmain5pic.c | ||
ifuncmain5picstatic.c | ||
ifuncmain5pie.c | ||
ifuncmain5static.c | ||
ifuncmain5staticpic.c | ||
ifuncmain6pie.c | ||
ifuncmain7.c | ||
ifuncmain7pic.c | ||
ifuncmain7picstatic.c | ||
ifuncmain7pie.c | ||
ifuncmain7static.c | ||
ifuncmod1.c | ||
ifuncmod3.c | ||
ifuncmod5.c | ||
ifuncmod6.c | ||
initfirst.c | ||
interp.c | ||
lateglobal.c | ||
ldconfig.c | ||
ldd.bash.in | ||
link.h | ||
loadfail.c | ||
loadtest.c | ||
ltglobmod1.c | ||
ltglobmod2.c | ||
Makefile | ||
multiload.c | ||
neededobj1.c | ||
neededobj2.c | ||
neededobj3.c | ||
neededobj4.c | ||
neededobj5.c | ||
neededobj6.c | ||
neededtest2.c | ||
neededtest3.c | ||
neededtest4.c | ||
neededtest.c | ||
next.c | ||
nextmod1.c | ||
nextmod2.c | ||
nodel2mod1.c | ||
nodel2mod2.c | ||
nodel2mod3.c | ||
nodelete2.c | ||
nodelete.c | ||
nodelmod1.c | ||
nodelmod2.c | ||
nodelmod3.c | ||
nodelmod4.c | ||
nodlopen2.c | ||
nodlopen.c | ||
nodlopenmod2.c | ||
nodlopenmod.c | ||
noload.c | ||
order2.c | ||
order2mod1.c | ||
order2mod2.c | ||
order2mod3.c | ||
order2mod4.c | ||
order.c | ||
origtest.c | ||
pathoptobj.c | ||
pldd-xx.c | ||
pldd.c | ||
preloadtest.c | ||
readelflib.c | ||
readlib.c | ||
reldep2.c | ||
reldep3.c | ||
reldep4.c | ||
reldep4mod1.c | ||
reldep4mod2.c | ||
reldep4mod3.c | ||
reldep4mod4.c | ||
reldep5.c | ||
reldep6.c | ||
reldep6mod0.c | ||
reldep6mod1.c | ||
reldep6mod2.c | ||
reldep6mod3.c | ||
reldep6mod4.c | ||
reldep7.c | ||
reldep7mod1.c | ||
reldep7mod2.c | ||
reldep8.c | ||
reldep8mod1.c | ||
reldep8mod2.c | ||
reldep8mod3.c | ||
reldep9.c | ||
reldep9mod1.c | ||
reldep9mod2.c | ||
reldep9mod3.c | ||
reldep.c | ||
reldepmod1.c | ||
reldepmod2.c | ||
reldepmod3.c | ||
reldepmod4.c | ||
reldepmod5.c | ||
reldepmod6.c | ||
resolvfail.c | ||
restest1.c | ||
restest2.c | ||
rtld-debugger-interface.txt | ||
rtld-Rules | ||
rtld.c | ||
setup-vdso.h | ||
sln.c | ||
sofini.c | ||
soinit.c | ||
sotruss-lib.c | ||
sotruss.sh | ||
sprof.c | ||
static-stubs.c | ||
testobj1_1.c | ||
testobj1.c | ||
testobj2.c | ||
testobj3.c | ||
testobj4.c | ||
testobj5.c | ||
testobj6.c | ||
testobj.h | ||
tls-macros.h | ||
tlsdeschtab.h | ||
tst-_dl_addr_inside_object.c | ||
tst-absolute-sym-lib.c | ||
tst-absolute-sym-lib.lds | ||
tst-absolute-sym.c | ||
tst-addr1.c | ||
tst-align2.c | ||
tst-align.c | ||
tst-alignmod2.c | ||
tst-alignmod.c | ||
tst-array1-static.c | ||
tst-array1.c | ||
tst-array1.exp | ||
tst-array2.c | ||
tst-array2.exp | ||
tst-array2dep.c | ||
tst-array3.c | ||
tst-array4.c | ||
tst-array4.exp | ||
tst-array5-static.c | ||
tst-array5-static.exp | ||
tst-array5.c | ||
tst-array5.exp | ||
tst-array5dep.c | ||
tst-audit1.c | ||
tst-audit2.c | ||
tst-audit8.c | ||
tst-audit9.c | ||
tst-audit11.c | ||
tst-audit11mod1.c | ||
tst-audit11mod2.c | ||
tst-audit11mod2.map | ||
tst-audit12.c | ||
tst-audit12mod1.c | ||
tst-audit12mod2.c | ||
tst-audit12mod2.map | ||
tst-audit12mod3.c | ||
tst-auditmod1.c | ||
tst-auditmod9a.c | ||
tst-auditmod9b.c | ||
tst-auditmod11.c | ||
tst-auditmod12.c | ||
tst-auxv.c | ||
tst-big-note-lib.S | ||
tst-big-note.c | ||
tst-debug1.c | ||
tst-deep1.c | ||
tst-deep1mod1.c | ||
tst-deep1mod2.c | ||
tst-deep1mod3.c | ||
tst-dl-iter-static.c | ||
tst-dlmodcount.c | ||
tst-dlmopen1.c | ||
tst-dlmopen1mod.c | ||
tst-dlmopen2.c | ||
tst-dlmopen3.c | ||
tst-dlopen-aout.c | ||
tst-dlopenrpath.c | ||
tst-dlopenrpathmod.c | ||
tst-dlsym-error.c | ||
tst-env-setuid-tunables.c | ||
tst-env-setuid.c | ||
tst-execstack-mod.c | ||
tst-execstack-needed.c | ||
tst-execstack-prog.c | ||
tst-execstack.c | ||
tst-global1.c | ||
tst-gnu2-tls1.c | ||
tst-gnu2-tls1mod.c | ||
tst-initorder2.c | ||
tst-initorder2.exp | ||
tst-initorder.c | ||
tst-initorder.exp | ||
tst-initordera1.c | ||
tst-initordera2.c | ||
tst-initordera3.c | ||
tst-initordera4.c | ||
tst-initorderb1.c | ||
tst-initorderb2.c | ||
tst-latepthread.c | ||
tst-latepthreadmod.c | ||
tst-ldconfig-X.sh | ||
tst-leaks1-static.c | ||
tst-leaks1.c | ||
tst-libc_dlvsym-dso.c | ||
tst-libc_dlvsym-static.c | ||
tst-libc_dlvsym.c | ||
tst-libc_dlvsym.h | ||
tst-linkall-static.c | ||
tst-main1.c | ||
tst-main1mod.c | ||
tst-nodelete2.c | ||
tst-nodelete2mod.c | ||
tst-nodelete-dlclose-dso.c | ||
tst-nodelete-dlclose-plugin.c | ||
tst-nodelete-dlclose.c | ||
tst-nodelete-opened-lib.c | ||
tst-nodelete-opened.c | ||
tst-nodelete-rtldmod.cc | ||
tst-nodelete-uniquemod.cc | ||
tst-nodelete-zmod.cc | ||
tst-nodelete.cc | ||
tst-noload.c | ||
tst-null-argv-lib.c | ||
tst-null-argv.c | ||
tst-order-a1.c | ||
tst-order-a2.c | ||
tst-order-a3.c | ||
tst-order-a4.c | ||
tst-order-b1.c | ||
tst-order-b2.c | ||
tst-order-main.c | ||
tst-pathopt.c | ||
tst-pathopt.sh | ||
tst-pie1.c | ||
tst-pie2.c | ||
tst-piemod1.c | ||
tst-prelink.c | ||
tst-prelink.exp | ||
tst-protected1a.c | ||
tst-protected1b.c | ||
tst-protected1mod.h | ||
tst-protected1moda.c | ||
tst-protected1modb.c | ||
tst-ptrguard1-static.c | ||
tst-ptrguard1.c | ||
tst-relsort1.c | ||
tst-relsort1mod1.c | ||
tst-relsort1mod2.c | ||
tst-rtld-load-self.sh | ||
tst-stackguard1-static.c | ||
tst-stackguard1.c | ||
tst-thrlock.c | ||
tst-tls1-static-non-pie.c | ||
tst-tls1-static.c | ||
tst-tls1.c | ||
tst-tls2-static.c | ||
tst-tls2.c | ||
tst-tls3.c | ||
tst-tls4.c | ||
tst-tls5.c | ||
tst-tls6.c | ||
tst-tls7.c | ||
tst-tls8.c | ||
tst-tls9-static.c | ||
tst-tls9.c | ||
tst-tls10.c | ||
tst-tls10.h | ||
tst-tls11.c | ||
tst-tls12.c | ||
tst-tls13.c | ||
tst-tls14.c | ||
tst-tls15.c | ||
tst-tls16.c | ||
tst-tls17.c | ||
tst-tls18.c | ||
tst-tls19.c | ||
tst-tls19mod1.c | ||
tst-tls19mod2.c | ||
tst-tls19mod3.c | ||
tst-tls-dlinfo.c | ||
tst-tls-manydynamic.c | ||
tst-tls-manydynamic.h | ||
tst-tls-manydynamicmod.c | ||
tst-tlsalign-extern-static.c | ||
tst-tlsalign-extern.c | ||
tst-tlsalign-lib.c | ||
tst-tlsalign-static.c | ||
tst-tlsalign-vars.c | ||
tst-tlsalign.c | ||
tst-tlsmod1.c | ||
tst-tlsmod2.c | ||
tst-tlsmod3.c | ||
tst-tlsmod4.c | ||
tst-tlsmod5.c | ||
tst-tlsmod6.c | ||
tst-tlsmod7.c | ||
tst-tlsmod8.c | ||
tst-tlsmod9.c | ||
tst-tlsmod10.c | ||
tst-tlsmod11.c | ||
tst-tlsmod12.c | ||
tst-tlsmod13.c | ||
tst-tlsmod13a.c | ||
tst-tlsmod14a.c | ||
tst-tlsmod14b.c | ||
tst-tlsmod15a.c | ||
tst-tlsmod15b.c | ||
tst-tlsmod16a.c | ||
tst-tlsmod16b.c | ||
tst-tlsmod17a.c | ||
tst-tlsmod17b.c | ||
tst-tlsmod18a.c | ||
tst-unique1.c | ||
tst-unique1mod1.c | ||
tst-unique1mod2.c | ||
tst-unique2.c | ||
tst-unique2mod1.c | ||
tst-unique2mod2.c | ||
tst-unique3.cc | ||
tst-unique3.h | ||
tst-unique3lib2.cc | ||
tst-unique3lib.cc | ||
tst-unique4.cc | ||
tst-unique4.h | ||
tst-unique4lib.cc | ||
unload2.c | ||
unload2dep.c | ||
unload2mod.c | ||
unload3.c | ||
unload3mod1.c | ||
unload3mod2.c | ||
unload3mod3.c | ||
unload3mod4.c | ||
unload4.c | ||
unload4mod1.c | ||
unload4mod2.c | ||
unload4mod3.c | ||
unload4mod4.c | ||
unload5.c | ||
unload6.c | ||
unload6mod1.c | ||
unload6mod2.c | ||
unload6mod3.c | ||
unload7.c | ||
unload7mod1.c | ||
unload7mod2.c | ||
unload8.c | ||
unload8mod1.c | ||
unload8mod1x.c | ||
unload8mod2.c | ||
unload8mod3.c | ||
unload.c | ||
unloadmod.c | ||
Versions | ||
vismain.c | ||
vismod1.c | ||
vismod2.c | ||
vismod3.c | ||
vismod.h |