From: Al Viro <viro@ZenIV.linux.org.uk>
To: Christian Brauner <christian@brauner.io>
Cc: keescook@chromium.org, linux-kernel@vger.kernel.org,
ebiederm@xmission.com, mcgrof@kernel.org,
akpm@linux-foundation.org, joe.lawrence@redhat.com,
longman@redhat.com, linux@dominikbrodowski.net,
adobriyan@gmail.com, linux-api@vger.kernel.org,
Andrea Arcangeli <aarcange@redhat.com>,
Miklos Szeredi <miklos@szeredi.hu>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH v3 2/2] sysctl: handle overflow for file-max
Date: Wed, 17 Oct 2018 01:35:48 +0100 [thread overview]
Message-ID: <20181017003548.GA32577@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20181016223322.16844-3-christian@brauner.io>
On Wed, Oct 17, 2018 at 12:33:22AM +0200, Christian Brauner wrote:
> Currently, when writing
>
> echo 18446744073709551616 > /proc/sys/fs/file-max
>
> /proc/sys/fs/file-max will overflow and be set to 0. That quickly
> crashes the system.
> This commit sets the max and min value for file-max and returns -EINVAL
> when a long int is exceeded. Any higher value cannot currently be used as
> the percpu counters are long ints and not unsigned integers. This behavior
> also aligns with other tuneables that return -EINVAL when their range is
> exceeded. See e.g. [1], [2] and others.
Mostly sane, but... get_max_files() users are bloody odd. The one in
file-max limit reporting looks like a half-arsed attempt in "[PATCH] fix
file counting". The one in af_unix.c, though... I don't remember how
that check had come to be - IIRC that was a strange fallout of a thread
with me, Andrea and ANK involved, circa 1999, but I don't remember details;
Andrea, any memories? It might be worth reconsidering... The change in
question is in 2.2.4pre6; what do we use unix_nr_socks for? We try to
limit the number of PF_UNIX socks by 2 * max_files, but max_files can be
huge *and* non-constant (i.e. it can decrease). What's more, unix_tot_inflight
is unsigned int and max_files might exceed 2^31 just fine since "fs: allow
for more than 2^31 files" back in 2010... Something's fishy there...
next prev parent reply other threads:[~2018-10-17 0:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 22:33 [PATCH v3 0/2] sysctl: handle overflow for file-max Christian Brauner
2018-10-16 22:33 ` [PATCH v3 1/2] sysctl: handle overflow in proc_get_long Christian Brauner
2018-10-16 23:45 ` Eric W. Biederman
2018-10-17 0:24 ` Christian Brauner
2018-10-17 2:19 ` Kees Cook
2018-10-16 22:33 ` [PATCH v3 2/2] sysctl: handle overflow for file-max Christian Brauner
2018-10-17 0:35 ` Al Viro [this message]
2018-10-17 9:57 ` Christian Brauner
2018-10-18 21:58 ` Andrea Arcangeli
2018-10-16 22:36 ` [PATCH v3 0/2] " Kees Cook
2018-10-29 14:58 ` Christian Brauner
2018-10-29 21:44 ` Kees Cook
2018-12-09 16:40 ` Christian Brauner
2018-12-10 17:51 ` 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=20181017003548.GA32577@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=aarcange@redhat.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=christian@brauner.io \
--cc=ebiederm@xmission.com \
--cc=eric.dumazet@gmail.com \
--cc=joe.lawrence@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=longman@redhat.com \
--cc=mcgrof@kernel.org \
--cc=miklos@szeredi.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.