On Wed, May 11, 2022 at 02:33:34PM -0600, Theo de Raadt wrote:
> Vitaliy Makkoveev <[email protected]> wrote:
>
> > On Wed, May 11, 2022 at 01:22:51PM -0600, Theo de Raadt wrote:
> > > Vitaliy Makkoveev <[email protected]> wrote:
> > >
> > > > Index: sys/sys/filedesc.h
> > > > ===================================================================
> > > > RCS file: /cvs/src/sys/sys/filedesc.h,v
> > > > retrieving revision 1.45
> > > > diff -u -p -r1.45 filedesc.h
> > > > --- sys/sys/filedesc.h 4 Jul 2020 08:06:08 -0000 1.45
> > > > +++ sys/sys/filedesc.h 11 May 2022 19:05:12 -0000
> > > > @@ -79,7 +79,7 @@ struct filedesc {
> > > > u_int *fd_lomap; /* [f] bitmap of free fds */
> > > > int fd_lastfile; /* [f] high-water mark of
> > > > fd_ofiles */
> > > > int fd_freefile; /* [f] approx. next free file */
> > > > - u_short fd_cmask; /* [f/w] mask for file creation
> > > > */
> > > > + mode_t fd_cmask; /* [f/w] mask for file creation
> > > > */
> > > > u_short fd_refcnt; /* [K] reference count */
> > > > struct rwlock fd_lock; /* lock for the file descs */
> > > > struct mutex fd_fplock; /* lock for reading fd_ofiles
> > > > without
> > >
> > > The conversation included a proposal to change fd_refcnt
> > >
> > > And anyways, these are unrelated commits I think.
> > >
> >
> > I said I want to modify `fd_refcnt' with separate commit. Or you
> > propose to modify `fd_cmask' and `fd_refcnt' with the first commit and
> > unlock umask(2) with the second?
>
> Both of the resizes should happen first, in case there is fallout in
> userland which isn't visible yet.
No problem.
Index: sys/sys/filedesc.h
===================================================================
RCS file: /cvs/src/sys/sys/filedesc.h,v
retrieving revision 1.45
diff -u -p -r1.45 filedesc.h
--- sys/sys/filedesc.h 4 Jul 2020 08:06:08 -0000 1.45
+++ sys/sys/filedesc.h 11 May 2022 20:14:48 -0000
@@ -79,8 +79,8 @@ struct filedesc {
u_int *fd_lomap; /* [f] bitmap of free fds */
int fd_lastfile; /* [f] high-water mark of fd_ofiles */
int fd_freefile; /* [f] approx. next free file */
- u_short fd_cmask; /* [f/w] mask for file creation */
- u_short fd_refcnt; /* [K] reference count */
+ mode_t fd_cmask; /* [f/w] mask for file creation */
+ u_int fd_refcnt; /* [K] reference count */
struct rwlock fd_lock; /* lock for the file descs */
struct mutex fd_fplock; /* lock for reading fd_ofiles without
* fd_lock */