From nobody Sun Jul 26 11:50:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782832540; cv=none; d=zohomail.com; s=zohoarc; b=Q6o+XuAPjgiO4ExEYwMQypM0/4ge6C4gOJPr5PUVBZFoBKnuTvte3TEzklYA8Sl+AeXPpRJfcoL00wJ1OIg5HjkPpQ3Q3eVH2b8spwMq6XkZdQ8jXkg0IRoznMyNW+Z1aTFQXB9kDB111QnYrKeIVWax1ko4RfMDQPzmIW7dejs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782832540; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uGTJv8BibaaQwg0fFkStqS+PxU9L27C+O2oa1Tgv6o8=; b=ZeoxNh/vO41kcXNqJSRWaBuCaIOUn19wFLdLB57luVqMDbKKgtmtw/1KmXUU5CfExLeVov/vahrWnCFzRwUcny+++8xExw1nXSbddU7PooU7MWzmr92JaJQV66UraiOkVrKLML9qWKhnPYS7TS7X+BYWL9W4CDSeShldB1T8F3Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178283254012045.71241833797751; Tue, 30 Jun 2026 08:15:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1weaAy-0002Xr-PC; Tue, 30 Jun 2026 11:15:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaAw-0002Ws-T1 for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaAv-0008Nt-Cs for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:02 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-KeRt_UYDOfq4Uo1prGO9KQ-1; Tue, 30 Jun 2026 11:14:58 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF54A1955D92 for ; Tue, 30 Jun 2026 15:14:57 +0000 (UTC) Received: from localhost (unknown [10.44.22.3]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B9DF91956065; Tue, 30 Jun 2026 15:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782832500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uGTJv8BibaaQwg0fFkStqS+PxU9L27C+O2oa1Tgv6o8=; b=RYlFKDftMYTb7XFRjs2o5i+1X5Q1atWQQKRhtUuZTs3p11K5JywyojDsis3sOkVyZZ5Utq JAI7S/gBeWX4OShY0u2Ie+xpWCeKSNkWgS/sY7TBnU+h64YMoi31j+D39FyU1lnB5To+0L Nncdljwtzw3bz3tpak4WPwNTYlBCw/8= X-MC-Unique: KeRt_UYDOfq4Uo1prGO9KQ-1 X-Mimecast-MFC-AGG-ID: KeRt_UYDOfq4Uo1prGO9KQ_1782832498 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 30 Jun 2026 19:13:16 +0400 Subject: [GIT PULL 1/8] migration: add migration_guest_ram_loading() helper MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260630-dump-v1-1-7df3087dffc9@redhat.com> References: <20260630-dump-v1-0-7df3087dffc9@redhat.com> In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi X-Developer-Signature: v=1; a=openpgp-sha256; l=1816; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=6iybEM8W9c1zpK9W+Z63b64AjqD33BvV2hzwhGhl6cA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqQ91nM9wwgrjXc4KNI26Y4SUqaq87Dj1pxB1ua BJd0ACHH4GJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCakPdZwAKCRDa6OEJdZac 5Q8YEACVnkbmJ9DWzF8EVX0hg40DqQnakorDBlfV5E5djOnzcq4YxizVZOdT55Z6VYTdN9vkkAB hLyWvxELytytfP+eaaXVdb9brY/rEbfpzx4DFTzo6vLkMXCknlrOZV+wg8yMCBZuLOeD3+AMwI4 +ta1NQXh4lAc/H56ljxGu3BJuw99sheThfBr9rCgtNxdhz3fyZMpdfkJ/8vBekkLseF2Ra8hROP WGaRfx4/AImFXB0nlYb4ZY0BJq/wnJ3ENSblGrz+wbL4sOXcH8rMJT+bQKanbBJLsX016DTrHl/ IE3QbeziGpg7TQpNkzumt8z4BZezfnO/sVSRG95jhyTH7Dr5K1Dzg2ItwjeGEtwT2JeE2oHr6/h jDLTOFQAjykd5ErdyY/ZKKyogW6S+yz3EMDb2mBe+KofBLkPtS3O5jdgyfQFBv8H6CQynKNqDiG y1Z2HpCkz4pIATcKqwObvlKrhnfevzoMA8ujoTCrntDUiXM5yw1B0wb+WuG95EEybHZHtKAFIiM 0z6USUTAdF/UADlqa3hXf3jj1P3erjiKgj+yTQch7cOWxm8m8sBZvVB8D/FgC5s32HMv6VyVi1h RGCZes/3tP4jSKFJMl3Ubrb5aaLkcg6SqIlDlQvLAsyw//tb37HlrQeRAoRsiJ5OkPd9TaT6+Bx waRO+jN6uH4KAfg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1782832542877158501 From: "Denis V. Lunev" Operations that read guest RAM (dump-guest-memory, memsave, pmemsave) must refuse to run while the destination of a migration is still receiving that RAM: during precopy it is incomplete, and during postcopy a read faults the page in from the source. Provide a single predicate they can share instead of open-coding the runstate and postcopy checks. Signed-off-by: Denis V. Lunev Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260619101834.228432-2-den@openvz.org> --- include/migration/misc.h | 3 +++ migration/migration.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/migration/misc.h b/include/migration/misc.h index 3159a5e53c3..d3d6e1f50d1 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -117,6 +117,9 @@ void migration_file_set_error(int ret, Error *err); /* True if incoming migration entered POSTCOPY_INCOMING_DISCARD */ bool migration_in_incoming_postcopy(void); =20 +/* True while the destination still receives guest RAM (precopy or postcop= y) */ +bool migration_guest_ram_loading(void); + /* True if incoming migration entered POSTCOPY_INCOMING_ADVISE */ bool migration_incoming_postcopy_advised(void); =20 diff --git a/migration/migration.c b/migration/migration.c index 278cad502ae..0f56432d903 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1643,6 +1643,12 @@ bool migration_in_incoming_postcopy(void) return ps >=3D POSTCOPY_INCOMING_DISCARD && ps < POSTCOPY_INCOMING_END; } =20 +bool migration_guest_ram_loading(void) +{ + return runstate_check(RUN_STATE_INMIGRATE) || + migration_in_incoming_postcopy(); +} + bool migration_incoming_postcopy_advised(void) { PostcopyState ps =3D postcopy_state_get(); --=20 2.54.0 From nobody Sun Jul 26 11:50:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782832547; cv=none; d=zohomail.com; s=zohoarc; b=Pbzs43Czn9qdslhJahUj243noosaWhmcrLCB9eXnjI9Jc61HWtqOElGW546NZXpsouKWEbVe3rF4XeGUrMOgCP2IXStp2D4iK7/Cxn1KJqy5ITbc8qmYFyTPWQ7IFxLk9cuV3f1hrWsx0wIQEAsPFMGbT2p0kYE5XaF/7x7dPas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782832547; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=D9Q14PAE9pPdWglsxDRBhSOEwrj4jxBYYcicl1P2ux0=; b=DaSEPQ1y7hrXylyVuD1fy2fG8rknI3fe8o0Ft3g8ke+0ddwUX9TBGe1kJlIdsiptu7wk+W1tI/9mYaAQfvbE+72lEmIxiG+O5nSJ+1VdIlYE9XdoU6paRdIZM0atM1qFZ+RXjRnblxYoiyn7J74D/kZFMT8giosKEyDDmjoDARA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782832547388517.123927291998; Tue, 30 Jun 2026 08:15:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1weaB4-0002fq-Fm; Tue, 30 Jun 2026 11:15:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaB2-0002bJ-4m for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaB0-00008I-Ml for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:07 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-553-g04iUS9cOo2XyzXYIt-wZQ-1; Tue, 30 Jun 2026 11:15:03 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E8F871954B39 for ; Tue, 30 Jun 2026 15:15:02 +0000 (UTC) Received: from localhost (unknown [10.44.22.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EE878180067F; Tue, 30 Jun 2026 15:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782832506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D9Q14PAE9pPdWglsxDRBhSOEwrj4jxBYYcicl1P2ux0=; b=E8D+ZWV9JHXY3hxS0UzxD+ptitFzfn2AsqYsxZzHAZKSYO5c2G3C73noKdpcCJH8or9wRI hmiLbbmXHdWFuDmD5bdMxhhiMh7hoKITHurEIsr0btg9E5PJrMqrSjvg/WCP46zl+kYRP1 9nmJM2pY2ExREDH0HrpPnKh2Hi0pmOk= X-MC-Unique: g04iUS9cOo2XyzXYIt-wZQ-1 X-Mimecast-MFC-AGG-ID: g04iUS9cOo2XyzXYIt-wZQ_1782832503 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 30 Jun 2026 19:13:17 +0400 Subject: [GIT PULL 2/8] dump: refuse dump-guest-memory while guest RAM is being migrated MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260630-dump-v1-2-7df3087dffc9@redhat.com> References: <20260630-dump-v1-0-7df3087dffc9@redhat.com> In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi X-Developer-Signature: v=1; a=openpgp-sha256; l=1723; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=A2r/x2MO5sa7tnjKrukI/PrYT92CuCLxO/f5hhMN720=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqQ91nRrpbSEvnaq6Fo3BKxXk4Ik+6SSRiD4PDs g/i3DzZpEGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCakPdZwAKCRDa6OEJdZac 5TliEACtckkzd87HA51rV9NlwgQEUGWChPyZ0qVpt9feAQ+40E6X40HNeUOklj0PRURrppzMYWQ AvoXWUeCYKfcuWCi0eBSWSaZ+4fyMWyFwSbyKopULfwojZVsBssGAHPILiYG3SPdhCNfqrETgBq dICRsu6C2WyLQ3WDVC7q38dZebb+7/2WfNmoRNkIGFWbBJWSHyP/ZMhRtZTqknRpqyYHs5YRjtf gUsa2S6Q9gwPlq1vIXgWN+OU0trlD4wToChItbqewIz9Hlm5+AGKEtz9aCGkOKTOECRLjMe5sj0 uy1cJedW3LFCgEvO8NWUvw0+T/OZlzAI1GMzOBHDV3kOgce+wqG8R1mh/raq8LQrWaw3JLt+435 06kUmPF5pfEYY27Q7gL4hD7FSMtocuOy4iFMGqrppNALGTQL60bu93nREkWbacADlsTAMS/ApKq fLOkZV94j17S70TjqN5MvmXGMrpKwBk06032l2uOY2bWuH1xJKHCn02VR41TnDw0+crn//zHzLb aRn3EawFr28I8fzj00VyGxapZNgxzymtG+UKOrr7wixxZCFWSiTBmr6wM4VSujzVAn/R+F/STnL OQrRO4QkZ12d8hXpJh2U7sjYnFNeoh14Bwd0lfXxK61XRPOl5WbS51j2jzymZdmusAQmaghLGbo 69tb6U2cyLFE01A== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1782832550809158500 From: "Denis V. Lunev" dump-guest-memory reads all of guest RAM. The existing guard only rejects the dump in RUN_STATE_INMIGRATE, i.e. the precopy load phase. On a postcopy destination the guest already runs (RUN_STATE_RUNNING) while its pages are pulled from the source on demand. A non-detached dump reads that RAM on the main thread with the BQL held. Touching a not-yet-received page blocks on the userfault, and because the postcopy incoming path itself takes the BQL to install pages, the transfer that would satisfy the fault cannot progress: the VM deadlocks. Use migration_guest_ram_loading(), which also covers postcopy, so the dump is refused for the whole time the destination is still receiving guest RAM. Signed-off-by: Denis V. Lunev Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260619101834.228432-3-den@openvz.org> --- dump/dump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index eb2ee1c10df..7fa2d6f788c 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -30,6 +30,7 @@ #include "qemu/main-loop.h" #include "hw/misc/vmcoreinfo.h" #include "migration/blocker.h" +#include "migration/misc.h" #include "hw/core/cpu.h" #include "win_dump.h" #include "qemu/range.h" @@ -2080,8 +2081,8 @@ void qmp_dump_guest_memory(bool paging, const char *p= rotocol, bool detach_p =3D false; bool kdump_raw =3D false; =20 - if (runstate_check(RUN_STATE_INMIGRATE)) { - error_setg(errp, "Dump not allowed during incoming migration."); + if (migration_guest_ram_loading()) { + error_setg(errp, "Dump not allowed during migration."); return; } =20 --=20 2.54.0 From nobody Sun Jul 26 11:50:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782832567; cv=none; d=zohomail.com; s=zohoarc; b=jgC8zK95ZRk4Os0nEdjvDsaqa8lBo+A+sz2iVxGbuj5PFPqQGhX2RFdPAlOS1aiS9kUxwQo6eUYUFZ6FJP5bZgW028QZphz09+5pIZ4qQvYy/ruC5StZn3UlEV9393b9XBk5rMsVPk5Z3P0ToqT/yx5JXMiEHJcMejMASUgd64k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782832567; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nyb+QiJafndVMzw69KLmfCh9TRyCjbVtvIVgo3SIUg0=; b=h375ugyvcvtOZqIMTGz3UfgxLWDmM0+Y6H81fSE/7qB3yWCm71T/3K2jOrrG+tZFZMvMFD+THD7MILmzL/DfeAxZh8N7fdPcsRmswpOB6elfIUFZOoiB/5pwWoQBIHJ2n95MibbXI6OSYWrHtOWDjtzx4MP6YuUtB96cC4hUux4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782832567588787.2134471338843; Tue, 30 Jun 2026 08:16:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1weaB8-0002go-JU; Tue, 30 Jun 2026 11:15:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaB7-0002ga-9f for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaB5-000095-St for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:13 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-472-NLRcfKm-P5ezzvWHIHQaYA-1; Tue, 30 Jun 2026 11:15:08 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ADE071802664 for ; Tue, 30 Jun 2026 15:15:07 +0000 (UTC) Received: from localhost (unknown [10.44.22.3]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C336A1956068; Tue, 30 Jun 2026 15:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782832510; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nyb+QiJafndVMzw69KLmfCh9TRyCjbVtvIVgo3SIUg0=; b=N9/ta8/gvfYj/VhQr6P1xsHpRgu4Tpj3JOhwZq9eO+H3QNrc4pAYKA1OAfI712vhGSh0N3 /mMkXnPDuP3AsFnJII+pkXUJGAtodCTMMOyDGC3Wdw55nxwNgOhlBYKOWyvL+YKXLttEGm nifZiMlKdYlrj8OSrv89JaPNLpuEO6w= X-MC-Unique: NLRcfKm-P5ezzvWHIHQaYA-1 X-Mimecast-MFC-AGG-ID: NLRcfKm-P5ezzvWHIHQaYA_1782832507 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 30 Jun 2026 19:13:18 +0400 Subject: [GIT PULL 3/8] system/cpus: refuse memsave/pmemsave while guest RAM is being migrated MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260630-dump-v1-3-7df3087dffc9@redhat.com> References: <20260630-dump-v1-0-7df3087dffc9@redhat.com> In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi X-Developer-Signature: v=1; a=openpgp-sha256; l=1889; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=dMyitmawkA0irUeHeZPgJ9NlFJzjYFkln3tC9a0Qg4g=; b=owEBbAKT/ZANAwAKAdro4Ql1lpzlAcsmYgBqQ91nmHDr8Ctk2gnGy11or5hUTbuYrJVZDKuRG iwxdZRoQHaJAjIEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCakPdZwAKCRDa6OEJdZac 5dhVD/YoLGPNyUzSWXr9dPVfqc3htlAA4VWMR/zMp5W9ZxNixQXdp5WmgapnJca6xr9BtL6FCOL /1Ou4QjBp/+DlSe/coqMCGxAFi0O1dk04nrlQkYq3vRKV8QjpdT8rgLUUGOjhNmeGSoB0O3X8id 19ULotSpMZqAWjmEb1JSfF42NlcLvX3bT0/lsPRiYY4xA7mbWG7doxDipFrPSArGQK+QR+WlihW MvwQG8o3/LHjBhA2jH3pqbhRhsM4Qx3CuDrx91SHbVNUIGywQAYJQdu1gTyUEgyWNhzI7gtx39t mEAyFkmR1bMc98tfVnnr56I9U7tOllqa3fDsQIFLNqod1EmzkdV44FezxpKOI2MEF3cJmNmqybv 4t4T5eU+Y5ivno/gPQ0AtcaPson2yVXjDRqAZPyOmX0UAzuB8IWhuXG3nQ+TyuFCXBT7cO8CT6a 7rDldGbtQ+zx7z2uF+tWACa02+gEUVlXvV1r9v47tFUCJdZClLLFSmW3y+UpgTlhXELU0yLiEc/ v2U5aA+EgHIBu7A4QoJ8gScthp7CSWnL1qVM/s7yZ++2s7ZU9Sv0NQbtyOwBbJ6OQ3302nXu0le Ubi+c9EpWJcMkb+hx4a8Y3NYnKmVFoOS/ILjDns8zGRkH9kUMZOc6afsyG0dSVVgHKdsQuydGKC OTOEP3+iV1lyd X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1782832568995158500 From: "Denis V. Lunev" memsave and pmemsave read guest memory and write it to a file, with no guard at all. They run on the main thread with the BQL held, so on a postcopy destination touching a not-yet-received page deadlocks: the thread blocks on the userfault while the postcopy incoming path waits for the BQL to install that page. During precopy the read returns incomplete state instead. Refuse both while guest RAM is still being received, using the same migration_guest_ram_loading() check as dump-guest-memory. Signed-off-by: Denis V. Lunev Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260619101834.228432-4-den@openvz.org> --- system/cpus.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/system/cpus.c b/system/cpus.c index 49f6daec3cd..b31c825b464 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -43,6 +43,7 @@ #include "system/physmem.h" #include "system/replay.h" #include "system/runstate.h" +#include "migration/misc.h" #include "system/cpu-timers.h" #include "system/whpx.h" #include "hw/core/boards.h" @@ -843,6 +844,11 @@ void qmp_memsave(uint64_t addr, uint64_t size, const c= har *filename, uint8_t buf[1024]; uint64_t orig_addr =3D addr, orig_size =3D size; =20 + if (migration_guest_ram_loading()) { + error_setg(errp, "Guest memory access not allowed during migration= "); + return; + } + if (!has_cpu) { cpu_index =3D 0; } @@ -889,6 +895,11 @@ void qmp_pmemsave(uint64_t addr, uint64_t size, const = char *filename, uint64_t l; uint8_t buf[1024]; =20 + if (migration_guest_ram_loading()) { + error_setg(errp, "Guest memory access not allowed during migration= "); + return; + } + f =3D fopen(filename, "wb"); if (!f) { error_setg_file_open(errp, errno, filename); --=20 2.54.0 From nobody Sun Jul 26 11:50:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782832565; cv=none; d=zohomail.com; s=zohoarc; b=AeoCpJB9Js0paup5siXBX+CtDGofvb+iEtBVaKePzGa2fehojycZn84JycDY1eFpB+xBxwgxQEoILTskUPfGfAUUF0dT/H3dlmHoalVah5a8EWrt5eIdPVz1OBfVXVO/21tf2yYVcghHEHK9ZHCqp6sSacVNvrcxHbY3ekc1Nds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782832565; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mH95uiYQHo8tm7+fISIlOPe/DC6AeHMmY7RDCPduhbU=; b=N2st3mgZxDQmn5zzzkgBE4oRKZhj6hPwhkvJduKb5JMqSN5QjM8JsDVBh9BtJPcWbi+B+nLtnJgHSJPSNldGqgvV8efLFInmRwJejiBCMZQBBlzT3dgDGenE71frHlvISUJnydiBLKbL20NIyXCJEQzgno1WpO+a5YYjtilqgio= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782832565401347.77489068837826; Tue, 30 Jun 2026 08:16:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1weaBD-0002hq-2C; Tue, 30 Jun 2026 11:15:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBB-0002hQ-Iq for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBA-00009s-1R for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:17 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-235-t3uH312xNjKwefK-HP9eOg-1; Tue, 30 Jun 2026 11:15:13 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C14191954B39 for ; Tue, 30 Jun 2026 15:15:12 +0000 (UTC) Received: from localhost (unknown [10.44.22.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8E76B1800744; Tue, 30 Jun 2026 15:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782832515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mH95uiYQHo8tm7+fISIlOPe/DC6AeHMmY7RDCPduhbU=; b=HNhWO9iDtQ+8G/eYw9+uCoIWRqMIAFK1fu0E9aX4Qw4btc4ednlJlvffSia9vJ0MplRpvu OZNG/ysrthew3eeb+naXuB6BRVCSYX4PMMpdZHUn8c1inOau+BuXwvoxHhxM0z/TQv0Ocw L/hwQi6i8rJIIvliOmWIhbt95HDqt/I= X-MC-Unique: t3uH312xNjKwefK-HP9eOg-1 X-Mimecast-MFC-AGG-ID: t3uH312xNjKwefK-HP9eOg_1782832513 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 30 Jun 2026 19:13:19 +0400 Subject: [GIT PULL 4/8] dump: make win_dump_available() check vmcoreinfo for a Windows dump header MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260630-dump-v1-4-7df3087dffc9@redhat.com> References: <20260630-dump-v1-0-7df3087dffc9@redhat.com> In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi X-Developer-Signature: v=1; a=openpgp-sha256; l=3217; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=j+4A5jhhHYk2Y2kikeINl7pteWMLi44zfKnvifvvdtI=; b=kA0DAAoB2ujhCXWWnOUByyZiAGpD3Wegy7zDTbTKwP/xRYelw0HJqqe7fIV3INYCdPu+vt/5D okCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJqQ91nAAoJENro4Ql1lpzlyLIP/i34 UplpGdXF1D14HHMY36PG/R8JW4qQR4mhBYXfP9Mj3Fe2ILqOY7KJ2BwB0KFlN9PG1eyShmi/WCF 9R+Gtnr6s+Ojj2Qy3hSQUj62Kj+B94LrEXAQzjZ3Cb5/lxUANwl3YlHB7U0N5CTk98shsqnkyUS hGHH51u40jh/zCm7FIHHAqdkb5pwWGWtL0GmufukrLf3BwQM1VIOqZzZZrJ0DQOrSxqhCp/stGO k/h7mkH5x2A5J6FzGw5AnG+UX0eT62plQhyIzuC8kIPqWDkBrhQUNCmAuIR633i1AIrTrEx+AeD ou7Dx4eda0OcRYOuiAUe2gzPz+Ssaq+LKz6gnZ9klSaUCOlipmn/OnVmjZRvgwlCzmCoufOXecH 7s2AqICX6qFhw15LRl/NxK9THKEmW9TvxFUmbykjBLQZJVdxn7gIaO+o9qBeSw2cRJyAToD+0Ol stOc3A+m53TnDfkAfZtp6qtRsTjU0HNDazBcVwSUgCQVZAq88+6cgcgw9YQH4hODSqGP/MCTE0R L8KOjUGMnTu/ZpuKRZWC3gLQbfX/sAN8/Amj0vMRvO7MSTfcG/lKqgz5EvFM6C4Miizh/Q5qXOT nOSKJX5GEDmZ6VtPxpr7CYKOc2IqsRsvwhirSptHSQao6BpRpHhi/pKf/oeb1IpjkeTXAd3sCsL I9Qc/ X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1782832566794158500 From: "Denis V. Lunev" QMP query-dump-guest-memory-capability reports win-dmp as available for any x86 VM, and dump-guest-memory accepts the win-dmp format unconditionally. Both are wrong: win-dmp only works when the guest has published a Windows dump header through vmcoreinfo. The guest registers that note with the vmcoreinfo device (its physical address and size), so win_dump_available() can read it back directly and validate the note size and the Windows dump header signature. This needs no other guest state, so it does not stop the vCPUs. The capability query reads the note on the main thread with the BQL held and has no migration guard of its own, so it is skipped while a migration destination is still receiving guest RAM: there the read would deadlock against the postcopy load (which needs the BQL) or, in precopy, see incomplete pages. Based on the original work of Nikolai Barybin. Signed-off-by: Denis V. Lunev [ MA - changed physical_memory_read() call ] Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260619101834.228432-5-den@openvz.org> --- dump/win_dump-x86.c | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/dump/win_dump-x86.c b/dump/win_dump-x86.c index 8848c8bfca3..0dd0c503c56 100644 --- a/dump/win_dump-x86.c +++ b/dump/win_dump-x86.c @@ -18,11 +18,10 @@ #include "qemu/win_dump_defs.h" #include "win_dump.h" #include "cpu.h" - -bool win_dump_available(Error **errp) -{ - return true; -} +#include "qemu/bswap.h" +#include "hw/misc/vmcoreinfo.h" +#include "migration/misc.h" +#include "standard-headers/linux/qemu_fw_cfg.h" =20 static size_t win_dump_ptr_size(bool x64) { @@ -404,6 +403,46 @@ static void restore_context(WinDumpHeader *h, bool x64, } } =20 +bool win_dump_available(Error **errp) +{ + VMCoreInfoState *vmci =3D vmcoreinfo_find(); + g_autofree uint8_t *note =3D NULL; + Error *local_err =3D NULL; + WinDumpHeader *h; + uint32_t size; + bool x64 =3D true; + + if (migration_guest_ram_loading()) { + error_setg(errp, "win-dump: not available during migration"); + return false; + } + + if (!vmci || !vmci->has_vmcoreinfo || + le16_to_cpu(vmci->vmcoreinfo.guest_format) !=3D + FW_CFG_VMCOREINFO_FORMAT_ELF) { + error_setg(errp, "win-dump: no vmcoreinfo note from the guest"); + return false; + } + + size =3D le32_to_cpu(vmci->vmcoreinfo.size); + if (size !=3D VMCOREINFO_WIN_DUMP_NOTE_SIZE32 && + size !=3D VMCOREINFO_WIN_DUMP_NOTE_SIZE64) { + error_setg(errp, "win-dump: invalid vmcoreinfo note size"); + return false; + } + + note =3D g_malloc(size); + physical_memory_read(le64_to_cpu(vmci->vmcoreinfo.paddr), note, size); + + h =3D (void *)(note + VMCOREINFO_ELF_NOTE_HDR_SIZE); + if (!check_header(h, &x64, &local_err)) { + error_propagate(errp, local_err); + return false; + } + + return true; +} + void create_win_dump(DumpState *s, Error **errp) { WinDumpHeader *h =3D (void *)(s->guest_note + VMCOREINFO_ELF_NOTE_HDR_= SIZE); --=20 2.54.0 From nobody Sun Jul 26 11:50:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782832547; cv=none; d=zohomail.com; s=zohoarc; b=lhfR3bOSJdCgZqPCIrVci2Pk7CcDdTgWH81Mt1VZ79lWzb+uHBnE1OxLcTArpWhBWKShpL5t9T9CFMNbNSktU3IKxdUuJbLP55mozQb39sIEb+PK2ZAGaAaLKggx01xLuIfioWI2RSXTbkodQB31JJ+ecVs9uIZdUaxCWvEPLsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782832547; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Iq+iouowlk69ERX36r4uFBuIwJ10tBY3aCggLDjZMJw=; b=Guf7o7wV8C4wdqloAWDTInE7Kht13wSo6584z5nEnJB7HSkHHrkYHbYZ9ck5nFrBd8cJk/Bw30Kbgxn/oE3uR+r4m2oZ5yLDV3el4g3lGbzkm4RhmQwIjGO5eG4wM5w9VvdwV3njy4AFyB1TI+mC+f01B3N94iurqOJtSAv3EjM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782832547393406.6434434980972; Tue, 30 Jun 2026 08:15:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1weaBJ-0002jC-Os; Tue, 30 Jun 2026 11:15:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBH-0002ig-O6 for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBF-0000CK-Sw for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:23 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-EGhTTkCRNjekfLa-bYrIvA-1; Tue, 30 Jun 2026 11:15:18 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7B17D18001F3 for ; Tue, 30 Jun 2026 15:15:17 +0000 (UTC) Received: from localhost (unknown [10.44.22.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 916B3180067F; Tue, 30 Jun 2026 15:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782832521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Iq+iouowlk69ERX36r4uFBuIwJ10tBY3aCggLDjZMJw=; b=KWgrrPlLc9Udu6KEkszcfImnnvJp2YILEXA9fjimXQtxy3yGAya6H7BKrjm8mxkCLyTMGV NTf1xW1JeCaTz7eW8bqbeCIb3tQcsPblibunnkOpwkdgJ4bUAwTtGqFIhAY9sy2nclvsrh FQqEMejj7OedgPpcWvTk77Ij4yXFWrE= X-MC-Unique: EGhTTkCRNjekfLa-bYrIvA-1 X-Mimecast-MFC-AGG-ID: EGhTTkCRNjekfLa-bYrIvA_1782832517 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 30 Jun 2026 19:13:20 +0400 Subject: [GIT PULL 5/8] tests/qtest: add dump-guest-memory test MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260630-dump-v1-5-7df3087dffc9@redhat.com> References: <20260630-dump-v1-0-7df3087dffc9@redhat.com> In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi X-Developer-Signature: v=1; a=openpgp-sha256; l=7999; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=EnE+NEGBoj+et4ZjVI2j+DnLblFc6z7p9xQ8gWOACRI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqQ91n1LmWhDG5ApISqASn2dHDaKoY+gyJ70Ygq Zs71pcbpkiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCakPdZwAKCRDa6OEJdZac 5Sv4D/421VApFtw5akdgXIafltglhW5ZUWoWWRDu97G2egZsN+O1oVY/5EzXy82lay870xuYaAO uDtz92SNgvh/2B92yHvrV+Jv5p5iQCLYdg7qlWGzAGZloAVhoXT8dDtfo0E6aFQAfrtBcfvuh2p OKH4IksIy3xpUsNyF+prCyrDmPcnL7kLrUqzfx1YaD9s3lvfSz0jybh6CS22HD+wbxjomXjMK18 oXzRO6hotuTwzbgitkmtuL6QsS0hAwShiYbKXQwEzoorIEdZTdIFZQTSKlzFfQLt04SbQyrez3d oigNtilBZozKjyHA9q0ZW+G9kHNMF1VDt4WWI5oX82Vr93QuypWvFxSLLiLsQFn86pMqOXUiNjw LogjVNPRe2HtU1J/pHurCBAanPaBtC/2Ys25V7K88hv9eqYzrTYmDSFXJxjz5gWRf7XhiI5vqyr nmDKLjG1i7SxSGyd2lc9StGRfPKasOdivp4Yat+rr8DWVu1aT0Pp4KxcOxoBqWvDskWxwlzBOSf dNwOzBtW+v8ybagK1YugbNtTHyJgZesc426AL6hwAFuYM2VaiVUAuZz0nMOm9C6GLW87kq/8XVp HuKDH6Mw86gNpNWerfcxA5IfpWLqzun+qz0hEKmdiS4VZFpqtHzIdt9g2wo1MSpN4bbgFsXPZM8 HMUKCDXbjCSvZBQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1782832548931158500 From: "Denis V. Lunev" There is currently almost no coverage for the dump-guest-memory QMP command beyond the test-hmp smoke test. Add a qtest that runs on a bare machine (no guest OS) and checks: - query-dump-guest-memory-capability always advertises 'elf'; - an ELF dump is produced and starts with the ELF magic; - a non-raw kdump dump is emitted in makedumpfile flattened format; - a raw kdump dump starts with the on-disk KDUMP header; - an unknown protocol is rejected without killing the VM, and dumping still works afterwards. Signed-off-by: Denis V. Lunev Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260619101834.228432-6-den@openvz.org> --- MAINTAINERS | 1 + tests/qtest/dump-test.c | 188 ++++++++++++++++++++++++++++++++++++++++++++= ++++ tests/qtest/meson.build | 1 + 3 files changed, 190 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 2ecfd7159db..7ff0ae09cdc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3309,6 +3309,7 @@ F: scripts/dump-guest-memory.py F: stubs/dump.c F: docs/specs/vmcoreinfo.rst F: tests/qtest/vmcoreinfo-test.c +F: tests/qtest/dump-test.c =20 Error reporting M: Markus Armbruster diff --git a/tests/qtest/dump-test.c b/tests/qtest/dump-test.c new file mode 100644 index 00000000000..eb188c9ccb8 --- /dev/null +++ b/tests/qtest/dump-test.c @@ -0,0 +1,188 @@ +/* + * QTest testcase for dump-guest-memory + * + * Generic coverage for the dump-guest-memory QMP command and the + * query-dump-guest-memory-capability reporting, exercised on a bare + * machine (no guest OS required). + * + * Copyright (c) 2026 Virtuozzo International GmbH + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "qobject/qdict.h" +#include "qobject/qlist.h" +#include "qobject/qstring.h" +#include "qemu/bswap.h" +#include "elf.h" + +#define KDUMP_RAW_MAGIC "KDUMP " +#define KDUMP_FLAT_MAGIC "makedumpfile" + +static QTestState *dump_test_start(void) +{ + return qtest_initf("-machine q35 -accel qtest -m 16"); +} + +static void assert_file_magic(const char *path, const char *magic, size_t = len) +{ + g_autofree char *buf =3D g_malloc0(len); + FILE *f =3D fopen(path, "rb"); + + g_assert_nonnull(f); + g_assert_cmpint(fread(buf, 1, len, f), =3D=3D, len); + fclose(f); + g_assert_cmpint(memcmp(buf, magic, len), =3D=3D, 0); +} + +/* validate that the file is a sane x86 ELF core, not just the leading mag= ic */ +static void assert_valid_elf_core(const char *path) +{ + unsigned char e[64]; + FILE *f =3D fopen(path, "rb"); + uint16_t e_type, e_machine, e_phnum; + + g_assert_nonnull(f); + g_assert_cmpint(fread(e, 1, sizeof(e), f), =3D=3D, sizeof(e)); + fclose(f); + + g_assert_cmpint(memcmp(e, ELFMAG, SELFMAG), =3D=3D, 0); + + /* e_type and e_machine sit at the same offset for ELF32 and ELF64 */ + e_type =3D lduw_le_p(e + 16); + e_machine =3D lduw_le_p(e + 18); + g_assert_cmpint(e_type, =3D=3D, ET_CORE); + g_assert(e_machine =3D=3D EM_386 || e_machine =3D=3D EM_X86_64); + + /* e_phnum lives at a class-dependent offset */ + if (e[EI_CLASS] =3D=3D ELFCLASS64) { + e_phnum =3D lduw_le_p(e + 56); + } else { + e_phnum =3D lduw_le_p(e + 44); + } + g_assert_cmpint(e_phnum, >, 0); +} + +/* dump-guest-memory to a fresh temp file; returns the path (caller frees)= */ +static char *do_dump(QTestState *qts, const char *format) +{ + g_autofree char *tmp =3D NULL; + g_autofree char *proto =3D NULL; + GError *err =3D NULL; + int fd; + + fd =3D g_file_open_tmp("dump-test-XXXXXX", &tmp, &err); + g_assert_no_error(err); + close(fd); + proto =3D g_strdup_printf("file:%s", tmp); + + if (format) { + qtest_qmp_assert_success(qts, + "{ 'execute': 'dump-guest-memory'," + " 'arguments': { 'paging': false, 'protocol': %s," + " 'format': %s } }", proto, format); + } else { + qtest_qmp_assert_success(qts, + "{ 'execute': 'dump-guest-memory'," + " 'arguments': { 'paging': false, 'protocol': %s } }", proto); + } + + return g_steal_pointer(&tmp); +} + +/* query-dump-guest-memory-capability must always advertise at least 'elf'= */ +static void test_query_capability(void) +{ + QTestState *qts =3D dump_test_start(); + QDict *resp, *ret; + QList *formats; + QListEntry *e; + bool has_elf =3D false; + + resp =3D qtest_qmp(qts, + "{ 'execute': 'query-dump-guest-memory-capability' }"); + g_assert(qdict_haskey(resp, "return")); + ret =3D qdict_get_qdict(resp, "return"); + formats =3D qdict_get_qlist(ret, "formats"); + g_assert_nonnull(formats); + + QLIST_FOREACH_ENTRY(formats, e) { + QString *qs =3D qobject_to(QString, qlist_entry_obj(e)); + + if (g_str_equal(qstring_get_str(qs), "elf")) { + has_elf =3D true; + } + } + g_assert_true(has_elf); + + qobject_unref(resp); + qtest_quit(qts); +} + +static void test_dump_elf(void) +{ + QTestState *qts =3D dump_test_start(); + g_autofree char *path =3D do_dump(qts, NULL); + + assert_valid_elf_core(path); + unlink(path); + qtest_quit(qts); +} + +/* non-raw kdump is emitted in makedumpfile flattened format */ +static void test_dump_kdump_zlib(void) +{ + QTestState *qts =3D dump_test_start(); + g_autofree char *path =3D do_dump(qts, "kdump-zlib"); + + assert_file_magic(path, KDUMP_FLAT_MAGIC, strlen(KDUMP_FLAT_MAGIC)); + unlink(path); + qtest_quit(qts); +} + +/* raw kdump starts with the on-disk KDUMP header */ +static void test_dump_kdump_raw_zlib(void) +{ + QTestState *qts =3D dump_test_start(); + g_autofree char *path =3D do_dump(qts, "kdump-raw-zlib"); + + assert_file_magic(path, KDUMP_RAW_MAGIC, strlen(KDUMP_RAW_MAGIC)); + unlink(path); + qtest_quit(qts); +} + +/* an unknown protocol must be rejected, not crash the VM */ +static void test_dump_invalid_protocol(void) +{ + QTestState *qts =3D dump_test_start(); + g_autofree char *path =3D NULL; + QDict *resp; + + resp =3D qtest_qmp(qts, + "{ 'execute': 'dump-guest-memory'," + " 'arguments': { 'paging': false, 'protocol': 'bogus:/x' } }"); + g_assert(qdict_haskey(resp, "error")); + qobject_unref(resp); + + /* VM is still alive and dumping still works afterwards */ + path =3D do_dump(qts, NULL); + assert_valid_elf_core(path); + unlink(path); + + qtest_quit(qts); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + + qtest_add_func("/dump/query-capability", test_query_capability); + qtest_add_func("/dump/elf", test_dump_elf); + qtest_add_func("/dump/kdump-zlib", test_dump_kdump_zlib); + qtest_add_func("/dump/kdump-raw-zlib", test_dump_kdump_raw_zlib); + qtest_add_func("/dump/invalid-protocol", test_dump_invalid_protocol); + + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 822e0bd2869..84062028f9c 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -59,6 +59,7 @@ qtests_i386 =3D \ (config_all_devices.has_key('CONFIG_FDC_ISA') ? ['fdc-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I440FX') ? ['fw_cfg-test'] : []) + = \ (config_all_devices.has_key('CONFIG_FW_CFG_DMA') ? ['vmcoreinfo-test'] := []) + \ + (config_all_devices.has_key('CONFIG_Q35') ? ['dump-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I440FX') ? ['i440fx-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I440FX') ? ['ide-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I440FX') ? ['numa-test'] : []) + = \ --=20 2.54.0 From nobody Sun Jul 26 11:50:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782832560; cv=none; d=zohomail.com; s=zohoarc; b=ClIDZN0oPigEYnJxzsMjiLpCJerAuqTwnZvGXMD3rnXTrcan1MP6X02mQd31ByEpDtyQ2ywCxPHvfH9vSdiGFeCupyfRYP3C7+xuEArwRCR5TUeAw+g1fIKjLNa53IXektvqrBCEYMU/jpTUCFAvwjMG9uG2ieR6mhlcTXyAjoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782832560; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0XBdA8E+oC6SGIZRfUZzMeVpOzgRV0QL0Mkw7GQR5r0=; b=fTHYcYwwFhtg3hVzJmvKgs3VMOGVydrOfZJ7n8D7IwzAjujSiDKDQwOnNjmGWXHPuOOK/PY9+6IZZjhql61sj6JdGGxGwVarnd7w03t9sTkcV2sbsJgVCJeH3WxE6VwIeKf8BHleYoGi9Z7/Zq6jdQBW02uvbrOOYGkpUFzSHXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782832560703813.8754491147165; Tue, 30 Jun 2026 08:16:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1weaBV-0002jl-Uw; Tue, 30 Jun 2026 11:15:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBL-0002jQ-Sm for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBK-0000Cx-2N for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:27 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-ZXwARUQUPu6Youc28rntfQ-1; Tue, 30 Jun 2026 11:15:23 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9F1261954B20 for ; Tue, 30 Jun 2026 15:15:22 +0000 (UTC) Received: from localhost (unknown [10.44.22.3]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5C11218005B1; Tue, 30 Jun 2026 15:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782832525; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0XBdA8E+oC6SGIZRfUZzMeVpOzgRV0QL0Mkw7GQR5r0=; b=Cqhd3aQ1u6heRQxleDUp0wGIOQzHr8DuKIivJmEyEs4T/Vt7SVZYDQimQCosdGWvKIrEBv 3wlMWXiekKnx3Dly9FY1T1Vj0mQJhPjROs1afdSXf1B1PKL/zNxatGkI9P/es1MAVL951D w84XmXm0MDIDynZ2k3Urcn5hyleLMWI= X-MC-Unique: ZXwARUQUPu6Youc28rntfQ-1 X-Mimecast-MFC-AGG-ID: ZXwARUQUPu6Youc28rntfQ_1782832522 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 30 Jun 2026 19:13:21 +0400 Subject: [GIT PULL 6/8] tests/qtest/dump: reject win-dmp without vmcoreinfo MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260630-dump-v1-6-7df3087dffc9@redhat.com> References: <20260630-dump-v1-0-7df3087dffc9@redhat.com> In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi X-Developer-Signature: v=1; a=openpgp-sha256; l=2956; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=VI+6CoAms05KFZFcT8i7jS80mzlwXt2S2GqbneLkrZo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqQ91nz1cY92vnlTVJhbhP6V44QobuLX3rqliyA ljFV1QEtjKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCakPdZwAKCRDa6OEJdZac 5U0JD/9EG104ybe81dOl95SoFfF3EPqm4FN6CCE4h8DzeoFg2tYHX1w68lBYgxEOW8/vQyFZkg5 j2WAnQ8mnHseIWfkTNnciUfHZE6CoYvFe1Wmm6OSVXev29sk99+rmKchBkNlFqJZhpKLKpcHiEr gDJvL7BDvfGqBvYg4ES+yGKf5SSdxim6xV0Xg7hWXyzhmlCr3A0G3czPUPg3uQ+bHq5HUTlXGEk 5BJ4oWrP/oa7XX+rA2Mi9d4gZ22X2SYZInqfYpAd3RQ5jL7xhlZwUzJWReMdTw0sV+FR7ZLF7kQ Ef8s15HIj0LUfZ4Nw2TU1zzbwQHvklkw3AOQWQbF7NhosckgmcN8x2yAeo+WiIxoJ9YPAgMYvY7 svzPcM8HEVg8ATu6EN7FuSlYeuFYy40mEQZdadEzo8Ew1mZoMTl2OwyZnjGEwmFf8nBe304+Vpo RhqnBNuGl8ldGHPmV113sbYwUs0vKwDtNWkdCffPe7SnLCJTNt2nr/y2G9LWcI0o4Q/exEj87eq DxgmU7OPpvSvG8y0rowrT8DmAguSEtI204rQVr+lkt1UV02CM6UZ+kuT6LL3E5gV/KIOrv85ZlL CCtUxLWkwrQ4zkWzZ14WZLZ3w0/ww/4FJ+qlQ+IpY6XuZ1Mo099QvKMZj9OpIJc5mLhJ+8VmDoq go0NLOjlDlbZWNA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1782832562666158500 From: "Denis V. Lunev" Requesting the Windows crashdump format (win-dmp) on a guest that does not expose a Windows dump header through vmcoreinfo must be rejected, not silently turned into a bogus dump. Add a test that asks for win-dmp on a plain VM and checks the request fails with "invalid vmcoreinfo note size" and that the VM stays usable afterwards (a subsequent ELF dump succeeds). The test is x86_64 only, where win_dump_available() performs this check. Signed-off-by: Denis V. Lunev Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260619101834.228432-7-den@openvz.org> --- tests/qtest/dump-test.c | 49 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 49 insertions(+) diff --git a/tests/qtest/dump-test.c b/tests/qtest/dump-test.c index eb188c9ccb8..6afaa2c2ea4 100644 --- a/tests/qtest/dump-test.c +++ b/tests/qtest/dump-test.c @@ -174,8 +174,51 @@ static void test_dump_invalid_protocol(void) qtest_quit(qts); } =20 +/* + * Requesting win-dmp without a Windows dump header in vmcoreinfo must be + * rejected with a clear error -- and must leave the VM usable, rather than + * produce a bogus dump. + */ +static void test_dump_win_dmp_unavailable(void) +{ + QTestState *qts =3D dump_test_start(); + g_autofree char *tmp =3D NULL; + g_autofree char *proto =3D NULL; + g_autofree char *path =3D NULL; + GError *err =3D NULL; + QDict *resp, *error; + const char *desc; + int fd; + + fd =3D g_file_open_tmp("dump-test-XXXXXX", &tmp, &err); + g_assert_no_error(err); + close(fd); + proto =3D g_strdup_printf("file:%s", tmp); + + resp =3D qtest_qmp(qts, + "{ 'execute': 'dump-guest-memory'," + " 'arguments': { 'paging': false, 'protocol': %s," + " 'format': 'win-dmp' } }", proto); + error =3D qdict_get_qdict(resp, "error"); + g_assert_nonnull(error); + desc =3D qdict_get_try_str(error, "desc"); + g_assert_nonnull(desc); + g_assert_nonnull(strstr(desc, "vmcoreinfo")); + qobject_unref(resp); + unlink(tmp); + + /* the failed request must not wedge the VM: a plain dump still works = */ + path =3D do_dump(qts, NULL); + assert_valid_elf_core(path); + unlink(path); + + qtest_quit(qts); +} + int main(int argc, char **argv) { + const char *arch =3D qtest_get_arch(); + g_test_init(&argc, &argv, NULL); =20 qtest_add_func("/dump/query-capability", test_query_capability); @@ -184,5 +227,11 @@ int main(int argc, char **argv) qtest_add_func("/dump/kdump-raw-zlib", test_dump_kdump_raw_zlib); qtest_add_func("/dump/invalid-protocol", test_dump_invalid_protocol); =20 + /* win-dmp is an x86_64-only format */ + if (g_str_equal(arch, "x86_64")) { + qtest_add_func("/dump/win-dmp-unavailable", + test_dump_win_dmp_unavailable); + } + return g_test_run(); } --=20 2.54.0 From nobody Sun Jul 26 11:50:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782832551; cv=none; d=zohomail.com; s=zohoarc; b=j4VJ/utJ1diijv6znm8n/0nkP7rRJFFFB5nOnLfAuSzItNeSf2PWkfo73NNdfSHu3OPApUUrQudGK9yjIhX2ALzVnpJcKwp5Bwso1FqZJyXgUlhYigdzF4yp1JO8k1C+svCwKX4O1tt7bp7W1sJZ1DxjX+9xKzk8Cr6Ll1WfNa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782832551; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BavUBLAK3VDuyAhs4ypu9Db+kGmiyaIDIJzxHE6lCAY=; b=bXLyIPSgEQE4XxDurt/uy2QtwUP3cQ6wK5Fs5FeeSlyYyoQVI7WiOZC4rbQLcgZQVtOfWnIXreVw7Ixaxc2QQRMYCMuJDrhalGpWFDnl2zye6VN88yf7mxUjLieMV6SJ34dgjehOHh36TsRAIjSXX5fdu66+WtFkGWK8h92+7KQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782832551316885.3495463527469; Tue, 30 Jun 2026 08:15:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1weaBY-0002mv-4c; Tue, 30 Jun 2026 11:15:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBS-0002k5-5H for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBQ-0000DG-CK for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:33 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-539-VC_ytAY1PzamBrYU5T2S1Q-1; Tue, 30 Jun 2026 11:15:28 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D4DC21955DA1 for ; Tue, 30 Jun 2026 15:15:27 +0000 (UTC) Received: from localhost (unknown [10.44.22.3]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A0E533000C02; Tue, 30 Jun 2026 15:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782832531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BavUBLAK3VDuyAhs4ypu9Db+kGmiyaIDIJzxHE6lCAY=; b=YVnXa9eM1pRTbzis6OLeAGqBjjZ82zqhinNp1LhH5QJNbsytN5l51193g1hnJLMCwvXrSn HZcQoHmO2FC3S4TOghnO/kYKmxGgMwT3HKkJyKQfZkvWzIIJ7e7G2VmP+7yIH4JPIr3GZn 3FgZ97um/+KEcYRM2D5r3TgK0V35Hg0= X-MC-Unique: VC_ytAY1PzamBrYU5T2S1Q-1 X-Mimecast-MFC-AGG-ID: VC_ytAY1PzamBrYU5T2S1Q_1782832527 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 30 Jun 2026 19:13:22 +0400 Subject: [GIT PULL 7/8] tests/qtest/dump: cover win-dmp availability via vmcoreinfo MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260630-dump-v1-7-7df3087dffc9@redhat.com> References: <20260630-dump-v1-0-7df3087dffc9@redhat.com> In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi X-Developer-Signature: v=1; a=openpgp-sha256; l=5453; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yKRH52D4g5dKsLWLush0OYxS7DZ9LzNtIlGYCyxwP+s=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqQ91nuZw1S+iH1iipK/aW8XeWEIOIpuIQ+rYng dC9ggivQ4OJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCakPdZwAKCRDa6OEJdZac 5cZzD/9n7LFSlk7WVv2I+S3C7VcJJijAWhhRZD4GLh50ycU1lTYCAoKCz0FSa3shVOjW+8X7fom n18NuiUFMt0bynXGkx0cKfP3HYnxCAlkBaTQIX7MiaQPkuBLl4IsWajV0L7uJahJM7SJcnjOqCB MRPmCbtkGEJDVGHfXY0mZYwwigLh0CFhPf7RKC0HhT+1fuUiC4qvz1C7TGDljGfPQnyy6YhzVzP p+hwvqu645OhD5DM4gUP4/MYdXJJh/OEEYM9qEDx/P6PfQtuffr38x+flbts1GvJeQmmuIRa2S9 9CDPHAI7z2nWbxyPWMrLIWdDc6w5HAHxMs2ilD7VvyTw0VUfozHJOZqIP5rSQPKJX8qMLC6Sc78 7SrdE9HuNHEhYYWQrkbg6LUz8q18MhIIV58ZhInfmouFUx7UpBsx90oqiq0XpSabdJpUnBhH3/z l5Yoe8BDIhSisFucdSo1sQVbGwlEvLFDg5FgecUqW47ZoWjyVL0UE7ZMSqY97UQOJ/doL1dHeZN X1PbuGnZrJLopQi53AeY/vpKsh2AwqvPGaReQtgJT6IQi9n7QzoxRpztz2ZFblu8lD3Q/O8/EpW su6/32ud1lIkpEGfGc5itLeKGftpZ/x49Cy3zAGVzywx4xY7aliSrQhlm8aCaq3jUntpm4tYvT1 LlznlxuaoAMryIA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1782832552897158500 From: "Denis V. Lunev" win-dmp becomes available only once the guest exposes a Windows dump header through vmcoreinfo. Forge exactly such a note (an ELF note header followed by a WinDumpHeader64 carrying the PAGE/DU64 signatures, the layout a Windows guest with the QEMU vmcoreinfo writer produces), place it in guest RAM, point the vmcoreinfo device at it via fw_cfg, and check that win-dmp flips from unavailable to available. This exercises win_dump_available()'s positive path without a real Windows guest. It only covers availability reporting; the actual win-dmp generation (create_win_dump()) needs real Windows kernel structures and is not exercised here. The test is registered only on x86_64 with a vmcoreinfo device present. Signed-off-by: Denis V. Lunev Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260619101834.228432-8-den@openvz.org> --- tests/qtest/dump-test.c | 94 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 94 insertions(+) diff --git a/tests/qtest/dump-test.c b/tests/qtest/dump-test.c index 6afaa2c2ea4..30c95a35285 100644 --- a/tests/qtest/dump-test.c +++ b/tests/qtest/dump-test.c @@ -12,10 +12,15 @@ =20 #include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/libqos-pc.h" +#include "libqos/fw_cfg.h" #include "qobject/qdict.h" #include "qobject/qlist.h" #include "qobject/qstring.h" #include "qemu/bswap.h" +#include "qemu/win_dump_defs.h" +#include "standard-headers/linux/qemu_fw_cfg.h" +#include "hw/misc/vmcoreinfo.h" #include "elf.h" =20 #define KDUMP_RAW_MAGIC "KDUMP " @@ -215,6 +220,90 @@ static void test_dump_win_dmp_unavailable(void) qtest_quit(qts); } =20 +static bool capability_has_format(QTestState *qts, const char *want) +{ + QDict *resp, *ret; + QList *formats; + QListEntry *e; + bool found =3D false; + + resp =3D qtest_qmp(qts, + "{ 'execute': 'query-dump-guest-memory-capability' }"); + g_assert(qdict_haskey(resp, "return")); + ret =3D qdict_get_qdict(resp, "return"); + formats =3D qdict_get_qlist(ret, "formats"); + g_assert_nonnull(formats); + + QLIST_FOREACH_ENTRY(formats, e) { + QString *qs =3D qobject_to(QString, qlist_entry_obj(e)); + + if (g_str_equal(qstring_get_str(qs), want)) { + found =3D true; + } + } + qobject_unref(resp); + return found; +} + +/* + * win-dmp becomes available only once the guest exposes a Windows dump + * header through vmcoreinfo. Forge exactly such a note -- the layout a + * Windows guest with the QEMU vmcoreinfo writer produces: a fixed-size ELF + * note header followed by a WinDumpHeader64 carrying the PAGE/DU64 + * signatures -- place it in guest RAM, point the vmcoreinfo device at it + * via fw_cfg, and check that win-dmp flips from unavailable to available. + * + * This only covers availability *reporting*; the actual win-dmp generation + * (create_win_dump()) needs real Windows kernel structures and is not + * exercised here. + */ +static void test_dump_win_dmp_available(void) +{ + const uint64_t paddr =3D 0x800000; /* 8 MiB, inside guest RAM */ + size_t notesz =3D VMCOREINFO_WIN_DUMP_NOTE_SIZE64; + g_autofree uint8_t *note =3D g_malloc0(notesz); + Elf64_Nhdr *nhdr =3D (Elf64_Nhdr *)note; + WinDumpHeader64 *hdr; + FWCfgVMCoreInfo info; + QFWCFG *fw_cfg; + QOSState *qs; + + /* the WinDumpHeader64 must sit right after the fixed ELF note header = */ + g_assert_cmpint(sizeof(WinDumpHeader64) % 4, =3D=3D, 0); + + nhdr->n_namesz =3D cpu_to_le32(sizeof("VMCOREINFO")); /* 11 -> padded = 12 */ + nhdr->n_descsz =3D cpu_to_le32(sizeof(WinDumpHeader64)); + nhdr->n_type =3D 0; + memcpy(note + sizeof(Elf64_Nhdr), "VMCOREINFO", sizeof("VMCOREINFO") -= 1); + + hdr =3D (WinDumpHeader64 *)(note + VMCOREINFO_ELF_NOTE_HDR_SIZE); + memcpy(hdr->Signature, "PAGE", sizeof(hdr->Signature)); + memcpy(hdr->ValidDump, "DU64", sizeof(hdr->ValidDump)); + + qs =3D qtest_pc_boot("-device vmcoreinfo -m 16"); + fw_cfg =3D pc_fw_cfg_init(qs->qts); + + /* with no guest note yet, win-dmp must not be advertised */ + g_assert_false(capability_has_format(qs->qts, "win-dmp")); + + /* place the forged note in guest RAM and point vmcoreinfo at it */ + qtest_memwrite(qs->qts, paddr, note, notesz); + + memset(&info, 0, sizeof(info)); + info.host_format =3D cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF); + info.guest_format =3D cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF); + info.size =3D cpu_to_le32(notesz); + info.paddr =3D cpu_to_le64(paddr); + qfw_cfg_write_file(fw_cfg, qs, FW_CFG_VMCOREINFO_FILENAME, + &info, sizeof(info)); + + /* now win-dmp must be reported as available */ + g_assert_true(capability_has_format(qs->qts, "win-dmp")); + + pc_fw_cfg_uninit(fw_cfg); + qtest_shutdown(qs); +} + int main(int argc, char **argv) { const char *arch =3D qtest_get_arch(); @@ -231,6 +320,11 @@ int main(int argc, char **argv) if (g_str_equal(arch, "x86_64")) { qtest_add_func("/dump/win-dmp-unavailable", test_dump_win_dmp_unavailable); + + if (qtest_has_device("vmcoreinfo")) { + qtest_add_func("/dump/win-dmp-available", + test_dump_win_dmp_available); + } } =20 return g_test_run(); --=20 2.54.0 From nobody Sun Jul 26 11:50:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782832557; cv=none; d=zohomail.com; s=zohoarc; b=GPmU7LGBU8AFOlfbcTSBBKg7SPHbDA+Zu7waoqy7SmPDQXRVeGqzuBgAIjf7lsFtNOHSCWEZX0h0eu3EzlwqfBFpU9b3ksmN+qtGCAxzjNOWTxujLprpEu+JpZ20ekQAtuWv6TNnWgoz79qcS6zVHhMd3/E/rUlGby6lZYmxfJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782832557; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Js0Gz5Z/33k/ANDJ3L6b1mCuHgq6vQpeGmYXZx9RY/Q=; b=bk6QWETRDBApWomP0vrjW4vrRUAWByxCNnMjNV3qS6S5yRWgVPLBKXQKUdjNEez5uscBtcpd/IB6WGwjguoX4X4aU2sO+lFcZhHHNOY/dDXtPBN3XWg/dYZeDBUDdGYeyB2Dn8KLCzqqscEaEJqXTYVOszrvOC93kjnFbfB07sE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782832557340398.4890381641861; Tue, 30 Jun 2026 08:15:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1weaBa-0002pn-0L; Tue, 30 Jun 2026 11:15:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBW-0002kp-TO for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1weaBV-0000DZ-Kb for qemu-devel@nongnu.org; Tue, 30 Jun 2026 11:15:38 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-324-7xeP0w61MHW8QGuHqKuJoQ-1; Tue, 30 Jun 2026 11:15:34 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 370631955F76 for ; Tue, 30 Jun 2026 15:15:33 +0000 (UTC) Received: from localhost (unknown [10.44.22.3]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F1ECC1955F76; Tue, 30 Jun 2026 15:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782832535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Js0Gz5Z/33k/ANDJ3L6b1mCuHgq6vQpeGmYXZx9RY/Q=; b=WYe+4be4iHlqtlq2NZuOdT4pEy7lz05eK8mzz5QA7NQMTsIyzqw9wJeHC+wmaB2FWeXxMi oGyANCjUaj9g96fNErKwdw81VZUXE43iSLDm5JHJ7CowI7J2XfDHBuaf2BPkqSFD2dfYmi TCJ2iR8lJQQdPiL3IsboQZ+ncAwjggQ= X-MC-Unique: 7xeP0w61MHW8QGuHqKuJoQ-1 X-Mimecast-MFC-AGG-ID: 7xeP0w61MHW8QGuHqKuJoQ_1782832533 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 30 Jun 2026 19:13:23 +0400 Subject: [GIT PULL 8/8] dump: fix misleading VMCOREINFO phys_base parse error MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260630-dump-v1-8-7df3087dffc9@redhat.com> References: <20260630-dump-v1-0-7df3087dffc9@redhat.com> In-Reply-To: <20260630-dump-v1-0-7df3087dffc9@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi X-Developer-Signature: v=1; a=openpgp-sha256; l=1229; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zcMisxcoNdoz9UHmtNVxTvT1WgNY1i5pj5kDCpWZlUM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqQ91ngXoqRlY489fvaOAyhVHoXggKG3IQNrtpG kO43NtIoe2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCakPdZwAKCRDa6OEJdZac 5dMXD/9B11UtyKKdmc0OAPevUEo8pQ4q5/gGe26aLxZVbCkDOQfsl0u0JI0Kl2tbXYYaFY2Z7hY v5TTJ3XqLclgo+BroZL4Tc/0n4nkHj41wvu7tWFdLApGkpoOVBLG7y4j7n5aRVRu9yroD1sbclL c4kCFsxciE2TECRvXOMB5kD8IjYChN7EX55UAqbVgX2Ag9HLAcNzx9XIZ09lnn3Gyv1gJ1UDxhz OPgF3m3gB2c6xElBojBej/Q8uM7+6fuiK0rsXQe/MxVajN2RRcmpjRNSfboQQRTecgqfyLnb0gy wnLgHf5DT7Azhakc9BJcoK4emDpOL3hUONgDI6YiNN//VjNrBOjvHFWuEgDMK1kOQP42TOAwCrE yP4FNL6ZpYTRn1Ge2wR/WfyRHERLZdt3En7z6rF4Nj5uEn3K/L8Tm+IcaZSjWFGdfCV6Q2DHruQ PPwKhQmg+S9VQy2oSusJtT25ZAg06LYUsUOTM+JT90ZZTqUC2Y5u/zY9J5hpb7pjsorJDRxhMCR ftpTdNuL8VTRa8PsmkzkEL5WfiZKbkyyJMwcfGRXMPoK/Bnm6cZ1hH/M4qrloBjviMjgGYQQmmr DMpoWxCicvlHWIO24stv0376nSq8bdR4xxPeWAn0uzjSG8uMmifRSAq8y/caXnrFp6I188TczJk ppj3v00biHl9oGQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1782832559581158500 From: yujun When qemu_strtou64() fails on the value after NUMBER(phys_base)=3D or NUMBER(PHYS_OFFSET)=3D, report a parse failure and include the malformed value. The previous message suggested the field name itself could not be read. Fixes: d9feb51772 ("dump: update phys_base header field based on VMCOREINFO= content") Signed-off-by: yujun Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20260629114646.288664-1-yujun@kylinos.cn> --- dump/dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dump/dump.c b/dump/dump.c index 7fa2d6f788c..52be7258a5d 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -1772,7 +1772,8 @@ static void vmcoreinfo_update_phys_base(DumpState *s) if (prefix && g_str_has_prefix(lines[i], prefix)) { if (qemu_strtou64(lines[i] + strlen(prefix), NULL, 16, &phys_base) < 0) { - warn_report("Failed to read %s", prefix); + warn_report("failed to parse %s in VMCOREINFO: '%s'", + prefix, lines[i] + strlen(prefix)); } else { s->dump_info.phys_base =3D phys_base; } --=20 2.54.0