From patchwork Fri Mar 1 23:06:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 777454 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp1680277wrn; Fri, 1 Mar 2024 20:13:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXlgq97WO2MPDDrcpeU1R9QQA3gVShavRH4PBDmisXPrUBOO0uI1RLNYP2ZH1PESuQ1rPGZe5a4L2/MBSyc1uX6 X-Google-Smtp-Source: AGHT+IE2MWsg4XXU5Tru9eOcYBgOr/PU3t27oJdYsqgj4CqzDZK1oQlIZPqiU0uqxZqRiJKFS+vq X-Received: by 2002:ae9:e30a:0:b0:787:dd42:4807 with SMTP id v10-20020ae9e30a000000b00787dd424807mr4839299qkf.3.1709352796420; Fri, 01 Mar 2024 20:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709352796; cv=none; d=google.com; s=arc-20160816; b=KjRELi2DCYKe6K4Nq6CeTPvzRuDLcYAp3674YVV1FOoEANQa59w1z1SdU7kiawzDRt /CV2ENlrSywlWsQSOPmaPxkdu6yJjKAMr7/C3p28VwG3UMn55GG62c65zF0+CwNbYzgo 6cBcJptX/KMupTR8X/f/MRk7UK3Zp+Wm6tqzHc1pBwuiNBM5G+UNQOS/nedAhAz2sTht TmWnqBWQYdPXyTS3jNol4YdF0vKDRc2KX6bBA9QH5mIwvfp/3ODGn7jsZ0Ub4OmqZME5 gq6Dt05rtZF0jhrWIawi7IM5GCuVktChGpLC/07yUxxcu43BGouEOnGqzdM/4rAw8Otb aA7Q== 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=7rYYyH2nCsC3OszbxYg3gYtAKvyiLKNjInne/wklRig=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=HNURSnJ1h5T04xGVUmGwE1KQVDn4O3nxaimfqiYpEIdcXiiHbGRUo7FmEeExWV0pFM JIGciNowvavkXNLQBng1jPWeP1v+SkwCkDjXkrhF+zLqlRjOmVvQjXeVAv9pNxQTH2eI 2W9av8x+7G0DclZTqzdvZszkW5Vr6DyFZ1aEg/aHDFFygXIPCFtRTTQkozZ++/2lYvA5 0xRyYQ4XI49dIAlWF7BZHTFksndf4qRPYxaMXwf5/ioOUYKIREre5mc4n+BHTCc5HFT4 iPvZ7vOY64HcPwnewTxeO36nv7tZcQOhPO7bH1oPHdCloewuu3PGP1mZIJ9xglAx7ZAR R4Hw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PXdVjMPZ; 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 bs44-20020a05620a472c00b007881c8c2be8si53799qkb.547.2024.03.01.20.13.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Mar 2024 20:13:16 -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; dkim=pass header.i=@linaro.org header.s=google header.b=PXdVjMPZ; 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 1rgGjL-0005PU-Ut; Fri, 01 Mar 2024 23:12:11 -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 1rgC1k-0003ze-Ig for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:10:59 -0500 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 1rgC1h-0005zr-T7 for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:10:52 -0500 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6e5dddd3b95so361841b3a.1 for ; Fri, 01 Mar 2024 15:10:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709334648; x=1709939448; 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=7rYYyH2nCsC3OszbxYg3gYtAKvyiLKNjInne/wklRig=; b=PXdVjMPZ82/pp1kdK4kP72tSGkH1KBZJb4jb2e83ZY3ltJSxAjzXfXKErrTxFGioZT s58ro0dOrYANbVYwXHMnASFPOPoTpsu61k/ZV9nX+GEQQ60/A+KfRG3AhDiYZdBdFXrb VK29ofkRdnvJPivFQ5zhAefGojZlTg6yLQFr+bEBNg5f4raUXoic8N2t1xzldjMc66RD EWglPsDnxiA2kvbP8GD4nIIdAjbjSgJY+VNhETVnFPZMRa5ZtQYjsKCbDvcyipxI6SOA S/wl3pJcwNawQMsUrLawE5ZOJ33GsK17eo3TF87R8RJhm4Pp/QCqzCZBFmcPzQ95QNpk mRBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709334648; x=1709939448; 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=7rYYyH2nCsC3OszbxYg3gYtAKvyiLKNjInne/wklRig=; b=NgvImdX8goKmeBJtdz553LEurVD9zXoAN7owdP4Qjj8pC14B06230r/m02IbQf5NpY M6hBkTvxwqPJXkx/WOGcstaiR7kXUssS7omC/FlwAidg1555VDWw6kRZKFcBhi+R1kUn tLksPBTWzaLRdMNKJhNmjue57MNTns8X/31l5YXaxo13MA9MMAh4yVyamKGD9c6SqUI5 OTYyH8EVgOGT11n5XfLLkiYaxgAAq0m6u+HZ7uv9g20g3WVIg2bc59TBkF1b3ze7OBVD mjdYn1sTn0bZ90Q8hLtrHbxWepR4cosyoq4HmdcmElkRexPnHpIxmQdIQFojY47LkI5J bTvg== X-Gm-Message-State: AOJu0YwUYobvkA9OUEHiTFXwBqFb/YPef9hCg8237FfFsVaRZOE4+YfM l791qIFucvw+N7rNhG0SjyARYKk0LUOaw0FFUKxK6F5k/TucWvMaShvHZo/LwVlAnejA1rVtzIX 4 X-Received: by 2002:a05:6a20:9e49:b0:1a0:eb42:a708 with SMTP id mt9-20020a056a209e4900b001a0eb42a708mr8354340pzb.18.1709334648603; Fri, 01 Mar 2024 15:10:48 -0800 (PST) Received: from stoup.. (098-147-055-211.res.spectrum.com. [98.147.55.211]) by smtp.gmail.com with ESMTPSA id c2-20020a634e02000000b005e438fe702dsm3449407pgb.65.2024.03.01.15.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 15:10:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 58/60] linux-user: Add strace for shmat Date: Fri, 1 Mar 2024 13:06:17 -1000 Message-Id: <20240301230619.661008-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301230619.661008-1-richard.henderson@linaro.org> References: <20240301230619.661008-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/strace.c | 24 ++++++++++++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index cf26e55264..8d13e55a5b 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -670,6 +670,26 @@ print_semctl(CPUArchState *cpu_env, const struct syscallname *name, } #endif +static void +print_shmat(CPUArchState *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + static const struct flags shmat_flags[] = { + FLAG_GENERIC(SHM_RND), + FLAG_GENERIC(SHM_REMAP), + FLAG_GENERIC(SHM_RDONLY), + FLAG_GENERIC(SHM_EXEC), + FLAG_END + }; + + print_syscall_prologue(name); + print_raw_param(TARGET_ABI_FMT_ld, arg0, 0); + print_pointer(arg1, 0); + print_flags(shmat_flags, arg2, 1); + print_syscall_epilogue(name); +} + #ifdef TARGET_NR_ipc static void print_ipc(CPUArchState *cpu_env, const struct syscallname *name, @@ -683,6 +703,10 @@ print_ipc(CPUArchState *cpu_env, const struct syscallname *name, print_ipc_cmd(arg3); qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4); break; + case IPCOP_shmat: + print_shmat(cpu_env, &(const struct syscallname){ .name = "shmat" }, + arg1, arg4, arg2, 0, 0, 0); + break; default: qemu_log(("%s(" TARGET_ABI_FMT_ld "," diff --git a/linux-user/strace.list b/linux-user/strace.list index 6655d4f26d..dfd4237d14 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1398,7 +1398,7 @@ { TARGET_NR_sgetmask, "sgetmask" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_shmat -{ TARGET_NR_shmat, "shmat" , NULL, NULL, print_syscall_ret_addr }, +{ TARGET_NR_shmat, "shmat" , NULL, print_shmat, print_syscall_ret_addr }, #endif #ifdef TARGET_NR_shmctl { TARGET_NR_shmctl, "shmctl" , NULL, NULL, NULL },