All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	James Morris <jmorris@namei.org>, Ingo Molnar <mingo@elte.hu>,
	Namhyung Kim <namhyung@gmail.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	kernel-hardening@lists.openwall.com,
	linux-kernel@vger.kernel.org, security@kernel.org
Subject: [kernel-hardening] Re: [PATCH] kernel: escape non-ASCII and control characters in printk()
Date: Wed, 22 Jun 2011 21:48:12 +0400	[thread overview]
Message-ID: <20110622174812.GA13392@albatros> (raw)
In-Reply-To: <1308762841.10423.28.camel@Joe-Laptop>

On Wed, Jun 22, 2011 at 10:14 -0700, Joe Perches wrote:
> On Wed, 2011-06-22 at 20:53 +0400, Vasiliy Kulikov wrote:
> > On Wed, Jun 22, 2011 at 09:38 -0700, Joe Perches wrote:
> > > > +	if ((c >= ' ' && c < 127) || c == '\n')
> > > 	if (isprint(c))
> > #define isprint(c)	((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
> > It slightly differs from what I've written.  It (1) lacks '\n',
> 
> You still need tab,

Correct.

> so:
> 
> if (isprint(c) || isspace(c))

No, it also allows vertical tabs.  Looking into __ctype only ' ', '\n' and
'\t' should be allowed among all _S, so

if (isprint(c) || (c == '\n') || (c == '\t'))


Thanks,

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

WARNING: multiple messages have this Message-ID (diff)
From: Vasiliy Kulikov <segoon@openwall.com>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	James Morris <jmorris@namei.org>, Ingo Molnar <mingo@elte.hu>,
	Namhyung Kim <namhyung@gmail.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	kernel-hardening@lists.openwall.com,
	linux-kernel@vger.kernel.org, security@kernel.org
Subject: Re: [PATCH] kernel: escape non-ASCII and control characters in printk()
Date: Wed, 22 Jun 2011 21:48:12 +0400	[thread overview]
Message-ID: <20110622174812.GA13392@albatros> (raw)
In-Reply-To: <1308762841.10423.28.camel@Joe-Laptop>

On Wed, Jun 22, 2011 at 10:14 -0700, Joe Perches wrote:
> On Wed, 2011-06-22 at 20:53 +0400, Vasiliy Kulikov wrote:
> > On Wed, Jun 22, 2011 at 09:38 -0700, Joe Perches wrote:
> > > > +	if ((c >= ' ' && c < 127) || c == '\n')
> > > 	if (isprint(c))
> > #define isprint(c)	((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
> > It slightly differs from what I've written.  It (1) lacks '\n',
> 
> You still need tab,

Correct.

> so:
> 
> if (isprint(c) || isspace(c))

No, it also allows vertical tabs.  Looking into __ctype only ' ', '\n' and
'\t' should be allowed among all _S, so

if (isprint(c) || (c == '\n') || (c == '\t'))


Thanks,

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

  reply	other threads:[~2011-06-22 17:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22  9:53 [kernel-hardening] [PATCH] kernel: escape non-ASCII and control characters in printk() Vasiliy Kulikov
2011-06-22  9:53 ` Vasiliy Kulikov
2011-06-22 15:37 ` [kernel-hardening] " Greg KH
2011-06-22 15:37   ` Greg KH
2011-06-22 16:13   ` [kernel-hardening] " Vasiliy Kulikov
2011-06-22 16:13     ` Vasiliy Kulikov
2011-06-23 13:36   ` [kernel-hardening] " Matthew Garrett
2011-06-23 13:36     ` Matthew Garrett
2011-06-23 21:44     ` [kernel-hardening] " Greg KH
2011-06-23 21:44       ` Greg KH
2011-07-11  6:37   ` [kernel-hardening] " Pavel Machek
2011-07-11  6:37     ` Pavel Machek
2011-06-22 16:38 ` [kernel-hardening] " Joe Perches
2011-06-22 16:38   ` Joe Perches
2011-06-22 16:53   ` [kernel-hardening] " Vasiliy Kulikov
2011-06-22 16:53     ` Vasiliy Kulikov
2011-06-22 17:14     ` [kernel-hardening] " Joe Perches
2011-06-22 17:14       ` Joe Perches
2011-06-22 17:48       ` Vasiliy Kulikov [this message]
2011-06-22 17:48         ` Vasiliy Kulikov
2011-06-22 18:10   ` [kernel-hardening] " Alan Cox
2011-06-22 18:10     ` Alan Cox
2011-06-22 19:07     ` [kernel-hardening] " Vasiliy Kulikov
2011-06-22 19:07       ` Vasiliy Kulikov
2011-06-23 18:11       ` [kernel-hardening] " Geert Uytterhoeven
2011-06-23 18:11         ` Geert Uytterhoeven
2011-06-25 20:52       ` [kernel-hardening] Re: [Security] " Willy Tarreau
2011-06-25 20:52         ` Willy Tarreau

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=20110622174812.GA13392@albatros \
    --to=segoon@openwall.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=jmorris@namei.org \
    --cc=joe@perches.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@gmail.com \
    --cc=security@kernel.org \
    /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.