From: sashiko-bot@kernel.org
To: "Dave Jiang" <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v6 05/13] ACPI: extlog: Avoid populating software AER metadata from raw hardware buffer
Date: Fri, 04 Sep 2026 17:58:40 +0000 [thread overview]
Message-ID: <20260904175840.E84881F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904172337.1409775-6-dave.jiang@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch truncates Flit mode TLP logs by strictly copying only 16 bytes of the prefix log and deliberately leaving `flit` and `header_len` as zero.
--
commit a79ba2cb1ba02ad8827d582fce99b0fe70c8796e
Author: Dave Jiang <dave.jiang@intel.com>
ACPI: extlog: Avoid populating software AER metadata from raw hardware buffer
This commit fixes an issue in extlog_print_pcie() where casting the hardware
aer_info buffer directly to struct aer_capability_regs could fill software-only
metadata fields (header_len and flit) with raw firmware bytes. It introduces a
safer local copy mechanism to populate only the hardware-backed fields while
keeping the rest zeroed.
Closes: https://lore.kernel.org/linux-cxl/20260709165457.8BA181F000E9@smtp.kernel.org/
> diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
> index 2451362e696dc..1b61788abd5a6 100644
> --- a/drivers/acpi/acpi_extlog.c
> +++ b/drivers/acpi/acpi_extlog.c
> @@ -149,7 +149,21 @@ static void extlog_print_pcie(struct cper_sec_pcie *pcie_err,
> return;
>
> aer_severity = cper_severity_to_aer(severity);
> - aer = (struct aer_capability_regs *)pcie_err->aer_info;
> +
> + /*
> + * struct pcie_tlp_log is larger than the hardware layout, so aer_info
> + * only maps onto the struct up to the four Header Log DWORDs. Copy that
> + * much, then place the TLP Prefix Log from where the hardware keeps it.
> + * Everything else stays zero: nothing reads root_command, root_status or
> + * the error source IDs, and header_len and flit are software-only.
> + */
> + memcpy(&aer_regs, pcie_err->aer_info,
> + offsetof(struct aer_capability_regs, header_log) +
> + PCIE_STD_NUM_TLP_HEADERLOG * sizeof(u32));
> + memcpy(aer_regs.header_log.prefix,
> + pcie_err->aer_info + PCI_ERR_PREFIX_LOG,
> + sizeof(aer_regs.header_log.prefix));
[Severity: Medium]
Does this strict 16-byte copy truncate the TLP Prefix Log in Flit mode?
By hardcoding sizeof(aer_regs.header_log.prefix) (16 bytes) and deliberately
leaving the software metadata fields 'flit' and 'header_len' as zero, this
appears to drop up to 24 bytes (6 DWORDs) of the Flit mode extended TLP header
from the hardware buffer.
If a PCIe error occurs in Flit mode, the error would be printed as if it were a
non-Flit mode error, leading to incomplete diagnostic information in dmesg.
Should this logic account for Flit mode to ensure the entire extended header
data is accurately copied?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260904172337.1409775-1-dave.jiang@intel.com?part=5
next prev parent reply other threads:[~2026-09-04 17:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 17:23 [PATCH v6 00/13] ACPI: APEI: GHES: Collection of fixes for issues reported by sashiko Dave Jiang
2026-09-04 17:23 ` [PATCH v6 01/13] efi/cper: Reject CPER records with an out-of-range error_data_length Dave Jiang
2026-09-04 17:39 ` sashiko-bot
2026-09-04 17:23 ` [PATCH v6 02/13] efi/cper: Reject an error status block length that wraps a u32 Dave Jiang
2026-09-04 17:38 ` sashiko-bot
2026-09-04 17:23 ` [PATCH v6 03/13] ACPI: extlog: Validate elog record length before walking sections Dave Jiang
2026-09-04 17:40 ` sashiko-bot
2026-09-04 17:23 ` [PATCH v6 04/13] ACPI: extlog: Defer CXL protocol error handling to avoid lock inversion Dave Jiang
2026-09-04 17:23 ` [PATCH v6 05/13] ACPI: extlog: Avoid populating software AER metadata from raw hardware buffer Dave Jiang
2026-09-04 17:58 ` sashiko-bot [this message]
2026-09-04 17:23 ` [PATCH v6 06/13] ACPI: extlog: Validate PCIe error section length before payload access Dave Jiang
2026-09-04 17:23 ` [PATCH v6 07/13] ACPI: extlog: Fix CONFIG_ACPI_APEI_PCIEAER guard typo Dave Jiang
2026-09-04 17:23 ` [PATCH v6 08/13] ACPI: APEI: GHES: Bound CXL event record copy to the firmware section length Dave Jiang
2026-09-04 17:23 ` [PATCH v6 09/13] ACPI: APEI: GHES: Validate CXL protocol error section length before RAS cap copy Dave Jiang
2026-09-04 18:05 ` sashiko-bot
2026-09-04 17:23 ` [PATCH v6 10/13] efi/cper: Read only validated fields in cper_mem_err_pack() Dave Jiang
2026-09-04 18:09 ` sashiko-bot
2026-09-04 17:23 ` [PATCH v6 11/13] ACPI: APEI: GHES: Validate memory error section length before payload access Dave Jiang
2026-09-04 18:12 ` sashiko-bot
2026-09-04 17:23 ` [PATCH v6 12/13] ACPI: APEI: GHES: Bound AER info copy and sanitize software metadata Dave Jiang
2026-09-04 18:08 ` sashiko-bot
2026-09-04 17:23 ` [PATCH v6 13/13] cxl/ras: Make cxl_cper_handle_prot_err() static Dave Jiang
2026-09-04 18:16 ` sashiko-bot
2026-09-04 18:21 ` [PATCH v6 00/13] ACPI: APEI: GHES: Collection of fixes for issues reported by sashiko Rafael J. Wysocki (Intel)
2026-09-04 19:44 ` Dave Jiang
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=20260904175840.E84881F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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