public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Stefan Liebler <stli@linux.ibm.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v3] malloc: Remove bin scanning from memalign (bug 30723)
Date: Wed, 20 Sep 2023 17:31:07 +0200	[thread overview]
Message-ID: <87fs3850as.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <86399d3a-c453-1805-0d6b-62fa6e025108@linux.ibm.com> (Stefan Liebler's message of "Wed, 20 Sep 2023 16:35:47 +0200")

* Stefan Liebler:

>> Does your kernel have a fix for the early sbrk failure?  I suspect what
>> happens is that we fall over to mmap from sbrk, making the heap
>> non-contiguous.
>> 
>> The sbrk failure should be visible under strace.
>> 
> Yes, strace shows mmap with randomize_va_space=0:
> brk(NULL)                               = 0x3fff7fb2000
> brk(0x3fff7fd3000)                      = 0x3fff7fd3000
> brk(0x3fff7ff7000)                      = 0x3fff7fd3000
> mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> 0) = 0x3fff7b00000

Ahh, looks like we can get 4 KiB or maybe 8 KiB of heap from the kernel.
That's why we didn't crash before in early startup.  It looks like a
another ASLR layout issue, different from the problem that broke static
PIE.

Not sure what we can do about this.  Obviously, we'd prefer if the test
suite ran with a more production-like malloc configuration.

> write(1, "error: tst-memalign-2.c:158: not"..., 54error:
> tst-memalign-2.c:158: not true: count > LN / 2
> ) = 54
>
> Note that there is this previous mmap-event before set_tid_address-syscall:
> mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
> = 0x3fff7ff7000

This is the ld.so minimal malloc, it doesn't use sbrk.

Thanks,
Florian


  reply	other threads:[~2023-09-20 15:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 15:48 Florian Weimer
2023-09-19 14:32 ` Stefan Liebler
2023-09-19 17:35   ` Florian Weimer
2023-09-20 14:35     ` Stefan Liebler
2023-09-20 15:31       ` Florian Weimer [this message]
2023-09-21 13:05         ` Stefan Liebler

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

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

  git send-email \
    --in-reply-to=87fs3850as.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=stli@linux.ibm.com \
    /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).