From patchwork Mon Nov 18 21:08:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844125 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp838642wrx; Mon, 18 Nov 2024 13:10:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW3tN4Q9iEXDHO+PG33P+1FK3N7Wd1OdjWcuLS9o3hZLBZtr0RXZEUj5OpnrkEgG812cCHWvw==@linaro.org X-Google-Smtp-Source: AGHT+IH9Rz84yL5Cs6Yk3zfOH+YAW8Sk1Kja06pGGkyjySHgXuIE8RIiBCo4Olur4KlEhKz6UdeD X-Received: by 2002:a05:620a:408a:b0:7ac:e832:907c with SMTP id af79cd13be357-7b36237b24fmr1815679685a.55.1731964240719; Mon, 18 Nov 2024 13:10:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731964240; cv=none; d=google.com; s=arc-20240605; b=d3l2/32bxZVj3zp0frAt+jrb2GHNCw476wt1nQaYab5hD0xFdElejQZtxzM/nWXH+A rc3EK3GcaprJP1eK1mEkrA1YeqXfsXndFIDTQp6brGJ+fWjmTA4Sb3FpjAUAdk39xh/X dwr8sK14izx65AV+V/dvOFoKYQR9CJHSviA8DpzrJilovwawlnVRgddZSh/xaaHaBJ8L TZBPVnZdqI2f63xnWwR4gsFCyBQKe11ZNeSwiOCs8227J/gPxsEoll/ZndYqpgV7dyNr j62xh6a4kaQB1UeTCl1Gd5t7DO88VNSvHCmLGgYiwLgRuSrvx3u3RzQq1YkG5aESLWuL 19PQ== 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=HbmMIEBXm3RAl5QDCzhaVlmc5ulg64sG1lQj0hwDWeU=; fh=tMa47au2sw5piyxOJuQsGBLvYh0d/gfD9bj/VCraw+I=; b=hpwTbpr/ksE0g2YTB69JkR//HhySajuy1nUKaekp+uksVCCRR136c2L733FrlLUWEj qOTnXpwTw1NVWKjgK+YEYf0dTWJEl1Jq5oIOkDAGAoF3D/8sMMpIPnq8qwVbBbKRl5Pm jUBrhjnNUomIg1dx0Gqp8yIHyHgUuE3CWdaA30fzZvGMdqijhrIeFkCcQGBJVhKqy4nD i8+ccWpTcWV1H7GWvS8B84IURdXxK+zgMWgI2WctdAPKenthfTyH06au7lZxlep4k6/r seT2ac4uIphaPpdWoA69CoqXMYAjz+G3cBTyH4YLYtupWZTpCMWmPHgFtYDog3rWMh0k 4R3w==; 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 af79cd13be357-7b37a8ac141si70092685a.643.2024.11.18.13.10.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 13:10:40 -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 1tD900-0002Gr-91; Mon, 18 Nov 2024 16:09:32 -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 1tD8zG-0001rq-Fg; Mon, 18 Nov 2024 16:08:47 -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 1tD8zC-0005M7-HF; Mon, 18 Nov 2024 16:08:45 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 54A0AA5608; 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 E1EED173621; Tue, 19 Nov 2024 00:08:34 +0300 (MSK) Received: (nullmailer pid 2366099 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, Peter Maydell , Paolo Bonzini , Michael Tokarev Subject: [Stable-9.0.4 59/71] hw/i386/pc: Don't try to init PCI NICs if there is no PCI bus Date: Tue, 19 Nov 2024 00:08:16 +0300 Message-Id: <20241118210834.2366046-2-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: Peter Maydell The 'isapc' machine type has no PCI bus, but pc_nic_init() still calls pci_init_nic_devices() passing it a NULL bus pointer. This causes the clang sanitizer to complain: $ ./build/clang/qemu-system-i386 -M isapc ../../hw/pci/pci.c:1866:39: runtime error: member access within null pointer of type 'PCIBus' (aka 'struct PCIBus') SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../hw/pci/pci.c:1866:39 in This is because pci_init_nic_devices() does &bus->qbus which is undefined behaviour on a NULL pointer even though we're not actually dereferencing the pointer. (We don't actually crash as a result, so if you aren't running a sanitizer build then there are no user-visible effects.) Make pc_nic_init() avoid trying to initialize PCI NICs on a non-PCI system. Cc: qemu-stable@nongnu.org Fixes: 8d39f9ba14d64 ("hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices()") Signed-off-by: Peter Maydell Link: https://lore.kernel.org/r/20241105171813.3031969-1-peter.maydell@linaro.org Signed-off-by: Paolo Bonzini (cherry picked from commit bd0e501e1a4813fa36a4cf9842aaf430323a03c3) Signed-off-by: Michael Tokarev diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 5c21b0c4db..6bd2333c2e 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1280,7 +1280,9 @@ void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) } /* Anything remaining should be a PCI NIC */ - pci_init_nic_devices(pci_bus, mc->default_nic); + if (pci_bus) { + pci_init_nic_devices(pci_bus, mc->default_nic); + } rom_reset_order_override(); } From patchwork Mon Nov 18 21:08:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844128 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp839023wrx; Mon, 18 Nov 2024 13:11:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU0AyQ2W77s2MMeqbONooRu/SZENKWLZiVRI85AaL9z0tc+Ixd5pC9/FlyWP+K3eqdmob+2yg==@linaro.org X-Google-Smtp-Source: AGHT+IEkunvwCM+qkjxNvTjMelIUL0aQH3S2YBbMIjwxlleTibnEAzYDgu15Yy7F6fpBV+SCFMce X-Received: by 2002:a05:622a:1486:b0:461:20b2:ba00 with SMTP id d75a77b69052e-46392da14f7mr12990311cf.18.1731964289597; Mon, 18 Nov 2024 13:11:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731964289; cv=none; d=google.com; s=arc-20240605; b=ZI0EZiaJMirbLKtToMx6GpT+olfoRd3GRLhFzNUX+vkW2yV0fRw0G8hn8MvESeBWVJ dgX2WqcECp/ROPJPXGuBKgsDWG7zS+/2ydKISbkCaOg1oeXtYIHkNiNukBv3g0VQV2/B wzNPtj4RCoa2vgAD7jN9y0zFp9m/zj9xr9s1HkqoyTFkydJ83JZJoJg4VlQULW6A3r7O ZILN52YSXITJxKb/nMSmC6EnwkOuV1PdYBc+tO3QnupzZ39lt14HAKmHKQigbcKZX0qO g8D7iHoQmGOtqSjzjgAivlBKZmPgSd/R5Fb81WlOmGh9ZkWLPOBVSho331VqkqYxb5Cu xaEw== 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=loHIXc4wXqImr2Y8mWhDPn3u3pm58UHKF295eTH1L1o=; fh=NoJ7n5JVE2hviRF6uNBFRIJvWH7igafuy1AIwg26ToM=; b=Hmcw1nNDkpoyX9RvglfcBtsEuSOxvM6PCKiuaclwOKN4Zya7LmBHCARXK9WqRKO/kE PaJjF+P3fyvY/hGENoxLRxR+xwPzF3aaL02lO1qEQC+qOo1rTGUctLTu8drZ/U649aEy fmtcKd0wHG0o/c5pvXtjdj/eskk1ko+OLe+QzstEC8E6QYeaTcZJM3hztH0M3NRu9Ywh fsWEZcfhQ38fBKUGWx/L7FHXTFRyC2wZ6kmeN5oxGCUtSp0zQja8KM8hD8AjbjEswS8t iI31lSuAaIPHffWQTGIK9nAoeFSKx6wmY0NuReTgEv9e7VRy539GUqEei8Olx2ZXaLNb 8fFw==; 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 af79cd13be357-7b37a8951d0si59896585a.361.2024.11.18.13.11.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 13:11:29 -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 1tD904-0002ZT-V3; Mon, 18 Nov 2024 16:09:37 -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 1tD8zJ-0001sM-Oc; Mon, 18 Nov 2024 16:08:51 -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 1tD8zI-0005N4-2h; Mon, 18 Nov 2024 16:08:49 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 72353A560A; 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 0B8C8173623; Tue, 19 Nov 2024 00:08:35 +0300 (MSK) Received: (nullmailer pid 2366106 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, Richard Henderson , Peter Maydell , Michael Tokarev Subject: [Stable-9.0.4 61/71] target/arm: Drop user-only special case in sve_stN_r Date: Tue, 19 Nov 2024 00:08:18 +0300 Message-Id: <20241118210834.2366046-4-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: Richard Henderson This path is reachable with plugins enabled, and provoked with run-plugin-catch-syscalls-with-libinline.so. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-ID: <20241112141232.321354-1-richard.henderson@linaro.org> (cherry picked from commit f27550804688da43c6e0d87b2f9e143adbf76271) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 6853f58c19..7ac19fdd65 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -6306,9 +6306,6 @@ void sve_stN_r(CPUARMState *env, uint64_t *vg, target_ulong addr, flags = info.page[0].flags | info.page[1].flags; if (unlikely(flags != 0)) { -#ifdef CONFIG_USER_ONLY - g_assert_not_reached(); -#else /* * At least one page includes MMIO. * Any bus operation can fail with cpu_transaction_failed, @@ -6339,7 +6336,6 @@ void sve_stN_r(CPUARMState *env, uint64_t *vg, target_ulong addr, } while (reg_off & 63); } while (reg_off <= reg_last); return; -#endif } mem_off = info.mem_off_first[0]; From patchwork Mon Nov 18 21:08:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844124 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp838369wrx; Mon, 18 Nov 2024 13:09:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW/9w14ffk7uE7fxPe4+MMjpKJ3klaQAhESamybUEGfPNI4yztgbFeIOkbG9Tksx/1qbzd+3A==@linaro.org X-Google-Smtp-Source: AGHT+IHk6zkWP1rZwroav+2qJWuPe5/R54FpbvY8cZeg3pRa8hHcZCgL4W+7kL8r1gUpq2qRchBz X-Received: by 2002:a05:620a:4491:b0:7b1:4762:87 with SMTP id af79cd13be357-7b3622db3e9mr2197076485a.37.1731964199123; Mon, 18 Nov 2024 13:09:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731964199; cv=none; d=google.com; s=arc-20240605; b=JncvvsVdNoRdZf4QG0F65GcwQ08xJGagkdFFRjTIptB1KPx9smzZKSsp/fy9UdywCA Ggrh026SvKYCYony/QsMcYtJ3FicORUUMNXfeZ96BmrHKmx4tMC3NaeWKx2T8n3yxZTm l2Y6laezpeu9oDgOpGjSQR1Mh2r+XN7RX9hLHvyRHirOzNodtiLQZIc2lbxN1By3pUed wBP+8GzcfwKEhmCLlVIuRUcVdaRv25fiMD/csBWyDeIE2JfYk4WdnMTB1zwPrNQM/mIg DtZzOSabRSM6kqpegKxJRVG9ASoSi6ToTfX2kTt0eDO1flkPmOSU2n0Q9D/IHzCahk7e qa0A== 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=5EpCGLBGMamdDSO2jfrCF5SwQvZHNrpbfk/1AuDTRcg=; fh=fA8wXgZkOijV3QzeJqIqYxlGqKQb9nNVVJRQwjQ6hao=; b=TPuGzB4SMBcBdXKqmR9EUAskHLuurJMFG03/5n7DSbMFMBExEQmzrRp8F+pReiVUQo LeEIkm66e02RFZvgs2vTy2aCVZMPQGaM5D20LCQ0a7yhMECH71VeVt/AJXX29PMO7BXd LTtHYhl8s8tabB9ba4g+sKD8GF/I4gt+ZrT8bjf2REj1imkNFTzuSb17V4WKas/z+HaF 7SVLJeH8JXEcVksKI2sWJBOnisASwJ/EP2M0wgqA2wZ2G6YWoAv08TWagAcXwkdbQ4zI EOFP79qNYg0vPHkZTcTZwij8Q8cBruuczoW6ywB3ghIpOTMN1pH2MkyLUaoR+F3MzkFz GIjw==; 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 af79cd13be357-7b37a83cb21si61031285a.101.2024.11.18.13.09.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 13:09:59 -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 1tD8zT-0001vc-H2; Mon, 18 Nov 2024 16:08:59 -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 1tD8zK-0001si-TT; Mon, 18 Nov 2024 16:08:51 -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 1tD8zI-0005NL-JN; Mon, 18 Nov 2024 16:08:50 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 7FD9AA560B; 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 19296173624; Tue, 19 Nov 2024 00:08:35 +0300 (MSK) Received: (nullmailer pid 2366109 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, Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9e?= , Michael Tokarev Subject: [Stable-9.0.4 62/71] accel/tcg: Fix user-only probe_access_internal plugin check Date: Tue, 19 Nov 2024 00:08:19 +0300 Message-Id: <20241118210834.2366046-5-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: Richard Henderson The acc_flag check for write should have been against PAGE_WRITE_ORG, not PAGE_WRITE. But it is better to combine two acc_flag checks to a single check against access_type. This matches the system code in cputlb.c. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2647 Signed-off-by: Richard Henderson Message-Id: 20241111145002.144995-1-richard.henderson@linaro.org Reviewed-by: Alex Bennée (cherry picked from commit 2a339fee450638b512c5122281cb5ab49331cfb8) Signed-off-by: Michael Tokarev diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 3cac3a78c4..50a9d32bd3 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -796,7 +796,7 @@ static int probe_access_internal(CPUArchState *env, vaddr addr, if (guest_addr_valid_untagged(addr)) { int page_flags = page_get_flags(addr); if (page_flags & acc_flag) { - if ((acc_flag == PAGE_READ || acc_flag == PAGE_WRITE) + if (access_type != MMU_INST_FETCH && cpu_plugin_mem_cbs_enabled(env_cpu(env))) { return TLB_MMIO; } From patchwork Mon Nov 18 21:08:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844123 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp838250wrx; Mon, 18 Nov 2024 13:09:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUE5WMNWuPHe6jJTAnS5fUei9RtyHELSgV2+NFBU3wlNhz1bxxIa6Zh3jHNEQeHFBJgN8tubg==@linaro.org X-Google-Smtp-Source: AGHT+IFgh5wHh5R8PtyFxy1c+tjGpwcfiOB2WrxrxGg4z9aHlGY33g2lmENsXx1o8CcoBmHUSaXH X-Received: by 2002:a05:620a:4109:b0:7b1:4436:cf12 with SMTP id af79cd13be357-7b3622dfb35mr2355966285a.25.1731964181091; Mon, 18 Nov 2024 13:09:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731964181; cv=none; d=google.com; s=arc-20240605; b=khkq2Mo2YcgBisoz3RPp9Hi4IAO1hxSx5kf5Yosb+uWLLiQRDBt8y7S5UzJD2dqntN RAHzszDSTOru+pOzgJPyuzUpIXIrk7HK5rrU32HwBrjis2da4CQzUvWhd/kiuaQLOfpN +e6/NhQwfY9iPieqD90gSNzzLAeBOYK08cDjhZHIvYLxY3EXQYWr9dYeHUgb12WtoUKo n0K02k7qDeiUUPzIDv/NaIp6HOejTxUh3Er1MS305CmBSVfn/C8IGidtzsfmjtH40Xh7 CqBXIHRrtxpy5ZNidkKTBmLhKabszVIesZftUd8XKcPpNxRTmh62+9uomyfFW6UFt22i /nuQ== 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=UAF4xrnSiDr+6+n8Ih/c+HXHjjKo4DYLm/IpHVBiYaE=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=aZdHbHxro4xx0b3xoQl+Fd7ZzmWYURHflDEmNm9zyeCK43y45Q3tEsOhTqcC/gS5aq HLn/3wKd+4JGVKVJfB79lWrYpo/QJMN5YOnQWBH5Nw1TD1ghusNKVlGektUGhstesQpN gWAeRzS18URHiqDa0mBsR3ztyX4ZYiyiz8berICnNogjEhXsVF4QYiYTw/R0M8xQN8OP 9psbTZcfyEbRlD+SQvbCXDBlifK2jIaaNwGcpMNFi3hJkvDVBL9HOOWkgCrkhqZBudDf eUPqUH2nR6cv4uF127eJ7Q+Mf7rcozA02Jnd58x0gq9V2+HYYiMGSaVOxAPCtiSJIOJh riUQ==; 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 af79cd13be357-7b37a84af95si57166885a.176.2024.11.18.13.09.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 13:09:41 -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 1tD8zw-000233-J7; Mon, 18 Nov 2024 16:09:30 -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 1tD8zN-0001uN-Ov; Mon, 18 Nov 2024 16:08:55 -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 1tD8zM-0005OC-7s; Mon, 18 Nov 2024 16:08:53 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 9A9AAA560D; 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 33E20173626; Tue, 19 Nov 2024 00:08:35 +0300 (MSK) Received: (nullmailer pid 2366115 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, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-9.0.4 64/71] linux-user/arm: Reduce vdso alignment to 4k Date: Tue, 19 Nov 2024 00:08:21 +0300 Message-Id: <20241118210834.2366046-7-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: Richard Henderson Reduce vdso alignment to minimum page size. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson (cherry picked from commit f7150b2151398c9274686d06c2c1e24618aa4cd6) Signed-off-by: Michael Tokarev diff --git a/linux-user/arm/vdso-be.so b/linux-user/arm/vdso-be.so index 69cafbb956..bed02804a4 100755 Binary files a/linux-user/arm/vdso-be.so and b/linux-user/arm/vdso-be.so differ diff --git a/linux-user/arm/vdso-le.so b/linux-user/arm/vdso-le.so index ad05a12518..38d3d51047 100755 Binary files a/linux-user/arm/vdso-le.so and b/linux-user/arm/vdso-le.so differ diff --git a/linux-user/arm/Makefile.vdso b/linux-user/arm/Makefile.vdso index 2d098a5748..8a24b0e534 100644 --- a/linux-user/arm/Makefile.vdso +++ b/linux-user/arm/Makefile.vdso @@ -6,7 +6,7 @@ VPATH += $(SUBDIR) all: $(SUBDIR)/vdso-be.so $(SUBDIR)/vdso-le.so # Adding -use-blx disables unneeded interworking without actually using blx. -LDFLAGS = -nostdlib -shared -Wl,-use-blx \ +LDFLAGS = -nostdlib -shared -Wl,-use-blx -Wl,-z,max-page-size=4096 \ -Wl,-h,linux-vdso.so.1 -Wl,--build-id=sha1 \ -Wl,--hash-style=both -Wl,-T,$(SUBDIR)/vdso.ld From patchwork Mon Nov 18 21:08:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844130 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp839183wrx; Mon, 18 Nov 2024 13:11:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUKHFkCyozPjYmbDq5vfRm5YgMRXttexpuSBQHeEKwyxXgouixCd/d7ZaKlnP6aXUzxRfkv1g==@linaro.org X-Google-Smtp-Source: AGHT+IFX0DErJIMQ7Djo5IK7wM0ITzwajUmBBqn5VcEr1Rde1F3kSjmS99hWNrOGAU4+8jkwp0hK X-Received: by 2002:a05:6214:390e:b0:6d3:f001:9c96 with SMTP id 6a1803df08f44-6d3fb7ac4ffmr168561346d6.8.1731964309122; Mon, 18 Nov 2024 13:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731964309; cv=none; d=google.com; s=arc-20240605; b=OWaeZvzHb4k3VI6ubdJoJnP3G4ImF/Edpoq0QqxEqLifWxm+TU0fPtJwjJ7U2G2JK/ k3Oz+eNzQJXjA6zZzmWDI/8PH6c3IGX1+7P9d6fk2LhT+mS8fJy9iTlQwDW+iSQENRgM ebPOFyMMS3QFPqv7sgYG6TTu5tFDgU8yz4rxTwOs5ucXKp0hGLu4TLzqX5p9dCIILb/x ojVK1nWUVfgQClp/GplAh6OisKnHyqplhzlFwNo4Hi0aQkJgnYFBCKQU1piJZHYSPlx4 syUSGRk/Qnnz5fnrcn8oSguwiidrthv+O4jBMu4Ev5uFu6ZLjvnl6erm1GdbYcL8FQrL YD6g== 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=cYWBSd/8iJlsE5huDODNMXv7PjZqWUAcfNnNRf+110I=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=JlmpN44J54c9SEJF9loxiNoDXajk1sXp0B3hRcMW2t1kAFJINsBPpJjN1Yv+W8ugUy k5ak11kQ7ksjvXoktdNhXR0CFbPhtza9mMX8ji+xTqzbhR0Tmqr6DaUPvb/KvwEXioiT GKJj+ujq9GkwUgdixazvjpnh9g5TtfB2Szzw7W+WK7tHc8B5idvQQNqHqbzUgn00r2oE qONbWiLeHrL5QB+15llPVytKnjfPPVom0WoUD+7sHZk2kNGs0ndpQJ3LePQo7wFSpyKf NFvby9fFZwPdFyY+v403CgaqvnxqIDlbduamFP5k4GvUTNVjxLbR3PcAOYdV3p0oatfi 450w==; 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-6d40dd1069csi70957506d6.472.2024.11.18.13.11.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 13:11:49 -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 1tD907-0002jA-71; Mon, 18 Nov 2024 16:09:40 -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 1tD8zQ-0001uz-24; Mon, 18 Nov 2024 16:08:56 -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 1tD8zO-0005Ok-3z; Mon, 18 Nov 2024 16:08:55 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id A9670A560E; 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 417E9173627; Tue, 19 Nov 2024 00:08:35 +0300 (MSK) Received: (nullmailer pid 2366118 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, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-9.0.4 65/71] linux-user/arm: Select vdso for be8 and be32 modes Date: Tue, 19 Nov 2024 00:08:22 +0300 Message-Id: <20241118210834.2366046-8-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: Richard Henderson In be8 mode, instructions are little-endian. In be32 mode, instructions are big-endian. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2333 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson (cherry picked from commit 95c9e2209cc09453cfd49e91321df254ccbf466f) Signed-off-by: Michael Tokarev diff --git a/linux-user/arm/Makefile.vdso b/linux-user/arm/Makefile.vdso index 8a24b0e534..ede489e236 100644 --- a/linux-user/arm/Makefile.vdso +++ b/linux-user/arm/Makefile.vdso @@ -3,15 +3,18 @@ include $(BUILD_DIR)/tests/tcg/arm-linux-user/config-target.mak SUBDIR = $(SRC_PATH)/linux-user/arm VPATH += $(SUBDIR) -all: $(SUBDIR)/vdso-be.so $(SUBDIR)/vdso-le.so +all: $(SUBDIR)/vdso-be8.so $(SUBDIR)/vdso-be32.so $(SUBDIR)/vdso-le.so # Adding -use-blx disables unneeded interworking without actually using blx. LDFLAGS = -nostdlib -shared -Wl,-use-blx -Wl,-z,max-page-size=4096 \ -Wl,-h,linux-vdso.so.1 -Wl,--build-id=sha1 \ -Wl,--hash-style=both -Wl,-T,$(SUBDIR)/vdso.ld -$(SUBDIR)/vdso-be.so: vdso.S vdso.ld vdso-asmoffset.h - $(CC) -o $@ $(LDFLAGS) -mbig-endian $< +$(SUBDIR)/vdso-be8.so: vdso.S vdso.ld vdso-asmoffset.h + $(CC) -o $@ $(LDFLAGS) -mbig-endian -mbe8 $< + +$(SUBDIR)/vdso-be32.so: vdso.S vdso.ld vdso-asmoffset.h + $(CC) -o $@ $(LDFLAGS) -mbig-endian -mbe32 $< $(SUBDIR)/vdso-le.so: vdso.S vdso.ld vdso-asmoffset.h $(CC) -o $@ $(LDFLAGS) -mlittle-endian $< diff --git a/linux-user/arm/meson.build b/linux-user/arm/meson.build index c4bb9af5b8..348ffb810d 100644 --- a/linux-user/arm/meson.build +++ b/linux-user/arm/meson.build @@ -10,10 +10,17 @@ syscall_nr_generators += { # is always true as far as source_set.apply() is concerned. Always build # both header files and include the right one via #if. -vdso_be_inc = gen_vdso.process('vdso-be.so', - extra_args: ['-s', 'sigreturn_codes']) +vdso_be8_inc = gen_vdso.process('vdso-be8.so', + extra_args: ['-s', 'sigreturn_codes', + '-p', 'vdso_be8']) + +vdso_be32_inc = gen_vdso.process('vdso-be32.so', + extra_args: ['-s', 'sigreturn_codes', + '-p', 'vdso_be32']) vdso_le_inc = gen_vdso.process('vdso-le.so', extra_args: ['-s', 'sigreturn_codes']) -linux_user_ss.add(when: 'TARGET_ARM', if_true: [vdso_be_inc, vdso_le_inc]) +linux_user_ss.add(when: 'TARGET_ARM', if_true: [ + vdso_be8_inc, vdso_be32_inc, vdso_le_inc +]) diff --git a/linux-user/arm/vdso-be32.so b/linux-user/arm/vdso-be32.so new file mode 100755 index 0000000000..b896d3d545 Binary files /dev/null and b/linux-user/arm/vdso-be32.so differ diff --git a/linux-user/arm/vdso-be.so b/linux-user/arm/vdso-be8.so similarity index 95% rename from linux-user/arm/vdso-be.so rename to linux-user/arm/vdso-be8.so index bed02804a4..784b7bdb2a 100755 Binary files a/linux-user/arm/vdso-be.so and b/linux-user/arm/vdso-be8.so differ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 42185cc111..28d5d52d0f 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -656,6 +656,23 @@ static const char *get_elf_platform(void) #undef END } +#if TARGET_BIG_ENDIAN +#include "elf.h" +#include "vdso-be8.c.inc" +#include "vdso-be32.c.inc" + +static const VdsoImageInfo *vdso_image_info(uint32_t elf_flags) +{ + return (EF_ARM_EABI_VERSION(elf_flags) >= EF_ARM_EABI_VER4 + && (elf_flags & EF_ARM_BE8) + ? &vdso_be8_image_info + : &vdso_be32_image_info); +} +#define vdso_image_info vdso_image_info +#else +# define VDSO_HEADER "vdso-le.c.inc" +#endif + #else /* 64 bit ARM definitions */ @@ -955,14 +972,14 @@ const char *elf_hwcap2_str(uint32_t bit) #undef GET_FEATURE_ID -#endif /* not TARGET_AARCH64 */ - #if TARGET_BIG_ENDIAN # define VDSO_HEADER "vdso-be.c.inc" #else # define VDSO_HEADER "vdso-le.c.inc" #endif +#endif /* not TARGET_AARCH64 */ + #endif /* TARGET_ARM */ #ifdef TARGET_SPARC @@ -3592,12 +3609,14 @@ static void load_elf_interp(const char *filename, struct image_info *info, load_elf_image(filename, &src, info, &ehdr, NULL); } +#ifndef vdso_image_info #ifdef VDSO_HEADER #include VDSO_HEADER -#define vdso_image_info() &vdso_image_info +#define vdso_image_info(flags) &vdso_image_info #else -#define vdso_image_info() NULL -#endif +#define vdso_image_info(flags) NULL +#endif /* VDSO_HEADER */ +#endif /* vdso_image_info */ static void load_elf_vdso(struct image_info *info, const VdsoImageInfo *vdso) { @@ -3928,7 +3947,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) * Load a vdso if available, which will amongst other things contain the * signal trampolines. Otherwise, allocate a separate page for them. */ - const VdsoImageInfo *vdso = vdso_image_info(); + const VdsoImageInfo *vdso = vdso_image_info(info->elf_flags); if (vdso) { load_elf_vdso(&vdso_info, vdso); info->vdso = vdso_info.load_bias; From patchwork Mon Nov 18 21:08:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844126 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp838649wrx; Mon, 18 Nov 2024 13:10:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXKrxvyodIGp8YCue6jUlVHqiScGUHIs4iCIlWSyVA4JDs/N6+1YwgOMCNARACKZbW8L0OUog==@linaro.org X-Google-Smtp-Source: AGHT+IGXeDFexb0ZK2B3LvzkMTbDrpFqryeLOonoumxF8lLUpoMDfzPpfc8yQGLNY9qu1QKDI+fg X-Received: by 2002:a05:620a:4481:b0:7b1:534b:5385 with SMTP id af79cd13be357-7b3622df7b1mr2056530885a.37.1731964242117; Mon, 18 Nov 2024 13:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731964242; cv=none; d=google.com; s=arc-20240605; b=d2hVzu8bRdE1R9inKOIBKJnuN3RrhhXKQTnyHCJhfXvr0WLsM5YzORWB6ls/IE+Wo3 bS0UOq0/MClz8r4yiqy891WoINNRnp26mAgINg1EIK1csDp1NSfWlD1VTNveX6QVji29 OaQzDEmAqiiuLTtzJHAHBM0HIr3HQ2gUcVMHLdKLkqjZyNRQWxmFqnVhNVXNRc3vpOHj 6HgQnUEExk3rWFoDD6U+/D8eBV2ITct9GbpAxqYb2JPLPLKyWi/s45FIQkbi151mQEmd +FS/ZHkxc0j8Y9Ivoebco9LGVZU/Kz9BCMc8f45zhdAEX2/cxxsTSF50ejDgSqf5Bc66 Sx8w== 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=LMl3VgmaK3q3SYObD5m5qm3/+RRmrJcV4C3nTxs68sA=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=iSw3SFh8JEaWKFvf/2jhqAz4xiqZRJAJvH/3JAAeQfZ4+NU583F0Wx0M9AtUpFcapb iFInY59dic11g0cvu/VBggKz3wIgbdGx5HRs7i57VmXiwhVtZOvSWB986nZovB1aQOCh wJvkZ14LiCmXa7K/ZGdgP1HdfaFxxsFLCpjlzm4i6Q787+gh5c+Y+lTV0yikdvPO7qJM 09T3DEiWjK3q2m9ol1Rq4g4SbnDPwmKpn0H7OnoHKzP2j5D4ZS5VUIs0Lpwt4sLx62bi o4p86QQPkruL12gtIVaKBqLIlNLXSTwIIwa0C0Mp7YS27pTslLEZBFB1wov98PTO3h/z JWMA==; 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 af79cd13be357-7b37a83ca02si62847485a.59.2024.11.18.13.10.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 13:10:42 -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 1tD90F-0003AA-O1; Mon, 18 Nov 2024 16:09:47 -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 1tD8zR-0001va-N7; Mon, 18 Nov 2024 16:08:58 -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 1tD8zP-0005Ow-PR; Mon, 18 Nov 2024 16:08:57 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id B6D99A560F; 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 504EC173628; Tue, 19 Nov 2024 00:08:35 +0300 (MSK) Received: (nullmailer pid 2366121 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, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-9.0.4 66/71] tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc() Date: Tue, 19 Nov 2024 00:08:23 +0300 Message-Id: <20241118210834.2366046-9-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: Peter Maydell In simd_desc() we create a SIMD descriptor from various pieces including an arbitrary data value from the caller. We try to sanitize these to make sure everything will fit: the 'data' value needs to fit in the SIMD_DATA_BITS (== 22) sized field. However we do that sanitizing with: tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS)); This works for the case where the data is supposed to be considered as a signed integer (which can then be returned via simd_data()). However, some callers want to treat the data value as unsigned. Specifically, for the Arm SVE operations, make_svemte_desc() assembles a data value as a collection of fields, and it needs to use all 22 bits. Currently if MTE is enabled then its MTEDESC SIZEM1 field may have the most significant bit set, and then it will trip this assertion. Loosen the assertion so that we only check that the data value will fit into the field in some way, either as a signed or as an unsigned value. This means we will fail to detect some kinds of bug in the callers, but we won't spuriously assert for intentional use of the data field as unsigned. Cc: qemu-stable@nongnu.org Fixes: db432672dc50e ("tcg: Add generic vector expanders") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2601 Signed-off-by: Peter Maydell Message-ID: <20241115172515.1229393-1-peter.maydell@linaro.org> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson (cherry picked from commit 8377e3fb854d126ba10e61cb6b60885af8443ad4) Signed-off-by: Michael Tokarev diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 566fd6eef7..8117e4fb39 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -88,7 +88,20 @@ uint32_t simd_desc(uint32_t oprsz, uint32_t maxsz, int32_t data) uint32_t desc = 0; check_size_align(oprsz, maxsz, 0); - tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS)); + + /* + * We want to check that 'data' will fit into SIMD_DATA_BITS. + * However, some callers want to treat the data as a signed + * value (which they can later get back with simd_data()) + * and some want to treat it as an unsigned value. + * So here we assert only that the data will fit into the + * field in at least one way. This means that some invalid + * values from the caller will not be detected, e.g. if the + * caller wants to handle the value as a signed integer but + * incorrectly passes us 1 << (SIMD_DATA_BITS - 1). + */ + tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS) || + data == extract32(data, 0, SIMD_DATA_BITS)); oprsz = (oprsz / 8) - 1; maxsz = (maxsz / 8) - 1; From patchwork Mon Nov 18 21:08:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844129 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp839071wrx; Mon, 18 Nov 2024 13:11:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVkTms1o06ghQQ8lYXw/XDt9pXpqlZXcXy+7TQP0TybdtcXAEYx6HZVzHK3J62maf6BcQ2mtw==@linaro.org X-Google-Smtp-Source: AGHT+IHtuP6x9KfQ+4gv0QOd5bqgtE0bs6jZ3AR6DTRDxSr9uTFP9ANL5VZNrZi+60oDmkY9mOCw X-Received: by 2002:a05:622a:22a3:b0:463:59f2:1835 with SMTP id d75a77b69052e-46363ec8b91mr198533581cf.54.1731964295001; Mon, 18 Nov 2024 13:11:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731964294; cv=none; d=google.com; s=arc-20240605; b=HKj16SaC3E74MxVzzKttsagK93uXGXF7vBi2vAtSo56jiYpAQ2ZskbOWaobHm+N0E/ Ocjn2UaYGZZhI6nxP6hMZ0FqXEm23Hu8Z7rbXiPScOMVLH9gqO9VNCPS9cOTYRs9ny5b LnRWrZ7ViZJii0RhQVsttZwCnryr8h9VQ6GRcHxXtgJApAsd3MMW7oOMDo9udzagwHzz PszXZ93VFCTCXKDG2ssioSjPBW0QATsElzf7ayrpY9bHK4E4HTbja5iA3N6Gx/6sULNu y4OA3ozFvCWmfNMiC9S0JX2gfXY5XVDF5t7z9HRgbliI+gNvd4HlY8D4MDdXXQwzQR6K ejmQ== 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=PuBVO93AEuyE7XllskxYUzp40s5BcEb0mMM2BFe9d1E=; fh=bJM08QyuQI9qNgdwAnWtM8YuXTWExZXcb9tnmXCkn/A=; b=ah8A8hxuUVIozlQoh1HlpvP89YHQYQu0dvVWTxZ8LcuuejDoN4ja33x5JBl0WDKjnX feoObtgHdT+WbwCxGMN9HUknePkVT4LzJ5IgWi2jjPBcTy7K2XVnMMav3rk9ZsSFsBKE gM7LCYW4/qhKzAxDPKWs4nNPkEKBQOS9fojPqOtsqvp5JfD+thvSFe16qVtiCxtdo5G5 T8P8UORmRY9+d7sQcreYMM+rH6UWCoqJwImZbOW0vzYhwYluI3MlnXcGfHnmBBFvMTLF mUhTM4kptEg6H7mV3VbWjadXd/w2rJBljnZlp9PQE6bFYm1ZBcUs2CrnVVMKMIVep49r YIpg==; 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-46392c429e5si5212141cf.421.2024.11.18.13.11.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 13:11:34 -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-00033y-97; 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 1tD8zT-0001w0-Ao; Mon, 18 Nov 2024 16:08:59 -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 1tD8zR-0005PS-Cz; Mon, 18 Nov 2024 16:08:58 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id C44B7A5610; 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 5D939173629; Tue, 19 Nov 2024 00:08:35 +0300 (MSK) Received: (nullmailer pid 2366125 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, Pierrick Bouvier , Richard Henderson , Michael Tokarev Subject: [Stable-9.0.4 67/71] target/i386: fix hang when using slow path for ptw_setl Date: Tue, 19 Nov 2024 00:08:24 +0300 Message-Id: <20241118210834.2366046-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: Pierrick Bouvier When instrumenting memory accesses for plugin, we force memory accesses to use the slow path for mmu [1]. This create a situation where we end up calling ptw_setl_slow. This was fixed recently in [2] but the issue still could appear out of plugins use case. Since this function gets called during a cpu_exec, start_exclusive then hangs. This exclusive section was introduced initially for security reasons [3]. I suspect this code path was never triggered, because ptw_setl_slow would always be called transitively from cpu_exec, resulting in a hang. [1] https://gitlab.com/qemu-project/qemu/-/commit/6d03226b42247b68ab2f0b3663e0f624335a4055 [2] https://gitlab.com/qemu-project/qemu/-/commit/115ade42d50144c15b74368d32dc734ea277d853 [2] https://gitlab.com/qemu-project/qemu/-/commit/88442869cf709f885a9c09fad00b96f802d58ffe in 9.0.x series [3] https://gitlab.com/qemu-project/qemu/-/issues/279 Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2566 Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-ID: <20241025175857.2554252-2-pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson (cherry picked from commit 7ba055b49b74c4d2f4a338c5198485bdff373fb1) Signed-off-by: Michael Tokarev (Mjt: mention [2] in 9.0.x series) diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c index bdf7b0df42..44b1b2ded6 100644 --- a/target/i386/tcg/sysemu/excp_helper.c +++ b/target/i386/tcg/sysemu/excp_helper.c @@ -106,6 +106,10 @@ static bool ptw_setl_slow(const PTETranslate *in, uint32_t old, uint32_t new) { uint32_t cmp; + CPUState *cpu = env_cpu(in->env); + /* We are in cpu_exec, and start_exclusive can't be called directly.*/ + g_assert(cpu->running); + cpu_exec_end(cpu); /* Does x86 really perform a rmw cycle on mmio for ptw? */ start_exclusive(); cmp = cpu_ldl_mmuidx_ra(in->env, in->gaddr, in->ptw_idx, 0); @@ -113,6 +117,7 @@ static bool ptw_setl_slow(const PTETranslate *in, uint32_t old, uint32_t new) cpu_stl_mmuidx_ra(in->env, in->gaddr, new, in->ptw_idx, 0); } end_exclusive(); + cpu_exec_start(cpu); return cmp == old; } 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 };