From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558622986; cv=none; d=zoho.com; s=zohoarc; b=oUITSxokFxR5rI4Wbsc54Q5m+I+Gm9CG0JCbs5hW3WbuHNMH5tahpD9ern5xb+JBuutwyMcVQorHzeS2JNjP1uyaKoyrzl6eJhZJyiRmgSiwHunpumPOs7Pnt8l4933jVqNMZPGWlw1cUrxSKHm8Bje6JDu9i6QBcS+vrLmUgxY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558622986; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mTgIGkA0v4mYbxB+q0NtkSeibQIBGVB9A4e5TgTdD8o=; b=onufhHtDxLo+/35zWd5JFg1BkDsxAZvfeR0eo49pFj55w2iZOlYlxd3/LeUB/k1IYk3igRuVR8uIbIOx/S/ot6WXjoe3sMk1g8adWpLA9A6EyesKb+K4VWysPNGDb4aaiZEyQZt386GmdokuH/0R/dvDLQnJFH4i/6YvDM+dFDY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155862298678225.683822528140695; Thu, 23 May 2019 07:49:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:38073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp2K-0000PW-Qo for importer@patchew.org; Thu, 23 May 2019 10:49:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTowu-0004Co-DP for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTowt-0006CJ-Ab for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:04 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:51701) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTowt-0006AN-0x for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:03 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M8QiW-1hYCej2X6e-004PLo; Thu, 23 May 2019 16:43:41 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:27 +0200 Message-Id: <20190523144336.13960-2-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:EYyeMyp13uTmvGMZg2AihT1bSicFMtThF1qZgcvqF+R+MAkVtRG DKO+yke/QNIOaUjVTWiTJ7HuHl0tFxqQ9yK/1qel8x9HDu5C8PpMfuE8bag+1rXXHjuewDi lUIzXjj2vlnLrcBnHQGx8+96ojjTxRr/VzKP55b6lYbps3IIIAmQcAlizYmkoQaTfJWK9xC AnOjiTAKbgJtAnput3eSw== X-UI-Out-Filterresults: notjunk:1;V03:K0:uYaPZKay5ao=:3rB1mJ2rhCqGcu39c3BwNT n2MUHynEd0HPyeP1UkLfJ6RBCaAKoU3QIKFLHq86E5S/Z/LYQN6vMFCNRqJkEH4tKqWsoluHk aGoQbkBD/8QQ5xwY4juckJ31haheKBZZnQB69OGhHXj8h6hV6T7ODhtQmNqhkOTEzBFUJjGDj 3LUzE5YpOp9u7uWeoWA2zBlkphrStYEeCAWRUd1HIBGh0YgEO8hWG92Ur7KpbMRph/oNluF/I tMDI7kcB8YjlOnZe9IR4vz0Oq50TpWloIguU7cSPdBGJvwxiO3dbFgX8KF9yHNyxKC96t28tm fD1208ttR15BFZE/WO6OaHKgjlz/Otf0mj5WUr5qNcFXQ27e93Tg8Y+M28j48nfXvsFbxpw+T 7twEovAMrwZDzhiqEVgHk3nI0y7G7f083tfm7WbOYqGTA/nWiNfVi+oHdByoz4fOk751VewsN WpfrpLhl9v21jOFf7HgY1HbswMHDgJzDmRBL1IgReMR3MBfpjNtr+o439yHUuMBDTfmlR+6pR 3T11zOIqfPRtC9ydfTiH2PsEsEiAb6UPAE7wkRP68RXF5u1PjQORqh86tmuGen7msnTCPMN5l DF+bLeDew9XJ3toZfCSk9kCt0Z8+QPl2crQFmJR4KR1pob6OMf59KJls+te+0YwAwEqNSkAXg sNKVcjzyfdTmfzviYyCGK7KPZ0qgOx3qMWyLN3+uXtIjq8HIG6KYCpPpRnfdzkOXFIEys3JCw VqG1elHsS13yCWbmsn6YEILXrfP0mkl9zJk0OA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.134 Subject: [Qemu-devel] [PULL 01/10] linux-user: add pseudo /proc/cpuinfo for sparc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Richard Henderson , Laurent Vivier , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" SPARC libc6 debian package wants to check the cpu level to be installed or not: WARNING: This machine has a SPARC V8 or earlier class processor. Debian lenny and later does not support such old hardware any longer. To avoid this, it only needs to know if the machine type is sun4u or sun4v, for that it reads the information from /proc/cpuinfo. Fixes: 9a93c152fcdb4ab2cd85094487b33578fd693915 ("linux-user: fix UNAME_MACHINE for sparc/sparc64") Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20190517133149.19593-2-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index efa3ec283706..68484a83e69e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6786,12 +6786,15 @@ static int is_proc_myself(const char *filename, con= st char *entry) return 0; } =20 -#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) +#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) || \ + defined(TARGET_SPARC) static int is_proc(const char *filename, const char *entry) { return strcmp(filename, entry) =3D=3D 0; } +#endif =20 +#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) static int open_net_route(void *cpu_env, int fd) { FILE *fp; @@ -6836,6 +6839,14 @@ static int open_net_route(void *cpu_env, int fd) } #endif =20 +#if defined(TARGET_SPARC) +static int open_cpuinfo(void *cpu_env, int fd) +{ + dprintf(fd, "type\t\t: sun4u\n"); + return 0; +} +#endif + static int do_openat(void *cpu_env, int dirfd, const char *pathname, int f= lags, mode_t mode) { struct fake_open { @@ -6851,6 +6862,9 @@ static int do_openat(void *cpu_env, int dirfd, const = char *pathname, int flags, { "cmdline", open_self_cmdline, is_proc_myself }, #if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) { "/proc/net/route", open_net_route, is_proc }, +#endif +#if defined(TARGET_SPARC) + { "/proc/cpuinfo", open_cpuinfo, is_proc }, #endif { NULL, NULL, NULL } }; --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558623297; cv=none; d=zoho.com; s=zohoarc; b=KQ8UIK65OeGQeOuCCwWt0T9qnNZUkSwgkrciSTUKGkTsHVC1CkHusf3p246QAMkM88o+GrzpFRy5ARdrtMqCO1Dyo4zWQJbeff78gyByDOBhdXGMJ6+wHWeBkQ4MR3ph4eTENSfrcMcRE8xPolo9JeCPxMtbkYyM0Zy0XxvU5qA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558623297; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SZoirlRBjd0hI3ZB7OZPHDozwqbZCd3gHi5EQ5b+U+Q=; b=BGJteMe9hgiutzoYN9oOrmp5uXQ/RmrgyVvqcHonaVW6nKZmlulLxiQY/919ylX8Dnl2Z/1Sac/jaDouLcqbec9L9v8LQnbh3NWg4+4k4Cox8QXxEy9Evlj68HCdz80qQG4F8d6nrDZwdWk4u8SixLhueId0Y7tmRnFy1eMhVzE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558623297929794.3885857921993; Thu, 23 May 2019 07:54:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:38194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp7M-0003zT-0L for importer@patchew.org; Thu, 23 May 2019 10:54:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTowy-0004IG-LD for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTowx-0006L9-J6 for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:08 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:38177) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTowx-0006I2-A0 for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:07 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MBUZr-1hLpGT18L1-00Cz0V; Thu, 23 May 2019 16:43:42 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:28 +0200 Message-Id: <20190523144336.13960-3-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:sFzFbFoTTJSxzKzFxiZe8nYkdCweOxthZPnT7LndP08mK1zExTN B4EMM41/Kzw+ea1Ld4wmXebE6O6PkljKXcm0dryf3bzfmZi74YnsaBLdgDxaXOolg+TkL/C jet4Dhmkg5EjO/wl0ssC8wSxOdRzzRiMVhnwrhcj6K/7ZupU4UUpPvPcSnFuaUG11BLriV7 ARsCXmDpHK5mHd7iK4S9A== X-UI-Out-Filterresults: notjunk:1;V03:K0:PQAGtdmxa/c=:8Yf0CI+3PSlK+BKRuqol1I HbSeR2KWYRWNENp7thVErmnQQ6aIw+W9Sn8loBC7V30Ya3/paIoxVqnPhoPcCjqx3BoNXUiEH 09r7g18vohLVjLwtS1UfPzRNF1x+72qJHVMZtS1DoBsbM48m1BhKgIf+rCik9qYOBHlVFqkh3 ugWedr8lVZ/WVUgNYPMho1I47JvBiHW9nk5l7JjbZAh50wKAVRGSX9I0nDjK1+yUwVrNTN0cH CJrB23GWfbKr/tWHkQ3gLziSmjIqK0SwL/C3uTZdAtUlYg0aqskjc40VpIGly8WMmRh4/I0Z3 b/k2Z2LdAgz1ZKekhe0jD9cdwgBQhcE4+pqALDmstfH2XY0z6tbThGL0z6p5JsqyyrcKuApmk Ewaso/NUqOLOr2YoWSxwMjIZu9xSrIXZhspdt1PWeQfP/+XDm8UoMuxgyNiV1VNOF17i7BcOi M1UbrsF69r0ORxR/XLn4mFhkVQYgz6U5D2N5EHZc9Ya+HwA7UgXhjTSka9LXHM+m0Kg9g6jqN q+E2/QQ9vL3yRSUy4jjB9HP46ubLQDL5iKh5f4Rpdf7kxhTdWd4AunKaPD8B2bHWWh9KpdmwY 5+7ijiW3HGN02lqkpACJrSQHLEY5URY73UiiQOH5EhoEotiyNrTJ+Xt86hUqBJAjuaEDYFe5A JMEZms7ooaprh2siSwBHGL6mQknlJBGO8kI5fx3+hiqrizP3drdtGczykA5oy8ne7l3+Trc3q SmcSEkO43YlkW6G43QVbve3Xlk5L8h1ZUtyfiw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PULL 02/10] linux-user: add pseudo /proc/hardware for m68k X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Richard Henderson , Laurent Vivier , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Debian console-setup uses /proc/hardware to guess the keyboard layout. If the file /proc/hardware cannot be opened, the installation fails. This patch adds a pseudo /proc/hardware file to report the model of the machine. Instead of reporting a known and fake model, it reports "qemu-m68k", which is true, and avoids to set the configuration for an Amiga/Apple/Atari and let the user to chose the good one. Bug: https://github.com/vivier/qemu-m68k/issues/34 Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20190517133149.19593-3-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 68484a83e69e..e5545cbafac7 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6787,7 +6787,7 @@ static int is_proc_myself(const char *filename, const= char *entry) } =20 #if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) || \ - defined(TARGET_SPARC) + defined(TARGET_SPARC) || defined(TARGET_M68K) static int is_proc(const char *filename, const char *entry) { return strcmp(filename, entry) =3D=3D 0; @@ -6847,6 +6847,14 @@ static int open_cpuinfo(void *cpu_env, int fd) } #endif =20 +#if defined(TARGET_M68K) +static int open_hardware(void *cpu_env, int fd) +{ + dprintf(fd, "Model:\t\tqemu-m68k\n"); + return 0; +} +#endif + static int do_openat(void *cpu_env, int dirfd, const char *pathname, int f= lags, mode_t mode) { struct fake_open { @@ -6865,6 +6873,9 @@ static int do_openat(void *cpu_env, int dirfd, const = char *pathname, int flags, #endif #if defined(TARGET_SPARC) { "/proc/cpuinfo", open_cpuinfo, is_proc }, +#endif +#if defined(TARGET_M68K) + { "/proc/hardware", open_hardware, is_proc }, #endif { NULL, NULL, NULL } }; --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558623436; cv=none; d=zoho.com; s=zohoarc; b=SCVsJScGBBq0j4B0qGnxwcpEybwdGpG+udDSY29d70oNVqN1QJVc6Xd9VjxTyUudT5xc6agkEp3Q/g1HLN5NugFSqdrsQs/QpPex0meUmzwtNsCyiRutal0VHCY6FnWUUj00hyxTVR444+fLbVPF7Df/RWwB00F1+4pNv9qfm3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558623436; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=EABWahvEWvxrS+Fy3zF+HPkyzozifNr3QOyqsA16wWM=; b=KPxHObBADW+EECx5xjqLL9kBQ995BX/3d0XzA7XqbnVpsWyBJZ9UtBXgTU0A7L4Dg9n7EWX1aCS2h9+LVH2dSdkJpHs89mZbvRdpOh5Jn3uTaSgXdI/2KLnM2YTT5mUA/D5GJMUHRPZp0Hj5hj/5tdOjN1YuSKE7d4GLpWFXD8k= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558623436794404.66587545478046; Thu, 23 May 2019 07:57:16 -0700 (PDT) Received: from localhost ([127.0.0.1]:38254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp9c-0005Vv-SC for importer@patchew.org; Thu, 23 May 2019 10:57:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTox1-0004Lt-TZ for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTox0-0006Nl-K0 for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:11 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:38043) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTox0-0006Mw-AU for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:10 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MNtCi-1hIsj83vdQ-00OGcG; Thu, 23 May 2019 16:43:43 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:29 +0200 Message-Id: <20190523144336.13960-4-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:0MGJHVzNT2jKtASdGvmoFoDKkK64vgdE9rdE23Cw6YtvBUF6D5u W17UMI5/3ao0th2bQ3urJcuoanIc3kPtIdOs2eKC79zbO/bCUTvz9M8kz3nBNxYcfV6+6Sc gbjJlpesV9Il0DnH1Lb7H53dDw+sXJXjJhihMkgGr/KTpfo3Zw8kBQ8nePPnYJzZB9iJ1KG tk0lb072mijQOEBmtCqOA== X-UI-Out-Filterresults: notjunk:1;V03:K0:XzmyCqWuS/E=:Fy0LPrCu8bS4W8Q058SXBR rc1GJdhN2D4UdH0SNRb1Yf+GiW5tqMYu03m0YYk4LL4MEH2/yzTwIwN4CyxZhwSVzg8fb2yCs FpMQky4VKBPpxDu9Y/W2P5cGV7NHjlx1rXuVN4Kg8YVbWyE+tDV9u34spHUQ/q48jl64lWMjr BgCVTtGphpm1lrTozPz7puWtbuGjsmkH1e1vJ9NZFx1CItaEeLfx7ueN1WaVyS2LRD8WAILyj gnpMOaW0uhYacW6uHr8UOTNya4k0aUxYg8lFHlMmJx1e+FcsLtfrBh6f/gfi4JzubVOc3KZMG uWBa97UL8OKbV0ujubefMEZ27PuNIRyZvGEQInIKKWqHoh0HJvqvQx05SO56yuAJQoFpbzP09 FrFjQMZal3zBqqjOTXfNfele83QOneHayuLWBOeHCU/JuOM6H4E8/uPg67CdrjhrPHYdroisG NVG9IrX3OMtiiDAOJf/aPhl1Ql6XW6mTHt/KGiy1xupYQM1n9YVEcrlCYnXYTbZrUAiumVWct zxVibCDwT8XKvOqhmw488aECZ5lSrR3OGDu6f/um9vQL5lSek5f03geY2cJN6aslaJ23L6Kzz U2VmuGRnsG/eRiUoRe4u0/+XMlsuefdAcYuhzSNxbVkrchUtVVu4cNOguGMdcYODvquwlXZKl Mf7KILbHUiOG/6aNObvTHwfVqoMnBKQW1Vg1Haq5tDOUb1dpRgmK+1dtj53TY6Tw1GR1+dNHr DYBpNGWjDWNWokjnS8vFh6MzS9J4NiRBO1qL/w== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.187 Subject: [Qemu-devel] [PULL 03/10] linux-user: Fix support for SIOCATMARK and SIOCGPGRP ioctls for xtensa X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Laurent Vivier , Max Filippov , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Aleksandar Markovic Fix support for the SIOCATMARK and SIOCGPGRP ioctls for xtensa by correcting corresponding macro definition. Values for TARGET_SIOCATMARK and TARGET_SIOCGPGRP are determined by Linux kernel. Following relevant lines (obtained by grep) are from the kernel source tree: arch/ia64/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905 arch/mips/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int) arch/parisc/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905 arch/sh/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int) arch/xtensa/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int) arch/alpha/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int) arch/sparc/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905 include/uapi/asm-generic/sockios.h:#define SIOCATMARK 0x8905 arch/ia64/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904 arch/mips/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid= _t) arch/parisc/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904 arch/sh/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid= _t) arch/xtensa/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid= _t) arch/alpha/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid= _t) arch/sparc/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904 include/uapi/asm-generic/sockios.h:#define SIOCGPGRP 0x8904 It is visible from above that xtensa should have the same definitions as alpha, mips and sh4 already do. This patch brings QEMU to the accurate state wrt these two ioctls. Acked-by: Max Filippov Signed-off-by: Aleksandar Markovic Reviewed-by: Laurent Vivier Message-Id: <1558282527-22183-2-git-send-email-aleksandar.markovic@rt-rk.co= m> Signed-off-by: Laurent Vivier --- linux-user/syscall_defs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 1f5b2d18dbea..5b530e04b8fd 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -737,7 +737,8 @@ struct target_pollfd { #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags]= */ #define TARGET_KDSIGACCEPT 0x4B4E =20 -#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) +#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) |= | \ + defined(TARGET_XTENSA) #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) #else --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558622763; cv=none; d=zoho.com; s=zohoarc; b=mbMz1Uxs6xJ0TGoRdg0gxaJZBh0NAIFZy6A4ljCgEewXaDdHqG8CdX6NrJ0ZKbZ3Ct5ZhpGw7Wel1/NR4eHaAdX7ihTqpTtoUUx6Pq8vRQYJ9+yLwhbpbeABt//S6/+OYpPdsmenFoW219wQMNOFVLrGJwbsY22tBinf003RR9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558622763; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=u7XE29VpZRqdRdTUM/PK7AIPdDUpqeziHZGDHhiY5FE=; b=deaGVxHTqA4IYrN6oTquCyaFJ5BrEGyTTMptXbAyh2C5NtnbNS5xToUA7IDRNWC3SInDqVJ1p/V3Junj7BEYnukvS+3v8uEqPACe4TRWsccd/CvLFDNDTzyLwhtv4LE9lqqyFTNBQbvozBuljMa5K6Oa4ZkisZQs9qEJfv7njXw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558622763235260.6212960853194; Thu, 23 May 2019 07:46:03 -0700 (PDT) Received: from localhost ([127.0.0.1]:38044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hToyi-0005S6-7s for importer@patchew.org; Thu, 23 May 2019 10:45:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTowv-0004DH-0r for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTowt-0006Cm-Sk for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:04 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:49787) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTowt-0006BX-Jk for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:03 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N3suW-1gU7aR2VpQ-00zrVE; Thu, 23 May 2019 16:43:43 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:30 +0200 Message-Id: <20190523144336.13960-5-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:fosqzI4IKyonWFKlDIrgHOJTQ95xdYWKrVKC8/cU5/xi+q9tDbb u8Yfz02StRE9/5LpiJVzOcVnlmEfUIlwgW5XP2UdxxCnCWQkalT9o1rwWm23TygbGc2xuC9 u//TDzzwsp2nLioxm7Mew9Bugtmy9uAThw5ARlPo4Xfy/Q+Sjcj0m06zA+2ACvyI6MW6KED PHHZcDwHjL8Ut8O5Px0tQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:n/TbAKfjseM=:ifwigjrhCyYJrEMH3pvAYf +dXJ2c/8WPWZjM6LjxMOscOyxkcFL2ev5Wd10EJAdx1deIEHRgpNn8n79fPHZ/6mZoPGg8wLh OupJyLskfwTcoXTH+lSgsQrrGmEWzTMwQIFMBZa6vyGWE1hvu2NVWRr2tIofV8qXyjBtLdH8Z RvqguVi1xmPShYC/I6xVsNo8Y89NSacU8UiMfbx2SPWQCMfcnWz/jZNo7FKQ5K3dbdvoDjNXc wv5OQoL1je6M5EJLqeKM2Mp2F0ts+3fTodJb/7DpgJZji9RJxR3kraenOpjNv2Ooiw3icQLas xyAKNkQgajsJ2ZBvkmOuxRxr3hhDsLDHK74rtOnUejazD4nLVgN4/tWKU6QeTttusKbYJ040+ K/3EI9C7Dh4TnvUl9VRzn4V06VawB8bjNVZ0GqfywV2SeAj0k9e9aqkwgemNpsh2syZtAqGqC RULGgqOyPa/GyjesEHRkcTNPw6FrVswrSoHPmZi9RnC521/Bi+NpZOQYxHsXTIlbImaTWmxbF fCh+TQMbfKEB0OVKCs6atLm95aQXI1yDF/JRFXeubQ5dbsmg8vWzokR9lSB5ftlud5AXD5WT3 NpKjTeWUpzvXyNm9QpG4M8cSx4Qhn1MS5UqU/b9LECx3MFJWkC94h6tT6td8krxidak7xXlqZ HgmW/u3xUtsbqTo/li8MnYvYdyGWgSTx/0IybvvT7xdBmukcWmMFEBrt39WGHsW61mC1RuhFh JNxRW226uOcqynpo2HujTCHA1DClnmMhkQz9bg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PULL 04/10] linux-user: Add support for SIOCSPGRP ioctl for all targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Laurent Vivier , Max Filippov , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Aleksandar Markovic Add support for setting the process (or process group) to receive SIGIO or SIGURG signals when I/O becomes possible or urgent data is available, using SIOCSPGRP ioctl. The ioctl numeric values for SIOCSPGRP are platform-dependent and are determined by following files in Linux kernel source tree: arch/ia64/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902 arch/mips/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_= t) arch/parisc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902 arch/sh/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_= t) arch/xtensa/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_= t) arch/alpha/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_= t) arch/sparc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902 include/uapi/asm-generic/sockios.h:#define SIOCSPGRP 0x8902 Hence the different definition for alpha, mips, sh4, and xtensa. Signed-off-by: Aleksandar Markovic Reviewed-by: Max Filippov Reviewed-by: Laurent Vivier Message-Id: <1558282527-22183-3-git-send-email-aleksandar.markovic@rt-rk.co= m> Signed-off-by: Laurent Vivier --- linux-user/ioctls.h | 1 + linux-user/syscall_defs.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index 37501f575cdd..99ed9d982568 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -218,6 +218,7 @@ IOCTL(SIOCSRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq))) IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq))) IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq))) + IOCTL(SIOCSPGRP, IOC_W, MK_PTR(TYPE_INT)) /* pid_t */ IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */ IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval))) IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec))) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 5b530e04b8fd..9470a5ce965b 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -740,11 +740,14 @@ struct target_pollfd { #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) |= | \ defined(TARGET_XTENSA) #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) +#define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) #else #define TARGET_SIOCATMARK 0x8905 +#define TARGET_SIOCSPGRP 0x8902 #define TARGET_SIOCGPGRP 0x8904 #endif + #define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ #define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ =20 --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558622921; cv=none; d=zoho.com; s=zohoarc; b=AMDVHumvI32bBjlRcbU0GEaVcclObVkc8RqLZVQN4zXnYJKNdbuToijY3+sQfZM9QA1UEXrODnKWHNqNO2Dsi4Q2dIEkSeQe6IyPhFeMjP/EMCZOoQMHMW3L6kzdO1xjYeJOFL7Xt0W2z3P86pFcwIVgxuoVBEC0CTkKMH6MLFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558622921; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=cQVXguRJPqVKRZCN68yYG5QJvqpyInfQ0cqOuH8ZCgo=; b=LE2ZncH3E5nnNeAf+zAhtVuhy8c8SD5Qk4jzvYHgDmkdz5qaUv+wC1ZElYJD60P2hVBpRAvqdq8XPuZwq+FGrYd3nIomCVUAdmD3sFYbfXx1nrP1Eg+KLG/ynSWI/MntWy8ykR8rOkte8UL6S4CGmgkC+drqTultHWLnNv01WgE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558622921906727.5287195831893; Thu, 23 May 2019 07:48:41 -0700 (PDT) Received: from localhost ([127.0.0.1]:38071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp1B-00081l-Rk for importer@patchew.org; Thu, 23 May 2019 10:48:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTowz-0004Ja-KM for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTowy-0006Lp-GQ for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:09 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:46945) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTowy-0006L1-7i for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:08 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N3bnP-1gTqaZ16Jv-010gql; Thu, 23 May 2019 16:43:44 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:31 +0200 Message-Id: <20190523144336.13960-6-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:fIEHQdd0xLK6m76XJQ2KhMZcRti/qRyWCnr5W8HvJUbSHd5u++D vjWkW1hlXmmXSjAP5XQcbX1ylBXrX8v9Fwy6bOTeoyIMwhz0jI7/kYSkpbTB8u8+rr/52go /37KkzRC3qFCsEPhNoyDASRKt7Z+Xv4wQGzwmYTWwJlPzp1tZfs9dWZL+EHQ9+GJzvxCnem udHo2gBPM1ijtz9sGtNcA== X-UI-Out-Filterresults: notjunk:1;V03:K0:9HCEEhfrL18=:FofsW3m17SvLq8lJsk2umn +upCSqr3L6oF3FdboCgTbqlYhVsScsYBP/uEiD4GMolt2GOhh+OV7Sok4azni3RW/Bu+nXkai b+Ap6L2POSzo9PLiJqUTOPxjApESJ6GBYIMxpahtKUGrVJed+JmYpnllhbKgRWiKt2KbkwSRL 4nDHX/uQVUrSA7Uv+EeRZvW0w05zBM7a7zQFvNaLBp9YgX6PfqB34q+qJP1Eggfl6aKMrQXrp DXANhMWk3yfWHqzPMsUmfpOwnH8rp2Bp4pn2+NgC3Wcy1roxkVpDLX479D89FIckRAK3NGvWf SF9uw42FQvdQSruCKUc/A/+iKkdJ5/MgEJWWgnkIbe356M89FHS+O9IlP4SD4ZeKXjVTuByS4 A3xWH44sZF7KO5i4LniMl0OkZ8549COJSh5zRpP6Aemsk+cWg1jAyMmzcHITKaQj/YQe7vO0C 5XMZlMMaMjS/tIs6Z5A5Yf24MXCJPOX5W4ClCluEhUeekNaQwG4R4aZch0q6ZWoP+RFbmqDMU mOxxwERHk2z4dsR5z7XGH+9SQB8V2TjtdhE0d64FIpGYCmS9/WTTu21QAg9Ok0IAbfDkC/lgz LMutEdiTDQFGmDiKUoYRbroRLfG0Kzy6wZ/Yiyy0QKg1jVRVbF3/3fmuaZsF7XU1mEdvDaUfs 5cSKK6CCaPzyb93Q4vTkC6z7LF71AeWG9TEYD1reuiodb1ZLesIP/rMHQxCCIO6XN6cD0EClV 0EwK/8ZUM3iMYmeuiIHsw5+3kzFvB4wqf9Ql1g== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.134 Subject: [Qemu-devel] [PULL 05/10] linux-user: Add support for SIOCIFPFLAGS ioctls for all targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Laurent Vivier , Aleksandar Markovic , Neng Chen , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Neng Chen Add support for getting and setting extended private flags of a network device via SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls. The ioctl numeric values are platform-independent and determined by the file include/uapi/linux/sockios.h in Linux kernel source code: #define SIOCSIFPFLAGS 0x8934 #define SIOCGIFPFLAGS 0x8935 These ioctls get (or set) the field ifr_flags of type short in the structure ifreq. Such functionality is achieved in QEMU by using MK_STRUCT() and MK_PTR() macros with an appropriate argument, as it was done for existing similar cases. Signed-off-by: Neng Chen Signed-off-by: Aleksandar Markovic Reviewed-by: Laurent Vivier Message-Id: <1554839486-3527-1-git-send-email-aleksandar.markovic@rt-rk.com> Message-Id: <1558282527-22183-4-git-send-email-aleksandar.markovic@rt-rk.co= m> Signed-off-by: Laurent Vivier --- linux-user/ioctls.h | 2 ++ linux-user/syscall_defs.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index 99ed9d982568..5e84dc7c3a77 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -206,6 +206,8 @@ IOCTL(SIOCADDMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCDELMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCGIFINDEX, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) + IOCTL(SIOCSIFPFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) + IOCTL(SIOCGIFPFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)= )) IOCTL(SIOCSIFLINK, 0, TYPE_NULL) IOCTL_SPECIAL(SIOCGIFCONF, IOC_W | IOC_R, do_ioctl_ifconf, MK_PTR(MK_STRUCT(STRUCT_ifconf))) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 9470a5ce965b..cb40620114f8 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -782,6 +782,8 @@ struct target_pollfd { #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists = */ #define TARGET_SIOCDELMULTI 0x8932 #define TARGET_SIOCGIFINDEX 0x8933 +#define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags = */ +#define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags = */ =20 /* Bridging control calls */ #define TARGET_SIOCGIFBR 0x8940 /* Bridging support = */ --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558623279; cv=none; d=zoho.com; s=zohoarc; b=VSJ9HE7ZnGiilmLr0rU4jJiJqBpqvjj9C5Xv0O70yYO3Nj5sg+nUmaUOsl6pXctXMmgn1Bt80g8Cbuxiod8GRFivIfLa3QdMLNnNP7HsZQGsW0P3nCG/mzIMKaMG9uQmxfX1JSmN4TVqe5DGFwBU8z9hRREdiQVVRNp95rTqTJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558623279; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=NrS3R0/TFs11T3h9lNelKHqSM+Nt3rcQRsTnh6xgzG4=; b=CjRqHeY3vx7uTt+UZ7gsrZ4mC4zTHzVgjhJUuSsdI5grhT5Xg4A+p62+CySYnr8nA+3GhPZ/PC8+gRY3QzlhdgDnnUBU+jNpooLN4ovAfqSFN7Hl/6I0WOcMSGi8fARiYNtRSnJlnycmrAy71r83wrUbiLtqFvCOtkK0BWcF9rk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558623279189919.3059291782548; Thu, 23 May 2019 07:54:39 -0700 (PDT) Received: from localhost ([127.0.0.1]:38192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp6x-0003la-UW for importer@patchew.org; Thu, 23 May 2019 10:54:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hToxI-0004Zb-Bv for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hToxH-0006qD-3t for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:28 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:34027) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hToxG-0006my-R7 for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:27 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M4K6z-1hU5vU2RAv-000Ikn; Thu, 23 May 2019 16:43:45 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:32 +0200 Message-Id: <20190523144336.13960-7-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:vOPW+lduhkMebW1fHRlZBTEPg6cT0dAhKXzKtqUnbIHrrP3DNkA TBwRphh/4P7VQ60+fZwOOYgVVKjmjeRrBQYf+5qXV3Fxac2qlHIEvjOMukNaBFBA6FqBawe KNTslxmPuSMSAtpl0Kci/dfFujvg7MizL5Ua8ulav55z1Yg90Jd4CVBhg6bZFG2IYcHybNm mHRAx/EP3/QyiQ2JkW0Rg== X-UI-Out-Filterresults: notjunk:1;V03:K0:FYtVsMceus0=:T/Y6hMlhLGucsEs2z96vGe Hj5uJaElewe8F3qnW/dSliBKKGrImbeSH3D3sD+HOP7Cq1/Wq/Xbj8ow9vCBdWbEEieOpdmBJ Cij/7gxXm/zQ6zIvcVPtzoAlAZFW03z3HzVCc0LkXVQaNiILCG0Al5sn5gom4veRoWj4MfSV8 XJ3zNlROj1qsW5mnFSp0kuaCR91RccIhW+Xzf48f+WG9YDRhQBCeHa9PdTAO6Z45S4+x8rq+w DciynQBiQQa9AIiTYtX8p0bX1f99ktbDWG2gD2fBYYvD1LIQZuLETqOjgeXRo9kvBLukBTjLs AlOUkavc7XQE3brmLP3mxlvcn6XRUz1ELokvj+8DxDYO6ibHpPx9IHTCpJJNBNLKQMUG/6Qjn w/YRd7l3fx7oiKoeVBF9eVHYPf3iv7+7l9MXJt/XIWDv2HuKDgf21mRu1A/G/vbQb6wy0HdXR KwO0eFm52HGUUsFNSpiNtPcu7t6Z8XuRHFdYDek7ONn0u1OOHlMX5xuiE8KpHZaAp3AE4Qgbh HmosTN46/mqrRJRepdfLnE6f4C0zIbCIppUm/J+Zts2W9o2/oYkO96AdylcuU//tTyOW8koAx fsdlOFh5QlKk2kKgEkZB1GCNCMn46Xj8fH0EaQcHUHGAY2cGQaQ88uFZWMq3KQ1sl8mLRJL29 OvCaW1UlauOTuNr1/7hMhl9DWNLn8TN2QyVIUPsTLpS5Axah17PlgWpKnipQFjA91FNfpis/a OX7RtB8/yq0pWD113D81ICxe4yt3GDCONEOvBS/28ZZxIy11L5macLsHS34= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PULL 06/10] linux-user: Sanitize interp_info and, for mips only, init field fp_abi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Laurent Vivier , Daniel Santos , Aleksandar Markovic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Daniel Santos Sanitize interp_info structure in load_elf_binary() and, for MIPS only, init its field fp_abi to MIPS_ABI_FP_UNKNOWN. This fixes appearances of "Unexpected FPU mode" message in some MIPS use cases. Currently, this bug is a complete stopper for some MIPS binaries. In load_elf_binary(), struct image_info interp_info is used without being properly initialized. One result is that when the ELF's program header doesn't contain an entry for the ABI flags, then the value of the struct image_info's fp_abi field is set to whatever happened to be in stack memory at the time. Backporting to 4.0 and, if possible, to 3.1 is recommended. Fixes: https://bugs.launchpad.net/qemu/+bug/1825002 Signed-off-by: Daniel Santos Signed-off-by: Aleksandar Markovic Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier Message-Id: <1558282527-22183-6-git-send-email-aleksandar.markovic@rt-rk.co= m> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index ef42e02d8233..02832adfbc0c 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2706,6 +2706,11 @@ int load_elf_binary(struct linux_binprm *bprm, struc= t image_info *info) char *elf_interpreter =3D NULL; char *scratch; =20 + memset(&interp_info, 0, sizeof(interp_info)); +#ifdef TARGET_MIPS + interp_info.fp_abi =3D MIPS_ABI_FP_UNKNOWN; +#endif + info->start_mmap =3D (abi_ulong)ELF_START_MMAP; =20 load_elf_image(bprm->filename, bprm->fd, info, --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558623155; cv=none; d=zoho.com; s=zohoarc; b=Wi1jJhGVXl+SILKbQYBOifo7ZsXApc/GshA7UI1M9aeXFvSDQco1VG1sAttp/+YM9dCeTyORbnPzGb2Q725wQOtdjdYbNaou6sGS9NWQzaIYN+NVFmllFXxfeRtnF2+tXZv8oRUGmtOaG33K3+357+F47f2pFU6nAdVTPqzmCOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558623155; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=rPDPS5bHhWO8oIfu7wfw7O8ZYyMMYrT/hCyFGBeAQks=; b=k9WYC0SsL6WuE6eFnKy1YTJMHQTWddieqPsa7euoYdJtL8Dyc+WKuh9hQ7PKDeT65LUTnISUBK9eHohnjzVy5Qtb+GdDhLN87W09vGnw/f5/Xc4ibv6XTGoaY/tqEKvMTwcHAk8QIQ1onVpjyqfy7xKXvKGx01pagCF7iAVoZk4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558623155797813.1906071941961; Thu, 23 May 2019 07:52:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:38157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp4t-0002KG-Hm for importer@patchew.org; Thu, 23 May 2019 10:52:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTowu-0004CX-3L for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTows-0006Be-Tv for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:04 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:34261) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTows-00069c-Kz for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:02 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mzydy-1gfh6S11Bm-00x4Cg; Thu, 23 May 2019 16:43:46 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:33 +0200 Message-Id: <20190523144336.13960-8-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:wqhZU6gk88fwROrf82j7nD5p1cGnks1SE+P6uFI2h9boVBYa1xx j9dCF/nuRHLxPrQ6ONJFor1Dz92nwXFH7sKA7QSWl+3xBN5eWC1WsPuS79PaV2qqP46woZo 2TNddznXiC0wUznWi1fNKR7KKGlnz6aOlgwH8cOKkkEUN1EJtsRCDUW1XrfssjU8N1T7foL QHeZeC24NLwd0P5NB7Pzw== X-UI-Out-Filterresults: notjunk:1;V03:K0:d+8fK3F9eAM=:UNZiI+IwYo77XXgZv6V4fp tGpGZe0jTg0AgVyug8vmoX5XMzcUMBEToFDfjrOqmGOub7Ui4ktNmtbggjdbpIkzTcb0Hc2n8 PC5PXuecoi5q+HR1jUKSYymmIxcvFa3D30nKPpjjrdX/wB+7hx+m7LPA/lMSwQtFwehFGPKmc rUdKTncqztVHifTTQN3Lm1vtCuaAR2/jtxJZon0zc3FV/ZGADRi6A2rKP4O0BXUM08SmRV2BB szEV6NA0+2/KmAHSCenVj5tItlPE+Sx9n7koapoBnBoy2dgLRYrAJoH63cjZ9tm8qFtFwarRQ V85eDITLImlqgZTGbRLl7xs7ivypI/dBRCST5tMmMut6lPFdoWWOeJTLy9EYsmpCQ6vf6jdmN kLCJWk4ACiDk/XrSlAjOUl5hSGVmsW1I/VCeblYhu5wY7ZwLawqzKGAJNr6aKP26MI7cw2udx orDBmC44oGGg604vT4jkq8aH+YFcHfDQfYOy3qTa34LhpcdvhOyyYHMJxtWz2Xl5b4RqCdWh8 UXgOY4WVQ754O64jraI/GUqrDzLkkcjRwroUMv/Py3ROfK6w5SAxcCE1A+C26/q7ltbrMxbQ3 s1eigAeXszK0GNHpNVlM5NoUm592OwSkj7lmDxld3CFVADuYrW292T43y5kTHubp6o+80Zx0g B8pFuwkHEwiJHZT5iJOh2LU8vYYQnKUM4n6NGvAlCqy860YeKuTZ5s4ichzG/mGAEUbcrETMH dakVKqKney1fGkYBtYTiRZ83Zz3dEHZp/hGQaw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.134 Subject: [Qemu-devel] [PULL 07/10] linux-user: Add support for setsockopt() options IPV6__MEMBERSHIP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Laurent Vivier , Aleksandar Markovic , Neng Chen , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Neng Chen Add support for options IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMPEMBERSHIP of the syscall setsockopt(). These options control membership in multicast groups. Their argument is a pointer to a struct ipv6_mreq, which is in turn defined in IP v6 header netinet/in.h as: struct ipv6_mreq { /* IPv6 multicast address of group */ struct in6_addr ipv6mr_multiaddr; /* local IPv6 address of interface */ int ipv6mr_interface; }; ...whereas its definition in kernel's include/uapi/linux/in6.h is: #if __UAPI_DEF_IPV6_MREQ struct ipv6_mreq { /* IPv6 multicast address of group */ struct in6_addr ipv6mr_multiaddr; /* local IPv6 address of interface */ int ipv6mr_ifindex; }; #endif The first field of ipv6_mreq has the same name ("ipv6mr_multiaddr") and type ("in6_addr") in both cases. Moreover, the in6_addr structure consists of fields that are always big-endian (on host of any endian), therefore the ipv6_mreq's field ipv6mr_multiaddr doesn't need any endian conversion. The second field of ipv6_mreq may, however, depending on the build environment, have different names. This is the reason why the line "#if __UAPI_DEF_IPV6_MREQ" is used in this patch - to establish the right choice for the field name. Also, endian conversion is needed for this field, since it is of type "int". Signed-off-by: Neng Chen Signed-off-by: Aleksandar Markovic Reviewed-by: Laurent Vivier Message-Id: <1558282527-22183-5-git-send-email-aleksandar.markovic@rt-rk.co= m> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e5545cbafac7..a0c2bf7db43c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1911,6 +1911,29 @@ static abi_long do_setsockopt(int sockfd, int level,= int optname, &pki, sizeof(pki))); break; } + case IPV6_ADD_MEMBERSHIP: + case IPV6_DROP_MEMBERSHIP: + { + struct ipv6_mreq ipv6mreq; + + if (optlen < sizeof(ipv6mreq)) { + return -TARGET_EINVAL; + } + + if (copy_from_user(&ipv6mreq, optval_addr, sizeof(ipv6mreq))) { + return -TARGET_EFAULT; + } + +#if __UAPI_DEF_IPV6_MREQ + ipv6mreq.ipv6mr_ifindex =3D tswap32(ipv6mreq.ipv6mr_ifindex); +#else + ipv6mreq.ipv6mr_interface =3D tswap32(ipv6mreq.ipv6mr_interfac= e); +#endif /* __UAPI_DEF_IVP6_MREQ */ + + ret =3D get_errno(setsockopt(sockfd, level, optname, + &ipv6mreq, sizeof(ipv6mreq))); + break; + } default: goto unimplemented; } --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558622768; cv=none; d=zoho.com; s=zohoarc; b=Qg1pAz3YSFwmsJbMHBw2YDgq+IOGi2Tgjs2KLtiGe9jpX1PGyoQYJXwGw73zLzA+QUol+A5zGakge68jMeB1S05okdB3rYUg2TXPqHWlWuo3tOiwRm8KFTRWy+xvMJ+liVUaWGQIfRWKDwit7KWvgArB2ocGuFQKbr9qXohU15U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558622768; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zzDWv75tx3vBBNjEGBPM/qHXvgfTq7p0ug/j2OJvEBY=; b=R5GRdbF9QVelDcntnF5pqFBoMgZQl1GtZq1Ezj8Z0md0cAI6sHzxgkq+rDX4bkDx7gUYtV0oLR76lH10SIU95OZbUqyKUX/qwGiKDNE6SG0Sp7zF18Q/jbDU0jxZ9Dzq1zgmIfEtvx9XWesWqwa6BgKXYXKEJjbdiT/tp6ulB8I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558622768273474.764098795584; Thu, 23 May 2019 07:46:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:38046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hToyr-0005Z7-Eu for importer@patchew.org; Thu, 23 May 2019 10:46:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTox1-0004Kq-0p for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTowz-0006Me-DT for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:10 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:53799) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTowz-0006Lj-49 for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:09 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N17l4-1gVmX23mPq-012bag; Thu, 23 May 2019 16:43:47 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:34 +0200 Message-Id: <20190523144336.13960-9-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:RfUqtwaq+SNTjIfAEcu3U45jOpyRrW+Lr1Rq/nN6AvmHsV2Av3x 3DhBtn7CdObLTJ2Sput6MQwePPrgXLX6+uwTfdRA0BemS98RAyA9R9DIoQvheYPPy4sSA59 MdApKaTjGjLeGHwqKeoWPla5pAMQn8UABonv8pXYnhsx3AmWUvIqssSUxfy8GtAKm6GtwhC bIT6L1bNxB/OSE9gwgREg== X-UI-Out-Filterresults: notjunk:1;V03:K0:F+deb7E1NZ4=:Tq+MUOeXS9AUMRBpdloGWo v5389u/hF2NDXvxJfbDY6S4qZfagoo3YfPpvHlj6yvuuC3f+AKSWIPpsl3MuKMpBFPq29WiUZ HD6a5NuzLwIPA/eiN7PMV90ljhDpRtbe+dE9JK5Oy0rfxrdcPW7NS/wryJQqDPcJTuBrfVfRj g5tfAZjhE29BU0Ag9/YmRznmIUQoHWEJsg7fB3AF50Lw96PcV+TB72tnlQJ1SLa7D42QZJ15T Pei+N7lUttiGZCUE6ITOW7UX+BBUYUbjP63zTQ6ZEya4AZhkj6aK61qQ409vgKCPlLOxWn4ik ZntBJ2BNGV25JBmIJNHDPbNBCTC4Ia+8Cuem1qXrDxGmLktObbYaG/AbomPYMRyF0euhYx+VQ WripoieG3pc4T3mEWkVyaPwLIhi9TONMh8LInPkpAKatYAvnnIJHkXrfaU8CNDnmFUkIbe6uw bivqG8nrIbXi/tzYJS0RQychaPt4j/Ior+0rH0npGNuSupomZ9wcMrJE/HRKJwD8FIHX21oJ5 fo134AqQabYf1mhui4+x744ER0hAwVSsgJwCxTUDNwGfb7+W38SREAhlsC4JnXZ29HXRJGF8K /sXwAk0fK51RKwWOpkwwJDeuKygsCtTu2G3YLlzSS9xwXR9GdYXL54wOAcb+/MSgAMBuWlfz+ ztQBDjOE7DYTvaNOXV/yaBJsNd0naNcADJ570seQxDP8DI11zoeeDruW1Y6FhluhAB1Tmtz99 gJdOVN4NCnTHXp/E+4070nOMzz5hsxjX6AQRMQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PULL 08/10] linux-user: Fix shmat emulation by honoring host SHMLBA X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Richard Henderson , Laurent Vivier , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson For those hosts with SHMLBA > getpagesize, we don't automatically select a guest address that is compatible with the host. We can achieve this by boosting the alignment of guest_base and by adding an extra alignment argument to mmap_find_vma. Signed-off-by: Richard Henderson Message-Id: <20190519201953.20161-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 17 ++++++----- linux-user/mmap.c | 70 +++++++++++++++++++++++--------------------- linux-user/qemu.h | 2 +- linux-user/syscall.c | 3 +- 4 files changed, 50 insertions(+), 42 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 02832adfbc0c..a23aa4493e72 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -3,6 +3,7 @@ #include =20 #include +#include =20 #include "qemu.h" #include "disas/disas.h" @@ -2012,6 +2013,8 @@ unsigned long init_guest_space(unsigned long host_sta= rt, unsigned long guest_start, bool fixed) { + /* In order to use host shmat, we must be able to honor SHMLBA. */ + unsigned long align =3D MAX(SHMLBA, qemu_host_page_size); unsigned long current_start, aligned_start; int flags; =20 @@ -2029,7 +2032,7 @@ unsigned long init_guest_space(unsigned long host_sta= rt, } =20 /* Setup the initial flags and start address. */ - current_start =3D host_start & qemu_host_page_mask; + current_start =3D host_start & -align; flags =3D MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE; if (fixed) { flags |=3D MAP_FIXED; @@ -2065,8 +2068,8 @@ unsigned long init_guest_space(unsigned long host_sta= rt, return (unsigned long)-1; } munmap((void *)real_start, host_full_size); - if (real_start & ~qemu_host_page_mask) { - /* The same thing again, but with an extra qemu_host_page_size + if (real_start & (align - 1)) { + /* The same thing again, but with extra * so that we can shift around alignment. */ unsigned long real_size =3D host_full_size + qemu_host_page_si= ze; @@ -2079,7 +2082,7 @@ unsigned long init_guest_space(unsigned long host_sta= rt, return (unsigned long)-1; } munmap((void *)real_start, real_size); - real_start =3D HOST_PAGE_ALIGN(real_start); + real_start =3D ROUND_UP(real_start, align); } current_start =3D real_start; } @@ -2106,7 +2109,7 @@ unsigned long init_guest_space(unsigned long host_sta= rt, } =20 /* Ensure the address is properly aligned. */ - if (real_start & ~qemu_host_page_mask) { + if (real_start & (align - 1)) { /* Ideally, we adjust like * * pages: [ ][ ][ ][ ][ ] @@ -2134,7 +2137,7 @@ unsigned long init_guest_space(unsigned long host_sta= rt, if (real_start =3D=3D (unsigned long)-1) { return (unsigned long)-1; } - aligned_start =3D HOST_PAGE_ALIGN(real_start); + aligned_start =3D ROUND_UP(real_start, align); } else { aligned_start =3D real_start; } @@ -2171,7 +2174,7 @@ unsigned long init_guest_space(unsigned long host_sta= rt, * because of trouble with ARM commpage setup. */ munmap((void *)real_start, real_size); - current_start +=3D qemu_host_page_size; + current_start +=3D align; if (host_start =3D=3D current_start) { /* Theoretically possible if host doesn't have any suitably * aligned areas. Normally the first mmap will fail. diff --git a/linux-user/mmap.c b/linux-user/mmap.c index e0249efe4fed..10796b37ac7b 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -202,49 +202,52 @@ unsigned long last_brk; =20 /* Subroutine of mmap_find_vma, used when we have pre-allocated a chunk of guest address space. */ -static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size) +static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size, + abi_ulong align) { - abi_ulong addr; - abi_ulong end_addr; + abi_ulong addr, end_addr, incr =3D qemu_host_page_size; int prot; - int looped =3D 0; + bool looped =3D false; =20 if (size > reserved_va) { return (abi_ulong)-1; } =20 - size =3D HOST_PAGE_ALIGN(size); + /* Note that start and size have already been aligned by mmap_find_vma= . */ + end_addr =3D start + size; - if (end_addr > reserved_va) { - end_addr =3D reserved_va; + if (start > reserved_va - size) { + /* Start at the top of the address space. */ + end_addr =3D ((reserved_va - size) & -align) + size; + looped =3D true; } - addr =3D end_addr - qemu_host_page_size; =20 + /* Search downward from END_ADDR, checking to see if a page is in use.= */ + addr =3D end_addr; while (1) { + addr -=3D incr; if (addr > end_addr) { if (looped) { + /* Failure. The entire address space has been searched. = */ return (abi_ulong)-1; } - end_addr =3D reserved_va; - addr =3D end_addr - qemu_host_page_size; - looped =3D 1; - continue; - } - prot =3D page_get_flags(addr); - if (prot) { - end_addr =3D addr; - } - if (addr && addr + size =3D=3D end_addr) { - break; + /* Re-start at the top of the address space. */ + addr =3D end_addr =3D ((reserved_va - size) & -align) + size; + looped =3D true; + } else { + prot =3D page_get_flags(addr); + if (prot) { + /* Page in use. Restart below this page. */ + addr =3D end_addr =3D ((addr - size) & -align) + size; + } else if (addr && addr + size =3D=3D end_addr) { + /* Success! All pages between ADDR and END_ADDR are free.= */ + if (start =3D=3D mmap_next_start) { + mmap_next_start =3D addr; + } + return addr; + } } - addr -=3D qemu_host_page_size; } - - if (start =3D=3D mmap_next_start) { - mmap_next_start =3D addr; - } - - return addr; } =20 /* @@ -253,7 +256,7 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start= , abi_ulong size) * It must be called with mmap_lock() held. * Return -1 if error. */ -abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size) +abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align) { void *ptr, *prev; abi_ulong addr; @@ -265,11 +268,12 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong si= ze) } else { start &=3D qemu_host_page_mask; } + start =3D ROUND_UP(start, align); =20 size =3D HOST_PAGE_ALIGN(size); =20 if (reserved_va) { - return mmap_find_vma_reserved(start, size); + return mmap_find_vma_reserved(start, size, align); } =20 addr =3D start; @@ -299,7 +303,7 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size) if (h2g_valid(ptr + size - 1)) { addr =3D h2g(ptr); =20 - if ((addr & ~TARGET_PAGE_MASK) =3D=3D 0) { + if ((addr & (align - 1)) =3D=3D 0) { /* Success. */ if (start =3D=3D mmap_next_start && addr >=3D TASK_UNMAPPE= D_BASE) { mmap_next_start =3D addr + size; @@ -313,12 +317,12 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong si= ze) /* Assume the result that the kernel gave us is the first with enough free space, so start again at the next higher target page. */ - addr =3D TARGET_PAGE_ALIGN(addr); + addr =3D ROUND_UP(addr, align); break; case 1: /* Sometimes the kernel decides to perform the allocation at the top end of memory instead. */ - addr &=3D TARGET_PAGE_MASK; + addr &=3D -align; break; case 2: /* Start over at low memory. */ @@ -416,7 +420,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t prot, if (!(flags & MAP_FIXED)) { host_len =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); - start =3D mmap_find_vma(real_start, host_len); + start =3D mmap_find_vma(real_start, host_len, TARGET_PAGE_SIZE); if (start =3D=3D (abi_ulong)-1) { errno =3D ENOMEM; goto fail; @@ -710,7 +714,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong ol= d_size, } else if (flags & MREMAP_MAYMOVE) { abi_ulong mmap_start; =20 - mmap_start =3D mmap_find_vma(0, new_size); + mmap_start =3D mmap_find_vma(0, new_size, TARGET_PAGE_SIZE); =20 if (mmap_start =3D=3D -1) { errno =3D ENOMEM; diff --git a/linux-user/qemu.h b/linux-user/qemu.h index ef400cb78ac6..82d33d7e93d5 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -443,7 +443,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong ol= d_size, abi_ulong new_addr); extern unsigned long last_brk; extern abi_ulong mmap_next_start; -abi_ulong mmap_find_vma(abi_ulong, abi_ulong); +abi_ulong mmap_find_vma(abi_ulong, abi_ulong, abi_ulong); void mmap_fork_start(void); void mmap_fork_end(int child); =20 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a0c2bf7db43c..e43255c29e56 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3935,7 +3935,8 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_en= v, else { abi_ulong mmap_start; =20 - mmap_start =3D mmap_find_vma(0, shm_info.shm_segsz); + /* In order to use the host shmat, we need to honor host SHMLBA. = */ + mmap_start =3D mmap_find_vma(0, shm_info.shm_segsz, MAX(SHMLBA, sh= mlba)); =20 if (mmap_start =3D=3D -1) { errno =3D ENOMEM; --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558623178; cv=none; d=zoho.com; s=zohoarc; b=A5Vkvwmg5tEk6OKFhTjRyOd2vzqGUWohWiMq0MVQixLgzhESTnxY+lXboTRx3oF5SV/0/RW5liIew+b2k1Yi9598W/M+5tEVY3r73VAwJaZg6P0+uKIe69m3aPkjP6s4/k4JPItWhxVUtONvXHw07tzWArGJqgXgX55OH8dQ/2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558623178; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=598f44TGDuB7IZvCNYslfKPq6sNaQzuRh2yw82YelaU=; b=jyOkkVhronpuHChOJzVKJTEi5/d3PeANMOEeKkHTb+FHTWnJT1rRIv9FahdBkxQKZg1jXlXrlFho8KmD/7UxvmoRh59Jo1FeMgJ6wDUrU7MdSldo+J2xuPO+Vjk5vc4vFYl/9YO3xTmK/nZIhKhOhMnhJ0Z+3T0g3GD9Q8hDu+s= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15586231786441020.1440381946303; Thu, 23 May 2019 07:52:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:38159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp5N-0002eP-Mx for importer@patchew.org; Thu, 23 May 2019 10:52:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTowv-0004E7-Tt for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTowv-0006EE-0V for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:05 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:51857) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTowu-0006Ct-Mc for qemu-devel@nongnu.org; Thu, 23 May 2019 10:44:04 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MtwEO-1ge4H12l8m-00uK7E; Thu, 23 May 2019 16:43:47 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:35 +0200 Message-Id: <20190523144336.13960-10-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:cs5dL+X0+zasUeXQvoPJVHhfkw/EwMe1R2voizKI35ZRlKPrz33 91yv08yz56F4EgYkfgadCkW+//Hf1Lj+n6l7znXrazaElkDBqPszz+q89EGpqeQDbMGHXqY D0Vtsi7X4y5t7k2lLJuUXnZSlEtd8OTkl/IvzC5TAj1xd0zHOkb0z5iWYEeAJHsLxsypbwV KiBnTwg+B5m1Mbnc7v0hQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:hUXmpm1N3uw=:VpozkE213P2bVP2P5vnXey r+tdpGI0VLHOAtyCdieEoe440MKAoaD9AuO7GTQBntGxUJN1/u9Imip9dtkKF+EsB9my6uN4+ 2oJEiZl1SZOsUofyf+EtphgcteF++sJscd3bhAbgasvLPmT+/M1T5P8yUStX2+psg5abWA6IU edMrvnhT9l47uZoQQgPsjOr4iMP10VVJoXUKoY1j+noPNF0VQOhlMxzqAK3fjhdUBBXfrHyEV BolUuyQMWg3rET5ncGuFkjVZSLyalHximClmhEVOMS5Jx0MBEeBB2csNRduJDoGdVXvLGkZPy gY22Vl9OCz56GJZ7PJliS5bbnzoyg/4ImNtXPqlIca+4tfZ6PuOdgjAvBGzIUeu3dluz7ww8f iIYd/kzygePbsG4Qa+t5bqp3hOsGntW1CNBe2wtM2GYrrS+PBoYjU+LhAzMVPWZsUfhOwSJaP zXMUaUnSSmOyHQr/0svRJRmvn4sJR9uUxmNV/QEqxmGls7tIPeBGBp/LRVNOoAglFBGVpT6+4 t7TIaoMT6L/P7RmH6S3hZ2aWDK12xIfHh98hG9RKmpsZvIwp0s8aX5X+/w60r8vFKJGiL+112 uPMqomiDQ3ppCVk3lTJvuzm+PvWzUgRcH4QDpt2PzmR+WucV11hf6ic8QKJ9JkrDyjrBG/jNt XIV43X6CXvN97aJI+qfOVJifao5DZrND6gCY6favGwtFq8+0Unv4ia9pbxC/GxKEZvezMv1ut +rg9udD7ir7ERr2Dvh5HtBGtHwYkR3zj3wvZTQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.187 Subject: [Qemu-devel] [PULL 09/10] linux-user: Align mmap_find_vma to host page size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Richard Henderson , Laurent Vivier , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson This can avoid stack allocation failures for i386 guest on ppc64 (64k page) host. Suggested-by: Laurent Vivier Signed-off-by: Richard Henderson Message-Id: <20190519201953.20161-14-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/mmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 10796b37ac7b..af41339d576b 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -262,6 +262,8 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size= , abi_ulong align) abi_ulong addr; int wrapped, repeat; =20 + align =3D MAX(align, qemu_host_page_size); + /* If 'start' =3D=3D 0, then a default start address is used. */ if (start =3D=3D 0) { start =3D mmap_next_start; --=20 2.20.1 From nobody Thu May 2 23:04:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558623111; cv=none; d=zoho.com; s=zohoarc; b=l+XEF0QHxeAAXIz5QK+sAM0qJ9hTvX2i2ZMdTrwokXr/R20Z7/TnpZLIuTY5Iiu5D+i0x61m9kHgk2drV7msezqFvz91zNBZiPYGEOhryn3jO2IrqQjjZkXFoW1D5S/uLSBX+N8hZ9TCHrjcSXC0qNYUs9UCstyVc7Fk/MThqSo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558623111; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=e7Swvwe0efsulLShBZ8YgP39DWetc+/8sSs691l2JVg=; b=dJH0HGdpnAsWPvyy2eeAqWjlfvK9bcsOrY2w3iJNCwHQkz2u/6enUpzOs7iR7p73AzCjjsP6TZRDKKCQ2jEEXLyv3e0kg4+JXLIVpsJClpugQJwgSzPQzK781GoWW5CsfF0VK5pUu+JBaUopkgA1kIPc8vKkM9IN16Vj6AVotOU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558623111013169.95411889629452; Thu, 23 May 2019 07:51:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:38151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp4J-0001ru-SD for importer@patchew.org; Thu, 23 May 2019 10:51:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTp2M-0000kq-Si for qemu-devel@nongnu.org; Thu, 23 May 2019 10:49:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTp2L-0003JK-Ad for qemu-devel@nongnu.org; Thu, 23 May 2019 10:49:42 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:46953) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTp2L-0003H0-1G for qemu-devel@nongnu.org; Thu, 23 May 2019 10:49:41 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MEFjJ-1hKAIC40wv-00AEv3; Thu, 23 May 2019 16:43:50 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:36 +0200 Message-Id: <20190523144336.13960-11-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523144336.13960-1-laurent@vivier.eu> References: <20190523144336.13960-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:tJl6uPyntQEDs0rLyxPhim3Ow9M7YkZnNRpvbEdEA9cGj71muZv j+z+CcWAw0zRpvpKdbrWFBB7NzytYquvHIzqIyjeK/45IpD1fHo+Y//b+AgRKX04sP4IaPu 8cIz09UaQhOW9CYX4PznpW14z9Ym+HLDNblc9a1tA+c0oXdyZ8TLda0XwKDK+qR5hPZamNJ VSOJhlmpaG991pRXM5DCg== X-UI-Out-Filterresults: notjunk:1;V03:K0:8CdGu0GyA6k=:5lwMDrw9ben87ccuYgmzaV adoa7RgfmsyEMcVL5tygc9fRdc9vV1H2zcoDaUPZ6qPJoT1Dsy59tdchqtF2syOeCNOFoqVYK 2dboRH6uXa2N5rXb7e2AKtcx35ImRyctckDcNuQHBQkhEj5D35sAorM+Ie/g8p/iDT4Y4LEax DsVRhYrDe01RUN79z4/SYFN+a1KawPsOWpbvvFwNauy1OY9xYs0rZ8wedYr+B5WQ2BRaa3n9i LzV01lv+ukOn60qa8+LLKFUMlASjV/iWxdNORlinUiCtWHYoWiMpj+wkcie42Jav6GzwnjchM +y8cu+FmjuZN/RHWWtjVdgWeUrr3ed0kd0nQmoAVwH9nVN6vQlAX9ZKOgWori64ZrYzSXVn7v ZRPLt7Gz20ZJFN+hS0QScJps7cUmerLui4OW8LKjb5D2/Vi2RxqF26UUgHbJmHp4rWsMN2rVg jJ2rjz1MeAJVYMcNvTMMkP8pVPw/2i5G18xTcuetFma/3eAWYlTU3Hhof9Y0jbP3rLe5zKRC1 5NeXVD1fBu1hAI+OA9sJMykpDYZ24S57fXB3crlMocCTFjSafXZ00EsSQqVyB2FMLoOdkIHjr Mbfk1+VGhQsF053wCvA5D82dCA8oGJrxNBSCZXvJLjFuefnAzqd8oc2Uzm3vgj8bJbyZY+qtH OMj0gSKN7w+WD8wPEWuyDCbjIcE0rYoyczF8hsrD+3TEEzd0rPd44UZwHl7ocfSsmP3WNOTsP YcRsEPkykhcYlXID7ztn9+E6Z8RUhvqAS8w7dg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.133 Subject: [Qemu-devel] [PULL 10/10] linux-user: Pass through nanosecond timestamp components for stat syscalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Riku Voipio , Laurent Vivier , Chen-Yu Tsai , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Chen-Yu Tsai Since Linux 2.6 the stat syscalls have mostly supported nanosecond components for each of the file-related timestamps. QEMU user mode emulation currently does not pass through the nanosecond portion of the timestamp, even when the host system fills in the value. This results in a mismatch when run on subsecond resolution filesystems such as ext4 or XFS. An example of this leading to inconsistency is cross-debootstraping a full desktop root filesystem of Debian Buster. Recent versions of fontconfig store the full timestamp (instead of just the second portion) of the directory in its per-directory cache file, and checks this against the directory to see if the cache is up-to-date. With QEMU user mode emulation, the timestamp stored is incorrect, and upon booting the rootfs natively, fontconfig discovers the mismatch, and proceeds to rebuild the cache on the comparatively slow machine (low-power ARM vs x86). This stalls the first attempt to open whatever application that incorporates fontconfig. This patch renames the "unused" padding trailing each timestamp element to its nanosecond counterpart name if such an element exists in the kernel sources for the given platform. Not all do. Then have the syscall wrapper fill in the nanosecond portion if the host supports it, as specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros. Recent versions of glibc only use stat64 and newfstatat syscalls on 32-bit and 64-bit platforms respectively. The changes in this patch were tested by directly calling the stat, stat64 and newfstatat syscalls directly, in addition to the glibc wrapper, on arm and aarch64 little endian targets. Reviewed-by: Laurent Vivier Signed-off-by: Chen-Yu Tsai Message-Id: <20190522162147.26303-1-wens@kernel.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 19 +++++++++++++++ linux-user/syscall_defs.h | 49 +++++++++++++++++++++++++-------------- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e43255c29e56..e311fcda0517 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6432,6 +6432,11 @@ static inline abi_long host_to_target_stat64(void *c= pu_env, __put_user(host_st->st_atime, &target_st->target_st_atime); __put_user(host_st->st_mtime, &target_st->target_st_mtime); __put_user(host_st->st_ctime, &target_st->target_st_ctime); +#if _POSIX_C_SOURCE >=3D 200809L || _XOPEN_SOURCE >=3D 700 + __put_user(host_st->st_atim.tv_nsec, &target_st->target_st_atime_n= sec); + __put_user(host_st->st_mtim.tv_nsec, &target_st->target_st_mtime_n= sec); + __put_user(host_st->st_ctim.tv_nsec, &target_st->target_st_ctime_n= sec); +#endif unlock_user_struct(target_st, target_addr, 1); } else #endif @@ -6462,6 +6467,11 @@ static inline abi_long host_to_target_stat64(void *c= pu_env, __put_user(host_st->st_atime, &target_st->target_st_atime); __put_user(host_st->st_mtime, &target_st->target_st_mtime); __put_user(host_st->st_ctime, &target_st->target_st_ctime); +#if _POSIX_C_SOURCE >=3D 200809L || _XOPEN_SOURCE >=3D 700 + __put_user(host_st->st_atim.tv_nsec, &target_st->target_st_atime_n= sec); + __put_user(host_st->st_mtim.tv_nsec, &target_st->target_st_mtime_n= sec); + __put_user(host_st->st_ctim.tv_nsec, &target_st->target_st_ctime_n= sec); +#endif unlock_user_struct(target_st, target_addr, 1); } =20 @@ -8915,6 +8925,15 @@ static abi_long do_syscall1(void *cpu_env, int num, = abi_long arg1, __put_user(st.st_atime, &target_st->target_st_atime); __put_user(st.st_mtime, &target_st->target_st_mtime); __put_user(st.st_ctime, &target_st->target_st_ctime); +#if (_POSIX_C_SOURCE >=3D 200809L || _XOPEN_SOURCE >=3D 700) && \ + defined(TARGET_STAT_HAVE_NSEC) + __put_user(st.st_atim.tv_nsec, + &target_st->target_st_atime_nsec); + __put_user(st.st_mtim.tv_nsec, + &target_st->target_st_mtime_nsec); + __put_user(st.st_ctim.tv_nsec, + &target_st->target_st_ctime_nsec); +#endif unlock_user_struct(target_st, arg2, 1); } } diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index cb40620114f8..7f141f699c1a 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1185,6 +1185,7 @@ struct target_winsize { #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ || defined(TARGET_CRIS) +#define TARGET_STAT_HAVE_NSEC struct target_stat { unsigned short st_dev; unsigned short __pad1; @@ -1199,11 +1200,11 @@ struct target_stat { abi_ulong st_blksize; abi_ulong st_blocks; abi_ulong target_st_atime; - abi_ulong __unused1; + abi_ulong target_st_atime_nsec; abi_ulong target_st_mtime; - abi_ulong __unused2; + abi_ulong target_st_mtime_nsec; abi_ulong target_st_ctime; - abi_ulong __unused3; + abi_ulong target_st_ctime_nsec; abi_ulong __unused4; abi_ulong __unused5; }; @@ -1235,13 +1236,13 @@ struct target_stat64 { abi_ulong __pad4; /* future possible st_blocks high bits */ =20 abi_ulong target_st_atime; - abi_ulong __pad5; + abi_ulong target_st_atime_nsec; =20 abi_ulong target_st_mtime; - abi_ulong __pad6; + abi_ulong target_st_mtime_nsec; =20 abi_ulong target_st_ctime; - abi_ulong __pad7; /* will be high 32 bits of ctime someday */ + abi_ulong target_st_ctime_nsec; =20 unsigned long long st_ino; } QEMU_PACKED; @@ -1320,19 +1321,20 @@ struct target_stat64 { unsigned int st_blocks; =20 abi_ulong target_st_atime; - abi_ulong __unused1; + abi_ulong target_st_atime_nsec; =20 abi_ulong target_st_mtime; - abi_ulong __unused2; + abi_ulong target_st_mtime_nsec; =20 abi_ulong target_st_ctime; - abi_ulong __unused3; + abi_ulong target_st_ctime_nsec; =20 abi_ulong __unused4[3]; }; =20 #elif defined(TARGET_SPARC) =20 +#define TARGET_STAT_HAVE_NSEC struct target_stat { unsigned short st_dev; abi_ulong st_ino; @@ -1343,14 +1345,14 @@ struct target_stat { unsigned short st_rdev; abi_long st_size; abi_long target_st_atime; - abi_ulong __unused1; + abi_ulong target_st_atime_nsec; abi_long target_st_mtime; - abi_ulong __unused2; + abi_ulong target_st_mtime_nsec; abi_long target_st_ctime; - abi_ulong __unused3; + abi_ulong target_st_ctime_nsec; abi_long st_blksize; abi_long st_blocks; - abi_ulong __unused4[2]; + abi_ulong __unused1[2]; }; =20 #define TARGET_HAS_STRUCT_STAT64 @@ -1378,20 +1380,21 @@ struct target_stat64 { unsigned int st_blocks; =20 unsigned int target_st_atime; - unsigned int __unused1; + unsigned int target_st_atime_nsec; =20 unsigned int target_st_mtime; - unsigned int __unused2; + unsigned int target_st_mtime_nsec; =20 unsigned int target_st_ctime; - unsigned int __unused3; + unsigned int target_st_ctime_nsec; =20 - unsigned int __unused4; - unsigned int __unused5; + unsigned int __unused1; + unsigned int __unused2; }; =20 #elif defined(TARGET_PPC) =20 +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1449,6 +1452,7 @@ struct QEMU_PACKED target_stat64 { =20 #elif defined(TARGET_MICROBLAZE) =20 +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1564,6 +1568,7 @@ struct target_stat64 { =20 #elif defined(TARGET_ABI_MIPSN64) =20 +#define TARGET_STAT_HAVE_NSEC /* The memory layout is the same as of struct stat64 of the 32-bit kernel.= */ struct target_stat { unsigned int st_dev; @@ -1603,6 +1608,7 @@ struct target_stat { =20 #elif defined(TARGET_ABI_MIPSN32) =20 +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ @@ -1627,6 +1633,7 @@ struct target_stat { =20 #elif defined(TARGET_ABI_MIPSO32) =20 +#define TARGET_STAT_HAVE_NSEC struct target_stat { unsigned st_dev; abi_long st_pad1[3]; /* Reserved for network id */ @@ -1743,6 +1750,7 @@ struct target_stat64 { =20 #elif defined(TARGET_SH4) =20 +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1802,6 +1810,7 @@ struct QEMU_PACKED target_stat64 { }; =20 #elif defined(TARGET_I386) && !defined(TARGET_ABI32) +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1847,6 +1856,7 @@ struct target_stat { abi_ulong __unused[3]; }; #elif defined(TARGET_AARCH64) +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1869,6 +1879,7 @@ struct target_stat { unsigned int __unused[2]; }; #elif defined(TARGET_XTENSA) +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1918,6 +1929,7 @@ struct target_stat64 { =20 /* These are the asm-generic versions of the stat and stat64 structures */ =20 +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1969,6 +1981,7 @@ struct target_stat64 { =20 #elif defined(TARGET_HPPA) =20 +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_uint st_dev; abi_uint st_ino; --=20 2.20.1