RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1710539 - glibc: pthread_create vs EPERM error and stack cleanup.
Summary: glibc: pthread_create vs EPERM error and stack cleanup.
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: glibc
Version: 8.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 8.2
Assignee: Siddhesh Poyarekar
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-15 17:41 UTC by Andrew Mike
Modified: 2023-07-18 14:30 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-18 14:10:43 UTC
Type: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Sourceware 19511 0 P3 RESOLVED 8MB memory leak in pthread_create in case of failure when non-root user changes priority 2021-10-21 13:54:22 UTC

Description Andrew Mike 2019-05-15 17:41:09 UTC
This bug was initially created as a copy of Bug #1678421

I am copying this bug because the customer requested 
us to refile the bug against RHEL 7.

If clone returns EPERM the stack is deallocated. After clone is
successful, glibc might return EPERM if it fails to scheduling policies
and/or attributes. On the later case, the thread stack is not released
(no call to __deallocate_stack).

  User wants to know a defined behaviour when pthread_create returns EPERM.

  If the kernel returns EPERM for the clone call, all data is deallocated?
If glibc returns EPERM on subsequent syscalls it would need to create the
thread detached and explicitly call pthread_detach?

Comment 2 Florian Weimer 2019-05-21 12:56:17 UTC
(In reply to Andrew Mike from comment #0)
> This bug was initially created as a copy of Bug #1678421
> 
> I am copying this bug because the customer requested 
> us to refile the bug against RHEL 7.
> 
> If clone returns EPERM the stack is deallocated. After clone is
> successful, glibc might return EPERM if it fails to scheduling policies
> and/or attributes. On the later case, the thread stack is not released
> (no call to __deallocate_stack).
> 
>   User wants to know a defined behaviour when pthread_create returns EPERM.
> 
>   If the kernel returns EPERM for the clone call, all data is deallocated?

Yes, if the clone system call fails, we deallocate the previously allocated resources in the current implementation.

> If glibc returns EPERM on subsequent syscalls it would need to create the
> thread detached and explicitly call pthread_detach?

No, if the start routine never runs, pthread_detach would be the wrong thing to do because it does not report the caller of pthread_create.  Something like this approach is needed, but needs implementation upstream and careful review there:

  <https://sourceware.org/bugzilla/show_bug.cgi?id=19511#c4>

Comment 3 Carlos O'Donell 2019-06-18 19:15:58 UTC
Red Hat Enterprise Linux 7 is entering Maintenance Phase Support 1 this year and only Urgent priority bug fixes will be considered. This issue is not urgent and we are moving this to Red Hat Enterprise Linux 8 for further consideration.

Comment 7 Florian Weimer 2021-10-21 13:53:44 UTC
The core fix is this:

commit 02189e8fb00c3c7f4e67476e21011a22c5dee707
Author: Adhemerval Zanella <adhemerval.zanella>
Date:   Fri May 21 14:19:23 2021 -0300

    nptl: Deallocate the thread stack on setup failure (BZ #19511)

But given of the amount of development that went into 2.34, I doubt it will apply cleanly to our 2.28-based tree.

Comment 14 Siddhesh Poyarekar 2022-11-18 14:10:43 UTC
This fix needs a number of backports that significantly increase the risk of regressions, making it unsuitable for RHEL-8.


Note You need to log in before you can comment on or make changes to this bug.