Re: [PATCH] pktgen: Remove a dangerous debug print.

From: Nelson Elhage
Date: Wed Oct 27 2010 - 15:28:19 EST


How would you feel about limiting the debug print to at most, say, 512 or 1024
bytes? Even if it's only accessible to root by default, I don't a userspace
program should be able to accidentally corrupt the kernel stack by writing too
many bytes to a file in /proc.

- Nelson

On Wed, Oct 27, 2010 at 12:21:43PM -0700, David Miller wrote:
> From: Nelson Elhage <nelhage@xxxxxxxxxxx>
> Date: Wed, 27 Oct 2010 15:13:08 -0400
>
> > We were allocating an arbitrarily-large buffer on the stack, which would allow a
> > buggy or malicious userspace program to overflow the kernel stack.
> >
> > Since the debug printk() was just printing exactly the text passed from
> > userspace, it's probably just as easy for anyone who might use it to augment (or
> > just strace(1)) the program writing to the pktgen file, so let's just not bother
> > trying to print the whole buffer.
> >
> > Signed-off-by: Nelson Elhage <nelhage@xxxxxxxxxxx>
>
> Only root can write to the pktgen control file.
>
> Also, the debug feature really is used by people's pktgen scripts, you
> can't just turn it off.
--
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/