kern_dup(): Call filecaps_free_prep() in a write section.
filecaps_free_prep() bzeros the capabilities structure and we need to be careful to synchronize with unlocked readers, which expect a consistent rights structure. Reviewed by: kib, mjg Reported by: syzbot+5f30b507f91ddedded21@syzkaller.appspotmail.com MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24120
This commit is contained in:
parent
2d896b816b
commit
429537caeb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359133
@ -968,7 +968,6 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new)
|
||||
newfde = &fdp->fd_ofiles[new];
|
||||
delfp = newfde->fde_file;
|
||||
|
||||
oioctls = filecaps_free_prep(&newfde->fde_caps);
|
||||
nioctls = filecaps_copy_prep(&oldfde->fde_caps);
|
||||
|
||||
/*
|
||||
@ -977,6 +976,7 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new)
|
||||
#ifdef CAPABILITIES
|
||||
seqc_write_begin(&newfde->fde_seqc);
|
||||
#endif
|
||||
oioctls = filecaps_free_prep(&newfde->fde_caps);
|
||||
memcpy(newfde, oldfde, fde_change_size);
|
||||
filecaps_copy_finish(&oldfde->fde_caps, &newfde->fde_caps,
|
||||
nioctls);
|
||||
|
Loading…
Reference in New Issue
Block a user