JIT user interrupts and updating the context

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JIT user interrupts and updating the context

Holger Freyther
Dear Paolo,

I get a NULL pointer dereference when using CTRL+C on the below piece
of code in unwind_context but I think the error might happen earlier
or for the same reason

 st>  [[(Delay forSeconds: 3) wait. '123' printNl] repeat] value
=> CTRL+C

MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject(Object)>>doesNotUnderstand: #goodness: (SysExcept.st:1408)
optimized [] in BlockClosure class>>exceptionHandlerSearchBlock (BlkClosure.st:16)
[] in SystemExceptions.UserInterrupt(Exception)>>instantiateNextHandlerFrom: (ExcHandling.st:340)
MethodContext(ContextPart)>>scanBacktraceForAttribute:do: (ContextPart.st:578)
SystemExceptions.UserInterrupt(Exception)>>instantiateNextHandlerFrom: (ExcHandling.st:342)
SystemExceptions.UserInterrupt(Exception)>>signal (ExcHandling.st:254)
SystemExceptions.UserInterrupt class(Exception class)>>signal (ExcHandling.st:151)
ProcessorScheduler(Object)>>userInterrupt (Object.st:1398)
optimized [] in Delay class>>initialize (Delay.st:196)
[] in Process>>onBlock:at:suspend: (Process.st:412)
BlockClosure>>on:do: (BlkClosure.st:196)
[] in Process>>onBlock:at:suspend: (Process.st:413)
BlockClosure>>ensure: (BlkClosure.st:271)
[] in Process>>onBlock:at:suspend: (Process.st:391)
[] in BlockClosure>>asContext: (BlkClosure.st:182)
BlockContext class>>fromClosure:parent: (BlkContext.st:68)
lt-gst: interp.c:1035: unwind_context: Assertion `newContextOOP != ((void *)0)' failed.
stdin:2: Aborted
(ip 12)BlockContext class>>#fromClosure:parent:
Aborted (core dumped)

As usual I don't understand the issue yet. The interrupt should be
queued through a normal SET_EXCEPT_FLAG and all frame information
should be written back. Do you have an idea or time to look into for
a fix?

holger

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: JIT user interrupts and updating the context

Holger Freyther
On Fri, Feb 07, 2014 at 09:01:45PM +0100, Holger Hans Peter Freyther wrote:

> As usual I don't understand the issue yet. The interrupt should be
> queued through a normal SET_EXCEPT_FLAG and all frame information
> should be written back. Do you have an idea or time to look into for
> a fix?

I think we should first update thisContext, nativeIP and more and then
check for _gst_abort_execution. This is the order used by interp-bc.inl.

I think it will be very difficult to create a unit test for this one.

diff --git a/libgst/interp-jit.inl b/libgst/interp-jit.inl
index 78fa94c..b74f3ef 100644
--- a/libgst/interp-jit.inl
+++ b/libgst/interp-jit.inl
@@ -407,14 +407,6 @@ _gst_interpret (OOP processOOP)
 
        SET_EXCEPT_FLAG (false);
 
-        if UNCOMMON (_gst_abort_execution)
-         {
-           OOP selectorOOP;
-           selectorOOP = _gst_intern_string ((char *)_gst_abort_execution);
-           _gst_abort_execution = NULL;
-           SEND_MESSAGE (selectorOOP, 0);
-         }
-
         /* First, deal with any async signals.  */
         if (async_queue_enabled)
           empty_async_queue ();
@@ -453,6 +445,15 @@ _gst_interpret (OOP processOOP)
            native_ip = GET_CONTEXT_IP (thisContext);
          }
 
+        if UNCOMMON (_gst_abort_execution)
+         {
+           OOP selectorOOP;
+           selectorOOP = _gst_intern_string ((char *)_gst_abort_execution);
+           _gst_abort_execution = NULL;
+           SEND_MESSAGE (selectorOOP, 0);
+         }
+
+
         if UNCOMMON (time_to_preempt)
          set_preemption_timer ();
       }

>
> holger

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: JIT user interrupts and updating the context

Paolo Bonzini-2
Il 07/02/2014 21:41, Holger Hans Peter Freyther ha scritto:
> On Fri, Feb 07, 2014 at 09:01:45PM +0100, Holger Hans Peter Freyther wrote:
>
>> As usual I don't understand the issue yet. The interrupt should be
>> queued through a normal SET_EXCEPT_FLAG and all frame information
>> should be written back. Do you have an idea or time to look into for
>> a fix?
>
> I think we should first update thisContext, nativeIP and more and then
> check for _gst_abort_execution. This is the order used by interp-bc.inl.

Looks good, thanks!

Paolo

> I think it will be very difficult to create a unit test for this one.
>
> diff --git a/libgst/interp-jit.inl b/libgst/interp-jit.inl
> index 78fa94c..b74f3ef 100644
> --- a/libgst/interp-jit.inl
> +++ b/libgst/interp-jit.inl
> @@ -407,14 +407,6 @@ _gst_interpret (OOP processOOP)
>
>         SET_EXCEPT_FLAG (false);
>
> -        if UNCOMMON (_gst_abort_execution)
> -         {
> -           OOP selectorOOP;
> -           selectorOOP = _gst_intern_string ((char *)_gst_abort_execution);
> -           _gst_abort_execution = NULL;
> -           SEND_MESSAGE (selectorOOP, 0);
> -         }
> -
>          /* First, deal with any async signals.  */
>          if (async_queue_enabled)
>            empty_async_queue ();
> @@ -453,6 +445,15 @@ _gst_interpret (OOP processOOP)
>             native_ip = GET_CONTEXT_IP (thisContext);
>           }
>
> +        if UNCOMMON (_gst_abort_execution)
> +         {
> +           OOP selectorOOP;
> +           selectorOOP = _gst_intern_string ((char *)_gst_abort_execution);
> +           _gst_abort_execution = NULL;
> +           SEND_MESSAGE (selectorOOP, 0);
> +         }
> +
> +
>          if UNCOMMON (time_to_preempt)
>           set_preemption_timer ();
>        }
>
>>
>> holger
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-smalltalk
>



_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk