emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master c4e3858: Avoid aborts due to unaligned byte stack o


From: Eli Zaretskii
Subject: [Emacs-diffs] master c4e3858: Avoid aborts due to unaligned byte stack of threads
Date: Fri, 23 Dec 2016 08:25:37 +0000 (UTC)

branch: master
commit c4e38581d3b4d6b19921f0db81f319d19ae4fb9e
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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)
---
 src/thread.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/thread.c b/src/thread.c
index 9613d14..3f95952 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -643,12 +643,19 @@ do_nothing (Lisp_Object whatever)
 static void *
 run_thread (void *state)
 {
-  char stack_pos;
+  /* Make sure stack_top and m_stack_bottom are properly aligned as GC
+     expects.  */
+  union
+  {
+    void *p;
+    char c;
+  } stack_pos;
+
   struct thread_state *self = state;
   struct thread_state **iter;
 
-  self->m_stack_bottom = &stack_pos;
-  self->stack_top = &stack_pos;
+  self->m_stack_bottom = &stack_pos.c;
+  self->stack_top = &stack_pos.c;
   self->thread_id = sys_thread_self ();
 
   acquire_global_lock (self);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]