Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932412Ab1FVSPb (ORCPT ); Wed, 22 Jun 2011 14:15:31 -0400 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:44766 "EHLO www.etchedpixels.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932276Ab1FVSPa (ORCPT ); Wed, 22 Jun 2011 14:15:30 -0400 Date: Wed, 22 Jun 2011 19:10:22 +0100 From: Alan Cox To: Joe Perches Cc: Vasiliy Kulikov , Andrew Morton , James Morris , Ingo Molnar , Namhyung Kim , Greg Kroah-Hartman , 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() Message-ID: <20110622191022.66135615@lxorguk.ukuu.org.uk> In-Reply-To: <1308760683.10423.16.camel@Joe-Laptop> References: <20110622095341.GA3353@albatros> <1308760683.10423.16.camel@Joe-Laptop> X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; x86_64-redhat-linux-gnu) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEWysKsSBQMIAwIZCwj///8wIhxoRDXH9QHCAAABeUlEQVQ4jaXTvW7DIBAAYCQTzz2hdq+rdg494ZmBeE5KYHZjm/d/hJ6NfzBJpp5kRb5PHJwvMPMk2L9As5Y9AmYRBL+HAyJKeOU5aHRhsAAvORQ+UEgAvgddj/lwAXndw2laEDqA4x6KEBhjYRCg9tBFCOuJFxg2OKegbWjbsRTk8PPhKPD7HcRxB7cqhgBRp9Dcqs+B8v4CQvFdqeot3Kov6hBUn0AJitrzY+sgUuiA8i0r7+B3AfqKcN6t8M6HtqQ+AOoELCikgQSbgabKaJW3kn5lBs47JSGDhhLKDUh1UMipwwinMYPTBuIBjEclSaGZUk9hDlTb5sUTYN2SFFQuPe4Gox1X0FZOufjgBiV1Vls7b+GvK3SU4wfmcGo9rPPQzgIabfj4TYQo15k3bTHX9RIw/kniir5YbtJF4jkFG+dsDK1IgE413zAthU/vR2HVMmFUPIHTvF6jWCpFaGw/A3qWgnbxpSm9MSmY5b3pM1gvNc/gQfwBsGwF0VCtxZgAAAAASUVORK5CYII= Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1402 Lines: 34 On Wed, 22 Jun 2011 09:38:03 -0700 Joe Perches wrote: > On Wed, 2011-06-22 at 13:53 +0400, Vasiliy Kulikov wrote: > > This patch escapes all characters outside of allowed '\n' plus 0x20-0x7E > > charset passed to printk(). I think this is fundamentally wrong. It makes sense for some interfaces but not others and arbitarily doing it makes a nasty mess of anything like file name printing in non English languages. The right way to do this IMHO is for the console device itself to have a filter function, the default would be the 0x20-0x7E but for example with any console which has an accompanying tty device the right behaviour depends upon the port UTF8 flag (IUTF8). If that is set you shouldn't be filtering out unicode, just control codes. Minor other nit is that you might want to allow BEL through and you certainly want to allow tab through. The core code should not be hardcoding policy assumptions about symbol sets and ASCII, for an awful lot of consoles today that assumption is just plain wrong, for others it makes sense So with tty maintainer hat on - NAK to the current approach but a good idea to do it properly. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/