From: Rich Felker <dalias@libc.org>
To: WILLIAMS Stephen <stephen.williams@capgemini.com>
Cc: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [musl] BUG REPORT: Fault in src/malloc/oldmalloc/aligned_alloc.c leads to memory corruption
Date: Tue, 3 May 2022 11:47:09 -0400 [thread overview]
Message-ID: <20220503154709.GV7074@brightrain.aerifal.cx> (raw)
In-Reply-To: <ACD897FC-192F-4E70-B79C-AA47C2795F92@altran.com>
On Tue, May 03, 2022 at 03:14:34PM +0000, WILLIAMS Stephen wrote:
> Interesting. From the logging I’m seeing (admittedly with an old
> fork in use with seL4) ‘mem’ is not guaranteed to be a multiple of
> SIZE_ALIGN as you are suggesting above.
>
> The following was generated with logging inside of the __memalign routine to show the values of ’new’ and ‘mem’:
>
> new = 0x5cd500
> mem = 0x5cd4f0
> memalign: align = 0x40, size = 0x1000. Returned address = 0x5cd500
>
> new = 0x5cd500
> mem = 0x5cd4f0
> memalign: align = 0x40, size = 0x1000. Returned address = 0x5cd500
>
> The ‘mem’ address returned by malloc is not a multiple of SIZE_ALIGN
> (32 on this system) thereby leading to new-mem being less that
> SIZE_ALIGN.
Interesting. I don't see where any changes were made to your fork of
malloc that would cause this, but it's definitely an intended variant
that all chunks be aligned mod SIZE_ALIGN, and that was the case all
the way back to the original musl oldmalloc.
Is it possible that PAGE_SIZE is evaluating to nonsense (maybe
libc.page_size ununitialized), resulting in the initial brk not
getting aligned? It's an implicit assumption that page size is larger
than SIZE_ALIGN.
Rich
next prev parent reply other threads:[~2022-05-03 15:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 10:51 WILLIAMS Stephen
2022-05-03 12:59 ` Rich Felker
2022-05-03 15:14 ` WILLIAMS Stephen
2022-05-03 15:47 ` Rich Felker [this message]
2022-05-03 20:01 ` Kent Mcleod
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=20220503154709.GV7074@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
--cc=stephen.williams@capgemini.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).