On Wed, Jan 3, 2018 at 8:44 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > On Thu, Jan 04, 2018 at 03:10:51AM +0000, Williams, Dan J wrote: > >> diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h >> index 1c65817673db..dbc12007da51 100644 >> --- a/include/linux/fdtable.h >> +++ b/include/linux/fdtable.h >> @@ -82,8 +82,10 @@ static inline struct file *__fcheck_files(struct files_struct *files, unsigned i >> { >> struct fdtable *fdt = rcu_dereference_raw(files->fdt); >> >> - if (fd < fdt->max_fds) >> + if (fd < fdt->max_fds) { >> + osb(); >> return rcu_dereference_raw(fdt->fd[fd]); >> + } >> return NULL; >> } > > ... and the point of that would be? Possibly revealing the value of files->fdt? > Why would that be a threat, assuming you manage to extract the information in > question in the first place? No, the concern is that an fd value >= fdt->max_fds may cause the cpu to read arbitrary memory addresses relative to files->fdt and userspace can observe that it got loaded. With the barrier the speculation stops and never allows that speculative read to issue. With the change, the cpu only issues a read for fdt->fd[fd] when fd is valid.