]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add a sanity check for nes_numsecflavor to the NFS server.
authorrmacklem <rmacklem@FreeBSD.org>
Fri, 17 Apr 2020 02:21:46 +0000 (02:21 +0000)
committerrmacklem <rmacklem@FreeBSD.org>
Fri, 17 Apr 2020 02:21:46 +0000 (02:21 +0000)
commitfda6fb828d41d4a993b6dd909a08778d7030febd
tree9fcfa38367d83715ee79c9a01569abb949066939
parent8182e5f2cfeef051ba43304682a10998f20281d8
Add a sanity check for nes_numsecflavor to the NFS server.

Ryan Moeller reported crashes in the NFS server that appear to be
caused by stack corruption in nfsrv_compound(). It appears that
the stack got corrupted just after a NFSv4.1 Lookup that crosses
a server mount point.
Although it is just a "theory" at this point, the most obvious way
the stack could get corrupted would be if nfsvno_checkexp() somehow
acquires an export with a bogus nes_numsecflavor value. This would
cause the copying of the secflavors to run off the end of the array,
which is allocated on the stack below where the corruption occurs.

This sanity check is simple to do and would stop the stack corruption
if the theory is correct. Otherwise, doing the sanity check seems to
be a reasonable safety belt to add to the code.

Reported by: freqlabs
MFC after: 2 weeks
sys/fs/nfsserver/nfs_nfsdport.c