From patchwork Mon Apr 29 09:19:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13646497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A269C4345F for ; Mon, 29 Apr 2024 09:20:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1NAh-0004hw-Ce; Mon, 29 Apr 2024 05:19:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1NAc-0004gC-4H for qemu-devel@nongnu.org; Mon, 29 Apr 2024 05:19:34 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1NAZ-0003GE-M1 for qemu-devel@nongnu.org; Mon, 29 Apr 2024 05:19:33 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41b5e74fa83so27531255e9.0 for ; Mon, 29 Apr 2024 02:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714382365; x=1714987165; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MJ8b4g3seUv7uUos7FZr6jyaqNHB6m9TX8jMWGCsuNE=; b=FNQ95OdFfTAXdH5K6I9wEYq0BnF760LxmRuRZ6jgqAcVUa3DE0B5Ya4C5+XTWRmtDH qcXcIdiCMFDN3hUcM+/vqXF2EI5NMcNgYsZeQA0BJ8/2CNn9yDJcAe3thgR0YvrcE3iZ EcO6Ua2hjQVvsrHYIkiI/hivCjWix7vcluAFMvb6sq2MYHpCUQJBRhsr8PRI60z0Qo3B jdkjZAGdwliS/asbrAfp040V6385ycAZ6Bc/9dJh/RbzHRgsUu6Jwt1jY+Z6ndTgydEy 4qz1ii6hU+SFiHRmmRFuksSoGrZbTS298g42t1Cd3ltjmPTfHOb0LOnI8CI7h/NuLcE3 DJkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714382365; x=1714987165; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MJ8b4g3seUv7uUos7FZr6jyaqNHB6m9TX8jMWGCsuNE=; b=wMEVB/h4Hgc4mF4XXPLjGIOc8dER4OelC4zK/0R0oaDF3OkwgHnneloF5eT/CEZ5Mv Y+JcX0x/IJuxMwJOeOMqLiHbsjhU4cojON52l5RRCk6mq6FhnR/nYNeZBnsX8sv3wv67 1meUgGVemT5cKSllj5Kk/wG2ga4YPLPR2wVKgACCEMwwzQN0/rbpKbSRkJSGQRXhV583 g4wJFfV/JGfzKsg/7MhIMca+AVwwlfiy6NTrde2J/ZKxGOOVupvgRdSW5yk+rGwy9C+K B2d2hrgGGof2RB39hlSg2tIQ46dEKBghSoRBMQPKHsAZ9tPcPPNGwaRgWvIuMPBPlKmv aEdw== X-Gm-Message-State: AOJu0YxvRonalDLzYeGx2QBsjXJx+Tc5NxszXNMTwdB85AVhVWvLRqoJ 7BjGP0TEaP/gCEVwYxHuzSo9nOiw9graKC9yMxknB0VfjRKOKxY0HC1s7r9hg/PPO2oOVV/wLi+ 4/4s= X-Google-Smtp-Source: AGHT+IFFgmVwa9R394PE9ymyzBL0/XnUUIHyf2GyjgwZwiCVYioICxIHHMtzbWjWPxPEq5kJFbJQFg== X-Received: by 2002:a05:600c:46cf:b0:41c:5eb:4f8f with SMTP id q15-20020a05600c46cf00b0041c05eb4f8fmr3651849wmo.15.1714382365250; Mon, 29 Apr 2024 02:19:25 -0700 (PDT) Received: from localhost.localdomain ([83.247.137.20]) by smtp.gmail.com with ESMTPSA id fl23-20020a05600c0b9700b0041bc41287cesm9312838wmb.16.2024.04.29.02.19.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 02:19:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Volker_R=C3=BCmelin?= , Sunil Muthuswamy , Reinoud Zandijk , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 1/2] accel/whpx: Fix NULL dereference in whpx_init_vcpu() Date: Mon, 29 Apr 2024 11:19:17 +0200 Message-ID: <20240429091918.27429-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240429091918.27429-1-philmd@linaro.org> References: <20240429091918.27429-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org When mechanically moving the @dirty field to AccelCPUState in commit 9ad49538c7, we neglected cpu->accel is still NULL when we want to dereference it. Fixes: 9ad49538c7 ("accel/whpx: Use accel-specific per-vcpu @dirty field") Reported-by: Volker Rümelin Suggested-by: Volker Rümelin Signed-off-by: Philippe Mathieu-Daudé --- target/i386/whpx/whpx-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index b08e644517..a6674a826d 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2236,7 +2236,7 @@ int whpx_init_vcpu(CPUState *cpu) } vcpu->interruptable = true; - cpu->accel->dirty = true; + vcpu->dirty = true; cpu->accel = vcpu; max_vcpu_index = max(max_vcpu_index, cpu->cpu_index); qemu_add_vm_change_state_handler(whpx_cpu_update_state, env); From patchwork Mon Apr 29 09:19:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13646499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 512C3C4345F for ; Mon, 29 Apr 2024 09:20:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1NAm-0004it-4m; Mon, 29 Apr 2024 05:19:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1NAf-0004hv-97 for qemu-devel@nongnu.org; Mon, 29 Apr 2024 05:19:39 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1NAb-0003Ge-SI for qemu-devel@nongnu.org; Mon, 29 Apr 2024 05:19:36 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-41c7ac6f635so691665e9.3 for ; Mon, 29 Apr 2024 02:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714382370; x=1714987170; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nQN2VxcIOLVMa1LnNXtGEPc0ePXAKKxeCQuVKvwbEdE=; b=CtodmkqRy+BGq8YF6UZkCbieRmi8fh2BkYIlVcukIabwNiCFDYsDl45DvokG8L0kUa XDLNPbRnPGKXTa945MQtR1isEd9pe71SyKnYM1UMIT6jWplRAsF4Ykf9Mj4oK1fdrsFj /m7VdfNz6d1vSBZzRgEzB6nGLgTy2pgXGsPesujudt6ydxorpubIc4s8Jqij7Y4OoX7n c1G3PvtEUIOVPuqQ1nwZ64cWYeUsXtQGcTK6+I7V8KS/AcvulqVHjg/KGjA9fGlPt8NH 1JqD1tzR/jcDb7KIBpI188MZEh/KeY1jZ42+WfsDUXzc0DCGqO0R42kW4NTPM7GuvHBh pVIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714382370; x=1714987170; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nQN2VxcIOLVMa1LnNXtGEPc0ePXAKKxeCQuVKvwbEdE=; b=Px2H4yZ5ybSx47NP1NzSLEWHIOvncMuqWDj+2R1fehZsTVWdt8pB8S0kopW/5F//vL Cv7/x4pb2HbciRYE/UhzxHiosHurJozP54AJ2BVRTCsJtpZViRWnf/23/4qxW3LROqKq dLG8ojsP/3O3eoFfsjDGCIOczaL81U6M/Ijq+M78Om/v7NFlpcoN/0asCCJ2yki2hHHz i9rW9/qqcQpjLE1YIF2k1Tch2flDomEY43jUBuy0B9pDwO024WEO7MLMy+ZMKF0hxg+P Qk5lt9PFY1gQkimK1BmXNStA9K4Bf3TyOxa7egDK/ye+skVXlFe9oindUswSo1CLpCfv eugg== X-Gm-Message-State: AOJu0Yy7Ua5G5MSg6ATSBk0V9RkHlZSmZI4hOkD1NIHOfxKCCu1gRcfK WgLFug3f8ZU9VyDK6C97ZyopZ/9CA4Osd7BBDCu1N1Ry2P1CbWKo8KncJ0frhVN/B6IqImqawO2 VTJ8= X-Google-Smtp-Source: AGHT+IFUb8nnkBI6J6w+hR1tBSUkMCDkTNUaWuF0Tdbu7nO/tlUvbVaCwtKsiL1Gi84r4JHBjobHxg== X-Received: by 2002:a05:600c:470e:b0:41b:f979:e19b with SMTP id v14-20020a05600c470e00b0041bf979e19bmr4381596wmo.39.1714382370256; Mon, 29 Apr 2024 02:19:30 -0700 (PDT) Received: from localhost.localdomain ([83.247.137.20]) by smtp.gmail.com with ESMTPSA id z18-20020a5d6412000000b00347ec0469b2sm28842076wru.46.2024.04.29.02.19.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 02:19:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Volker_R=C3=BCmelin?= , Sunil Muthuswamy , Reinoud Zandijk , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 2/2] accel/nvmm: Fix NULL dereference in nvmm_init_vcpu() Date: Mon, 29 Apr 2024 11:19:18 +0200 Message-ID: <20240429091918.27429-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240429091918.27429-1-philmd@linaro.org> References: <20240429091918.27429-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org When mechanically moving the @dirty field to AccelCPUState in commit 79f1926b2d, we neglected cpu->accel is still NULL when we want to dereference it. Reported-by: Volker Rümelin Suggested-by: Volker Rümelin Fixes: 79f1926b2d ("accel/nvmm: Use accel-specific per-vcpu @dirty field") Signed-off-by: Philippe Mathieu-Daudé --- target/i386/nvmm/nvmm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index f9cced53b3..65768aca03 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -982,7 +982,7 @@ nvmm_init_vcpu(CPUState *cpu) } } - cpu->accel->dirty = true; + qcpu->dirty = true; cpu->accel = qcpu; return 0;