Honestly that was what I was trying to accomplish. I execute arbitrary perl and the only minor security hole is that shmget allows people to allocate shared memory that never goes away, which apparently has a negative effect when other processes later want shared memory.