]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC: r360032
authorRick Macklem <rmacklem@FreeBSD.org>
Fri, 1 May 2020 22:37:09 +0000 (22:37 +0000)
committerRick Macklem <rmacklem@FreeBSD.org>
Fri, 1 May 2020 22:37:09 +0000 (22:37 +0000)
commit949936a62ec8da93a4bec1c256570eb7c69f9c7e
treea140f5f4a8647a6820b6302f38fa78bb636a4d98
parent7c0460062f547ba0636611d6f3a560816e7d3bbe
MFC: r360032
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.
sys/fs/nfsserver/nfs_nfsdport.c