Commit 9f3336ab authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] hugetlbfs file system

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.
parent 1541c38b
......@@ -18,7 +18,7 @@
#include <asm/tlb.h>
#include <asm/tlbflush.h>
static struct vm_operations_struct hugetlb_vm_ops;
struct vm_operations_struct hugetlb_vm_ops;
struct list_head htlbpage_freelist;
spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
extern long htlbpagemem;
......@@ -536,5 +536,12 @@ int set_hugetlb_mem_size(int count)
return (int) htlbzone_pages;
}
static struct vm_operations_struct hugetlb_vm_ops = {
static struct page * hugetlb_nopage(struct vm_area_struct * area, unsigned long address, int unused)
{
BUG();
return NULL;
}
struct vm_operations_struct hugetlb_vm_ops = {
.nopage = hugetlb_nopage,
};
......@@ -578,6 +578,10 @@ config RAMFS
say M here and read <file:Documentation/modules.txt>. The module
will be called ramfs.o.
config HUGETLBFS
bool "HugeTLB file system support"
depends on HUGETLB_PAGE
config ISO9660_FS
tristate "ISO 9660 CDROM file system support"
---help---
......
......@@ -48,6 +48,7 @@ obj-$(CONFIG_JBD) += jbd/
obj-$(CONFIG_EXT2_FS) += ext2/
obj-$(CONFIG_CRAMFS) += cramfs/
obj-$(CONFIG_RAMFS) += ramfs/
obj-$(CONFIG_HUGETLBFS) += hugetlbfs/
obj-$(CONFIG_CODA_FS) += coda/
obj-$(CONFIG_INTERMEZZO_FS) += intermezzo/
obj-$(CONFIG_MINIX_FS) += minix/
......
#
# Makefile for the linux ramfs routines.
#
obj-$(CONFIG_HUGETLBFS) += hugetlbfs.o
hugetlbfs-objs := inode.o
include $(TOPDIR)/Rules.make
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment