CVS commit: xsrc/external/mit/xf86-video-pnozz/dist/src
Module Name:xsrc Committed By: jdc Date: Wed Jun 9 07:25:57 UTC 2021 Modified Files: xsrc/external/mit/xf86-video-pnozz/dist/src: pnozz_exa.c pnozz_regs.h Log Message: Add some acceleration using the P9100 quad and blit commands: - for solid fill (quad) - for pixmap copy (blit) when source and destination pitch are the same To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c cvs rdiff -u -r1.1 -r1.2 \ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_regs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c diff -u xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c:1.3 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c:1.4 --- xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c:1.3 Thu May 27 20:20:43 2021 +++ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c Wed Jun 9 07:25:57 2021 @@ -1,7 +1,6 @@ /* * SBus Weitek P9100 EXA support - */ -/*- + * * Copyright (c) 2021 The NetBSD Foundation, Inc. * All rights reserved. * @@ -79,11 +78,9 @@ static CARD32 PnozzDrawROP[] = { #define waitReady(pPnozz) while((pnozz_read_4(pPnozz, ENGINE_STATUS) & \ (ENGINE_BUSY | BLITTER_BUSY)) !=0 ) -void PnozzInitEngine(PnozzPtr); +/* From pnozz_accel.c */ void pnozz_write_colour(PnozzPtr pPnozz, int reg, CARD32 colour); -extern CARD32 MaxClip, junk; - static void PnozzWaitMarker(ScreenPtr pScreen, int Marker) { @@ -110,8 +107,10 @@ PnozzPrepareCopy waitReady(pPnozz); pnozz_write_4(pPnozz, RASTER_OP, (PnozzCopyROP[alu] & 0xff)); pnozz_write_4(pPnozz, PLANE_MASK, planemask); -pPnozz->srcoff = exaGetPixmapOffset(pSrcPixmap) / pPnozz->width; +pPnozz->srcoff = exaGetPixmapOffset(pSrcPixmap); +if (exaGetPixmapPitch(pSrcPixmap) != exaGetPixmapPitch(pDstPixmap)) + return FALSE; return TRUE; } @@ -130,24 +129,25 @@ PnozzCopy ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); CARD32 src, dst, srcw, dstw; -int doff = exaGetPixmapOffset(pDstPixmap) / pPnozz->width; +int soff = pPnozz->srcoff / exaGetPixmapPitch(pDstPixmap); +int doff = exaGetPixmapOffset(pDstPixmap) / exaGetPixmapPitch(pDstPixmap); src = (((xSrc << pPnozz->depthshift) & 0x1fff) << 16) | - ((ySrc + pPnozz->srcoff) & 0x1fff); + ((ySrc + soff) & 0x1fff); dst = (((xDst << pPnozz->depthshift) & 0x1fff) << 16) | ((yDst + doff) & 0x1fff); -srcw = xSrc + w) << pPnozz->depthshift) - 1) << 16) | -((ySrc + pPnozz->srcoff + h - 1) & 0x1fff); +srcw = xSrc + w) << pPnozz->depthshift) - 1) << 16) | + ((ySrc + soff + h) & 0x1fff); dstw = xDst + w) << pPnozz->depthshift) - 1) << 16) | -((yDst + doff + h - 1) & 0x1fff); + ((yDst + doff + h) & 0x1fff); waitReady(pPnozz); - pnozz_write_4(pPnozz, ABS_XY0, src); pnozz_write_4(pPnozz, ABS_XY1, srcw); pnozz_write_4(pPnozz, ABS_XY2, dst); pnozz_write_4(pPnozz, ABS_XY3, dstw); -junk = pnozz_read_4(pPnozz, COMMAND_BLIT); +pnozz_read_4(pPnozz, COMMAND_BLIT); + exaMarkSync(pDstPixmap->drawable.pScreen); } @@ -172,7 +172,8 @@ PnozzPrepareSolid( waitReady(pPnozz); pnozz_write_colour(pPnozz, FOREGROUND_COLOR, fg); -pnozz_write_4(pPnozz, RASTER_OP, PnozzDrawROP[alu] & 0xff); +pnozz_write_colour(pPnozz, BACKGROUND_COLOR, fg); +pnozz_write_4(pPnozz, RASTER_OP, ROP_PAT); pnozz_write_4(pPnozz, PLANE_MASK, planemask); pnozz_write_4(pPnozz, COORD_INDEX, 0); @@ -189,15 +190,18 @@ PnozzSolid( { ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); -int w = x2 - x - 1; -int h = y2 - y - 1; +int doff = exaGetPixmapOffset(pPixmap); waitReady(pPnozz); -pnozz_write_4(pPnozz, RECT_RTW_XY, ((x & 0x1fff) << 16) | -(y & 0x1fff)); -pnozz_write_4(pPnozz, RECT_RTP_XY, (((w & 0x1fff) << 16) | -(h & 0x1fff))); -junk = pnozz_read_4(pPnozz, COMMAND_QUAD); +pnozz_write_4(pPnozz, ABS_XY0, (((x + doff) & 0x1fff) << 16) | + (y & 0x1fff)); +pnozz_write_4(pPnozz, ABS_XY1, (((x + doff) & 0x1fff) << 16) | + (y2 & 0x1fff)); +pnozz_write_4(pPnozz, ABS_XY2, (((x2 + doff) & 0x1fff) << 16) | + (y2 & 0x1fff)); +pnozz_write_4(pPnozz, ABS_XY3, (((x2 + doff) & 0x1fff) << 16) | + (y & 0x1fff)); +pnozz_read_4(pPnozz, COMMAND_QUAD); exaMarkSync(pPixmap->drawable.pScreen); } @@ -208,8 +212,6 @@ PnozzEXAInit(ScreenPtr pScreen) PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); ExaDriverPtr pExa; -PnozzInitEngine(pPnozz); - pExa = exaDriverAlloc(); if (!pExa) return FALSE; @@ -223,7 +225,8 @@ PnozzEXAInit(ScreenPtr pScreen) /* round to multiple of pixmap pitch */ pExa
CVS commit: src/lib/libossaudio
Module Name:src Committed By: nia Date: Wed Jun 9 14:49:13 UTC 2021 Modified Files: src/lib/libossaudio: oss_caps.c Log Message: ossaudio(3): continue getting capabilities if AUDIO_GETFORMAT fails we want this to work on mixer devices too To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libossaudio/oss_caps.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libossaudio/oss_caps.c diff -u src/lib/libossaudio/oss_caps.c:1.1 src/lib/libossaudio/oss_caps.c:1.2 --- src/lib/libossaudio/oss_caps.c:1.1 Tue Jun 8 18:43:54 2021 +++ src/lib/libossaudio/oss_caps.c Wed Jun 9 14:49:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: oss_caps.c,v 1.1 2021/06/08 18:43:54 nia Exp $ */ +/* $NetBSD: oss_caps.c,v 1.2 2021/06/09 14:49:13 nia Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -41,27 +41,26 @@ _oss_get_caps(int fd, int *out) if (ioctl(fd, AUDIO_GETPROPS, &props) < 0) return -1; - if (ioctl(fd, AUDIO_GETFORMAT, &info) < 0) - return -1; - caps = 0; caps |= PCM_CAP_TRIGGER; caps |= PCM_CAP_MULTI; caps |= PCM_CAP_FREERATE; - nchannels = (props & AUDIO_PROP_PLAYBACK) ? - info.play.channels : info.record.channels; - - switch (nchannels) { - case 2: - caps |= DSP_CH_STEREO; - break; - case 1: - caps |= DSP_CH_MONO; - break; - default: - caps |= DSP_CH_MULTI; - break; + if (ioctl(fd, AUDIO_GETFORMAT, &info) != -1) { + nchannels = (props & AUDIO_PROP_PLAYBACK) ? + info.play.channels : info.record.channels; + + switch (nchannels) { + case 2: + caps |= DSP_CH_STEREO; + break; + case 1: + caps |= DSP_CH_MONO; + break; + default: + caps |= DSP_CH_MULTI; + break; + } } if (props & AUDIO_PROP_FULLDUPLEX)
CVS commit: src/sys/kern
Module Name:src Committed By: christos Date: Wed Jun 9 15:15:35 UTC 2021 Modified Files: src/sys/kern: subr_kobj.c Log Message: Work around abs rela relocations issue (for now): $ readelf -r compat_linux ... Relocation section '.rela.data' at offset 0x37270 contains 537 entries: Offset Info Type Sym. ValueSym. Name + Addend ... 0040 0001 R_X86_64_64 0 0048 0001 R_X86_64_64 0 ... $ objdump -r compat_linux ... RELOCATION RECORDS FOR [.data]: OFFSET TYPE VALUE ... 0040 R_X86_64_64 *ABS* 0048 R_X86_64_64 *ABS* ... Since those have symidx == 0, and the 0 symbol table entry is special, treat them as SHN_ABS. Change ENOENT -> ENOEXEC to avoid confusion (like other linking errors), and add some debugging when that happens. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/kern/subr_kobj.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_kobj.c diff -u src/sys/kern/subr_kobj.c:1.67 src/sys/kern/subr_kobj.c:1.68 --- src/sys/kern/subr_kobj.c:1.67 Sat Jun 27 13:27:59 2020 +++ src/sys/kern/subr_kobj.c Wed Jun 9 11:15:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kobj.c,v 1.67 2020/06/27 17:27:59 christos Exp $ */ +/* $NetBSD: subr_kobj.c,v 1.68 2021/06/09 15:15:35 christos Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.67 2020/06/27 17:27:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.68 2021/06/09 15:15:35 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_modular.h" @@ -881,7 +881,7 @@ kobj_sym_lookup(kobj_t ko, uintptr_t sym sym = ko->ko_symtab + symidx; - if (symidx == SHN_ABS) { + if (symidx == SHN_ABS || symidx == 0) { *val = (uintptr_t)sym->st_value; return 0; } else if (symidx >= ko->ko_symcnt) { @@ -1074,7 +1074,12 @@ kobj_relocate(kobj_t ko, bool local) } error = kobj_reloc(ko, base, rel, false, local); if (error != 0) { -return ENOENT; +kobj_error(ko, "unresolved rel relocation " +"@%#jx type=%d symidx=%d", +(intmax_t)rel->r_offset, +(int)ELF_R_TYPE(rel->r_info), +(int)ELF_R_SYM(rel->r_info)); +return ENOEXEC; } } } @@ -1105,7 +1110,12 @@ kobj_relocate(kobj_t ko, bool local) } error = kobj_reloc(ko, base, rela, true, local); if (error != 0) { -return ENOENT; +kobj_error(ko, "unresolved rela relocation " +"@%#jx type=%d symidx=%d", +(intmax_t)rela->r_offset, +(int)ELF_R_TYPE(rela->r_info), +(int)ELF_R_SYM(rela->r_info)); +return ENOEXEC; } } }
CVS commit: src/sys/net
Module Name:src Committed By: martin Date: Wed Jun 9 15:38:40 UTC 2021 Modified Files: src/sys/net: bpf.h Log Message: Add a (FreeBSD compatible) bpf_peers_present() predicate to allow testing for active listeners on a tap. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/net/bpf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/bpf.h diff -u src/sys/net/bpf.h:1.75 src/sys/net/bpf.h:1.76 --- src/sys/net/bpf.h:1.75 Thu Jun 11 13:36:20 2020 +++ src/sys/net/bpf.h Wed Jun 9 15:38:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bpf.h,v 1.75 2020/06/11 13:36:20 roy Exp $ */ +/* $NetBSD: bpf.h,v 1.76 2021/06/09 15:38:39 martin Exp $ */ /* * Copyright (c) 1990, 1991, 1993 @@ -501,6 +501,16 @@ bpf_change_type(struct ifnet *_ifp, u_in bpf_ops->bpf_change_type(_ifp, _dlt, _hdrlen); } +static __inline bool +bpf_peers_present(struct bpf_if *dp) +{ + /* + * Our code makes sure the driver visible pointer is NULL + * whenever there is no listener on this tap. + */ + return dp != NULL; +} + static __inline void bpf_detach(struct ifnet *_ifp) {
CVS commit: src/sys/net
Module Name:src Committed By: martin Date: Wed Jun 9 15:44:15 UTC 2021 Modified Files: src/sys/net: bpf.c bpf.h bpfdesc.h Log Message: Add a bpf_register_track_event() function (and deregister equivalent) that allows a driver to track listeners attaching/detaching from tap points. This is usefull for drivers that would have to do extra work for some taps and can not easily decide (at the driver level) if the work would be needed further up the stack. An example is providing radiotap headers for IEEE 802.11 frames. To generate a diff of this commit: cvs rdiff -u -r1.239 -r1.240 src/sys/net/bpf.c cvs rdiff -u -r1.76 -r1.77 src/sys/net/bpf.h cvs rdiff -u -r1.47 -r1.48 src/sys/net/bpfdesc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/bpf.c diff -u src/sys/net/bpf.c:1.239 src/sys/net/bpf.c:1.240 --- src/sys/net/bpf.c:1.239 Fri Dec 18 01:31:49 2020 +++ src/sys/net/bpf.c Wed Jun 9 15:44:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bpf.c,v 1.239 2020/12/18 01:31:49 thorpej Exp $ */ +/* $NetBSD: bpf.c,v 1.240 2021/06/09 15:44:15 martin Exp $ */ /* * Copyright (c) 1990, 1991, 1993 @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.239 2020/12/18 01:31:49 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.240 2021/06/09 15:44:15 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_bpf.h" @@ -461,6 +461,7 @@ bad: static void bpf_attachd(struct bpf_d *d, struct bpf_if *bp) { + struct bpf_event_tracker *t; KASSERT(mutex_owned(&bpf_mtx)); KASSERT(mutex_owned(d->bd_mtx)); @@ -473,6 +474,11 @@ bpf_attachd(struct bpf_d *d, struct bpf_ BPFIF_DLIST_WRITER_INSERT_HEAD(bp, d); *bp->bif_driverp = bp; + + SLIST_FOREACH(t, &bp->bif_trackers, bet_entries) { + t->bet_notify(bp, bp->bif_ifp, bp->bif_dlt, + BPF_TRACK_EVENT_ATTACH); + } } /* @@ -482,6 +488,7 @@ static void bpf_detachd(struct bpf_d *d) { struct bpf_if *bp; + struct bpf_event_tracker *t; KASSERT(mutex_owned(&bpf_mtx)); KASSERT(mutex_owned(d->bd_mtx)); @@ -522,7 +529,13 @@ bpf_detachd(struct bpf_d *d) */ *d->bd_bif->bif_driverp = NULL; } + d->bd_bif = NULL; + + SLIST_FOREACH(t, &bp->bif_trackers, bet_entries) { + t->bet_notify(bp, bp->bif_ifp, bp->bif_dlt, + BPF_TRACK_EVENT_DETACH); + } } static void @@ -2125,6 +2138,7 @@ _bpfattach(struct ifnet *ifp, u_int dlt, BPF_IFLIST_ENTRY_INIT(bp); PSLIST_INIT(&bp->bif_dlist_head); psref_target_init(&bp->bif_psref, bpf_psref_class); + SLIST_INIT(&bp->bif_trackers); BPF_IFLIST_WRITER_INSERT_HEAD(bp); @@ -2133,7 +2147,7 @@ _bpfattach(struct ifnet *ifp, u_int dlt, bp->bif_hdrlen = hdrlen; mutex_exit(&bpf_mtx); #if 0 - printf("bpf: %s attached\n", ifp->if_xname); + printf("bpf: %s attached with dlt %x\n", ifp->if_xname, dlt); #endif } @@ -2196,6 +2210,14 @@ _bpfdetach(struct ifnet *ifp) pserialize_perform(bpf_psz); psref_target_destroy(&bp->bif_psref, bpf_psref_class); + while (!SLIST_EMPTY(&bp->bif_trackers)) { +struct bpf_event_tracker *t = +SLIST_FIRST(&bp->bif_trackers); +SLIST_REMOVE_HEAD(&bp->bif_trackers, +bet_entries); +kmem_free(t, sizeof(*t)); + } + BPF_IFLIST_ENTRY_DESTROY(bp); if (bp->bif_si != NULL) { /* XXX NOMPSAFE: assumed running on one CPU */ @@ -2523,10 +2545,69 @@ SYSCTL_SETUP(sysctl_net_bpf_setup, "bpf } +static int +_bpf_register_track_event(struct bpf_if **driverp, + void (*_fun)(struct bpf_if *, struct ifnet *, int, int)) +{ + struct bpf_if *bp; + struct bpf_event_tracker *t; + int ret = ENOENT; + + t = kmem_zalloc(sizeof(*t), KM_SLEEP); + if (!t) + return ENOMEM; + t->bet_notify = _fun; + + mutex_enter(&bpf_mtx); + BPF_IFLIST_WRITER_FOREACH(bp) { + if (bp->bif_driverp != driverp) + continue; + SLIST_INSERT_HEAD(&bp->bif_trackers, t, bet_entries); + ret = 0; + break; + } + mutex_exit(&bpf_mtx); + + return ret; +} + +static int +_bpf_deregister_track_event(struct bpf_if **driverp, + void (*_fun)(struct bpf_if *, struct ifnet *, int, int)) +{ + struct bpf_if *bp; + struct bpf_event_tracker *t = NULL; + int ret = ENOENT; + + mutex_enter(&bpf_mtx); + BPF_IFLIST_WRITER_FOREACH(bp) { + if (bp->bif_driverp != driverp) + continue; + SLIST_FOREACH(t, &bp->bif_trackers, bet_entries) { + if (t->bet_notify == _fun) { +ret = 0; +break; + } + } + if (ret == 0) + break; + } + if (ret == 0 && t && t->bet_notify == _fun) { + SLIST_REMOVE(&bp->bif_trackers, t, bpf_event_tracker, + bet_entries); + } + mutex_exit(&bpf_mtx); + if (ret == 0) + kmem_free(t, sizeof(*t)); + return ret; +} + struct bpf_ops bpf_ops_kernel = { .bpf_attach = _bpfattach, .bpf_detach = _bpfdetach, .bpf_change_type = _bpf_change_type, + .bpf_register_track_event = _bpf_register_track_event, + .bpf_deregister_track_event = _bpf_deregister_track_event, .bpf_mtap = _bpf_mtap, .bpf_mtap2 = _bpf_mtap2, In
CVS commit: src/sys/sys
Module Name:src Committed By: martin Date: Wed Jun 9 15:49:58 UTC 2021 Modified Files: src/sys/sys: param.h Log Message: Welcome to NetBSD 9.99.84 (bpf tracking changes) To generate a diff of this commit: cvs rdiff -u -r1.693 -r1.694 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.693 src/sys/sys/param.h:1.694 --- src/sys/sys/param.h:1.693 Wed Jun 2 01:48:08 2021 +++ src/sys/sys/param.h Wed Jun 9 15:49:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.693 2021/06/02 01:48:08 yamaguchi Exp $ */ +/* $NetBSD: param.h,v 1.694 2021/06/09 15:49:57 martin Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999008300 /* NetBSD 9.99.83 */ +#define __NetBSD_Version__ 999008400 /* NetBSD 9.99.84 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: [netbsd-9] src/external/bsd/libpcap/bin
Module Name:src Committed By: martin Date: Wed Jun 9 19:46:20 UTC 2021 Modified Files: src/external/bsd/libpcap/bin [netbsd-9]: Makefile Log Message: Pull up following revision(s) (requested by dholland in ticket #1284): external/bsd/libpcap/bin/Makefile: revision 1.3 Fix pcap-config --libs output To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.50.1 src/external/bsd/libpcap/bin/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libpcap/bin/Makefile diff -u src/external/bsd/libpcap/bin/Makefile:1.2 src/external/bsd/libpcap/bin/Makefile:1.2.50.1 --- src/external/bsd/libpcap/bin/Makefile:1.2 Sun Dec 5 09:09:39 2010 +++ src/external/bsd/libpcap/bin/Makefile Wed Jun 9 19:46:19 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2010/12/05 09:09:39 mrg Exp $ +# $NetBSD: Makefile,v 1.2.50.1 2021/06/09 19:46:19 martin Exp $ .include @@ -13,6 +13,10 @@ pcap-config: pcap-config.in @rm -f ${.TARGET} ${TOOL_SED} -e 's,@libdir@,/usr/lib,g' \ -e 's,@includedir@,/usr/include,g' \ + -e 's,@PACKAGE_NAME@,pcap,g' \ + -e 's,@prefix@,/usr,g' \ + -e 's,@exec_prefix@,/usr,g' \ + -e 's/@V_RPATH_OPT@/-Wl,-rpath,/g' \ -e 's,@LIBS@,,g' < ${.ALLSRC} > ${.TARGET} chmod a+x ${.TARGET}
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Wed Jun 9 19:47:29 UTC 2021 Modified Files: src/doc [netbsd-9]: CHANGES-9.3 Log Message: Ticket #1284 To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/doc/CHANGES-9.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.3 diff -u src/doc/CHANGES-9.3:1.1.2.6 src/doc/CHANGES-9.3:1.1.2.7 --- src/doc/CHANGES-9.3:1.1.2.6 Tue Jun 8 12:56:29 2021 +++ src/doc/CHANGES-9.3 Wed Jun 9 19:47:29 2021 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.3,v 1.1.2.6 2021/06/08 12:56:29 martin Exp $ +# $NetBSD: CHANGES-9.3,v 1.1.2.7 2021/06/09 19:47:29 martin Exp $ A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3 release: @@ -87,3 +87,8 @@ sbin/dump/tape.c1.56 dump(8): prevent crashes for large file systems. [hannken, ticket #1283] +external/bsd/libpcap/bin/Makefile 1.3 + + Fix pcap-config output. + [dholland, ticket #1284] +
CVS commit: src/tests/lib/libc/regex
Module Name:src Committed By: christos Date: Wed Jun 9 20:48:37 UTC 2021 Modified Files: src/tests/lib/libc/regex: t_exhaust.c Log Message: 1. Preallocate the patterns so that out of memory conditions don't happen during their allocation, which the test cannot handle properly. 2. Enable building the test without atf so that we can easily debug with atf memory allocations interfering 3. Add memory tracing (disabled) To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libc/regex/t_exhaust.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/regex/t_exhaust.c diff -u src/tests/lib/libc/regex/t_exhaust.c:1.11 src/tests/lib/libc/regex/t_exhaust.c:1.12 --- src/tests/lib/libc/regex/t_exhaust.c:1.11 Mon Jun 7 07:45:35 2021 +++ src/tests/lib/libc/regex/t_exhaust.c Wed Jun 9 16:48:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_exhaust.c,v 1.11 2021/06/07 11:45:35 christos Exp $ */ +/* $NetBSD: t_exhaust.c,v 1.12 2021/06/09 20:48:37 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -37,20 +37,59 @@ */ #include -__RCSID("$NetBSD: t_exhaust.c,v 1.11 2021/06/07 11:45:35 christos Exp $"); +__RCSID("$NetBSD: t_exhaust.c,v 1.12 2021/06/09 20:48:37 christos Exp $"); #include -#include #include + +#ifdef TEST +# include +# define ATF_REQUIRE(a) assert(a) +# define ATF_REQUIRE_MSG(a, fmt, ...) \ +if (!(a)) err(EXIT_FAILURE, fmt, __VA_ARGS__) +#else +# include +#endif + #include +#include #include #include #include +#include #ifndef REGEX_MAXSIZE #define REGEX_MAXSIZE #endif +#ifdef TRACE +void * +malloc(size_t l) +{ + static void *(*m)(size_t); + static int q; + if (m == NULL) m = dlsym(RTLD_NEXT, "malloc"); + void *p = (*m)(l); + if (q) + return p; + q = 1; + printf("%p m %zu\n", p, l); + if (p == (void *)0x7f7ff7e21ac0) + kill(0, SIGSTOP); + q = 0; + return p; +} + +void +free(void *p) +{ + static void (*f)(void *); + if (f == NULL) f = dlsym(RTLD_NEXT, "malloc"); + printf("%p f\n", p); + (*f)(p); +} +#endif + static char * mkstr(const char *str, size_t len) { @@ -168,43 +207,56 @@ static const struct { { p6, REG_BASIC }, }; -ATF_TC(regcomp_too_big); - -ATF_TC_HEAD(regcomp_too_big, tc) -{ - - atf_tc_set_md_var(tc, "descr", "Check that large patterns don't" - " crash, but return a proper error code"); - // libtre needs it. - atf_tc_set_md_var(tc, "timeout", "600"); - atf_tc_set_md_var(tc, "require.memory", "256M"); -} - -ATF_TC_BODY(regcomp_too_big, tc) +static void +run(void) { regex_t re; int e; struct rlimit limit; + char *patterns[__arraycount(tests)]; + + for (size_t i = 0; i < __arraycount(patterns); i++) { + patterns[i] = (*tests[i].pattern)(REGEX_MAXSIZE); + } limit.rlim_cur = limit.rlim_max = 256 * 1024 * 1024; ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1); for (size_t i = 0; i < __arraycount(tests); i++) { - char *d = (*tests[i].pattern)(REGEX_MAXSIZE); - e = regcomp(&re, d, tests[i].type); + e = regcomp(&re, patterns[i], tests[i].type); if (e) { char ebuf[1024]; (void)regerror(e, &re, ebuf, sizeof(ebuf)); ATF_REQUIRE_MSG(e == REG_ESPACE, - "regcomp returned %d (%s) for pattern %zu [%s]", e, ebuf, - i, d); - free(d); + "regcomp returned %d (%s) for pattern %zu [%s]", e, + ebuf, i, patterns[i]); continue; } - free(d); (void)regexec(&re, "aaa", 0, NULL, 0); regfree(&re); } + for (size_t i = 0; i < __arraycount(patterns); i++) { + free(patterns[i]); + } +} + +#ifndef TEST + +ATF_TC(regcomp_too_big); + +ATF_TC_HEAD(regcomp_too_big, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check that large patterns don't" + " crash, but return a proper error code"); + // libtre needs it. + atf_tc_set_md_var(tc, "timeout", "600"); + atf_tc_set_md_var(tc, "require.memory", "256M"); +} + +ATF_TC_BODY(regcomp_too_big, tc) +{ + run(); } ATF_TP_ADD_TCS(tp) @@ -213,3 +265,11 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, regcomp_too_big); return atf_no_error(); } +#else +int +main(void) +{ + run(); + return 0; +} +#endif
CVS commit: src/tests/lib/libc/regex
Module Name:src Committed By: christos Date: Wed Jun 9 21:08:56 UTC 2021 Modified Files: src/tests/lib/libc/regex: t_exhaust.c Log Message: remove not required include files To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libc/regex/t_exhaust.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/regex/t_exhaust.c diff -u src/tests/lib/libc/regex/t_exhaust.c:1.12 src/tests/lib/libc/regex/t_exhaust.c:1.13 --- src/tests/lib/libc/regex/t_exhaust.c:1.12 Wed Jun 9 16:48:37 2021 +++ src/tests/lib/libc/regex/t_exhaust.c Wed Jun 9 17:08:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_exhaust.c,v 1.12 2021/06/09 20:48:37 christos Exp $ */ +/* $NetBSD: t_exhaust.c,v 1.13 2021/06/09 21:08:56 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__RCSID("$NetBSD: t_exhaust.c,v 1.12 2021/06/09 20:48:37 christos Exp $"); +__RCSID("$NetBSD: t_exhaust.c,v 1.13 2021/06/09 21:08:56 christos Exp $"); #include #include @@ -52,17 +52,17 @@ __RCSID("$NetBSD: t_exhaust.c,v 1.12 202 #endif #include -#include #include #include #include -#include #ifndef REGEX_MAXSIZE #define REGEX_MAXSIZE #endif #ifdef TRACE + +#include void * malloc(size_t l) {
CVS commit: src/tests/lib/libc/regex
Module Name:src Committed By: christos Date: Wed Jun 9 21:09:20 UTC 2021 Modified Files: src/tests/lib/libc/regex: t_exhaust.c Log Message: remove the kill in the trace code. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libc/regex/t_exhaust.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/regex/t_exhaust.c diff -u src/tests/lib/libc/regex/t_exhaust.c:1.13 src/tests/lib/libc/regex/t_exhaust.c:1.14 --- src/tests/lib/libc/regex/t_exhaust.c:1.13 Wed Jun 9 17:08:56 2021 +++ src/tests/lib/libc/regex/t_exhaust.c Wed Jun 9 17:09:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_exhaust.c,v 1.13 2021/06/09 21:08:56 christos Exp $ */ +/* $NetBSD: t_exhaust.c,v 1.14 2021/06/09 21:09:20 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__RCSID("$NetBSD: t_exhaust.c,v 1.13 2021/06/09 21:08:56 christos Exp $"); +__RCSID("$NetBSD: t_exhaust.c,v 1.14 2021/06/09 21:09:20 christos Exp $"); #include #include @@ -74,8 +74,6 @@ malloc(size_t l) return p; q = 1; printf("%p m %zu\n", p, l); - if (p == (void *)0x7f7ff7e21ac0) - kill(0, SIGSTOP); q = 0; return p; }
CVS commit: src/sys/dev
Module Name:src Committed By: pgoyette Date: Wed Jun 9 23:22:51 UTC 2021 Modified Files: src/sys/dev: dev_verbose.h Log Message: Use the localcount(9)-based module_hook mechanism to prevent the verbose modules' code and data being unloaded while in use. Should prevent some crashes reported by Riastradh@ to occur during suspend/resume operation. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dev_verbose.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dev_verbose.h diff -u src/sys/dev/dev_verbose.h:1.5 src/sys/dev/dev_verbose.h:1.6 --- src/sys/dev/dev_verbose.h:1.5 Tue Jun 1 22:58:03 2021 +++ src/sys/dev/dev_verbose.h Wed Jun 9 23:22:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dev_verbose.h,v 1.5 2021/06/01 22:58:03 riastradh Exp $ */ +/* $NetBSD: dev_verbose.h,v 1.6 2021/06/09 23:22:51 pgoyette Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,6 +25,10 @@ #ifndef _DEV_DEV_VERBOSE_H_ #define _DEV_DEV_VERBOSE_H_ +#ifdef _KERNEL +#include +#endif + const char *dev_findvendor(char *, size_t, const char *, size_t, const uint16_t *, size_t, uint16_t); const char *dev_findproduct(char *, size_t, const char *, size_t, @@ -50,33 +54,34 @@ tag ## _findproduct_real(char *buf, size #ifdef _KERNEL +#define DEV_VERBOSE_KERNEL_DECLARE(tag) \ +MODULE_HOOK(tag ## _findvendor_hook, const char *, \ + (char *, size_t, uint16_t)); \ +MODULE_HOOK(tag ## _findproduct_hook, const char *, \ + (char *, size_t, uint16_t, uint16_t));\ +extern int tag ## verbose_loaded; + #define DEV_VERBOSE_MODULE_DEFINE(tag, deps)\ DEV_VERBOSE_COMMON_DEFINE(tag) \ -extern int tag ## verbose_loaded; \ +DEV_VERBOSE_KERNEL_DECLARE(tag) \ \ static int\ tag ## verbose_modcmd(modcmd_t cmd, void *arg)\ { \ - static const char *(*saved_findvendor)(char *, size_t, \ - uint16_t); \ - static const char *(*saved_findproduct)(char *, size_t, \ - uint16_t, uint16_t); \ \ switch (cmd) { \ case MODULE_CMD_INIT: \ - saved_findvendor = tag ## _findvendor; \ - saved_findproduct = tag ## _findproduct; \ - tag ## _findvendor = tag ## _findvendor_real; \ - tag ## _findproduct = tag ## _findproduct_real; \ + MODULE_HOOK_SET(tag ## _findvendor_hook, \ + tag ## _findvendor_real); \ + MODULE_HOOK_SET(tag ## _findproduct_hook, \ + tag ## _findproduct_real); \ tag ## verbose_loaded = 1;\ return 0; \ case MODULE_CMD_FINI: \ - tag ## _findvendor = saved_findvendor; \ - tag ## _findproduct = saved_findproduct; \ tag ## verbose_loaded = 0;\ + MODULE_HOOK_UNSET(tag ## _findproduct_hook); \ + MODULE_HOOK_UNSET(tag ## _findvendor_hook); \ return 0; \ - case MODULE_CMD_AUTOUNLOAD: \ - return EBUSY; \ default: \ return ENOTTY; \ }\ @@ -86,11 +91,15 @@ MODULE(MODULE_CLASS_DRIVER, tag ## verbo #endif /* KERNEL */ #define DEV_VERBOSE_DECLARE(tag) \ -extern const char * (*tag ## _findvendor)(char *, size_t, uint16_t); \ -extern const char * (*tag ## _findproduct)(char *, size_t, uint16_t, uint16_t) +extern const char * tag ## _findvendor(char *, size_t, uint16_t); \ +extern const char * tag ## _findproduct(char *, size_t, uint16_t, uint16_t) #if defined(_KERNEL) + #define DEV_VERBOSE_DEFINE(tag) \ +DEV_VERBOSE_KERNEL_DECLARE(tag) \ +struct tag ## _findvendor_hook_t tag ## _findvendor_hook; \ +struct tag ## _findproduct_hook_t tag ## _findproduct_hook; \ int tag ## verbose_loaded = 0; \ \ static void\ @@ -101,46 +110,48 @@ tag ## _load_verbose(void) \ module_autoload(# tag "verbose", MODULE_CLASS_DRIVER); \ } \ \ -static const char * \ -tag ## _findvendor_stub(char *buf, size_t len, uint16_t vendor) \ +const char *\ +tag ## _findvendor(char *buf, size_t len, uint16_t vendor) \ { \ + const char *retval = NULL; \ \ tag ## _load_verbose(); \ - if (tag ## verbose_loaded) \ - return tag ## _findvendor(buf, len, vendor); \ - else {\ - snprintf(buf, len, "vendor %4.4x", vendor); \ - return NULL; \ - }\ + MODULE_HOOK_CALL(tag ## _findvendor_hook, (buf, len, vendor), \ + {snprintf(buf, len, "vendor %4.4x", vendor); NULL; }, \ + retval); \ + return retval; \ } \ \ -static const char * \ -tag ## _findproduct_stub(char *buf, size_t len, uint16_t vendor, \ +const char *\ +tag ## _findproduct(char *buf, size_t len, uint16_t vendor, \ uint16_t product) \ { \ + const char *retval = NULL; \ \ tag ## _load_verbose(); \ - if (tag ## verbose_loaded) \ - return tag ## _findproduct(buf, len, vendor, product); \ - else {\ - snprintf(buf, len, "