From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751632AbaJVNj1 (ORCPT ); Wed, 22 Oct 2014 09:39:27 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:44057 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbaJVNj0 (ORCPT ); Wed, 22 Oct 2014 09:39:26 -0400 Date: Wed, 22 Oct 2014 06:39:19 -0700 From: "Paul E. McKenney" To: Kees Cook Cc: linux-kernel@vger.kernel.org, Andrew Morton , Ingo Molnar , Rik van Riel , David Rientjes , Aaron Tomlin , Dario Faggioli , Andi Kleen , Peter Zijlstra , Jens Axboe Subject: Re: [PATCH] sysctl: terminate strings also on \r Message-ID: <20141022133919.GS4977@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20141021202137.GA20114@www.outflux.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141021202137.GA20114@www.outflux.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14102213-0021-0000-0000-00000593E96D Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 21, 2014 at 01:21:37PM -0700, Kees Cook wrote: > From: Paul Wise > > This partially mitigates a common strategy used by attackers for hiding > the full contents of strings in procfs from naive sysadmins who use cat, > more or sysctl to inspect the contents of strings in procfs. > > References: http://www.jakoblell.com/blog/2014/05/07/hacking-contest-hiding-stuff-from-the-terminal/ > Signed-off-by: Paul Wise > Signed-off-by: Kees Cook Acked-by: Paul E. McKenney > --- > kernel/sysctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index 4aada6d9fe74..c34c9414caac 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -1739,7 +1739,7 @@ static int _proc_do_string(char *data, int maxlen, int write, > while ((p - buffer) < *lenp && len < maxlen - 1) { > if (get_user(c, p++)) > return -EFAULT; > - if (c == 0 || c == '\n') > + if (c == 0 || c == '\n' || c == '\r') > break; > data[len++] = c; > } > -- > 1.9.1 > > > -- > Kees Cook > Chrome OS Security >