zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: zmodload (-u?) changing options (was Re: [PATCH] Named reference typos & misc.)
Date: Thu, 16 Feb 2023 10:17:06 -0800	[thread overview]
Message-ID: <CAH+w=7YE1TiDjczd7v3VR37B7g6paD7qu_hVLM5FUc=Wj34AyA@mail.gmail.com> (raw)
In-Reply-To: <1919749331.2020682.1676562737303@mail.virginmedia.com>

On Thu, Feb 16, 2023 at 7:53 AM Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
>
> Might be something valgrind could help with, it's hard to see how
> this could be deliberate even as an obscure side effect.

I rigged up a script as Src/zsh so that I could invoke valgrind from
the test harness.  Got multiple invalid reads for this block:

==746398==  Block was alloc'd at
==746398==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgprel
oad_memcheck-amd64-linux.so)
==746398==    by 0x190208: zalloc (mem.c:966)
==746398==    by 0x1903B9: zshcalloc (mem.c:979)
==746398==    by 0x19B2CD: createparam (params.c:1061)
==746398==    by 0x1A1048: assignsparam (params.c:3130)
==746398==    by 0x1A1D02: setsparam (params.c:3240)
==746398==    by 0x19270F: add_autoparam (module.c:1215)
==746398==    by 0x19862A: autofeatures (module.c:3612)
==746398==    by 0x19686F: unload_module (module.c:2902)
==746398==    by 0x196A04: unload_named_module (module.c:2949)
==746398==    by 0x196ABD: bin_zmodload_load (module.c:2971)
==746398==    by 0x1957AD: bin_zmodload (module.c:2499)

module.c:2902 would be:

   2898         /*
   2899          * Module has autoloadable features.  Restore them
   2900          * so that the module will be reloaded when needed.
   2901          */
   2902         autofeatures("zsh", m->node.nam,
   2903                      hlinklist2array(m->autoloads, 0), 0, FEAT_IGNORE);

==746398==  Address 0x643b030 is 16 bytes inside a block of size 80 free'd
==746398==    at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreloa
d_memcheck-amd64-linux.so)
==746398==    by 0x1907C9: zfree (mem.c:1871)
==746398==    by 0x1A80C3: freeparamnode (params.c:5818)
==746398==    by 0x1A4681: unsetparam_pm (params.c:3779)
==746398==    by 0x19206F: checkaddparam (module.c:1052)
==746398==    by 0x19209A: addparamdef (module.c:1065)
==746398==    by 0x192463: setparamdefs (module.c:1174)
==746398==    by 0x197E48: setfeatureenables (module.c:3367)
==746398==    by 0x197EC3: handlefeatures (module.c:3385)
==746398==    by 0x1F7CC5: enables_zshQsparameter (parameter.c:2333)
==746398==    by 0x193164: enables_module (module.c:1948)
==746398==    by 0x1936C6: do_module_features (module.c:2109)

So, what's going on here?  I tried checking the "incleanup" static
inside Src/Modules/parameter.c enables_(), but it's not set [before
entering enables_()] during that call stack.


  reply	other threads:[~2023-02-16 18:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  2:08 [PATCH] Named reference typos & misc Bart Schaefer
2023-02-14 14:46 ` Peter Stephenson
2023-02-14 16:14   ` Bart Schaefer
2023-02-14 16:36     ` Peter Stephenson
2023-02-14 20:00       ` Bart Schaefer
2023-02-15  1:39         ` Bart Schaefer
2023-02-16 15:29           ` zmodload (-u?) changing options (was Re: [PATCH] Named reference typos & misc.) Bart Schaefer
2023-02-16 15:52             ` Peter Stephenson
2023-02-16 18:17               ` Bart Schaefer [this message]
2023-02-16 19:28                 ` Bart Schaefer
2023-02-16 23:10                 ` Bart Schaefer
2023-02-21 11:47                 ` Peter Stephenson
2023-02-21 12:11                   ` Peter Stephenson
2023-02-21 15:57                     ` Bart Schaefer
2023-02-15 10:12         ` [PATCH] Named reference typos & misc Peter Stephenson
2023-02-15 10:36           ` Peter Stephenson
2023-02-15 14:58             ` 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='CAH+w=7YE1TiDjczd7v3VR37B7g6paD7qu_hVLM5FUc=Wj34AyA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=p.w.stephenson@ntlworld.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).