unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: libc-alpha@sourceware.org,  fweimer@redhat.com,  carlos@redhat.com
Subject: Re: [RFC] Supporting malloc_usable_size
Date: Fri, 02 Dec 2022 13:03:14 +0100	[thread overview]
Message-ID: <87sfhyrp19.fsf@igel.home> (raw)
In-Reply-To: <20221124213258.305192-1-siddhesh@gotplt.org> (Siddhesh Poyarekar's message of "Thu, 24 Nov 2022 16:32:58 -0500")

On Nov 24 2022, Siddhesh Poyarekar wrote:

> This is in context of this systemd issue:
>
> https://github.com/systemd/systemd/issues/22801
>
> through which I had discovered that systemd was (ab)using
> malloc_usable_size to use spare space in an allocated object.  This was
> discovered when _FORTIFY_SOURCE=3 flagged this as a buffer overflow,
> since the compiler is unable to see that the space beyond the allocation
> was safe to use.

Which it isn't.  Nothing prevents malloc to hand out the extra space to
a different thread any time, so the size returned by malloc_usable_size
can get outdated instantly.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

  parent reply	other threads:[~2022-12-02 12:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 21:32 [RFC] Supporting malloc_usable_size Siddhesh Poyarekar
2022-12-02  4:42 ` DJ Delorie via Libc-alpha
2022-12-02  5:00   ` Sam James via Libc-alpha
2022-12-02  5:28     ` DJ Delorie via Libc-alpha
2022-12-02 12:36       ` Siddhesh Poyarekar
2022-12-02 19:16         ` DJ Delorie via Libc-alpha
2022-12-02 19:49           ` Siddhesh Poyarekar
2022-12-02 19:57             ` DJ Delorie via Libc-alpha
2022-12-02 12:03 ` Andreas Schwab [this message]
2022-12-02 12:22   ` Siddhesh Poyarekar
2022-12-02 12:34     ` Andreas Schwab
2022-12-02 12:39       ` Florian Weimer via Libc-alpha
2022-12-05 18:46         ` Zack Weinberg via Libc-alpha
2022-12-05 19:04           ` Siddhesh Poyarekar
2022-12-05 20:35           ` Florian Weimer via Libc-alpha
2022-12-06 19:25             ` Siddhesh Poyarekar
2022-12-07 10:01               ` Florian Weimer via Libc-alpha
2022-12-07 16:34                 ` Siddhesh Poyarekar
2022-12-07 16:54                   ` Adhemerval Zanella Netto via Libc-alpha
2022-12-07 16:57                     ` Sam James via Libc-alpha
2022-12-07 17:39                     ` Florian Weimer via Libc-alpha
2022-12-09 15:42                     ` Siddhesh Poyarekar
2022-12-07 18:45                 ` DJ Delorie via Libc-alpha
2022-12-02 12:54     ` Florian Weimer via Libc-alpha
  -- strict thread matches above, loose matches on Subject: below --
2022-12-02 13:54 Wilco Dijkstra via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfhyrp19.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@gotplt.org \
    /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).