sync with OpenBSD -current

This commit is contained in:
purplerain 2024-08-20 16:39:32 +00:00
parent eb9d621948
commit f36b410006
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
37 changed files with 350 additions and 317 deletions

View file

@ -1,76 +0,0 @@
#!/bin/sh -
# $OpenBSD: mkscripts.sh,v 1.2 1996/06/23 14:20:08 deraadt Exp $
# $NetBSD: mkscripts.sh,v 1.10 1995/04/23 10:07:36 cgd Exp $
#
# This script generates ed test scripts (.ed) from .t files
PATH="/bin:/usr/bin:/usr/local/bin/:."
ED=$1
[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
for i in *.t; do
# base=${i%.*}
# base=`echo $i | sed 's/\..*//'`
# base=`expr $i : '\([^.]*\)'`
# (
# echo "#!/bin/sh -"
# echo "$ED - <<\EOT"
# echo "r $base.d"
# cat $i
# echo "w $base.o"
# echo EOT
# ) >$base.ed
# chmod +x $base.ed
# The following is pretty ugly way of doing the above, and not appropriate
# use of ed but the point is that it can be done...
base=`$ED - \!"echo $i" <<-EOF
s/\..*
EOF`
$ED - <<-EOF
a
#!/bin/sh -
$ED - <<\EOT
H
r $base.d
w $base.o
EOT
.
-2r $i
w $base.ed
!chmod +x $base.ed
EOF
done
for i in *.err; do
# base=${i%.*}
# base=`echo $i | sed 's/\..*//'`
# base=`expr $i : '\([^.]*\)'`
# (
# echo "#!/bin/sh -"
# echo "$ED - <<\EOT"
# echo H
# echo "r $base.err"
# cat $i
# echo "w $base.o"
# echo EOT
# ) >$base-err.ed
# chmod +x $base-err.ed
# The following is pretty ugly way of doing the above, and not appropriate
# use of ed but the point is that it can be done...
base=`$ED - \!"echo $i" <<-EOF
s/\..*
EOF`
$ED - <<-EOF
a
#!/bin/sh -
$ED - <<\EOT
H
r $base.err
w $base.o
EOT
.
-2r $i
w ${base}.red
!chmod +x ${base}.red
EOF
done

View file

@ -1 +1 @@
# SecBSD 1.6-0217120: Thu Aug 8 00:00:00 UTC 2024 (Yatagarasu) # SecBSD 1.6-68b5a75: Tue Aug 20 00:00:00 UTC 2024 (Yatagarasu)

View file

@ -1,76 +1,92 @@
# $OpenBSD: rekey.sh,v 1.20 2024/05/22 04:20:00 djm Exp $ # $OpenBSD: rekey.sh,v 1.26 2024/08/20 12:36:59 dtucker Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="rekey" tid="rekey"
LOG=${TEST_SSH_LOGFILE} LOG=${TEST_SSH_LOGFILE}
COPY2=$OBJ/copy2
rm -f ${LOG} rm -f ${LOG}
cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
echo "Compression no" >> $OBJ/ssh_proxy
echo "RekeyLimit 256k" >> $OBJ/ssh_proxy
# Test rekeying based on data volume only. # Test rekeying based on data volume only.
# Arguments will be passed to ssh. # Arguments: rekeylimit, kex method, optional remaining opts are passed to ssh.
ssh_data_rekeying() ssh_data_rekeying()
{ {
_bytes=$1 ; shift
_kexopt=$1 ; shift _kexopt=$1 ; shift
_opts="$@" _opts="$@"
if test -z "$_bytes"; then
_bytes=32k
fi
if ! test -z "$_kexopt" ; then if ! test -z "$_kexopt" ; then
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
echo "$_kexopt" >> $OBJ/sshd_proxy echo "$_kexopt" >> $OBJ/sshd_proxy
_opts="$_opts -o$_kexopt" _opts="$_opts -o$_kexopt"
fi fi
rm -f ${COPY} ${LOG} trace bytes $_bytes kex $_kexopt opts $_opts
_opts="$_opts -oCompression=no" rm -f ${COPY} ${COPY2} ${LOG}
${SSH} <${DATA} $_opts -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" # Create data file just big enough to reach rekey threshold.
dd if=${DATA} of=${COPY} bs=$_bytes count=1 2>/dev/null
${SSH} <${COPY} $_opts -v \
-oRekeyLimit=$_bytes -F $OBJ/ssh_proxy somehost "cat >${COPY2}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "ssh failed ($@)" fail "ssh failed ($@)"
fi fi
cmp ${DATA} ${COPY} || fail "corrupted copy ($@)" cmp ${COPY} ${COPY2} || fail "corrupted copy ($@)"
n=`grep 'NEWKEYS sent' ${LOG} | wc -l` n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
n=`expr $n - 1` n=`expr $n - 1`
trace "$n rekeying(s)" trace "$n rekeying(s)"
if [ $n -lt 1 ]; then if [ $n -lt 1 ]; then
fail "no rekeying occurred ($@)" fail "no rekeying occurred ($@)"
fi fi
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
} }
increase_datafile_size 300 increase_datafile_size 300
opts="" opts=""
for i in `${SSH} -Q kex`; do
# Filter out duplicate curve algo
kexs=`${SSH} -Q kex | grep -v curve25519-sha256@libssh.org`
ciphers=`${SSH} -Q cipher`
macs=`${SSH} -Q mac`
for i in $kexs; do
opts="$opts KexAlgorithms=$i" opts="$opts KexAlgorithms=$i"
done done
for i in `${SSH} -Q cipher`; do for i in $ciphers; do
opts="$opts Ciphers=$i" opts="$opts Ciphers=$i"
done done
for i in `${SSH} -Q mac`; do for i in $macs; do
opts="$opts MACs=$i" opts="$opts MACs=$i"
done done
for opt in $opts; do for opt in $opts; do
verbose "client rekey $opt" verbose "client rekey $opt"
ssh_data_rekeying "$opt" -oRekeyLimit=256k if ${SSH} -Q cipher-auth | sed 's/^/Ciphers=/' | \
done grep $opt >/dev/null; then
trace AEAD cipher, testing all KexAlgorithms
# AEAD ciphers are magical so test with all KexAlgorithms for kex in $kexs; do
if ${SSH} -Q cipher-auth | grep '^.*$' >/dev/null 2>&1 ; then ssh_data_rekeying "" "KexAlgorithms=$kex" "-o$opt"
for c in `${SSH} -Q cipher-auth`; do
for kex in `${SSH} -Q kex`; do
verbose "client rekey $c $kex"
ssh_data_rekeying "KexAlgorithms=$kex" -oRekeyLimit=256k -oCiphers=$c
done
done done
else
ssh_data_rekeying "" "$opt"
fi fi
done
for s in 16 1k 128k 256k; do for s in 16 1k 128k 256k; do
verbose "client rekeylimit ${s}" verbose "client rekeylimit ${s}"
ssh_data_rekeying "" -oCompression=no -oRekeyLimit=$s ssh_data_rekeying "$s" ""
done done
for s in 5 10; do for s in 5 10; do
verbose "client rekeylimit default ${s}" verbose "client rekeylimit default ${s}"
rm -f ${COPY} ${LOG} rm -f ${COPY} ${LOG}
${SSH} < ${DATA} -oCompression=no -oRekeyLimit="default $s" -F \ ${SSH} < ${DATA} -oRekeyLimit="default $s" -F \
$OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 10" $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 10"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "ssh failed" fail "ssh failed"
@ -87,7 +103,7 @@ done
for s in 5 10; do for s in 5 10; do
verbose "client rekeylimit default ${s} no data" verbose "client rekeylimit default ${s} no data"
rm -f ${COPY} ${LOG} rm -f ${COPY} ${LOG}
${SSH} -oCompression=no -oRekeyLimit="default $s" -F \ ${SSH} -oRekeyLimit="default $s" -F \
$OBJ/ssh_proxy somehost "sleep $s;sleep 10" $OBJ/ssh_proxy somehost "sleep $s;sleep 10"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "ssh failed" fail "ssh failed"
@ -104,13 +120,13 @@ for s in 16 1k 128k 256k; do
verbose "server rekeylimit ${s}" verbose "server rekeylimit ${s}"
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
echo "rekeylimit ${s}" >>$OBJ/sshd_proxy echo "rekeylimit ${s}" >>$OBJ/sshd_proxy
rm -f ${COPY} ${LOG} rm -f ${COPY} ${COPY2} ${LOG}
${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "cat ${DATA}" \ dd if=${DATA} of=${COPY} bs=$s count=1 2>/dev/null
> ${COPY} ${SSH} -F $OBJ/ssh_proxy somehost "cat ${COPY}" >${COPY2}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "ssh failed" fail "ssh failed"
fi fi
cmp ${DATA} ${COPY} || fail "corrupted copy" cmp ${COPY} ${COPY2} || fail "corrupted copy"
n=`grep 'NEWKEYS sent' ${LOG} | wc -l` n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
n=`expr $n - 1` n=`expr $n - 1`
trace "$n rekeying(s)" trace "$n rekeying(s)"
@ -124,7 +140,7 @@ for s in 5 10; do
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
echo "rekeylimit default ${s}" >>$OBJ/sshd_proxy echo "rekeylimit default ${s}" >>$OBJ/sshd_proxy
rm -f ${COPY} ${LOG} rm -f ${COPY} ${LOG}
${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "sleep $s;sleep 10" ${SSH} -F $OBJ/ssh_proxy somehost "sleep $s;sleep 10"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "ssh failed" fail "ssh failed"
fi fi
@ -136,9 +152,8 @@ for s in 5 10; do
fi fi
done done
verbose "rekeylimit parsing" verbose "rekeylimit parsing: bytes"
for size in 16 1k 1K 1m 1M 1g 1G 4G 8G; do for size in 16 1k 1K 1m 1M 1g 1G 4G 8G; do
for time in 1 1m 1M 1h 1H 1d 1D 1w 1W; do
case $size in case $size in
16) bytes=16 ;; 16) bytes=16 ;;
1k|1K) bytes=1024 ;; 1k|1K) bytes=1024 ;;
@ -147,6 +162,15 @@ for size in 16 1k 1K 1m 1M 1g 1G 4G 8G; do
4g|4G) bytes=4294967296 ;; 4g|4G) bytes=4294967296 ;;
8g|8G) bytes=8589934592 ;; 8g|8G) bytes=8589934592 ;;
esac esac
b=`${SSH} -G -o "rekeylimit $size" -f $OBJ/ssh_proxy host | \
awk '/rekeylimit/{print $2}'`
if [ "$bytes" != "$b" ]; then
fatal "rekeylimit size: expected $bytes bytes got $b"
fi
done
verbose "rekeylimit parsing: time"
for time in 1 1m 1M 1h 1H 1d 1D 1w 1W; do
case $time in case $time in
1) seconds=1 ;; 1) seconds=1 ;;
1m|1M) seconds=60 ;; 1m|1M) seconds=60 ;;
@ -154,19 +178,11 @@ for size in 16 1k 1K 1m 1M 1g 1G 4G 8G; do
1d|1D) seconds=86400 ;; 1d|1D) seconds=86400 ;;
1w|1W) seconds=604800 ;; 1w|1W) seconds=604800 ;;
esac esac
s=`${SSH} -G -o "rekeylimit default $time" -f $OBJ/ssh_proxy host | \
b=`$SUDO ${SSHD} -T -o "rekeylimit $size $time" -f $OBJ/sshd_proxy | \
awk '/rekeylimit/{print $2}'`
s=`$SUDO ${SSHD} -T -o "rekeylimit $size $time" -f $OBJ/sshd_proxy | \
awk '/rekeylimit/{print $3}'` awk '/rekeylimit/{print $3}'`
if [ "$bytes" != "$b" ]; then
fatal "rekeylimit size: expected $bytes bytes got $b"
fi
if [ "$seconds" != "$s" ]; then if [ "$seconds" != "$s" ]; then
fatal "rekeylimit time: expected $time seconds got $s" fatal "rekeylimit time: expected $time seconds got $s"
fi fi
done done
done
rm -f ${COPY} ${DATA} rm -f ${COPY} ${COPY2} ${DATA}

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: sti.4,v 1.26 2024/08/17 08:41:25 miod Exp $ .\" $OpenBSD: sti.4,v 1.27 2024/08/20 05:52:04 jsg Exp $
.\" .\"
.\" Copyright (c) 2001 Michael Shalayeff .\" Copyright (c) 2001 Michael Shalayeff
.\" All rights reserved. .\" All rights reserved.
@ -24,7 +24,7 @@
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE. .\" THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: August 17 2024 $ .Dd $Mdocdate: August 20 2024 $
.Dt STI 4 .Dt STI 4
.Os .Os
.Sh NAME .Sh NAME
@ -239,7 +239,7 @@ EPROM map mode, implemented on
.Nm Visualize EG . .Nm Visualize EG .
.It 8.11 .It 8.11
Support for HP-UX non-implicit locking DMA, implemented on Support for HP-UX non-implicit locking DMA, implemented on
.Nm Visualize FXE . .Nm Visualize FXe .
.It 8.12 .It 8.12
.Nm sti_util .Nm sti_util
function added (flashing under HP-UX and other sideband traffic). function added (flashing under HP-UX and other sideband traffic).

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.53 2024/08/18 21:04:29 bluhm Exp $ */ /* $OpenBSD: bus_dma.c,v 1.55 2024/08/20 12:36:09 sf Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*- /*-
@ -102,7 +102,7 @@
#endif #endif
int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t,
struct proc *, int, paddr_t *, int *, int); struct proc *, int, paddr_t *, int *, int *, int);
/* /*
* Common function for DMA map creation. May be called by bus-specific * Common function for DMA map creation. May be called by bus-specific
@ -223,12 +223,18 @@ _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
size_t mapsize; size_t mapsize;
struct vm_page **pg; struct vm_page **pg;
struct pglist mlist; struct pglist mlist;
int use_bounce_buffer = cpu_sev_guestmode || FORCE_BOUNCE_BUFFER;
if (map->_dm_pgva) { if (map->_dm_pgva) {
km_free((void *)map->_dm_pgva, map->_dm_npages << PGSHIFT, km_free((void *)map->_dm_pgva, map->_dm_npages << PGSHIFT,
&kv_any, &kp_none); &kv_any, &kp_none);
} }
mapsize = sizeof(struct bus_dmamap) +
(sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
if (use_bounce_buffer)
mapsize += sizeof(struct vm_page *) * map->_dm_npages;
if (map->_dm_pages) { if (map->_dm_pages) {
TAILQ_INIT(&mlist); TAILQ_INIT(&mlist);
for (pg = map->_dm_pages; map->_dm_npages--; pg++) { for (pg = map->_dm_pages; map->_dm_npages--; pg++) {
@ -237,8 +243,6 @@ _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
uvm_pglistfree(&mlist); uvm_pglistfree(&mlist);
} }
mapsize = sizeof(struct bus_dmamap) +
(sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
free(map, M_DEVBUF, mapsize); free(map, M_DEVBUF, mapsize);
} }
@ -251,7 +255,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
bus_size_t buflen, struct proc *p, int flags) bus_size_t buflen, struct proc *p, int flags)
{ {
bus_addr_t lastaddr = 0; bus_addr_t lastaddr = 0;
int seg, error; int seg, used, error;
/* /*
* Make sure that on error condition we return "no valid mappings". * Make sure that on error condition we return "no valid mappings".
@ -263,11 +267,13 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
return (EINVAL); return (EINVAL);
seg = 0; seg = 0;
used = 0;
error = _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, error = _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags,
&lastaddr, &seg, 1); &lastaddr, &seg, &used, 1);
if (error == 0) { if (error == 0) {
map->dm_mapsize = buflen; map->dm_mapsize = buflen;
map->dm_nsegs = seg + 1; map->dm_nsegs = seg + 1;
map->_dm_nused = used;
} }
return (error); return (error);
} }
@ -280,7 +286,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
int flags) int flags)
{ {
paddr_t lastaddr = 0; paddr_t lastaddr = 0;
int seg, error, first; int seg, used, error, first;
struct mbuf *m; struct mbuf *m;
/* /*
@ -299,17 +305,19 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
first = 1; first = 1;
seg = 0; seg = 0;
used = 0;
error = 0; error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) { for (m = m0; m != NULL && error == 0; m = m->m_next) {
if (m->m_len == 0) if (m->m_len == 0)
continue; continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len, error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first); NULL, flags, &lastaddr, &seg, &used, first);
first = 0; first = 0;
} }
if (error == 0) { if (error == 0) {
map->dm_mapsize = m0->m_pkthdr.len; map->dm_mapsize = m0->m_pkthdr.len;
map->dm_nsegs = seg + 1; map->dm_nsegs = seg + 1;
map->_dm_nused = used;
} }
return (error); return (error);
} }
@ -322,7 +330,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
int flags) int flags)
{ {
paddr_t lastaddr = 0; paddr_t lastaddr = 0;
int seg, i, error, first; int seg, used, i, error, first;
bus_size_t minlen, resid; bus_size_t minlen, resid;
struct proc *p = NULL; struct proc *p = NULL;
struct iovec *iov; struct iovec *iov;
@ -347,6 +355,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
first = 1; first = 1;
seg = 0; seg = 0;
used = 0;
error = 0; error = 0;
for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) { for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
/* /*
@ -357,7 +366,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
addr = (caddr_t)iov[i].iov_base; addr = (caddr_t)iov[i].iov_base;
error = _bus_dmamap_load_buffer(t, map, addr, minlen, error = _bus_dmamap_load_buffer(t, map, addr, minlen,
p, flags, &lastaddr, &seg, first); p, flags, &lastaddr, &seg, &used, first);
first = 0; first = 0;
resid -= minlen; resid -= minlen;
@ -365,6 +374,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
if (error == 0) { if (error == 0) {
map->dm_mapsize = uio->uio_resid; map->dm_mapsize = uio->uio_resid;
map->dm_nsegs = seg + 1; map->dm_nsegs = seg + 1;
map->_dm_nused = used;
} }
return (error); return (error);
} }
@ -683,8 +693,8 @@ _bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
*/ */
int int
_bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf, _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
bus_size_t buflen, struct proc *p, int flags, paddr_t *lastaddrp, int *segp, bus_size_t buflen, struct proc *p, int flags, paddr_t *lastaddrp,
int first) int *segp, int *usedp, int first)
{ {
bus_size_t sgsize; bus_size_t sgsize;
bus_addr_t curaddr, lastaddr, baddr, bmask; bus_addr_t curaddr, lastaddr, baddr, bmask;
@ -699,6 +709,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
else else
pmap = pmap_kernel(); pmap = pmap_kernel();
page = *usedp;
lastaddr = *lastaddrp; lastaddr = *lastaddrp;
bmask = ~(map->_dm_boundary - 1); bmask = ~(map->_dm_boundary - 1);
@ -714,14 +725,14 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
curaddr); curaddr);
if (use_bounce_buffer) { if (use_bounce_buffer) {
if (map->_dm_nused + 1 >= map->_dm_npages) if (page >= map->_dm_npages)
return (ENOMEM); return (ENOMEM);
off = vaddr & PAGE_MASK; off = vaddr & PAGE_MASK;
pg = map->_dm_pages[page = map->_dm_nused++]; pg = map->_dm_pages[page];
curaddr = VM_PAGE_TO_PHYS(pg) + off; curaddr = VM_PAGE_TO_PHYS(pg) + off;
pgva = map->_dm_pgva + (page << PGSHIFT) + off; pgva = map->_dm_pgva + (page << PGSHIFT) + off;
page++;
} }
/* /*
@ -774,6 +785,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
} }
*segp = seg; *segp = seg;
*usedp = page;
*lastaddrp = lastaddr; *lastaddrp = lastaddr;
/* /*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: param.c,v 1.50 2024/05/05 06:14:37 jsg Exp $ */ /* $OpenBSD: param.c,v 1.52 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */ /* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */
/* /*
@ -49,6 +49,11 @@
#include <sys/sem.h> #include <sys/sem.h>
#endif #endif
/*
* Locks used to protect data:
* a atomic
*/
/* /*
* System parameter formulae. * System parameter formulae.
* *
@ -67,9 +72,9 @@ int utc_offset = 0;
#define NTEXT (80 + NPROCESS / 8) /* actually the object cache */ #define NTEXT (80 + NPROCESS / 8) /* actually the object cache */
#define NVNODE (NPROCESS * 2 + NTEXT + 100) #define NVNODE (NPROCESS * 2 + NTEXT + 100)
int initialvnodes = NVNODE; int initialvnodes = NVNODE;
int maxprocess = NPROCESS; int maxprocess = NPROCESS; /* [a] */
int maxthread = 2 * NPROCESS; int maxthread = 2 * NPROCESS; /* [a] */
int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80; int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80; /* [a] */
long nmbclust = NMBCLUSTERS; long nmbclust = NMBCLUSTERS;
#ifndef BUFCACHEPERCENT #ifndef BUFCACHEPERCENT

