The British government has passed legislation amending the Computer Misuse Act to prevent GCHQ from prosecution over any hacking into computers.