Cherry-picked from upstream. Also applied a fix for the CPUShares configuration option while I'm at it. CVE-2013-4327
This fixes hangs during EC2 reboots (which are implemented by sending a ctrl-alt-del to the instance).