Commit Graph

7 Commits

Author SHA1 Message Date
David Brazdil
eb262a9628 BACKPORT: misc: open-dice: Add driver to expose DICE data to userspace
Open Profile for DICE is an open protocol for measured boot compatible
with the Trusted Computing Group's Device Identifier Composition
Engine (DICE) specification. The generated Compound Device Identifier
(CDI) certificates represent the hardware/software combination measured
by DICE, and can be used for remote attestation and sealing.

Add a driver that exposes reserved memory regions populated by firmware
with DICE CDIs and exposes them to userspace via a character device.

Userspace obtains the memory region's size from read() and calls mmap()
to create a mapping of the memory region in its address space. The
mapping is not allowed to be write+shared, giving userspace a guarantee
that the data were not overwritten by another process.

Userspace can also call write(), which triggers a wipe of the DICE data
by the driver. Because both the kernel and userspace mappings use
write-combine semantics, all clients observe the memory as zeroed after
the syscall has returned.

Cc: Andrew Scull <ascull@google.com>
Cc: Will Deacon <will@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Brazdil <dbrazdil@google.com>
Link: https://lore.kernel.org/r/20220126231237.529308-3-dbrazdil@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f396ededbd8bf5911d588b683a3ce335844b7c89)
[willdeacon@: Fix trivial context conflict in drivers/misc/Makefile]
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 198197082
Bug: 233587962
Change-Id: I3b4809aab98bd0ff96d1a27ab645708d8803999b
2022-08-04 13:03:53 +00:00
Will Deacon
3a47c1e2eb Revert "BACKPORT: FROMLIST: misc: open-dice: Add driver to expose DICE data to userspace"
This reverts commit 3251a051a2.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I3a7d2aecc2dc96b7a48d03d0644b4dec850759c8
2022-08-04 13:03:53 +00:00
Will Deacon
c55ad1ad28 Revert "Revert "BACKPORT: FROMLIST: misc: open-dice: Add driver to expose DICE data to userspace""
This reverts commit 7a02bab109.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Iec2c188b95647908577cab2415c4e87c58651788
2022-08-04 13:03:53 +00:00
Will Deacon
1563deffce Revert "BACKPORT: FROMLIST: misc: open-dice: Add driver to expose DICE data to userspace"
This reverts commit 784db42db8.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Id740b1c0b995fc9c69f57a3017c189ebf1e6c7ca
2022-08-04 13:03:53 +00:00
David Brazdil
784db42db8 BACKPORT: FROMLIST: misc: open-dice: Add driver to expose DICE data to userspace
Open Profile for DICE is an open protocol for measured boot compatible
with the Trusted Computing Group's Device Identifier Composition
Engine (DICE) specification. The generated Compound Device Identifier
(CDI) certificates represent the hardware/software combination measured
by DICE, and can be used for remote attestation and sealing.

Add a driver that exposes reserved memory regions populated by firmware
with DICE CDIs and exposes them to userspace via a character device.

Userspace obtains the memory region's size from read() and calls mmap()
to create a mapping of the memory region in its address space. The
mapping is not allowed to be write+shared, giving userspace a guarantee
that the data were not overwritten by another process.

Userspace can also call write(), which triggers a wipe of the DICE data
by the driver. Because both the kernel and userspace mappings use
write-combine semantics, all clients observe the memory as zeroed after
the syscall has returned.

Acked-by: Rob Herring <robh@kernel.org>
Cc: Andrew Scull <ascull@google.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: David Brazdil <dbrazdil@google.com>
Link: https://lore.kernel.org/r/20220126231237.529308-3-dbrazdil@google.com
[dbrazdil@: Fixed context conflicts in reserved_mem_matches[] and Makefile]
Bug: 198197082
Change-Id: Iabd65f4d20036bb452e4103c7722f220c2273c81
(cherry picked from commit 8941930d125c97e7d22fb24eb10b431fad4436f4)
2022-01-27 11:16:29 +00:00
David Brazdil
7a02bab109 Revert "BACKPORT: FROMLIST: misc: open-dice: Add driver to expose DICE data to userspace"
This reverts commit d1109f05c395c2a0401e12f72acb1f976ef94578.
It will be replaced with the latest patch set version from upstream.

Bug: 198197082
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I661f1bc06d336e5eaab9e52affeb273a0ad6fc2f
(cherry picked from commit dbd93393826d11a10594182a33bd5c0b22d5378d)
2022-01-27 11:15:47 +00:00
David Brazdil
3251a051a2 BACKPORT: FROMLIST: misc: open-dice: Add driver to expose DICE data to userspace
Open Profile for DICE is an open protocol for measured boot compatible
with the Trusted Computing Group's Device Identifier Composition
Engine (DICE) specification. The generated Compound Device Identifier
(CDI) certificates represent the hardware/software combination measured
by DICE, and can be used for remote attestation and sealing.

Add a driver that exposes reserved memory regions populated by firmware
with DICE CDIs and exposes them to userspace via a character device.

Userspace obtains the memory region's size from read() and calls mmap()
to create a mapping of the memory region in its address space. The
mapping is not allowed to be write+shared, giving userspace a guarantee
that the data were not overwritten by another process.

Userspace can also call write(), which triggers a wipe of the DICE data
by the driver. Because both the kernel and userspace mappings use
write-combine semantics, all clients observe the memory as zeroed after
the syscall has returned.

Acked-by: Rob Herring <robh@kernel.org>
Cc: Andrew Scull <ascull@google.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: David Brazdil <dbrazdil@google.com>
Link: https://lore.kernel.org/r/20220104100645.1810028-3-dbrazdil@google.com
Bug: 198197082
[willdeacon@: Fixed context conflict in Makefile]
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 209580772
Change-Id: If1160c8cc3a39ea822e089d1b80c837aec8075fa
Signed-off-by: Will Deacon <willdeacon@google.com>
2022-01-14 16:48:50 +00:00