Re: [PATCH v11 3/5] s390/zcrypt: Improve EP11 CPRB length and overflow checks
Holger Dengler <[email protected]> Mon, 3 Aug 2026 17:03:10 +0200
| Newsgroups | org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
On 8/3/26 10:33, Harald Freudenberger wrote:
> The xcrb_msg_to_type6_ep11cprb_msgx() function lacks proper input
> validation, creating security vulnerabilities:
> 1. Missing minimum size validation: The ep11_cprb structure and
> subsequent payload fields (pld_tag, pld_lenfmt) are copied from
> userspace without verifying sufficient buffer length.
> 2. Arithmetic overflow in length calculations: CEIL4 alignment could
> overflow, bypassing size checks and enabling buffer overflows.
> 3. The payload is asn1 encoded but the function just uses a simple c
> struct overlay to access some fields of the payload.
>
> Fix by using size_t for length calculations, adding U32_MAX boundary
> checks after alignment, and validating minimum request size and
> minimum reply size before copying from userspace. Do a very simple
> asn1 parsing of the payload up to the function value field.
>
> Fixes: e2c6d91eb8b1 ("s390/zcrypt: Rework domain processing within zcrypt device driver")
> Signed-off-by: Harald Freudenberger <[email protected]>
> Cc: [email protected] # 7.1+
Reviewed-by: Holger Dengler <[email protected]>
--
Mit freundlichen Grüßen / Kind regards
Holger Dengler