[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8736f4g4yz.fsf@x220.int.ebiederm.org>
Date: Sun, 03 Nov 2019 13:00:36 -0600
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Chris Down <chris@...isdown.name>,
Johannes Weiner <hannes@...xchg.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH] kernel: sysctl: make drop_caches write-only
Alexey Dobriyan <adobriyan@...il.com> writes:
> On Fri, Nov 01, 2019 at 12:35:44PM -0700, Andrew Morton wrote:
>> On Fri, 1 Nov 2019 12:29:20 -0700 Andrew Morton <akpm@...ux-foundation.org> wrote:
>>
>> > > Either change is an upgrade from the current situation, at least. I prefer
>> > > towards whatever makes the API the least confusing, which appears to be
>> > > Johannes' original change, but I'd support a patch which always set it to
>> > > 0 instead if it was deemed safer.
>> >
>> > On the other hand.. As I mentioned earlier, if someone's code is
>> > failing because of the permissions change, they can chmod
>> > /proc/sys/vm/drop_caches at boot time and be happy. They have no such
>> > workaround if their software misbehaves due to a read always returning
>> > "0".
>>
>> I lied. I can chmod things in /proc but I can't chmod things in
>> /proc/sys/vm. Huh, why did we do that?
>
> To conserve memory! It was in 2007.
> For the record I support 0200 on vm.drop_caches.
>
> commit 77b14db502cb85a031fe8fde6c85d52f3e0acb63
> [PATCH] sysctl: reimplement the sysctl proc support
>
> +static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
> +{
> + struct inode *inode = dentry->d_inode;
> + int error;
> +
> + if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))
> + return -EPERM;
Almost.
The rewrite was both to concerve memory and to support the network
namespace. Which required a different view of proc files.
But in this case we have always unconditionally called sysctl_perm. The
change above at best removed a layer of obfuscation that made it look
like some other permission check was being honored.
Eric
Powered by blists - more mailing lists