[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100630092828.3903.A69D9226@jp.fujitsu.com>
Date: Wed, 30 Jun 2010 09:31:29 +0900 (JST)
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: kosaki.motohiro@...fujitsu.com,
Kees Cook <kees.cook@...onical.com>,
linux-kernel@...r.kernel.org, Greg Kroah-Hartman <gregkh@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Tejun Heo <tj@...nel.org>,
Veaceslav Falico <vfalico@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Oleg Nesterov <oleg@...hat.com>,
Neil Horman <nhorman@...driver.com>,
Roland McGrath <roland@...hat.com>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
Stefani Seibold <stefani@...bold.net>,
Thomas Gleixner <tglx@...utronix.de>,
Eric Paris <eparis@...hat.com>,
James Morris <jmorris@...ei.org>,
"Andrew G. Morgan" <morgan@...nel.org>,
Dhaval Giani <dhaval.giani@...il.com>,
"Serge E. Hallyn" <serue@...ibm.com>,
Steve Grubb <sgrubb@...hat.com>,
Christoph Hellwig <hch@....de>, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2] sanitize task->comm to avoid leaking escape codes
> > This patch sanitizes task->comm to only contain printable characters
> > when it is set. Additionally, it redefines get_task_comm so that it is
> > more obvious when misused by callers (presently nothing was incorrectly
> > calling get_task_comm's unsafe use of strncpy).
>
> This is a regression for tools that correctly handle unmutilated data.
>
> > + /* sanitize non-printable characters */
> > + for (i = 0; buf[i] && i < (sizeof(tsk->comm) - 1); i++) {
> > + if (!isprint(buf[i]))
> > + tsk->comm[i] = '?';
>
> The kernel "isprint" isn't adequate for this. comm is set by the shell
> based on argv[0] usually which means that in normal situations it is a
> UTF-8 string.
Ah, I recall one use case. In past, some IBM folks talked about they
want to map Java thread name to prctl(PR_SET_NAME). In such case,
utf-8 name is very common.
So, I agree with you.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists