From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web12.55656.1583759771337265425 for ; Mon, 09 Mar 2020 06:16:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=vocf/ahs; spf=pass (domain: nuviainc.com, ip: 209.85.221.67, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f67.google.com with SMTP id p2so10261349wrw.7 for ; Mon, 09 Mar 2020 06:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=x/oTV/oQimL7mqMm5hF2B0kPNDubalSX8lqqZW2M+oY=; b=vocf/ahsGYD3Qp2x2+fH7AdpSn9BS17JmK0/SyQvSnqLd7erN2e7QwrMW9tGWXq4Zw P3yXQGuRlXRIruTSPF067azzu7Ezz7y7XnvIRYwJf7aTs13kw/8HU/++nLXkjtERN137 XsHLvrwwr7615lt2zybthN+Yv89HTrI3GZ0340em3OZXWBzztRrZrIPUTiAxJMZrbDUN Jggg97udXdYAycJcYFMLFF+eFON/KMICuaiAsHYp5noZIXb4uqbVRbeqGGo2iDpge7eV yo2/fWWuYLp2zguwm0kv+TDAb4f63rm/EDj9ZJSZFDLvJB66pa9j70ojQ16FReMGi1nS RCKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=x/oTV/oQimL7mqMm5hF2B0kPNDubalSX8lqqZW2M+oY=; b=VlolaYeXPjzmhgbLwRjbhbPPvGfWjm1bzCTyKq06cfEF/hIyScR1Qllgn3/hiUg69G Oo4bAub9b/TLMlEOHkpbQpWa7woco6WdbV2tsBbpQ7w+c6NnnanqGRH8aEzlVVdRggN1 CM/vtZR2MeJRQ6xarJFBxahaekRdC1AgY4wGnIZ7lDmyU4ufXCi0O+iMbeAYb0Ca1g3S FbuN+yJtr+C0AI7E00EJkbYvnpXm92c41CgVSrpV1LK0yUx6xd60Z/2lunP4Q93NbFy3 jpUPRRrNjUOS8rURCH7s1uw6AD0JV3QYZe/m05r8lU1seJNtdd8X2QXwSUhtI161YYqQ +W9Q== X-Gm-Message-State: ANhLgQ3X3QyyURxbGnk1QRF6p0m0fNLH8qt5V6nlFOGEDJMTlRldOgFX OjaqNk1el3OHI/818fhoHcj2JA== X-Google-Smtp-Source: ADFU+vvHXoShqXiUvC+DYGVwP4lu2lWZZIuz4FscTnGZ1EuWWZrDJyf06dycGTY6Hu/etQiDwLRo4Q== X-Received: by 2002:a5d:4ecb:: with SMTP id s11mr21376198wrv.83.1583759769897; Mon, 09 Mar 2020 06:16:09 -0700 (PDT) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id c72sm19604234wme.35.2020.03.09.06.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 06:16:09 -0700 (PDT) Date: Mon, 9 Mar 2020 13:16:07 +0000 From: "Leif Lindholm" To: Ard Biesheuvel Cc: devel@edk2.groups.io Subject: Re: [PATCH 0/2] ArmPkg/ArmMmuLib AARCH64: correctness fix Message-ID: <20200309131607.GS23627@bivouac.eciton.net> References: <20200307133415.18857-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20200307133415.18857-1-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Mar 07, 2020 at 14:34:13 +0100, Ard Biesheuvel wrote: > Last one, I promise :-) > > The new ArmMmuLib code is easier to reason about, so that is what I did: > currently, when we create mappings that cover existing table entries, we > may end up overwriting those with block entries without taking the mapping > attributes of the original table entries into account. So let's fix this. > > I honestly don't know whether the original code was better at dealing with > this: I do remember some changes from Heyi that may have been related, but > the old code is not easy to follow. In any case, I didn't manage to hit this > case in practice, given that we typically start out with large mappings, and > break them down later (to set permissions), rather than the other way around. > > Patch #1 adds some helpers to hide the insane way the type bits change > meaning when you change to level 3. > > Patch #2 ensures that we only replace (and free) table entries with block > entries if it is guaranteed that doing so will not lose any attribute > information. For the series: Reviewed-by: Leif Lindholm Thanks! > Ard Biesheuvel (2): > ArmPkg/ArmMmuLib AARCH64: use helpers to determine table entry types > ArmPkg/ArmMmuLib AARCH64: preserve attributes when replacing a table > entry > > .../Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 61 ++++++++++++++++--- > 1 file changed, 54 insertions(+), 7 deletions(-) > > -- > 2.17.1 >