svn commit: r349776 - stable/11/sys/kern
Mark Johnston
markj at FreeBSD.org
Sat Jul 6 01:00:29 UTC 2019
Author: markj
Date: Sat Jul 6 01:00:28 2019
New Revision: 349776
URL: https://svnweb.freebsd.org/changeset/base/349776
Log:
MFC r349547:
Use a consistent snapshot of the fd's rights in fget_mmap().
Modified:
stable/11/sys/kern/kern_descrip.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/kern/kern_descrip.c
==============================================================================
--- stable/11/sys/kern/kern_descrip.c Sat Jul 6 01:00:11 2019 (r349775)
+++ stable/11/sys/kern/kern_descrip.c Sat Jul 6 01:00:28 2019 (r349776)
@@ -2687,6 +2687,7 @@ fget_mmap(struct thread *td, int fd, cap_rights_t *rig
if (maxprotp != NULL)
*maxprotp = VM_PROT_ALL;
#else
+ cap_rights_t fdrights;
struct filedesc *fdp = td->td_proc->p_fd;
seq_t seq;
@@ -2695,15 +2696,18 @@ fget_mmap(struct thread *td, int fd, cap_rights_t *rig
error = _fget(td, fd, fpp, 0, rightsp, &seq);
if (error != 0)
return (error);
- /*
- * If requested, convert capability rights to access flags.
- */
if (maxprotp != NULL)
- *maxprotp = cap_rights_to_vmprot(cap_rights(fdp, fd));
+ fdrights = *cap_rights(fdp, fd);
if (!fd_modified(fdp, fd, seq))
break;
fdrop(*fpp, td);
}
+
+ /*
+ * If requested, convert capability rights to access flags.
+ */
+ if (maxprotp != NULL)
+ *maxprotp = cap_rights_to_vmprot(&fdrights);
#endif
return (error);
}
More information about the svn-src-all
mailing list