diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_sysctl.c | 46 | ||||
-rw-r--r-- | ipc/mqueue.c | 3 | ||||
-rw-r--r-- | ipc/sem.c | 1 | ||||
-rw-r--r-- | ipc/shm.c | 27 |
4 files changed, 42 insertions, 35 deletions
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c index 0dfebc509426..4a7a12c95abe 100644 --- a/ipc/ipc_sysctl.c +++ b/ipc/ipc_sysctl.c | |||
@@ -26,29 +26,6 @@ static void *get_ipc(ctl_table *table) | |||
26 | return which; | 26 | return which; |
27 | } | 27 | } |
28 | 28 | ||
29 | /* | ||
30 | * Routine that is called when the file "auto_msgmni" has successfully been | ||
31 | * written. | ||
32 | * Two values are allowed: | ||
33 | * 0: unregister msgmni's callback routine from the ipc namespace notifier | ||
34 | * chain. This means that msgmni won't be recomputed anymore upon memory | ||
35 | * add/remove or ipc namespace creation/removal. | ||
36 | * 1: register back the callback routine. | ||
37 | */ | ||
38 | static void ipc_auto_callback(int val) | ||
39 | { | ||
40 | if (!val) | ||
41 | unregister_ipcns_notifier(current->nsproxy->ipc_ns); | ||
42 | else { | ||
43 | /* | ||
44 | * Re-enable automatic recomputing only if not already | ||
45 | * enabled. | ||
46 | */ | ||
47 | recompute_msgmni(current->nsproxy->ipc_ns); | ||
48 | cond_register_ipcns_notifier(current->nsproxy->ipc_ns); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | #ifdef CONFIG_PROC_FS | 29 | #ifdef CONFIG_PROC_FS |
53 | static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp, | 30 | static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp, |
54 | void __user *buffer, size_t *lenp, loff_t *ppos) | 31 | void __user *buffer, size_t *lenp, loff_t *ppos) |
@@ -94,6 +71,29 @@ static int proc_ipc_doulongvec_minmax(ctl_table *table, int write, | |||
94 | lenp, ppos); | 71 | lenp, ppos); |
95 | } | 72 | } |
96 | 73 | ||
74 | /* | ||
75 | * Routine that is called when the file "auto_msgmni" has successfully been | ||
76 | * written. | ||
77 | * Two values are allowed: | ||
78 | * 0: unregister msgmni's callback routine from the ipc namespace notifier | ||
79 | * chain. This means that msgmni won't be recomputed anymore upon memory | ||
80 | * add/remove or ipc namespace creation/removal. | ||
81 | * 1: register back the callback routine. | ||
82 | */ | ||
83 | static void ipc_auto_callback(int val) | ||
84 | { | ||
85 | if (!val) | ||
86 | unregister_ipcns_notifier(current->nsproxy->ipc_ns); | ||
87 | else { | ||
88 | /* | ||
89 | * Re-enable automatic recomputing only if not already | ||
90 | * enabled. | ||
91 | */ | ||
92 | recompute_msgmni(current->nsproxy->ipc_ns); | ||
93 | cond_register_ipcns_notifier(current->nsproxy->ipc_ns); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, | 97 | static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, |
98 | struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos) | 98 | struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos) |
99 | { | 99 | { |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index eddb6247a553..23fdb8492b8e 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -505,7 +505,8 @@ static void __do_notify(struct mqueue_inode_info *info) | |||
505 | sig_i.si_errno = 0; | 505 | sig_i.si_errno = 0; |
506 | sig_i.si_code = SI_MESGQ; | 506 | sig_i.si_code = SI_MESGQ; |
507 | sig_i.si_value = info->notify.sigev_value; | 507 | sig_i.si_value = info->notify.sigev_value; |
508 | sig_i.si_pid = task_tgid_vnr(current); | 508 | sig_i.si_pid = task_tgid_nr_ns(current, |
509 | ns_of_pid(info->notify_owner)); | ||
509 | sig_i.si_uid = current_uid(); | 510 | sig_i.si_uid = current_uid(); |
510 | 511 | ||
511 | kill_pid_info(info->notify.sigev_signo, | 512 | kill_pid_info(info->notify.sigev_signo, |
@@ -1216,7 +1216,6 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops, | |||
1216 | if (timeout && jiffies_left == 0) | 1216 | if (timeout && jiffies_left == 0) |
1217 | error = -EAGAIN; | 1217 | error = -EAGAIN; |
1218 | list_del(&queue.list); | 1218 | list_del(&queue.list); |
1219 | goto out_unlock_free; | ||
1220 | 1219 | ||
1221 | out_unlock_free: | 1220 | out_unlock_free: |
1222 | sem_unlock(sma); | 1221 | sem_unlock(sma); |
@@ -75,7 +75,7 @@ void shm_init_ns(struct ipc_namespace *ns) | |||
75 | ns->shm_ctlall = SHMALL; | 75 | ns->shm_ctlall = SHMALL; |
76 | ns->shm_ctlmni = SHMMNI; | 76 | ns->shm_ctlmni = SHMMNI; |
77 | ns->shm_tot = 0; | 77 | ns->shm_tot = 0; |
78 | ipc_init_ids(&ns->ids[IPC_SHM_IDS]); | 78 | ipc_init_ids(&shm_ids(ns)); |
79 | } | 79 | } |
80 | 80 | ||
81 | /* | 81 | /* |
@@ -644,7 +644,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) | |||
644 | if (err) | 644 | if (err) |
645 | return err; | 645 | return err; |
646 | 646 | ||
647 | memset(&shminfo,0,sizeof(shminfo)); | 647 | memset(&shminfo, 0, sizeof(shminfo)); |
648 | shminfo.shmmni = shminfo.shmseg = ns->shm_ctlmni; | 648 | shminfo.shmmni = shminfo.shmseg = ns->shm_ctlmni; |
649 | shminfo.shmmax = ns->shm_ctlmax; | 649 | shminfo.shmmax = ns->shm_ctlmax; |
650 | shminfo.shmall = ns->shm_ctlall; | 650 | shminfo.shmall = ns->shm_ctlall; |
@@ -669,7 +669,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) | |||
669 | if (err) | 669 | if (err) |
670 | return err; | 670 | return err; |
671 | 671 | ||
672 | memset(&shm_info,0,sizeof(shm_info)); | 672 | memset(&shm_info, 0, sizeof(shm_info)); |
673 | down_read(&shm_ids(ns).rw_mutex); | 673 | down_read(&shm_ids(ns).rw_mutex); |
674 | shm_info.used_ids = shm_ids(ns).in_use; | 674 | shm_info.used_ids = shm_ids(ns).in_use; |
675 | shm_get_stat (ns, &shm_info.shm_rss, &shm_info.shm_swp); | 675 | shm_get_stat (ns, &shm_info.shm_rss, &shm_info.shm_swp); |
@@ -678,7 +678,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) | |||
678 | shm_info.swap_successes = 0; | 678 | shm_info.swap_successes = 0; |
679 | err = ipc_get_maxid(&shm_ids(ns)); | 679 | err = ipc_get_maxid(&shm_ids(ns)); |
680 | up_read(&shm_ids(ns).rw_mutex); | 680 | up_read(&shm_ids(ns).rw_mutex); |
681 | if(copy_to_user (buf, &shm_info, sizeof(shm_info))) { | 681 | if (copy_to_user(buf, &shm_info, sizeof(shm_info))) { |
682 | err = -EFAULT; | 682 | err = -EFAULT; |
683 | goto out; | 683 | goto out; |
684 | } | 684 | } |
@@ -692,11 +692,6 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) | |||
692 | struct shmid64_ds tbuf; | 692 | struct shmid64_ds tbuf; |
693 | int result; | 693 | int result; |
694 | 694 | ||
695 | if (!buf) { | ||
696 | err = -EFAULT; | ||
697 | goto out; | ||
698 | } | ||
699 | |||
700 | if (cmd == SHM_STAT) { | 695 | if (cmd == SHM_STAT) { |
701 | shp = shm_lock(ns, shmid); | 696 | shp = shm_lock(ns, shmid); |
702 | if (IS_ERR(shp)) { | 697 | if (IS_ERR(shp)) { |
@@ -712,7 +707,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) | |||
712 | } | 707 | } |
713 | result = 0; | 708 | result = 0; |
714 | } | 709 | } |
715 | err=-EACCES; | 710 | err = -EACCES; |
716 | if (ipcperms (&shp->shm_perm, S_IRUGO)) | 711 | if (ipcperms (&shp->shm_perm, S_IRUGO)) |
717 | goto out_unlock; | 712 | goto out_unlock; |
718 | err = security_shm_shmctl(shp, cmd); | 713 | err = security_shm_shmctl(shp, cmd); |
@@ -995,6 +990,7 @@ asmlinkage long sys_shmdt(char __user *shmaddr) | |||
995 | */ | 990 | */ |
996 | vma = find_vma(mm, addr); | 991 | vma = find_vma(mm, addr); |
997 | 992 | ||
993 | #ifdef CONFIG_MMU | ||
998 | while (vma) { | 994 | while (vma) { |
999 | next = vma->vm_next; | 995 | next = vma->vm_next; |
1000 | 996 | ||
@@ -1039,6 +1035,17 @@ asmlinkage long sys_shmdt(char __user *shmaddr) | |||
1039 | vma = next; | 1035 | vma = next; |
1040 | } | 1036 | } |
1041 | 1037 | ||
1038 | #else /* CONFIG_MMU */ | ||
1039 | /* under NOMMU conditions, the exact address to be destroyed must be | ||
1040 | * given */ | ||
1041 | retval = -EINVAL; | ||
1042 | if (vma->vm_start == addr && vma->vm_ops == &shm_vm_ops) { | ||
1043 | do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start); | ||
1044 | retval = 0; | ||
1045 | } | ||
1046 | |||
1047 | #endif | ||
1048 | |||
1042 | up_write(&mm->mmap_sem); | 1049 | up_write(&mm->mmap_sem); |
1043 | return retval; | 1050 | return retval; |
1044 | } | 1051 | } |