-
Andrew Morton authored
From Bill Irwin Tiny hugetlbpage ram-backed filesystem. Some way to export hugetlbfs through more standard system call interfaces was needed, and hugetlbfs already had inodes with ratnodes etc. used to track offset -> page translations, so adding the rest of a filesystem around it was easy and natural. Most of it is identical to ramfs, except ->f_op->mmap() is now just a wrapper around the hugetlb_prefault() to fill in the VMA, and to simplify it, ->readpage(), ->prepare_write(), and ->commit_write() are omitted. Permissions: (1) check capable(CAP_IPC_LOCK) in ->f_ops->mmap This may be redundant but it errors out with less state to clean up and at least clarifies the fact that checks are being performed at the relevant entry points. (2) check capable(CAP_IPC_LOCK) in hugetlbfs_zero_setup() This is called at shmget() time and is an actual potential security hole. hugetlb_prefault() does not perform this check itself, so it must be done here.
9f3336ab