public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>, Rik van Riel <riel@redhat.com>,
	David Rientjes <rientjes@google.com>,
	Aaron Tomlin <atomlin@redhat.com>,
	Dario Faggioli <raistlin@linux.it>,
	Andi Kleen <ak@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>, Jens Axboe <axboe@fb.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Paul Wise <pabs3@bonedaddy.net>
Subject: Re: [PATCH] sysctl: terminate strings also on \r
Date: Mon, 27 Oct 2014 10:56:26 +0100	[thread overview]
Message-ID: <20141027095626.GD9807@amd> (raw)
In-Reply-To: <CAGXu5j+sW89tZDA5GQnkL4E9wHTScftyxUhyAjbWnEfxGocBjg@mail.gmail.com>

On Wed 2014-10-22 16:43:10, Kees Cook wrote:
> On Wed, Oct 22, 2014 at 4:26 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
> > On Tue, 21 Oct 2014 13:21:37 -0700 Kees Cook <keescook@chromium.org> wrote:
> >
> >> From: Paul Wise <pabs3@bonedaddy.net>
> >>
> >> 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.
> >>
> >> ...
> >>
> >> --- 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;
> >>               }
> >
> > There are no valid uses of \r in a procfs write?
> 
> I struggle to imagine one; everything I found that uses proc_dostring
> seems to be names, paths, and commands.

Well, filename can contain \r, right?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2014-10-27  9:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21 20:21 [PATCH] sysctl: terminate strings also on \r Kees Cook
2014-10-22 10:03 ` Aaron Tomlin
2014-10-22 13:39 ` Paul E. McKenney
2014-10-22 22:49 ` David Rientjes
2014-10-22 23:26 ` Andrew Morton
2014-10-22 23:43   ` Kees Cook
2014-10-23  2:00     ` Andrew Morton
2014-10-23 16:39       ` Kees Cook
2014-10-23 18:23         ` Andrew Morton
2014-10-23 18:50           ` Kees Cook
2014-10-27  9:56     ` Pavel Machek [this message]
2014-10-27 10:11       ` Geert Uytterhoeven
2014-10-27 12:01         ` Pavel Machek

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=20141027095626.GD9807@amd \
    --to=pavel@ucw.cz \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=atomlin@redhat.com \
    --cc=axboe@fb.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pabs3@bonedaddy.net \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=raistlin@linux.it \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox