All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Cahalan <albert@users.sf.net>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: unsafe printk
Date: 17 Oct 2003 19:52:55 -0400	[thread overview]
Message-ID: <1066434774.15920.217.camel@cube> (raw)
In-Reply-To: <20031017095240.GB7738@elf.ucw.cz>

On Fri, 2003-10-17 at 05:52, Pavel Machek wrote:
> Hi!
> 
> > Suppose I name an executable this:
> > "\n<0>Oops: EIP=0"
> > 
> > That comes out as a KERN_EMERG log message,
> > hitting the console and maybe a pager even.
> > 
> > There seem to be a number of places in the
> > kernel that printk current->comm without
> > concern for what it may contain.
> > 
> > Escape codes and non-ASCII can make for some
> > interesting log messages as well. Terminals
> > may have some programmable keys or answerback
> > messages. So one day root is using grep on
> > the log files, and they program the answerback
> > string to contain a "\r\nrm -r /\r\n"...
> 
> Or at least you can make his terminal pink ;-). Unfortunately same
> problem is with userland programs; root does ps and his terminal goes
> pink. Sanitizing kernel messages would be good start, but ps&friends
> and ls&friends need to be sanitized, too.

Both ps and ls are protected. At least with the
procps-3.1.xx code, w and top are also protected.

So anyway, what to do about the kernel messages?
One option is to just mangle comm up front. Another
option is to provide a formatting function for
safe printing.



  reply	other threads:[~2003-10-18  0:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-17  1:36 unsafe printk Albert Cahalan
2003-10-17  9:52 ` Pavel Machek
2003-10-17 23:52   ` Albert Cahalan [this message]
2003-10-17 12:38 ` Richard B. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1066434774.15920.217.camel@cube \
    --to=albert@users.sf.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.