All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	"Kernel Mailing List, Linux" <linux-kernel@vger.kernel.org>,
	kvm <kvm@vger.kernel.org>
Subject: Re: [RFC PATCH kernel] KVM: Stop leaking memory in debugfs
Date: Tue, 3 Aug 2021 15:29:16 +0200	[thread overview]
Message-ID: <CABgObfamvoMai1b9hrPkt1uwgw0kozhU5V_Vvk1__k_sGnx4LA@mail.gmail.com> (raw)
In-Reply-To: <YQlAl7/GSHWwkzEj@kroah.com>

> So userspace can create kvm resources with duplicate names?  That feels
> wrong to me.

Yes, the name is just the (pid, file descriptor). It's used only for
debugfs, and it's not really likely going to happen unless a program
does it on purpose, but the ugliness/wrongness is one of the reasons
why we now have a non-debugfs mechanism to retrieve the stats.

> But if all that is "duplicate" is the debugfs kvm directory, why not ask
> debugfs if it is already present before trying to create it again?  That
> way you will not have debugfs complain about duplicate
> files/directories.

That would also be racy; it would need a simple mutex around
debugfs_lookup and debugfs_create_dir. But it would indeed avoid the
complaints altogether, so I'll prepare a patch.  Thanks,

Paolo


  reply	other threads:[~2021-08-03 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30  4:32 [RFC PATCH kernel] KVM: Stop leaking memory in debugfs Alexey Kardashevskiy
2021-08-03 11:16 ` Greg KH
2021-08-03 12:52   ` Paolo Bonzini
2021-08-03 13:11     ` Greg KH
2021-08-03 13:29       ` Paolo Bonzini [this message]
2021-08-03 13:13     ` Alexey Kardashevskiy

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=CABgObfamvoMai1b9hrPkt1uwgw0kozhU5V_Vvk1__k_sGnx4LA@mail.gmail.com \
    --to=pbonzini@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.