From 708141b7a2df74a22d460de58e3dd8b985dd3685 Mon Sep 17 00:00:00 2001 From: purplerain Date: Tue, 29 Aug 2023 22:23:51 +0000 Subject: [PATCH] sync code with last improvements from OpenBSD --- lib/libcrypto/man/ECDH_compute_key.3 | 6 +- lib/libcrypto/man/ECDSA_SIG_new.3 | 6 +- lib/libcrypto/man/EC_KEY_METHOD_new.3 | 6 +- lib/libcrypto/man/EC_KEY_new.3 | 10 +- regress/lib/libz/utils_unittest.cc | 3 +- share/man/man4/dwiic.4 | 5 +- sys/dev/fdt/dwiic_fdt.c | 168 ++++++++++++++++++++++++++ sys/dev/fdt/files.fdt | 5 +- sys/dev/ic/dwiic.c | 4 +- sys/dev/ic/dwiicvar.h | 7 +- sys/kern/init_main.c | 10 +- sys/kern/kern_exit.c | 12 +- sys/kern/kern_resource.c | 18 +-- sys/kern/kern_sched.c | 7 +- sys/kern/kern_time.c | 4 +- sys/kern/sched_bsd.c | 6 +- sys/sys/proc.h | 3 +- sys/sys/resourcevar.h | 4 +- usr.bin/ssh/servconf.c | 4 +- usr.sbin/acme-client/acctproc.c | 3 +- usr.sbin/acme-client/key.c | 13 +- 21 files changed, 232 insertions(+), 72 deletions(-) create mode 100644 sys/dev/fdt/dwiic_fdt.c diff --git a/lib/libcrypto/man/ECDH_compute_key.3 b/lib/libcrypto/man/ECDH_compute_key.3 index ba67098cd..c49988e14 100644 --- a/lib/libcrypto/man/ECDH_compute_key.3 +++ b/lib/libcrypto/man/ECDH_compute_key.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ECDH_compute_key.3,v 1.2 2021/03/12 05:18:00 jsg Exp $ +.\" $OpenBSD: ECDH_compute_key.3,v 1.3 2023/08/29 10:07:42 tb Exp $ .\" Copyright (c) 2019 Ingo Schwarze .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -13,7 +13,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 12 2021 $ +.Dd $Mdocdate: August 29 2023 $ .Dt ECDH_COMPUTE_KEY 3 .Os .Sh NAME @@ -21,7 +21,7 @@ .Nm ECDH_size .Nd Elliptic Curve Diffie-Hellman key exchange .Sh SYNOPSIS -.In openssl/ecdh.h +.In openssl/ec.h .Ft int .Fo ECDH_compute_key .Fa "void *out" diff --git a/lib/libcrypto/man/ECDSA_SIG_new.3 b/lib/libcrypto/man/ECDSA_SIG_new.3 index f86520591..c9ef8e814 100644 --- a/lib/libcrypto/man/ECDSA_SIG_new.3 +++ b/lib/libcrypto/man/ECDSA_SIG_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ECDSA_SIG_new.3,v 1.19 2023/07/21 04:44:40 tb Exp $ +.\" $OpenBSD: ECDSA_SIG_new.3,v 1.20 2023/08/29 10:07:42 tb Exp $ .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 .\" selective merge up to: OpenSSL da4ea0cf Aug 5 16:13:24 2019 +0100 .\" @@ -50,7 +50,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: August 29 2023 $ .Dt ECDSA_SIG_NEW 3 .Os .Sh NAME @@ -69,7 +69,7 @@ .Nm ECDSA_do_verify .Nd Elliptic Curve Digital Signature Algorithm .Sh SYNOPSIS -.In openssl/ecdsa.h +.In openssl/ec.h .Ft ECDSA_SIG* .Fo ECDSA_SIG_new .Fa void diff --git a/lib/libcrypto/man/EC_KEY_METHOD_new.3 b/lib/libcrypto/man/EC_KEY_METHOD_new.3 index c8efa8c73..489bd3ac6 100644 --- a/lib/libcrypto/man/EC_KEY_METHOD_new.3 +++ b/lib/libcrypto/man/EC_KEY_METHOD_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.2 2023/07/20 09:28:30 tb Exp $ +.\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.3 2023/08/29 10:07:42 tb Exp $ .\" Copyright (c) 2019 Ingo Schwarze .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -13,7 +13,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 20 2023 $ +.Dd $Mdocdate: August 29 2023 $ .Dt EC_KEY_METHOD_NEW 3 .Os .Sh NAME @@ -66,7 +66,6 @@ .Fa "int (**pset_private)(EC_KEY *key, const BIGNUM *priv_key)" .Fa "int (**pset_public)(EC_KEY *key, const EC_POINT *pub_key)" .Fc -.In openssl/ecdsa.h .Ft void .Fo EC_KEY_METHOD_set_sign .Fa "EC_KEY_METHOD *meth" @@ -105,7 +104,6 @@ .Fa "int (**pverify_sig)(const unsigned char *dgst, int dgst_len,\ const ECDSA_SIG *sig, EC_KEY *eckey)" .Fc -.In openssl/ec.h .Ft void .Fo EC_KEY_METHOD_set_keygen .Fa "EC_KEY_METHOD *meth" diff --git a/lib/libcrypto/man/EC_KEY_new.3 b/lib/libcrypto/man/EC_KEY_new.3 index 15918898d..06afdd537 100644 --- a/lib/libcrypto/man/EC_KEY_new.3 +++ b/lib/libcrypto/man/EC_KEY_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: EC_KEY_new.3,v 1.17 2023/04/27 09:49:44 tb Exp $ +.\" $OpenBSD: EC_KEY_new.3,v 1.18 2023/08/29 10:07:42 tb Exp $ .\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500 .\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 .\" @@ -49,7 +49,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: April 27 2023 $ +.Dd $Mdocdate: August 29 2023 $ .Dt EC_KEY_NEW 3 .Os .Sh NAME @@ -387,10 +387,8 @@ The currently defined standard flags are .Dv EC_FLAG_NON_FIPS_ALLOW and .Dv EC_FLAG_FIPS_CHECKED . -In addition there is the flag -.Dv EC_FLAG_COFACTOR_ECDH -which is specific to ECDH and is defined in -.In openssl/ecdh.h . +In addition there is the ECDH-specific flag +.Dv EC_FLAG_COFACTOR_ECDH . .Fn EC_KEY_get_flags returns the current flags that are set for this .Vt EC_KEY . diff --git a/regress/lib/libz/utils_unittest.cc b/regress/lib/libz/utils_unittest.cc index 57a9eaa21..91ba8d797 100644 --- a/regress/lib/libz/utils_unittest.cc +++ b/regress/lib/libz/utils_unittest.cc @@ -1,4 +1,4 @@ -// $OpenBSD: utils_unittest.cc,v 1.4 2022/11/10 14:51:01 kn Exp $ +// $OpenBSD: utils_unittest.cc,v 1.5 2023/08/29 07:54:01 yasuoka Exp $ // // Copyright 2020 The Chromium Authors. All rights reserved. // @@ -29,6 +29,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include +#include #include #include diff --git a/share/man/man4/dwiic.4 b/share/man/man4/dwiic.4 index 87ab0fae3..1f730de44 100644 --- a/share/man/man4/dwiic.4 +++ b/share/man/man4/dwiic.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dwiic.4,v 1.5 2023/04/23 00:44:44 dlg Exp $ +.\" $OpenBSD: dwiic.4,v 1.6 2023/08/29 12:11:08 kettenis Exp $ .\" .\" Copyright (c) 2016 Jonathan Gray .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 23 2023 $ +.Dd $Mdocdate: August 29 2023 $ .Dt DWIIC 4 .Os .Sh NAME @@ -22,6 +22,7 @@ .Nd Synopsys DesignWare I2C controller .Sh SYNOPSIS .Cd "dwiic* at acpi?" +.Cd "dwiic* at fdt?" .Cd "dwiic* at pci?" .Cd "iic* at dwiic?" .Sh DESCRIPTION diff --git a/sys/dev/fdt/dwiic_fdt.c b/sys/dev/fdt/dwiic_fdt.c new file mode 100644 index 000000000..5f4de8d44 --- /dev/null +++ b/sys/dev/fdt/dwiic_fdt.c @@ -0,0 +1,168 @@ +/* $OpenBSD: dwiic_fdt.c,v 1.1 2023/08/29 12:09:40 kettenis Exp $ */ +/* + * Copyright (c) 2023 Patrick Wildt + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +static inline uint32_t +round_closest(uint64_t num, uint64_t den) +{ + return (num + (den / 2)) / den; +} + +struct dwiic_fdt_softc { + struct dwiic_softc sc_sc; + int sc_node; +}; + +int dwiic_fdt_match(struct device *, void *, void *); +void dwiic_fdt_attach(struct device *, struct device *, void *); + +const struct cfattach dwiic_fdt_ca = { + sizeof(struct dwiic_fdt_softc), dwiic_fdt_match, dwiic_fdt_attach +}; + +void dwiic_fdt_bus_scan(struct device *, struct i2cbus_attach_args *, + void *); + +int +dwiic_fdt_match(struct device *parent, void *match, void *aux) +{ + struct fdt_attach_args *faa = aux; + + return OF_is_compatible(faa->fa_node, "snps,designware-i2c"); +} + +void +dwiic_fdt_attach(struct device *parent, struct device *self, void *aux) +{ + struct dwiic_fdt_softc *fsc = (struct dwiic_fdt_softc *)self; + struct dwiic_softc *sc = &fsc->sc_sc; + struct fdt_attach_args *faa = aux; + struct i2cbus_attach_args iba; + uint32_t sda_hold, sda_fall, scl_fall; + uint64_t freq; + + if (faa->fa_nreg < 1) + return; + + sc->sc_iot = faa->fa_iot; + fsc->sc_node = faa->fa_node; + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_ioh)) { + printf(": can't map registers\n"); + return; + } + + pinctrl_byname(faa->fa_node, "default"); + reset_deassert_all(faa->fa_node); + clock_enable(faa->fa_node, NULL); + + freq = clock_get_frequency(faa->fa_node, NULL); + sda_hold = OF_getpropint(faa->fa_node, "i2c-sda-hold-time-ns", 300); + sda_fall = OF_getpropint(faa->fa_node, "i2c-sda-falling-time-ns", 300); + scl_fall = OF_getpropint(faa->fa_node, "i2c-scl-falling-time-ns", 300); + + sc->sda_hold_time = round_closest(freq * sda_hold, 1000000000); + + /* Standard-mode: tHIGH = 4.0 us; tLOW = 4.7 us */ + sc->ss_hcnt = round_closest(freq * (4000 + sda_fall), 1000000000) - 3; + sc->ss_lcnt = round_closest(freq * (4700 + scl_fall), 1000000000) - 1; + /* Fast-mode: tHIGH = 0.6 us; tLOW = 1.3 us */ + sc->fs_hcnt = round_closest(freq * (600 + sda_fall), 1000000000) - 3; + sc->fs_lcnt = round_closest(freq * (1300 + scl_fall), 1000000000) - 1; + + if (dwiic_init(sc)) { + printf(": can't initialize\n"); + bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size); + return; + } + + /* leave the controller disabled */ + dwiic_write(sc, DW_IC_INTR_MASK, 0); + dwiic_enable(sc, 0); + dwiic_read(sc, DW_IC_CLR_INTR); + + sc->sc_ih = fdt_intr_establish(faa->fa_node, IPL_BIO, + dwiic_intr, sc, sc->sc_dev.dv_xname); + + printf("\n"); + + rw_init(&sc->sc_i2c_lock, "dwiic"); + + sc->sc_i2c_tag.ic_cookie = sc; + sc->sc_i2c_tag.ic_acquire_bus = dwiic_i2c_acquire_bus; + sc->sc_i2c_tag.ic_release_bus = dwiic_i2c_release_bus; + sc->sc_i2c_tag.ic_exec = dwiic_i2c_exec; + + bzero(&iba, sizeof iba); + iba.iba_name = "iic"; + iba.iba_tag = &sc->sc_i2c_tag; + iba.iba_bus_scan = dwiic_fdt_bus_scan; + iba.iba_bus_scan_arg = &fsc->sc_node; + config_found(&sc->sc_dev, &iba, iicbus_print); +} + +void +dwiic_fdt_bus_scan(struct device *self, struct i2cbus_attach_args *iba, + void *aux) +{ + int iba_node = *(int *)aux; + extern int iic_print(void *, const char *); + struct i2c_attach_args ia; + char name[32], status[32]; + uint32_t reg[1]; + int node; + + for (node = OF_child(iba_node); node; node = OF_peer(node)) { + memset(name, 0, sizeof(name)); + memset(status, 0, sizeof(status)); + memset(reg, 0, sizeof(reg)); + + if (OF_getprop(node, "compatible", name, sizeof(name)) == -1) + continue; + if (name[0] == '\0') + continue; + + if (OF_getprop(node, "status", status, sizeof(status)) > 0 && + strcmp(status, "disabled") == 0) + continue; + + if (OF_getprop(node, "reg", ®, sizeof(reg)) != sizeof(reg)) + continue; + + memset(&ia, 0, sizeof(ia)); + ia.ia_tag = iba->iba_tag; + ia.ia_addr = bemtoh32(®[0]); + ia.ia_name = name; + ia.ia_cookie = &node; + + config_found(self, &ia, iic_print); + } +} diff --git a/sys/dev/fdt/files.fdt b/sys/dev/fdt/files.fdt index 630680bb0..99e0ec034 100644 --- a/sys/dev/fdt/files.fdt +++ b/sys/dev/fdt/files.fdt @@ -1,4 +1,4 @@ -# $OpenBSD: files.fdt,v 1.197 2023/07/31 09:00:43 kettenis Exp $ +# $OpenBSD: files.fdt,v 1.198 2023/08/29 12:09:40 kettenis Exp $ # # Config file and device description for machine-independent FDT code. # Included by ports that need it. @@ -422,6 +422,9 @@ device rkvop attach rkvop at fdt file dev/fdt/rkvop.c rkvop +attach dwiic at fdt with dwiic_fdt +file dev/fdt/dwiic_fdt.c dwiic_fdt + device dwmmc: sdmmcbus attach dwmmc at fdt file dev/fdt/dwmmc.c dwmmc diff --git a/sys/dev/ic/dwiic.c b/sys/dev/ic/dwiic.c index 7a9dad87b..0f562bb5e 100644 --- a/sys/dev/ic/dwiic.c +++ b/sys/dev/ic/dwiic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiic.c,v 1.14 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: dwiic.c,v 1.15 2023/08/29 12:09:40 kettenis Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -21,11 +21,13 @@ #include #include +#ifdef __HAVE_ACPI #include #include #include #include #include +#endif #include diff --git a/sys/dev/ic/dwiicvar.h b/sys/dev/ic/dwiicvar.h index ea718914a..95dc18a8f 100644 --- a/sys/dev/ic/dwiicvar.h +++ b/sys/dev/ic/dwiicvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiicvar.h,v 1.5 2022/08/31 15:14:01 kettenis Exp $ */ +/* $OpenBSD: dwiicvar.h,v 1.6 2023/08/29 12:09:40 kettenis Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -21,11 +21,14 @@ #include #include +#ifdef __HAVE_ACPI +#include "acpi.h" #include #include #include #include #include +#endif #include @@ -33,8 +36,6 @@ #include -#include "acpi.h" - /* #define DWIIC_DEBUG */ #ifdef DWIIC_DEBUG diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 7a2aee10a..fd918a019 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.321 2023/06/15 22:18:06 cheloha Exp $ */ +/* $OpenBSD: init_main.c,v 1.322 2023/08/29 16:19:34 claudio Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -482,16 +482,12 @@ main(void *framep) /* * Now can look at time, having had a chance to verify the time - * from the file system. Reset p->p_rtime as it may have been - * munched in mi_switch() after the time got set. + * from the file system. */ LIST_FOREACH(pr, &allprocess, ps_list) { nanouptime(&pr->ps_start); - TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link) { - nanouptime(&p->p_cpu->ci_schedstate.spc_runtime); - timespecclear(&p->p_rtime); - } } + nanouptime(&curcpu()->ci_schedstate.spc_runtime); uvm_swap_init(); diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 85c5d58dc..2863d1806 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.211 2023/04/25 18:14:06 claudio Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.212 2023/08/29 16:19:34 claudio Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -118,6 +118,7 @@ exit1(struct proc *p, int xexit, int xsig, int flags) { struct process *pr, *qr, *nqr; struct rusage *rup; + struct timespec ts; int s; atomic_setbits_int(&p->p_flag, P_WEXIT); @@ -298,7 +299,14 @@ exit1(struct proc *p, int xexit, int xsig, int flags) /* add thread's accumulated rusage into the process's total */ ruadd(rup, &p->p_ru); - tuagg(pr, p); + nanouptime(&ts); + if (timespeccmp(&ts, &curcpu()->ci_schedstate.spc_runtime, <)) + timespecclear(&ts); + else + timespecsub(&ts, &curcpu()->ci_schedstate.spc_runtime, &ts); + SCHED_LOCK(s); + tuagg_locked(pr, p, &ts); + SCHED_UNLOCK(s); /* * clear %cpu usage during swap diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 92459833f..1f4a043da 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.77 2023/02/04 19:33:03 cheloha Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.78 2023/08/29 16:19:34 claudio Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -64,7 +64,7 @@ struct plimit *lim_copy(struct plimit *); struct plimit *lim_write_begin(void); void lim_write_commit(struct plimit *); -void tuagg_sub(struct tusage *, struct proc *); +void tuagg_sub(struct tusage *, struct proc *, const struct timespec *); /* * Patchable maximum data and stack limits. @@ -368,9 +368,10 @@ sys_getrlimit(struct proc *p, void *v, register_t *retval) } void -tuagg_sub(struct tusage *tup, struct proc *p) +tuagg_sub(struct tusage *tup, struct proc *p, const struct timespec *ts) { - timespecadd(&tup->tu_runtime, &p->p_rtime, &tup->tu_runtime); + if (ts != NULL) + timespecadd(&tup->tu_runtime, ts, &tup->tu_runtime); tup->tu_uticks += p->p_uticks; tup->tu_sticks += p->p_sticks; tup->tu_iticks += p->p_iticks; @@ -381,11 +382,10 @@ tuagg_sub(struct tusage *tup, struct proc *p) * totals for the thread and process */ void -tuagg_unlocked(struct process *pr, struct proc *p) +tuagg_locked(struct process *pr, struct proc *p, const struct timespec *ts) { - tuagg_sub(&pr->ps_tu, p); - tuagg_sub(&p->p_tu, p); - timespecclear(&p->p_rtime); + tuagg_sub(&pr->ps_tu, p, ts); + tuagg_sub(&p->p_tu, p, ts); p->p_uticks = 0; p->p_sticks = 0; p->p_iticks = 0; @@ -397,7 +397,7 @@ tuagg(struct process *pr, struct proc *p) int s; SCHED_LOCK(s); - tuagg_unlocked(pr, p); + tuagg_locked(pr, p, NULL); SCHED_UNLOCK(s); } diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 54902ded6..fac0dd2f8 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sched.c,v 1.86 2023/08/14 08:33:24 mpi Exp $ */ +/* $OpenBSD: kern_sched.c,v 1.87 2023/08/29 16:19:34 claudio Exp $ */ /* * Copyright (c) 2007, 2008 Artur Grabowski * @@ -230,14 +230,9 @@ void sched_exit(struct proc *p) { struct schedstate_percpu *spc = &curcpu()->ci_schedstate; - struct timespec ts; struct proc *idle; int s; - nanouptime(&ts); - timespecsub(&ts, &spc->spc_runtime, &ts); - timespecadd(&p->p_rtime, &ts, &p->p_rtime); - if (ISSET(spc->spc_schedflags, SPCF_ITIMER)) { atomic_clearbits_int(&spc->spc_schedflags, SPCF_ITIMER); clockintr_cancel(spc->spc_itimer); diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index ad18d941d..3650b3bc8 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_time.c,v 1.164 2023/08/05 20:07:55 cheloha Exp $ */ +/* $OpenBSD: kern_time.c,v 1.165 2023/08/29 16:19:34 claudio Exp $ */ /* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */ /* @@ -130,13 +130,11 @@ clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp) nanouptime(tp); timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp); timespecadd(tp, &p->p_p->ps_tu.tu_runtime, tp); - timespecadd(tp, &p->p_rtime, tp); break; case CLOCK_THREAD_CPUTIME_ID: nanouptime(tp); timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp); timespecadd(tp, &p->p_tu.tu_runtime, tp); - timespecadd(tp, &p->p_rtime, tp); break; default: /* check for clock from pthread_getcpuclockid() */ diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c index f9f2b7d76..465624e58 100644 --- a/sys/kern/sched_bsd.c +++ b/sys/kern/sched_bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sched_bsd.c,v 1.83 2023/08/19 11:14:11 claudio Exp $ */ +/* $OpenBSD: sched_bsd.c,v 1.84 2023/08/29 16:19:34 claudio Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /*- @@ -385,13 +385,13 @@ mi_switch(void) (long long)spc->spc_runtime.tv_sec, spc->spc_runtime.tv_nsec); #endif + timespecclear(&ts); } else { timespecsub(&ts, &spc->spc_runtime, &ts); - timespecadd(&p->p_rtime, &ts, &p->p_rtime); } /* add the time counts for this thread to the process's total */ - tuagg_unlocked(pr, p); + tuagg_locked(pr, p, &ts); /* Stop any optional clock interrupts. */ if (ISSET(spc->spc_schedflags, SPCF_ITIMER)) { diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 271a91211..41e5a3b8d 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.347 2023/08/05 20:07:56 cheloha Exp $ */ +/* $OpenBSD: proc.h,v 1.348 2023/08/29 16:19:34 claudio Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -354,7 +354,6 @@ struct proc { struct rusage p_ru; /* Statistics */ struct tusage p_tu; /* accumulated times. */ - struct timespec p_rtime; /* Real time. */ struct plimit *p_limit; /* [l] read ref. of p_p->ps_limit */ struct kcov_dev *p_kd; /* kcov device handle */ diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index d25840445..b3fc0476b 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resourcevar.h,v 1.27 2023/07/25 18:16:19 cheloha Exp $ */ +/* $OpenBSD: resourcevar.h,v 1.28 2023/08/29 16:19:34 claudio Exp $ */ /* $NetBSD: resourcevar.h,v 1.12 1995/11/22 23:01:53 cgd Exp $ */ /* @@ -67,7 +67,7 @@ extern uint32_t profclock_period; void addupc_intr(struct proc *, u_long, u_long); void addupc_task(struct proc *, u_long, u_int); void profclock(struct clockintr *, void *); -void tuagg_unlocked(struct process *, struct proc *); +void tuagg_locked(struct process *, struct proc *, const struct timespec *); void tuagg(struct process *, struct proc *); struct tusage; void calctsru(struct tusage *, struct timespec *, struct timespec *, diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c index d8a652ddf..84fc8a63a 100644 --- a/usr.bin/ssh/servconf.c +++ b/usr.bin/ssh/servconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.396 2023/07/17 05:26:38 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.397 2023/08/29 02:50:10 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -1973,7 +1973,7 @@ process_server_config_line_depth(ServerOptions *options, char *line, fatal("%s line %d: %s integer value %s.", filename, linenum, keyword, errstr); } - if (*activep) + if (*activep && options->per_source_max_startups == -1) options->per_source_max_startups = value; break; diff --git a/usr.sbin/acme-client/acctproc.c b/usr.sbin/acme-client/acctproc.c index e3a0eb64d..da3d49107 100644 --- a/usr.sbin/acme-client/acctproc.c +++ b/usr.sbin/acme-client/acctproc.c @@ -1,4 +1,4 @@ -/* $Id: acctproc.c,v 1.31 2022/12/19 11:16:52 tb Exp $ */ +/* $Id: acctproc.c,v 1.32 2023/08/29 14:44:53 op Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons * @@ -27,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/usr.sbin/acme-client/key.c b/usr.sbin/acme-client/key.c index a6fc437f8..af8cc7d5c 100644 --- a/usr.sbin/acme-client/key.c +++ b/usr.sbin/acme-client/key.c @@ -1,4 +1,4 @@ -/* $Id: key.c,v 1.7 2022/12/18 12:08:49 tb Exp $ */ +/* $Id: key.c,v 1.8 2023/08/29 14:44:53 op Exp $ */ /* * Copyright (c) 2019 Renaud Allard * Copyright (c) 2016 Kristaps Dzonsons @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -80,7 +79,7 @@ ec_key_create(FILE *f, const char *fname) EC_KEY *eckey = NULL; EVP_PKEY *pkey = NULL; - if ((eckey = EC_KEY_new_by_curve_name(NID_secp384r1)) == NULL ) { + if ((eckey = EC_KEY_new_by_curve_name(NID_secp384r1)) == NULL) { warnx("EC_KEY_new_by_curve_name"); goto err; } @@ -90,10 +89,6 @@ ec_key_create(FILE *f, const char *fname) goto err; } - /* set OPENSSL_EC_NAMED_CURVE to be able to load the key */ - - EC_KEY_set_asn1_flag(eckey, OPENSSL_EC_NAMED_CURVE); - /* Serialise the key to the disc in EC format */ if (!PEM_write_ECPrivateKey(f, eckey, NULL, NULL, 0, NULL, NULL)) { @@ -108,7 +103,7 @@ ec_key_create(FILE *f, const char *fname) goto err; } if (!EVP_PKEY_set1_EC_KEY(pkey, eckey)) { - warnx("EVP_PKEY_assign_EC_KEY"); + warnx("EVP_PKEY_set1_EC_KEY"); goto err; } @@ -122,8 +117,6 @@ out: return pkey; } - - EVP_PKEY * key_load(FILE *f, const char *fname) {