sys/uvm: unwind failed amap copies
A PR_NOWAIT chunk allocation in amap_copy() may fail after earlier
chunks already contain copied anons; amap_free() requires an empty amap,
so direct cleanup trips its diagnostic assertion or leaves copied anon
references orphaned which may end who knows how.
Uuse amap_wipeout() instead to reverse the partial copy, release the
shared lock, and free the temporary amap.
OK: kettenis@
When an escape sequence that requires an argument occurs at the end of an
input line and the argument is missing, abort parsing the line and report
an "incomplete escape sequence" error.
This fixes a read buffer overrun that Josiah Frentsos <jfrent at tilde.team>
sent a different patch for. Instead of always entering the argument
parsing code and detecting that there is no argument at two places in
the middle of that code, as Josiah proposed, i chose to instead check
up front that there is anything that can be parsed to begin with.
Also reminded by deraadt@, thanks!