From: Matthew Wilcox <willy@infradead.org>
To: Greg Hackmann <ghackmann@android.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Omer Tripp <trippo@google.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
gregkh@linuxfoundation.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] fs: fix possible Spectre V1 indexing in __close_fd()
Date: Mon, 24 Dec 2018 06:40:21 -0800 [thread overview]
Message-ID: <20181224144021.GN10600@bombadil.infradead.org> (raw)
In-Reply-To: <20181224142642.7385-1-ghackmann@android.com>
On Mon, Dec 24, 2018 at 06:26:42AM -0800, Greg Hackmann wrote:
> +++ b/fs/file.c
> @@ -18,6 +18,7 @@
> #include <linux/bitops.h>
> #include <linux/spinlock.h>
> #include <linux/rcupdate.h>
> +#include <linux/nospec.h>
>
> unsigned int sysctl_nr_open __read_mostly = 1024*1024;
> unsigned int sysctl_nr_open_min = BITS_PER_LONG;
> @@ -626,6 +627,7 @@ int __close_fd(struct files_struct *files, unsigned fd)
> fdt = files_fdtable(files);
> if (fd >= fdt->max_fds)
> goto out_unlock;
> + fd = array_index_nospec(fd, fdt->max_fds);
> file = fdt->fd[fd];
> if (!file)
> goto out_unlock;
This is insufficient. do_dup2() has a similar problem.
prev parent reply other threads:[~2018-12-24 14:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-24 14:26 [PATCH v2] fs: fix possible Spectre V1 indexing in __close_fd() Greg Hackmann
2018-12-24 14:40 ` Matthew Wilcox [this message]
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=20181224144021.GN10600@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=ghackmann@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=trippo@google.com \
--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;
as well as URLs for NNTP newsgroup(s).