This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

finishing cancellation handling


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ever since the cancellation handling in nptl started using exceptions
there are a large number of potential problems in the libc code.  For an
exception to be passed up all functions on the call path to the place
where the exception originated must have call frame information.  Not a
problem for platforms which have the support enabled by default, but x86
for instance doesn't fall into this category.

Another problem is that all interfaces which might cause an exception to
be raised must not be marked with __THROW in the header.

Analyzing this by hand is a tedious job and when I tried I missed many
things.  I've now written a little very specialized tool which helps
with this:

  http://people.redhat.com/drepper/find-cps.c

You need a reasonable libelf for it (i.e., the one from elfutils).

The tool has two basic modes: one to show which interfaces, when called,
can (potentially) raise an exception.  The other mode shows which files,
containing functions which might raise exception or call functions which
might raise exceptions, are not compiled with -fexceptions.

The automatic analysis is not 100% so there is the possibility to have
waiver list.  One I've already checked into the CVS archive
(CANCEL-FILE-WAIVE).  Use the tool with it like this

find-cps -e -f libc_pic.a -w ~/gnu/libc/CANCEL-FILE-WAIVE open close

This is for the second mode.  For the first mode run


find-cps -f libc_pic.a -d libc.so open close


There will be a waiver list as well.  I haven't populated it yet.

There is a lot of work left so you are encouraged to do your part.
Please send small patches as soon as you have them so that we can
minimize duplication of work.  There are several different solutions:

~ functions cannot use cancelable functions and have to be rewritten;
  this is also sometimes necessary if the cleanup action would be too
  messy

~ if cancellation is OK the code must be compiled with -fexceptions and
  the prototype in the exported header must not have __THROW

~ if the function modifies some global data it might be necessary to
  write cleanup handlers

~ the tools report false positives; the waiver lists must be adjusted.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/VGQN2ijCOnn/RHQRAgE3AKCh0d6xF2df9V288inv/kpVLUpfTQCdHcai
S3NWHYs1j8jln5Y9qA+3vRo=
=InJw
-----END PGP SIGNATURE-----


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