From patchwork Fri Mar 29 22:20:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784084 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3426534wrt; Fri, 29 Mar 2024 15:22:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVxuFUjASAi/mz9kKxCvuhNg42MhMQQc3/yjt+0KbU54wunxZrz7e6tt+yuksThKZfNIc+F1u6dTl3loMBs/PKw X-Google-Smtp-Source: AGHT+IHcLuvghkslAvZizF2LJIGU/u35qKay1ZwkYUKCBMLl5cqQaSizFtPcK24E9todyUuKPh2W X-Received: by 2002:a05:620a:191f:b0:78a:6e80:ee33 with SMTP id bj31-20020a05620a191f00b0078a6e80ee33mr10303266qkb.15.1711750925469; Fri, 29 Mar 2024 15:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711750925; cv=none; d=google.com; s=arc-20160816; b=BLLFKnx1bFeVMMJX5g7ZuatadJ5rrgA37eqszU84RCNB+skp67A0lXTWjxj/hbRD8X A5vKuQUUa5mKgJGexTgy7CcV2kaMPwW9czh3C7w2h4DPxPeG131ds1NRpZHNVz2R2cfu GIE0dvXzd0nTQG0bCXe9Oy3I/VVOtzIGX+lHI50++2dyifeOZQuYDXyWOsWgfB0V/Ihj +bBtXPt80Sa9LC4B+9vDia9tuKA/2F6UdPVb7HVdnNjwUVcSvTEx8hsftR5dcvXrHqV9 CacW8wazjo4Y7crFFXvNPR0CUFqsO8QcI1yJzd0UK7RBwsMcWLOjp0lAb6Yqhs1//yMH 40GA== 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=qF+Rh4Z//XloQGlanOoCz61ZgUvkOnM9tqWX1k+rwd4=; fh=o2XzhdKG+B45MJCghEfnYoypmHvLX2hd4SL6yXeiyXI=; b=IF3W7AMI7mOgD3y8MIpBA1f29vtxNkKAbLHYfPB/klkD8znnHRnZkVZ31rm1u3aFSc rOR1uWeHQr1Px/RMxZkBt5OxtAsJzM8/DR4LCm38D71V7t5Yqy/OPu71aTGbggLioLb1 EM/AnlvXUfDnkc/7WZOxVa5niOmlkYWZWOCatPn4ECgoAAb16hZ+IS87KUN79GbOWgfE uL09iBAxymhQDkzDLU+oea8kAtCC8U8gOnIc6XEJQW1yToy9q7h9nUePdHO/CXy4MAEp No88q96GVYNHXJU5BSiQuhk49gOq5sCz+3ydRH0J9g+5dM0FPpk4ROi5EoJh8vgbcCO5 ZBEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xz7eHbhU; 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 dt7-20020a05620a478700b00789e9180877si4564820qkb.721.2024.03.29.15.22.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:22:05 -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=Xz7eHbhU; 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 1rqKad-00055T-Pf; Fri, 29 Mar 2024 18:20:47 -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 1rqKab-00054x-Qh for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:45 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKaa-0001ou-7L for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:45 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6e6ee9e3cffso1660052b3a.1 for ; Fri, 29 Mar 2024 15:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711750842; x=1712355642; 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=qF+Rh4Z//XloQGlanOoCz61ZgUvkOnM9tqWX1k+rwd4=; b=Xz7eHbhUkCd9TyXkGaZ+qKhgXg9FwIw29oA9BIPtTuV+Q9oIZ5/wsCdwt0DEN2avJS v4F3xqvcKqJs8oISaYN9lUfHFyQlIwIh2lBCF6fa0TTLDxrMmQfivQyG++cLbdPJPyyY 5xuUkRk1jKTUjdrdAHmcFiwX3/DZUY1jKP5dPvzpwjqkWVgoWEFp3Xkqdd24ffFQgX9j XOY6O/OTAvh8AKZ0CAsdLiX9rxNI43gffYEpbmPvfyXFvQU3RYfisNSR4YpsyfdyWvuq zI5qFYIMtrn0+Yi6YaiKXYY6iE0Q0sIs9hqXqbAlli7TS/TWI8gOf9nwO++0OGlsp2AE DYZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711750842; x=1712355642; 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=qF+Rh4Z//XloQGlanOoCz61ZgUvkOnM9tqWX1k+rwd4=; b=OwT1nGCzT25Bs1bxPZ0MCPylINSPaxiLJlB8A5W1Sjw836b1jkh/CDVdztQ3dcjFi5 i/fdilNGSw7aBRIjV5NHey8NzBkxNjFqP9PsMSiZOo/YTjl64rSEWDnDIZnTVlcGPAlO u1BWxMSdYgHtevAMXmJXv/p30u4Js2kgdeRcPZigI3UNi6fK90dsD47gYO/1lMGhUgg7 PwET+dpaCYaGRR0vKWr7PQjB/pBdExujDiil+vxlSHhHkNR92/46ec4ThvU9X9Tjr51F esz7sEOcRsqKYDFys9COsdHq+pl6jlmKEXM2RelG5KevRmdb2LcPEbS8Nmsz8MibKet/ JaYA== X-Gm-Message-State: AOJu0YxFcSAY05H6fUGCea9fZ7tjuGvEqzEmJokIhn2uWSKdzH/r4Idu JR/Ji2Qm/bMAmts7uib6FX89QoKkJWaubc20KZl+lBmgtgEgi95eblctehdLvzAjqEOzAQ3Jhk8 N X-Received: by 2002:a05:6a00:2e22:b0:6e6:fb9a:fb45 with SMTP id fc34-20020a056a002e2200b006e6fb9afb45mr5145614pfb.1.1711750842349; Fri, 29 Mar 2024 15:20:42 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id lc24-20020a056a004f5800b006eaacc63435sm3579811pfb.173.2024.03.29.15.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:20:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 1/7] linux-user: Fix semctl() strace Date: Fri, 29 Mar 2024 12:20:31 -1000 Message-Id: <20240329222037.1735350-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329222037.1735350-1-richard.henderson@linaro.org> References: <20240329222037.1735350-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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: Ilya Leoshkevich The indices of arguments used with semctl() are all off-by-1, because arg1 is the ipc() command. Fix them. While at it, reuse print_semctl(). New output (for a small test program): 3540333 semctl(999,888,SEM_INFO,0x00007fe5051ee9a0) = -1 errno=14 (Bad address) Fixes: 7ccfb2eb5f9d ("Fix warnings that would be caused by gcc flag -Wwrite-strings") Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-Id: <20240325192436.561154-2-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- linux-user/strace.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 8d13e55a5b..51a5bdd95f 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -657,7 +657,6 @@ print_newselect(CPUArchState *cpu_env, const struct syscallname *name, } #endif -#ifdef TARGET_NR_semctl static void print_semctl(CPUArchState *cpu_env, const struct syscallname *name, abi_long arg1, abi_long arg2, abi_long arg3, @@ -668,7 +667,6 @@ print_semctl(CPUArchState *cpu_env, const struct syscallname *name, print_ipc_cmd(arg3); qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4); } -#endif static void print_shmat(CPUArchState *cpu_env, const struct syscallname *name, @@ -698,10 +696,8 @@ print_ipc(CPUArchState *cpu_env, const struct syscallname *name, { switch(arg1) { case IPCOP_semctl: - qemu_log("semctl(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",", - arg1, arg2); - print_ipc_cmd(arg3); - qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4); + print_semctl(cpu_env, &(const struct syscallname){ .name = "semctl" }, + arg2, arg3, arg4, arg5, 0, 0); break; case IPCOP_shmat: print_shmat(cpu_env, &(const struct syscallname){ .name = "shmat" }, From patchwork Fri Mar 29 22:20:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784083 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3426501wrt; Fri, 29 Mar 2024 15:21:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVXZ1wfrAdtdBVv9cKcvsDk2a8IpS0u/SSD5IHCo49iBnoqvVWdBkobvJvcGVmVMw5jTdTPPQDxPftfsWi9yuRF X-Google-Smtp-Source: AGHT+IFqMnXLr+R9YEcxc7fDLd9hMApojZcNXiBiOXnKwVvWpl4TuWDBtkYCxvBADJNkw4q9i/eH X-Received: by 2002:a81:5257:0:b0:60a:c653:4134 with SMTP id g84-20020a815257000000b0060ac6534134mr3707325ywb.9.1711750917016; Fri, 29 Mar 2024 15:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711750916; cv=none; d=google.com; s=arc-20160816; b=ZCbRRjIG6iGE0jFilrmeUiiW6qhd8LjIDzzR4ao8XoqrOi/LzT8Ea/RmrxLLZfJR8F D80L20XuM8+w2u62Tltpsu+KVTIlQRFVwP/FZeRKoOVrLukDQszOExo4r5P4tSPLksZw UHSlNqzm1nlxcRH0s0ypGf0sa/wFOYrqqIJ2e0pk4vb4QZdClD/y7BEZLs1LxL3K1uq6 aedbQy7Ua1uYTRAPRWFIPruFNHxUnYeo8/j2q5Ek4ygnQbVxIPWyBMkdL7bwy8L1tRxL mRpr2jhALEbKbP/Pi6ODu2YJiIqUN1WMJwqXB9Eg1IeIsO0pwFxfgWf+15cXsR9ogpLy /mKw== 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=vLgHs0lHF4uZkMVrK5zDEoSHxG5H5AOQOiZmQyJc1i4=; fh=o2XzhdKG+B45MJCghEfnYoypmHvLX2hd4SL6yXeiyXI=; b=MgfqzsXEYqURj0OyTLAIbS/E3/WjNfIz5EtqnFMgkjGvY9waKSLrr8F1wMTxX30wR9 +klwixI8VCEPImWHtfpJ1wYtwBzwV4puozhVNzGwmjWb4AmwlAcNYo2NKsO4Wmj+aQ+7 E5CBDod5OVVKU+AUGLn2joJEucSaA3RCMLWZ2peCGwKZBOAviwFnBkNOVoVaFQIOMx8J fXXO4GEIZzl0ATK39VvPStI+sjMfO8IFyUDDWHch72rEHwj/FKscoR/un5VH1ICmsY1s oG6q4Z1S2bI15xZkzZN6NLJQjb5w33zDto+7UTAlXT9a+qS3TAevTUYTc5H86I6UtO0g z43w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L3rbRcnR; 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 d9-20020a05620a136900b0078a53254b31si4613370qkl.53.2024.03.29.15.21.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:21:56 -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=L3rbRcnR; 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 1rqKae-00055e-Cn; Fri, 29 Mar 2024 18:20:48 -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 1rqKac-000555-Hl for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:46 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKab-0001oz-41 for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:46 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6eaf1005fcaso340711b3a.3 for ; Fri, 29 Mar 2024 15:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711750844; x=1712355644; 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=vLgHs0lHF4uZkMVrK5zDEoSHxG5H5AOQOiZmQyJc1i4=; b=L3rbRcnRU37YopaavvC0LPVDLo74+HkRRKxSgjIyIzxLkJETfQJeqDukH+Xu+cTf2F p5HtKh3bCO7qRyMkJMHzbUmMdD8gBYMGfB6UkU4OWYgdKnuzCty4Fd7IsB6PQOVB8aYt CgDNQ2aOg1jfl0CsQUkhBA+Uh4nmOL2vN2Z4JGO75V8cc8WGfC3Baaw/eyDfJ0YxksgE +Fskm1H6/tqSj6mamxDqDZ6LuvxNgreNbNMyhmW9wGVMWfFvgGGZwp5Hd6vpcB8ctI8V qqY4aMN511OPDw2wjJKMdPvw74dV4ztuW0cWm6bXtsAlYCodR6GwCiIyHdOZWStCJQN+ 0a5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711750844; x=1712355644; 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=vLgHs0lHF4uZkMVrK5zDEoSHxG5H5AOQOiZmQyJc1i4=; b=f8zDPMg8WVYdh1waAvDRZU5fF8Bq09hyIjFGXmrNui5JcTQ0FyEJrnx9eI/OaJhc4N Z0lEOYIOPURUDa8IdMrra9TfHIzwh7Lxon9vrI1kJ0BaZ/COkFfhR4G3kHRb+u3OPBZz nyeBAelAXtelyRd4h7rY9PHegsiqtMEMPjw2tzPuWSJFQblS95uomChB6zYFTB2qaAEo ePIqPmcyXIX/o6EzHnYCnIoIcTmaGv/gHZSzwxcS7hFfM751BW2VEiOTcUZcgzGh7TAv 6/ra5uPJLn2fsUOa0Y9DmK/O9J7gAJ/aQ3GSZCdaghpdwxu+P+wvVE6wGL+z1eMrUMCb tQlA== X-Gm-Message-State: AOJu0YwNZJgQ5A14VLE3fGP+ytzyfnJe5oxB/7qC+xnE2snIn0UAksnd mNXKxmwuG9zzRIE+Q0FPFJJ6p36zmVmI3sPgUasR9oWeoy4LECdicbsTyU15uCA1ydPlWu9K/0k f X-Received: by 2002:a05:6a20:ae86:b0:1a3:dc19:e5a0 with SMTP id do6-20020a056a20ae8600b001a3dc19e5a0mr2851946pzb.41.1711750843638; Fri, 29 Mar 2024 15:20:43 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id lc24-20020a056a004f5800b006eaacc63435sm3579811pfb.173.2024.03.29.15.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:20:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 2/7] linux-user: Fix shmat() strace Date: Fri, 29 Mar 2024 12:20:32 -1000 Message-Id: <20240329222037.1735350-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329222037.1735350-1-richard.henderson@linaro.org> References: <20240329222037.1735350-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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: Ilya Leoshkevich The indices of arguments passed to print_shmat() are all off-by-1, because arg1 is the ipc() command. Fix them. New output for linux-shmat-maps test: 3501769 shmat(4784214,0x0000000000800000,SHM_RND) = 0 Fixes: 9f7c97324c27 ("linux-user: Add strace for shmat") Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-Id: <20240325192436.561154-3-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- linux-user/strace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 51a5bdd95f..b4d1098170 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -701,7 +701,7 @@ print_ipc(CPUArchState *cpu_env, const struct syscallname *name, break; case IPCOP_shmat: print_shmat(cpu_env, &(const struct syscallname){ .name = "shmat" }, - arg1, arg4, arg2, 0, 0, 0); + arg2, arg5, arg3, 0, 0, 0); break; default: qemu_log(("%s(" From patchwork Fri Mar 29 22:20:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784086 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3426548wrt; Fri, 29 Mar 2024 15:22:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU+0WDZkoH3tY750oapD4NSeUs8NS8QJni9y+YxBDXK6YCL0sPFRgtMSwfJrFnM548hvsA5pmB/psM7oJwo4NFN X-Google-Smtp-Source: AGHT+IFrO7gKnAQVvS4WPqNArLrL2vlDqhgk8mhhv+4NMFohhiREZUNXhtcLw4x38bohECn6gJWB X-Received: by 2002:a05:6214:16a:b0:696:ad33:cc01 with SMTP id y10-20020a056214016a00b00696ad33cc01mr3603476qvs.22.1711750929396; Fri, 29 Mar 2024 15:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711750929; cv=none; d=google.com; s=arc-20160816; b=V+q9Rp9xcvF24VmjJe/7006OBZZ3QHHQu8hibuthvFGj71oy/weuBxEtuUhTFqvWPr UwTLQB3alNvzN3iSN621M8Z/lMmWN4mbMHV4Ok5GH6l9yD3YE0voxhULwl7E3+N1I73I zqZacPCIK/yYUqOcWDIesdudz85GHw2WvxQ6mL1D7mc+QcKt7fgIrM6XGey57zU7p4y6 dhhc+FJgy9+Z6FMymgNcQ3+GI5+zRxjXW2axzSq5BuVzUMVh7YLHo8MP9j1eydwcTf4D 24OK/hPxDCqkK5YA/+0ClU5mXA78W87ruutJEsXQ3rxkbbuN0MxDAmNnRckSFFIfUQAy z4nA== 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=HtUHg09UOjxxYBJJEpdXT1anxY6jjxQxzEq5yXQbAXE=; fh=o2XzhdKG+B45MJCghEfnYoypmHvLX2hd4SL6yXeiyXI=; b=tA3ZsCaDYzu8YyTYtqVBOZ64Z9rCTeX6BYcfVNRdkeBYNZMxxVGZiOzelFM1bEfAc1 xsA1lRGJElS8t/0kjotsNnKsjn8r9aN1deDxOyUlxdB5T1xsipsRW/rDiRPOIo/KUSzE xGix7XigO52HbADGMyJMWnUtrY6QACe+OPirlmvxfW8fKKaxKa6K6AxvQPR59R6NZ9DG RH4tKCKgxYrPpnS54ABCfb7iEw4qBF3BtwTj5DWeeSXUDc62HJsvXCGwl1eljMLUFEKp LvgYbAC3KwYpuCMB4hlQsFy3UY78MBH4qWgaiJvPEDL6TB7vxLaAFIPFhv0bPqHEptEE p+rw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yBJGaOdr; 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 jy19-20020a0562142b5300b00696b17e2c70si4524777qvb.218.2024.03.29.15.22.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:22:09 -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=yBJGaOdr; 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 1rqKae-00055n-Ss; Fri, 29 Mar 2024 18:20:48 -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 1rqKad-00055U-PG for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:47 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKac-0001p9-9T for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:47 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6e74bd85f26so2032981b3a.1 for ; Fri, 29 Mar 2024 15:20:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711750845; x=1712355645; 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=HtUHg09UOjxxYBJJEpdXT1anxY6jjxQxzEq5yXQbAXE=; b=yBJGaOdrjxNQNBorSTQqmPpBX4T4sd3LXvM2cI1rJX+8fCHqOMYiRWupAHDFL1+lJB vYukkFzzMz/qP2Ht9Rn6HF0LD1zg29tyoNxlVmyk27bQgAbV7w116SyLpiCs4qICIkru a//h8CKsi+/oZRk/6JKFTw7LSrqnN2PvvFXRBGSG+ibN6YVr5yyqVpDDQ3Z9Km6i0Esr zsnvevkFBoRegLZV2qOFw16vgIsTBHhKajHR7AjrT4J9SWXhPitXDU6bmxc9fJ8pfxIF 2Ph2e/9RCeSBSaWIr9drZo06fv15xcXn6/F9N0pg8bTGXRxnp6lOvSQX22+QwtHWPWPF feyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711750845; x=1712355645; 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=HtUHg09UOjxxYBJJEpdXT1anxY6jjxQxzEq5yXQbAXE=; b=uy+aVsv8+5hMTe6B3KLjT5T1xAp7D4W8XNxY2E3sCf57xjTngGI9QUroVDv/lLIo3P smL7uxHtYh+ucJb1Qb9npY8vaWOp8ops/ImqaYz2THsdX+bGdMo1XNzHiPXspWGwhT+Q vmDiZ0G1uy0ecRx5IGTxzUQfBZy5TURWSHd+l5iQlRoqnxxfQn9azIuPNnuJSkHvjC6c TJ1/ZXgXEzcazpPENqL4/PBiGPKAbHpLlxnfuGznJ5+HCO+CbqkbLXqzyTQr88HBaYqb 5GnSPHcmfjlhIvdVPjelu4zZ7MT4hnB6YP3BdLMNGHCKzMOMktDAWfVblthkIWX9o9oB XLMA== X-Gm-Message-State: AOJu0YxAI7oilD/G6bru9aP7lD3sfvM0LdL3dClBVRBKr6lfVM7Amd5v PmTDnwRj7I0Bz/i3V+EbA+2uIqEtOMpM9qnJLp5TWOMXTnRTDnr8dYUOhRBvwoL2RHvEuIXI4co o X-Received: by 2002:a05:6a00:1910:b0:6ea:ca90:3459 with SMTP id y16-20020a056a00191000b006eaca903459mr3588812pfi.32.1711750844955; Fri, 29 Mar 2024 15:20:44 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id lc24-20020a056a004f5800b006eaacc63435sm3579811pfb.173.2024.03.29.15.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:20:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 3/7] linux-user: Fix shmat(NULL) for h != g Date: Fri, 29 Mar 2024 12:20:33 -1000 Message-Id: <20240329222037.1735350-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329222037.1735350-1-richard.henderson@linaro.org> References: <20240329222037.1735350-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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: Ilya Leoshkevich In the h != g && shmaddr == NULL && !reserved_va case, target_shmat() incorrectly mmap()s the initial anonymous range with MAP_FIXED_NOREPLACE, even though the earlier mmap_find_vma() has already reserved the respective address range. Fix by using MAP_FIXED when "mapped", which is set after mmap_find_vma(), is true. Fixes: 78bc8ed9a8f0 ("linux-user: Rewrite target_shmat") Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-Id: <20240325192436.561154-4-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- linux-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 4505fd7376..be3b9a68eb 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -1354,7 +1354,7 @@ abi_ulong target_shmat(CPUArchState *cpu_env, int shmid, if (h_len != t_len) { int mmap_p = PROT_READ | (shmflg & SHM_RDONLY ? 0 : PROT_WRITE); int mmap_f = MAP_PRIVATE | MAP_ANONYMOUS - | (reserved_va || (shmflg & SHM_REMAP) + | (reserved_va || mapped || (shmflg & SHM_REMAP) ? MAP_FIXED : MAP_FIXED_NOREPLACE); test = mmap(want, m_len, mmap_p, mmap_f, -1, 0); From patchwork Fri Mar 29 22:20:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784082 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3426474wrt; Fri, 29 Mar 2024 15:21:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUaUhrN5XwtLJzA/3/meJrzdAnGFN4AN0uv954OWm08SGQXoY/rfrreQl+n2kbr/TCY6UckalHcpkLdk+8GTtxt X-Google-Smtp-Source: AGHT+IEwNIIJaATuf5fWpoW+GHfFOAZFtDm9Hjm0QTa8IZ2Yu1blR3uHIOnVKl60CAkkoICvzn0Z X-Received: by 2002:ae9:e706:0:b0:78b:c23e:b241 with SMTP id m6-20020ae9e706000000b0078bc23eb241mr3749374qka.50.1711750912093; Fri, 29 Mar 2024 15:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711750912; cv=none; d=google.com; s=arc-20160816; b=SSBTOzu1S7SrZeBLJaFdVK5nYcAC5lMt0d/8lzk1Qr7XyvwR/lAqPyad14pyWJ95wq jMuJ9Bi3DYv61SvQBXJTKdOiFPvGW7i+3NUeveClrur6cY7NW7zzXQprxDCwdtsB4D8O y5N2i1s8sbM4dEVn8+5IjhXp9bUuix66V7nNQh5ox+2A6oH7nkTcHZSEdLJDZap5QQv0 VRXd2t3kVrxJwx6t/VbTsVnElA/GWrcOaZ9+6gmnCBpCoHmXaFBaq4RlMTKWOfRyKPV6 Kmc6Q7kvCcv6yfN734gXTJJc4Z8IgkBkRZCjZb+CAuKi434LWScQGtNqy5RBILxCez33 SmNA== 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=mqnAymu0Pceh1YCimgMze24poYMrVWuaKl+QjHlACqk=; fh=o2XzhdKG+B45MJCghEfnYoypmHvLX2hd4SL6yXeiyXI=; b=NS4U9U88Ng1my/BHrf/5fnOHfKUgUSS5XUDMJ1D2LmMNQLdnnQbSKLfnpO0VHJz1nT FUT/B8nYT2Dmwewx8Dm4daTCt/EoMbbJ0BCX1SGYAFlMobRVDJDD5CWHa/yKIRWrfU+q nru8qESmJPAF38DzeNTmeBZ3Hydw7Y7REXaG/QHCRMzal79OpSZgrpywLW034Yk/XKA3 SiOLrML0NxeI/ByoYzZTzEmoVJL+3U6fqdD35/L0SCEkJRinwyTHHbbFg1vcDFiGbB8Z sdyMdElONW6/bvQQgq40mliyb3IqW8Wn74klw8a7abVLMYkYb3ogOn/9ALSXgVduLCAB a4lg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c7dTs2Jw; 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 c11-20020a05620a164b00b00789d99cc609si4549852qko.549.2024.03.29.15.21.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:21:52 -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=c7dTs2Jw; 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 1rqKag-00056k-LG; Fri, 29 Mar 2024 18:20:50 -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 1rqKaf-00056J-IG for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:49 -0400 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKae-0001pR-0Y for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:49 -0400 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-229b7ada9e8so980647fac.0 for ; Fri, 29 Mar 2024 15:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711750846; x=1712355646; 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=mqnAymu0Pceh1YCimgMze24poYMrVWuaKl+QjHlACqk=; b=c7dTs2JwE0gy2Q8yHxazYc7sPPaBgrCh2EDRtBJdHAwRz3zTnOi0N6yUzE3g8N4bm7 TBJE6tryTOBnknZyYihdFhq5k454FUefOst9YxtBQ991Q1yQaTT/x5vCr6j2esiFswo1 DAysLqzti4QsxFgewjO7m1lhGXubFHBU6+z/r0FOHV6y+CNNQyaEeWF+PCEBhVqRSjQ7 UJf6bnC2NArSZUJt+k5RBZZal6D0rY2s2zNdi9gViBc2xgGOX/0c7OydCfOFw3ZQDFSc Uw7cKspc6L/A3XWEsVukN6EkVNLXrjIcZxnLxAhwgZK2y4aqXGvf83M1lgWKyXwkDrtj yfxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711750846; x=1712355646; 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=mqnAymu0Pceh1YCimgMze24poYMrVWuaKl+QjHlACqk=; b=Is5hau9MXInH+WK40584xk9QpbV6y3/E5cGEsZv8g1NjJXGGVMUkJlH0+8d9T/Gudl fDzw81Xh2flTCprDVAFcAGdQG5ETYUQst/qrFLGoEEFdHkSNTv5vjVWrRfU0RTVbTMoK BwW6H2TsmJp8ylDwXD1AAVkfHr0XmRYFFVs8nCydcTjiCfIJlQ3Z0raCo8rCxcNhGokO 2LLrwQ4kqTGWyKhhhpDYUxCXT4t6/xLz4ddBBz4ia/MmJ3dt4BTKTDOggrTrVcewqB+s wbZ1XnZo/9/xUVxgt+uRPDF4m3NsH97j3xsS9RGBHT+OLbJ9ptQaGkn8aniGkElCDqBz Xkeg== X-Gm-Message-State: AOJu0YzV/+i2nck+OS1Q+FmIDHMfH/jaStrCirfCHFuGqbac4wCGs8UZ sl9lwBHPfKdN5dK71edNTC5RV8ljwoXo8l2D9PPXIJiZqpQuyl4fWoZTBtRkLLJXFAabl0bQSSV G X-Received: by 2002:a05:6871:340c:b0:22a:551c:3170 with SMTP id nh12-20020a056871340c00b0022a551c3170mr3672097oac.23.1711750846598; Fri, 29 Mar 2024 15:20:46 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id lc24-20020a056a004f5800b006eaacc63435sm3579811pfb.173.2024.03.29.15.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:20:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 4/7] tests/tcg: Test shmat(NULL) Date: Fri, 29 Mar 2024 12:20:34 -1000 Message-Id: <20240329222037.1735350-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329222037.1735350-1-richard.henderson@linaro.org> References: <20240329222037.1735350-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::30; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x30.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: Ilya Leoshkevich Add a small test to prevent regressions. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-Id: <20240325192436.561154-5-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- tests/tcg/multiarch/linux/linux-shmat-null.c | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/tcg/multiarch/linux/linux-shmat-null.c diff --git a/tests/tcg/multiarch/linux/linux-shmat-null.c b/tests/tcg/multiarch/linux/linux-shmat-null.c new file mode 100644 index 0000000000..94eaaec371 --- /dev/null +++ b/tests/tcg/multiarch/linux/linux-shmat-null.c @@ -0,0 +1,38 @@ +/* + * Test shmat(NULL). + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include +#include +#include + +int main(void) +{ + int shmid; + char *p; + int err; + + /* Create, attach and intialize shared memory. */ + shmid = shmget(IPC_PRIVATE, 1, IPC_CREAT | 0600); + assert(shmid != -1); + p = shmat(shmid, NULL, 0); + assert(p != (void *)-1); + *p = 42; + + /* Reattach, check that the value is still there. */ + err = shmdt(p); + assert(err == 0); + p = shmat(shmid, NULL, 0); + assert(p != (void *)-1); + assert(*p == 42); + + /* Detach. */ + err = shmdt(p); + assert(err == 0); + err = shmctl(shmid, IPC_RMID, NULL); + assert(err == 0); + + return EXIT_SUCCESS; +} From patchwork Fri Mar 29 22:20:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784080 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3426469wrt; Fri, 29 Mar 2024 15:21:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWxT1eXd8CsH8FhQbPETVtfzDnGqKrTxB8KJ/tJfL3Uipr23RnQ9oLs7QopGZRz4gFrvxOIN2RVwb7LrXVmdmjm X-Google-Smtp-Source: AGHT+IGZPqjXKYP4ETIhKmgBI/mJc6FGDd/vsqIAEQm20qK1ihJHAjh8uczx2pXI75CLNm8d37hw X-Received: by 2002:a05:622a:1187:b0:432:cf93:d369 with SMTP id m7-20020a05622a118700b00432cf93d369mr155880qtk.2.1711750911269; Fri, 29 Mar 2024 15:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711750911; cv=none; d=google.com; s=arc-20160816; b=FAIgXRV1qVBxzZUbHyBMjl4LWvmG5URDaI4MP4aISPBJ5Ma4L4ZgcyyN8fq6HbCmQQ kTYzex+6Llf7b/B/K5Qfh5NMDia33W7AMq7zfeCyk2zhSDRRnMSbbGJFOpfb6rWy8eLB eGKE9fTuNud3BNXGqDvsoFJcOFUY2VK8Rkm3H5wPGTD8KyCFEJrAv9EtCWoCfmMhhU/P lShDtFzIDTVxNwUVlcBtUorxwsOjXZFQZRUWp966sb8/qt2esrmnYiuQ5/HkjH1soFtO R2apAiEgiVSpB1XYuYmmUBQBzBsEv+VulgNtsD5Q0BWWGv02k1JQ4k44b7eU4Fyix5fT /L3A== 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=3dondGlVn7Nspk+b15ZO4C68ipaZNt0/1iWHRvOdtfQ=; fh=aYwv1qvAWDHKcZLZyhvLuIoAkBRd6ysYy/Itgr1WhFg=; b=ELk2oPYfLKsvVf78I2Sz2A97dOJ9RvQ0yem6+HjeuG0ynhPHHTsFMuUrdQOLtVyJkO woxDB9ik4S33P/fyvAlDEIN3H9x/N8ECn4oaJX2MDSeBrHa9iqedRRQeipoavicBg7ef YQAU426Yr/iZtb9TcVnsexAYvMblanBriNJsPrEBhtchNrKvrIqzX/QT/MLnoOyfsWB5 dQyl7qR9XO+2IaNN356zagXELlBQRM1AKR3n+60lTes3/5lXcamEYcwfuiX8LZ1jPvyl eW6d9IJ2t1bbnz6zlgz230+ghF0WIy1WvYStnxIenBG4JFLX7KgkNIm3MGPHktmLVosA icQw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OI4rJQbd; 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 et14-20020a05622a4b0e00b00432c1c86992si1998885qtb.286.2024.03.29.15.21.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:21: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=OI4rJQbd; 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 1rqKai-00057e-Hj; Fri, 29 Mar 2024 18:20:52 -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 1rqKah-000578-6B for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:51 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKaf-0001pg-BU for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:50 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6e6b3dc3564so1993113b3a.2 for ; Fri, 29 Mar 2024 15:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711750848; x=1712355648; 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=3dondGlVn7Nspk+b15ZO4C68ipaZNt0/1iWHRvOdtfQ=; b=OI4rJQbdxIVAbSx4eeo2MEJTvpoQR3eUpSVzIO3au2bpnntTqCb9ra1X0iyT3ossu1 IFSQF+jXkUTUV0JdlwDLVaY6Dod/hnYZZBFJOehUccd+rbE1wDc2uc3tkcXDWBWS8Vo9 Y76TVb/cvWsX3tCpVt2GSgG7DPdp2Y+V1ofT+9r824CU/85oAu292AW5u01O5HIrCOKQ zxH7Jn5e1g+OsOR2JX7OMLv8MPeeHOksHt2EENdD3u0XhtLgyRAt7BMwcvccP7xtvLTc eyNq4p+kDUxmWTm9YITQugMmslJRWOJXd677kH7HN6QMbig8pqn0w1v5UJ56Qf6GTosY YN9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711750848; x=1712355648; 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=3dondGlVn7Nspk+b15ZO4C68ipaZNt0/1iWHRvOdtfQ=; b=csePmz6DPygQPAUHSB2NM5EFc44f6sEN8rRARGZ1iNciry6lAIHKBjdE8OKOsQ8CkM nU9YfZvScmXFnemQBpb4oCKAP+DFWZm2yrp4KaoVw77x41NgGZQvpP9951UqxybywAqw 5Gcc5aV6nNLym1uSGA9ymY5JUUCuawWF/ixSw+fu6wlo145mX0ZrUwG+VoebscQimk6T H+JtxSZ2T50iwexAb3EdWR4Qm7KqoA3Pxn/iPsjuu5pwFZ+p9FITvyUmkW/eDJ7r73GC LNBg/HFJl9l9DorGdTLX7dHngGgqLNTUV+TkaO+KgLSTaCJyvWu3jRGQV4T/pmzMzeyU wzXg== X-Gm-Message-State: AOJu0YyXWW8QDkW81xIwS3++rnf1M5V7NDYwQdlJfu8uxyg0B+KPSAuj pFcn09/z4v3cp11hUx8M/Jcmvc88SXCwR4UszIy4dhSM2EB5qB2gaYdrysfl4KqBVMeVWUcTJNw Y X-Received: by 2002:a05:6a00:4fc6:b0:6ea:ab48:5dd9 with SMTP id le6-20020a056a004fc600b006eaab485dd9mr3564600pfb.6.1711750847953; Fri, 29 Mar 2024 15:20:47 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id lc24-20020a056a004f5800b006eaacc63435sm3579811pfb.173.2024.03.29.15.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:20:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 5/7] tcg/optimize: Fix sign_mask for logical right-shift Date: Fri, 29 Mar 2024 12:20:35 -1000 Message-Id: <20240329222037.1735350-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329222037.1735350-1-richard.henderson@linaro.org> References: <20240329222037.1735350-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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=unavailable 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 The 'sign' computation is attempting to locate the sign bit that has been repeated, so that we can test if that bit is known zero. That computation can be zero if there are no known sign repetitions. Cc: qemu-stable@nongnu.org Fixes: 93a967fbb57 ("tcg/optimize: Propagate sign info for shifting") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2248 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- tcg/optimize.c | 2 +- tests/tcg/aarch64/test-2248.c | 28 ++++++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/test-2248.c diff --git a/tcg/optimize.c b/tcg/optimize.c index 752cc5c56b..275db77b42 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2376,7 +2376,7 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) * will not reduced the number of input sign repetitions. */ sign = (s_mask & -s_mask) >> 1; - if (!(z_mask & sign)) { + if (sign && !(z_mask & sign)) { ctx->s_mask = s_mask; } break; diff --git a/tests/tcg/aarch64/test-2248.c b/tests/tcg/aarch64/test-2248.c new file mode 100644 index 0000000000..aac2e17836 --- /dev/null +++ b/tests/tcg/aarch64/test-2248.c @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* See https://gitlab.com/qemu-project/qemu/-/issues/2248 */ + +#include + +__attribute__((noinline)) +long test(long x, long y, long sh) +{ + long r; + asm("cmp %1, %2\n\t" + "cset x12, lt\n\t" + "and w11, w12, #0xff\n\t" + "cmp w11, #0\n\t" + "csetm x14, ne\n\t" + "lsr x13, x14, %3\n\t" + "sxtb %0, w13" + : "=r"(r) + : "r"(x), "r"(y), "r"(sh) + : "x11", "x12", "x13", "x14"); + return r; +} + +int main() +{ + long r = test(0, 1, 2); + assert(r == -1); + return 0; +} diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index ea3e232e65..0efd565f05 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -10,6 +10,7 @@ VPATH += $(AARCH64_SRC) # Base architecture tests AARCH64_TESTS=fcvt pcalign-a64 lse2-fault +AARCH64_TESTS += test-2248 fcvt: LDFLAGS+=-lm From patchwork Fri Mar 29 22:20:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784087 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3426596wrt; Fri, 29 Mar 2024 15:22:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9bomGgeEIeAmIgwo+0lYWT16L4WEaQupp8afaqmAJixDPRFcg/yeCbesI8LqKUSY2iNcVWtxOnr/LGCTHYZCF X-Google-Smtp-Source: AGHT+IGQFA9KmxwoLEARpixVrTL3EXOTOrnVChewpDgCSKHtHPu3CaeiGNSxa62QW4kGM31NgJyd X-Received: by 2002:ac8:5941:0:b0:431:5f73:bda8 with SMTP id 1-20020ac85941000000b004315f73bda8mr4039582qtz.65.1711750938263; Fri, 29 Mar 2024 15:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711750938; cv=none; d=google.com; s=arc-20160816; b=LyzAPImSF1ugHk/aa8peHwaFOuf0ONIDwA8VMOErg8WnKCakr/mDE8d37YXHYPN9SY uSkihCvtMh0+m/DlK+n244j6+fxEzWfEqS0io11NLxz1YF41z9C3wpeJk07lU6alIgg0 zK3pJuw/8rUEytmVOEupWZWsvWSDKX87CVf89XwbSA71Q+bNyVvtFj/EU9bSrGpJrZTf XWfVvRm8HRU3F/Nfww6nXmhZoOdqJyt58YNXC9a2lEz0oNJdbKAZIL9lIb9IIfcAR1Mb TOdTXNB2srTEMsz5CXTOxvSrywwOM4fKtefd3vr7hyOyWdZ72cTSkYEl3M7Hn68zBbHy H+kA== 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:to:from :dkim-signature; bh=1pFViSSelBLDC7jQWPNWKQ58HUVyc3Kf8+NgXdrfBUc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=PARiDlwHv7EdP8HYGlh/0YWsvX9+L69Ao4KOgvuasw7xw5JV6QVA2LjDFwC2BHh555 AYU/zthXXwaHEXQ8AWLvpVrVH/QcQh2kNsCdgSeRtp8BhM1cZcgTBmMQOwODgJh0CKJN y8y/pQn7m2ZzlcnZRB9zSoS6W6TtITqz08yGlkTlv0P8XHQzgZfcgxpqa6jr5OpOzqGZ lhe3qNNXcwu2YfBkVx7QLeADcqrYE9T0akgknB0+520UhNDE6ioi8tHtcWtnqWGWIUJs GmluIEoncu8SDL+LZA1xvqMPugaxyyo5jWJ+6daxCkY/klGrfXr8g1SR1VeRc4kdjuaP UAIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tva+OfnK; 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 g16-20020ac87d10000000b0043182dd0573si4606735qtb.503.2024.03.29.15.22.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:22:18 -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=Tva+OfnK; 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 1rqKam-00058o-J8; Fri, 29 Mar 2024 18:20:56 -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 1rqKai-00057f-Kt for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:53 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKah-0001q2-5R for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:52 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6e740fff1d8so2012850b3a.1 for ; Fri, 29 Mar 2024 15:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711750849; x=1712355649; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1pFViSSelBLDC7jQWPNWKQ58HUVyc3Kf8+NgXdrfBUc=; b=Tva+OfnKh9KR7OktjPfOxSJAsP6pAvXCA2q9RtdmrT2s+KqhHQkmxCcLMLAI9hcM8k mZxmy02efutIBEecJ6Cr1EEmsLd1Ul6jdRZnfDrF0O8Dw+1Obuy173nGJMoNIPTugwxj uA3b3uxmpivHUSy1q8NsiM3UJBYRIUkNLsA/RxmyciOn3zU//qZWun0ABEDQdTkv9g3z Axx7fkJbEsmeG1ARCjsfihBjPdnFM0FvNPkq4ERP3xygoMLqaMx5jT0TL6P44y14tdQb d/OBoENRTIGytuyhfeExy8WdGkzwZZAWdh21ju5GT5Jk9US4SiRPYL8w2Yr/d8QI+LKm DKdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711750849; x=1712355649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1pFViSSelBLDC7jQWPNWKQ58HUVyc3Kf8+NgXdrfBUc=; b=XVJzL2Th15il8bP5W8J32SoUpN51LaTB73r/t+vdr5PKekn9eUEjKAp3ADhnuoqVNE 8h2tX5GcZBoKG3bmAzBu99HxnGMpYfQZt+URWE+usPADggD7CEBvmRtCRUkrK0/RxtCw dRGfLAVwHRIaw6FyJ9o5aPsr2CgJiPZ5bD0YZFJqPnWrRNAWT2p5+e8HhUuxzr3lWvpk Y6njmOyyzt7D30ZnzHj87sazD3h6PSoXCv8LO99dng2c9lSlvJ73z/Le2siULzlKLicr 9mG88hphtLlp2br5f7KuRXXRH5ZVGO0+1G2RGlDUoB0cw7uupnR3q4Ff9Nx19Y2fQ9pI FGug== X-Gm-Message-State: AOJu0YwhZtcslby7Lb5Oc13Y96IUTahY0obaiYz6oijScYXBEl1I3hox 809ZVByMNttu1vxdbJv+SOxuSdMPTArm+x3lEKfeUS0wWfd0fhvnC1pj35HJjcPNI6us/GChVqL S X-Received: by 2002:a05:6a00:4b50:b0:6e7:6a7d:5a58 with SMTP id kr16-20020a056a004b5000b006e76a7d5a58mr3560406pfb.25.1711750849554; Fri, 29 Mar 2024 15:20:49 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id lc24-20020a056a004f5800b006eaacc63435sm3579811pfb.173.2024.03.29.15.20.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:20:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 6/7] disas: Show opcodes for target_disas and monitor_disas Date: Fri, 29 Mar 2024 12:20:36 -1000 Message-Id: <20240329222037.1735350-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329222037.1735350-1-richard.henderson@linaro.org> References: <20240329222037.1735350-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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, PDS_OTHER_BAD_TLD=0.001, 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 Fixes: 83b4613ba83 ("disas: introduce show_opcodes") Signed-off-by: Richard Henderson --- disas/disas-mon.c | 1 + disas/disas.c | 1 + 2 files changed, 2 insertions(+) diff --git a/disas/disas-mon.c b/disas/disas-mon.c index 48ac492c6c..5d6d9aa02d 100644 --- a/disas/disas-mon.c +++ b/disas/disas-mon.c @@ -34,6 +34,7 @@ void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, disas_initialize_debug_target(&s, cpu); s.info.fprintf_func = disas_gstring_printf; s.info.stream = (FILE *)ds; /* abuse this slot */ + s.info.show_opcodes = true; if (is_physical) { s.info.read_memory_func = physical_read_memory; diff --git a/disas/disas.c b/disas/disas.c index 17170d291e..7e3b0bb46c 100644 --- a/disas/disas.c +++ b/disas/disas.c @@ -211,6 +211,7 @@ void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size) s.info.stream = out; s.info.buffer_vma = code; s.info.buffer_length = size; + s.info.show_opcodes = true; if (s.info.cap_arch >= 0 && cap_disas_target(&s.info, code, size)) { return; From patchwork Fri Mar 29 22:20:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784085 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3426542wrt; Fri, 29 Mar 2024 15:22:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXOv06d1AAeCHmn+52QNbT59VRNkojioJW/DJJr6auWuuzeTHYeOzDEISH2ePPAsmbrHme/eUwu132ynQko+pnk X-Google-Smtp-Source: AGHT+IHHZmYob+yKZv9eze+GMyyn3B2X/nAGpdt+iWxEu6OVBmrYAGmC1sfoezEs7Kh8iIcQPPDf X-Received: by 2002:a05:6808:3309:b0:3c3:e61f:dc03 with SMTP id ca9-20020a056808330900b003c3e61fdc03mr4327043oib.33.1711750927501; Fri, 29 Mar 2024 15:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711750927; cv=none; d=google.com; s=arc-20160816; b=XK94JIKoLkRv1xx6kPJhPHkXy4B5i6JJnQDadmMS4+V5TyUdOVN9o4vmCzAmUyhAcR PxtIznlnOVK+sV+8FYZbcW4B2M6LVeL+GELQb/ZgRfknKjTDbOpCY/AKCx6vUc7GYsFN zvg9qVkwywyQDu1RwZxfPd4ssPmVeptZDvP/lysFEqx40qzofdaW1g0PAPzdvAVu2BEd 3Dnisf+Im9C1lXg2ryo3GDKT6vqkmonhyOcdtZrRTLBtrI20l8eFsvByrLX+QVDJ4jth Jg8L2qw/dND/2EROeqt78VZ39PeWbuz/r8+Zn9GYyyP9oOLqkS3LPTkyaY/xGzfQneMX hMlQ== 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:to:from :dkim-signature; bh=aXBZFu2s4VI4gx6Rv0AU3SgCaeiACnYHqJQpFd1hK8k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=xQALx4O6k7kWTIZE78mwacst/djMFdjrvcSxWhxrjl+pi1X7ljTa9FVhdWkkseyuud 7PXH45LYOhY0jmvECLJ2HOYu5bl5NT1AxU59HUYJyt8SG9cppfY0gzeDsZ/kxSCJ9HZu 6GiiZf+m1C/9IJxG0MUQKoAQak7Nsh9PAWYiF+P3R+3WVOc2pUxzbl+x86ZcLSWjJGtR 8AIMQiAHJho03gZre9uU+ySVmwGSfNwBnNHx0c48RSyqZW4oNWZmhgIF/l2F0YmLG5DW +I6yhomipd/6cwDU3ls1fqd5hYv62IZ/I8TD9Ok+uxiYdGSfQFe36Iy09+KmyUKldqSA gPeQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoDIdmAR; 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 v14-20020ac8578e000000b00432b953060fsi3839448qta.651.2024.03.29.15.22.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:22:07 -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=CoDIdmAR; 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 1rqKan-00059G-8u; Fri, 29 Mar 2024 18:20:57 -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 1rqKak-000588-Gg for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:54 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKai-0001qU-CW for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:20:53 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e704078860so2085719b3a.0 for ; Fri, 29 Mar 2024 15:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711750851; x=1712355651; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=aXBZFu2s4VI4gx6Rv0AU3SgCaeiACnYHqJQpFd1hK8k=; b=CoDIdmARNX9vqrG7PCuHKbASUQSfwM8lwRwiE/l49KUiSqt3+NTdLTBCUxsQpEOMXX 8U6fLY/qdG3vG1LJeyHEVb51MPFVmcYO6SOXWXPv743Em3DgAcZ70WbAc9aYiHGqRaKH 0F6uFQ+5RkjZkiWEzsCEDeSQJX6RHtnxy++BQ1gqHT3tdFP1EcUFVE1w3dbiANTMm526 W2duqXeBG5vpOPAIZOGV+hIPa+62zVx+LFPqBQnOW+UK9lDfs3Ndmu5W+62KMj4e3xgG n+CI1cn01JPMUH+uR9yh32hDHXzI8JlO4gC0gKH+Nukv64bLGOzUoXaIgaUWw2tVs2p7 xcJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711750851; x=1712355651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aXBZFu2s4VI4gx6Rv0AU3SgCaeiACnYHqJQpFd1hK8k=; b=HTgm1ud5c0FeRA74Qwwdjg9hqo2I6gqAGPwBYbbynG3pP2cLhWOK+LYkF/zK3F0qeV aVVpTmLZTUqXfaY5ekPDHMekvqglAMq2RVHA4sJ1phvYUX0DfjmYxcPXB4ARmqPLjKoz BFEdJe2YEuCH0i7v3zCNJMwE5+F2bY75J9Yzi1Srs1iiK/YD+CcVSjGWdkaahVLo1enf h5lyHIUP5Z+yqbwy46qZFUtlzguDWvgzo+OuA44cESXCeCDZI2AGWHetNaWsjyukir9r bIVkj0LN052c3C/xnuHul46t3rjTTNPDzYPyOm6DKZf6+3OoZYCd/l1lrvJyR7YMhm7h lQ9g== X-Gm-Message-State: AOJu0YwEysyjLq5WDotDLGMyVwmhXaJNjjGe/XTSMbiP/JElyZf5zQKQ k6x78ood7d4djLiylvK33Z5VbPOT2Vn9Ip4cDsEFdDyI1qaDL/FYxaLQ0f5beuFDnYS7W6v3eIb / X-Received: by 2002:a05:6a00:4f82:b0:6e6:970f:a809 with SMTP id ld2-20020a056a004f8200b006e6970fa809mr4312957pfb.20.1711750850944; Fri, 29 Mar 2024 15:20:50 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id lc24-20020a056a004f5800b006eaacc63435sm3579811pfb.173.2024.03.29.15.20.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:20:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 7/7] accel/tcg: Use CPUState.get_pc in cpu_io_recompile Date: Fri, 29 Mar 2024 12:20:37 -1000 Message-Id: <20240329222037.1735350-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329222037.1735350-1-richard.henderson@linaro.org> References: <20240329222037.1735350-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 Using log_pc produces the pc at the beginning of TB, not the actual pc installed by cpu_restore_state_from_tb, which could be any of the guest instructions within TB. Signed-off-by: Richard Henderson --- accel/tcg/translate-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index c1f57e894a..83cc14fbde 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -634,7 +634,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu->cflags_next_tb = curr_cflags(cpu) | CF_MEMI_ONLY | n; if (qemu_loglevel_mask(CPU_LOG_EXEC)) { - vaddr pc = log_pc(cpu, tb); + vaddr pc = cpu->cc->get_pc(cpu); if (qemu_log_in_addr_range(pc)) { qemu_log("cpu_io_recompile: rewound execution of TB to %016" VADDR_PRIx "\n", pc);