virt: tdx-guest: Just leak decrypted memory on unrecoverable errorsIn CoCo VMs it is possible for the untrusted host to causeset_memory_decrypted() to fail such that an error is returnedand the r
virt: tdx-guest: Just leak decrypted memory on unrecoverable errorsIn CoCo VMs it is possible for the untrusted host to causeset_memory_decrypted() to fail such that an error is returnedand the resulting memory is shared. Callers need to take careto handle these errors to avoid returning decrypted (shared)memory to the page allocator, which could lead to functionalor security issues.Leak the decrypted memory when set_memory_decrypted() fails,and don't need to print an error since set_memory_decrypted()will call WARN_ONCE().Fixes: f4738f56d1dc ("virt: tdx-guest: Add Quote generation support using TSM_REPORTS")Signed-off-by: Li RongQing <[email protected]>Signed-off-by: Dave Hansen <[email protected]>Signed-off-by: Ingo Molnar <[email protected]>Reviewed-by: Rick Edgecombe <[email protected]>Reviewed-by: Kirill A. Shutemov <[email protected]>Cc: [email protected]Link: https://lore.kernel.org/all/20240619111801.25630-1-lirongqing%40baidu.com
show more ...
[tree-wide] finally take no_llseek outno_llseek had been defined to NULL two years ago, in commit 868941b14441("fs: remove no_llseek")To quote that commit, At -rc1 we'll need do a mechanical
[tree-wide] finally take no_llseek outno_llseek had been defined to NULL two years ago, in commit 868941b14441("fs: remove no_llseek")To quote that commit, At -rc1 we'll need do a mechanical removal of no_llseek - git grep -l -w no_llseek | grep -v porting.rst | while read i; do sed -i '/\<no_llseek\>/d' $i done would do it.Unfortunately, that hadn't been done. Linus, could you do that now, sothat we could finally put that thing to rest? All instances are of theform .llseek = no_llseek,so it's obviously safe.Signed-off-by: Al Viro <[email protected]>Signed-off-by: Linus Torvalds <[email protected]>
x86/sev: Take advantage of configfs visibility support in TSMThe TSM attestation report support provides multiple configfs attributetypes (both for standard and binary attributes) to allow for add
x86/sev: Take advantage of configfs visibility support in TSMThe TSM attestation report support provides multiple configfs attributetypes (both for standard and binary attributes) to allow for additionalattributes to be displayed for SNP as compared to TDX. With the abilityto hide attributes via configfs, consolidate the multiple attribute groupsinto a single standard attribute group and a single binary attributegroup. Modify the TDX support to hide the attributes that were previously"hidden" as a result of registering the selective attribute groups.Co-developed-by: Dan Williams <[email protected]>Signed-off-by: Dan Williams <[email protected]>Signed-off-by: Tom Lendacky <[email protected]>Signed-off-by: Borislav Petkov (AMD) <[email protected]>Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]>Link: https://lore.kernel.org/r/8873c45d0c8abc35aaf01d7833a55788a6905727.1717600736.git.thomas.lendacky@amd.com
virt: tdx-guest: Add Quote generation support using TSM_REPORTSIn TDX guest, the attestation process is used to verify the TDX guesttrustworthiness to other entities before provisioning secrets to
virt: tdx-guest: Add Quote generation support using TSM_REPORTSIn TDX guest, the attestation process is used to verify the TDX guesttrustworthiness to other entities before provisioning secrets to theguest. The first step in the attestation process is TDREPORTgeneration, which involves getting the guest measurement data in theformat of TDREPORT, which is further used to validate the authenticityof the TDX guest. TDREPORT by design is integrity-protected and canonly be verified on the local machine.To support remote verification of the TDREPORT in a SGX-basedattestation, the TDREPORT needs to be sent to the SGX Quoting Enclave(QE) to convert it to a remotely verifiable Quote. SGX QE by design canonly run outside of the TDX guest (i.e. in a host process or in anormal VM) and guest can use communication channels like vsock orTCP/IP to send the TDREPORT to the QE. But for security concerns, theTDX guest may not support these communication channels. To handle suchcases, TDX defines a GetQuote hypercall which can be used by the guestto request the host VMM to communicate with the SGX QE. More detailsabout GetQuote hypercall can be found in TDX Guest-Host CommunicationInterface (GHCI) for Intel TDX 1.0, section titled"TDG.VP.VMCALL<GetQuote>".Trusted Security Module (TSM) [1] exposes a common ABI for ConfidentialComputing Guest platforms to get the measurement data via ConfigFS.Extend the TSM framework and add support to allow an attestation agentto get the TDX Quote data (included usage example below). report=/sys/kernel/config/tsm/report/report0 mkdir $report dd if=/dev/urandom bs=64 count=1 > $report/inblob hexdump -C $report/outblob rmdir $reportGetQuote TDVMCALL requires TD guest pass a 4K aligned shared bufferwith TDREPORT data as input, which is further used by the VMM to copythe TD Quote result after successful Quote generation. To create theshared buffer, allocate a large enough memory and mark it shared usingset_memory_decrypted() in tdx_guest_init(). This buffer will be re-usedfor GetQuote requests in the TDX TSM handler.Although this method reserves a fixed chunk of memory for GetQuoterequests, such one time allocation can help avoid memory fragmentationrelated allocation failures later in the uptime of the guest.Since the Quote generation process is not time-critical or frequentlyused, the current version uses a polling model for Quote requests andit also does not support parallel GetQuote requests.Link: https://lore.kernel.org/lkml/169342399185.3934343.3035845348326944519.stgit@dwillia2-xfh.jf.intel.com/ [1]Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]>Reviewed-by: Erdem Aktas <[email protected]>Tested-by: Kuppuswamy Sathyanarayanan <[email protected]>Tested-by: Peter Gonda <[email protected]>Reviewed-by: Tom Lendacky <[email protected]>Signed-off-by: Dan Williams <[email protected]>
virt: Add TDX guest driverTDX guest driver exposes IOCTL interfaces to service TDX guestuser-specific requests. Currently, it is only used to allow the user toget the TDREPORT to support TDX atte
virt: Add TDX guest driverTDX guest driver exposes IOCTL interfaces to service TDX guestuser-specific requests. Currently, it is only used to allow the user toget the TDREPORT to support TDX attestation.Details about the TDX attestation process are documented inDocumentation/x86/tdx.rst, and the IOCTL details are documented inDocumentation/virt/coco/tdx-guest.rst.Operations like getting TDREPORT involves sending a blob of data asinput and getting another blob of data as output. It was consideredto use a sysfs interface for this, but it doesn't fit well into thestandard sysfs model for configuring values. It would be possible todo read/write on files, but it would need multiple file descriptors,which would be somewhat messy. IOCTLs seem to be the best fittingand simplest model for this use case. The AMD sev-guest driver alsouses the IOCTL interface to support attestation.[Bagas Sanjaya: Ack is for documentation portion]Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]>Signed-off-by: Dave Hansen <[email protected]>Reviewed-by: Bagas Sanjaya <[email protected]>Reviewed-by: Tony Luck <[email protected]>Reviewed-by: Mika Westerberg <[email protected]>Acked-by: Kai Huang <[email protected]>Acked-by: Kirill A. Shutemov <[email protected]>Acked-by: Wander Lairson Costa <[email protected]>Link: https://lore.kernel.org/all/20221116223820.819090-3-sathyanarayanan.kuppuswamy%40linux.intel.com