Opened 10 years ago

Closed 10 years ago

#802 closed defect (fixed)

ARM: ccl:process-interrupt causes crash

Reported by: ivan4th Owned by: gb
Priority: normal Milestone:
Component: Runtime (threads, GC) Version: trunk
Keywords: ffi crash threads arm Cc:


The problem occurs very often, though some calls to ccl:process-interrupt do succeed. I've tested it on recent CCL under Angstrom Linux on a BeagleBoard clone (I can retest it on N900 if you ask but I don't think it will make any difference). The problem seems to occur mostly when FFI-related code is hit in the thread being interrupted, though I also encountered it in some non-FFI code when it was compiled with high debug setting (with lower debug/safety and higher speed settings the crashes tend to occur only in FFI code). I've attached a distilled test case that demonstrates the bug using usleep() calls in the thread.

Below is a sample session demonstrating the problem.

root@beagleboard:~# ~/ccl/armcl
Welcome to Clozure Common Lisp Version 1.7-dev-r14544M-trunk  (LinuxARM32)!
? (load "interrupt.lisp")
? (start-thread)
#<PROCESS sleepy(2) [Reset] #x545724D6>
? (interrupt)
> Error: Fault during read of memory address #x5A000
> While executing: THREAD-FUNCTION, in process sleepy(2).

;;; #<PROCESS sleepy(2) [Active] #x545724D6> requires access to Shared Terminal Input
;;; Type (:y 2) to yield control to this thread.
(:y 2)

;;; Shared Terminal Input is now owned by #<PROCESS sleepy(2) [Active] #x545724D6>

> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > (:b)
*(407A4768) : 0 (THREAD-FUNCTION) 94
 (407A4778) : 1 (RUN-PROCESS-INITIAL-FORM #<PROCESS sleepy(2) [Active] #x545724D6> (#<COMPILED-LEXICAL-CLOSURE # #x54572016>)) 364
 (407A4890) : 2 (FUNCALL #'#<(:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS)))> #<PROCESS sleepy(2) [Active] #x545724D6> (#<COMPILED-LEXICAL-CLOSURE # #x54572016>)) 188
1 > (disassemble 'thread-function)
;; Source: "home:interrupt.lisp.newest":89-208
  (cmp nargs (:$ 0))
  (beq L12)
  (uuo-error-wrong-nargs (:? ne))
  (mov imm0 (:$ 19))
  (stmdb (:! sp) (imm0 vsp fn lr))
  (mov fn temp2)

;;; (external-call "usleep" :int 1000 :void)
  (mov imm0 (:$ #xB00))
  (mov imm1 (:lsr imm0 (:$ 6)))
  (orr imm0 imm0 (:$ #xAF))
  (mov nargs sp)
  (add imm1 imm1 (:$ 4))
  (str imm0 (:-@! sp imm1))
  (str nargs (:@ sp (:$ 4)))
  (ldr arg_y (:@ fn '#<EXTERNAL-ENTRY-POINT "usleep" (#x4019A848) #x54578C4E>))
  (ldr arg_z (:@ arg_y (:$ 2)))
  (cmp arg_z 'nil)
  (bne L72)
  (uuo-eep-unresolved arg_z arg_y)
  (str arg_z (:@! vsp (:$ -4)))
  (mov imm0 (:$ #x3E8))
  (str imm0 (:@ sp (:$ 8)))
  (ldr arg_z (:@+ vsp (:$ 4)))
  (bla .SPeabi-ff-call)

;;; (loop (external-call "usleep" :int 1000 :void))
  (b L24)
  (mov arg_z 'nil)
  (ldmia (:! sp) (imm0 vsp fn pc))

;;; #<no source text>
1 >

Attachments (1)

interrupt.lisp (411 bytes) - added by ivan4th 10 years ago.

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by ivan4th

comment:1 Changed 10 years ago by ivan4th

Just in case: from my observations, the function passed to ccl:process-interrupt always gets called. The problem occurs after returning from it.

comment:2 Changed 10 years ago by gb

  • Owner set to gb
  • Status changed from new to assigned

comment:3 Changed 10 years ago by gb

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14545]) In handle_uuo(), don't expect the cmain callback to tell us how to adjust the PC when handling a deferred interrupt.

Fixes ticket:802.

Note: See TracTickets for help on using tickets.