All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernie Huang <phhuang@realtek.com>
To: Robert Beckett <bob.beckett@collabora.com>,
	Ping-Ke Shih <pkshih@realtek.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"Luka Gejak" <luka.gejak@linux.dev>,
	Bitterblue Smith <rtl8821cerfe2@gmail.com>,
	Timlee <timlee@realtek.com>,
	"matthew.leach@collabora.com" <matthew.leach@collabora.com>,
	"kernel@collabora.com" <kernel@collabora.com>
Subject: RE: rtw88: 8822CE passes corrupted A-MSDUs as hw-decrypted, poisoning CCMP replay counter
Date: Mon, 2 Nov 2026 08:33:32 +0000	[thread overview]
Message-ID: <0497033bfcda4a348d18399da1f264ac@realtek.com> (raw)
In-Reply-To: <1a163984687.46e4c9841111898.2085291868591283475@collabora.com>

>  > Bob Beckett <bob.beckett@collabora.com> wrote:
>  > > On Wed, 21 Oct 2026 07:30:58 +0000, Ping-Ke Shih
> <pkshih@realtek.com> wrote:
>  > > > Bob Beckett <bob.beckett@collabora.com> wrote:
>  > > > >
>  > > > > The AP's own PN sequence is consistent before and after the bad
> frame,  > > > > so the corruption happens on the receive side.
>  > > >
>  > > > Maybe this is a hint to make a patch to defer (drop) reporting weird
> packet,  > > > as Luka has fixed 3 of 4 problems.
>  >
>  > I quickly checked the debug patches, which seem not detect if PN sequence
> is  > correct after the bad frame, for example
>  >   seq     PN
>  >    1      101
>  >    2      99999   // bad frame. should be 102.
>  >    3      103     // not detect this
>  >
>  > Or I missed something?
> 
> if pn jumps, rtw_rx_pn_guard returns early before latching pn, so the next
> corrected pn would just be a regular increase and not get dropped.
> 
>  >
>  > > > > 4. For completeness: on these chips can RXBD_IDX or the
>  > > > >    buffer-descriptor RX tag ever be updated before the packet data
> DMA
>  > > > >    has completed, as described for WiFi 7 in rtw89 0bc7d1d4e63c?
>  > > >
>  > > > The RX tag in rtw88 located on memory allocated by
> dma_alloc_coherent(), and  > > > the RX tag must be set after packet data
> MAC completed.
>  >
>  > (fix typo:                          ... data DMA completed.)
>  >
>  > >
>  > > Understood that this is the design intent. My question was whether the
> host can  > > ever observe the tag before the data. dma_alloc_coherent()
> only makes the tag  > > visible to the CPU without cache maintenance; the
> payload is in a separate  > > streaming mapping (a SWIOTLB bounce buffer on
> this platform), so the order in  > > which the host sees them depends on the
> order of the device's PCIe writes.
>  > > Relaxed Ordering is enabled on the 8822CE here (DevCtl RlxdOrd+).
>  > > Does the 8822CE set the RO attribute on RX DMA writes, in particular the
> > > buffer-descriptor/tag update? If it does, the tag write may pass the payload
> > > writes.
>  > >
>  > > We are hoping to test this directly with the next round of tests. the
> rx_debug  > > option re-syncs a suspect buffer 100 us later, so late payload
> writes might  > > show up as changed bytes, and we can repeat the test with
> Relaxed Ordering  > > disabled.
>  >
>  > I'll check the behavior internally and get back to you.
>  >
>  >
>  >
> 

Hi Bob,

Do you mind testing this patch?
Reproduce again with the same ftrace and sniffer logs
By the result we can differentiate which is the case:
(1) AP sends incorrect CCMP header (less likely)
(2) DMA incomplete at some moment, but later the correct data can be retrieved
(3) DMA incomplete, data never recovers

IIUC, our hardware writes payload first then the tag.
The RO attribute is never set in our TLP, so despite the configuration space, PCIE RC shouldn't do reordering.
I am waiting for protocol analyzer to verify this, and will update when I have the result.
If the buffer poisoning somehow changes the timing, and fail becomes not reproducible, please let us know, thanks!

  parent reply	other threads:[~2026-11-02  8:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 19:11 rtw88: 8822CE passes corrupted A-MSDUs as hw-decrypted, poisoning CCMP replay counter Bob Beckett
2026-10-16 22:15 ` Luka Gejak
2026-10-17  8:36   ` Luka Gejak
2026-10-19 12:43   ` Matthew Leach
2026-10-19 16:30     ` Luka Gejak
2026-10-21  7:30 ` Ping-Ke Shih
2026-10-21 19:05   ` Bob Beckett
2026-10-21 19:05     ` [RFC PATCH rtw-next 1/5] wifi: rtw88: do not trust a claimed decryption Bob Beckett
2026-10-21 19:05     ` [RFC PATCH rtw-next 2/5] wifi: rtw88: report and optionally re-verify suspect hw-decrypted frames Bob Beckett
2026-10-21 19:05     ` [RFC PATCH rtw-next 3/5] wifi: rtw88: pci: optional RX buffer poisoning and recheck Bob Beckett
2026-10-21 19:05     ` [RFC PATCH rtw-next 4/5] wifi: rtw88: make the PN guard threshold a test parameter Bob Beckett
2026-10-21 19:05     ` [RFC PATCH rtw-next 5/5] wifi: rtw88: pci: clear CLKREQ/ASPM enables when disable_aspm is set Bob Beckett
2026-10-21 20:50       ` Luka Gejak
2026-10-22  5:39     ` rtw88: 8822CE passes corrupted A-MSDUs as hw-decrypted, poisoning CCMP replay counter Ping-Ke Shih
2026-10-22 12:31       ` Robert Beckett
2026-11-02  8:15         ` Bernie Huang
2026-11-02  8:33         ` Bernie Huang [this message]
2026-11-02  9:27         ` Bernie Huang
2026-11-03 16:25           ` Robert Beckett
2026-10-21 11:32 ` Bitterblue Smith

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=0497033bfcda4a348d18399da1f264ac@realtek.com \
    --to=phhuang@realtek.com \
    --cc=bob.beckett@collabora.com \
    --cc=kernel@collabora.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luka.gejak@linux.dev \
    --cc=matthew.leach@collabora.com \
    --cc=pkshih@realtek.com \
    --cc=rtl8821cerfe2@gmail.com \
    --cc=timlee@realtek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.