<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/crypto/ccp, branch v7.1.7</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1.7</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1.7'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-07-24T14:19:24+00:00</updated>
<entry>
<title>crypto: ccp/tsm - Enable the root port after the endpoint</title>
<updated>2026-07-24T14:19:24+00:00</updated>
<author>
<name>Alexey Kardashevskiy</name>
<email>aik@amd.com</email>
</author>
<published>2026-05-21T07:43:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6945ad6db8d939c668f50e8ba2af24e50bcc4fe7'/>
<id>urn:sha1:6945ad6db8d939c668f50e8ba2af24e50bcc4fe7</id>
<content type='text'>
[ Upstream commit 50e506201bab875545c7a9443bd7e1c71804e553 ]

The PCIe r7.0, chapter "6.33.8 Other IDE Rules" mandates if selective IDE
is enabled for config requersts, a stream must be enabled on the endpoint
before enabling it on the rootport:

===
For Selective IDE, the Stream must not be used until it has been enabled in
both Partner Ports. For cases where one of the Partner Ports is a Root Port
and Selective IDE for Configuration Requests is enabled, the other
Partner Port must be enabled prior to the Root Port. For other scenarios,
the mechanisms to satisfy this requirement are implementation-specific.
===

Do what the spec says.

Fixes: 4be423572da1 ("crypto/ccp: Implement SEV-TIO PCIe IDE (phase1)")
Signed-off-by: Alexey Kardashevskiy &lt;aik@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp/sev-dev-tsm - bail out early when pdev-&gt;bus is NULL</title>
<updated>2026-07-24T14:19:13+00:00</updated>
<author>
<name>Stepan Ionichev</name>
<email>sozdayvek@gmail.com</email>
</author>
<published>2026-05-07T14:06:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6bafd740095fb3d0e9a00540bc8f3484c38e6f85'/>
<id>urn:sha1:6bafd740095fb3d0e9a00540bc8f3484c38e6f85</id>
<content type='text'>
[ Upstream commit 930d9d36ea618a775985446a125aedeb401db522 ]

dsm_create() initially checks pdev-&gt;bus when computing segment_id:

	u8 segment_id = pdev-&gt;bus ? pci_domain_nr(pdev-&gt;bus) : 0;

But the next two lines unconditionally dereference pdev-&gt;bus via
pcie_find_root_port() and especially pci_dev_id(pdev), which expands
to PCI_DEVID(dev-&gt;bus-&gt;number, dev-&gt;devfn). If pdev-&gt;bus is in fact
NULL, segment_id is initialised to 0 but the very next statement
crashes the kernel.

smatch flags this:

  drivers/crypto/ccp/sev-dev-tsm.c:253 dsm_create() error: we
    previously assumed 'pdev-&gt;bus' could be null (see line 251)

Make the NULL handling consistent: if pdev-&gt;bus is NULL the device
has no PCI context to work with and SEV TIO setup cannot proceed,
so return -ENODEV before any of the bus-dependent lookups. The
remaining initialisation now runs only on the path where pdev-&gt;bus
is known to be valid.

No change for callers where pdev-&gt;bus is non-NULL, which is the
only case where dsm_create() did meaningful work before this change.

Fixes: 4be423572da1 ("crypto/ccp: Implement SEV-TIO PCIe IDE (phase1)")
Signed-off-by: Stepan Ionichev &lt;sozdayvek@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp - Treat zero-length cert chain as query for blob lengths</title>
<updated>2026-07-24T14:19:13+00:00</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2026-05-04T22:28:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d88071a6ce091272726bedda26c105b85b23705f'/>
<id>urn:sha1:d88071a6ce091272726bedda26c105b85b23705f</id>
<content type='text'>
[ Upstream commit ef8c9dacda2871accd64e3eda951fef6b788b1ea ]

