Edit: This issue (bug #120) was fixed in SML/NJ version 110.77 (release notes) by enabling MAP_ANONYMOUS, which was previously unsupported in Linux. Installing the latest version of SMLNJ would be preferable to the solution below, since it doesn't require weakening the security of the system. If you do continue via modifying the permissions of /dev
, it's advisable to remove exec
permission after each session.
This problem is primarily reproducible in a Chromium OS environment running ChrUbuntu or Crouton, but may happen to other users in other environments who have a similar problem.
Running strace
on sml
gives this (attempted) operation before the error output:
open("/dev/zero", O_RDONLY) = 4
mmap2(NULL, 1245184, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 4, 0) = -1 EPERM (Operation not permitted)
According to the mmap(2) documentation, EPERM
indicates that the system is attempting to allocate memory with execute permission in a directory that is marked noexec
.
Indeed, mount
gives:
...
devtmpfs on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=960456k,nr_inodes=240114,mode=755)
...
The solution is thus to remount /dev
with exec
permission:
$ sudo mount -o remount,exec /dev
$ sml
Standard ML of New Jersey v110.75 [built: Thu May 9 05:41:01 2013]
-