]> git.eshelyaron.com Git - emacs.git/commit
Module assertions: check for garbage collections
authorPhilipp Stephani <phst@google.com>
Tue, 4 Jul 2017 20:50:46 +0000 (22:50 +0200)
committerPhilipp Stephani <phst@google.com>
Sat, 8 Jul 2017 13:25:01 +0000 (15:25 +0200)
commitb7dab24b7953f7a31b806f83e15043c94aaa7745
treefc31284ef0fac82accddc573069652b1c8adccf0
parenta87d767c7acc43b3679d87d2d225b1edeb69326c
Module assertions: check for garbage collections

It's technically possible to write a user pointer finalizer that calls
into Emacs module functions.  This would be disastrous because it
would allow arbitrary Lisp code to run during garbage collection.
Therefore extend the module assertions to check for this case.

* src/emacs-module.c (module_assert_thread): Also check whether a
garbage collection is in progress.

* test/data/emacs-module/mod-test.c (invalid_finalizer)
(Fmod_test_invalid_finalizer): New test module functions.
(emacs_module_init): Register new test function.

* test/src/emacs-module-tests.el (module--test-assertion)
(module--with-temp-directory): New helper macros.
(module--test-assertions--load-non-live-object): Rename existing
unit test, use helper macros.
(module--test-assertions--call-emacs-from-gc): New unit test.
src/emacs-module.c
test/data/emacs-module/mod-test.c
test/src/emacs-module-tests.el