Borrowed a bunch of security patches from r1q2.

Mostly fixing buffer overflows and stuff that lets an attacker
compromise the operating system.