From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941218; cv=none; d=zohomail.com; s=zohoarc; b=WBSy6uOtjXCxq0r4ohLJQqz63WL6pb+YVLmd7z6o3GetspPj38IVbWaBvYwYXZXpSxW1a47sDjuW9wo9g5aCUGf3x888YL695BDRVfWS0w8/VQH5YwiJmOm1WMXT6aBQdPw45VwJozhvT4FpkFoh9vYg4SAVM3AfH222cWA17es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941218; 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; bh=+bAv2HPSumCjz45QTmpT65MHVnN93v/+fTRM89VHFyg=; b=UTId0Yvc0SSxSXjJcxzbtsD7lvajGFwIHkffpOh6EqoUEoKjFIRM/fR2m6ITIDLypmRG9sPmsIDNbIK96aNFK7CngcGb0+TmiSiv+RmECre5moCLjSTHE9Zyil3vkL1TorXgl06BWD4ajYvq4J087doW190s6jX1Am/1KIyOlko= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941218694673.5349637389528; Fri, 3 Apr 2020 12:13:38 -0700 (PDT) Received: from localhost ([::1]:60122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRl3-0004yA-97 for importer@patchew.org; Fri, 03 Apr 2020 15:13:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40233) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjQ-0003FP-DZ for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjP-000200-1X for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:56 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:40096) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjO-0001xC-LH for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:54 -0400 Received: by mail-wr1-x443.google.com with SMTP id s8so7674625wrt.7 for ; Fri, 03 Apr 2020 12:11:54 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r5sm12481552wmr.15.2020.04.03.12.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AE1E41FF87; Fri, 3 Apr 2020 20:11:50 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+bAv2HPSumCjz45QTmpT65MHVnN93v/+fTRM89VHFyg=; b=yK80QjmIo8e7BiILucvoVLSRw1slFmjM0ixIcZ1APs/uqRY1aqhiIjg1U8HKCBlk7a 2SIfRuEu55FGF5MgvxJdWuuLJ7U8mdmhVf+SJgcHlCLwNbiJQKusN1oKNZozSEFpm7OA tojXMZHU1vFnykDXF4MsGdJ/spSGRTUNAJJo7YaXf3JIFOdXDx6VMFdy7jq5rG+rqqyv GAwNglWd16vbNHK/Hsbn72X/+fC4611gFwfZC+9ifN2OzQLX1Tco8ChwoO6LTe5FlWat /Ukg+bnbKvUKSOA/XowjHPyhLyU0ErtjiCXwNgg5AsEBtnKUMwOelX54exmmrrmCsorU QkMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+bAv2HPSumCjz45QTmpT65MHVnN93v/+fTRM89VHFyg=; b=XG/9lN/z+LMxCfP0FrGXiUdr3HrvdZjyiiH9F13PYQ4QQO8QznfwKb3yVg/gw1+oRC LY6DvyoKwAKX1dAopmxPphyLs559bDkUCmFqvanWbuPylfG6Td4ACalAH1yuXgFmvFO4 w7jBFlm+AlCz9XLJjgawWIwEEKkN4Uty+i3zxDmTa367H/QmEP2UH7yK32J8KOFJxhtv Y2ipsg9uPgPeWtW54chLZFiKy4R2yIgbXcn9qHQoMuejQ+c2KrZxhInsEUPlWyyopsTB QpFT1JlXbrhCvwlk8pG9Nl0+64ugWRFEGsyNKtAkli4I9UjIx/h/imdt35tSZuC5zA7I TYiA== X-Gm-Message-State: AGi0PuZ3upSxrZvULtcbQ6TYojMjjSeEGVx9Nt4blmuxZW6vVqJWQD6E yI08xAM2hRYXeBFvO3tIoyBa/w== X-Google-Smtp-Source: APiQypJYjV20SZh9EMjLxEqPuCNt7HlmEncehjl71E+cn4bsKm5PrVAjGU2YcKF8Szt6pXqYtj/XCQ== X-Received: by 2002:adf:e90b:: with SMTP id f11mr10454150wrm.65.1585941113556; Fri, 03 Apr 2020 12:11:53 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 01/12] elf-ops: bail out if we have no function symbols Date: Fri, 3 Apr 2020 20:11:39 +0100 Message-Id: <20200403191150.863-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It's perfectly possible to have no function symbols in your elf file and if we do the undefined behaviour sanitizer rightly complains about us passing NULL to qsort. Check nsyms before we go ahead. While we are at it lets drop the unchecked return value and cleanup the fail leg by use of g_autoptr. Another fix was proposed 101 weeks ago in: Message-Id: 20180421232120.22208-1-f4bug@amsat.org Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/elf_ops.h | 48 +++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index a1411bfcab6..e0bb47bb678 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -104,19 +104,21 @@ static int glue(symcmp, SZ)(const void *s0, const voi= d *s1) : ((sym0->st_value > sym1->st_value) ? 1 : 0); } =20 -static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_sw= ab, - int clear_lsb, symbol_fn_t sym_cb) +static void glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_s= wab, + int clear_lsb, symbol_fn_t sym_cb) { - struct elf_shdr *symtab, *strtab, *shdr_table =3D NULL; - struct elf_sym *syms =3D NULL; + struct elf_shdr *symtab, *strtab; + g_autofree struct elf_shdr *shdr_table =3D NULL; + g_autofree struct elf_sym *syms =3D NULL; + g_autofree char *str =3D NULL; struct syminfo *s; int nsyms, i; - char *str =3D NULL; =20 shdr_table =3D load_at(fd, ehdr->e_shoff, sizeof(struct elf_shdr) * ehdr->e_shnum); - if (!shdr_table) - return -1; + if (!shdr_table) { + return ; + } =20 if (must_swab) { for (i =3D 0; i < ehdr->e_shnum; i++) { @@ -125,23 +127,25 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr= , int fd, int must_swab, } =20 symtab =3D glue(find_section, SZ)(shdr_table, ehdr->e_shnum, SHT_SYMTA= B); - if (!symtab) - goto fail; + if (!symtab) { + return; + } syms =3D load_at(fd, symtab->sh_offset, symtab->sh_size); - if (!syms) - goto fail; + if (!syms) { + return; + } =20 nsyms =3D symtab->sh_size / sizeof(struct elf_sym); =20 /* String table */ if (symtab->sh_link >=3D ehdr->e_shnum) { - goto fail; + return; } strtab =3D &shdr_table[symtab->sh_link]; =20 str =3D load_at(fd, strtab->sh_offset, strtab->sh_size); if (!str) { - goto fail; + return; } =20 i =3D 0; @@ -170,8 +174,13 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr,= int fd, int must_swab, } i++; } - syms =3D g_realloc(syms, nsyms * sizeof(*syms)); =20 + /* check we have symbols left */ + if (nsyms =3D=3D 0) { + return; + } + + syms =3D g_realloc(syms, nsyms * sizeof(*syms)); qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ)); for (i =3D 0; i < nsyms - 1; i++) { if (syms[i].st_size =3D=3D 0) { @@ -182,18 +191,11 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr= , int fd, int must_swab, /* Commit */ s =3D g_malloc0(sizeof(*s)); s->lookup_symbol =3D glue(lookup_symbol, SZ); - glue(s->disas_symtab.elf, SZ) =3D syms; + glue(s->disas_symtab.elf, SZ) =3D g_steal_pointer(&syms); s->disas_num_syms =3D nsyms; - s->disas_strtab =3D str; + s->disas_strtab =3D g_steal_pointer(&str); s->next =3D syminfos; syminfos =3D s; - g_free(shdr_table); - return 0; - fail: - g_free(syms); - g_free(str); - g_free(shdr_table); - return -1; } =20 static int glue(elf_reloc, SZ)(struct elfhdr *ehdr, int fd, int must_swab, --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941229; cv=none; d=zohomail.com; s=zohoarc; b=bUIPDeA1zkZHz1KtZSRqq+LSXrCuAoGTkpKEd1IUR45o8k147Hb/O0P9gsZJJxjK+bOuP91oOfr/RgYzowoKjt657aj1fjst1/r/hbl8uADjV+9RsVXWeD1MAWW3YVqBcnEre5oKC22WlQaDbrIajrCKxepMxWsZTaoXjrIbQh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941229; 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; bh=9yYReGEoMkqsfZWblGMzvHlMGSzTNisl1Y211B1bnEY=; b=U7uP0HQbrBeZPtqxn3twkwtSQeRQCGTbPj2lwCjf42/1vM6BT0lqDT5oHsaCydxkc5ARGcsC0XinWI/92lh+5nfw8x9PAOv6KCownFwqMi1Nbv4toMrWWJFpSaf60dWmVFWn+YPRbK9+dUNE8AhVoLI40s/vILs21HEKVAKbER4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941229408473.3290394798248; Fri, 3 Apr 2020 12:13:49 -0700 (PDT) Received: from localhost ([::1]:60131 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRlC-0005DG-U4 for importer@patchew.org; Fri, 03 Apr 2020 15:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40411) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjT-0003GB-5y for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjS-000284-59 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:59 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:39787) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjR-00022w-UO for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:58 -0400 Received: by mail-wm1-x342.google.com with SMTP id e9so8904410wme.4 for ; Fri, 03 Apr 2020 12:11:56 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w15sm2587012wra.25.2020.04.03.12.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C29BC1FF8C; Fri, 3 Apr 2020 20:11:50 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9yYReGEoMkqsfZWblGMzvHlMGSzTNisl1Y211B1bnEY=; b=K5NNnLA8kQ8cHlQxExClBCwKnhdlLhBVE/KiPCZLBWC7OV0Ye9YRL4HMB0BNPgkHOk AB+OFaWl6BtYt9R7R9o/ykTr7SU8tykYfVrwo1NebcRsrl3UTeXItTsWo2LlRB6suiR2 8N2hy/ICndn/3hLTMMSkXrm/SeFnMbDWYlotLSrl3V0ccOxbLqJPp6Tlc05gw9i+ijW3 s1aq//oJ1IDWdfjjBftYFlf1bFVA8ixQyRtsdX+wz0o5ZjuAOq/08C5umO15A+UAifec sgADKKoDVtbe6y5XqGlopGhguRyYP62/6Ho6mFIND5iylHj4Kp7Y0YGj4XtmGPT4JqtM 1bww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9yYReGEoMkqsfZWblGMzvHlMGSzTNisl1Y211B1bnEY=; b=UuNB7ar7mlv64jOdhjiiY5t0e75LdK6zx4mezRve+ng/ZIfWWxIsHtS7YclEZpt+WF XGa0x5se2i56wEq/o6wIN3rtMnvWub6J9cAVarIw3h55jK9sGf99LpnkASX+qKGWDMAI xrsBTYVygMNQW7FAG8KVuRYlp0kZzy644BYH4aW/L0qHlTiG4DGG/0bSnPrfBYg2unyD CFpA9M/apLPEP3YDAi4c2gdV39/fJt5z1tCqfwTfiVo/NK+uJmsZBfGDP99YcQwmtVWr pvjgcAcQNCiXGWGoNa/SJsjshFW9AC72jGTgf6iIzcDtJzaOuGrjHQ7cg6aCRxjWTHSJ 116Q== X-Gm-Message-State: AGi0PuYo1EPKV2kysy3nOjB+hY2NInkOwq0GDnsc61FhBLIiSEdkPI+B h3W/EFOk8EtboWAPZb+lnv0ZKA== X-Google-Smtp-Source: APiQypKbM8zHCiBvPk7890MlBrTiuB25FciqWLJe8Xw/gZUPyllw8r+X1ESdySjGpOHYtzHc0OOzhw== X-Received: by 2002:a7b:c2a1:: with SMTP id c1mr9774878wmk.138.1585941115898; Fri, 03 Apr 2020 12:11:55 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 02/12] linux-user: protect fcntl64 with an #ifdef Date: Fri, 3 Apr 2020 20:11:40 +0100 Message-Id: <20200403191150.863-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Checking TARGET_ABI_BITS is sketchy - we should check for the presence of the define to be sure. Also clean up the white space while we are there. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Laurent Vivier Reviewed-by: Richard Henderson --- linux-user/syscall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5af55fca781..b679bc6b136 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11331,11 +11331,11 @@ static abi_long do_syscall1(void *cpu_env, int nu= m, abi_long arg1, This is a hint, so ignoring and returning success is ok. */ return 0; #endif -#if TARGET_ABI_BITS =3D=3D 32 +#ifdef TARGET_NR_fcntl64 case TARGET_NR_fcntl64: { - int cmd; - struct flock64 fl; + int cmd; + struct flock64 fl; from_flock64_fn *copyfrom =3D copy_from_user_flock64; to_flock64_fn *copyto =3D copy_to_user_flock64; =20 @@ -11346,7 +11346,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, } #endif =20 - cmd =3D target_to_host_fcntl_cmd(arg2); + cmd =3D target_to_host_fcntl_cmd(arg2); if (cmd =3D=3D -TARGET_EINVAL) { return cmd; } --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941217; cv=none; d=zohomail.com; s=zohoarc; b=QR2K7hyJFtTD8dEM/b/wy7kUWXjPftzzRdo+WReyBehL1fYulmiinVquIn/8j4fAaTH8RMpmcqVr8ZnLxjxAEX3SKzNX8pHQBKwT72xvOvQNj/R613JUIHBZNhmgfP0O9tGl67lku+qYI90u+MXrOdGjYwMBaXV6rsNr3RVwLhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941217; 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; bh=R7MN9eSx9agbWPqT5OjGjNM4Lpuf6u0q6HsuyaT0dMs=; b=i8oaEVYk7vsQ46QWaI/BV15nXqkzKxRjcRBZKVhrdZhJNP6AwUyqXAoCGkngbcwU3asZZ1U5PPNGtEakUdqCXMP31HUy6AJ2TS3cM6yqBGcjZgHikIhzhiU8s7dw1fjEXXTHfbODo3SMXJ7wiVNHl36GXAU890AoCy2u+n7mxYs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941217342717.9389460536308; Fri, 3 Apr 2020 12:13:37 -0700 (PDT) Received: from localhost ([::1]:60126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRl1-00059l-U6 for importer@patchew.org; Fri, 03 Apr 2020 15:13:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40290) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjS-0003Ff-4H for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjP-00021q-Sj for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:57 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:40752) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjP-000206-MR for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:55 -0400 Received: by mail-wm1-x341.google.com with SMTP id a81so8870936wmf.5 for ; Fri, 03 Apr 2020 12:11:55 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id g194sm2615680wme.32.2020.04.03.12.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DAF421FF8F; Fri, 3 Apr 2020 20:11:50 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R7MN9eSx9agbWPqT5OjGjNM4Lpuf6u0q6HsuyaT0dMs=; b=BONettR/CVYQoMOwUD4wfIm3Y7+Q0ldet1ttJYyBwey05p1vyzvBKbeOTVPmtK3/Sg T33I8vcG5F3OfsDlbKz++1IxtogEzpN7dypoREzNIuE3NIuYH0Bedg6/3y730smfb8Fu 0vGAPnFNcuKoKuxlKZ0sX9xZMBzn+FHOHS/rEtaDrKKJwW81ju4JPNc1T7HkPtUGHBOj 1mljXvF9Px61bQV1ylFzhqqw7aWLYCvsCXc+dZctNXj0A7CSBp0vBI0mz4eBaFXqgVMU 32qaaXitVivYOKYde2CK2/Y9YM5+pMw49mKkBuR/6gySiXeID3L0Yx3JRDKbdWOd8u5L yfyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R7MN9eSx9agbWPqT5OjGjNM4Lpuf6u0q6HsuyaT0dMs=; b=m5C9qU9I+mrvWJrxGeOEjLi+NR72xn9QzXJ/uEGBdD9fjm/K8iUDCbCZLKrZk1ZZC6 8Cxmlbo+6oNua8Ym+0KG1rFxhHxmpl5FhHj0HwI3s0oI0U5S6SOrq8SeOt7GLkplc47X biWebLSM2YzfvhVBj9IYytXeM+2VB5cx+Pr3sSDZ6zXOc+BU/ESrlgl4MOCR4WgzBa3z 2Dt/42SZY8+B8H+0e1HyF5fw1l/9k+HGJ0nvBHd0mmpmC3GqwpGyebsHtIrIhR9bxR5T BvcQfuKvzQAToKfWR6m0Ygn8+k3Mief5KpKd3RuoIzd7FHYsVPUOyaItXuktuJMawymr +snA== X-Gm-Message-State: AGi0PubmTPKrAmC8dTu6pLNyGmAN2rrNdLStofzwX3Cg0t5cZbW/TeiU LYeCz1PvoJSyVb9Rmt6z8nzVAA== X-Google-Smtp-Source: APiQypKiSj4LBhfTZybCiPsA/XuDVwyWvqnt3E9S7rFOECobzf/eMh8jgWS67YcgJRHLBsXL6ongVw== X-Received: by 2002:a1c:1d02:: with SMTP id d2mr1706593wmd.78.1585941114631; Fri, 03 Apr 2020 12:11:54 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 03/12] tests/tcg: remove extraneous pasting macros Date: Fri, 3 Apr 2020 20:11:41 +0100 Message-Id: <20200403191150.863-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We are not using them and they just get in the way. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- tests/tcg/x86_64/system/boot.S | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/tcg/x86_64/system/boot.S b/tests/tcg/x86_64/system/boot.S index 205cfbd3982..73b19a2bda6 100644 --- a/tests/tcg/x86_64/system/boot.S +++ b/tests/tcg/x86_64/system/boot.S @@ -41,10 +41,7 @@ #define XEN_ELFNOTE_PHYS32_ENTRY 18 =20 #define __ASM_FORM(x) x -#define __ASM_FORM_RAW(x) x -#define __ASM_FORM_COMMA(x) x, -#define __ASM_SEL(a,b) __ASM_FORM(b) -#define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(b) +#define __ASM_SEL(a,b) __ASM_FORM(b) #define _ASM_PTR __ASM_SEL(.long, .quad) =20 ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR 0x100000) --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941373; cv=none; d=zohomail.com; s=zohoarc; b=bY8DQJKOCkPrJiR3/DNEB8IcZzr8Q8yWYUnzmDLDXzWD0GQbC9y/qMXWfQRMxCbiMEwKLXMzkWfuVRGkjIJOxYxqUX3j4J1RGSLOdcKFHy4MBBbnbOPV8Za4WsHTdQrVZTVNYWg+lCqIyqsa3mm1TbDkQqQuMd200ykv25a6T7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941373; 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; bh=L6skE25jv77X3Ic3q30MQuACWpAXjktUtUIdWwwluKc=; b=ODveQgnZbWeBQKfxeMti+6lA/BztzUj61++pVX/lqHLRoFWKo9jJ5W+w3aHl/FyT0gdRP5odbkUJCMGykOI9YHqF7YVOaEShI9zvU/H5kDzs9Kmn7UjAxvzSInT2U9MRR2sZe71RfqAmJLL8lKHOlfiQyCrEwtoFsSiR/a0gZos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941373352325.69391888220457; Fri, 3 Apr 2020 12:16:13 -0700 (PDT) Received: from localhost ([::1]:60192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRnY-0000Q4-1e for importer@patchew.org; Fri, 03 Apr 2020 15:16:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40436) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjT-0003Gx-IH for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjS-00028i-BN for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:59 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:39018) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjS-00026Z-4F for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:58 -0400 Received: by mail-wr1-x442.google.com with SMTP id p10so9799909wrt.6 for ; Fri, 03 Apr 2020 12:11:58 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s66sm12965448wme.40.2020.04.03.12.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:53 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F39E41FF90; Fri, 3 Apr 2020 20:11:50 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L6skE25jv77X3Ic3q30MQuACWpAXjktUtUIdWwwluKc=; b=fJTYoCy/lEiJMV48/JGCu+kfV9Bkzb2MWZwVR/fDUJdJsFcy9Be50ItHs2ID/3dj2p 9zvkmRmQagwdHDeAEoTlV7cpeL0nmXMXrk1VLm6/qZvYF5PxcSUbw6ZDDS0VSwebWMyO xSargiPA4+W9iiDULBOO9TonftJ8/t1AcHgLt7yM8fgBSf3nrR29xLf1//4yUhc9b/pB yjRHEkL3HaxYD6prgUKgXNaOiEoIPa/V1VGPzzTxJHve4bpCMMPW8zGcUK9mWXSSiaes vKtfx/13xyU5hZOocR04YhTmV5o3erbZwuSWG6Z7+ayMHzYaAkCL2R/cuCIrVJY3hNX/ O2iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L6skE25jv77X3Ic3q30MQuACWpAXjktUtUIdWwwluKc=; b=jA+BHlfwOADfI66iMR4KELREAIWFxk9f2hzI3tZutKACVTuO3Vj+Afua/wgMGR+Yos GstgwXQ+gjyXFoN6RmTxnwrYk4QPOUgdGRXVBEuO6jfJuBHw5n74BBoUNF427VaKbRJo LahIb/Ika8dml2jOp8dgxXiC1be3NXYYg+/eIYsOh/i8lRri9SYC3ZTtsfSD8bjetQ/i 9ag6WzZZRRgf6KazmsRr8mAwx79hW4ko0+2lkVEcm158EjSc4la1mlmoPjkXj9NNy5/l HYK4IPLqi3EQEaOtE5x+4vOw9BTaTMmYxyiiTzaS1wHwdGRRwUf2hpw98/jkVQVxGIfX hMPA== X-Gm-Message-State: AGi0PuYVsGZ7Uf+T/MPMc+EoXsuuGzkHYP3DZSkJkEEVsiRJQ1KVsXvN bRGecu5gUruQGv1NE0E3Qq+tsw== X-Google-Smtp-Source: APiQypJWhBpbhvItGrxG9ZozVVZn9ZxdulOkke/J1l/9hFBgGbjIpBaTdJgst8/1FyKhI3m3ftsj1w== X-Received: by 2002:adf:a48d:: with SMTP id g13mr11235534wrb.38.1585941117105; Fri, 03 Apr 2020 12:11:57 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 04/12] linux-user: more debug for init_guest_space Date: Fri, 3 Apr 2020 20:11:42 +0100 Message-Id: <20200403191150.863-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Searching for memory space can cause problems so lets extend the CPU_LOG_PAGE output so you can watch init_guest_space fail to allocate memory. A more involved fix is actually required to make this function play nicely with the large guard pages the sanitiser likes to use. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/elfload.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 8198be04460..619c054cc48 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2172,6 +2172,8 @@ unsigned long init_guest_space(unsigned long host_sta= rt, =20 /* Check to see if the address is valid. */ if (host_start && real_start !=3D current_start) { + qemu_log_mask(CPU_LOG_PAGE, "invalid %lx && %lx !=3D %lx\n", + host_start, real_start, current_start); goto try_again; } =20 @@ -2240,7 +2242,11 @@ unsigned long init_guest_space(unsigned long host_st= art, * probably a bad strategy if not, which means we got here * because of trouble with ARM commpage setup. */ - munmap((void *)real_start, real_size); + if (munmap((void *)real_start, real_size) !=3D 0) { + error_report("%s: failed to unmap %lx:%lx (%s)", __func__, + real_start, real_size, strerror(errno)); + abort(); + } current_start +=3D align; if (host_start =3D=3D current_start) { /* Theoretically possible if host doesn't have any suitably --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941368; cv=none; d=zohomail.com; s=zohoarc; b=YWnAU1ewFMkPhgUeY3sgC5BF9sSH+JYN53rrcguh9agLr8yCWAfAUXq9AtBAYAPYF7K3SlSz3ZPeYR8Y/NNaReZHnLXgHeqYyatQMK6KJqIdpiFSNOjLSSjosGE0fombSBnGGOAYv42Pi8ymwNAt+BY8hboeYsRYN+nHhkNHgRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941368; 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; bh=zezcqVbZAh673hmos+bKgDlwDb2CfDg/on9jJSHU3kk=; b=hsGCyqdoFnoAyeT8Lj0Jvg6HRw6+YmDzxoo1K/FwiW4lgSfcwx/Bhswc36Gcy3fgJkutySKP3scg6X68eC3XEpF1QQ8D7sBWAA4Ut3AOHKccsprq2q5LvmMiETWEkT9S627nijO/K9Aac0DK3YsZL0JnnEgvsbgkv2UVYdPw/Gk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941368794355.7133763053437; Fri, 3 Apr 2020 12:16:08 -0700 (PDT) Received: from localhost ([::1]:60196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRnS-0000Rc-PY for importer@patchew.org; Fri, 03 Apr 2020 15:16:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40704) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjX-0003M8-Mx for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjV-0002HW-IX for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:03 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:42225) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjV-0002Cn-9G for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:01 -0400 Received: by mail-wr1-x443.google.com with SMTP id h15so9786703wrx.9 for ; Fri, 03 Apr 2020 12:12:00 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f62sm12170207wmf.44.2020.04.03.12.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:55 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1AB1D1FF91; Fri, 3 Apr 2020 20:11:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zezcqVbZAh673hmos+bKgDlwDb2CfDg/on9jJSHU3kk=; b=lA285D1Rg7ucY/Doq8MaiRAqRmiAK+itnW0AIVnEylfZBeaiigq+/DF8zs1RJp+Knf wwnAy0h8YjSi3hVoJNkkZeG7YL+JU3Up8cEPukEOKiG7gzXt3OpYkhtubG/mF83rQx0R RgHPIcrehW9jnUGtLgdwoA07RYoGN+XcJYXGzH0vp0WxGV7EHHBOJ4fIej7Tvqs24a4Y 5EaDRSiGRGIA4NhVfaNUpaGBTwLHTqxlYzbM0RT/axbtzCR8CxwCIrDq2SfTLVI3W68z xmmVuofaaEHATkYqwVr2rZtFy/+lz3SsnH1jo9EP6HBURCxD7+zWdSVF/mA8HTYvAAI7 ij1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zezcqVbZAh673hmos+bKgDlwDb2CfDg/on9jJSHU3kk=; b=GWNS3xz5WOh52x61+bbgoenf50arCnXZsyXREgigwgK+3HuM07Dc8D+e1aNNZPltwf Pz5qQRobS4/U1nbptXsiIOBMH4CxlWYfkXUyR2fUc9vynNJ4SV0gdS9NGVW1ctQEqzS4 L6+a8FZiw6Wc9+C9ZphGdWfMIOHPNemqg3e2vJcFJ9Ra65BB/IV/C0u5xH8rY3XRDLoq r5f/ZAzxEOnaxiWdnQ3/F783Fa/OAW4kNkvjeq0tfTfBcpFGbi57ZA1KFgSrcEljMGNP yFPl+OZGIgcMU5S5DnHe1YO2r1sKaYRLQpQIBIAUErmHpdvNxdl9nDjxQ+fVpOeZvdot CUuA== X-Gm-Message-State: AGi0PuZlbL50dKC5jbmTWiDDC/PJtSDm0+tckaIDc5rGPoCu6IChTOXK 0bUdbxOI73pGzNT7FGp1p9Bpmg== X-Google-Smtp-Source: APiQypKVL6bpkT0VTY6QAnvvXLU/9R8MSuhdpqgIRKLEaOZ4HBYprWPNEgQ9h+vrsp2Cs0YyWtaRQw== X-Received: by 2002:adf:fd44:: with SMTP id h4mr10663153wrs.177.1585941119262; Fri, 03 Apr 2020 12:11:59 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 05/12] target/xtensa: add FIXME for translation memory leak Date: Fri, 3 Apr 2020 20:11:43 +0100 Message-Id: <20200403191150.863-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Dynamically allocating a new structure within the DisasContext can potentially leak as we can longjmp out of the translation loop (see test_phys_mem). The proper fix would be to use static allocation within the DisasContext but as the Xtensa translator imports it's code from elsewhere I leave that as an exercise for the maintainer. Signed-off-by: Alex Benn=C3=A9e Acked-by: Max Filippov --- target/xtensa/translate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 8aa972cafdf..37f65b1f030 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1174,6 +1174,11 @@ static void xtensa_tr_init_disas_context(DisasContex= tBase *dcbase, dc->callinc =3D ((tb_flags & XTENSA_TBFLAG_CALLINC_MASK) >> XTENSA_TBFLAG_CALLINC_SHIFT); =20 + /* + * FIXME: This will leak when a failed instruction load or similar + * event causes us to longjump out of the translation loop and + * hence not clean-up in xtensa_tr_tb_stop + */ if (dc->config->isa) { dc->insnbuf =3D xtensa_insnbuf_alloc(dc->config->isa); dc->slotbuf =3D xtensa_insnbuf_alloc(dc->config->isa); --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941497; cv=none; d=zohomail.com; s=zohoarc; b=MdWRR61zXgU+5GO4b6rHK9Ptx9jOlLhjTHoes0T6s3HO0Jdmt59oFWU9YmdpfWT93EnaYBCQgWyGmRoPGAFmoODslJ9csos0dTsL2wkObDGg+qhUZoKiSQed8fKbMBE46dl7fql5rKvcnWPvkJZCBXvx36xcioLFRmB2vCjm8qI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941497; 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; bh=IiHiPfqSf5RxTYVWG0ZPN64iJbsFrXxtKKLhTgnCXm4=; b=dMkgmP0/oCjzmrz+QEV7/L8sNV/zVBkHeKFm3F+km+2342LwS8RldYVm9njXCmiV7C4WbnlmoOX3E/i+lmgd2zcovruZwN4umetLP09riGG3ZH0o6KCJVWMBiK5/EZJpAoUm9fcMp06zqe8vBPNmwIhuNaAw7Np28AUIem9ZzsY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941497785117.11914250068219; Fri, 3 Apr 2020 12:18:17 -0700 (PDT) Received: from localhost ([::1]:60237 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRpY-0003Lf-Dx for importer@patchew.org; Fri, 03 Apr 2020 15:18:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40578) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjV-0003Jp-Mx for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjT-0002CF-H9 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:01 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:38124) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjT-00029U-AA for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:11:59 -0400 Received: by mail-wm1-x329.google.com with SMTP id f6so8896975wmj.3 for ; Fri, 03 Apr 2020 12:11:59 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t11sm12997902wru.69.2020.04.03.12.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:55 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 31BAA1FF92; Fri, 3 Apr 2020 20:11:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IiHiPfqSf5RxTYVWG0ZPN64iJbsFrXxtKKLhTgnCXm4=; b=vNCHrUh14ftnala+hX/PRVKkCzQAHERXu+tCmyveg8c0F7d0dGozNsXPo6JHZz2CJO LQyMmzrwElE8jJthxbUrDD2FpUJ/e46imTp+nQxzxPaPuqJUMvHrgnBu6vWnIYJ7Sp0J y63xaCmLCrd902cr4slNIll7r6PprV76R2BXW7X/AA58aRKBDb9QDB5WfEeoYiSvWwsa g14noLR3rwfvn1uahOsr6bE3KT9t506Vzc8jzJOyQsMJQusq2MAcFHMAf3uxtGOEn8O8 72j1M3++YAY1qINpwWFOsIgnQFoR12ycrqwylW+zURJ0iqDEV8LELcWA8CWRZXxMw1At Tsrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IiHiPfqSf5RxTYVWG0ZPN64iJbsFrXxtKKLhTgnCXm4=; b=cA9VqL+QYWbdFpsfDJZ6UooJ2263svFwMAuwxGN+wvPKJ+PlKL0V24jxvgjFu74h0t XV71u6Nz40GQFEvnv8D9lhPS1hx8MCyJHTgQ3a17NIAmA8YT+4auQ/HXVao3DDyoKxbR FfOewYXFfKRXDwMj+DRNXf3+EiJzGiKVR/0OLvtUaA4I9iSQbjvAvh8d5j/CYEokvhMx qDLF2d1h6470B6sK8B8yK4n+f8HusHTvj019gr6/YbeDzM78gUX29U81zPTZI7nDbuP2 N8bD+yctL5NVYDn5l/NiQkxwaK4l+M0+B1Zq+RsfoZqDAoC73XoaeVJJnGtIx0GeBaiN Se/g== X-Gm-Message-State: AGi0PubmZSlGQZWSS3Ym+Tb9jVOXDzLtG/gS6PyoJteqP+NagI9LxYj8 +hurQOKIij/zd0/tGAARFKUwfQ== X-Google-Smtp-Source: APiQypI0KEM7HYM5R5g6a9WQq5H1bAAZec2aLY9N5dlDUT0KCnfw2J2dim+KkT0J0wsfhArXU/lzPw== X-Received: by 2002:a05:600c:218d:: with SMTP id e13mr10084372wme.148.1585941118248; Fri, 03 Apr 2020 12:11:58 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 06/12] gdbstub: fix compiler complaining Date: Fri, 3 Apr 2020 20:11:44 +0100 Message-Id: <20200403191150.863-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Denis Plotnikov , Euler Robot , Chen Qun , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Denis Plotnikov ./gdbstub.c: In function =E2=80=98handle_query_thread_extra=E2=80=99: /usr/include/glib-2.0/glib/glib-autocleanups.h:28:10: error: =E2=80=98cpu_name=E2=80=99 may be used uninitialized in this fun= ction [-Werror=3Dmaybe-uninitialized] g_free (*pp); ^ ./gdbstub.c:2063:26: note: =E2=80=98cpu_name=E2=80=99 was declared here g_autofree char *cpu_name; ^ cc1: all warnings being treated as errors Signed-off-by: Denis Plotnikov Message-Id: <20200326151407.25046-1-dplotnikov@virtuozzo.com> Reported-by: Euler Robot Reported-by: Chen Qun Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Miroslav Rezanina --- gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 013fb1ac0f1..171e1509509 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2060,8 +2060,8 @@ static void handle_query_thread_extra(GdbCmdContext *= gdb_ctx, void *user_ctx) /* Print the CPU model and name in multiprocess mode */ ObjectClass *oc =3D object_get_class(OBJECT(cpu)); const char *cpu_model =3D object_class_get_name(oc); - g_autofree char *cpu_name; - cpu_name =3D object_get_canonical_path_component(OBJECT(cpu)); + g_autofree char *cpu_name =3D + object_get_canonical_path_component(OBJECT(cpu)); g_string_printf(rs, "%s %s [%s]", cpu_model, cpu_name, cpu->halted ? "halted " : "running"); } else { --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941345; cv=none; d=zohomail.com; s=zohoarc; b=IpB5DNQ56eQf97u+hBhGMu+PjNDWY/9DHhyQu1QsRUBsYTT721ilJjywkRmCnqI00e8QwwhplypAV0dvJauiq/gUfdpWo+TW6NscsETFpTsjny5QfoHnC3ZmaGGw4KKV16ygrO4IQU9XFIsMr/L3HjrNdh2He7WGmkIKRRLxxMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941345; 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; bh=g9xr3EL2jz3uIXqebGO8vaQXLJoFQmUrqrOGsA7SE/w=; b=IkVoh2G81K51woCLv1pCXQrufI+ll49lNueKTy0BT8KKlaM/fyQxImIjCQhKng2JdKN01F2im3qnsPUuyehPnQ7l9hyb0QnT6eOBlpXyJ57KFfdQ3yAu4wrSVewqy2LPo0Gx88jKo7JWG3rBb0e7QpsinKwVulelkNA/K+r18lk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941345684411.00053449321604; Fri, 3 Apr 2020 12:15:45 -0700 (PDT) Received: from localhost ([::1]:60172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRn6-0008OS-Cc for importer@patchew.org; Fri, 03 Apr 2020 15:15:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40648) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjW-0003KN-RV for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjV-0002Ig-TK for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:02 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:39789) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjV-0002Ft-Lm for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:01 -0400 Received: by mail-wm1-x344.google.com with SMTP id e9so8904731wme.4 for ; Fri, 03 Apr 2020 12:12:01 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a13sm598120wrn.27.2020.04.03.12.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4886D1FF93; Fri, 3 Apr 2020 20:11:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g9xr3EL2jz3uIXqebGO8vaQXLJoFQmUrqrOGsA7SE/w=; b=GFsnxyynZgCjj4EsqktcZg00qrQza5SzQnhyq35gTpDDp9JcA/qzzP/vF18KaaWtMz BawuEpgGWs3FpP9bqoFqrwV+8LbHvhXEoVLAMBmmTNQbPajmknXUrZKkqW1jTw71KhuO dye6UMd7V68jHP9snRtylzp8TqtUU5z4cBt3ZavcrWnEC6+XSviEwyF38TmWJv18BrDp +S3Oa0YaGTtzutFl3RhiBqQ+AY6kpDLJP8vT1O5BpDK9L1CNWQvJhF5SxgRaeH7L/ac0 kDs9yH5ZH8ceh9eGCQTGZVB4p629NbOFWbNPe8xuUbfRFo8xtl6wVPZI1v06XsW+rnKS f5ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g9xr3EL2jz3uIXqebGO8vaQXLJoFQmUrqrOGsA7SE/w=; b=XRxk0tygvnh6yB0Xrp1J2A5fNne+UbBWygnwttw+HdH4986biaY4FQ0uVSR5HFeR1x Av97vrL9gI69e7BBJ+qAGM5FyHp9J2Ne5LD3Txk8GsfYTiQpoWpnYmo2pPYARfkB4Qsh OOzPU8hQ6wgcUxTa8lHtjFIFuWDENwa++WTm4OLPTNYZj29vr0+qJtVto0diLw//cA+0 0R6+Qzm70rzqRJqNBsTNSLF+FrFkxZZTF/nCdAHgE2xk2KlXQlJ76wfo2YjKUcqvlzOV J1/Y0xruf2k8NVr24MkNb2u7mQLelRJQZRuPYvEbIu0oQqCm8hg5aGHfKJFTYGqwbmHr ehCA== X-Gm-Message-State: AGi0PuZUjzyTD4N/DKrjzLxNlCYzKeiSu8TV8973yViJSZYRlDAqJEW+ pvY/56dyCp6h/CMc81cqbZcm6Q== X-Google-Smtp-Source: APiQypKiOgdyxzQsVnNUPGRwNgRvvmGJrMuX2lCCwpBvEqGG5rvMQTFc6+q+N2B4MlCxWKfl0TekVA== X-Received: by 2002:a1c:4e11:: with SMTP id g17mr10422549wmh.80.1585941120598; Fri, 03 Apr 2020 12:12:00 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 07/12] softfloat: Fix BAD_SHIFT from normalizeFloatx80Subnormal Date: Fri, 3 Apr 2020 20:11:45 +0100 Message-Id: <20200403191150.863-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Aurelien Jarno , Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Richard Henderson All other calls to normalize*Subnormal detect zero input before the call -- this is the only outlier. This case can happen with +0.0 + +0.0 =3D +0.0 or -0.0 + -0.0 =3D -0.0, so return a zero of the correct sign. Reported-by: Coverity (CID 1421991) Signed-off-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20200327232042.10008-1-richard.henderson@linaro.org> --- fpu/softfloat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 301ce3b537b..ae6ba718540 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -5856,6 +5856,9 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 = b, flag zSign, zSig1 =3D 0; zSig0 =3D aSig + bSig; if ( aExp =3D=3D 0 ) { + if (zSig0 =3D=3D 0) { + return packFloatx80(zSign, 0, 0); + } normalizeFloatx80Subnormal( zSig0, &zExp, &zSig0 ); goto roundAndPack; } --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941486; cv=none; d=zohomail.com; s=zohoarc; b=EPDD46IiHrOOSS5WeFuM5c6ApdFyFSNDfBAd7dJJW8H+pGZ74yYiBOBii2rfJuE6FTGDs50zUPA87sLbWNEPi29GMy+BZBJkrPJh/I6HLa3vi1KX1RtMBymh/ufgA41S05fjNDNAoViUkWFKj8FBUxSmojKZCFYdeSDzkzmfmrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941486; 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; bh=DQHtt4SCEmnNGJRjmTOgUWPksbgm0tCqnL6/z7xrXlo=; b=h/p1sxds6e1JNl2cD3LdIaq5zYM56VIt/4XO+hK7PfkEDiHhvyuQm2vDposbhty++n1irSos3zJ9elSCu7XC08esir6UTWtFdZCRy1KlKfh7Gt+QO2oTy+7+T3zdV9zzqEqB3U5gvwTVHDRbQowNvhn6AJzG3Yr96qukIz4kNhM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941486053516.1822260165603; Fri, 3 Apr 2020 12:18:06 -0700 (PDT) Received: from localhost ([::1]:60230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRpL-00039m-LT for importer@patchew.org; Fri, 03 Apr 2020 15:18:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40740) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjY-0003O7-Hr for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjW-0002M9-VG for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:04 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:36136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjW-0002Ir-LB for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:02 -0400 Received: by mail-wr1-x443.google.com with SMTP id k1so386448wrm.3 for ; Fri, 03 Apr 2020 12:12:02 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id q9sm14726320wrp.84.2020.04.03.12.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 648381FF96; Fri, 3 Apr 2020 20:11:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DQHtt4SCEmnNGJRjmTOgUWPksbgm0tCqnL6/z7xrXlo=; b=FrXp8cJk0jkbd76O4lmqq6FtWFs19W9KdWxGOHmkqJAceS6srTsPEt2ylJiL9MB7L/ HHGdH8W/BkcqF+TmRm1N6k24FCOJhGLy6P87WW57DKyx0XpykmnS8vRO/EFgMUE6i0hD Z3klBJQTjevHMpNILrpHOgUIJrYcuIkZJLrudX7EOlT+RMTYOQ23u9v1PJVS4VtyIlc/ xDFfQDJdZiIL6qpYG91Se/rjRNSUwOeS5vDjd/jltQZBwk9lziBu+eqGq9qk1kYMvxVV BayRvZrEIgVFbvNFv885oxAliAcyw3F8KOhRumTpC4SlMCCLQpsiVAoQHaICKuJ/ePy1 Aftg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DQHtt4SCEmnNGJRjmTOgUWPksbgm0tCqnL6/z7xrXlo=; b=Zfr7MIEbnyiRgqMUYJtErkJyNz9T1VVAoMtFY1FXhJB1U/n8BKsc+6YRp3XeF2mEOE sGCYoA1mk+vSCgrKKa4OKtNN1OJtL7WGf6fN+1uyvYKGKfwq2CEXF/WfmWh7cku7ZLJC zOqdsE+Z/901ecRpwbspEOVN1zxOKnS2V1QPlt3CZpjl/Qu0UtN65VKNop+9L0pjoogz B3/hXPoT//Tjn6STteoDnzcZU3E6UlT5XITmCcIV+AVD5pLlzFyLdt3eRGzLpLo1bV1J m7nqntNIJQWPxomTOTVijN4Yc9LqceoGiR0WO1iDs6EZqvQkBLsL9j1Un05gQ0NIq0NM xJnA== X-Gm-Message-State: AGi0Pubt2L8gA0/C3UgQXemYFyWfYYBqxBrlydFPGy4H6Zwzghb5jkI9 zerEb1LUlgKrN1oKq0I2pFHUeQ== X-Google-Smtp-Source: APiQypIzXJARcJMjU+AbYfFTUiVnNMAYdLkpV1dKDG0xFO3s5+AThrBYfxl6z/4lQUN/KDDkIqgaEA== X-Received: by 2002:adf:f401:: with SMTP id g1mr10172141wro.140.1585941121628; Fri, 03 Apr 2020 12:12:01 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 08/12] linux-user: factor out reading of /proc/self/maps Date: Fri, 3 Apr 2020 20:11:46 +0100 Message-Id: <20200403191150.863-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Unfortunately reading /proc/self/maps is still considered the gold standard for a process finding out about it's own memory layout. As we will want this data in other contexts soon factor out the code to read and parse the data. Rather than just blindly copying the existing sscanf based code we use a more modern glib version of the parsing code to make a more general purpose map structure. Signed-off-by: Alex Benn=C3=A9e --- v2 - s/uint64_t/unsigned long/ for MapInfo structure - limit to 6 fields and strip leading spaces --- include/qemu/selfmap.h | 44 ++++++++++++++++++++++++ linux-user/syscall.c | 58 +++++++++++++++---------------- util/selfmap.c | 77 ++++++++++++++++++++++++++++++++++++++++++ util/Makefile.objs | 1 + 4 files changed, 150 insertions(+), 30 deletions(-) create mode 100644 include/qemu/selfmap.h create mode 100644 util/selfmap.c diff --git a/include/qemu/selfmap.h b/include/qemu/selfmap.h new file mode 100644 index 00000000000..302c459d695 --- /dev/null +++ b/include/qemu/selfmap.h @@ -0,0 +1,44 @@ +/* + * Utility functions to read our own memory map + * + * Copyright (c) 2020 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef _SELFMAP_H_ +#define _SELFMAP_H_ + +typedef struct { + unsigned long start; + unsigned long end; + + /* flags */ + bool is_read; + bool is_write; + bool is_exec; + bool is_priv; + + unsigned long offset; + gchar *dev; + int inode; + gchar *path; +} MapInfo; + + +/** + * read_self_maps: + * + * Read /proc/self/maps and return a list of MapInfo structures. + */ +GSList *read_self_maps(void); + +/** + * free_self_maps: + * @info: a GSlist + * + * Free a list of MapInfo structures. + */ +void free_self_maps(GSList *info); + +#endif /* _SELFMAP_H_ */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b679bc6b136..666be20f3ff 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -117,6 +117,7 @@ =20 #include "qemu.h" #include "qemu/guest-random.h" +#include "qemu/selfmap.h" #include "user/syscall-trace.h" #include "qapi/error.h" #include "fd-trans.h" @@ -7232,45 +7233,45 @@ static int open_self_maps(void *cpu_env, int fd) { CPUState *cpu =3D env_cpu((CPUArchState *)cpu_env); TaskState *ts =3D cpu->opaque; - FILE *fp; - char *line =3D NULL; - size_t len =3D 0; - ssize_t read; + GSList *map_info =3D read_self_maps(); + GSList *s; =20 - fp =3D fopen("/proc/self/maps", "r"); - if (fp =3D=3D NULL) { - return -1; - } + for (s =3D map_info; s; s =3D g_slist_next(s)) { + MapInfo *e =3D (MapInfo *) s->data; =20 - while ((read =3D getline(&line, &len, fp)) !=3D -1) { - int fields, dev_maj, dev_min, inode; - uint64_t min, max, offset; - char flag_r, flag_w, flag_x, flag_p; - char path[512] =3D ""; - fields =3D sscanf(line, "%"PRIx64"-%"PRIx64" %c%c%c%c %"PRIx64" %x= :%x %d" - " %512s", &min, &max, &flag_r, &flag_w, &flag_x, - &flag_p, &offset, &dev_maj, &dev_min, &inode, path= ); - - if ((fields < 10) || (fields > 11)) { - continue; - } - if (h2g_valid(min)) { + if (h2g_valid(e->start)) { + unsigned long min =3D e->start; + unsigned long max =3D e->end; int flags =3D page_get_flags(h2g(min)); - max =3D h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_M= AX) + 1; + const char *path; + + max =3D h2g_valid(max - 1) ? + max : (uintptr_t) g2h(GUEST_ADDR_MAX) + 1; + if (page_check_range(h2g(min), max - min, flags) =3D=3D -1) { continue; } + if (h2g(min) =3D=3D ts->info->stack_limit) { - pstrcpy(path, sizeof(path), " [stack]"); + path =3D " [stack]"; + } else { + path =3D e->path; } + dprintf(fd, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr - " %c%c%c%c %08" PRIx64 " %02x:%02x %d %s%s\n", - h2g(min), h2g(max - 1) + 1, flag_r, flag_w, - flag_x, flag_p, offset, dev_maj, dev_min, inode, - path[0] ? " " : "", path); + " %c%c%c%c %08" PRIx64 " %s %d %s%s\n", + h2g(min), h2g(max - 1) + 1, + e->is_read ? 'r' : '-', + e->is_write ? 'w' : '-', + e->is_exec ? 'x' : '-', + e->is_priv ? 'p' : '-', + (uint64_t) e->offset, e->dev, e->inode, + path ? " " : "", path ? path : ""); } } =20 + free_self_maps(map_info); + #ifdef TARGET_VSYSCALL_PAGE /* * We only support execution from the vsyscall page. @@ -7281,9 +7282,6 @@ static int open_self_maps(void *cpu_env, int fd) TARGET_VSYSCALL_PAGE, TARGET_VSYSCALL_PAGE + TARGET_PAGE_SIZE); #endif =20 - free(line); - fclose(fp); - return 0; } =20 diff --git a/util/selfmap.c b/util/selfmap.c new file mode 100644 index 00000000000..15d0acdb437 --- /dev/null +++ b/util/selfmap.c @@ -0,0 +1,77 @@ +/* + * Utility function to get QEMU's own process map + * + * Copyright (c) 2020 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/cutils.h" +#include "qemu/selfmap.h" + +GSList *read_self_maps(void) +{ + gchar *maps; + GSList *map_info =3D NULL; + + if (g_file_get_contents("/proc/self/maps", &maps, NULL, NULL)) { + gchar **lines =3D g_strsplit(maps, "\n", 0); + int i, entries =3D g_strv_length(lines); + + for (i =3D 0; i < entries; i++) { + gchar **fields =3D g_strsplit(lines[i], " ", 6); + if (g_strv_length(fields) > 4) { + MapInfo *e =3D g_new0(MapInfo, 1); + int errors; + const char *end; + + errors =3D qemu_strtoul(fields[0], &end, 16, &e->start); + errors +=3D qemu_strtoul(end + 1, NULL, 16, &e->end); + + e->is_read =3D fields[1][0] =3D=3D 'r' ? true : false; + e->is_write =3D fields[1][1] =3D=3D 'w' ? true : false; + e->is_exec =3D fields[1][2] =3D=3D 'x' ? true : false; + e->is_priv =3D fields[1][3] =3D=3D 'p' ? true : false; + + errors +=3D qemu_strtoul(fields[2], NULL, 16, &e->offset); + e->dev =3D g_strdup(fields[3]); + errors +=3D qemu_strtoi(fields[4], NULL, 10, &e->inode); + + /* + * The last field may have leading spaces which we + * need to strip. + */ + if (g_strv_length(fields) =3D=3D 6) { + e->path =3D g_strdup(g_strchug(fields[5])); + } + map_info =3D g_slist_prepend(map_info, e); + } + + g_strfreev(fields); + } + g_strfreev(lines); + g_free(maps); + } + + /* ensure the map data is in the same order we collected it */ + return g_slist_reverse(map_info); +} + +/** + * free_self_maps: + * @info: a GSlist + * + * Free a list of MapInfo structures. + */ +static void free_info(gpointer data) +{ + MapInfo *e =3D (MapInfo *) data; + g_free(e->dev); + g_free(e->path); +} + +void free_self_maps(GSList *info) +{ + g_slist_free_full(info, &free_info); +} diff --git a/util/Makefile.objs b/util/Makefile.objs index 6718a38b616..fe339c2636b 100644 --- a/util/Makefile.objs +++ b/util/Makefile.objs @@ -63,3 +63,4 @@ util-obj-y +=3D guest-random.o util-obj-$(CONFIG_GIO) +=3D dbus.o dbus.o-cflags =3D $(GIO_CFLAGS) dbus.o-libs =3D $(GIO_LIBS) +util-obj-$(CONFIG_USER_ONLY) +=3D selfmap.o --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941614; cv=none; d=zohomail.com; s=zohoarc; b=gp4Hjm8ZMyHtylJmkHvwnQDi/FMiyKVij5TFa33MLkoGaWn2SlxiE1TtQ2ytVfLmLiqHXsyQBk1WeOgeiDfe925SbtbyG2IMDZzpskllgy1mlqs8tVoQS03GNrbLyMnMHkPU0YTYzXZWZMxQLXA/MCJswFlB2kfEFme3GE1dNnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941614; 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; bh=jGuKGm7KMOs2UN9ivTUYCq92gardKrGXU32VGXhYNDc=; b=EXuShSDPEyvE6p5yJoT9yfZv4B/Iptvy0HFKWIjL8ns9nl0aOi+9qhgwYPojSqcc1Ux6cnGnb1qchpnfJyzXZ11hbOoVZDH3bITM9dzubwny+SnVCFPLZDP3aNbw4/rqve8PBk3nLGtidyNq+BcjBNJUImr5YBnLJpBpwMRVVhY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941614427329.4665338922438; Fri, 3 Apr 2020 12:20:14 -0700 (PDT) Received: from localhost ([::1]:60266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRrR-0005WC-4y for importer@patchew.org; Fri, 03 Apr 2020 15:20:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40773) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRja-0003QP-Co for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjY-0002PD-8h for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:05 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:33624) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjY-0002NB-2D for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:04 -0400 Received: by mail-wm1-x344.google.com with SMTP id z14so2825266wmf.0 for ; Fri, 03 Apr 2020 12:12:03 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id k84sm12680120wmk.2.2020.04.03.12.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 79F271FF98; Fri, 3 Apr 2020 20:11:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jGuKGm7KMOs2UN9ivTUYCq92gardKrGXU32VGXhYNDc=; b=O7iku8HTg3uKAe/7dfvlzcFGD08ng6bKMt4MS8drysmkTsZl/4npYNDV61AApVDTj6 6CTljDUwfUB5MRyKOXBzGRfnLAAz3Nejn9KiiFTybxx+72uR2UkTtHhW5k969/6ytgne h824DPW6+d3EXrNMdxVnSNrgTtQ+6tAzTQnT+dfBxfWeSWtR/XcxdtIBwK5PGcm7sh9D ubeL7kShk9qqGbDPUM9tZagn6EFXqIAqSvX/c/s64m4jSlf6DAAyo06D+KUEO9488zgv ibnRnlUXi8M0cMYCMR+ONqdyD9/EJTnfhfr/kh9P2ijvXys1McSZgWL667DsKnMPhUvd EiDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jGuKGm7KMOs2UN9ivTUYCq92gardKrGXU32VGXhYNDc=; b=JdLyk5jaxX5Spc2Gi1JT5fdCgjKCj2FcDgFy/sJdRkvCTPl2PD03xt9Jrjrt8YdNrw o+7foC+auPTSkC2X3rluIJcI5zIBjT+wlzIMAYBiW8PnRoBPXruRhMwp5rzQJBtgOUxK eWvQ8xuIw8UCRfjWO4aqGJY+KrhBi6gEk5VithyNlQeDMM+1xAw/SdQeHWPTnyUWacug TPJxTCesY4jk7h7ewrkP+n97BCzMeFW8QQ4u8rvqeBVXJWy9s5OM7ltEtPDCVo/xXg/9 Vi8MVqv+6k0Gdjeq2xG7C/PQTOTh6Rhv5Kr4yflbO4QVEjvwNeXUvA0agqNo16ZXH3o7 xxPQ== X-Gm-Message-State: AGi0PuYzphuNDz0QY4lfvQubz1hA+Ve1zK5kOLwTl7W53yJmBHDyDpZ1 BnZN9xfSfftGJ4awdKblxOtOhoGkSHc= X-Google-Smtp-Source: APiQypKDZoIF/BoXfWRzAPWz4jlgHdxVnhxFL1eyJ+jvQvCWI1q1q49TFnMofuGyTwI1iMnd5FhZBQ== X-Received: by 2002:a1c:b356:: with SMTP id c83mr10557949wmf.10.1585941123000; Fri, 03 Apr 2020 12:12:03 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 09/12] linux-user: clean-up padding on /proc/self/maps Date: Fri, 3 Apr 2020 20:11:47 +0100 Message-Id: <20200403191150.863-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Don't use magic spaces, calculate the justification for the file field like the kernel does with seq_pad. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- v2 - change for unsigned long update --- linux-user/syscall.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 666be20f3ff..8a610b91402 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7235,6 +7235,7 @@ static int open_self_maps(void *cpu_env, int fd) TaskState *ts =3D cpu->opaque; GSList *map_info =3D read_self_maps(); GSList *s; + int count; =20 for (s =3D map_info; s; s =3D g_slist_next(s)) { MapInfo *e =3D (MapInfo *) s->data; @@ -7253,20 +7254,24 @@ static int open_self_maps(void *cpu_env, int fd) } =20 if (h2g(min) =3D=3D ts->info->stack_limit) { - path =3D " [stack]"; + path =3D "[stack]"; } else { path =3D e->path; } =20 - dprintf(fd, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr - " %c%c%c%c %08" PRIx64 " %s %d %s%s\n", - h2g(min), h2g(max - 1) + 1, - e->is_read ? 'r' : '-', - e->is_write ? 'w' : '-', - e->is_exec ? 'x' : '-', - e->is_priv ? 'p' : '-', - (uint64_t) e->offset, e->dev, e->inode, - path ? " " : "", path ? path : ""); + count =3D dprintf(fd, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr + " %c%c%c%c %08" PRIx64 " %s %d", + h2g(min), h2g(max - 1) + 1, + e->is_read ? 'r' : '-', + e->is_write ? 'w' : '-', + e->is_exec ? 'x' : '-', + e->is_priv ? 'p' : '-', + (uint64_t) e->offset, e->dev, e->inode); + if (path) { + dprintf(fd, "%*s%s\n", 73 - count, "", path); + } else { + dprintf(fd, "\n"); + } } } =20 @@ -7277,9 +7282,10 @@ static int open_self_maps(void *cpu_env, int fd) * We only support execution from the vsyscall page. * This is as if CONFIG_LEGACY_VSYSCALL_XONLY=3Dy from v5.3. */ - dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx - " --xp 00000000 00:00 0 [vsyscall]\n", - TARGET_VSYSCALL_PAGE, TARGET_VSYSCALL_PAGE + TARGET_PAGE_SIZE); + count =3D dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx + " --xp 00000000 00:00 0", + TARGET_VSYSCALL_PAGE, TARGET_VSYSCALL_PAGE + TARGET_PA= GE_SIZE); + dprintf(fd, "%*s%s\n", 73 - count, "", "[vsyscall]"); #endif =20 return 0; --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941594; cv=none; d=zohomail.com; s=zohoarc; b=G+XojhnWaiD4MbNP3TeWuRMJWYyBOjgc3M+lvrBXjiuhJSMyQPkCR19N6s+j54tiC2SJ7ICIOVh5OyQ7VXKOKZnRo3ufgWIO0HNxlz+mMyUc1VTyGPIcIE32p9/UEa+575KRamAYGJBxca6lr+eaUQ4tg3NdkQVA1Y7qWUv3Xi8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941594; 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; bh=BnraU9e2QlfXAnwDnsquPq2nPEANf8Vm3M5lpPbQw3c=; b=jFTgYTcSsd6QTmBEq00Bk2874mc8jY7/O3H72dKpDm+Ut4lQnJhtXZQitcQIqgg7aju8dSuAXSiKVYAyackFNXLnqgxa62kL8pOX5lphr3iZHURRtsDs+6gZ5ueMgT9r0mAUbztRmzafHeG8JPTdMcPorltRy5mUeQTD7PmdsT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941594231555.1635531984981; Fri, 3 Apr 2020 12:19:54 -0700 (PDT) Received: from localhost ([::1]:60262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRr6-0005Bz-UX for importer@patchew.org; Fri, 03 Apr 2020 15:19:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40828) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRja-0003Sj-8N for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjZ-0002QU-8s for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:06 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:50577) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjZ-0002Pa-1g for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:05 -0400 Received: by mail-wm1-x341.google.com with SMTP id t128so8281811wma.0 for ; Fri, 03 Apr 2020 12:12:04 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b187sm13626896wmc.14.2020.04.03.12.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 94EF91FF99; Fri, 3 Apr 2020 20:11:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BnraU9e2QlfXAnwDnsquPq2nPEANf8Vm3M5lpPbQw3c=; b=mnN0kuMJWeH2jNmYRvBwWcMWl9zT59HHmZ0M9fZBR3G4+3+vM5nUyBpmtYrbb2oxLd HsRLIU+P0k5W7bH3PX9QwtBqo6PQHjBQKm9imnkIlVI/fDvi/5VyDJ8UahZOVxSUj81I ZEapBaVrfvVZSwTjRCq+8AWAer+VHULRUjdPpO2FwPzbR2OCg4hViVK6z+BPCS68kHiY IIDSKzkx3qXTsLRm7GL3TUzpC6ZlXp+Qie23Y+XCX8q1UuXMsYwjW5M7KinrHmf1vVRe DcOe7BKOUmVrTyC9lQWEr0fntyeSSq5kSb7rclEDoP4dSW/NJuhMueod7ger7YvjGrkQ zJBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BnraU9e2QlfXAnwDnsquPq2nPEANf8Vm3M5lpPbQw3c=; b=Y30hlB5cS2s5TeEQSYVVboN22S8f98DAJZsH9KDqyu5ikhDGUsDIjz5KM1W8JvEu9v caqKTaJZi4ZmLQ/hlsCiHLpRBekK4s4ySSjzxp6rT93T8TFeWy+x2IQNTO1FERhPmEa7 pRz6OcqA99hoaEciqddWBsA9Lr9V8RXuwWCoOOlxproml9id8Uutw9l9pFVptSJ8DU5a KlS2uQseWIHB0/6Z0tmod+4/wTeJwQZlHBAtnuZIngE+UMVbTmeVhr2lvOf5krwZefSx etT3HD4TZnhsi2alkjNBVYR7Pd+V2xHWNZp9Wtm5gCd11sIYQQrnTPutN5v/yQuBliXY jIyg== X-Gm-Message-State: AGi0PuaQm1/B4uIfiq7GUsVqbDQGE7/zdn7oV6SLMklBKnT7GMXUeVwW LCUkp5zuFcSRscebDCH53529LA== X-Google-Smtp-Source: APiQypL1H+tX9Q6efzFWQ5HFlYboOz2mWWgstd2kz6XQyRYFVpI6PdoSDDLq3bkGHzQhg15js3iBUw== X-Received: by 2002:a1c:e055:: with SMTP id x82mr9953081wmg.20.1585941124055; Fri, 03 Apr 2020 12:12:04 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 10/12] target/arm: don't expose "ieee_half" via gdbstub Date: Fri, 3 Apr 2020 20:11:48 +0100 Message-Id: <20200403191150.863-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , "open list:ARM TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) While support for parsing ieee_half in the XML description was added to gdb in 2019 (a6d0f249) there is no easy way for the gdbstub to know if the gdb end will understand it. Disable it for now and allow older gdbs to successfully connect to the default -cpu max SVE enabled QEMUs. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- target/arm/gdbstub.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index d9ef7d2187c..8efc535f2a0 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -192,7 +192,12 @@ static const struct TypeSize vec_lanes[] =3D { /* 16 bit */ { "uint16", 16, 'h', 'u' }, { "int16", 16, 'h', 's' }, - { "ieee_half", 16, 'h', 'f' }, + /* + * TODO: currently there is no reliable way of telling + * if the remote gdb actually understands ieee_half so + * we don't expose it in the target description for now. + * { "ieee_half", 16, 'h', 'f' }, + */ /* bytes */ { "uint8", 8, 'b', 'u' }, { "int8", 8, 'b', 's' }, --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941367; cv=none; d=zohomail.com; s=zohoarc; b=cb0Q6i1C61z04F3cthng25TaCBT+lYNLOKgQRELelipGS4JdU4HU4KXPwpEKzPPaNB7quJkGEn8txs0AeL08fl053fQaNuvimm1wYCCPE7umHHJnz47fIFUcKYE7ajlVl5mLW0qTrgRxYpMl8YSTjcXz8awgSbUDS+qXvRL0seM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941367; 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; bh=DgcsVRLcv58otFdRsNxFND+i/4AlyINLiQErQsSUPtE=; b=I8FO4SlqJyw8rMiB/fqTtGCEb42ajV8hLwVfovmYZNvSSm4/RY8j20MPqN/HUbfHIE9ffpAEgxNz0XXgAHHqjkT4VyRGxC9JqlMCUa6BJ8iujVZSmYQ3u5FwEJbdbq49txrFlORNaG23i91Kov31+FlCt8LIsFlLMpvAdw9z7cM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941367006591.526865970062; Fri, 3 Apr 2020 12:16:07 -0700 (PDT) Received: from localhost ([::1]:60184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRnR-0000FT-PP for importer@patchew.org; Fri, 03 Apr 2020 15:16:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40910) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjb-0003Vb-HP for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRja-0002V3-8F for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:07 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:39792) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRjZ-0002Ql-Vs for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:06 -0400 Received: by mail-wm1-x343.google.com with SMTP id e9so8904963wme.4 for ; Fri, 03 Apr 2020 12:12:05 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id c6sm10161053wrm.85.2020.04.03.12.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:59 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AD5241FF9A; Fri, 3 Apr 2020 20:11:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DgcsVRLcv58otFdRsNxFND+i/4AlyINLiQErQsSUPtE=; b=b62VDQt7B3YmV/5dG6ywTOUYfm7P42bQuEiI5fRJ/Rp08d14EXw/AF5k8JNgFlUhEQ L+Dhj398lyB7K90oUGcCwxuUPK6lo7rb7YrGdrBdNgjNaHnq4o8GldLgPhS1RqtY3n1P cV1JY8SNT81dEHX+FU8jLozLPtpZJUiz69Oh7GqZCqaL3felghuRrKzGYbCXNe0/WAWJ Lf/+1sU3tMA4/SZTImDcWVYU4A/uR4o9K2iNk8yzlmYX9YHeU6CHvCrAopH3eHRZ7J23 URFR/bWFZ0OncpMuHr0Uxz2NgITCv9HSRojONMLWCwmfESYaUtGKfhb/nGpkXhmZ4PQO t6Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DgcsVRLcv58otFdRsNxFND+i/4AlyINLiQErQsSUPtE=; b=TMW6RvAqcepjaAqrPma27eskEL9A/Z1f+c53Knr0bAzOPHwDjgGqn/SZYwXxL1t9vf DIfEHEznq603UkYdIaIKJhfBzk3H1gZ4jx23jGF7aN2o3GkD7H0W1MSxRk69BfwiV4XS H2wV00fAFtVxV40Two8CAllSLjuTJiHq7I9+zzwVUF2o9UYxmCPSKhZuZ1RiyxWt0E+y cxPiwu+HBlWT/Jh6P44ymk0MQEexi4RM9Z6JBRlzH/50b0dfpUOTyJHW/gZu0K92UIQy eFhMfzIu55NAYRiWLu3yjBgmdRItIFR+3xA1wy8XCxP+goUtJg7F7Shb7hHGLY3DCxS0 Q88A== X-Gm-Message-State: AGi0PuasbEcLTLpOZLqKSOkQ+RJWVHLkgtkrpqq1fjr8oUec1y9wfzT6 nwXKhloAS9Kickb81CWm9ien/w== X-Google-Smtp-Source: APiQypLAqJtUiO70v5QjRA6gD5NDJFlIWIItByivUmZ1H6tC12vNUCfYKfTuLd+KyNx8H9FGC+UvMQ== X-Received: by 2002:a1c:9c47:: with SMTP id f68mr9851632wme.148.1585941124945; Fri, 03 Apr 2020 12:12:04 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 11/12] hw/core: properly terminate loading .hex on EOF record Date: Fri, 3 Apr 2020 20:11:49 +0100 Message-Id: <20200403191150.863-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The https://makecode.microbit.org/#editor generates slightly weird .hex files which work fine on a real microbit but causes QEMU to choke. The reason is extraneous data after the EOF record which causes the loader to attempt to write a bigger file than it should to the "rom". According to the HEX file spec an EOF really should be the last thing we process so lets do that. Reported-by: Ursula Benn=C3=A9e Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/loader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index eeef6da9a1b..8bbb1797a4c 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -1447,6 +1447,7 @@ typedef struct { uint32_t current_rom_index; uint32_t rom_start_address; AddressSpace *as; + bool complete; } HexParser; =20 /* return size or -1 if error */ @@ -1484,6 +1485,7 @@ static int handle_record_type(HexParser *parser) parser->current_rom_index, parser->rom_start_address, parser->as); } + parser->complete =3D true; return parser->total_size; case EXT_SEG_ADDR_RECORD: case EXT_LINEAR_ADDR_RECORD: @@ -1548,11 +1550,12 @@ static int parse_hex_blob(const char *filename, hwa= ddr *addr, uint8_t *hex_blob, .bin_buf =3D g_malloc(hex_blob_size), .start_addr =3D addr, .as =3D as, + .complete =3D false }; =20 rom_transaction_begin(); =20 - for (; hex_blob < end; ++hex_blob) { + for (; hex_blob < end && !parser.complete; ++hex_blob) { switch (*hex_blob) { case '\r': case '\n': --=20 2.20.1 From nobody Sun May 19 11:37:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585941707; cv=none; d=zohomail.com; s=zohoarc; b=ICytOOqyJrvhFZEUZ4kxrHZbntFV4iUAj3/SzPEmNr1sjRdEA88rbvZCJ5ZiKHIEq29g3KVRnLNtga+UhfsV1J3dhnBEbCwTDgPYtO9QhQ8Y/9z+rPLvywz8Tsv5IUepK6sEoJWwB3kGxKsV0fT/tgTeTwwyXnvwQCiuPjcINIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585941707; 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; bh=DyeIxRwQ3r5TyVkIrZoIov4F8W7a9xfnJ4qmjPwmv54=; b=ZsHFXd2b6Sc83+al1wfI9hdyO1KphIQfefSx60i25scMhf0SCZV7dSs5G/WyaQYSyrqZAxwoop4GyuDEw9GBhntjJ9dqO2gTw8SKZau4uOXDNqSI1/DDWhLGAtazfHE4KO5SUsAlwXc8M8S+0s432/rRlU3n/qHO1bzPFcbsnHA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585941707215345.2384241909642; Fri, 3 Apr 2020 12:21:47 -0700 (PDT) Received: from localhost ([::1]:60308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRsv-0007OL-SV for importer@patchew.org; Fri, 03 Apr 2020 15:21:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41006) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKRjd-0003Yd-3j for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKRjb-0002XD-2f for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:08 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:50578) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKRja-0002VC-Rw for qemu-devel@nongnu.org; Fri, 03 Apr 2020 15:12:07 -0400 Received: by mail-wm1-x342.google.com with SMTP id t128so8281919wma.0 for ; Fri, 03 Apr 2020 12:12:06 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 138sm12521183wmb.21.2020.04.03.12.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 12:11:59 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C200B1FF9B; Fri, 3 Apr 2020 20:11:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DyeIxRwQ3r5TyVkIrZoIov4F8W7a9xfnJ4qmjPwmv54=; b=HE2pRBeHMSc4igIjt0XF95cKDtlhZawGnFUFuy+PmxcRSm6ybcvG6AndgkNiyUQLsQ pZTAd05urN571KW0zz+iPJDEc11dy2G7GRzBUc8W+Kd9rSg29IX6yKVIecL49VKH+t3V TPLSY2jOQeTxuxWQ0svd2j+62X7jTB+ivEGGBIFu8ItzWMqVqQ1bFOIz+3HJL8fpaTug 4JtYCLJ6nPDBGUQ9EA5r7PJq3qoPyk2da71tNy0kmQ0v4Ei9gdTZQqaaHqBVBiMQ4APA CG6QvsnJ1ERR1XOEEzKO65bSWPPwCJGwTHABZmQrtTD9GUfKCFUcEyT1jZJs9lNVKsgG 7oJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DyeIxRwQ3r5TyVkIrZoIov4F8W7a9xfnJ4qmjPwmv54=; b=CTgu84Zhs4AxIc+RwHJSRKNuXAikXfSSmY2Da141KwR4xGZWhG75wPFUWxEaBZ/LQp p6IfmXe6+CJEwCDlaZgux+W+Plc/GrFfl6TPSzzIDEfbJJavTIbe7CeonjzwBVbSsLJF qMo98xMpK/uYNfMefq6+8/uALbJiicvVW1VeGBWyFQtH5lwMN2MsV+YieIausCMppFUE mafzbp3XWZN+8XuZW2QmIn0mTXPBzfXLhCLw8cMdbrsmej5/p73rBrUL0WBg7hLzVyfQ 4xo8MKUE8TNYKPpSbPba38UA+BmzXKbc0+JJG4DFNfTOBdn1J/c8P0piyYvD6bxrO0oN h88A== X-Gm-Message-State: AGi0PubS9en2YmAr+dgO/lu1WphXgBMHyjfbHRxMOOcueIUCsuh4BFDl ePU1iMT8aZ8enIia+B7hkuYe6A== X-Google-Smtp-Source: APiQypIvw1puQJJjnCsbKKByRZbDMqtpqRGxztr0Fz8+nT5pVnISdCFDraYGA0IRhHOw9Ax0ppM2OQ== X-Received: by 2002:a1c:41d6:: with SMTP id o205mr9971548wma.122.1585941125880; Fri, 03 Apr 2020 12:12:05 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 12/12] configure: Add -Werror to PIE probe Date: Fri, 3 Apr 2020 20:11:50 +0100 Message-Id: <20200403191150.863-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200403191150.863-1-alex.bennee@linaro.org> References: <20200403191150.863-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Richard Henderson Without -Werror, the probe may succeed, but then compilation fails later when -Werror is added for other reasons. Shows up on windows, where the compiler complains about -fPIC. Signed-off-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20200401214756.6559-1-richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 22870f38672..233c671aaa9 100755 --- a/configure +++ b/configure @@ -2119,7 +2119,7 @@ if compile_prog "-Werror -fno-pie" "-no-pie"; then fi =20 if test "$static" =3D "yes"; then - if test "$pie" !=3D "no" && compile_prog "-fPIE -DPIE" "-static-pie"; th= en + if test "$pie" !=3D "no" && compile_prog "-Werror -fPIE -DPIE" "-static-= pie"; then QEMU_CFLAGS=3D"-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS=3D"-static-pie $QEMU_LDFLAGS" pie=3D"yes" @@ -2132,7 +2132,7 @@ if test "$static" =3D "yes"; then elif test "$pie" =3D "no"; then QEMU_CFLAGS=3D"$CFLAGS_NOPIE $QEMU_CFLAGS" QEMU_LDFLAGS=3D"$LDFLAGS_NOPIE $QEMU_LDFLAGS" -elif compile_prog "-fPIE -DPIE" "-pie"; then +elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then QEMU_CFLAGS=3D"-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS=3D"-pie $QEMU_LDFLAGS" pie=3D"yes" --=20 2.20.1