From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5D04B398B434; Fri, 21 May 2021 08:54:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D04B398B434 From: "fweimer at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug nptl/27896] New: mq_notify does not handle separately allocated thread attributes Date: Fri, 21 May 2021 08:54:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nptl X-Bugzilla-Version: 2.34 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 08:54:12 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27896 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 !=3D NULL) { /* The thread attribute has to be allocated separately. */ data.attr =3D (pthread_attr_t *) malloc (sizeof (pthread_attr_t)); if (data.attr =3D=3D 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 m= ask has been separately allocated, since before the addition of mq_notify. (A caller of mq_notify can call pthread_attr_destroy immediately after mq_noti= fy returns and before the new thread is created.) Found through code inspection. No known application impact. --=20 You are receiving this mail because: You are on the CC list for the bug.=