[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/4] docs: Introduce live patch signing


  • To: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 12 May 2025 14:19:07 +0200
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 12 May 2025 12:19:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.05.2025 18:18, Ross Lagerwall wrote:
> --- a/docs/misc/livepatch.pandoc
> +++ b/docs/misc/livepatch.pandoc
> @@ -917,6 +917,58 @@ The normal sequence of events is to:
>   3. *XEN_SYSCTL_LIVEPATCH_ACTION* with *LIVEPATCH_ACTION_APPLY* to apply the 
> patch.
>   4. *XEN_SYSCTL_LIVEPATCH_GET* to check the `->rc`. If in *-XEN_EAGAIN* 
> spin. If zero exit with success.
>  
> +## Signature Checking
> +
> +While loading live patches would generally be restricted to a privileged
> +process in dom0, in certain cases signature checking in Xen may be required.
> +For example, when Secure Boot is enabled live patches need to be verified
> +before being loaded.
> +
> +Xen live patches are ELF binaries but there is no standardized mechanism for
> +signing ELF binaries. One approach used by Linux is to append a signature to
> +the end of the binary, outside of the ELF container. While this works, it 
> tends
> +to be fragile since tools that handle ELF binaries do not correctly handle 
> the
> +signature. Instead, the approach taken here is to use an ELF note for the
> +signature.
> +
> +The ELF note section name shall be `.note.Xen.signature` with note name `Xen`
> +and type `0`.
> +
> +The note data shall contain a header followed by the signature data:
> +
> +    #define SIGNATURE_SUPPORTED_VERION 1

I don't think this is a good name (leaving aside the typo); conceptually
multiple versions could be supported. Otoh live patches are hypervisor
build specific anyway, so it's hard to see why a version would be needed
in the first place. Alternatively should version or ...

> +    #define SIGNATURE_ALGORITHM_RSA 0
> +    #define SIGNATURE_HASH_SHA256 0

... these two be encoded in the note's type, instead of leaving that
effectively unused?

> +    struct payload_signature {
> +        uint16_t version;
> +        uint8_t algo;        /* Public-key crypto algorithm */
> +        uint8_t hash;        /* Digest algorithm */
> +        uint32_t sig_len;    /* Length of signature data */

Should there be a minimum length specified, to ensure security at least
for the moment (before e.g. quantum computers can break things)?

> +    };
> +
> +To sign a live patch:
> +
> +1) Add a new note section with a populated payload signature and zeroed out
> +   signature.
> +2) Generate a detached signature over the entire binary.
> +3) Fill in the signature in the note section.
> +
> +During live patch load, Xen shall verify the signature using the following
> +steps:
> +
> +1) Copy the signature out of the note section.
> +2) Zero the signature.
> +3) Generate a detached signature over the entire binary.
> +4) Compare against the signature from (1).
> +
> +Initially, to avoid including DER / X.509 parsing of certificates, handling
> +chains, etc. Xen shall verify signatures against a compiled in RSA key in
> +exponent/modulus form.

And this is sufficient to satisfy (Microsoft's?) requirements?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.