From: Waiman Long <longman@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>,
Kees Cook <keescook@chromium.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 2/3] sysctl: Warn when a clamped sysctl parameter is set out of range
Date: Wed, 21 Feb 2018 10:24:05 -0500 [thread overview]
Message-ID: <60a7ee3c-d6f9-c124-b0a0-e31bafa7a62e@redhat.com> (raw)
In-Reply-To: <20180220151705.8b4519f105db8f5c119015f0@linux-foundation.org>
On 02/20/2018 06:17 PM, Andrew Morton wrote:
> On Mon, 19 Feb 2018 11:53:50 -0500 Waiman Long <longman@redhat.com> wrote:
>
>> Even with clamped sysctl parameters, it is still not that straight
>> forward to figure out the exact range of those parameters. One may
>> try to write extreme parameter values to see if they get clamped.
>> To make it easier, a warning with the expected range will now be
>> printed in the kernel ring buffer when a clamped sysctl parameter
>> receives an out of range value.
> This assumes that do_proc_dointvec_minmax_conv() and
> do_proc_douintvec_minmax_conv() are only ever called by privileged
> userspace. Because we mustn't give unprivileged applications a way to
> spam the kernel logs.
>
> That's presumably true in the case of the caller you just added, but I
> don't see what we can do to guarantee this in the future, so perhaps we
> should add some permission check to the pr_warn()?
>
Good point. Beside adding security check, another alternative is to use
some kind of warn_once() for each sysctl parameter. That will limit the
amount of spamming that is possible. It will require adding a flag to
the ctl_table to mark an entry as warned. I think that will be less
tricky than adding permission check.
I can also use the new flag to designate that a sysctl parameter need to
be clamped to the range instead of failing when out of range. With that,
I don't need to introduce new clamping APIs. I can use the existing
ones. I will work on v2 patch with that change.
Thanks,
Longman
next prev parent reply other threads:[~2018-02-21 15:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-19 16:53 [PATCH 0/3] ipc: Clamp msgmni and shmmni to the real IPC_MNI limit Waiman Long
2018-02-19 16:53 ` [PATCH 1/3] sysctl: Add range clamping intvec helper functions Waiman Long
2018-02-20 23:41 ` Luis R. Rodriguez
2018-02-21 16:58 ` Waiman Long
2018-02-19 16:53 ` [PATCH 2/3] sysctl: Warn when a clamped sysctl parameter is set out of range Waiman Long
2018-02-20 23:17 ` Andrew Morton
2018-02-20 23:55 ` Luis R. Rodriguez
2018-02-21 1:26 ` Kees Cook
2018-02-21 15:33 ` Waiman Long
2018-02-21 15:24 ` Waiman Long [this message]
2018-02-19 16:53 ` [PATCH 3/3] ipc: Clamp msgmni and shmmni to the real IPC_MNI limit Waiman Long
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=60a7ee3c-d6f9-c124-b0a0-e31bafa7a62e@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
Powered by JetHome