mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>,
	Li Zefan <lizefan@huawei.com>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	Aaron Tomlin <atomlin@redhat.com>,
	Dario Faggioli <raistlin@linux.it>,
	Andrew Shewmaker <agshew@gmail.com>,
	Andi Kleen <ak@linux.intel.com>, Jens Axboe <axboe@fb.com>,
	Wanpeng Li <liwanp@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	Andrey Vagin <avagin@openvz.org>,
	Michael Ellerman <michael@ellerman.id.au>
Subject: Re: [PATCH v2 3/4] sysctl: allow for strict write position handling
Date: Tue, 22 Apr 2014 11:11:43 -0700	[thread overview]
Message-ID: <20140422111143.74a426009ee37027c948aebc@linux-foundation.org> (raw)
In-Reply-To: <CAGXu5jLBJynt81Y0HqWkPzFpa6ToR4SZk2ZLLjS3SPNNczTXNw@mail.gmail.com>

On Mon, 21 Apr 2014 21:52:48 -0700 Kees Cook <keescook@chromium.org> wrote:

> >> This provides CONFIG_PROC_SYSCTL_STRICT_WRITES as a way to make this
> >> behavior act in a less surprising manner for strings, and disallows
> >> non-zero file position when writing numeric sysctls (similar to what is
> >> already done when reading from non-zero file positions).
> >
> > Adding a Kconfig knob to alter the behavior of procfs writes creeps me
> > out.  I wonder why.
> >
> > - I doubt if many people have a sufficient amount of control over
> >   their entire systems to be able to confidently set
> >   CONFIG_PROC_SYSCTL_STRICT_WRITES.
> >
> > - Software will be shipped which runs OK with one setting but breaks
> >   with the other setting.
> >
> > So what to do?
> >
> > I think we can *detect* this situation easily enough.  So some options are
> >
> > a) change the behaviour and add code which detects when userspace is
> >    doing a write whose behaviour is now altered.  Print a warning.   Or
> >
> > b) leave the behaviour as-is.  Add a detector which tells people
> >    "hey, your userspace is probably broken - please fix".  Wait N
> >    years.  Then alter the behaviour as in a).
> >
> > In either case the detector should display current->comm, the procfs
> > pathname and the contents of the write, to aid people in hunting down
> > and fixing their userspace.
> 
> How about a tri-state sysctl (har har control sysctl behavior with a
> sysctl) that defaults ("1") to existing behavior (to not break
> anything) with a warning. Mode "2" uses new behavior, and mode "0"
> uses existing behavior without a warning? Then we can wait N years and
> switch the default to "2"?

Yes, I suppose that's more flexible.

I do have my doubts about whether we'll ever be able to change the
behaviour.  There will be soooo many random proc-pokers out there and
the amount of dusty-deck software will only increase over time.

I suppose the first thing to do is to get the warning in there and see
if we can get an understanding of how much code is likely to be
affected by the change.  Add "please email Kees" to the printk ;) I did
that once, many years ago.  I got a lot of email.  Didn't do it again.

  reply	other threads:[~2014-04-22 18:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-18  0:16 [PATCH v2 0/4] sysctl: fix incorrect " Kees Cook
2014-04-18  0:16 ` [PATCH v2 1/4] sysctl: clean up char buffer arguments Kees Cook
2014-04-18  0:28   ` Andi Kleen
2014-04-18  6:24     ` Kees Cook
2014-04-18  0:16 ` [PATCH v2 2/4] sysctl: refactor sysctl string writing logic Kees Cook
2014-04-18  0:16 ` [PATCH v2 3/4] sysctl: allow for strict write position handling Kees Cook
2014-04-21 22:45   ` Andrew Morton
2014-04-22  4:52     ` Kees Cook
2014-04-22 18:11       ` Andrew Morton [this message]
2014-04-22 18:37         ` Kees Cook
2014-04-18  0:16 ` [PATCH v2 4/4] test: validate CONFIG_PROC_SYSCTL_STRICT_WRITES Kees Cook

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=20140422111143.74a426009ee37027c948aebc@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=agshew@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=atomlin@redhat.com \
    --cc=avagin@openvz.org \
    --cc=axboe@fb.com \
    --cc=benh@kernel.crashing.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=dhowells@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwanp@linux.vnet.ibm.com \
    --cc=lizefan@huawei.com \
    --cc=mgorman@suse.de \
    --cc=michael@ellerman.id.au \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=raistlin@linux.it \
    --cc=rdunlap@infradead.org \
    --cc=riel@redhat.com \
    --cc=xemul@parallels.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

all inboxes | Powered by JetHome®