When handling a PDH export, treat a zero-length userspace cert chain buffer
as a request to query the length of the relevant blobs.  Failure to account
for the zero-length buffer trips a BUG_ON() when running with
CONFIG_DEBUG_VIRTUAL=y due to trying to get the physical address of the
ZERO_SIZE_PTR (returned by kzalloc() on the bogus allocation).

   kernel BUG at arch/x86/mm/physaddr.c:28 !
  Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
  CPU: 30 UID: 0 PID: 28580 Comm: syz.2.18 Kdump: loaded
  Tainted: G        W           6.18.16-smp-DEV #1 NONE
  Tainted: [W]=WARN
  Hardware name: Google, Inc. Arcadia_IT_80/Arcadia_IT_80, BIOS 12.62.0-0 11/19/2025
   RIP: 0010:__phys_addr+0x16a/0x180 arch/x86/mm/physaddr.c:28
  RSP: 0018:ffffc9008329fc80 EFLAGS: 00010293
  RAX: ffffffff8179110a RBX: 0000778000000010 RCX: ffff8884e6992600
  RDX: 0000000000000000 RSI: 0000000080000010 RDI: 0000778000000010
  RBP: ffffc9008329fdf0 R08: 0000000000000dc0 R09: 00000000ffffffff
  R10: dffffc0000000000 R11: fffffbfff126d297 R12: dffffc0000000000
  R13: 1ffff92010653fc8 R14: 0000000080000010 R15: dffffc0000000000
  FS:  0000555556bec9c0(0000) GS:ffff88aa4ce1c000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00007fd3159e7000 CR3: 00000004fbc44000 CR4: 0000000000350ef0
  Call Trace:
   &lt;TASK&gt;
    [&lt;ffffffff853d3869&gt;] sev_ioctl_do_pdh_export+0x559/0x7a0 drivers/crypto/ccp/sev-dev.c:2308
    [&lt;ffffffff853d1fdd&gt;] sev_ioctl+0x2cd/0x480 drivers/crypto/ccp/sev-dev.c:2556
    [&lt;ffffffff82549ebc&gt;] vfs_ioctl fs/ioctl.c:52 [inline]
    [&lt;ffffffff82549ebc&gt;] __do_sys_ioctl fs/ioctl.c:598 [inline]
    [&lt;ffffffff82549ebc&gt;] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
    [&lt;ffffffff8630115f&gt;] do_syscall_x64 arch/x86/entry/syscall_64.c:64 [inline]
    [&lt;ffffffff8630115f&gt;] do_syscall_64+0x9f/0xf40 arch/x86/entry/syscall_64.c:98
   [&lt;ffffffff81000136&gt;] entry_SYSCALL_64_after_hwframe+0x76/0x7e
  RIP: 0033:0x7fd3158eac39
   &lt;/TASK&gt;

Thankfully, the bug is benign outside of CONFIG_DEBUG_VIRTUAL=y as getting
the physical address is just arithmetic, and the PSP errors out before
trying to write to the garbage address (which it must, otherwise querying
the blob lengths would clobber memory at pfn=0).

Fixes: 76a2b524a4b1 ("crypto: ccp: Implement SEV_PDH_CERT_EXPORT ioctl command")
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Reviewed-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp - Initialize data during __sev_snp_init_locked()</title>
<updated>2026-07-24T14:19:10+00:00</updated>
<author>
<name>Tycho Andersen (AMD)</name>
<email>tycho@kernel.org</email>
</author>
<published>2026-04-08T14:32:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9aeea4317696dc34304a58248d7f4d5912bec4dd'/>
<id>urn:sha1:9aeea4317696dc34304a58248d7f4d5912bec4dd</id>
<content type='text'>
[ Upstream commit fed613c1230277105bb512bce6e1fda8f316d178 ]

Sashiko notes:

&gt; is the stack variable data left uninitialized when taking the else branch?
&gt; Since data.tio_en is later evaluated unconditionally, could stack garbage
&gt; cause it to evaluate to true, leading to erroneous attempts to allocate
&gt; pages and initialize SEV-TIO on unsupported hardware?

If the firmware is too old to support SEV_INIT_EX, data is left
uninitialized but used in the debug logging about whether TIO is enabled or
not.

Fixes: 4be423572da1 ("crypto/ccp: Implement SEV-TIO PCIe IDE (phase1)")
Reported-by: Sashiko
Assisted-by: Gemini:gemini-3.1-pro-preview
Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
Signed-off-by: Tycho Andersen (AMD) &lt;tycho@kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp - Check for page allocation failure correctly in TIO</title>
<updated>2026-07-24T14:19:10+00:00</updated>
<author>
<name>Tycho Andersen (AMD)</name>
<email>tycho@kernel.org</email>
</author>
<published>2026-04-08T14:32:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=17e1aae19a06d9f6da4b46d54fa2aeab77ec0c69'/>
<id>urn:sha1:17e1aae19a06d9f6da4b46d54fa2aeab77ec0c69</id>
<content type='text'>
[ Upstream commit a8d5370eef00eca132a292b1901c9914c817e385 ]

Sashiko notes:

&gt; if __snp_alloc_firmware_pages() returns NULL under memory pressure, is it
&gt; safe to pass it directly to page_address()?
&gt;
&gt; On architectures without HASHED_PAGE_VIRTUAL, page_address(NULL) might
&gt; compute a deterministic but invalid, non-zero virtual address. The
&gt; subsequent if (tio_status) check would then evaluate to true, and
&gt; sev_tsm_init_locked() would dereference the invalid pointer.

