Comment 26 for bug 1335478

Revision history for this message
Andy Whitcroft (apw) wrote :

@Ben -- the code is clear, the issue is the API is not clear. These issues have occurred because the userspace program is passing in junk in one of the fields of the structure it passes to the kernel, literally random bits from its stack. In attempting to validate those to prevent security issues this userspace application has been caught out. The main issue is the documentation for the call can be read to say you do not need to fill in that field under some circumstances, a failure in the documentation, but given that the validation needs to be more targetted; and this final fix does that, zapping the "not needed to be filled value" to zero when it is not required to avoid validation failures. The new code also documents this ABI weakness so that it should not occur.

Of course none of that excuses the userspace programmer from not initialising this structure sensibly regardless of the documentation. It is plain sloppy practice.