public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Fw: Re: oops in choose_configuration()
@ 2006-03-08  3:29 Chuck Ebbert
  2006-03-08  3:48 ` Dmitry Torokhov
  2006-03-08  4:01 ` Linus Torvalds
  0 siblings, 2 replies; 28+ messages in thread
From: Chuck Ebbert @ 2006-03-08  3:29 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, Ingo Molnar, Andrew Morton, Linus Torvalds,
	Dmitry Torokhov

In-Reply-To: <20060308005455.GA23921@kroah.com>

On Tue, 7 Mar 2006 16:54:55 -0800, Greg KH wrote:

> On Tue, Mar 07, 2006 at 04:54:24PM -0500, Chuck Ebbert wrote:
> > At least one susbsystem rolls its own method of adding env vars to the
> > uevent buffer, and it's so broken it triggers the WARN_ON() in
> > lib/vsprintf.c::vsnprintf() by passing a negative length to that function.
> > Start at drivers/input/input.c::input_dev_uevent() and watch the fun.
> 
> All of the INPUT_ADD_HOTPLUG_VAR() calls do use add_uevent_var(), so we
> should be safe there.  The other calls also look safe, if not a bit
> wierd...  So I don't see how we could change this to be any safer, do
> you?

input.c line 747+ was recently added and caused the error message:

[1]=>   envp[i++] = buffer + len;
[2]=>   len += snprintf(buffer + len, buffer_size - len, "MODALIAS=");
[2]=>   len += print_modalias(buffer + len, buffer_size - len, dev) + 1;

[1]=>   envp[i] = NULL;
        return 0;

[1] What is checking for enough space here?  This didn't overflow AFAICT
but it could.

[2] The snprintf() and print_modalias() calls don't check for errors and
thus don't return -ENOMEM when the buffer does fill up.  Shouldn't they
do that instead of returning a truncated env string?  Only the final
sanity test in snprintf() keeps them from overrunning the buffer.
(It was print_modalias_bits() that actually caused the overflow.)

> Are you still seeing problems now?

Wasn't me, it was Horst Schirmeier <horst@schirmeier.com>

-- 
Chuck
"Penguins don't come from next door, they come from the Antarctic!"

^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: Fw: Re: oops in choose_configuration()
@ 2006-03-07 21:54 Chuck Ebbert
  2006-03-08  0:54 ` Greg KH
  2006-03-08  0:57 ` Linus Torvalds
  0 siblings, 2 replies; 28+ messages in thread
From: Chuck Ebbert @ 2006-03-07 21:54 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Greg KH, Ingo Molnar, linux-kernel

In-Reply-To: <Pine.LNX.4.64.0603051840280.13139@g5.osdl.org>

On Sun, 5 Mar 2006 19:27:53 -0800, Linus Torvalds wrote:

> So I'd be more inclined to blame a buffer overflow on a kmalloc, and the 
> obvious target is the "add_uevent_var()" thing, since all/many of the 
> corruptions seem to come from uevent environment variable strings.

At least one susbsystem rolls its own method of adding env vars to the
uevent buffer, and it's so broken it triggers the WARN_ON() in
lib/vsprintf.c::vsnprintf() by passing a negative length to that function.
Start at drivers/input/input.c::input_dev_uevent() and watch the fun.

I reported this to linux-kernel, the input maintainer and the author
of that code on Feb. 26:

        http://lkml.org/lkml/2006/2/26/39


-- 
Chuck
"Penguins don't come from next door, they come from the Antarctic!"


^ permalink raw reply	[flat|nested] 28+ messages in thread
[parent not found: <20060304121723.19fe9b4b.akpm@osdl.org>]

end of thread, other threads:[~2006-03-08  6:15 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-08  3:29 Fw: Re: oops in choose_configuration() Chuck Ebbert
2006-03-08  3:48 ` Dmitry Torokhov
2006-03-08  4:01 ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2006-03-07 21:54 Chuck Ebbert
2006-03-08  0:54 ` Greg KH
2006-03-08  0:57 ` Linus Torvalds
2006-03-08  1:13   ` Dmitry Torokhov
2006-03-08  1:27     ` Greg KH
2006-03-08  3:22       ` Dmitry Torokhov
2006-03-08  5:23         ` Greg KH
2006-03-08  6:06           ` Dmitry Torokhov
2006-03-08  6:15             ` Greg KH
2006-03-08  4:28   ` Joe Korty
2006-03-08  4:44     ` Dmitry Torokhov
     [not found] <20060304121723.19fe9b4b.akpm@osdl.org>
     [not found] ` <Pine.LNX.4.64.0603041235110.22647@g5.osdl.org>
     [not found]   ` <20060304213447.GA4445@kroah.com>
     [not found]     ` <20060304135138.613021bd.akpm@osdl.org>
     [not found]       ` <20060304221810.GA20011@kroah.com>
2006-03-05 23:48         ` Andrew Morton
2006-03-06  3:27           ` Linus Torvalds
2006-03-06  8:48             ` Andrew Morton
2006-03-08  1:31               ` Greg KH
2006-03-08  1:49                 ` Andrew Morton
2006-03-06  5:00           ` Linus Torvalds
2006-03-06  7:47             ` Mike Galbraith
2006-03-07  5:51               ` Mike Galbraith
2006-03-07  5:56                 ` Nick Piggin
2006-03-06  9:14             ` Ingo Molnar
2006-03-06 10:31             ` Andrew Morton
2006-03-06 11:04           ` Jesper Juhl
2006-03-06 11:15             ` Andrew Morton
2006-03-06 15:59               ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox