From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AFSGD/Uo32/DlY6NMIvBjhfHdZeTHJkFvQNvT+SdjPSCwP60Fk/lDbnVbZ4vN0ec3fJrNMcyNnzVdg== 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: [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: , X-List-Received-Date: Mon, 07 Jan 2019 06:56:54 -0000 Content-Transfer-Encoding: 8bit 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(+) 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; } -- 2.20.1