From patchwork Mon Jan 7 06:56:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154868 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3179204ljp; Sun, 6 Jan 2019 22:56:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN5k+kD8TRf9/DEemZsqDjZNk0i+cq6edObff0NsH+gipT6huKcoyrqCM4s9C//DflUJ4R7P X-Received: by 2002:a65:65c9:: with SMTP id y9mr10190162pgv.438.1546844216273; Sun, 06 Jan 2019 22:56:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546844216; cv=none; d=google.com; s=arc-20160816; b=s+AbFONyHNWnkqX+EQ07LE7/0uu6at8e7qRpRaS/apQgz4J+bUZrsrZJa9EPzdCeI1 r6X93X3PISXUSdtlNJQxFGSi8wGoT9v2/MaZsA7Vf44Rx9+DgrmWVWfmNh1NTGI7wroZ DnRVgSXLC5ucGW+K0OJkDfCX/nlTM7dDXdjar7HWfyxPaoNZ9e3ved/RzIjm03YboBWz ruVKpewi69zWnMS6+sYxi7LZY5Q6EP4AEI7TTam6E6O7cuM83eahqatF8hjOF8KG1Zn2 unl1SCQMGIegJvfXYxK4KxJZp8Y6GNCXzZccen3dHVHTm9kuNjHsmNISqxSMJGGdSSv0 39VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:delivered-to; bh=0rAbyT8OE8jn0FYmtBxDyy5ZlmxJqha1kGS4dlKW104=; b=PwFQPzgQEHCyYN2uuCHjTe77G53HQMS7rFdlNWJN84ZkBQGtIYgy5ckNbp+G7xL+Nm gr4WRA4BgafB6sQ9abF7yxIi41N8InoFzaFExJPnQ5kWSLEisxlQOQsP7QfPILgNyoMF mNduGP7ESsOqZ7yMYM+yWT8Sqml9ddj44Ys8PJnnBLUx2pBOHTvx7pKYQINoL4CuA8+D PUElOl8wdC595N0TTSjrZFh9mkn/p6GY5D025JQGyrym4K69pHlOzo7RjrZK6T9WsU3s jIU+VUPsyqBf4fn/Xg4zYvX+33IDSYsf1wM4kbrFXojMiTlYuHzjKgILKuc20LmEvkot 35OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DqBHOewc; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id e7si1692154pgi.263.2019.01.06.22.56.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Jan 2019 22:56:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DqBHOewc; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DAD03211B1125; Sun, 6 Jan 2019 22:56:55 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::544; helo=mail-ed1-x544.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 51D3920837994 for ; Sun, 6 Jan 2019 22:56:54 -0800 (PST) Received: by mail-ed1-x544.google.com with SMTP id x30so36931342edx.2 for ; Sun, 06 Jan 2019 22:56:54 -0800 (PST) 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=/OJBwtaHnQ4UlfiKuRvqpPJo5XBXdzsEm67Y4o6xSl0=; b=DqBHOewcaTN0GCPwFKbN7JweByPaJeKKYgYkaIlmgzxwDO83U20Ot6ckdRdpWmFWxl iTcIoS7ZZk9lifHXCyKVK8zfCi6OypHVGjxpCY/NnjlYLvjczh1ArGw2Epb6yl5bTb9o yQy6TvPZ6uT30qSNNXanD6lB3ooRuHF6SrjtQ= 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=/OJBwtaHnQ4UlfiKuRvqpPJo5XBXdzsEm67Y4o6xSl0=; b=n1hc7QrAUfxYrobORLGCcJxwP597CBODPu6725a5YlNh7SpOWZv74i996Y0Mr2FVWo g8MjH26tafe9jehCFye9MtJsUvBEC4b2l7GS5njk/Tz3jxYy4RquXHANqJ4sjTWkl9nc bzy3ltL/mob7zN+nEGN+OTB5pFS1uJGgxsD7gepEn64n2+RKzdhu/liBX/RT5F/h9QOX AN9Jbtg4sSzjD/G0LNZfVNOBX8JgvPMhUtKeU+Pb4Uz0MPXehDvfDcEkqiMvbZCdVoSl kJ9zRi7u65in6rWqk8ilUYDsbxbB+p5MqUsKV0J+wxEzcfVgr3LLO4Frw7CEkOwhDYcP D9dA== X-Gm-Message-State: AA+aEWZbyieaiLyXAM+Xh3UtvHzDO77jPK+WeYI5lVoQv66nlym6/SGd J6A8DBTEeZAQoXwCMNarrGWiKM9F1L/Gqw== X-Received: by 2002:a17:906:cd2:: with SMTP id l18-v6mr45045950ejh.97.1546844212514; Sun, 06 Jan 2019 22:56:52 -0800 (PST) Received: from chuckie.home ([2a01:cb1d:112:6f00:58f2:776e:9e23:a7ca]) by smtp.gmail.com with ESMTPSA id g37sm35490296edb.85.2019.01.06.22.56.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Jan 2019 22:56:51 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 7 Jan 2019 07:56:49 +0100 Message-Id: <20190107065649.2003-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [edk2] [PATCH] ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Ignore calls to ArmSetMemoryAttributes () when the region described is outside of the 32-bit addressable range. This memory is not mapped in the first place, and the current code does not deal with the high bits correctly, resulting in hangs. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.20.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c index 3b3b20aa9b78..bffab83d4fd0 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -744,6 +744,10 @@ ArmSetMemoryAttributes ( UINT64 ChunkLength; BOOLEAN FlushTlbs; + if (BaseAddress > (UINT64)MAX_ADDRESS - Length + 1) { + return EFI_UNSUPPORTED; + } + if (Length == 0) { return EFI_SUCCESS; }