On Mon, Apr 14, 2014 at 06:18:06PM +0200, Werner Fink wrote: > On Mon, Apr 14, 2014 at 05:46:14PM +0200, Werner Fink wrote: > > > > Now one remaining problem is the !(flags&NV_ARRAY) in nv_create() that is > > without ksh crashes with comvar.sh and builtin_poll.sh ... with this > > change the crash for comvar.sh is gone but then builtin_poll.sh does > > crash on an other place > > Please replace comvar.sh with comvario.sh ... comvar.sh works whereas > comvario.sh with the unpatched ksh does stop here > > if(mp && mp->nvname==0 || *mp->nvname==0) > > in nv_name() as mp=np->nvenv a line above is not valid anymore after > the free in nv_delete().
For a test I've added reference bit
char nvref:1; /* remember if hold */
in src/cmd/ksh93/include/nval.h for struct Namval, then used
if(np && !nv_isattr(np,NV_MINIMAL) && shp->oldnp &&
!np->nvenv && shp->oldnp!=np)
+ {
+ shp->oldnp->nvref = 1;
np->nvenv = (char*)shp->oldnp;
+ }
in src/cmd/ksh93/sh/name.c nv_create() to be able to use
- if(!(flags&NV_NOFREE) && ((flags&NV_FUNCTION) ||
!nv_subsaved(np,flags&NV_TABLE)))
+ if(!np->nvref && !(flags&NV_NOFREE) &&
((flags&NV_FUNCTION) || !nv_subsaved(np,flags&NV_TABLE)))
free((void*)np);
in nv_delete() ... it works for comvario.sh, arrays.sh, and arrays2.sh but not
for
builtin_poll.sh. In other words the reason was not the !(flags&NV_ARRAY) in
nv_create() instead of using the nvref bit:
src/cmd/ksh93/tests> gdb $X /tmp/test_builtin_poll.lp1I2UEl/core
[...]
Program terminated with signal 11, Segmentation fault.
#0 0x000000000043d5ab in nv_create (name=0x7efd70 "pl[16388]",
root=0x7f3150, flags=132608, dp=0x7fff1d357c80)
at /usr/src/packages/BUILD/ksh93/src/cmd/ksh93/sh/name.c:1217
1217 if(ap && ap->table &&
tp)
The !(flags&NV_ARRAY) method in nv_create() still shows invalid reads but does
not
crash whereas the reference bit method shows memory leaks (definitely lost).
For the problem with the stalled signal handlers here from our build system
here:
[ 1436s] test signal begins at 2014-04-14+15:31:46
[30238s] qemu: terminating on signal 15 from pid 15707
or
[ 1482s] test signal begins at 2014-04-14+15:32:33
[30289s] qemu: terminating on signal 15 from pid 26509
or
[ 2165s] test signal begins at 2014-04-14+15:44:00
[30976s] qemu: terminating on signal 15 from pid 5588
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
pgpAlMUnZR_C4.pgp
Description: PGP signature
_______________________________________________ ast-developers mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-developers
