CVS: cvs.openbsd.org: src

2023-07-04 Thread Jonathan Gray
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2023/07/04 19:21:51

Modified files:
usr.sbin/pkg_add: pkg_create.1 

Log message:
fw_update is in section 8 not 1



CVS: cvs.openbsd.org: src

2023-07-04 Thread Vitaliy Makkoveev
CVSROOT:/cvs
Module name:src
Changes by: m...@cvs.openbsd.org2023/07/04 16:28:24

Modified files:
sys/kern   : uipc_socket.c uipc_socket2.c 
sys/sys: socketvar.h 

Log message:
Introduce SBL_WAIT and SBL_NOINTR sbwait() flags.

This refactoring is another step to make standalone socket buffers
locking. sblock() uses M_WAITOK and M_NOWAIT flags passed as the third
argument together with the SB_NOINTR flag on the `sb_flags' to control
sleep behaviour. To perform uninterruptible acquisition, SB_NOINTR flag
should be set before sblock() call. `sb_flags' modification requires to
hold solock() around sblock()/sbunlock() that makes standalone call
impossible.

Also `sb_flags' modifications outside sblock()/sbunlock() makes
uninterruptible acquisition code huge enough. This time only sorflush()
does this (and forgets to restore SB_NOINTR flag, so shutdown(SHUT_RDWR)
call permanently modifies socket locking behaviour) and this looks not
the big problem. But with the standalone socket buffer locking it will
be many such places, so this huge construction is unwanted.

Introduce new SBL_NOINTR flag passed as third sblock() argument. The
sblock() acquisition will be uninterruptible when existing SB_NOINTR
flag is set on `sb_flags' or SBL_NOINTR was passed.

The M_WAITOK and M_NOWAIT flags belongs to malloc(9). It has no M_NOINTR
flag and there is no reason to introduce it. So for consistency reasons
introduce new SBL_WAIT and use it together with SBL_NOINTR instead of
M_WAITOK and M_NOINTR respectively.

ok bluhm



CVS: cvs.openbsd.org: src

2023-07-04 Thread Anton Lindqvist
CVSROOT:/cvs
Module name:src
Changes by: an...@cvs.openbsd.org   2023/07/04 13:01:46

Modified files:
regress/gnu/usr.bin/perl: Makefile 

Log message:
favor hw.ncpuonline; ok bluhm@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Scott Soule Cheloha
CVSROOT:/cvs
Module name:src
Changes by: chel...@cvs.openbsd.org 2023/07/04 11:29:32

Modified files:
sys/arch/amd64/include: cpu.h 

Log message:
amd64: cpu_info: rearrange members, keep ci_mds_tmp 32-byte aligned

ci_mds_tmp needs to be 32-byte aligned, otherwise we trip a CTASSERT
in amd64/cpu.c and break kernel compilation.  However, ci_mds_tmp's
32-byte alignment is at risk: the size of schedstate_percpu is about
to change.

Move ci_curproc and ci_schedstate up just after ci_mds_buf.  This puts
ci_mds_tmp at page offset 64 with no structs ahead of it in cpu_info.
With this arrangement it should remain 32-byte aligned without much
effort.

With input from guenther@.

ok guenther@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 09:09:31

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Avoid outputting invalid signatures

The caller can provide an r which will be added to the ECDSA_SIG unchecked.
This can happen via ECDSA_{,do_}sign_ex() or ECDSA_sign_setup() or else via
a custom sign_sig() handler. Therefore add a check that it is in the bounds
required.

Since k was long thrown away, there's no way to check kinv, so it needs to
be trusted. Misdesigned APIs that will output garbage everywhere...

ok jsing



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 08:59:32

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Clean up ECDSA verification

Use variable names that correspond more closely to the standard. Use an
additional variable for s^-1 for readability. Annotate the code with
the corresponding steps from FIPS 186-5.

ok jsing



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 08:57:05

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
ECDSA signing: annotate code with steps corresponding to FIPS 185-6.

ok jsing



CVS: cvs.openbsd.org: src

2023-07-04 Thread Marc Espie
CVSROOT:/cvs
Module name:src
Changes by: es...@cvs.openbsd.org   2023/07/04 08:41:26

Modified files:
usr.sbin/pkg_add/OpenBSD: PackingElement.pm 

Log message:
use local assignment to $ENV{TZ} like we do for signal handlers



CVS: cvs.openbsd.org: src

2023-07-04 Thread Patrick Wildt
CVSROOT:/cvs
Module name:src
Changes by: patr...@cvs.openbsd.org 2023/07/04 08:32:21

Modified files:
sys/dev/fdt: qcsmptp.c 

Log message:
Instead of waiting for the inbound item to show up in the interrupt
handler, allocate it ourselves.  The firmware doesn't seem to mind
that it's us doing the allocation.  This fixes a splassert, because
the code that retrieves the item reaches through the shared memory
driver, which acquires the hardware mutex, which in turn mallocs.

