From patchwork Thu Jun 20 15:22:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 805984 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp345925wrt; Thu, 20 Jun 2024 08:23:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU2ztCbGzDbQWUhIkv5W9fTBfe22R9+Fx/eBFUF67ainE55GzmJYidKj45ZnL3FkgkhvQ5RABYTGfe1TYIqS9Eq X-Google-Smtp-Source: AGHT+IFG2esEsGZ6GFxS+VMTV6lrCLJMXqrABQxpZikap0eQzR2DJP1lXG47IVhfEKpBmC7H3XbV X-Received: by 2002:a05:6808:2221:b0:3d2:18fd:18d2 with SMTP id 5614622812f47-3d51ba24202mr6304056b6e.33.1718897038408; Thu, 20 Jun 2024 08:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897038; cv=none; d=google.com; s=arc-20160816; b=imTA04ilY+pGUCF+pk3wvoe9ch2Qa6WljYPvqHKSzzIGrzfKzdpRTYwCItExaI/nfc VIiFsejy2C/OkQtzDos8mJwc8IqpN1jNNyRpkwMbqElFe19kAFNQvpR7KM7wq6z1p2HU P908TCvqx5z0Mu/x68F+u5dmxWbroBu7zlM7+ZLyywsL2+2OO00nlrJO1ZjUkYxOOtjl oNb4DiBsKo1j124VW6FBkiVeL7WwJOYQzcf/4UX2JjiSZFq5aIjL8CFnUpasB57JTex6 oKPNFuDRKA2KRW4/RtKY4aC3gut4UL7AyqR77mcXa2WNhAOX603Nc8lvDO8Vq0pmTZG8 1a5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=97cycViE9OQK6SdY90/SywB1oI0H0vp7Y3hsl3HXbfM=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=y0kMIAC2DFl1M9+7PitUH7uQo5nPxxHQ4qr3zKs7+nvUbZK+TNqHgKwGQX5n+2kQK4 VBOPLFJf8yoOp3NetKR2X5SODiICMR1fu3koXrwamaLKI8wrjjIADyCFoqppHA5bjstO e19+Cf1zbHbe17uPqvXwNVHvUSh4bA8WezbZUt5tYFXcWxn+Y52JLIM+BYkPEjxNbzZo q/KQ+3X6bH3DWq6+L/X79OPumu58VKoqjPgIbwos5cRaIkG6YwdvZONpXp5aGwEBGSrH cuem1XdLW9mlGNcoL+yypDuU8Yd3yIMhFods6g2ZSMPXs70xA54WSCuIoZS/7diQuMR1 TVWw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tRgGGgEo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-798abe59706si1723161985a.616.2024.06.20.08.23.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:23:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tRgGGgEo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJci-0006B6-Br; Thu, 20 Jun 2024 11:22:52 -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 1sKJca-00065z-QE for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:44 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcX-00082t-M3 for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:44 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a6ef46d25efso118102966b.0 for ; Thu, 20 Jun 2024 08:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896960; x=1719501760; 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=97cycViE9OQK6SdY90/SywB1oI0H0vp7Y3hsl3HXbfM=; b=tRgGGgEoQAPPranslMuJkrxERNVKM4LbFwoJjPjOGAyBDshZJOhoO1/t7YNLPbzkIs 71QE062moNcbGO+9BCSE6z2yC+VvpnSax30w38Kap1BOG6J6XGneKPwqREoQ3i4+1oXm eAq7d4nfO5RVhBNQvZVD/+n0NV1iDw4bNKTSi+uLJ9IQ33UzFK3cXUGlwfrYbfOaVC8G r3DFnwtzq0kicQX8JATzqreOIiVzZ373w4nN5j2vnDpRYU2Rxzzv2uxLlatJtvUDOhoa KfrYDDgAA5oemJBM1LN4U6O4px1rJ4TjbVfinHUyJOD8rn2EfUGj67SihAJZ7gVy6Ja1 h3aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896960; x=1719501760; 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=97cycViE9OQK6SdY90/SywB1oI0H0vp7Y3hsl3HXbfM=; b=YZtKT+vaK6bUhibqv8FPc8ezIDTW2CuzOnKwoU+xZ7Ax2U9+LZRqHBfwQ39qywCFGB LmGV6U5JZGOWKSg8nNxZpV0YSmoYrWBa3QysJkCEWXsj6A8hwrelcMkfFqg7d24ewdzE +URaZHfb5Gj1xvuI5izkF0Ltqjsb5d/vAcn5Y+s0DwfcRbHmCXB+qukpbbvDfUX4Kgv1 n4hcMxCWQ7JeZr0X7yX+y7393b9MHxsXxdtrmCkDKOoY/NW0M/SUIUJ170h0nQxQ0OQN +pUSJnQ9tAohlsjnGHa77qytqEPDoqFVlsxDRZ8GVMfer+bhTivEoPzSZFwIK+/0B3Zt Evqw== X-Gm-Message-State: AOJu0YyKeg3wR0mDrdFQ7kVMJRG0htS5F2fuGO2xr9fAVmaSj5hf7DYX vW0nDD6q5AwvbhnWexFnJ5b2AWRfrxEUqSj/kKFT73m1JeZOKA1lZ2VElchB7zU= X-Received: by 2002:a17:906:c1d1:b0:a6f:b9d3:343a with SMTP id a640c23a62f3a-a6fb9d3383cmr198180066b.71.1718896960112; Thu, 20 Jun 2024 08:22:40 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56ed369bsm771539666b.100.2024.06.20.08.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 259085FA0C; Thu, 20 Jun 2024 16:22:22 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 11/12] plugins: fix inject_mem_cb rw masking Date: Thu, 20 Jun 2024 16:22:19 +0100 Message-Id: <20240620152220.2192768-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62f.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Pierrick Bouvier These are not booleans, but masks. Issue found by Richard Henderson. Fixes: f86fd4d8721 ("plugins: distinct types for callbacks") Signed-off-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20240612195147.93121-3-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Reviewed-by: Alwalid Salama --- accel/tcg/plugin-gen.c | 4 ++-- plugins/core.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index cc1634e7a6..b6bae32b99 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -240,13 +240,13 @@ static void inject_mem_cb(struct qemu_plugin_dyn_cb *cb, { switch (cb->type) { case PLUGIN_CB_MEM_REGULAR: - if (rw && cb->regular.rw) { + if (rw & cb->regular.rw) { gen_mem_cb(&cb->regular, meminfo, addr); } break; case PLUGIN_CB_INLINE_ADD_U64: case PLUGIN_CB_INLINE_STORE_U64: - if (rw && cb->inline_insn.rw) { + if (rw & cb->inline_insn.rw) { inject_cb(cb); } break; diff --git a/plugins/core.c b/plugins/core.c index badede28cf..9d737d8278 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -589,7 +589,7 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, switch (cb->type) { case PLUGIN_CB_MEM_REGULAR: - if (rw && cb->regular.rw) { + if (rw & cb->regular.rw) { cb->regular.f.vcpu_mem(cpu->cpu_index, make_plugin_meminfo(oi, rw), vaddr, cb->regular.userp); @@ -597,7 +597,7 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, break; case PLUGIN_CB_INLINE_ADD_U64: case PLUGIN_CB_INLINE_STORE_U64: - if (rw && cb->inline_insn.rw) { + if (rw & cb->inline_insn.rw) { exec_inline_op(cb->type, &cb->inline_insn, cpu->cpu_index); } break;