sbcl.sbcl/tests/save10.test.sh
Douglas Katzman 2c8affb085 Zeroize junk at end of heap spaces when saving core
Patch to save.c by Andreas Franke, test case by me
2026-03-03 23:34:21 -05:00

23 lines
823 B
Bash

. ./subr.sh
use_test_subdirectory
tmpcore=$TEST_FILESTEM.core
set -e
# This test asserts that preparing read-only space prior to saving a core file
# does not attempt to rewrite pointers that appear to point to unknown memory.
# So the test attempts to fabricate such pointers. However it's a bad idea
# to store into the car of a cons the value
# (sb-kernel:%make-lisp-obj sb-vm:instance-pointer-lowtag)
# as that cons is indistinguishable from a forwarded cons in 32-bit builds,
# where INSTANCE_POINTER_LOWTAG is 1 and forwarding_pointer_p(x) is '*x == 1'
run_sbcl <<EOF
(defvar *x* (list (sb-kernel:%make-lisp-obj sb-vm:fun-pointer-lowtag)
(sb-kernel:%make-lisp-obj
(logior #x100 sb-vm:instance-pointer-lowtag))))
(save-lisp-and-die "$tmpcore")
EOF
exit $EXIT_TEST_WIN