aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2016-12-23 10:24:30 +0200
committerEli Zaretskii2016-12-23 10:24:30 +0200
commitc4e38581d3b4d6b19921f0db81f319d19ae4fb9e (patch)
tree24d0879a5ad238d97ba25a374db47860ac05ddd0 /src
parenta978d300a3faf58ee6e94ba57f764ca99a9ec308 (diff)
downloademacs-c4e38581d3b4d6b19921f0db81f319d19ae4fb9e.tar.gz
emacs-c4e38581d3b4d6b19921f0db81f319d19ae4fb9e.zip
Avoid aborts due to unaligned byte stack of threads
* src/thread.c (run_thread): Make sure the pointers to thread byte stack are properly aligned. (Bug#25247)
Diffstat (limited to 'src')
-rw-r--r--src/thread.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/thread.c b/src/thread.c
index 9613d1435f7..3f9595274e9 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -643,12 +643,19 @@ do_nothing (Lisp_Object whatever)
643static void * 643static void *
644run_thread (void *state) 644run_thread (void *state)
645{ 645{
646 char stack_pos; 646 /* Make sure stack_top and m_stack_bottom are properly aligned as GC
647 expects. */
648 union
649 {
650 void *p;
651 char c;
652 } stack_pos;
653
647 struct thread_state *self = state; 654 struct thread_state *self = state;
648 struct thread_state **iter; 655 struct thread_state **iter;
649 656
650 self->m_stack_bottom = &stack_pos; 657 self->m_stack_bottom = &stack_pos.c;
651 self->stack_top = &stack_pos; 658 self->stack_top = &stack_pos.c;
652 self->thread_id = sys_thread_self (); 659 self->thread_id = sys_thread_self ();
653 660
654 acquire_global_lock (self); 661 acquire_global_lock (self);