Skip to contentSkip to conversation

nucleus: Fix migration race in schedule_linux_call

PATCH New Jan Kiszka 1 participant 1 message Jan 18, 2013

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 nucleus: Fix migration race in schedule_linux_call

schedule_linux_call may also be invoked over preemptible, thus migratable Linux contexts. Therefore we must not read the CPU number outside the splhigh/splexit section.

---
 ksrc/nucleus/shadow.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
ksrc/nucleus/shadow.c +2 -1
index 260fdef..c91a6f3 100644
@@ -820,7 +820,7 @@ static void lostage_handler(void *cookie)
 
 static void schedule_linux_call(int type, struct task_struct *p, int arg)
 {
-	int cpu = rthal_processor_id(), reqnum;
+	int cpu, reqnum;
 	struct __lostagerq *rq;
 	spl_t s;
 
@@ -832,6 +832,7 @@ static void schedule_linux_call(int type, struct task_struct *p, int arg)
 
 	splhigh(s);
 
+	cpu = rthal_processor_id();
 	rq = &lostagerq[cpu];
 	reqnum = rq->in;
 	rq->in = (reqnum + 1) & (LO_MAX_REQUESTS - 1);
Signature · 1 line
1.7.3.4