Re: [PATCH] fix sys cpumap for > 352 NR_CPUS
From: Greg KH
Date: Thu Jun 03 2004 - 11:58:08 EST
On Thu, Jun 03, 2004 at 09:38:07AM -0700, Paul Jackson wrote:
> > We do check for an error in that function, so returning any negative
> > error value for a show() sysfs callback will be handled properly.
>
> If a show() function returns an error, you handle it - good. As it
> should be.
>
> But if a show() function overwrites the page buffer provided to it,
> before returning, then there is nothing you can do beyond sending
> condolences to the next of kin.
Yup, you broke the kernel, you get to keep both pieces :)
> This PATCH and email thread came about because the buffer size is not
> passed into the show() function, nor, so far as I can tell, is it
> documented anywhere other than implicitly in the fill_read_buffer()
> code:
>
> buffer->page = (char *) get_zeroed_page(GFP_KERNEL);
I agree that we should document this better. This thread has shown
that.
> So we were getting confused as to what size buffer we had, when
> coding defensively to avoid buffer overrun.
Panicing the kernel is not really acceptable, even if you did just
scribble accross any portion of kernel memory in your show() function.
Just be aware of the size and code your show() function to be defensive
and not overrun that size.
thanks,
greg k-h
-
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/