public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/18524] New: Missing calloc error checking in __cxa_thread_atexit_impl
@ 2015-06-12 13:35 fweimer at redhat dot com
  2015-07-12  7:23 ` [Bug nptl/18524] " neleai at seznam dot cz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2015-06-12 13:35 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 18524
           Summary: Missing calloc error checking in
                    __cxa_thread_atexit_impl
           Product: glibc
           Version: 2.21
            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: ---
             Flags: security-

This should have an explicit check for calloc failure:

  struct dtor_list *new = calloc (1, sizeof (struct dtor_list));
  new->func = func;
  new->obj = obj;

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


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

* [Bug nptl/18524] Missing calloc error checking in __cxa_thread_atexit_impl
  2015-06-12 13:35 [Bug nptl/18524] New: Missing calloc error checking in __cxa_thread_atexit_impl fweimer at redhat dot com
@ 2015-07-12  7:23 ` neleai at seznam dot cz
  2015-10-06 10:58 ` fweimer at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: neleai at seznam dot cz @ 2015-07-12  7:23 UTC (permalink / raw)
  To: glibc-bugs

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

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |neleai at seznam dot cz

--- Comment #1 from Ondrej Bilka <neleai at seznam dot cz> ---
Do you have patch for that. Only course of action is return which causes memory
leak as you don't call destructor later.

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


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

* [Bug nptl/18524] Missing calloc error checking in __cxa_thread_atexit_impl
  2015-06-12 13:35 [Bug nptl/18524] New: Missing calloc error checking in __cxa_thread_atexit_impl fweimer at redhat dot com
  2015-07-12  7:23 ` [Bug nptl/18524] " neleai at seznam dot cz
@ 2015-10-06 10:58 ` fweimer at redhat dot com
  2015-10-06 19:21 ` carlos at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2015-10-06 10:58 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Ondrej Bilka from comment #1)
> Do you have patch for that. Only course of action is return which causes
> memory leak as you don't call destructor later.

I think the interface cannot be salvaged.  The required space for bookkeeping
needs to be allocated in .tbss, or separately, at the time .tbss is allocated. 
I don't think anything in the standard permits leaks or exceptions in this
context.

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


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

* [Bug nptl/18524] Missing calloc error checking in __cxa_thread_atexit_impl
  2015-06-12 13:35 [Bug nptl/18524] New: Missing calloc error checking in __cxa_thread_atexit_impl fweimer at redhat dot com
  2015-07-12  7:23 ` [Bug nptl/18524] " neleai at seznam dot cz
  2015-10-06 10:58 ` fweimer at redhat dot com
@ 2015-10-06 19:21 ` carlos at redhat dot com
  2020-09-09 19:57 ` tavianator at tavianator dot com
  2021-07-28 10:40 ` siddhesh at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: carlos at redhat dot com @ 2015-10-06 19:21 UTC (permalink / raw)
  To: glibc-bugs

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

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at redhat dot com

--- Comment #3 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Florian Weimer from comment #2)
> (In reply to Ondrej Bilka from comment #1)
> > Do you have patch for that. Only course of action is return which causes
> > memory leak as you don't call destructor later.
> 
> I think the interface cannot be salvaged.  The required space for
> bookkeeping needs to be allocated in .tbss, or separately, at the time .tbss
> is allocated.  I don't think anything in the standard permits leaks or
> exceptions in this context.

So argue QoI, and just abort if calloc returns null? It's a crappy solution,
but it prevents the program from running into undefined territory by not
running destructors.

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


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

* [Bug nptl/18524] Missing calloc error checking in __cxa_thread_atexit_impl
  2015-06-12 13:35 [Bug nptl/18524] New: Missing calloc error checking in __cxa_thread_atexit_impl fweimer at redhat dot com
                   ` (2 preceding siblings ...)
  2015-10-06 19:21 ` carlos at redhat dot com
@ 2020-09-09 19:57 ` tavianator at tavianator dot com
  2021-07-28 10:40 ` siddhesh at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tavianator at tavianator dot com @ 2020-09-09 19:57 UTC (permalink / raw)
  To: glibc-bugs

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

Tavian Barnes <tavianator at tavianator dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tavianator at tavianator dot com

--- Comment #4 from Tavian Barnes <tavianator at tavianator dot com> ---
Any chance this can get fixed?  I'm running into it while trying to test that
my own applications handle memory allocation failures correctly.

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

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

* [Bug nptl/18524] Missing calloc error checking in __cxa_thread_atexit_impl
  2015-06-12 13:35 [Bug nptl/18524] New: Missing calloc error checking in __cxa_thread_atexit_impl fweimer at redhat dot com
                   ` (3 preceding siblings ...)
  2020-09-09 19:57 ` tavianator at tavianator dot com
@ 2021-07-28 10:40 ` siddhesh at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: siddhesh at sourceware dot org @ 2021-07-28 10:40 UTC (permalink / raw)
  To: glibc-bugs

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

Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |2.34
                 CC|                            |siddhesh at sourceware dot org

--- Comment #5 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
commit 4aedc25f55eda50010f2932fdb0a533db6f89f61 (HEAD -> master, origin/master,
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Wed Jul 28 13:11:20 2021 +0530

    __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]

    Abort in the unlikely event that allocation fails when trying to
    register a TLS destructor.

    Reviewed-by: Florian Weimer <fweimer@redhat.com>

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

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

end of thread, other threads:[~2021-07-28 10:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-12 13:35 [Bug nptl/18524] New: Missing calloc error checking in __cxa_thread_atexit_impl fweimer at redhat dot com
2015-07-12  7:23 ` [Bug nptl/18524] " neleai at seznam dot cz
2015-10-06 10:58 ` fweimer at redhat dot com
2015-10-06 19:21 ` carlos at redhat dot com
2020-09-09 19:57 ` tavianator at tavianator dot com
2021-07-28 10:40 ` siddhesh at sourceware dot org

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