diff options
author | stefanf <stefanf@FreeBSD.org> | 2005-10-28 10:45:19 +0000 |
---|---|---|
committer | stefanf <stefanf@FreeBSD.org> | 2005-10-28 10:45:19 +0000 |
commit | 54091cfc827e8a2a18fc61f70f5c2fae197d6997 (patch) | |
tree | 90a53b77b5ce252eb80e70be38ddf646e528c634 /bin/sh/memalloc.h | |
parent | 175c41b86af872bde2bead127e56ad848b0e3eb7 (diff) | |
download | FreeBSD-src-54091cfc827e8a2a18fc61f70f5c2fae197d6997.zip FreeBSD-src-54091cfc827e8a2a18fc61f70f5c2fae197d6997.tar.gz |
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
Diffstat (limited to 'bin/sh/memalloc.h')
-rw-r--r-- | bin/sh/memalloc.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/bin/sh/memalloc.h b/bin/sh/memalloc.h index 254d27b..3475442 100644 --- a/bin/sh/memalloc.h +++ b/bin/sh/memalloc.h @@ -48,6 +48,7 @@ extern int herefd; pointer ckmalloc(int); pointer ckrealloc(pointer, int); +void ckfree(pointer); char *savestr(char *); pointer stalloc(int); void stunalloc(pointer); @@ -72,5 +73,3 @@ void ungrabstackstr(char *, char *); #define STTOPC(p) p[-1] #define STADJUST(amount, p) (p += (amount), sstrnleft -= (amount)) #define grabstackstr(p) stalloc(stackblocksize() - sstrnleft) - -#define ckfree(p) free((pointer)(p)) |