ok kettenis@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Alexandr Nedvedicky
CVSROOT:/cvs
Module name:src
Changes by: sas...@cvs.openbsd.org  2023/07/04 08:23:38

Modified files:
sys/net: pf_ioctl.c 

Log message:
This diff limits the number of transactions/tickets
pf_open_trans() can issue for each clone of /dev/pf
to 512. The pf_open_trans() is currently being used
by DIOCGETRULES ioctl(2). The limit avoids processes
to consume all kernel memory by asking DIOCGETRULES
for more tickets. If DIOCGETRULES hits the limit, then
the application will see EBUSY error.

This diff was fine tuned with feedback from cluadio@,
deraadt@ and kn@.

OK kn@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Marc Espie
CVSROOT:/cvs
Module name:src
Changes by: es...@cvs.openbsd.org   2023/07/04 08:08:30

Modified files:
usr.sbin/pkg_add: pkg_create.1 

Log message:
stop saying the format is "simple" there are so many annotations.
"straightforward" is a better description at this point.



CVS: cvs.openbsd.org: src

2023-07-04 Thread Marc Espie
CVSROOT:/cvs
Module name:src
Changes by: es...@cvs.openbsd.org   2023/07/04 08:03:16

Modified files:
usr.sbin/pkg_add/OpenBSD: PkgCreate.pm 

Log message:
add some more fluff to documentation



CVS: cvs.openbsd.org: src

2023-07-04 Thread Marc Espie
CVSROOT:/cvs
Module name:src
Changes by: es...@cvs.openbsd.org   2023/07/04 08:00:18

Modified files:
usr.sbin/pkg_add: pkg_create.1 

Log message:
explain why NO_TS_IN_PLIST exists



CVS: cvs.openbsd.org: src

2023-07-04 Thread Marc Espie
CVSROOT:/cvs
Module name:src
Changes by: es...@cvs.openbsd.org   2023/07/04 07:58:01

Modified files:
usr.sbin/pkg_add/OpenBSD: PackingElement.pm PkgCreate.pm 

Log message:
fix some very minor syntactic nits



CVS: cvs.openbsd.org: src

2023-07-04 Thread Jan Klemkow
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2023/07/04 07:37:47

Modified files:
sys/net: if.c 

Log message:
Check for interface type ethernet before call ether_brport_isset()

Pointed out by bluhm.

ok bluhm@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Mark Kettenis
CVSROOT:/cvs
Module name:src
Changes by: kette...@cvs.openbsd.org2023/07/04 07:04:08

Modified files:
sys/arch/riscv64/conf: GENERIC RAMDISK 

Log message:
enable dwqe(4)



CVS: cvs.openbsd.org: src

2023-07-04 Thread Mark Kettenis
CVSROOT:/cvs
Module name:src
Changes by: kette...@cvs.openbsd.org2023/07/04 06:58:42

Modified files:
sys/dev/fdt: if_dwqe_fdt.c 

Log message:
Add StarFive JH7110 support.
Based on an initial diff from jsing@

ok jsing@, patrick@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Mark Kettenis
CVSROOT:/cvs
Module name:src
Changes by: kette...@cvs.openbsd.org2023/07/04 06:48:42

Modified files:
sys/dev/ic : dwqe.c 

Log message:
Handle rx error.

ok jsing@, patrick@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Jasper Lievisse Adriaanse
CVSROOT:/cvs
Module name:src
Changes by: jas...@cvs.openbsd.org  2023/07/04 06:27:44

Modified files:
sys/dev/dt : dt_prov_kprobe.c 

Log message:
consistenly name instruction defines



CVS: cvs.openbsd.org: src

2023-07-04 Thread Jasper Lievisse Adriaanse
CVSROOT:/cvs
Module name:src
Changes by: jas...@cvs.openbsd.org  2023/07/04 06:20:10

Modified files:
sys/dev/dt : dt_prov_kprobe.c 

Log message:
Unbreak kprobes. Since LLVM emits endbr64 instructions for IBT, dt could no
longer identify function boundaries and as such no kprobes were found anymore.
Adjust the parser accordingly.

ok mpi@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Alexandr Nedvedicky
CVSROOT:/cvs
Module name:src
Changes by: sas...@cvs.openbsd.org  2023/07/04 05:34:20

Modified files:
libexec/snmpd/snmpd_metrics: mib.c 
sys/net: pf_ioctl.c pfvar.h 
usr.bin/systat : pftop.c 

Log message:
The recent change to DIOCGETRULE allows applications which
periodically read rules from pf(4) to consume all kernel
memory. The bug has been discovered and root caused by florian@.
In this particular case it was snmpd(8) what ate all kernel
memory.

This commit introduces DIOCXEND to pf(4) so applications such
as snmpd(8) and systat(1) to close ticket/transaction when
they are done with fetching the rules. This change also
updates snmpd(8) and systat(1) to use newly introduced
DIOCXEND ioctl(2).

