From patchwork Fri May 24 11:25:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959757 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A2C96C5 for ; Fri, 24 May 2019 11:29:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84216287CE for ; Fri, 24 May 2019 11:29:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 782272883B; Fri, 24 May 2019 11:29:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 11FCB287CE for ; Fri, 24 May 2019 11:29:20 +0000 (UTC) Received: from localhost ([127.0.0.1]:52734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Nz-00005j-VL for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:29:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Ke-0005GI-VF for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8Kd-000120-Ts for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:52 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:38207) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8Kd-00011U-Ke for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:51 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N1Oft-1gVkfU03n1-012nSm; Fri, 24 May 2019 13:25:27 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:12 +0200 Message-Id: <20190524112520.17684-2-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:ZVJYp+Pllff+VmZhbOP76AzxDzdoZoTwwGTC5KpDvz8SNllhHJ+ dvaiBIkjt5RqKtjHVsBf1qZIzcfbJ/dYDiumlEJ8t2A/zG3E0X2+Dsewg5nRWfbmbGkNiO4 XNXzGfJkhWDlXR7i5rFCwpjLFKPYI5KzHpzWN83EV67EQGWbS2w+E54nrUvqEifrHxnuKzP VIIYq2FVw/zBRMfyUULBA== X-UI-Out-Filterresults: notjunk:1;V03:K0:UJA3Ia/IE0E=:adhDTI+EvNq2snAh8G9tye SoBvaT0zh94DeLvNExBmHG0W7KGEdsh1uNjUgbx5LPSAkFvqLXMT9Gf42SOfkRI7UZORWNivz 5f/A7h/82NTVQbsfCDJP2UPf6242GNuFDlVM7HXNXIbJcbkLf+cuz2tlRXg6s+ZLEaORH/rfe X0Zo1Ld+AgwYXdir12fMaj3qe+EgrDeYR3Em6kec/CZNF1LfSVk4SBExBaFLe0sqzCCcjOu+N wffU804vhKb/nUr7NxMvt7NUBRXDP9KwrXV4sOSF+OMCbvKanFR/udVlif7Ar4RH5jxeOsGLW d3hMoMOjSXVqpi0lZrCpBVLQj7dONzsTd6S9gd6Lsb37WeUHcsBEIw9gWA237jtTx8Uhns0zX 5mu8ym27lXZ156pwD99UrzZRZNconjdiJczfbsD1h3jDymXYHoXmObCpitgXAiGEOhJ5QUm+r 5pS2MnZ5eE094hl2t41z/7ZDhdebPBXpsqyEFGDbytuoifHHYeihmRRIb5LMAWJBFkHgj/2vz 2Eae5I179F6aL/vt2sRvldODPdYcasYYCasvcHY4cm2dLF2ngbdPD6J2zuZX0uFNXccsfX0q2 iLqilur46Am6U/BrbT0FhsTPdx/Hh4fe6rQveVdqHf9VvClJ/vi5CzgjbcmSG/Wu3w8q3KhiX gGCVTUR4vtZnoVLq7AZj2Jgr5PkkHgZ4nv2yBOJRtq2jHUxfb/XOQKSfJhb0i0Yo8Lc1WYYCX 7ZPSwqB3SFBApn27s1svouAu4/5rrM0crJwsWg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.24 Subject: [Qemu-devel] [PULL v2 1/9] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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, const char *entry) return 0; } -#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) +#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) || \ + defined(TARGET_SPARC) static int is_proc(const char *filename, const char *entry) { return strcmp(filename, entry) == 0; } +#endif +#if defined(HOST_WORDS_BIGENDIAN) != 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 +#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 flags, 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) != 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 } }; From patchwork Fri May 24 11:25:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03D4E112C for ; Fri, 24 May 2019 11:32:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4FFC2883B for ; Fri, 24 May 2019 11:31:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D677328843; Fri, 24 May 2019 11:31:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 678582883B for ; Fri, 24 May 2019 11:31:59 +0000 (UTC) Received: from localhost ([127.0.0.1]:52785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8QY-0002OM-Nn for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:31:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Kl-0005VY-M4 for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8Kk-00016n-CO for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:59 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:56361) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8Kk-00015t-2k for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:58 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MIxBc-1hE7uX2oIs-00KLxV; Fri, 24 May 2019 13:25:27 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:13 +0200 Message-Id: <20190524112520.17684-3-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:xh6Sa+2nA5IJIw6duJjLbQWWY83kKZ7wbiyhA1zFQk+M7MZ2sSi q/3g1sa8zGf4oq+nBDmzXxAzml1R2gQ0mgrffuspRfx6TQYYBE5DKrDZbeN58uWnph+7v21 Ho5DXeLUSUiw8Lw/4zSY+zEQeqO9aUD2yiRZbL3jeQtpVeRQC+Dpkh1M5zVb8M8hBJoQwWb wgisxbKJu7fqzhRAcwQhA== X-UI-Out-Filterresults: notjunk:1;V03:K0:vTBt5pFikrA=:ctiZ5RRbmbZHDB9++HuYjP 38dYVcw9zTuaqrz+9D53PUkM1ecF0uBXmNJbdp3HBvdnyWcttTCyIEBn/yqeCrMvh/nY4DFjb NRLY4VsNnJXQWqe1sxfBJvHQFUPmc4opspipPZtowg9otqBMG3obtQQ/HVD3v7wQRfbuoLjhJ bvMnhpjNq6RPpQM9au1pwm6Qefo5m7iprvuGSUl9q50vJvObR/o/DlIlmqhhAn+HZcZ2TjtXI T/kcKxqApH4Fo0dcG50vb7xXqzbFKTHMgf1MwK3KwMnvy4fA4KYanaZC0vrad7qge+i2v2UG3 KoWExqzFFJY61+/Is3CMJaBxhhi9L/W5c7oBlvpskCDKTBtpJ5xVRRp/SXqaez3SfOBw3dQml 3PW0MgmWveJYs7xu+qDGnCFP9pqmMgoWcv2h8yZkzUleepMgI7CSXBnOAeHwUPVbYi/kmuGvK aX6V7scP7VrWoPSbQtcgJ5sJwI6/gosf3Tx4KOmpca3luYmASfME46G+q7h0VEZk+i86xzTkm /LsJoKqHEEZeirX05Du0ko5aflwiqc54CVJVZJKOKOII/T0FM8FSdfQRVXYHNZJgh9KVVuHyC PoH3aWHqLCX2c8DZn14KlvK1jxvuqFKpKSCBgo9Yt7kg0aLkiDUR5xG9ywxqPXEdTaXgKPtFR 3OeX6m1iiwetDdQggdfdL7JgK16WDu2NJvZuuPDWVX/4vfZjJEqmheJSy/M4gsdK0xW/StC0h AhYL+hSISxWX/L/E8sUaPsZ0vikNtwOixJNWfQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PULL v2 2/9] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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) } #if defined(HOST_WORDS_BIGENDIAN) != 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) == 0; @@ -6847,6 +6847,14 @@ static int open_cpuinfo(void *cpu_env, int fd) } #endif +#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 flags, 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 } }; From patchwork Fri May 24 11:25:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F05121395 for ; Fri, 24 May 2019 11:27:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE299287CE for ; Fri, 24 May 2019 11:27:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D23E11FF29; Fri, 24 May 2019 11:27:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C7CD1FF29 for ; Fri, 24 May 2019 11:27:14 +0000 (UTC) Received: from localhost ([127.0.0.1]:52712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Lx-0006nO-Ug for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:27:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Ke-0005Fr-CM for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8Kd-00011c-2X for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:52 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:42597) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8Kc-000118-PZ for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:51 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mq2vU-1gprp41N9m-00nDc5; Fri, 24 May 2019 13:25:28 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:14 +0200 Message-Id: <20190524112520.17684-4-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:lsbnsglWsnMP83Af3VQjKNBIC2E4zUcnBXX3GszR69zo3K7mg+5 KhKCBN0faP4MkHDj/60JRVr0KxYjdHRgPiflaRSyHyWNk8mX24C9ziGqcIN4lS0VE4/QKQK 093ksR6O/8zNYL6Pj50VHuKYuUM/XUbnSSW6/3syondW3+n3sBJLagkq0+qF4Y9qGas2o2i sHSv5TnOZVmA8T2aFYk8Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:ETalZQH+KBM=:+SpNcOP4TGmonnzeMuripL 2XV5X2TjciPg7IOpXfPmmE1YS3ynnQ+yMt3gvcgG6QjybRyS70tww7xmYxd6U3l+C5sv01Egr KjD1mKOkNiPGu0Mqru8xqh0IYNiD+qPHP/DKyux+sPLyJVodqMiIThANFGV1PQeh+xo1Khswq p2zEUzz4NDhRV1G8S+PLuY3nXWR8xFGCtQCTV4Hc+YEQMVBOEfFigCsURD/dg697yETw1yV5I gCN08lo8JS7Ricd8WAzyXW4p8c41uTvLsoLKx6YcX6XvV2Do9e84g8Iwp+SevAXp7JQ4OWyrh XucXDeb+OiNjpNk+JTmSuP4qNSAcgSCyGAzEHoi3mGvJ6CTvAFW62QvFerkiLwD1ikW/JekAP 8MgvlzgJ/PH9GfY7P4M57CNgskO1aFfJ8KbACXHAUIYo7W9Ui6jQohB0MaJgAW/be2PJX5nAv D5stWjFJ1ihDEHzI74eXNM1RA3u6FB7/EupjO8Ziu850rhW2vk6D5BUEs2KIK6KeoCtY1RAfq tQVg25SKpHY7BzETqel/K8Ecu0z9OMdtq02eemJ5US8RHMuMm0qsQ3Vc4nh1WezlYTYpLRINm 0A0nVWf6rMkcUHOH5zOXxWzW2XCM15AbD5VoSEetcbEqehHSjsL+1u9i2tM9jGEEcebou7SqA Jh/ZaTsAO3BzsN55ghZkqBn/duKmpciSnPNejKmnx6XialAuYtZixEoThr4V4vEvCyHj1P2cF piw+9kVvivf9IsTwlLYQhPPe4uRx0U6y7f3rPQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PULL v2 3/9] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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.com> 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 -#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 From patchwork Fri May 24 11:25:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B3921395 for ; Fri, 24 May 2019 11:31:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1870A2882F for ; Fri, 24 May 2019 11:31:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C8CD2883F; Fri, 24 May 2019 11:31:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 99D872882F for ; Fri, 24 May 2019 11:31:44 +0000 (UTC) Received: from localhost ([127.0.0.1]:52783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8QJ-0002Ex-Pa for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:31:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Kj-0005PV-Pl for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8Ki-00015S-H9 for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:57 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:50617) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8Ki-000140-7r for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:56 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MI5YH-1hNpCJ46sh-00FFho; Fri, 24 May 2019 13:25:29 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:15 +0200 Message-Id: <20190524112520.17684-5-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:PwQEIESTGe/x7EyIbQZJ7+3Sc2Kts5aj0+2tZveJH7SlRx9tfuF USBHd0UhkUV/MBnLwsC66K5MTlSmF23dm36pQ5fPFOuSiCjbOluuQxh0YRai1rhbUgX2Wpw r39oT5NIo8i5CzxiHUtz7w7egjwbFHJE1VTp0wVMFc1bl0wVddcO5ynBJShnGucjp9Dl2XI GHvVUBGqPATV6pfyDz82Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:PDYS0joFyE0=:xEqisyWnjc6Lcs5bB/+YjO GArUdMKtk5nbmrKb9I0BWHl0sHvil51i8Dx2XoBoWwwRT9/ivo3MQ0CXr4wFiEMT1I1Q/MMDE yVzNyCOyiVPLGsUc6IUFz8YatOskNYUWrY8LOxuyJNkYm4QTtZuaPrsGoQ6m9IESQo5Vrf7uW i+dGQNDbCPbFcXU5aKRLymw06hHmz61qmbhaoHdU/PVItfSQeEf3T9nEFqtG7xEg6v5IdQeDv tjN9aU8GaK0ahdXiSP/8UjfKbz9dMsLFQEPeyF8xIslpfFfxt/MxQgpK+y3ZW94MVagVaOVVj XVzAsG5aWSqiUfMLLzlVrnoxNVbzKZAaXpo9lqbGpX/uE6Pcrwpf7Y21Xdi4k/QYvU5WElcIS R5GoWtlabs4wP98OJuneNvukLx35/SAwMsjtCJhtHbMABTeD0h2vG6BCYskZziWjfY8WyzLk1 TnpTybe0AuA1Jfd0reDTehZM8GAglH7x42Q3p7benH4hHh39AuKrhBCpIFBXtKZstqwoJg2Dd kwbbSf+rE4qNVnFGuQ51pSUA263zU4PobMzQROrhKA8opNrhqQH92tqmQYSBM7TJAEGt+AgSj 3vclL9XcrrFn8MlpzCjWZM9qQsC0ZycTkKb1faiEoOeypmkcG9xYSVSfJk6AxDqL1YmvPTRH3 J5KG4fDf6J/+LZCcVq6g9Bc5nAVIjTg7Lri+2UPcowINomC1K4TpN6IbtaXVM/9eCVyVU5R1o Pd5TbDhFRiKYqhHbun58+2WkPAX0aH7NT+kNKw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PULL v2 4/9] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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.com> 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) */ From patchwork Fri May 24 11:25:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5FE16C5 for ; Fri, 24 May 2019 11:27:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C45061FF29 for ; Fri, 24 May 2019 11:27:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B86A72882C; Fri, 24 May 2019 11:27:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 91F981FF29 for ; Fri, 24 May 2019 11:27:24 +0000 (UTC) Received: from localhost ([127.0.0.1]:52714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8M7-0006xy-Se for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:27:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Kj-0005Q3-TD for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8Ki-00015b-T7 for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:57 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:53441) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8Ki-00014o-KI for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:56 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M3UhQ-1hTaMV2epO-000dFN; Fri, 24 May 2019 13:25:29 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:16 +0200 Message-Id: <20190524112520.17684-6-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:/zoP9ZJIYI3PlOLLxDV8yMn+R9FhkbQovg3b/o8RZYWWz61DxOa pj+LzCK0SquhTsrsylKFGskJxbm6+e0/Ul8WASbupDxyH1epnlM1KmzH+OtgP3+7nMXS3gx NKAKvYJyLjxBnhC0WMJXlM3dmKvRC9fcVB/us+cKghTF0lEwwwwOSqNgGUwec+3oZCJI7qv Bq0qwty2gOl+hE6fEbs/g== X-UI-Out-Filterresults: notjunk:1;V03:K0:VGizC32a5xY=:13j2DMITh3JlMUPaB68Uwr 93jp1ZXSkuQbcucid8lP7xfqXdu42KL5VFvRv7mqIne5ORt4KWBdji4+TRtaEjpWPvVWq3S1N X36dKAm9gnsmVa6Fzp47kjmdygzZT7yNnnZPRTAF+2O9SjbyGUB/AsGLXshVlxjEbB6+FbvvS HFbj0GQEbE3NXd+68sKbZ4MBpFZmkOBv7MPP+kP5M3T1q7Cg4dc8EriHlSWnrAdkeTrHWqUSG uKDgfvy/aVLwjfPJvAKDreWSnA9j4Gapp6h/MT9XH0hiLNjPqXp+2DuY0rJ83dh7FBrku4CrV B48dIm6vpZBmMqtZj4So1OuDX/NgN9wIAJ5peGgyphSwyoTWlbxSkdALTRHrvCUDpNkAb2H67 h/oCS0hakkjPRVKeVYwyXVoPfMpku9PAxxUiLZgjUJ04agk4Q8LdiiHzPBSvRO4hWu93B9UCU 00RwT1WvE6SX4MJ17y0StsUnVKkHg1a9C2VR1BXpPoICrNlcVFXZoPX0QaJ419W2XqClHBaJV 6D9jsnldc2O26KKRuH0URiOnWUufp98MiH49U4MEuzHjKMeciMt633dJrKevlbJtiiTgTHCgx HpXEVaeigfpWc9hC8jonsDf5YrNF2cU18muaMe0ZqffkcKRKx1wDLKUXNbkyjvRJS2aEf5pse X/xzfJsQBoZMFy0NoEcxF+SQZq+sNOb5emjIzLsI2bXszH9ipRpxrAZk2y+DtHFTXRGjewjAi dXK27Jltr8ZeD42PQCR3wcHpYR4En5JYEVjcMQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.74 Subject: [Qemu-devel] [PULL v2 5/9] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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.com> 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 */ /* Bridging control calls */ #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ From patchwork Fri May 24 11:25:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40560112C for ; Fri, 24 May 2019 11:34:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DAC62882F for ; Fri, 24 May 2019 11:34:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21F912884E; Fri, 24 May 2019 11:34:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD1DF2882F for ; Fri, 24 May 2019 11:34:19 +0000 (UTC) Received: from localhost ([127.0.0.1]:52809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Sp-00047k-2q for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:34:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8L2-00060Z-Ry for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8L1-0001De-OB for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:16 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:37779) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8L1-0001DJ-Fc for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:15 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MTAJl-1h3z1Q1cSN-00UYZc; Fri, 24 May 2019 13:25:31 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:17 +0200 Message-Id: <20190524112520.17684-7-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:yOFi+1/VS9lFfLHE3MmqVhmdwHuNz3e7O6H4CfrBLTkz8XQpfq8 mgoK/P8HY1atfuEt0jtDqMCHKoVLqlE0thbcyQ84yPXmGPVJZ/AlbmvikS3n3nj6m2Gj5ob ddsnwUi//nfXDP90NyXttBNFy9o+my38OlI2RqgFu6wZHcyOLmVQfrMb8mwmfn3JVXgzCZ2 CxVS2Pd6Uimt8DIglxRmw== X-UI-Out-Filterresults: notjunk:1;V03:K0:qPWGBI7w6Ww=:2UsWspFWLraJxPR9MCM7HM T3ufGbRYvxsSyRpZafksnpIOjVZFcNvmwRyanUOfEP67BKnwFa8D0FoBuIFoLnVuI00qIpYMu IMv5xG2iWNZon7M5VsZEQ0hJ6VqktV0GXDDz20VWuZ1tGXy1vF1p3OygtBBb++kpe0k3hYxrR KgEiJxNEOYfTGMPO8sLFDjr4YsstDL1sK9wA9hyqY3PWbutRRbdtB1up0GfL8boW3yezaKNra bedS3E+xzkBDr+gnnu7NKjh7eiR8d1jCypP4fuSaXWEyLtNp2wSb+Fhw5MOk+T1zciMVanExQ sDYsTkcBFaMOMyWW8+Ozu7HPedt79xZuKd81R5dNi4LuEpYnvLMdOFVdmTNa3cNgSlkr1jtYd xhfWNSRREGXHFSVx5gbo0w2TK5tpvpyTf9Zk0CsvL0RgCaEIBth42CYU/6MR//dkCpZne567r Ft4/qQfBEqJvwpS2Er3ll6jDW5ESIoClEqbdywTLs5CaaX68ou6MLvesJOIT0m3Ejwg2yanUV 7mUe3+UyhQN/tY1pQlGkqvF7aYIKKCQApdm2WdLhGehpSgSGJZVWE94gAw4HRDv2ICglARSyp //PJLsDSU4OyNL00zmG8J2vBlYA3RSeTnyr4Nkl5Un0ifWuuSmD0nSNEbsa2SubRIGGPOiZW6 i9fvAYN4e7N0JrW33whC7k65TOygGwC1cNQN/vVRONAAfAu1E/9tDbVaudWJFJ3vBOg73iLVv YG1s9mthOxf7dL3xQiA/TVgXcLwci1bnazSZb2k2uqqM9h9EF4sXrZXMltU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.73 Subject: [Qemu-devel] [PULL v2 6/9] 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_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é Reviewed-by: Laurent Vivier Message-Id: <1558282527-22183-6-git-send-email-aleksandar.markovic@rt-rk.com> 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, struct image_info *info) char *elf_interpreter = NULL; char *scratch; + memset(&interp_info, 0, sizeof(interp_info)); +#ifdef TARGET_MIPS + interp_info.fp_abi = MIPS_ABI_FP_UNKNOWN; +#endif + info->start_mmap = (abi_ulong)ELF_START_MMAP; load_elf_image(bprm->filename, bprm->fd, info, From patchwork Fri May 24 11:25:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 060511395 for ; Fri, 24 May 2019 11:29:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E35281FF29 for ; Fri, 24 May 2019 11:29:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1FA72882C; Fri, 24 May 2019 11:29:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1F65E1FF29 for ; Fri, 24 May 2019 11:29:58 +0000 (UTC) Received: from localhost ([127.0.0.1]:52738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Ob-0000ab-FH for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:29:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Kn-0005Z1-0R for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8Kl-00017U-Fw for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:00 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:53869) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8Kl-00016z-66 for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:59 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MdeSt-1guWWj09gn-00Zh5C; Fri, 24 May 2019 13:25:32 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:18 +0200 Message-Id: <20190524112520.17684-8-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:2ha9l4+kdw1Ivy1dipZ4Op7wBho/hxzHyL8IatCh663ngDSDH+E TgRqE3x4Mrc4VHEUx1wYLG5Ezzn4rRHJpGKCDVIMvDI+WG2pF/ZYsg+dDKs1Opt+ewHRoWY p/1a9hMO9z1wmRWQ8a1oVp/Jtpgw+JvN6o8H02q7vc8qXS14uc0k3yXjCSFPx2ucclNZS4f nKG9iZTqTu+8qOxPGzDWA== X-UI-Out-Filterresults: notjunk:1;V03:K0:gvayknHzqJI=:b3bHAxTf/HKNaXQIrjZZF/ rGkFn8KLB21a4ApsEBjLK0qdGoN2n4gmY61AJjA3m7zL6uTUvNLOgklyfRKYrEV0BloSjwEss et1GNf2FSayI3yafe5KLLbYRn1r0YVQ4j3KO25P+8NNkz7o7yek14Nt6YvvWdMDRdJxiA2pGY oGISBKKXPfePObZJkbWNTUQ5HzUu3ZAspgz/oO00bGvoX7Sy2wLdm2RL9RMdnSwfqndfkWXtX +lik8c69Uq2RsxC8pRtKcXddEDoWy39Jn44VjfiZ0JYQIwR1ow+N/CRga8ONbsxZI3pqDZYqs 7M1bV5L0wKFWhvTtWdppuPySkawuNGCAEMB4TswXojLZZ794MJP1LcUzkIz2AhR7zKwHmibH4 c9gw1dPGvko4Qj4iDnikzRVAWTyaA07FI2YiSn82oFKZAc6xOmFop4bpyDOVbdQjSnbQZG00A Ae9LHW+RuNZYC21b0ip/tSW8KPzqIs7Xwsfa24xjboBTOUKRUZXypLh3yTDpmmH3Gti/S7yDG 3nitT9Q9W/JgiiwAfElDJ3pDZTWV3hQY/qotlteRM+rqKHM4ZMU6pujBYHcSKL6c+K8rahTnM SFxIPuGrRElJOOGycFApN1g8p2/3NpOltlqxYQ1ic8A6V1hltDx2rc6PRA0VQrvJwRIUPEzxm srrr/Zk5n9QjSttKaZnjG8SxEyVMuV10Z5poAGzL0lXKXW7fchyKYmquRcPs8MM0ji5j6AdYI L5Dw6i5mPU4CgDn8jZDhQxSGil2kj6Dt8MHJ4g== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PULL v2 7/9] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 #include +#include #include "qemu.h" #include "disas/disas.h" @@ -2012,6 +2013,8 @@ unsigned long init_guest_space(unsigned long host_start, unsigned long guest_start, bool fixed) { + /* In order to use host shmat, we must be able to honor SHMLBA. */ + unsigned long align = MAX(SHMLBA, qemu_host_page_size); unsigned long current_start, aligned_start; int flags; @@ -2029,7 +2032,7 @@ unsigned long init_guest_space(unsigned long host_start, } /* Setup the initial flags and start address. */ - current_start = host_start & qemu_host_page_mask; + current_start = host_start & -align; flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE; if (fixed) { flags |= MAP_FIXED; @@ -2065,8 +2068,8 @@ unsigned long init_guest_space(unsigned long host_start, 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 = host_full_size + qemu_host_page_size; @@ -2079,7 +2082,7 @@ unsigned long init_guest_space(unsigned long host_start, return (unsigned long)-1; } munmap((void *)real_start, real_size); - real_start = HOST_PAGE_ALIGN(real_start); + real_start = ROUND_UP(real_start, align); } current_start = real_start; } @@ -2106,7 +2109,7 @@ unsigned long init_guest_space(unsigned long host_start, } /* 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_start, if (real_start == (unsigned long)-1) { return (unsigned long)-1; } - aligned_start = HOST_PAGE_ALIGN(real_start); + aligned_start = ROUND_UP(real_start, align); } else { aligned_start = real_start; } @@ -2171,7 +2174,7 @@ unsigned long init_guest_space(unsigned long host_start, * because of trouble with ARM commpage setup. */ munmap((void *)real_start, real_size); - current_start += qemu_host_page_size; + current_start += align; if (host_start == 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; /* 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 = qemu_host_page_size; int prot; - int looped = 0; + bool looped = false; if (size > reserved_va) { return (abi_ulong)-1; } - size = HOST_PAGE_ALIGN(size); + /* Note that start and size have already been aligned by mmap_find_vma. */ + end_addr = start + size; - if (end_addr > reserved_va) { - end_addr = reserved_va; + if (start > reserved_va - size) { + /* Start at the top of the address space. */ + end_addr = ((reserved_va - size) & -align) + size; + looped = true; } - addr = end_addr - qemu_host_page_size; + /* Search downward from END_ADDR, checking to see if a page is in use. */ + addr = end_addr; while (1) { + addr -= incr; if (addr > end_addr) { if (looped) { + /* Failure. The entire address space has been searched. */ return (abi_ulong)-1; } - end_addr = reserved_va; - addr = end_addr - qemu_host_page_size; - looped = 1; - continue; - } - prot = page_get_flags(addr); - if (prot) { - end_addr = addr; - } - if (addr && addr + size == end_addr) { - break; + /* Re-start at the top of the address space. */ + addr = end_addr = ((reserved_va - size) & -align) + size; + looped = true; + } else { + prot = page_get_flags(addr); + if (prot) { + /* Page in use. Restart below this page. */ + addr = end_addr = ((addr - size) & -align) + size; + } else if (addr && addr + size == end_addr) { + /* Success! All pages between ADDR and END_ADDR are free. */ + if (start == mmap_next_start) { + mmap_next_start = addr; + } + return addr; + } } - addr -= qemu_host_page_size; } - - if (start == mmap_next_start) { - mmap_next_start = addr; - } - - return addr; } /* @@ -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 size) } else { start &= qemu_host_page_mask; } + start = ROUND_UP(start, align); size = HOST_PAGE_ALIGN(size); if (reserved_va) { - return mmap_find_vma_reserved(start, size); + return mmap_find_vma_reserved(start, size, align); } addr = start; @@ -299,7 +303,7 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size) if (h2g_valid(ptr + size - 1)) { addr = h2g(ptr); - if ((addr & ~TARGET_PAGE_MASK) == 0) { + if ((addr & (align - 1)) == 0) { /* Success. */ if (start == mmap_next_start && addr >= TASK_UNMAPPED_BASE) { mmap_next_start = addr + size; @@ -313,12 +317,12 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size) /* 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 = TARGET_PAGE_ALIGN(addr); + addr = ROUND_UP(addr, align); break; case 1: /* Sometimes the kernel decides to perform the allocation at the top end of memory instead. */ - addr &= TARGET_PAGE_MASK; + addr &= -align; break; case 2: /* Start over at low memory. */ @@ -416,7 +420,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, if (!(flags & MAP_FIXED)) { host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); - start = mmap_find_vma(real_start, host_len); + start = mmap_find_vma(real_start, host_len, TARGET_PAGE_SIZE); if (start == (abi_ulong)-1) { errno = ENOMEM; goto fail; @@ -710,7 +714,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, } else if (flags & MREMAP_MAYMOVE) { abi_ulong mmap_start; - mmap_start = mmap_find_vma(0, new_size); + mmap_start = mmap_find_vma(0, new_size, TARGET_PAGE_SIZE); if (mmap_start == -1) { errno = 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 old_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); diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e5545cbafac7..51cc049e064f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3912,7 +3912,8 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, else { abi_ulong mmap_start; - mmap_start = mmap_find_vma(0, shm_info.shm_segsz); + /* In order to use the host shmat, we need to honor host SHMLBA. */ + mmap_start = mmap_find_vma(0, shm_info.shm_segsz, MAX(SHMLBA, shmlba)); if (mmap_start == -1) { errno = ENOMEM; From patchwork Fri May 24 11:25:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C18ED6C5 for ; Fri, 24 May 2019 11:29:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF4E71FF29 for ; Fri, 24 May 2019 11:29:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A36082882C; Fri, 24 May 2019 11:29:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50DBE1FF29 for ; Fri, 24 May 2019 11:29:32 +0000 (UTC) Received: from localhost ([127.0.0.1]:52736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8OB-0000GH-Km for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:29:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Kk-0005SC-CE for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8Kj-00015y-Gg for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:58 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:57863) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8Kj-00015R-8D for qemu-devel@nongnu.org; Fri, 24 May 2019 07:25:57 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MaIvT-1h6hmj3NPZ-00WEao; Fri, 24 May 2019 13:25:33 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:19 +0200 Message-Id: <20190524112520.17684-9-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:vWZCbtxrZGHp6JZLg7Zj19cF/UIF8dyMPQqnm7PQN4E+olpYLJM LUcQLi6eZJAn5av/lBrlUDoVRq9FyziNqGQJMVRtqUD406VlOCse7UVYCrelNTUMVYnjmPr 6AzBPN2YsfiaoZ6YOtRdQrdGO/6L4blMqZ9i40Q7HaMm61Cn0mvngjD+sIPAhSbal8jPDNK lDKjHDdAUp68rUpD8P2Hg== X-UI-Out-Filterresults: notjunk:1;V03:K0:2Laiz8PsXD4=:ZT5DOPHNjWS0AsoxTJb/X6 cyqd5+mCdsuAIM4BMZph1H9AdADjhkmnzRPYma2UXaW9/79THOMtIYXB5Hlg296qNpqGKeqLc j5qPksKS2zVwVNldggU38VBzzPKvNU4Lcd8Osi2icCD6gDMeuaFbU90wUJNGEzSu8U42zhwQY BztFFYLcfl7cLMWatJOchPqwDE0UJznDJ8TQ72sMdoBo7Irg/p1BQtjZfTenp9SfZ+K3qL1/3 mdPWybNAKa6kB2LqAnPwwUzZSde+u+ns2/OadQ13duD9x0Jsltsv54Jle4UDx59kGlZn0ROe+ IUDMMbScp92YCnv3JTJdP68RPCsQrLoAXggKtlSI309h5fo324ptkoNOsw52em3erVapQ66/R D1ppuohHdoKfp0D2q+srcOmwFR511Uyt+Wlo7V5kx0cbm/pbMYWBs5FQSbBycP110Pxl4n3aq n1LNskQJfrX0AbmjsYoVHZGawHWneGl/eevlFHlYXyd0FRjSqNyUV5vikJEbySYx9OSMYs3OV dp49GXTc0WW/G8sbn23vx24QtTzdxV72cP8CyFgLHO66YXHyc9bX1pg+0ujzxTqcyVUoQ+ZJN fB1aqsfyp6RrddgWRx5gasG0V7H67VlKSh6cewi4KX+jw/trEDDrsW6M0ciw7Z6mmfTLXMTqP tkr1QxQRLfLs76KEDlw4559w4vCnk6ldOTWwffb9ucvWnTVEIUA65IIdxiW4CRuWQoultyqne Nt6dZnAD/8LIcVc8Kb4xoZ43ZPirzy+oVou/eg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PULL v2 8/9] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; + align = MAX(align, qemu_host_page_size); + /* If 'start' == 0, then a default start address is used. */ if (start == 0) { start = mmap_next_start; From patchwork Fri May 24 11:25:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10959769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D9941395 for ; Fri, 24 May 2019 11:32:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47F582883F for ; Fri, 24 May 2019 11:32:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3572E2884E; Fri, 24 May 2019 11:32:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D7392883F for ; Fri, 24 May 2019 11:32:29 +0000 (UTC) Received: from localhost ([127.0.0.1]:52787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8R2-0002sS-JV for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 May 2019 07:32:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU8Kq-0005fF-55 for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU8Ko-00018h-Jt for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:04 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:48539) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU8Ko-00018N-Au for qemu-devel@nongnu.org; Fri, 24 May 2019 07:26:02 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MfHIb-1h0ZCn3K1b-00gqke; Fri, 24 May 2019 13:25:35 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 13:25:20 +0200 Message-Id: <20190524112520.17684-10-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524112520.17684-1-laurent@vivier.eu> References: <20190524112520.17684-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:4j1ecWKpqLKYUxdxC0tcLTys1b+Lw2sDx0SnmC/BtVKQhKpXT/+ NHc2FBWZ6DsKM4IM/wrybN/d+6Dgn3MdHxBWXDTQ/1bi71wwaHR5z+ABciRj/3Nvs21uszL vC7VZOz1CNRmW7R6RqKc6HTyvHCzMkCe93dDS6pdeZ/r6gpZGUASRPh/Q8sIqD6Sgl7QwgE PptcDBAO5Luk1GPY2ZpVA== X-UI-Out-Filterresults: notjunk:1;V03:K0:enTuKS2fygo=:mqUUFl2tnsBdr/n6zU+L4I mt6BAnDm0ZB+rUQMmH5SuSG3Q7Sa4x+4IZSaeJuLFfdcE8DDgSeEPhjPwmUPqlD3LPAPifnv7 At5XagS28yNxBYLnFf5ylISRxipzSjx3J30/eAmkFFpGx8cFTk/b2rZrDJzJTX0In9mAfJdXp z30wU00GtQis2B1R54NBaO8IVDRpp93m55sSoXlFHc4Xfqz0a8B2cOaMb6CcvYCD+iikqQHmn N8ZzHc6r2awa4lzCb73qtVvp2vrv6BPdaFAK571s09/Vl4vkvn+RINoaFCPbc3OphGGlauR2F rVLoYQJn5jIAL39wuM9fSViShlL9J7MysIA0V+Zm+xbu0Nw5Htt/MeEcmEsGsHrl5t348Bp6Z GjhKHQ7eoORmS30TR/1n70CPJ9zKPpigGcIB2XhS+RYjkqwZ7gzEzvbdx4vlxjmCn6lXAUbuq aQv+uwX4K9enU4oCK7k88MC2Hmo5bpcolXvauCqWOxzPSuZqtnEUEu9WzjqCVQkPZlJKcp0VR v7Mxa6zhO/aYiYc1F9n7ZMr+xQplCOk3h0AWqpeO975qH2KkZRphumVI1qCKOn/FA86HY7l8Q F23d42kxX9H/kzv2wh/Z4dScu9Mngrpf08D815Z+I1RN/3BtAx1L7eyb/Rb27fVy1HXwpwtv/ 9xuFL/Pw17IqFG3GCHeJkx3/MId0e1oSK5b+PG+kIZuilbGVgFRi+9S4nn2adcecBQY+axzSm 4G398umrlebckzX0iWniSsrTvyUD8CwMqmk2XQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [PULL v2 9/9] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 51cc049e064f..0d6c764502c3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6409,6 +6409,11 @@ static inline abi_long host_to_target_stat64(void *cpu_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 >= 200809L || _XOPEN_SOURCE >= 700 + __put_user(host_st->st_atim.tv_nsec, &target_st->target_st_atime_nsec); + __put_user(host_st->st_mtim.tv_nsec, &target_st->target_st_mtime_nsec); + __put_user(host_st->st_ctim.tv_nsec, &target_st->target_st_ctime_nsec); +#endif unlock_user_struct(target_st, target_addr, 1); } else #endif @@ -6439,6 +6444,11 @@ static inline abi_long host_to_target_stat64(void *cpu_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 >= 200809L || _XOPEN_SOURCE >= 700 + __put_user(host_st->st_atim.tv_nsec, &target_st->target_st_atime_nsec); + __put_user(host_st->st_mtim.tv_nsec, &target_st->target_st_mtime_nsec); + __put_user(host_st->st_ctim.tv_nsec, &target_st->target_st_ctime_nsec); +#endif unlock_user_struct(target_st, target_addr, 1); } @@ -8892,6 +8902,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 >= 200809L || _XOPEN_SOURCE >= 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 */ abi_ulong target_st_atime; - abi_ulong __pad5; + abi_ulong target_st_atime_nsec; abi_ulong target_st_mtime; - abi_ulong __pad6; + abi_ulong target_st_mtime_nsec; abi_ulong target_st_ctime; - abi_ulong __pad7; /* will be high 32 bits of ctime someday */ + abi_ulong target_st_ctime_nsec; unsigned long long st_ino; } QEMU_PACKED; @@ -1320,19 +1321,20 @@ struct target_stat64 { unsigned int 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[3]; }; #elif defined(TARGET_SPARC) +#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]; }; #define TARGET_HAS_STRUCT_STAT64 @@ -1378,20 +1380,21 @@ struct target_stat64 { unsigned int st_blocks; unsigned int target_st_atime; - unsigned int __unused1; + unsigned int target_st_atime_nsec; unsigned int target_st_mtime; - unsigned int __unused2; + unsigned int target_st_mtime_nsec; unsigned int target_st_ctime; - unsigned int __unused3; + unsigned int target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + unsigned int __unused1; + unsigned int __unused2; }; #elif defined(TARGET_PPC) +#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 { #elif defined(TARGET_MICROBLAZE) +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1564,6 +1568,7 @@ struct target_stat64 { #elif defined(TARGET_ABI_MIPSN64) +#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 { #elif defined(TARGET_ABI_MIPSN32) +#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 { #elif defined(TARGET_ABI_MIPSO32) +#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 { #elif defined(TARGET_SH4) +#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 { }; #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 { /* These are the asm-generic versions of the stat and stat64 structures */ +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; @@ -1969,6 +1981,7 @@ struct target_stat64 { #elif defined(TARGET_HPPA) +#define TARGET_STAT_HAVE_NSEC struct target_stat { abi_uint st_dev; abi_uint st_ino;