On Sun, Feb 11, 2018 at 02:50:30PM +0100, Martin Pieuchot wrote:
> On 11/02/18(Sun) 12:37, Matthieu Herrb wrote:
> > Hi,
> > 
> > I ugraded my laptop from sources to -current yesterday. Since then
> > firefox stops resolving host names after a dozen of minutes or so.
> 
> What do you mean with "stops resolving host names"?  What happens?  What
> do you see?
> 
> How did figure out it was a name resolution problem?
> 
> A firefox error page?
>  
> You saw some  syscalls failing via ktrace? 
> 
> You looked at tcpdump outputs?
> 
> Some network counters were increasing?
> 
> > It's not the firefox port itself, since it started after I rebooted a
> > the new kernel, while base and xenocara were rebuilding. My previous
> > kernel was from jan, 31.
> 
> So you're saying that *some* kernels newer than jan, 31 expose this
> regression?  Could you bisect when it has been introduced?
> 
> > Other programs are fine (including chromium), but appart may be chromium
> > nothing I run is using threads and name resolution at the same time .
> 
> You're assuming it's related to threaded applications,  why?
> 
> > Any idea of what's causing this, or should I start bisecting ?
> 
> A bisection would be great.

And the winner is:
https://github.com/openbsd/src/commit/a0801e345934b8c139c255c8327f726a614b3267

Author: mpi <[email protected]>
Date:   Fri Feb 9 07:32:35 2018 +0000

    Call socreate() before falloc() in sys_socket().
    
    This is similar to what we do in sys_socketpair() and will allow us
    to grab the KERNEL_LOCK() only after having created a socket.
    
    ok tedu@

Reverting that commit with the patch below, I've not been able to
reproduce the issue in -current.

Index: uipc_syscalls.c
===================================================================
RCS file: /cvs/OpenBSD/src/sys/kern/uipc_syscalls.c,v
retrieving revision 1.163
diff -u -r1.163 uipc_syscalls.c
--- uipc_syscalls.c     9 Feb 2018 07:32:35 -0000       1.163
+++ uipc_syscalls.c     11 Feb 2018 20:56:24 -0000
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uipc_syscalls.c,v 1.163 2018/02/09 07:32:35 mpi Exp $ */
+/*     $OpenBSD: uipc_syscalls.c,v 1.162 2018/01/09 15:14:23 mpi Exp $ */
 /*     $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $      
*/
 
 /*
@@ -83,7 +83,7 @@
        struct file *fp;
        int type = SCARG(uap, type);
        int domain = SCARG(uap, domain);
-       int fd, cloexec, nonblock, fflag, error;
+       int fd, error;
        unsigned int ss = 0;
 
        if ((type & SOCK_DNS) && !(domain == AF_INET || domain == AF_INET6))
@@ -95,24 +95,23 @@
        if (error)
                return (error);
 
-       type &= ~(SOCK_CLOEXEC | SOCK_NONBLOCK | SOCK_DNS);
-       cloexec = (SCARG(uap, type) & SOCK_CLOEXEC) ? UF_EXCLOSE : 0;
-       nonblock = SCARG(uap, type) &  SOCK_NONBLOCK;
-       fflag = FREAD | FWRITE | (nonblock ? FNONBLOCK : 0);
-
-       error = socreate(SCARG(uap, domain), &so, type, SCARG(uap, protocol));
+       fdplock(fdp);
+       error = falloc(p, (type & SOCK_CLOEXEC) ? UF_EXCLOSE : 0, &fp, &fd);
+       fdpunlock(fdp);
        if (error != 0)
                goto out;
 
-       fdplock(fdp);
-       error = falloc(p, cloexec, &fp, &fd);
-       fdpunlock(fdp);
+       fp->f_flag = FREAD | FWRITE | (type & SOCK_NONBLOCK ? FNONBLOCK : 0);
+       fp->f_type = DTYPE_SOCKET;
+       fp->f_ops = &socketops;
+       error = socreate(SCARG(uap, domain), &so,
+           type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK | SOCK_DNS), SCARG(uap, 
protocol));
        if (error) {
-               soclose(so);
+               fdplock(fdp);
+               fdremove(fdp, fd);
+               closef(fp, p);
+               fdpunlock(fdp);
        } else {
-               fp->f_flag = fflag;
-               fp->f_type = DTYPE_SOCKET;
-               fp->f_ops = &socketops;
                if (type & SOCK_NONBLOCK)
                        so->so_state |= SS_NBIO;
                so->so_state |= ss;


-- 
Matthieu Herrb

Reply via email to