• Linus Torvalds's avatar
    Handle two threads both trying to expand their stack simultaneously. · fa6e49a2
    Linus Torvalds authored
    We had all the locking right, but we didn't check whether one of the
    threads now no longer needed to expand, so we could incorrectly _shrink_
    the stack in the other thread instead (not only causing segfaults, but
    since we didn't do a proper unmap, we'd possibly leak pages too).
    
    So re-check the need for expand after getting the lock.
    
    Noticed by Paul Starzetz.
    fa6e49a2
mmap.c 54 KB