From nobody Fri Mar 29 15:57:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1590069525; cv=none; d=zohomail.com; s=zohoarc; b=jV5UWQazNAV+Rcl75Xv51ycMkaPiHoMdKnFrVcuFjEyLp/tgwTFe6r+sa+twYDVrcUNJfTUAqEU8h+1Qw35xhiyRuXNcxqgph3tN5BY0tz67AZOJOR4lRwYFu82vja+0eGtVJ7EewUYUab3K9dzgLOzUbVYpRRAWu18+of2TYvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590069525; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=jOXM0m/kqe/Bzewn8gZ7sUGDJi/1sEEUwPb5JWkw44g=; b=A2OhM9ST6O6IOB2ZraHET670IK0/PyNvXJXS3JKRqdne01aXisfLhlOfkiXqW32wFxENDqHmG5eVCKK1pEs55PfahH+Ij5vdVRSC4kjB0UVAtLyIQMGlEmfrzmi/e56OO5py2htLz+8JxpcPAX5HLA+p5dseu/6Bp7eLVKRswUU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590069525234535.591618088616; Thu, 21 May 2020 06:58:45 -0700 (PDT) Received: from localhost ([::1]:45650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jblid-0001p8-Qf for importer@patchew.org; Thu, 21 May 2020 09:58:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jblhx-0001PU-7v for qemu-devel@nongnu.org; Thu, 21 May 2020 09:58:01 -0400 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:36450) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jblhw-0001XY-3k for qemu-devel@nongnu.org; Thu, 21 May 2020 09:58:00 -0400 Received: by mail-ed1-x543.google.com with SMTP id b91so6727102edf.3 for ; Thu, 21 May 2020 06:57:58 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w14sm5061690ejk.13.2020.05.21.06.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 06:57:55 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 75F561FF7E; Thu, 21 May 2020 14:57:54 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jOXM0m/kqe/Bzewn8gZ7sUGDJi/1sEEUwPb5JWkw44g=; b=sctq1WWAmg/x/CQGB4m4dJ2UeNZcRJ7kbiULo0gTIEh2qM/znOjFGx/sBhR2zj/T7I vvlFQKLoNi3C9HwfUXlSrK93WvskP6W5Q+xffdrfo3yV4fbqFhc/2RUgPYhnZnMYTo/P t+AyHJfk4fPIqyZrStIuLzRqtJINapfDT5EM+WBWmoy5YYUeQdwD/G9mgtkKOXJu0E0r HfBFmaBoFYFAbu5oOv20bIoc4/OE/OjSnXZ55pBWIKzfOYM2R8nnbn+27wsIsylD9U8e vhuA/QiOaIKjbG1hf2XmuEzXkBEm/kF92U2BE3k6E/9FcFpgBBFIHaOn+9IFJnOx1+K3 ztSg== 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:mime-version :content-transfer-encoding; bh=jOXM0m/kqe/Bzewn8gZ7sUGDJi/1sEEUwPb5JWkw44g=; b=bBppkgide7ca0d83GOXQxz5SG+OsBD225fmEJ81U2sMfshdcyKj4uPWcGsX9UzWykC 0VCXwoiUGVnwR7R6sU1gztv/L4ykqsA4hGXZKhZmYufzWVtecOuzEdF8bZhEsSO7p1BD 4zauk328JuyVYwFhsE9DNllLTi1hrr3B252mmM2T201EUjdmeUOoyu3amZtfB2wUHbBp QtGfzVUz3fbwIAe05+qkYoTANf+PO30HMWCokTt7TTn+FfBiDmUlvvJDXk6ktQdPhE2i jz1uxe5QNYVT5QYuaHDTfcdhTpxOYVoaYD39wjpFbnH7vZmtBkpo7uMLDb7jlFieoAgF o3jQ== X-Gm-Message-State: AOAM531iDadfAQEeJEsl0lGOh0auHOWam9jxusY5Ymz7azazQ4jfIdHh 5iqQJbmAWL3O+XCkdDVWQUIh/g== X-Google-Smtp-Source: ABdhPJxjUabx6SDTFq+s4jU3XDoQyTwOvIWuf0nqdsqNy6YHC3qF8iJ1kLynBDCgwfcpeuy3crDy+Q== X-Received: by 2002:a05:6402:128f:: with SMTP id w15mr7949700edv.203.1590069476780; Thu, 21 May 2020 06:57:56 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2] linux-user: limit check to HOST_LONG_BITS == 32 Date: Thu, 21 May 2020 14:57:48 +0100 Message-Id: <20200521135748.9859-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::543; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x543.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: Thomas Huth , Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Newer clangs rightly spot that you can never exceed the full address space of 64 bit hosts with: linux-user/elfload.c:2076:41: error: result of comparison 'unsigned long' > 18446744073709551615 is always false [-Werror,-Wtautological-type-limit-compare] 4685 if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) { 4686 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~ 4687 1 error generated. So lets limit the check to 32 bit hosts only. Fixes: ee94743034bf Reported-by: Thomas Huth Signed-off-by: Alex Benn=C3=A9e --- v2 - move inside else bracket --- linux-user/elfload.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 01a9323a637..de82eaf5420 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2073,12 +2073,14 @@ static void pgb_have_guest_base(const char *image_n= ame, abi_ulong guest_loaddr, exit(EXIT_FAILURE); } } else { +#if HOST_LONG_BITS =3D=3D 32 if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) { error_report("%s: requires more virtual address space " "than the host can provide (0x%" PRIx64 ")", image_name, (uint64_t)guest_hiaddr - guest_base); exit(EXIT_FAILURE); } +#endif } =20 /* --=20 2.20.1