public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r@public.gmane.org
To: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [Bug 25292] New: async-signal-safe functions list in Linux
Date: Mon, 20 Dec 2010 05:38:16 GMT	[thread overview]
Message-ID: <bug-25292-11311@https.bugzilla.kernel.org/> (raw)

https://bugzilla.kernel.org/show_bug.cgi?id=25292

           Summary: async-signal-safe functions list in Linux
           Product: Documentation
           Version: unspecified
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: man-pages
        AssignedTo: documentation_man-pages-ztI5WcYan/vQLgFONoPN62D2FQJk+8+b@public.gmane.org
        ReportedBy: kosaki.motohiro-+CUm20s59erQFUHtdCDX3A@public.gmane.org
        Regression: No


Signal(7) described which functions are async-signal-safe. But it is only
written POSIX definition, is not described linux implementation specific limit.
And it should be.

I have three example.

1. fork

glibc malloc are calling pthread_atfork() internally, therefore our fork is
async signal unsafe since long time ago.

http://sourceware.org/bugzilla/show_bug.cgi?id=4737


The standard comitte has decided to remove fork() from async-signal-safe
functions in future standard. (see following defect reports)

http://www.opengroup.org/austin/aardvark/latest/xshbug3.txt

>  _____________________________________________________________________________
>  COMMENT                                         Enhancement Request Number 15
>  rajani.g.k:xxxxxx                              Defect in XSH 2.4.3 (rdvk#  6)
>  {GKRFORK012009}                                  Thu, 8 Jan 2009 07:41:10 GMT
>  _____________________________________________________________________________
>  Accept_____    Accept as marked below_X___     Duplicate_____     Reject_____
>  Rationale for rejected or partial changes:
> 
> We agreed not to send this down the interps track yet.
> 
> The standard is clear and concerns are being forwarded to the sponsor.
> A previous interpretation 1003.1c-1995 #37, and also ERN XSHbug2145 have
> addressed the same issue, but still the problem has remained unresolved.
> 
> Because of the problems which exist here it has become
> clear that an application using pthread_atfork(), even if the application itself
> did not call pthread_atfork(), may have had pthread_atfork() handlers
> installed by a third party library or the implementation. Therefore
> calling fork() from an asynchronous signal handler is undefined.
> Therefore we are removing fork() from the list of
> async-signal-safe functions.
> 
> 
> Recommendations for a future revision:
> A future revision should mandate posix_spawn() and add that to the list
> of async-signal-safe functions.
> Remove fork() from the list of async-signal-safe functions.
> [ 12 Feb 2009 - we had no consensus on the changes for a future revision]

2. aio_suspend

It is using pthread_mutex_lock() internally.

glibc/sysdeps/pthread/aio_suspend.c
------------------------------------------
int
aio_suspend (list, nent, timeout)
     const struct aiocb *const list[];
     int nent;
     const struct timespec *timeout;
{
(snip)

  /* Request the mutex.  */
  pthread_mutex_lock (&__aio_requests_mutex);


3. execle

It is using realloc internally.

glibc/posix/execle.c
----------------------------------------------------------
int
execle (const char *path, const char *arg, ...)
{
#define INITIAL_ARGV_MAX 1024
  size_t argv_max = INITIAL_ARGV_MAX;
  const char *initial_argv[INITIAL_ARGV_MAX];
  const char **argv = initial_argv;
  va_list args;
  argv[0] = arg;

  va_start (args, arg);
  unsigned int i = 0;
  while (argv[i++] != NULL)
    {
      if (i == argv_max)
        {
          argv_max *= 2;
          const char **nptr = realloc (argv == initial_argv ? NULL : argv,
                                       argv_max * sizeof (const char *));
          if (nptr == NULL)
            {


Can you please consider to update signal(7) man page?

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2010-12-20  5:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20  5:38 bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r [this message]
     [not found] ` <bug-25292-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
2014-06-25 15:43   ` [Bug 25292] async-signal-safe functions list in Linux bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2014-06-25 18:50   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-02-19 16:10   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-25292-11311@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon-590eeb7gvniway/ihj7yzeb+6bgklq7r@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox