From patchwork Wed Jun 26 23:12:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 807517 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp539279wrn; Wed, 26 Jun 2024 16:14:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQVL9K3vGz1BbViciuWpXvJmc3mdB47Jrf3m7N30jUc9y4/zhkzMY5rTshRfXIl+2Tp+Fv5GUTXp4SzmRaNgvl X-Google-Smtp-Source: AGHT+IHyUDri4N3o/hNDws+5IgHoWnX7hjuVeflFDiY9aQ0ESaTNGe5hT6LP4TulfTSnXqn8u4hQ X-Received: by 2002:a05:6102:1349:b0:48f:451c:9d38 with SMTP id ada2fe7eead31-48f4f02413fmr12701941137.14.1719443660465; Wed, 26 Jun 2024 16:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719443660; cv=none; d=google.com; s=arc-20160816; b=h6HIgXgtObYjwOc7C/5ERMTPQtQAOpz5H9worBC/4uXs8wEHEiJ5IXus9ftq/9qPrt Dn4YCy0nrqdrjSGv4NwUl/TH5JtPVY9+OFD0emT+aUj4DYy8PeNElTaQlr7L7yxEuV43 1uJMDEeaIwW6plq+p8AFBLczWxxpa06r+/JeuvjABPcO1CYIBHf9xq1hp9VYtFMWuwk6 rReL60AVe5bYhEScAYu3vUjyxa8zuDjIyJX4YFZfT47CEFUTsqIJ7/lUQoV2nIny0XQq l/9HWTq9VKSl+xVW2JoATPVk74+W6MCCA6wo9sP9o+lyakid2r6oeMXeBqb/tmjoUdme b/0Q== 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=zs33WUET3TwShkJZi0v92Kdx2DNNU6JjJOAyINKhk/A=; fh=WQ0fQ4sUzgT0xo1UK8NVSlSI80y+/XkhC1sdM3re38s=; b=vjQf5CEcubluTglcgKak9+xWJBxjhqg21na75Pxl7e0629+STUSVflCNx3i0tdI08i lQsJPv94VV35vywUitDy5H1rUdnW9tU/FL4kO791KPDTDSt5CNHrlgaSCQ9T25DKb6XV DxX4JHXDqw2NRHdA2FlStHfNrDwexp7euMGeAFh28qtgJAlr/FKCj6vvoeHfBvBNCGfP 664E3eXwprzXQZWw7vpu6ZrvSNvBfCw1qU7HCHNxWo6J964nNpOfNrtNQD/tOucuSEXK pYELTiGmQmMH7Objw4msKkuaQfKuI7kXIBwquMg4xSLBamPsa0ivv1ena2FBq77JMJIK 2z1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n0Or9Ddj; 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-4464202a499si724011cf.265.2024.06.26.16.14.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jun 2024 16:14:20 -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=n0Or9Ddj; 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 1sMbp5-00038p-M7; Wed, 26 Jun 2024 19:13:07 -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 1sMbp1-00037u-Ss for qemu-devel@nongnu.org; Wed, 26 Jun 2024 19:13:03 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMbp0-0000OA-BA for qemu-devel@nongnu.org; Wed, 26 Jun 2024 19:13:03 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1f64ecb1766so55240115ad.1 for ; Wed, 26 Jun 2024 16:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719443580; x=1720048380; 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=zs33WUET3TwShkJZi0v92Kdx2DNNU6JjJOAyINKhk/A=; b=n0Or9DdjfvPbekEtxWyOr75G1YMsVilhH2jw1uul4adaPCk3owzVLJwIgpXXfQMlLt G1SwQRkK1phO/TDGmRwzJom9DwJOIcp+0HQdqFBLpSdG9Lllr3OEwXxbvhAE4qP4fpdu ej12U2y7IwZE/6e74IJulOHFmzv8gdPMBoK4/ya7qSR9Cvs00OX5CZCceKo6QvB6ctCV gvlDJcUqB7Mi5g6rFaNLU9PXxVMjC74uWz1gl7MA5VI8+J9qdz8yqDeuzDpCdBxwmEkL ChQTezdtGgHIBp0yl0BW1Vi4zT8Pdx3UebJis6g3p8WGIMx4V3P5gsrLKBEzYO2U6ekw hajA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719443580; x=1720048380; 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=zs33WUET3TwShkJZi0v92Kdx2DNNU6JjJOAyINKhk/A=; b=CX0PXVNQnnPSDdIoP9002v8IeAYP0DyisFvCKOE0JW6AL3bVunhPMxjMke3DOB+PXV RE4K9Y/bbYis/GRZXOVv11SkJCLi6Bf94E+bNPRJxeJGcifZHrqSqf7IGQJZ6wV38QG3 rbbtwUB1VUhdukHls4T9RB3wZ2UdXISjrDgNzgJnDLsVgkj1SjlYsRTBJQAo2uK2hwF8 /GrHw7orpTnjksGp8HyBXkOHoeAlj4Mf85JSv3f6mBD3xOKmdReU6LuT4art0MIVtQKk 1EnZYbiVrYxn6BNZeMYp3DDWBkaPge4Xdk13KM+PVVUvps4vn1VobXkTddqI06zlX630 Yozw== X-Gm-Message-State: AOJu0YxpQreVcbmecd5poTApUs8oCYyI56N42CgItnlN9YvLVwQFo5SF LLrOR4FeGzUbjMCmWkL7WhAl2l+ly277tKQq0nCGnEQNYgFLo1mj0CGXYq/pQiEbLwOXYAB0SfX mfno= X-Received: by 2002:a17:902:eccb:b0:1f7:1ba5:85ff with SMTP id d9443c01a7336-1fa1d673c80mr136315375ad.57.1719443580340; Wed, 26 Jun 2024 16:13:00 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::2193]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1faac82cd3bsm478215ad.0.2024.06.26.16.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 16:12:59 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Mahmoud Mandour , Paolo Bonzini , Eduardo Habkost , Richard Henderson , Alexandre Iooss , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= Subject: [PATCH 1/7] plugins: fix mem callback array size Date: Wed, 26 Jun 2024 16:12:49 -0700 Message-Id: <20240626231255.339353-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240626231255.339353-1-pierrick.bouvier@linaro.org> References: <20240626231255.339353-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x634.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 data was correctly copied, but size of array was not set (g_array_sized_new only reserves memory, but does not set size). As a result, callbacks were not called for code path relying on plugin_register_vcpu_mem_cb(). Found when trying to trigger mem access callbacks for atomic instructions. Signed-off-by: Pierrick Bouvier --- accel/tcg/plugin-gen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index b6bae32b997..ec89a085b43 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -85,8 +85,7 @@ static void gen_enable_mem_helper(struct qemu_plugin_tb *ptb, len = insn->mem_cbs->len; arr = g_array_sized_new(false, false, sizeof(struct qemu_plugin_dyn_cb), len); - memcpy(arr->data, insn->mem_cbs->data, - len * sizeof(struct qemu_plugin_dyn_cb)); + g_array_append_vals(arr, insn->mem_cbs->data, len); qemu_plugin_add_dyn_cb_arr(arr); tcg_gen_st_ptr(tcg_constant_ptr((intptr_t)arr), tcg_env,