public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/9076: Call Frame Instructions are not handled correctly during unwind operation..
@ 2002-12-27 20:26 sunil.k.davasam
0 siblings, 0 replies; 3+ messages in thread
From: sunil.k.davasam @ 2002-12-27 20:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 9076
>Category: libstdc++
>Synopsis: Call Frame Instructions are not handled correctly during unwind operation..
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Dec 27 20:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: sunil.k.davasam@intel.com
>Release: gcc-3.2
>Organization:
>Environment:
$ g++ -v
Reading specs from /local/skdavasa/gcc321/lib/gcc-lib/i386-redhat-linux/3.2.1/specs
Configured with: gcc-3.2.1/configure --prefix=/local/skdavasa/gcc321 --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2.1
cat /etc/issue
Red Hat Linux release 8.0 (Psyche)
Kernel \r on an \m
>Description:
Based on DWARF2 Standard (6.4.2 Call Frame Instructions),
The instructions "DW_CFA_undefined" & "DW_CFA_same_value" takes a single unsigned LEB128 argument that represents a register number. While executing these instructions, The runtime library is not treating the next data as operands to the "DW_CFA_undefined" & "DW_CFA_same_value" instructions. Instead, it treats them as opcodes and executes them. Due to this, the program behaviour changes and gives segmentation fault at runtime.
This is not a problem when I use gcc compiler and libraries. Because, gcc compiler may not be generating "DW_CFA_undefined" & "DW_CFA_same_value" instructions. But, This is an interoperability issue.
I tried to compile the testcase with intel compiler and linked with gcc libraries. I got segmentation fault.
Fix for this problem may be simple. While handling "DW_CFA_undefined" & "DW_CFA_same_value" instructions (in file: gcc-3.2/gcc/unwind-dw2.c, function: execute_cfa_program), read the next LEB128 argument and ignore it.
Please let me know, if it is not correct.
Thanks,
-Sunil.
>How-To-Repeat:
>Fix:
file: gcc-3.2/gcc/unwind-dw2.c
function: execute_cfa_program
code:
static void
execute_cfa_program (const unsigned char *insn_ptr,
const unsigned char *insn_end,
struct _Unwind_Context *context,
_Unwind_FrameState *fs)
{
....
....
switch (insn)
{
case DW_CFA_set_loc:
insn_ptr = read_encoded_value (context, fs->fde_encoding,
insn_ptr, (_Unwind_Ptr *) &fs->pc);
break;
case DW_CFA_advance_loc1:
fs->pc += read_1u (insn_ptr) * fs->code_align;
insn_ptr += 1;
break;
case DW_CFA_advance_loc2:
fs->pc += read_2u (insn_ptr) * fs->code_align;
insn_ptr += 2;
break;
case DW_CFA_advance_loc4:
fs->pc += read_4u (insn_ptr) * fs->code_align;
insn_ptr += 4;
break;
case DW_CFA_offset_extended:
insn_ptr = read_uleb128 (insn_ptr, ®);
insn_ptr = read_uleb128 (insn_ptr, &utmp);
offset = (_Unwind_Sword) utmp * fs->data_align;
fs->regs.reg[reg].how = REG_SAVED_OFFSET;
fs->regs.reg[reg].loc.offset = offset;
break;
case DW_CFA_restore_extended:
insn_ptr = read_uleb128 (insn_ptr, ®);
fs->regs.reg[reg].how = REG_UNSAVED;
break;
770 case DW_CFA_undefined:
771 case DW_CFA_same_value:
772 case DW_CFA_nop:
773 break;
.....
.....
}
Change the code in line numbers from 770 to 773 to the following..
case DW_CFA_undefined:
case DW_CFA_same_value:
insn_ptr = read_uleb128 (insn_ptr, ®);
break;
case DW_CFA_nop:
break;
........
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: libstdc++/9076: Call Frame Instructions are not handled correctly during unwind operation..
@ 2003-01-07 20:23 bkoz
0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2003-01-07 20:23 UTC (permalink / raw)
To: bkoz, gcc-bugs, gcc-prs, rth, sunil.k.davasam
Synopsis: Call Frame Instructions are not handled correctly during unwind operation..
Responsible-Changed-From-To: rth->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Tue Jan 7 12:23:22 2003
Responsible-Changed-Why:
Ok, well whatever.
State-Changed-From-To: analyzed->closed
State-Changed-By: bkoz
State-Changed-When: Tue Jan 7 12:23:22 2003
State-Changed-Why:
In gcc, gcc-3_3-branch, gcc-3_3-branch.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9076
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: libstdc++/9076: Call Frame Instructions are not handled correctly during unwind operation..
@ 2003-01-02 22:47 bkoz
0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2003-01-02 22:47 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, rth, sunil.k.davasam
Synopsis: Call Frame Instructions are not handled correctly during unwind operation..
Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: bkoz
Responsible-Changed-When: Thu Jan 2 14:47:46 2003
Responsible-Changed-Why:
Hey Richard can you give me some feedback about this? This bug has a patch enclosed to unwind-dw2.c, and it seems reasonable.
Thanks,
benjamin
State-Changed-From-To: open->analyzed
State-Changed-By: bkoz
State-Changed-When: Thu Jan 2 14:47:46 2003
State-Changed-Why:
Seems reasonable.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9076
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-07 20:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-27 20:26 libstdc++/9076: Call Frame Instructions are not handled correctly during unwind operation sunil.k.davasam
2003-01-02 22:47 bkoz
2003-01-07 20:23 bkoz
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 read-only IMAP folder(s) and NNTP newsgroup(s).