unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Guillaume Morin <guillaume@morinfr.org>
To: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: fweimer@redhat.com, Siddhesh Poyarekar <siddhesh@sourceware.org>,
	Guillaume Morin <guillaume@morinfr.org>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH v8 03/10] Remove __morecore and __default_morecore
Date: Wed, 14 Jul 2021 20:25:52 +0200	[thread overview]
Message-ID: <20210714182551.GA16858@bender.morinfr.org> (raw)
In-Reply-To: <6364b66d-14a8-3086-00ad-a0def6995c54@gotplt.org>

On 14 Jul 23:02, Siddhesh Poyarekar wrote:
> But that means it won't be useless in RHEL8 or current stable Debian/Ubuntu,
> so there's still time for libhugetlbfs to adapt to the change.

As I said though, there is no other way besides forking glibc's malloc.
the morecore.c implementation in libhugetlbfs is like 100 lines of code.
We're not talking apples to apples. Far from it.

> As is evident, I personally haven't followed libhugetlbfs development and
> have been carrying forward work to remove __morecore that started at least a
> year ago, if not more.  That said though, the deprecation warning
> (especially the fact that the release notes specifically mentioned malloc
> interpositioning as the alternative) ought to have made it clear that we
> weren't thinking of an alternative.

Well, I will certainly grant that someone should have reached out
sooner, though I would probably have done it if my bug report had not
been ignore for 5 years ;-)

> > Well, I do not see why morecore() does not make sense as a plugin. I am
> > not seeing any technical argument supporting that it will prevent
> > clamping down the implementation provided you document the currently
> > acceptable semantics for this interface.
> 
> Right now the debug DSO that this patch pulls out only supports the
> debugging features (malloc_check, mcheck, mtrace, old hooks) and they're not
> intended to be linked against, only used as compatibility for existing
> programs.  If __morecore is to move there, we'd have to allow linking with
> the debug DSO, which we don't want to do because it multiplies the
> interfaces we need to support.  We'd basically have two malloc interfaces to
> support then.

I did not mean to say it should be moved to the debug DSO.

What I am saying is having explicit glibc support so I can LD_PRELOAD  a
version of libhugetlbfs that would export a __morecore() that will then be
used by glibc. No function pointers that needs explicitly set.

I am suggesting morecore interposition instead of the malloc
interposition you initially suggested. That should make no security
difference at all. It just requires to agree on some semantics though
for the interface which are basically these are sbrk.

> The direction we want to take is to not have to support all this in the
> interest of simplifying the implementation and make it easier to reason,
> audit and debug.

I think I have made decent technical points that it's not complicated at
all. There are no complications or security implications that I see,
just agreeing on the semantics on one function ...
I keep hearing theoretical concerns but nobody seems to want to detail:
why morecore interposition is complicated or insecure. I'll grant you
guys are the experts here, so please humor me, I am all ears.

> The hooks fall somewhere between the last two because in the
> general case they're quite hard to reason and in the simplest case, they're
> unprotected indirections that have historically been used as vulnerability
> primitives for years.

I have not argued for you to keep the hooks as is because i understand
your concerns. I am trying to find a solution that alleviates your
understandable concerns without breaking every single libhugetlbfs
user.

Guillaume.

-- 
Guillaume Morin <guillaume@morinfr.org>

  reply	other threads:[~2021-07-14 18:26 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13  7:38 [PATCH v8 00/10] malloc hooks removal Siddhesh Poyarekar via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 01/10] Make mcheck tests conditional on GLIBC_2.24 or earlier Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:03   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 02/10] Remove __after_morecore_hook Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:03   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 03/10] Remove __morecore and __default_morecore Siddhesh Poyarekar via Libc-alpha
2021-07-14  7:01   ` Siddhesh Poyarekar
2021-07-14 12:54     ` Guillaume Morin
2021-07-14 14:13       ` Siddhesh Poyarekar
2021-07-14 16:42         ` Guillaume Morin
2021-07-14 17:15           ` Carlos O'Donell via Libc-alpha
2021-07-14 17:42             ` Adhemerval Zanella via Libc-alpha
2021-07-14 18:37               ` Guillaume Morin
2021-07-14 18:48               ` Siddhesh Poyarekar
2021-07-14 18:31             ` Guillaume Morin
2021-07-14 17:32           ` Siddhesh Poyarekar
2021-07-14 18:25             ` Guillaume Morin [this message]
2021-07-14 18:43               ` Siddhesh Poyarekar
2021-07-14 18:51                 ` Guillaume Morin
2021-07-17 22:03   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 04/10] Move malloc hooks into a compat DSO Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:04   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 05/10] mcheck: Wean away from malloc hooks Siddhesh Poyarekar via Libc-alpha
2021-07-13 15:47   ` H.J. Lu via Libc-alpha
2021-07-14  2:44     ` Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:04   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 06/10] Simplify __malloc_initialized Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:04   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 07/10] mtrace: Wean away from malloc hooks Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:04   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 08/10] glibc.malloc.check: " Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:04   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 09/10] Remove " Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:04   ` Carlos O'Donell via Libc-alpha
2021-07-13  7:38 ` [PATCH v8 10/10] mcheck Fix malloc_usable_size [BZ #22057] Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:04   ` Carlos O'Donell via Libc-alpha
2021-07-13 14:48 ` [PATCH v8 00/10] malloc hooks removal H.J. Lu via Libc-alpha
2021-07-13 15:41   ` Siddhesh Poyarekar via Libc-alpha
2021-07-17 22:03 ` Carlos O'Donell 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=20210714182551.GA16858@bender.morinfr.org \
    --to=guillaume@morinfr.org \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@gotplt.org \
    --cc=siddhesh@sourceware.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).