From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mx.groups.io with SMTP id smtpd.web10.14227.1678296266733052494 for ; Wed, 08 Mar 2023 09:24:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@taylorbeebe.com header.s=google header.b=fQgPCvkV; spf=pass (domain: taylorbeebe.com, ip: 209.85.216.54, mailfrom: t@taylorbeebe.com) Received: by mail-pj1-f54.google.com with SMTP id qa18-20020a17090b4fd200b0023750b675f5so3131908pjb.3 for ; Wed, 08 Mar 2023 09:24:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taylorbeebe.com; s=google; t=1678296266; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=55mi3JVsFF0pRkQpO9KvmVwLHVFMQLWc5jwkuRFFGLs=; b=fQgPCvkV0Ie3covlJvfxgYd9KgMgvcWuBwGrZ1Jqp0y12bQnKG8w3Le74K/a7j5/QR 8k+o/6o/AQpYHeMCQUTj2XblBzSzW/g8xtA5kZu1rmoaHjtxaJSZLGFVmYrULU5OKxLo vq98+acfyvLHsn1h9N2VZEbcTbK/47mMf+DRbwzjVNhKQEmoYqnmoNiUxG2mLw02vqs8 UDlpjq0FVcfQQpiqPr3yIUPTG1Mk6koDsPttzVHOTXrlvPJ2Pw7KQaUvJ8OZf2XK4PsH oqzBwXzFihBJgZTByuaSKRoZC1ACxTbTk/0gqPC6qaMG+Ea+o9Q2Z8Cj/kLFRjFx1xiT Ea/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678296266; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=55mi3JVsFF0pRkQpO9KvmVwLHVFMQLWc5jwkuRFFGLs=; b=PUaLCElU7WxbrAslZp4dQnpueOgjRzdQxjcNvwgCOqNF9psumN/wix+JUyRzertjWA yAVeIEarfR1Qvcqk5+abtGucP/AKb0mfn7ZyE645BaR7XNr9oJAm3hBP65WOkNwLvIP2 xp5xWyoHFa4SpYMdRTFCFgc4v7HnnD3W+oO7uSNL7jItpfrZGduKhJzEhzchweUZG4w8 tg7Xh1ZDFfRbja8j3/VxLVHouSi3rSsweESgF/5+h1tSnJZ2XxCWsWq3/m8ri8vkUrRi nmVzE/arlTZmJxOr4GVk4OQl1Vd3yQl62daKcIDKAkhxe42RAtl0saq54D9wGZey7BBR eukA== X-Gm-Message-State: AO0yUKWZgW0vUS4iDXUSlXe1SyPwOX+reJB8Fjrd952p5lwnIvep2bvh NxLLm9RDqiZJv05mjhzJFRlYRA== X-Google-Smtp-Source: AK7set/1+5f0uxHy1iWClS6iZI6gAjt0EI6mYcjFrJTPSYVhhohzfRqhfFdesIui4hIsD9SxhwA/0g== X-Received: by 2002:a17:902:e884:b0:19e:845d:d898 with SMTP id w4-20020a170902e88400b0019e845dd898mr20677454plg.14.1678296265992; Wed, 08 Mar 2023 09:24:25 -0800 (PST) Return-Path: Received: from [192.168.50.162] ([50.46.230.135]) by smtp.gmail.com with ESMTPSA id kl15-20020a170903074f00b0019945535973sm10119723plb.63.2023.03.08.09.24.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Mar 2023 09:24:25 -0800 (PST) Message-ID: Date: Wed, 8 Mar 2023 09:24:25 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v4 00/11] ArmPkg: implement EFI memory attributes protocol To: Ard Biesheuvel Cc: devel@edk2.groups.io, Michael Kinney , Liming Gao , Jiewen Yao , Michael Kubacki , Sean Brogan , Rebecca Cran , Leif Lindholm , Sami Mujawar References: <20230209135936.789983-1-ardb@kernel.org> <5af401fe-d5f9-15ef-d021-b998395554e7@taylorbeebe.com> From: "Taylor Beebe" In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit My mistake - the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED feature is why FreePagesWithProtectionAttributesTestCase might fail. To make the clear memory feature more compatible with the memory attribute protocol, can you add a check to DebugClearMemoryEnabled() on free and clear EFI_MEMORY_RP and EFI_MEMORY_RO if they're set? -Taylor On 3/1/2023 1:57 PM, Ard Biesheuvel wrote: > On Wed, 1 Mar 2023 at 21:43, Taylor Beebe wrote: >> >> >> >> On 2/11/2023 2:05 AM, Ard Biesheuvel wrote: >>> On Sat, 11 Feb 2023 at 01:56, Taylor Beebe wrote: >>>> >>>> Hey Ard, >>>> >>>> Once the Memory Attribute Protocol is made available, Windows will have >>>> some expectations about its functionality. Can you run this test app >>>> created by me and Jiewen to ensure it meets the Windows requirements? >>>> Part of the test needed an AARCH64 implementation which I just added - >>>> let me know if it doesn't work. >>>> >>> >>> Thanks, this is rather helpful. >>> >>> There appears to be an issue related to >>> DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED so I had to disable that to >>> run these tests, as otherwise, the DXE core tries to clear freed pages >>> before restoring the memory attributes. >>> >>> With that out of the way, the only test that fails is 'New >>> EfiLoaderCode buffer attributes expected' because this firmware build >>> maps loader code RWX, as existing boot stages for Linux are relying on >>> this (including the kernel itself at this point) >> >> It makes sense that the NewEfiLoaderCode test fails, but I am surprised >> the FreePagesWithProtectionAttributesTestCase passes. The test ensures >> that a page with EFI_MEMORY_RP and/or EFI_MEMORY_RO has those attributes >> cleared before attempting to free the page within the FreePage routine >> and is related to the concern Marvin had. >> >> Did you make a change to the core or is there an execution path I'm not >> seeing which allows that test to pass? > > No, I didn't make any additional changes to the core afair.