From cac1167ac2af94ec39514976514f2bf1d89e1c28 Mon Sep 17 00:00:00 2001 From: purplerain Date: Thu, 7 Sep 2023 01:24:24 +0000 Subject: [PATCH] sync code with last improvements from OpenBSD --- games/hack/hack.c | 3 +- games/hack/hack.do_name.c | 3 +- games/hack/hack.main.c | 3 +- games/hack/hack.makemon.c | 3 +- games/hack/hack.objnam.c | 3 +- games/hack/hack.unix.c | 3 +- gnu/lib/libiberty/Makefile.bsd-wrapper | 3 +- .../binutils-2.17/Makefile.bsd-wrapper | 3 +- gnu/usr.bin/binutils/Makefile.bsd-wrapper | 3 +- gnu/usr.bin/binutils/gdb/gnu-v3-abi.c | 4 +- gnu/usr.bin/cvs/Makefile.bsd-wrapper | 3 +- gnu/usr.bin/texinfo/Makefile.bsd-wrapper | 3 +- include/uchar.h | 4 +- lib/libc/gen/exec.c | 4 +- lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 | 9 +- lib/libcrypto/man/OBJ_create.3 | 39 ++++++- lib/libcrypto/x509/x509_addr.c | 16 ++- libexec/spamd/spamd.c | 6 +- regress/usr.bin/ssh/Makefile | 5 +- regress/usr.bin/ssh/match-subsystem.sh | 90 +++++++++++++++ sbin/disklabel/editor.c | 8 +- share/man/man5/bsd.port.mk.5 | 98 ++++++++++------ sys/arch/amd64/amd64/vmm_machdep.c | 12 +- sys/arch/amd64/conf/Makefile.amd64 | 5 +- sys/arch/amd64/include/vmmvar.h | 3 +- sys/arch/amd64/stand/Makefile.inc | 5 +- sys/arch/arm64/conf/Makefile.arm64 | 5 +- sys/arch/arm64/stand/efiboot/Makefile | 5 +- sys/arch/armv7/conf/Makefile.armv7 | 5 +- sys/arch/armv7/stand/efiboot/Makefile | 5 +- sys/arch/i386/conf/Makefile.i386 | 5 +- sys/arch/i386/stand/Makefile.inc | 5 +- sys/dev/pci/drm/amd/amdgpu/amdgpu_devlist.h | 4 +- sys/dev/pci/pcidevs | 4 +- sys/dev/pci/pcidevs.h | 4 +- sys/dev/pci/pcidevs_data.h | 10 +- sys/kern/kern_clockintr.c | 79 ++++++------- sys/kern/kern_sched.c | 8 +- sys/kern/subr_prof.c | 5 +- sys/netinet/ip_input.c | 6 +- sys/netinet6/ip6_input.c | 6 +- sys/sys/clockintr.h | 16 +-- usr.bin/dig/dig.c | 6 +- usr.bin/ssh/servconf.c | 105 ++++++++++++++---- usr.bin/ssh/servconf.h | 14 ++- usr.bin/ssh/sshsig.c | 27 +++-- usr.bin/tput/tput.c | 4 +- usr.sbin/bgpctl/bgpctl.c | 3 +- usr.sbin/config/ukcutil.c | 4 +- usr.sbin/mopd/mopchk/mopchk.c | 12 +- usr.sbin/mrouted/cfparse.y | 15 +-- usr.sbin/tcpdump/parsenfsfh.c | 14 +-- usr.sbin/tcpdump/print-stp.c | 15 +-- usr.sbin/tcpdump/print-sunrpc.c | 5 +- usr.sbin/unbound/config.h.in | 3 - usr.sbin/unbound/configure | 1 - usr.sbin/unbound/configure.ac | 1 - usr.sbin/unbound/daemon/daemon.c | 4 +- usr.sbin/unbound/sldns/rrdef.h | 4 +- usr.sbin/unbound/util/tube.c | 2 +- usr.sbin/vmd/vioblk.c | 21 ++-- usr.sbin/vmd/vioscsi.c | 13 +-- usr.sbin/vmd/virtio.h | 4 +- usr.sbin/vmd/vm.c | 20 +--- 64 files changed, 491 insertions(+), 319 deletions(-) create mode 100644 regress/usr.bin/ssh/match-subsystem.sh diff --git a/games/hack/hack.c b/games/hack/hack.c index 640ff236a..298da1848 100644 --- a/games/hack/hack.c +++ b/games/hack/hack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.c,v 1.11 2016/01/10 15:12:20 mestre Exp $ */ +/* $OpenBSD: hack.c,v 1.12 2023/09/06 11:53:56 jsg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -69,7 +69,6 @@ #include "hack.h" extern char *nomovemsg; -extern char *exclam(); static void movobj(struct obj *, int, int); #ifdef QUEST diff --git a/games/hack/hack.do_name.c b/games/hack/hack.do_name.c index 07d928f28..1f75a2cbd 100644 --- a/games/hack/hack.do_name.c +++ b/games/hack/hack.do_name.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.do_name.c,v 1.11 2016/01/09 18:33:15 mestre Exp $ */ +/* $OpenBSD: hack.do_name.c,v 1.12 2023/09/06 11:53:56 jsg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -118,7 +118,6 @@ do_mname(void) coord cc; int cx,cy,lth,i; struct monst *mtmp, *mtmp2; - extern char *lmonnam(); cc = getpos(0, "the monster you want to name"); cx = cc.x; diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c index 96382aa2f..1a44c166a 100644 --- a/games/hack/hack.main.c +++ b/games/hack/hack.main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.main.c,v 1.25 2023/06/03 15:19:38 op Exp $ */ +/* $OpenBSD: hack.main.c,v 1.26 2023/09/06 11:53:56 jsg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -350,7 +350,6 @@ not_recovered: if(moves%2 == 0 || (!(Fast & ~INTRINSIC) && (!Fast || rn2(3)))) { - extern struct monst *makemon(); movemon(); if(!rn2(70)) (void) makemon((struct permonst *)0, 0, 0); diff --git a/games/hack/hack.makemon.c b/games/hack/hack.makemon.c index e607b6d54..9143b7551 100644 --- a/games/hack/hack.makemon.c +++ b/games/hack/hack.makemon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.makemon.c,v 1.8 2016/01/09 18:33:15 mestre Exp $ */ +/* $OpenBSD: hack.makemon.c,v 1.9 2023/09/06 11:53:56 jsg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -64,7 +64,6 @@ #include "hack.h" extern char fut_geno[]; -extern struct obj *mkobj_at(); struct monst zeromonst; /* diff --git a/games/hack/hack.objnam.c b/games/hack/hack.objnam.c index a6e19dcee..fd2316de8 100644 --- a/games/hack/hack.objnam.c +++ b/games/hack/hack.objnam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.objnam.c,v 1.11 2016/01/09 18:33:15 mestre Exp $ */ +/* $OpenBSD: hack.objnam.c,v 1.12 2023/09/06 11:53:56 jsg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -609,7 +609,6 @@ any: typ = probtype(let); typfnd: { struct obj *otmp; - extern struct obj *mksobj(); let = objects[typ].oc_olet; otmp = mksobj(typ); if(heavy) diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c index 039ef93c5..117c6ae3a 100644 --- a/games/hack/hack.unix.c +++ b/games/hack/hack.unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.unix.c,v 1.22 2023/06/03 15:19:38 op Exp $ */ +/* $OpenBSD: hack.unix.c,v 1.23 2023/09/06 11:53:56 jsg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -97,7 +97,6 @@ static struct tm * getlt(void) { time_t date; - struct tm *localtime(); (void) time(&date); return(localtime(&date)); diff --git a/gnu/lib/libiberty/Makefile.bsd-wrapper b/gnu/lib/libiberty/Makefile.bsd-wrapper index 3d8c5120a..e8737d909 100644 --- a/gnu/lib/libiberty/Makefile.bsd-wrapper +++ b/gnu/lib/libiberty/Makefile.bsd-wrapper @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.19 2018/09/14 13:37:52 naddy Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.20 2023/09/06 11:49:11 jca Exp $ LIB= iberty CPPFLAGS+= -DHAVE_CONFIG_H -I$(.CURDIR)/src -I$(.CURDIR)/include -I$(.OBJDIR) +CFLAGS+= -std=gnu89 XCFLAGS= CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDFLAGS}" HOST_FILES!= cat $(.OBJDIR)/needed-list 2>/dev/null||true diff --git a/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper b/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper index 85d9d0e27..da3dfea1c 100644 --- a/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper +++ b/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.31 2023/01/27 22:01:02 kettenis Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.32 2023/09/06 12:15:30 jca Exp $ .include @@ -7,6 +7,7 @@ TARGET_ARCH?= ${MACHINE_ARCH} SUBDIRS= opcodes bfd CONF_SUBDIRS= opcodes bfd +CFLAGS+= -std=gnu89 CFLAGS+= ${PIE_DEFAULT} XCFLAGS= CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDSTATIC}" # This allows moving the whole binutils installation around for diff --git a/gnu/usr.bin/binutils/Makefile.bsd-wrapper b/gnu/usr.bin/binutils/Makefile.bsd-wrapper index 10227c175..8be6f2846 100644 --- a/gnu/usr.bin/binutils/Makefile.bsd-wrapper +++ b/gnu/usr.bin/binutils/Makefile.bsd-wrapper @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.89 2019/12/21 21:40:00 espie Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.90 2023/09/06 12:15:30 jca Exp $ .include +CFLAGS+= -std=gnu89 CFLAGS+= ${PIE_DEFAULT} XCFLAGS= CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDSTATIC}" # This allows moving the whole binutils installation around for diff --git a/gnu/usr.bin/binutils/gdb/gnu-v3-abi.c b/gnu/usr.bin/binutils/gdb/gnu-v3-abi.c index 195af2640..3c719f6e6 100644 --- a/gnu/usr.bin/binutils/gdb/gnu-v3-abi.c +++ b/gnu/usr.bin/binutils/gdb/gnu-v3-abi.c @@ -427,8 +427,8 @@ init_gnuv3_ops (void) gnu_v3_abi_ops.shortname = "gnu-v3"; gnu_v3_abi_ops.longname = "GNU G++ Version 3 ABI"; gnu_v3_abi_ops.doc = "G++ Version 3 ABI"; - gnu_v3_abi_ops.is_destructor_name = is_gnu_v3_mangled_dtor; - gnu_v3_abi_ops.is_constructor_name = is_gnu_v3_mangled_ctor; + gnu_v3_abi_ops.is_destructor_name = (enum dtor_kinds (*)(const char *))is_gnu_v3_mangled_dtor; + gnu_v3_abi_ops.is_constructor_name = (enum ctor_kinds (*)(const char *))is_gnu_v3_mangled_ctor; gnu_v3_abi_ops.is_vtable_name = gnuv3_is_vtable_name; gnu_v3_abi_ops.is_operator_name = gnuv3_is_operator_name; gnu_v3_abi_ops.rtti_type = gnuv3_rtti_type; diff --git a/gnu/usr.bin/cvs/Makefile.bsd-wrapper b/gnu/usr.bin/cvs/Makefile.bsd-wrapper index ee2e77204..0a58a6cf9 100644 --- a/gnu/usr.bin/cvs/Makefile.bsd-wrapper +++ b/gnu/usr.bin/cvs/Makefile.bsd-wrapper @@ -1,8 +1,9 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.59 2019/12/21 21:40:00 espie Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.60 2023/09/06 12:15:30 jca Exp $ .include MAN= man/cvs.1 man/cvs.5 man/cvsbug.8 man/rcs2log.1 +CFLAGS+= -std=gnu89 XCFLAGS= CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" CPP="${CPP}" CLEANFILES= src/version.c lib/getdate.c lib/getdate.h macintosh/Makefile \ os2/Makefile zlib/Makefile \ diff --git a/gnu/usr.bin/texinfo/Makefile.bsd-wrapper b/gnu/usr.bin/texinfo/Makefile.bsd-wrapper index 11158c4b0..d9d6ad723 100644 --- a/gnu/usr.bin/texinfo/Makefile.bsd-wrapper +++ b/gnu/usr.bin/texinfo/Makefile.bsd-wrapper @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.47 2019/12/21 21:40:00 espie Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.48 2023/09/06 11:49:11 jca Exp $ INFODIR= infodir=/usr/share/info INFOPATH= DEFAULT_INFOPATH=/usr/local/info:/usr/share/info:. @@ -6,6 +6,7 @@ INFOPATH= DEFAULT_INFOPATH=/usr/local/info:/usr/share/info:. MAN= doc/info.1 doc/install-info.1 doc/makeinfo.1 doc/texi2dvi.1 MAN+= doc/texindex.1 doc/info.5 doc/texinfo.5 doc/infokey.1 +CFLAGS+= -std=gnu89 XCFLAGS= CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDFLAGS}" GNUCFLAGS= ${XCFLAGS} \ ACLOCAL=true AUTOHEADER=true AUTOCONF=true AUTOMAKE=true \ diff --git a/include/uchar.h b/include/uchar.h index 2ed5f2c12..15f2a0ef6 100644 --- a/include/uchar.h +++ b/include/uchar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uchar.h,v 1.1 2023/08/20 15:02:50 schwarze Exp $ */ +/* $OpenBSD: uchar.h,v 1.2 2023/09/05 23:16:01 schwarze Exp $ */ /* * Written by Ingo Schwarze * and placed in the public domain on March 19, 2022. @@ -23,8 +23,10 @@ typedef __size_t size_t; #define __STDC_UTF_16__ 1 #define __STDC_UTF_32__ 1 +#if !defined(__cplusplus) || __cplusplus < 201103L typedef __uint16_t char16_t; typedef __uint32_t char32_t; +#endif __BEGIN_DECLS size_t mbrtoc16(char16_t * __restrict, const char * __restrict, size_t, diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c index d19a5c0aa..0b3ae27f7 100644 --- a/lib/libc/gen/exec.c +++ b/lib/libc/gen/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.24 2021/09/22 20:40:06 deraadt Exp $ */ +/* $OpenBSD: exec.c,v 1.25 2023/09/06 03:51:20 jsg Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -161,7 +161,7 @@ execvpe(const char *name, char *const *argv, char *const *envp) int eacces = 0; char *bp, *cur, *path, buf[PATH_MAX]; size_t maplen; - int save_errno, n; + int save_errno; /* * Do not allow null name diff --git a/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 b/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 index a8e32cdc5..67ef8679b 100644 --- a/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 +++ b/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: EVP_CIPHER_CTX_set_flags.3,v 1.1 2023/08/31 17:27:41 schwarze Exp $ +.\" $OpenBSD: EVP_CIPHER_CTX_set_flags.3,v 1.2 2023/09/06 16:26:49 schwarze Exp $ .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 .\" .\" This file is a derived work. @@ -67,7 +67,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: August 31 2023 $ +.Dd $Mdocdate: September 6 2023 $ .Dt EVP_CIPHER_CTX_SET_FLAGS 3 .Os .Sh NAME @@ -77,6 +77,11 @@ .Nm EVP_CIPHER_CTX_rand_key , .Nm EVP_CIPHER_param_to_asn1 , .Nm EVP_CIPHER_asn1_to_param , +.\" .Nm EVP_CIPHER_set_asn1_iv and +.\" .Nm EVP_CIPHER_get_asn1_iv are intentionally undocumented +.\" because they are unused according to codesearch.debian.net +.\" and should probably not be public: they seem hardly useful +.\" even for implementing custom EVP_CIPHER algorithms. .Nm EVP_CIPHER_CTX_get_app_data , .Nm EVP_CIPHER_CTX_set_app_data .Nd unusual EVP cipher context configuration diff --git a/lib/libcrypto/man/OBJ_create.3 b/lib/libcrypto/man/OBJ_create.3 index 690c1c77f..7a6135e05 100644 --- a/lib/libcrypto/man/OBJ_create.3 +++ b/lib/libcrypto/man/OBJ_create.3 @@ -1,13 +1,13 @@ -.\" $OpenBSD: OBJ_create.3,v 1.7 2023/07/21 05:02:53 tb Exp $ +.\" $OpenBSD: OBJ_create.3,v 1.8 2023/09/06 12:26:59 schwarze Exp $ .\" full merge up to: .\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400 .\" selective merge up to: -.\" OpenSSL OBJ_nid2obj.pod 35fd9953 May 28 14:49:38 2019 +0200 +.\" OpenSSL OBJ_nid2obj.pod 0c5bc96f Mar 15 13:57:22 2022 +0000 .\" .\" This file is a derived work. .\" The changes are covered by the following Copyright and license: .\" -.\" Copyright (c) 2017, 2021 Ingo Schwarze +.\" Copyright (c) 2017, 2021, 2023 Ingo Schwarze .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -69,7 +69,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: July 21 2023 $ +.Dd $Mdocdate: September 6 2023 $ .Dt OBJ_CREATE 3 .Os .Sh NAME @@ -217,11 +217,15 @@ The opposite order will usually not work. returns the new NID. .Pp .Fn OBJ_add_object -returns the NID associated with the +returns the NID of the added .Fa object or .Dv NID_undef -if memory allocation fails. +if no object was added because the +.Fa object +argument was +.Dv NULL , +did not contain an NID, or memory allocation failed. .Pp .Fn OBJ_create returns the new NID or @@ -271,6 +275,29 @@ and .Fn check_defer first appeared in OpenSSL 1.0.0 and have been available since .Ox 4.9 . +.Sh CAVEATS +.Fn OBJ_add_object +indicates success even after adding an incomplete object that was created with +.Xr ASN1_OBJECT_create 3 +but lacks a short name, a long name, or an OID. +.Pp +Even +.Fn OBJ_create +tolerates +.Dv NULL +pointers being passed for the +.Fa sn +and/or +.Fa ln +arguments, in which case +.Xr OBJ_nid2sn 3 +and +.Xr OBJ_sn2nid 3 +or +.Xr OBJ_nid2ln 3 +and +.Xr OBJ_ln2nid 3 +will not work on the added object, respectively. .Sh BUGS .Fn OBJ_new_nid does not reserve any return value to indicate an error. diff --git a/lib/libcrypto/x509/x509_addr.c b/lib/libcrypto/x509/x509_addr.c index 2d8cc0b31..735891fd2 100644 --- a/lib/libcrypto/x509/x509_addr.c +++ b/lib/libcrypto/x509/x509_addr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_addr.c,v 1.86 2023/02/16 08:38:17 tb Exp $ */ +/* $OpenBSD: x509_addr.c,v 1.88 2023/09/06 15:53:07 job Exp $ */ /* * Contributed to the OpenSSL Project by the American Registry for * Internet Numbers ("ARIN"). @@ -413,6 +413,13 @@ IPAddressFamily_afi_safi(const IPAddressFamily *af, uint16_t *out_afi, uint8_t safi = 0; int got_safi = 0; + if (out_afi != NULL) + *out_afi = 0; + if (out_safi != NULL) { + *out_safi = 0; + *safi_is_set = 0; + } + CBS_init(&cbs, af->addressFamily->data, af->addressFamily->length); if (!CBS_get_u16(&cbs, &afi)) @@ -669,9 +676,10 @@ i2r_IPAddrBlocks(const X509V3_EXT_METHOD *method, void *ext, BIO *out, { const IPAddrBlocks *addr = ext; IPAddressFamily *af; - uint16_t afi; - uint8_t safi; - int i, safi_is_set; + uint16_t afi = 0; + uint8_t safi = 0; + int safi_is_set = 0; + int i; for (i = 0; i < sk_IPAddressFamily_num(addr); i++) { af = sk_IPAddressFamily_value(addr, i); diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c index 58800238d..f2f19b351 100644 --- a/libexec/spamd/spamd.c +++ b/libexec/spamd/spamd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamd.c,v 1.160 2023/04/19 12:58:15 jsg Exp $ */ +/* $OpenBSD: spamd.c,v 1.161 2023/09/05 16:01:58 jca Exp $ */ /* * Copyright (c) 2015 Henning Brauer @@ -728,10 +728,8 @@ initcon(struct con *cp, int fd, struct sockaddr *sa) 0 : stutter; error = getnameinfo(sa, sa->sa_len, cp->addr, sizeof(cp->addr), NULL, 0, NI_NUMERICHOST); -#ifdef useless if (error) - errx(1, "%s", gai_strerror(error)); -#endif + strlcpy(cp->addr, "", sizeof(cp->addr)); ctime_r(&t, ctimebuf); ctimebuf[sizeof(ctimebuf) - 2] = '\0'; /* nuke newline */ snprintf(cp->obuf, cp->osize, "220 %s ESMTP %s; %s\r\n", diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile index 006f79d9b..782193162 100644 --- a/regress/usr.bin/ssh/Makefile +++ b/regress/usr.bin/ssh/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.125 2023/05/17 05:52:01 djm Exp $ +# $OpenBSD: Makefile,v 1.126 2023/09/06 23:36:09 djm Exp $ OPENSSL?= yes @@ -101,7 +101,8 @@ LTESTS= connect \ agent-restrict \ hostbased \ channel-timeout \ - connection-timeout + connection-timeout \ + match-subsystem INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers #INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp diff --git a/regress/usr.bin/ssh/match-subsystem.sh b/regress/usr.bin/ssh/match-subsystem.sh new file mode 100644 index 000000000..0b691d8e8 --- /dev/null +++ b/regress/usr.bin/ssh/match-subsystem.sh @@ -0,0 +1,90 @@ +# $OpenBSD: match-subsystem.sh,v 1.1 2023/09/06 23:36:09 djm Exp $ +# Placed in the Public Domain. + +tid="sshd_config match subsystem" + +cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak + +try_subsystem() { + _id=$1 + _subsystem=$2 + _expect=$3 + ${SSHD} -tf $OBJ/sshd_proxy || fatal "$_id: bad config" + ${SSH} -sF $OBJ/ssh_proxy somehost $_subsystem + _exit=$? + trace "$_id subsystem $_subsystem" + if [ $_exit -ne $_expect ] ; then + fail "$_id: subsystem $_subsystem exit $_exit expected $_expect" + fi + return $? +} + +# Simple case: subsystem in main config. +cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy +cat >> $OBJ/sshd_proxy << _EOF +Subsystem xxx /bin/sh -c "exit 23" +_EOF +try_subsystem "main config" xxx 23 + +# No clobber in main config. +cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy +cat >> $OBJ/sshd_proxy << _EOF +Subsystem xxx /bin/sh -c "exit 23" +Subsystem xxx /bin/sh -c "exit 24" +_EOF +try_subsystem "main config no clobber" xxx 23 + +# Subsystem in match all block +cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy +cat >> $OBJ/sshd_proxy << _EOF +Match all +Subsystem xxx /bin/sh -c "exit 21" +_EOF +try_subsystem "match all" xxx 21 + +# No clobber in match all block +cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy +cat >> $OBJ/sshd_proxy << _EOF +Match all +Subsystem xxx /bin/sh -c "exit 21" +Subsystem xxx /bin/sh -c "exit 24" +_EOF +try_subsystem "match all no clobber" xxx 21 + +# Subsystem in match user block +cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy +cat >> $OBJ/sshd_proxy << _EOF +Match user * +Subsystem xxx /bin/sh -c "exit 20" +_EOF +try_subsystem "match user" xxx 20 + +# No clobber in match user block +cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy +cat >> $OBJ/sshd_proxy << _EOF +Match user * +Subsystem xxx /bin/sh -c "exit 20" +Subsystem xxx /bin/sh -c "exit 24" +Match all +Subsystem xxx /bin/sh -c "exit 24" +_EOF +try_subsystem "match user no clobber" xxx 20 + +# Override main with match all +cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy +cat >> $OBJ/sshd_proxy << _EOF +Subsystem xxx /bin/sh -c "exit 23" +Match all +Subsystem xxx /bin/sh -c "exit 19" +_EOF +try_subsystem "match all override" xxx 19 + +# Override main with match user +cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy +cat >> $OBJ/sshd_proxy << _EOF +Subsystem xxx /bin/sh -c "exit 23" +Match user * +Subsystem xxx /bin/sh -c "exit 18" +_EOF +try_subsystem "match user override" xxx 18 + diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index a1d1a2f68..5e29c14f5 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.415 2023/07/05 07:28:10 krw Exp $ */ +/* $OpenBSD: editor.c,v 1.417 2023/09/06 12:45:19 robert Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller @@ -1799,8 +1799,6 @@ micmp(const void *a1, const void *a2) void zero_partitions(struct disklabel *lp) { - int i; - memset(lp->d_partitions, 0, sizeof(lp->d_partitions)); DL_SETPSIZE(&lp->d_partitions[RAW_PART], DL_GETDSIZE(lp)); @@ -1953,7 +1951,7 @@ apply_unit(double val, u_char unit, u_int64_t *n) } val *= factor / DEV_BSIZE; - if (val > ULLONG_MAX) + if (val > (double)ULLONG_MAX) return -1; *n = val; return 0; @@ -1964,7 +1962,7 @@ parse_sizespec(const char *buf, double *val, char **unit) { errno = 0; *val = strtod(buf, unit); - if (errno == ERANGE || *val < 0 || *val > ULLONG_MAX) + if (errno == ERANGE || *val < 0 || *val > (double)ULLONG_MAX) return -1; /* too big/small */ if (*val == 0 && *unit == buf) return -1; /* No conversion performed. */ diff --git a/share/man/man5/bsd.port.mk.5 b/share/man/man5/bsd.port.mk.5 index 4570b2fe6..0a503549a 100644 --- a/share/man/man5/bsd.port.mk.5 +++ b/share/man/man5/bsd.port.mk.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bsd.port.mk.5,v 1.602 2023/09/05 13:58:49 espie Exp $ +.\" $OpenBSD: bsd.port.mk.5,v 1.612 2023/09/06 22:28:50 espie Exp $ .\" .\" Copyright (c) 2000-2008 Marc Espie .\" @@ -24,7 +24,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: September 5 2023 $ +.Dd $Mdocdate: September 6 2023 $ .Dt BSD.PORT.MK 5 .Os .Sh NAME @@ -397,6 +397,7 @@ hooks, as this would break See .Ev ALL_DISTFILES , .Ev ALL_PATCHFILES , +.Ev ALL_SUPDISTFILES , .Ev CHECKSUMFILES , .Ev DISTDIR , .Ev DISTFILES* , @@ -1007,6 +1008,13 @@ setting, after applying the .Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx conversion. Read-only. +.It Ev ALL_SUPDISTFILES +List of all actual files coming from every +.Ev SUPDISTFILES* +setting, after applying the +.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx +conversion. +Read-only. .It Ev ALL_TEST_ENV Environment passed to test. Equals @@ -1739,7 +1747,7 @@ is set and if is not null, then .Ev DISTFILES will be set to -.Pa ${DISNAME}${EXTRACT_SUFX} . +.Pa ${DISTNAME}${EXTRACT_SUFX} . .It Ev DISTNAME Name used to identify the port. See @@ -1858,16 +1866,27 @@ for other common issues). .Pp Note that setting fatal errors defeats all introspection mechanisms and breaks .Pa sqlports . +.Pp +Tip: if you need to debug a fatal error, you can always override +.Ev ERRORS +on the command line, e.g., +.Bd -literal -offset indent +make ERRORS= show= +.Ed .It Ev EXTRACT_CASES -In the normal extraction stage (when +The extraction stage runs a loop under +.Pa ${WRKDIR} +with +.Ev archive +(shell variable) set to each element of .Ev EXTRACT_ONLY -is not empty), this is the contents of a -.Xr sh 1 -.Em case conditional , -used to extract files. -Fragments are automatically appended to extract the following archives and -add the relevant compression tool to -.Ev BUILD_DEPENDS : +in order, which is then processed by a case switch: ${EXTRACT_CASES}. +.Pp +.Nm +detects extensions in ${CHECKSUMFILES} +and automatically adds +.Ev BUILD_DEPENDS +and fragments to handle the following archives: .Pp .Bl -tag -width archivers/lzip/lunzip -offset indent -compact .It gzip @@ -1889,7 +1908,7 @@ rpm Other cases not supported directly in .Nm can be added, and existing cases can be overridden. -For example the following example sets extra conversion flags to unzip, +For example the following snippet sets extra conversion flags to unzip, and adds support for rar: .Bd -literal *.zip) ${UNZIP} -Laq ${FULLDISTDIR}/$$archive -d ${WRKDIR};; \\ @@ -1900,22 +1919,25 @@ Set to the list of distfiles to actually extract if some distfiles should not be extracted during the .Cm do-extract stage. -Defaults to all distfiles, can even be set to empty. +Defaults to ${ALL_DISTFILES}, can even be set to empty. .It Ev EXTRACT_SUFX -Used to set DISTFILES default value to ${DISTNAME}${EXTRACT_SUFX}. -The decompression tool needed will be automatically added as -.Ev BUILD_DEPENDS . -Default value is .tar.gz. +Used to set +.Ev DISTFILES +default value to ${DISTNAME}${EXTRACT_SUFX}. +Default value is +.Pa .tar.gz . .Pp Note that .Ev DISTFILES will only be set in the absence of .Ev DISTFILES.sufx -as well. +as well, or if +.Ev SITES +is not empty. .It Ev EXTRACT_SUFX. The .Ev EXTRACT_SUFX -for a template defined with +value for a template defined through .Ev DIST_TUPLE . .It Ev EXTRACT_FILES Set to the list of files to actually extract from distfiles. @@ -2103,6 +2125,10 @@ Yields a suitable default for .Ev SITES_GITHUB and .Ev DISTNAME . +.Pp +Use +.Ev DIST_TUPLE +for more complicated situations. .It Ev GH_ACCOUNT Account name of the GitHub user hosting the project. .It Ev GH_COMMIT @@ -2366,15 +2392,6 @@ is set, will contain the list of missing distfiles or patchfiles that need to be fetched manually. Read-only. -.It Ev MTREE_FILE -.Xr mtree 8 -specification used during -.Ar fake . -Replaced by direct use of -.Xr mkdir 1 -now that -.Ar fake -no longer happens as root. .It Ev MODGNU_CONFIG_GUESS_DIRS If a port uses config.guess outside WRKSRC, the directories containing the other copies must be set here. @@ -2447,7 +2464,7 @@ below. Especially read the part about .Ev ONLY_FOR_ARCHS when some of the packages only exist for some architectures. -.It NO_ARCH +.It Ev NO_ARCH Location for arch-independent packages. Defaults to .Sq no-arch . @@ -2582,7 +2599,7 @@ shell fragment: .Bd -literal set -e cd ${FULLDISTDIR} -for patchfile in ${_LIST_PATCHFILES} +for patchfile in ${ALL_PATCHFILES} do case $$patchfile in *.bz2) @@ -2942,7 +2959,7 @@ If set to empty, will not register anything: very much unsafe. Controls the behavior of .Pa misc/portroach as documented in detail at -.Lk http://jasperla.github.io/portroach/docs/portroach-portconfig.txt . +.Lk https://jasperla.github.io/portroach/docs/portroach-portconfig.txt .It Ev PREFIX Base directory for the current port installation. Usually ${LOCALBASE}, though some ports may elect a location under @@ -3111,6 +3128,18 @@ as .Sq p${REVISION} to form a full package-name conforming to .Xr packages-specs 7 . +.It Ev ROACH_SITES +Selects the correct list of sites corresponding to +.Ev ROACH_URL , +in order to help portroach. +.It Ev ROACH_URL +The canonical url corresponding to the current port. +Gets deduced from ${DISTFILES} by default, using the first value +or the first entry in ${DISTFILES.sufx} if there's only one suffix. +Conversion rules for +.Ev DISTFILES +are applied to yield only the url part of the distfile. +Set manually if the automatic rules don't find the right one. .It Ev RUN_DEPENDS Specification of ports this port needs installed to be functional. Same format as @@ -3194,7 +3223,6 @@ for details. Suffix should start with .Sq \&. for consistency. -.Pp .It Ev SITES0 , ... , SITES9 Supplementary locations from which distribution files and patchfiles are retrieved (deprecated). @@ -3380,7 +3408,7 @@ For instance, defaults to .Bd -literal --{//archive/}.tar.gz -.Ed . +.Ed .Pp with .Li DIST_TUPLE += github foo bar baz qux. @@ -4401,6 +4429,10 @@ Note that some of these messages are actually emitted by some other external commands, but grouped here for convenience: easier to look for in .Xr dpb 1 Ns 's logs. +.Pp +See +.Ev ERRORS +for more details about internal diagnostics. .Bl -diag .It "/bin/sh: cd .../pkg - No such file or directory" Emitted during diff --git a/sys/arch/amd64/amd64/vmm_machdep.c b/sys/arch/amd64/amd64/vmm_machdep.c index 4e68581d1..8cf516674 100644 --- a/sys/arch/amd64/amd64/vmm_machdep.c +++ b/sys/arch/amd64/amd64/vmm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm_machdep.c,v 1.7 2023/09/05 14:00:40 mlarkin Exp $ */ +/* $OpenBSD: vmm_machdep.c,v 1.8 2023/09/06 03:35:57 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -3973,6 +3973,11 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp) */ irq = vrp->vrp_irq; + if (vrp->vrp_intr_pending) + vcpu->vc_intr = 1; + else + vcpu->vc_intr = 0; + if (vrp->vrp_continue) { switch (vcpu->vc_gueststate.vg_exit_reason) { case VMX_EXIT_IO: @@ -6381,6 +6386,11 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp) irq = vrp->vrp_irq; + if (vrp->vrp_intr_pending) + vcpu->vc_intr = 1; + else + vcpu->vc_intr = 0; + /* * If we are returning from userspace (vmd) because we exited * last time, fix up any needed vcpu state first. Which state diff --git a/sys/arch/amd64/conf/Makefile.amd64 b/sys/arch/amd64/conf/Makefile.amd64 index 6f760b174..8183af31b 100644 --- a/sys/arch/amd64/conf/Makefile.amd64 +++ b/sys/arch/amd64/conf/Makefile.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.amd64,v 1.133 2023/07/31 04:01:07 guenther Exp $ +# $OpenBSD: Makefile.amd64,v 1.134 2023/09/06 01:47:36 jsg Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -78,9 +78,6 @@ CMACHFLAGS+= -mretpoline-external-thunk -fcf-protection=branch NO_INTEGR_AS= -no-integrated-as CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion \ -Wno-unused-but-set-variable -Wno-gnu-folding-constant -# XXX Workaround for zlib + clang 15 -# https://github.com/madler/zlib/issues/633 -CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option .endif DEBUG?= -g diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index 4b75fa8ac..fe55eef96 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.93 2023/09/05 14:00:41 mlarkin Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.94 2023/09/06 03:35:57 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -456,6 +456,7 @@ struct vm_run_params { uint32_t vrp_vcpu_id; uint8_t vrp_continue; /* Continuing from an exit */ uint16_t vrp_irq; /* IRQ to inject */ + uint8_t vrp_intr_pending; /* Additional intrs pending? */ /* Input/output parameter to VMM_IOC_RUN */ struct vm_exit *vrp_exit; /* updated exit data */ diff --git a/sys/arch/amd64/stand/Makefile.inc b/sys/arch/amd64/stand/Makefile.inc index d423cae65..3f5ce7475 100644 --- a/sys/arch/amd64/stand/Makefile.inc +++ b/sys/arch/amd64/stand/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.21 2023/02/23 19:48:21 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.22 2023/09/06 01:47:36 jsg Exp $ CFLAGS=${DEBUG} ${COPTS} -Oz -Wall -Werror CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM -DBOOT_STTY @@ -25,9 +25,6 @@ SACFLAGS+=-nostdinc -fno-builtin -fpack-struct .include .if ${COMPILER_VERSION:Mclang} -# XXX Workaround for zlib + clang 15 -# https://github.com/madler/zlib/issues/633 -CFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option NO_INTEGR_AS= -no-integrated-as .endif diff --git a/sys/arch/arm64/conf/Makefile.arm64 b/sys/arch/arm64/conf/Makefile.arm64 index 1719e3d04..636b7b404 100644 --- a/sys/arch/arm64/conf/Makefile.arm64 +++ b/sys/arch/arm64/conf/Makefile.arm64 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.arm64,v 1.46 2023/04/09 19:48:37 kettenis Exp $ +# $OpenBSD: Makefile.arm64,v 1.47 2023/09/06 01:47:36 jsg Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -55,9 +55,6 @@ CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \ -Wno-constant-conversion -Wno-address-of-packed-member \ -Wno-unused-but-set-variable -Wno-gnu-folding-constant \ -Wframe-larger-than=2047 -# XXX Workaround for zlib + clang 15 -# https://github.com/madler/zlib/issues/633 -CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option CMACHFLAGS= -march=armv8-a+nofp+nosimd \ -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer \ diff --git a/sys/arch/arm64/stand/efiboot/Makefile b/sys/arch/arm64/stand/efiboot/Makefile index fbd86b1c2..48c5132f0 100644 --- a/sys/arch/arm64/stand/efiboot/Makefile +++ b/sys/arch/arm64/stand/efiboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.20 2023/03/05 16:21:52 kettenis Exp $ +# $OpenBSD: Makefile,v 1.21 2023/09/06 01:47:36 jsg Exp $ NOMAN= # @@ -53,9 +53,6 @@ COPTS+= -Wno-attributes -Wno-format COPTS+= -ffreestanding -fno-stack-protector COPTS+= -fshort-wchar -fPIC -fno-builtin COPTS+= -Wall -Werror -# XXX Workaround for zlib + clang 15 -# https://github.com/madler/zlib/issues/633 -COPTS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option PROG.elf= ${PROG:S/.EFI/.elf/} CLEANFILES+= ${PROG.elf} ${PROG.elf}.tmp diff --git a/sys/arch/armv7/conf/Makefile.armv7 b/sys/arch/armv7/conf/Makefile.armv7 index 78944a7d7..470107e14 100644 --- a/sys/arch/armv7/conf/Makefile.armv7 +++ b/sys/arch/armv7/conf/Makefile.armv7 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.armv7,v 1.53 2022/12/30 06:44:35 jca Exp $ +# $OpenBSD: Makefile.armv7,v 1.54 2023/09/06 01:47:36 jsg Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -28,9 +28,6 @@ CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \ -Wno-constant-conversion -Wno-address-of-packed-member \ -Wno-unused-but-set-variable -Wno-gnu-folding-constant \ -Wframe-larger-than=2047 -# XXX Workaround for zlib + clang 15 -# https://github.com/madler/zlib/issues/633 -CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option CMACHFLAGS= -msoft-float -march=armv7a CMACHFLAGS+= -ffreestanding ${NOPIE_FLAGS} diff --git a/sys/arch/armv7/stand/efiboot/Makefile b/sys/arch/armv7/stand/efiboot/Makefile index f769148f6..a549b9802 100644 --- a/sys/arch/armv7/stand/efiboot/Makefile +++ b/sys/arch/armv7/stand/efiboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2023/02/23 19:48:22 miod Exp $ +# $OpenBSD: Makefile,v 1.20 2023/09/06 01:47:37 jsg Exp $ NOMAN= # @@ -51,9 +51,6 @@ COPTS+= -ffreestanding -fno-stack-protector COPTS+= -fshort-wchar -fPIC -fno-builtin COPTS+= -Wall -Werror COPTS+= -mfloat-abi=soft -# XXX Workaround for zlib + clang 15 -# https://github.com/madler/zlib/issues/633 -COPTS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option PROG.elf= ${PROG:S/.EFI/.elf/} CLEANFILES+= ${PROG.elf} ${PROG.elf}.tmp diff --git a/sys/arch/i386/conf/Makefile.i386 b/sys/arch/i386/conf/Makefile.i386 index 77b2bb554..f2c1079de 100644 --- a/sys/arch/i386/conf/Makefile.i386 +++ b/sys/arch/i386/conf/Makefile.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.i386,v 1.143 2022/12/30 06:44:36 jca Exp $ +# $OpenBSD: Makefile.i386,v 1.144 2023/09/06 01:47:37 jsg Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -46,9 +46,6 @@ CMACHFLAGS+= -mretpoline NO_INTEGR_AS= -no-integrated-as CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion \ -Wno-unused-but-set-variable -Wno-gnu-folding-constant -# XXX Workaround for zlib + clang 15 -# https://github.com/madler/zlib/issues/633 -CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option .endif DEBUG?= -g diff --git a/sys/arch/i386/stand/Makefile.inc b/sys/arch/i386/stand/Makefile.inc index d9898462e..2ac5c017d 100644 --- a/sys/arch/i386/stand/Makefile.inc +++ b/sys/arch/i386/stand/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.54 2023/02/23 19:48:22 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.55 2023/09/06 01:47:37 jsg Exp $ CFLAGS=${DEBUG} ${COPTS} -Oz -Wall -Werror CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM -DBOOT_STTY @@ -25,9 +25,6 @@ SACFLAGS+=-nostdinc -fno-builtin -fpack-struct .include .if ${COMPILER_VERSION:Mclang} -# XXX Workaround for zlib + clang 15 -# https://github.com/madler/zlib/issues/633 -CFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option NO_INTEGR_AS= -no-integrated-as .endif diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_devlist.h b/sys/dev/pci/drm/amd/amdgpu/amdgpu_devlist.h index 227df5257..b2f3f6727 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_devlist.h +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_devlist.h @@ -216,6 +216,8 @@ static const struct pci_matchid amdgpu_devices[] = { {0x1002, 0x7483 }, /* Radeon RX 7600M */ {0x1002, 0x7489 }, /* Radeon Pro W7500 */ - /* GC 11.0.3, DCN 3.2.0, dGPU */ + /* GC 11.0.3, DCN 3.2.0, dGPU, "Navi 32" */ + {0x1002, 0x747e }, /* Radeon RX 7700 XT, 7800 XT */ + /* GC 11.0.4, DCN 3.1.4, APU */ }; diff --git a/sys/dev/pci/pcidevs b/sys/dev/pci/pcidevs index 1924f8f6d..44051dcba 100644 --- a/sys/dev/pci/pcidevs +++ b/sys/dev/pci/pcidevs @@ -1,4 +1,4 @@ -$OpenBSD: pcidevs,v 1.2046 2023/08/30 07:11:48 kevlo Exp $ +$OpenBSD: pcidevs,v 1.2048 2023/09/06 23:47:14 jsg Exp $ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* @@ -2102,6 +2102,7 @@ product ATI BEIGE_GOBY_6 0x743f Navi 24 product ATI NAVI31_2 0x7448 Navi 31 product ATI NAVI31_1 0x744c Navi 31 product ATI NAVI31_3 0x745e Navi 31 +product ATI NAVI32_1 0x747e Navi 32 product ATI NAVI33_1 0x7480 Navi 33 product ATI NAVI33_2 0x7483 Navi 33 product ATI NAVI33_3 0x7489 Navi 33 @@ -4566,6 +4567,7 @@ product INTEL WL_8265_1 0x24fd Dual Band Wireless-AC 8265 product INTEL 82820_HB 0x2501 82820 Host product INTEL 82820_AGP 0x250f 82820 AGP product INTEL OPTANE 0x2522 Optane +product INTEL P1600X 0x2525 P1600X product INTEL WL_9260_1 0x2526 Dual Band Wireless-AC 9260 product INTEL 82850_HB 0x2530 82850 Host product INTEL 82860_HB 0x2531 82860 Host diff --git a/sys/dev/pci/pcidevs.h b/sys/dev/pci/pcidevs.h index 3c07405c8..0ad585ee9 100644 --- a/sys/dev/pci/pcidevs.h +++ b/sys/dev/pci/pcidevs.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2046 2023/08/30 07:11:48 kevlo Exp + * OpenBSD: pcidevs,v 1.2048 2023/09/06 23:47:14 jsg Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -2107,6 +2107,7 @@ #define PCI_PRODUCT_ATI_NAVI31_2 0x7448 /* Navi 31 */ #define PCI_PRODUCT_ATI_NAVI31_1 0x744c /* Navi 31 */ #define PCI_PRODUCT_ATI_NAVI31_3 0x745e /* Navi 31 */ +#define PCI_PRODUCT_ATI_NAVI32_1 0x747e /* Navi 32 */ #define PCI_PRODUCT_ATI_NAVI33_1 0x7480 /* Navi 33 */ #define PCI_PRODUCT_ATI_NAVI33_2 0x7483 /* Navi 33 */ #define PCI_PRODUCT_ATI_NAVI33_3 0x7489 /* Navi 33 */ @@ -4571,6 +4572,7 @@ #define PCI_PRODUCT_INTEL_82820_HB 0x2501 /* 82820 Host */ #define PCI_PRODUCT_INTEL_82820_AGP 0x250f /* 82820 AGP */ #define PCI_PRODUCT_INTEL_OPTANE 0x2522 /* Optane */ +#define PCI_PRODUCT_INTEL_P1600X 0x2525 /* P1600X */ #define PCI_PRODUCT_INTEL_WL_9260_1 0x2526 /* Dual Band Wireless-AC 9260 */ #define PCI_PRODUCT_INTEL_82850_HB 0x2530 /* 82850 Host */ #define PCI_PRODUCT_INTEL_82860_HB 0x2531 /* 82860 Host */ diff --git a/sys/dev/pci/pcidevs_data.h b/sys/dev/pci/pcidevs_data.h index 583616c57..271babcca 100644 --- a/sys/dev/pci/pcidevs_data.h +++ b/sys/dev/pci/pcidevs_data.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2046 2023/08/30 07:11:48 kevlo Exp + * OpenBSD: pcidevs,v 1.2048 2023/09/06 23:47:14 jsg Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -6547,6 +6547,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_NAVI31_3, "Navi 31", }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_NAVI32_1, + "Navi 32", + }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_NAVI33_1, "Navi 33", @@ -15623,6 +15627,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_OPTANE, "Optane", }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_P1600X, + "P1600X", + }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_9260_1, "Dual Band Wireless-AC 9260", diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c index 1f234f15b..70abd291f 100644 --- a/sys/kern/kern_clockintr.c +++ b/sys/kern/kern_clockintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clockintr.c,v 1.33 2023/08/26 22:21:00 cheloha Exp $ */ +/* $OpenBSD: kern_clockintr.c,v 1.38 2023/09/06 02:33:18 cheloha Exp $ */ /* * Copyright (c) 2003 Dale Rahn * Copyright (c) 2020 Mark Kettenis @@ -36,16 +36,15 @@ * * I Immutable after initialization. */ -u_int clockintr_flags; /* [I] global state + behavior flags */ +uint32_t clockintr_flags; /* [I] global state + behavior flags */ uint32_t hardclock_period; /* [I] hardclock period (ns) */ uint32_t statclock_avg; /* [I] average statclock period (ns) */ uint32_t statclock_min; /* [I] minimum statclock period (ns) */ uint32_t statclock_mask; /* [I] set of allowed offsets */ +uint64_t clockintr_advance_random(struct clockintr *, uint64_t, uint32_t); void clockintr_cancel_locked(struct clockintr *); -uint64_t clockintr_expiration(const struct clockintr *); void clockintr_hardclock(struct clockintr *, void *); -uint64_t clockintr_nsecuptime(const struct clockintr *); void clockintr_schedule(struct clockintr *, uint64_t); void clockintr_schedule_locked(struct clockintr *, uint64_t); void clockintr_statclock(struct clockintr *, void *); @@ -59,7 +58,7 @@ uint64_t nsec_advance(uint64_t *, uint64_t, uint64_t); * Initialize global state. Set flags and compute intervals. */ void -clockintr_init(u_int flags) +clockintr_init(uint32_t flags) { uint32_t half_avg, var; @@ -113,12 +112,12 @@ clockintr_cpu_init(const struct intrclock *ic) /* TODO: Remove these from struct clockintr_queue. */ if (cq->cq_hardclock == NULL) { - cq->cq_hardclock = clockintr_establish(cq, clockintr_hardclock); + cq->cq_hardclock = clockintr_establish(ci, clockintr_hardclock); if (cq->cq_hardclock == NULL) panic("%s: failed to establish hardclock", __func__); } if (cq->cq_statclock == NULL) { - cq->cq_statclock = clockintr_establish(cq, clockintr_statclock); + cq->cq_statclock = clockintr_establish(ci, clockintr_statclock); if (cq->cq_statclock == NULL) panic("%s: failed to establish statclock", __func__); } @@ -220,7 +219,7 @@ clockintr_dispatch(void *frame) struct cpu_info *ci = curcpu(); struct clockintr *cl; struct clockintr_queue *cq = &ci->ci_queue; - u_int ogen; + uint32_t ogen; if (cq->cq_dispatch != 0) panic("%s: recursive dispatch", __func__); @@ -345,6 +344,25 @@ clockintr_advance(struct clockintr *cl, uint64_t period) return count; } +uint64_t +clockintr_advance_random(struct clockintr *cl, uint64_t min, uint32_t mask) +{ + uint64_t count = 0; + struct clockintr_queue *cq = cl->cl_queue; + uint32_t off; + + KASSERT(cl == &cq->cq_shadow); + + while (cl->cl_expiration <= cq->cq_uptime) { + while ((off = (random() & mask)) == 0) + continue; + cl->cl_expiration += min + off; + count++; + } + SET(cl->cl_flags, CLST_SHADOW_PENDING); + return count; +} + void clockintr_cancel(struct clockintr *cl) { @@ -385,10 +403,11 @@ clockintr_cancel_locked(struct clockintr *cl) } struct clockintr * -clockintr_establish(struct clockintr_queue *cq, +clockintr_establish(struct cpu_info *ci, void (*func)(struct clockintr *, void *)) { struct clockintr *cl; + struct clockintr_queue *cq = &ci->ci_queue; cl = malloc(sizeof *cl, M_DEVBUF, M_NOWAIT | M_ZERO); if (cl == NULL) @@ -402,21 +421,6 @@ clockintr_establish(struct clockintr_queue *cq, return cl; } -uint64_t -clockintr_expiration(const struct clockintr *cl) -{ - uint64_t expiration; - struct clockintr_queue *cq = cl->cl_queue; - - if (cl == &cq->cq_shadow) - return cl->cl_expiration; - - mtx_enter(&cq->cq_mtx); - expiration = cl->cl_expiration; - mtx_leave(&cq->cq_mtx); - return expiration; -} - void clockintr_schedule(struct clockintr *cl, uint64_t expiration) { @@ -465,7 +469,8 @@ clockintr_schedule_locked(struct clockintr *cl, uint64_t expiration) } void -clockintr_stagger(struct clockintr *cl, uint64_t period, u_int n, u_int count) +clockintr_stagger(struct clockintr *cl, uint64_t period, uint32_t n, + uint32_t count) { struct clockintr_queue *cq = cl->cl_queue; @@ -478,13 +483,6 @@ clockintr_stagger(struct clockintr *cl, uint64_t period, u_int n, u_int count) mtx_leave(&cq->cq_mtx); } -uint64_t -clockintr_nsecuptime(const struct clockintr *cl) -{ - KASSERT(cl == &cl->cl_queue->cq_shadow); - return cl->cl_queue->cq_uptime; -} - void clockintr_hardclock(struct clockintr *cl, void *frame) { @@ -498,20 +496,11 @@ clockintr_hardclock(struct clockintr *cl, void *frame) void clockintr_statclock(struct clockintr *cl, void *frame) { - uint64_t count, expiration, i, uptime; - uint32_t off; + uint64_t count, i; if (ISSET(clockintr_flags, CL_RNDSTAT)) { - count = 0; - expiration = clockintr_expiration(cl); - uptime = clockintr_nsecuptime(cl); - while (expiration <= uptime) { - while ((off = (random() & statclock_mask)) == 0) - continue; - expiration += statclock_min + off; - count++; - } - clockintr_schedule(cl, expiration); + count = clockintr_advance_random(cl, statclock_min, + statclock_mask); } else { count = clockintr_advance(cl, statclock_avg); } @@ -601,7 +590,7 @@ sysctl_clockintr(int *name, u_int namelen, void *oldp, size_t *oldlenp, struct clockintr_queue *cq; struct cpu_info *ci; CPU_INFO_ITERATOR cii; - u_int gen; + uint32_t gen; if (namelen != 1) return ENOTDIR; diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 66f129304..0e49241a3 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sched.c,v 1.88 2023/08/31 19:29:51 cheloha Exp $ */ +/* $OpenBSD: kern_sched.c,v 1.89 2023/09/06 02:09:58 cheloha Exp $ */ /* * Copyright (c) 2007, 2008 Artur Grabowski * @@ -88,13 +88,13 @@ sched_init_cpu(struct cpu_info *ci) spc->spc_idleproc = NULL; - spc->spc_itimer = clockintr_establish(&ci->ci_queue, itimer_update); + spc->spc_itimer = clockintr_establish(ci, itimer_update); if (spc->spc_itimer == NULL) panic("%s: clockintr_establish itimer_update", __func__); - spc->spc_profclock = clockintr_establish(&ci->ci_queue, profclock); + spc->spc_profclock = clockintr_establish(ci, profclock); if (spc->spc_profclock == NULL) panic("%s: clockintr_establish profclock", __func__); - spc->spc_roundrobin = clockintr_establish(&ci->ci_queue, roundrobin); + spc->spc_roundrobin = clockintr_establish(ci, roundrobin); if (spc->spc_roundrobin == NULL) panic("%s: clockintr_establish roundrobin", __func__); diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c index 850e0fb3b..10a9d9e2c 100644 --- a/sys/kern/subr_prof.c +++ b/sys/kern/subr_prof.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prof.c,v 1.36 2023/07/25 18:16:19 cheloha Exp $ */ +/* $OpenBSD: subr_prof.c,v 1.37 2023/09/06 02:09:58 cheloha Exp $ */ /* $NetBSD: subr_prof.c,v 1.12 1996/04/22 01:38:50 christos Exp $ */ /*- @@ -101,8 +101,7 @@ prof_init(void) /* Allocate and initialize one profiling buffer per CPU. */ CPU_INFO_FOREACH(cii, ci) { - ci->ci_gmonclock = clockintr_establish(&ci->ci_queue, - gmonclock); + ci->ci_gmonclock = clockintr_establish(ci, gmonclock); if (ci->ci_gmonclock == NULL) { printf("%s: clockintr_establish gmonclock\n", __func__); return; diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 31c8a8eaf..5db74552c 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.385 2023/05/18 09:59:43 mvs Exp $ */ +/* $OpenBSD: ip_input.c,v 1.386 2023/09/06 11:09:43 bluhm Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1851,7 +1851,7 @@ ip_send_do_dispatch(void *xmq, int flags) if (ml_empty(&ml)) return; - NET_LOCK(); + NET_LOCK_SHARED(); while ((m = ml_dequeue(&ml)) != NULL) { u_int32_t ipsecflowinfo = 0; @@ -1862,7 +1862,7 @@ ip_send_do_dispatch(void *xmq, int flags) } ip_output(m, NULL, NULL, flags, NULL, NULL, ipsecflowinfo); } - NET_UNLOCK(); + NET_UNLOCK_SHARED(); } void diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 2238a6cb6..be7e0010f 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.254 2022/08/21 14:15:55 bluhm Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.255 2023/09/06 11:09:43 bluhm Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -1572,11 +1572,11 @@ ip6_send_dispatch(void *xmq) if (ml_empty(&ml)) return; - NET_LOCK(); + NET_LOCK_SHARED(); while ((m = ml_dequeue(&ml)) != NULL) { ip6_output(m, NULL, NULL, 0, NULL, NULL); } - NET_UNLOCK(); + NET_UNLOCK_SHARED(); } void diff --git a/sys/sys/clockintr.h b/sys/sys/clockintr.h index d7e707d64..e8ddffe37 100644 --- a/sys/sys/clockintr.h +++ b/sys/sys/clockintr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: clockintr.h,v 1.10 2023/08/21 17:22:04 cheloha Exp $ */ +/* $OpenBSD: clockintr.h,v 1.12 2023/09/06 02:33:18 cheloha Exp $ */ /* * Copyright (c) 2020-2022 Scott Cheloha * @@ -72,7 +72,7 @@ struct clockintr { TAILQ_ENTRY(clockintr) cl_plink; /* [m] cq_pend glue */ void (*cl_func)(struct clockintr *, void *); /* [I] callback */ struct clockintr_queue *cl_queue; /* [I] parent queue */ - u_int cl_flags; /* [m] CLST_* flags */ + uint32_t cl_flags; /* [m] CLST_* flags */ }; #define CLST_PENDING 0x00000001 /* scheduled to run */ @@ -100,9 +100,9 @@ struct clockintr_queue { struct clockintr *cq_statclock; /* [o] statclock handle */ struct intrclock cq_intrclock; /* [I] local interrupt clock */ struct clockintr_stat cq_stat; /* [o] dispatch statistics */ - volatile u_int cq_gen; /* [o] cq_stat update generation */ - volatile u_int cq_dispatch; /* [o] dispatch is running */ - u_int cq_flags; /* [I] CQ_* flags; see below */ + volatile uint32_t cq_gen; /* [o] cq_stat update generation */ + volatile uint32_t cq_dispatch; /* [o] dispatch is running */ + uint32_t cq_flags; /* [I] CQ_* flags; see below */ }; #define CQ_INIT 0x00000001 /* clockintr_cpu_init() done */ @@ -119,7 +119,7 @@ struct clockintr_queue { void clockintr_cpu_init(const struct intrclock *); int clockintr_dispatch(void *); -void clockintr_init(u_int); +void clockintr_init(uint32_t); void clockintr_trigger(void); /* @@ -128,9 +128,9 @@ void clockintr_trigger(void); uint64_t clockintr_advance(struct clockintr *, uint64_t); void clockintr_cancel(struct clockintr *); -struct clockintr *clockintr_establish(struct clockintr_queue *, +struct clockintr *clockintr_establish(struct cpu_info *, void (*)(struct clockintr *, void *)); -void clockintr_stagger(struct clockintr *, uint64_t, u_int, u_int); +void clockintr_stagger(struct clockintr *, uint64_t, uint32_t, uint32_t); void clockqueue_init(struct clockintr_queue *); int sysctl_clockintr(int *, u_int, void *, size_t *, void *, size_t); diff --git a/usr.bin/dig/dig.c b/usr.bin/dig/dig.c index 11d65645f..a23bcbeb4 100644 --- a/usr.bin/dig/dig.c +++ b/usr.bin/dig/dig.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.19 2020/12/20 11:27:47 florian Exp $ */ +/* $Id: dig.c,v 1.20 2023/09/06 04:57:28 jsg Exp $ */ /*! \file */ #include @@ -1924,7 +1924,7 @@ void dig_query_setup(int is_batchfile, int config_only, } } -void dig_startup() { +void dig_startup(void) { isc_result_t result; debug("dig_startup()"); @@ -1935,7 +1935,7 @@ void dig_startup() { } void -dig_shutdown() { +dig_shutdown(void) { destroy_lookup(default_lookup); if (batchname != NULL) { if (batchfp != stdin) diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c index 84fc8a63a..fea3bdfbe 100644 --- a/usr.bin/ssh/servconf.c +++ b/usr.bin/ssh/servconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.397 2023/08/29 02:50:10 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.401 2023/09/06 23:35:35 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -599,7 +599,7 @@ static struct { { "macs", sMacs, SSHCFG_GLOBAL }, { "protocol", sIgnore, SSHCFG_GLOBAL }, { "gatewayports", sGatewayPorts, SSHCFG_ALL }, - { "subsystem", sSubsystem, SSHCFG_GLOBAL }, + { "subsystem", sSubsystem, SSHCFG_ALL }, { "maxstartups", sMaxStartups, SSHCFG_GLOBAL }, { "persourcemaxstartups", sPerSourceMaxStartups, SSHCFG_GLOBAL }, { "persourcenetblocksize", sPerSourceNetBlockSize, SSHCFG_GLOBAL }, @@ -1876,39 +1876,54 @@ process_server_config_line_depth(ServerOptions *options, char *line, break; case sSubsystem: - if (options->num_subsystems >= MAX_SUBSYSTEMS) { - fatal("%s line %d: too many subsystems defined.", - filename, linenum); - } arg = argv_next(&ac, &av); if (!arg || *arg == '\0') fatal("%s line %d: %s missing argument.", filename, linenum, keyword); if (!*activep) { - arg = argv_next(&ac, &av); + argv_consume(&ac); break; } - for (i = 0; i < options->num_subsystems; i++) - if (strcmp(arg, options->subsystem_name[i]) == 0) - fatal("%s line %d: Subsystem '%s' " - "already defined.", filename, linenum, arg); + found = 0; + for (i = 0; i < options->num_subsystems; i++) { + if (strcmp(arg, options->subsystem_name[i]) == 0) { + found = 1; + break; + } + } + if (found) { + debug("%s line %d: Subsystem '%s' already defined.", + filename, linenum, arg); + argv_consume(&ac); + break; + } + options->subsystem_name = xrecallocarray( + options->subsystem_name, options->num_subsystems, + options->num_subsystems + 1, + sizeof(options->subsystem_name)); + options->subsystem_command = xrecallocarray( + options->subsystem_command, options->num_subsystems, + options->num_subsystems + 1, + sizeof(options->subsystem_command)); + options->subsystem_args = xrecallocarray( + options->subsystem_args, options->num_subsystems, + options->num_subsystems + 1, + sizeof(options->subsystem_args)); options->subsystem_name[options->num_subsystems] = xstrdup(arg); arg = argv_next(&ac, &av); - if (!arg || *arg == '\0') + if (!arg || *arg == '\0') { fatal("%s line %d: Missing subsystem command.", filename, linenum); - options->subsystem_command[options->num_subsystems] = xstrdup(arg); - - /* Collect arguments (separate to executable) */ - p = xstrdup(arg); - len = strlen(p) + 1; - while ((arg = argv_next(&ac, &av)) != NULL) { - len += 1 + strlen(arg); - p = xreallocarray(p, 1, len); - strlcat(p, " ", len); - strlcat(p, arg, len); } - options->subsystem_args[options->num_subsystems] = p; + options->subsystem_command[options->num_subsystems] = + xstrdup(arg); + /* Collect arguments (separate to executable) */ + arg = argv_assemble(1, &arg); /* quote command correctly */ + arg2 = argv_assemble(ac, av); /* rest of command */ + xasprintf(&options->subsystem_args[options->num_subsystems], + "%s %s", arg, arg2); + free(arg2); + argv_consume(&ac); options->num_subsystems++; break; @@ -2618,6 +2633,47 @@ int parse_server_match_testspec(struct connection_info *ci, char *spec) return 0; } +void +servconf_merge_subsystems(ServerOptions *dst, ServerOptions *src) +{ + u_int i, j, found; + + for (i = 0; i < src->num_subsystems; i++) { + found = 0; + for (j = 0; j < dst->num_subsystems; j++) { + if (strcmp(src->subsystem_name[i], + dst->subsystem_name[j]) == 0) { + found = 1; + break; + } + } + if (found) { + debug_f("override \"%s\"", dst->subsystem_name[j]); + free(dst->subsystem_command[j]); + free(dst->subsystem_args[j]); + dst->subsystem_command[j] = + xstrdup(src->subsystem_command[i]); + dst->subsystem_args[j] = + xstrdup(src->subsystem_args[i]); + continue; + } + debug_f("add \"%s\"", src->subsystem_name[i]); + dst->subsystem_name = xrecallocarray( + dst->subsystem_name, dst->num_subsystems, + dst->num_subsystems + 1, sizeof(dst->subsystem_name)); + dst->subsystem_command = xrecallocarray( + dst->subsystem_command, dst->num_subsystems, + dst->num_subsystems + 1, sizeof(dst->subsystem_command)); + dst->subsystem_args = xrecallocarray( + dst->subsystem_args, dst->num_subsystems, + dst->num_subsystems + 1, sizeof(dst->subsystem_args)); + j = dst->num_subsystems++; + dst->subsystem_name[j] = xstrdup(src->subsystem_name[i]); + dst->subsystem_command[j] = xstrdup(src->subsystem_command[i]); + dst->subsystem_args[j] = xstrdup(src->subsystem_args[i]); + } +} + /* * Copy any supported values that are set. * @@ -2724,6 +2780,9 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth) free(dst->chroot_directory); dst->chroot_directory = NULL; } + + /* Subsystems require merging. */ + servconf_merge_subsystems(dst, src); } #undef M_CP_INTOPT diff --git a/usr.bin/ssh/servconf.h b/usr.bin/ssh/servconf.h index 1a2411e1b..bff6f2686 100644 --- a/usr.bin/ssh/servconf.h +++ b/usr.bin/ssh/servconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.h,v 1.159 2023/01/17 09:44:48 djm Exp $ */ +/* $OpenBSD: servconf.h,v 1.160 2023/09/06 23:35:35 djm Exp $ */ /* * Author: Tatu Ylonen @@ -20,8 +20,6 @@ #define MAX_PORTS 256 /* Max # ports. */ -#define MAX_SUBSYSTEMS 256 /* Max # subsystems. */ - /* permit_root_login */ #define PERMIT_NOT_SET -1 #define PERMIT_NO 0 @@ -165,9 +163,9 @@ typedef struct { char **deny_groups; u_int num_subsystems; - char *subsystem_name[MAX_SUBSYSTEMS]; - char *subsystem_command[MAX_SUBSYSTEMS]; - char *subsystem_args[MAX_SUBSYSTEMS]; + char **subsystem_name; + char **subsystem_command; + char **subsystem_args; u_int num_accept_env; char **accept_env; @@ -292,6 +290,9 @@ TAILQ_HEAD(include_list, include_item); M_CP_STRARRAYOPT(permitted_listens, num_permitted_listens); \ M_CP_STRARRAYOPT(channel_timeouts, num_channel_timeouts); \ M_CP_STRARRAYOPT(log_verbose, num_log_verbose); \ + M_CP_STRARRAYOPT(subsystem_name, num_subsystems); \ + M_CP_STRARRAYOPT(subsystem_command, num_subsystems); \ + M_CP_STRARRAYOPT(subsystem_args, num_subsystems); \ } while (0) struct connection_info *get_connection_info(struct ssh *, int, int); @@ -308,6 +309,7 @@ void parse_server_match_config(ServerOptions *, struct include_list *includes, struct connection_info *); int parse_server_match_testspec(struct connection_info *, char *); int server_match_spec_complete(struct connection_info *); +void servconf_merge_subsystems(ServerOptions *, ServerOptions *); void copy_set_server_options(ServerOptions *, ServerOptions *, int); void dump_config(ServerOptions *); char *derelativise_path(const char *); diff --git a/usr.bin/ssh/sshsig.c b/usr.bin/ssh/sshsig.c index 3f02c90b1..b35801531 100644 --- a/usr.bin/ssh/sshsig.c +++ b/usr.bin/ssh/sshsig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshsig.c,v 1.32 2023/04/06 03:56:02 djm Exp $ */ +/* $OpenBSD: sshsig.c,v 1.33 2023/09/06 23:18:15 djm Exp $ */ /* * Copyright (c) 2019 Google LLC * @@ -36,7 +36,7 @@ #define SIG_VERSION 0x01 #define MAGIC_PREAMBLE "SSHSIG" #define MAGIC_PREAMBLE_LEN (sizeof(MAGIC_PREAMBLE) - 1) -#define BEGIN_SIGNATURE "-----BEGIN SSH SIGNATURE-----\n" +#define BEGIN_SIGNATURE "-----BEGIN SSH SIGNATURE-----" #define END_SIGNATURE "-----END SSH SIGNATURE-----" #define RSA_SIGN_ALG "rsa-sha2-512" /* XXX maybe make configurable */ #define RSA_SIGN_ALLOWED "rsa-sha2-512,rsa-sha2-256" @@ -57,8 +57,7 @@ sshsig_armor(const struct sshbuf *blob, struct sshbuf **out) goto out; } - if ((r = sshbuf_put(buf, BEGIN_SIGNATURE, - sizeof(BEGIN_SIGNATURE)-1)) != 0) { + if ((r = sshbuf_putf(buf, "%s\n", BEGIN_SIGNATURE)) != 0) { error_fr(r, "sshbuf_putf"); goto out; } @@ -97,23 +96,35 @@ sshsig_dearmor(struct sshbuf *sig, struct sshbuf **out) return SSH_ERR_ALLOC_FAIL; } + /* Expect and consume preamble + lf/crlf */ if ((r = sshbuf_cmp(sbuf, 0, BEGIN_SIGNATURE, sizeof(BEGIN_SIGNATURE)-1)) != 0) { error("Couldn't parse signature: missing header"); goto done; } - if ((r = sshbuf_consume(sbuf, sizeof(BEGIN_SIGNATURE)-1)) != 0) { error_fr(r, "consume"); goto done; } - + if ((r = sshbuf_cmp(sbuf, 0, "\r\n", 2)) == 0) + eoffset = 2; + else if ((r = sshbuf_cmp(sbuf, 0, "\n", 1)) == 0) + eoffset = 1; + else { + r = SSH_ERR_INVALID_FORMAT; + error_f("no header eol"); + goto done; + } + if ((r = sshbuf_consume(sbuf, eoffset)) != 0) { + error_fr(r, "consume eol"); + goto done; + } + /* Find and consume lf + suffix (any prior cr would be ignored) */ if ((r = sshbuf_find(sbuf, 0, "\n" END_SIGNATURE, - sizeof("\n" END_SIGNATURE)-1, &eoffset)) != 0) { + sizeof(END_SIGNATURE), &eoffset)) != 0) { error("Couldn't parse signature: missing footer"); goto done; } - if ((r = sshbuf_consume_end(sbuf, sshbuf_len(sbuf)-eoffset)) != 0) { error_fr(r, "consume"); goto done; diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c index 3b4e5dfce..b2e4e0a7a 100644 --- a/usr.bin/tput/tput.c +++ b/usr.bin/tput/tput.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tput.c,v 1.28 2023/02/08 15:56:32 millert Exp $ */ +/* $OpenBSD: tput.c,v 1.29 2023/09/06 05:04:07 jsg Exp $ */ /* * Copyright (c) 1999 Todd C. Miller @@ -193,7 +193,7 @@ main(int argc, char *argv[]) static char ** process(char *cap, char *str, char **argv) { - char *cp, *s, *nargv[NUM_PARM] = {0}; + char *s, *nargv[NUM_PARM] = {0}; char *p_is_s[NUM_PARM]; int arg_need, i; diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index 981f33ff4..ebfa0b4a6 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.295 2023/04/28 13:24:25 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.296 2023/09/06 09:52:26 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -19,6 +19,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include #include #include #include diff --git a/usr.sbin/config/ukcutil.c b/usr.sbin/config/ukcutil.c index 90cfb8a78..27ec4d9be 100644 --- a/usr.sbin/config/ukcutil.c +++ b/usr.sbin/config/ukcutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ukcutil.c,v 1.26 2021/11/20 03:13:37 jcs Exp $ */ +/* $OpenBSD: ukcutil.c,v 1.27 2023/09/06 05:00:37 jsg Exp $ */ /* * Copyright (c) 1999-2001 Mats O Jansson. All rights reserved. @@ -1309,8 +1309,6 @@ config(void) /* Edit cycle */ do { - char lbuf[100]; - again: /* Get input */ if (cmdfile == NULL) { diff --git a/usr.sbin/mopd/mopchk/mopchk.c b/usr.sbin/mopd/mopchk/mopchk.c index f1bccdbe0..f740a6a55 100644 --- a/usr.sbin/mopd/mopchk/mopchk.c +++ b/usr.sbin/mopd/mopchk/mopchk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mopchk.c,v 1.20 2023/03/08 04:43:14 guenther Exp $ */ +/* $OpenBSD: mopchk.c,v 1.21 2023/09/06 11:03:30 jsg Exp $ */ /* * Copyright (c) 1995-96 Mats O Jansson. All rights reserved. @@ -52,9 +52,7 @@ extern char *__progname; extern char version[]; int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { struct dllist dl; int op, i; @@ -142,7 +140,7 @@ main(argc, argv) } void -Usage() +Usage(void) { fprintf(stderr, "usage: %s [-av] [file ...]\n", __progname); exit(1); @@ -152,9 +150,7 @@ Usage() * Process incoming packages, NOT. */ void -mopProcess(ii, pkt) - struct if_info *ii; - u_char *pkt; +mopProcess(struct if_info *ii, u_char *pkt) { } diff --git a/usr.sbin/mrouted/cfparse.y b/usr.sbin/mrouted/cfparse.y index bf0664498..d8872cfb9 100644 --- a/usr.sbin/mrouted/cfparse.y +++ b/usr.sbin/mrouted/cfparse.y @@ -398,14 +398,13 @@ warn(const char *fmt, ...) } static void -yyerror(s) -char *s; +yyerror(char *s) { logit(LOG_ERR, 0, "%s: %s near line %d", configfilename, s, lineno); } static char * -next_word() +next_word(void) { static char buf[1024]; static char *p=NULL; @@ -440,7 +439,7 @@ next_word() } static int -yylex() +yylex(void) { int n; u_int32_t addr; @@ -514,7 +513,7 @@ yylex() } void -config_vifs_from_file() +config_vifs_from_file(void) { extern FILE *f; @@ -534,8 +533,7 @@ config_vifs_from_file() } static u_int32_t -valid_if(s) -char *s; +valid_if(char *s) { register vifi_t vifi; register struct uvif *v; @@ -548,8 +546,7 @@ char *s; } static const char * -ifconfaddr(a) - u_int32_t a; +ifconfaddr(u_int32_t a) { static char ifname[IFNAMSIZ]; struct ifaddrs *ifap, *ifa; diff --git a/usr.sbin/tcpdump/parsenfsfh.c b/usr.sbin/tcpdump/parsenfsfh.c index 1cf89ca21..b8f8f7e04 100644 --- a/usr.sbin/tcpdump/parsenfsfh.c +++ b/usr.sbin/tcpdump/parsenfsfh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parsenfsfh.c,v 1.14 2016/01/15 18:02:18 mmcc Exp $ */ +/* $OpenBSD: parsenfsfh.c,v 1.15 2023/09/06 05:54:07 jsg Exp $ */ /* * Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation, @@ -97,12 +97,9 @@ static int is_UCX(unsigned char *); void -Parse_fh(fh, fsidp, inop, osnamep, fsnamep) -caddr_t *fh; -my_fsid *fsidp; -ino_t *inop; -char **osnamep; /* if non-NULL, return OS name here */ -char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */ +Parse_fh(caddr_t *fh, my_fsid *fsidp, ino_t *inop, + char **osnamep, /* if non-NULL, return OS name here */ + char **fsnamep) /* if non-NULL, return server fs name here (for VMS) */ { unsigned char *fhp = (unsigned char *)fh; u_int32_t temp; @@ -392,8 +389,7 @@ char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */ * (3) followed by string of nulls */ static int -is_UCX(fhp) -unsigned char *fhp; +is_UCX(unsigned char *fhp) { int i; int seen_null = 0; diff --git a/usr.sbin/tcpdump/print-stp.c b/usr.sbin/tcpdump/print-stp.c index 07a4b8f5a..7b265a7b9 100644 --- a/usr.sbin/tcpdump/print-stp.c +++ b/usr.sbin/tcpdump/print-stp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-stp.c,v 1.11 2023/03/13 14:58:01 mbuhl Exp $ */ +/* $OpenBSD: print-stp.c,v 1.12 2023/09/06 05:54:07 jsg Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -85,9 +85,7 @@ static void stp_print_cbpdu(const u_char *, u_int, int); static void stp_print_tbpdu(const u_char *, u_int); void -stp_print(p, len) - const u_char *p; - u_int len; +stp_print(const u_char *p, u_int len) { u_int16_t id; int proto = STP_PROTO_STP; @@ -155,10 +153,7 @@ truncated: } static void -stp_print_cbpdu(p, len, proto) - const u_char *p; - u_int len; - int proto; +stp_print_cbpdu(const u_char *p, u_int len, int proto) { u_int32_t cost; u_int16_t t; @@ -294,9 +289,7 @@ truncated: } static void -stp_print_tbpdu(p, len) - const u_char *p; - u_int len; +stp_print_tbpdu(const u_char *p, u_int len) { printf(" tcn"); } diff --git a/usr.sbin/tcpdump/print-sunrpc.c b/usr.sbin/tcpdump/print-sunrpc.c index 6735704cc..74f0ecbae 100644 --- a/usr.sbin/tcpdump/print-sunrpc.c +++ b/usr.sbin/tcpdump/print-sunrpc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-sunrpc.c,v 1.22 2022/01/05 05:29:54 dlg Exp $ */ +/* $OpenBSD: print-sunrpc.c,v 1.23 2023/09/06 05:54:07 jsg Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995, 1996 @@ -91,8 +91,7 @@ sunrpcrequest_print(const u_char *bp, u_int length, const u_char *bp2) } static char * -progstr(prog) - u_int32_t prog; +progstr(u_int32_t prog) { char progname[32]; static char buf[32]; diff --git a/usr.sbin/unbound/config.h.in b/usr.sbin/unbound/config.h.in index 845abe134..f31354d01 100644 --- a/usr.sbin/unbound/config.h.in +++ b/usr.sbin/unbound/config.h.in @@ -328,9 +328,6 @@ /* Define to 1 if you have the `if_nametoindex' function. */ #undef HAVE_IF_NAMETOINDEX -/* Define to 1 if you have the `if_nametoindex' function. */ -#undef HAVE_IF_NAMETOINDEX - /* Define to 1 if you have the `inet_aton' function. */ #undef HAVE_INET_ATON diff --git a/usr.sbin/unbound/configure b/usr.sbin/unbound/configure index d67d5d766..7592463ad 100644 --- a/usr.sbin/unbound/configure +++ b/usr.sbin/unbound/configure @@ -16304,7 +16304,6 @@ fi done - # check if we can use SO_REUSEPORT reuseport_default=0 if echo "$host" | $GREP -i -e linux >/dev/null; then reuseport_default=1; fi diff --git a/usr.sbin/unbound/configure.ac b/usr.sbin/unbound/configure.ac index 678d28b2a..c49b67c93 100644 --- a/usr.sbin/unbound/configure.ac +++ b/usr.sbin/unbound/configure.ac @@ -547,7 +547,6 @@ ACX_CHECK_NONBLOCKING_BROKEN ACX_MKDIR_ONE_ARG AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])]) - # check if we can use SO_REUSEPORT reuseport_default=0 if echo "$host" | $GREP -i -e linux >/dev/null; then reuseport_default=1; fi diff --git a/usr.sbin/unbound/daemon/daemon.c b/usr.sbin/unbound/daemon/daemon.c index 0dbe1ccc8..a2958ff79 100644 --- a/usr.sbin/unbound/daemon/daemon.c +++ b/usr.sbin/unbound/daemon/daemon.c @@ -828,8 +828,8 @@ daemon_cleanup(struct daemon* daemon) * defer the cleanup until we know whether the new configuration allows * the reuse. (If we're exiting, cleanup should be done here). */ if(!daemon->reuse_cache || daemon->need_to_exit) { - slabhash_clear(&daemon->env->rrset_cache->table); - slabhash_clear(daemon->env->msg_cache); + slabhash_clear(&daemon->env->rrset_cache->table); + slabhash_clear(daemon->env->msg_cache); } daemon->old_num = daemon->num; /* save the current num */ local_zones_delete(daemon->local_zones); diff --git a/usr.sbin/unbound/sldns/rrdef.h b/usr.sbin/unbound/sldns/rrdef.h index 5f3efe25b..c43b21dad 100644 --- a/usr.sbin/unbound/sldns/rrdef.h +++ b/usr.sbin/unbound/sldns/rrdef.h @@ -196,8 +196,8 @@ enum sldns_enum_rr_type LDNS_RR_TYPE_OPENPGPKEY = 61, /* RFC 7929 */ LDNS_RR_TYPE_CSYNC = 62, /* RFC 7477 */ LDNS_RR_TYPE_ZONEMD = 63, /* draft-ietf-dnsop-dns-zone-digest-12 */ - LDNS_RR_TYPE_SVCB = 64, /* draft-ietf-dnsop-svcb-https-04 */ - LDNS_RR_TYPE_HTTPS = 65, /* draft-ietf-dnsop-svcb-https-04 */ + LDNS_RR_TYPE_SVCB = 64, /* draft-ietf-dnsop-svcb-https-04 */ + LDNS_RR_TYPE_HTTPS = 65, /* draft-ietf-dnsop-svcb-https-04 */ LDNS_RR_TYPE_SPF = 99, /* RFC 4408 */ diff --git a/usr.sbin/unbound/util/tube.c b/usr.sbin/unbound/util/tube.c index b18e219c9..68ef4b9db 100644 --- a/usr.sbin/unbound/util/tube.c +++ b/usr.sbin/unbound/util/tube.c @@ -420,7 +420,7 @@ pollit(int fd, struct timeval* t) return 0; if(pret != 0) return 1; - return 0; + return 0; } int tube_poll(struct tube* tube) diff --git a/usr.sbin/vmd/vioblk.c b/usr.sbin/vmd/vioblk.c index ef38e9eb3..87ad721b7 100644 --- a/usr.sbin/vmd/vioblk.c +++ b/usr.sbin/vmd/vioblk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblk.c,v 1.5 2023/09/01 19:42:26 dv Exp $ */ +/* $OpenBSD: vioblk.c,v 1.7 2023/09/06 19:27:54 dv Exp $ */ /* * Copyright (c) 2023 Dave Voutila @@ -84,7 +84,7 @@ vioblk_main(int fd, int fd_vmm) sz = atomicio(read, fd, &dev, sizeof(dev)); if (sz != sizeof(dev)) { ret = errno; - log_warn("failed to receive vionet"); + log_warn("failed to receive vioblk"); goto fail; } if (dev.dev_type != VMD_DEVTYPE_DISK) { @@ -305,7 +305,6 @@ vioblk_start_read(struct vioblk_dev *dev, off_t sector, size_t sz) goto nomem; info->len = sz; info->offset = sector * VIRTIO_BLK_SECTOR_SIZE; - info->file = &dev->file; return info; nomem: @@ -316,17 +315,15 @@ nomem: static const uint8_t * -vioblk_finish_read(struct ioinfo *info) +vioblk_finish_read(struct vioblk_dev *dev, struct ioinfo *info) { - struct virtio_backing *file; + struct virtio_backing *file = &dev->file; - file = info->file; if (file == NULL || file->pread == NULL) { log_warnx("%s: XXX null?!", __func__); return NULL; } if (file->pread(file->p, info->buf, info->len, info->offset) != info->len) { - info->error = errno; log_warn("vioblk read error"); return NULL; } @@ -355,7 +352,6 @@ vioblk_start_write(struct vioblk_dev *dev, off_t sector, goto nomem; info->len = len; info->offset = sector * VIRTIO_BLK_SECTOR_SIZE; - info->file = &dev->file; if (read_mem(addr, info->buf, info->len)) { vioblk_free_info(info); @@ -371,11 +367,10 @@ nomem: } static int -vioblk_finish_write(struct ioinfo *info) +vioblk_finish_write(struct vioblk_dev *dev, struct ioinfo *info) { - struct virtio_backing *file; + struct virtio_backing *file = &dev->file; - file = info->file; if (file->pwrite(file->p, info->buf, info->len, info->offset) != info->len) { log_warn("vioblk write error"); return EIO; @@ -479,7 +474,7 @@ vioblk_notifyq(struct vioblk_dev *dev) } /* read the data, use current data descriptor */ - secdata = vioblk_finish_read(info); + secdata = vioblk_finish_read(dev, info); if (secdata == NULL) { vioblk_free_info(info); log_warnx("vioblk: block read error, " @@ -557,7 +552,7 @@ vioblk_notifyq(struct vioblk_dev *dev) goto out; } - if (vioblk_finish_write(info)) { + if (vioblk_finish_write(dev, info)) { log_warnx("wr vioblk: disk write " "error"); vioblk_free_info(info); diff --git a/usr.sbin/vmd/vioscsi.c b/usr.sbin/vmd/vioscsi.c index 48d65fc24..3fb3d4eae 100644 --- a/usr.sbin/vmd/vioscsi.c +++ b/usr.sbin/vmd/vioscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioscsi.c,v 1.23 2023/04/01 06:39:03 jsg Exp $ */ +/* $OpenBSD: vioscsi.c,v 1.24 2023/09/06 19:26:39 dv Exp $ */ /* * Copyright (c) 2017 Carlos Cardenas @@ -206,7 +206,6 @@ vioscsi_start_read(struct vioscsi_dev *dev, off_t block, size_t n_blocks) goto nomem; info->len = n_blocks * VIOSCSI_BLOCK_SIZE_CDROM; info->offset = block * VIOSCSI_BLOCK_SIZE_CDROM; - info->file = &dev->file; return info; @@ -217,13 +216,11 @@ nomem: } static const uint8_t * -vioscsi_finish_read(struct ioinfo *info) +vioscsi_finish_read(struct vioscsi_dev *dev, struct ioinfo *info) { - struct virtio_backing *f; + struct virtio_backing *f = &dev->file; - f = info->file; if (f->pread(f->p, info->buf, info->len, info->offset) != info->len) { - info->error = errno; log_warn("vioscsi read error"); return NULL; } @@ -928,7 +925,7 @@ vioscsi_handle_read_6(struct vioscsi_dev *dev, } /* read block */ - read_buf = vioscsi_finish_read(info); + read_buf = vioscsi_finish_read(dev, info); if (read_buf == NULL) { log_warnx("%s: error reading position %ud", @@ -1057,7 +1054,7 @@ vioscsi_handle_read_10(struct vioscsi_dev *dev, } /* read block */ - read_buf = vioscsi_finish_read(info); + read_buf = vioscsi_finish_read(dev, info); if (read_buf == NULL) { log_warnx("%s: error reading position %ud", __func__, read_lba); diff --git a/usr.sbin/vmd/virtio.h b/usr.sbin/vmd/virtio.h index 24fd0097a..29fda474d 100644 --- a/usr.sbin/vmd/virtio.h +++ b/usr.sbin/vmd/virtio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.h,v 1.46 2023/07/13 18:31:59 dv Exp $ */ +/* $OpenBSD: virtio.h,v 1.47 2023/09/06 19:26:39 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -319,11 +319,9 @@ struct vmmci_dev { }; struct ioinfo { - struct virtio_backing *file; uint8_t *buf; ssize_t len; off_t offset; - int error; }; /* virtio.c */ diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c index 5f598bcc1..15c1dd992 100644 --- a/usr.sbin/vmd/vm.c +++ b/usr.sbin/vmd/vm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm.c,v 1.90 2023/07/13 18:31:59 dv Exp $ */ +/* $OpenBSD: vm.c,v 1.91 2023/09/06 03:35:57 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -1610,22 +1610,8 @@ vcpu_run_loop(void *arg) } else vrp->vrp_irq = 0xFFFF; - /* Still more pending? */ - if (i8259_is_pending()) { - /* - * XXX can probably avoid ioctls here by providing intr - * in vrp - */ - if (vcpu_pic_intr(vrp->vrp_vm_id, - vrp->vrp_vcpu_id, 1)) { - fatal("can't set INTR"); - } - } else { - if (vcpu_pic_intr(vrp->vrp_vm_id, - vrp->vrp_vcpu_id, 0)) { - fatal("can't clear INTR"); - } - } + /* Still more interrupts pending? */ + vrp->vrp_intr_pending = i8259_is_pending(); if (ioctl(env->vmd_fd, VMM_IOC_RUN, vrp) == -1) { /* If run ioctl failed, exit */