Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zmodload (-u?) changing options (was Re: [PATCH] Named reference typos & misc.)



On Thu, Feb 16, 2023 at 7:53 AM Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> 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.




Messages sorted by: Reverse Date, Date, Thread, Author