Re: [RFC][PATCH 1/6] prepare sysctls for containers

From: Chris Wright
Date: Mon Mar 06 2006 - 19:54:53 EST


* Dave Hansen (haveblue@xxxxxxxxxx) wrote:
> /* If there is no strategy routine, or if the strategy returns
> * zero, proceed with automatic r/w */
> - if (table->data && table->maxlen) {
> + data = sysctl_table_data(table);
> + if (data && table->maxlen) {
> if (oldval && oldlenp) {
> if (get_user(len, oldlenp))
> return -EFAULT;
> if (len) {
> if (len > table->maxlen)
> len = table->maxlen;
> - if(copy_to_user(oldval, table->data, len))
> + if(copy_to_user(oldval, data, len))
> return -EFAULT;
> if(put_user(len, oldlenp))
> return -EFAULT;
> @@ -1241,7 +1261,7 @@ int do_sysctl_strategy (ctl_table *table
> len = newlen;
> if (len > table->maxlen)
> len = table->maxlen;
> - if(copy_from_user(table->data, newval, len))
> + if(copy_from_user(data, newval, len))
> return -EFAULT;

Interesting idea. One piece that's missing is strategy for controlling
creation the new context (assuming the data_access() will always evaluate
into a context sensitive piece of data). Otherwise a user can get out
of the limits imposed by sysadmin (since they may have placed themselves
in a context which differs from admin).

thanks,
-chris
-
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/