[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231006132130.bpekoewcsjqz4qps@f>
Date: Fri, 6 Oct 2023 15:21:30 +0200
From: Mateusz Guzik <mjguzik@...il.com>
To: Sven Schnelle <svens@...ux.ibm.com>
Cc: Mark Brown <broonie@...nel.org>,
Christian Brauner <brauner@...nel.org>,
Jann Horn <jannh@...gle.com>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: Test failure from "file: convert to SLAB_TYPESAFE_BY_RCU"
On Fri, Oct 06, 2023 at 02:54:04PM +0200, Sven Schnelle wrote:
> Mateusz Guzik <mjguzik@...il.com> writes:
>
> > On Fri, Oct 06, 2023 at 11:19:58AM +0200, Sven Schnelle wrote:
> >> I'm seeing the same with the strace test-suite on s390. The problem is
> >> that /proc/*/fd now contains the file descriptors of the calling
> >> process, and not the target process.
> >>
> >
> > This is why:
> >
> > +static inline struct file *files_lookup_fdget_rcu(struct files_struct *files, unsigned int fd)
> > +{
> > + RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
> > + "suspicious rcu_dereference_check() usage");
> > + return lookup_fdget_rcu(fd);
> > +}
> >
> > files argument is now thrown away, instead it always uses current.
>
> Yes, passing files to lookup_fdget_rcu() fixes the issue.
so i wrote this as an immediate fixup. not the prettiest, but should
prevent the need to drop the patch from linux-next.
diff --git a/fs/file.c b/fs/file.c
index 2f6965848907..8d62d6f46982 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -1024,7 +1024,7 @@ static inline struct file *files_lookup_fdget_rcu(struct files_struct *files, un
{
RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
"suspicious rcu_dereference_check() usage");
- return lookup_fdget_rcu(fd);
+ return __fget_files_rcu(files, fd, 0);
}
struct file *task_lookup_fdget_rcu(struct task_struct *task, unsigned int fd)
Powered by blists - more mailing lists