qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, hreitz@redhat.com, t.lamprecht@proxmox.com,
	d.csapak@proxmox.com, berrange@redhat.com
Subject: Re: [PATCH v2] vl: defuse PID file path resolve error
Date: Tue, 24 Jan 2023 14:55:07 +0100	[thread overview]
Message-ID: <d4384eef-f55b-8ca8-9aeb-5ff77ceae8c2@proxmox.com> (raw)
In-Reply-To: <20221031094716.39786-1-f.ebner@proxmox.com>

Am 31.10.22 um 10:47 schrieb Fiona Ebner:
> Commit 85c4bf8aa6 ("vl: Unlink absolute PID file path") introduced a
> critical error when the PID file path cannot be resolved. Before this
> commit, it was possible to invoke QEMU when the PID file was a file
> created with mkstemp that was already unlinked at the time of the
> invocation. There might be other similar scenarios.
> 
> It should not be a critical error when the PID file unlink notifier
> can't be registered, because the path can't be resolved. If the file
> is already gone from QEMU's perspective, silently ignore the error.
> Otherwise, only print a warning.
> 
> Fixes: 85c4bf8aa6 ("vl: Unlink absolute PID file path")
> Reported-by: Dominik Csapak <d.csapak@proxmox.com>
> Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> 
> v1 -> v2:
>     * Ignore error if errno == ENOENT.
> 
>  softmmu/vl.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index b464da25bc..cf2c591ba5 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -2432,10 +2432,11 @@ static void qemu_maybe_daemonize(const char *pid_file)
>  
>          pid_file_realpath = g_malloc0(PATH_MAX);
>          if (!realpath(pid_file, pid_file_realpath)) {
> -            error_report("cannot resolve PID file path: %s: %s",
> -                         pid_file, strerror(errno));
> -            unlink(pid_file);
> -            exit(1);
> +            if (errno != ENOENT) {
> +                warn_report("not removing PID file on exit: cannot resolve PID "
> +                            "file path: %s: %s", pid_file, strerror(errno));
> +            }
> +            return;
>          }
>  
>          qemu_unlink_pidfile_notifier = (struct UnlinkPidfileNotifier) {

Ping



  parent reply	other threads:[~2023-01-24 13:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31  9:47 [PATCH v2] vl: defuse PID file path resolve error Fiona Ebner
2022-11-07 13:05 ` Hanna Reitz
2023-01-24 13:55 ` Fiona Ebner [this message]
2023-03-15  8:52   ` Fiona Ebner
2023-03-15 10:48 ` Paolo Bonzini

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=d4384eef-f55b-8ca8-9aeb-5ff77ceae8c2@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=berrange@redhat.com \
    --cc=d.csapak@proxmox.com \
    --cc=hreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=t.lamprecht@proxmox.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;
as well as URLs for NNTP newsgroup(s).