Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Nov 2020 17:53:47 +0200
From:      Guy Yur <guyyur@gmail.com>
To:        Robert Wing <rew@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r367927 - in head: sys/kern tests/sys/kern
Message-ID:  <75a09790-79d8-f539-e118-acf32b6bc65e@gmail.com>
In-Reply-To: <202011220500.0AM50Tml047660@repo.freebsd.org>
References:  <202011220500.0AM50Tml047660@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 22/11/20 7:00 am, Robert Wing wrote:
> Author: rew
> Date: Sun Nov 22 05:00:28 2020
> New Revision: 367927
> URL: https://svnweb.freebsd.org/changeset/base/367927
>
> Log:
>    fd: free old file descriptor tables when not shared
>    
>    During the life of a process, new file descriptor tables may be allocated. When
>    a new table is allocated, the old table is placed in a free list and held onto
>    until all processes referencing them exit.
>    
>    When a new file descriptor table is allocated, the old file descriptor table
>    can be freed when the current process has a single-thread and the file
>    descriptor table is not being shared with any other processes.
>    
>    Reviewed by:    kevans
>    Approved by:    kevans (mentor)
>    Differential Revision:  https://reviews.freebsd.org/D18617
>
> Added:
>    head/tests/sys/kern/fdgrowtable_test.c   (contents, props changed)
> Modified:
>    head/sys/kern/kern_descrip.c
>    head/tests/sys/kern/Makefile

Hi,

I am getting a kernel panic with this commit when building
devel/gmake port and it runs dup2 test in configure script.

panic: fc_ioctls != NULL, but fc_nioctls=-16162
...
#10 0xffffffff80655c72 in vpanic (fmt=<optimized out>, ap=<optimized out>)
     at /usr/src/sys/kern/kern_shutdown.c:907
#11 0xffffffff80655a03 in panic (
     fmt=0xffffffff80eb2b78 <cnputs_mtx> "헝\200\377\377\377\377")
     at /usr/src/sys/kern/kern_shutdown.c:843
#12 0xffffffff805fff9a in filecaps_copy_prep (src=<optimized out>)
     at /usr/src/sys/kern/kern_descrip.c:1629
#13 kern_dup (td=<optimized out>, mode=<optimized out>, flags=0,
     old=<optimized out>, new=256) at /usr/src/sys/kern/kern_descrip.c:970
#14 0xffffffff8094a5de in syscallenter (td=<optimized out>)
     at /usr/src/sys/amd64/amd64/../../kern/subr_syscall.c:189
#15 amd64_syscall (td=0xfffffe00513f8500, traced=0)
     at /usr/src/sys/amd64/amd64/trap.c:1156


Simplified test program that causes panic:
#include <unistd.h>
#include <limits.h>

int main ()
{
   int bad_fd = INT_MAX;
   dup2 (1, 1);
   close (0);
   dup2 (0, 0);
   dup2 (2, bad_fd);
   dup2 (2, -1);
   dup2 (2, 255);
   dup2 (2, 256);
   return 0;
}


Thanks,
Guy Yur




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?75a09790-79d8-f539-e118-acf32b6bc65e>