aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/audit.c8
-rw-r--r--kernel/auditfilter.c10
-rw-r--r--kernel/irq/manage.c82
3 files changed, 94 insertions, 6 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index e4956244ae50..939500317066 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -74,6 +74,8 @@ static int audit_initialized;
74int audit_enabled; 74int audit_enabled;
75int audit_ever_enabled; 75int audit_ever_enabled;
76 76
77EXPORT_SYMBOL_GPL(audit_enabled);
78
77/* Default state when kernel boots without any parameters. */ 79/* Default state when kernel boots without any parameters. */
78static int audit_default; 80static int audit_default;
79 81
@@ -671,9 +673,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
671 673
672 pid = NETLINK_CREDS(skb)->pid; 674 pid = NETLINK_CREDS(skb)->pid;
673 uid = NETLINK_CREDS(skb)->uid; 675 uid = NETLINK_CREDS(skb)->uid;
674 loginuid = NETLINK_CB(skb).loginuid; 676 loginuid = audit_get_loginuid(current);
675 sessionid = NETLINK_CB(skb).sessionid; 677 sessionid = audit_get_sessionid(current);
676 sid = NETLINK_CB(skb).sid; 678 security_task_getsecid(current, &sid);
677 seq = nlh->nlmsg_seq; 679 seq = nlh->nlmsg_seq;
678 data = NLMSG_DATA(nlh); 680 data = NLMSG_DATA(nlh);
679 681
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index add2819af71b..f8277c80d678 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1238,6 +1238,7 @@ static int audit_filter_user_rules(struct netlink_skb_parms *cb,
1238 for (i = 0; i < rule->field_count; i++) { 1238 for (i = 0; i < rule->field_count; i++) {
1239 struct audit_field *f = &rule->fields[i]; 1239 struct audit_field *f = &rule->fields[i];
1240 int result = 0; 1240 int result = 0;
1241 u32 sid;
1241 1242
1242 switch (f->type) { 1243 switch (f->type) {
1243 case AUDIT_PID: 1244 case AUDIT_PID:
@@ -1250,19 +1251,22 @@ static int audit_filter_user_rules(struct netlink_skb_parms *cb,
1250 result = audit_comparator(cb->creds.gid, f->op, f->val); 1251 result = audit_comparator(cb->creds.gid, f->op, f->val);
1251 break; 1252 break;
1252 case AUDIT_LOGINUID: 1253 case AUDIT_LOGINUID:
1253 result = audit_comparator(cb->loginuid, f->op, f->val); 1254 result = audit_comparator(audit_get_loginuid(current),
1255 f->op, f->val);
1254 break; 1256 break;
1255 case AUDIT_SUBJ_USER: 1257 case AUDIT_SUBJ_USER:
1256 case AUDIT_SUBJ_ROLE: 1258 case AUDIT_SUBJ_ROLE:
1257 case AUDIT_SUBJ_TYPE: 1259 case AUDIT_SUBJ_TYPE:
1258 case AUDIT_SUBJ_SEN: 1260 case AUDIT_SUBJ_SEN:
1259 case AUDIT_SUBJ_CLR: 1261 case AUDIT_SUBJ_CLR:
1260 if (f->lsm_rule) 1262 if (f->lsm_rule) {
1261 result = security_audit_rule_match(cb->sid, 1263 security_task_getsecid(current, &sid);
1264 result = security_audit_rule_match(sid,
1262 f->type, 1265 f->type,
1263 f->op, 1266 f->op,
1264 f->lsm_rule, 1267 f->lsm_rule,
1265 NULL); 1268 NULL);
1269 }
1266 break; 1270 break;
1267 } 1271 }
1268 1272
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 9033c1c70828..094fafe86c96 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -134,6 +134,10 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
134 irq_set_thread_affinity(desc); 134 irq_set_thread_affinity(desc);
135 } 135 }
136#endif 136#endif
137 if (desc->affinity_notify) {
138 kref_get(&desc->affinity_notify->kref);
139 schedule_work(&desc->affinity_notify->work);
140 }
137 desc->status |= IRQ_AFFINITY_SET; 141 desc->status |= IRQ_AFFINITY_SET;
138 raw_spin_unlock_irqrestore(&desc->lock, flags); 142 raw_spin_unlock_irqrestore(&desc->lock, flags);
139 return 0; 143 return 0;
@@ -155,6 +159,79 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
155} 159}
156EXPORT_SYMBOL_GPL(irq_set_affinity_hint); 160EXPORT_SYMBOL_GPL(irq_set_affinity_hint);
157 161
162static void irq_affinity_notify(struct work_struct *work)
163{
164 struct irq_affinity_notify *notify =
165 container_of(work, struct irq_affinity_notify, work);
166 struct irq_desc *desc = irq_to_desc(notify->irq);
167 cpumask_var_t cpumask;
168 unsigned long flags;
169
170 if (!desc)
171 goto out;
172
173 if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
174 goto out;
175
176 raw_spin_lock_irqsave(&desc->lock, flags);
177#ifdef CONFIG_GENERIC_PENDING_IRQ
178 if (desc->status & IRQ_MOVE_PENDING)
179 cpumask_copy(cpumask, desc->pending_mask);
180 else
181#endif
182 cpumask_copy(cpumask, desc->affinity);
183 raw_spin_unlock_irqrestore(&desc->lock, flags);
184
185 notify->notify(notify, cpumask);
186
187 free_cpumask_var(cpumask);
188out:
189 kref_put(&notify->kref, notify->release);
190}
191
192/**
193 * irq_set_affinity_notifier - control notification of IRQ affinity changes
194 * @irq: Interrupt for which to enable/disable notification
195 * @notify: Context for notification, or %NULL to disable
196 * notification. Function pointers must be initialised;
197 * the other fields will be initialised by this function.
198 *
199 * Must be called in process context. Notification may only be enabled
200 * after the IRQ is allocated and must be disabled before the IRQ is
201 * freed using free_irq().
202 */
203int
204irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
205{
206 struct irq_desc *desc = irq_to_desc(irq);
207 struct irq_affinity_notify *old_notify;
208 unsigned long flags;
209
210 /* The release function is promised process context */
211 might_sleep();
212
213 if (!desc)
214 return -EINVAL;
215
216 /* Complete initialisation of *notify */
217 if (notify) {
218 notify->irq = irq;
219 kref_init(&notify->kref);
220 INIT_WORK(&notify->work, irq_affinity_notify);
221 }
222
223 raw_spin_lock_irqsave(&desc->lock, flags);
224 old_notify = desc->affinity_notify;
225 desc->affinity_notify = notify;
226 raw_spin_unlock_irqrestore(&desc->lock, flags);
227
228 if (old_notify)
229 kref_put(&old_notify->kref, old_notify->release);
230
231 return 0;
232}
233EXPORT_SYMBOL_GPL(irq_set_affinity_notifier);
234
158#ifndef CONFIG_AUTO_IRQ_AFFINITY 235#ifndef CONFIG_AUTO_IRQ_AFFINITY
159/* 236/*
160 * Generic version of the affinity autoselector. 237 * Generic version of the affinity autoselector.
@@ -1004,6 +1081,11 @@ void free_irq(unsigned int irq, void *dev_id)
1004 if (!desc) 1081 if (!desc)
1005 return; 1082 return;
1006 1083
1084#ifdef CONFIG_SMP
1085 if (WARN_ON(desc->affinity_notify))
1086 desc->affinity_notify = NULL;
1087#endif
1088
1007 chip_bus_lock(desc); 1089 chip_bus_lock(desc);
1008 kfree(__free_irq(irq, dev_id)); 1090 kfree(__free_irq(irq, dev_id));
1009 chip_bus_sync_unlock(desc); 1091 chip_bus_sync_unlock(desc);