Intro: Fix mountd buffer overflow when using large numbers of netgroups
Subsystems (2)
cover Intro: Fix mountd buffer overflow when using large numbers of netgroups
This patchset is intended to address the buffer overrun reported by Stefan Walter when a client matches a large number of netgroups. The main problem is that the string returned by client_compose can be any length, and that is strcpy()'ed into a fixed-length array.
The first four patches are cleanup patches. They also take care of the actual buffer overrun. The last patch implements Neil Brown's suggestion to allow mountd to conditionally map ipaddr to ipaddr in the auth.unix.ip cache and to only check mount requests against exports that match the path.
This mode is automatically selected when the total length of all of the netgroup m_hostname fields is greater than 1/2 of NFSCLNT_IDMAX. I decided on this scheme simply because it allowed for a long list of netgroups with plenty of space at the end of the string for other matches.
Unlike earlier versions of this patch, there is no way to select this mode manually. The reason is that explaining when an admin should select this mode is difficult and adding an option would be very confusing. If it becomes desirable to do so, however, we can always add one later.
This patchset is very similar to the last one. The main difference is the removal of some null pointer checks when freeing memory, and some changes to error handling when memory can't be allocated. My reasoning is that in most cases, when memory can't be allocated it's probably best to kill off mountd. Not doing this could leave the exports table in an indeterminate state. The main exception is in the codepath that actually services mount requests. If memory can't be allocated there, it's probably best to just fail the mount request and keep mountd up. The next mount request might work just fine.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs