
adarshanto
New User
Aug 14, 2012, 10:05 PM
Post #1 of 1
(7560 views)
|
Perl Interpreter (5.8.5) initialization causes SIGSEGV in HPUX
|
Can't Post
|
|
Hi All, Would really appreciate if you can help me with this issue I am trying to initialize Perl interpreter (Perl-5.8.5) from my C program (using perl_run() ) It is crashing (SIGSEGV) in HPUX trusted systems during the initialization. Same program works fine for HPUX non-trusted systems & other operating systems like Linux, AIX & Solaris. During the initialization, getspnam() function is invoked. The function returns an invalid address in HPUX trusted systems & the program crashes trying to access the memory. Ideally, the function should return NULL pointer in case of failure & the program should be working fine. Any pointers to debug/fix this issue is appreciated. Thanks, Adarsh. The code snippet where the crash happens follows: (File: perl-5.8.5/pp_sys.c) 5299 # if defined(HAS_GETSPNAM) && !defined(_AIX) 5300 { 5301 struct spwd *spwent; 5302 int saverrno; /* Save and restore errno so that 5303 * underprivileged attempts seem 5304 * to have never made the unsccessful 5305 * attempt to retrieve the shadow password. */ 5306 5307 saverrno = errno; 5308 spwent = getspnam(pwent->pw_name); 5309 errno = saverrno; 5310 if (spwent && spwent->sp_pwdp) <- --The spwent address returned is an invalid address leading to SEGV 5311 sv_setpv(sv, spwent->sp_pwdp); 5312 } getspnam(pwent->pw_name); (gdb) p *pwent $1 = {pw_name = 0x40280d40 "root", pw_passwd = 0x40280d45 "*", pw_uid = 0, pw_gid = 3, pw_age = 0x40280d46 "", pw_comment = 0x40280d4b "", pw_gecos = 0x40280d4b "", pw_dir = 0x40280d4c "/", pw_shell = 0x40280d4e "/usr/bin/ksh", pw_audid = 1076358392, pw_audflg = 1} After the call: (gdb) p *spwent Cannot access memory at address 0x64726976 (gdb) Machine details: bash-4.2# uname -a HP-UX hprp3440 B.11.31 U 9000/800 458296442 unlimited-user license Complete backtrace: Program received signal SIGSEGV, Segmentation fault. 0x00706424 in Perl_pp_gpwent (my_perl=0x40278470) at pp_sys.c:5310 (gdb) bt #0 0x00706424 in Perl_pp_gpwent (my_perl=0x40278470) at pp_sys.c:5310 #1 0x007060a4 in Perl_pp_gpwuid (my_perl=0x77fb2d94) at pp_sys.c:5154 #2 0x00674c4c in Perl_runops_debug (my_perl=0x40278470) at dump.c:1442 #3 0x0062b3a0 in S_call_body (my_perl=0x40278470, myop=0xe, is_eval=2012531840) at perl.c:2288 #4 0x0062af8c in Perl_call_sv (my_perl=0x40278470, sv=0x0, flags=6) at perl.c:2206 #5 0x0062f548 in S_call_list_body (my_perl=0x40278470, cv=0x40ce0ef8) at perl.c:4698 #6 0x0062f0b4 in Perl_call_list (my_perl=0x40278470, oldscope=24, paramList=0x40ce0e5c) at perl.c:4627 #7 0x006598d8 in Perl_newATTRSUB (my_perl=0x40278470, floor=852, o=0x40ce0ef8, proto=0x18, attrs=0x0, block=0x40ce21c0) at op.c:4416 #8 0x00656100 in Perl_utilize (my_perl=0x40278470, aver=1, floor=852, version=0x40ce21c0, idop=0x40ce1268, arg=0x0) at op.c:2992 #9 0x006dde44 in Perl_yyparse (my_perl=0x40278470) at perly.y:414 #10 0x006ad1f0 in S_doeval (my_perl=0x40278470, gimme=0, startop=0x0, outside=0x4029cc08, seq=9) at pp_ctl.c:2817 #11 0x006aef08 in Perl_pp_entereval (my_perl=0x40278470) at pp_ctl.c:3411 #12 0x00674c4c in Perl_runops_debug (my_perl=0x40278470) at dump.c:1442 #13 0x0062b3a0 in S_call_body (my_perl=0x40278470, myop=0xe, is_eval=2012531840) at perl.c:2288 #14 0x0062af8c in Perl_call_sv (my_perl=0x40278470, sv=0x0, flags=6) at perl.c:2206 #15 0x0062f548 in S_call_list_body (my_perl=0x40278470, cv=0x40cc8650) at perl.c:4698 #16 0x0062f0b4 in Perl_call_list (my_perl=0x40278470, oldscope=17, paramList=0x40cc8590) at perl.c:4627 #17 0x006598d8 in Perl_newATTRSUB (my_perl=0x40278470, floor=616, o=0x40cc8650, proto=0x11, attrs=0x0, block=0x40be0610) at op.c:4416 #18 0x00656100 in Perl_utilize (my_perl=0x40278470, aver=1, floor=616, version=0x40be0610, idop=0x40ba6f50, arg=0x0) at op.c:2992 #19 0x006dde44 in Perl_yyparse (my_perl=0x40278470) at perly.y:414 #20 0x006ad1f0 in S_doeval (my_perl=0x40278470, gimme=0, startop=0x0, outside=0x4029cc08, seq=9) at pp_ctl.c:2817 #21 0x006aef08 in Perl_pp_entereval (my_perl=0x40278470) at pp_ctl.c:3411 #22 0x00674c4c in Perl_runops_debug (my_perl=0x40278470) at dump.c:1442 #23 0x0062b3a0 in S_call_body (my_perl=0x40278470, myop=0xe, is_eval=2012531840) at perl.c:2288 #24 0x0062af8c in Perl_call_sv (my_perl=0x40278470, sv=0x0, flags=6) at perl.c:2206 #25 0x0062f548 in S_call_list_body (my_perl=0x40278470, cv=0x40682e08) at perl.c:4698 #26 0x0062f0b4 in Perl_call_list (my_perl=0x40278470, oldscope=10, paramList=0x40682dd8) at perl.c:4627 #27 0x006598d8 in Perl_newATTRSUB (my_perl=0x40278470, floor=383, o=0x40682e08, proto=0xa, attrs=0x0, block=0x402cbe98) at op.c:4416 #28 0x00656100 in Perl_utilize (my_perl=0x40278470, aver=1, floor=383, version=0x402cbe98, idop=0x402c4378, arg=0x0) at op.c:2992 #29 0x006dde44 in Perl_yyparse (my_perl=0x40278470) at perly.y:414 #30 0x006ad1f0 in S_doeval (my_perl=0x40278470, gimme=0, startop=0x0, outside=0x4029cc08, seq=9) at pp_ctl.c:2817 #31 0x006aef08 in Perl_pp_entereval (my_perl=0x40278470) at pp_ctl.c:3411 #32 0x00674c4c in Perl_runops_debug (my_perl=0x40278470) at dump.c:1442 #33 0x0062b3a0 in S_call_body (my_perl=0x40278470, myop=0xe, is_eval=2012531840) at perl.c:2288 #34 0x0062af8c in Perl_call_sv (my_perl=0x40278470, sv=0x0, flags=6) at perl.c:2206 #35 0x0062f548 in S_call_list_body (my_perl=0x40278470, cv=0x40682d18) at perl.c:4698 #36 0x0062f0b4 in Perl_call_list (my_perl=0x40278470, oldscope=3, paramList=0x4028c2b4) at perl.c:4627 #37 0x006598d8 in Perl_newATTRSUB (my_perl=0x40278470, floor=154, o=0x40682d18, proto=0x3, attrs=0x0, block=0x402aa238) at op.c:4416 #38 0x00656100 in Perl_utilize (my_perl=0x40278470, aver=1, floor=154, version=0x402aa238, idop=0x402a4710, arg=0x0) at op.c:2992 #39 0x006dde44 in Perl_yyparse (my_perl=0x40278470) at perly.y:414 #40 0x006ad1f0 in S_doeval (my_perl=0x40278470, gimme=0, startop=0x0, outside=0x40279230, seq=0) at pp_ctl.c:2817 #41 0x006aef08 in Perl_pp_entereval (my_perl=0x40278470) at pp_ctl.c:3411 #42 0x0062b370 in S_call_body (my_perl=0x40278470, myop=0xe, is_eval=2012531840) at perl.c:2283 #43 0x0062b634 in Perl_eval_sv (my_perl=0x40278470, sv=0x402790f8, flags=0) at perl.c:2348 #44 0x0062b8b0 in Perl_eval_pv (my_perl=0x40278470, p=0xe <Address 0xe out of bounds>, croak_on_error=1) at perl.c:2407 #45 0x001f2b58 in my_perl_run () at ../cli/swzl_perl.c:103
|