Re: uevent buffer overflow in input layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 23, 2006 at 10:07:41PM -0800, Greg KH wrote:
> On Tue, Jan 24, 2006 at 01:01:19AM -0500, Dmitry Torokhov wrote:
> > On Tuesday 24 January 2006 00:03, Greg KH wrote:
> > > On Mon, Jan 23, 2006 at 10:43:41AM +1100, Benjamin Herrenschmidt wrote:
> > > > Current -git as of today does this on an x86 box with a logitech USB
> > > > keyboard:
> > > > 
> > > > (the $$$ is debug stuff I added to print_modalias(), size is the size
> > > > passed in and "Total len" is the value of "len" before returning). We
> > > > end up overflowing, thus we pass a negative size to snprintf which
> > > > causes the WARN_ON. Bumping the uevent buffer size in lib/kobject_uevent.c
> > > > from 1024 to 2048 seems to fix the oops and /dev/input/mice is now properly
> > > > created and works (it doesn't without the fix, X fails and we end up back
> > > > in console with a dead keyboard).
> > > > 
> > > > I'm not sure it's the correct solution as I'm not too familiar with the
> > > > uevent code though, so I'll let you guys decide on the proper approach.
> > > 
> > > Yes, input has some big strings, I'd recommend bumping it up like you
> > > suggest.
> > > 
> > > Care to make up a patch as you found the problem and should get the
> > > credit?  :)

Yes, sounds sane, to double the sizes of BUFFER_SIZE and NUM_ENVP in
lib/kobject_uevent.c. I'll do the same for udev now.

> > Actually, is it too late to convert modalias data to the same format
> > (bitmap) we are using in /proc/bus/input/devices (keeping cutting key
> > info at KEY_MIN_INTERESTING)? It looks like it will be more compact
> > and let us keep 1024 bytes buffer...
> 
> I don't think so, but Kay knows best about this.  Kay?

Sure, that's fine to change. Nobody besides modprobe should be interested in
the content of the string. We just pass it back to modprobe which matches
against the depmod generated list in /lib/modules/<2.6.16...>/modules.alias
to find the modules to load. If you make sure that modprobe $MODALIAS still
loads the right modules, everything should be fine.

Both changes sounds good to me, please do.

Thanks,
Kay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux