Subject: Re: socreate()
To: Jason Thorpe <>
From: Elad Efrat <>
List: tech-kern
Date: 10/25/2006 23:54:01
Jason Thorpe wrote:
> On Oct 25, 2006, at 2:41 PM, Elad Efrat wrote:
>> hi,
>> can socreate() sleep? (I want to add a kauth(9) call in there to
>> implement socket policies in one place)
>         s = splsoftnet();
>         so = pool_get(&socket_pool, PR_WAITOK);
>> I *think* someone mentioned something about that in some thread in the
>> past; looking at the code it seems that if_gre.c:gre_kick(), called at
>> IPL_NET, can call socreate().
> socreate() must never be called from interrupt context.

okay then I perhaps don't understand the code.

if_gre.c:gre_kick() says it "Must be called at IPL_NET" (and it is, from
gre_ioctl(), right after splnet() was called). gre_kick() in turn calls
kthread_create1() with 'func' being gre_thread(). in turn, that calls
gre_thread1(), which can call gre_socreate1(), which can call

granted, I'm not familiar with neither the gre(4) code nor kernel
threads, but is there any guarantee that the above won't result in at
least some cases where socreate() is called at IPL_NET?


Elad Efrat