]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sh: Remove linked list of stack marks.
authorJilles Tjoelker <jilles@FreeBSD.org>
Sat, 11 May 2013 20:51:00 +0000 (20:51 +0000)
committerJilles Tjoelker <jilles@FreeBSD.org>
Sat, 11 May 2013 20:51:00 +0000 (20:51 +0000)
commit336e0c87fa2b1bb2fb9da11c09e9e7e0df684696
treebe11628c178535fe7fd9957134f7f49cfd4252a5
parentb8992a679264000568ee3889c53952ef0970d0ce
sh: Remove linked list of stack marks.

The linked list of stack marks may cause problems if the allocation stack is
used between an exception and a higher-level popstackmark(), as it may then
touch a stack mark that is local to a function which has returned.

Also, the adjustment compares to a pointer passed to realloc(), which is
undefined behaviour.

Instead of adjusting stack marks when reallocating stack blocks, ensure that
such an adjustment is never necessary by fixing a small piece of memory in
place at a stack mark. This also simplifies the code.

To avoid the problems reported in bin/175922, it remains necessary to call
setstackmark() after popstackmark() if the stack mark remains in use.
bin/sh/memalloc.c
bin/sh/memalloc.h