git: 9fa05aec8459 - stable/15 - em(4): fix capability bounds needed to access checksum context.

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 08:05:10 UTC
The branch stable/15 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=9fa05aec84599786e159934deadd553fda8e2272

commit 9fa05aec84599786e159934deadd553fda8e2272
Author:     Ruslan Bukin <br@FreeBSD.org>
AuthorDate: 2025-11-25 09:16:39 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 08:02:02 +0000

    em(4): fix capability bounds needed to access checksum context.
    
    Ensure the offp capability bounds cover entire struct with checksum fields.
    
    This is needed for CHERI systems to avoid bounds violation trap, as
    otherwise offp allowed to dereference 4 bytes of csum_flags field only
    so bzero failed.
    
    Tested on ARM Morello.
    
    Reviewed by:    kbowling
    Discussed with: jrtc27
    Sponsored by:   CHERI Research Centre
    Differential Revision:  https://reviews.freebsd.org/D53903
    
    (cherry picked from commit 64ee9c166ce5e807e575d205ac2e15cc5cf6581b)
---
 sys/dev/e1000/if_em.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index bfcb8d808344..7829bd7a2f64 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -5119,7 +5119,7 @@ em_initialize_transmit_unit(if_ctx_t ctx)
 		bus_addr = txr->tx_paddr;
 
 		/* Clear checksum offload context. */
-		offp = (caddr_t)&txr->csum_flags;
+		offp = (caddr_t)txr + offsetof(struct tx_ring, csum_flags);
 		endp = (caddr_t)(txr + 1);
 		memset(offp, 0, endp - offp);