public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/27896] New: mq_notify does not handle separately allocated thread attributes
@ 2021-05-21  8:54 fweimer at redhat dot com
  2021-05-21  9:52 ` [Bug nptl/27896] " siddhesh at sourceware dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: fweimer at redhat dot com @ 2021-05-21  8:54 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27896

            Bug ID: 27896
           Summary: mq_notify does not handle separately allocated thread
                    attributes
           Product: glibc
           Version: 2.34
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

mq_notify makes a shallow copy of pthread_attr_t here:

  if (notification->sigev_notify_attributes != NULL)
    {
      /* The thread attribute has to be allocated separately.  */
      data.attr = (pthread_attr_t *) malloc (sizeof (pthread_attr_t));
      if (data.attr == NULL)
        return -1;

      memcpy (data.attr, notification->sigev_notify_attributes,
              sizeof (pthread_attr_t));
    }

This introduces a potential for a use-after-free bug because the affinity mask
has been separately allocated, since before the addition of mq_notify. (A
caller of mq_notify can call pthread_attr_destroy immediately after mq_notify
returns and before the new thread is created.)

Found through code inspection. No known application impact.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-08-02  0:51 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21  8:54 [Bug nptl/27896] New: mq_notify does not handle separately allocated thread attributes fweimer at redhat dot com
2021-05-21  9:52 ` [Bug nptl/27896] " siddhesh at sourceware dot org
2021-05-26  5:30 ` [Bug nptl/27896] mq_notify does not handle separately allocated thread attributes (CVE-2021-33574) siddhesh at sourceware dot org
2021-05-31  6:42 ` siddhesh at sourceware dot org
2021-05-31  7:24 ` siddhesh at sourceware dot org
2021-06-01 15:14 ` schwab@linux-m68k.org
2021-06-03  5:54 ` siddhesh at sourceware dot org
2021-06-04  3:56 ` liqingqing3 at huawei dot com
2021-06-04  4:19 ` siddhesh at sourceware dot org
2021-06-16 17:43 ` manojh3012 at gmail dot com
2021-06-16 18:18 ` fweimer at redhat dot com
2021-06-17  1:26 ` manojh3012 at gmail dot com
2021-06-17  2:00 ` liqingqing3 at huawei dot com
2021-06-17  2:02 ` liqingqing3 at huawei dot com
2021-08-01 15:54 ` andyliuliming at outlook dot com
2021-08-02  0:51 ` carlos at redhat dot com

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).