On Sun, 2011-03-06 at 13:19 +0000, Alan Cox wrote: > > If we had wrappers for the most common cases, then any cases that were > > left that used copy_from_user() explicitly could be flagged and > > checked by hand, since they would be exception, and not the rule. > > Arjan's copy_from_user validation code already does verification checks > on the copies using gcc magic. > > Some of the others might be useful - kmalloc_from_user() is a fairly > obvious interface, a copy_from_user_into() interface where you pass > the destination object and its actual length as well is mostly covered by > Arjan's stuff. > > Alan This is all worthwhile discussion, and a good implementation of these kinds of features is available as part of grsecurity (PAX_USERCOPY) - it provides additional bounds-checking for copy operations into both heap and stack buffers. Rather than reinventing the wheel, perhaps it would be a better use of time to extract this patch and make it suitable for inclusion. In the meantime, I'd like to get back to the original patch (make /proc/slabinfo 0400), and the subsequent followup patch (randomize free objects within a slab). While it's clear that these patches by themselves will not entirely prevent kernel heap exploits, they both seem to be sane improvements, won't significantly impact performance, and shouldn't be more than a very minor inconvenience to some small subset of normal users. In addition, the absence of these changes might undermine future hardening improvements (e.g. with a more hardened heap, the readability of /proc/slabinfo may be more necessary for successful exploitation). -Dan -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>