On 29/06/20(Mon) 11:59, Vitaliy Makkoveev wrote: > [...] > I reworked tool for reproduce. Now I avoided fork()/exec() route and it > takes couple of minutes to take panic on 4 cores. Also some screenshots > attached.
Setting kern.pool_debug=2 makes the race reproducible in seconds. Could you turn this test into something committable in regress/? We can link it to the build once a fix is committed. > #include <sys/socket.h> > #include <sys/ioctl.h> > #include <net/if.h> > #include <stdio.h> > #include <stdlib.h> > #include <err.h> > #include <errno.h> > #include <pthread.h> > #include <string.h> > #include <unistd.h> > > static struct ifreq ifr; > > static void *clone_create(void *arg) > { > int s; > > if((s=socket(AF_INET, SOCK_DGRAM, 0))<0) > err(1, "socket()"); > while(1){ > if(ioctl(s, SIOCIFCREATE, &ifr)<0) > if(errno==EINVAL) > exit(1); > } > > return NULL; > } > > static void *clone_destroy(void *arg) > { > int s; > > if((s=socket(AF_INET, SOCK_DGRAM, 0))<0) > err(1, "socket()"); > while(1){ > if(ioctl(s, SIOCIFDESTROY, &ifr)<0) > if(errno==EINVAL) > exit(1); > } > > return NULL; > } > > int main(int argc, char *argv[]) > { > pthread_t thr; > int i; > > if(argc!=2){ > fprintf(stderr, "usage: %s ifname\n", getprogname()); > return 1; > } > > if(getuid()!=0){ > fprintf(stderr, "should be root\n"); > return 1; > } > > memset(&ifr, 0, sizeof(ifr)); > strlcpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name)); > > for(i=0; i<8*4; ++i){ > if(pthread_create(&thr, NULL, clone_create, NULL)!=0) > errx(1, "pthread_create(clone_create)"); > } > > clone_destroy(NULL); > > return 0; > } > > ---- cut end ----