sharplispers / ironclad

A cryptographic toolkit written in Common Lisp
BSD 3-Clause "New" or "Revised" License
166 stars 28 forks source link

Lock on package SB-VM violated when interning EA while in package IRONCLAD. #38

Closed TheJunglePedantic closed 3 years ago

TheJunglePedantic commented 3 years ago

CL-USER> (lisp-implementation-version) "2.0.11.142-1b0795826" CL-USER> (ql:quickload :ironclad) To load "ironclad": Load 1 ASDF system: ironclad ; Loading "ironclad" [package ironclad] ; ; caught ERROR: ; READ error during COMPILE-FILE: ;
; Lock on package SB-VM violated when interning EA while in package IRONCLAD. ; See also: ; The SBCL Manual, Node "Package Locks" ;
; (in form starting at line: 216, column: 0, position: 7846)

I'm using a Raspberry 4b... seems like there was a change recently in that area?

glv2 commented 3 years ago

I don't have any arm64 hardware to reproduce this error, however maybe the following patch will fix it. Could you try it?

diff --git a/src/package.lisp b/src/package.lisp
index f30a9f3..57595d6 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -220,11 +220,10 @@
              :32-bit
              :64-bit)
          :ironclad-fast-mod32-arithmetic
-         (append
-          (when (member :x86-64 *features*)
-            '(:ironclad-fast-mod64-arithmetic))
-          (when (fboundp 'sb-vm::ea)
-            '(:ironclad-sb-vm-ea))))
+         (when (member :x86-64 *features*)
+           (list* :ironclad-fast-mod64-arithmetic
+                  (when (fboundp 'sb-vm::ea)
+                    '(:ironclad-sb-vm-ea)))))
   #+cmu
   (list (c:backend-byte-order c:*target-backend*)
         (if (= vm:word-bits 32)
TheJunglePedantic commented 3 years ago

CL-USER> (find-symbol "EA" "SB-VM") NIL NIL CL-USER> (fboundp 'sb-vm::ea)

Lock on package SB-VM violated when interning EA while in package COMMON-LISP-USER. [Condition of type PACKAGE-LOCKED-ERROR] See also: SBCL Manual, Package Locks [:node]

That seems to be the issue but I don't know what the proper resolution is. Interning and exporting a symbol from a locked package throws an error I think.

I can get around it by causing the package-locked-error for 'sb-vm::ea and picking the continue restart to ignore the package lock for that operation. Then the symbol is already interned and I am able to load ironclad.

glv2 commented 3 years ago

I pushed a fix (f215e183e7fe0b66da009c07d70e6f738ea1da03) that should make the SB-VM package lock error disappear.

ebrasca commented 3 years ago

@glv2 It also fixes same error on ppc64le.

TheJunglePedantic commented 3 years ago

thank you!