public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dlbulk-sourcesredhat at yahoo dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/12981] New: race in aio handle_fildes_io corrupts user memory
Date: Mon, 11 Jul 2011 15:40:00 -0000	[thread overview]
Message-ID: <bug-12981-131@http.sourceware.org/bugzilla/> (raw)

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

           Summary: race in aio handle_fildes_io corrupts user memory
           Product: glibc
           Version: 2.14
            Status: NEW
          Severity: critical
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: dlbulk-sourcesredhat@yahoo.com


sysdeps/pthread/aio_misc.c:

    603           if (aiocbp->aiocb.__return_value == -1)
    604             aiocbp->aiocb.__error_code = errno;
    605           else
    606             aiocbp->aiocb.__error_code = 0;
    607 
    608           /* Send the signal to notify about finished processing of the
    609              request.  */
    610           __aio_notify (runp);

Once aiocb.__error_code is set, a user thread could be polling aio_error and
aio_return to process the completed io. aiocbp could be freed in this process.

However, __aio_notify dereferences and modifies this memory:

sysdeps/pthread/aio_notify.c:
    128 #ifdef BROKEN_THREAD_SIGNALS
    129   if (__aio_notify_only (&aiocbp->aio_sigevent, req->caller_pid) != 0)
    130 #else
    131   if (__aio_notify_only (&aiocbp->aio_sigevent) != 0)
    132 #endif
    133     {
    134       /* XXX What shall we do if already an error is set by
    135          read/write/fsync?  */
    136       aiocbp->__error_code = errno;
    137       aiocbp->__return_value = -1;
    138     }

To fix this race, __aio_notify should be skipped if
aiocbp->aio_sigevent.sigev_notify is SIGEV_NONE.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2011-07-11 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 15:40 dlbulk-sourcesredhat at yahoo dot com [this message]
2011-07-12 20:58 ` [Bug libc/12981] " ppluzhnikov at google dot com
2011-07-19  6:15 ` renegat.nospam at gmail dot com
2012-12-19 10:41 ` schwab@linux-m68k.org
2014-06-27 12:56 ` fweimer at redhat dot com
2015-08-27 22:06 ` [Bug librt/12981] " jsm28 at gcc dot gnu.org

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-12981-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).