Date: Sun, 4 Sep 2016 18:05:48 +0200 From: Mateusz Guzik <mjguzik@gmail.com> To: Conrad Meyer <cem@freebsd.org> Cc: Mateusz Guzik <mjg@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305383 - head/sys/sys Message-ID: <20160904160547.GD25473@dft-labs.eu> In-Reply-To: <CAG6CVpVuqH671EBrpuVxCmM-kAyrJD9ZvpCBY8rqq2qCh9EiEw@mail.gmail.com> References: <201609041331.u84DVwIX061144@repo.freebsd.org> <CAG6CVpVuqH671EBrpuVxCmM-kAyrJD9ZvpCBY8rqq2qCh9EiEw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 04, 2016 at 09:00:38AM -0700, Conrad Meyer wrote: > Do you know which revision this was introduced (i.e. what revision > range should be avoided)? The most relevant commit seems to be > r305093 but I'm not sure how that would have broken this (nothing in > that diff was checking fde_file before). > The problem was present since r305093 to this very commit. The problem affects weird programs which do F_GETFD to see if they got given fd installed, like bash. Prior to r305093 they would get EBADF. But due to incorrect test in fdeget_locked, they would get 0 instead. > Best, > Conrad > > On Sun, Sep 4, 2016 at 6:31 AM, Mateusz Guzik <mjg@freebsd.org> wrote: > > Author: mjg > > Date: Sun Sep 4 13:31:57 2016 > > New Revision: 305383 > > URL: https://svnweb.freebsd.org/changeset/base/305383 > > > > Log: > > fd: fix up fdeget_file > > > > It was supposed to return NULL if a fp is not installed. > > > > Facepalm-by: mjg > > > > Modified: > > head/sys/sys/filedesc.h > > > > Modified: head/sys/sys/filedesc.h > > ============================================================================== > > --- head/sys/sys/filedesc.h Sun Sep 4 12:22:14 2016 (r305382) > > +++ head/sys/sys/filedesc.h Sun Sep 4 13:31:57 2016 (r305383) > > @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd > > static __inline struct filedescent * > > fdeget_locked(struct filedesc *fdp, int fd) > > { > > + struct filedescent *fde; > > > > FILEDESC_LOCK_ASSERT(fdp); > > > > if (fd < 0 || fd > fdp->fd_lastfile) > > return (NULL); > > > > - return (&fdp->fd_ofiles[fd]); > > + fde = &fdp->fd_ofiles[fd]; > > + if (fde->fde_file == NULL) > > + return (NULL); > > + > > + return (fde); > > } > > > > static __inline bool > > -- Mateusz Guzik <mjguzik gmail.com>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160904160547.GD25473>