Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/arch/m68k/m68k Pull up following revision(s) (request...



details:   https://anonhg.NetBSD.org/src/rev/9898b1302830
branches:  netbsd-9
changeset: 372995:9898b1302830
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jan 07 14:57:55 2023 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1564):

        sys/arch/m68k/m68k/bus_dma.c: revision 1.39

Fix out of bounds invalidate (and writeback) in bus_dmamap_sync(9) ops.

Detected by the POOL_REDZONE check in sys/kern/subr_pool.c that
has been activated if options DIAGNOSTIC is enabled on post netbsd-9.

The extra invalidate on DMASYNC_PREREAD op discards redzone pattern
data allocated right after an mbuf cluster without proper writeback
to memory so that it triggers false redzone assertions on freeing mbufs.

This bug was my botch in rev 1.25 committed 15 years ago. (sigh)

Fixes PR/57107 (kernel panic on -current when configuring network
with sn(4) on mac68k), as actually the bus_dma(9) op changes
in the past days were introduced for mac68k sn(4) improvements
by using the MI SONIC (src/sys/dev/ic/dp83932.c) driver.

https://mail-index.netbsd.org/port-mac68k/2007/06/01/0001.html

diffstat:

 sys/arch/m68k/m68k/bus_dma.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 9cf878a3fcf3 -r 9898b1302830 sys/arch/m68k/m68k/bus_dma.c
--- a/sys/arch/m68k/m68k/bus_dma.c      Fri Jan 06 13:47:36 2023 +0000
+++ b/sys/arch/m68k/m68k/bus_dma.c      Sat Jan 07 14:57:55 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.35 2013/10/25 09:46:10 martin Exp $ */
+/* $NetBSD: bus_dma.c,v 1.35.34.1 2023/01/07 14:57:55 martin Exp $ */
 
 /*
  * This file was taken from from alpha/common/bus_dma.c
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2013/10/25 09:46:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35.34.1 2023/01/07 14:57:55 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -490,7 +490,8 @@
                        }
 
                        /* flush cachelines per 128bytes */
-                       while ((p < e) && (p & PAGE_MASK) != 0) {
+                       while ((p + CACHELINE_SIZE * 8 <= e) &&
+                           (p & PAGE_MASK) != 0) {
                                DCFL(p);
                                p += CACHELINE_SIZE;
                                DCFL(p);
@@ -566,7 +567,8 @@
                        }
 
                        /* purge cachelines per 128bytes */
-                       while ((p < e) && (p & PAGE_MASK) != 0) {
+                       while ((p + CACHELINE_SIZE * 8 <= e) &&
+                           (p & PAGE_MASK) != 0) {
                                DCPL(p);
                                p += CACHELINE_SIZE;
                                DCPL(p);



Home | Main Index | Thread Index | Old Index