From patchwork Mon Nov 18 21:08:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844127 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp838990wrx; Mon, 18 Nov 2024 13:11:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXMdODyq7ASSwhwEKQFFLSJXGPfBpBA+syLFiZV2mVZeG3EL2fpMkZGkaPdE1N96KB7yNFagg==@linaro.org X-Google-Smtp-Source: AGHT+IHIMBYqbNiF2Y+gzg3tUwUvnfGdf+i8A0Ll36naMcawOz9NJJ1RezIKLpkevv7qDe4rZ7aL X-Received: by 2002:ac8:59c7:0:b0:463:16ee:bdb with SMTP id d75a77b69052e-46363e246bdmr229191091cf.23.1731964286352; Mon, 18 Nov 2024 13:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731964286; cv=none; d=google.com; s=arc-20240605; b=FJYuxk5QHn9DjcGs4S/DHaHqetF1SIsRSiCQhbpQ27CHXFtaYa8RP52aO5JJ/2MwIM coRXaJWHDLhR4YAu74a4Sym3DF3147l+GE+WTJZn9f7wOkMUVFYlmkNJfh39wtaqs8RK 9MWFgABGpNvg2evTsXnFt3OnPG0i592ozEAPjjhdqq3POErBQ7KIlNEnkbXtZCjzTsvJ D18O9uLq4Dmn1yvgqxjahNEgzY6xVdTeUzdbtGZEdsAbjaItUQzutX8qX+G7m2bwZoi3 x7z1fyOt96FbbVImpGYEgd6j/JpYz0esn6fEmD+Khq9oPBJmhizyL55XfUCjaqoe0Rke F1Ig== 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=ydzj5v64bDiKGKLne2KjbFR6S8kIPj7QOrU30iIlBoQ=; fh=E2WqPFE+FyovtIgeriVrkDknUlAAi4gj+HL6eUZjBtc=; b=KVFQlBag06R7h8sxV+ERQDb5abdD2o1NM2UvxcTIQD5OHCuj/HM9wF3HPu8bLMdYrE 04lGpvPdEIYcNvOCv0yaNhtnU5a+KXl/cXz2zbEMtZHZ54HeuDilmk2j2G3FGgCbGicA dVUofuzRbe6OExEEfQaFzHKwpK0hysMfBQyENEXK4+CFzamPlTjfy88k4UQwL6n7ArNQ ZwnHPn0oEXMkkG/GUIO+BJL/2h0Gizcrg+l++Nfbe2HsljNJu9Lz8PsoMXuTM0wNBEhW U9R6psovuSGc5u0rJdeBvlHSXs2CFKT6LAjA9M1ishrOlxO/VPpoED4OTvE6frNxNngu v51w==; 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 d75a77b69052e-46392b9b58asi6457971cf.25.2024.11.18.13.11.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 13:11:26 -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 1tD90E-00033r-A6; Mon, 18 Nov 2024 16:09:46 -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 1tD8zp-000224-MH; Mon, 18 Nov 2024 16:09:25 -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 1tD8zn-0005Pm-3y; Mon, 18 Nov 2024 16:09:21 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id D21BBA5611; Tue, 19 Nov 2024 00:08:31 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 6B2F117362A; Tue, 19 Nov 2024 00:08:35 +0300 (MSK) Received: (nullmailer pid 2366128 invoked by uid 1000); Mon, 18 Nov 2024 21:08:34 -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-9.0.4 68/71] contrib/plugins: add compat for g_memdup2 Date: Tue, 19 Nov 2024 00:08:25 +0300 Message-Id: <20241118210834.2366046-11-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 9.0.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 };