From 504e1b79e7bc5c6cca5f920dea12d6d9eec6e8fb Mon Sep 17 00:00:00 2001 From: Austin Wise Date: Fri, 9 Mar 2018 09:22:39 +0000 Subject: joyent/illumos-joyent#163 fix stack selection for delivery of Linux signals --- usr/src/lib/brand/lx/lx_brand/common/signal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr/src/lib/brand/lx/lx_brand/common/signal.c b/usr/src/lib/brand/lx/lx_brand/common/signal.c index a8e3601cb9..5ae399bcd8 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/signal.c +++ b/usr/src/lib/brand/lx/lx_brand/common/signal.c @@ -26,6 +26,7 @@ /* * Copyright 2018 Joyent, Inc. All rights reserved. + * Copyright 2018 Austin Wise */ #include @@ -1636,8 +1637,10 @@ lx_sigdeliver(int lx_sig, siginfo_t *sip, ucontext_t *ucp, size_t stacksz, * stack specified by the user. */ newstack = (lxsap->lxsa_flags & LX_SA_ONSTACK) && - !(lxtsd->lxtsd_sigaltstack.ss_flags & (LX_SS_ONSTACK | - LX_SS_DISABLE)); + !(lxtsd->lxtsd_sigaltstack.ss_flags & LX_SS_DISABLE) && + (orig_sp < (uintptr_t)lxtsd->lxtsd_sigaltstack.ss_sp || + orig_sp >= (uintptr_t)(lxtsd->lxtsd_sigaltstack.ss_sp + + lxtsd->lxtsd_sigaltstack.ss_size)); /* * Find the first unused region of the Linux process stack, where -- cgit v1.2.3