From patchwork Mon Jun 24 10:18:35 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: 807016 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp1811238wrt; Mon, 24 Jun 2024 03:20:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXnfzHiNG2BN6UgqPeZ8IBauexMRSarXM2mZlnQ/PKywTluOiiuY9/g8uUgF0eJcASf7+XGXtecLILSDcVNkxwE X-Google-Smtp-Source: AGHT+IFLUEAAvBDwnfSyu+BVcwe8rsVfkXy6rUSOfv5I4rTwcsyOQxbPmerHkNXnUp4DVgtCistU X-Received: by 2002:a05:6808:21a7:b0:3d2:278b:2af6 with SMTP id 5614622812f47-3d5459877e4mr4491554b6e.28.1719224451565; Mon, 24 Jun 2024 03:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719224451; cv=none; d=google.com; s=arc-20160816; b=zh5yVxWPzRIt8DxyIwIujUpRQGiVuhxyasuGvz266d1tIS3N1fJwqKT4XzcZNv+G5x 068eYJyeNY3d5rVlsbVmM+dYsNtxkQ24hnPRjmSXE3QQUheMRfJQX6Qe9TUXTg33XVId t3y2w4jAYk1Q2H/Br/u+kfG3v95UB0Aana0pni3lczlUs/SxRApac6JPmRnT1/B9QZSz 2xOfO3D6f3Rf6Nl9+XFE+Lzti9CuBwKPT46UHytTtlAnYcsguxy8i+LwKbXTphKbCCDV FSDC9OA9SPa2QmTismGNlamT5CrqkOpcK+aBupZDWwa/TDgheeWPW+GKkdwgPzihB6vm sPsw== 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=GAfr/ztELiK85W31P9IhL6FxEJ0DWBMMSKgHmbUooPs=; fh=OVYocnyG7mUUuZjZN0fXL99tAh6d6HUvqDMF3aaSrz0=; b=X/O4dpcacASHXnfSmZtYd8KM0tJklJBJ3yBWwb9O77b7/oUOkr5hjycJ4eaq+MXklM RZJuzDHzBKpOxBVgyJ974MBeeSScNWKjUFOzpFzny0QuLv+gNK69sXQM3w+Uvu+FgZQp pzhHTheVI2Jj6+Lyh3fCyzbKQo3o7pCVtJuw9HoRuyGyRtE8jbr56jAupM5YKtmgPlxM zMlk4+JGmrK2mMtnkcHrAEqi5rpUss9sfjKRniGP6UfLN9c3SF+m9rZrVRteH4XdnKDY 7XKGXEJG8CPLO07zLEpfCwcfmZDWrT83GzDoG7kvAD8Sdqf7H/mAJe2mvL3LsoAahdqI 0G3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KOfxYaAF; 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 d75a77b69052e-444ddb3c137si28698541cf.629.2024.06.24.03.20.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jun 2024 03:20:51 -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=KOfxYaAF; 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 1sLgmj-0006ps-Af; Mon, 24 Jun 2024 06:18:53 -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 1sLgmg-0006oT-U2 for qemu-devel@nongnu.org; Mon, 24 Jun 2024 06:18:50 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sLgmb-0007hE-4i for qemu-devel@nongnu.org; Mon, 24 Jun 2024 06:18:50 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-57d15b85a34so4241182a12.3 for ; Mon, 24 Jun 2024 03:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719224324; x=1719829124; 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=GAfr/ztELiK85W31P9IhL6FxEJ0DWBMMSKgHmbUooPs=; b=KOfxYaAFT1UKAmg4PtNEYKJLeVpQId1II0wF4//OI2nQz9HG8eWEGR7ditNAUJ4WM0 DRhGp5X0AHgbTeOxND8vJsyTCytj8S/9EtxULxP2+dCs+EI8RjeOxMxek8w0N/od+wHB XCd+sNWIwK4STat6GugT7z6Pj+B9wzFqKR9v+Eclpazj2BJ/cxDYgER7vci/hcl3Kg3T ZsbpbFKdXH7hIBbkPo/kF2U1Su4l2lBuQ9AU4b+o88kUAjz6LcEk+D8Zn5YNTWWokuqT sC4ovrGDbUCiLtKDYq+28LZtDXKib92HTf9sgLOWYyv7CwO8+vt6Z2TeyQB51Xk5HnSX sb/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719224324; x=1719829124; 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=GAfr/ztELiK85W31P9IhL6FxEJ0DWBMMSKgHmbUooPs=; b=qIGOUKb3/ugrb+ynJDU05ikpCnqn9jCV8ymSDUor7Heru5IY42p81OGVhUfpMN6/8A oUU6+ORx3ZwKvGuFDweg+qWRXdpkDspH5LLbirUprjIeUMV+qB7DSbTP2as/U2JEF7Yl pMTPJFwdyw+IyK6wNFtHEYvH9qehve3SinGWka82noDQWegknUiBs6zuNfjba0KOyIgN XPgE+AIFu+lEhDLgwv8Qxv9JaI8b0vUDvP99mSteVcCAGR4rRmgspFjjNqUXxnlLG74h T4+9eXOxNR9kGtxXIh8hjZ87JTREKQKPArwU0nAG3kONClVWQW4dDP7lu4/Gxga+GBqg hXoQ== X-Gm-Message-State: AOJu0Yyk4yTMe+ZZCg/J+M6p/eOIPa1GryE0SabXooBbZ15k8vSz5CYw OzeJvUN1VPv1ypvlyoMaJw+z7RKUiMf4Mc2A8FLJO+6eY1dIaBfjHf3C1eyJo6o= X-Received: by 2002:a50:c31e:0:b0:57d:1756:6bb1 with SMTP id 4fb4d7f45d1cf-57d457f622amr3054576a12.31.1719224323540; Mon, 24 Jun 2024 03:18:43 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57d3053510asm4546151a12.74.2024.06.24.03.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 03:18:41 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 66EB55FA2D; Mon, 24 Jun 2024 11:18:37 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Paolo Bonzini , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 11/12] plugins: fix inject_mem_cb rw masking Date: Mon, 24 Jun 2024 11:18:35 +0100 Message-Id: <20240624101836.193761-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624101836.193761-1-alex.bennee@linaro.org> References: <20240624101836.193761-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52b.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+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 Message-Id: <20240620152220.2192768-12-alex.bennee@linaro.org> 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;