[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181224144021.GN10600@bombadil.infradead.org>
Date: Mon, 24 Dec 2018 06:40:21 -0800
From: Matthew Wilcox <willy@...radead.org>
To: Greg Hackmann <ghackmann@...roid.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Omer Tripp <trippo@...gle.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
stable@...r.kernel.org
Subject: Re: [PATCH v2] fs: fix possible Spectre V1 indexing in __close_fd()
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.
Powered by blists - more mailing lists