From: mvs Date: Thu, 12 May 2022 13:33:09 +0000 (+0000) Subject: Convert `fd_cmask' and `fd_refcnt' types from u_short to 32 bit types. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d0517649e10b8988bbe5ddfc4744ed456dbe76c7;p=openbsd Convert `fd_cmask' and `fd_refcnt' types from u_short to 32 bit types. `fd_cmask' and `fd_refcnt' are 16 bit variables which are protected by different locks and could be not MP independent on all architectures. `fd_cmask' modifications already protected by fd_lock' rwlock(9), but actually we do all access to both variables with kernel lock held. So convert them both before make `fd_cmask' access without kernel when umask(2) will be unlocked. Proposed by bluhm@. ok deraadt@ bluhm@ --- diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index f332fb6619a..a8cb947b9fe 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: filedesc.h,v 1.45 2020/07/04 08:06:08 anton Exp $ */ +/* $OpenBSD: filedesc.h,v 1.46 2022/05/12 13:33:09 mvs Exp $ */ /* $NetBSD: filedesc.h,v 1.14 1996/04/09 20:55:28 cgd Exp $ */ /* @@ -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 */