CVS commit: src/games/fortune/datfiles
Module Name:src Committed By: sevan Date: Thu Apr 2 05:55:02 UTC 2020 Modified Files: src/games/fortune/datfiles: fortunes Log Message: Disks can sense vibes, DTrace confirms it. https://youtu.be/tDacjrSCeq4 To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/games/fortune/datfiles/fortunes Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/fortune/datfiles/fortunes diff -u src/games/fortune/datfiles/fortunes:1.88 src/games/fortune/datfiles/fortunes:1.89 --- src/games/fortune/datfiles/fortunes:1.88 Sat Feb 22 19:03:04 2020 +++ src/games/fortune/datfiles/fortunes Thu Apr 2 05:55:02 2020 @@ -16294,3 +16294,6 @@ Fanfare, n.: The food available for consumption at a con. % Fail we may, sail we must +% +Don't shout at your JBODs, they don't like it! + -- Brendan Gregg, "Shouting in the Datacenter"
CVS commit: src/games/fortune/datfiles
Module Name:src Committed By: sevan Date: Thu Apr 2 05:55:02 UTC 2020 Modified Files: src/games/fortune/datfiles: fortunes Log Message: Disks can sense vibes, DTrace confirms it. https://youtu.be/tDacjrSCeq4 To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/games/fortune/datfiles/fortunes Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: nisimura Date: Thu Apr 2 04:09:36 UTC 2020 Modified Files: src/sys/dev/usb: if_mos.c if_url.c Log Message: iron out multicast filter logic and pick better name for its work To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/if_mos.c cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/if_url.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: nisimura Date: Thu Apr 2 04:09:36 UTC 2020 Modified Files: src/sys/dev/usb: if_mos.c if_url.c Log Message: iron out multicast filter logic and pick better name for its work To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/if_mos.c cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/if_url.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/dev/usb/if_mos.c diff -u src/sys/dev/usb/if_mos.c:1.6 src/sys/dev/usb/if_mos.c:1.7 --- src/sys/dev/usb/if_mos.c:1.6 Tue Mar 31 23:26:32 2020 +++ src/sys/dev/usb/if_mos.c Thu Apr 2 04:09:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mos.c,v 1.6 2020/03/31 23:26:32 nisimura Exp $ */ +/* $NetBSD: if_mos.c,v 1.7 2020/04/02 04:09:36 nisimura Exp $ */ /* $OpenBSD: if_mos.c,v 1.40 2019/07/07 06:40:10 kevlo Exp $ */ /* @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.6 2020/03/31 23:26:32 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.7 2020/04/02 04:09:36 nisimura Exp $"); #include @@ -485,7 +485,7 @@ mos_rcvfilt_locked(struct usbnet *un) ec->ec_flags |= ETHER_F_ALLMULTI; ETHER_UNLOCK(ec); memset(mchash, 0, sizeof(mchash)); /* correct ??? */ - /* accept all mulicast frame */ + /* accept all multicast frame */ rxmode |= MOS_CTL_ALLMULTI; goto update; } @@ -743,7 +743,7 @@ mos_init_locked(struct ifnet *ifp) mos_reg_write_1(un, MOS_IPG0, ipgs[0]); mos_reg_write_1(un, MOS_IPG1, ipgs[1]); - /* Program promiscuous mode and multicast filters. */ + /* Accept multicast frame or run promisc. mode */ mos_rcvfilt_locked(un); /* Enable receiver and transmitter, bridge controls speed/duplex mode */ Index: src/sys/dev/usb/if_url.c diff -u src/sys/dev/usb/if_url.c:1.76 src/sys/dev/usb/if_url.c:1.77 --- src/sys/dev/usb/if_url.c:1.76 Sun Mar 15 23:04:51 2020 +++ src/sys/dev/usb/if_url.c Thu Apr 2 04:09:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_url.c,v 1.76 2020/03/15 23:04:51 thorpej Exp $ */ +/* $NetBSD: if_url.c,v 1.77 2020/04/02 04:09:36 nisimura Exp $ */ /* * Copyright (c) 2001, 2002 @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.76 2020/03/15 23:04:51 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.77 2020/04/02 04:09:36 nisimura Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -81,7 +81,7 @@ static int url_uno_ioctl(struct ifnet *, static void url_uno_stop(struct ifnet *, int); static void url_uno_mii_statchg(struct ifnet *); static int url_uno_init(struct ifnet *); -static void url_setiff_locked(struct usbnet *); +static void url_rcvfilt_locked(struct usbnet *); static void url_reset(struct usbnet *); static int url_csr_read_1(struct usbnet *, int); @@ -398,20 +398,10 @@ url_init_locked(struct ifnet *ifp) URL_TCR_NOCRC); /* Init receive control register */ - URL_SETBIT2(un, URL_RCR, URL_RCR_TAIL | URL_RCR_AD); - if (ifp->if_flags & IFF_BROADCAST) - URL_SETBIT2(un, URL_RCR, URL_RCR_AB); - else - URL_CLRBIT2(un, URL_RCR, URL_RCR_AB); - - /* If we want promiscuous mode, accept all physical frames. */ - if (ifp->if_flags & IFF_PROMISC) - URL_SETBIT2(un, URL_RCR, URL_RCR_AAM | URL_RCR_AAP); - else - URL_CLRBIT2(un, URL_RCR, URL_RCR_AAM | URL_RCR_AAP); + URL_SETBIT2(un, URL_RCR, URL_RCR_TAIL | URL_RCR_AD | URL_RCR_AB); - /* Load the multicast filter */ - url_setiff_locked(un); + /* Accept multicast frame or run promisc. mode */ + url_rcvfilt_locked(un); /* Enable RX and TX */ URL_SETBIT(un, URL_CR, URL_CR_TE | URL_CR_RE); @@ -454,18 +444,15 @@ url_reset(struct usbnet *un) delay(1); /* XXX */ } -#define url_calchash(addr) (ether_crc32_be((addr), ETHER_ADDR_LEN) >> 26) - static void -url_setiff_locked(struct usbnet *un) +url_rcvfilt_locked(struct usbnet *un) { struct ifnet * const ifp = usbnet_ifp(un); struct ethercom *ec = usbnet_ec(un); struct ether_multi *enm; struct ether_multistep step; - uint32_t hashes[2] = { 0, 0 }; - int h = 0; - int mcnt = 0; + uint32_t mchash[2] = { 0, 0 }; + int h = 0, rcr; DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__)); @@ -474,52 +461,40 @@ url_setiff_locked(struct usbnet *un) if (usbnet_isdying(un)) return; - if (ifp->if_flags & IFF_PROMISC) { - URL_SETBIT2(un, URL_RCR, URL_RCR_AAM | URL_RCR_AAP); - return; - } else if (ifp->if_flags & IFF_ALLMULTI) { -allmulti: - ifp->if_flags |= IFF_ALLMULTI; - URL_SETBIT2(un, URL_RCR, URL_RCR_AAM); - URL_CLRBIT2(un, URL_RCR, URL_RCR_AAP); - return; - } - - /* first, zot all the existing hash bits */ - url_csr_write_4(un, URL_MAR0, 0); - url_csr_write_4(un, URL_MAR4, 0); + rcr = url_csr_read_2(un, URL_RCR); + rcr &= ~(URL_RCR_AAP | URL_RCR_AAM | URL_RCR_AM); - /* now program new ones */ ETHER_LOCK(ec); + if (ifp->if_flags & IFF_PROMISC) { + ec->ec_flags |= ETHER_F_ALLMULTI; + ETHER_UNLOCK(ec); + /* run promisc. mode */ + rcr |=
CVS commit: src/usr.bin/kdump
Module Name:src Committed By: kamil Date: Thu Apr 2 03:35:48 UTC 2020 Modified Files: src/usr.bin/kdump: kdump.1 Log Message: Note ioctlprint(1) in SEE ALSO To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/kdump/kdump.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/kdump
Module Name:src Committed By: kamil Date: Thu Apr 2 03:35:48 UTC 2020 Modified Files: src/usr.bin/kdump: kdump.1 Log Message: Note ioctlprint(1) in SEE ALSO To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/kdump/kdump.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/kdump/kdump.1 diff -u src/usr.bin/kdump/kdump.1:1.28 src/usr.bin/kdump/kdump.1:1.29 --- src/usr.bin/kdump/kdump.1:1.28 Sun Sep 10 10:09:34 2017 +++ src/usr.bin/kdump/kdump.1 Thu Apr 2 03:35:48 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: kdump.1,v 1.28 2017/09/10 10:09:34 wiz Exp $ +.\" $NetBSD: kdump.1,v 1.29 2020/04/02 03:35:48 kamil Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)kdump.1 8.1 (Berkeley) 6/6/93 .\" -.Dd September 9, 2017 +.Dd April 2, 2020 .Dt KDUMP 1 .Os .Sh NAME @@ -118,6 +118,7 @@ bytes. Supported values are 1, 2, 4, 8, and 16. .El .Sh SEE ALSO +.Xr ioctlprint 1 .Xr ktrace 1 .Sh HISTORY The
CVS commit: src/doc
Module Name:src Committed By: kamil Date: Thu Apr 2 03:34:49 UTC 2020 Modified Files: src/doc: CHANGES Log Message: ioctlprint(1): Add ioctl descriptive printer. To generate a diff of this commit: cvs rdiff -u -r1.2662 -r1.2663 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: kamil Date: Thu Apr 2 03:34:49 UTC 2020 Modified Files: src/doc: CHANGES Log Message: ioctlprint(1): Add ioctl descriptive printer. To generate a diff of this commit: cvs rdiff -u -r1.2662 -r1.2663 src/doc/CHANGES 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 diff -u src/doc/CHANGES:1.2662 src/doc/CHANGES:1.2663 --- src/doc/CHANGES:1.2662 Sat Mar 28 19:50:40 2020 +++ src/doc/CHANGES Thu Apr 2 03:34:49 2020 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2662 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2663 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -161,3 +161,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: where the relevant pages are already in-core. [ad 20200322] bwfm: Update firmware to linux-firmware-20200316. [thorpej 20200322] acpi(4): Updated ACPICA to 20200326. [christos 20200328] + ioctlprint(1): Add ioctl descriptive printer. [kamil 20200402]
CVS commit: src
Module Name:src Committed By: kamil Date: Thu Apr 2 03:32:46 UTC 2020 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/man: mi src/usr.bin/kdump: Makefile kdump.c Added Files: src/usr.bin/kdump: ioctlprint.1 Log Message: Add ioctlprint - descriptive ioctl value printer ioctlprint(1) is embedded in the kdump(1) program. To generate a diff of this commit: cvs rdiff -u -r1.1235 -r1.1236 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.1684 -r1.1685 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.32 -r1.33 src/usr.bin/kdump/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/kdump/ioctlprint.1 cvs rdiff -u -r1.132 -r1.133 src/usr.bin/kdump/kdump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.1235 src/distrib/sets/lists/base/mi:1.1236 --- src/distrib/sets/lists/base/mi:1.1235 Sun Mar 29 17:13:46 2020 +++ src/distrib/sets/lists/base/mi Thu Apr 2 03:32:46 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1235 2020/03/29 17:13:46 christos Exp $ +# $NetBSD: mi,v 1.1236 2020/04/02 03:32:46 kamil Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -797,6 +797,7 @@ ./usr/bin/installbase-util-bin ./usr/bin/install-infobase-texinfo-bin ./usr/bin/install-sidbase-gnats-bin +./usr/bin/ioctlprintbase-debug-bin ./usr/bin/ipcrm base-util-bin ./usr/bin/ipcs base-util-bin ./usr/bin/join base-util-bin Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1684 src/distrib/sets/lists/man/mi:1.1685 --- src/distrib/sets/lists/man/mi:1.1684 Sun Mar 29 17:13:46 2020 +++ src/distrib/sets/lists/man/mi Thu Apr 2 03:32:46 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1684 2020/03/29 17:13:46 christos Exp $ +# $NetBSD: mi,v 1.1685 2020/04/02 03:32:46 kamil Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -226,6 +226,7 @@ ./usr/share/man/cat1/install-info.0 man-texinfo-catman .cat ./usr/share/man/cat1/install.0 man-util-catman .cat ./usr/share/man/cat1/intro.0 man-sys-catman .cat +./usr/share/man/cat1/ioctlprint.0 man-debug-catman .cat ./usr/share/man/cat1/ipcrm.0 man-util-catman .cat ./usr/share/man/cat1/ipcs.0 man-util-catman .cat ./usr/share/man/cat1/ipftest.0 man-ipf-catman ipfilter,.cat @@ -3512,6 +3513,7 @@ ./usr/share/man/html1/install-info.html man-texinfo-htmlman html ./usr/share/man/html1/install.html man-util-htmlman html ./usr/share/man/html1/intro.html man-sys-htmlman html +./usr/share/man/html1/ioctlprint.html man-debug-htmlman html ./usr/share/man/html1/ipcrm.html man-util-htmlman html ./usr/share/man/html1/ipcs.html man-util-htmlman html ./usr/share/man/html1/ipftest.html man-ipf-htmlman ipfilter,html @@ -6436,6 +6438,7 @@ ./usr/share/man/man1/install-info.1 man-texinfo-man .man ./usr/share/man/man1/install.1 man-util-man .man ./usr/share/man/man1/intro.1 man-sys-man .man +./usr/share/man/man1/ioctlprint.1 man-debug-man .man ./usr/share/man/man1/ipcrm.1 man-util-man .man ./usr/share/man/man1/ipcs.1 man-util-man .man ./usr/share/man/man1/ipftest.1 man-ipf-man ipfilter,.man Index: src/usr.bin/kdump/Makefile diff -u src/usr.bin/kdump/Makefile:1.32 src/usr.bin/kdump/Makefile:1.33 --- src/usr.bin/kdump/Makefile:1.32 Sat Jan 23 21:22:49 2016 +++ src/usr.bin/kdump/Makefile Thu Apr 2 03:32:46 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.32 2016/01/23 21:22:49 christos Exp $ +# $NetBSD: Makefile,v 1.33 2020/04/02 03:32:46 kamil Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 .include # for MKDYNAMICROOT & NETBSDSRCDIR @@ -6,6 +6,8 @@ USE_FORT?= yes # cryptographic software PROG= kdump +LINKS= ${BINDIR}/kdump ${BINDIR}/ioctlprint +MAN= kdump.1 ioctlprint.1 SRCS= kdump.c subr.c setemul.c siginfo.c .PATH: ${NETBSDSRCDIR}/usr.bin/ktrace CLEANFILES+=siginfo.c Index: src/usr.bin/kdump/kdump.c diff -u src/usr.bin/kdump/kdump.c:1.132 src/usr.bin/kdump/kdump.c:1.133 --- src/usr.bin/kdump/kdump.c:1.132 Tue Jul 23 01:54:51 2019 +++ src/usr.bin/kdump/kdump.c Thu Apr 2 03:32:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kdump.c,v 1.132 2019/07/23 01:54:51 nonaka Exp $ */ +/* $NetBSD: kdump.c,v 1.133 2020/04/02 03:32:46 kamil Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: kdump.c,v 1.132 2019/07/23 01:54:51 nonaka Exp $"); +__RCSID("$NetBSD: kdump.c,v 1.133 2020/04/02 03:32:46 kamil Exp $"); #endif #endif /* not lint */ @@ -58,6 +58,7 @@ __RCSID("$NetBSD: kdump.c,v 1.132 2019/0 #include #include +#include #include #include #include @@ -107,6 +108,9 @@ static const char * const linux_ptrace_o "PTRACE_SYSCALL", }; +static const char
CVS commit: src
Module Name:src Committed By: kamil Date: Thu Apr 2 03:32:46 UTC 2020 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/man: mi src/usr.bin/kdump: Makefile kdump.c Added Files: src/usr.bin/kdump: ioctlprint.1 Log Message: Add ioctlprint - descriptive ioctl value printer ioctlprint(1) is embedded in the kdump(1) program. To generate a diff of this commit: cvs rdiff -u -r1.1235 -r1.1236 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.1684 -r1.1685 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.32 -r1.33 src/usr.bin/kdump/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/kdump/ioctlprint.1 cvs rdiff -u -r1.132 -r1.133 src/usr.bin/kdump/kdump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/shmif_dumpbus
Module Name:src Committed By: christos Date: Thu Apr 2 00:00:16 UTC 2020 Modified Files: src/tests/usr.bin/shmif_dumpbus: t_basic.sh Log Message: Add path. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/shmif_dumpbus/t_basic.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/shmif_dumpbus/t_basic.sh diff -u src/tests/usr.bin/shmif_dumpbus/t_basic.sh:1.9 src/tests/usr.bin/shmif_dumpbus/t_basic.sh:1.10 --- src/tests/usr.bin/shmif_dumpbus/t_basic.sh:1.9 Mon Apr 9 12:21:05 2018 +++ src/tests/usr.bin/shmif_dumpbus/t_basic.sh Wed Apr 1 20:00:16 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_basic.sh,v 1.9 2018/04/09 16:21:05 martin Exp $ +# $NetBSD: t_basic.sh,v 1.10 2020/04/02 00:00:16 christos Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,6 +25,8 @@ # POSSIBILITY OF SUCH DAMAGE. # +export PATH=/bin:/usr/bin:/sbin:/usr/sbin + unpack_file() {
CVS commit: src/tests/usr.bin/shmif_dumpbus
Module Name:src Committed By: christos Date: Thu Apr 2 00:00:16 UTC 2020 Modified Files: src/tests/usr.bin/shmif_dumpbus: t_basic.sh Log Message: Add path. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/shmif_dumpbus/t_basic.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/shmif_dumpbus
Module Name:src Committed By: christos Date: Wed Apr 1 21:04:34 UTC 2020 Modified Files: src/usr.bin/shmif_dumpbus: shmif_dumpbus.c Log Message: improve error messages, minor cleanups. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/shmif_dumpbus/shmif_dumpbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/shmif_dumpbus/shmif_dumpbus.c diff -u src/usr.bin/shmif_dumpbus/shmif_dumpbus.c:1.18 src/usr.bin/shmif_dumpbus/shmif_dumpbus.c:1.19 --- src/usr.bin/shmif_dumpbus/shmif_dumpbus.c:1.18 Tue Nov 4 14:05:17 2014 +++ src/usr.bin/shmif_dumpbus/shmif_dumpbus.c Wed Apr 1 17:04:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: shmif_dumpbus.c,v 1.18 2014/11/04 19:05:17 pooka Exp $ */ +/* $NetBSD: shmif_dumpbus.c,v 1.19 2020/04/01 21:04:34 christos Exp $ */ /*- * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -33,7 +33,7 @@ #include #ifndef lint -__RCSID("$NetBSD: shmif_dumpbus.c,v 1.18 2014/11/04 19:05:17 pooka Exp $"); +__RCSID("$NetBSD: shmif_dumpbus.c,v 1.19 2020/04/01 21:04:34 christos Exp $"); #endif /* !lint */ #include @@ -64,8 +64,9 @@ usage(void) #define getprogname() "shmif_dumpbus" #endif - fprintf(stderr, "usage: %s [-h] [-p pcapfile] buspath\n",getprogname()); - exit(1); + fprintf(stderr, "Usage: %s [-h] [-p pcapfile] buspath\n", + getprogname()); + exit(EXIT_FAILURE); } #define BUFSIZE 64*1024 @@ -101,8 +102,8 @@ swp64(uint64_t x) return v; } -#define FIXENDIAN32(x) (doswap ? swp32(x) : (x)) -#define FIXENDIAN64(x) (doswap ? swp64(x) : (x)) +#define FIXENDIAN32(x) (doswap ? swp32(x) : (uint32_t)(x)) +#define FIXENDIAN64(x) (doswap ? swp64(x) : (uint64_t)(x)) /* compat for bus version 2 */ struct shmif_pkthdr2 { @@ -126,7 +127,7 @@ main(int argc, char *argv[]) bool hflag = false, doswap = false; pcap_dumper_t *pdump; FILE *dumploc = stdout; - int useversion; + uint32_t useversion; setprogname(argv[0]); while ((ch = getopt(argc, argv, "hp:")) != -1) { @@ -150,33 +151,36 @@ main(int argc, char *argv[]) buf = malloc(BUFSIZE); if (buf == NULL) - err(1, "malloc"); + err(EXIT_FAILURE, "malloc"); fd = open(argv[0], O_RDONLY); if (fd == -1) - err(1, "open bus"); + err(EXIT_FAILURE, "Can't open bus file `%s'", argv[0]); if (fstat(fd, ) == -1) - err(1, "stat"); + err(EXIT_FAILURE, "Can't stat bus file `%s'", argv[0]); - busmem = mmap(NULL, sb.st_size, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0); + busmem = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_FILE|MAP_SHARED, + fd, 0); if (busmem == MAP_FAILED) - err(1, "mmap"); + err(EXIT_FAILURE, "mmap"); bmem = busmem; if (bmem->shm_magic != SHMIF_MAGIC) { if (bmem->shm_magic != swp32(SHMIF_MAGIC)) - errx(1, "%s not a shmif bus", argv[0]); + errx(EXIT_FAILURE, "%s not a shmif bus: " + "bad magic %#x != %#x", argv[0], bmem->shm_magic, + SHMIF_MAGIC); doswap = true; } - if (FIXENDIAN32(bmem->shm_version) != SHMIF_VERSION) { - if (FIXENDIAN32(bmem->shm_version) != 2) { - errx(1, "bus version %d, program %d", - FIXENDIAN32(bmem->shm_version), SHMIF_VERSION); - } - useversion = 2; - } else { - useversion = 3; + useversion = FIXENDIAN32(bmem->shm_version); + switch (useversion) { + case 2: + case SHMIF_VERSION: + break; + default: + errx(EXIT_FAILURE, "Unhandled bus version %d, program %d", + useversion, SHMIF_VERSION); } if (pcapfile && strcmp(pcapfile, "-") == 0) @@ -194,8 +198,11 @@ main(int argc, char *argv[]) if (pcapfile) { pcap_t *pcap = pcap_open_dead(DLT_EN10MB, 1518); pdump = pcap_dump_open(pcap, pcapfile); - if (pdump == NULL) - err(1, "cannot open pcap dump file"); + if (pdump == NULL) { + errx(EXIT_FAILURE, + "Cannot open pcap dump file `%s': %s", pcapfile, + pcap_geterr(pcap)); + } } else { /* XXXgcc */ pdump = NULL; @@ -252,8 +259,8 @@ main(int argc, char *argv[]) } fprintf(dumploc, "packet %d, offset 0x%04x, length 0x%04x, " - "ts %d/%06d\n", i++, curbus, curlen, - sp_sec, sp_usec); + "ts %d/%06d\n", i++, curbus, curlen, + sp_sec, sp_usec); if (!pcapfile) { curbus = shmif_busread(bmem, @@ -266,7 +273,7 @@ main(int argc, char *argv[]) memset(, 0, sizeof(packhdr)); packhdr.caplen = packhdr.len = curlen; packhdr.ts.tv_sec = sp_sec; - packhdr.ts.tv_usec = sp_usec; + packhdr.ts.tv_usec = (suseconds_t)sp_usec; assert(curlen <= BUFSIZE); curbus = shmif_busread(bmem, buf, curbus, curlen, ); @@ -278,5 +285,5 @@ main(int argc, char *argv[]) if (pcapfile) pcap_dump_close(pdump); - return 0; + return EXIT_SUCCESS; }
CVS commit: src/usr.bin/shmif_dumpbus
Module Name:src Committed By: christos Date: Wed Apr 1 21:04:34 UTC 2020 Modified Files: src/usr.bin/shmif_dumpbus: shmif_dumpbus.c Log Message: improve error messages, minor cleanups. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/shmif_dumpbus/shmif_dumpbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/rockchip
Module Name:src Committed By: tnn Date: Wed Apr 1 20:37:32 UTC 2020 Modified Files: src/sys/arch/arm/rockchip: rk_spi.c Log Message: Don't fail if we cannot compute the clock divider because the master clock is too slow for what the slave device requested. Instead warn and select the highest available slave clock rate. Should fix boot hang on Pinebook Pro when using spiflash(4). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_spi.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/arch/arm/rockchip/rk_spi.c diff -u src/sys/arch/arm/rockchip/rk_spi.c:1.3 src/sys/arch/arm/rockchip/rk_spi.c:1.4 --- src/sys/arch/arm/rockchip/rk_spi.c:1.3 Tue Aug 13 17:15:55 2019 +++ src/sys/arch/arm/rockchip/rk_spi.c Wed Apr 1 20:37:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_spi.c,v 1.3 2019/08/13 17:15:55 tnn Exp $ */ +/* $NetBSD: rk_spi.c,v 1.4 2020/04/01 20:37:32 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.3 2019/08/13 17:15:55 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.4 2020/04/01 20:37:32 tnn Exp $"); #include #include @@ -277,8 +277,12 @@ rk_spi_configure(void *cookie, int slave uint16_t divider; divider = (sc->sc_spi_freq / speed) & ~1; - if (divider < 2) - return EINVAL; + if (divider < 2) { + aprint_error_dev(sc->sc_dev, + "spi_clk %u is too low for speed %u, using speed %u\n", + sc->sc_spi_freq, speed, sc->sc_spi_freq / 2); + divider = 2; + } if (slave >= sc->sc_spi.sct_nslaves) return EINVAL;
CVS commit: src/sys/arch/arm/rockchip
Module Name:src Committed By: tnn Date: Wed Apr 1 20:37:32 UTC 2020 Modified Files: src/sys/arch/arm/rockchip: rk_spi.c Log Message: Don't fail if we cannot compute the clock divider because the master clock is too slow for what the slave device requested. Instead warn and select the highest available slave clock rate. Should fix boot hang on Pinebook Pro when using spiflash(4). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_spi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: is Date: Wed Apr 1 20:24:50 UTC 2020 Modified Files: src/sys/net: if_spppsubr.c Log Message: Define a few more LCP options. Recognize, sanity-check and report (but still reject for the moment) multilink PPP configuration options received. To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: is Date: Wed Apr 1 20:24:50 UTC 2020 Modified Files: src/sys/net: if_spppsubr.c Log Message: Define a few more LCP options. Recognize, sanity-check and report (but still reject for the moment) multilink PPP configuration options received. To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/sys/net/if_spppsubr.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/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.187 src/sys/net/if_spppsubr.c:1.188 --- src/sys/net/if_spppsubr.c:1.187 Fri Mar 6 10:26:59 2020 +++ src/sys/net/if_spppsubr.c Wed Apr 1 20:24:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.187 2020/03/06 10:26:59 knakahara Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.188 2020/04/01 20:24:50 is Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187 2020/03/06 10:26:59 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.188 2020/04/01 20:24:50 is Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -146,6 +146,13 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr. #define LCP_OPT_RESERVED 6 /* reserved */ #define LCP_OPT_PROTO_COMP 7 /* protocol field compression */ #define LCP_OPT_ADDR_COMP 8 /* address/control field compression */ +#define LCP_OPT_FCS_ALTS 9 /* FCS alternatives */ +#define LCP_OPT_SELF_DESC_PAD 10 /* self-describing padding */ +#define LCP_OPT_CALL_BACK 13 /* callback */ +#define LCP_OPT_COMPOUND_FRMS 15 /* compound frames */ +#define LCP_OPT_MP_MRRU 17 /* multilink MRRU */ +#define LCP_OPT_MP_SSNHF 18 /* multilink short seq. numbers */ +#define LCP_OPT_MP_EID 19 /* multilink endpoint discriminator */ #define IPCP_OPT_ADDRESSES 1 /* both IP addresses; deprecated */ #define IPCP_OPT_COMPRESSION 2 /* IP compression protocol */ @@ -2374,6 +2381,36 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp if (debug) addlog(" [invalid]"); break; + case LCP_OPT_MP_EID: + if (len >= l && l >= 3) { +if (debug) + addlog(" [rej]"); +break; + } + if (debug) +addlog(" [invalid]"); + break; + case LCP_OPT_MP_SSNHF: + if (len >= 2 && l == 2) { +if (debug) + addlog(" [rej]"); +break; + } + if (debug) +addlog(" [invalid]"); + break; + case LCP_OPT_MP_MRRU: + /* Multilink maximum received reconstructed unit */ + /* should be fall through, both are same length */ + /* for now, check, then reject anyway */ + if (len >= 4 && l == 4) { +if (debug) + addlog(" %d [rej]", (p[2] <<8) + p[3]); +break; + } + if (debug) +addlog(" [invalid]"); + break; case LCP_OPT_MRU: /* Maximum receive unit. */ if (len >= 4 && l == 4) @@ -6016,6 +6053,12 @@ sppp_lcp_opt_name(u_char opt) case LCP_OPT_MAGIC: return "magic"; case LCP_OPT_PROTO_COMP: return "proto-comp"; case LCP_OPT_ADDR_COMP: return "addr-comp"; + case LCP_OPT_SELF_DESC_PAD: return "sdpad"; + case LCP_OPT_CALL_BACK: return "callback"; + case LCP_OPT_COMPOUND_FRMS: return "cmpd-frms"; + case LCP_OPT_MP_MRRU: return "mrru"; + case LCP_OPT_MP_SSNHF: return "mp-ssnhf"; + case LCP_OPT_MP_EID: return "mp-eid"; } snprintf(buf, sizeof(buf), "0x%x", opt); return buf;
CVS commit: src/sys/dev/isa
Module Name:src Committed By: ad Date: Wed Apr 1 18:34:22 UTC 2020 Modified Files: src/sys/dev/isa: nct.c Log Message: Newer PC Engines BIOS versions don't set up the Super I/O for GPIO the way we want so ignore most of the existing settings and enable banks 0 and 1. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/isa/nct.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/isa
Module Name:src Committed By: ad Date: Wed Apr 1 18:34:22 UTC 2020 Modified Files: src/sys/dev/isa: nct.c Log Message: Newer PC Engines BIOS versions don't set up the Super I/O for GPIO the way we want so ignore most of the existing settings and enable banks 0 and 1. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/isa/nct.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/dev/isa/nct.c diff -u src/sys/dev/isa/nct.c:1.2 src/sys/dev/isa/nct.c:1.3 --- src/sys/dev/isa/nct.c:1.2 Sat Nov 16 15:38:43 2019 +++ src/sys/dev/isa/nct.c Wed Apr 1 18:34:22 2020 @@ -1,7 +1,7 @@ -/* $NetBSD: nct.c,v 1.2 2019/11/16 15:38:43 martin Exp $ */ +/* $NetBSD: nct.c,v 1.3 2020/04/01 18:34:22 ad Exp $ */ /*- - * Copyright (c) 2019 The NetBSD Foundation, Inc. + * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -37,14 +37,14 @@ * - UARTS: handled by com driver. 3rd & 4th UARTs use GPIO pins. * * If asked to probe with a wildcard address, we'll only do so if known to - * be running on a PC Engines APU board. Probe is invasive. + * be running on a PC Engines system. Probe is invasive. * * Register access on Super I/O chips typically involves one or two levels * of indirection, so we try hard to avoid needless register access. */ #include -__KERNEL_RCSID(0, "$NetBSD: nct.c,v 1.2 2019/11/16 15:38:43 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nct.c,v 1.3 2020/04/01 18:34:22 ad Exp $"); #include #include @@ -69,7 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: nct.c,v 1.2 #define NCT_IOBASE_B 0x4e #define NCT_IOSIZE 2 #define NCT_CHIP_ID_1 0x1061 -#define NCT_CHIP_ID_2 0xc452 /* PC Engines APU1 */ +#define NCT_CHIP_ID_2 0xc452 /* PC Engines APU */ #define NCT_NUM_PINS 17 /* Enable/disable keys */ @@ -241,20 +241,18 @@ nct_match(device_t parent, cfdata_t matc int nioaddr, i; u_int8_t low, high; u_int16_t id; - const char *vendor, *product; + const char *vendor; /* * Allow override of I/O base address. If no I/O base address is - * provided, proceed to probe if running on a PC Engines APU. + * provided, proceed to probe if running on a PC Engines system. */ if (ia->ia_nio > 0 && ia->ia_io[0].ir_addr != ISA_UNKNOWN_PORT) { ioaddrs[0] = ia->ia_io[0].ir_addr; nioaddr = 1; } else { vendor = pmf_get_platform("system-vendor"); - product = pmf_get_platform("system-product"); - if (vendor != NULL && strcmp(vendor, "PC Engines") == 0 && - product != NULL && strcmp(product, "APU") == 0) { + if (vendor != NULL && strstr(vendor, "PC Engines") != NULL) { nioaddr = __arraycount(ioaddrs); } else { nioaddr = 0; @@ -305,7 +303,6 @@ nct_attach(device_t parent, device_t sel struct gpiobus_attach_args gba; struct nct_bank *nb; u_int8_t multifun, enable; - bool apu; int i, j; /* @@ -321,8 +318,6 @@ nct_attach(device_t parent, device_t sel sc->sc_iot = ia->ia_iot; sc->sc_curdev = -1; sc->sc_curreg = -1; - apu = ((strcmp(pmf_get_platform("system-vendor"), "PC Engines") | - strcmp(pmf_get_platform("system-product"), "APU")) == 0); /* * All pin access is funneled through a common, indirect register @@ -342,45 +337,38 @@ nct_attach(device_t parent, device_t sel nct_wr(sc, LD8_DEVCFG, 0); /* - * Fill out descriptions of GPIO0, GPIO1 and GPIO67. - * Determine which banks and pins are enabled. + * The BIOS doesn't set things up the way we want. Pfft. + * Enable all GPIO0/GPIO1 pins. */ multifun = nct_rd(sc, GD_MULTIFUN); - enable = nct_rd(sc, LD7_ENABLE); + nct_wr(sc, GD_MULTIFUN, + multifun & ~(GD_MULTIFUN_GPIO0 | GD_MULTIFUN_GPIO1)); + nct_wr(sc, LDA_UARTC_ENABLE, 0); + nct_wr(sc, LD8_GPIO0_MULTIFUNC, 0); + nct_wr(sc, LDB_UARTD_ENABLE, 0); + nct_wr(sc, LD8_GPIO1_MULTIFUNC, 0); + multifun = nct_rd(sc, GD_MULTIFUN); + enable = nct_rd(sc, LD7_ENABLE) | LD7_ENABLE_GPIO0 | LD7_ENABLE_GPIO1; nb = >sc_bank[0]; nb->nb_firstpin = 0; nb->nb_numpins = 8; + nb->nb_enabled = 0xff; nb->nb_reg_dir = LD7_GPIO0_DIRECTION; nb->nb_reg_data = LD7_GPIO0_DATA; nb->nb_reg_inv = LD7_GPIO0_INVERSION; nb->nb_reg_stat = LD7_GPIO0_STATUS; nb->nb_reg_mode = LDF_GPIO0_OUTMODE; - if ((multifun & GD_MULTIFUN_GPIO0) == 0 && - ((nct_rd(sc, LDA_UARTC_ENABLE) & 1) == 0 || apu)) { - nct_wr(sc, LD8_GPIO0_MULTIFUNC, 0); - nb->nb_enabled = 0xff; - enable |= LD7_ENABLE_GPIO0; - } else { - sc->sc_bank[0].nb_enabled = 0; - } - + nb = >sc_bank[1]; nb->nb_firstpin = 8; nb->nb_numpins = 8; + nb->nb_enabled = 0xff; nb->nb_reg_dir = LD7_GPIO1_DIRECTION; nb->nb_reg_data = LD7_GPIO1_DATA; nb->nb_reg_inv = LD7_GPIO1_INVERSION; nb->nb_reg_stat = LD7_GPIO1_STATUS; nb->nb_reg_mode = LDF_GPIO1_OUTMODE; - if ((multifun & GD_MULTIFUN_GPIO1) == 0 && - (nct_rd(sc,
Re: CVS commit: src/lib/librumpuser
On 01.04.2020 17:06, Robert Elz wrote: > Date:Wed, 1 Apr 2020 15:54:15 +0200 > From:Kamil Rytarowski > Message-ID: <969362d2-d93e-2cf4-7437-ab593ab11...@gmx.com> > > | Ping? This still breaks. > > I am still working on it.Best I can tell at the minute is that the \0 > is potentially needed (in a theoretical sense) but not by anything > operating rationally. > > That is, when rump is used the strings will already always be \0 terminated > and the extra one added (the one that is off the end of the array) is never > needed, there's always an earlier one. > > However, the relevant struct (that contains the string) comes from some > other process, and while if that process is running rump code, which is > what is intended to happen, all will be OK (I believe, I am not finished > checking all of that code), if it is something else, generating rump > packets, and passing them through, then we have no idea what will > be there, and the \0 termination cannot be guaranteed (and if we don't > do something, the rump process will eventually do bizarre things, that > out of the array \0 is currently preventing that possibility). > > I see two reasonable paths forward here: > > 1. instead of adding the \0 off the end of the array, check that the > array is already \0 terminated (it should be, and always is in the ATF > test uses of rump - I ran the tests with a check in place, and it never > failed) - the \0 is always in the final byte of the array (the one you > overwrote in your earlier change, which meant that the changed line was > just a no-op, in practice, as suspected earlier.) > > 2. When we are reading an exec rump struct, allocate (and zero - the zero > part is already present) 1 byte more than will be received from the > sending process, so that the final byte will always remain as a \0, and > we will absolutely guarantee that the string will be \0 terminated (in > all normal cases it would end up terminated by two \0's). > > If we do either of these, we don't need to waste time verifying that rump > always does send (in every case) a \0 terminated string (digging through the > code to work out where some of these structs get built is a slow process) > as the actual problem will be solved either way. > > Solution 1 makes it an error, and the rup process will fail the exec if > the path isn't correctly \0 terminated. Solution 2 does what the code > currently does (effectively) adding a \0 beyond the string that is received > from the sending process, but does it within the array bounds (by making the > array bigger) rather than outside them. > > Opinions for which is better? > Going for 2. is a little bit safer and we can reduce researching corner cases that might never happen anyway. > kre >
Re: CVS commit: src/sys/modules/examples/fopsmapper
> Date: Wed, 1 Apr 2020 07:42:53 -0700 > From: Jason Thorpe > > If PAGE_SIZE is ostensibly a vsize_t / size_t, why not define it as (1U << > PAGE_SHIFT)? Without running the following program, can you tell me what it will print? It might work to define PAGE_SIZE to be ((size_t)1 << PAGE_SHIFT) but the consequences are not immediately clear to me (and might be tricky on, e.g., i386pae). #include #include #include #define PAGE_SIZE_S (1 << 12) #define PAGE_SIZE_U (1u << 12) uint64_taddr = 0x7fff01234567; int main(void) { printf("%"PRIx64"\n", addr & ~(PAGE_SIZE_S - 1)); printf("%"PRIx64"\n", addr & ~(PAGE_SIZE_U - 1)); fflush(stdout); return ferror(stdout); }
Re: CVS commit: src/sys/modules/examples/fopsmapper
I think that PAGESIZE is not always a constant in our code. christos signature.asc Description: Message signed with OpenPGP
CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio
Module Name:src Committed By: msaitoh Date: Wed Apr 1 15:57:46 UTC 2020 Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio: nouveau_nvkm_subdev_gpio_base.c Log Message: Calculate mask correctly for bit 31 in nvkm_gpio_fini(). Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_base.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/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_base.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_base.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_base.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_base.c:1.2 Mon Aug 27 04:58:34 2018 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_base.c Wed Apr 1 15:57:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_nvkm_subdev_gpio_base.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $ */ +/* $NetBSD: nouveau_nvkm_subdev_gpio_base.c,v 1.3 2020/04/01 15:57:46 msaitoh Exp $ */ /* * Copyright 2011 Red Hat Inc. @@ -24,7 +24,7 @@ * Authors: Ben Skeggs */ #include -__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_gpio_base.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_gpio_base.c,v 1.3 2020/04/01 15:57:46 msaitoh Exp $"); #include "priv.h" @@ -169,7 +169,7 @@ static int nvkm_gpio_fini(struct nvkm_subdev *subdev, bool suspend) { struct nvkm_gpio *gpio = nvkm_gpio(subdev); - u32 mask = (1 << gpio->func->lines) - 1; + u32 mask = (1ULL << gpio->func->lines) - 1; gpio->func->intr_mask(gpio, NVKM_GPIO_TOGGLED, mask, 0); gpio->func->intr_stat(gpio, , );
CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio
Module Name:src Committed By: msaitoh Date: Wed Apr 1 15:57:46 UTC 2020 Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio: nouveau_nvkm_subdev_gpio_base.c Log Message: Calculate mask correctly for bit 31 in nvkm_gpio_fini(). Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_base.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/modules/examples/fopsmapper
Date:Wed, 1 Apr 2020 16:31:01 +0200 From:Kamil Rytarowski Message-ID: | Does it look better? | | http://netbsd.org/~kamil/patch-00244-fopsmapper-PAGE_SIZE.txt Apart from it needing to be (expressed in the relevant make syntax, whatever that is) if (WARNS > 3) WARNE=3 rather than simply WARNS=3 then as a hack type fix that looks fine. But this is really a gcc bug, we shouldn't be needing to change our sources at all because of this. The signed vs unsigned comparison warning is because if the signed number happens to be negative, when treated as unsigned it will compare larger (usually) than the unsigned value - whereas most people expect negative numbers to be less than positive ones (whatever the magnitudes). Warning for that potential problem is entirely reasonable. But here we have a known positive (though signed) constant. It can never magically become negative, and so the problem can never exist. There should not (ever) be a warning for this case, it is simply stupid, and we should not need to modify either code, or makefiles, to make it go away. kre
CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev
Module Name:src Committed By: msaitoh Date: Wed Apr 1 15:55:52 UTC 2020 Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio: nouveau_nvkm_subdev_gpio_nv50.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c: nouveau_nvkm_subdev_i2c_g94.c Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_nv50.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_g94.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/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_nv50.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_nv50.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_nv50.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_nv50.c:1.2 Mon Aug 27 04:58:34 2018 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_nv50.c Wed Apr 1 15:55:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_nvkm_subdev_gpio_nv50.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $ */ +/* $NetBSD: nouveau_nvkm_subdev_gpio_nv50.c,v 1.3 2020/04/01 15:55:52 msaitoh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -24,7 +24,7 @@ * Authors: Ben Skeggs */ #include -__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_gpio_nv50.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_gpio_nv50.c,v 1.3 2020/04/01 15:55:52 msaitoh Exp $"); #include "priv.h" @@ -55,7 +55,7 @@ nv50_gpio_reset(struct nvkm_gpio *gpio, nvkm_gpio_set(gpio, 0, func, line, defs); - nvkm_mask(device, reg, 0x00010001 << lsh, val << lsh); + nvkm_mask(device, reg, 0x00010001U << lsh, val << lsh); } } Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_g94.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_g94.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_g94.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_g94.c:1.2 Mon Aug 27 04:58:34 2018 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_g94.c Wed Apr 1 15:55:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_nvkm_subdev_i2c_g94.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $ */ +/* $NetBSD: nouveau_nvkm_subdev_i2c_g94.c,v 1.3 2020/04/01 15:55:52 msaitoh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -24,7 +24,7 @@ * Authors: Ben Skeggs */ #include -__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_i2c_g94.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_i2c_g94.c,v 1.3 2020/04/01 15:55:52 msaitoh Exp $"); #include "priv.h" #include "pad.h" @@ -39,7 +39,7 @@ g94_aux_stat(struct nvkm_i2c *i2c, u32 * if ((stat & (1 << (i * 4 *hi |= 1 << i; if ((stat & (2 << (i * 4 *lo |= 1 << i; if ((stat & (4 << (i * 4 *rq |= 1 << i; - if ((stat & (8 << (i * 4 *tx |= 1 << i; + if ((stat & (8U << (i * 4 *tx |= 1 << i; } nvkm_wr32(device, 0x00e06c, intr); }
CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev
Module Name:src Committed By: msaitoh Date: Wed Apr 1 15:55:52 UTC 2020 Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio: nouveau_nvkm_subdev_gpio_nv50.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c: nouveau_nvkm_subdev_i2c_g94.c Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/gpio/nouveau_nvkm_subdev_gpio_nv50.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c/nouveau_nvkm_subdev_i2c_g94.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Wed Apr 1 15:54:07 UTC 2020 Modified Files: src/sys/dev/pci: pcidevs.h pcidevs_data.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.1390 -r1.1391 src/sys/dev/pci/pcidevs.h cvs rdiff -u -r1.1389 -r1.1390 src/sys/dev/pci/pcidevs_data.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Wed Apr 1 15:53:36 UTC 2020 Modified Files: src/sys/dev/pci: pcidevs Log Message: Add NVIDIA Quadro NVS 295. To generate a diff of this commit: cvs rdiff -u -r1.1402 -r1.1403 src/sys/dev/pci/pcidevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Wed Apr 1 15:53:36 UTC 2020 Modified Files: src/sys/dev/pci: pcidevs Log Message: Add NVIDIA Quadro NVS 295. To generate a diff of this commit: cvs rdiff -u -r1.1402 -r1.1403 src/sys/dev/pci/pcidevs 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/pci/pcidevs diff -u src/sys/dev/pci/pcidevs:1.1402 src/sys/dev/pci/pcidevs:1.1403 --- src/sys/dev/pci/pcidevs:1.1402 Wed Mar 11 16:13:13 2020 +++ src/sys/dev/pci/pcidevs Wed Apr 1 15:53:35 2020 @@ -1,4 +1,4 @@ -$NetBSD: pcidevs,v 1.1402 2020/03/11 16:13:13 msaitoh Exp $ +$NetBSD: pcidevs,v 1.1403 2020/04/01 15:53:35 msaitoh Exp $ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -6610,6 +6610,7 @@ product NVIDIA GEFORCE8400GS 0x06e4 GeFo product NVIDIA GEFORCE9300M_GS 0x06e9 GeForce 9300M GS product NVIDIA QUADRONVS150 0x06ea Quadro NVS 150m product NVIDIA QUADRONVS160 0x06eb Quadro NVS 160m +product NVIDIA QUADRONVS295 0x06fd Quadro NVS 295 product NVIDIA MCP78S_SMB 0x0752 nForce MCP78S SMBus Controller product NVIDIA MCP77_IDE 0x0759 nForce MCP77 ATA133 IDE Controller product NVIDIA MCP77_LAN1 0x0760 nForce MCP77 Gigabit Ethernet Controller
CVS commit: src/share/man/man4
Module Name:src Committed By: gson Date: Wed Apr 1 15:42:15 UTC 2020 Modified Files: src/share/man/man4: qemufwcfg.4 Log Message: Fix incorrect device path. OK jmcneill. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/qemufwcfg.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: gson Date: Wed Apr 1 15:42:15 UTC 2020 Modified Files: src/share/man/man4: qemufwcfg.4 Log Message: Fix incorrect device path. OK jmcneill. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/qemufwcfg.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/qemufwcfg.4 diff -u src/share/man/man4/qemufwcfg.4:1.5 src/share/man/man4/qemufwcfg.4:1.6 --- src/share/man/man4/qemufwcfg.4:1.5 Wed Jul 11 13:49:06 2018 +++ src/share/man/man4/qemufwcfg.4 Wed Apr 1 15:42:15 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: qemufwcfg.4,v 1.5 2018/07/11 13:49:06 jmcneill Exp $ +.\" $NetBSD: qemufwcfg.4,v 1.6 2020/04/01 15:42:15 gson Exp $ .\" .\" Copyright (c) 2017 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -24,7 +24,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 11, 2018 +.Dd April 1, 2020 .Dt QEMUFWCFG 4 .Os .Sh NAME @@ -46,7 +46,7 @@ option in the man page. .Sh FILES .Bl -tag -width 20n -.It Pa /dev/qemufwctl +.It Pa /dev/qemufwcfg device path .El .Sh SEE ALSO
CVS commit: src/share/man/man8
Module Name:src Committed By: gson Date: Wed Apr 1 15:33:50 UTC 2020 Modified Files: src/share/man/man8: MAKEDEV.8 Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/share/man/man8/MAKEDEV.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/MAKEDEV.8 diff -u src/share/man/man8/MAKEDEV.8:1.56 src/share/man/man8/MAKEDEV.8:1.57 --- src/share/man/man8/MAKEDEV.8:1.56 Wed Jan 29 18:39:05 2020 +++ src/share/man/man8/MAKEDEV.8 Wed Apr 1 15:33:50 2020 @@ -6,7 +6,7 @@ .\" *** DO NOT EDIT - any changes will be lost!!! .\" *** -- .\" -.\" $NetBSD: MAKEDEV.8,v 1.56 2020/01/29 18:39:05 maya Exp $ +.\" $NetBSD: MAKEDEV.8,v 1.57 2020/04/01 15:33:50 gson Exp $ .\" .\" Copyright (c) 2001, 2003, 2007, 2008 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,7 +35,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 29, 2020 +.Dd April 1, 2020 .Dt MAKEDEV 8 .Os .Sh NAME @@ -803,6 +803,9 @@ Pass-to-Userspace Transporter . It Ar px# PixelStamp Xserver access, see .Xr \ 4 +. It Ar qemufwcfg# +QEMU Firmware Configuration, see +.Xr \ 4 . It Ar radio# Radio devices, see .Xr \ 4
CVS commit: src/share/man/man8
Module Name:src Committed By: gson Date: Wed Apr 1 15:33:50 UTC 2020 Modified Files: src/share/man/man8: MAKEDEV.8 Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/share/man/man8/MAKEDEV.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/etc
Module Name:src Committed By: gson Date: Wed Apr 1 15:32:21 UTC 2020 Modified Files: src/etc: MAKEDEV.tmpl Log Message: Create the qemufwcfg device as part of "all". Discussed with jmcneill. Also, include it in the list of special purpose devices. To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/etc/MAKEDEV.tmpl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/MAKEDEV.tmpl diff -u src/etc/MAKEDEV.tmpl:1.216 src/etc/MAKEDEV.tmpl:1.217 --- src/etc/MAKEDEV.tmpl:1.216 Mon Mar 2 15:49:30 2020 +++ src/etc/MAKEDEV.tmpl Wed Apr 1 15:32:21 2020 @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: MAKEDEV.tmpl,v 1.216 2020/03/02 15:49:30 riastradh Exp $ +# $NetBSD: MAKEDEV.tmpl,v 1.217 2020/04/01 15:32:21 gson Exp $ # # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -265,6 +265,7 @@ # pf PF packet filter # putter Pass-to-Userspace Transporter # px* PixelStamp Xserver access +# qemufwcfg* QEMU Firmware Configuration # radio* radio devices # random Random number generator # rtc* RealTimeClock @@ -845,6 +846,7 @@ all) makedev autofs makedev fw0 fw1 fw2 fw3 makedev ipmi0 + makedev qemufwcfg makedev local # do this last ;;
CVS commit: src/etc
Module Name:src Committed By: gson Date: Wed Apr 1 15:32:21 UTC 2020 Modified Files: src/etc: MAKEDEV.tmpl Log Message: Create the qemufwcfg device as part of "all". Discussed with jmcneill. Also, include it in the list of special purpose devices. To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/etc/MAKEDEV.tmpl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/modules/examples/fopsmapper
> If PAGE_SIZE is ostensibly a vsize_t / size_t, why not define it as (1U << > PAGE_SHIFT)? It will *probably* work unless we have 'if (negative_int > PAGESIZE)' somewhere. I guess if you make the change and the kernel boots... :-) christos signature.asc Description: Message signed with OpenPGP
Re: CVS commit: src/lib/librumpuser
Date:Wed, 1 Apr 2020 15:54:15 +0200 From:Kamil Rytarowski Message-ID: <969362d2-d93e-2cf4-7437-ab593ab11...@gmx.com> | Ping? This still breaks. I am still working on it.Best I can tell at the minute is that the \0 is potentially needed (in a theoretical sense) but not by anything operating rationally. That is, when rump is used the strings will already always be \0 terminated and the extra one added (the one that is off the end of the array) is never needed, there's always an earlier one. However, the relevant struct (that contains the string) comes from some other process, and while if that process is running rump code, which is what is intended to happen, all will be OK (I believe, I am not finished checking all of that code), if it is something else, generating rump packets, and passing them through, then we have no idea what will be there, and the \0 termination cannot be guaranteed (and if we don't do something, the rump process will eventually do bizarre things, that out of the array \0 is currently preventing that possibility). I see two reasonable paths forward here: 1. instead of adding the \0 off the end of the array, check that the array is already \0 terminated (it should be, and always is in the ATF test uses of rump - I ran the tests with a check in place, and it never failed) - the \0 is always in the final byte of the array (the one you overwrote in your earlier change, which meant that the changed line was just a no-op, in practice, as suspected earlier.) 2. When we are reading an exec rump struct, allocate (and zero - the zero part is already present) 1 byte more than will be received from the sending process, so that the final byte will always remain as a \0, and we will absolutely guarantee that the string will be \0 terminated (in all normal cases it would end up terminated by two \0's). If we do either of these, we don't need to waste time verifying that rump always does send (in every case) a \0 terminated string (digging through the code to work out where some of these structs get built is a slow process) as the actual problem will be solved either way. Solution 1 makes it an error, and the rup process will fail the exec if the path isn't correctly \0 terminated. Solution 2 does what the code currently does (effectively) adding a \0 beyond the string that is received from the sending process, but does it within the array bounds (by making the array bigger) rather than outside them. Opinions for which is better? kre
Re: CVS commit: src/sys/modules/examples/fopsmapper
> On Apr 1, 2020, at 7:17 AM, Christos Zoulas wrote: > > Which we have been slowly fixing. I think in this case the sign-compare > warnings are annoying, but putting casts on each warning is cluttering > the code needlessly. Unfortunately the alternative (to make the PAGESIZE > constant unsigned is more dangerous -- unless of course you are willing to > examine all the places it is used and make sure that the semantics don't > change). Another way would be to make: > >#define PAGESIZE_U ((unsigned)PAGESIZE) If PAGE_SIZE is ostensibly a vsize_t / size_t, why not define it as (1U << PAGE_SHIFT)? -- thorpej
Re: CVS commit: src/sys/modules/examples/fopsmapper
On 01.04.2020 16:17, Christos Zoulas wrote: > In article , > Paul Goyette wrote: >> On Wed, 1 Apr 2020, Kamil Rytarowski wrote: >> >>> On 01.04.2020 15:47, Robert Elz wrote: Date:Wed, 1 Apr 2020 11:45:53 + From:"Kamil Rytarowski" Message-ID: <20200401114554.05167f...@cvs.netbsd.org> | Log Message: | Avoid comparison between signed and unsigned integer | | Cast PAGE_SIZE to size_t. This kind of pedantry is going way too far, PAGE_SIZE is a compile time constant (1 << PAGE_SHIFT) which is an int (and so signed, nominally) but one which is known to be positive. >>> >>> I got reports that certain ports no longer build due to: >>> >>> src/sys/modules/examples/fopsmapper/fopsmapper.c:118:11: error: >>> comparison between signed and unsigned integer expressions >>> [-Werror=sign-compare] >>> if (size != PAGE_SIZE) >>> ^~ >>> cc1: all warnings being treated as errors >> >> >> There's a lot of modules that fail for this with WARNS=5 when being >> built as loadable modules. >> >> That's why so many of the individual module Makefiles have explicit >> WARNS=4. (It seems that when modules are built-in as part of the >> kernel, they are by default built with WARNS=4.) > > Which we have been slowly fixing. I think in this case the sign-compare > warnings are annoying, but putting casts on each warning is cluttering > the code needlessly. Unfortunately the alternative (to make the PAGESIZE > constant unsigned is more dangerous -- unless of course you are willing to > examine all the places it is used and make sure that the semantics don't > change). Another way would be to make: > > #define PAGESIZE_U ((unsigned)PAGESIZE) > > and use that instead; eventually when all instances of PAGESIZE have been > converted to PAGESIZE_U it can be removed. But is it worth it? There are > perhaps better things to do. But anyway you want to proceed should be > discussed in tech-kern. Adding piecemeal casts everywhere does not make > the world a better place. > > christos > Does it look better? http://netbsd.org/~kamil/patch-00244-fopsmapper-PAGE_SIZE.txt Perhaps we could switch PAGE_SIZE to unsigned.. but it is too much for now.
Re: CVS commit: src/sys/modules/examples/fopsmapper
In article , Paul Goyette wrote: >On Wed, 1 Apr 2020, Kamil Rytarowski wrote: > >> On 01.04.2020 15:47, Robert Elz wrote: >>> Date:Wed, 1 Apr 2020 11:45:53 + >>> From:"Kamil Rytarowski" >>> Message-ID: <20200401114554.05167f...@cvs.netbsd.org> >>> >>> | Log Message: >>> | Avoid comparison between signed and unsigned integer >>> | >>> | Cast PAGE_SIZE to size_t. >>> >>> This kind of pedantry is going way too far, PAGE_SIZE is a compile >>> time constant (1 << PAGE_SHIFT) which is an int (and so signed, >>> nominally) but one which is known to be positive. >>> >> >> I got reports that certain ports no longer build due to: >> >> src/sys/modules/examples/fopsmapper/fopsmapper.c:118:11: error: >> comparison between signed and unsigned integer expressions >> [-Werror=sign-compare] >> if (size != PAGE_SIZE) >> ^~ >> cc1: all warnings being treated as errors > > >There's a lot of modules that fail for this with WARNS=5 when being >built as loadable modules. > >That's why so many of the individual module Makefiles have explicit >WARNS=4. (It seems that when modules are built-in as part of the >kernel, they are by default built with WARNS=4.) Which we have been slowly fixing. I think in this case the sign-compare warnings are annoying, but putting casts on each warning is cluttering the code needlessly. Unfortunately the alternative (to make the PAGESIZE constant unsigned is more dangerous -- unless of course you are willing to examine all the places it is used and make sure that the semantics don't change). Another way would be to make: #define PAGESIZE_U ((unsigned)PAGESIZE) and use that instead; eventually when all instances of PAGESIZE have been converted to PAGESIZE_U it can be removed. But is it worth it? There are perhaps better things to do. But anyway you want to proceed should be discussed in tech-kern. Adding piecemeal casts everywhere does not make the world a better place. christos
Re: CVS commit: src/sys/modules/examples/fopsmapper
On 01.04.2020 16:10, Paul Goyette wrote: > On Wed, 1 Apr 2020, Kamil Rytarowski wrote: > >> On 01.04.2020 15:47, Robert Elz wrote: >>> Date: Wed, 1 Apr 2020 11:45:53 + >>> From: "Kamil Rytarowski" >>> Message-ID: <20200401114554.05167f...@cvs.netbsd.org> >>> >>> | Log Message: >>> | Avoid comparison between signed and unsigned integer >>> | >>> | Cast PAGE_SIZE to size_t. >>> >>> This kind of pedantry is going way too far, PAGE_SIZE is a compile >>> time constant (1 << PAGE_SHIFT) which is an int (and so signed, >>> nominally) but one which is known to be positive. >>> >> >> I got reports that certain ports no longer build due to: >> >> src/sys/modules/examples/fopsmapper/fopsmapper.c:118:11: error: >> comparison between signed and unsigned integer expressions >> [-Werror=sign-compare] >> if (size != PAGE_SIZE) >> ^~ >> cc1: all warnings being treated as errors > > > There's a lot of modules that fail for this with WARNS=5 when being > built as loadable modules. > > That's why so many of the individual module Makefiles have explicit > WARNS=4. (It seems that when modules are built-in as part of the > kernel, they are by default built with WARNS=4.) > I tracked it to WARNS=3 # Rather than our usual WARNS=5, we need to use 3, since there are a # lot of signed-vs-unsigned compares WARNS= 3 Personally I have got no preference. I'm fine with an explicit cast as it is in a single place only needed (hopefully).
Re: CVS commit: src/sys/modules/examples/fopsmapper
On Wed, 1 Apr 2020, Kamil Rytarowski wrote: On 01.04.2020 15:47, Robert Elz wrote: Date:Wed, 1 Apr 2020 11:45:53 + From:"Kamil Rytarowski" Message-ID: <20200401114554.05167f...@cvs.netbsd.org> | Log Message: | Avoid comparison between signed and unsigned integer | | Cast PAGE_SIZE to size_t. This kind of pedantry is going way too far, PAGE_SIZE is a compile time constant (1 << PAGE_SHIFT) which is an int (and so signed, nominally) but one which is known to be positive. I got reports that certain ports no longer build due to: src/sys/modules/examples/fopsmapper/fopsmapper.c:118:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if (size != PAGE_SIZE) ^~ cc1: all warnings being treated as errors There's a lot of modules that fail for this with WARNS=5 when being built as loadable modules. That's why so many of the individual module Makefiles have explicit WARNS=4. (It seems that when modules are built-in as part of the kernel, they are by default built with WARNS=4.) ++--+---+ | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | (Retired) | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com | | Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org | ++--+---+
Re: CVS commit: src/lib/librumpuser
On 24.03.2020 19:37, Kamil Rytarowski wrote: > On 24.03.2020 15:41, Robert Elz wrote: >> Date:Tue, 24 Mar 2020 13:27:45 +0100 >> From:Kamil Rytarowski >> Message-ID: <5ec1195a-f1c8-cd46-6a14-ea29da109...@gmx.com> >> >> | I patched it myself only when I reproduced the problems myself. >> >> I have no doubt that there's a bug that needs fixing - it is the fix >> proposed that is wrong. My guess is that most probably it is simply >> doing nothing useful (no harm, no good either) but I need to confirm >> that. If it is, the correct fix is simply to delete the line (both >> times it was changed). If not, there's a more serious problem elsewhere >> that needs fixing elsewhere (after which the line can be deleted!) >> >> | OK. I will do it and please fix it in a better way. >> >> Working on it now. >> > > Thanks. > >> I haven't seen the revert yet, when I do I will commit the fix (or a fix, >> this one is somewhat debatble what is correct, though what is there now >> is obviously wrong ... but just like the one in question, while wrong, it >> is, in practice, harmless, at least in any normal use of librump). >> >> The fix for this issue needs to wait until the real problem the offending >> line is there to deal with (if any, which I suspect is not the case) is >> found. >> > > ASan detects not a hypothetical, but factual momory corruption. > > I'm attaching a report from ASan. > > = > ==11092==ERROR: AddressSanitizer: heap-buffer-overflow on address > 0x6020101e at pc 0x7f7ff6a10419 bp 0x7f7fe942fcb0 sp 0x7f7fe942fca8 > WRITE of size 1 at 0x6020101e thread T30 > #0 0x7f7ff6a10418 in handlereq > /usr/src/lib/librumpuser/rumpuser_sp.c:984:18 > #1 0x7f7ff6a10418 in spserver > /usr/src/lib/librumpuser/rumpuser_sp.c:1280:7 > #2 0x7f7ff660cf36 in pthread__create_tramp > /usr/src/lib/libpthread/pthread.c:587:11 > > 0x6020101e is located 0 bytes to the right of 14-byte region > [0x60201010,0x6020101e) > allocated by thread T30 here: > #0 0x311793 in malloc (/usr/bin/rump_server+0x111793) > #1 0x7f7ff6a0e5bb in readframe > /usr/src/lib/librumpuser/sp_common.c:505:18 > #2 0x7f7ff6a0e5bb in spserver > /usr/src/lib/librumpuser/rumpuser_sp.c:1268:13 > #3 0x7f7ff660cf36 in pthread__create_tramp > /usr/src/lib/libpthread/pthread.c:587:11 > > Thread T30 created by T0 here: > #0 0x2e054d in pthread_create (/usr/bin/rump_server+0xe054d) > > SUMMARY: AddressSanitizer: heap-buffer-overflow > /usr/src/lib/librumpuser/rumpuser_sp.c:984:18 in handlereq > Shadow bytes around the buggy address: > 0x4c0401b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c0401c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c0401d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c0401e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c0401f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > =>0x4c040200: fa fa 00[06]fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c040210: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c040220: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c040230: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c040240: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x4c040250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > Shadow byte legend (one shadow byte represents 8 application bytes): > Addressable: 00 > Partially addressable: 01 02 03 04 05 06 07 > Heap left redzone: fa > Freed heap region: fd > Stack left redzone: f1 > Stack mid redzone: f2 > Stack right redzone: f3 > Stack after return: f5 > Stack use after scope: f8 > Global redzone: f9 > Global init order: f6 > Poisoned by user:f7 > Container overflow: fc > Array cookie:ac > Intra object redzone:bb > ASan internal: fe > Left alloca redzone: ca > Right alloca redzone:cb > Shadow gap: cc > ==11092==ABORTING > > Getting now more debug info is too time consuming (build times are > excessive in my setup). > Ping? This still breaks.
Re: CVS commit: src/sys/modules/examples/fopsmapper
On 01.04.2020 15:47, Robert Elz wrote: > Date:Wed, 1 Apr 2020 11:45:53 + > From:"Kamil Rytarowski" > Message-ID: <20200401114554.05167f...@cvs.netbsd.org> > > | Log Message: > | Avoid comparison between signed and unsigned integer > | > | Cast PAGE_SIZE to size_t. > > This kind of pedantry is going way too far, PAGE_SIZE is a compile > time constant (1 << PAGE_SHIFT) which is an int (and so signed, > nominally) but one which is known to be positive. > I got reports that certain ports no longer build due to: src/sys/modules/examples/fopsmapper/fopsmapper.c:118:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if (size != PAGE_SIZE) ^~ cc1: all warnings being treated as errors
Re: CVS commit: src/sys/modules/examples/fopsmapper
Date:Wed, 1 Apr 2020 11:45:53 + From:"Kamil Rytarowski" Message-ID: <20200401114554.05167f...@cvs.netbsd.org> | Log Message: | Avoid comparison between signed and unsigned integer | | Cast PAGE_SIZE to size_t. This kind of pedantry is going way too far, PAGE_SIZE is a compile time constant (1 << PAGE_SHIFT) which is an int (and so signed, nominally) but one which is known to be positive. What is to be next? Given an unsigned var (any unsigned type) 'u' are we going to be required to write if (u != 0U) or if (u != (unsigned)0) instead of just if (u != 0) ? Get rid of the cast, it isn't needed in this case, and anything that believes it is, is wrong (broken). kre
CVS commit: src/sys/modules/examples/fopsmapper
Module Name:src Committed By: kamil Date: Wed Apr 1 13:07:32 UTC 2020 Modified Files: src/sys/modules/examples/fopsmapper: cmd_mapper.c Log Message: Fix CVS Id To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/fopsmapper/cmd_mapper.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/modules/examples/fopsmapper/cmd_mapper.c diff -u src/sys/modules/examples/fopsmapper/cmd_mapper.c:1.1 src/sys/modules/examples/fopsmapper/cmd_mapper.c:1.2 --- src/sys/modules/examples/fopsmapper/cmd_mapper.c:1.1 Wed Apr 1 01:57:20 2020 +++ src/sys/modules/examples/fopsmapper/cmd_mapper.c Wed Apr 1 13:07:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd_mapper.c,v 1.1 2020/04/01 01:57:20 kamil Exp $ */ +/* $NetBSD: cmd_mapper.c,v 1.2 2020/04/01 13:07:32 kamil Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD"); +__RCSID("$NetBSD: cmd_mapper.c,v 1.2 2020/04/01 13:07:32 kamil Exp $"); #include
CVS commit: src/sys/modules/examples/fopsmapper
Module Name:src Committed By: kamil Date: Wed Apr 1 13:07:32 UTC 2020 Modified Files: src/sys/modules/examples/fopsmapper: cmd_mapper.c Log Message: Fix CVS Id To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/fopsmapper/cmd_mapper.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/modules/examples/fopsmapper
Module Name:src Committed By: kamil Date: Wed Apr 1 11:45:53 UTC 2020 Modified Files: src/sys/modules/examples/fopsmapper: fopsmapper.c Log Message: Avoid comparison between signed and unsigned integer Cast PAGE_SIZE to size_t. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/fopsmapper/fopsmapper.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/modules/examples/fopsmapper
Module Name:src Committed By: kamil Date: Wed Apr 1 11:45:53 UTC 2020 Modified Files: src/sys/modules/examples/fopsmapper: fopsmapper.c Log Message: Avoid comparison between signed and unsigned integer Cast PAGE_SIZE to size_t. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/fopsmapper/fopsmapper.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/modules/examples/fopsmapper/fopsmapper.c diff -u src/sys/modules/examples/fopsmapper/fopsmapper.c:1.1 src/sys/modules/examples/fopsmapper/fopsmapper.c:1.2 --- src/sys/modules/examples/fopsmapper/fopsmapper.c:1.1 Wed Apr 1 01:57:20 2020 +++ src/sys/modules/examples/fopsmapper/fopsmapper.c Wed Apr 1 11:45:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fopsmapper.c,v 1.1 2020/04/01 01:57:20 kamil Exp $ */ +/* $NetBSD: fopsmapper.c,v 1.2 2020/04/01 11:45:53 kamil Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fopsmapper.c,v 1.1 2020/04/01 01:57:20 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fopsmapper.c,v 1.2 2020/04/01 11:45:53 kamil Exp $"); #include #include @@ -115,7 +115,7 @@ fopsmapper_mmap(file_t * fp, off_t * off if (prot & PROT_EXEC) return EACCES; - if (size != PAGE_SIZE) + if (size != (size_t)PAGE_SIZE) return EINVAL; if ((fo = fp->f_data) == NULL)
CVS commit: src/sys/stand/efiboot
Module Name:src Committed By: tnn Date: Wed Apr 1 10:45:44 UTC 2020 Modified Files: src/sys/stand/efiboot: Makefile.efiboot Log Message: efiboot: add clang fix from i386/stand/efiboot/bootx64/Makefile here too To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/stand/efiboot/Makefile.efiboot Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/stand/efiboot
Module Name:src Committed By: tnn Date: Wed Apr 1 10:45:44 UTC 2020 Modified Files: src/sys/stand/efiboot: Makefile.efiboot Log Message: efiboot: add clang fix from i386/stand/efiboot/bootx64/Makefile here too To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/stand/efiboot/Makefile.efiboot Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/stand/efiboot/Makefile.efiboot diff -u src/sys/stand/efiboot/Makefile.efiboot:1.10 src/sys/stand/efiboot/Makefile.efiboot:1.11 --- src/sys/stand/efiboot/Makefile.efiboot:1.10 Sat Jan 25 11:24:20 2020 +++ src/sys/stand/efiboot/Makefile.efiboot Wed Apr 1 10:45:44 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.efiboot,v 1.10 2020/01/25 11:24:20 jmcneill Exp $ +# $NetBSD: Makefile.efiboot,v 1.11 2020/04/01 10:45:44 tnn Exp $ S= ${.CURDIR}/../../.. @@ -87,6 +87,11 @@ CPPFLAGS+= -DLIBSA_ENABLE_LS_OP #CPPFLAGS+= -DRARP_DEBUG #CPPFLAGS+= -DRPC_DEBUG +# Follow the suit of Makefile.kern.inc; needed for the lfs64 union +# accessors -- they don't actually dereference the resulting pointer, +# just use it for type-checking. +CWARNFLAGS.clang+= -Wno-error=address-of-packed-member + SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)"
CVS commit: src/sys/arch/x86
Module Name:src Committed By: msaitoh Date: Wed Apr 1 08:21:39 UTC 2020 Modified Files: src/sys/arch/x86/include: specialreg.h src/sys/arch/x86/x86: procfs_machdep.c Log Message: Add AVX512_VP2INTERSECT, SERIALIZE and TSXLDTRK(TSX suspend load addr tracking) To generate a diff of this commit: cvs rdiff -u -r1.158 -r1.159 src/sys/arch/x86/include/specialreg.h cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/x86/procfs_machdep.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/arch/x86/include/specialreg.h diff -u src/sys/arch/x86/include/specialreg.h:1.158 src/sys/arch/x86/include/specialreg.h:1.159 --- src/sys/arch/x86/include/specialreg.h:1.158 Sun Nov 17 15:31:05 2019 +++ src/sys/arch/x86/include/specialreg.h Wed Apr 1 08:21:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: specialreg.h,v 1.158 2019/11/17 15:31:05 msaitoh Exp $ */ +/* $NetBSD: specialreg.h,v 1.159 2020/04/01 08:21:38 msaitoh Exp $ */ /* * Copyright (c) 2014-2019 The NetBSD Foundation, Inc. @@ -475,9 +475,12 @@ #define CPUID_SEF_AVX512_4VNNIW __BIT(2) #define CPUID_SEF_AVX512_4FMAPS __BIT(3) #define CPUID_SEF_FSREP_MOV __BIT(4) /* Fast Short REP MOV */ +#define CPUID_SEF_AVX512_VP2INTERSECT __BIT(8) #define CPUID_SEF_MD_CLEAR __BIT(10) #define CPUID_SEF_TSX_FORCE_ABORT __BIT(13) /* MSR_TSX_FORCE_ABORT bit 0 */ +#define CPUID_SEF_SERIALIZE __BIT(14) #define CPUID_SEF_HYBRID __BIT(15) /* Hybrid part */ +#define CPUID_SEF_TSXLDTRK __BIT(16) /* TSX suspend load addr tracking */ #define CPUID_SEF_CET_IBT __BIT(20) /* CET Indirect Branch Tracking */ #define CPUID_SEF_IBRS __BIT(26) /* IBRS / IBPB Speculation Control */ #define CPUID_SEF_STIBP __BIT(27) /* STIBP Speculation Control */ @@ -489,8 +492,9 @@ #define CPUID_SEF_FLAGS2 "\20" \ "\3" "AVX512_4VNNIW" "\4" "AVX512_4FMAPS" \ "\5" "FSREP_MOV" \ -"\13" "MD_CLEAR" \ - "\16" "TSX_FORCE_ABORT" "\20" "HYBRID" \ + "\11" "VP2INTERSECT" "\13" "MD_CLEAR" \ + "\16TSX_FORCE_ABORT" "\17SERIALIZE" "\20HYBRID" \ + "\21" "TSXLDTRK" \ "\25" "CET_IBT" \ "\33" "IBRS" "\34" "STIBP" \ "\35" "L1D_FLUSH" "\36" "ARCH_CAP" "\37CORE_CAP" "\40" "SSBD" Index: src/sys/arch/x86/x86/procfs_machdep.c diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.35 src/sys/arch/x86/x86/procfs_machdep.c:1.36 --- src/sys/arch/x86/x86/procfs_machdep.c:1.35 Fri Jan 17 04:48:21 2020 +++ src/sys/arch/x86/x86/procfs_machdep.c Wed Apr 1 08:21:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_machdep.c,v 1.35 2020/01/17 04:48:21 msaitoh Exp $ */ +/* $NetBSD: procfs_machdep.c,v 1.36 2020/04/01 08:21:38 msaitoh Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.35 2020/01/17 04:48:21 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.36 2020/04/01 08:21:38 msaitoh Exp $"); #include #include @@ -189,7 +189,7 @@ static const char * const x86_features[] { /* (18) Intel 0x0007 edx */ NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL, - NULL, NULL, "md_clear", NULL, NULL, NULL, NULL, NULL, + "vp2intersect", NULL, "md_clear", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "pconfig", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "flush_l1d", "arch_capabilities", NULL, "ssbd"},
CVS commit: src/sys/arch/x86
Module Name:src Committed By: msaitoh Date: Wed Apr 1 08:21:39 UTC 2020 Modified Files: src/sys/arch/x86/include: specialreg.h src/sys/arch/x86/x86: procfs_machdep.c Log Message: Add AVX512_VP2INTERSECT, SERIALIZE and TSXLDTRK(TSX suspend load addr tracking) To generate a diff of this commit: cvs rdiff -u -r1.158 -r1.159 src/sys/arch/x86/include/specialreg.h cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/x86/procfs_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.