From patchwork Mon Nov 18 19:35:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844111 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp802620wrx; Mon, 18 Nov 2024 11:37:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVUj7Ku9ueqmu2dxcfai2mbNRzQWMxGO1nMDAjwBQnfS9EmCnJmpSUqZQH3S8Wa9/7QlNm19w==@linaro.org X-Google-Smtp-Source: AGHT+IE4H4ZtJOce6Eoozf5Gs7WM2X3pxYv2lIUOaWtnAj9u/dcuNljXNbUMI3kkGf79xum8/IY/ X-Received: by 2002:a05:6214:428d:b0:6d3:c3ee:10c4 with SMTP id 6a1803df08f44-6d3fb821febmr193375436d6.33.1731958632063; Mon, 18 Nov 2024 11:37:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731958632; cv=none; d=google.com; s=arc-20240605; b=LaS9ccFtXP8mn1J24ksiKknF3SdzYmWiBkI8RgBk+jt4lgSNlWhLr+fL3AGrH5KdJb vF06LEId2EqKGyK1BweWaiw2/bUGUGSbJqSEbx2C8xfSrIQv0UuMEgINItMJ6EeQHWUx eP8foDNlZ39rA+Fmqa0HFzqfvijFw5TYUccyreFFM8azvcp55UXZl/O6OmLAybQXjd7n IIdRf13SwWkCMNZgsO4ufcJYPQFc4NTlQJgjTDpsDBOp5eOpLRuDZaa3wvRJGO09fbWw TVWbze0lluUo7RbUiSWX8xZiGS6g9zhT/Sigxkux5l6s0rY8epWoWOzRE8odETo2IBfl IdCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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; bh=n6/1D3Di6uHqhMO/KT+uMHhIFcckqzSUy6ISVzBnJus=; fh=E2WqPFE+FyovtIgeriVrkDknUlAAi4gj+HL6eUZjBtc=; b=MDRA+sBF4qUXG6sbgbIwgfil8m6IOV5EHUApocRJkhv7N7madRifgSK6q72d9E2k/C Ny7lPkdr3kudu8kRATNOjIrYZXF222NWvrEoR+EXayN/VCyJA8RPdvxKGEmqJwyAO0Ii tBnYhz1FVOuWuT4/g+oLhQziitA7z2p4UWpXjbxdKRe1Wpzt3xe7sCWhrnqidkgcEC+r GGRI/BG9c6o5W3tNlE0JjUQHbO55Mipi6nX0cG1gYejZmBr2mv/IAMZsjLG5gUzMx1sw cCmTx8PL5G9T5iIB0AKmBHFObm2CHbxTJUukaEW5wLnx92yH0//ks7shEX78ZMlhwISO UCLQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d40db981cdsi76350416d6.119.2024.11.18.11.37.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 11:37:12 -0800 (PST) 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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD7XX-0006hW-Tl; Mon, 18 Nov 2024 14:36:04 -0500 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 1tD7XM-0006f9-3a; Mon, 18 Nov 2024 14:35:53 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD7XD-0002iB-30; Mon, 18 Nov 2024 14:35:44 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id CCB1EA54E7; Mon, 18 Nov 2024 22:35:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 4C6F41735A4; Mon, 18 Nov 2024 22:35:21 +0300 (MSK) Received: (nullmailer pid 2312698 invoked by uid 1000); Mon, 18 Nov 2024 19:35:20 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-8.2.8 58/61] contrib/plugins: add compat for g_memdup2 Date: Mon, 18 Nov 2024 22:35:13 +0300 Message-Id: <20241118193520.2312620-10-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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: Alex Bennée We were premature if bumping this because some of our builds are still on older glibs. Just copy the compat handler for now and we can remove it later. Fixes: ee293103b0 (plugins: update lockstep to use g_memdup2) Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2161 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20240729144414.830369-14-alex.bennee@linaro.org> (cherry picked from commit 44e794896759236885f6d30d1f6b9b8b76355d52) Signed-off-by: Michael Tokarev Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2681 in 8.2.x diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index 237543b43a..0c6f060183 100644 --- a/contrib/plugins/lockstep.c +++ b/contrib/plugins/lockstep.c @@ -100,6 +100,31 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) plugin_cleanup(id); } +/* + * g_memdup has been deprecated in Glib since 2.68 and + * will complain about it if you try to use it. However until + * glib_req_ver for QEMU is bumped we make a copy of the glib-compat + * handler. + */ +static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size) +{ +#if GLIB_CHECK_VERSION(2, 68, 0) + return g_memdup2(mem, byte_size); +#else + gpointer new_mem; + + if (mem && byte_size != 0) { + new_mem = g_malloc(byte_size); + memcpy(new_mem, mem, byte_size); + } else { + new_mem = NULL; + } + + return new_mem; +#endif +} +#define g_memdup2(m, s) g_memdup2_qemu(m, s) + static void report_divergance(ExecState *us, ExecState *them) { DivergeState divrec = { log, 0 };