petdance/scratch — Issue #161: NCI segfaults with null pcc_params_signature
Author: petdance
Created: 2011-11-14 06:07:01+00:00
State: open
Labels: bug, core, Pri-normal, Sev-medium

changes in r32203 cause mod_parrot to segfault, as the param signature is
an uninitialized string. specifically, the pcc_params_signature NCI
attribute is null. not sure if this corresponds to a specific parrot
test...

creating the signature as a constant string appears to cause this problem,
as removing PObj_constant_FLAG from src/pmc/nci.pmc:82 "fixes" the issue,
though that's most certainly not a solution.

chromatic thinks we need more COW: "My theory is that the JIT STRING
conversion needs a Parrot_make_COW_reference."

tewk has a workaround: "short-term comment tools/build/nativecall.pl:308
to disable jitted NCI"

backtrace is included, now with more stack smashing!
```
Program received signal SIGSEGV, Segmentation fault.
0x40798304 in Parrot_init_arg_sig (interp_unused=0x81b7bf8, ctx=0x832fd78,
sig=0x0, ap=0x0, sti=0xbffff398) at src/inter_call.c:422
422 if (*sig) {
(gdb) bt
#0 0x40798304 in Parrot_init_arg_sig (interp_unused=0x81b7bf8,
ctx=0x832fd78,
sig=0x0, ap=0x0, sti=0xbffff398) at src/inter_call.c:422
#1 0x40797f6c in Parrot_init_arg_nci (interp=0x81b7bf8, st=0xbffff36c,
sig=0x0) at src/inter_call.c:276
#2 0x082f6451 in ?? ()
#3 0x081b7bf8 in ?? ()
#4 0xbffff36c in ?? ()
#5 0x00000000 in ?? ()
#6 0x08193458 in ?? ()
#7 0x08310418 in ?? ()
#8 0x00000200 in ?? ()
#9 0x40cdd2d8 in ?? ()
#10 0x082dda10 in ?? ()
#11 0x0832fd78 in ?? ()
#12 0x00000001 in ?? ()
#13 0x00000000 in ?? ()
#14 0x00000000 in ?? ()
#15 0x00000000 in ?? ()
#16 0x00000000 in ?? ()
#17 0x081b7bf8 in ?? ()
#18 0x08193458 in ?? ()
#19 0x00000100 in ?? ()
#20 0x407a0bc3 in key_next (interp=0x81b7bf8, key=0x82e1f4c) at
src/key.c:480
#21 0x40938a6e in Parrot_NCI_invoke (interp=0x81b7bf8, pmc=0x82e1f4c,
next=0x40cdd2ec) at nci.pmc:303
#22 0x40717116 in Parrot_invokecc_p (cur_opcode=0x40cdd2e4,
interp=0x81b7bf8)
at core.ops:475
#23 0x407cd83c in runops_slow_core (interp=0x81b7bf8, pc=0x40cdd2e4)
at src/runops_cores.c:222
#24 0x4079edb9 in runops_int (interp=0x81b7bf8, offset=80)
at src/interpreter.c:938
#25 0x4079f65f in runops (interp=0x81b7bf8, offs=80) at
src/inter_run.c:101
#26 0x4079f904 in runops_args (interp=0x81b7bf8, sub=0x82dd7fc,
obj=0x8328fd4,
meth_unused=0x826cc5c, sig=0x40ad50e5 "v", ap=0xbffff594 "\2172\b")
at src/inter_run.c:236
#27 0x4079fc96 in Parrot_run_meth_fromc_args (interp=0x81b7bf8,
sub=0x82dd7fc,
obj=0x8328fd4, meth=0x826cc5c, sig=0x40ad50e5 "v") at
src/inter_run.c:426
#28 0x409a9042 in initialize_parents (interp=0x81b7bf8, object=0x8328fd4,
all_parents=0x8329108) at class.pmc:344
#29 0x409aaf7c in Parrot_Class_instantiate (interp=0x81b7bf8,
pmc=0x832923c,
init=0x82c8028) at class.pmc:1131
#30 0x40736446 in Parrot_new_p_pc (cur_opcode=0x40c981b0,
interp=0x81b7bf8)
at pmc.ops:130
#31 0x407cd83c in runops_slow_core (interp=0x81b7bf8, pc=0x40c981b0)
at src/runops_cores.c:222
#32 0x4079edb9 in runops_int (interp=0x81b7bf8, offset=2101)
at src/interpreter.c:938
#33 0x4079f65f in runops (interp=0x81b7bf8, offs=2101) at
src/inter_run.c:101
#34 0x4079f904 in runops_args (interp=0x81b7bf8, sub=0x82e17f8,
obj=0x82c8028,
meth_unused=0x0, sig=0x4043b4d5 "IP",
ap=0xbffff7ec
"\2242\b-\btz,\b<-\bT\027.\b\024C@H\027ZC@{\033\b\001#\bIC@x\2242\b`<\bHO\223\025@-\b\2242\b0\2252\b(")
at src/inter_run.c:236
#35 0x4079fe56 in Parrot_runops_fromc_arglist_reti (interp=0x81b7bf8,
sub=0x82e17f8, sig=0x4043b4d5 "IP",
args=0xbffff7ec
"\2242\b-\btz,\b<-\bT\027.\b\024C@H\027ZC@{\033\b\001#\bIC@x\2242\b`<\bHO\223\025@-\b\2242\b0\2252\b(")
at src/inter_run.c:527
#36 0x4078995c in Parrot_call_sub_ret_int (interp=0x81b7bf8,
sub=0x82e17f8,
signature=0x4043b4d5 "IP") at src/extend.c:929
#37 0x4043834b in modparrot_call_sub_IP (interp=0x81b7bf8,
namespace=0x82301d0 "PIR", name=0x4043af49
"post_read_request_handler",
ret=0xbffff878, pmc=0x83294a4) at src/parrot_util.c:167
#38 0x40435a17 in modparrot_call_meta_handler (interp=0x81b7bf8,
hll=0x82301d0 "PIR", hook=0x4043af49 "post_read_request_handler",
ret=0xbffff878) at src/mod_parrot.c:233
#39 0x40435e91 in modparrot_meta_post_read_request_handler (r=0x83cab60)
at src/mod_parrot.c:382
```

Originally http://trac.parrot.org/parrot/ticket/1173