BZ #99: md_codegen_get_pv_from_pc may access illegal memory on ARM

Status fields:

creation_ts:2008-08-18 13:18
component:jit
version:default branch
rep_platform:arm
op_sys:All
bug_status:RESOLVED
resolution:FIXED
reporter:twisti@complang.tuwien.ac.at
x/16i (0x44389ff8 - 32)

0x44389fd8:     undefined
0x44389fdc:     mov     r2, r6
0x44389fe0:     mov     r1, r7
0x44389fe4:     mov     r0, r8
0x44389fe8:     ldr     r11, [r0]
0x44389fec:     ldr     r12, [r11, #132]
0x44389ff0:     mov     lr, pc
0x44389ff4:     mov     pc, r12
0x44389ff8:     sub     r12, pc, #96    ; 0x60
0x44389ffc:     pop     {r6, r7, r8, pc}
0x4438a000:     Cannot access memory at address 0x4438a000
(gdb)

pc is 0x44389ff8 and md_codegen_get_pv_from_pc tries to access pc[2], which is in this
case 0x4438a000.

Comment #1 by michi@complang.tuwien.ac.at on 2008-08-18 17:06:27

This should fix the mentioned problem:
http://mips.complang.tuwien.ac.at/hg/cacao/rev/560d90393144
Since I do not have any testcase at hand to trigger the problem, could someone please
test it?

Comment #2 by twisti@complang.tuwien.ac.at on 2008-08-19 09:48:04

One of my (closed source) testcases now works and I'm very sure this bug triggered the
crash.  I will transplant the changeset to cacao-1.0.x.  We should wait for Xerxes'
report before closing this one.

Comment #3 by xerxes@zafena.se on 2008-08-19 14:33:29

My "testcase" now works!

The compile of Icedtea classes : icedtea6/openjdk/control/build/linux-
arm/democlasses/demo/management/JTop works!
javac compilation of JTop part of the icedtea6 (changeset:   1013:a469b20018d9
) classes previously triggered this bug.

Bug closed!

Comment #4 by xerxes@zafena.se on 2009-03-21 22:48:47

Created an attachment (id=60)
transplant of PR99 patch from cacao hg 1.0.x to release 0.99.x HEAD.

I have uploaded my rewrite and transplant of cacao PR99 patch from cacao hg 1.0.x to be
applicable to the release HEAD containing 0.99.x.
It is basically a rewrite of the original PR99 patchs md.h part written in cpp to c with
as much reassemblance as possible to the original cpp version.

Comment #5 by michi@complang.tuwien.ac.at on 2009-03-30 13:35:48

I forgot to transplant this patch onto the stable branch for the last release, thanks to
Xerxes for checking. The patch has now been transplanted and will make it into the next
release. This is the changeset:
http://mips.complang.tuwien.ac.at/hg/cacao/rev/5013009f4d11

Closing bug now (again).

Attachment id=60

date:2009-03-21 22:48
desc:transplant of PR99 patch from cacao hg 1.0.x to release 0.99.x HEAD.
type:text/plain
download:cacao_PR99_C_0.99.3.patch