]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Protect malloc, realloc and free calls with INT{ON,OFF} directly in chkalloc,
authorstefanf <stefanf@FreeBSD.org>
Fri, 28 Oct 2005 10:45:19 +0000 (10:45 +0000)
committerstefanf <stefanf@FreeBSD.org>
Fri, 28 Oct 2005 10:45:19 +0000 (10:45 +0000)
commit54091cfc827e8a2a18fc61f70f5c2fae197d6997
tree90a53b77b5ce252eb80e70be38ddf646e528c634
parent175c41b86af872bde2bead127e56ad848b0e3eb7
Protect malloc, realloc and free calls with INT{ON,OFF} directly in chkalloc,
ckrealloc and ckfree (added), respectively.  sh jumps out of the signal handler
using longjmp which is obviously a bad idea during malloc calls.

Note: I think there is still a small race here because volatile sig_atomic_t
only guarantees atomic reads and writes while we're doing increments and
decrements.

Protect a setmode call with INT{ON,OFF} as it calls malloc internally.

PR: 45478
Patch from: Nate Eldredge
bin/sh/memalloc.c
bin/sh/memalloc.h
bin/sh/miscbltin.c