public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Stefan Berger" <stefanb@linux.ibm.com>
To: devel@edk2.groups.io, jiewen.yao@intel.com,
	Gerd Hoffmann <kraxel@redhat.com>
Cc: "marcandre.lureau@redhat.com" <marcandre.lureau@redhat.com>,
	"Wang, Jian J" <jian.j.wang@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 3/4] OvmfPkg: Enable physical presence interface for TPM 1.2
Date: Mon, 8 Nov 2021 15:53:47 -0500	[thread overview]
Message-ID: <f19118d4-34ba-240e-71ff-17ab3903d500@linux.ibm.com> (raw)
In-Reply-To: <16B59953A0045591.32008@groups.io>


On 11/8/21 09:43, Stefan Berger wrote:
> On 11/8/21 07:13, Yao, Jiewen wrote:
>
>> The PPFlag variable MUST to be locked to prevent malicious modification.
>> Otherwise, anyone can change the PP configuration without 
>> confirmation from end user.
>
> That change by an attacker could presumably only  be done via UEFI 
> shell/command line? How do I display the variables? I tried with 
> 'dmpstore PhysicalPresenceFlags' (TPM 1.2) or 'dumpstore 
> Tcg2PhysicalPresenceFlags' but I don't see them. I don't see them with 
> 'dmpstore -b', either, but I see them both on Linux in 
> /sys/firmware/efi/efivars.
>
> Under Linux I can remove the (Tcg2)PhysicalPresenceFlags after 'chattr 
> -i' on the file and then an 'rm'. Is it a concern for this particular 
> variable if root can do this?
>
> Since this is old/outdated, what is a new API for it?
>
>    Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, 
> NULL, (VOID **)&VariableLockProtocol);
>    if (!EFI_ERROR (Status)) {
>      Status = VariableLockProtocol->RequestToLock (
>
> Thanks.
>
It seems that the following makes this a read-only variable for root on 
Linux as well. It doesn't make it appear with 'dmpstrore -b'. Is this 
now the correct solution?


diff --git a/SecurityPkg/Library/AuthVariableLib/AuthServiceInternal.h 
b/SecurityPkg/Library/AuthVariableLib/AuthServiceInternal.h
index 2bec637f75..fc2abdb96c 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthServiceInternal.h
+++ b/SecurityPkg/Library/AuthVariableLib/AuthServiceInternal.h
@@ -30,6 +30,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent

  #include <Guid/AuthenticatedVariableFormat.h>
  #include <Guid/ImageAuthentication.h>
+#include <Guid/PhysicalPresenceData.h>

  #define TWO_BYTE_ENCODE       0x82

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c 
b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c
index 122b3b0bf4..888977efa7 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c
@@ -89,6 +89,17 @@ VARIABLE_ENTRY_PROPERTY mAuthVarEntry[] = {
        MAX_UINTN
      }
    },
+  {
+    &gEfiPhysicalPresenceGuid,
+    PHYSICAL_PRESENCE_FLAGS_VARIABLE,
+    {
+      VAR_CHECK_VARIABLE_PROPERTY_REVISION,
+      VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY,
+      VARIABLE_ATTRIBUTE_NV_BS,
+      sizeof (EFI_PHYSICAL_PRESENCE_FLAGS),
+      MAX_UINTN
+    }
+  }
  };

  VOID **mAuthVarAddressPointer[9];
diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf 
b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
index 8eadeebceb..d0ced0792c 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
+++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
@@ -75,6 +75,10 @@
    ## PRODUCES            ## Variable:L"certdbv"
    gEfiCertDbGuid

+  ## CONSUMES            ## Variable:L"PhysicalPresenceFlags"
+  ## PRODUCES            ## Variable:L"PhysicalPresenceFlags"
+  gEfiPhysicalPresenceGuid
+
    ## CONSUMES            ## Variable:L"VendorKeysNv"
    ## PRODUCES            ## Variable:L"VendorKeysNv"
    gEfiVendorKeysNvGuid


    Stefan


  parent reply	other threads:[~2021-11-08 20:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 15:49 [PATCH v2 0/4] Add support for TPM 1.2 Physical Presence Interface and Menu Stefan Berger
2021-11-02 15:49 ` [PATCH v2 1/4] SecurityPkg: Store physical presence code by submitting to PreOS func Stefan Berger
2021-11-02 15:49 ` [PATCH v2 2/4] OvmfPkg: Copy TPM 1.2 DxeTcgPhysicalPresenceLib.c from SecuityPkg Stefan Berger
2021-11-02 15:49 ` [PATCH v2 3/4] OvmfPkg: Enable physical presence interface for TPM 1.2 Stefan Berger
2021-11-05 12:17   ` Gerd Hoffmann
2021-11-07  1:19     ` [edk2-devel] " Stefan Berger
2021-11-08 11:57       ` Gerd Hoffmann
2021-11-08 12:13         ` Yao, Jiewen
2021-11-08 14:43           ` Stefan Berger
     [not found]           ` <16B59953A0045591.32008@groups.io>
2021-11-08 20:53             ` Stefan Berger [this message]
2021-11-02 15:49 ` [PATCH v2 4/4] OvmfPkg: add TPM 1.2 config menu Stefan Berger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f19118d4-34ba-240e-71ff-17ab3903d500@linux.ibm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox