RFR(S): JDK-8203481 Incorrect constraint for unextended_sp in frame:safe_for_sender

Dmitry Samersoff dms at samersoff.net
Sun Jun 3 20:18:30 UTC 2018


Dan,

I have an impression that _unextended_sp doesn't contain "unextended"
value at the time we constructing frame() object on both aarch64 and x86.

On x86 _unextended_sp always equals to _sp at this point, on aarch64
_unextended_sp is less or equal to _sp.

if I add

assert((_unextended_sp >= _sp), "DMS: unextended_sp_safe");

inside

frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp,
address pc)

on aarhc64 java crashes immediately (java -version).


1.

#22 0x0000ffff905d7b9c in report_vm_error (
    file=file at entry=0xffff91361260
"/root/dsamersoff/esc/JDK-8203481/jdk/src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp",
line=line at entry=81,
    error_msg=error_msg at entry=0xffff91371240 "assert((_unextended_sp >=
_sp)) failed", detail_fmt=detail_fmt at entry=0xffff91371228 "DMS:
unextended_sp_safe")
    at
/root/dsamersoff/esc/JDK-8203481/jdk/src/hotspot/share/utilities/debug.cpp:231
#23 0x0000ffff906e2230 in frame::frame (
    pc=0xffff79081400
"\264\003_\370\277\003\037\370\266\203[\370\270\003\\\370\272\203\\\370\254\203^\370\201\r@\371\241\003^\370\201\004",
    fp=0xffff8fc86f70, unextended_sp=0xffff8fc86ee0, sp=<optimized out>,
this=0xffff8fc866d0)
    at
/root/dsamersoff/esc/JDK-8203481/jdk/src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp:81
#24 frame::sender_for_interpreter_frame (map=0xffff8fc86840,
this=0xffff8fc86808)
    at
/root/dsamersoff/esc/JDK-8203481/jdk/src/hotspot/cpu/aarch64/frame_aarch64.cpp:441
#25 frame::sender (this=this at entry=0xffff8fc86808,
map=map at entry=0xffff8fc86840)
    at
/root/dsamersoff/esc/JDK-8203481/jdk/src/hotspot/cpu/aarch64/frame_aarch64.cpp:493
#26 0x0000ffff90ac1f44 in vframeStreamCommon::next (this=0xffff8fc86800)
    at
/root/dsamersoff/esc/JDK-8203481/jdk/src/hotspot/share/runtime/vframe.inline.hpp:47
#27 JVM_GetStackAccessControlContext (env=0x0, cls=<optimized out>) at
/root/dsamersoff/esc/JDK-8203481/jdk/src/hotspot/share/prims/jvm.cpp:1357
#28 0x0000ffff79088b0c in ?? ()
#29 0x000000008b506a48 in ?? ()


(gdb) p _unextended_sp
$1 = (intptr_t *) 0xffff8fc86ee0
(gdb) p _sp
$2 = (intptr_t *) 0xffff8fc86f10

-Dmitry


On 05/21/2018 05:28 PM, Daniel D. Daugherty wrote:
> Hi Dmitry,
> 
> I think something else must be going wrong here. The unextended SP
> is typically documented like this:
> 
>   // This is the sp before any possible extension (adapter/locals).
>   intptr_t* unextended_sp = interpreter_frame_sender_sp();
> 
> and like this:
> 
>   // stack frames shouldn't be much larger than max_stack elements
>   // this test requires the use of unextended_sp which is the sp as seen by
>   // the current frame, and not sp which is the "raw" pc which could point
>   // further because of local variables of the callee method inserted after
>   // method arguments
>   if (fp() - unextended_sp() > 1024 +
> m->max_stack()*Interpreter::stackElementSize) {
>     return false;
>   }
> 
> So I think this existing comment and assertion are correct:
> 
>     L72:   // unextended sp must be within the stack and above or equal sp
>     L73:   bool unextended_sp_safe = (unextended_sp <
> thread->stack_base()) &&
>     L74:                             (unextended_sp >= sp);
> 
> Also, your proposed fix only changed this for two platforms. The same
> logic exists on 'arm' and 'sparc' also.
> 
> Dan
> 
> 
> On 5/21/18 9:44 AM, Dmitry Samersoff wrote:
>> Hello Everybody,
>>
>> Please review small fix
>>
>> http://cr.openjdk.java.net/~dsamersoff/JDK-8203481/webrev.01/
>>
>> CR:
>>
>> https://bugs.openjdk.java.net/browse/JDK-8203481
>>
>> Testing:
>>
>> jfr tests that depends to safe_for_sender functionality
>>
>> ./jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.java
>> ./jdk/jdk/jfr/event/profiling/TestFullStackTrace.java
>>
>> fails on AARCH64.
>>
>> These tests passed after the fix.
>>
>>
> 


-- 
Dmitry Samersoff
http://devnull.samersoff.net
* There will come soft rains ...



More information about the hotspot-runtime-dev mailing list