From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: Infinite loop in malloc
Date: Fri, 25 Jan 2019 22:49:29 +0100 [thread overview]
Message-ID: <20190125214929.GE23924@voyager> (raw)
In-Reply-To: <20190125151350.GB20330@r>
On Fri, Jan 25, 2019 at 10:13:50AM -0500, r yang wrote:
> Examining the value in gdb:
> (gdb) printf "%X\n", mask
> 204701
>
> The bin head points to the bin itself so this condition is never met:
> c = mal.bins[j].head;
> if (c != BIN_TO_CHUNK(j)) { ... }
>
> Examining the values in gdb:
> (gdb) printf "%X\n", mal.bins[j].head
> 62337FC0
> (gdb) printf "%X\n", (struct chunk *)((char *)(&mal.bins[j].head) - (2*sizeof(size_t)))
> 62337FC0
Wait, isn't that an invalid state? The bins are circular doubly linked
lists; the head points back to itself only when the list is empty. But
the binmap is only set for non-empty bins. At least in the
single-threaded case.
So, if the bit is 1, then it was never deleted. So either arm's
a_and_64() is b0rken, or the last chunk removed from the smallest bin
was invalid, and didn't trigger the a_and_64(). Or does anyone have a
better idea?
Ciao,
Markus
next prev parent reply other threads:[~2019-01-25 21:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 15:13 r yang
2019-01-25 21:49 ` Markus Wichmann [this message]
2019-01-25 21:57 ` Szabolcs Nagy
2019-01-25 21:55 ` Markus Wichmann
2019-01-25 22:28 ` Szabolcs Nagy
2019-01-25 23:11 ` Szabolcs Nagy
2019-01-26 1:30 ` Rich Felker
2019-01-26 13:59 ` Szabolcs Nagy
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=20190125214929.GE23924@voyager \
--to=nullplan@gmx.net \
--cc=musl@lists.openwall.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).