OK claudio@, deraadt@, kn@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Alexander Bluhm
CVSROOT:/cvs
Module name:src
Changes by: bl...@cvs.openbsd.org   2023/07/04 05:27:13

Log message:
Run Perl tests from our regress tree.  It needs a Perl obj directory
with Makefile.  To create the test environment, use the
Makefile.bsd-wrapper in /usr/src/gnu/usr.bin/perl and build Perl
there if it does not exist.  This allows to test Perl easily and
in a consistent manner.  Do not link tests to regress tree due to
this reach around and the combination of build and test.

Status:

Vendor Tag: bluhm
Release Tags:   bluhm_20230704

N src/regress/gnu/usr.bin/perl/Makefile

No conflicts created by this import



CVS: cvs.openbsd.org: src

2023-07-04 Thread Jonathan Gray
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2023/07/04 05:14:00

Modified files:
sys/sys: mount.h proc.h sysctl.h tty.h 

Log message:
remove prototypes for removed functions



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 04:53:42

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Extract private key and group order in s computation

This pushes a few variables no longer needed in ossl_ecdsa_sign_sig() into
ecdsa_compute_s() separating API logic and pure computation a bit more.

ok beck



CVS: cvs.openbsd.org: src

2023-07-04 Thread Alexander Bluhm
CVSROOT:/cvs
Module name:src
Changes by: bl...@cvs.openbsd.org   2023/07/04 04:48:19

Modified files:
sys/netinet: ip_output.c tcp_output.c 

Log message:
Remove redundant code when calculating checksum.
OK jmatthew@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Mark Kettenis
CVSROOT:/cvs
Module name:src
Changes by: kette...@cvs.openbsd.org2023/07/04 04:34:04

Modified files:
sys/arch/riscv64/dev: stfclock.c 

Log message:
Add a bunch of clocks for GMAC0 and GMAC1 on the JH7110 SoC.
Based on an initial diff from jsing@

ok jsing@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 04:31:57

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Use key for the EC_KEY everywhere



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 04:26:47

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Some more consistency in variable names



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 04:23:34

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Normalize ECDSA_SIG to be sig everywhere



CVS: cvs.openbsd.org: src

2023-07-04 Thread Jonathan Matthew
CVSROOT:/cvs
Module name:src
Changes by: jmatt...@cvs.openbsd.org2023/07/04 04:22:39

Modified files:
sys/dev/pci: if_bge.c if_bgereg.h 

Log message:
Make the hardware counters available on BCM5705 and newer available as
kstats.  Some of the hardware counters are already used in
bge_stats_update_regs() to update interface counters and work around
hardware bugs, and all counters reset on read, so to keep things simple
the work is split between that function and bge_kstat_read(), which
reads the rest of the counters.

tested by bluhm@ on BCM5720 (with counters) and BCM5704 (without), and
by me on BCM5720 A0 (with counters and hardware bugs)
ok bluhm@ dlg@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 04:14:37

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Normalize on digest and digest_len rather than dgst dlen dgstlen, etc.



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 04:06:37

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Rework ecdsa_prepare_digest()

Make it take an EC_KEY instead of a group order in preparation for further
cleanup. Rename m into e to match the standard better. Also buy some vowels
for jsing.

ok beck jsing



CVS: cvs.openbsd.org: src

2023-07-04 Thread Jonathan Gray
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2023/07/04 03:47:51

Modified files:
sys/sys: mbuf.h 
sys/conf   : param.c 

Log message:
Remove mbuf low watermark vars.  Unused since uipc_mbuf.c rev 1.244.
ok kn@ bluhm@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Mark Kettenis
CVSROOT:/cvs
Module name:src
Changes by: kette...@cvs.openbsd.org2023/07/04 03:00:24

Modified files:
sys/dev/ic : dwqe.c 

Log message:
Add some extra parenthesis for consistency.

stolen from jsing@



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 02:47:01

Modified files:
regress/lib/libssl/ssl: ssltest.c 

Log message:
Plug leak in the ssltest

Removing -tls1 moved some tests from the legacy stack to the TLSv1.3 stack.
On a HRR, the alpn callback would be called twice and allocate the global
twice, thereby leaking. So free it up front.

Joint suffering with bcook and beck



CVS: cvs.openbsd.org: src

2023-07-04 Thread Theo Buehler
CVSROOT:/cvs
Module name:src
Changes by: t...@cvs.openbsd.org2023/07/04 01:38:31

Modified files:
lib/libcrypto/ecdsa: ecs_ossl.c 

Log message:
Factor the computation of ECDSA s into a function

ossl_ecdsa_sign_sig() is already complicated enough. The math bit is
entirely self contained and does not need to obfuscate control flow
and logic.

with feedback from and ok jsing



CVS: cvs.openbsd.org: src

2023-07-04 Thread Marc Espie
CVSROOT:/cvs
Module name:src
Changes by: es...@cvs.openbsd.org   2023/07/04 01:04:11

Modified files:
share/man/man5 : bsd.port.mk.5 

Log message:
document the recent addition of "Building from scratch" and what it means.