linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] kernel: sysctl: make drop_caches write-only
Date: Thu, 31 Oct 2019 16:28:25 -0700	[thread overview]
Message-ID: <20191031162825.a545a5d4d8567368501769bd@linux-foundation.org> (raw)
In-Reply-To: <20191031221602.9375-1-hannes@cmpxchg.org>

On Thu, 31 Oct 2019 18:16:02 -0400 Johannes Weiner <hannes@cmpxchg.org> wrote:

> Currently, the drop_caches proc file and sysctl read back the last
> value written, suggesting this is somehow a stateful setting instead
> of a one-time command. Make it write-only, like e.g. compact_memory.
> 
> ...
>
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -1474,7 +1474,7 @@ static struct ctl_table vm_table[] = {
>  		.procname	= "drop_caches",
>  		.data		= &sysctl_drop_caches,
>  		.maxlen		= sizeof(int),
> -		.mode		= 0644,
> +		.mode		= 0200,
>  		.proc_handler	= drop_caches_sysctl_handler,
>  		.extra1		= SYSCTL_ONE,
>  		.extra2		= &four,

hm.

Risk: some (odd) userspace code will break.  Fixable by manually chmodding
it back again.

Reward: very little.

Is the reward worth the risk?


  reply	other threads:[~2019-10-31 23:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 22:16 [PATCH] kernel: sysctl: make drop_caches write-only Johannes Weiner
2019-10-31 23:28 ` Andrew Morton [this message]
2019-11-01 11:09   ` Chris Down
2019-11-01 11:09     ` Chris Down
2019-11-01 14:45     ` Johannes Weiner
2019-11-01 18:59       ` Andrew Morton
2019-11-01 19:24         ` Chris Down
2019-11-01 19:29           ` Andrew Morton
2019-11-01 19:35             ` Andrew Morton
2019-11-02 15:55               ` Alexey Dobriyan
2019-11-03 19:00                 ` Eric W. Biederman
2019-11-01 10:58 ` Chris Down
2019-11-04 10:37 ` David Hildenbrand
2019-11-04 13:25 ` Vlastimil Babka
2019-11-05  6:20 ` Michal Hocko

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=20191031162825.a545a5d4d8567368501769bd@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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;
as well as URLs for NNTP newsgroup(s).