aboutsummaryrefslogtreecommitdiffstats
path: root/mm
ModeNameSize
-rw-r--r--Kconfig6668logstatsplainblame
-rw-r--r--Makefile1305logstatsplainblame
-rw-r--r--allocpercpu.c4078logstatsplainblame
-rw-r--r--backing-dev.c7156logstatsplainblame
-rw-r--r--bootmem.c18232logstatsplainblame
-rw-r--r--bounce.c6661logstatsplainblame
-rw-r--r--dmapool.c13164logstatsplainblame
-rw-r--r--fadvise.c3399logstatsplainblame
-rw-r--r--failslab.c1281logstatsplainblame
-rw-r--r--filemap.c66530logstatsplainblame
-rw-r--r--filemap_xip.c11234logstatsplainblame
-rw-r--r--fremap.c6854logstatsplainblame
-rw-r--r--highmem.c8943logstatsplainblame
-rw-r--r--hugetlb.c61527logstatsplainblame
-rw-r--r--internal.h8040logstatsplainblame
-rw-r--r--maccess.c1406logstatsplainblame
-rw-r--r--madvise.c9774logstatsplainblame
-rw-r--r--memcontrol.c57608logstatsplainblame
-rw-r--r--memory.c88153logstatsplainblame
-rw-r--r--memory_hotplug.c21253logstatsplainblame
-rw-r--r--mempolicy.c60699logstatsplainblame
-rw-r--r--mempool.c9244logstatsplainblame
-rw-r--r--migrate.c26355logstatsplainblame
-rw-r--r--mincore.c5836logstatsplainblame
-rw-r--r--mlock.c18392logstatsplainblame
-rw-r--r--mm_init.c3837logstatsplainblame
-rw-r--r--mmap.c66098logstatsplainblame
-rw-r--r--mmu_notifier.c8415logstatsplainblame
-rw-r--r--mmzone.c1509logstatsplainblame
-rw-r--r--mprotect.c7674logstatsplainblame
-rw-r--r--mremap.c11373logstatsplainblame
-rw-r--r--msync.c2500logstatsplainblame
-rw-r--r--nommu.c47022logstatsplainblame
-rw-r--r--oom_kill.c16809logstatsplainblame
-rw-r--r--page-writeback.c40230logstatsplainblame
-rw-r--r--page_alloc.c133282logstatsplainblame
-rw-r--r--page_cgroup.c10792logstatsplainblame
-rw-r--r--page_io.c3510logstatsplainblame
-rw-r--r--page_isolation.c3662logstatsplainblame
-rw-r--r--pagewalk.c3299logstatsplainblame
-rw-r--r--pdflush.c6784logstatsplainblame
-rw-r--r--prio_tree.c6453logstatsplainblame
-rw-r--r--quicklist.c2496logstatsplainblame
-rw-r--r--readahead.c13684logstatsplainblame
-rw-r--r--rmap.c35001logstatsplainblame
-rw-r--r--shmem.c69503logstatsplainblame
-rw-r--r--shmem_acl.c4709logstatsplainblame
-rw-r--r--slab.c117876logstatsplainblame
-rw-r--r--slob.c16318logstatsplainblame
-rw-r--r--slub.c108457logstatsplainblame
-rw-r--r--sparse-vmemmap.c4276logstatsplainblame
-rw-r--r--sparse.c16595logstatsplainblame
-rw-r--r--swap.c14844logstatsplainblame
-rw-r--r--swap_state.c10360logstatsplainblame
-rw-r--r--swapfile.c51686logstatsplainblame
-rw-r--r--thrash.c2098logstatsplainblame
-rw-r--r--truncate.c13303logstatsplainblame
-rw-r--r--util.c3962logstatsplainblame
-rw-r--r--vmalloc.c44075logstatsplainblame
-rw-r--r--vmscan.c74374logstatsplainblame
-rw-r--r--vmstat.c23314logstatsplainblame
p of the mounted filesystem B) mount owner should not get illegitimate access to information from other users' and the super user's processes C) mount owner should not be able to induce undesired behavior in other users' or the super user's processes How are requirements fulfilled? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A) The mount owner could gain elevated privileges by either: 1) creating a filesystem containing a device file, then opening this device 2) creating a filesystem containing a suid or sgid application, then executing this application The solution is not to allow opening device files and ignore setuid and setgid bits when executing programs. To ensure this fusermount always adds "nosuid" and "nodev" to the mount options for non-privileged mounts. B) If another user is accessing files or directories in the filesystem, the filesystem daemon serving requests can record the exact sequence and timing of operations performed. This information is otherwise inaccessible to the mount owner, so this counts as an information leak. The solution to this problem will be presented in point 2) of C). C) There are several ways in which the mount owner can induce undesired behavior in other users' processes, such as: 1) mounting a filesystem over a file or directory which the mount owner could otherwise not be able to modify (or could only make limited modifications). This is solved in fusermount, by checking the access permissions on the mountpoint and only allowing the mount if the mount owner can do unlimited modification (has write access to the mountpoint, and mountpoint is not a "sticky" directory) 2) Even if 1) is solved the mount owner can change the behavior of other users' processes. i) It can slow down or indefinitely delay the execution of a filesystem operation creating a DoS against the user or the whole system. For example a suid application locking a system file, and then accessing a file on the mount owner's filesystem could be stopped, and thus causing the system file to be locked forever. ii) It can present files or directories of unlimited length, or directory structures of unlimited depth, possibly causing a system process to eat up diskspace, memory or other resources, again causing DoS. The solution to this as well as B) is not to allow processes to access the filesystem, which could otherwise not be monitored or manipulated by the mount owner. Since if the mount owner can ptrace a process, it can do all of the above without using a FUSE mount, the same criteria as used in ptrace can be used to check if a process is allowed to access the filesystem or not. Note that the ptrace check is not strictly necessary to prevent B/2/i, it is enough to check if mount owner has enough privilege to send signal to the process accessing the filesystem, since SIGSTOP can be used to get a similar effect. I think these limitations are unacceptable? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If a sysadmin trusts the users enough, or can ensure through other measures, that system processes will never enter non-privileged mounts, it can relax the last limitation with a "user_allow_other" config option. If this config option is set, the mounting user can add the "allow_other" mount option which disables the check for other users' processes. Kernel - userspace interface ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following diagram shows how a filesystem operation (in this example unlink) is performed in FUSE. NOTE: everything in this description is greatly simplified | "rm /mnt/fuse/file" | FUSE filesystem daemon | | | | >sys_read() | | >fuse_dev_read() | | >request_wait() | | [sleep on fc->waitq] | | | >sys_unlink() | | >fuse_unlink() | | [get request from | | fc->unused_list] | | >request_send() | | [queue req on fc->pending] | | [wake up fc->waitq] | [woken up] | >request_wait_answer() | | [sleep on req->waitq] | | | <request_wait() | | [remove req from fc->pending] | | [copy req to read buffer] | | [add req to fc->processing] | | <fuse_dev_read() | | <sys_read() | | | | [perform unlink] | | | | >sys_write() | | >fuse_dev_write() | | [look up req in fc->processing] | | [remove from fc->processing] | | [copy write buffer to req] | [woken up] | [wake up req->waitq] | | <fuse_dev_write() | | <sys_write() | <request_wait_answer() | | <request_send() | | [add request to | | fc->unused_list] | | <fuse_unlink() | | <sys_unlink() | There are a couple of ways in which to deadlock a FUSE filesystem. Since we are talking about unprivileged userspace programs, something must be done about these. Scenario 1 - Simple deadlock ----------------------------- | "rm /mnt/fuse/file" | FUSE filesystem daemon | | | >sys_unlink("/mnt/fuse/file") | | [acquire inode semaphore | | for "file"] | | >fuse_unlink() | | [sleep on req->waitq] | | | <sys_read() | | >sys_unlink("/mnt/fuse/file") | | [acquire inode semaphore | | for "file"] | | *DEADLOCK* The solution for this is to allow the filesystem to be aborted. Scenario 2 - Tricky deadlock ---------------------------- This one needs a carefully crafted filesystem. It's a variation on the above, only the call back to the filesystem is not explicit, but is caused by a pagefault. | Kamikaze filesystem thread 1 | Kamikaze filesystem thread 2 | | | [fd = open("/mnt/fuse/file")] | [request served normally] | [mmap fd to 'addr'] | | [close fd] | [FLUSH triggers 'magic' flag] | [read a byte from addr] | | >do_page_fault() | | [find or create page] | | [lock page] | | >fuse_readpage() | | [queue READ request] | | [sleep on req->waitq] | | | [read request to buffer] | | [create reply header before addr] | | >sys_write(addr - headerlength) | | >fuse_dev_write() | | [look up req in fc->processing] | | [remove from fc->processing] | | [copy write buffer to req] | | >do_page_fault() | | [find or create page] | | [lock page] | | * DEADLOCK * Solution is basically the same as above. An additional problem is that while the write buffer is being copied to the request, the request must not be interrupted/aborted. This is because the destination address of the copy may not be valid after the request has returned. This is solved with doing the copy atomically, and allowing abort while the page(s) belonging to the write buffer are faulted with get_user_pages(). The 'req->locked' flag indicates when the copy is taking place, and abort is delayed until this flag is unset.