mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: Sven Schnelle <svens@linux.ibm.com>
Cc: Mark Brown <broonie@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Jann Horn <jannh@google.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: Test failure from "file: convert to SLAB_TYPESAFE_BY_RCU"
Date: Fri, 6 Oct 2023 15:21:30 +0200	[thread overview]
Message-ID: <20231006132130.bpekoewcsjqz4qps@f> (raw)
In-Reply-To: <yt9d4jj3zzbn.fsf@linux.ibm.com>

On Fri, Oct 06, 2023 at 02:54:04PM +0200, Sven Schnelle wrote:
> Mateusz Guzik <mjguzik@gmail.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)

  reply	other threads:[~2023-10-06 13:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06  0:04 Mark Brown
2023-10-06  8:38 ` Christian Brauner
2023-10-06 19:47   ` Christian Brauner
2023-10-06  9:19 ` Sven Schnelle
2023-10-06 12:39   ` Mateusz Guzik
2023-10-06 12:54     ` Sven Schnelle
2023-10-06 13:21       ` Mateusz Guzik [this message]
2023-10-06 19:49     ` Christian Brauner

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=20231006132130.bpekoewcsjqz4qps@f \
    --to=mjguzik@gmail.com \
    --cc=brauner@kernel.org \
    --cc=broonie@kernel.org \
    --cc=jannh@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /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

Powered by JetHome