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" },