aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:42:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:42:52 -0400
commit17bb51d56cdc8cbf252031db3107de034cfeb44c (patch)
treef9fb2c16b29a152d3413fa0028e660e3b6146584 /fs
parent0671b7674f42ab3a200401ea0e48d6f47d34acae (diff)
parent95aac7b1cd224f568fb83937044cd303ff11b029 (diff)
Merge branch 'akpm-incoming-2'
* akpm-incoming-2: (139 commits) epoll: make epoll_wait() use the hrtimer range feature select: rename estimate_accuracy() to select_estimate_accuracy() Remove duplicate includes from many files ramoops: use the platform data structure instead of module params kernel/resource.c: handle reinsertion of an already-inserted resource kfifo: fix kfifo_alloc() to return a signed int value w1: don't allow arbitrary users to remove w1 devices alpha: remove dma64_addr_t usage mips: remove dma64_addr_t usage sparc: remove dma64_addr_t usage fuse: use release_pages() taskstats: use real microsecond granularity for CPU times taskstats: split fill_pid function taskstats: separate taskstats commands delayacct: align to 8 byte boundary on 64-bit systems delay-accounting: reimplement -c for getdelays.c to report information on a target command namespaces Kconfig: move namespace menu location after the cgroup namespaces Kconfig: remove the cgroup device whitelist experimental tag namespaces Kconfig: remove pointless cgroup dependency namespaces Kconfig: make namespace a submenu ...
Diffstat (limited to 'fs')
-rw-r--r--fs/Kconfig.binfmt4
-rw-r--r--fs/eventpoll.c35
-rw-r--r--fs/exec.c168
-rw-r--r--fs/fuse/dev.c7
-rw-r--r--fs/isofs/inode.c40
-rw-r--r--fs/proc/base.c8
-rw-r--r--fs/proc/softirqs.c4
-rw-r--r--fs/proc/stat.c14
-rw-r--r--fs/proc/task_mmu.c6
-rw-r--r--fs/select.c6
10 files changed, 181 insertions, 111 deletions
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index bb4cc5b8abc8..79e2ca7973b7 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -42,7 +42,7 @@ config BINFMT_ELF_FDPIC
42 42
43config CORE_DUMP_DEFAULT_ELF_HEADERS 43config CORE_DUMP_DEFAULT_ELF_HEADERS
44 bool "Write ELF core dumps with partial segments" 44 bool "Write ELF core dumps with partial segments"
45 default n 45 default y
46 depends on BINFMT_ELF && ELF_CORE 46 depends on BINFMT_ELF && ELF_CORE
47 help 47 help
48 ELF core dump files describe each memory mapping of the crashed 48 ELF core dump files describe each memory mapping of the crashed
@@ -60,7 +60,7 @@ config CORE_DUMP_DEFAULT_ELF_HEADERS
60 inherited. See Documentation/filesystems/proc.txt for details. 60 inherited. See Documentation/filesystems/proc.txt for details.
61 61
62 This config option changes the default setting of coredump_filter 62 This config option changes the default setting of coredump_filter
63 seen at boot time. If unsure, say N. 63 seen at boot time. If unsure, say Y.
64 64
65config BINFMT_FLAT 65config BINFMT_FLAT
66 bool "Kernel support for flat binaries" 66 bool "Kernel support for flat binaries"
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 256bb7bb102a..8cf07242067d 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -77,9 +77,6 @@
77/* Maximum number of nesting allowed inside epoll sets */ 77/* Maximum number of nesting allowed inside epoll sets */
78#define EP_MAX_NESTS 4 78#define EP_MAX_NESTS 4
79 79
80/* Maximum msec timeout value storeable in a long int */
81#define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, (LONG_MAX - 999ULL) / HZ)
82
83#define EP_MAX_EVENTS (INT_MAX / sizeof(struct epoll_event)) 80#define EP_MAX_EVENTS (INT_MAX / sizeof(struct epoll_event))
84 81
85#define EP_UNACTIVE_PTR ((void *) -1L) 82#define EP_UNACTIVE_PTR ((void *) -1L)
@@ -1117,18 +1114,22 @@ static int ep_send_events(struct eventpoll *ep,
1117static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, 1114static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
1118 int maxevents, long timeout) 1115 int maxevents, long timeout)
1119{ 1116{
1120 int res, eavail; 1117 int res, eavail, timed_out = 0;
1121 unsigned long flags; 1118 unsigned long flags;
1122 long jtimeout; 1119 long slack;
1123 wait_queue_t wait; 1120 wait_queue_t wait;
1124 1121 struct timespec end_time;
1125 /* 1122 ktime_t expires, *to = NULL;
1126 * Calculate the timeout by checking for the "infinite" value (-1) 1123
1127 * and the overflow condition. The passed timeout is in milliseconds, 1124 if (timeout > 0) {
1128 * that why (t * HZ) / 1000. 1125 ktime_get_ts(&end_time);
1129 */ 1126 timespec_add_ns(&end_time, (u64)timeout * NSEC_PER_MSEC);
1130 jtimeout = (timeout < 0 || timeout >= EP_MAX_MSTIMEO) ? 1127 slack = select_estimate_accuracy(&end_time);
1131 MAX_SCHEDULE_TIMEOUT : (timeout * HZ + 999) / 1000; 1128 to = &expires;
1129 *to = timespec_to_ktime(end_time);
1130 } else if (timeout == 0) {
1131 timed_out = 1;
1132 }
1132 1133
1133retry: 1134retry:
1134 spin_lock_irqsave(&ep->lock, flags); 1135 spin_lock_irqsave(&ep->lock, flags);
@@ -1150,7 +1151,7 @@ retry:
1150 * to TASK_INTERRUPTIBLE before doing the checks. 1151 * to TASK_INTERRUPTIBLE before doing the checks.
1151 */ 1152 */
1152 set_current_state(TASK_INTERRUPTIBLE); 1153 set_current_state(TASK_INTERRUPTIBLE);
1153 if (!list_empty(&ep->rdllist) || !jtimeout) 1154 if (!list_empty(&ep->rdllist) || timed_out)
1154 break; 1155 break;
1155 if (signal_pending(current)) { 1156 if (signal_pending(current)) {
1156 res = -EINTR; 1157 res = -EINTR;
@@ -1158,7 +1159,9 @@ retry:
1158 } 1159 }
1159 1160
1160 spin_unlock_irqrestore(&ep->lock, flags); 1161 spin_unlock_irqrestore(&ep->lock, flags);
1161 jtimeout = schedule_timeout(jtimeout); 1162 if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))
1163 timed_out = 1;
1164
1162 spin_lock_irqsave(&ep->lock, flags); 1165 spin_lock_irqsave(&ep->lock, flags);
1163 } 1166 }
1164 __remove_wait_queue(&ep->wq, &wait); 1167 __remove_wait_queue(&ep->wq, &wait);
@@ -1176,7 +1179,7 @@ retry:
1176 * more luck. 1179 * more luck.
1177 */ 1180 */
1178 if (!res && eavail && 1181 if (!res && eavail &&
1179 !(res = ep_send_events(ep, events, maxevents)) && jtimeout) 1182 !(res = ep_send_events(ep, events, maxevents)) && !timed_out)
1180 goto retry; 1183 goto retry;
1181 1184
1182 return res; 1185 return res;
diff --git a/fs/exec.c b/fs/exec.c
index 3aa75b8888a1..99d33a1371e9 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -66,6 +66,12 @@ char core_pattern[CORENAME_MAX_SIZE] = "core";
66unsigned int core_pipe_limit; 66unsigned int core_pipe_limit;
67int suid_dumpable = 0; 67int suid_dumpable = 0;
68 68
69struct core_name {
70 char *corename;
71 int used, size;
72};
73static atomic_t call_count = ATOMIC_INIT(1);
74
69/* The maximal length of core_pattern is also specified in sysctl.c */ 75/* The maximal length of core_pattern is also specified in sysctl.c */
70 76
71static LIST_HEAD(formats); 77static LIST_HEAD(formats);
@@ -1003,7 +1009,7 @@ int flush_old_exec(struct linux_binprm * bprm)
1003 1009
1004 bprm->mm = NULL; /* We're using it now */ 1010 bprm->mm = NULL; /* We're using it now */
1005 1011
1006 current->flags &= ~PF_RANDOMIZE; 1012 current->flags &= ~(PF_RANDOMIZE | PF_KTHREAD);
1007 flush_thread(); 1013 flush_thread();
1008 current->personality &= ~bprm->per_clear; 1014 current->personality &= ~bprm->per_clear;
1009 1015
@@ -1083,14 +1089,14 @@ EXPORT_SYMBOL(setup_new_exec);
1083 */ 1089 */
1084int prepare_bprm_creds(struct linux_binprm *bprm) 1090int prepare_bprm_creds(struct linux_binprm *bprm)
1085{ 1091{
1086 if (mutex_lock_interruptible(&current->cred_guard_mutex)) 1092 if (mutex_lock_interruptible(&current->signal->cred_guard_mutex))
1087 return -ERESTARTNOINTR; 1093 return -ERESTARTNOINTR;
1088 1094
1089 bprm->cred = prepare_exec_creds(); 1095 bprm->cred = prepare_exec_creds();
1090 if (likely(bprm->cred)) 1096 if (likely(bprm->cred))
1091 return 0; 1097 return 0;
1092 1098
1093 mutex_unlock(&current->cred_guard_mutex); 1099 mutex_unlock(&current->signal->cred_guard_mutex);
1094 return -ENOMEM; 1100 return -ENOMEM;
1095} 1101}
1096 1102
@@ -1098,7 +1104,7 @@ void free_bprm(struct linux_binprm *bprm)
1098{ 1104{
1099 free_arg_pages(bprm); 1105 free_arg_pages(bprm);
1100 if (bprm->cred) { 1106 if (bprm->cred) {
1101 mutex_unlock(&current->cred_guard_mutex); 1107 mutex_unlock(&current->signal->cred_guard_mutex);
1102 abort_creds(bprm->cred); 1108 abort_creds(bprm->cred);
1103 } 1109 }
1104 kfree(bprm); 1110 kfree(bprm);
@@ -1119,13 +1125,13 @@ void install_exec_creds(struct linux_binprm *bprm)
1119 * credentials; any time after this it may be unlocked. 1125 * credentials; any time after this it may be unlocked.
1120 */ 1126 */
1121 security_bprm_committed_creds(bprm); 1127 security_bprm_committed_creds(bprm);
1122 mutex_unlock(&current->cred_guard_mutex); 1128 mutex_unlock(&current->signal->cred_guard_mutex);
1123} 1129}
1124EXPORT_SYMBOL(install_exec_creds); 1130EXPORT_SYMBOL(install_exec_creds);
1125 1131
1126/* 1132/*
1127 * determine how safe it is to execute the proposed program 1133 * determine how safe it is to execute the proposed program
1128 * - the caller must hold current->cred_guard_mutex to protect against 1134 * - the caller must hold ->cred_guard_mutex to protect against
1129 * PTRACE_ATTACH 1135 * PTRACE_ATTACH
1130 */ 1136 */
1131int check_unsafe_exec(struct linux_binprm *bprm) 1137int check_unsafe_exec(struct linux_binprm *bprm)
@@ -1406,7 +1412,6 @@ int do_execve(const char * filename,
1406 if (retval < 0) 1412 if (retval < 0)
1407 goto out; 1413 goto out;
1408 1414
1409 current->flags &= ~PF_KTHREAD;
1410 retval = search_binary_handler(bprm,regs); 1415 retval = search_binary_handler(bprm,regs);
1411 if (retval < 0) 1416 if (retval < 0)
1412 goto out; 1417 goto out;
@@ -1459,127 +1464,148 @@ void set_binfmt(struct linux_binfmt *new)
1459 1464
1460EXPORT_SYMBOL(set_binfmt); 1465EXPORT_SYMBOL(set_binfmt);
1461 1466
1467static int expand_corename(struct core_name *cn)
1468{
1469 char *old_corename = cn->corename;
1470
1471 cn->size = CORENAME_MAX_SIZE * atomic_inc_return(&call_count);
1472 cn->corename = krealloc(old_corename, cn->size, GFP_KERNEL);
1473
1474 if (!cn->corename) {
1475 kfree(old_corename);
1476 return -ENOMEM;
1477 }
1478
1479 return 0;
1480}
1481
1482static int cn_printf(struct core_name *cn, const char *fmt, ...)
1483{
1484 char *cur;
1485 int need;
1486 int ret;
1487 va_list arg;
1488
1489 va_start(arg, fmt);
1490 need = vsnprintf(NULL, 0, fmt, arg);
1491 va_end(arg);
1492
1493 if (likely(need < cn->size - cn->used - 1))
1494 goto out_printf;
1495
1496 ret = expand_corename(cn);
1497 if (ret)
1498 goto expand_fail;
1499
1500out_printf:
1501 cur = cn->corename + cn->used;
1502 va_start(arg, fmt);
1503 vsnprintf(cur, need + 1, fmt, arg);
1504 va_end(arg);
1505 cn->used += need;
1506 return 0;
1507
1508expand_fail:
1509 return ret;
1510}
1511
1462/* format_corename will inspect the pattern parameter, and output a 1512/* format_corename will inspect the pattern parameter, and output a
1463 * name into corename, which must have space for at least 1513 * name into corename, which must have space for at least
1464 * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. 1514 * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
1465 */ 1515 */
1466static int format_corename(char *corename, long signr) 1516static int format_corename(struct core_name *cn, long signr)
1467{ 1517{
1468 const struct cred *cred = current_cred(); 1518 const struct cred *cred = current_cred();
1469 const char *pat_ptr = core_pattern; 1519 const char *pat_ptr = core_pattern;
1470 int ispipe = (*pat_ptr == '|'); 1520 int ispipe = (*pat_ptr == '|');
1471 char *out_ptr = corename;
1472 char *const out_end = corename + CORENAME_MAX_SIZE;
1473 int rc;
1474 int pid_in_pattern = 0; 1521 int pid_in_pattern = 0;
1522 int err = 0;
1523
1524 cn->size = CORENAME_MAX_SIZE * atomic_read(&call_count);
1525 cn->corename = kmalloc(cn->size, GFP_KERNEL);
1526 cn->used = 0;
1527
1528 if (!cn->corename)
1529 return -ENOMEM;
1475 1530
1476 /* Repeat as long as we have more pattern to process and more output 1531 /* Repeat as long as we have more pattern to process and more output
1477 space */ 1532 space */
1478 while (*pat_ptr) { 1533 while (*pat_ptr) {
1479 if (*pat_ptr != '%') { 1534 if (*pat_ptr != '%') {
1480 if (out_ptr == out_end) 1535 if (*pat_ptr == 0)
1481 goto out; 1536 goto out;
1482 *out_ptr++ = *pat_ptr++; 1537 err = cn_printf(cn, "%c", *pat_ptr++);
1483 } else { 1538 } else {
1484 switch (*++pat_ptr) { 1539 switch (*++pat_ptr) {
1540 /* single % at the end, drop that */
1485 case 0: 1541 case 0:
1486 goto out; 1542 goto out;
1487 /* Double percent, output one percent */ 1543 /* Double percent, output one percent */
1488 case '%': 1544 case '%':
1489 if (out_ptr == out_end) 1545 err = cn_printf(cn, "%c", '%');
1490 goto out;
1491 *out_ptr++ = '%';
1492 break; 1546 break;
1493 /* pid */ 1547 /* pid */
1494 case 'p': 1548 case 'p':
1495 pid_in_pattern = 1; 1549 pid_in_pattern = 1;
1496 rc = snprintf(out_ptr, out_end - out_ptr, 1550 err = cn_printf(cn, "%d",
1497 "%d", task_tgid_vnr(current)); 1551 task_tgid_vnr(current));
1498 if (rc > out_end - out_ptr)
1499 goto out;
1500 out_ptr += rc;
1501 break; 1552 break;
1502 /* uid */ 1553 /* uid */
1503 case 'u': 1554 case 'u':
1504 rc = snprintf(out_ptr, out_end - out_ptr, 1555 err = cn_printf(cn, "%d", cred->uid);
1505 "%d", cred->uid);
1506 if (rc > out_end - out_ptr)
1507 goto out;
1508 out_ptr += rc;
1509 break; 1556 break;
1510 /* gid */ 1557 /* gid */
1511 case 'g': 1558 case 'g':
1512 rc = snprintf(out_ptr, out_end - out_ptr, 1559 err = cn_printf(cn, "%d", cred->gid);
1513 "%d", cred->gid);
1514 if (rc > out_end - out_ptr)
1515 goto out;
1516 out_ptr += rc;
1517 break; 1560 break;
1518 /* signal that caused the coredump */ 1561 /* signal that caused the coredump */
1519 case 's': 1562 case 's':
1520 rc = snprintf(out_ptr, out_end - out_ptr, 1563 err = cn_printf(cn, "%ld", signr);
1521 "%ld", signr);
1522 if (rc > out_end - out_ptr)
1523 goto out;
1524 out_ptr += rc;
1525 break; 1564 break;
1526 /* UNIX time of coredump */ 1565 /* UNIX time of coredump */
1527 case 't': { 1566 case 't': {
1528 struct timeval tv; 1567 struct timeval tv;
1529 do_gettimeofday(&tv); 1568 do_gettimeofday(&tv);
1530 rc = snprintf(out_ptr, out_end - out_ptr, 1569 err = cn_printf(cn, "%lu", tv.tv_sec);
1531 "%lu", tv.tv_sec);
1532 if (rc > out_end - out_ptr)
1533 goto out;
1534 out_ptr += rc;
1535 break; 1570 break;
1536 } 1571 }
1537 /* hostname */ 1572 /* hostname */
1538 case 'h': 1573 case 'h':
1539 down_read(&uts_sem); 1574 down_read(&uts_sem);
1540 rc = snprintf(out_ptr, out_end - out_ptr, 1575 err = cn_printf(cn, "%s",
1541 "%s", utsname()->nodename); 1576 utsname()->nodename);
1542 up_read(&uts_sem); 1577 up_read(&uts_sem);
1543 if (rc > out_end - out_ptr)
1544 goto out;
1545 out_ptr += rc;
1546 break; 1578 break;
1547 /* executable */ 1579 /* executable */
1548 case 'e': 1580 case 'e':
1549 rc = snprintf(out_ptr, out_end - out_ptr, 1581 err = cn_printf(cn, "%s", current->comm);
1550 "%s", current->comm);
1551 if (rc > out_end - out_ptr)
1552 goto out;
1553 out_ptr += rc;
1554 break; 1582 break;
1555 /* core limit size */ 1583 /* core limit size */
1556 case 'c': 1584 case 'c':
1557 rc = snprintf(out_ptr, out_end - out_ptr, 1585 err = cn_printf(cn, "%lu",
1558 "%lu", rlimit(RLIMIT_CORE)); 1586 rlimit(RLIMIT_CORE));
1559 if (rc > out_end - out_ptr)
1560 goto out;
1561 out_ptr += rc;
1562 break; 1587 break;
1563 default: 1588 default:
1564 break; 1589 break;
1565 } 1590 }
1566 ++pat_ptr; 1591 ++pat_ptr;
1567 } 1592 }
1593
1594 if (err)
1595 return err;
1568 } 1596 }
1597
1569 /* Backward compatibility with core_uses_pid: 1598 /* Backward compatibility with core_uses_pid:
1570 * 1599 *
1571 * If core_pattern does not include a %p (as is the default) 1600 * If core_pattern does not include a %p (as is the default)
1572 * and core_uses_pid is set, then .%pid will be appended to 1601 * and core_uses_pid is set, then .%pid will be appended to
1573 * the filename. Do not do this for piped commands. */ 1602 * the filename. Do not do this for piped commands. */
1574 if (!ispipe && !pid_in_pattern && core_uses_pid) { 1603 if (!ispipe && !pid_in_pattern && core_uses_pid) {
1575 rc = snprintf(out_ptr, out_end - out_ptr, 1604 err = cn_printf(cn, ".%d", task_tgid_vnr(current));
1576 ".%d", task_tgid_vnr(current)); 1605 if (err)
1577 if (rc > out_end - out_ptr) 1606 return err;
1578 goto out;
1579 out_ptr += rc;
1580 } 1607 }
1581out: 1608out:
1582 *out_ptr = 0;
1583 return ispipe; 1609 return ispipe;
1584} 1610}
1585 1611
@@ -1856,7 +1882,7 @@ static int umh_pipe_setup(struct subprocess_info *info)
1856void do_coredump(long signr, int exit_code, struct pt_regs *regs) 1882void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1857{ 1883{
1858 struct core_state core_state; 1884 struct core_state core_state;
1859 char corename[CORENAME_MAX_SIZE + 1]; 1885 struct core_name cn;
1860 struct mm_struct *mm = current->mm; 1886 struct mm_struct *mm = current->mm;
1861 struct linux_binfmt * binfmt; 1887 struct linux_binfmt * binfmt;
1862 const struct cred *old_cred; 1888 const struct cred *old_cred;
@@ -1911,7 +1937,13 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1911 */ 1937 */
1912 clear_thread_flag(TIF_SIGPENDING); 1938 clear_thread_flag(TIF_SIGPENDING);
1913 1939
1914 ispipe = format_corename(corename, signr); 1940 ispipe = format_corename(&cn, signr);
1941
1942 if (ispipe == -ENOMEM) {
1943 printk(KERN_WARNING "format_corename failed\n");
1944 printk(KERN_WARNING "Aborting core\n");
1945 goto fail_corename;
1946 }
1915 1947
1916 if (ispipe) { 1948 if (ispipe) {
1917 int dump_count; 1949 int dump_count;
@@ -1948,7 +1980,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1948 goto fail_dropcount; 1980 goto fail_dropcount;
1949 } 1981 }
1950 1982
1951 helper_argv = argv_split(GFP_KERNEL, corename+1, NULL); 1983 helper_argv = argv_split(GFP_KERNEL, cn.corename+1, NULL);
1952 if (!helper_argv) { 1984 if (!helper_argv) {
1953 printk(KERN_WARNING "%s failed to allocate memory\n", 1985 printk(KERN_WARNING "%s failed to allocate memory\n",
1954 __func__); 1986 __func__);
@@ -1961,7 +1993,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1961 argv_free(helper_argv); 1993 argv_free(helper_argv);
1962 if (retval) { 1994 if (retval) {
1963 printk(KERN_INFO "Core dump to %s pipe failed\n", 1995 printk(KERN_INFO "Core dump to %s pipe failed\n",
1964 corename); 1996 cn.corename);
1965 goto close_fail; 1997 goto close_fail;
1966 } 1998 }
1967 } else { 1999 } else {
@@ -1970,7 +2002,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1970 if (cprm.limit < binfmt->min_coredump) 2002 if (cprm.limit < binfmt->min_coredump)
1971 goto fail_unlock; 2003 goto fail_unlock;
1972 2004
1973 cprm.file = filp_open(corename, 2005 cprm.file = filp_open(cn.corename,
1974 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag, 2006 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
1975 0600); 2007 0600);
1976 if (IS_ERR(cprm.file)) 2008 if (IS_ERR(cprm.file))
@@ -2012,6 +2044,8 @@ fail_dropcount:
2012 if (ispipe) 2044 if (ispipe)
2013 atomic_dec(&core_dump_count); 2045 atomic_dec(&core_dump_count);
2014fail_unlock: 2046fail_unlock:
2047 kfree(cn.corename);
2048fail_corename:
2015 coredump_finish(mm); 2049 coredump_finish(mm);
2016 revert_creds(old_cred); 2050 revert_creds(old_cred);
2017fail_creds: 2051fail_creds:
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index b98664275f02..6e07696308dc 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1334,12 +1334,7 @@ out_finish:
1334 1334
1335static void fuse_retrieve_end(struct fuse_conn *fc, struct fuse_req *req) 1335static void fuse_retrieve_end(struct fuse_conn *fc, struct fuse_req *req)
1336{ 1336{
1337 int i; 1337 release_pages(req->pages, req->num_pages, 0);
1338
1339 for (i = 0; i < req->num_pages; i++) {
1340 struct page *page = req->pages[i];
1341 page_cache_release(page);
1342 }
1343} 1338}
1344 1339
1345static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, 1340static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 60c2b944d762..79cf7f616bbe 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -544,6 +544,34 @@ static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
544} 544}
545 545
546/* 546/*
547 * Check if root directory is empty (has less than 3 files).
548 *
549 * Used to detect broken CDs where ISO root directory is empty but Joliet root
550 * directory is OK. If such CD has Rock Ridge extensions, they will be disabled
551 * (and Joliet used instead) or else no files would be visible.
552 */
553static bool rootdir_empty(struct super_block *sb, unsigned long block)
554{
555 int offset = 0, files = 0, de_len;
556 struct iso_directory_record *de;
557 struct buffer_head *bh;
558
559 bh = sb_bread(sb, block);
560 if (!bh)
561 return true;
562 while (files < 3) {
563 de = (struct iso_directory_record *) (bh->b_data + offset);
564 de_len = *(unsigned char *) de;
565 if (de_len == 0)
566 break;
567 files++;
568 offset += de_len;
569 }
570 brelse(bh);
571 return files < 3;
572}
573
574/*
547 * Initialize the superblock and read the root inode. 575 * Initialize the superblock and read the root inode.
548 * 576 *
549 * Note: a check_disk_change() has been done immediately prior 577 * Note: a check_disk_change() has been done immediately prior
@@ -843,6 +871,18 @@ root_found:
843 goto out_no_root; 871 goto out_no_root;
844 872
845 /* 873 /*
874 * Fix for broken CDs with Rock Ridge and empty ISO root directory but
875 * correct Joliet root directory.
876 */
877 if (sbi->s_rock == 1 && joliet_level &&
878 rootdir_empty(s, sbi->s_firstdatazone)) {
879 printk(KERN_NOTICE
880 "ISOFS: primary root directory is empty. "
881 "Disabling Rock Ridge and switching to Joliet.");
882 sbi->s_rock = 0;
883 }
884
885 /*
846 * If this disk has both Rock Ridge and Joliet on it, then we 886 * If this disk has both Rock Ridge and Joliet on it, then we
847 * want to use Rock Ridge by default. This can be overridden 887 * want to use Rock Ridge by default. This can be overridden
848 * by using the norock mount option. There is still one other 888 * by using the norock mount option. There is still one other
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 9b094c1c8465..f3d02ca461ec 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -226,7 +226,7 @@ struct mm_struct *mm_for_maps(struct task_struct *task)
226{ 226{
227 struct mm_struct *mm; 227 struct mm_struct *mm;
228 228
229 if (mutex_lock_killable(&task->cred_guard_mutex)) 229 if (mutex_lock_killable(&task->signal->cred_guard_mutex))
230 return NULL; 230 return NULL;
231 231
232 mm = get_task_mm(task); 232 mm = get_task_mm(task);
@@ -235,7 +235,7 @@ struct mm_struct *mm_for_maps(struct task_struct *task)
235 mmput(mm); 235 mmput(mm);
236 mm = NULL; 236 mm = NULL;
237 } 237 }
238 mutex_unlock(&task->cred_guard_mutex); 238 mutex_unlock(&task->signal->cred_guard_mutex);
239 239
240 return mm; 240 return mm;
241} 241}
@@ -2354,14 +2354,14 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
2354 goto out_free; 2354 goto out_free;
2355 2355
2356 /* Guard against adverse ptrace interaction */ 2356 /* Guard against adverse ptrace interaction */
2357 length = mutex_lock_interruptible(&task->cred_guard_mutex); 2357 length = mutex_lock_interruptible(&task->signal->cred_guard_mutex);
2358 if (length < 0) 2358 if (length < 0)
2359 goto out_free; 2359 goto out_free;
2360 2360
2361 length = security_setprocattr(task, 2361 length = security_setprocattr(task,
2362 (char*)file->f_path.dentry->d_name.name, 2362 (char*)file->f_path.dentry->d_name.name,
2363 (void*)page, count); 2363 (void*)page, count);
2364 mutex_unlock(&task->cred_guard_mutex); 2364 mutex_unlock(&task->signal->cred_guard_mutex);
2365out_free: 2365out_free:
2366 free_page((unsigned long) page); 2366 free_page((unsigned long) page);
2367out: 2367out:
diff --git a/fs/proc/softirqs.c b/fs/proc/softirqs.c
index 1807c2419f17..37994737c983 100644
--- a/fs/proc/softirqs.c
+++ b/fs/proc/softirqs.c
@@ -10,13 +10,13 @@ static int show_softirqs(struct seq_file *p, void *v)
10{ 10{
11 int i, j; 11 int i, j;
12 12
13 seq_printf(p, " "); 13 seq_printf(p, " ");
14 for_each_possible_cpu(i) 14 for_each_possible_cpu(i)
15 seq_printf(p, "CPU%-8d", i); 15 seq_printf(p, "CPU%-8d", i);
16 seq_printf(p, "\n"); 16 seq_printf(p, "\n");
17 17
18 for (i = 0; i < NR_SOFTIRQS; i++) { 18 for (i = 0; i < NR_SOFTIRQS; i++) {
19 seq_printf(p, "%8s:", softirq_to_name[i]); 19 seq_printf(p, "%12s:", softirq_to_name[i]);
20 for_each_possible_cpu(j) 20 for_each_possible_cpu(j)
21 seq_printf(p, " %10u", kstat_softirqs_cpu(i, j)); 21 seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
22 seq_printf(p, "\n"); 22 seq_printf(p, "\n");
diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index bf31b03fc275..e15a19c93bae 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -31,7 +31,6 @@ static int show_stat(struct seq_file *p, void *v)
31 u64 sum_softirq = 0; 31 u64 sum_softirq = 0;
32 unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; 32 unsigned int per_softirq_sums[NR_SOFTIRQS] = {0};
33 struct timespec boottime; 33 struct timespec boottime;
34 unsigned int per_irq_sum;
35 34
36 user = nice = system = idle = iowait = 35 user = nice = system = idle = iowait =
37 irq = softirq = steal = cputime64_zero; 36 irq = softirq = steal = cputime64_zero;
@@ -52,9 +51,7 @@ static int show_stat(struct seq_file *p, void *v)
52 guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); 51 guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
53 guest_nice = cputime64_add(guest_nice, 52 guest_nice = cputime64_add(guest_nice,
54 kstat_cpu(i).cpustat.guest_nice); 53 kstat_cpu(i).cpustat.guest_nice);
55 for_each_irq_nr(j) { 54 sum += kstat_cpu_irqs_sum(i);
56 sum += kstat_irqs_cpu(j, i);
57 }
58 sum += arch_irq_stat_cpu(i); 55 sum += arch_irq_stat_cpu(i);
59 56
60 for (j = 0; j < NR_SOFTIRQS; j++) { 57 for (j = 0; j < NR_SOFTIRQS; j++) {
@@ -110,13 +107,8 @@ static int show_stat(struct seq_file *p, void *v)
110 seq_printf(p, "intr %llu", (unsigned long long)sum); 107 seq_printf(p, "intr %llu", (unsigned long long)sum);
111 108
112 /* sum again ? it could be updated? */ 109 /* sum again ? it could be updated? */
113 for_each_irq_nr(j) { 110 for_each_irq_nr(j)
114 per_irq_sum = 0; 111 seq_printf(p, " %u", kstat_irqs(j));
115 for_each_possible_cpu(i)
116 per_irq_sum += kstat_irqs_cpu(j, i);
117
118 seq_printf(p, " %u", per_irq_sum);
119 }
120 112
121 seq_printf(p, 113 seq_printf(p,
122 "\nctxt %llu\n" 114 "\nctxt %llu\n"
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 871e25ed0069..da6b01d70f01 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -327,6 +327,7 @@ struct mem_size_stats {
327 unsigned long private_clean; 327 unsigned long private_clean;
328 unsigned long private_dirty; 328 unsigned long private_dirty;
329 unsigned long referenced; 329 unsigned long referenced;
330 unsigned long anonymous;
330 unsigned long swap; 331 unsigned long swap;
331 u64 pss; 332 u64 pss;
332}; 333};
@@ -357,6 +358,9 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
357 if (!page) 358 if (!page)
358 continue; 359 continue;
359 360
361 if (PageAnon(page))
362 mss->anonymous += PAGE_SIZE;
363
360 mss->resident += PAGE_SIZE; 364 mss->resident += PAGE_SIZE;
361 /* Accumulate the size in pages that have been accessed. */ 365 /* Accumulate the size in pages that have been accessed. */
362 if (pte_young(ptent) || PageReferenced(page)) 366 if (pte_young(ptent) || PageReferenced(page))
@@ -410,6 +414,7 @@ static int show_smap(struct seq_file *m, void *v)
410 "Private_Clean: %8lu kB\n" 414 "Private_Clean: %8lu kB\n"
411 "Private_Dirty: %8lu kB\n" 415 "Private_Dirty: %8lu kB\n"
412 "Referenced: %8lu kB\n" 416 "Referenced: %8lu kB\n"
417 "Anonymous: %8lu kB\n"
413 "Swap: %8lu kB\n" 418 "Swap: %8lu kB\n"
414 "KernelPageSize: %8lu kB\n" 419 "KernelPageSize: %8lu kB\n"
415 "MMUPageSize: %8lu kB\n", 420 "MMUPageSize: %8lu kB\n",
@@ -421,6 +426,7 @@ static int show_smap(struct seq_file *m, void *v)
421 mss.private_clean >> 10, 426 mss.private_clean >> 10,
422 mss.private_dirty >> 10, 427 mss.private_dirty >> 10,
423 mss.referenced >> 10, 428 mss.referenced >> 10,
429 mss.anonymous >> 10,
424 mss.swap >> 10, 430 mss.swap >> 10,
425 vma_kernel_pagesize(vma) >> 10, 431 vma_kernel_pagesize(vma) >> 10,
426 vma_mmu_pagesize(vma) >> 10); 432 vma_mmu_pagesize(vma) >> 10);
diff --git a/fs/select.c b/fs/select.c
index 500a669f7790..b7b10aa30861 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -67,7 +67,7 @@ static long __estimate_accuracy(struct timespec *tv)
67 return slack; 67 return slack;
68} 68}
69 69
70static long estimate_accuracy(struct timespec *tv) 70long select_estimate_accuracy(struct timespec *tv)
71{ 71{
72 unsigned long ret; 72 unsigned long ret;
73 struct timespec now; 73 struct timespec now;
@@ -417,7 +417,7 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
417 } 417 }
418 418
419 if (end_time && !timed_out) 419 if (end_time && !timed_out)
420 slack = estimate_accuracy(end_time); 420 slack = select_estimate_accuracy(end_time);
421 421
422 retval = 0; 422 retval = 0;
423 for (;;) { 423 for (;;) {
@@ -769,7 +769,7 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
769 } 769 }
770 770
771 if (end_time && !timed_out) 771 if (end_time && !timed_out)
772 slack = estimate_accuracy(end_time); 772 slack = select_estimate_accuracy(end_time);
773 773
774 for (;;) { 774 for (;;) {
775 struct poll_list *walk; 775 struct poll_list *walk;