From: Collin Walling <walling@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
Zhuoying Cai <zycai@linux.ibm.com>,
richard.henderson@linaro.org, david@redhat.com,
pbonzini@redhat.com
Cc: jjherne@linux.ibm.com, jrossi@linux.ibm.com,
fiuczy@linux.ibm.com, pasic@linux.ibm.com,
borntraeger@linux.ibm.com, farman@linux.ibm.com,
iii@linux.ibm.com, qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 25/25] docs/system/s390x: Add secure IPL documentation
Date: Fri, 23 May 2025 16:28:51 -0400 [thread overview]
Message-ID: <c7d791a6-8077-4063-a587-e235e6d84850@linux.ibm.com> (raw)
In-Reply-To: <4e170da7-3ffd-4edb-8695-a3abc9333c75@redhat.com>
On 5/21/25 8:37 AM, Thomas Huth wrote:
> On 09/05/2025 00.50, Zhuoying Cai wrote:
>> Add documentation for secure IPL.
>>
>> Signed-off-by: Collin Walling <walling@linux.ibm.com>
>> Signed-off-by: Zhuoying Cai <zycai@linux.ibm.com>
>> ---
>> docs/system/s390x/secure-ipl.rst | 249 +++++++++++++++++++++++++++++++
>> 1 file changed, 249 insertions(+)
>> create mode 100644 docs/system/s390x/secure-ipl.rst
>>
>> diff --git a/docs/system/s390x/secure-ipl.rst b/docs/system/s390x/secure-ipl.rst
>> new file mode 100644
>> index 0000000000..4f80d7741e
>> --- /dev/null
>> +++ b/docs/system/s390x/secure-ipl.rst
>> @@ -0,0 +1,249 @@
>> +.. SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +s390 Secure IPL
>> +===============
>> +
>> +Secure IPL, also known as secure boot, enables s390-ccw virtual machines to
>> +leverage qcrypto libraries and z/Arch implementations to verify the integrity of
>> +guest kernels. These operations are rely on userspace invocations and QEMU
>> +interpretation.
>
> I don't understand the last sentence. Could you please rephrase it?
It's my poorly worded phrasing to say "userspace and QEMU must work in
tandem to complete the secure IPL operations". Basically encapsulating
the bulleted list below.
"Interpretation" was a poor choice -- should have said "QEMU handling"
or something akin to that. Will revisit when splitting this into specs
and doc.
>
>> The user provides one or more certificates via the command line
>> +options, which populates a certificate store. DIAGNOSE 'X'320' is invoked by
>> +userspace to query cert store info and retrieve specific certificates from QEMU.
>> +DIAGNOSE 'X'508' is used by userspace to leverage qcrypto libraries to perform
>> +signature-verification in QEMU. Lastly, userspace generates and appends an
>> +IPL Information Report Block (IIRB) at the end of the IPL Parameter Block.
>> +
>> +The steps are as follows:
>> +
>> +- Userspace retrieves data payload from disk (e.g. stage3 boot loader, kernel)
>> +- Userspace checks the validity of the SCLAB
>> +- Userspace invokes DIAG 508 subcode 1 and provides it the payload
>> +- QEMU handles DIAG 508 request by reading the payload and retrieving the
>> + certificate store
>> +- QEMU DIAG 508 utilizes qcrypto libraries to perform signature-verification on
>> + the payload, attempting with each cert in the store (until success or
>> + exhausted)
>> +- QEMU DIAG 508 returns:
>> +
>> + - success: index of cert used to verify payload
>> + - failure: error code
>
> So this doc is rather meant as a specification, not as a documentation for
> the end user? In that case it should maybe rather reside in docs/specs/ and
> not in docs/system/s390x.
>
>> +- Userspace responds to this operation:
>> +
>> + - success: retrieves cert from store via DIAG 320 using returned index
>> + - failure: reports with warning (audit mode), aborts with error (secure mode)
>> +
>> +- Userspace appends IIRB at the end of the IPLB
>> +- Userspace kicks off IPL
>> +
>> +
>> +Constraints
>> +-----------
>> +
>> +The following constraints apply when attempting to secure IPL an s390 guest:
>> +
>> +- z16 CPU model
>> +- certificates must be in X.509 DER format
>> +- only sha256 encryption is supported
>> +- only support for SCSI scheme of virtio-blk/virtio-scsi devices
>> +- a boot device must be specified
>> +- any unsupported devices (e.g., ECKD and VFIO) or non-eligible devices (e.g.,
>> + Net) will cause the entire boot process terminating early with an error
>> + logged to the console.
>> +
>> +
>> +s390 Certificate Store
>> +======================
>> +
>> +Secure boot relies on user certificates for signature-verification. Normally,
>> +these certificates would be stored somewhere on the LPAR. Instead, for virtual
>> +guests, a certificate store is implemented within QEMU. This store will read
>> +any certificates provided by the user via command-line, which are expected to
>> +be stored somewhere on the host file system. Once these certificates are
>> +stored, they are ready to be queried/requested by DIAGNOSE 'X'320' or used for
>> +verification by DIAGNOSE 'X'508'.
>> +
>> +The certificate store can be populated by supplying a comma-delimited list of
>> +certificates on the command-line:
>> +
>> +.. code-block:: shell
>> +
>> + qemu-system-s390x -machine s390-ccw-virtio, \
>> + boot-certificates=/.../qemu/certs:/another/path/cert.der
>> +
>> +
>> +DIAGNOSE function code 'X'320' - Certificate Store Facility
>> +-----------------------------------------------------------
>> +
>> +DIAGNOSE 'X'320' is used to provide support to query the certificate store.
>> +
>> +Subcode 0 - query installed subcodes
>> + Returns a 256-bit installed subcodes mask (ISM) stored in the installed
>> + subcodes block (ISB). This mask indicates which sucodes are currently
>> + installed and available for use.
>> +
>> +Subcode 1 - query verification certificate storage information
>> + Provides the information required to determine the amount of memory needed to
>> + store one or more verification-certificates (VCs) from the certificate store (CS).
>> +
>> + Upon successful completion, this subcode returns various storage size values for
>> + verification-certificate blocks (VCBs).
>> +
>> + The output is returned in the verification-certificate-storage-size block (VCSSB).
>> +
>> +Subcode 2 - store verification certificates
>> + Provides VCs that are in the certificate store.
>> +
>> + The output is provided in a VCB, which includes a common header followed by zero
>> + or more verification-certificate entries (VCEs).
>> +
>> + The first-VC index and last-VC index fields of VCB specify the range of VCs
>> + to be stored by subcode 2. Stored count and remained count fields specify the
>> + number of VCs stored and could not be stored in the VCB due to insufficient
>> + storage specified in the VCB input length field.
>> +
>> + VCE contains various information of a VC from the CS.
>> +
>> +
>> +IPL Modes
>> +=========
>> +
>> +Different IPL modes may be toggled with the following command line option:
>> +
>> +.. code-block:: shell
>> +
>> + qemu-system-s390x -machine s390-ccw-virtio,secure-boot=on|off
>> +
>> +Additionally, the provision of certificates affect the mode.
>> +
>> +
>> +Normal Mode
>> +-----------
>> +
>> +The absence of both certificates and the ``secure-boot`` option will attempt to
>> +IPL a guest without secure IPL operations. No checks are performed, and no
>> +warnings/errors are reported. This is the default mode, and can be explicitly
>> +enabled with ``secure-boot=off``.
>> +
>> +
>> +Audit Mode
>> +----------
>> +
>> +With *only* the presence of certificates in the store, it is assumed that secure
>> +boot operations should be performed with errors reported as warnings. As such,
>> +the secure IPL operations will be performed, and any errors that stem from these
>> +operations will report a warning via the SCLP console.
>> +
>> +
>> +Secure Mode
>> +-----------
>> +
>> +With *both* the presence of certificates in the store and the ``secure-boot=on``
>> +option, it is understood that secure boot should be performed with errors
>> +reported and boot will abort.
>> +
>> +
>> +Secure IPL Functions
>> +====================
>> +
>> +IPL Information Report Block
>> +----------------------------
>> +
>> +The IPL Parameter Block (IPLPB), utilized for IPL operation, is extended with an
>> +IPL Information Report Block (IIRB), which contains the results from secure IPL
>> +operations such as:
>> +
>> +* component data
>> +* verification results
>> +* certificate data
>> +
>> +
>> +Secure Code Loading Attributes Facility
>> +---------------------------------
>> +
>> +Secure Code Loading Attributes Facility (SCLAF) provides additional security during IPL.
>> +
>> +When SCLAF is available, its behavior depends on the IPL Modes.
>> +
>> +* secure mode: IPL will terminate on any errors detected by this facility.
>> +* audit mode: IPL may proceed regardless of any errors detected by this facility.
>> +
>> +Errors detected by the SCLAF are reported in IIRB.
>> +
>> +Unsigned components may only be loaded at absolute storage address x’2000’ or higher.
>> +
>> +Signed components must include a Secure Code Loading Attribute Block (SCLAB),
>> +which is located at the very end of the signed component.
>> +
>> +**Secure Code Loading Attribute Block (SCLAB)**
>> +
>> +The SCLAB is located at the end of each signed component. It defines the code loading
>> +attributes for the component and may:
>> +
>> +* Provide direction on how to process the rest of the component.
>> +
>> +* Provide further validation of information on where to load the signed binary code
>> + from the load device.
>> +
>> +* Specify where to start the execution of the loaded OS code.
>> +
>> +
>> +DIAGNOSE function code 'X'508' - KVM IPL extensions
>> +---------------------------------------------------
>> +
>> +DIAGNOSE 'X'508' is reserved for KVM guest use in order to facilitate
>> +communication of additional IPL operations that cannot be handled by userspace,
>> +such as signature verification for secure IPL.
>> +
>> +If the function code specifies 0x508, KVM IPL extension functions are performed.
>> +These functions are meant to provide extended functionality for s390 guest boot
>> +that requires assistance from QEMU.
>> +
>> +Subcode 0 - query installed subcodes
>> + Returns a 64-bit mask indicating which subcodes are supported.
>> +
>> +Subcode 1 - perform signature verification
>> + Used to perform signature-verification on a signed component, leveraging
>> + qcrypto libraries to perform this operation and pulling from the certificate
>> + store.
>> +
>> +
>> +Secure IPL Quickstart
>> +=====================
>> +
>> +Build QEMU with gnutls enabled:
>> +
>> +.. code-block:: shell
>> +
>> + ./configure … --enable-gnutls
>> +
>> +Generate certificate (e.g. via openssl):
>> +
>> +.. code-block:: shell
>> +
>> + openssl req -new -x509 -newkey rsa:2048 -keyout mykey.priv \
>> + -outform DER -out mycert.der -days 36500 \
>> + -subj "/CN=My Name/" -nodes
>> +
>> +Sign Images (e.g. via sign-file):
>> +
>> +- signing must be performed on a KVM guest filesystem
>> +- sign-file script used in the example below is located within the kernel source
>> + repo
>> +
>> +.. code-block:: shell
>> +
>> + ./sign-file sha256 mykey.priv mycert.der /boot/vmlinuz-…
>> + ./sign-file sha256 mykey.priv mycert.der /usr/lib/s390-tools/stage3.bin
>> +
>> +Run zipl with secure boot enabled
>> +
>> +.. code-block:: shell
>> +
>> + zipl --secure 1 -V
>> +
>> +Start Guest with Cmd Options:
>> +
>> +.. code-block:: shell
>> +
>> + qemu-system-s390x -machine s390-ccw-virtio,secure-boot=on,boot-certificates=mycert.der ...
>
> So that quickstart section looks like it could be useful for the end user?
> Maybe you could split your doc up into two part, one going into
> docs/system/s390x/ for the normal users, and one going into docs/specs/ as
> technical reference for the developers?
>
> Thomas
>
>
Sure. So, for the specs we can include the following sections:
- s390 Secure IPL
- s390 Certificate Store (description)
- DIAG 320 and 508
- Secure IPL Functions (and all sub sections)
For the docs:
- Constraints
- s390 Certificate Store (command line), probably rename this section
- IPL Modes
- Quickstart
--
Regards,
Collin
prev parent reply other threads:[~2025-05-23 20:29 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 22:50 [PATCH v2 00/25] Secure IPL Support for SCSI Scheme of virtio-blk/virtio-scsi Devices Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 01/25] Add -boot-certificates to s390-ccw-virtio machine type option Zhuoying Cai
2025-05-13 14:58 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 02/25] hw/s390x/ipl: Create certificate store Zhuoying Cai
2025-05-14 5:43 ` Thomas Huth
2025-05-29 18:49 ` Zhuoying Cai
2025-05-14 9:03 ` Daniel P. Berrangé
2025-05-29 17:51 ` Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 03/25] s390x: Guest support for Certificate Store Facility (CS) Zhuoying Cai
2025-05-14 6:11 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 04/25] s390x/diag: Introduce DIAG 320 for certificate store facility Zhuoying Cai
2025-05-14 8:17 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 05/25] s390x/diag: Refactor address validation check from diag308_parm_check Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 06/25] s390x/diag: Implement DIAG 320 subcode 1 Zhuoying Cai
2025-05-14 15:32 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 07/25] s390x/diag: Implement DIAG 320 subcode 2 Zhuoying Cai
2025-05-14 16:18 ` Thomas Huth
2025-05-29 19:09 ` Zhuoying Cai
2025-05-30 6:38 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 08/25] s390x/diag: Introduce DIAG 508 for secure IPL operations Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 09/25] s390x/diag: Implement DIAG 508 subcode 1 for signature verification Zhuoying Cai
2025-05-20 6:11 ` Thomas Huth
2025-05-20 8:16 ` Daniel P. Berrangé
2025-05-08 22:50 ` [PATCH v2 10/25] pc-bios/s390-ccw: Introduce IPL Information Report Block (IIRB) Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 11/25] pc-bios/s390-ccw: Define memory for IPLB and convert IPLB to pointers Zhuoying Cai
2025-05-20 9:24 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 12/25] hw/s390x/ipl: Add IPIB flags to IPL Parameter Block Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 13/25] hw/s390x/ipl: Set iplb->len to maximum length of " Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 14/25] s390x: Guest support for Secure-IPL Facility Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 15/25] pc-bios/s390-ccw: Refactor zipl_run() Zhuoying Cai
2025-05-20 9:29 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 16/25] pc-bios/s390-ccw: Refactor zipl_load_segment function Zhuoying Cai
2025-05-20 9:39 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 17/25] pc-bios/s390-ccw: Add signature verification for secure IPL in audit mode Zhuoying Cai
2025-05-20 10:25 ` Thomas Huth
2025-05-29 19:28 ` Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 18/25] s390x: Guest support for Secure-IPL Code Loading Attributes Facility (SCLAF) Zhuoying Cai
2025-05-26 14:46 ` Hendrik Brueckner
2025-05-08 22:50 ` [PATCH v2 19/25] pc-bios/s390-ccw: Add additional security checks for secure boot Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 20/25] Add -secure-boot to s390-ccw-virtio machine type option Zhuoying Cai
2025-05-21 12:14 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 21/25] hw/s390x/ipl: Set IPIB flags for secure IPL Zhuoying Cai
2025-05-21 12:20 ` Thomas Huth
2025-05-08 22:50 ` [PATCH v2 22/25] pc-bios/s390-ccw: Handle true secure IPL mode Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 23/25] pc-bios/s390-ccw: Handle secure boot with multiple boot devices Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 24/25] hw/s390x/ipl: Handle secure boot without specifying a boot device Zhuoying Cai
2025-05-08 22:50 ` [PATCH v2 25/25] docs/system/s390x: Add secure IPL documentation Zhuoying Cai
2025-05-21 12:37 ` Thomas Huth
2025-05-23 20:28 ` Collin Walling [this message]
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-all 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=c7d791a6-8077-4063-a587-e235e6d84850@linux.ibm.com \
--to=walling@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=farman@linux.ibm.com \
--cc=fiuczy@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=jrossi@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=zycai@linux.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).