From patchwork Tue Oct 8 18:51:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833614 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450255wrv; Tue, 8 Oct 2024 11:53:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUygRPxdnFmon9EdYZ0c9nHTtCDZYcu0s7dMraMEq2LMI+UFIM0xwjLjGD8HZxOvQOqcUnHow==@linaro.org X-Google-Smtp-Source: AGHT+IGJHdLj5s5RtSyaa7Y/JoAI5K9g7TM2ePUhXik5K8VNsaZcGRnbQtVBgNLDIokz+mDy+rRM X-Received: by 2002:a05:620a:488d:b0:7af:cdf9:8c22 with SMTP id af79cd13be357-7afcdf98ebdmr249606185a.33.1728413610390; Tue, 08 Oct 2024 11:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413610; cv=none; d=google.com; s=arc-20240605; b=NygKNzn9FKuD113SiOvsN5G4/4TQgNKw0z+QoJa9qDGtceuKib8f5/HJUCTaUvyS7c AyQkTHhELkt7syC7uT3fYu3tQuXdcUQaSLX294ti/RcVlMxBnfJ/KDsmAvbwj+graOmD IhivaI113T7Aus+QS42drvScbP7qLqOuxJUPQSvUtX0zXv6pajIncMCPuY0VEBTPGE8O 8HoB8M7J5c1t6aQx30OT2g+R6IrEJtYwq/I2khuEguMgDvJGv1L/QKX0PB/5t8BDj2uW sXCUAvTt8c8IOuw9EEXWXcrLSIjWd4Kyv2N1B+uWyppcpAM/bMIYShKk7dJfwQosrsNA DxJQ== 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:dkim-signature; bh=K+Rj8O/QK6Pa3filkPJ4FZfJms9lNPKqXWSFkDZyfyA=; fh=tTjTfh/QwbpfIJ40uL4jnZOzWTJn3vAziy+Fmyen6KU=; b=FZZR335+c0vxEJHJ9YS2DtNUBaar+gHW5/eOB6m8eyLO1KB9QPv/ky2V/6lnEEk+x3 RSCAHllgMK+OXS59LE+ZyR6bI8XcQkL2rz/5KD4nJzIvBxAem6Zqq2+USaia27M5eykf aT3fPBRaFWmD/4PGDyCItyGG7iK81wE27YJAokvMiV0TSz5VBfWyZPHRBGPDqgXWPm8k Ipmznzv/wOmHVPoQ46Tggm+FuJAnKYbvvJT9/8J2TH3MdlzF024HBw5upRAH4ZHXAoM5 D0M8DlqaJW9BmhxUlVZTDR/XsuH3fIkArY0Ob6B+1FRXV4hC9dBzgrPtBxsxPklGuv2L 6ebQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SCFevais; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7afcd66f628si132688285a.564.2024.10.08.11.53.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:53:30 -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=SCFevais; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJT-0007T7-73; Tue, 08 Oct 2024 14:52:03 -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 1syFJP-0007Qq-Qr for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJL-0002S3-Ak for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:57 -0400 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3a377534e00so16743075ab.3 for ; Tue, 08 Oct 2024 11:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413504; x=1729018304; 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=K+Rj8O/QK6Pa3filkPJ4FZfJms9lNPKqXWSFkDZyfyA=; b=SCFevais/ptMBAgP0n7GyvOII57QeabaSMjUDe2/PvDwe8YphxjsokK0o5XXlMccN6 yrVQs4eZpPxqqHdBbwdgSJqse5yRNUCyKGSsbjswaBYzFy2oPZN85w+IwzMwoqGVTUv4 O1bMLybWOo6j3z9aYqkQTgFk0FJ7oIDIE30Q1z3FEngdKBJ5dVJ0Ach/ubD0mELmRySN StfRwNz3rz0yqwIMUErX68RtDga1Qp8G/JTzAopTRziAj+jtXZgeWGH8chu18jxcg7j4 Am9bvFimR6SmvJiz0l8Tllz7NfAtRxSODANcggzLueYltSIPT/U8QreC2KjHDTNvYfIB 9ayA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413504; x=1729018304; 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=K+Rj8O/QK6Pa3filkPJ4FZfJms9lNPKqXWSFkDZyfyA=; b=QTvc/vFoNIcx3NK3IfNU+B4zdk7kKaxY12jHrhWO64qlPpsLzHYeGLRXZA3BIAE8nr 2UUb/RYcXut6xozo/M8+GilKTbTboVbTz8JFvd3FKBPCBU+vPkVIw1VvIRziGWzbfq1Q FSKQtp4vTn66SrNIaxIdAofZnnO6gqi+HlFa1gn3MpqGrwNZf+EEIJ1Gp/7S+UuSrvUB q+1aNKRISVzL+YalvkdTsdg1dFLlBtBmUbu7Z+E7CuwgogyrJkSaUej7FizDpesMy/lf wZ28SITypz8L1a1kYKYRbwGNetDf1U9TZX52SDEM05N0XUwJr4kA2nlsc0zDK1+Ya3x9 56lw== X-Gm-Message-State: AOJu0YwRIbHJopK0H6bBlmWPMBC5dESuwxhh5/FFMLdDN0rnmxJo8DnX FXZPBAY3BMHGP81W+c9ET6NOs7XOrFRGkcOYSbBSZPKnahb1g0rrmuXBPz7JUO8BPZfc0cOsAQl c X-Received: by 2002:a05:6e02:20e2:b0:3a3:4221:b0d3 with SMTP id e9e14a558f8ab-3a3757c8506mr174156735ab.0.1728413504238; Tue, 08 Oct 2024 11:51:44 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 01/14] linux-user/flatload: Take mmap_lock in load_flt_binary() Date: Tue, 8 Oct 2024 11:51:28 -0700 Message-ID: <20241008185141.20057-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::129; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x129.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: Philippe Mathieu-Daudé load_flt_binary() calls load_flat_file() -> page_set_flags(). page_set_flags() must be called with the mmap_lock held, otherwise it aborts: $ qemu-arm -L stm32/lib/ stm32/bin/busybox qemu-arm: ../accel/tcg/user-exec.c:505: page_set_flags: Assertion `have_mmap_lock()' failed. Aborted (core dumped) Fix by taking the lock in load_flt_binary(). Fixes: fbd3c4cff6 ("linux-user/arm: Mark the commpage executable") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2525 Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20240822095045.72643-3-philmd@linaro.org> Signed-off-by: Richard Henderson --- linux-user/flatload.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 04d8138d12..0e4be5bf44 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -487,7 +487,10 @@ int load_flt_binary(struct linux_binprm *bprm, struct image_info *info) stack_len += (bprm->envc + 1) * 4; /* the envp array */ + mmap_lock(); res = load_flat_file(bprm, libinfo, 0, &stack_len); + mmap_unlock(); + if (is_error(res)) { return res; } From patchwork Tue Oct 8 18:51:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833623 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450960wrv; Tue, 8 Oct 2024 11:55:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXhTXtwzZpnt+t7+QivshJ45x8uLs2D683vKIVlgm8FB9pXIvDJui7uCl5zTfXJPbXm0GcclQ==@linaro.org X-Google-Smtp-Source: AGHT+IHkxHfIT4Ynt6GI9BId87g50vR3rErJgMUKUyA9wFgAQ3Q3oIxCoAwoqWV96YxdPrgklK0B X-Received: by 2002:ac8:598f:0:b0:456:8b5e:bcf3 with SMTP id d75a77b69052e-45d9bafc116mr261849221cf.52.1728413733490; Tue, 08 Oct 2024 11:55:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413733; cv=none; d=google.com; s=arc-20240605; b=cKUKIg0BXnB3SOhxZAvlDdUSelm5g9hPDgVFaJ8/agko95UkaVwUfgUmLg6WF3PuXl sNP6uQsOn2PCHycSI8WR5JTTcvX7UhFJU1R4LtH3U6AbQRSG+YVBD+2RAJTqMj0+M52I SZ6uCiIHETpV8ZXP3wfywhzHwfWKcGHGAbAB1p0CyG1f8HcQ8/Ab8hD27qzDtxHwG9so QfSycoctZMC7NaqJ/8L6f4N7+DK546a0X/3FeIrHcLDLToS5D1ZgntLRfL0OFhCTNEEU rUL7aN+mcr2pxX4niNEe9n/+LnWq1rIK+SNHVbBhVGsbZsN3I0AE3hA5eknTMb2VCwzr aGQQ== 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:dkim-signature; bh=TOn9FQKnsFqqK8dvmrqts9k4e/ZA/rwyYeo2+pg72XQ=; fh=/QfAvEwSfxyWv8Z4/MKMf+odbTLkQvwTx0WR90zvsG4=; b=P4HDukFakN4KsIPoMrqxnIopES5SbgiORvnTdZWNcxluAGkFmGpdLA3rKwlJGo7aCD s5T9JS4bc7ajKAiCMESRFxknFhkoCrqA5PAJ9Ng9vbWYN7BN7Nget4h9hOdk5cODXgBQ ZdrRDcLbgQLwAd6ThoMxFsIpikUg3Ke4SUrhEBfXIsfEj2HtZX129ivbnbO1CcWk1ta7 h8t1Cz8B5WWHEOmeQcv/mdxN5MNWtutzO6B0onoKmaDrrWi/asMw6YDJ+gHF+dCUQmDb uZHwPBeyH7cyvVtXgVlMbJgXncAklktmOr+tQ4pdb0eb3yeRVxEy2KTwrSuVDLwk50XZ xlyw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YlVD4yWS; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45da74aeebdsi92014841cf.70.2024.10.08.11.55.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:55:33 -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=YlVD4yWS; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJW-0007Tg-Rn; Tue, 08 Oct 2024 14:52:06 -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 1syFJP-0007Qr-R3 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJL-0002S8-AZ for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:58 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-20b833f9b35so52365595ad.2 for ; Tue, 08 Oct 2024 11:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413505; x=1729018305; 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=TOn9FQKnsFqqK8dvmrqts9k4e/ZA/rwyYeo2+pg72XQ=; b=YlVD4yWS0Adj4ke/Vz2TCJVjSDPbZ0DWWjhmUzhLIjGy28b9IgbUNpYfZChn4RAwSi nz/SF/NWB2EqXrwdKL3al0Rwo/Yp/2Xwdk1FJiry0ejWA3yM0iKPXwD1dl+pmRUhJuUB F9qaTOQ/b85hiKIlAV3P9vmPGGvH2eSHdfRqSP/kO9Q/oQu/3I391sxkw3hzDC2+nG58 4FyPJqbpq0aE6q6jGTFkeM76LKPuVK0xQzhbgFOB+LItLAfLUR+sutzz5CuU3mlXiJkm eezbCt8U4v5WyDpAn+M0JtMmZLxav8iSvSB50lo9RDs8VrVVkMKehYYiwPTtpfxP6B0r XI6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413505; x=1729018305; 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=TOn9FQKnsFqqK8dvmrqts9k4e/ZA/rwyYeo2+pg72XQ=; b=QtnVdHj+//FGJN06mCeydEPhnA7HI0IoaK5K2haRyCl3s1q3mtGmZXL/9/itDFaeVC 9bOqfWKBiJxdaXfkZwOy/Y3JnkItGNzzFPf7rAjhpHX/zVEcdKw+GvohRYXjbg8tioEr PDoJufADBDZQpJVaClpuTgQhhbS5YFCY5KGTIKo8GIKFP0pkGTHLoDm2pkHpXRmiVLF1 6QfUpfBQboFcHZwgRjMvJR/OnUXXQywNSL1GnJGSMrEcIMyBJZrTtSj2d+U9kwT2gS19 c8MWY1n/Ktk5402EScnCDcEbqYMQJecvAuVKRC6+J5ySlcIBI2xPoRCvo4ZDJBL15zEF kAAg== X-Gm-Message-State: AOJu0YzvnDR/u6PXN1ncUVZdnPoEo2pfQ5+TbVJeSaOmWQ3K7iMkad1/ XXSISp1AAyI32xTBuW5BaUMfoXd24LzDgVi9XuE5eBoQHT/svghCwiif7icvCCPvn0WznRZrLeM q X-Received: by 2002:a17:903:2289:b0:20c:61f8:f45d with SMTP id d9443c01a7336-20c61f8f6admr6163045ad.22.1728413505243; Tue, 08 Oct 2024 11:51:45 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [PULL 02/14] linux-user: Fix parse_elf_properties GNU0_MAGIC check Date: Tue, 8 Oct 2024 11:51:29 -0700 Message-ID: <20241008185141.20057-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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 Comparing a string of 4 bytes only works in little-endian. Adjust bulk bswap to only apply to the note payload. Perform swapping of the note header manually; the magic is defined so that it does not need a runtime swap. Fixes: 83f990eb5adb ("linux-user/elfload: Parse NT_GNU_PROPERTY_TYPE_0 notes") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2596 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael Tokarev --- linux-user/elfload.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 0678c9d506..52c88a68a9 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -3121,11 +3121,11 @@ static bool parse_elf_properties(const ImageSource *src, } /* - * The contents of a valid PT_GNU_PROPERTY is a sequence - * of uint32_t -- swap them all now. + * The contents of a valid PT_GNU_PROPERTY is a sequence of uint32_t. + * Swap most of them now, beyond the header and namesz. */ #ifdef BSWAP_NEEDED - for (int i = 0; i < n / 4; i++) { + for (int i = 4; i < n / 4; i++) { bswap32s(note.data + i); } #endif @@ -3135,15 +3135,15 @@ static bool parse_elf_properties(const ImageSource *src, * immediately follows nhdr and is thus at the 4th word. Further, all * of the inputs to the kernel's round_up are multiples of 4. */ - if (note.nhdr.n_type != NT_GNU_PROPERTY_TYPE_0 || - note.nhdr.n_namesz != NOTE_NAME_SZ || + if (tswap32(note.nhdr.n_type) != NT_GNU_PROPERTY_TYPE_0 || + tswap32(note.nhdr.n_namesz) != NOTE_NAME_SZ || note.data[3] != GNU0_MAGIC) { error_setg(errp, "Invalid note in PT_GNU_PROPERTY"); return false; } off = sizeof(note.nhdr) + NOTE_NAME_SZ; - datasz = note.nhdr.n_descsz + off; + datasz = tswap32(note.nhdr.n_descsz) + off; if (datasz > n) { error_setg(errp, "Invalid note size in PT_GNU_PROPERTY"); return false; From patchwork Tue Oct 8 18:51:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833613 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450235wrv; Tue, 8 Oct 2024 11:53:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXPgbsTDw9j7sgSMKIgg1U6iNZj6IoxGmwIYDJ+UQY/dxHUH1eBz+dQdlYLx4dL3wjtS4Z7HQ==@linaro.org X-Google-Smtp-Source: AGHT+IEAwG9slMEnfkOmc9EHp/GUtKndHVrzeeNx2CFUZBRRcgAt6gcQQWYZDub6/dnYNPLlpJNP X-Received: by 2002:a05:622a:5a9b:b0:45f:6d2:f1d9 with SMTP id d75a77b69052e-45f06d2f48dmr27515711cf.10.1728413607276; Tue, 08 Oct 2024 11:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413607; cv=none; d=google.com; s=arc-20240605; b=H0/yS7sxVwsYqu8PrznKH8eQWdCpeLfVKmT2Lu1mpmpwX3iO43FYjIbe9EjxDMBIoK B0NANvrLveiPPleTPoHuS7DrC6wOJDpaDAe44ObrJigq9CC8e2veYKyc/iOXxKFq66sw sI93CCjSBxK7VLyztldXK81xEYxTNTMoKTQCR8cswVdawo7MCy2kDpAQ/SEmja8y0Vki VQUzrRGhA1fvsYhi/U06OMCv80iifWxj5jR/9uBi6gaKVq5ZeFBL+7OHZdcnObrpXsW1 09rMuNxXK7hoelu3nVgL653lx4A67KjIckVF5XlNKliLsr3GUsyXTd0Z0hKm8YxixlDF WrFA== 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:dkim-signature; bh=ieyGc0lcP2qslY/k/Zc8iH5sBXnxr9bzsD8Ux8bqk8s=; fh=bfzdhCcU3ZfQ17YMkDaytQs6HssTokv83KlNoAueAKU=; b=BYC/uNU8dT9fnHu1XiaDjX/awmGmRp2d/SQJv9rCRLx7Kg04DgMROFRKQGwfxrpYLT /fK6t6SuQ7eQjjIJKFc5RrI6HNQ8uwURGva0dZD1AMoAGHnIoWoI754plSMrOB8845kr pg+EV5SrYgJ+dNvx+0tWybAtc+Mx7IzcG1c6wDO8DCNNkEk626VPZ1myRWVHNDRzH9+7 Ilc3sAQVOLhaSjW1vipsB+9Pyd6dTNlPGk6yU2OIagVaD0tBLIwl+26tnw4sFGrplkHG xPD8uSEaYn47nQVMNf6YZLZGRrl/QFw7M87BkqacsN1iNfS+Skx46Is38dJTKYIUO4hs nvQw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jXIRCvm0; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45f04d58292si13271241cf.146.2024.10.08.11.53.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:53:27 -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=jXIRCvm0; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJf-0007WW-5r; Tue, 08 Oct 2024 14:52:15 -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 1syFJR-0007SI-Id for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJL-0002SG-AI for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7db637d1e4eso4423333a12.2 for ; Tue, 08 Oct 2024 11:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413506; x=1729018306; 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=ieyGc0lcP2qslY/k/Zc8iH5sBXnxr9bzsD8Ux8bqk8s=; b=jXIRCvm0gkX77/oShekf80Q+AJ89BVl8pqpAkoOzx9h+cBwOuTzddiE/8hvJtHnJBT d9jDSmxnJdyRBcQb8DM7DKJZbvZs+deBJu5i+Qqy/SLyLt/n2wSuqrkVMqgRQ68VKcJH Lq06D75GqJskDeMT1nhiNWRjwLOglCjt0vv1mFBKxroijd02GnhUf+7Cqlm/7kZMIY7v SM4Ju4tqFGvLgbBLkcX2ZzMSLA4SYDTew0BphNxsG1W3PrmX0u6tu2xujoDY4uD0u0eu v/apMYQHsAplh53/j9/BkNzwLNws0noeYbXKVjT7NLBSig+VrAnIoyjmmjNaSmyA7DIq nGhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413506; x=1729018306; 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=ieyGc0lcP2qslY/k/Zc8iH5sBXnxr9bzsD8Ux8bqk8s=; b=uFD9luVGLPn58AEXQhjRVYroNwThQwQ6Q3RkdgynKNQ8eQdlNo+n885YKHYSKwaEpv knQlFQRLDYIf35NK/qgAC5kRkdHfsIedf/Ljir/WTH8NYSxLxuVoTzdnGxNZ3mzcbdbY 2siSXaPHhK4QVZkHLF6LVLA8GAfMfbnBVQK8pyXup2zQzlwv0h1qvpwvGi5gMhB6ua1d qhZEYyRU0SDrY1LEDk/sl6yZdc9c6Q0aRuZgzst+Fk+fVqXwrnSCk7O6uCDGHUD4P0fM I3sREIwQxLdZ6EmBPmX/BjwrH7NLX6UWXyUt57HwGnmbMwSy1+rNTdgb6GqsF09KXgJ/ h/Xw== X-Gm-Message-State: AOJu0Yzry8uh9979cwy13D7U8WwnUPBpPmpmuCfdPo4F539Bq0LbKnl3 PRsi5WBtuQNWdj+wE8NLgN5S01hx79SADEkZjlqj+hSfbL4/co2heHktRA+TPIgHQpBRQ2kWznT X X-Received: by 2002:a17:902:ec90:b0:20b:c1e4:2d6c with SMTP id d9443c01a7336-20bff1d8123mr266668675ad.57.1728413506291; Tue, 08 Oct 2024 11:51:46 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Michael Vogt , Laurent Vivier Subject: [PULL 03/14] linux-user: add openat2 support in linux-user Date: Tue, 8 Oct 2024 11:51:30 -0700 Message-ID: <20241008185141.20057-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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: Michael Vogt This commit adds support for the `openat2()` syscall in the `linux-user` userspace emulator. It is implemented by extracting a new helper `maybe_do_fake_open()` out of the exiting `do_guest_openat()` and share that with the new `do_guest_openat2()`. Unfortunately we cannot just make do_guest_openat2() a superset of do_guest_openat() because the openat2() syscall is stricter with the argument checking and will return an error for invalid flags or mode combinations (which open()/openat() will ignore). The implementation is similar to SYSCALL_DEFINE(openat2), i.e. a new `copy_struct_from_user()` is used that works the same as the kernels version to support backwards-compatibility for struct syscall argument. Instead of including openat2.h we create a copy of `open_how` as `open_how_ver0` to ensure that if the structure grows we can log a LOG_UNIMP warning. Note that in this commit using openat2() for a "faked" file in /proc will honor the "resolve" flags for RESOLVE_NO_{MAGIC,SYM}LINKS for path based access to /proc/self/exe (which is the only magic link we support for faked files). Note it will not catch special access via e.g. dirfd. This is not great but it seems similar to the exiting behavior when openat() is called with a dirfd to "/proc". Here too the fake file lookup may not catch the special file because no dirfd is used to determine if the path is in /proc. Signed-off-by: Michael Vogt Buglink: https://github.com/osbuild/bootc-image-builder/issues/619 Reviewed-by: Laurent Vivier Message-ID: <1c2c8c9db3731ed4c6fd9b10c63637c3e4caf8f5.1727795334.git.mvogt@redhat.com> Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 13 +++++ linux-user/syscall.c | 105 +++++++++++++++++++++++++++++++++++++- 2 files changed, 116 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index e08d088740..de5091c977 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2748,4 +2748,17 @@ struct target_sched_param { abi_int sched_priority; }; +/* from kernel's include/uapi/linux/openat2.h */ +struct target_open_how_ver0 { + abi_ullong flags; + abi_ullong mode; + abi_ullong resolve; +}; +#ifndef RESOLVE_NO_MAGICLINKS +#define RESOLVE_NO_MAGICLINKS 0x02 +#endif +#ifndef RESOLVE_NO_SYMLINKS +#define RESOLVE_NO_SYMLINKS 0x04 +#endif + #endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a666986189..2febc3bc3f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -602,6 +602,34 @@ static int check_zeroed_user(abi_long addr, size_t ksize, size_t usize) return 1; } +/* + * Copies a target struct to a host struct, in a way that guarantees + * backwards-compatibility for struct syscall arguments. + * + * Similar to kernels uaccess.h:copy_struct_from_user() + */ +static int +copy_struct_from_user(void *dst, size_t ksize, abi_ptr src, size_t usize) +{ + size_t size = MIN(ksize, usize); + size_t rest = MAX(ksize, usize) - size; + + /* Deal with trailing bytes. */ + if (usize < ksize) { + memset(dst + size, 0, rest); + } else if (usize > ksize) { + int ret = check_zeroed_user(src, ksize, usize); + if (ret <= 0) { + return ret ?: -TARGET_E2BIG; + } + } + /* Copy the interoperable parts of the struct. */ + if (copy_from_user(dst, src, size)) { + return -TARGET_EFAULT; + } + return 0; +} + #define safe_syscall0(type, name) \ static type safe_##name(void) \ { \ @@ -653,6 +681,15 @@ safe_syscall3(ssize_t, read, int, fd, void *, buff, size_t, count) safe_syscall3(ssize_t, write, int, fd, const void *, buff, size_t, count) safe_syscall4(int, openat, int, dirfd, const char *, pathname, \ int, flags, mode_t, mode) + +struct open_how_ver0 { + __u64 flags; + __u64 mode; + __u64 resolve; +}; +safe_syscall4(int, openat2, int, dirfd, const char *, pathname, \ + const struct open_how_ver0 *, how, size_t, size) + #if defined(TARGET_NR_wait4) || defined(TARGET_NR_waitpid) safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, \ struct rusage *, rusage) @@ -8332,8 +8369,9 @@ static int open_net_route(CPUArchState *cpu_env, int fd) } #endif -int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *fname, - int flags, mode_t mode, bool safe) +static int maybe_do_fake_open(CPUArchState *cpu_env, int dirfd, + const char *fname, int flags, mode_t mode, + int openat2_resolve, bool safe) { g_autofree char *proc_name = NULL; const char *pathname; @@ -8370,6 +8408,12 @@ int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *fname, } if (is_proc_myself(pathname, "exe")) { + /* Honor openat2 resolve flags */ + if ((openat2_resolve & RESOLVE_NO_MAGICLINKS) || + (openat2_resolve & RESOLVE_NO_SYMLINKS)) { + errno = ELOOP; + return -1; + } if (safe) { return safe_openat(dirfd, exec_path, flags, mode); } else { @@ -8416,6 +8460,17 @@ int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *fname, return fd; } + return -2; +} + +int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, + int flags, mode_t mode, bool safe) +{ + int fd = maybe_do_fake_open(cpu_env, dirfd, pathname, flags, mode, 0, safe); + if (fd > -2) { + return fd; + } + if (safe) { return safe_openat(dirfd, path(pathname), flags, mode); } else { @@ -8423,6 +8478,49 @@ int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *fname, } } + +static int do_openat2(CPUArchState *cpu_env, abi_long dirfd, + abi_ptr guest_pathname, abi_ptr guest_open_how, + abi_ulong guest_size) +{ + struct open_how_ver0 how = {0}; + char *pathname; + int ret; + + if (guest_size < sizeof(struct target_open_how_ver0)) { + return -TARGET_EINVAL; + } + ret = copy_struct_from_user(&how, sizeof(how), guest_open_how, guest_size); + if (ret) { + if (ret == -TARGET_E2BIG) { + qemu_log_mask(LOG_UNIMP, + "Unimplemented openat2 open_how size: " + TARGET_ABI_FMT_lu "\n", guest_size); + } + return ret; + } + pathname = lock_user_string(guest_pathname); + if (!pathname) { + return -TARGET_EFAULT; + } + + how.flags = target_to_host_bitmask(tswap64(how.flags), fcntl_flags_tbl); + how.mode = tswap64(how.mode); + how.resolve = tswap64(how.resolve); + int fd = maybe_do_fake_open(cpu_env, dirfd, pathname, how.flags, how.mode, + how.resolve, true); + if (fd > -2) { + ret = get_errno(fd); + } else { + ret = get_errno(safe_openat2(dirfd, pathname, &how, + sizeof(struct open_how_ver0))); + } + + fd_trans_unregister(ret); + unlock_user(pathname, guest_pathname, 0); + return ret; +} + ssize_t do_guest_readlink(const char *pathname, char *buf, size_t bufsiz) { ssize_t ret; @@ -9195,6 +9293,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, fd_trans_unregister(ret); unlock_user(p, arg2, 0); return ret; + case TARGET_NR_openat2: + ret = do_openat2(cpu_env, arg1, arg2, arg3, arg4); + return ret; #if defined(TARGET_NR_name_to_handle_at) && defined(CONFIG_OPEN_BY_HANDLE) case TARGET_NR_name_to_handle_at: ret = do_name_to_handle_at(arg1, arg2, arg3, arg4, arg5); From patchwork Tue Oct 8 18:51: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: 833616 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450510wrv; Tue, 8 Oct 2024 11:54:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUv0Dqq5yK7kW2nJrnJZIGuapJ5RHCjgk1tVYb/zjZAB0Cxq7qc2jWaNgelm/GDSJAaD11Mmg==@linaro.org X-Google-Smtp-Source: AGHT+IER/kmEN11ZRCoPbRuX8NInoPprQhKLS2pU2M59kVDiv2zrwUt+04FEm4w/KxUFmIyZl4G4 X-Received: by 2002:a05:620a:1910:b0:7a9:c160:c80b with SMTP id af79cd13be357-7ae6f432b34mr2683170485a.8.1728413655985; Tue, 08 Oct 2024 11:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413655; cv=none; d=google.com; s=arc-20240605; b=T7GNnZZ1x4H4J/LyyFVJp55cd3Mv6NFdxAvW3hHDwXnACwlW+gJs+U7CWyFgjrfWi1 I1Vkuv7tIlnjGkOIJ+w0VhOTVQsySTaSBURB3JmeB12GKdKQ7DNvFiuPAoiPEifY86ro Nt27hjXCjY6rGenOrZCfYD/tVyo1wJtFeDGODUI/SjnRH9wpsnd4Cqtgll6qS2gEyJqt S1c6stYs86SDGO0MgUYXfzI5SULywZZ39b7gbOJ1siV5rf8yTQ+D8AIhdrR02Rp/tWZ7 FuUkH8lIf0LAYoAd8vLkETo7qG4nsLZJ2bUgsbNX945f5DA6iEvapB0qufeY+hvuzx/T Nwwg== 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:dkim-signature; bh=8nnulTAtUcmZmZfuGcf5eSLVvnbBtACxcyEvOVNzWDI=; fh=bfzdhCcU3ZfQ17YMkDaytQs6HssTokv83KlNoAueAKU=; b=FClY39rMCRtv9N8nzZEQvW2/GPztzTauClRTl7LJ5Jp21rBk/HZ6HP+gJy/NGtKR12 3J4dicEP5byOOQv/HAINu6aglTv2lFvrINMPk+hEnK5Z4OSdxEVlLUB+hmA0KXYON5aX SvaRKvDFVpbMxCVuu8oDWmiVblcAUfNS//aXAkcRJOAfMmXVkIhjP0kNWZTQh0BvJLCP Xs404gzrIfakwS+qasCYh1DaYbuL1TWM4iyESTvdwuJ1I+a1i2e7VYl1jruJfFzPYelt xB3gZks6YhqDmrXnRrArfBJvT9Ofu7RB9R/icIUXqfhqu5856rj1X+JV93TsTTF8rdoC bgXA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HOWkmtFX; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae75764cd9si902301185a.455.2024.10.08.11.54.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:54:15 -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=HOWkmtFX; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJb-0007Tx-0Z; Tue, 08 Oct 2024 14:52:11 -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 1syFJP-0007Qn-OG for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJK-0002SM-32 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:57 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-71e0cd1f3b6so1567576b3a.0 for ; Tue, 08 Oct 2024 11:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413507; x=1729018307; 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=8nnulTAtUcmZmZfuGcf5eSLVvnbBtACxcyEvOVNzWDI=; b=HOWkmtFX5bWk+yQqu2HuS8tpUHsY0ETwB274GglsmoYDdncRCxTPc5Rczi6yVhATzE ARdxfVWmjC0za36gseFT7aB05hhXxH4r2IdvC3vnT8yjnelVxvNCXJoClLF+FxwlBpk2 3aJDpLVBYDQhkMmj6kS4XjJ16j3EqSbyN9YQxvzeZok3F3CATnXxEYgX3B6SZQjHr+oN YvHrynosqkD1J1zI/ugYuBtJdd05E4xO/rOlVwUGjypwQjG3rLeFY+RaBwBWSzWYnNdc 3JC5Y5VLS3WVmok75veLcc8KIjMfokxrmSRhodYqouW5r2Qd3MR90JtBuZelTqWRGDid gPgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413507; x=1729018307; 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=8nnulTAtUcmZmZfuGcf5eSLVvnbBtACxcyEvOVNzWDI=; b=suaXGOox/eZ+P7AbiMxWlxLcD6czEmNmS/7zhkZ2qCyMdMm6V7MA6bYcwqZwSSYs1j XSm88zGj+VCVAvArMWikVsSU+6uTPkGWgh5ZfVr+Rlr7rNAlOcBNuHpLKP6TsT+x2bZH BpfdFVERe+Zpi0DsyAkxQ0bDCaqCAo3OdztDUenLx+xSxwFI6KXuWMId4eoeGC1yRJel 55lCHHS7/WplD0zOGwou1oInQa/K0nExuK6zGPu2+9xhkZDgqtpbMlo6CkPt/23l0OPY Wa228rDz1pPRVIrj8FjkwSjpFDmoZVP26HHviQnd2IjNz9W3x0J1qlNeLH/fA/vXGuTz bUwA== X-Gm-Message-State: AOJu0Yw4b8xD1yKVtce+dkFp1FF/d6FEQxTUr2os5iTkoOQwoVYX4QbH Zuo/naQGjKLR9uAsGWl54dHIdLfmnRxDDD96tf3Rm/AWCxoHAd6xGFK21voVdPK54ZKODP2MSA8 3 X-Received: by 2002:a05:6a21:1192:b0:1d8:a354:1acd with SMTP id adf61e73a8af0-1d8a35421f0mr141040637.25.1728413507435; Tue, 08 Oct 2024 11:51:47 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Michael Vogt , Laurent Vivier Subject: [PULL 04/14] linux-user: add strace support for openat2 Date: Tue, 8 Oct 2024 11:51:31 -0700 Message-ID: <20241008185141.20057-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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: Michael Vogt This commit adds support for the `openat2()` to `QEMU_STRACE`. It will use the `openat2.h` header if available to create user readable flags for the `resolve` argument but does not require the header otherwise. It also makes `copy_struct_from_user()` available via `qemu.h` and `open_how_ver0` via `syscall_defs.h` so that strace.c can use them. Signed-off-by: Michael Vogt Reviewed-by: Laurent Vivier Message-ID: [rth: Add braces around the expanded how structure, like strace(3)] Signed-off-by: Richard Henderson --- linux-user/qemu.h | 9 ++++++++ linux-user/syscall_defs.h | 5 +++++ linux-user/strace.c | 47 +++++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 8 +------ linux-user/strace.list | 3 +++ meson.build | 1 + 6 files changed, 66 insertions(+), 7 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 2e90a97175..98ad848ab2 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -313,6 +313,15 @@ static inline bool access_ok(CPUState *cpu, int type, int copy_from_user(void *hptr, abi_ulong gaddr, ssize_t len); int copy_to_user(abi_ulong gaddr, void *hptr, ssize_t len); +/* + * copy_struct_from_user() copies a target struct to a host struct, in + * a way that guarantees backwards-compatibility for struct syscall + * arguments. + * + * Similar to kernels uaccess.h:copy_struct_from_user() + */ +int copy_struct_from_user(void *dst, size_t ksize, abi_ptr src, size_t usize); + /* Functions for accessing guest memory. The tget and tput functions read/write single values, byteswapping as necessary. The lock_user function gets a pointer to a contiguous area of guest memory, but does not perform diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index de5091c977..0ade83745e 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2749,6 +2749,11 @@ struct target_sched_param { }; /* from kernel's include/uapi/linux/openat2.h */ +struct open_how_ver0 { + __u64 flags; + __u64 mode; + __u64 resolve; +}; struct target_open_how_ver0 { abi_ullong flags; abi_ullong mode; diff --git a/linux-user/strace.c b/linux-user/strace.c index b4d1098170..d3cdd09dc1 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -13,6 +13,9 @@ #include #include #include +#ifdef HAVE_OPENAT2_H +#include +#endif #include #include "qemu.h" #include "user-internals.h" @@ -1063,6 +1066,18 @@ UNUSED static const struct flags open_flags[] = { FLAG_END, }; +UNUSED static const struct flags openat2_resolve_flags[] = { +#ifdef HAVE_OPENAT2_H + FLAG_GENERIC(RESOLVE_NO_XDEV), + FLAG_GENERIC(RESOLVE_NO_MAGICLINKS), + FLAG_GENERIC(RESOLVE_NO_SYMLINKS), + FLAG_GENERIC(RESOLVE_BENEATH), + FLAG_GENERIC(RESOLVE_IN_ROOT), + FLAG_GENERIC(RESOLVE_CACHED), +#endif + FLAG_END, +}; + UNUSED static const struct flags mount_flags[] = { #ifdef MS_BIND FLAG_GENERIC(MS_BIND), @@ -3483,6 +3498,38 @@ print_openat(CPUArchState *cpu_env, const struct syscallname *name, } #endif +#ifdef TARGET_NR_openat2 +static void +print_openat2(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) +{ + struct open_how_ver0 how; + + print_syscall_prologue(name); + print_at_dirfd(arg0, 0); + print_string(arg1, 0); + + if ((abi_ulong)arg3 >= sizeof(struct target_open_how_ver0) && + copy_struct_from_user(&how, sizeof(how), arg2, arg3) == 0) { + how.flags = tswap64(how.flags); + how.mode = tswap64(how.mode); + how.resolve = tswap64(how.resolve); + qemu_log("{"); + print_open_flags(how.flags, 0); + if (how.flags & TARGET_O_CREAT) { + print_file_mode(how.mode, 0); + } + print_flags(openat2_resolve_flags, how.resolve, 1); + qemu_log("},"); + } else { + print_pointer(arg2, 0); + } + print_raw_param(TARGET_ABI_FMT_lu, arg3, 1); + print_syscall_epilogue(name); +} +#endif + #ifdef TARGET_NR_pidfd_send_signal static void print_pidfd_send_signal(CPUArchState *cpu_env, const struct syscallname *name, diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2febc3bc3f..1354e75694 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -608,8 +608,7 @@ static int check_zeroed_user(abi_long addr, size_t ksize, size_t usize) * * Similar to kernels uaccess.h:copy_struct_from_user() */ -static int -copy_struct_from_user(void *dst, size_t ksize, abi_ptr src, size_t usize) +int copy_struct_from_user(void *dst, size_t ksize, abi_ptr src, size_t usize) { size_t size = MIN(ksize, usize); size_t rest = MAX(ksize, usize) - size; @@ -682,11 +681,6 @@ safe_syscall3(ssize_t, write, int, fd, const void *, buff, size_t, count) safe_syscall4(int, openat, int, dirfd, const char *, pathname, \ int, flags, mode_t, mode) -struct open_how_ver0 { - __u64 flags; - __u64 mode; - __u64 resolve; -}; safe_syscall4(int, openat2, int, dirfd, const char *, pathname, \ const struct open_how_ver0 *, how, size_t, size) diff --git a/linux-user/strace.list b/linux-user/strace.list index dfd4237d14..ef658224fc 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -715,6 +715,9 @@ #ifdef TARGET_NR_openat { TARGET_NR_openat, "openat" , NULL, print_openat, NULL }, #endif +#ifdef TARGET_NR_openat2 +{ TARGET_NR_openat2, "openat2" , NULL, print_openat2, NULL }, +#endif #ifdef TARGET_NR_osf_adjtime { TARGET_NR_osf_adjtime, "osf_adjtime" , NULL, NULL, NULL }, #endif diff --git a/meson.build b/meson.build index 33954b3eba..4ea1984fc5 100644 --- a/meson.build +++ b/meson.build @@ -2481,6 +2481,7 @@ config_host_data.set('CONFIG_LINUX_MAGIC_H', cc.has_header('linux/magic.h')) config_host_data.set('CONFIG_VALGRIND_H', cc.has_header('valgrind/valgrind.h')) config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h')) config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) +config_host_data.set('HAVE_OPENAT2_H', cc.has_header('linux/openat2.h')) config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) config_host_data.set('HAVE_SYS_DISK_H', cc.has_header('sys/disk.h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) From patchwork Tue Oct 8 18:51: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: 833612 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450156wrv; Tue, 8 Oct 2024 11:53:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/kY6ZwdepD8LZJbpV0DAtwavLH6BdNZD8brLvM++VBvmgO3QRL3nvh0nzm5fj2UkQHcDZrg==@linaro.org X-Google-Smtp-Source: AGHT+IH06BvS78HjwPfjNhWqrD6QKt3nlfnJGH69LVGwmlL8+rSxwpFhI0vln20/nXA5HWqLC/yp X-Received: by 2002:a05:622a:3d1:b0:458:333b:335f with SMTP id d75a77b69052e-45d9bb4323amr231770011cf.49.1728413596048; Tue, 08 Oct 2024 11:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413596; cv=none; d=google.com; s=arc-20240605; b=P4GZZJ2bG6FiOrWhl9iKuk96FQNkJCVJwD0ZZAGlPNCtUMHMd+lYQs8rbBCtLfOMwr lG+qcj/hegLkyjDo+dkPpeqFoULneZbjp7RfhOx+haluE8Ob9SmID4wXlgHp6Yq1ToA1 i98rNJNnUPhlt+F+5STpC/UCc6eUPaOPFxn3D1cxeh6+RLBdVzOIbKhAOhBXt1rxmUaq xX4O43BRH29R+M3L1GmvbR23WckF57Bhvo2PhQKcPEabP9u2+hzfpmHqF+YsmumBSBJD 02ptkQExlePjxF2UnV59DOPj80Z8FEAtLiznCfGufjGAd/uWymhVQm3mIItdcPdTB3rQ IIhQ== 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:dkim-signature; bh=o3MlKySkLCqcubwj2AlCHtEZtre6EurFM45v8Ib7p+Y=; fh=q3ib3EcYMLZG/asL75HqGNq22y0B7nID0VMnAoDZxT4=; b=EZPcSYquXFnc7JygwkwcLkWGi4G2Jj5FvsBpQUCyw9VFstIkUfHml4957hx8mSpibv werIknFqJRigbx1fYzqsQvGeDBVDGfip8wM6oGTuKfNEVQax1cDlTGSfRsbia1ZIuqaK JJdG3C7T5/kU3S1UdatWUv6dBtwLYf9LmQiosCaLHzyZ0Xo4RXr74snpvEe2OXuMtGXQ ReznkII9n6YxUj1iuSi/nMQrG4corZQOJriIR6hytm4GF+jF7e2BpqBS4nbDRycluE8a +STywd17dOno85bz/f7s/MGfkqtL4Yf191cDSEEFD8FGTtEgzWMqPg5Za2awLbk14UgJ gu6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ckAE1xcH; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45effbb8ad6si15186411cf.799.2024.10.08.11.53.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:53:16 -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=ckAE1xcH; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJU-0007TW-Uv; Tue, 08 Oct 2024 14:52:04 -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 1syFJP-0007Qo-Q5 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJK-0002SQ-B1 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:56 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-20b1335e4e4so59268885ad.0 for ; Tue, 08 Oct 2024 11:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413508; x=1729018308; 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=o3MlKySkLCqcubwj2AlCHtEZtre6EurFM45v8Ib7p+Y=; b=ckAE1xcHhhyryqfgq6V8xT8/ESnVNIJOmcbSF05SvmOZaMq9YBMvqMNr8BsrjE/n1h FyjiLbRL8xhm64z6paSkVJFLR+qihdh7hWV6hMVbhfpvcLURLZvIQKZFatyNSUn2+l4H F015CgmNetOteGcZEckNBl81+5HSTrLThOWsvkHZ5d7yd4UBQYxX1wiPlpP4up9HIxMB Pi8qbEIb0fcoa7EeNXc9TfcmwV3xzpeETHOSaZ9uoBeLsEJuCXRguadE/QwP/cNjqp2N 5fj93gKamV0TDpqtv8fseJ3Dd8GFVDz3ccj69EKxJf+BAMXdddp5uDODbz0MdigmuOqq eDHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413508; x=1729018308; 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=o3MlKySkLCqcubwj2AlCHtEZtre6EurFM45v8Ib7p+Y=; b=MYKl+jAU10dVF1M6z1P/Bc6E7Ebj3tiHzn3vI8OKd4hJxJD9DX1SrmOo9u8wJpKTaI o4qihh4FJPT2+BeDUMtF4KAtcz69kJ7bw8d0Nw7jZLCcZ4jl9I5x1/oS5Qdfpfoxvujh NseHrE1eRl9IFdGAV1UPQUsUhE3n1kQ+59y4s0nVM+lwrI3f19i9TDDFk5Zr6KHYpSmS 73rjzrXbQCF4x5bVmXQffpeyATVlrgBWSz0Q7OyYuaSJwuCici/N4JJyVQOA69Y5wszT g7g609yHl1je2WHzfNiMVV4+XroSXjB0wXln5P6dpjmrTqYIB0MKoLw87eUCDkfhAo2f vObw== X-Gm-Message-State: AOJu0YxBEslOme7sjhVdIoNuuoo8tibHx2VoTx2Oy4cKbiXgLqgGESvC QgDBWnwgBYdmI7prVzSSfmiZvJkyAqm6vJWS/otoKe3iibsMM5yEpJDYfM+QS/k+CmKS/xrW7t0 I X-Received: by 2002:a17:902:fc4e:b0:202:4666:f018 with SMTP id d9443c01a7336-20bfdfd2693mr274481165ad.15.1728413508303; Tue, 08 Oct 2024 11:51:48 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Ilya Leoshkevich Subject: [PULL 05/14] linux-user: Trace wait4()'s and waitpid()'s wstatus Date: Tue, 8 Oct 2024 11:51:32 -0700 Message-ID: <20241008185141.20057-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 Borrow the code for formatting the most frequent WIFEXITED() and WIFSIGNALED() special cases from from the strace's printstatus(). Output examples: 474729 wait4(-1,0x7f00767ff0a0,0,(nil)) = 474733 (wstatus={WIFEXITED(s) && WEXITSTATUS(s) == 1}) 475833 wait4(-1,0x7f7de61ff0a0,0,(nil)) = 475837 (wstatus={WIFSIGNALED(s) && WTERMSIG(s) == SIGKILL}) 1168 waitpid(1171,0x7f44eea00340,0) = 1171 (wstatus={WIFSIGNALED(s) && WTERMSIG(s) == SIGKILL}) Signed-off-by: Ilya Leoshkevich Message-ID: <20241001193244.14939-1-iii@linux.ibm.com> [rth: Drop extra output for NULL wstatus or error reading.] Signed-off-by: Richard Henderson --- linux-user/strace.c | 57 ++++++++++++++++++++++++++++++++++++++++++ linux-user/strace.list | 6 +++-- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index d3cdd09dc1..cf9eaf71c9 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -4215,6 +4215,63 @@ print_ioctl(CPUArchState *cpu_env, const struct syscallname *name, } #endif +#if defined(TARGET_NR_wait4) || defined(TARGET_NR_waitpid) +static void print_wstatus(int wstatus) +{ + if (WIFSIGNALED(wstatus)) { + qemu_log("{WIFSIGNALED(s) && WTERMSIG(s) == "); + print_signal(WTERMSIG(wstatus), 1); + if (WCOREDUMP(wstatus)) { + qemu_log(" && WCOREDUMP(s)"); + } + qemu_log("}"); + } else if (WIFEXITED(wstatus)) { + qemu_log("{WIFEXITED(s) && WEXITSTATUS(s) == %d}", + WEXITSTATUS(wstatus)); + } else { + print_number(wstatus, 1); + } +} + +static void print_ret_wstatus(abi_long ret, abi_long wstatus_addr) +{ + int wstatus; + + if (!print_syscall_err(ret) + && wstatus_addr + && get_user_s32(wstatus, wstatus_addr)) { + qemu_log(TARGET_ABI_FMT_ld " (wstatus=", ret); + print_wstatus(wstatus); + qemu_log(")"); + } + qemu_log("\n"); +} +#endif + +#ifdef TARGET_NR_wait4 +static void +print_syscall_ret_wait4(CPUArchState *cpu_env, + const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) +{ + print_ret_wstatus(ret, arg1); +} +#endif + +#ifdef TARGET_NR_waitpid +static void +print_syscall_ret_waitpid(CPUArchState *cpu_env, + const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) +{ + print_ret_wstatus(ret, arg1); +} +#endif + /* * An array of all of the syscalls we know about */ diff --git a/linux-user/strace.list b/linux-user/strace.list index ef658224fc..f8899710b5 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1662,13 +1662,15 @@ { TARGET_NR_vserver, "vserver" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_wait4 -{ TARGET_NR_wait4, "wait4" , "%s(%d,%p,%d,%p)", NULL, NULL }, +{ TARGET_NR_wait4, "wait4" , "%s(%d,%p,%d,%p)", NULL, + print_syscall_ret_wait4 }, #endif #ifdef TARGET_NR_waitid { TARGET_NR_waitid, "waitid" , "%s(%#x,%d,%p,%#x)", NULL, NULL }, #endif #ifdef TARGET_NR_waitpid -{ TARGET_NR_waitpid, "waitpid" , "%s(%d,%p,%#x)", NULL, NULL }, +{ TARGET_NR_waitpid, "waitpid", "%s(%d,%p,%#x)", NULL, + print_syscall_ret_waitpid }, #endif #ifdef TARGET_NR_write { TARGET_NR_write, "write" , "%s(%d,%#x,%d)", NULL, NULL }, From patchwork Tue Oct 8 18:51:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833617 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450514wrv; Tue, 8 Oct 2024 11:54:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXRlovPXWfm2GxbxENWTuAguAYdhS3QS8TY0+hSHl3e+hkgSB2t2t92JZ2T3KrkUNeQffM2Dg==@linaro.org X-Google-Smtp-Source: AGHT+IHu1+vjiICTSa6V2bh9SKnbx61WruCzAS2z0ch84o8WPoGEDsHIb5FjIEZhtGl0XVto0uLU X-Received: by 2002:a05:620a:44d2:b0:7ac:bb00:cd42 with SMTP id af79cd13be357-7ae6f454016mr2681075285a.27.1728413657816; Tue, 08 Oct 2024 11:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413657; cv=none; d=google.com; s=arc-20240605; b=J4nZZtt1BzLe/N+rSUbjyGVOt/SbrW0P6AJpuD3UfLVvtRJOXNnXbnqbPEWdBHw1Uj 6tZh7TJncTFJLScjLHBO9rCplYV58tBLJpAy6m2qoJ1REPUAiMOzJZdLeamjfCbv18SW ywmzSgC2FlDwjP4qmeUolTyLdcC4gQMICsqJH62SQ4WNkZ+CHWyPk6RWhnaAIt2JwpKa udWzwIMPRuVK2Dx2ol9cee/Bk+iNDD4VtHQ5966GeDZt5Po5QqkM0q/KiqH40odD7hKm WB25wMnrE5bdIjVA+vy0SMEtOu2CYRPxaBimAwiQpi31pvjKmqZ8abJ6LAD/J2SEy2FS Y61g== 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:dkim-signature; bh=5CYklN5kY6AhJz0z8fnMo7i52/61zUcEwxCjMHlZ3PY=; fh=VA5fFQhEMLAFY8N/eU6MrxAxygDfRSReAsnt7AOK3f8=; b=b9sp/WuZBN46u9T8zExPOD3CStlWdsXtC581o+L2gdLj0yIDfAOwLScLPedNBU5IVX GnLFz10lEaeks2iHddRakdBw2vN4jtiKbirFgkvooz5yTGZnatuZTrF/s61sAPjM9XEc h68cSkaOg+IH5VPnTDoA0ohpQwjksFgXOsfa52oltSbNI8DI4wgC0ylfbmMgSA75gJ8a +VUUWXC8sXxEktMCRq68dzyma2FONEzqLAYDiJ2LHe01Wrb+zhc+mGnSi5kOTFsFGvC1 b9QGSFYWM0ysn83x4eeMgr8ohCnIrToD6BsXd+DV5BnL5KdeokZiISPJ9uQyW4zNa1b/ 1b2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XtdWt77C; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae757654f1si913266385a.497.2024.10.08.11.54.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:54:17 -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=XtdWt77C; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJQ-0007Qd-VZ; Tue, 08 Oct 2024 14:52:00 -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 1syFJL-0007QL-W2 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:56 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJJ-0002SU-67 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:55 -0400 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3a393010110so2653375ab.0 for ; Tue, 08 Oct 2024 11:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413509; x=1729018309; 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=5CYklN5kY6AhJz0z8fnMo7i52/61zUcEwxCjMHlZ3PY=; b=XtdWt77C+X/VuILR9Fehp0IopcAy93KLFGIXKECKQ7JAZE3MkouIabQAwQ2BMe05iW Hucdiw3Un2R1+fwm/lsCMRjiSEehgPkR58oYBAKKBQNhtc7PO4dhm0os1pN/f2PLjZjk cLAEK6kTe37Mn8OCuhrpGqdH83lxlcpy8BSje+zRJt3nQBhHESJr4PeGWWjCjwfwHuoE 2yPC0SNmvcZCS2TM+4V2IqpiZ7t8RjnsInrzovmywdkcOyLO+raF+jkXoRDtOjssILQc MDNNTN67twIxFUzpNOE+KzAKm8pIWWZP2LAD03yuIXJeDusqDPxjLbMwu9nql4ngjaXK 5fPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413509; x=1729018309; 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=5CYklN5kY6AhJz0z8fnMo7i52/61zUcEwxCjMHlZ3PY=; b=LMlnVus3uBkfpRTDKEaHI1UuIDGf+Ypg+zVbQy003IH8uvAqklzKVebzjGTwTx06zG 3JoIkKzz0IlvuOP3CTGD/Cgbs49mSgCXrbbyAFyod2SJULNN4jL1IjRJUd3ghJPq8nV4 J2DEg4ZVpRf85bEggUZwtvCHgtOyKhhl0j8Qf5qBXXlmzypnL2nDnStlHlIM+zGhlnWS 5KOjK4NBZ7zEzntjcDuRf69WG484gCaaea+GCysVyN70OFiN1wLtGqadqyV2XpWz/0ZZ XVlpE5GSL0b01g49wRcQySes/MZ4QF5StqYpFNtbWf8qOSDyzcb6XZuq8UYK0K9Dsg/X fhVg== X-Gm-Message-State: AOJu0YwMYrjqfCCiNBJ1SV5fGxVFmWUh7/8+IIq2xrwAHbt9kVoqtDRP 94RfQn8UaloUVvdCvO9Ak+Vg0DwmLofZXRwD5xSsiRyvEHvpZPJNjlS6WLFWees4JHuDHLb6uuy x X-Received: by 2002:a05:6e02:b29:b0:39f:60d7:813b with SMTP id e9e14a558f8ab-3a375bc6844mr162725195ab.22.1728413509277; Tue, 08 Oct 2024 11:51:49 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PULL 06/14] linux-user: Correct print_sockaddr() format Date: Tue, 8 Oct 2024 11:51:33 -0700 Message-ID: <20241008185141.20057-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::130; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x130.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: Philippe Mathieu-Daudé When the %addr argument can not be accessed, a double comma is logged (the final qemu_log call prepend a comma). Move the comma from the final qemu_log to the preceeding switch cases that had omitted it. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20240807124306.52903-2-philmd@linaro.org> Acked-by: Ilya Leoshkevich [rth: Move comma into the various switch cases.] Signed-off-by: Richard Henderson --- linux-user/strace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index cf9eaf71c9..dfdec58542 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -376,7 +376,7 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last) un->sun_path[i]; i++) { qemu_log("%c", un->sun_path[i]); } - qemu_log("\"}"); + qemu_log("\"},"); break; } case AF_INET: { @@ -386,7 +386,7 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last) ntohs(in->sin_port)); qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")", c[0], c[1], c[2], c[3]); - qemu_log("}"); + qemu_log("},"); break; } case AF_PACKET: { @@ -417,12 +417,12 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last) } qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); - qemu_log("}"); + qemu_log("},"); break; } case AF_NETLINK: { struct target_sockaddr_nl *nl = (struct target_sockaddr_nl *)sa; - qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}", + qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u},", tswap32(nl->nl_pid), tswap32(nl->nl_groups)); break; } @@ -432,14 +432,14 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last) qemu_log("%02x, ", sa->sa_data[i]); } qemu_log("%02x}", sa->sa_data[i]); - qemu_log("}"); + qemu_log("},"); break; } unlock_user(sa, addr, 0); } else { print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0); } - qemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last)); + qemu_log(TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last)); } static void From patchwork Tue Oct 8 18:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833609 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450108wrv; Tue, 8 Oct 2024 11:53:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUmJd8QxZsjhd8ty3ffRIinNFk2oh2AFA6Xc6axZoi7c3b3rgudbTNVktJ0oy257Z1Xg4cOPA==@linaro.org X-Google-Smtp-Source: AGHT+IE+3bvN8NcBADomY3oVA3fagZ232u8BTQWVF2mSfDV+95xt8f12YIyELvzBPpAaeG7xUlhz X-Received: by 2002:a05:622a:181a:b0:458:2405:3b76 with SMTP id d75a77b69052e-45d9ba1e738mr234163601cf.11.1728413588003; Tue, 08 Oct 2024 11:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413587; cv=none; d=google.com; s=arc-20240605; b=bSv2DQfZyNmPpjHWmhLseJxbNnhAMKVmeoS+vp/eVLFiRv8Z/9ApQ8/7UDh1konvTM QUWnmK6ltcpmu2m1fVMm6xK3jadXJznI995wHNQw/Ym9Y4CyHb9JtQ7nrtH6evND05/Y 5fEMmtxmYzJzwwTiIRxlD1D5/ApdkosFSIrg4qQM0Ap1/7GzJ13o9as3CYlOsKMskEVn zXvX61YxjKWHDfn12KmfFU5dKnmLClDchWmuxyRW8OxBwAu9LIGvUygFrSlD3Ak5f/3X 8DulHV0nl2Ccsz++U/aQQ9F964mWa2Yf/cGTohrXvDjrEVD8hEz9ou/udDrxp/6K09D/ il+A== 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:dkim-signature; bh=4lBUGHhECpofGFp4uwDS9iqEwNffUJsxDhRgO3S72WA=; fh=VA5fFQhEMLAFY8N/eU6MrxAxygDfRSReAsnt7AOK3f8=; b=YmOUXdL/8DtLi47///LPmO1JB4lbCU2ixkIXA84dAHvByQuEwnXXj3L1U8dZ0iOqPu PodGqTWWXgLmMGJdZtJNQFQ8S/hIFczDzKx6eLEqYexcq3V4hqyiJcZOauNn4smgEDmX I0KRTf7XvOKGPniqC/gAahkPT8q5Yxyg7wyDcuY5v3mmdM24smRCI0dpbAe5+Ngb9P9G 9ft0//OaJgzAGuUTDqE7JZAPnIgzaWDaB4fpcExeuzts70dy6gJAquni3jmC+ZzZAf0e 65t3j7I0G9CiZCFYUqi3Fc5DSVYQF4sXE5XVoOeL+pMnYhT/eiRSq9nUGM8SilaPIwu1 Zw8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Muue62Va; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45da74e9a1dsi89501421cf.187.2024.10.08.11.53.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:53: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=Muue62Va; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJe-0007Vm-KJ; Tue, 08 Oct 2024 14:52:14 -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 1syFJP-0007Qp-QN for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJL-0002Sa-B9 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:58 -0400 Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-3a39620ff54so1228565ab.1 for ; Tue, 08 Oct 2024 11:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413510; x=1729018310; 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=4lBUGHhECpofGFp4uwDS9iqEwNffUJsxDhRgO3S72WA=; b=Muue62VaQTiXytk/EfeMpD3XrOTUFiO6/nxW1CtXElk6axYRH11EQIqwuOFc8QJnSo npGE77O3K4ztt49sjzXn9zQVLDSwGxKabuYx6WDk9UyJ0uHSkzhaMwWFepApDPpBwnko xd2msSWgNPgHxVT5fHoPI2aRRTxnK31soE1Vl0PnRu0CGwmDFIQy2iOCfm8paJDvxvbi pwigVpnYS5T6tIr3B7Vi1xfopho4zN9HuYn67zH9YVCkYL5a5rKP5kCXmf02QLvIJ35I LzgfZCmHMeiDAV3WHFQyTFiV3tlkvQrRnE71U0aGHzQxyIOw61xI7KGNeIgfegJuxoAM xUDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413510; x=1729018310; 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=4lBUGHhECpofGFp4uwDS9iqEwNffUJsxDhRgO3S72WA=; b=p2iE7wK5R1K0LnRtolS5JOXrxprDEvlxmxaXOQ6ndSRA8pXVhJLR9zpbj+qiR2DsRz G7O+oBrTnMKIOmamHeo2HQpi13aOCKTqxFmcwQ+UGmubRQls8+1lubhdqL+f8dhm8GGJ B+KQaNMYKFEgeSfU0F6152b15XrAdQo9JAvBVU9L+juUeIKHT7iXOjOBZGKMWmgleBPT Oa+KSdphm11K/eGUA9yibULjlEk2LUk1/ehsXEkEU4uhMy9Ld1AfP0robYe2xFO+lRpc FbTVC2BqYxSs8GBScVFZ6+gPY6hE0arpBKNs5zSdkTzAmtqCflx0K6bpvhtax7fYofJs QgKA== X-Gm-Message-State: AOJu0YzS8RTsjy+C6NAfE7PozqRO4dmLuKoqw5bZajGFHs+T8y0vNee6 EoQhf63YBySkFZIGzbyV9RLJeL4jQsxFwrspFwQtpEEDw2eULJ5PEOPeAZyqv9G1p8qyZV3uh6O 7 X-Received: by 2002:a05:6e02:1fc8:b0:3a0:4d1f:519c with SMTP id e9e14a558f8ab-3a375976acfmr161764005ab.3.1728413510166; Tue, 08 Oct 2024 11:51:50 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PULL 07/14] linux-user: Display sockaddr buffer as pointer Date: Tue, 8 Oct 2024 11:51:34 -0700 Message-ID: <20241008185141.20057-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12c; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x12c.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: Philippe Mathieu-Daudé Rather than 'raw param', display as pointer to get "NULL" instead of "0x00000000". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Ilya Leoshkevich Message-ID: <20240807124306.52903-3-philmd@linaro.org> 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 dfdec58542..b72fcd515f 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -437,7 +437,7 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last) } unlock_user(sa, addr, 0); } else { - print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0); + print_pointer(addr, 0); } qemu_log(TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last)); } From patchwork Tue Oct 8 18:51: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: 833620 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450640wrv; Tue, 8 Oct 2024 11:54:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVTlVAgZo/L2KnaaHiGmcVGXGirqpHYc43SI1zqL+c+JwbLrmF74kAhJ/EQyOmoRGrPESrCOA==@linaro.org X-Google-Smtp-Source: AGHT+IH3ZjmWFxScPUo/JuFTmL0NNfjQHnItrQOu0v5YYysGP6AJ+i1nv3nTfz2VvvVNKZ3xdY4n X-Received: by 2002:a05:620a:3181:b0:7af:ce72:f341 with SMTP id af79cd13be357-7afce735cc8mr223704285a.9.1728413677202; Tue, 08 Oct 2024 11:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413677; cv=none; d=google.com; s=arc-20240605; b=KHJiUJtlaNSQwpOg4c3oXD3o7Gya3uFMCIx5V4Fr/u6G//CqwLiaSiEUHxMwvxf5sy tAzWLPzexuPsYCJOlIZ9snIN0Gnla6Bytycn1VoKG2PeDbgMuaRNwDDcu65pjuf/en68 gUsNTD1EC4NCYVV1UhCLvEChDqn6MKqKNlWt1497G9hkUmt9CKC34ZzR9fnET/VyQlhL BM9SgIMMDp6IpDdWMAhPF8CHO7B8tQVTtfcPOJzfGPxJ96Y3kot+0avZLd6QHLjTbcCK +mSsiDT153y5opNXAnn5Br38wsAkkm3tZBGQmUfnkIjKPzUNA3aTOzGL96OhQW1te2qi Uk3Q== 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:dkim-signature; bh=280plYgj9pKDnH+V9HZdJ+ePLYDZqB5eIDcpDzTLK4I=; fh=VA5fFQhEMLAFY8N/eU6MrxAxygDfRSReAsnt7AOK3f8=; b=IBCVIm+SQ5RhxQ866dixdCG0i/LX9VeAv5ZNy/a5zHOg+7/3k0z1V7Bm19DEG2q0/B Tp6tsE0QaMY4Y89gPD3yaCMZbMqulr8gtjZLIO1ypBVC5vheRXgUBoS76JgGRN7kM58k WeSGN4nFwyZrqi6hgvpMyjwpfMdMGZGAJcNn6efrqGI55ZC4fO9gsExOqq0anhFPkfgY FITIByN9hxGUoLqeXNMTxG5wbjrkpjJ157uMafHdXHMM6ReHrjVwPnqXAEjvylDobY7W ID4xcwObwh+V5dLAy/GQIGsMke71jC119f/PDU6+r/jeRBuVAiR1ceriXucnmhlNa30C Fwcg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WzJpZieP; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae757627d0si878310485a.431.2024.10.08.11.54.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:54:37 -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=WzJpZieP; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJV-0007TX-Ub; Tue, 08 Oct 2024 14:52:05 -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 1syFJP-0007Qu-RY for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJK-0002Se-6d for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:56 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-7d4f85766f0so4823303a12.2 for ; Tue, 08 Oct 2024 11:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413511; x=1729018311; 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=280plYgj9pKDnH+V9HZdJ+ePLYDZqB5eIDcpDzTLK4I=; b=WzJpZiePA48mCqtODV3EfjoJNr1+0kxfGubz4xebTpCFJ4csGdcoHcvf48mYi58JlW 4eCv6bs9CMm6gGDrnI3aXnGvf9yjnPhFa3y6N/BQ0Pkhguf6bZ8Q2uG9SGu/KVZ6jimJ fq6wt2uYHhr+EBSxJynMo9uFzkC82zgkl/7w1CrDwv6Tq6mXK0UI1iQPUHQ1S4FS9IaJ AIWcKgYtVtmFT9hGYxJ3vesdj5fRgaAaB7UE8bsUBIBOsJrBSB+wOczzkufM1pcfpACv L1MkcS1smDI8PA9Fb8AL0NZz/Ydvs68wopPohAap5A3Q1cCvhWoy6ve3UElpO4VGJBeY /ubA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413511; x=1729018311; 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=280plYgj9pKDnH+V9HZdJ+ePLYDZqB5eIDcpDzTLK4I=; b=b0fdboDuKttxKSKb5MmsFtdEm6NJJisqsazFWGvES+FX84wu/vuMawT1xqA9UbKrqf aeYKSZBkd43QBak2xkkFDVuC5wRzayLMS9CRx0bdqC3/j5P0j6nJqvgLlYp/e/++orUH +BpvqIDoCaim8Oi5HiFTMufdESeiTKkg2phJUKfqyQHiAyI1Hz1A/cIopmnO9Imf/wr9 iK5kr45mZEPMaKBwjdq4fLtNVAlMGagjYJ/9Kzsq8dZJym08LH0cLsW5WZ0FojDCuT6s xxgPMgNJP139RNfnAzoPNHaLCtnaGL2P3kv0Duc0lK2bJVghO7dUDIehFF+Zd+CChLxW 0Pnw== X-Gm-Message-State: AOJu0YwxjQXOvSGU/RTaF7aBdvhTtq8EnWzjva2vUI0epy72KSnpyu8o tG2LAKAH5fk0GbuAnD9pGESazlb9sBJZeYiuGoXAoqrvv8YXR1OCBeKvLTemIas3HR2sUKbW/6C T X-Received: by 2002:a05:6a20:c886:b0:1d5:a29:3173 with SMTP id adf61e73a8af0-1d6dfa42844mr25093834637.24.1728413511098; Tue, 08 Oct 2024 11:51:51 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PULL 08/14] linux-user: Factor print_buf_len() out Date: Tue, 8 Oct 2024 11:51:35 -0700 Message-ID: <20241008185141.20057-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Ilya Leoshkevich Message-ID: <20240807124306.52903-4-philmd@linaro.org> Signed-off-by: Richard Henderson --- linux-user/strace.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index b72fcd515f..245153c1ce 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1670,6 +1670,13 @@ print_buf(abi_long addr, abi_long len, int last) } } +static void +print_buf_len(abi_long addr, abi_long len, int last) +{ + print_buf(addr, len, 0); + print_raw_param(TARGET_ABI_FMT_ld, len, last); +} + /* * Prints out raw parameter using given format. Caller needs * to do byte swapping if needed. @@ -2757,8 +2764,7 @@ static void do_print_sendrecv(const char *name, abi_long arg1) qemu_log("%s(", name); print_sockfd(sockfd, 0); - print_buf(msg, len, 0); - print_raw_param(TARGET_ABI_FMT_ld, len, 0); + print_buf_len(msg, len, 0); print_flags(msg_flags, flags, 1); qemu_log(")"); } @@ -2776,8 +2782,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1) qemu_log("%s(", name); print_sockfd(sockfd, 0); - print_buf(msg, len, 0); - print_raw_param(TARGET_ABI_FMT_ld, len, 0); + print_buf_len(msg, len, 0); print_flags(msg_flags, flags, 0); print_sockaddr(addr, addrlen, 0); qemu_log(")"); From patchwork Tue Oct 8 18:51:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833622 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450850wrv; Tue, 8 Oct 2024 11:55:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWDak5iA2iwXocAeDN+LsO/xtupUPrZGb7rW1HctZ0yW+NoYY11YwUcOKZaYe+o3lR+atJIug==@linaro.org X-Google-Smtp-Source: AGHT+IEQaB/o0VyyadXtGcAKLCsESI3x9NfWfl9s7JFIStn8zvNrqaVXenbUlw4I64WBLFIxV4wv X-Received: by 2002:a05:6902:2503:b0:e1f:ebc5:22cb with SMTP id 3f1490d57ef6-e28fe40cb36mr115615276.27.1728413710790; Tue, 08 Oct 2024 11:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413710; cv=none; d=google.com; s=arc-20240605; b=lFaITd+d3JLIFXPdxj30ahbriAGoC8P02jy3w5wzfVDXdkW537DazOL+lk0PPw+xVG wHSX0VXEz+VqJ4XK7n6BAnVjIlGpikymoo0GXK8bOhY1C17xBfG6LCpCa0OrX+hDHTat 1CUoRQ2I3ncxYaN1hPh7JjE1OlbfxreytAVlpwmkz5gD6R36/Sv9hy6OZMhRiS6fmcfx GiJ42zc9BNVOs29qJX/c+IIm7gaCxUJU9besWHxFIzrTVQ/FaEt66DRFv5rSOdrXvu0g 6GNDCLlLyg3iqcCsztJozTg4JGq/VD/9vfrjhfU0avlGeNIgKxWjaBbnPx1b3XqgJfcX WTtg== 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:dkim-signature; bh=F2PtOJCUNqbnhgRp0PzmkQFuI5aOsUosexzj1Se6aBs=; fh=VA5fFQhEMLAFY8N/eU6MrxAxygDfRSReAsnt7AOK3f8=; b=CfLc4NbXu+LoBFiN1gnrdlZTR0u5qGGkGy7oRaTktraNi19aMiUoLbYcFhZb3zsP8y YUKIWxTa2/hiOqKXsiXsu9pI5M6JAmIgwdr5izHlbQBO2+dtaBtWjke3zl3uo32nccdC VF5TxDVlJPpbb39g4hTFP/cEtWvem0ug//OZupj7EbT3fldkt/wm/XEO4lz7Qns5DI4d Q7KikRGBfC/PjMvUu1lZl39M+D+eUAEyB3J1k4W4JenFLxifefNdOwHlG8VuoqgTa+zN 5DTXpqApnbIFEa/AQrZRR7PaBAHFD2+5y9aK7h2Dx4wthdQlDEjIhZNTO95sc9tHZH5O UoUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rW11cEZL; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae756625b1si893133985a.251.2024.10.08.11.55.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:55:10 -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=rW11cEZL; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJc-0007Uk-BE; Tue, 08 Oct 2024 14:52:12 -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 1syFJP-0007Qs-RE for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJL-0002Sm-A1 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:51:58 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-71e050190ddso1813995b3a.0 for ; Tue, 08 Oct 2024 11:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413512; x=1729018312; 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=F2PtOJCUNqbnhgRp0PzmkQFuI5aOsUosexzj1Se6aBs=; b=rW11cEZL+xp2lpFZYILKRLIQUxuRNA5t6Hg9xYgR2mhJXrnWNZaCCWXXlgZrZmiPfq 09I04DChgsdEo+qjKvstqELJSR1I12az6My/jKaoeiyNzyHQBoK5Ja7820wn/4XqyCoD yQpGiG0Skng1w08gQ5HxX1x/z+2EGzIIKyO9Zi2W3399TAr2phh6HgE9GjjaLP2uA7d4 Ocl04hyJKEKTpeKChaHcUrAFkh1Dfu/+HZvXWC/5tw9hy/c7IdgaBlImU4K/AQAywmCx w4XIujp2fvvoB7I0x5r2eft3iM42wafVMA4EroV1h65FMh5/z/uWRjSJ3AkfFebwROI7 cUVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413512; x=1729018312; 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=F2PtOJCUNqbnhgRp0PzmkQFuI5aOsUosexzj1Se6aBs=; b=OUfSaTHg9Z7DBQqiSOjp1UGyP9C9Ywgp5bN0jJUzkVNKRu35FDXcATrPA/VY9OG/vf KYwio+nkxDEPUK7/DDwUVIHERaqM5rBT6cYX3j8kM9TJ05o9BKjDslP1ZdMROBYbqSjD vax48R4JwkZYhlH+0qYkHOCawBpmkqEnpaVmNrCUdwnQ83fxxE02OmbrZC+bbzOdwf0j sKC/cK1sG+JbIa02gi5zZwecI3EIaAw1WjEvebE3tx2kKoxPtx6YTfYgk9EAIRDG6vQk imw2Kvt6ak8wjQfquTaJlxCB+Op6qaJWk3htC+JPDOQsJfBN/jViOQ6Kzo46CEdoaKLM MJWw== X-Gm-Message-State: AOJu0YxPw02RzKT6MlBa/+3H0lMtf31jtZDwpyrakkMnJSFLq82oeQPo 6pVJkTsCUP9C2a/C4LV6sD1pSu07dicSh01ASGopdiafbBFniSfmayuGCv9HWjGQjE3qgr1SHQp 9 X-Received: by 2002:a05:6a20:d492:b0:1d2:f124:a1cb with SMTP id adf61e73a8af0-1d6dfa27999mr24547657637.9.1728413511984; Tue, 08 Oct 2024 11:51:51 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PULL 09/14] linux-user: Add strace for sendto() Date: Tue, 8 Oct 2024 11:51:36 -0700 Message-ID: <20241008185141.20057-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Ilya Leoshkevich Message-ID: <20240807124306.52903-5-philmd@linaro.org> Signed-off-by: Richard Henderson --- linux-user/strace.c | 15 +++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 245153c1ce..0263e6a396 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3142,6 +3142,21 @@ print_bind(CPUArchState *cpu_env, const struct syscallname *name, } #endif +#ifdef TARGET_NR_sendto +static void +print_sendto(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) +{ + print_syscall_prologue(name); + print_sockfd(arg0, 0); + print_buf_len(arg1, arg2, 0); + print_flags(msg_flags, arg3, 0); + print_sockaddr(arg4, arg5, 1); + print_syscall_epilogue(name); +} +#endif + #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \ defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) static void diff --git a/linux-user/strace.list b/linux-user/strace.list index f8899710b5..64d24e16d0 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1288,7 +1288,7 @@ { TARGET_NR_sendmsg, "sendmsg" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sendto -{ TARGET_NR_sendto, "sendto" , NULL, NULL, NULL }, +{ TARGET_NR_sendto, "sendto" , NULL, print_sendto, NULL }, #endif #ifdef TARGET_NR_setdomainname { TARGET_NR_setdomainname, "setdomainname" , NULL, NULL, NULL }, From patchwork Tue Oct 8 18:51:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833610 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450109wrv; Tue, 8 Oct 2024 11:53:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3w0TMUVUQFxT2vKmVwMRpennCiV6Sq8hVTsnB/+RsYx8uTwPLiIefSqyxlRmKT3pO7UVPUQ==@linaro.org X-Google-Smtp-Source: AGHT+IHWMnsTDCWqlvx+ClbzGwUGPnQe9tUK/SE8bLjPP/HCLU5otWU5gN4GNx3L62gAwHEc8mkO X-Received: by 2002:a05:6214:4881:b0:6cb:c772:fbe5 with SMTP id 6a1803df08f44-6cbc772fc21mr25361066d6.30.1728413588003; Tue, 08 Oct 2024 11:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413587; cv=none; d=google.com; s=arc-20240605; b=T5hjjT92p6wJCEAfftuJ3U3b0r42XOgP5sQGo+UJd0BTcUyLafUuK2saJk68j/OhNz 4nO5s+/oqg+d8shD67ciw2xNimNci5gHqtb+OvThYO9WHl7s+nE7n/cBu8xh7V1SNS1a GoE4x7hvNvYzoAWacyHY6vwpsRdUd5s7blzzFzccYnkK3kIRl+z9Cef+TgG2GtZMRlAB 1saLssA+CEuEKqduL7AuzqYzMOHgSLmlTeTIxdwZD2fFtVVpX2uK9wpyoWFWPWCTVdst PzSbeuRWcGZPy5VGgOZFtx/eNy1xvY3nINT9V65btXuVhO1Jp3RplJHyySEbzFy/yyKJ DQkw== 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:dkim-signature; bh=wYBWpQBnXZ27uF3GVfCeocPGkAYUMjeFh2ALsFccVN8=; fh=tTjTfh/QwbpfIJ40uL4jnZOzWTJn3vAziy+Fmyen6KU=; b=S/4ty8241rAxQ6b0KHrI+Yo5P7AlUwNOjOAvelkjdvTVi1opqgoXD4Z5anDKFd/mKF Ll+WnGre8VlljeGcnxtoxyv+3uWSxkJMaFLc7/beJdlyyOSFNof2w/kQf8LVx9+TBgaA vn7ZAPPpWN3MOKgHi4FWQGQkFipggIYIGC9JCmqOHAN9HfQ/EETCuXcUo/DboiGyHx+n ymFmdM8quUbGxavYdkds+1LjCDaJYm4D4sRAnoBzKfrtGjOw1cCGLzPCxh3nRF4eQ5aK kRQANCQtZSn8sWbAHBSG+dQFlZl5ZuFSMVLFmHJMS+cGDp5vCGJDU56LA8mMNOt5BTxr NuBA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KWP0Qrk8; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cba46d7d9esi91869196d6.2.2024.10.08.11.53.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:53: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=KWP0Qrk8; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJf-0007XR-Pf; Tue, 08 Oct 2024 14:52:16 -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 1syFJS-0007SP-RY for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJL-0002T7-Ae for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:01 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-71dfe07489dso2210912b3a.3 for ; Tue, 08 Oct 2024 11:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413513; x=1729018313; 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=wYBWpQBnXZ27uF3GVfCeocPGkAYUMjeFh2ALsFccVN8=; b=KWP0Qrk8sgrfWvJflShrddoSYkn0AoCoeq3iCKJ2KVRPqfvKS5IOAUYeHFBjn1arWu ILE5Rw8mYx4wcNGk1y2fBfbCMW+pIXH9QYQirGyaNNg1A58rZ+hNEwtABk5EPZEopvq0 YjlSZ4A69Ba2IRuse5XYUrXtE35eQYRNyjInlWE/IsS/nd9dSE8B0htKe5K1wP5ERmP3 k+lclaCf76NYOZmulzWILscuUbz4cgv4jb6bWZZkeNycekHKltptcDCIsOkKermGCXzq lDH3AxM+ySLOC03XzC/iEeLABayhHWCidXxh6bp0lT+Uw7hJn8ihqfUsdRBmlRdZtJ/r 6b0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413513; x=1729018313; 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=wYBWpQBnXZ27uF3GVfCeocPGkAYUMjeFh2ALsFccVN8=; b=xBMvKeeE/Us1sCvCqW9pDIBi4GFKmvJf4XpeQ7qg45JxBqRxSHxSYUY+RTH82hBM2P FZNBxcsBW23Gdrhyp5zLJchKGgA+1VV5ZjkOMico50EGfoMfY0X3JFJj6T5qxZS8Ofmo BEJMSpqsVdAr6W1a5OdNNnuNn/FDpzffmQ5Mdl2EGjxyXnqn67XZEFWmquIRD/G4P507 GkWN8+Sc2EyVM6VpoZJzoRemtD/ZUs4Z++FE0hTHWlKjdJryjctu//4FeUaDnvHK715R JkIuXl1Qgq9cPlibdLI6Psr7qFiHNQQnguOAbuZlA+QXQibJL2Fc/dSVFgRHdwPVHDav TRUA== X-Gm-Message-State: AOJu0YzmocLBlF+sUhuKoD2Ai86fYHVEy8S4CJgEPoSLRra7nbLikw6u ThK1+bJhLzVFacuafECsSx4dCWcx5l8cIl+CcBRI/2yhNx4i7ik18QuksrqXg9ePgzELEz9zkce 0 X-Received: by 2002:a05:6a21:1798:b0:1d5:10c3:ae43 with SMTP id adf61e73a8af0-1d6dfa45775mr21831835637.21.1728413513002; Tue, 08 Oct 2024 11:51:53 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 10/14] linux-user: Add strace for recvfrom() Date: Tue, 8 Oct 2024 11:51:37 -0700 Message-ID: <20241008185141.20057-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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, T_SPF_TEMPERROR=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 From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20240807124306.52903-6-philmd@linaro.org> [rth: Do not dump output buffers.] Signed-off-by: Richard Henderson --- linux-user/strace.c | 17 +++++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 0263e6a396..c3eb3a2706 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3142,6 +3142,23 @@ print_bind(CPUArchState *cpu_env, const struct syscallname *name, } #endif +#ifdef TARGET_NR_recvfrom +static void +print_recvfrom(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) +{ + print_syscall_prologue(name); + print_sockfd(arg0, 0); + print_pointer(arg1, 0); /* output */ + print_raw_param(TARGET_ABI_FMT_ld, arg2, 0); + print_flags(msg_flags, arg3, 0); + print_pointer(arg4, 0); /* output */ + print_pointer(arg5, 1); /* in/out */ + print_syscall_epilogue(name); +} +#endif + #ifdef TARGET_NR_sendto static void print_sendto(CPUArchState *cpu_env, const struct syscallname *name, diff --git a/linux-user/strace.list b/linux-user/strace.list index 64d24e16d0..0d69fb3150 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1138,7 +1138,7 @@ { TARGET_NR_recv, "recv" , "%s(%d,%p,%u,%d)", NULL, NULL }, #endif #ifdef TARGET_NR_recvfrom -{ TARGET_NR_recvfrom, "recvfrom" , NULL, NULL, NULL }, +{ TARGET_NR_recvfrom, "recvfrom" , NULL, print_recvfrom, NULL }, #endif #ifdef TARGET_NR_recvmmsg { TARGET_NR_recvmmsg, "recvmmsg" , NULL, NULL, NULL }, From patchwork Tue Oct 8 18:51:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833621 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450753wrv; Tue, 8 Oct 2024 11:54:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVGxBHufZ7FNQpPnv/HasvysU9mlkptDF+5nD1j2/1e/XzKahLVmCM3cQZscU0036MUxbrBDw==@linaro.org X-Google-Smtp-Source: AGHT+IHqCOmWxIz3zlw43P3hKrjOnMnOpODfd7tUGqZE9zMUmf162wQbkq+Asi29sAVKQ0AjujoR X-Received: by 2002:ac8:7f09:0:b0:458:5161:e0ca with SMTP id d75a77b69052e-45d9baed416mr280749871cf.41.1728413693072; Tue, 08 Oct 2024 11:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413693; cv=none; d=google.com; s=arc-20240605; b=E/4kDVnhlbOQEqv2tasauk0VinY3ooeT+JVgIOuqKrVqfVNyWxyDQ0+8Qg+F46FrhC /3FPlKiGk7Uhl2+hEg1KR/AWyPjj3AyLp2BW8XxXKGNwIg2Hx4MpW7e5F8uRZZC0+CoW NYHsoce1cXmJmpdVCVnwaBIyDVbF1YhmvbgpW9KzMMhoiw/GY4vS4SCwWD9k4b6p3zO7 yXrXfzthNg/1Ev9uA0Yj8dXuqX/wyMguIb6eJlqca808OzEMq5JkCXeokdfHSjOG6lL0 ZVQVtRmsj+gMdzrGrUdz85sfnSNHR8Q857rQHC+9X+2pWqBM6eXT6FQreK7SsC7zE0Vy 6WlQ== 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:dkim-signature; bh=CvN0udLtupEne5xbmGMllUkO3gfAOouXveZw0bp9Mts=; fh=g1jmSm8gExqnCetj1a1Sa5xHoCqZ/paewyT+zCwPlKg=; b=kMTVXjtsLYWgGjVnvPP7ErTo3kcAq4MhttUwqZVrC+6b7Fd6fBVVzqQxVYOKwk+Kx0 wVVstfHYpYyCF+icNMbm4i7R32ZNsKo4vpyFJP7mttBE7tm4HC8ImjAug29B7mq7dIlb Tw9dJ4WLCmaoeUjI9Y2gz6qGjlGbfhLq8/Av5lCf7DGfqOIwTrETEmSYQIFSMqAdUBxB lpnDAif7buBAPd3U2NrUxKNdqcgxdNPnNw8t9Yid/PdysMjs3qpK9XTzcTSnh68gCUaF dJERS3EmXFrq7PE0Wv13VvVHB7zzBSyoZyvCMXlKoosfuH6i7rhi93F+LKyrdp8iJTpi YRtQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GsytaxmS; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45da74b03e1si92926381cf.77.2024.10.08.11.54.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:54:53 -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=GsytaxmS; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJc-0007UZ-6f; Tue, 08 Oct 2024 14:52:12 -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 1syFJS-0007SQ-SE for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJP-0002Tb-HJ for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-71de9e1f431so3496473b3a.3 for ; Tue, 08 Oct 2024 11:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413514; x=1729018314; 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=CvN0udLtupEne5xbmGMllUkO3gfAOouXveZw0bp9Mts=; b=GsytaxmSMxM2mwlcXgYfqOPCEpmAkAsywDL5dqFwoCJxQZ85cgYfG3Hm9sfb4/LAnB ELX3fbbTNYlVnbVgovtgtR6fE3R2/YLNzHQLPkAa7q9TUXVlUbqr0NUXEZLTgOVnb+3K 3gCfSmzimjFOxWK5TltgVaNNNh3EwiJb24HhYqJkhrshwZmQUYpaNKytA1j/Af6huuVc 5qMpaDZVY2pLT4ciB6d5eIwX2EoRNiCMlRyWDbj4dJbSQVEgVC6wY+96F8wsuLvJoHUd GiIET8jGtr+7sF9aq8othO/bnyj6veMP9EknwDsoA5PYWN8h4V3WLaxUw3IR3jzXvZWF sYOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413514; x=1729018314; 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=CvN0udLtupEne5xbmGMllUkO3gfAOouXveZw0bp9Mts=; b=rHVm4N2WOjZLb4J43R7MKZnu4hhMZcLVeQAfvmAhSNhyW1b5LunuhpoIyrFkQIk8Dr yvPwvsIX91pRvNp/eBnOhVHPzbgXdxvwuXEaep8/MCC/XIbYeTU/HHlFAQfLYCh2JPju qkMHqUBhV1eETgcJZvHfobIXHpjsgJQKgnkGuH3BE3LVrDTMmU7hlaQ45u+PTJUN1ryt PRyepB6nToVfdEoQ1COXOJmRuFty4+5BbKelGFCVenFfLehu34PC93T1apR9b5wBafIw xmqrwJ9FlXfkq4XTh36CbFJZEe5skOh3Ge0g48umTkqArUMxhVy013tcZ0scZuebK0wz pOuQ== X-Gm-Message-State: AOJu0YxrSDtERnoG4Dqcm1TzepF7svpAV+gRvx4ldoe7jBWGPGKzn55W p8aQLN+Fl+6jBLrFCe+2eBnfOtA+T6xin6jC8q4tyr12dCysT18WT02dEIoGmL8sqW16KbAQvr8 c X-Received: by 2002:a05:6a20:c886:b0:1d1:21a8:ee8d with SMTP id adf61e73a8af0-1d6dfa46960mr28034015637.22.1728413513872; Tue, 08 Oct 2024 11:51:53 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, qemu-stable@nongnu.org, Michael Tokarev Subject: [PULL 11/14] tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st Date: Tue, 8 Oct 2024 11:51:38 -0700 Message-ID: <20241008185141.20057-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 In the fallback when STDBRX is not available, avoid clobbering TCG_REG_TMP1, which might be h.base, which is still in use. Use TCG_REG_TMP2 instead. Cc: qemu-stable@nongnu.org Fixes: 01a112e2e9 ("tcg/ppc: Reorg tcg_out_tlb_read") Signed-off-by: Richard Henderson Tested-By: Michael Tokarev --- tcg/ppc/tcg-target.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 3f413ce3c1..6be5049d02 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2704,9 +2704,9 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg datalo, TCGReg datahi, uint32_t insn = qemu_stx_opc[opc & (MO_BSWAP | MO_SIZE)]; if (!have_isa_2_06 && insn == STDBRX) { tcg_out32(s, STWBRX | SAB(datalo, h.base, h.index)); - tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, h.index, 4)); + tcg_out32(s, ADDI | TAI(TCG_REG_TMP2, h.index, 4)); tcg_out_shri64(s, TCG_REG_R0, datalo, 32); - tcg_out32(s, STWBRX | SAB(TCG_REG_R0, h.base, TCG_REG_TMP1)); + tcg_out32(s, STWBRX | SAB(TCG_REG_R0, h.base, TCG_REG_TMP2)); } else { tcg_out32(s, insn | SAB(datalo, h.base, h.index)); } From patchwork Tue Oct 8 18:51:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833618 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450571wrv; Tue, 8 Oct 2024 11:54:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUs+vNnwBziPT3oGXe75dK4sTsXeMfPFaF8vgb8W/pDiKxWvH4rsL4fDsNSJmXo1KanhQ+c7w==@linaro.org X-Google-Smtp-Source: AGHT+IG2HUm3ZmGANvAZz0OGXkyw0UPf4n4VA05Tm+XVRKZeiN00AbYEDVxluKIhpq/KyOq4JXhT X-Received: by 2002:a05:6214:5c42:b0:6cb:41e1:b2b4 with SMTP id 6a1803df08f44-6cbc9307cecmr223566d6.10.1728413667686; Tue, 08 Oct 2024 11:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413667; cv=none; d=google.com; s=arc-20240605; b=HbvR5jK2lt6/jGe72S6SWJ92C+DhXSsfQom1pDtBWrZJhGoABNRq5ySV8CMrlt99mb d+St1990QJ9krM7Dptq8D6leqbCB40wYs0UKOCPA0Swn2101qXMd+lXDaCV//Kvi32uX flUHsRNw1Fx6eDOEcGHMIRD2i2/yIlYRzZYQTYmKoELcCAF2cU23xAmGAnDaN1m+3UuH kruq5ob0/nu72+tHgCkOZGk+uWRLEOwEld6Wa626XHgru0MkZXGNHA03eYkaYNRrWrn4 KNA3D6coXhErYb2CVs5KcryPV1aPJl6O8Yn0HgDkbSvOrqYa1nCS2orCfeWQYx7VSVti VK0w== 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:dkim-signature; bh=TdZ1rsJXsMXK9Xw+CkLT1YF+f8XvML7ftUECJVUUWO0=; fh=g1jmSm8gExqnCetj1a1Sa5xHoCqZ/paewyT+zCwPlKg=; b=Rb+CkKDYk4s5gIROR9iafREZN1F6BpRRfkUT5gwfkDNBj6sBuQG13+J/xd2HgSbBPM N48XWtYlo5djsDhHt5txHeGckTaBjCVkZnf4PyUT1gJyloBydIeB8I21g2UOgAweNkGp f3ZA3pkgwYM6GjRstc+NU4gXPrw3Z4KfsIptX0o0cia3ty5NyDC0ir9sJDDNauZiSESt Rdv4V4AUBkpjXsapy8fY2a7uKXqqm9xrl6hCP0O5c7/0YoTEkYIdqfCExPcJhy3J5qrv /Oa3NEQu44L7Z00BWs9/TJJ1qef9DYrzg5eIOmLGbO+rvu0OSZM/1kVdK5nl6yMrHyBg waAA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="k1G/9jlR"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cbc0f6bed0si16763346d6.513.2024.10.08.11.54.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:54:27 -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="k1G/9jlR"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJc-0007UK-0b; Tue, 08 Oct 2024 14:52:12 -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 1syFJR-0007SH-I3 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJL-0002Tj-Uk for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:00 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-71df0dbee46so2510260b3a.0 for ; Tue, 08 Oct 2024 11:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413514; x=1729018314; 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=TdZ1rsJXsMXK9Xw+CkLT1YF+f8XvML7ftUECJVUUWO0=; b=k1G/9jlRImAn/XTA9HFFH+k3u7r333aaT/kg68TtIXlVmCSNXQ08otD/gwBsI6XGnM 1DInKggBAhFOQhRZ5SzMdxuwuSre0kEpArOw0lVy3Y0TUgyLMUMEtMlee3tZaStKmiUT zHtKjhk3xNnaeJ+sezPw6mNqy+DI3nA33vDT2/+eZ28ZyS/oDCaTJaaq5wjk1qchFC9Q QkgqQ9R4yED4KckEklGfHXbnMibeWcoioPOhdS72rkp7SPWHazAgb15ROX3Hd9gv30Ik 1LteSU1YsJhL5f66kDmKAEn+Tbx9DO+cv/tj1T02bX6+37rfrxMUm01keDzxkje8ZknA I8JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413514; x=1729018314; 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=TdZ1rsJXsMXK9Xw+CkLT1YF+f8XvML7ftUECJVUUWO0=; b=dDq06hG0SmgB4zZwY92u2h+tjIse/7qF1rbiF45NsucnGvjBa03rxZGpL0gD/wK/Pj K03p1vOUkH48z4iu/+3CUzt0jCyrZWGzbytgn846/tyEZnHlA49qGjMu2ThiVIXwKyrH jjte1kPq3xzHKuCsDTDsMxNgW3TDEpKfufEbivS/8qzFa/7SYQ4SLQYcmVdrDDRrksCK 4zCwb2x+27/Lfy6pMtONo7gOdraECOpqm8wzfeQZOKXPg+I7cf69ghQ2mjcxrfrn/n6y kmUrXBkJE9WhGnTnycSa0H/Lrz+I9bzJawNAL9Nit3pthJ2NDsbWbaFLGW0xmF32ZctX S4uQ== X-Gm-Message-State: AOJu0YwlvyWbKWg1zH1VR2mrBUQ3HtqsLoUzG3b7G5YlADbrIOPxI6UY 2RsslCFkZ1nFeokyHwEbTFJDrvpYaUOeMrNsVzBbwb114vaDh9u4tLig3iH/kjhX5dn9Ig2WjBQ 8 X-Received: by 2002:a05:6a21:e8e:b0:1cf:4dfd:f4e0 with SMTP id adf61e73a8af0-1d6dfa3b3aemr25125505637.13.1728413514622; Tue, 08 Oct 2024 11:51:54 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, qemu-stable@nongnu.org, Michael Tokarev Subject: [PULL 12/14] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr Date: Tue, 8 Oct 2024 11:51:39 -0700 Message-ID: <20241008185141.20057-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 In tcg_out_qemu_ldst_i128, we need a non-zero index register, which we then use as a base register in several address modes. Since we always have TCG_REG_TMP2 available, use that. Cc: qemu-stable@nongnu.org Fixes: 526cd4ec01f ("tcg/ppc: Support 128-bit load/store") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2597 Signed-off-by: Richard Henderson Tested-By: Michael Tokarev --- tcg/ppc/tcg-target.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 6be5049d02..223f079524 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2617,8 +2617,8 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) { /* Zero-extend the guest address for use in the host address. */ - tcg_out_ext32u(s, TCG_REG_R0, addrlo); - h->index = TCG_REG_R0; + tcg_out_ext32u(s, TCG_REG_TMP2, addrlo); + h->index = TCG_REG_TMP2; } else { h->index = addrlo; } From patchwork Tue Oct 8 18:51:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833619 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450638wrv; Tue, 8 Oct 2024 11:54:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXmUAuff3TWCy//B1YHBT/TVlF1gr3SvUeBPwKJ7cOes7G+gh8SZQ561aOnImozMrJAK1mG/Q==@linaro.org X-Google-Smtp-Source: AGHT+IHCEq49wmDXB2Rd1eWzNTJt5wFsMG1NHS67t0ykv4xtV/X2dzkO1BnzOQLifKw1ztQontPD X-Received: by 2002:a05:6214:2c10:b0:6c6:9bb9:b435 with SMTP id 6a1803df08f44-6cb9a4f8f3dmr235501316d6.53.1728413677186; Tue, 08 Oct 2024 11:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413677; cv=none; d=google.com; s=arc-20240605; b=LZZa56PBWOgiEcNkqOuG3KHpLV34tdJAGQvX5+Pd9j85wbmXQf5yDGR3kU6wzYQV2E AAKrHWO3YD1STD4959u1UMbYZLPVT0zfaGfPGuVHXuzzlwfNQ5uhxT+G/cXMzqz5+lT7 ark8Nz0qgNiGwcrUoCIat6fW2tDjQq4m/DZsZXCLAcFeSc63t/UhV5iRtSQCCj6Zyy6S yJCA1udNv8BksDbWs7rO/tAgcITNLnUj8IUOYXNn8oY78zBUCaBWuCa5fQMxLQx16HMu HDaPbver01AgpBZOT5Bj7VK9Ej4QtzF7ScU3QkXuZe00I2/OlvYW2LSDnzNoi1543G/7 ZVPQ== 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:dkim-signature; bh=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; fh=tTjTfh/QwbpfIJ40uL4jnZOzWTJn3vAziy+Fmyen6KU=; b=fHHr6m8co4gD4t/vOQhkyCgaMZRtyqmbDqTUm/EqPqBNWJWy1AzehHlH6dyhVbqKwZ ts+KEggi+NZ52JOLGdKR6qZ42/aO8D6iaWvu18BueWtK4ormQU270e5XDo0/Wucwfslg lcNhFVuS2q9tXfDR8Ui5/40fbQaeNhyN+azJxqNrObcU4BWhKt6vhFTi7QQs5sQmVYhN S36dqXUq0ONOYfenB1oRCY3guKM0OIayIi6rKIczwJRnabBPUKy5esvmv1XDC7uUFhhf 9Q7mNlol+gjNDQ/ZmK04yoyxr7yFfSgEhhdN1fZ7eiYVihLsZA9Wf1q8EGhl8GmAwCxV mYYQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o80o3xZQ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cba46da1e8si92007246d6.89.2024.10.08.11.54.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:54:37 -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=o80o3xZQ; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJh-0007Y5-NL; Tue, 08 Oct 2024 14:52:17 -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 1syFJS-0007SR-S9 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJP-0002Uc-G9 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:01 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-71df8585a42so2548693b3a.3 for ; Tue, 08 Oct 2024 11:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413515; x=1729018315; 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=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; b=o80o3xZQf0wmvDB/S97KNbXeaGPVjYVQev31/7sOBubGp77Z5Eg1XHZXHG634I/Awj 1Okoh0mZP0MtVh/BGfwDeDLX2nNIdY7+GWcyxzA37yNj4r10484XAYNoJk6gJSxo9KrM SSEkJclqRT6hZyIJqR6UxKkvQTOqSygedJQvfZoxV2nWLUNKEmS/N9jlGBmBmvtk2ajc Jk+zbPYrdl+tyNDXXew6fIACzQWGpGwCdZRiGxvzOuxgyNojjjUi9KSN4kY/0na4Y5pc 9ofIV5STK7RNCk8t5QG5KPxVk0fZkWJr8oXM8br8OkywKg9DfjXiYIc2M4U2/IwrFGuP /xmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413515; x=1729018315; 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=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; b=pUXmj+S4/NuM69leVuPVCyU2vk4nBrkziaYuS2sRnMlmlqDesFjV9H9Des1XZMYK2Y ewTTwAEBaqSKueM80KuhVFzknAx0OoOoDOtGa90EnpPWJYxQL5qleF6+A4Rh+H/ICfFH P4d8aRv1FHHuJZW2lXUEfyirdhpBoflnt0W2RNzA1HIUqJhNm66laq6pzZfI5kuZR5P8 BFO8ecW3dNzxWT6NGdC1k2MipgAN+R6uCH0b0nzN00M6FWE6eIvhyk7HaghNbkaRp4fh zsby5uW8Yw0PgGExUEHUFWn464hE7GVO3x/SScAbhD5KqsT24zmDJT9ylCTNI+hdtlK+ hJgA== X-Gm-Message-State: AOJu0YzOf/6xuKXJZuSRuznNH6zHqEkbdraN+Se89rRPQXvDP16Osvxo MeBiaAYFtHn6EzarYHDTH0qo2OeU2fEU2L+JDUAR1uWtQTBvPwv/lJHwnQXaLlnpGHXLJWP1IT+ V X-Received: by 2002:a05:6a20:c709:b0:1d2:bbd9:4646 with SMTP id adf61e73a8af0-1d6dfabb7bfmr25353858637.38.1728413515383; Tue, 08 Oct 2024 11:51:55 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 13/14] target/m68k: Always return a temporary from gen_lea_mode Date: Tue, 8 Oct 2024 11:51:40 -0700 Message-ID: <20241008185141.20057-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 Returning a raw areg does not preserve the value if the areg is subsequently modified. Fixes, e.g. "jsr (sp)", where the return address is pushed before the branch. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2483 Signed-off-by: Richard Henderson Message-Id: <20240813000737.228470-1-richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé --- target/m68k/translate.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 445966fb6a..ad3ce34501 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -720,7 +720,9 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s, } /* fallthru */ case 2: /* Indirect register */ - return get_areg(s, reg0); + tmp = tcg_temp_new(); + tcg_gen_mov_i32(tmp, get_areg(s, reg0)); + return tmp; case 4: /* Indirect predecrememnt. */ if (opsize == OS_UNSIZED) { return NULL_QREG; @@ -747,20 +749,23 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s, switch (reg0) { case 0: /* Absolute short. */ offset = (int16_t)read_im16(env, s); - return tcg_constant_i32(offset); + break; case 1: /* Absolute long. */ offset = read_im32(env, s); - return tcg_constant_i32(offset); + break; case 2: /* pc displacement */ offset = s->pc; offset += (int16_t)read_im16(env, s); - return tcg_constant_i32(offset); + break; case 3: /* pc index+displacement. */ return gen_lea_indexed(env, s, NULL_QREG); case 4: /* Immediate. */ default: return NULL_QREG; } + tmp = tcg_temp_new(); + tcg_gen_movi_i32(tmp, offset); + return tmp; } /* Should never happen. */ return NULL_QREG; From patchwork Tue Oct 8 18:51:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833615 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450474wrv; Tue, 8 Oct 2024 11:54:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUZBy3gRYiOSVwx+gD+aC4xHUPgl5z4OuOCh0aVBQtAHGNkXrYQSO+TsCQqDW/aaakV+/H+lQ==@linaro.org X-Google-Smtp-Source: AGHT+IF3fMgSsRTvAiHEL6eL4JntB8wsSd+8h5Kxffp8cU3cNV3qwByqcOwEJSX+se8Nw+ysfONy X-Received: by 2002:a05:620a:394f:b0:7a9:baa5:f772 with SMTP id af79cd13be357-7ae85f29fbcmr752648385a.19.1728413650827; Tue, 08 Oct 2024 11:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413650; cv=none; d=google.com; s=arc-20240605; b=LIMphJvURsGRooueYJEwbb2lidCo252nueN7tk1HhO9ci9U9ejQU9d9739SdWcyoTh ocwLl3kA4GGG5NaB1J+xzcDAAcXo4RigmJE+AYONZSdknEwccSHFlaysLSeYEVLzQtXR bUwNrn27dNZ/GpsUvJsFnHAMq1Ldq8JKQFbbZ+U+hmxYA8sKgWJJOpNBC4zcZelgiAR9 +hjJBAD7LW9dnkxyvxxSGDv0VVK/izUdVTqCHU2nzXrlMhYAkpisjpY5EpmQKNFqdw7h zwF/uoziuPRY9gtM7ZKHhIm1b0yBJV6YIV9COrSN7t+wNLCB6YMgg9VfoQaPtvDBZ1Jj 40DA== 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:dkim-signature; bh=dJRQrtWzEa9YTQ2bC834pCenIsD7NAkkm9NzR9qJJwA=; fh=tTjTfh/QwbpfIJ40uL4jnZOzWTJn3vAziy+Fmyen6KU=; b=dhYA7KzoYrrPD4ZfIlPziFj1hCGQEEQaUfz8d4c2HoIcX2aDHaHNBsieKwd1Lr4J1T voziHJctELPyzbHHte2bWCewiuMQfKikzeCykpZb2QwGnvzsaxaraA3RkNc599AT/dTn oC26cQW2+8YCGIXv83Gyl0IgUzTaJptjJqSJbXgpHSdGrxF/kkwD4h6Mdq7wgEBHwMTi TNK4GYRo+kUHfqX53WIzBLqprqblaHRgcgen3B/zsOW6v1CalPdSgoRfO3ex6DYkHYTL bO7BRtzUkIpqmuyAa7R341tB1caArkhBf/i81PFP8p6kBbfCd6T4ZTZQmia5RANfWvFk rYTw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PLHn94Mm; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae75662519si874516185a.232.2024.10.08.11.54.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:54:10 -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=PLHn94Mm; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJb-0007Ty-Al; Tue, 08 Oct 2024 14:52:11 -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 1syFJS-0007SS-Ry for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJP-0002Uv-HA for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-71dfccba177so106955b3a.0 for ; Tue, 08 Oct 2024 11:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413516; x=1729018316; 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=dJRQrtWzEa9YTQ2bC834pCenIsD7NAkkm9NzR9qJJwA=; b=PLHn94Mm+y4Fxj5Aazz1O6vFvAgslRBtA2ONVvisPMaUt3O4ete3UBI8z+gyF447Dm FWQ+sF5gCOLbF56RNN676DrCAdo/lPZewDmNomdQHgIPb5GIVAeSCYNYv/iKmVpa3vJA S893x4yXMXgTZK+O5VOB8a2m1BIHlu7w/z2sS9c0q++598EN0Ufz4ne4JZBWmf3aVVhw AuAzyYMDYFvw/rBowYyar6nCPA75qqq72n/RW4a4PDEyhDJvLImDwaSGU1tWFgdsc/u1 UBmGbP7qDM58GSpi3ms8i57LlFfWhdushvnM6kCO2hlTwM0iU2RvV+GZEXaNN1/d2/fG Vf5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413516; x=1729018316; 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=dJRQrtWzEa9YTQ2bC834pCenIsD7NAkkm9NzR9qJJwA=; b=Gm0TpNHFVjM6XsFLRY8aZpLJfkMhSXYOZHGR9Ivyy5QyN1gj9+AFaNtD8MwelgAPRe grpkkJzbyL7bvYbya0Rlf9PvEYr3JTKLYxK7sWN1GKaDJkelTgEAATd1kw35lMQEWjC+ DO686ge1lm1ZolEux6Y6+vyNauW2tW8GKIipOukYbw0JlOnRgJQrAUKs2cKlYuq+CEK3 uw4QTQAQav7M7+up33UZB4VAtT9eJje8iC291vGJcTEHuLWVIwfrVfjANcli124BDJW9 wGokAmd36yDo3p2FDtVJ9b4XEGgS02zC+F1lEaL39bnGoSK82kxGkQuweHRZ3lTyR35t UPDg== X-Gm-Message-State: AOJu0Yz7+aBgCjUNIs+oHMf4Hs7vVuQGgt8NefcUYTmIZMgqirRWk1C/ Xm1spuyjqu+GSLHeC89Lv0SMD7bEUZbLkL9omFOmFHgYC1edbJBweJ03EaxhbGu7sbkxLYv27B2 q X-Received: by 2002:a05:6a20:258a:b0:1d4:fb97:41b9 with SMTP id adf61e73a8af0-1d707459d68mr6414648637.22.1728413516302; Tue, 08 Oct 2024 11:51:56 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 14/14] accel/tcg: Make page_set_flags() documentation public Date: Tue, 8 Oct 2024 11:51:41 -0700 Message-ID: <20241008185141.20057-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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: Philippe Mathieu-Daudé Commit e505a063ba ("translate-all: Add assert_(memory|tb)_lock annotations") states page_set_flags() is "public APIs and [is] documented as needing them held for linux-user mode". Document the prototype. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20240822095045.72643-2-philmd@linaro.org> Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 13 +++++++++++++ accel/tcg/user-exec.c | 5 ----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 6f09b86e7f..45e6676938 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -166,7 +166,20 @@ typedef int (*walk_memory_regions_fn)(void *, target_ulong, int walk_memory_regions(void *, walk_memory_regions_fn); int page_get_flags(target_ulong address); + +/** + * page_set_flags: + * @start: first byte of range + * @last: last byte of range + * @flags: flags to set + * Context: holding mmap lock + * + * Modify the flags of a page and invalidate the code if necessary. + * The flag PAGE_WRITE_ORG is positioned automatically depending + * on PAGE_WRITE. The mmap_lock should already be held. + */ void page_set_flags(target_ulong start, target_ulong last, int flags); + void page_reset_target_data(target_ulong start, target_ulong last); /** diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 7ddc47b0ba..11b6d45e90 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -485,11 +485,6 @@ static bool pageflags_set_clear(target_ulong start, target_ulong last, return inval_tb; } -/* - * Modify the flags of a page and invalidate the code if necessary. - * The flag PAGE_WRITE_ORG is positioned automatically depending - * on PAGE_WRITE. The mmap_lock should already be held. - */ void page_set_flags(target_ulong start, target_ulong last, int flags) { bool reset = false;