View file

@ -1,4 +1,4 @@
/* $OpenBSD: audio.c,v 1.207 2024/06/07 08:48:10 jsg Exp $ */ /* $OpenBSD: audio.c,v 1.208 2024/08/20 07:44:36 mvs Exp $ */
/* /*
* Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org> * Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org>
* *
@ -27,11 +27,17 @@
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/audioio.h> #include <sys/audioio.h>
#include <sys/atomic.h>
#include <dev/audio_if.h> #include <dev/audio_if.h>
#include <dev/mulaw.h> #include <dev/mulaw.h>
#include "audio.h" #include "audio.h"
#include "wskbd.h" #include "wskbd.h"
/*
* Locks used to protect data:
* a atomic
*/
#ifdef AUDIO_DEBUG #ifdef AUDIO_DEBUG
#define DPRINTF(...) \ #define DPRINTF(...) \
do { \ do { \
@ -225,7 +231,7 @@ struct mutex audio_lock = MUTEX_INITIALIZER(IPL_AUDIO);
* Global flag to control if audio recording is enabled when the * Global flag to control if audio recording is enabled when the
* mixerctl setting is record.enable=sysctl * mixerctl setting is record.enable=sysctl
*/ */
int audio_record_enable = 0; int audio_record_enable = 0; /* [a] */
#ifdef AUDIO_DEBUG #ifdef AUDIO_DEBUG
/* /*
@ -590,7 +596,7 @@ audio_rintr(void *addr)
sc->rec.pos += sc->rec.blksz; sc->rec.pos += sc->rec.blksz;
if ((sc->record_enable == MIXER_RECORD_ENABLE_SYSCTL && if ((sc->record_enable == MIXER_RECORD_ENABLE_SYSCTL &&
!audio_record_enable) || atomic_load_int(&audio_record_enable) == 0) ||
sc->record_enable == MIXER_RECORD_ENABLE_OFF) { sc->record_enable == MIXER_RECORD_ENABLE_OFF) {
ptr = audio_buf_wgetblk(&sc->rec, &count); ptr = audio_buf_wgetblk(&sc->rec, &count);
audio_fill_sil(sc, ptr, sc->rec.blksz); audio_fill_sil(sc, ptr, sc->rec.blksz);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: virtio_mmio.c,v 1.13 2024/05/17 16:37:10 sf Exp $ */ /* $OpenBSD: virtio_mmio.c,v 1.14 2024/08/20 07:04:29 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/* /*
@ -271,16 +271,16 @@ virtio_mmio_attach(struct device *parent, struct device *self, void *aux)
id = bus_space_read_4(sc->sc_iot, sc->sc_ioh, VIRTIO_MMIO_DEVICE_ID); id = bus_space_read_4(sc->sc_iot, sc->sc_ioh, VIRTIO_MMIO_DEVICE_ID);
printf(": Virtio %s Device", virtio_device_string(id)); printf(": Virtio %s Device", virtio_device_string(id));
if (sc->sc_version == 1)
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
VIRTIO_MMIO_GUEST_PAGE_SIZE, PAGE_SIZE);
printf("\n"); printf("\n");
/* No device connected. */ /* No device connected. */
if (id == 0) if (id == 0)
return; return;
if (sc->sc_version == 1)
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
VIRTIO_MMIO_GUEST_PAGE_SIZE, PAGE_SIZE);
vsc->sc_ops = &virtio_mmio_ops; vsc->sc_ops = &virtio_mmio_ops;
vsc->sc_dmat = sc->sc_dmat; vsc->sc_dmat = sc->sc_dmat;
sc->sc_config_offset = VIRTIO_MMIO_CONFIG; sc->sc_config_offset = VIRTIO_MMIO_CONFIG;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ufshci.c,v 1.39 2024/06/27 21:35:34 mglocker Exp $ */ /* $OpenBSD: ufshci.c,v 1.40 2024/08/20 05:36:38 jsg Exp $ */
/* /*
* Copyright (c) 2022 Marcus Glocker <mglocker@openbsd.org> * Copyright (c) 2022 Marcus Glocker <mglocker@openbsd.org>
@ -347,7 +347,7 @@ ufshci_dmamem_alloc(struct ufshci_softc *sc, size_t size)
if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0,
BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW | BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW |
(sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0, ((sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0),
&udm->udm_map) != 0) &udm->udm_map) != 0)
goto udmfree; goto udmfree;
@ -1428,7 +1428,7 @@ ufshci_ccb_alloc(struct ufshci_softc *sc, int nccbs)
if (bus_dmamap_create(sc->sc_dmat, UFSHCI_UCD_PRDT_MAX_XFER, if (bus_dmamap_create(sc->sc_dmat, UFSHCI_UCD_PRDT_MAX_XFER,
UFSHCI_UCD_PRDT_MAX_SEGS, UFSHCI_UCD_PRDT_MAX_XFER, 0, UFSHCI_UCD_PRDT_MAX_SEGS, UFSHCI_UCD_PRDT_MAX_XFER, 0,
BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW | BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW |
(sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0, ((sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0),
&ccb->ccb_dmamap) != 0) &ccb->ccb_dmamap) != 0)
goto free_maps; goto free_maps;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_rge.c,v 1.29 2024/08/12 06:47:11 dlg Exp $ */ /* $OpenBSD: if_rge.c,v 1.30 2024/08/20 00:09:12 dlg Exp $ */
/* /*
* Copyright (c) 2019, 2020, 2023, 2024 * Copyright (c) 2019, 2020, 2023, 2024
@ -65,7 +65,6 @@ int rge_match(struct device *, void *, void *);
void rge_attach(struct device *, struct device *, void *); void rge_attach(struct device *, struct device *, void *);
int rge_activate(struct device *, int); int rge_activate(struct device *, int);
int rge_intr(void *); int rge_intr(void *);
int rge_encap(struct rge_queues *, struct mbuf *, int);
int rge_ioctl(struct ifnet *, u_long, caddr_t); int rge_ioctl(struct ifnet *, u_long, caddr_t);
void rge_start(struct ifqueue *); void rge_start(struct ifqueue *);
void rge_watchdog(struct ifnet *); void rge_watchdog(struct ifnet *);
@ -413,29 +412,27 @@ rge_intr(void *arg)
return (claimed); return (claimed);
} }
int static inline void
rge_encap(struct rge_queues *q, struct mbuf *m, int idx) rge_tx_list_sync(struct rge_softc *sc, struct rge_queues *q,
unsigned int idx, unsigned int len, int ops)
{
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map,
idx * sizeof(struct rge_tx_desc), len * sizeof(struct rge_tx_desc),
ops);
}
static int
rge_encap(struct ifnet *ifp, struct rge_queues *q, struct mbuf *m, int idx)
{ {
struct rge_softc *sc = q->q_sc; struct rge_softc *sc = q->q_sc;
struct rge_tx_desc *d = NULL; struct rge_tx_desc *d = NULL;
struct rge_txq *txq; struct rge_txq *txq;
bus_dmamap_t txmap; bus_dmamap_t txmap;
uint32_t cmdsts, cflags = 0; uint32_t cmdsts, cflags = 0;
int cur, error, i, last, nsegs; int cur, error, i;
#if NBPFILTER > 0
/* caddr_t if_bpf;
* Set RGE_TDEXTSTS_IPCSUM if any checksum offloading is requested. #endif
* Otherwise, RGE_TDEXTSTS_TCPCSUM / RGE_TDEXTSTS_UDPCSUM does not
* take affect.
*/
if ((m->m_pkthdr.csum_flags &
(M_IPV4_CSUM_OUT | M_TCP_CSUM_OUT | M_UDP_CSUM_OUT)) != 0) {
cflags |= RGE_TDEXTSTS_IPCSUM;
if (m->m_pkthdr.csum_flags & M_TCP_CSUM_OUT)
cflags |= RGE_TDEXTSTS_TCPCSUM;
if (m->m_pkthdr.csum_flags & M_UDP_CSUM_OUT)
cflags |= RGE_TDEXTSTS_UDPCSUM;
}
txq = &q->q_tx.rge_txq[idx]; txq = &q->q_tx.rge_txq[idx];
txmap = txq->txq_dmamap; txmap = txq->txq_dmamap;
@ -455,10 +452,28 @@ rge_encap(struct rge_queues *q, struct mbuf *m, int idx)
return (0); return (0);
} }
#if NBPFILTER > 0
if_bpf = READ_ONCE(ifp->if_bpf);
if (if_bpf)
bpf_mtap_ether(if_bpf, m, BPF_DIRECTION_OUT);
#endif
bus_dmamap_sync(sc->sc_dmat, txmap, 0, txmap->dm_mapsize, bus_dmamap_sync(sc->sc_dmat, txmap, 0, txmap->dm_mapsize,
BUS_DMASYNC_PREWRITE); BUS_DMASYNC_PREWRITE);
nsegs = txmap->dm_nsegs; /*
* Set RGE_TDEXTSTS_IPCSUM if any checksum offloading is requested.
* Otherwise, RGE_TDEXTSTS_TCPCSUM / RGE_TDEXTSTS_UDPCSUM does not
* take affect.
*/
if ((m->m_pkthdr.csum_flags &
(M_IPV4_CSUM_OUT | M_TCP_CSUM_OUT | M_UDP_CSUM_OUT)) != 0) {
cflags |= RGE_TDEXTSTS_IPCSUM;
if (m->m_pkthdr.csum_flags & M_TCP_CSUM_OUT)
cflags |= RGE_TDEXTSTS_TCPCSUM;
if (m->m_pkthdr.csum_flags & M_UDP_CSUM_OUT)
cflags |= RGE_TDEXTSTS_UDPCSUM;
}
/* Set up hardware VLAN tagging. */ /* Set up hardware VLAN tagging. */
#if NVLAN > 0 #if NVLAN > 0
@ -467,47 +482,57 @@ rge_encap(struct rge_queues *q, struct mbuf *m, int idx)
#endif #endif
cur = idx; cur = idx;
cmdsts = RGE_TDCMDSTS_SOF; for (i = 1; i < txmap->dm_nsegs; i++) {
cur = RGE_NEXT_TX_DESC(cur);
for (i = 0; i < txmap->dm_nsegs; i++) {
d = &q->q_tx.rge_tx_list[cur];
d->rge_extsts = htole32(cflags);
d->rge_addrlo = htole32(RGE_ADDR_LO(txmap->dm_segs[i].ds_addr));
d->rge_addrhi = htole32(RGE_ADDR_HI(txmap->dm_segs[i].ds_addr));
cmdsts = RGE_TDCMDSTS_OWN;
cmdsts |= txmap->dm_segs[i].ds_len; cmdsts |= txmap->dm_segs[i].ds_len;
if (cur == RGE_TX_LIST_CNT - 1) if (cur == RGE_TX_LIST_CNT - 1)
cmdsts |= RGE_TDCMDSTS_EOR; cmdsts |= RGE_TDCMDSTS_EOR;
if (i == (txmap->dm_nsegs - 1)) if (i == txmap->dm_nsegs - 1)
cmdsts |= RGE_TDCMDSTS_EOF; cmdsts |= RGE_TDCMDSTS_EOF;
d = &q->q_tx.rge_tx_list[cur];
d->rge_cmdsts = htole32(cmdsts); d->rge_cmdsts = htole32(cmdsts);
d->rge_extsts = htole32(cflags);
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map, d->rge_addr = htole64(txmap->dm_segs[i].ds_addr);
cur * sizeof(struct rge_tx_desc), sizeof(struct rge_tx_desc),
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
last = cur;
cmdsts = RGE_TDCMDSTS_OWN;
cur = RGE_NEXT_TX_DESC(cur);
} }
/* Transfer ownership of packet to the chip. */
d = &q->q_tx.rge_tx_list[idx];
d->rge_cmdsts |= htole32(RGE_TDCMDSTS_OWN);
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map,
idx * sizeof(struct rge_tx_desc), sizeof(struct rge_tx_desc),
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
/* Update info of TX queue and descriptors. */ /* Update info of TX queue and descriptors. */
txq->txq_mbuf = m; txq->txq_mbuf = m;
txq->txq_descidx = last; txq->txq_descidx = cur;
return (nsegs); cmdsts = RGE_TDCMDSTS_SOF;
cmdsts |= txmap->dm_segs[0].ds_len;
if (idx == RGE_TX_LIST_CNT - 1)
cmdsts |= RGE_TDCMDSTS_EOR;
if (txmap->dm_nsegs == 1)
cmdsts |= RGE_TDCMDSTS_EOF;
d = &q->q_tx.rge_tx_list[idx];
d->rge_cmdsts = htole32(cmdsts);
d->rge_extsts = htole32(cflags);
d->rge_addr = htole64(txmap->dm_segs[0].ds_addr);
if (cur >= idx) {
rge_tx_list_sync(sc, q, idx, txmap->dm_nsegs,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
} else {
rge_tx_list_sync(sc, q, idx, RGE_TX_LIST_CNT - idx,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
rge_tx_list_sync(sc, q, 0, cur + 1,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
}
/* Transfer ownership of packet to the chip. */
cmdsts |= RGE_TDCMDSTS_OWN;
rge_tx_list_sync(sc, q, idx, 1, BUS_DMASYNC_POSTWRITE);
d->rge_cmdsts = htole32(cmdsts);
rge_tx_list_sync(sc, q, idx, 1, BUS_DMASYNC_PREWRITE);
return (txmap->dm_nsegs);
} }
int int
@ -590,20 +615,15 @@ rge_start(struct ifqueue *ifq)
if (m == NULL) if (m == NULL)
break; break;
used = rge_encap(q, m, idx); used = rge_encap(ifp, q, m, idx);
if (used == 0) { if (used == 0) {
m_freem(m); m_freem(m);
continue; continue;
} }
KASSERT(used <= free); KASSERT(used < free);
free -= used; free -= used;
#if NBPFILTER > 0
if (ifp->if_bpf)
bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif
idx += used; idx += used;
if (idx >= RGE_TX_LIST_CNT) if (idx >= RGE_TX_LIST_CNT)
idx -= RGE_TX_LIST_CNT; idx -= RGE_TX_LIST_CNT;
@ -1357,24 +1377,21 @@ rge_txeof(struct rge_queues *q)
struct ifnet *ifp = &sc->sc_arpcom.ac_if; struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct rge_txq *txq; struct rge_txq *txq;
uint32_t txstat; uint32_t txstat;
int cons, idx, prod; int cons, prod, cur, idx;
int free = 0; int free = 0;
prod = q->q_tx.rge_txq_prodidx; prod = q->q_tx.rge_txq_prodidx;
cons = q->q_tx.rge_txq_considx; cons = q->q_tx.rge_txq_considx;
while (prod != cons) { idx = cons;
txq = &q->q_tx.rge_txq[cons]; while (idx != prod) {
idx = txq->txq_descidx; txq = &q->q_tx.rge_txq[idx];
cur = txq->txq_descidx;
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map, rge_tx_list_sync(sc, q, cur, 1, BUS_DMASYNC_POSTREAD);
idx * sizeof(struct rge_tx_desc), txstat = q->q_tx.rge_tx_list[cur].rge_cmdsts;
sizeof(struct rge_tx_desc), rge_tx_list_sync(sc, q, cur, 1, BUS_DMASYNC_PREREAD);
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); if (ISSET(txstat, htole32(RGE_TDCMDSTS_OWN))) {
txstat = letoh32(q->q_tx.rge_tx_list[idx].rge_cmdsts);
if (txstat & RGE_TDCMDSTS_OWN) {
free = 2; free = 2;
break; break;
} }
@ -1385,24 +1402,30 @@ rge_txeof(struct rge_queues *q)
m_freem(txq->txq_mbuf); m_freem(txq->txq_mbuf);
txq->txq_mbuf = NULL; txq->txq_mbuf = NULL;
if (txstat & (RGE_TDCMDSTS_EXCESSCOLL | RGE_TDCMDSTS_COLL)) if (ISSET(txstat,
htole32(RGE_TDCMDSTS_EXCESSCOLL | RGE_TDCMDSTS_COLL)))
ifp->if_collisions++; ifp->if_collisions++;
if (txstat & RGE_TDCMDSTS_TXERR) if (ISSET(txstat, htole32(RGE_TDCMDSTS_TXERR)))
ifp->if_oerrors++; ifp->if_oerrors++;
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map, idx = RGE_NEXT_TX_DESC(cur);
idx * sizeof(struct rge_tx_desc),
sizeof(struct rge_tx_desc),
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
cons = RGE_NEXT_TX_DESC(idx);
free = 1; free = 1;
} }
if (free == 0) if (free == 0)
return (0); return (0);
q->q_tx.rge_txq_considx = cons; if (idx >= cons) {
rge_tx_list_sync(sc, q, cons, idx - cons,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
} else {
rge_tx_list_sync(sc, q, cons, RGE_TX_LIST_CNT - cons,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
rge_tx_list_sync(sc, q, 0, idx,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
}
q->q_tx.rge_txq_considx = idx;
if (ifq_is_oactive(&ifp->if_snd)) if (ifq_is_oactive(&ifp->if_snd))
ifq_restart(&ifp->if_snd); ifq_restart(&ifp->if_snd);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_rgereg.h,v 1.11 2024/06/30 08:13:02 kevlo Exp $ */ /* $OpenBSD: if_rgereg.h,v 1.12 2024/08/20 00:09:12 dlg Exp $ */
/* /*
* Copyright (c) 2019, 2020 Kevin Lo <kevlo@openbsd.org> * Copyright (c) 2019, 2020 Kevin Lo <kevlo@openbsd.org>
@ -206,10 +206,9 @@
struct rge_tx_desc { struct rge_tx_desc {
uint32_t rge_cmdsts; uint32_t rge_cmdsts;
uint32_t rge_extsts; uint32_t rge_extsts;
uint32_t rge_addrlo; uint64_t rge_addr;
uint32_t rge_addrhi;
uint32_t reserved[4]; uint32_t reserved[4];
}; } __packed __aligned(16);
#define RGE_TDCMDSTS_COLL 0x000f0000 #define RGE_TDCMDSTS_COLL 0x000f0000
#define RGE_TDCMDSTS_EXCESSCOLL 0x00100000 #define RGE_TDCMDSTS_EXCESSCOLL 0x00100000

View file

@ -1,4 +1,4 @@
$OpenBSD: pcidevs,v 1.2084 2024/08/15 11:25:37 patrick Exp $ $OpenBSD: pcidevs,v 1.2085 2024/08/20 12:17:48 jsg Exp $
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
/* /*
@ -8956,6 +8956,8 @@ product SAMSUNG2 SM981_NVME 0xa808 SM981/PM981 NVMe
product SAMSUNG2 PM991_NVME 0xa809 PM991 NVMe product SAMSUNG2 PM991_NVME 0xa809 PM991 NVMe
product SAMSUNG2 PM9A1_NVME 0xa80a PM9A1 NVMe product SAMSUNG2 PM9A1_NVME 0xa80a PM9A1 NVMe
product SAMSUNG2 PM9B1_NVME 0xa80b PM9B1 NVMe product SAMSUNG2 PM9B1_NVME 0xa80b PM9B1 NVMe
product SAMSUNG2 PM9C1_NVME 0xa80c PM9C1 NVMe
product SAMSUNG2 PM9C1A_NVME 0xa80d PM9C1a NVMe
product SAMSUNG2 NVME_171X 0xa820 NVMe product SAMSUNG2 NVME_171X 0xa820 NVMe
product SAMSUNG2 NVME_172X 0xa821 NVMe product SAMSUNG2 NVME_172X 0xa821 NVMe
product SAMSUNG2 NVME_172X_A_B 0xa822 NVMe product SAMSUNG2 NVME_172X_A_B 0xa822 NVMe

View file

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
* *
* generated from: * generated from:
* OpenBSD: pcidevs,v 1.2084 2024/08/15 11:25:37 patrick Exp * OpenBSD: pcidevs,v 1.2085 2024/08/20 12:17:48 jsg Exp
*/ */
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -8961,6 +8961,8 @@
#define PCI_PRODUCT_SAMSUNG2_PM991_NVME 0xa809 /* PM991 NVMe */ #define PCI_PRODUCT_SAMSUNG2_PM991_NVME 0xa809 /* PM991 NVMe */
#define PCI_PRODUCT_SAMSUNG2_PM9A1_NVME 0xa80a /* PM9A1 NVMe */ #define PCI_PRODUCT_SAMSUNG2_PM9A1_NVME 0xa80a /* PM9A1 NVMe */
#define PCI_PRODUCT_SAMSUNG2_PM9B1_NVME 0xa80b /* PM9B1 NVMe */ #define PCI_PRODUCT_SAMSUNG2_PM9B1_NVME 0xa80b /* PM9B1 NVMe */
#define PCI_PRODUCT_SAMSUNG2_PM9C1_NVME 0xa80c /* PM9C1 NVMe */
#define PCI_PRODUCT_SAMSUNG2_PM9C1A_NVME 0xa80d /* PM9C1a NVMe */
#define PCI_PRODUCT_SAMSUNG2_NVME_171X 0xa820 /* NVMe */ #define PCI_PRODUCT_SAMSUNG2_NVME_171X 0xa820 /* NVMe */
#define PCI_PRODUCT_SAMSUNG2_NVME_172X 0xa821 /* NVMe */ #define PCI_PRODUCT_SAMSUNG2_NVME_172X 0xa821 /* NVMe */
#define PCI_PRODUCT_SAMSUNG2_NVME_172X_A_B 0xa822 /* NVMe */ #define PCI_PRODUCT_SAMSUNG2_NVME_172X_A_B 0xa822 /* NVMe */

View file

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
* *
* generated from: * generated from:
* OpenBSD: pcidevs,v 1.2084 2024/08/15 11:25:37 patrick Exp * OpenBSD: pcidevs,v 1.2085 2024/08/20 12:17:48 jsg Exp
*/ */
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -32307,6 +32307,14 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_PM9B1_NVME, PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_PM9B1_NVME,
"PM9B1 NVMe", "PM9B1 NVMe",
}, },
{
PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_PM9C1_NVME,
"PM9C1 NVMe",
},
{
PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_PM9C1A_NVME,
"PM9C1a NVMe",
},
{ {
PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_NVME_171X, PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_NVME_171X,
"NVMe", "NVMe",

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_descrip.c,v 1.208 2024/06/22 10:22:29 jsg Exp $ */ /* $OpenBSD: kern_descrip.c,v 1.209 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/* /*
@ -362,7 +362,7 @@ restart:
return (0); return (0);
} }
if ((u_int)new >= lim_cur(RLIMIT_NOFILE) || if ((u_int)new >= lim_cur(RLIMIT_NOFILE) ||
(u_int)new >= maxfiles) { (u_int)new >= atomic_load_int(&maxfiles)) {
FRELE(fp, p); FRELE(fp, p);
return (EBADF); return (EBADF);
} }
@ -424,7 +424,7 @@ restart:
case F_DUPFD_CLOEXEC: case F_DUPFD_CLOEXEC:
newmin = (long)SCARG(uap, arg); newmin = (long)SCARG(uap, arg);
if ((u_int)newmin >= lim_cur(RLIMIT_NOFILE) || if ((u_int)newmin >= lim_cur(RLIMIT_NOFILE) ||
(u_int)newmin >= maxfiles) { (u_int)newmin >= atomic_load_int(&maxfiles)) {
error = EINVAL; error = EINVAL;
break; break;
} }
@ -877,7 +877,7 @@ fdalloc(struct proc *p, int want, int *result)
* expanding the ofile array. * expanding the ofile array.
*/ */
restart: restart:
lim = min((int)lim_cur(RLIMIT_NOFILE), maxfiles); lim = min((int)lim_cur(RLIMIT_NOFILE), atomic_load_int(&maxfiles));
last = min(fdp->fd_nfiles, lim); last = min(fdp->fd_nfiles, lim);
if ((i = want) < fdp->fd_freefile) if ((i = want) < fdp->fd_freefile)
i = fdp->fd_freefile; i = fdp->fd_freefile;
@ -1037,7 +1037,7 @@ fnew(struct proc *p)
int nfiles; int nfiles;
nfiles = atomic_inc_int_nv(&numfiles); nfiles = atomic_inc_int_nv(&numfiles);
if (nfiles > maxfiles) { if (nfiles > atomic_load_int(&maxfiles)) {
atomic_dec_int(&numfiles); atomic_dec_int(&numfiles);
tablefull("file"); tablefull("file");
return (NULL); return (NULL);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_fork.c,v 1.263 2024/08/16 16:19:03 mpi Exp $ */ /* $OpenBSD: kern_fork.c,v 1.264 2024/08/20 07:48:23 mvs Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/* /*
@ -307,7 +307,7 @@ struct timeval fork_tfmrate = { 10, 0 };
int int
fork_check_maxthread(uid_t uid) fork_check_maxthread(uid_t uid)
{ {
int val; int maxthread_local, val;
/* /*
* Although process entries are dynamically created, we still keep * Although process entries are dynamically created, we still keep
@ -318,8 +318,10 @@ fork_check_maxthread(uid_t uid)
* the variable nthreads is the current number of procs, maxthread is * the variable nthreads is the current number of procs, maxthread is
* the limit. * the limit.
*/ */
maxthread_local = atomic_load_int(&maxthread);
val = atomic_inc_int_nv(&nthreads); val = atomic_inc_int_nv(&nthreads);
if ((val > maxthread - 5 && uid != 0) || val > maxthread) { if ((val > maxthread_local - 5 && uid != 0) ||
val > maxthread_local) {
static struct timeval lasttfm; static struct timeval lasttfm;
if (ratecheck(&lasttfm, &fork_tfmrate)) if (ratecheck(&lasttfm, &fork_tfmrate))
@ -353,7 +355,7 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg,
struct proc *p; struct proc *p;
uid_t uid = curp->p_ucred->cr_ruid; uid_t uid = curp->p_ucred->cr_ruid;
struct vmspace *vm; struct vmspace *vm;
int count; int count, maxprocess_local;
vaddr_t uaddr; vaddr_t uaddr;
int error; int error;
struct ptrace_state *newptstat = NULL; struct ptrace_state *newptstat = NULL;
@ -366,8 +368,9 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg,
if ((error = fork_check_maxthread(uid))) if ((error = fork_check_maxthread(uid)))
return error; return error;
if ((nprocesses >= maxprocess - 5 && uid != 0) || maxprocess_local = atomic_load_int(&maxprocess);
nprocesses >= maxprocess) { if ((nprocesses >= maxprocess_local - 5 && uid != 0) ||
nprocesses >= maxprocess_local) {
static struct timeval lasttfm; static struct timeval lasttfm;
if (ratecheck(&lasttfm, &fork_tfmrate)) if (ratecheck(&lasttfm, &fork_tfmrate))

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_resource.c,v 1.86 2024/07/09 15:20:15 claudio Exp $ */ /* $OpenBSD: kern_resource.c,v 1.88 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*- /*-
@ -275,10 +275,10 @@ dosetrlimit(struct proc *p, u_int which, struct rlimit *limp)
maxlim = maxsmap; maxlim = maxsmap;
break; break;
case RLIMIT_NOFILE: case RLIMIT_NOFILE:
maxlim = maxfiles; maxlim = atomic_load_int(&maxfiles);
break; break;
case RLIMIT_NPROC: case RLIMIT_NPROC:
maxlim = maxprocess; maxlim = atomic_load_int(&maxprocess);
break; break;
default: default:
maxlim = RLIM_INFINITY; maxlim = RLIM_INFINITY;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.439 2024/08/14 17:52:47 mvs Exp $ */ /* $OpenBSD: kern_sysctl.c,v 1.442 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*- /*-
@ -455,11 +455,6 @@ kern_sysctl_dirs(int top_name, int *name, u_int namelen,
return witness_sysctl(name, namelen, oldp, oldlenp, return witness_sysctl(name, namelen, oldp, oldlenp,
newp, newlen); newp, newlen);
#endif #endif
#if NAUDIO > 0
case KERN_AUDIO:
return (sysctl_audio(name, namelen, oldp, oldlenp,
newp, newlen));
#endif
#if NVIDEO > 0 #if NVIDEO > 0
case KERN_VIDEO: case KERN_VIDEO:
return (sysctl_video(name, namelen, oldp, oldlenp, return (sysctl_video(name, namelen, oldp, oldlenp,
@ -488,6 +483,16 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
/* dispatch the non-terminal nodes first */ /* dispatch the non-terminal nodes first */
if (namelen != 1) { if (namelen != 1) {
switch (name[0]) {
#if NAUDIO > 0
case KERN_AUDIO:
return (sysctl_audio(name, namelen, oldp, oldlenp,
newp, newlen));
#endif
default:
break;
}
savelen = *oldlenp; savelen = *oldlenp;
if ((error = sysctl_vslock(oldp, savelen))) if ((error = sysctl_vslock(oldp, savelen)))
return (error); return (error);
@ -549,6 +554,8 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (sysctl_rdint(oldp, oldlenp, newp, mp->msg_bufs)); return (sysctl_rdint(oldp, oldlenp, newp, mp->msg_bufs));
} }
case KERN_OSREV: case KERN_OSREV:
case KERN_MAXPROC:
case KERN_MAXFILES:
case KERN_NFILES: case KERN_NFILES:
case KERN_TTYCOUNT: case KERN_TTYCOUNT:
case KERN_ARGMAX: case KERN_ARGMAX:
@ -558,6 +565,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case KERN_SAVED_IDS: case KERN_SAVED_IDS:
case KERN_MAXPARTITIONS: case KERN_MAXPARTITIONS:
case KERN_RAWPARTITION: case KERN_RAWPARTITION:
case KERN_MAXTHREAD:
case KERN_NTHREADS: case KERN_NTHREADS:
case KERN_SOMAXCONN: case KERN_SOMAXCONN:
case KERN_SOMINCONN: case KERN_SOMINCONN:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_etherip.c,v 1.55 2024/02/13 12:22:09 bluhm Exp $ */ /* $OpenBSD: if_etherip.c,v 1.56 2024/08/20 07:47:25 mvs Exp $ */
/* /*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org> * Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
* *
@ -55,6 +55,11 @@
#include <net/if_etherip.h> #include <net/if_etherip.h>
/*
* Locks used to protect data:
* a atomic
*/
union etherip_addr { union etherip_addr {
struct in_addr in4; struct in_addr in4;
struct in6_addr in6; struct in6_addr in6;
@ -97,7 +102,7 @@ struct etherip_softc {
* We can control the acceptance of EtherIP packets by altering the sysctl * We can control the acceptance of EtherIP packets by altering the sysctl
* net.inet.etherip.allow value. Zero means drop them, all else is acceptance. * net.inet.etherip.allow value. Zero means drop them, all else is acceptance.
*/ */
int etherip_allow = 0; int etherip_allow = 0; /* [a] */
struct cpumem *etheripcounters; struct cpumem *etheripcounters;
@ -628,7 +633,8 @@ etherip_input(struct etherip_tunnel *key, struct mbuf *m, uint8_t tos,
struct etherip_header *eip; struct etherip_header *eip;
int rxprio; int rxprio;
if (!etherip_allow && (m->m_flags & (M_AUTH|M_CONF)) == 0) { if (atomic_load_int(&etherip_allow) == 0 &&
(m->m_flags & (M_AUTH|M_CONF)) == 0) {
etheripstat_inc(etherips_pdrops); etheripstat_inc(etherips_pdrops);
goto drop; goto drop;
} }
@ -799,19 +805,14 @@ int
etherip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, etherip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen) void *newp, size_t newlen)
{ {
int error;
/* All sysctl names at this level are terminal. */ /* All sysctl names at this level are terminal. */
if (namelen != 1) if (namelen != 1)
return ENOTDIR; return ENOTDIR;
switch (name[0]) { switch (name[0]) {
case ETHERIPCTL_ALLOW: case ETHERIPCTL_ALLOW:
NET_LOCK(); return (sysctl_int_bounded(oldp, oldlenp, newp, newlen,
error = sysctl_int_bounded(oldp, oldlenp, newp, newlen, &etherip_allow, 0, 1));
&etherip_allow, 0, 1);
NET_UNLOCK();
return (error);
case ETHERIPCTL_STATS: case ETHERIPCTL_STATS:
return (etherip_sysctl_etheripstat(oldp, oldlenp, newp)); return (etherip_sysctl_etheripstat(oldp, oldlenp, newp));
default: default:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: igmp.c,v 1.84 2024/08/12 11:25:27 bluhm Exp $ */ /* $OpenBSD: igmp.c,v 1.85 2024/08/20 07:46:27 mvs Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */ /* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/* /*
@ -687,8 +687,6 @@ igmp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
switch (name[0]) { switch (name[0]) {
case IGMPCTL_STATS: case IGMPCTL_STATS:
if (newp != NULL)
return (EPERM);
return (igmp_sysctl_igmpstat(oldp, oldlenp, newp)); return (igmp_sysctl_igmpstat(oldp, oldlenp, newp));
default: default:
return (EOPNOTSUPP); return (EOPNOTSUPP);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in_proto.c,v 1.108 2024/08/16 09:20:35 mvs Exp $ */ /* $OpenBSD: in_proto.c,v 1.110 2024/08/20 07:47:25 mvs Exp $ */
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */ /* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
/* /*
@ -270,7 +270,7 @@ const struct protosw inetsw[] = {
.pr_type = SOCK_RAW, .pr_type = SOCK_RAW,
.pr_domain = &inetdomain, .pr_domain = &inetdomain,
.pr_protocol = IPPROTO_IGMP, .pr_protocol = IPPROTO_IGMP,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET|PR_MPSYSCTL,
.pr_input = igmp_input, .pr_input = igmp_input,
.pr_ctloutput = rip_ctloutput, .pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs, .pr_usrreqs = &rip_usrreqs,
@ -342,7 +342,7 @@ const struct protosw inetsw[] = {
.pr_type = SOCK_RAW, .pr_type = SOCK_RAW,
.pr_domain = &inetdomain, .pr_domain = &inetdomain,
.pr_protocol = IPPROTO_PFSYNC, .pr_protocol = IPPROTO_PFSYNC,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET|PR_MPSYSCTL,
.pr_input = pfsync_input4, .pr_input = pfsync_input4,
.pr_ctloutput = rip_ctloutput, .pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs, .pr_usrreqs = &rip_usrreqs,
@ -366,7 +366,7 @@ const struct protosw inetsw[] = {
.pr_type = SOCK_RAW, .pr_type = SOCK_RAW,
.pr_domain = &inetdomain, .pr_domain = &inetdomain,
.pr_protocol = IPPROTO_ETHERIP, .pr_protocol = IPPROTO_ETHERIP,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET|PR_MPSYSCTL,
.pr_input = ip_etherip_input, .pr_input = ip_etherip_input,
.pr_ctloutput = rip_ctloutput, .pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs, .pr_usrreqs = &rip_usrreqs,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in6_proto.c,v 1.118 2024/08/16 09:20:35 mvs Exp $ */ /* $OpenBSD: in6_proto.c,v 1.119 2024/08/20 07:46:27 mvs Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */ /* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/* /*
@ -158,7 +158,7 @@ const struct protosw inet6sw[] = {
.pr_type = SOCK_RAW, .pr_type = SOCK_RAW,
.pr_domain = &inet6domain, .pr_domain = &inet6domain,
.pr_protocol = IPPROTO_RAW, .pr_protocol = IPPROTO_RAW,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET, .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET|PR_MPSYSCTL,
.pr_input = rip6_input, .pr_input = rip6_input,
.pr_ctlinput = rip6_ctlinput, .pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput, .pr_ctloutput = rip6_ctloutput,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sshkey.c,v 1.143 2024/08/15 00:51:51 djm Exp $ */ /* $OpenBSD: sshkey.c,v 1.145 2024/08/20 11:10:04 djm Exp $ */
/* /*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved. * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@ -26,6 +26,7 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/mman.h>
#include <netinet/in.h> #include <netinet/in.h>
#ifdef WITH_OPENSSL #ifdef WITH_OPENSSL
@ -710,6 +711,27 @@ sshkey_sk_cleanup(struct sshkey *k)
k->sk_key_handle = k->sk_reserved = NULL; k->sk_key_handle = k->sk_reserved = NULL;
} }
static int
sshkey_prekey_alloc(u_char **prekeyp, size_t len)
{
u_char *prekey;
*prekeyp = NULL;
if ((prekey = mmap(NULL, len, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE|MAP_CONCEAL, -1, 0)) == MAP_FAILED)
return SSH_ERR_SYSTEM_ERROR;
*prekeyp = prekey;
return 0;
}
static void
sshkey_prekey_free(void *prekey, size_t len)
{
if (prekey == NULL)
return;
munmap(prekey, len);
}
static void static void
sshkey_free_contents(struct sshkey *k) sshkey_free_contents(struct sshkey *k)
{ {
@ -723,7 +745,7 @@ sshkey_free_contents(struct sshkey *k)
if (sshkey_is_cert(k)) if (sshkey_is_cert(k))
cert_free(k->cert); cert_free(k->cert);
freezero(k->shielded_private, k->shielded_len); freezero(k->shielded_private, k->shielded_len);
freezero(k->shield_prekey, k->shield_prekey_len); sshkey_prekey_free(k->shield_prekey, k->shield_prekey_len);
} }
void void
@ -1591,10 +1613,8 @@ sshkey_shield_private(struct sshkey *k)
} }
/* Prepare a random pre-key, and from it an ephemeral key */ /* Prepare a random pre-key, and from it an ephemeral key */
if ((prekey = malloc(SSHKEY_SHIELD_PREKEY_LEN)) == NULL) { if ((r = sshkey_prekey_alloc(&prekey, SSHKEY_SHIELD_PREKEY_LEN)) != 0)
r = SSH_ERR_ALLOC_FAIL;
goto out; goto out;
}
arc4random_buf(prekey, SSHKEY_SHIELD_PREKEY_LEN); arc4random_buf(prekey, SSHKEY_SHIELD_PREKEY_LEN);
if ((r = ssh_digest_memory(SSHKEY_SHIELD_PREKEY_HASH, if ((r = ssh_digest_memory(SSHKEY_SHIELD_PREKEY_HASH,
prekey, SSHKEY_SHIELD_PREKEY_LEN, prekey, SSHKEY_SHIELD_PREKEY_LEN,
@ -1672,7 +1692,7 @@ sshkey_shield_private(struct sshkey *k)
explicit_bzero(keyiv, sizeof(keyiv)); explicit_bzero(keyiv, sizeof(keyiv));
explicit_bzero(&tmp, sizeof(tmp)); explicit_bzero(&tmp, sizeof(tmp));
freezero(enc, enclen); freezero(enc, enclen);
freezero(prekey, SSHKEY_SHIELD_PREKEY_LEN); sshkey_prekey_free(prekey, SSHKEY_SHIELD_PREKEY_LEN);
sshkey_free(kswap); sshkey_free(kswap);
sshbuf_free(prvbuf); sshbuf_free(prvbuf);
return r; return r;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: output.c,v 1.53 2024/08/14 19:10:51 claudio Exp $ */ /* $OpenBSD: output.c,v 1.54 2024/08/20 12:00:20 claudio Exp $ */
/* /*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@ -119,7 +119,7 @@ show_summary(struct peer *p)
p->stats.msg_sent_open + p->stats.msg_sent_notification + p->stats.msg_sent_open + p->stats.msg_sent_notification +
p->stats.msg_sent_update + p->stats.msg_sent_keepalive + p->stats.msg_sent_update + p->stats.msg_sent_keepalive +
p->stats.msg_sent_rrefresh, p->stats.msg_sent_rrefresh,
p->wbuf.queued, p->stats.msg_queue_len,
fmt_monotime(p->stats.last_updown)); fmt_monotime(p->stats.last_updown));
if (p->state == STATE_ESTABLISHED) { if (p->state == STATE_ESTABLISHED) {
printf("%6u", p->stats.prefix_cnt); printf("%6u", p->stats.prefix_cnt);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: control.c,v 1.117 2024/04/22 09:36:04 claudio Exp $ */ /* $OpenBSD: control.c,v 1.118 2024/08/20 11:59:39 claudio Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -564,6 +564,7 @@ control_imsg_relay(struct imsg *imsg, struct peer *p)
p->stats.prefix_sent_eor = stats.prefix_sent_eor; p->stats.prefix_sent_eor = stats.prefix_sent_eor;
p->stats.pending_update = stats.pending_update; p->stats.pending_update = stats.pending_update;
p->stats.pending_withdraw = stats.pending_withdraw; p->stats.pending_withdraw = stats.pending_withdraw;
p->stats.msg_queue_len = msgbuf_queuelen(&p->wbuf);
return imsg_compose(&c->imsgbuf, type, 0, pid, -1, return imsg_compose(&c->imsgbuf, type, 0, pid, -1,
p, sizeof(*p)); p, sizeof(*p));

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rde.c,v 1.626 2024/08/14 19:09:51 claudio Exp $ */ /* $OpenBSD: rde.c,v 1.627 2024/08/20 11:59:39 claudio Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -245,7 +245,7 @@ rde_main(int debug, int verbose)
if (i >= pfd_elms) if (i >= pfd_elms)
fatalx("poll pfd too small"); fatalx("poll pfd too small");
if (mctx->mrt.wbuf.queued) { if (msgbuf_queuelen(&mctx->mrt.wbuf) > 0) {
pfd[i].fd = mctx->mrt.wbuf.fd; pfd[i].fd = mctx->mrt.wbuf.fd;
pfd[i].events = POLLOUT; pfd[i].events = POLLOUT;
i++; i++;
@ -3175,7 +3175,7 @@ rde_mrt_throttled(void *arg)
{ {
struct mrt *mrt = arg; struct mrt *mrt = arg;
return (mrt->wbuf.queued > SESS_MSG_LOW_MARK); return (msgbuf_queuelen(&mrt->wbuf) > SESS_MSG_LOW_MARK);
} }
static void static void

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rtr_proto.c,v 1.38 2024/08/12 09:04:23 claudio Exp $ */ /* $OpenBSD: rtr_proto.c,v 1.39 2024/08/20 11:59:39 claudio Exp $ */
/* /*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@ -1263,7 +1263,7 @@ rtr_dispatch_msg(struct pollfd *pfd, struct rtr_session *rs)
rtr_fsm(rs, RTR_EVNT_CON_CLOSE); rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
return; return;
} }
if (pfd->revents & POLLOUT && rs->w.queued) { if (pfd->revents & POLLOUT && msgbuf_queuelen(&rs->w) > 0) {
if ((error = ibuf_write(&rs->w)) == -1) { if ((error = ibuf_write(&rs->w)) == -1) {
if (errno != EAGAIN) { if (errno != EAGAIN) {
log_warn("rtr %s: write error", log_rtr(rs)); log_warn("rtr %s: write error", log_rtr(rs));
@ -1272,7 +1272,8 @@ rtr_dispatch_msg(struct pollfd *pfd, struct rtr_session *rs)
} }
if (error == 0) if (error == 0)
rtr_fsm(rs, RTR_EVNT_CON_CLOSE); rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
if (rs->w.queued == 0 && rs->state == RTR_STATE_ERROR) if (rs->state == RTR_STATE_ERROR &&
msgbuf_queuelen(&rs->w) == 0)
rtr_fsm(rs, RTR_EVNT_CON_CLOSE); rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
} }
if (pfd->revents & POLLIN) { if (pfd->revents & POLLIN) {
@ -1378,7 +1379,7 @@ rtr_poll_events(struct pollfd *pfds, size_t npfds, time_t *timeout)
pfd->fd = rs->fd; pfd->fd = rs->fd;
pfd->events = 0; pfd->events = 0;
if (rs->w.queued) if (msgbuf_queuelen(&rs->w) > 0)
pfd->events |= POLLOUT; pfd->events |= POLLOUT;
if (rs->state >= RTR_STATE_ESTABLISHED) if (rs->state >= RTR_STATE_ESTABLISHED)
pfd->events |= POLLIN; pfd->events |= POLLIN;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: session.c,v 1.480 2024/06/10 12:51:25 claudio Exp $ */ /* $OpenBSD: session.c,v 1.481 2024/08/20 11:59:39 claudio Exp $ */
/* /*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@ -305,7 +305,7 @@ session_main(int debug, int verbose)
free(m); free(m);
continue; continue;
} }
if (m->wbuf.queued) if (msgbuf_queuelen(&m->wbuf) > 0)
mrt_cnt++; mrt_cnt++;
} }
@ -415,7 +415,8 @@ session_main(int debug, int verbose)
/* are we waiting for a write? */ /* are we waiting for a write? */
events = POLLIN; events = POLLIN;
if (p->wbuf.queued > 0 || p->state == STATE_CONNECT) if (msgbuf_queuelen(&p->wbuf) > 0 ||
p->state == STATE_CONNECT)
events |= POLLOUT; events |= POLLOUT;
/* is there still work to do? */ /* is there still work to do? */
if (p->rpending && p->rbuf && p->rbuf->wpos) if (p->rpending && p->rbuf && p->rbuf->wpos)
@ -433,7 +434,7 @@ session_main(int debug, int verbose)
idx_peers = i; idx_peers = i;
LIST_FOREACH(m, &mrthead, entry) LIST_FOREACH(m, &mrthead, entry)
if (m->wbuf.queued) { if (msgbuf_queuelen(&m->wbuf) > 0) {
pfd[i].fd = m->wbuf.fd; pfd[i].fd = m->wbuf.fd;
pfd[i].events = POLLOUT; pfd[i].events = POLLOUT;
mrt_l[i - idx_peers] = m; mrt_l[i - idx_peers] = m;
@ -884,7 +885,8 @@ change_state(struct peer *peer, enum session_state state,
* try to write out what's buffered (maybe a notification), * try to write out what's buffered (maybe a notification),
* don't bother if it fails * don't bother if it fails
*/ */
if (peer->state >= STATE_OPENSENT && peer->wbuf.queued) if (peer->state >= STATE_OPENSENT &&
msgbuf_queuelen(&peer->wbuf) > 0)
msgbuf_write(&peer->wbuf); msgbuf_write(&peer->wbuf);
/* /*
@ -1429,7 +1431,7 @@ session_sendmsg(struct bgp_msg *msg, struct peer *p)
} }
ibuf_close(&p->wbuf, msg->buf); ibuf_close(&p->wbuf, msg->buf);
if (!p->throttled && p->wbuf.queued > SESS_MSG_HIGH_MARK) { if (!p->throttled && msgbuf_queuelen(&p->wbuf) > SESS_MSG_HIGH_MARK) {
if (imsg_rde(IMSG_XOFF, p->conf.id, NULL, 0) == -1) if (imsg_rde(IMSG_XOFF, p->conf.id, NULL, 0) == -1)
log_peer_warn(&p->conf, "imsg_compose XOFF"); log_peer_warn(&p->conf, "imsg_compose XOFF");
else else
@ -1936,7 +1938,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p)
return (1); return (1);
} }
if (pfd->revents & POLLOUT && p->wbuf.queued) { if (pfd->revents & POLLOUT && msgbuf_queuelen(&p->wbuf) > 0) {
if ((error = msgbuf_write(&p->wbuf)) <= 0 && errno != EAGAIN) { if ((error = msgbuf_write(&p->wbuf)) <= 0 && errno != EAGAIN) {
if (error == 0) if (error == 0)
log_peer_warnx(&p->conf, "Connection closed"); log_peer_warnx(&p->conf, "Connection closed");
@ -1947,7 +1949,8 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p)
} }
p->stats.last_write = getmonotime(); p->stats.last_write = getmonotime();
start_timer_sendholdtime(p); start_timer_sendholdtime(p);
if (p->throttled && p->wbuf.queued < SESS_MSG_LOW_MARK) { if (p->throttled &&
msgbuf_queuelen(&p->wbuf) < SESS_MSG_LOW_MARK) {
if (imsg_rde(IMSG_XON, p->conf.id, NULL, 0) == -1) if (imsg_rde(IMSG_XON, p->conf.id, NULL, 0) == -1)
log_peer_warn(&p->conf, "imsg_compose XON"); log_peer_warn(&p->conf, "imsg_compose XON");
else else

View file

@ -1,4 +1,4 @@
/* $OpenBSD: session.h,v 1.171 2024/08/12 09:04:23 claudio Exp $ */ /* $OpenBSD: session.h,v 1.172 2024/08/20 11:59:39 claudio Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -151,6 +151,7 @@ struct peer_stats {
time_t last_updown; time_t last_updown;
time_t last_read; time_t last_read;
time_t last_write; time_t last_write;
uint32_t msg_queue_len;
uint32_t prefix_cnt; uint32_t prefix_cnt;
uint32_t prefix_out_cnt; uint32_t prefix_out_cnt;
uint32_t pending_update; uint32_t pending_update;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: filemode.c,v 1.48 2024/07/25 08:44:39 tb Exp $ */ /* $OpenBSD: filemode.c,v 1.49 2024/08/20 13:31:49 claudio Exp $ */
/* /*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -731,7 +731,7 @@ proc_filemode(int fd)
for (;;) { for (;;) {
pfd.events = POLLIN; pfd.events = POLLIN;
if (msgq.queued) if (msgbuf_queuelen(&msgq) > 0)
pfd.events |= POLLOUT; pfd.events |= POLLOUT;
if (poll(&pfd, 1, INFTIM) == -1) { if (poll(&pfd, 1, INFTIM) == -1) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: http.c,v 1.85 2024/04/23 10:27:46 tb Exp $ */ /* $OpenBSD: http.c,v 1.86 2024/08/20 13:31:49 claudio Exp $ */
/* /*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com> * Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@ -2077,7 +2077,7 @@ proc_http(char *bind_addr, int fd)
memset(&pfds, 0, sizeof(pfds)); memset(&pfds, 0, sizeof(pfds));
pfds[0].fd = fd; pfds[0].fd = fd;
pfds[0].events = POLLIN; pfds[0].events = POLLIN;
if (msgq.queued) if (msgbuf_queuelen(&msgq) > 0)
pfds[0].events |= POLLOUT; pfds[0].events |= POLLOUT;
i = 1; i = 1;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.263 2024/08/15 09:22:12 claudio Exp $ */ /* $OpenBSD: main.c,v 1.264 2024/08/20 13:31:49 claudio Exp $ */
/* /*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -1289,7 +1289,7 @@ main(int argc, char *argv[])
for (i = 0; i < NPFD; i++) { for (i = 0; i < NPFD; i++) {
pfd[i].events = POLLIN; pfd[i].events = POLLIN;
if (queues[i]->queued) if (msgbuf_queuelen(queues[i]) > 0)
pfd[i].events |= POLLOUT; pfd[i].events |= POLLOUT;
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: parser.c,v 1.141 2024/06/12 10:03:09 tb Exp $ */ /* $OpenBSD: parser.c,v 1.142 2024/08/20 13:31:49 claudio Exp $ */
/* /*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -1056,7 +1056,7 @@ proc_parser(int fd)
for (;;) { for (;;) {
pfd.events = POLLIN; pfd.events = POLLIN;
if (msgq.queued) if (msgbuf_queuelen(&msgq) > 0)
pfd.events |= POLLOUT; pfd.events |= POLLOUT;
if (poll(&pfd, 1, INFTIM) == -1) { if (poll(&pfd, 1, INFTIM) == -1) {

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: rpki-client.8,v 1.107 2024/06/20 20:15:02 job Exp $ .\" $OpenBSD: rpki-client.8,v 1.108 2024/08/20 12:53:47 job Exp $
.\" .\"
.\" Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> .\" Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
.\" .\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: June 20 2024 $ .Dd $Mdocdate: August 20 2024 $
.Dt RPKI-CLIENT 8 .Dt RPKI-CLIENT 8
.Os .Os
.Sh NAME .Sh NAME
@ -403,11 +403,6 @@ agreement regarding ARIN service restrictions.
.Re .Re
.Pp .Pp
.Rs .Rs
.%T Finding and Using Geofeed Data
.%R RFC 9092
.Re
.Pp
.Rs
.%T Manifests for the RPKI .%T Manifests for the RPKI
.%R RFC 9286 .%R RFC 9286
.Re .Re
@ -428,6 +423,11 @@ agreement regarding ARIN service restrictions.
.Re .Re
.Pp .Pp
.Rs .Rs
.%T Finding and Using Geofeed Data
.%R RFC 9632
.Re
.Pp
.Rs
.%T RPKI Signed Object for Trust Anchor Key .%T RPKI Signed Object for Trust Anchor Key
.%U https://datatracker.ietf.org/doc/html/draft-ietf-sidrops-signed-tal .%U https://datatracker.ietf.org/doc/html/draft-ietf-sidrops-signed-tal
.%D Oct, 2022 .%D Oct, 2022

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rrdp.c,v 1.33 2024/02/16 11:46:57 tb Exp $ */ /* $OpenBSD: rrdp.c,v 1.34 2024/08/20 13:31:49 claudio Exp $ */
/* /*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com> * Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
@ -585,7 +585,7 @@ proc_rrdp(int fd)
*/ */
pfds[0].fd = fd; pfds[0].fd = fd;
pfds[0].events = POLLIN; pfds[0].events = POLLIN;
if (msgq.queued) if (msgbuf_queuelen(&msgq) > 0)
pfds[0].events |= POLLOUT; pfds[0].events |= POLLOUT;
if (poll(pfds, i, INFTIM) == -1) { if (poll(pfds, i, INFTIM) == -1) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rsync.c,v 1.50 2024/03/22 03:38:12 job Exp $ */ /* $OpenBSD: rsync.c,v 1.51 2024/08/20 13:31:49 claudio Exp $ */
/* /*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* *
@ -294,7 +294,7 @@ proc_rsync(char *prog, char *bind_addr, int fd)
pfd.events = 0; pfd.events = 0;
pfd.events |= POLLIN; pfd.events |= POLLIN;
if (msgq.queued) if (msgbuf_queuelen(&msgq) > 0)
pfd.events |= POLLOUT; pfd.events |= POLLOUT;
if (npending > 0 && nprocs < MAX_RSYNC_REQUESTS) { if (npending > 0 && nprocs < MAX_RSYNC_REQUESTS) {