CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Mon Mar 1 04:50:18 UTC 2021 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Refactor rxq->rxq_ptr updating. To generate a diff of this commit: cvs rdiff -u -r1.700 -r1.701 src/sys/dev/pci/if_wm.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/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.700 src/sys/dev/pci/if_wm.c:1.701 --- src/sys/dev/pci/if_wm.c:1.700 Mon Mar 1 04:49:11 2021 +++ src/sys/dev/pci/if_wm.c Mon Mar 1 04:50:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.700 2021/03/01 04:49:11 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.701 2021/03/01 04:50:17 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.700 2021/03/01 04:49:11 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.701 2021/03/01 04:50:17 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -9177,7 +9177,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l for (i = rxq->rxq_ptr;; i = WM_NEXTRX(i)) { if (limit-- == 0) { - rxq->rxq_ptr = i; more = true; DPRINTF(sc, WM_DEBUG_RX, ("%s: RX: loop limited, descriptor %d is not processed\n", @@ -9203,11 +9202,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l #endif if (!wm_rxdesc_dd(rxq, i, status)) { - /* - * Update the receive pointer holding rxq_lock - * consistent with increment counter. - */ - rxq->rxq_ptr = i; break; } @@ -9333,7 +9327,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l /* Set up checksum info for this packet. */ wm_rxdesc_ensure_checksum(rxq, status, errors, m); - rxq->rxq_ptr = i; rxq->rxq_packets++; rxq->rxq_bytes += len; /* Pass it on. */ @@ -9342,6 +9335,7 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l if (rxq->rxq_stopping) break; } + rxq->rxq_ptr = i; if (count != 0) rnd_add_uint32(>rnd_source, count);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Mon Mar 1 04:49:11 UTC 2021 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Remove extra unlock/lock processing around if_percpuq_enqueue(). This temporary unlock/lock processing was required for direct calling ifp->if_input. After r1.391, wm(4) uses if_percpuq_enqueue() and it does not hold any mutexes. To generate a diff of this commit: cvs rdiff -u -r1.699 -r1.700 src/sys/dev/pci/if_wm.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/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.699 src/sys/dev/pci/if_wm.c:1.700 --- src/sys/dev/pci/if_wm.c:1.699 Wed Feb 17 08:15:43 2021 +++ src/sys/dev/pci/if_wm.c Mon Mar 1 04:49:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.699 2021/02/17 08:15:43 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.700 2021/03/01 04:49:11 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.699 2021/02/17 08:15:43 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.700 2021/03/01 04:49:11 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -9332,20 +9332,13 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l /* Set up checksum info for this packet. */ wm_rxdesc_ensure_checksum(rxq, status, errors, m); - /* - * Update the receive pointer holding rxq_lock consistent with - * increment counter. - */ + rxq->rxq_ptr = i; rxq->rxq_packets++; rxq->rxq_bytes += len; - mutex_exit(rxq->rxq_lock); - /* Pass it on. */ if_percpuq_enqueue(sc->sc_ipq, m); - mutex_enter(rxq->rxq_lock); - if (rxq->rxq_stopping) break; }
CVS commit: src/doc
Module Name:src Committed By: christos Date: Mon Mar 1 04:43:55 UTC 2021 Modified Files: src/doc: 3RDPARTY CHANGES Log Message: new tzcode To generate a diff of this commit: cvs rdiff -u -r1.1781 -r1.1782 src/doc/3RDPARTY cvs rdiff -u -r1.2783 -r1.2784 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/3RDPARTY diff -u src/doc/3RDPARTY:1.1781 src/doc/3RDPARTY:1.1782 --- src/doc/3RDPARTY:1.1781 Sun Feb 28 20:43:15 2021 +++ src/doc/3RDPARTY Sun Feb 28 23:43:54 2021 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1781 2021/03/01 01:43:15 christos Exp $ +# $NetBSD: 3RDPARTY,v 1.1782 2021/03/01 04:43:54 christos Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -1409,14 +1409,14 @@ Notes: Added changes from a5 -> a12 manually. Package: tz -Version: tzcode2020c / tzdata2021a +Version: tzcode2021a / tzdata2021a Current Vers: tzcode2021a / tzdata2021a Maintainer: Paul Eggert Archive Site: ftp://ftp.iana.org/tz/releases/ Archive Site: ftp://munnari.oz.au/pub/oldtz/ Old Archive Site: ftp://elsie.nci.nih.gov/pub/ Home Page: http://www.iana.org/time-zones -Date: 2020-12-31 +Date: 2021-02-28 Mailing List: t...@iana.org Responsible: kleink, christos, kre License: Public domain Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2783 src/doc/CHANGES:1.2784 --- src/doc/CHANGES:1.2783 Sun Feb 28 20:43:15 2021 +++ src/doc/CHANGES Sun Feb 28 23:43:54 2021 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2783 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2784 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -336,3 +336,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: OpenSSL: Imported 1.1.1j. [christos 20210219] byacc: Update to 20210109. [christos 20210220] wpa: Import wpa_supplicant and hostapd 2.9. [christos 20210228] + tzcode: Updated to 2021a. [christos 20210228]
CVS commit: src/lib/libc/time
Module Name:src Committed By: christos Date: Mon Mar 1 04:42:14 UTC 2021 Modified Files: src/lib/libc/time: Makefile NEWS theory.html tz-art.html tz-link.html version zic.8 zic.c Log Message: Merge tzcode-2021a - No comments in the changelog about the code changes. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/lib/libc/time/Makefile cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/NEWS cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/theory.html cvs rdiff -u -r1.7 -r1.8 src/lib/libc/time/tz-art.html cvs rdiff -u -r1.8 -r1.9 src/lib/libc/time/tz-link.html cvs rdiff -u -r1.15 -r1.16 src/lib/libc/time/version cvs rdiff -u -r1.35 -r1.36 src/lib/libc/time/zic.8 cvs rdiff -u -r1.77 -r1.78 src/lib/libc/time/zic.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/libc/time/Makefile diff -u src/lib/libc/time/Makefile:1.47 src/lib/libc/time/Makefile:1.48 --- src/lib/libc/time/Makefile:1.47 Sat Oct 17 12:24:33 2020 +++ src/lib/libc/time/Makefile Sun Feb 28 23:42:14 2021 @@ -583,11 +583,19 @@ INSTALL: ALL install date.1 cp date '$(DESTDIR)$(BINDIR)/.' cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' +# Calculate version number from git, if available. +# Otherwise, use $(VERSION) unless it is "unknown" and there is already +# a 'version' file, in which case reuse the existing 'version' contents +# and append "-dirty" if the contents do not already end in "-dirty". version: $(VERSION_DEPS) { (type git) >/dev/null 2>&1 && \ V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ --abbrev=7 --dirty` || \ - V='$(VERSION)'; } && \ + if test '$(VERSION)' = unknown && V=`cat $@`; then \ + case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ + else \ + V='$(VERSION)'; \ + fi; } && \ printf '%s\n' "$$V" >$@.out mv $@.out $@ @@ -872,11 +880,34 @@ $(MANTXTS): workman.sh LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out mv $@.out $@ +# Set file timestamps deterministically if possible, +# so that tarballs containing the timestamps are reproducible. +# +# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the +# file DEST to the maximum of the timestamps of the files A B C ..., +# plus N if GNU ls and touch are available. +SET_TIMESTAMP_N = sh -c '\ + n=$$0 dest=$$1; shift; \ + touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \ + if test $$n != 0 && \ + lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \ +set x $$lsout && \ +touch -cmd @`expr $$7 + $$n` "$$dest"; \ + else :; fi' +# If DEST depends on A B C ... in this Makefile, callers should use +# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any +# downstream 'make' that considers equal timestamps to be out of date. +# POSIX allows this 'make' behavior, and HP-UX 'make' does it. +# If all that matters is that the timestamp be reproducible +# and plausible, use $(SET_TIMESTAMP). +SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 +SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 + # Set the timestamps to those of the git repository, if available, # and if the files have not changed since then. -# This uses GNU 'touch' syntax 'touch -d@N FILE', -# where N is the number of seconds since 1970. -# If git or GNU 'touch' is absent, don't bother to sync with git timestamps. +# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, +# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. +# If git or GNU is absent, don't bother to sync with git timestamps. # Also, set the timestamp of each prebuilt file like 'leapseconds' # to be the maximum of the files it depends on. set-timestamps.out: $(EIGHT_YARDS) @@ -894,16 +925,16 @@ set-timestamps.out: $(EIGHT_YARDS) fi || exit; \ done; \ fi - touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds + $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ - touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \ + $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \ exit; \ done - touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi - touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version + $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) + $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) touch $@ set-tzs-timestamp.out: $(TZS) - touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS) + $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) touch $@ # The zics below ensure that each data file can stand on its own. @@ -914,7 +945,10 @@ check_public: $(VERSION_DEPS) mkdir public.dir ln $(VERSION_DEPS) public.dir cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL - for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi; do \ + for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ + public.dir/vanguard.zi public.dir/main.zi \ + public.dir/rearguard.zi; \ + do \ public.dir/zic -v -d
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: rin Date: Mon Mar 1 04:40:39 UTC 2021 Modified Files: src/sys/dev/i2c: lm75.c Log Message: Use lmtemp(4) as entropy source. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/i2c/lm75.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/i2c/lm75.c diff -u src/sys/dev/i2c/lm75.c:1.41 src/sys/dev/i2c/lm75.c:1.42 --- src/sys/dev/i2c/lm75.c:1.41 Sat Feb 6 05:21:47 2021 +++ src/sys/dev/i2c/lm75.c Mon Mar 1 04:40:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lm75.c,v 1.41 2021/02/06 05:21:47 thorpej Exp $ */ +/* $NetBSD: lm75.c,v 1.42 2021/03/01 04:40:39 rin Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.41 2021/02/06 05:21:47 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.42 2021/03/01 04:40:39 rin Exp $"); #include #include @@ -279,7 +279,7 @@ lmtemp_attach(device_t parent, device_t /* Initialize sensor data. */ sc->sc_sensor.units = ENVSYS_STEMP; sc->sc_sensor.state = ENVSYS_SINVALID; - sc->sc_sensor.flags = ENVSYS_FMONLIMITS; + sc->sc_sensor.flags = ENVSYS_FMONLIMITS | ENVSYS_FHAS_ENTROPY; (void)strlcpy(name, ia->ia_name? ia->ia_name : device_xname(self),
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: rin Date: Mon Mar 1 04:39:45 UTC 2021 Modified Files: src/sys/dev/i2c: dstemp.c Log Message: Use dstemp(4) as entropy source. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/i2c/dstemp.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/i2c/dstemp.c diff -u src/sys/dev/i2c/dstemp.c:1.11 src/sys/dev/i2c/dstemp.c:1.12 --- src/sys/dev/i2c/dstemp.c:1.11 Sat Jan 30 17:37:25 2021 +++ src/sys/dev/i2c/dstemp.c Mon Mar 1 04:39:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dstemp.c,v 1.11 2021/01/30 17:37:25 thorpej Exp $ */ +/* $NetBSD: dstemp.c,v 1.12 2021/03/01 04:39:45 rin Exp $ */ /*- * Copyright (c) 2018 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.11 2021/01/30 17:37:25 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.12 2021/03/01 04:39:45 rin Exp $"); #include #include @@ -124,6 +124,7 @@ dstemp_attach(device_t parent, device_t sc->sc_sensor_temp.units = ENVSYS_STEMP; sc->sc_sensor_temp.state = ENVSYS_SINVALID; + sc->sc_sensor_temp.flags = ENVSYS_FHAS_ENTROPY; if (prop_dictionary_get_cstring_nocopy(sc->sc_prop, "s00", )) { strncpy(name, desc, 64);
CVS commit: src/external/bsd/wpa/bin/hostapd
Module Name:src Committed By: christos Date: Mon Mar 1 03:42:57 UTC 2021 Modified Files: src/external/bsd/wpa/bin/hostapd: Makefile Log Message: Enable more options. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/external/bsd/wpa/bin/hostapd/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/wpa/bin/hostapd/Makefile diff -u src/external/bsd/wpa/bin/hostapd/Makefile:1.14 src/external/bsd/wpa/bin/hostapd/Makefile:1.15 --- src/external/bsd/wpa/bin/hostapd/Makefile:1.14 Sun Sep 6 03:20:26 2020 +++ src/external/bsd/wpa/bin/hostapd/Makefile Sun Feb 28 22:42:57 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2020/09/06 07:20:26 mrg Exp $ +# $NetBSD: Makefile,v 1.15 2021/03/01 03:42:57 christos Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -16,12 +16,18 @@ authsrv.c \ beacon.c \ bss_load.c \ ctrl_iface_ap.c \ +dpp.c \ +dpp_hostapd.c \ drv_callbacks.c \ eap_user_db.c \ +gas.c \ +gas_query_ap.c \ +gas_serv.c \ hostapd.c \ ieee802_11_auth.c \ ieee802_11_shared.c \ ieee802_1x.c \ +mbo_ap.c \ neighbor_db.c \ pmksa_cache_auth.c \ preauth_auth.c \ @@ -65,6 +71,7 @@ SRCS+= \ base64.c \ common.c \ eloop.c \ +json.c \ ip_addr.c \ os_unix.c \ wpa_debug.c \ @@ -94,8 +101,15 @@ eap_server_methods.c # crypto SRCS+= \ +aes-siv.c \ random.c \ -sha1-prf.c +sha1-prf.c \ +sha256-kdf.c \ +sha256-prf.c \ +sha384-kdf.c \ +sha384-prf.c \ +sha512-kdf.c \ +sha512-prf.c \ # crypto for non-openssl NO_SRCS+= \ @@ -131,6 +145,21 @@ CPPFLAGS+= -DCONFIG_IPV6 .endif CPPFLAGS+= -DCONFIG_PEERKEY CPPFLAGS+= -DCONFIG_RSN_PREAUTH +CPPFLAGS+= -DCONFIG_DPP +CPPFLAGS+= -DCONFIG_DPP2 +CPPFLAGS+= -DCONFIG_ECC +#CPPFLAGS+= -DCONFIG_OWE +#CPPFLAGS+= -DCONFIG_SAE +#CPPFLAGS+= -DCONFIG_AIRTIME_POLICY +#CPPFLAGS+= -DCONFIG_FILS +#CPPFLAGS+= -DCONFIG_OCV +#CPPFLAGS+= -DCONFIG_IEEE80211AX +CPPFLAGS+= -DCONFIG_IEEE80211W +#CPPFLAGS+= -DCONFIG_IEEE80211R_AP +CPPFLAGS+= -DCONFIG_MBO +#CPPFLAGS+= -DCONFIG_NO_VLAN +#CPPFLAGS+= -DCONFIG_SQLITE +#CPPFLAGS+= -DCONFIG_SHA256 -DCONFIG_SHA484 -DCONFIG_SHA512 DPADD+= ${LIBPCAP} LDADD+= -lpcap @@ -169,6 +198,8 @@ fips_prf_openssl.c \ ms_funcs.c \ sha1-tlsprf.c \ sha256.c \ +sha384.c \ +sha512.c \ tls_openssl.c # eap_common
CVS commit: src/sys/arch/powerpc
Module Name:src Committed By: thorpej Date: Mon Mar 1 01:53:46 UTC 2021 Modified Files: src/sys/arch/powerpc/include/oea: pmap.h src/sys/arch/powerpc/oea: pmap.c Log Message: Split pmap_bootstrap() into 2 functions: - pmap_bootstrap1(), which sets up the low-level pmap data structures. - pmap_bootstrap2(), which actually programs the MMU hardware based on pmap_bootstrap1()'s work. pmap_bootstrap() is still provided as a wrapper around the two, but this provides flexibility to platforms that might need to do additional work between these two phases. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/include/oea/pmap.h cvs rdiff -u -r1.98 -r1.99 src/sys/arch/powerpc/oea/pmap.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/powerpc/include/oea/pmap.h diff -u src/sys/arch/powerpc/include/oea/pmap.h:1.32 src/sys/arch/powerpc/include/oea/pmap.h:1.33 --- src/sys/arch/powerpc/include/oea/pmap.h:1.32 Mon Jul 6 10:57:03 2020 +++ src/sys/arch/powerpc/include/oea/pmap.h Mon Mar 1 01:53:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.32 2020/07/06 10:57:03 rin Exp $ */ +/* $NetBSD: pmap.h,v 1.33 2021/03/01 01:53:46 thorpej Exp $ */ /*- * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -145,6 +145,8 @@ extern unsigned int pmap_pteg_cnt; extern unsigned int pmap_pteg_mask; void pmap_bootstrap(vaddr_t, vaddr_t); +void pmap_bootstrap1(vaddr_t, vaddr_t); +void pmap_bootstrap2(void); bool pmap_extract(pmap_t, vaddr_t, paddr_t *); bool pmap_query_bit(struct vm_page *, int); bool pmap_clear_bit(struct vm_page *, int); Index: src/sys/arch/powerpc/oea/pmap.c diff -u src/sys/arch/powerpc/oea/pmap.c:1.98 src/sys/arch/powerpc/oea/pmap.c:1.99 --- src/sys/arch/powerpc/oea/pmap.c:1.98 Mon Jul 6 09:34:17 2020 +++ src/sys/arch/powerpc/oea/pmap.c Mon Mar 1 01:53:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.98 2020/07/06 09:34:17 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.99 2021/03/01 01:53:46 thorpej Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -63,7 +63,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.98 2020/07/06 09:34:17 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.99 2021/03/01 01:53:46 thorpej Exp $"); #define PMAP_NOOPNAMES @@ -3145,12 +3145,11 @@ pmap_setup_segment0_map(int use_large_pa #endif /* PMAP_OEA64_BRIDGE */ /* - * This is not part of the defined PMAP interface and is specific to the - * PowerPC architecture. This is called during initppc, before the system - * is really initialized. + * Set up the bottom level of the data structures necessary for the kernel + * to manage memory. MMU hardware is programmed in pmap_bootstrap2(). */ void -pmap_bootstrap(paddr_t kernelstart, paddr_t kernelend) +pmap_bootstrap1(paddr_t kernelstart, paddr_t kernelend) { struct mem_region *mp, tmp; paddr_t s, e; @@ -3413,34 +3412,20 @@ pmap_bootstrap(paddr_t kernelstart, padd continue; #endif pmap_kernel()->pm_sr[i] = KERNELN_SEGMENT(i)|SR_PRKEY; - __asm volatile ("mtsrin %0,%1" - :: "r"(KERNELN_SEGMENT(i)|SR_PRKEY), "r"(i << ADDR_SR_SHFT)); } pmap_kernel()->pm_sr[KERNEL_SR] = KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY; - __asm volatile ("mtsr %0,%1" - :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT)); #ifdef KERNEL2_SR pmap_kernel()->pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT|SR_SUKEY|SR_PRKEY; - __asm volatile ("mtsr %0,%1" - :: "n"(KERNEL2_SR), "r"(KERNEL2_SEGMENT)); #endif #endif /* PMAP_OEA || PMAP_OEA64_BRIDGE */ #if defined (PMAP_OEA) for (i = 0; i < 16; i++) { if (iosrtable[i] & SR601_T) { pmap_kernel()->pm_sr[i] = iosrtable[i]; - __asm volatile ("mtsrin %0,%1" - :: "r"(iosrtable[i]), "r"(i << ADDR_SR_SHFT)); } } - __asm volatile ("sync; mtsdr1 %0; isync" - :: "r"((uintptr_t)pmap_pteg_table | (pmap_pteg_mask >> 10))); -#elif defined (PMAP_OEA64) || defined (PMAP_OEA64_BRIDGE) - __asm __volatile ("sync; mtsdr1 %0; isync" - :: "r"((uintptr_t)pmap_pteg_table | (32 - __builtin_clz(pmap_pteg_mask >> 11; #endif - tlbia(); #ifdef ALTIVEC pmap_use_altivec = cpu_altivec; @@ -3537,14 +3522,54 @@ pmap_bootstrap(paddr_t kernelstart, padd pmap_pte_insert(ptegidx, ); } #endif + } +#endif +} - __asm volatile ("mtsrin %0,%1" - :: "r"(sr), "r"(kernelstart)); +/* + * Using the data structures prepared in pmap_bootstrap1(), program + * the MMU hardware. + */ +void +pmap_bootstrap2(void) +{ +/* PMAP_OEA64_BRIDGE does support these instructions */ +#if defined (PMAP_OEA) || defined (PMAP_OEA64_BRIDGE) + for (int i = 0; i < 16; i++) { +#if defined(PPC_OEA601) + /* XXX wedges for segment register 0xf , so set later */ + if ((iosrtable[i] & SR601_T) && ((MFPVR() >> 16) == MPC601)) + continue; +#endif /* PPC_OEA601 */ + __asm volatile("mtsrin %0,%1" + :: "r"(pmap_kernel()->pm_sr[i]), +
CVS commit: src/doc
Module Name:src Committed By: christos Date: Mon Mar 1 01:43:16 UTC 2021 Modified Files: src/doc: 3RDPARTY CHANGES Log Message: new wpa. To generate a diff of this commit: cvs rdiff -u -r1.1780 -r1.1781 src/doc/3RDPARTY cvs rdiff -u -r1.2782 -r1.2783 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/3RDPARTY diff -u src/doc/3RDPARTY:1.1780 src/doc/3RDPARTY:1.1781 --- src/doc/3RDPARTY:1.1780 Sat Feb 20 17:59:37 2021 +++ src/doc/3RDPARTY Sun Feb 28 20:43:15 2021 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1780 2021/02/20 22:59:37 christos Exp $ +# $NetBSD: 3RDPARTY,v 1.1781 2021/03/01 01:43:15 christos Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -1209,8 +1209,7 @@ Version: 980911 Current Vers: 980911 Maintainer: Mike Muuss Archive Site: -Home Page: http://ftp.arl.mil/mike/ping.html -Date: 2019-01-09 +Date: 2021-02-28 Mailing List: Responsible: christos License: BSD (3-clause) @@ -1278,7 +1277,7 @@ Current Vers: 2.32 Maintainer: Vernon Schryver Archive Site: Home Page: -Date: 2019-01-09 +Date: 2021-02-28 Mailing List: Responsible: christos License: BSD (4-clause) @@ -1430,12 +1429,12 @@ is too much inertia to apply them. Check For the data files, do use external/public-domain/tz/tzdata2netbsd. Package: wpa_supplicant/hostapd -Version: 2.7 +Version: 2.9 Current Vers: 2.9 Maintainer: Jouni Malinen Archive Site: http://w1.fi/releases/ Home Page: http://w1.fi/wpa_supplicant/ -Date: 2020-06-13 +Date: 2021-02-28 Mailing List: Responsible: scw, dyoung, christos License: BSD or GPLv2 Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2782 src/doc/CHANGES:1.2783 --- src/doc/CHANGES:1.2782 Sat Feb 20 17:59:37 2021 +++ src/doc/CHANGES Sun Feb 28 20:43:15 2021 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2782 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2783 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -335,3 +335,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: bind: Import version 9.16.12. [christos 20210219] OpenSSL: Imported 1.1.1j. [christos 20210219] byacc: Update to 20210109. [christos 20210220] + wpa: Import wpa_supplicant and hostapd 2.9. [christos 20210228]
CVS import: src/external/bsd/wpa/dist
Module Name:src Committed By: christos Date: Mon Mar 1 01:38:10 UTC 2021 Update of /cvsroot/src/external/bsd/wpa/dist In directory ivanova.netbsd.org:/tmp/cvs-serv22775 Log Message: ChangeLog for wpa_supplicant 2019-08-07 - v2.9 * SAE changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * EAP-pwd changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * fixed FT-EAP initial mobility domain association using PMKSA caching * added configuration of airtime policy * fixed FILS to and RSNE into (Re)Association Response frames * fixed DPP bootstrapping URI parser of channel list * added support for regulatory WMM limitation (for ETSI) * added support for MACsec Key Agreement using IEEE 802.1X/PSK * added experimental support for EAP-TEAP server (RFC 7170) * added experimental support for EAP-TLS server with TLS v1.3 * added support for two server certificates/keys (RSA/ECC) * added AKMSuiteSelector into "STA " control interface data to determine with AKM was used for an association * added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and fast reauthentication use to be disabled * fixed an ECDH operation corner case with OpenSSL 2019-04-21 - v2.8 * SAE changes - added support for SAE Password Identifier - changed default configuration to enable only group 19 (i.e., disable groups 20, 21, 25, 26 from default configuration) and disable all unsuitable groups completely based on REVmd changes - improved anti-clogging token mechanism and SAE authentication frame processing during heavy CPU load; this mitigates some issues with potential DoS attacks trying to flood an AP with large number of SAE messages - added Finite Cyclic Group field in status code 77 responses - reject use of unsuitable groups based on new implementation guidance in REVmd (allow only FFC groups with prime >= 3072 bits and ECC groups with prime >= 256) - minimize timing and memory use differences in PWE derivation [https://w1.fi/security/2019-1/] (CVE-2019-9494) - fixed confirm message validation in error cases [https://w1.fi/security/2019-3/] (CVE-2019-9496) * EAP-pwd changes - minimize timing and memory use differences in PWE derivation [https://w1.fi/security/2019-2/] (CVE-2019-9495) - verify peer scalar/element [https://w1.fi/security/2019-4/] (CVE-2019-9497 and CVE-2019-9498) - fix message reassembly issue with unexpected fragment [https://w1.fi/security/2019-5/] - enforce rand,mask generation rules more strictly - fix a memory leak in PWE derivation - disallow ECC groups with a prime under 256 bits (groups 25, 26, and 27) * Hotspot 2.0 changes - added support for release number 3 - reject release 2 or newer association without PMF * added support for RSN operating channel validation (CONFIG_OCV=y and configuration parameter ocv=1) * added Multi-AP protocol support * added FTM responder configuration * fixed build with LibreSSL * added FT/RRB workaround for short Ethernet frame padding * fixed KEK2 derivation for FILS+FT * added RSSI-based association rejection from OCE * extended beacon reporting functionality * VLAN changes - allow local VLAN management with remote RADIUS authentication - add WPA/WPA2 passphrase/PSK -based VLAN assignment * OpenSSL: allow systemwide policies to be overridden * extended PEAP to derive EMSK to enable use with ERP/FILS * extended WPS to allow SAE configuration to be added automatically for PSK (wps_cred_add_sae=1) * fixed FT and SA Query Action frame with AP-MLME-in-driver cases * OWE: allow Diffie-Hellman Parameter element to be included with DPP in preparation for DPP protocol extension * RADIUS server: started to accept ERP keyName-NAI as user identity automatically without matching EAP database entry * fixed PTK rekeying with FILS and FT ChangeLog for hostapd 2019-08-07 - v2.9 * SAE changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * EAP-pwd changes - disable use of groups using Brainpool curves - allow the set of groups to be configured (eap_pwd_groups)
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Mar 1 00:51:01 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: lex.c Log Message: lint: only warn once about integer constant overflow on 32-bit Previously, the test msg_056.c warned twice about the integer literal, but only on 32-bit platforms. On 64-bit platforms, there was only a single warning since the integer constant was converted to type __uint128_t, and this prevented the second warning. On 32-bit targets, there is no __uint128_t though. Fixes part of PR bin/55976. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/lex.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/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.10 src/usr.bin/xlint/lint1/lex.c:1.11 --- src/usr.bin/xlint/lint1/lex.c:1.10 Sun Feb 28 18:51:51 2021 +++ src/usr.bin/xlint/lint1/lex.c Mon Mar 1 00:51:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.10 2021/02/28 18:51:51 rillig Exp $ */ +/* $NetBSD: lex.c,v 1.11 2021/03/01 00:51:01 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: lex.c,v 1.10 2021/02/28 18:51:51 rillig Exp $"); +__RCSID("$NetBSD: lex.c,v 1.11 2021/03/01 00:51:01 rillig Exp $"); #endif #include @@ -478,6 +478,7 @@ lex_integer_constant(const char *yytext, char c, *eptr; tspec_t typ; bool ansiu; + bool warned = false; #ifdef TARG_INT128_MAX __uint128_t uq = 0; static tspec_t contypes[2][4] = { @@ -531,9 +532,11 @@ lex_integer_constant(const char *yytext, uq = strtouq(cp, , base); lint_assert(eptr == cp + len); - if (errno != 0) + if (errno != 0) { /* integer constant out of range */ warning(252); + warned = true; + } /* * If the value is too big for the current type, we must choose @@ -550,7 +553,7 @@ lex_integer_constant(const char *yytext, typ = LONG; } else { typ = ULONG; - if (uq > TARG_ULONG_MAX) { + if (uq > TARG_ULONG_MAX && !warned) { /* integer constant out of range */ warning(252); } @@ -570,7 +573,7 @@ lex_integer_constant(const char *yytext, case UINT: if (uq > TARG_UINT_MAX) { typ = ULONG; - if (uq > TARG_ULONG_MAX) { + if (uq > TARG_ULONG_MAX && !warned) { /* integer constant out of range */ warning(252); } @@ -581,14 +584,14 @@ lex_integer_constant(const char *yytext, typ = ULONG; if (!sflag) ansiu = true; - if (uq > TARG_ULONG_MAX) { + if (uq > TARG_ULONG_MAX && !warned) { /* integer constant out of range */ warning(252); } } break; case ULONG: - if (uq > TARG_ULONG_MAX) { + if (uq > TARG_ULONG_MAX && !warned) { /* integer constant out of range */ warning(252); } @@ -601,7 +604,7 @@ lex_integer_constant(const char *yytext, } break; case UQUAD: - if (uq > TARG_UQUAD_MAX) { + if (uq > TARG_UQUAD_MAX && !warned) { /* integer constant out of range */ warning(252); } @@ -618,7 +621,7 @@ lex_integer_constant(const char *yytext, break; case UINT128: #ifdef TARG_INT128_MAX - if (uq > TARG_UINT128_MAX) { + if (uq > TARG_UINT128_MAX && !warned) { /* integer constant out of range */ warning(252); }
CVS commit: src/sys/lib/libunwind
Module Name:src Committed By: joerg Date: Sun Feb 28 23:12:37 UTC 2021 Modified Files: src/sys/lib/libunwind: AddressSpace.hpp Log Message: Defer acquiring the FDE lock until after the allocation. This can avoid nesting issues between malloc and backtrace when using LSan. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libunwind/AddressSpace.hpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libunwind/AddressSpace.hpp diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.9 src/sys/lib/libunwind/AddressSpace.hpp:1.10 --- src/sys/lib/libunwind/AddressSpace.hpp:1.9 Thu Nov 2 16:09:33 2017 +++ src/sys/lib/libunwind/AddressSpace.hpp Sun Feb 28 23:12:37 2021 @@ -283,7 +283,6 @@ public: } bool addFDE(pint_t pcStart, pint_t pcEnd, pint_t fde) { -pthread_rwlock_wrlock(); Range *n = (Range *)malloc(sizeof(*n)); n->hdr_base = fde; n->hdr_start = 0; @@ -292,6 +291,7 @@ public: n->last_pc = pcEnd; n->data_base = 0; n->ehframe_base = 0; +pthread_rwlock_wrlock(); if (static_cast(rb_tree_insert_node(, n)) == n) { pthread_rwlock_unlock(); return true;
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Feb 28 22:12:17 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh src/usr.bin/xlint/lint1: tree.c Added Files: src/tests/usr.bin/xlint/lint1: d_pr_22119.c d_pr_22119.exp Log Message: lint: fix null pointer dereference on parse error Fixes PR bin/22119. To generate a diff of this commit: cvs rdiff -u -r1.1023 -r1.1024 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.33 -r1.34 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_pr_22119.c \ src/tests/usr.bin/xlint/lint1/d_pr_22119.exp cvs rdiff -u -r1.31 -r1.32 src/tests/usr.bin/xlint/lint1/t_integration.sh cvs rdiff -u -r1.231 -r1.232 src/usr.bin/xlint/lint1/tree.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/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1023 src/distrib/sets/lists/tests/mi:1.1024 --- src/distrib/sets/lists/tests/mi:1.1023 Sun Feb 28 20:17:13 2021 +++ src/distrib/sets/lists/tests/mi Sun Feb 28 22:12:16 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1023 2021/02/28 20:17:13 rillig Exp $ +# $NetBSD: mi,v 1.1024 2021/02/28 22:12:16 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5825,6 +5825,8 @@ ./usr/tests/usr.bin/xlint/lint1/d_nested_structs.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_nolimit_init.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_packed_structs.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/d_pr_22119.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/d_pr_22119.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_return_type.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_return_type.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_shift_to_narrower_type.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.33 src/tests/usr.bin/xlint/lint1/Makefile:1.34 --- src/tests/usr.bin/xlint/lint1/Makefile:1.33 Sun Feb 28 20:17:14 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Feb 28 22:12:16 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.33 2021/02/28 20:17:14 rillig Exp $ +# $NetBSD: Makefile,v 1.34 2021/02/28 22:12:16 rillig Exp $ NOMAN= # defined @@ -79,6 +79,8 @@ FILES+= d_long_double_int.exp FILES+= d_nested_structs.c FILES+= d_nolimit_init.c FILES+= d_packed_structs.c +FILES+= d_pr_22119.c +FILES+= d_pr_22119.exp FILES+= d_return_type.c FILES+= d_return_type.exp FILES+= d_shift_to_narrower_type.c Index: src/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.31 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.32 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.31 Sun Feb 28 20:17:14 2021 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Sun Feb 28 22:12:16 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.31 2021/02/28 20:17:14 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.32 2021/02/28 22:12:16 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -123,6 +123,7 @@ test_case c99_recursive_init test_case c9x_recursive_init test_case nested_structs test_case packed_structs +test_case pr_22119 test_case struct_init_nested test_case cast_init Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.231 src/usr.bin/xlint/lint1/tree.c:1.232 --- src/usr.bin/xlint/lint1/tree.c:1.231 Sun Feb 28 20:04:52 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Feb 28 22:12:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.231 2021/02/28 20:04:52 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.232 2021/02/28 22:12:16 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.231 2021/02/28 20:04:52 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.232 2021/02/28 22:12:16 rillig Exp $"); #endif #include @@ -3455,6 +3455,14 @@ cast(tnode_t *tn, type_t *tp) if (tn == NULL) return NULL; + /* + * XXX: checking for tp == NULL is only a quick fix for PR 22119. + * The proper fix needs to be investigated properly. + * See d_pr_22119.c for how to get here. + */ + if (tp == NULL) + return NULL; + tn = cconv(tn); nt = tp->t_tspec; Added files: Index: src/tests/usr.bin/xlint/lint1/d_pr_22119.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_pr_22119.c:1.1 --- /dev/null Sun Feb 28 22:12:17 2021 +++ src/tests/usr.bin/xlint/lint1/d_pr_22119.c Sun Feb 28 22:12:16 2021 @@ -0,0 +1,18 @@ +/* $NetBSD: d_pr_22119.c,v 1.1 2021/02/28 22:12:16 rillig Exp
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Feb 28 21:39:17 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp Log Message: tests/lint: add test for narrowing conversions Lint can warn about narrowing conversions, it just doesn't do so by default. The option -a (which is included in the default LINTFLAGS in sys.mk) only reports narrowing conversions from 'long' or larger. To get warnings about all possible narrowing conversions, the option -a has to be given more than once. PR bin/14531 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_132.exp 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/xlint/lint1/msg_132.c diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.2 src/tests/usr.bin/xlint/lint1/msg_132.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_132.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_132.c Sun Feb 28 21:39:17 2021 @@ -1,7 +1,64 @@ -/* $NetBSD: msg_132.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_132.c,v 1.3 2021/02/28 21:39:17 rillig Exp $ */ # 3 "msg_132.c" // Test for message: conversion from '%s' to '%s' may lose accuracy [132] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* + * NetBSD's default lint flags only include a single -a, which only flags + * narrowing conversions from long. To get warnings for all narrowing + * conversions, -aa needs to be given more than once. + * + * https://gnats.netbsd.org/14531 + */ + +/* lint1-extra-flags: -aa */ + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +typedef unsigned long long u64; + +typedef signed char i8; +typedef signed short i16; +typedef signed int i32; +typedef signed long long i64; + +void +convert_unsigned(u8 v8, u16 v16, u32 v32, u64 v64) +{ + v8 = v16; /* expect: 132 */ + v8 = v32; /* expect: 132 */ + v8 = v64; /* expect: 132 */ + + v16 = v8; + v16 = v32; /* expect: 132 */ + v16 = v64; /* expect: 132 */ + + v32 = v8; + v32 = v16; + v32 = v64; /* expect: 132 */ + + v64 = v8; + v64 = v16; + v64 = v32; +} + +void +convert_signed(i8 v8, i16 v16, i32 v32, i64 v64) +{ + v8 = v16; /* expect: 132 */ + v8 = v32; /* expect: 132 */ + v8 = v64; /* expect: 132 */ + + v16 = v8; + v16 = v32; /* expect: 132 */ + v16 = v64; /* expect: 132 */ + + v32 = v8; + v32 = v16; + v32 = v64; /* expect: 132 */ + + v64 = v8; + v64 = v16; + v64 = v32; +} Index: src/tests/usr.bin/xlint/lint1/msg_132.exp diff -u src/tests/usr.bin/xlint/lint1/msg_132.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_132.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_132.exp:1.1 Sat Jan 2 10:22:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_132.exp Sun Feb 28 21:39:17 2021 @@ -1 +1,12 @@ -msg_132.c(6): syntax error ':' [249] +msg_132.c(29): warning: conversion from 'unsigned short' to 'unsigned char' may lose accuracy [132] +msg_132.c(30): warning: conversion from 'unsigned int' to 'unsigned char' may lose accuracy [132] +msg_132.c(31): warning: conversion from 'unsigned long long' to 'unsigned char' may lose accuracy [132] +msg_132.c(34): warning: conversion from 'unsigned int' to 'unsigned short' may lose accuracy [132] +msg_132.c(35): warning: conversion from 'unsigned long long' to 'unsigned short' may lose accuracy [132] +msg_132.c(39): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] +msg_132.c(49): warning: conversion from 'short' to 'signed char' may lose accuracy [132] +msg_132.c(50): warning: conversion from 'int' to 'signed char' may lose accuracy [132] +msg_132.c(51): warning: conversion from 'long long' to 'signed char' may lose accuracy [132] +msg_132.c(54): warning: conversion from 'int' to 'short' may lose accuracy [132] +msg_132.c(55): warning: conversion from 'long long' to 'short' may lose accuracy [132] +msg_132.c(59): warning: conversion from 'long long' to 'int' may lose accuracy [132]
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: tnn Date: Sun Feb 28 21:34:34 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: sys_machdep.c Log Message: support building alpha kernel without PCI bus To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/sys_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/alpha/alpha/sys_machdep.c diff -u src/sys/arch/alpha/alpha/sys_machdep.c:1.21 src/sys/arch/alpha/alpha/sys_machdep.c:1.22 --- src/sys/arch/alpha/alpha/sys_machdep.c:1.21 Mon Feb 6 02:14:12 2012 +++ src/sys/arch/alpha/alpha/sys_machdep.c Sun Feb 28 21:34:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.21 2012/02/06 02:14:12 matt Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.22 2021/02/28 21:34:34 tnn Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.21 2012/02/06 02:14:12 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.22 2021/02/28 21:34:34 tnn Exp $"); #include #include @@ -188,6 +188,7 @@ sys_sysarch(struct lwp *l, const struct break; } +#if NPCI > 0 case ALPHA_PCI_CONF_READWRITE: { struct alpha_pci_conf_readwrite_args args; @@ -222,6 +223,7 @@ sys_sysarch(struct lwp *l, const struct } break; } +#endif default: error = EINVAL;
CVS commit: src/sys/arch/powerpc/include
Module Name:src Committed By: thorpej Date: Sun Feb 28 20:31:33 UTC 2021 Modified Files: src/sys/arch/powerpc/include: ofw_machdep.h Log Message: Bump OFW_MAX_TRANSLATIONS from 32 -> 48. 32 was already tight (at least on my Macs), and having having translations for the kernel itself present in the firmware's translation table bumped it over the 32-entry limit. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/include/ofw_machdep.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/arch/powerpc/include/ofw_machdep.h diff -u src/sys/arch/powerpc/include/ofw_machdep.h:1.2 src/sys/arch/powerpc/include/ofw_machdep.h:1.3 --- src/sys/arch/powerpc/include/ofw_machdep.h:1.2 Fri Feb 19 05:21:39 2021 +++ src/sys/arch/powerpc/include/ofw_machdep.h Sun Feb 28 20:31:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_machdep.h,v 1.2 2021/02/19 05:21:39 thorpej Exp $ */ +/* $NetBSD: ofw_machdep.h,v 1.3 2021/02/28 20:31:32 thorpej Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ struct OF_translation { uint32_t mode; }; -#define OFW_MAX_TRANSLATIONS 32 +#define OFW_MAX_TRANSLATIONS 48 extern int ofw_chosen; /* cached handle for "/chosen" */ extern struct OF_translation ofw_translations[OFW_MAX_TRANSLATIONS];
CVS commit: src/sys/arch/macppc
Module Name:src Committed By: thorpej Date: Sun Feb 28 20:27:40 UTC 2021 Modified Files: src/sys/arch/macppc/include: loadfile_machdep.h src/sys/arch/macppc/stand/ofwboot: Locore.c Makefile boot.c ofdev.c openfirm.h version Added Files: src/sys/arch/macppc/stand/ofwboot: loadfile_machdep.c Log Message: - When starting the boot program, cache a bunch of OFW frequently used ihandles / phandles, rather than fetching them all the time. - Change the signature of OF_call_method() to take an array of cells for the inputs and outputs, rather than using variadic arguments. This makes it much easier to use OF_call_method() when the format of the arguments passed to a given method are determined at run-time (due to e.g. #address-cells). - Properly inform OpenFirmware where the kernel is loaded by using "claim" on /chosen/memory and, if running in virtual-mode, using "claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu to enter the translation. (The kernel is still always mapped VA==PA.) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/macppc/include/loadfile_machdep.h cvs rdiff -u -r1.34 -r1.35 src/sys/arch/macppc/stand/ofwboot/Locore.c cvs rdiff -u -r1.59 -r1.60 src/sys/arch/macppc/stand/ofwboot/Makefile cvs rdiff -u -r1.30 -r1.31 src/sys/arch/macppc/stand/ofwboot/boot.c cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/stand/ofwboot/loadfile_machdep.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/macppc/stand/ofwboot/ofdev.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/stand/ofwboot/openfirm.h cvs rdiff -u -r1.14 -r1.15 src/sys/arch/macppc/stand/ofwboot/version 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/macppc/include/loadfile_machdep.h diff -u src/sys/arch/macppc/include/loadfile_machdep.h:1.6 src/sys/arch/macppc/include/loadfile_machdep.h:1.7 --- src/sys/arch/macppc/include/loadfile_machdep.h:1.6 Wed Aug 6 21:57:50 2014 +++ src/sys/arch/macppc/include/loadfile_machdep.h Sun Feb 28 20:27:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile_machdep.h,v 1.6 2014/08/06 21:57:50 joerg Exp $ */ +/* $NetBSD: loadfile_machdep.h,v 1.7 2021/02/28 20:27:40 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -36,9 +36,21 @@ #define LOADADDR(a) (((u_long)(a)) + offset) #define ALIGNENTRY(a) ((u_long)(a)) + +#ifdef _STANDALONE +ssize_t macppc_read(int, void *, size_t); +void * macppc_memcpy(void *, const void *, size_t); +void * macppc_memset(void *, int, size_t); + +#define READ(f, b, c) macppc_read((f), (void *)LOADADDR(b), (c)) +#define BCOPY(s, d, c) macppc_memcpy((void *)LOADADDR(d), (void *)(s), (c)) +#define BZERO(d, c) macppc_memset((void *)LOADADDR(d), 0, (c)) +#else #define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) #define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) #define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) +#endif /* _STANDALONE */ + #define WARN(a) do { \ (void)printf a; \ if (errno) \ Index: src/sys/arch/macppc/stand/ofwboot/Locore.c diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.34 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.35 --- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.34 Wed Apr 15 13:33:13 2020 +++ src/sys/arch/macppc/stand/ofwboot/Locore.c Sun Feb 28 20:27:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.34 2020/04/15 13:33:13 rin Exp $ */ +/* $NetBSD: Locore.c,v 1.35 2021/02/28 20:27:40 thorpej Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -201,6 +201,34 @@ openfirmware(void *arg) } #endif +int ofw_real_mode; +int ofw_address_cells; +int ofw_size_cells; + +int ofw_root; /* / */ +int ofw_options; /* /options */ +int ofw_openprom; /* /openprom */ +int ofw_chosen; /* /chosen (package) */ +int ofw_stdin; /* /chosen/stdin */ +int ofw_stdout; /* /chosen/stdout */ +int ofw_memory_ihandle; /* /chosen/memory */ +int ofw_mmu_ihandle; /* /chosen/mmu */ + +bool +ofw_option_truefalse(const char *prop, int proplen) +{ + /* These are all supposed to be strings. */ + switch (prop[0]) { + case 'y': + case 'Y': + case 't': + case 'T': + case '1': + return true; + } + return false; +} + static void startup(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl) { @@ -623,9 +651,9 @@ OF_chain(void *virt, u_int size, boot_en #endif int -OF_call_method(const char *method, int ihandle, int nargs, int nreturns, ...) +OF_call_method(const char *method, int ihandle, int nargs, int nreturns, +int *cells) { - va_list ap; static struct { const char *name; int nargs; @@ -642,47 +670,47 @@ OF_call_method(const char *method, int i if (nargs > 6) return -1; + args.nargs = nargs + 2; args.nreturns = nreturns + 1; args.method = method; args.ihandle = ihandle; - va_start(ap, nreturns); + for (ip = args.args_n_results + (n = nargs); --n >= 0;) - *--ip =
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Feb 28 20:17:14 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh Added Files: src/tests/usr.bin/xlint/lint1: d_c99_union_init5.c Log Message: lint: add test to demonstrate that PR bin/20264 has been fixed To generate a diff of this commit: cvs rdiff -u -r1.1022 -r1.1023 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.32 -r1.33 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_c99_union_init5.c cvs rdiff -u -r1.30 -r1.31 src/tests/usr.bin/xlint/lint1/t_integration.sh 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/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1022 src/distrib/sets/lists/tests/mi:1.1023 --- src/distrib/sets/lists/tests/mi:1.1022 Sun Feb 21 21:26:26 2021 +++ src/distrib/sets/lists/tests/mi Sun Feb 28 20:17:13 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1022 2021/02/21 21:26:26 rillig Exp $ +# $NetBSD: mi,v 1.1023 2021/02/28 20:17:13 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5785,6 +5785,7 @@ ./usr/tests/usr.bin/xlint/lint1/d_c99_union_init2.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_union_init3.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_union_init4.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/d_c99_union_init5.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c9x_array_init.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c9x_recursive_init.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.32 src/tests/usr.bin/xlint/lint1/Makefile:1.33 --- src/tests/usr.bin/xlint/lint1/Makefile:1.32 Sun Feb 21 08:05:51 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Feb 28 20:17:14 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.32 2021/02/21 08:05:51 rillig Exp $ +# $NetBSD: Makefile,v 1.33 2021/02/28 20:17:14 rillig Exp $ NOMAN= # defined @@ -39,6 +39,7 @@ FILES+= d_c99_union_init1.c FILES+= d_c99_union_init2.c FILES+= d_c99_union_init3.c FILES+= d_c99_union_init4.c +FILES+= d_c99_union_init5.c FILES+= d_c9x_array_init.c FILES+= d_c9x_recursive_init.c FILES+= d_cast_fun_array_param.c Index: src/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.30 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.31 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.30 Sun Feb 21 08:05:51 2021 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Sun Feb 28 20:17:14 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.30 2021/02/21 08:05:51 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.31 2021/02/28 20:17:14 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -102,6 +102,7 @@ test_case c99_init test_case c99_nested_struct test_case c99_union_cast test_case c99_union_init4 +test_case c99_union_init5 test_case cast_fun_array_param test_case cast_typeof test_case decl_old_style_arguments Added files: Index: src/tests/usr.bin/xlint/lint1/d_c99_union_init5.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_c99_union_init5.c:1.1 --- /dev/null Sun Feb 28 20:17:14 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_union_init5.c Sun Feb 28 20:17:14 2021 @@ -0,0 +1,18 @@ +/* $NetBSD: d_c99_union_init5.c,v 1.1 2021/02/28 20:17:14 rillig Exp $ */ +# 3 "d_c99_union_init5.c" + +/* + * PR bin/20264: lint(1) has problems with named member initialization + * + * Has been fixed somewhere between 2005.12.24.20.47.56 and + * 2006.12.19.19.06.44. +*/ + +union mist { + char *p; + int a[1]; +}; + +union mist xx = { +.a = { 7 } +};
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Feb 28 20:04:52 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: document where in C99 the behavior of cconv is specified To generate a diff of this commit: cvs rdiff -u -r1.230 -r1.231 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.230 src/usr.bin/xlint/lint1/tree.c:1.231 --- src/usr.bin/xlint/lint1/tree.c:1.230 Sun Feb 28 19:24:15 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Feb 28 20:04:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.230 2021/02/28 19:24:15 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.231 2021/02/28 20:04:52 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.230 2021/02/28 19:24:15 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.231 2021/02/28 20:04:52 rillig Exp $"); #endif #include @@ -673,6 +673,10 @@ build(op_t op, tnode_t *ln, tnode_t *rn) * Arrays of type T are converted into pointers to type T. * Functions are converted to pointers to functions. * Lvalues are converted to rvalues. + * + * C99 6.3 "Conversions" + * C99 6.3.2 "Other operands" + * C99 6.3.2.1 "Lvalues, arrays, and function designators" */ tnode_t * cconv(tnode_t *tn)
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Feb 28 19:24:15 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: lint1.h tree.c Log Message: lint: replace wrong comment with assertion The broad type of a value is indeed stored in the value itself, in the member v_tspec. For nodes that refer to this value, it is redundantly stored, it always equals tn->tn_type->t_tspec. After initialization, neither tn->tn_type nor val->v_tspec are modified. This is not ensured by the compiler but has to be analyzed manually. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.229 -r1.230 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.68 src/usr.bin/xlint/lint1/lint1.h:1.69 --- src/usr.bin/xlint/lint1/lint1.h:1.68 Sun Feb 28 19:16:05 2021 +++ src/usr.bin/xlint/lint1/lint1.h Sun Feb 28 19:24:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.68 2021/02/28 19:16:05 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.69 2021/02/28 19:24:15 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -464,18 +464,17 @@ check_printf(const char *fmt, ...) #endif static inline bool -is_nonzero_val(tspec_t t, const val_t *val) +is_nonzero_val(const val_t *val) { - return is_floating(t) ? val->v_ldbl != 0.0 : val->v_quad != 0; + return is_floating(val->v_tspec) + ? val->v_ldbl != 0.0 + : val->v_quad != 0; } static inline bool constant_is_nonzero(const tnode_t *tn) { - /* - * XXX: It's strange that val_t doesn't know itself whether it - * holds a floating-point or an integer value. - */ lint_assert(tn->tn_op == CON); - return is_nonzero_val(tn->tn_type->t_tspec, tn->tn_val); + lint_assert(tn->tn_type->t_tspec == tn->tn_val->v_tspec); + return is_nonzero_val(tn->tn_val); } Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.229 src/usr.bin/xlint/lint1/tree.c:1.230 --- src/usr.bin/xlint/lint1/tree.c:1.229 Sun Feb 28 19:16:05 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Feb 28 19:24:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.229 2021/02/28 19:16:05 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.230 2021/02/28 19:24:15 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.229 2021/02/28 19:16:05 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.230 2021/02/28 19:24:15 rillig Exp $"); #endif #include @@ -2289,7 +2289,7 @@ convert_constant(op_t op, int arg, type_ if (nt == BOOL) { /* C99 6.3.1.2 */ nv->v_ansiu = false; - nv->v_quad = is_nonzero_val(ot, v) ? 1 : 0; + nv->v_quad = is_nonzero_val(v) ? 1 : 0; return; }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Feb 28 19:16:05 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: func.c lint1.h tree.c Log Message: lint: rename is_nonzero to constant_is_nonzero The new function name emphasizes that the given node must have the operator CON. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.67 -r1.68 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.228 -r1.229 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.73 src/usr.bin/xlint/lint1/func.c:1.74 --- src/usr.bin/xlint/lint1/func.c:1.73 Mon Feb 22 15:09:50 2021 +++ src/usr.bin/xlint/lint1/func.c Sun Feb 28 19:16:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.73 2021/02/22 15:09:50 rillig Exp $ */ +/* $NetBSD: func.c,v 1.74 2021/02/28 19:16:05 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: func.c,v 1.73 2021/02/22 15:09:50 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.74 2021/02/28 19:16:05 rillig Exp $"); #endif #include @@ -740,7 +740,7 @@ while1(tnode_t *tn) pushctrl(T_WHILE); cstmt->c_loop = true; if (tn != NULL && tn->tn_op == CON) - cstmt->c_infinite = is_nonzero(tn); + cstmt->c_infinite = constant_is_nonzero(tn); check_getopt_begin_while(tn); expr(tn, false, true, true, false); @@ -801,7 +801,7 @@ do2(tnode_t *tn) tn = check_controlling_expression(tn); if (tn != NULL && tn->tn_op == CON) { - cstmt->c_infinite = is_nonzero(tn); + cstmt->c_infinite = constant_is_nonzero(tn); if (!cstmt->c_infinite && cstmt->c_cont) /* continue in 'do ... while (0)' loop */ error(323); @@ -858,7 +858,7 @@ for1(tnode_t *tn1, tnode_t *tn2, tnode_t expr(tn2, false, true, true, false); cstmt->c_infinite = - tn2 == NULL || (tn2->tn_op == CON && is_nonzero(tn2)); + tn2 == NULL || (tn2->tn_op == CON && constant_is_nonzero(tn2)); /* Checking the reinitialization expression is done in for2() */ Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.67 src/usr.bin/xlint/lint1/lint1.h:1.68 --- src/usr.bin/xlint/lint1/lint1.h:1.67 Sun Feb 28 03:59:28 2021 +++ src/usr.bin/xlint/lint1/lint1.h Sun Feb 28 19:16:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.67 2021/02/28 03:59:28 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.68 2021/02/28 19:16:05 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -470,7 +470,7 @@ is_nonzero_val(tspec_t t, const val_t *v } static inline bool -is_nonzero(const tnode_t *tn) +constant_is_nonzero(const tnode_t *tn) { /* * XXX: It's strange that val_t doesn't know itself whether it Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.228 src/usr.bin/xlint/lint1/tree.c:1.229 --- src/usr.bin/xlint/lint1/tree.c:1.228 Sun Feb 28 18:51:51 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Feb 28 19:16:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.228 2021/02/28 18:51:51 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.229 2021/02/28 19:16:05 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.228 2021/02/28 18:51:51 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.229 2021/02/28 19:16:05 rillig Exp $"); #endif #include @@ -3188,8 +3188,8 @@ fold_test(tnode_t *tn) v->v_tspec = tn->tn_type->t_tspec; lint_assert(v->v_tspec == INT || (Tflag && v->v_tspec == BOOL)); - l = is_nonzero(tn->tn_left); - r = modtab[tn->tn_op].m_binary && is_nonzero(tn->tn_right); + l = constant_is_nonzero(tn->tn_left); + r = modtab[tn->tn_op].m_binary && constant_is_nonzero(tn->tn_right); switch (tn->tn_op) { case NOT:
CVS commit: src/sys/arch/powerpc/oea
Module Name:src Committed By: thorpej Date: Sun Feb 28 19:01:11 UTC 2021 Modified Files: src/sys/arch/powerpc/oea: ofw_subr.S Log Message: Minor re-ordering of a few things, and issue an isync barrier at all critical MMU on/off transitions. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/oea/ofw_subr.S 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/powerpc/oea/ofw_subr.S diff -u src/sys/arch/powerpc/oea/ofw_subr.S:1.19 src/sys/arch/powerpc/oea/ofw_subr.S:1.20 --- src/sys/arch/powerpc/oea/ofw_subr.S:1.19 Wed Feb 24 17:35:39 2021 +++ src/sys/arch/powerpc/oea/ofw_subr.S Sun Feb 28 19:01:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_subr.S,v 1.19 2021/02/24 17:35:39 thorpej Exp $ */ +/* $NetBSD: ofw_subr.S,v 1.20 2021/02/28 19:01:11 thorpej Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -148,10 +148,6 @@ ENTRY_NOPROFILE(openfirmware_trampoline) */ stwu %r1,-48(%r1) - lis %r4,ofentry@ha /* get firmware entry point */ - lwz %r4,ofentry@l(%r4) - mtlr %r4 - #ifdef FIRMWORKSBUGS lis %r4,ofwreal_incharge@ha lwz %r4,ofwreal_incharge@l(%r4) @@ -164,9 +160,12 @@ ENTRY_NOPROFILE(openfirmware_trampoline) mfmsr %r4 /* save msr */ stw %r4,8(%r1) - li %r0,0 /* clear battable translations */ + li %r0,0 /* disable MMU */ mtmsr %r0 + isync + #if defined (PPC_OEA) || defined (PPC_OEA64_BRIDGE) + /* clear BAT translations */ mtdbatu 2,%r0 mtdbatu 3,%r0 mtibatu 2,%r0 @@ -202,13 +201,21 @@ ENTRY_NOPROFILE(openfirmware_trampoline) addi %r5,%r5,_C_LABEL(ofw_battable)@l stw %r5,CI_BATTABLE(%r4) - lis %r4,ofwmsr@ha /* Open Firmware msr */ + lis %r4,ofentry@ha /* get firmware entry point */ + lwz %r4,ofentry@l(%r4) + mtlr %r4 + + lis %r4,ofwmsr@ha /* load Open Firmware MSR */ lwz %r5,ofwmsr@l(%r4) mtmsr %r5 isync blrl/* call Open Firmware */ + li %r0,0 /* ensure disable MMU is disabled */ + mtmsr %r0 + isync + /* curcpu()->ci_battable = */ GET_CPUINFO(%r4) lis %r5,_C_LABEL(battable)@ha
CVS commit: src/usr.bin/xlint
Module Name:src Committed By: rillig Date: Sun Feb 28 18:51:51 UTC 2021 Modified Files: src/usr.bin/xlint/common: inittyp.c lint.h src/usr.bin/xlint/lint1: decl.c lex.c tree.c Log Message: lint: rename members and access macros of the basic types Having the measurement unit in the variable name prevents accidental confusion between bits and bytes, especially since usually the word 'size' means the size in bytes, while 'width' means the size in bits, at least for integer types. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/common/inittyp.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/common/lint.h cvs rdiff -u -r1.142 -r1.143 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/xlint/lint1/lex.c cvs rdiff -u -r1.227 -r1.228 src/usr.bin/xlint/lint1/tree.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/xlint/common/inittyp.c diff -u src/usr.bin/xlint/common/inittyp.c:1.19 src/usr.bin/xlint/common/inittyp.c:1.20 --- src/usr.bin/xlint/common/inittyp.c:1.19 Sat Feb 20 19:10:37 2021 +++ src/usr.bin/xlint/common/inittyp.c Sun Feb 28 18:51:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: inittyp.c,v 1.19 2021/02/20 19:10:37 rillig Exp $ */ +/* $NetBSD: inittyp.c,v 1.20 2021/02/28 18:51:51 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: inittyp.c,v 1.19 2021/02/20 19:10:37 rillig Exp $"); +__RCSID("$NetBSD: inittyp.c,v 1.20 2021/02/28 18:51:51 rillig Exp $"); #endif #include @@ -125,8 +125,9 @@ inittyp(void) DCOMPLEX, DCOMPLEX, 0, 0, 1, 1, 1, 1, "double _Complex" } }, /* - * XXX: with -p, LCOMPLEX.tt_psz != 2 * LDOUBLE.tt_psz. - * This may or may not have been intentional. + * XXX: with -p, LCOMPLEX.tt_portable_size_in_bits != + * 2 * LDOUBLE.tt_portable_size_in_bits. + * This may or may not have been intentional. */ { LCOMPLEX, { LDOUBLE_SIZE * 2, 64 * 2, LCOMPLEX, LCOMPLEX, @@ -158,7 +159,8 @@ inittyp(void) ttab[ittab[i].it_tspec] = ittab[i].it_ttab; if (!pflag) { for (i = 0; i < NTSPEC; i++) - ttab[i].tt_psz = ttab[i].tt_sz; + ttab[i].tt_portable_size_in_bits = + ttab[i].tt_size_in_bits; } if (Tflag) { ttab[BOOL].tt_is_integer = false; Index: src/usr.bin/xlint/common/lint.h diff -u src/usr.bin/xlint/common/lint.h:1.25 src/usr.bin/xlint/common/lint.h:1.26 --- src/usr.bin/xlint/common/lint.h:1.25 Sat Jan 16 02:40:02 2021 +++ src/usr.bin/xlint/common/lint.h Sun Feb 28 18:51:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint.h,v 1.25 2021/01/16 02:40:02 rillig Exp $ */ +/* $NetBSD: lint.h,v 1.26 2021/02/28 18:51:51 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -92,9 +92,9 @@ typedef enum { * size of types, name and classification */ typedef struct { - size_t tt_sz; /* size in bits */ - size_t tt_psz; /* size, different from tt_sz - if pflag is set */ + size_t tt_size_in_bits; + size_t tt_portable_size_in_bits; /* different from tt_size_in_bits + * if pflag is set */ tspec_t tt_signed_counterpart; tspec_t tt_unsigned_counterpart; bool tt_is_integer : 1; /* integer type */ @@ -106,8 +106,8 @@ typedef struct { const char *tt_name; /* name of the type */ } ttab_t; -#define size(t) (ttab[t].tt_sz) -#define psize(t) (ttab[t].tt_psz) +#define size_in_bits(t) (ttab[t].tt_size_in_bits) +#define portable_size_in_bits(t) (ttab[t].tt_portable_size_in_bits) #define signed_type(t) (ttab[t].tt_signed_counterpart) #define unsigned_type(t) (ttab[t].tt_unsigned_counterpart) #define is_integer(t) (ttab[t].tt_is_integer) Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.142 src/usr.bin/xlint/lint1/decl.c:1.143 --- src/usr.bin/xlint/lint1/decl.c:1.142 Sun Feb 28 03:14:44 2021 +++ src/usr.bin/xlint/lint1/decl.c Sun Feb 28 18:51:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.142 2021/02/28 03:14:44 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.143 2021/02/28 18:51:51 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.142 2021/02/28 03:14:44 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.143 2021/02/28 18:51:51 rillig Exp $"); #endif #include @@ -917,7 +917,7 @@ length(const type_t *tp, const char *nam } /* FALLTHROUGH */ default: - elsz = size(tp->t_tspec); + elsz = size_in_bits(tp->t_tspec); if (elsz <= 0) LERROR("length(%d)", elsz); break; @@ -944,7 +944,7 @@ alignment_in_bits(const type_t *tp) error(14); a = WORST_ALIGN(1) * CHAR_SIZE; } else { - if ((a = size(t)) == 0) { + if ((a = size_in_bits(t)) == 0) { a = CHAR_SIZE; } else if (a > WORST_ALIGN(1) * CHAR_SIZE) { a = WORST_ALIGN(1) *
CVS commit: src/usr.bin/xlint/lint2
Module Name:src Committed By: rillig Date: Sun Feb 28 18:17:08 UTC 2021 Added Files: src/usr.bin/xlint/lint2: check-msgs.lua Log Message: lint2: add redundancy checker for comments in source code Based on the redundancy checker for lint1. No functional change. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/usr.bin/xlint/lint2/check-msgs.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/usr.bin/xlint/lint2/check-msgs.lua diff -u /dev/null src/usr.bin/xlint/lint2/check-msgs.lua:1.1 --- /dev/null Sun Feb 28 18:17:08 2021 +++ src/usr.bin/xlint/lint2/check-msgs.lua Sun Feb 28 18:17:08 2021 @@ -0,0 +1,110 @@ +#! /usr/bin/lua +-- $NetBSD: check-msgs.lua,v 1.1 2021/02/28 18:17:08 rillig Exp $ + +--[[ + +usage: lua ./check-msgs.lua *.c + +Check that the message text in the comments of the C source code matches the +actual user-visible message text in msg.c. + +]] + + +local function load_messages(fname) + local msgs = {} + + local f = assert(io.open(fname, "r")) + for line in f:lines() do +local msg, id = line:match("%s*\"(.+)\",%s*/%*%s*(%d+)%s*%*/$") +if msg ~= nil then + msgs[tonumber(id)] = msg +end + end + + f:close() + + return msgs +end + + +local function check_message(fname, lineno, id, comment, msgs, errors) + local msg = msgs[id] + + if msg == nil then +errors:add("%s:%d: id=%d not found", fname, lineno, id) +return + end + + msg = msg:gsub("/%*", "**") + msg = msg:gsub("%*/", "**") + msg = msg:gsub("\\t", "t") -- for lint2 + msg = msg:gsub("\\(.)", "%1") + + if comment == msg then +return + end + + local prefix = comment:match("^(.-)%s*%.%.%.$") + if prefix ~= nil and msg:find(prefix, 1, 1) == 1 then +return + end + + errors:add("%s:%d: id=%-3d msg=%-40s comment=%s", +fname, lineno, id, msg, comment) +end + + +local function collect_errors(fname, msgs) + local errors = {} + errors.add = function(self, fmt, ...) +table.insert(self, fmt:format(...)) + end + + local f = assert(io.open(fname, "r")) + local lineno = 0 + local prev = "" + for line in f:lines() do +lineno = lineno + 1 + +local func, id = line:match("^%s+(%w+)%((%d+)[),]") +id = tonumber(id) +if func == "msg" then + local comment = prev:match("^%s+/%* (.+) %*/$") + if comment ~= nil then +check_message(fname, lineno, id, comment, msgs, errors) + else +errors:add("%s:%d: missing comment for %d: /* %s */", + fname, lineno, id, msgs[id]) + end +end + +prev = line + end + + f:close() + + return errors +end + + +local function check_file(fname, msgs) + local errors = collect_errors(fname, msgs) + for _, err in ipairs(errors) do +print(err) + end + return #errors == 0 +end + + +local function main(arg) + local msgs = load_messages("msg.c") + local ok = true + for _, fname in ipairs(arg) do +ok = check_file(fname, msgs) and ok + end + return ok +end + + +os.exit(main(arg))
CVS commit: src/usr.bin/xlint/lint2
Module Name:src Committed By: rillig Date: Sun Feb 28 17:16:51 UTC 2021 Modified Files: src/usr.bin/xlint/lint2: chk.c read.c Log Message: lint2: align comments in the code with actual messages To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/xlint/lint2/chk.c \ src/usr.bin/xlint/lint2/read.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/xlint/lint2/chk.c diff -u src/usr.bin/xlint/lint2/chk.c:1.39 src/usr.bin/xlint/lint2/chk.c:1.40 --- src/usr.bin/xlint/lint2/chk.c:1.39 Mon Feb 22 15:09:50 2021 +++ src/usr.bin/xlint/lint2/chk.c Sun Feb 28 17:16:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: chk.c,v 1.39 2021/02/22 15:09:50 rillig Exp $ */ +/* $NetBSD: chk.c,v 1.40 2021/02/28 17:16:50 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: chk.c,v 1.39 2021/02/22 15:09:50 rillig Exp $"); +__RCSID("$NetBSD: chk.c,v 1.40 2021/02/28 17:16:50 rillig Exp $"); #endif #include @@ -218,7 +218,7 @@ chkmd(hte_t *hte) continue; } pos1 = xstrdup(mkpos(>s_pos)); - /* %s multiply defined\t%s :: %s */ + /* %s multiply defined \t%s :: %s */ msg(3, hte->h_name, pos1, mkpos(>s_pos)); free(pos1); } @@ -273,7 +273,7 @@ chkvtui(hte_t *hte, sym_t *def, sym_t *d * accepted for now. */ pos1 = xstrdup(mkpos(>s_pos)); -/* %s value must be decl. before use %s :: %s */ +/* %s function value must be declared ... */ msg(17, hte->h_name, pos1, mkpos(>f_pos)); free(pos1); @@ -282,7 +282,7 @@ chkvtui(hte_t *hte, sym_t *def, sym_t *d } if (!eq || (sflag && dowarn)) { pos1 = xstrdup(mkpos(>s_pos)); - /* %s value used inconsistently\t%s :: %s */ + /* %s value used inconsistently \t%s :: %s */ msg(4, hte->h_name, pos1, mkpos(>f_pos)); free(pos1); } @@ -323,7 +323,7 @@ chkvtdi(hte_t *hte, sym_t *def, sym_t *d } if (!eq || (sflag && dowarn)) { pos1 = xstrdup(mkpos(>s_pos)); - /* %s value declared inconsistently\t%s :: %s */ + /* %s value declared inconsistently (%s != %s) \t... */ msg(5, hte->h_name, type_name(xt1), type_name(xt2), pos1, mkpos(>s_pos)); free(pos1); @@ -406,7 +406,7 @@ chkfaui(hte_t *hte, sym_t *def, sym_t *d */ } else { pos1 = xstrdup(mkpos(pos1p)); - /* %s: variable # of args\t%s :: %s */ + /* %s: variable # of args \t%s :: %s */ msg(7, hte->h_name, pos1, mkpos(>f_pos)); free(pos1); continue; @@ -589,7 +589,7 @@ chkau(hte_t *hte, int n, sym_t *def, sym } pos1 = xstrdup(mkpos(pos1p)); - /* %s, arg %d used inconsistently\t%s[%s] :: %s[%s] */ + /* %s, arg %d used inconsistently \t%s[%s] :: %s[%s] */ msg(6, hte->h_name, n, pos1, type_name(arg1), mkpos(>f_pos), type_name(arg2)); free(pos1); @@ -1019,7 +1019,7 @@ static void badfmt(hte_t *hte, fcall_t *call) { - /* %s: malformed format string\t%s */ + /* %s: malformed format string \t%s */ msg(13, hte->h_name, mkpos(>f_pos)); } @@ -1027,7 +1027,7 @@ static void inconarg(hte_t *hte, fcall_t *call, int n) { - /* %s, arg %d inconsistent with format\t%s(%d) */ + /* %s, arg %d inconsistent with format \t%s */ msg(14, hte->h_name, n, mkpos(>f_pos)); } @@ -1102,14 +1102,14 @@ chkrvu(hte_t *hte, sym_t *def) /* %s returns value which is always ignored */ msg(8, hte->h_name); } else if (used && ignored) { - /* %s returns value which is sometimes ign. */ + /* %s returns value which is sometimes ignored */ msg(9, hte->h_name); } } else { /* function has no return value */ for (call = hte->h_calls; call != NULL; call = call->f_next) { if (call->f_rused) -/* %s value is used( %s ), but none ret. */ +/* %s value is used( %s ), but none returned */ msg(10, hte->h_name, mkpos(>f_pos)); } } @@ -1178,8 +1178,8 @@ chkadecl(hte_t *hte, sym_t *def, sym_t * continue; } } - /* %s: variable # of args declared\t%s :: %s */ pos1 = xstrdup(mkpos(>s_pos)); + /* %s: variable # of args declared \t%s :: %s */ msg(12, hte->h_name, pos1, mkpos(>s_pos)); free(pos1); } Index: src/usr.bin/xlint/lint2/read.c diff -u src/usr.bin/xlint/lint2/read.c:1.39 src/usr.bin/xlint/lint2/read.c:1.40 --- src/usr.bin/xlint/lint2/read.c:1.39 Fri Feb 19 22:27:49 2021 +++ src/usr.bin/xlint/lint2/read.c Sun Feb 28 17:16:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.39 2021/02/19 22:27:49 rillig Exp $ */ +/* $NetBSD: read.c,v 1.40 2021/02/28 17:16:50 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: read.c,v 1.39 2021/02/19 22:27:49 rillig Exp $"); +__RCSID("$NetBSD: read.c,v 1.40 2021/02/28 17:16:50 rillig Exp $"); #endif #include @@ -461,7
CVS commit: src/libexec/httpd
Module Name:src Committed By: rillig Date: Sun Feb 28 16:10:00 UTC 2021 Modified Files: src/libexec/httpd: printenv.lua Log Message: libexec/httpd: fix cross-site scripting in Lua example curl \ --header 'NAME: ' \ 'http://127.0.0.1:8080/test/printenv?=' To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/libexec/httpd/printenv.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/httpd/printenv.lua diff -u src/libexec/httpd/printenv.lua:1.4 src/libexec/httpd/printenv.lua:1.5 --- src/libexec/httpd/printenv.lua:1.4 Tue Aug 25 20:02:33 2020 +++ src/libexec/httpd/printenv.lua Sun Feb 28 16:10:00 2021 @@ -1,4 +1,4 @@ --- $NetBSD: printenv.lua,v 1.4 2020/08/25 20:02:33 leot Exp $ +-- $NetBSD: printenv.lua,v 1.5 2021/02/28 16:10:00 rillig Exp $ -- this small Lua script demonstrates the use of Lua in (bozo)httpd -- it will simply output the "environment" @@ -14,6 +14,10 @@ local httpd = require 'httpd' +function escape_html(s) + return s:gsub('&', ''):gsub('<', ''):gsub('>', ''):gsub('"', '') +end + function printenv(env, headers, query) -- we get the "environment" in the env table, the values are more @@ -40,18 +44,18 @@ function printenv(env, headers, query) httpd.print('Server Environment') -- print the list of "environment" variables for k, v in pairs(env) do - httpd.print(k .. '=' .. v .. '') + httpd.print(escape_html(k) .. '=' .. escape_html(v) .. '') end httpd.print('Request Headers') for k, v in pairs(headers) do - httpd.print(k .. '=' .. v .. '') + httpd.print(escape_html(k) .. '=' .. escape_html(v) .. '') end if query ~= nil then httpd.print('Query Variables') for k, v in pairs(query) do - httpd.print(k .. '=' .. v .. '') + httpd.print(escape_html(k) .. '=' .. escape_html(v) .. '') end end @@ -83,7 +87,7 @@ function form(env, header, query) end for k, v in pairs(query) do - httpd.print(k .. '=' .. v .. '') + httpd.print(escape_html(k) .. '=' .. escape_html(v) .. '') end else httpd.print('No values')
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Feb 28 12:45:47 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: check-msgs.lua Log Message: tests/lint: shorten code for checking redundancy in files No functional change. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/lint1/check-msgs.lua 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/xlint/lint1/check-msgs.lua diff -u src/usr.bin/xlint/lint1/check-msgs.lua:1.8 src/usr.bin/xlint/lint1/check-msgs.lua:1.9 --- src/usr.bin/xlint/lint1/check-msgs.lua:1.8 Sun Feb 28 12:40:00 2021 +++ src/usr.bin/xlint/lint1/check-msgs.lua Sun Feb 28 12:45:47 2021 @@ -1,5 +1,5 @@ #! /usr/bin/lua --- $NetBSD: check-msgs.lua,v 1.8 2021/02/28 12:40:00 rillig Exp $ +-- $NetBSD: check-msgs.lua,v 1.9 2021/02/28 12:45:47 rillig Exp $ --[[ @@ -113,14 +113,9 @@ end local function file_contains(filename, text) local f = assert(io.open(filename, "r")) - for line in f:lines() do -if line:find(text, 1, true) then - f:close() - return true -end - end + local found = f:read("a"):find(text, 1, true) f:close() - return false + return found end local function check_test_files(msgs)
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Feb 28 12:40:00 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_003.c msg_108.c msg_124.c msg_126.c msg_156.c msg_210.c msg_247.c msg_275.c msg_308.c src/usr.bin/xlint/lint1: check-msgs.lua Log Message: tests/lint: keep messages in test files in sync with actual messages Each of the tests named msg_*.c repeats the template of the message, to make the test somewhat self-contained when viewed in isolation. This creates a redundancy, and keeping track of this manually is next to impossible. I tried it and failed in 9 cases, even though it has just been 2 months since I myself created the initial files and I knew all the time that this redundancy exists. Be fool-proof for the future by checking this automatically. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_003.c \ src/tests/usr.bin/xlint/lint1/msg_126.c \ src/tests/usr.bin/xlint/lint1/msg_275.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_108.c \ src/tests/usr.bin/xlint/lint1/msg_156.c \ src/tests/usr.bin/xlint/lint1/msg_210.c \ src/tests/usr.bin/xlint/lint1/msg_308.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_124.c cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_247.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/check-msgs.lua 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/xlint/lint1/msg_003.c diff -u src/tests/usr.bin/xlint/lint1/msg_003.c:1.3 src/tests/usr.bin/xlint/lint1/msg_003.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_003.c:1.3 Sun Jan 31 11:12:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_003.c Sun Feb 28 12:40:00 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_003.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */ +/* $NetBSD: msg_003.c,v 1.4 2021/02/28 12:40:00 rillig Exp $ */ # 3 "msg_003.c" -// Test for message: %s declared in argument declaration list [3] +// Test for message: '%s' declared in argument declaration list [3] /*ARGSUSED*/ void Index: src/tests/usr.bin/xlint/lint1/msg_126.c diff -u src/tests/usr.bin/xlint/lint1/msg_126.c:1.3 src/tests/usr.bin/xlint/lint1/msg_126.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_126.c:1.3 Sun Jan 31 11:12:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_126.c Sun Feb 28 12:40:00 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_126.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */ +/* $NetBSD: msg_126.c,v 1.4 2021/02/28 12:40:00 rillig Exp $ */ # 3 "msg_126.c" -// Test for message: incompatible types in conditional [126] +// Test for message: incompatible types '%s' and '%s' in conditional [126] int max(int cond, void *ptr, double dbl) /* expect: 231, 231, 231 */ Index: src/tests/usr.bin/xlint/lint1/msg_275.c diff -u src/tests/usr.bin/xlint/lint1/msg_275.c:1.3 src/tests/usr.bin/xlint/lint1/msg_275.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_275.c:1.3 Sun Feb 28 01:36:46 2021 +++ src/tests/usr.bin/xlint/lint1/msg_275.c Sun Feb 28 12:40:00 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_275.c,v 1.3 2021/02/28 01:36:46 rillig Exp $ */ +/* $NetBSD: msg_275.c,v 1.4 2021/02/28 12:40:00 rillig Exp $ */ # 3 "msg_275.c" -// Test for message: cast discards 'const' from pointer target type [275] +// Test for message: cast discards 'const' from type '%s' [275] /* lint1-extra-flags: -h */ Index: src/tests/usr.bin/xlint/lint1/msg_108.c diff -u src/tests/usr.bin/xlint/lint1/msg_108.c:1.4 src/tests/usr.bin/xlint/lint1/msg_108.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_108.c:1.4 Sun Jan 31 11:12:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_108.c Sun Feb 28 12:40:00 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_108.c,v 1.4 2021/01/31 11:12:07 rillig Exp $ */ +/* $NetBSD: msg_108.c,v 1.5 2021/02/28 12:40:00 rillig Exp $ */ # 3 "msg_108.c" -// Test for message: operand of '%s' has incompatible type (%s != %s) [108] +// Test for message: operand of '%s' has invalid type (%s) [108] /* * Before tree.c 1.137 from 2021-01-19, taking the complement of a struct Index: src/tests/usr.bin/xlint/lint1/msg_156.c diff -u src/tests/usr.bin/xlint/lint1/msg_156.c:1.4 src/tests/usr.bin/xlint/lint1/msg_156.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_156.c:1.4 Sat Feb 27 13:43:36 2021 +++ src/tests/usr.bin/xlint/lint1/msg_156.c Sun Feb 28 12:40:00 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_156.c,v 1.4 2021/02/27 13:43:36 rillig Exp $ */ +/* $NetBSD: msg_156.c,v 1.5 2021/02/28 12:40:00 rillig Exp $ */ # 3 "msg_156.c" -// Test for message: enum type mismatch, arg #%d [156] +// Test for message: enum type mismatch, arg #%d (%s != %s) [156] enum color { RED = 1 << 0, Index: src/tests/usr.bin/xlint/lint1/msg_210.c diff -u src/tests/usr.bin/xlint/lint1/msg_210.c:1.4 src/tests/usr.bin/xlint/lint1/msg_210.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_210.c:1.4 Mon Feb 22 15:09:50 2021 +++ src/tests/usr.bin/xlint/lint1/msg_210.c Sun Feb 28
CVS commit: src/usr.bin/resize
Module Name:src Committed By: mrg Date: Sun Feb 28 09:04:28 UTC 2021 Modified Files: src/usr.bin/resize: Makefile Log Message: disable the rule to copy resize.c since it fails on r/o src trees: cp: /home/source/ab/HEAD/src/usr.bin/resize/resize.c: Permission denied To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/resize/Makefile 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/resize/Makefile diff -u src/usr.bin/resize/Makefile:1.5 src/usr.bin/resize/Makefile:1.6 --- src/usr.bin/resize/Makefile:1.5 Sun Feb 28 00:43:24 2021 +++ src/usr.bin/resize/Makefile Sun Feb 28 09:04:28 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2021/02/28 00:43:24 christos Exp $ +# $NetBSD: Makefile,v 1.6 2021/02/28 09:04:28 mrg Exp $ .include @@ -13,6 +13,8 @@ LDADD+= -lutil XTERM=${X11SRCDIR}/external/mit/xterm/dist +# XXX disable for now; breaks on r/o source trees. +.if 0 .if exists(${XTERM}) .for i in resize.c resize.man copy:: ${.CURDIR}/${i} @@ -20,6 +22,7 @@ ${.CURDIR}/${i}: ${XTERM}/${i} cp -p ${.ALLSRC} ${.TARGET} .endfor .endif +.endif CLEANFILES+=resize.1