Indeed, page_address(NULL) will return non-NULL garbage here. Fix this by
checking the page allocation itself for NULL, not the resulting virtual
address.

Fixes: 4be423572da1 ("crypto/ccp: Implement SEV-TIO PCIe IDE (phase1)")
Reported-by: Sashiko
Assisted-by: Gemini:gemini-3.1-pro-preview
Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
Signed-off-by: Tycho Andersen (AMD) &lt;tycho@kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp - Fix snp_filter_reserved_mem_regions() off-by-one</title>
<updated>2026-07-24T14:19:10+00:00</updated>
<author>
<name>Tycho Andersen (AMD)</name>
<email>tycho@kernel.org</email>
</author>
<published>2026-04-08T14:32:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=af7341616b742ad2c374a90998bd650a035f694d'/>
<id>urn:sha1:af7341616b742ad2c374a90998bd650a035f694d</id>
<content type='text'>
[ Upstream commit 1b864b6cb213bbd7b406e9b2e98c962077f300df ]

Sashiko notes:

&gt; regarding the bounds check in snp_filter_reserved_mem_regions()
&gt; called via walk_iomem_res_desc(): does the check
&gt; if ((range_list-&gt;num_elements * 16 + 8) &gt; PAGE_SIZE)
&gt; allow an off-by-one heap buffer overflow?
&gt;
&gt; If range_list-&gt;num_elements is 255, 255 * 16 + 8 = 4088, which is &lt;= 4096.
&gt; Writing range-&gt;base (8 bytes) fills 4088-4095, but writing range-&gt;page_count
&gt; (4 bytes) would write to 4096-4099, overflowing the kzalloc-allocated
&gt; PAGE_SIZE buffer.

Fix this by accounting for the entry about to be written to, in addition to
the entries that are already allocated.

Fixes: 1ca5614b84ee ("crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP")
Reported-by: Sashiko
Assisted-by: Gemini:gemini-3.1-pro-preview
Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
Signed-off-by: Tycho Andersen (AMD) &lt;tycho@kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp - Reverse the cleanup order in psp_dev_destroy()</title>
<updated>2026-07-24T14:19:10+00:00</updated>
<author>
<name>Tycho Andersen (AMD)</name>
<email>tycho@kernel.org</email>
</author>
<published>2026-04-08T14:32:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d0c7bc211499cc429b01688c0ed7ba21035c9d6f'/>
<id>urn:sha1:d0c7bc211499cc429b01688c0ed7ba21035c9d6f</id>
<content type='text'>
[ Upstream commit 4a76a164ba1617f60d1c8a2fd754466c9d9e48e9 ]

Before SNP x86 shutdown [1], all HV_FIXED pages were always leaked on
module unload. Now pages can be reclaimed if they are freed before SNP
shutdown.

The SFS driver does sfs_dev_destroy() -&gt; snp_free_hv_fixed_pages(), marking
the command buffer as free. But this happens after sev_dev_destroy() in
psp_dev_destroy(), so the pages are always leaked.

Rearrange psp_dev_destroy() to destroy things in the reverse order from
psp_init(), so that any dependencies can be unwound accordingly. This lets
SFS free the page and the subsequent SNP shutdown release it.

This was identified with use of Chris Mason's review-prompts:
https://github.com/masoncl/review-prompts

[1]: https://lore.kernel.org/all/20260324161301.1353976-1-tycho@kernel.org/

Fixes: 648dbccc03a0 ("crypto: ccp - Add AMD Seamless Firmware Servicing (SFS) driver")
Reported-by: review-prompts
Assisted-by: Claude:claude-4.6-opus
Suggested-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Tycho Andersen (AMD) &lt;tycho@kernel.org&gt;
Reviewed-by: Ashish Kalra &lt;ashish.kalra@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp - Do not initialize SNP for ioctl(SNP_CONFIG)</title>
<updated>2026-07-18T14:55:41+00:00</updated>
<author>
<name>Tycho Andersen (AMD)</name>
<email>tycho@kernel.org</email>
</author>
<published>2026-05-04T16:51:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=20f548cdac94860a164e5ebba4f7e4a01051cb06'/>
<id>urn:sha1:20f548cdac94860a164e5ebba4f7e4a01051cb06</id>
<content type='text'>
commit 08f0e65e784c4b20e6e620dd4f68d8636073a3d2 upstream.

Sashiko notes:

