Re: [PATCH 2/3] mailbox: pcc: Check shared memory signature on request

From: Alexey Klimov

Date: Mon Jul 20 2026 - 11:05:39 EST


On Fri Jul 17, 2026 at 8:56 AM BST, Sudeep Holla wrote:
> ACPI 6.6 Tables 14.9 and 14.12 define the PCC shared memory
> signature as the bitwise OR of 0x50434300 and the PCC subspace ID.
> They also clarify that the signature is populated by the platform and
> verified by OSPM. The signature is at byte offset 0 in the generic,
> extended and reduced PCC shared memory layouts.
>
> Check the signature when a client requests a PCC mailbox channel,
> after mapping shared memory and before binding the mailbox client.
> This keeps the check in the PCC mailbox controller instead of
> duplicating it in individual clients.
>
> Treat a signature mismatch as a warning rather than rejecting the
> channel request. Making this newly added check fatal could break
> existing systems whose firmware did not populate the signature
> correctly even though PCC communication works. Continue to reject
> shared memory that is too small to contain a signature because it
> cannot be inspected safely.
>
> Cc: Jassi Brar <jassisinghbrar@xxxxxxxxx>
> Cc: Huisong Li <lihuisong@xxxxxxxxxx>
> Signed-off-by: Sudeep Holla <sudeep.holla@xxxxxxxxxx>
> ---
> drivers/mailbox/pcc.c | 36 +++++++++++++++++++++++++++++++-----

[..]

> +static int pcc_mbox_validate_signature(struct pcc_mbox_chan *pcc_mchan,
> + int subspace_id)
> +{
> + u32 expected_signature = PCC_SIGNATURE | subspace_id;
> + u32 signature;
> +
> + if (pcc_mchan->shmem_size < sizeof(signature)) {
> + pr_err("PCC subspace %d shared memory is too small\n",
> + subspace_id);
> + return -EINVAL;
> + }
> +
> + signature = ioread32(pcc_mchan->shmem);
> + if (signature != expected_signature)
> + pr_warn("PCC subspace %d invalid signature %#x expected %#x\n",
> + subspace_id, signature, expected_signature);

IIRC signature comes from table, so I'd even add smth like
"Potentially broken firmware: PCC subspace %d invalid signature %#x expected %#x\n"
or "PCC subspace %d invalid signature %#x expected %#x, broken firmware\n" or
similar to encourage reader/consumer of the message to report bugs to
firmware provider :)
Maybe it will be even fixed.

Anyhow, regardless of above:

Reviewed-by: Alexey Klimov <alexey.klimov@xxxxxxxxxx>

Best regards,
Alexey