Changelog: Feb 15: Don't set new ipc->user_ns if we didn't create a new ipc_ns. Feb 23: Move extern declaration to ipc_namespace.h, and group fwd declarations at top. Signed-off-by: Serge E. Hallyn <firstname.lastname@example.org> Acked-by: "Eric W. Biederman" <email@example.com> Acked-by: Daniel Lezcano <firstname.lastname@example.org> Acked-by: David Howells <email@example.com> Cc: James Morris <firstname.lastname@example.org> Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Implement multiple mounts of the mqueue file system, and link it to usage of CLONE_NEWIPC. Each ipc ns has a corresponding mqueuefs superblock. When a user does clone(CLONE_NEWIPC) or unshare(CLONE_NEWIPC), the unshare will cause an internal mount of a new mqueuefs sb linked to the new ipc ns. When a user does 'mount -t mqueue mqueue /dev/mqueue', he mounts the mqueuefs superblock. Posix message queues can be worked with both through the mq_* system calls (see mq_overview(7)), and through the VFS through the mqueue mount. Any usage of mq_open() and friends will work with the acting task's ipc namespace. Any actions through the VFS will work with the mqueuefs in which the file was created. So if a user doesn't remount mqueuefs after unshare(CLONE_NEWIPC), mq_open("/ab") will not be reflected in "ls /dev/mqueue". If task a mounts mqueue for ipc_ns:1, then clones task b with a new ipcns, ipcns:2, and then task a is the last task in ipc_ns:1 to exit, then (1) ipc_ns:1 will be freed, (2) it's superblock will live on until task b umounts the corresponding mqueuefs, and vfs actions will continue to succeed, but (3) sb->s_fs_info will be NULL for the sb corresponding to the deceased ipc_ns:1. To make this happen, we must protect the ipc reference count when a) a task exits and drops its ipcns->count, since it might be dropping it to 0 and freeing the ipcns b) a task accesses the ipcns through its mqueuefs interface, since it bumps the ipcns refcount and might race with the last task in the ipcns exiting. So the kref is changed to an atomic_t so we can use atomic_dec_and_lock(&ns->count,mq_lock), and every access to the ipcns through ns = mqueuefs_sb->s_fs_info is protected by the same lock. Signed-off-by: Cedric Le Goater <email@example.com> Signed-off-by: Serge E. Hallyn <firstname.lastname@example.org> Cc: Alexey Dobriyan <email@example.com> Signed-off-by: Andrew Morton <firstname.lastname@example.org> Signed-off-by: Linus Torvalds <email@example.com>
Move mqueue vfsmount plus a few tunables into the ipc_namespace struct. The CONFIG_IPC_NS boolean and the ipc_namespace struct will serve both the posix message queue namespaces and the SYSV ipc namespaces. The sysctl code will be fixed separately in patch 3. After just this patch, making a change to posix mqueue tunables always changes the values in the initial ipc namespace. Signed-off-by: Cedric Le Goater <firstname.lastname@example.org> Signed-off-by: Serge E. Hallyn <email@example.com> Cc: Alexey Dobriyan <firstname.lastname@example.org> Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Run this: #!/bin/sh for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do echo "De-casting $f..." perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f done And then go through and reinstate those cases where code is casting pointers to non-pointers. And then drop a few hunks which conflicted with outstanding work. Cc: Russell King <email@example.com>, Ian Molton <firstname.lastname@example.org> Cc: Mikael Starvik <email@example.com> Cc: Yoshinori Sato <firstname.lastname@example.org> Cc: Roman Zippel <email@example.com> Cc: Geert Uytterhoeven <firstname.lastname@example.org> Cc: Ralf Baechle <email@example.com> Cc: Paul Mackerras <firstname.lastname@example.org> Cc: Kyle McMartin <email@example.com> Cc: Benjamin Herrenschmidt <firstname.lastname@example.org> Cc: Martin Schwidefsky <email@example.com> Cc: "David S. Miller" <firstname.lastname@example.org> Cc: Jeff Dike <email@example.com> Cc: Greg KH <firstname.lastname@example.org> Cc: Jens Axboe <email@example.com> Cc: Paul Fulghum <firstname.lastname@example.org> Cc: Alan Cox <email@example.com> Cc: Karsten Keil <firstname.lastname@example.org> Cc: Mauro Carvalho Chehab <email@example.com> Cc: Jeff Garzik <firstname.lastname@example.org> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Ian Kent <email@example.com> Cc: Steven French <firstname.lastname@example.org> Cc: David Woodhouse <email@example.com> Cc: Neil Brown <firstname.lastname@example.org> Cc: Jaroslav Kysela <email@example.com> Cc: Takashi Iwai <firstname.lastname@example.org> Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!