|
@@ -2576,6 +2576,18 @@ static inline int kill_cad_pid(int sig, int priv)
|
|
|
*/
|
|
|
static inline int on_sig_stack(unsigned long sp)
|
|
|
{
|
|
|
+ /*
|
|
|
+ * If the signal stack is SS_AUTODISARM then, by construction, we
|
|
|
+ * can't be on the signal stack unless user code deliberately set
|
|
|
+ * SS_AUTODISARM when we were already on it.
|
|
|
+ *
|
|
|
+ * This improves reliability: if user state gets corrupted such that
|
|
|
+ * the stack pointer points very close to the end of the signal stack,
|
|
|
+ * then this check will enable the signal to be handled anyway.
|
|
|
+ */
|
|
|
+ if (current->sas_ss_flags & SS_AUTODISARM)
|
|
|
+ return 0;
|
|
|
+
|
|
|
#ifdef CONFIG_STACK_GROWSUP
|
|
|
return sp >= current->sas_ss_sp &&
|
|
|
sp - current->sas_ss_sp < current->sas_ss_size;
|