new helper: sigsp()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 6 Nov 2012 18:28:21 +0000 (13:28 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 3 Feb 2013 20:09:26 +0000 (15:09 -0500)
Normal logics for altstack handling in sigframe allocation

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
include/linux/sched.h

index 6fc8f45de4e912f1196d07a5ace4d4cc752ebe3f..8f983293b403da8e06db1778a5e37f6dc4d9479e 100644 (file)
@@ -2305,6 +2305,17 @@ static inline int sas_ss_flags(unsigned long sp)
                : on_sig_stack(sp) ? SS_ONSTACK : 0);
 }
 
+static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
+{
+       if (unlikely((ksig->ka.sa.sa_flags & SA_ONSTACK)) && ! sas_ss_flags(sp))
+#ifdef CONFIG_STACK_GROWSUP
+               return current->sas_ss_sp;
+#else
+               return current->sas_ss_sp + current->sas_ss_size;
+#endif
+       return sp;
+}
+
 /*
  * Routines for handling mm_structs
  */