Skip to content

Commit

Permalink
BHYVE: OS-7096 installctx needs kpreempt_disable protection
Browse files Browse the repository at this point in the history
Reviewed by: John Levon <john.levon@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Robert Mustacchi <rm@joyent.com>
  • Loading branch information
pfmooney authored and citrus-it committed Aug 1, 2018
1 parent 66061f1 commit 2e15cb8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions usr/src/uts/common/disp/thread.c
Expand Up @@ -1073,7 +1073,12 @@ installctx(
* form a loop of the ctxops in newest-to-oldest order. The 'prev'
* pointers form a loop in the reverse direction, where t_ctx->prev is
* the oldest entry associated with the thread.
*
* The protection of kpreempt_disable is required to safely perform the
* list insertion, since there are inconsistent states between some of
* the pointer assignments.
*/
kpreempt_disable();
if (t->t_ctx == NULL) {
ctx->next = ctx;
ctx->prev = ctx;
Expand All @@ -1086,6 +1091,7 @@ installctx(
tail->next = ctx;
}
t->t_ctx = ctx;
kpreempt_enable();
}

/*
Expand Down

0 comments on commit 2e15cb8

Please sign in to comment.