zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint@zdharma.org>
To: zsh-workers@zsh.org
Subject: Re: [BUG] Segfault if zcompile followed by source, on large file
Date: Wed, 3 Jan 2018 07:40:09 +0100	[thread overview]
Message-ID: <etPan.5a4c7aca.974ffb7.13d7@zdharma.org> (raw)
In-Reply-To: <etPan.5a4b9bf3.5f062768.13d7@zdharma.org>

On 2 Jan 2018 at 15:49:22, Sebastian Gniazdowski (psprint@zdharma.org) wrote:
> I exponentially enlarged the file starting from 1 line, and first segfault occurred  
> at 292k lines, 146k was fine.

Ran valgrind, expecting that something will came up in zcompile, some heap corruption. However it's sourcing that yields something, and it's the thing known from backtrace:

==49954== Memcheck, a memory error detector
==49954== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==49954== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==49954== Command: zsh-5.4.2-dev-0 ./test2.src.script
==49954==
==49954== Invalid read of size 4
==49954==    at 0x100019C3A: addvars (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100015784: execsimple (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x10001506D: execlist (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100014CF3: execode (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x1000351FE: source (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x10000EB09: bin_dot (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100001D25: execbuiltin (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x10001F0E2: execcmd_exec (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x10001A9EE: execpline2 (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100015B80: execpline (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100015307: execlist (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100014CF3: execode (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==  Address 0x1016c4000 is not stack'd, malloc'd or (recently) free'd

==49954== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==49954==  Access not within mapped region at address 0x1016C4000
==49954==    at 0x100019C3A: addvars (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100015784: execsimple (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x10001506D: execlist (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100014CF3: execode (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x1000351FE: source (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x10000EB09: bin_dot (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100001D25: execbuiltin (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x10001F0E2: execcmd_exec (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x10001A9EE: execpline2 (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100015B80: execpline (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==    by 0x100015307: execlist (in /usr/local/bin/zsh-5.4.2-dev-0)
#zcompile test2.src
==49954==    by 0x100014CF3: execode (in /usr/local/bin/zsh-5.4.2-dev-0)
==49954==  If you believe this happened as a result of a stack
==49954==  overflow in your program's main thread (unlikely but
==49954==  possible), you can try to increase the size of the
==49954==  main thread stack using the --main-stacksize= flag.
==49954==  The main thread stack size used in this run was 8388608.

Valgrind hints that this might be a stack overflow:

==52921==  If you believe this happened as a result of a stack
==52921==  overflow in your program's main thread (unlikely but
==52921==  possible), you can try to increase the size of the
==52921==  main thread stack using the --main-stacksize= flag.
==52921==  The main thread stack size used in this run was 8388608.

However I ran it again with --main-stacksize=9388608 and 19388608, and the issue repeated.

--  
Sebastian Gniazdowski
psprint /at/ zdharma.org


  parent reply	other threads:[~2018-01-03  6:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180102145007epcas2p35349fe256ab195853ed923c0f84f900b@epcas2p3.samsung.com>
2018-01-02 14:49 ` Sebastian Gniazdowski
2018-01-02 15:26   ` Daniel Shahaf
2018-01-03  6:40   ` Sebastian Gniazdowski [this message]
2018-01-05 10:23   ` Peter Stephenson
2018-01-05 22:40     ` Bart Schaefer

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=etPan.5a4c7aca.974ffb7.13d7@zdharma.org \
    --to=psprint@zdharma.org \
    --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).