From patchwork Thu Feb 16 14:22:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 94079 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2530258qgi; Thu, 16 Feb 2017 06:29:32 -0800 (PST) X-Received: by 10.55.31.36 with SMTP id f36mr2458516qkf.23.1487255372654; Thu, 16 Feb 2017 06:29:32 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 69si5327748qta.308.2017.02.16.06.29.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 16 Feb 2017 06:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:46999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceN3s-0000Wx-5V for patch@linaro.org; Thu, 16 Feb 2017 09:29:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMxI-0002Cx-Qo for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:22:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMxF-0002IM-KK for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:22:44 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:63469) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceMxF-0002Hw-92 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:22:41 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.183]) with ESMTPSA (Nemesis) id 0M3See-1cMhXi3oXI-00r1Gy; Thu, 16 Feb 2017 15:22:31 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 15:22:14 +0100 Message-Id: <20170216142227.27448-2-laurent@vivier.eu> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170216142227.27448-1-laurent@vivier.eu> References: <20170216142227.27448-1-laurent@vivier.eu> X-Provags-ID: V03:K0:4n8YdMhsnJKO3rU/jwrjaYm0RVgLczGgNGmDutHurqMIVNCD+qB AamR1a1vot/Sj2jB4bA0euE1b4iwqYyy/6doQPe5OD97frSzFKgfYPJGXmWrjhE4tXDCIXm bGwsXueELUjoSmjjBIe8R8NU9RIKdp3wWlCtjd7aunA3jYuLXpvGOG3bhiWugfpChCFlBCf uV3A5QGqf+Y8ztkTJlccg== X-UI-Out-Filterresults: notjunk:1; V01:K0:Yoi9QMU1c64=:Mh6DpCERltFqdx7t89SQbh hwevwltlIvgMb3T5E63ZuY1Ez1uHCChqC+MWHBJs/V9iu+g8B7sFAigMo6Vrn05H3MCMay4aa NiDfGO7BjC7W1nlvlL/jqu7rMB/5TbbrO7vUsibBRp5CtPbnvnSlZQkbj5DFxIhDcBDpIk9Dl QyIvMFbIkNGzjkxeJLZbfRslMIXbD7U7Xo2RGV+7x+SvqmZIm2xSUPEzak83v9wh1IbazqPjv +CG8wuH3ASxlKS548DcnOff4zwRiD39SUvRAeGB1lRn6juztQeX6IiG7BL8ZPUR3Z1To4IXIB h+Ng4v9ZedRrhnkTQHTK8PkpLSkCt30YoI6nr523M6W75+vKkdsjEEqGRo6AVi4mh8vb4DMRn 8TJ//gN0TXCQg2uX+9pm8DDYJUjRrL2vAl6i8pdRw0sRo5UaC2XpApPWy0SIYHYzKVmwl3xFb YzWCBDsl2vHTmV1ZUZqOLaH7v/C5gZBWC0AOLVQr6tbUEw6IIQs98jDDvO6DlEN/q9/lF/+wX t8SPVFOEBoivH3EB4V70XGK5dYzi0yVFPaYvT+2UTTUWITi6IT6U5e2naA78K0eLyXsJVVAA+ 2151tWdfj53YEo0oW3GB8q3g7v+eIU75R8/Gkw1DiVZ3gV3KEdNUCf0RZ7e7mJIaNNL9SFTcb QmZr1vCJ3OpkzKAHw4ENt4DsAivlj+Ye+YpoFv448QorV8IEGSyueV2y2dMRJt94UqbI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.24 Subject: [Qemu-devel] [PULL 01/14] linux-user: remove ifdef __USER_MISC 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: Riku Voipio , Riku Voipio Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Riku Voipio This preprocessor macro isn't set anywhere. Remove the check so -strace can show these options. Signed-off-by: Riku Voipio --- linux-user/strace.c | 2 -- 1 file changed, 2 deletions(-) -- 2.9.3 diff --git a/linux-user/strace.c b/linux-user/strace.c index 489dbc9..8fb1b6e 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -90,10 +90,8 @@ if( cmd == val ) { \ output_cmd( IPC_STAT ); output_cmd( IPC_INFO ); /* msgctl() commands */ - #ifdef __USER_MISC output_cmd( MSG_STAT ); output_cmd( MSG_INFO ); - #endif /* shmctl() commands */ output_cmd( SHM_LOCK ); output_cmd( SHM_UNLOCK ); From patchwork Thu Feb 16 14:22:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 94080 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2538606qgi; Thu, 16 Feb 2017 06:50:02 -0800 (PST) X-Received: by 10.55.18.82 with SMTP id c79mr2646782qkh.135.1487256601990; Thu, 16 Feb 2017 06:50:01 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f63si5371502qkd.153.2017.02.16.06.50.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 16 Feb 2017 06:50:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:47117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceNNh-0006bp-F4 for patch@linaro.org; Thu, 16 Feb 2017 09:50:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMxb-0002zK-Fo for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:23:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMxX-0002SQ-Qa for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:23:03 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:57123) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceMxX-0002RI-F7 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:22:59 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Lmcct-1c5JFb1cvb-00aBD9; Thu, 16 Feb 2017 15:22:32 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 15:22:15 +0100 Message-Id: <20170216142227.27448-3-laurent@vivier.eu> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170216142227.27448-1-laurent@vivier.eu> References: <20170216142227.27448-1-laurent@vivier.eu> X-Provags-ID: V03:K0:ohMti3gy2YF84sQtiDQyUx2k3eXyEgwi1xFPdXlCo9m4jW7e3rO du/yBoPfGE9/M8+QMWVl4DA8MoYfGTZmxb9fxuIxAYL7D162lynSmbOiO64HcImtEfpZ12O xtTLTV8ngIY4l1jojAo3LOWjxx8818f5D9up5H4OFBh9rCf8/sJaZwxg0SfbotIMmqMO8v/ MPbgsm9xaKVu9mBenT6gw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Mzg8Pm6gfbc=:4fLU9DewGZv1QfQ2OCVPKk 5r24Xg3E0C0cr3VNbJDfDl+JYYpJop6HXIuarfIS9yxiQIZAmX29usMr28k9bPuX1UEDDodl0 sS5Z6PjnrWyM2b/dUaHlzBxGxueJxM+IZl2eQXbLUgwlx+aCbx2CVyI/TZgnI27qvmAG0Qm4T xOZ+dRSLg6rCOeyQ2KCXFoAakVfWuWULyfNX7cgIGUobPskcQVyy/onlhPEZry9l6p9Qa3a5k XYyLfg/jcImi3dIYVPGuEcU3do6Fju8TZaJCe2pp/YIpjZ2zrrFocV5joUdgxUkaHJiUD+g1A Ak7EwgpqoaepUHOQEDFjp7Xml7CsrnyfRIpJg06KGO/B6GAMVbcOun7bzBomL9dN9q+/SKtCO r1lco8DOPaf5J2a6fhgoHZgJtfEb8B8BKAxrSoqxPMpU0DpygIkxoHRHlUXCTr3Qv9CEQUPga fNWggPn9+vT5G3EFr50j7GoIMwLycC+sEmXKPgp2oNg1ncKrR6lTAtlx6OL3GPvc8j5xhHKmL BkC8eD0nmhH4UPh8EzwuNR7Hb9cTEPW/qxiG/Ef9UGH1ayUrrpTJgS6eSqCEtw0s6xmRnWrTv rbg0/APcvSQJYC10xlp7e+4TgyoOBUahU6qgXTm/0pGrkm7EBXobfaGVF9efoo5B7IMSGAjXS rkGG1nnuSzBH4SSIRc+FJ6KTTMuqMME2QE1vHsdAP5ADhDu3LjWB4FZxzAfOZIZP6i5g= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [PULL 02/14] linux-user: drop __cygwin__ ifdef 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: Riku Voipio , Riku Voipio , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Riku Voipio linux-user doesn't work on cygwin anyways. Cc: Richard Henderson Signed-off-by: Riku Voipio --- linux-user/mmap.c | 3 --- 1 file changed, 3 deletions(-) -- 2.9.3 diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 61685bf..4ed9cad 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -193,9 +193,6 @@ static int mmap_frag(abi_ulong real_start, #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64 # define TASK_UNMAPPED_BASE (1ul << 38) -#elif defined(__CYGWIN__) -/* Cygwin doesn't have a whole lot of address space. */ -# define TASK_UNMAPPED_BASE 0x18000000 #else # define TASK_UNMAPPED_BASE 0x40000000 #endif From patchwork Thu Feb 16 14:22:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 94081 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2538795qgi; Thu, 16 Feb 2017 06:50:30 -0800 (PST) X-Received: by 10.55.212.23 with SMTP id l23mr2223566qki.247.1487256629986; Thu, 16 Feb 2017 06:50:29 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v62si5376915qte.101.2017.02.16.06.50.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 16 Feb 2017 06:50:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:47119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceNO9-0006zR-Dd for patch@linaro.org; Thu, 16 Feb 2017 09:50:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMxH-0002BJ-IS for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:22:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMxG-0002Ia-9I for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:22:43 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:60047) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceMxF-0002I9-TF for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:22:42 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Lcxai-1bwCQp3dL6-00iBYG; Thu, 16 Feb 2017 15:22:40 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 15:22:26 +0100 Message-Id: <20170216142227.27448-14-laurent@vivier.eu> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170216142227.27448-1-laurent@vivier.eu> References: <20170216142227.27448-1-laurent@vivier.eu> MIME-Version: 1.0 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linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [PULL 13/14] linux-user: Use correct types in load_symbols() 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: Peter Maydell , Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Coverity doesn't like the code in load_symbols() which assumes it can use 'int' for a variable that might hold an offset into the guest ELF file, because in a 64-bit guest that could overflow. Guest binaries with 2GB sections aren't very likely and this isn't a security issue because we fully trust the guest linux-user binary anyway, but we might as well use the right types, which will placate Coverity. Use uint64_t to hold section sizes, and bail out if the symbol table is too large rather than just overflowing an int. (Coverity issue CID1005776) Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1486249533-5260-1-git-send-email-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) -- 2.9.3 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 8271227..f520d77 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2262,6 +2262,7 @@ static int symcmp(const void *s0, const void *s1) static void load_symbols(struct elfhdr *hdr, int fd, abi_ulong load_bias) { int i, shnum, nsyms, sym_idx = 0, str_idx = 0; + uint64_t segsz; struct elf_shdr *shdr; char *strings = NULL; struct syminfo *s = NULL; @@ -2293,19 +2294,26 @@ static void load_symbols(struct elfhdr *hdr, int fd, abi_ulong load_bias) goto give_up; } - i = shdr[str_idx].sh_size; - s->disas_strtab = strings = g_try_malloc(i); - if (!strings || pread(fd, strings, i, shdr[str_idx].sh_offset) != i) { + segsz = shdr[str_idx].sh_size; + s->disas_strtab = strings = g_try_malloc(segsz); + if (!strings || + pread(fd, strings, segsz, shdr[str_idx].sh_offset) != segsz) { goto give_up; } - i = shdr[sym_idx].sh_size; - syms = g_try_malloc(i); - if (!syms || pread(fd, syms, i, shdr[sym_idx].sh_offset) != i) { + segsz = shdr[sym_idx].sh_size; + syms = g_try_malloc(segsz); + if (!syms || pread(fd, syms, segsz, shdr[sym_idx].sh_offset) != segsz) { goto give_up; } - nsyms = i / sizeof(struct elf_sym); + if (segsz / sizeof(struct elf_sym) > INT_MAX) { + /* Implausibly large symbol table: give up rather than ploughing + * on with the number of symbols calculation overflowing + */ + goto give_up; + } + nsyms = segsz / sizeof(struct elf_sym); for (i = 0; i < nsyms; ) { bswap_sym(syms + i); /* Throw away entries which we do not need. */