From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A9EC18A41F for ; Tue, 2 Aug 2022 12:05:07 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 99AC037274 for ; Tue, 2 Aug 2022 12:04:37 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 2 Aug 2022 12:04:36 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A3BA342D63 for ; Tue, 2 Aug 2022 12:04:36 +0200 (CEST) Message-ID: Date: Tue, 2 Aug 2022 12:04:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: pve-devel@lists.proxmox.com, Mira Limbeck References: <20220726122506.1482590-1-f.ebner@proxmox.com> From: Fiona Ebner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.041 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: Re: [pve-devel] [PATCH qemu] avoid segfault when aborting snapshot X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2022 10:05:07 -0000 Am 02.08.22 um 11:52 schrieb Mira Limbeck: > On 7/26/22 14:25, Fiona Ebner wrote: >> Reported in the community forum[0]. >> >> For 6.1.0, there were a few changes to the coroutine-sleep API, but >> the adaptations in f376b2b ("update and rebase to QEMU v6.1.0") made >> a mistake. >> >> Currently, target_close_wait is NULL when passed to >> qemu_co_sleep_ns_wakeable(), which further passes it to >> qemu_co_sleep(), but there, it is dereferenced when trying to access >> the 'to_wake' member: >> >>> Thread 1 "kvm" received signal SIGSEGV, Segmentation fault. >>> qemu_co_sleep (w=0x0) at ../util/qemu-coroutine-sleep.c:57 >> To fix it, create a proper struct and pass its address instead. Also >> call qemu_co_sleep_wake unconditionally, because the NULL check (for >> the 'to_wake' member) is done inside the function itself. >> >> This patch is based on what the QEMU commits introducing the changes >> to the coroutine-sleep API did to the callers in QEMU: >> eaee072085 ("coroutine-sleep: allow qemu_co_sleep_wake that wakes >> nothing") >> 29a6ea24eb ("coroutine-sleep: replace QemuCoSleepState pointer with >> struct in the API") >> >> [0]: https://forum.proxmox.com/threads/112130/ >> >> Signed-off-by: Fiona Ebner >> --- > > Tested-by: Mira Limbeck > > > Found a strange behavior when aborting the snapshot. It no longer > crashes, but trying to snapshot the VM again leads to instant failure. > > After the failed snapshot, the next one works again. So some state > doesn't seem to be cleaned up the first time. Thanks for testing! This behavior was present even before 6.1.0, so not related to the patch, but I wasn't entirely sure if it'd be fine to just set the status to SAVE_STATE_DONE in qmp_savevm_end() after abort. I'll take another look and send a follow-up. It's probably fine in case the state file has been closed successfully, but I'll need to check the users in qemu-server and test it.