[kernel-hardening] Re: [PATCH] kernel: escape non-ASCII and control characters in printk()

Joe Perches
2011-06-22T17:14:01Z

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, so:

if (isprint(c) || isspace(c))

> (2) passes non-ASCII symbols.
> How would non-ASCII symbols look like if
> terminal doesn't support it? (I don't know, merely asking).

I believe most would work fine.

Are there any lp01's or la36's still connected
to a serial console?

I don't know what would happen to a 7 bit
ascii only device.