From: Linus Torvalds Date: Wed, 10 Oct 2012 02:15:20 +0000 (+0900) Subject: Merge branch 'for-linus-37rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml X-Git-Tag: v3.7-rc1~65 X-Git-Url: https://repo.jachan.dev/linux.git/commitdiff_plain/f59b51fe3d3092c08d7d554ecb40db24011b2ebc?hp=-c Merge branch 'for-linus-37rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml Pull UML changes from Richard Weinberger: "UML receives this time only cleanups. The most outstanding change is the 'include "foo.h"' do 'include ' conversion done by Al Viro. It touches many files, that's why the diffstat is rather big." * 'for-linus-37rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: typo in UserModeLinux-HOWTO hppfs: fix the return value of get_inode() hostfs: drop vmtruncate um: get rid of pointless include "..." where include <...> will do um: move sysrq.h out of include/shared um/x86: merge 32 and 64 bit variants of ptrace.h um/x86: merge 32 and 64bit variants of checksum.h --- f59b51fe3d3092c08d7d554ecb40db24011b2ebc diff --combined arch/um/drivers/line.c index 457475f98414,b8e841c128aa..fd9a15b318af --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@@ -3,15 -3,15 +3,15 @@@ * Licensed under the GPL */ - #include "linux/irqreturn.h" - #include "linux/kd.h" - #include "linux/sched.h" - #include "linux/slab.h" + #include + #include + #include + #include #include "chan.h" - #include "irq_kern.h" - #include "irq_user.h" - #include "kern_util.h" - #include "os.h" + #include + #include + #include + #include #define LINE_BUFSIZE 4096 @@@ -409,8 -409,7 +409,8 @@@ int setup_one_line(struct line *lines, line->valid = 1; err = parse_chan_pair(new, line, n, opts, error_out); if (!err) { - struct device *d = tty_register_device(driver, n, NULL); + struct device *d = tty_port_register_device(&line->port, + driver, n, NULL); if (IS_ERR(d)) { *error_out = "Failed to register device"; err = PTR_ERR(d); diff --combined arch/um/drivers/mconsole_kern.c index 9efeb6da48bc,25e63fdd8028..79ccfe6c7078 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c @@@ -21,19 -21,16 +21,19 @@@ #include #include #include +#include +#include +#include #include #include - #include "init.h" - #include "irq_kern.h" - #include "irq_user.h" - #include "kern_util.h" + #include + #include + #include + #include #include "mconsole.h" #include "mconsole_kern.h" - #include "os.h" + #include static int do_unlink_socket(struct notifier_block *notifier, unsigned long what, void *data) @@@ -121,38 -118,90 +121,38 @@@ void mconsole_log(struct mc_request *re mconsole_reply(req, "", 0, 0); } -/* This is a more convoluted version of mconsole_proc, which has some stability - * problems; however, we need it fixed, because it is expected that UML users - * mount HPPFS instead of procfs on /proc. And we want mconsole_proc to still - * show the real procfs content, not the ones from hppfs.*/ -#if 0 void mconsole_proc(struct mc_request *req) { struct vfsmount *mnt = current->nsproxy->pid_ns->proc_mnt; - struct file *file; - int n; - char *ptr = req->request.data, *buf; - mm_segment_t old_fs = get_fs(); - - ptr += strlen("proc"); - ptr = skip_spaces(ptr); - - file = file_open_root(mnt->mnt_root, mnt, ptr, O_RDONLY); - if (IS_ERR(file)) { - mconsole_reply(req, "Failed to open file", 1, 0); - goto out; - } - - buf = kmalloc(PAGE_SIZE, GFP_KERNEL); - if (buf == NULL) { - mconsole_reply(req, "Failed to allocate buffer", 1, 0); - goto out_fput; - } - - if (file->f_op->read) { - do { - loff_t pos; - set_fs(KERNEL_DS); - n = vfs_read(file, buf, PAGE_SIZE - 1, &pos); - file_pos_write(file, pos); - set_fs(old_fs); - if (n >= 0) { - buf[n] = '\0'; - mconsole_reply(req, buf, 0, (n > 0)); - } - else { - mconsole_reply(req, "Read of file failed", - 1, 0); - goto out_free; - } - } while (n > 0); - } - else mconsole_reply(req, "", 0, 0); - - out_free: - kfree(buf); - out_fput: - fput(file); - out: ; -} -#endif - -void mconsole_proc(struct mc_request *req) -{ - char path[64]; char *buf; int len; - int fd; + struct file *file; int first_chunk = 1; char *ptr = req->request.data; ptr += strlen("proc"); ptr = skip_spaces(ptr); - snprintf(path, sizeof(path), "/proc/%s", ptr); - fd = sys_open(path, 0, 0); - if (fd < 0) { + file = file_open_root(mnt->mnt_root, mnt, ptr, O_RDONLY); + if (IS_ERR(file)) { mconsole_reply(req, "Failed to open file", 1, 0); - printk(KERN_ERR "open %s: %d\n",path,fd); + printk(KERN_ERR "open /proc/%s: %ld\n", ptr, PTR_ERR(file)); goto out; } buf = kmalloc(PAGE_SIZE, GFP_KERNEL); if (buf == NULL) { mconsole_reply(req, "Failed to allocate buffer", 1, 0); - goto out_close; + goto out_fput; } - for (;;) { - len = sys_read(fd, buf, PAGE_SIZE-1); + do { + loff_t pos; + mm_segment_t old_fs = get_fs(); + set_fs(KERNEL_DS); + len = vfs_read(file, buf, PAGE_SIZE - 1, &pos); + set_fs(old_fs); + file->f_pos = pos; if (len < 0) { mconsole_reply(req, "Read of file failed", 1, 0); goto out_free; @@@ -162,14 -211,22 +162,14 @@@ mconsole_reply(req, "\n", 0, 1); first_chunk = 0; } - if (len == PAGE_SIZE-1) { - buf[len] = '\0'; - mconsole_reply(req, buf, 0, 1); - } else { - buf[len] = '\0'; - mconsole_reply(req, buf, 0, 0); - break; - } - } - + buf[len] = '\0'; + mconsole_reply(req, buf, 0, (len > 0)); + } while (len > 0); out_free: kfree(buf); - out_close: - sys_close(fd); - out: - /* nothing */; + out_fput: + fput(file); + out: ; } #define UML_MCONSOLE_HELPTEXT \ @@@ -648,7 -705,6 +648,7 @@@ static void stack_proc(void *arg struct task_struct *from = current, *to = arg; to->thread.saved_task = from; + rcu_switch(from, to); switch_to(from, to, from); } diff --combined arch/um/kernel/trap.c index 0f00e9c82080,cf7585fbc9fa..089f3987e273 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c @@@ -10,11 -10,11 +10,11 @@@ #include #include #include - #include "arch.h" - #include "as-layout.h" - #include "kern_util.h" - #include "os.h" - #include "skas.h" + #include + #include + #include + #include + #include /* * Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by @@@ -89,7 -89,6 +89,7 @@@ good_area current->min_flt++; if (fault & VM_FAULT_RETRY) { flags &= ~FAULT_FLAG_ALLOW_RETRY; + flags |= FAULT_FLAG_TRIED; goto retry; } diff --combined fs/hostfs/hostfs_kern.c index 6c9f3a9d5e21,3c423c746b59..457addc5c91f --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@@ -16,8 -16,8 +16,8 @@@ #include #include #include "hostfs.h" - #include "init.h" - #include "kern.h" + #include + #include struct hostfs_inode_info { int fd; @@@ -542,8 -542,8 +542,8 @@@ static int read_name(struct inode *ino ino->i_ino = st.ino; ino->i_mode = st.mode; set_nlink(ino, st.nlink); - ino->i_uid = st.uid; - ino->i_gid = st.gid; + i_uid_write(ino, st.uid); + i_gid_write(ino, st.gid); ino->i_atime = st.atime; ino->i_mtime = st.mtime; ino->i_ctime = st.ctime; @@@ -808,11 -808,11 +808,11 @@@ int hostfs_setattr(struct dentry *dentr } if (attr->ia_valid & ATTR_UID) { attrs.ia_valid |= HOSTFS_ATTR_UID; - attrs.ia_uid = attr->ia_uid; + attrs.ia_uid = from_kuid(&init_user_ns, attr->ia_uid); } if (attr->ia_valid & ATTR_GID) { attrs.ia_valid |= HOSTFS_ATTR_GID; - attrs.ia_gid = attr->ia_gid; + attrs.ia_gid = from_kgid(&init_user_ns, attr->ia_gid); } if (attr->ia_valid & ATTR_SIZE) { attrs.ia_valid |= HOSTFS_ATTR_SIZE; @@@ -848,9 -848,11 +848,11 @@@ attr->ia_size != i_size_read(inode)) { int error; - error = vmtruncate(inode, attr->ia_size); - if (err) - return err; + error = inode_newsize_ok(inode, attr->ia_size); + if (error) + return error; + + truncate_setsize(inode, attr->ia_size); } setattr_copy(inode, attr);