aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ipc_namespace.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/ipc_namespace.h
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/linux/ipc_namespace.h')
-rw-r--r--include/linux/ipc_namespace.h52
1 files changed, 8 insertions, 44 deletions
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index ae221a7b509..8a297a5e794 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -24,7 +24,6 @@ struct ipc_ids {
24 unsigned short seq_max; 24 unsigned short seq_max;
25 struct rw_semaphore rw_mutex; 25 struct rw_semaphore rw_mutex;
26 struct idr ipcs_idr; 26 struct idr ipcs_idr;
27 int next_id;
28}; 27};
29 28
30struct ipc_namespace { 29struct ipc_namespace {
@@ -63,13 +62,9 @@ struct ipc_namespace {
63 unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */ 62 unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */
64 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ 63 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */
65 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ 64 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */
66 unsigned int mq_msg_default;
67 unsigned int mq_msgsize_default;
68 65
69 /* user_ns which owns the ipc ns */ 66 /* user_ns which owns the ipc ns */
70 struct user_namespace *user_ns; 67 struct user_namespace *user_ns;
71
72 unsigned int proc_inum;
73}; 68};
74 69
75extern struct ipc_namespace init_ipc_ns; 70extern struct ipc_namespace init_ipc_ns;
@@ -95,49 +90,18 @@ static inline void shm_destroy_orphaned(struct ipc_namespace *ns) {}
95 90
96#ifdef CONFIG_POSIX_MQUEUE 91#ifdef CONFIG_POSIX_MQUEUE
97extern int mq_init_ns(struct ipc_namespace *ns); 92extern int mq_init_ns(struct ipc_namespace *ns);
98/* 93/* default values */
99 * POSIX Message Queue default values: 94#define DFLT_QUEUESMAX 256 /* max number of message queues */
100 * 95#define DFLT_MSGMAX 10 /* max number of messages in each queue */
101 * MIN_*: Lowest value an admin can set the maximum unprivileged limit to 96#define HARD_MSGMAX (32768*sizeof(void *)/4)
102 * DFLT_*MAX: Default values for the maximum unprivileged limits 97#define DFLT_MSGSIZEMAX 8192 /* max message size */
103 * DFLT_{MSG,MSGSIZE}: Default values used when the user doesn't supply
104 * an attribute to the open call and the queue must be created
105 * HARD_*: Highest value the maximums can be set to. These are enforced
106 * on CAP_SYS_RESOURCE apps as well making them inviolate (so make them
107 * suitably high)
108 *
109 * POSIX Requirements:
110 * Per app minimum openable message queues - 8. This does not map well
111 * to the fact that we limit the number of queues on a per namespace
112 * basis instead of a per app basis. So, make the default high enough
113 * that no given app should have a hard time opening 8 queues.
114 * Minimum maximum for HARD_MSGMAX - 32767. I bumped this to 65536.
115 * Minimum maximum for HARD_MSGSIZEMAX - POSIX is silent on this. However,
116 * we have run into a situation where running applications in the wild
117 * require this to be at least 5MB, and preferably 10MB, so I set the
118 * value to 16MB in hopes that this user is the worst of the bunch and
119 * the new maximum will handle anyone else. I may have to revisit this
120 * in the future.
121 */
122#define MIN_QUEUESMAX 1
123#define DFLT_QUEUESMAX 256
124#define HARD_QUEUESMAX 1024
125#define MIN_MSGMAX 1
126#define DFLT_MSG 10U
127#define DFLT_MSGMAX 10
128#define HARD_MSGMAX 65536
129#define MIN_MSGSIZEMAX 128
130#define DFLT_MSGSIZE 8192U
131#define DFLT_MSGSIZEMAX 8192
132#define HARD_MSGSIZEMAX (16*1024*1024)
133#else 98#else
134static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } 99static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
135#endif 100#endif
136 101
137#if defined(CONFIG_IPC_NS) 102#if defined(CONFIG_IPC_NS)
138extern struct ipc_namespace *copy_ipcs(unsigned long flags, 103extern struct ipc_namespace *copy_ipcs(unsigned long flags,
139 struct user_namespace *user_ns, struct ipc_namespace *ns); 104 struct task_struct *tsk);
140
141static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 105static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
142{ 106{
143 if (ns) 107 if (ns)
@@ -148,12 +112,12 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
148extern void put_ipc_ns(struct ipc_namespace *ns); 112extern void put_ipc_ns(struct ipc_namespace *ns);
149#else 113#else
150static inline struct ipc_namespace *copy_ipcs(unsigned long flags, 114static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
151 struct user_namespace *user_ns, struct ipc_namespace *ns) 115 struct task_struct *tsk)
152{ 116{
153 if (flags & CLONE_NEWIPC) 117 if (flags & CLONE_NEWIPC)
154 return ERR_PTR(-EINVAL); 118 return ERR_PTR(-EINVAL);
155 119
156 return ns; 120 return tsk->nsproxy->ipc_ns;
157} 121}
158 122
159static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 123static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)