Add pledge support in awk and make awk -safe actually safe.
authordoug <doug@openbsd.org>
Sat, 10 Oct 2015 20:04:28 +0000 (20:04 +0000)
committerdoug <doug@openbsd.org>
Sat, 10 Oct 2015 20:04:28 +0000 (20:04 +0000)
commit8ce597b39125ff469e691e0be0f4dc60cf5e80dd
tree4339325e33a740d5af8d0fbfbda10d7d0ec592b1
parent9490edf2cc1db1c6c10782d325f0baf17b18d234
Add pledge support in awk and make awk -safe actually safe.

awk -safe was introduced back in 1997 to stop awk from doing file output,
execute commands or access the environment.  The lexer rejected programs
when it saw awk commands that would write, exec or env.  Beyond that,
it wasn't safe from write/exec/env during program execution.

With pledge "stdio rpath", the kernel is now enforcing the awk -safe
mode restrictions at runtime (other than env).

Based on a diff by deraadt@

ok deraadt@ beck@
usr.bin/awk/main.c