Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Aug 2017 22:11:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 221161] devel/staf: stafproc passes a revoked file descriptor to children
Message-ID:  <bug-221161-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221161

            Bug ID: 221161
           Summary: devel/staf: stafproc passes a revoked file descriptor
                    to children
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org
                CC: kozlov.sergey.404@gmail.com
             Flags: maintainer-feedback?(kozlov.sergey.404@gmail.com)
                CC: kozlov.sergey.404@gmail.com

The "staf local process start ..." command causes stafproc to fork and exec=
 a
new process.  Depending on the arguments, it may pass its own stdin to the
child, unmodified.  staf's RC script uses daemon(8) to detach stafproc from=
 its
controlling terminal, but it does nothing to stdin.  The result is that
stafproc has a stdin in the revoked state, which it passes to child process=
es.=20
Some programs can't handle revoked file descriptors, because they return EB=
ADF
despite being opened.  See the file descriptors in the "x" state in the lis=
ting
below:

# procstat -f 1319
  PID COMM                FD T V FLAGS    REF  OFFSET PRO NAME=20=20=20=20=
=20=20=20=20
 1319 STAFProc          text v r r-------   -       - -=20=20
/usr/local/bin/STAFProc
 1319 STAFProc           cwd v d r-------   -       - -   /=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc          root v d r-------   -       - -   /=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             0 v x rw------  74   34840 -   -=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             1 v r -wa-----   6    1825 -   -=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             2 v r -wa-----   6    1825 -   -=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             3 v x rw------  74   34840 -   -=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             4 v r -wa-----   6    1825 -   -=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             5 v r -wa-----   6    1825 -   -=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             6 v r rw------   1       0 -   -=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             7 v r rw------   1       0 -   -=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
 1319 STAFProc             8 s - rw------   2       0 UDS /tmp/STAFIPC_STAF
 1319 STAFProc             9 s - rw------   1       0 TCP 0.0.0.0:6550
0.0.0.0:0
 1319 STAFProc            11 s - rw------   1       0 TCP 0.0.0.0:6500
0.0.0.0:0
 1319 STAFProc            12 ? - --------   2       0 -   -=20


The easiest solution is to close stdin in stafproc's RC script.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221161-13>