&gt; if SEV initialization fails and KVM is actively running normal VMs, could a
&gt; userspace process trigger this code path via /dev/sev ioctls (e.g.,
&gt; SEV_PDH_GEN) and zero out MSR_VM_HSAVE_PA globally? Would the next VMRUN
&gt; execution for an active VM trigger a general protection fault and crash the
&gt; host?

Refuse to re-try initialization if SNP is not already initialized for
SNP_CONFIG.

This is technically an ABI break: before if SNP initialization failed it
could be transparently retriggered by this ioctl, and if no VMs were
running, everything worked fine. Hopefully this is enough of a corner case
that nobody will notice, but someone does, there are a few options:

* do something like symbol_get() for kvm and refuse to initialize if KVM is
  loaded
* check each cpu's HSAVE_PA for non-zero data before re-initializing
* once initialization has failed, continue to refuse to initialize until
  the ccp module is unloaded

Fixes: ceac7fb89e8d ("crypto: ccp - Ensure implicit SEV/SNP init and shutdown in ioctls")
Reported-by: Sashiko
Assisted-by: Gemini:gemini-3.1-pro-preview
Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
CC: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Tycho Andersen (AMD) &lt;tycho@kernel.org&gt;
Reviewed-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp - Do not initialize SNP for ioctl(SNP_VLEK_LOAD)</title>
<updated>2026-07-18T14:55:41+00:00</updated>
<author>
<name>Tycho Andersen (AMD)</name>
<email>tycho@kernel.org</email>
</author>
<published>2026-05-04T16:51:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8836801847b9479ac046cb18a24981e1b0b05e9d'/>
<id>urn:sha1:8836801847b9479ac046cb18a24981e1b0b05e9d</id>
<content type='text'>
commit f91e9dbb5845d1e5abf1028e6df57dcf61583e1b upstream.

Sashiko notes:

&gt; if SEV initialization fails and KVM is actively running normal VMs, could a
&gt; userspace process trigger this code path via /dev/sev ioctls (e.g.,
&gt; SEV_PDH_GEN) and zero out MSR_VM_HSAVE_PA globally? Would the next VMRUN
&gt; execution for an active VM trigger a general protection fault and crash the
&gt; host?

The SEV firmware docs for SNP_VLEK_LOAD note:

&gt; On SNP_SHUTDOWN, the VLEK is deleted.

That is, the initialization/shutdown wrapper here is pointless, because the
firmware immediately throws away the key anyway. Instead, refuse to do
anything if SNP has not been previously initialized.

This is an ABI break: before, this was a no-op and almost certainly a
mistake by userspace, and now it returns -ENODEV. ABI compatibility could be
maintained here by simply returning 0 in the check instead.

Fixes: ceac7fb89e8d ("crypto: ccp - Ensure implicit SEV/SNP init and shutdown in ioctls")
Reported-by: Sashiko
Assisted-by: Gemini:gemini-3.1-pro-preview
Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
CC: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Tycho Andersen (AMD) &lt;tycho@kernel.org&gt;
Reviewed-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>crypto: ccp - Do not initialize SNP for ioctl(SNP_COMMIT)</title>
<updated>2026-07-18T14:55:41+00:00</updated>
<author>
<name>Tycho Andersen (AMD)</name>
<email>tycho@kernel.org</email>
</author>
<published>2026-05-04T16:51:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=67ed191b4c8bdf432a3f32d1eb302880b4795cd1'/>
<id>urn:sha1:67ed191b4c8bdf432a3f32d1eb302880b4795cd1</id>
<content type='text'>
commit 5a1364da2f04217a36e2fdfa2db4ee025b383a20 upstream.

Sashiko notes:

&gt; if SEV initialization fails and KVM is actively running normal VMs, could a
&gt; userspace process trigger this code path via /dev/sev ioctls (e.g.,
&gt; SEV_PDH_GEN) and zero out MSR_VM_HSAVE_PA globally? Would the next VMRUN
&gt; execution for an active VM trigger a general protection fault and crash the
&gt; host?

The SNP_COMMIT command does not require the firmware to be in any
particular state. Skip initializing it if it was previously uninitialized.

The SEV-SNP firmware specification doc 56860 does not mention SNP_COMMIT in
Table 5 as a command that is allowed in the UNINIT state, but it is in fact
allowed and a future documentation update will reflect that.

Fixes: ceac7fb89e8d ("crypto: ccp - Ensure implicit SEV/SNP init and shutdown in ioctls")
Reported-by: Sashiko
Assisted-by: Gemini:gemini-3.1-pro-preview
Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
CC: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Tycho Andersen (AMD) &lt;tycho@kernel.org&gt;
Reviewed-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
