Re: [PATCH 3/4] add ksm kernel shared memory driver

From: Izik Eidus
Date: Tue Nov 11 2008 - 17:38:58 EST


Jonathan Corbet wrote:
[Let's see if I can get through the rest without premature sends...]

On Wed, 12 Nov 2008 00:17:39 +0200
Izik Eidus <ieidus@xxxxxxxxxx> wrote:

Actually, it occurs to me that there's no sanity checks on any of
the values passed in by ioctl(). What happens if the user tells
KSM to scan a bogus range of memory?
Well get_user_pages() run in context of the process, therefore it
should fail in "bogus range of memory"

But it will fail in a totally silent and mysterious way. Doesn't it
seem better to verify the values when you can return a meaningful error
code to the caller?


Well I dont mind insert it (the above for sure is not a bug)
but even with that, the user can still free the memory that he gave to us
so this check if "nice to have check", we have nothing to do but to relay on
get_user_pages return value :)

The other ioctl() calls have the same issue; you can start the thread
with nonsensical values for the number of pages to scan and the sleep
time.

well about this i agree, here it make alot of logic to check the values!



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/