From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mx.groups.io with SMTP id smtpd.web10.31151.1684263876879457981 for ; Tue, 16 May 2023 12:04:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20221208 header.b=cQC0PMY2; spf=pass (domain: gmail.com, ip: 209.85.210.180, mailfrom: kuqin12@gmail.com) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-64a9335a8e7so7992031b3a.0 for ; Tue, 16 May 2023 12:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684263876; x=1686855876; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Xr/lwvT3PGTyiwGpJTTh8BguSbkM76/ZIYWu7DaiBig=; b=cQC0PMY2muAODjHeVLuB19iQw4p9iNJ0e1WVkCRQyx++Hel2zwUoCw6+drazu/TOgY mRk05ydxg1roPz54wxwO9PmDULHPaHsDocOFhtCeE7whceKKQt0u2SniVQ0oRchupSzc AapSGthgsmrjYB7/Mwdj8ELmzLHVjh2QtPbwKpNZTD7HpqYEojUbUmgQsGV+d0FSp1j8 Bsscf2vdBDLxW3JCFwXx7mzZloEvaFn34zAet1nBDMlQ1eP9l8uFTLPukeZgcsA6GCmc gPdE1QxOn2+N8eXRfshf2sYNBnbT/gJ1+qlrwz7/KOnqqPrTwcqlsZZilBxJTnDwGa1m kEFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684263876; x=1686855876; h=content-transfer-encoding:in-reply-to:content-language:from :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=Xr/lwvT3PGTyiwGpJTTh8BguSbkM76/ZIYWu7DaiBig=; b=RRV129A2YZzHt27K9Fg3HKJ8sPWATnWBIt8TmqyN3G439xXtesoi2LCOwLUTiknakn S8M3J3QReiN3EKmCANXzd+8rUJPmMSxqm91054Gk+fgRZrfstPsVfmetIwtDL8HiJRbw CidBQEq6xQ0uIwTzks2GDo7sUslqwg53I6+NvAIyKfh6PoDB98aAvWOEA8P+XcgdG6lc 88768E7NKtME2L692Sxy2nuCPo4HGZfu7xTKQ0y5DvzVuHDrT0LNYKmeLWTuRkvvBXC4 +dJxDb+UckAAfHX7jlChltkyS2EUI/06YacIQufGjXA40jbcGmshWUIsEQI84h5lgw9p v6+w== X-Gm-Message-State: AC+VfDwQkpH7PRwLqwt9VeKR0eUM+Yp5WF1ejBvnwYxLQE78XwCJVn0g U62/NeNh+0sHiBEXZ39KmHdlOFT2uPs= X-Google-Smtp-Source: ACHHUZ5qjj531fh5cTYBp/GpYzhTGQSmQ4DWOe7d4Z9Digo6MBbwKTRPDSf75B4XBDvSvsalZlZnug== X-Received: by 2002:a17:902:e805:b0:1ac:820e:c34a with SMTP id u5-20020a170902e80500b001ac820ec34amr34453536plg.0.1684263875987; Tue, 16 May 2023 12:04:35 -0700 (PDT) Return-Path: Received: from ?IPV6:2001:4898:d8:33:bdc3:cb2:9bb3:dffa? ([2001:4898:80e8:9:3ddd:cb2:9bb3:dffa]) by smtp.gmail.com with ESMTPSA id s18-20020a170902a51200b0019aaab3f9d7sm9987911plq.113.2023.05.16.12.04.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 May 2023 12:04:35 -0700 (PDT) Message-ID: <8bd4677e-21e8-c2f6-24ed-b480ca974927@gmail.com> Date: Tue, 16 May 2023 12:04:34 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [edk2-devel] [Patch V4 04/15] MdeModulePkg: Remove RO and NX protection when unset guard page To: devel@edk2.groups.io, dun.tan@intel.com Cc: Liming Gao , Ray Ni , Jian J Wang References: <20230516095932.1525-1-dun.tan@intel.com> <20230516095932.1525-5-dun.tan@intel.com> From: "Kun Qin" In-Reply-To: <20230516095932.1525-5-dun.tan@intel.com> Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Dun, I might have missed the context, but could you please explain why we need to clear "EFI_MEMORY_XP"? It is understandable that you would like to clear RO. But would it make more sense to clear XP only when needed (i.e. code page allocation)? Thanks, Kun On 5/16/2023 2:59 AM, duntan wrote: > Remove RO and NX protection when unset guard page. > When UnsetGuardPage(), remove all the memory attribute protection > for guarded page. > > Signed-off-by: Dun Tan > Cc: Liming Gao > Cc: Ray Ni > Cc: Jian J Wang > --- > MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c > index 8f3bab6fee..7daeeccf13 100644 > --- a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c > +++ b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c > @@ -553,7 +553,7 @@ UnsetGuardPage ( > mSmmMemoryAttribute, > BaseAddress, > EFI_PAGE_SIZE, > - EFI_MEMORY_RP > + EFI_MEMORY_RP|EFI_MEMORY_RO|EFI_MEMORY_XP > ); > ASSERT_EFI_ERROR (Status); > mOnGuarding = FALSE;