I've now managed to get my original project, and the cut-down testcase, both working flawlessly (err, or at least not crashing) on an IGEPv2 board, using (I think) the same version of the SGX drivers, but with a later kernel (*). This to me points very strongly towards a kernel issue. I guess...