With jigsaw builds this stuff is not allowed, its no longer an option of security manager or not.
So we should remove these permissions and fix the test leaks, crappy code, remove hacks, etc.
If the hack is really somehow needed for some special reason (e.g. well known case like mmap), it needs to gracefully handle not being able to do this, the code and tests should still "work" if it cannot do the hack.
Otherwise there will be problems for java 9.