Howdy, The following patches hardens a good portion of libxc''s error path code against errno clobbering. Errno clobbering occurs when a function returns a failure code (such as -1) but then calls some other function (like munmap or perror) that could potentially change the value of errno. The patch doesn''t touch any of the build/save/restore code because it seems like since these functions do so much work it would be useful to create special error returns for them. Does this sound reasonable? There''s also a ton of read() calls that need to be hardened but that''s another patch. Signed-off-by: Anthony Liguori Regards, Anthony Liguori _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 23 Jun 2005, at 05:15, Anthony Liguori wrote:> The following patches hardens a good portion of libxc''s error path > code against errno clobbering. Errno clobbering occurs when a > function returns a failure code (such as -1) but then calls some other > function (like munmap or perror) that could potentially change the > value of errno.mmap() will never return NULL address (according to the man page). I guess you might be able to force it with MAP_FIXED, but no sane mmap implementation would ever automatically choose NULL as a reasonable valid return address. :-) -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
* Keir Fraser (Keir.Fraser@cl.cam.ac.uk) wrote:> mmap() will never return NULL address (according to the man page). I > guess you might be able to force it with MAP_FIXED, but no sane mmap > implementation would ever automatically choose NULL as a reasonable > valid return address. :-)Heh, sadly we just recently fixed a bug in the kernel that actually allowed returning NULL w/out MAP_FIXED. But aside from bugs... ;-) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel