From patchwork Tue Apr 7 15:51:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185241 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5011747ilr; Tue, 7 Apr 2020 08:51:44 -0700 (PDT) X-Google-Smtp-Source: APiQypKnwdfqv+wjInxIKTLbNh8t7FZv682wjrcv0hCvzoFzfC4w2g+UOQNbewLYgQ4ZNKwHXp2l X-Received: by 2002:aed:2381:: with SMTP id j1mr2933824qtc.170.1586274703894; Tue, 07 Apr 2020 08:51:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274703; cv=none; d=google.com; s=arc-20160816; b=ZScXciiFs37Gb/mNO74oJWWcZrBhSWPoDa4ACbEhz0yKqVOnOpee9MSACW8HIKGLyX oou9aSR76FMW+ybU4FyjPQKJV+kakw2QvMhe9c/W9pTiDSLyUbhAZHtwyrY1bDMqBa5W dUTK2/p9SqN0HAr7mq9vQ7DW8/n+pNpVqUMSC/aBNHTf3VzsRFgtvi3zVDPhY3OTwzI+ o+HZd6rqzXQdQbzUqfYqsR3KZbnbdOZgOK4kmGD8vyZEUdRasJ48vKko24nvu3ALsls3 7QYRNOSK3P62fBYXQPO9lsJE9kRp/PKyR3d4NCExu32sOCvzlPR8L8wB2g8aagZNTKnv ZFzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=TbMEKb/R1jjoicwVt8GVgYsRKVdxSn1pbcevDhKYxlE=; b=NSq+ARrOkOulxrH5Zonb4VsX1rc5TuWC7SPqGaxwbOS+HZCBVzLTM7660zalYvYIaa pBCMZTDMb2jw2WvkT8+tZk0pt/+TZnpOF0Tor0WwgoxDMf6j6XqQIv/cXMiCHzCTUsRg Oz4RWVBQ534P+zghNzvtezZN+KLzWE6Am1iHgDLtm71CfjgIJMPpqx5aFUalc255OHaw D/JLMxH7UFTME0K9hBsaxBYTL0o/UmR7rbDwl40UCZU1cF//hyw4mC3zde6i8TstDgPj B6EIOisgxxnX/3Bv3gsBa0P8VQ6PQKvlJWcOPOCtPfvVsaHWeAnoay+ftlC4e7l/90Sp hqMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QMcnDLCY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t36si1902609qtb.375.2020.04.07.08.51.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:51:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QMcnDLCY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVr-0003Ua-7b for patch@linaro.org; Tue, 07 Apr 2020 11:51:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43648) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVd-0003RA-4o for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVa-0004Jh-UN for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:29 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:53044) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVa-0004J6-O3 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:26 -0400 Received: by mail-wm1-x334.google.com with SMTP id t203so2239722wmt.2 for ; Tue, 07 Apr 2020 08:51:26 -0700 (PDT) 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=TbMEKb/R1jjoicwVt8GVgYsRKVdxSn1pbcevDhKYxlE=; b=QMcnDLCYCI6j24s0UEFCh6kpU8DGUJmIcsHNkx05XdYFAQ96HcOzwjAGwzuHIT82P7 QqeennngPNuCQGH1Df4sCa5Vt+jLUpXIQzWV4xd1+9nt46IlDwSgoFcTQWs65t2yuPpe BHf/XKfuSS9+iysdf14PCjRLtkUY/XptG6A/gmg9AHXa0/q8vtN+Y2h228e5ddVvTNWd LXJlgTAiiZ7QNDUeJ7Zmn6QLuf5zKmOvDb56tn6Gg4KfYYo5AQALlisSYHRLn8k1T31p LA3ryr8qTAUJqe8RarxvW2mP9r9sTFrWZv/7hDcBnJ9O37VWVPN05wzYxZTi8aRqFq0+ RLkw== 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=TbMEKb/R1jjoicwVt8GVgYsRKVdxSn1pbcevDhKYxlE=; b=m8Xvie6PH9UWh5IuhZiEGuwJ4UVX400vZ788MCeW9RCdIhv3i3d6GID7rspSfkSDsL s1kngZlD8OF3VtUEeTO3QIFQq6Pz9VR7pAW75/x2VwPAIEZrfJZ/CribkpJyiiY00hCE ZKZuseAQJDS0XOKJaGuOG4ekBtTAm4reOyQ7xESNVqN88jaRP4qO5TffDBkp2CG/pHjt IO13tJWGMUg0pwht5VVcrjjbY/q2ykbLpMfUWqalcgXdq82slqxsyl6tcWUABWzY4YTu uel197HS7kR7jhAWb3anbPo/EffpBVgfzwhT83hm1xr2lL4nvlhfrEbg79YCol7ceL1I 1JXw== X-Gm-Message-State: AGi0PubzuOC5GwUF3h3t+UfnzxOtU8VPKH+zfb2Uyv4keiedaLxeJdJy 9B9Bp3HlqM8gq+1yxe9qiYKa4w== X-Received: by 2002:a1c:7415:: with SMTP id p21mr2950628wmc.93.1586274685635; Tue, 07 Apr 2020 08:51:25 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b82sm3124895wme.25.2020.04.07.08.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:19 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 598301FF87; Tue, 7 Apr 2020 16:51:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 01/13] .github: Enable repo-lockdown bot to refuse GitHub pull requests Date: Tue, 7 Apr 2020 16:51:06 +0100 Message-Id: <20200407155118.20139-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 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: Fam Zheng , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , John Snow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Some GitHub users try to open pull requests against the GitHub mirror. Unfortunate these get ignored until eventually someone notices and closes the request. Enable the 'Repo Lockdown' [*] 3rd party bot which can autorespond to pull requests with a friendly comment, close the request, and then lock it to prevent further comments. [*] https://github.com/dessant/repo-lockdown Suggested-by: Daniel P. Berrangé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: John Snow Message-Id: <20200406214125.18538-1-f4bug@amsat.org> [AJB: s/fill/file/ and point at canonical qemu.org/contribute] Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/.github/lockdown.yml b/.github/lockdown.yml new file mode 100644 index 00000000000..9acc393f1cf --- /dev/null +++ b/.github/lockdown.yml @@ -0,0 +1,34 @@ +# Configuration for Repo Lockdown - https://github.com/dessant/repo-lockdown + +# Close issues and pull requests +close: true + +# Lock issues and pull requests +lock: true + +issues: + comment: | + Thank you for your interest in the QEMU project. + + This repository is a read-only mirror of the project's master + repostories hosted on https://git.qemu.org/git/qemu.git. + The project does not process issues filed on GitHub. + + The project issues are tracked on Launchpad: + https://bugs.launchpad.net/qemu + + QEMU welcomes bug report contributions. You can file new ones on: + https://bugs.launchpad.net/qemu/+filebug + +pulls: + comment: | + Thank you for your interest in the QEMU project. + + This repository is a read-only mirror of the project's master + repostories hosted on https://git.qemu.org/git/qemu.git. + The project does not process merge requests filed on GitHub. + + QEMU welcomes contributions of code (either fixing bugs or adding new + functionality). However, we get a lot of patches, and so we have some + guidelines about contributing on the project website: + https://www.qemu.org/contribute/ diff --git a/MAINTAINERS b/MAINTAINERS index 9d156d73b31..0559e847901 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2833,6 +2833,7 @@ M: Alex Bennée M: Fam Zheng R: Philippe Mathieu-Daudé S: Maintained +F: .github/lockdown.yml F: .travis.yml F: scripts/travis/ F: .shippable.yml From patchwork Tue Apr 7 15:51:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185242 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5012120ilr; Tue, 7 Apr 2020 08:52:10 -0700 (PDT) X-Google-Smtp-Source: APiQypLXWxV6AmZhjhfZAEB0FwoFvpY4im+wUg7fPbC+3Pa2cW0zg/4K1y5NbfNpB7BIz4AC1P0p X-Received: by 2002:a05:620a:21d0:: with SMTP id h16mr3020991qka.104.1586274729950; Tue, 07 Apr 2020 08:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274729; cv=none; d=google.com; s=arc-20160816; b=kqFgHyGi9M1pEydgVPrAkIBcOCZa1qTPDFRY8YuKE4UBd87rhSf3qMvSbTjeHn8cpH IK1MISaRblJo2JxYS31W3FpG2I+lGgl9Ls8t8/QIhQqILkiZONhmk4aEB4cuVqgSAl2j Xd1eHNg091MjszXwvFsi4it3voLNJtB3Qy7MgH1DZNd1CDjdnadLJDajE2oY7sAOheSP PtOOkqH6+QFh09V7MnTQtg52MpdOD/+liVFMEiteGpEnJJbOumQtWxuVxJwKm7fGI/sO ArnQGtWCyY2RiOEKZFPv8pzhvXfWJPwLFkgcTgThWPqVlWKbwjfPk58WU7Mfsmy4lReW JLQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Q57zQTrLcXLT83HxQuDz8QACu0YFUBqTjtOg3VhhyNs=; b=bv+I+55I/J6GVD9J8E2lS+7Ku5luLO52jHeCb92gMh/hJbMH26Ph49helx5GZ6wYH0 0C4OtotuIkHtiRqrVltar6AW7dwstVnNgaZn7rXsxa8d3hwr4Xo7aPAM8hQMrxEYoumC o0BrIDNcHln6YD511xnCvDH/4ChhizUTDDtT84/3FkGXXhfHaNmYPSCueKyI6ubfn9SF 61C5y4b6Uh5PhllShqBQXgDtP/caapqOIjXE/Wl8iMIegWN84iquIt67SKOXMRJAABH6 bVc35WL6CvU3vNSiJ64CZ1IUSpSVTIjdMrkZUTDEyf5Z2JO7pEEe0L4qS6+lhiyN1dkr 14WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=l1T1p6Jd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o17si1720602qtj.142.2020.04.07.08.52.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:52:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=l1T1p6Jd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqWH-0003O2-GG for patch@linaro.org; Tue, 07 Apr 2020 11:52:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43606) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVX-0003ND-M3 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVW-0004FX-Eb for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:23 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:36754) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVW-0004Ej-1E for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:22 -0400 Received: by mail-wm1-x32d.google.com with SMTP id d202so2375899wmd.1 for ; Tue, 07 Apr 2020 08:51:21 -0700 (PDT) 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=Q57zQTrLcXLT83HxQuDz8QACu0YFUBqTjtOg3VhhyNs=; b=l1T1p6Jd4u+ukfVttYGakUINGAatIH3aRP7q1iaUGA0Yc+bM7TMrtTmSABWLwjueub WtIF9+gr+NO2soVdqZdeBER29q6l43l6m6QPlRYhxaAZyR1QDPb+0eujPrnO+NtPAZf0 ohMtyaPdverRK2fvJYYlkAEs9YMy2Iy73TjXyXIdJ4Do+wJudvqSOVrVQ4KYi3a84i2p 8NPiO4aRvVz8tUTTbq/NRUDZiNNaGYtdOqywnasMi4ORXZkvjg8fLIAj50oUuNrdjeXQ RsN8r5TQBA6waBB7QsdWIXQnaaX3PboVdhPgfmtJ94akzcVgHZxI9iMGIIdtPp9H3S+3 /rqg== 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=Q57zQTrLcXLT83HxQuDz8QACu0YFUBqTjtOg3VhhyNs=; b=n+4xbnp63lYCzM+UDQ81cOpSW8l+Cih9uFFDaf2RomhZceECLjmWweH8PdjgpiOmx+ HVupG7RHKVP7BNsW6xA23ZQhyGvlrN3Fga0n7Tg8K+GA4q3uU3TOSEMHAjJTMFtoVGSd idmciedc5arj58IiomlbsJn5MCLKdIFEPtAO3A7NBs91oA1gi569/jhzi6z7ljYUCslD ZAmllD2xz/R3h5Myhg5uK6zWw/TzMgqwiXXoJuywy0V5Rj1Qmh9QepI86A1SaHWx1VdZ +tgUOVG/ZxYlXnGADhND377BrUOZjlDd+i2ZK4aDJglA113MVIdtonagOjoaWN3xWz2G W9tQ== X-Gm-Message-State: AGi0PuYTCV7tk+BmU0j9yU0eGkK1v76PT/PO5vGg/l9NMa+0n8g6XdWL pH15BwqIQ3YNuYQTr1+pkozcog== X-Received: by 2002:a7b:c92d:: with SMTP id h13mr2943244wml.120.1586274680548; Tue, 07 Apr 2020 08:51:20 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i1sm2871572wmb.33.2020.04.07.08.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:19 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6F2B01FF8C; Tue, 7 Apr 2020 16:51:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 02/13] elf-ops: bail out if we have no function symbols Date: Tue, 7 Apr 2020 16:51:07 +0100 Message-Id: <20200407155118.20139-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d 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_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200403191150.863-2-alex.bennee@linaro.org> -- 2.20.1 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 void *s1) : ((sym0->st_value > sym1->st_value) ? 1 : 0); } -static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab, - int clear_lsb, symbol_fn_t sym_cb) +static void glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab, + int clear_lsb, symbol_fn_t sym_cb) { - struct elf_shdr *symtab, *strtab, *shdr_table = NULL; - struct elf_sym *syms = NULL; + struct elf_shdr *symtab, *strtab; + g_autofree struct elf_shdr *shdr_table = NULL; + g_autofree struct elf_sym *syms = NULL; + g_autofree char *str = NULL; struct syminfo *s; int nsyms, i; - char *str = NULL; shdr_table = load_at(fd, ehdr->e_shoff, sizeof(struct elf_shdr) * ehdr->e_shnum); - if (!shdr_table) - return -1; + if (!shdr_table) { + return ; + } if (must_swab) { for (i = 0; i < ehdr->e_shnum; i++) { @@ -125,23 +127,25 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab, } symtab = glue(find_section, SZ)(shdr_table, ehdr->e_shnum, SHT_SYMTAB); - if (!symtab) - goto fail; + if (!symtab) { + return; + } syms = load_at(fd, symtab->sh_offset, symtab->sh_size); - if (!syms) - goto fail; + if (!syms) { + return; + } nsyms = symtab->sh_size / sizeof(struct elf_sym); /* String table */ if (symtab->sh_link >= ehdr->e_shnum) { - goto fail; + return; } strtab = &shdr_table[symtab->sh_link]; str = load_at(fd, strtab->sh_offset, strtab->sh_size); if (!str) { - goto fail; + return; } i = 0; @@ -170,8 +174,13 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab, } i++; } - syms = g_realloc(syms, nsyms * sizeof(*syms)); + /* check we have symbols left */ + if (nsyms == 0) { + return; + } + + syms = g_realloc(syms, nsyms * sizeof(*syms)); qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ)); for (i = 0; i < nsyms - 1; i++) { if (syms[i].st_size == 0) { @@ -182,18 +191,11 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab, /* Commit */ s = g_malloc0(sizeof(*s)); s->lookup_symbol = glue(lookup_symbol, SZ); - glue(s->disas_symtab.elf, SZ) = syms; + glue(s->disas_symtab.elf, SZ) = g_steal_pointer(&syms); s->disas_num_syms = nsyms; - s->disas_strtab = str; + s->disas_strtab = g_steal_pointer(&str); s->next = syminfos; syminfos = s; - g_free(shdr_table); - return 0; - fail: - g_free(syms); - g_free(str); - g_free(shdr_table); - return -1; } static int glue(elf_reloc, SZ)(struct elfhdr *ehdr, int fd, int must_swab, From patchwork Tue Apr 7 15:51:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185240 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5011669ilr; Tue, 7 Apr 2020 08:51:39 -0700 (PDT) X-Google-Smtp-Source: APiQypLTUi/gmVCS1xQR8fCCuVTLrEygb3tEXKvp8d3O3ZVtpb1Tp1XCgQKdS1BtL0/eTsuz43hR X-Received: by 2002:ac8:7a6b:: with SMTP id w11mr2852144qtt.126.1586274699053; Tue, 07 Apr 2020 08:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274699; cv=none; d=google.com; s=arc-20160816; b=tHTogJj2lH20WFMZlQNkSpe9lgYkGzSFdF2DtGC0IZjUpkHmrItK/EoJMj6dH1ISrp e80BKXxGu7aS0JoK2+3bnxrt1PG70LZRheddnxQMrzS2ylvCCzIZ9rDJlZeEB2fG5Wqt 0wFrLwXJLIV1nq3n4zA+Iw28jJf36cJQCwlnGZ8APo+6iOuORT8h6Vn/5wCpzlyPkwkA /LlFyGXeLVAVHJBMO+hS1eAPRGrhdOV/gBgM2CCjv53VeHecsamwD6eXvfWP7Y+t4O37 iS6zlt3Kmv+v2WkKcklgYENbOCa9yn6xzgmzffv+DtSAlQFwKrrQJAvvd8Zg5ziRwvWM 9p+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VJ6+jJuK9aM49AP9y9RG5kZxMwVILHzFOXjQWpNENXw=; b=EEqx6jRoUhowZTlaDRNmUpZh3vEbqs/ST3hlWCYYicDVna6Lz9Z43hhepy0lrEixlr A4HiiRg2qBBVt8IetpJ1PRJICtn4CRyagF2Hfuu/flqtfNdmIb+MEpQT/f9ay4TRy+zR zcLpSM3N07JJxJmyk3C2Skhq69Iax3iC8AJ3vHgUwr9iJwk6G4dXuGtgEUNQ+UAYDr8m Ze4gn3TUHAxqeSk3JuP3iLFUSJGjQO5YY8ioh0lEuXvswNvocgzMXKVJa1N4e9AgQtRe fSMocDYCPtNO7QA6apnnbtfaScwZwYj8720ycki+TnRYn1ncHTTl9COUJO1vqEry8h4T fIDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=E7cVgqrm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s20si2055142qth.227.2020.04.07.08.51.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:51:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=E7cVgqrm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVm-0003O9-FI for patch@linaro.org; Tue, 07 Apr 2020 11:51:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43607) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVX-0003NF-MX for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVW-0004Fp-KY for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:23 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:43722) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVW-0004FD-Ep for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:22 -0400 Received: by mail-wr1-x441.google.com with SMTP id w15so4446745wrv.10 for ; Tue, 07 Apr 2020 08:51:22 -0700 (PDT) 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=VJ6+jJuK9aM49AP9y9RG5kZxMwVILHzFOXjQWpNENXw=; b=E7cVgqrmx8m42zTAkUJ3leJxd5Zh9dPKamAXLo1ffqZ6Slnpe2RS+diupvVwo4VcDj Lm1YuGw2ImaGRPIrf+INC5+7o0WIQCdYdiuk1mjOubKpoLqpnjzzCYyOxm6NWco1WfsG haVz/7irjlwr8VXVZQqWmivLQqL3TscBXMdrTHPexT5rceZWhhk2/8JjoYx5zxuyrXlG +rt9sSNjsv+5EPDsuFyuVl/rY6emTU4DbQrov9YMcxP8TI6qJ4gBaHblF1FsreZRT2p3 pUaH5FZ0zJI+BwdkvljGYQRiK2dyYtqgfV571LCFpwbFq0hNLH/5u754Epxn2xkIL85X zTZA== 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=VJ6+jJuK9aM49AP9y9RG5kZxMwVILHzFOXjQWpNENXw=; b=RVRy9RYyzt19iIjbkqoi1Yv872NpMKpgCXwbHECzNcVTRaWF3DbBzJhDR5sPB81TaW nMSw5TR2j2oXkOIWkSsFL7I8SfzCiQ1x/SW8BCxE0UuPWsCLdz4gOWlwgn2TzFgvJNA3 l8B/C772LqgeOZTlbrqnHl43PbO1wzk7lrVRNO4oaOUHUNseUMQ77200ww3pTdC0ZuOl P4+CRILPcB2R52t8nfI6PlR0+g0ktK9zztBSkSkDldlSdcuIsHDmIbC98IUTdXgflrQW n8YnqOR7Ws2TTK5c5xgSJpu4ByjFnmB1qbosLG7b7Kpiwza8V7SFrcC8yQuF3LdUJlR9 HnIw== X-Gm-Message-State: AGi0Pua/vf0Hu7HkWkrjVLiB+eWkd/C/EtaptnWcmtEliO85jDw40Z8u aEpXcTFIY8Rd0RCnu/w6sQatmQ== X-Received: by 2002:a5d:6452:: with SMTP id d18mr3336077wrw.405.1586274681427; Tue, 07 Apr 2020 08:51:21 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i1sm2871571wmb.33.2020.04.07.08.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:19 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 854881FF8F; Tue, 7 Apr 2020 16:51:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 03/13] linux-user: protect fcntl64 with an #ifdef Date: Tue, 7 Apr 2020 16:51:08 +0100 Message-Id: <20200407155118.20139-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 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_Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20200403191150.863-3-alex.bennee@linaro.org> -- 2.20.1 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 num, abi_long arg1, This is a hint, so ignoring and returning success is ok. */ return 0; #endif -#if TARGET_ABI_BITS == 32 +#ifdef TARGET_NR_fcntl64 case TARGET_NR_fcntl64: { - int cmd; - struct flock64 fl; + int cmd; + struct flock64 fl; from_flock64_fn *copyfrom = copy_from_user_flock64; to_flock64_fn *copyto = copy_to_user_flock64; @@ -11346,7 +11346,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, } #endif - cmd = target_to_host_fcntl_cmd(arg2); + cmd = target_to_host_fcntl_cmd(arg2); if (cmd == -TARGET_EINVAL) { return cmd; } From patchwork Tue Apr 7 15:51:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185244 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5013420ilr; Tue, 7 Apr 2020 08:53:35 -0700 (PDT) X-Google-Smtp-Source: APiQypIDO0TlnVeNHJVsdppq8ysCjGOVxlN5t5JoPc/RlymsZCEFkR1uKAsdYmHN1vZjqXJj/9ji X-Received: by 2002:a37:70c6:: with SMTP id l189mr2815843qkc.158.1586274815438; Tue, 07 Apr 2020 08:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274815; cv=none; d=google.com; s=arc-20160816; b=0Sda3ObCYRwqiwhNtcAR2N6i3OBP5BzEjUEZJSiSLlM7ywnFngrYg8O8Lf6hAkBvqM f+JjMMcpekJoA2dRgN93pXSqdHVSwG5QQ9S9fAx900CachzEvTbQT2FJL4XrJZ2bowba Ubu5cgOSqyOZ8yWmpOKw5mrL7B2RLzu9cVlUHRrf1cOI3Wx9FboLzG4RfYYncn5iWLo7 jRA3Fig/uz5BCtoGw8gKYQAkI9Tq+raOuslESV73nMJlnqDzLhcpJxLltFfzwdP66TTs dJ4/uKTII4cF1sne0vq9pRceVHf+vnEJqhLTyFXokXjnJi2hcuzn379e8HFfidt+ithE a22w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PbesXQUG3Qr2w0fWSAAmJ+0PO5T8KwoqRlchy88FHNA=; b=sS8IFsJRmPkyaLYKk1u8zVN+vJqdAPCg5LmxN9m3vRsytjgpCFAxmsBHwOQKNqq/Qj tpo0Oh2tcDyOCBNudhngnSPVM6e/DjSsgu37a0tYrQhKp/aehZLBlVL4L2bISAVXyAKs nBEIQO+UOBAlx2c30waJzZ0cFe2YpIiZ5QHgx/T+5tzoudzQiVV6gg099C4X4vV3E7y6 vj0GN3hxW/OdAKTMkXxjxVkA9DwmEGhRrquUO+dnAepJjfroyi+wOsXyG/HKC5W2rx78 6M3Y69eBemvKoce9jZeQliL/FuDwcQVAjTsKyjae3KZ3gdDQNrOYilU0rpnCPwwuclMt tuQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oICfkXuy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r13si2183868qvb.174.2020.04.07.08.53.35 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:53:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oICfkXuy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqXe-00070S-VO for patch@linaro.org; Tue, 07 Apr 2020 11:53:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43624) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVY-0003NK-Mu for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVX-0004HD-Q9 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:24 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:56292) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVX-0004G3-KI for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:23 -0400 Received: by mail-wm1-x32f.google.com with SMTP id e26so2231890wmk.5 for ; Tue, 07 Apr 2020 08:51:23 -0700 (PDT) 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=PbesXQUG3Qr2w0fWSAAmJ+0PO5T8KwoqRlchy88FHNA=; b=oICfkXuyhHmVwAl/4mRoLJSLXNu7mcNg6OYmbVeiUFowmscviTbv4Jng1F5GyClnCG ms1SJSe9UBA9xZMjeB++Tr09GKcAG4QIyBQ8UJ8xAx/Wfz1pzunESgQ0LkE+p6w/9T8x e8nF2eM0WTFnpHSlT9AhKUimda8H6RDkF+P2P3DHHx19D5bMTuyJSYCflRFIef8FQK0U 1OTAx/YMXLHU6AGNpJEaDuuxd5OO0MwFg0upr8ZkZrDo9p0WHhELLe3yvM/f+gPEP9HF K34jXbe2209aKKo1vcGrHS1pjy0P/Rm9+XVMF9isBJm2nrQ52SqWnzh/J/TdlHVsa5QJ Ev7w== 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=PbesXQUG3Qr2w0fWSAAmJ+0PO5T8KwoqRlchy88FHNA=; b=ZhT9JoTgEjIZr/L59qkPUbs1jDHn53mS/mx0jz7BOda27hzwePRRpKkCRNiXMA3Xi3 p+hYusJQUU8qfPOk76M5TPu1BonQQj319G2w3mlgqPGu9hP6LV2o/BTAg12twV1yI3Ss T4BZ2OQ4cSPB/SfYm0sDUmR+gAksxz5g8YKEPv0oSykbg+nU3s0FMqdCRowmo8dFIZMa hb0CiStHMF6oRcB2fT6cvvoucdrC7aRXl4P8vi/7Cw6NnintpwWfWw3DysBLT4D9IMzq 7+kgXUzdL3BHvU1r5dnBQfMO2/dnaK/km+BexqBaKiLEtl45uiagAb+BcZSLMnIm69ik EAHQ== X-Gm-Message-State: AGi0PuYU847egmJPwXwHh3p7kH4rZp95Xw3uYxNSyi71rmD9UPJIRS1I IBzqQhpIkvPP31hNjBgTzReNpg== X-Received: by 2002:a05:600c:2251:: with SMTP id a17mr2993003wmm.106.1586274682624; Tue, 07 Apr 2020 08:51:22 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p3sm11048654wrq.97.2020.04.07.08.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:19 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A00BA1FF90; Tue, 7 Apr 2020 16:51:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 04/13] tests/tcg: remove extraneous pasting macros Date: Tue, 7 Apr 2020 16:51:09 +0100 Message-Id: <20200407155118.20139-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32f 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_Benn=C3=A9e?= , Richard Henderson , qemu-devel@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We are not using them and they just get in the way. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200403191150.863-4-alex.bennee@linaro.org> -- 2.20.1 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 #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) ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR 0x100000) From patchwork Tue Apr 7 15:51:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185245 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5013425ilr; Tue, 7 Apr 2020 08:53:36 -0700 (PDT) X-Google-Smtp-Source: APiQypJ7lwNfBPfPHuDu5souodK0UWiSC5aQ5/uyS6VFh3r6BYBwj8Kcto3/mGoC8mbxPsQrjV8R X-Received: by 2002:a37:a3c1:: with SMTP id m184mr3080390qke.352.1586274816068; Tue, 07 Apr 2020 08:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274816; cv=none; d=google.com; s=arc-20160816; b=gHLpSfh9AIqgw7qnIHpU9DVDvOA9KJJIod4ZlLYB9/+XUogm/FuRbEwm/moydtKdd+ bE0C7GTurI+JwswR8ppm6Djx8y01V5R3lT9ZmaDkksNLsoTzvOFUdMQXU5d/TQ+NLUKv WVk4MbQ6uAW5qpxyYlIvVycGMJ57wlQiLyEux2hXOt5M0N4tKPQCNtfxeXrlQFfnE1yq sxfKOJxYO20d3SR6c+dpA0ZhVAwSliJ8DWbc22E9u6YagKv3TXBrdEIht0Ag0ZkJyXQy U7x3ZWaGv7lRzGDNp7ve5PfAE58WPv9fTpA/pP96zzuz/ewaWFXGz/n6jf9ELswJ+a5u BYvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=knuvWGJJjL2l+VM/Pu56sYdaHUVTSyIKJQEQhEZXCg8=; b=mBkoGE07+ovrENNIspElhhxhAecTK1wab3SmahBF9uNPsPpC1KxteIywnOFYVPh2Ls cGyDUPe60MLduK17lAwV5FAWuGrsAOlQkImTXdNEYyVr3RANiBXWqxUrtU47CyXSTWxk AeNdrAFLzvrUfOjNM4mbVXNE+Kh4soEcUqFzVxHNMFmA1diqpjFiLI+FTqbmHc1SGRWE oAga6QL+ZWWUpUHGubNaWs9uYclz4uC/9YqCVWTriHG4G7eff3tMacoBH7cQKPU3mfSu y9gnkEKEX0QZSs8TiKAMfF+JRax99oInXMUBGWA7zlgB3X8ahfREfdP/qYxrst+NHPt0 hspg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sr4j9s1Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n21si430489qke.228.2020.04.07.08.53.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:53:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sr4j9s1Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqXf-000726-Hw for patch@linaro.org; Tue, 07 Apr 2020 11:53:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43667) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVe-0003TC-7A for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVd-0004LX-4b for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:30 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:33652) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVc-0004Kw-Uw for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:29 -0400 Received: by mail-wr1-x441.google.com with SMTP id a25so4514848wrd.0 for ; Tue, 07 Apr 2020 08:51:28 -0700 (PDT) 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=knuvWGJJjL2l+VM/Pu56sYdaHUVTSyIKJQEQhEZXCg8=; b=sr4j9s1YKOZfp2w+RIR3IaPWFx9+8+LQBxRZ4/zmJR/U78j8z/xVZYAgcrc1reyWZ7 v1MHYYmNnJoPzIjwV5PQjh0dvFj+uL0XOxoeY8h/3aYyzVmKpMZJvn4UbRLiEkTPlOws LitRB9IrJpeM2a8yHRhlreW0lWvrBWSLbsI//ZF5qL2Md6a/SqGJW4pkM1W1ch386eB+ P7XwxF4cy4jwZEmCe4RAJDrr+GV8VKRjsXkxAALsbQ7bbvMjOt/XfhsylbEdCHsbbGgY pLCmFPDaeRBNIlIwTzpbCw+7OXKSlkEKZBwjqPdAeHn2t06DQD2jwjjUuvrrsGahhDAF kCsQ== 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=knuvWGJJjL2l+VM/Pu56sYdaHUVTSyIKJQEQhEZXCg8=; b=JardRk4uvRaV8Nxic45LDUpwMZsw3BlDP66QWkfT3VBKc7XRIzagi0kEy+s/GvZsnZ 9vexZqw7fRr5G/qK/RzNqBvgOjm9uDWunrD1Ys1gvYd8PYuVv5ep2TAW2jdk4rmYBhVO vXbYKZMTAFG7U5w5snjKxzx4ZTEIFHdN6OeqwKXSexmgwOutY2/5Qy0JCMZY1yINs5Oz gA2O6wXHlSWR3i7+ONYNQTeNgVppDWDH4mf14Fln877L4Mx4flt/xTus4p5uu6BSLnt8 p4vfCp8LSgV3c3p7fXctVNhJBWk2NX2FoEJQOhr/7TpW0sPsVoymJAoNCIYUcnXIkKVx tYiQ== X-Gm-Message-State: AGi0PuZ0xoDpdznT47ZEuShaVEAHZApDik46OAMDD07oGz9B6QQVwn7K BZKw5sxQKf+m2SgLN2LSijZsXA== X-Received: by 2002:adf:c3d0:: with SMTP id d16mr3664143wrg.180.1586274688050; Tue, 07 Apr 2020 08:51:28 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m19sm2755823wml.21.2020.04.07.08.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B392E1FF91; Tue, 7 Apr 2020 16:51:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 05/13] linux-user: more debug for init_guest_space Date: Tue, 7 Apr 2020 16:51:10 +0100 Message-Id: <20200407155118.20139-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 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_Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Laurent Vivier Message-Id: <20200403191150.863-5-alex.bennee@linaro.org> -- 2.20.1 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_start, /* Check to see if the address is valid. */ if (host_start && real_start != current_start) { + qemu_log_mask(CPU_LOG_PAGE, "invalid %lx && %lx != %lx\n", + host_start, real_start, current_start); goto try_again; } @@ -2240,7 +2242,11 @@ unsigned long init_guest_space(unsigned long host_start, * 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) != 0) { + error_report("%s: failed to unmap %lx:%lx (%s)", __func__, + real_start, real_size, strerror(errno)); + abort(); + } current_start += align; if (host_start == current_start) { /* Theoretically possible if host doesn't have any suitably From patchwork Tue Apr 7 15:51:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185246 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5013844ilr; Tue, 7 Apr 2020 08:54:06 -0700 (PDT) X-Google-Smtp-Source: APiQypKmTdqmsHWQlvsetYktz3aQlLI++BXk1iJ6M/MO565ms9Oe9V7UjtliCKsuszSPem4e7ifd X-Received: by 2002:ac8:7a6b:: with SMTP id w11mr2862609qtt.126.1586274845915; Tue, 07 Apr 2020 08:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274845; cv=none; d=google.com; s=arc-20160816; b=KpahXLhzHV9YB4VgvteXwjNCOiiWT1lGCUREwZb3ZGAdVPkgoCM2d0Qqqhd2IgigA5 QDNordIlNWFxoc7jPN0pk7FcUGoXr8KbGyepFoqE2tdVPLIzChezU+/EDolcLXHz7+d0 NW/6NXUEthb7Vmmeb2VBCncclxXsMIWb612TPYQ5AOo/gVEaWz4hpNaRCz0wAPtRc/TP qnXRg5m5afvd5KwarZnb1sbydXUzuI9HxHEkLF/M8ITz8KJbRToDdP9Uf19ifstcOO0h FdhCcp4AqMdh3wtEpANDUcJ3GqZdQATnq6H/IMfHfTnRCpX/Q54XnhD6Cf43Im3VAiXe 0FZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=j8FdPU/oaPxbpC8XFRmXIv/XBHTSg+RMGViKj8kJEZw=; b=ponrBBSBIZTVQX2lw+r1xtmyAxq5mCFo2vjDalADpaE0Y/YggX86OhASJ8xhnhN3/M zMtMMeOS8Jy3CF777F8R7sbYZqRRNOyjd1hLCsMKg0ZgogrZ3GySdRbBRl59jeCR2wXt AgO6rrq8rnnNk2a6Fo3UDJNadi/10BFGkgoImTk6/FSzZ/REOxHS05ttKdBhwZHFW+2h 0aFZ87RVfsM/DQLiCTlFk9ojaRzsHlQrcotrStsr5mR17LeCKJ4HcQHOFZ9vCI8ZZS9p DcmaIyuVBUK3/xJCGMSxP1HFhdbGK4eiDTwgJN9feS56S361Qt9tmDAaJ/ZAkTNIsHCD rn0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="im2/Gh9H"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d32si2042985qve.13.2020.04.07.08.54.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="im2/Gh9H"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqY9-0006xY-Dr for patch@linaro.org; Tue, 07 Apr 2020 11:54:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43686) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVf-0003UE-8t for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVe-0004Mg-AP for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:31 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:34733) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVe-0004Lt-4h for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:30 -0400 Received: by mail-wr1-x42a.google.com with SMTP id 65so4506025wrl.1 for ; Tue, 07 Apr 2020 08:51:30 -0700 (PDT) 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=j8FdPU/oaPxbpC8XFRmXIv/XBHTSg+RMGViKj8kJEZw=; b=im2/Gh9Hxw0EKBnx3wf00FbaA4avWtSg5SUZZLF+t+ggQJqi0XzkuiFQTjWIHQri40 gtPfUzbSbgZsCYcdGnip4B22aq+y8QEH3OKtcB+XBz61GEFj5aA2oJtEjMI1wqM+oFyD bmNOrDtLib0s9SvtyC5jujraGOtCBn9p+s7OUOfg7TV6IKBpuNCQpXFjjsOIqrlD6Lp0 Iy0Vnq+wcdjFpod/FI3je8SVBZhNWt3rqTMbCmIiAxKiWJtniucq4vzxzSYEPsuMXAYm EPsABRbTU+KPnBA5v+zbXrHLuK/FkAZkmkcbeq4VC7fFi8qUQVDfg9ntXEYH0Ah5oXlX Jn2g== 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=j8FdPU/oaPxbpC8XFRmXIv/XBHTSg+RMGViKj8kJEZw=; b=qoA0UoCezi8vD20hHsuR1bENyJrjshLR9GNxOhA/ubTxVD9IkFVT2ASchi7L0Mj/ZR 3Zw/+w52kAhl6Y36YN2f9wO4hlL++JEUpGEkczkxWVKBwxdc8ErHKeydkGB5MJcf31fL G2izyqJFPKR4gbaDTnwQ/haTGhquxq8b1Ud4HB4K78Il3XmtsphsjzGyBwSlNOOSQuEG lPchirUpAUqjJ72ut0wh84gAuCY3zWOexJtG7k0EpNYnwHS/N/F2Q/5s2nCewWCiT6g3 lkMOoy46gaNqGTr6l61gMjcb7flzodE5ypubf773APA9mkFseNSpN7sQPcmdqe+uJU9A 9ktg== X-Gm-Message-State: AGi0Pub81vVN3PuoWQP4GWJSKzCBrfqmMQNjekXTolsn14SxxcqxNcfl xrDvA7IosLf+6gHTssBdIbRgsA== X-Received: by 2002:a5d:5707:: with SMTP id a7mr3392347wrv.108.1586274688989; Tue, 07 Apr 2020 08:51:28 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s13sm15474804wrw.20.2020.04.07.08.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C71061FF92; Tue, 7 Apr 2020 16:51:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 06/13] target/xtensa: add FIXME for translation memory leak Date: Tue, 7 Apr 2020 16:51:11 +0100 Message-Id: <20200407155118.20139-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a 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_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Acked-by: Max Filippov Message-Id: <20200403191150.863-6-alex.bennee@linaro.org> -- 2.20.1 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(DisasContextBase *dcbase, dc->callinc = ((tb_flags & XTENSA_TBFLAG_CALLINC_MASK) >> XTENSA_TBFLAG_CALLINC_SHIFT); + /* + * 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 = xtensa_insnbuf_alloc(dc->config->isa); dc->slotbuf = xtensa_insnbuf_alloc(dc->config->isa); From patchwork Tue Apr 7 15:51:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185248 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5015041ilr; Tue, 7 Apr 2020 08:55:20 -0700 (PDT) X-Google-Smtp-Source: APiQypK2iUfLWL0MVjsleTkOF7TfO226Re23yh208bEWgaNJ5lJEWBEnStVtS44Kg+Im8gvscvJy X-Received: by 2002:ac8:6903:: with SMTP id e3mr2901030qtr.109.1586274920441; Tue, 07 Apr 2020 08:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274920; cv=none; d=google.com; s=arc-20160816; b=hzFF3ip1UY9zFYQE/O64MOkpUH47AA/JA1EIWvlpzrHV//odMaA4SlEe9zYmhECOHK mXrRZTgATNQsNgPnIHA15NIGyzppErwTHiCCPH5PRDdpWz6oakOKx3PmIaEnQ33EKLLi iMP/emD1aC8Luk2M3D/Goa17X6sofduU9mp6XyXHdl5SuWQiWX48QfTVXbpJIKUmpaxw XG5Cx42KPruKGEU2xMec/EAH4GOOpS9Vlve3ff/qMT3beLEJJAGDU86UFhaP3brlQGea DnYNHZeLD29izaHfXOAeIqHWv3KJqwmrxfY2C1ClrhY2XmGcR8wjZ5SXxcza180qvgC/ fLjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=22H5f+VrayDXYFN091+N51uEFPxm5X5X7vqYpPPYKEE=; b=qtHpcm+iVuIVbMRc1F/aoJ3P6g0IAAPTSrd/KOV0V2fCATG+RZ1eXzRvC4jOYqp+fP 31wXPpVlC1HBCrCT7agu1skHIy+cdb/aR0cyBY7x4aS+dtI/cs2o8crYT9Z4UL1scOdJ /xf+JfFVuGUL9w6PpXwZsgU4d9Ui0NYoWkvtkb4RL/Qmarcx8WVac6cs1+Lm3oC7zdT/ ZeGWEZeVGHgVcoL1fQ08ujuv37+pEOYg3SJJy7XDWd0/PJhAM0N561yfWfwafC1GXvG3 CQh7HkpMzWfAJD3k5EgdAojI/U+7A6dx+nomUwS8VzzwnFewG1GWrVJHuq8fa8AGWxxE z4uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="vdY+9/Ra"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v33si1899415qte.371.2020.04.07.08.55.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:55:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="vdY+9/Ra"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqZL-0001fb-Tc for patch@linaro.org; Tue, 07 Apr 2020 11:55:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43698) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVg-0003XE-9T for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVf-0004Na-9H for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:32 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:54639) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVf-0004Ml-2f for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:31 -0400 Received: by mail-wm1-x336.google.com with SMTP id h2so2238715wmb.4 for ; Tue, 07 Apr 2020 08:51:31 -0700 (PDT) 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=22H5f+VrayDXYFN091+N51uEFPxm5X5X7vqYpPPYKEE=; b=vdY+9/RanPH02Og0zqVqXQJ8zeEnVHCBBM0x/MsuihZfSKddKQVMFTv79kkfDhCwiB KenpP3/bQYmkzTwHlpoQOFTUMrfkR7D5pm+QdViQR3dKGEngfLWlWjpbAoAlg8syE2v2 FexBmiD7CxU0h34QmM7zQ7B8akp7AaJoqmsvesH7FXnjyO6BSByp0UcmSJcrKGT81967 xldqCMqjlbkAl5p6eB5aCIjYB6KmGf23HybCr7cWMHFtzdmOrulnASPbCSO4K0SEMiOT W4PoTT+HZmOG97pebhOkSBVzNX1e5ORLLsI3cpr4+dnN8ATjh4y0PcWHmVDB4w9Ueeos Xi8w== 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=22H5f+VrayDXYFN091+N51uEFPxm5X5X7vqYpPPYKEE=; b=Vya8MyYjqiMdq049sqGRFB2ECHdM/rzqA2cOuHZPh/mjoOD7/HFf7/1BwYbBE/GHx7 DsWgRuwyLUM3bHlbJ/xXBtaqCGq8iAA3gATUQZlOWgyThIXmsa00+AIOW7PTbwY413Vd fNDQy0qYkjyaiKYiO63s8se7opfk9504aObUbHPiaiTvb5odoM6IrOCH0qcSahP2uK7u wrRa6YXW+WZ5/X4VbSHMIUwhK4g+7I7DFH4iR0E+U61SCbTHVAgI5juQt1WAaDOy+mhs o/l1S0fTo1/vkjvpzbpfD4uEtahD+TCaYBrh6R9dIkPocbu28ePf/GWqZuO2zell39c7 +2dg== X-Gm-Message-State: AGi0PuYERZygujEbx+Pjxv0ku/pAvGDxPdNVFPtvA0etpoqVOCxzHgKQ 5+8Iap50UzFJbXcnHky99rVEoA== X-Received: by 2002:a7b:cd8c:: with SMTP id y12mr3171798wmj.106.1586274689979; Tue, 07 Apr 2020 08:51:29 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 145sm1751033wma.1.2020.04.07.08.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DDF561FF93; Tue, 7 Apr 2020 16:51:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 07/13] gdbstub: fix compiler complaining Date: Tue, 7 Apr 2020 16:51:12 +0100 Message-Id: <20200407155118.20139-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 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_Mathieu-Daud=C3=A9?= , Richard Henderson , qemu-devel@nongnu.org, Denis Plotnikov , Euler Robot , Chen Qun , Miroslav Rezanina , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Denis Plotnikov ./gdbstub.c: In function ‘handle_query_thread_extra’: /usr/include/glib-2.0/glib/glib-autocleanups.h:28:10: error: ‘cpu_name’ may be used uninitialized in this function [-Werror=maybe-uninitialized] g_free (*pp); ^ ./gdbstub.c:2063:26: note: ‘cpu_name’ 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: Miroslav Rezanina Message-Id: <20200325092137.24020-1-kuhn.chenqun@huawei.com> Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200403191150.863-7-alex.bennee@linaro.org> -- 2.20.1 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 = object_get_class(OBJECT(cpu)); const char *cpu_model = object_class_get_name(oc); - g_autofree char *cpu_name; - cpu_name = object_get_canonical_path_component(OBJECT(cpu)); + g_autofree char *cpu_name = + object_get_canonical_path_component(OBJECT(cpu)); g_string_printf(rs, "%s %s [%s]", cpu_model, cpu_name, cpu->halted ? "halted " : "running"); } else { From patchwork Tue Apr 7 15:51:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185249 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5015359ilr; Tue, 7 Apr 2020 08:55:38 -0700 (PDT) X-Google-Smtp-Source: APiQypKwqtudj/llQ+irsjjqOZIfYZMnn5EPI/vdaCsymBQme4g0JtrmtB9wMoJcc+HP/nCpqCvB X-Received: by 2002:a37:a0d6:: with SMTP id j205mr2995302qke.455.1586274938679; Tue, 07 Apr 2020 08:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274938; cv=none; d=google.com; s=arc-20160816; b=LF7dTwndfllckUg4tPFYWLPBr6rH6Gw5lRDB+OzNXOG1RqNu3aLQHk8HX4KkMM+QEl zSidvE1r88hPQOU5urIhVReGAbTssB/9WhlCG6dHSTCSKmbfIK87e2w4lxyEH30O3LNc VMy+xMrGc6KrhjCYrh81+SOY2VDAgi6xysosWt9tN3tH1JOppi0JJEnni3U8oBb5rh6K yDZv75pPRos5PpKQrGrOMoQkZA74duzex67AjGl0Nq13yI5cgA5qaThzHHQJB5U5Hw8N wTg15VXtgA4qDPLhuOnvf3U6Irp3+iyYBxgKHc5NRO2kHnV7iJiQtPjUuvrY3zWk/Y2t BWMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=rtMP8ceKEL32RxJnzf/04PfZMF0AhqQhuzU8HQYfCC8=; b=LG8XfTnYXLiYQHe3uPCIQc0paTdlI1JpK1q8uz7/njtaKZ8iHzTD+tqwGjewSFwJqe ffULlRpB/eHIKJ7B09e6e1og1FPr2Aop2Aa2PuBpNb6UviG189t7VHLOvIz6XITtpRLh wjIwqZ/9Lu9iCgDG00e+f2EnjGjxtRiwCZ8BogU+iauxTRWrnbJUA5h7CUYDkU/pOeZ5 W2kfil+24jDU59SxOAnG+h0s9chlFn20AEE2b4NXYDfxSCcZrnD1hR4p79EACZ/xOJpI 5XSNSCwKXbQbZ+wxpm48bWYFxPjFFNL9om5rS++0X87hyatm+1Std6kFmUmAIY37cfZO 0HfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LUi2JkXA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m10si2072832qvo.141.2020.04.07.08.55.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:55:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LUi2JkXA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqZe-0001aE-7T for patch@linaro.org; Tue, 07 Apr 2020 11:55:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43733) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVj-0003gS-G8 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVi-0004Qc-I9 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:35 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:35332) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVi-0004Pu-B7 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:34 -0400 Received: by mail-wm1-x32e.google.com with SMTP id r26so2381427wmh.0 for ; Tue, 07 Apr 2020 08:51:34 -0700 (PDT) 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=rtMP8ceKEL32RxJnzf/04PfZMF0AhqQhuzU8HQYfCC8=; b=LUi2JkXAP2knRV0g2mRSbykVlLamWHHX/kbUWBV/mEN7jTEPFQiyYyKpVEeK7YCdf6 grn7xRdEYs6MdplFoMz7H+XWCnEfxEEARuEuEpCj16HUhxQEcX18zgAfk1wxXWFYUMfV 05+icVClCIgaZEljagw9i3iolyowYBEs17ml+8JV4okd4RUMIUWQDb4NMFqzfGw3R9+P hWRLGheQqO+Q5fL+dT2P+bPoCoZGudokuLKzMF2CpmkWAojG5xlUI3Sy9KPd09dawu4y QYVIaAi5LPMWOjifGhXw7tAensV1ic5tzOc965UKIz5QEnsrc8C0niOOG5V3pVCpf8vo yb0g== 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=rtMP8ceKEL32RxJnzf/04PfZMF0AhqQhuzU8HQYfCC8=; b=MazbOi4uiYggiHaixLIHWEL5Q2JQacUv7F4ox+mQPM+z/0z2gYm86gStVNsMn+b1+r E7cnIJ7jQqzf91xm0UHUI52bL6qxPb34rGAl0I8AkkjfyKUVqgAV/Y8GP1GH90G2SIgE fVQCPE2RfPR5V9ixyjeDUXIIYpTntq/6utmNd+a+tQUdPgcR2ZY4NTQKqbpROzCuW/Jg 7Kf5cMnu/4r0hHPuJlEbLiuHmRar+VQgRVa5sBTBWCliDCybM+Tv2THNBku3D5x9EkKq j0UYCfcYAitHkb98/WVFR31cJbS5MJhEGaLjHpkXQEqoeUVFmJRrgIGq8YSOVV23n+HH enUA== X-Gm-Message-State: AGi0PuYDLR36Ho3bmQ8+/xOnqSvIvA16AxSed2nzYWKdHZWFDhp0QzFn 0IzkAEA62w90GJpdSMzZHdg2L4mHJl4= X-Received: by 2002:a1c:1fca:: with SMTP id f193mr2935310wmf.5.1586274693285; Tue, 07 Apr 2020 08:51:33 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w15sm21898416wra.25.2020.04.07.08.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F1F491FF96; Tue, 7 Apr 2020 16:51:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 08/13] softfloat: Fix BAD_SHIFT from normalizeFloatx80Subnormal Date: Tue, 7 Apr 2020 16:51:13 +0100 Message-Id: <20200407155118.20139-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32e 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_Benn=C3=A9e?= , Richard Henderson , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 = +0.0 or -0.0 + -0.0 = -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ée Message-Id: <20200327232042.10008-1-richard.henderson@linaro.org> Message-Id: <20200403191150.863-8-alex.bennee@linaro.org> -- 2.20.1 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 = 0; zSig0 = aSig + bSig; if ( aExp == 0 ) { + if (zSig0 == 0) { + return packFloatx80(zSign, 0, 0); + } normalizeFloatx80Subnormal( zSig0, &zExp, &zSig0 ); goto roundAndPack; } From patchwork Tue Apr 7 15:51:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185251 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5016583ilr; Tue, 7 Apr 2020 08:56:54 -0700 (PDT) X-Google-Smtp-Source: APiQypKD0Lr8QrMCjGYah9d3DLPXr1U8hV7E/lkGXv9LnarVKISn6SppVXCd7oTbvZMvl8jSTOPj X-Received: by 2002:a0c:f583:: with SMTP id k3mr2834848qvm.129.1586275013918; Tue, 07 Apr 2020 08:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586275013; cv=none; d=google.com; s=arc-20160816; b=Lb1tStwn4gswhforOKHZy/lV4RMiEfUsg+6hOTLh5eLBQb850sx8XXEdrOD8MO78Li oouius/NRH+c8jQUjgAqZFPxRbInnqXqxpmY+P2yYIFi75S7SVjTj5ENZyybsdVA+tgl CCR16umgBZRqE0XeSsKC5sefIfgKnDnn53BXiH+nXwlgEq5KgGUg/ne/hXuuicXQ44Hn S3goG7/HF3g7KBIQDC9MrcmQrp/1+VMt7P9t2dsR9si4Frnv1zrgUli7K5MPC7ngxAdZ BNZUh2dmpILCTU4P9srQYnt7opjnYxqBSBBYoVjs+AcJaiuq51rTNJm5kSgoKYAvFyld RrJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1J4Mb00cD/gBndme3KRwMHmDdy2oCcZCIa8IBou3aHg=; b=AC1GPPcKMRvpN5Phs67Cgig0pDFuScu2fljlLsbOhz4wAVN9jM9CP8QtTw+V0XRV1q B30beQpo5qw1MTLOSeyPMJxM3dMXqZvmcJE6f4InA9nQEUCyjWNlcm5bbReflfk1xSRF /IO8rG5/OrB4Xg3yF4vbUimdR8yPXGCk4IH9eBqjgOigWIzo0BPgyNFBKyHeIZD1V1f4 9dP5LBHqn/70ScCXuEUJ+9fXsxRt8CKrncZ99BFY7cH49bBllBx6cSRvfRFWbnmSGbG7 aU4DlMHgd9N5p3plYh21KBTtvxzoPbSK73zmRVbI0FmSIjkf2A2qA2t9kudOt8mitNMb TN5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GpDLWiHO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i12si2036079qtw.163.2020.04.07.08.56.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:56:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GpDLWiHO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqar-0004Q0-Cs for patch@linaro.org; Tue, 07 Apr 2020 11:56:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43716) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVi-0003d4-5j for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVg-0004OV-F1 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:34 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:55527) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVg-0004Nu-8M for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:32 -0400 Received: by mail-wm1-x343.google.com with SMTP id e26so2232323wmk.5 for ; Tue, 07 Apr 2020 08:51:32 -0700 (PDT) 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=1J4Mb00cD/gBndme3KRwMHmDdy2oCcZCIa8IBou3aHg=; b=GpDLWiHOKc9NuiNI7Z/GbclUEwnk9F1uroe7YWurmeYHOylclPEBBoN0mPwRqDnI73 skZfvA/M3g3CvUyYsQFcCkOo2ufbemcf7ZXhenFjutLgAIXnbXhjSEjWqqJ8UELNrCVe XEK7wrKmlySAQefuSXKDlAluJo9l2VsOaUydQa49MvuMoLjcrWay2RSDI3iS/F1D5iPN pBTyuDu0lLXzQSkf9BqEc/za62i416Dl0wfyJwIgAnof1fZmSb1c8L+z0l+NQVd8vj/h 4d5itWKb4vRDKEvOAs1wE3PpfJMK3uv5hc50drqA/K595xqM/foF/2CaC1KlQ34u3nWZ yW1A== 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=1J4Mb00cD/gBndme3KRwMHmDdy2oCcZCIa8IBou3aHg=; b=dVcMkzQ4/vLwq15pEGRLbHEXl7JSMbIAF8CIeZso/JiS04wO6BMeSzRxwkCa0Dsn7M 1K9msRDIFR/V7+AstIEBzfh42TifN8ogBAbJaKjE9+4PcK8EQmWmzumWAujkdgV64qfo ldlu5PJGNmYzCaIdYIPLcBvvjOWEKNJzq+3T3Z2MF6D4ysiZXAHDnjiL1hbTwWGxixL4 bBgs6SiIpEITbb+wp8UG6S7DaPGCIDNV0uZCbOQaT0qKRaCvHKUN/rZu8so1ZnthP50E ppMXod1vNEEqBiL9rH1i2kD7brjUQlO7XzvaeAYaXqBxPUOM/VILyYdJrVNhSHcoSzP8 j7WQ== X-Gm-Message-State: AGi0PubYOuCDXq9P/Mx2ymmfc4/nBrWnhl1qZ7W1JGtej97516iY7JMN zy3E2nmJSVPmtFsNrlE3ICp8GgpTwJ4= X-Received: by 2002:a7b:c3ce:: with SMTP id t14mr3167701wmj.9.1586274691083; Tue, 07 Apr 2020 08:51:31 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p22sm2849817wmc.42.2020.04.07.08.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 165AD1FF98; Tue, 7 Apr 2020 16:51:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 09/13] linux-user: factor out reading of /proc/self/maps Date: Tue, 7 Apr 2020 16:51:14 +0100 Message-Id: <20200407155118.20139-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 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: Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20200403191150.863-9-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/qemu/selfmap.h b/include/qemu/selfmap.h new file mode 100644 index 00000000000..8382c4c779d --- /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; + uint64_t 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..5f117872947 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -117,6 +117,7 @@ #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 = env_cpu((CPUArchState *)cpu_env); TaskState *ts = cpu->opaque; - FILE *fp; - char *line = NULL; - size_t len = 0; - ssize_t read; + GSList *map_info = read_self_maps(); + GSList *s; - fp = fopen("/proc/self/maps", "r"); - if (fp == NULL) { - return -1; - } + for (s = map_info; s; s = g_slist_next(s)) { + MapInfo *e = (MapInfo *) s->data; - while ((read = getline(&line, &len, fp)) != -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] = ""; - fields = 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 = e->start; + unsigned long max = e->end; int flags = page_get_flags(h2g(min)); - max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX) + 1; + const char *path; + + max = h2g_valid(max - 1) ? + max : (uintptr_t) g2h(GUEST_ADDR_MAX) + 1; + if (page_check_range(h2g(min), max - min, flags) == -1) { continue; } + if (h2g(min) == ts->info->stack_limit) { - pstrcpy(path, sizeof(path), " [stack]"); + path = " [stack]"; + } else { + path = 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 %"PRId64" %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 : ""); } } + 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 - free(line); - fclose(fp); - return 0; } diff --git a/util/selfmap.c b/util/selfmap.c new file mode 100644 index 00000000000..2ec99dfdda1 --- /dev/null +++ b/util/selfmap.c @@ -0,0 +1,78 @@ +/* + * 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 = NULL; + + if (g_file_get_contents("/proc/self/maps", &maps, NULL, NULL)) { + gchar **lines = g_strsplit(maps, "\n", 0); + int i, entries = g_strv_length(lines); + + for (i = 0; i < entries; i++) { + gchar **fields = g_strsplit(lines[i], " ", 6); + if (g_strv_length(fields) > 4) { + MapInfo *e = g_new0(MapInfo, 1); + int errors; + const char *end; + + errors = qemu_strtoul(fields[0], &end, 16, &e->start); + errors += qemu_strtoul(end + 1, NULL, 16, &e->end); + + e->is_read = fields[1][0] == 'r'; + e->is_write = fields[1][1] == 'w'; + e->is_exec = fields[1][2] == 'x'; + e->is_priv = fields[1][3] == 'p'; + + errors += qemu_strtoul(fields[2], NULL, 16, &e->offset); + e->dev = g_strdup(fields[3]); + errors += qemu_strtou64(fields[4], NULL, 10, &e->inode); + + /* + * The last field may have leading spaces which we + * need to strip. + */ + if (g_strv_length(fields) == 6) { + e->path = g_strdup(g_strchug(fields[5])); + } + map_info = 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 = (MapInfo *) data; + g_free(e->dev); + g_free(e->path); + g_free(e); +} + +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 += guest-random.o util-obj-$(CONFIG_GIO) += dbus.o dbus.o-cflags = $(GIO_CFLAGS) dbus.o-libs = $(GIO_LIBS) +util-obj-$(CONFIG_USER_ONLY) += selfmap.o From patchwork Tue Apr 7 15:51:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185247 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5015011ilr; Tue, 7 Apr 2020 08:55:18 -0700 (PDT) X-Google-Smtp-Source: APiQypKSDRdQ6XpRLCL5OZ8MglynA4/qq214i6b7SOyAfPyri6sheHPxO1GXeuNcnr0RVc6GkIQs X-Received: by 2002:a37:aa15:: with SMTP id t21mr2922951qke.460.1586274917528; Tue, 07 Apr 2020 08:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586274917; cv=none; d=google.com; s=arc-20160816; b=vYgS5r2Ej+4nMfWmKYywbzfSNDmrnCOD9VsrpSqSgFd1xkLL+dSd3fQEtevwFbWth+ Yq6PjdgzEznRScXPQxDNdFv9pqN7ze+QJ5lAfOBBkV8Ld2igxNbHKRcxLfvANmO2JCDX rUQ5Idq48g98OlQtGIBqMpOkEIgJXw1MBM6DwvKLExcIxDJy78b6X/P8PKDNTY0OBVdB VUPB211NG6NAa1FeknqyAPc6hmn9GEVtbPkKlWEeSUKGAteTJGDek1odzXiK9KDlS85b 8i3zLDvIkJXt8Zie/jzEeHDSMsZdOr+z+lH0friBsSEllNd/C/MKXYJZQ0fQ7cIVgEpW GLQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=D8BK29LzMjfBeG1Gt0CmPdKAbN7O2k2vjO3bs9Akqc4=; b=tTEMu5/KqyQ6PUANbQfqSGODsfk9o2URPdCNT2IklpN3UtRKSU2scxbNMVQo5ygu2n U7VOeepPlqilgIaHK1TVCUEzvnrX070GTyMTWaXCQ9r9NSL9L/lDp7evJQxBVvqr3CqS J7EoCm4YZ5d7r/JGXonRPw1lQrekqr0JZhdizQWabGDYk2955lUsrj7AESj17lIxGRRT S9yllAJe6+EA0mkGuFILWp+SlP2MsK445DpWd5bFqidKPIsyd7xRlUOiW9hrNfCEtBiQ 8b1YxXAtqfGz+y8c2vPkISfhhy12JwoEAPNLFCmmEg551Dtfzc2X7bQphvSYArBdTmcP R0Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KLYCntdY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f137si2107572qke.171.2020.04.07.08.55.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:55:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KLYCntdY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqZJ-0001g5-2W for patch@linaro.org; Tue, 07 Apr 2020 11:55:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43718) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVi-0003da-CC for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVh-0004PD-9D for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:34 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:38488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVh-0004Ob-3D for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:33 -0400 Received: by mail-wm1-x32e.google.com with SMTP id f20so2364532wmh.3 for ; Tue, 07 Apr 2020 08:51:33 -0700 (PDT) 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=D8BK29LzMjfBeG1Gt0CmPdKAbN7O2k2vjO3bs9Akqc4=; b=KLYCntdYS8lGIH4zoDHxDdbiGfUzjbKpOXcTQgZMZXxbSYn+5NTyVuTiQ4qJHZiZZY GEzz4pGB+eFcaLkTnAIgn4QCmRLDY7NlKMWDhvf2D2YJUgw49yrjLWpxS82/h12YPY8u pe+OtxvA/DJnn4TjXuKw6QzzedoLQCzbas7RNI0dJBlaAPhEAigaYbbGX4q0XFNEdaTQ wdFh+hR7a8ZN8zg5HqHmHJ2x9fl0SzxesrkTTKAcXFLnWGEh0IVumDOeBkbGxRa4ZH6y 13E/W9FkPnaYjReWXM2NvH35VX2LzzuhE4sE+IgQHIM8G1ftj0IVvqtqKU0qF1d2DKlq nrpw== 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=D8BK29LzMjfBeG1Gt0CmPdKAbN7O2k2vjO3bs9Akqc4=; b=EPUq0bsjnKhJDyRa2UopPyiORdOGVeIvm/8ypZNp32ExeJe7K5a/jQFr/J0hBfkrOs CemOiN0s2Zxqt975w7KNoA+IdqRcq+XzMmuFm+k4716r1rGaJXj57TKO5JlSuxR5yI2p puqEz62gIYMxgmGLYV4y+RwZJkv3ijgI3r9EF0//5mfaqDoKeefp4ygsm4infkphae3k 7YSdDoacHBe2y+yS8LHuCA0qCa22FkWyQ13Eq5Y3Joyg8zHDGpgfuIOej9BPVmRgC0S1 vbPpC+BAyg0NJbnMRzoV5H9M5RaItGsOt5LmNwNnYnC+pD6y1EQh+6XhZmyFuXg5Mo/j ACkA== X-Gm-Message-State: AGi0PuYTtZRY4vSkoFEF8OygjWgLDQBaalCDC7eDBCDvz/UQKEsRpCrK OvwcdK9k+uMC4rQEfAgcDGU4lg== X-Received: by 2002:a05:600c:a:: with SMTP id g10mr3043304wmc.153.1586274692008; Tue, 07 Apr 2020 08:51:32 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id j6sm32369851wrb.4.2020.04.07.08.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2BCA01FF99; Tue, 7 Apr 2020 16:51:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 10/13] linux-user: clean-up padding on /proc/self/maps Date: Tue, 7 Apr 2020 16:51:15 +0100 Message-Id: <20200407155118.20139-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32e 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_Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Don't use magic spaces, calculate the justification for the file field like the kernel does with seq_pad. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20200403191150.863-10-alex.bennee@linaro.org> -- 2.20.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5f117872947..6495ddc4cda 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 = cpu->opaque; GSList *map_info = read_self_maps(); GSList *s; + int count; for (s = map_info; s; s = g_slist_next(s)) { MapInfo *e = (MapInfo *) s->data; @@ -7253,20 +7254,24 @@ static int open_self_maps(void *cpu_env, int fd) } if (h2g(min) == ts->info->stack_limit) { - path = " [stack]"; + path = "[stack]"; } else { path = e->path; } - dprintf(fd, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr - " %c%c%c%c %08" PRIx64 " %s %"PRId64" %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 = dprintf(fd, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr + " %c%c%c%c %08" PRIx64 " %s %"PRId64, + 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"); + } } } @@ -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=y 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 = dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx + " --xp 00000000 00:00 0", + TARGET_VSYSCALL_PAGE, TARGET_VSYSCALL_PAGE + TARGET_PAGE_SIZE); + dprintf(fd, "%*s%s\n", 73 - count, "", "[vsyscall]"); #endif return 0; From patchwork Tue Apr 7 15:51:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185253 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5018172ilr; Tue, 7 Apr 2020 08:58:42 -0700 (PDT) X-Google-Smtp-Source: APiQypKoxRkieUQhu/TDsIj83nMln7B2ckaIX3/o2yc9n5YcA1NvHgIJJzXrn+rcUB2uGzZP5pf7 X-Received: by 2002:a37:9fc6:: with SMTP id i189mr2905682qke.46.1586275122675; Tue, 07 Apr 2020 08:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586275122; cv=none; d=google.com; s=arc-20160816; b=htXEK/53t8tzzb6BqAtR9c3VbMu4ORXxnVE1s/jdrJ9x3QTMuQ0ACUzykvLgayZ0cC W+sCEbQedqRzkhXwBxZdtRjoLRAxKggb1Y+5WdKEXZrZH5hbdFfJxTILakJd+Mhb7ofz VkMBDlg+umEcw9wVb0ihfyPn5AfPrSxQaNgGKotur8pRTj3Vj2HsjtRJ9OwW3pvKpP8J SDW1gmv+SACervSvUHXsvOF2AfQm42vvYMwqgDve7OTvligzVk7mOiKrBzI6BKOzoJU8 0xyibO4aaE+usc2iNVDMCPdBb+1HWsXG7LB3hMWBLxfMTHzNrh4iBe85Z+Ah2vYL792O H7GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=6B+33TDAfIaOLpicgY8n+ylFencr6qohELifXSSvkE0=; b=jiJlydYvy4XkjOVHWtjPZwoQ2LEyVOMdwu3YP3CzizdKQqAf7G4orAcSgPFNW+Anp8 NL3iJN4tXicqHKUmfXZ0xQKD90U3CqOfjpvzGVkup6xdgcGzSgsN8G5vIyX/fBzEGfzk IEtIXYGP6ZU985n/dqUqwALxxVlizy0JPCiqKeQYy2dpQ57ZcFFNk2u7m7mB6sWIi+No Tf5mmCwbYVQ5swvtjqpIi0U6FCPuE1TE2gA4HciSZp7/LO0HsTTfRWXhWGHXOIHeNTfV gqImChjJtSL0JZJm7JIwUyJKH+b75fmQ77DQwlpYFMRkORK3guyFDGAHPfYBjXByW/cQ 5HZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mVZeilI2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h7si2126936qvv.138.2020.04.07.08.58.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:58:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mVZeilI2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqcc-0007C5-9O for patch@linaro.org; Tue, 07 Apr 2020 11:58:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43761) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVm-0003pK-Os for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVl-0004Si-J3 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:38 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:42130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVl-0004S6-DL for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:37 -0400 Received: by mail-wr1-x433.google.com with SMTP id h15so4463653wrx.9 for ; Tue, 07 Apr 2020 08:51:37 -0700 (PDT) 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=6B+33TDAfIaOLpicgY8n+ylFencr6qohELifXSSvkE0=; b=mVZeilI2YzyMDuyyFkQnkFrkD8G/vEsr7Vz//hcMCcaxuLqVMrqGslf8CLPepOCTKG 4oo4haNCToi6HUVTMRx8gR505gVrszSGTYnVNax1kX6exw06qD3FBlFHPvvQVqEuDu2v jX8Nmv/L1UjiopQf3IsBAfRNmkTT8g2WWtC/+94fju7p9eyltcQHdxt2UNsmj0Tfhz7m NQaUN4SEE++V1TQAANF4TFi+DSzDPZPjjmpfpBypDFHG3BuTJvevIEbVgoLoqDt0FAkc yuw1uyBC5Bwn3pFRlihUmrXVCPPrGoMGub7bQBox9ROJGgMfOzospe8y40yHzgb2R1tp wwbg== 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=6B+33TDAfIaOLpicgY8n+ylFencr6qohELifXSSvkE0=; b=iytMvamwi/r4w5EOVLH1EqqnAWLT5UyXvtXTZbhZ3YWZl84kCg2Sdsvk/Ej5I2iwFt sz2+RmX1027WEnb0mCAeKbJthe+kT7nklbvyPgfRn5ipkhFSwHxrjqTTZEwTDo1hCECb yF0inYAnCN8UBoHIf9ZTvNLkotk0v/HaPdkQc1xzUBfk1T7wgIChcXKwQ5k1Te8rmbF5 CV8KuZl6L0QVTGoAAYEfQMGXCeOm/TXloaMK8CYpzjgyi++c4I81NE0K8lj4Ss4atsp0 wtojqi5I9/TwUMG+dZ3OjXASLT6b4j1v3HtZ7AQy9LGRydyO+mPynYChZ3Zpa0aO2+5W BnLg== X-Gm-Message-State: AGi0PuZwtJOVoZsx9rxSOPFZfRyfZcODPiF7PlWvKFDr8eSHWBOgSC8O KTFOTyXnSmGR3BNHFiywcpwr/BEWzVU= X-Received: by 2002:adf:ee8b:: with SMTP id b11mr3323659wro.404.1586274696290; Tue, 07 Apr 2020 08:51:36 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w18sm8881639wrn.55.2020.04.07.08.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:33 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3F0721FF9A; Tue, 7 Apr 2020 16:51:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 11/13] hw/core: properly terminate loading .hex on EOF record Date: Tue, 7 Apr 2020 16:51:16 +0100 Message-Id: <20200407155118.20139-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 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_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, Stefan Hajnoczi , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Signed-off-by: Alex Bennée Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200403191150.863-12-alex.bennee@linaro.org> -- 2.20.1 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; /* 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 = 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, hwaddr *addr, uint8_t *hex_blob, .bin_buf = g_malloc(hex_blob_size), .start_addr = addr, .as = as, + .complete = false }; rom_transaction_begin(); - for (; hex_blob < end; ++hex_blob) { + for (; hex_blob < end && !parser.complete; ++hex_blob) { switch (*hex_blob) { case '\r': case '\n': From patchwork Tue Apr 7 15:51:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185250 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5016501ilr; Tue, 7 Apr 2020 08:56:49 -0700 (PDT) X-Google-Smtp-Source: APiQypIZS42Mp242qvrT47pBNcOUNUJ14cDBAJkDUDOhbDcAvY/J8pzfzs0RD3B34PEqJX9ZUV6X X-Received: by 2002:a05:6214:906:: with SMTP id dj6mr2855172qvb.36.1586275009573; Tue, 07 Apr 2020 08:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586275009; cv=none; d=google.com; s=arc-20160816; b=XPXOufeM+m/xeQHWoqa79JGdP2nzghaQyW2fz8ZFcr62JfZ3BOHhPr1dNbdMe5gPg+ 83HRsVUVHp28uWapz021dbZ/f1BeNtnZm5LRtX6gnXFBMBqz6Cl7GPRH+1z0w3SyoHop Hr/0rYaUrsM27SkpOQVPOWrHB61uLm5m1kejOEvi6OLEeZbOcGnOa0xbs1OaWnPkWlbA lwERXbFu8+U/ddmiSNskMDJEUBgSfqmYwFlOMMpmwAqY4+CG70v1eFH9xjL92liYj1K0 9vKqjH8ttkhUTwgbZKUerxRgQPcSalywsWzrivlA9K3IcT1N93Qad3wk0T0m0N5zrXaB aD1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=DZhF2Eah6PBu0UmOWylByF6k8/eL6tyE6oC8t+Hk8gw=; b=BBmhNBeunCz2mnwmPdOfq8rY70t+bZJVYeMmN4RUq0Ne2PE5jKcPuE4L4W6dtLuB1Z MHJg06WgSadeo5e2nghA7HFuhLLXqlZIRs6QZShYRJAIBOqJNvXlBR9IfeOfJwcuflT7 gvzKt3nTHW4FCYuVm07p1kuNa15DQM+LpBkNs2wh7fiKAgxydNc7REusOMJ8X7ZssijD ua25Ts8OVL5wEhLcT86Fdl5WzVzdtke2Gq60CZtG/+rJw4ppWTeU/WMUovYCMQzjJFWM nqVaIe/InmRmG9u4cAAK9SOoC8nUzv+xtpSQEJok37T3IYlmVtGRXx+mAmOCTE5Iw655 AQxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UIeWE+PU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g6si2151642qvy.39.2020.04.07.08.56.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:56:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UIeWE+PU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqan-0004Fn-1k for patch@linaro.org; Tue, 07 Apr 2020 11:56:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43747) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVl-0003ku-Je for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVk-0004S0-HR for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:37 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:35887) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVk-0004RS-BT for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:36 -0400 Received: by mail-wr1-x434.google.com with SMTP id k1so4504660wrm.3 for ; Tue, 07 Apr 2020 08:51:36 -0700 (PDT) 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=DZhF2Eah6PBu0UmOWylByF6k8/eL6tyE6oC8t+Hk8gw=; b=UIeWE+PUqdeeMcb4I8uiCEgsyj25vatF1rEm1kwXx9rHPR8KxR3JVBUmy6EBiMz1lv jQjUzahruWdAtRlS0MxxFEWXl+wy0NL8QUstg69IOdg+I6UmCwdqK+tUyC5+sNkNWmc2 H3cVLXuvJlmHA4b7/jVwsAf8FdTlFO6biW1kYjuzWzvIicuRFlNA1r43To462wMOYrQx O5ZSCwI+tPlcYrcMzGAKptjcS6Zw6uWCjmW2HwmOlg6Ic8JC8p4yedzxWz9GIEq/soXE 4SPVlaJ0COcvCJj7NjHGi9egVeEq2sMJ8ptDjCCfnVcP8gswkJPukxbzMNksVLKSstpH 85Uw== 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=DZhF2Eah6PBu0UmOWylByF6k8/eL6tyE6oC8t+Hk8gw=; b=WzF05OBTv9M46xcu1nLqVi9ybWTLNgsHkQHp/LhXyMuKSX1IM+GFx6PaUETeL98xwp jbkbXu7FPvLileu9RwJRiCWPb7CTHxa5xTxuvutoSD75SyyeiwmUs8l1UEYMrScyOO+Z YQK2npe8BEfmeqL+D4InjB+l4F8uNzeXrtQyqtgNvGV4fQTgQs5xwvdxtcdfDprVjWGo XRoMAB7mlFnosPStEuEMEdEV+B6+T/yXfXWE32Xbr06h410SR+vAf7pY1H9o0UTwtpxt 3Wt1Yjhyb8btWs6a0fwt5zTEdlhoFLAzjJhfwM0RqlZgWAp1j3iHrdMySZ7enQeY0TRJ VPog== X-Gm-Message-State: AGi0PubslbtdTi9tzy9805i7KKGKguyNvnbxgcqgcLQfsMEd0G9/DSnf ZkKXRpjTC0ODF4ZD53Z4mQQe9A== X-Received: by 2002:a5d:6204:: with SMTP id y4mr3625126wru.410.1586274695169; Tue, 07 Apr 2020 08:51:35 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s7sm6888848wrt.2.2020.04.07.08.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:33 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 52D221FF9B; Tue, 7 Apr 2020 16:51:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 12/13] configure: Add -Werror to PIE probe Date: Tue, 7 Apr 2020 16:51:17 +0100 Message-Id: <20200407155118.20139-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 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_Benn=C3=A9e?= , Richard Henderson , qemu-devel@nongnu.org, =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20200401214756.6559-1-richard.henderson@linaro.org> Message-Id: <20200403191150.863-13-alex.bennee@linaro.org> -- 2.20.1 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 if test "$static" = "yes"; then - if test "$pie" != "no" && compile_prog "-fPIE -DPIE" "-static-pie"; then + if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" pie="yes" @@ -2132,7 +2132,7 @@ if test "$static" = "yes"; then elif test "$pie" = "no"; then QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS" QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS" -elif compile_prog "-fPIE -DPIE" "-pie"; then +elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" pie="yes" From patchwork Tue Apr 7 15:51:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185252 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp5017978ilr; Tue, 7 Apr 2020 08:58:27 -0700 (PDT) X-Google-Smtp-Source: APiQypJnx2FLl1j19Q88/tKBcwKc8RBJq10fzvz+ZZTzFW3pPtjNbmS+nHqlpRiMfZaU97JhIy7I X-Received: by 2002:ae9:c319:: with SMTP id n25mr2710557qkg.79.1586275107012; Tue, 07 Apr 2020 08:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586275107; cv=none; d=google.com; s=arc-20160816; b=qaeuZJ10TbLmjrXzP92ZmEe5DJcF5zY5NX11TNXmzeUAqv5hnCC1Mgt/hOR7qxQh30 fsBHt9jbgQBXH1Yhbmie/QHZOhsPfGOyuCwuPjqOq5ndnwsrDDqg+gabMcJAVq8dixxC UCuR7tPJFQBYj78cGKygS0+/VHI9+Y6xBRIcVwP3HFJHTLtbKyn03yZeG8iH31siOBKg XD4SgX0zBbAjN/163gubyd1q3LdYrFPRAgknJwxzTiMfyqtGdT6/oruqY172XJ2LD89D sonqCc1q2CdNUAT6FAOj0VakMsvjUvX2TsdKkkRfUPono68CC5ZzfNPndVI1SPILa26O gUWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+Dj9bvmQD1l5de8jG8VJF31FLCLEGTP0nVDrh17bTiY=; b=acTaMiGl3ReJxUO5JOrH/2haxrN61eez/skYyfnQE7wyDjnymcYH+iVHttYqSftztQ 7P2FY/M9ZJm3PMd/JX+qfDS6hcYvz4w380NkMVCvquA+ycLENaQo+MsJo2YJb85zrDiL TFhpIFIqYOHGtO43kWYPmY5Aa2rVT+Mi29WL0+8NR2QB/r/NVqCsxeNoiKeOe/MYOow3 EtVmb6C/j6bf2j2+TvBLjlRhSYlldxXMMsk1Bx6R4IY27WTLPq4E1kYI4Tn/XezCk1jv MvWfK4B+5SYBVNmpsbQSPMozqEe7ll0zlNSCXCRp7CtQpkxuJ9gi3ibBAplkXVfPi08V wpow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wn3u4hXo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a13si2201183qvf.210.2020.04.07.08.58.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:58:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wn3u4hXo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqcM-0006ye-Fg for patch@linaro.org; Tue, 07 Apr 2020 11:58:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43776) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLqVo-0003rq-F3 for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLqVm-0004Ts-IE for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:39 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:53352) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLqVm-0004TF-BT for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:51:38 -0400 Received: by mail-wm1-x32b.google.com with SMTP id d77so2250804wmd.3 for ; Tue, 07 Apr 2020 08:51:38 -0700 (PDT) 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=+Dj9bvmQD1l5de8jG8VJF31FLCLEGTP0nVDrh17bTiY=; b=wn3u4hXoejvD+TBBFVuquKqc7FHlfav1FYlvJdTory5jgXqTZt6EOTc3eHrcblqs++ oMBEvm4HFNeaKpkU19bdg2gzOiHjtbFRlQW7enV5FueUPCwvRmsu/1MsVRSddjXb5VM8 FBJbvlhRjnQ/3TdY/6/NDB/NuM4/sBg5pWUt2DSWtrOt6dupLil9mwi363vQBu7eYDzc xitJGkR8TjtmYFS8eG4RpgtEH8nIeZAe3CV4k8QW8z0375jWq+4AjYe6R3AvbprCFtxw SHMOVrjo3cC1IclJreMpJxWvFwfK9aUXR34zWJP1eysCQs43mawDuHCBLF1W+xArl3Zg hskw== 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=+Dj9bvmQD1l5de8jG8VJF31FLCLEGTP0nVDrh17bTiY=; b=k0nKjYOsoAjNRqjX1ToWhzo9QMNKyliCGb0uZxr6jPhCNlkzoQEzfrNE3VF+Z8Y0jT tW6qIjCAOCsrVF9zbQKxCuHu4nLjId1Noy9P5+WyGAqSNkGSxktSZ8Cqwd1ZSWXmvZof AC4bRPtSXp/p+oEkwNSdmwv+DSR+OacRyD+4A/Sz+mLIKbW16iXSTQW2aBLcgtPPDJye LDLbyrtuGkUl2CYTygB14eNq0uUaAwZrSC91MhV/SZuTucZYwU+hNqVeGpOye7XUZzAh M/1KkOMAE0GlpDT71mlfdpOYlv/JVBRA+9UabX9chndt5iDJnhZ9+zDxgV8tUPfnFpmh wVAQ== X-Gm-Message-State: AGi0PuY91bKmVxKIn0d8z/R459tB9pWoAt9Q2ohm0M/Yt0WhANx86mhx aDuatBCYqccZ7hWGlNaqUWZTag== X-Received: by 2002:a1c:4b1a:: with SMTP id y26mr1448584wma.130.1586274697219; Tue, 07 Apr 2020 08:51:37 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id e23sm21278552wra.43.2020.04.07.08.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 08:51:33 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 66BC41FF9C; Tue, 7 Apr 2020 16:51:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 13/13] tcg/i386: Fix %r12 guest_base initialization Date: Tue, 7 Apr 2020 16:51:18 +0100 Message-Id: <20200407155118.20139-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407155118.20139-1-alex.bennee@linaro.org> References: <20200407155118.20139-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b 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_Benn=C3=A9e?= , Richard Henderson , qemu-devel@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson When %gs cannot be used, we use register offset addressing. This path is almost never used, so it was clearly not tested. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Tested-by: Alex Bennée Message-Id: <20200406174803.8192-1-richard.henderson@linaro.org> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 7f61eeedd09..ec083bddcfb 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -3737,7 +3737,7 @@ static void tcg_target_qemu_prologue(TCGContext *s) } else { /* Choose R12 because, as a base, it requires a SIB byte. */ x86_guest_base_index = TCG_REG_R12; - tcg_out_mov(s, TCG_TYPE_PTR, x86_guest_base_index, guest_base); + tcg_out_movi(s, TCG_TYPE_PTR, x86_guest_base_index, guest_base); tcg_regset_set_reg(s->reserved_regs, x86_guest_base_index); } }