git: libc - Check for invalid context in setcontext() and swapcontext()

Matthew Dillon dillon at crater.dragonflybsd.org
Sat Jan 25 15:47:22 PST 2020


commit c27d72478c10a7d8648217bc817f8429939e8828
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sat Jan 25 15:44:57 2020 -0800

    libc - Check for invalid context in setcontext() and swapcontext()
    
    * Check for an invalid context in setcontext() and swapcontext()
      and return -1 instead of switching to the invalid context.
    
    * This is not an exhaustive check but will handle invalid states set
      by makecontext() if e.g. argc is messed up or the supplied stack is
      too small.  In particular, if makecontext() fails and set/swap tries
      to switch to it, it will switch to the state from the getcontext()
      prior to the makecontext() instead of to the desired makecontext()
      state.
    
    Reported-by: zrj, tuxillo

Summary of changes:
 lib/libc/gen/ucontext.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/c27d72478c10a7d8648217bc817f8429939e8828


-- 
DragonFly BSD source repository


More information about the Commits mailing list