From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Substitution ${...///} slows down when certain UTF character occurs
Date: Thu, 01 Oct 2015 09:41:40 +0100 [thread overview]
Message-ID: <20151001094140.413b5401@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <150930141937.ZM22962@torch.brasslantern.com>
On Wed, 30 Sep 2015 14:19:37 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Sep 30, 3:04pm, Peter Stephenson wrote:
> } In some complex git completion --- reproducible only in one set up ---
> } the heap allocation is apparently going out of bounds. Yet I've checked
> } and nothing seems able to happen that can affect this. If I add
> } debugging, the same pointer is reported as returned from zhalloc() that
> } is later claimed to be out of bounds. Yet with more debugging there's
> } no popheap() or switch_heap() happening, as by eye there can't be. I'm
> } a bit stuck; how can a piece of memory returned by zhalloc() suddenly go
> } invalid?
> }
> } valgrind agrees with gdb but doesn't give any more help.
>
> Did you --enable-zsh-heap-debug and --enable-zsh-valgrind ? I always
> forget at least the latter of those ...
I don't have the full valgrind library framework, just the executable,
on the system where this is happening. (This is 64-bit and I haven't
seen it with a 32-bit system I have more control over in the same repo.)
But I tried heap debug and the last bit of output doesn't look obviously
suspicious --- I don't see a sign it's allocating masses of memory, for
example. Indeed, the last thing it did was a push, not a pop.
> } Maybe we're just running out of memory after all?
>
> That seems really unlikely, unless the explicit zalloc version shows a
> similar issue.
Yes, zhalloc() gets memory from zalloc() which explicitly tests, and
there's no obvious way you could get a pointer of the sort I've got.
> But I suppose if the heap is never popped it might be
> possible to run out of memory on a deep recursive glob. Perhaps a
> call to freeheap() is needed somewhere prior to the popheap()? Or
> maybe there *is* a freeheap() happening where it isn't any longer safe
> to do so -- did you check for that?
Yes, I looked for popping, freeing and swapping of heaps and there
doesn't appear to be any in the immediate vicint.
> Even if out of memory, I wouldn't expect an existing pointer to go bad.
> You'd just fail to get a new one. And heaps are mmap()d if possible so
> in that case you'd have to be out of address space, not just out of
> memory?
I tried not using mmap and the symptom is the same.
I get the feeling there's something here that simply switching back to
zalloc() is likely to obscure rather than fix.
pws
next prev parent reply other threads:[~2015-10-01 8:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-26 12:19 Sebastian Gniazdowski
2015-09-26 20:44 ` Bart Schaefer
2015-09-27 8:13 ` Sebastian Gniazdowski
2015-09-27 16:11 ` Bart Schaefer
2015-09-28 8:51 ` Peter Stephenson
2015-09-28 11:30 ` Peter Stephenson
2015-09-28 19:23 ` Peter Stephenson
2015-09-29 8:44 ` Peter Stephenson
2015-09-29 18:37 ` Peter Stephenson
2015-09-29 19:23 ` Bart Schaefer
2015-09-30 8:59 ` Peter Stephenson
2015-09-30 14:04 ` Peter Stephenson
2015-09-30 21:19 ` Bart Schaefer
2015-10-01 8:41 ` Peter Stephenson [this message]
2015-10-01 14:28 ` Heap corruption [the thread formerly known as substitution] Peter Stephenson
2015-10-01 15:07 ` Bart Schaefer
2015-10-01 15:13 ` Peter Stephenson
2015-10-03 18:59 ` Peter Stephenson
2015-10-01 13:45 ` Substitution ${...///} slows down when certain UTF character occurs Sebastian Gniazdowski
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=20151001094140.413b5401@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).