git: kernel - misc MPSAFe work

Michael Neumann michaelneuma at
Sun Dec 20 04:52:30 PST 2009

2009/12/20 Matthew Dillon <dillon at>

commit 61f96b6ff60acbd1692d0bffe07b5e1f262327dc
Author: Matthew Dillon <dillon at>
Date:   Sat Dec 19 22:18:37 2009 -0800

    kernel - misc MPSAFe work

    * prisoncount, prison_hold(), and prison_free() are now MPSAFEI wonder if the change below is really neccessary, as LIST_INSERT_HEAD is not MP-safe andthe whole function kern_jail must be called with mp_lock hold. It just made me think that you missed 
to make the list insert race free until I saw that the function is always called with mp_lock held.--- a/sys/kern/kern_jail.c+++ b/sys/kern/kern_jail.c@@ -177,7 +177,7 @@ kern_jail(struct prison *pr, struct jail *j)
        LIST_INSERT_HEAD(&allprison, pr, pr_list);-       prisoncount++;+       atomic_add_int(&prisoncount, 1);And I wonder if in the error path, there is isn't missing an atomic_add_int(&prisoncount, -1):
  179         LIST_INSERT_HEAD(&allprison, pr, pr_list); 180         atomic_add_int(&prisoncount, 1); 181  182         error = kern_jail_attach(pr->pr_id); 183         if (error) { 184                 LIST_REMOVE(pr, pr_list);
 +                      atomic_add_int(&prisoncount, -1):  185                 varsymset_clean(&pr->pr_varsymset); 186         }Regards,  Michael

More information about the Commits mailing list