sync with OpenBSD -current

This commit is contained in:
purplerain 2024-07-26 01:19:29 +00:00
parent acf2ed1690
commit 06dd911763
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
20 changed files with 327 additions and 83 deletions

View file

@ -1,4 +1,4 @@
# $OpenBSD: bgpd.conf,v 1.22 2023/09/27 10:49:21 claudio Exp $
# $OpenBSD: bgpd.conf,v 1.24 2024/07/24 19:28:37 job Exp $
# example bgpd configuration file, see bgpd.conf(5)
# define our own ASN as a macro
@ -39,6 +39,8 @@ prefix-set bogons {
2001:db8::/32 or-longer # docu range [RFC3849]
2002::/16 or-longer # 6to4 anycast relay [RFC7526]
3ffe::/16 or-longer # old 6bone
3fff::/20 or-longer # docu range [draft-ietf-v6ops-rfc3849-update]
5f00::/16 or-longer # segment routing SRv6 SIDs [RFC9602]
fc00::/7 or-longer # unique local unicast
fe80::/10 or-longer # link local unicast
fec0::/10 or-longer # old site local unicast

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: compress.3,v 1.29 2024/06/29 16:10:08 tb Exp $
.\" $OpenBSD: compress.3,v 1.31 2024/07/25 17:29:51 tb Exp $
.\"
.\" Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
.\"
@ -21,7 +21,7 @@
.\" Converted to mdoc format for the OpenBSD project
.\" by Jason McIntyre <jmc@openbsd.org>
.\"
.Dd $Mdocdate: June 29 2024 $
.Dd $Mdocdate: July 25 2024 $
.Dt COMPRESS 3
.Os
.Sh NAME
@ -42,6 +42,7 @@
.Nm deflateTune ,
.Nm deflateBound ,
.Nm deflatePending ,
.Nm deflateUsed ,
.Nm deflatePrime ,
.Nm deflateSetHeader ,
.Nm inflateInit2 ,
@ -138,6 +139,8 @@ Advanced functions
.Ft int
.Fn deflatePending "z_streamp strm" "unsigned *pending" "int *bits"
.Ft int
.Fn deflateUsed "z_streamp strm" "int *bits"
.Ft int
.Fn deflatePrime "z_streamp strm" "int bits" "int value"
.Ft int
.Fn deflateSetHeader "z_streamp strm" "gz_headerp head"
@ -1508,7 +1511,27 @@ are
.Dv NULL ,
then those values are not set.
.Pp
.Fn deflatePending returns
.Fn deflatePending
returns
.Dv Z_OK
if success, or
.Dv Z_STREAM_ERROR
if the source stream state was inconsistent.
.It Xo
.Fa int
.Fn deflateUsed "z_streamp strm" "int *bits" ;
.Xc
.Pp
.Fn deflateUsed
returns in
.Pf * Fa bits
the most recent number of deflate bits used in the last byte
when flushing to a byte boundary.
The result is in the range 1..8, or 0 if there has not yet been a flush.
This helps determine the location of the last bit of a deflate stream.
.Pp
.Fn deflateUsed
returns
.Dv Z_OK
if success, or
.Dv Z_STREAM_ERROR

View file

@ -15,14 +15,14 @@ void test23(void)
uint8_t packetdata[] = {
RADIUS_CODE_ACCESS_REQUEST, 0x7f, 0, 48,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* auth */
10, 10, 'h', 'o', 'g', 'e', 'f', 'u', 'g', 'a',
RADIUS_TYPE_MESSAGE_AUTHENTICATOR, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10, 10, 'h', 'o', 'g', 'e', 'f', 'u', 'g', 'a',
};
uint8_t responsedata[] = {
RADIUS_CODE_ACCESS_ACCEPT, 0x7f, 0, 49,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* auth */
10, 11, 'f', 'o', 'o', 'b', 'a', 'r', 'b', 'a', 'z',
RADIUS_TYPE_MESSAGE_AUTHENTICATOR, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10, 11, 'f', 'o', 'o', 'b', 'a', 'r', 'b', 'a', 'z',
};
packet = radius_new_request_packet(RADIUS_CODE_ACCESS_REQUEST);
@ -31,7 +31,7 @@ void test23(void)
radius_put_message_authenticator(packet, "sharedsecret");
radius_get_authenticator(packet, packetdata + 4);
HMAC(EVP_md5(), "sharedsecret", 12, packetdata, sizeof(packetdata), packetdata + sizeof(packetdata) - 16, NULL);
HMAC(EVP_md5(), "sharedsecret", 12, packetdata, sizeof(packetdata), packetdata + 22, NULL);
CHECK(radius_get_length(packet) == sizeof(packetdata));
CHECK(memcmp(radius_get_data(packet), packetdata, sizeof(packetdata)) == 0);
@ -47,7 +47,7 @@ void test23(void)
HMAC_Update(ctx, responsedata, 4);
HMAC_Update(ctx, packetdata + 4, 16);
HMAC_Update(ctx, responsedata + 20, sizeof(responsedata) - 20);
HMAC_Final(ctx, responsedata + sizeof(responsedata) - 16, NULL);
HMAC_Final(ctx, responsedata + 22, NULL);
HMAC_CTX_free(ctx);
CHECK(radius_get_length(response) == sizeof(responsedata));
@ -63,8 +63,8 @@ void test23(void)
radius_set_id(packet, 0xff);
radius_set_message_authenticator(packet, "sharedsecret");
packetdata[1] = 0xff;
memset(packetdata + sizeof(packetdata) - 16, 0, 16);
HMAC(EVP_md5(), "sharedsecret", 12, packetdata, sizeof(packetdata), packetdata + sizeof(packetdata) - 16, NULL);
memset(packetdata + 22, 0, 16);
HMAC(EVP_md5(), "sharedsecret", 12, packetdata, sizeof(packetdata), packetdata + 22, NULL);
CHECK(memcmp(radius_get_data(packet), packetdata, sizeof(packetdata)) == 0);
}

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: python-module.5,v 1.12 2024/05/28 16:05:39 sthen Exp $
.\" $OpenBSD: python-module.5,v 1.13 2024/07/25 15:36:56 sthen Exp $
.\"
.\" Copyright (c) 2008 Marc Espie
.\"
@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: May 28 2024 $
.Dd $Mdocdate: July 25 2024 $
.Dt PYTHON-MODULE 5
.Os
.Sh NAME
@ -113,8 +113,8 @@ If the port provides a
.Pa pyproject.toml
file, check the "build-backend" line in the [build-system] section.
.Nm
currently supports flit_core, hatchling, hatch-vcs, jupyter_packaging,
maturin, poetry-core, setuptools and setuptools_scm.
currently supports flit, flit_core, hatchling, hatch-vcs, jupyter_packaging,
maturin, pdm, poetry-core, setuptools and setuptools_scm.
If no
.Pa pyproject.toml
is provided then it probably uses setuptools.
@ -127,7 +127,9 @@ and sets
In cases where a less common backend is used, or where the build backend is
distributed with the software itself,
.Ev MODPY_PYBUILD
can be set to other to use the PEP 517 mechanism without adding a dependency
can be set to
.Sq other
to use the PEP 517 mechanism without adding a dependency
for a backend.
.Pp
Older ports using setuptools still set

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmm_machdep.c,v 1.29 2024/07/14 07:57:42 dv Exp $ */
/* $OpenBSD: vmm_machdep.c,v 1.30 2024/07/24 21:04:12 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@ -1987,10 +1987,8 @@ vcpu_reset_regs_svm(struct vcpu *vcpu, struct vcpu_reg_state *vrs)
PATENTRY(6, PAT_UCMINUS) | PATENTRY(7, PAT_UC);
/* NPT */
if (vmm_softc->mode == VMM_MODE_RVI) {
vmcb->v_np_enable = 1;
vmcb->v_n_cr3 = vcpu->vc_parent->vm_map->pmap->pm_pdirpa;
}
/* Enable SVME in EFER (must always be set) */
vmcb->v_efer |= EFER_SVME;
@ -2363,11 +2361,8 @@ vcpu_reset_regs_vmx(struct vcpu *vcpu, struct vcpu_reg_state *vrs)
IA32_VMX_USE_TPR_SHADOW;
want0 = 0;
if (vmm_softc->mode == VMM_MODE_EPT) {
want1 |= IA32_VMX_ACTIVATE_SECONDARY_CONTROLS;
want0 |= IA32_VMX_CR3_LOAD_EXITING |
IA32_VMX_CR3_STORE_EXITING;
}
want0 |= IA32_VMX_CR3_LOAD_EXITING | IA32_VMX_CR3_STORE_EXITING;
if (vcpu->vc_vmx_basic & IA32_VMX_TRUE_CTLS_AVAIL) {
ctrl = IA32_VMX_TRUE_PROCBASED_CTLS;
@ -2403,7 +2398,7 @@ vcpu_reset_regs_vmx(struct vcpu *vcpu, struct vcpu_reg_state *vrs)
* IA32_VMX_UNRESTRICTED_GUEST - enable unrestricted guest (if caller
* specified CR0_PG | CR0_PE in %cr0 in the 'vrs' parameter)
*/
want1 = 0;
want1 = IA32_VMX_ENABLE_EPT;
/* XXX checking for 2ndary controls can be combined here */
if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED_CTLS,
@ -2415,9 +2410,6 @@ vcpu_reset_regs_vmx(struct vcpu *vcpu, struct vcpu_reg_state *vrs)
}
}
if (vmm_softc->mode == VMM_MODE_EPT)
want1 |= IA32_VMX_ENABLE_EPT;
if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED_CTLS,
IA32_VMX_ACTIVATE_SECONDARY_CONTROLS, 1)) {
if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED2_CTLS,
@ -5419,8 +5411,7 @@ vmx_handle_cr0_write(struct vcpu *vcpu, uint64_t r)
/* If the guest hasn't enabled paging ... */
if (!(r & CR0_PG) && (oldcr0 & CR0_PG)) {
/* Paging was disabled (prev. enabled) - Flush TLB */
if (vmm_softc->mode == VMM_MODE_EPT &&
vcpu->vc_vmx_vpid_enabled) {
if (vcpu->vc_vmx_vpid_enabled) {
vid.vid_vpid = vcpu->vc_vpid;
vid.vid_addr = 0;
invvpid(IA32_VMX_INVVPID_SINGLE_CTX_GLB, &vid);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.129 2024/07/21 18:57:31 kettenis Exp $ */
/* $OpenBSD: cpu.c,v 1.130 2024/07/24 21:24:18 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
@ -242,6 +242,9 @@ int cpu_node;
uint64_t cpu_id_aa64isar0;
uint64_t cpu_id_aa64isar1;
uint64_t cpu_id_aa64isar2;
uint64_t cpu_id_aa64mmfr0;
uint64_t cpu_id_aa64mmfr1;
uint64_t cpu_id_aa64mmfr2;
uint64_t cpu_id_aa64pfr0;
uint64_t cpu_id_aa64pfr1;
@ -487,6 +490,7 @@ cpu_identify(struct cpu_info *ci)
static uint64_t prev_id_aa64isar2;
static uint64_t prev_id_aa64mmfr0;
static uint64_t prev_id_aa64mmfr1;
static uint64_t prev_id_aa64mmfr2;
static uint64_t prev_id_aa64pfr0;
static uint64_t prev_id_aa64pfr1;
uint64_t midr, impl, part;
@ -642,6 +646,7 @@ cpu_identify(struct cpu_info *ci)
READ_SPECIALREG(id_aa64isar2_el1) == prev_id_aa64isar2 &&
READ_SPECIALREG(id_aa64mmfr0_el1) == prev_id_aa64mmfr0 &&
READ_SPECIALREG(id_aa64mmfr1_el1) == prev_id_aa64mmfr1 &&
READ_SPECIALREG(id_aa64mmfr2_el1) == prev_id_aa64mmfr2 &&
READ_SPECIALREG(id_aa64pfr0_el1) == prev_id_aa64pfr0 &&
READ_SPECIALREG(id_aa64pfr1_el1) == prev_id_aa64pfr1)
return;
@ -662,6 +667,18 @@ cpu_identify(struct cpu_info *ci)
printf("\n%s: mismatched ID_AA64ISAR2_EL1",
ci->ci_dev->dv_xname);
}
if (READ_SPECIALREG(id_aa64mmfr0_el1) != cpu_id_aa64mmfr0) {
printf("\n%s: mismatched ID_AA64MMFR0_EL1",
ci->ci_dev->dv_xname);
}
if (READ_SPECIALREG(id_aa64mmfr1_el1) != cpu_id_aa64mmfr1) {
printf("\n%s: mismatched ID_AA64MMFR1_EL1",
ci->ci_dev->dv_xname);
}
if (READ_SPECIALREG(id_aa64mmfr2_el1) != cpu_id_aa64mmfr2) {
printf("\n%s: mismatched ID_AA64MMFR2_EL1",
ci->ci_dev->dv_xname);
}
id = READ_SPECIALREG(id_aa64pfr0_el1);
/* Allow CSV2/CVS3 to be different. */
id &= ~ID_AA64PFR0_CSV2_MASK;
@ -938,6 +955,16 @@ cpu_identify(struct cpu_info *ci)
sep = ",";
}
/*
* ID_AA64MMFR2
*/
id = READ_SPECIALREG(id_aa64mmfr2_el1);
if (ID_AA64MMFR2_IDS(id) >= ID_AA64MMFR2_IDS_IMPL) {
printf("%sIDS", sep);
sep = ",";
}
/*
* ID_AA64PFR0
*/
@ -989,6 +1016,7 @@ cpu_identify(struct cpu_info *ci)
prev_id_aa64isar2 = READ_SPECIALREG(id_aa64isar2_el1);
prev_id_aa64mmfr0 = READ_SPECIALREG(id_aa64mmfr0_el1);
prev_id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1);
prev_id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1);
prev_id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1);
prev_id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1);
@ -1023,6 +1051,7 @@ cpu_identify(struct cpu_info *ci)
void
cpu_identify_cleanup(void)
{
uint64_t id_aa64mmfr2;
uint64_t value;
/* ID_AA64ISAR0_EL1 */
@ -1040,6 +1069,15 @@ cpu_identify_cleanup(void)
value &= ~ID_AA64ISAR2_CLRBHB_MASK;
cpu_id_aa64isar2 = value;
/* ID_AA64MMFR0_EL1 */
cpu_id_aa64mmfr0 = 0;
/* ID_AA64MMFR1_EL1 */
cpu_id_aa64mmfr1 = 0;
/* ID_AA64MMFR2_EL1 */
cpu_id_aa64mmfr2 = 0;
/* ID_AA64PFR0_EL1 */
value = 0;
value |= cpu_id_aa64pfr0 & ID_AA64PFR0_FP_MASK;
@ -1071,7 +1109,9 @@ cpu_identify_cleanup(void)
hwcap |= HWCAP_ATOMICS;
/* HWCAP_FPHP */
/* HWCAP_ASIMDHP */
/* HWCAP_CPUID */
id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1);
if (ID_AA64MMFR2_IDS(id_aa64mmfr2) >= ID_AA64MMFR2_IDS_IMPL)
hwcap |= HWCAP_CPUID;
if (ID_AA64ISAR0_RDM(cpu_id_aa64isar0) >= ID_AA64ISAR0_RDM_IMPL)
hwcap |= HWCAP_ASIMDRDM;
if (ID_AA64ISAR1_JSCVT(cpu_id_aa64isar1) >= ID_AA64ISAR1_JSCVT_IMPL)
@ -1271,6 +1311,9 @@ cpu_attach(struct device *parent, struct device *dev, void *aux)
cpu_id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
cpu_id_aa64isar1 = READ_SPECIALREG(id_aa64isar1_el1);
cpu_id_aa64isar2 = READ_SPECIALREG(id_aa64isar2_el1);
cpu_id_aa64mmfr0 = READ_SPECIALREG(id_aa64mmfr0_el1);
cpu_id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1);
cpu_id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1);
cpu_id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1);
cpu_id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: fpu.c,v 1.1 2022/01/01 18:52:36 kettenis Exp $ */
/* $OpenBSD: fpu.c,v 1.2 2024/07/26 00:23:57 jsg Exp $ */
/*
* Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org>
*
@ -22,6 +22,7 @@
#include <machine/armreg.h>
__attribute__((target("+fp")))
void
fpu_save(struct proc *p)
{
@ -74,6 +75,7 @@ fpu_save(struct proc *p)
fp->fp_cr = READ_SPECIALREG(fpcr);
}
__attribute__((target("+fp")))
void
fpu_load(struct proc *p)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.91 2024/07/17 15:21:59 kettenis Exp $ */
/* $OpenBSD: machdep.c,v 1.92 2024/07/24 21:24:18 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
@ -360,8 +360,11 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case CPU_ID_AA64PFR1:
return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64pfr1);
case CPU_ID_AA64MMFR0:
return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64mmfr0);
case CPU_ID_AA64MMFR1:
return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64mmfr1);
case CPU_ID_AA64MMFR2:
return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64mmfr2);
case CPU_ID_AA64SMFR0:
case CPU_ID_AA64ZFR0:
return sysctl_rdquad(oldp, oldlenp, newp, 0);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.48 2024/02/21 15:53:07 deraadt Exp $ */
/* $OpenBSD: trap.c,v 1.49 2024/07/24 21:24:18 kettenis Exp $ */
/*-
* Copyright (c) 2014 Andrew Turner
* All rights reserved.
@ -187,6 +187,99 @@ kdata_abort(struct trapframe *frame, uint64_t esr, uint64_t far, int exe)
}
}
static int
emulate_msr(struct trapframe *frame, uint64_t esr)
{
u_int rt = ISS_MSR_Rt(esr);
uint64_t val;
/* Only emulate reads. */
if ((esr & ISS_MSR_DIR) == 0)
return 0;
/* Only emulate non-debug System register access. */
if (ISS_MSR_OP0(esr) != 3 || ISS_MSR_OP1(esr) != 0 ||
ISS_MSR_CRn(esr) != 0)
return 0;
switch (ISS_MSR_CRm(esr)) {
case 0:
switch (ISS_MSR_OP2(esr)) {
case 0: /* MIDR_EL1 */
val = READ_SPECIALREG(midr_el1);
break;
case 5: /* MPIDR_EL1 */
/*
* Don't reveal the topology to userland. But
* return a valid value; Bit 31 is RES1.
*/
val = 0x80000000;
break;
case 6: /* REVIDR_EL1 */
val = 0;
break;
default:
return 0;
}
break;
case 4:
switch (ISS_MSR_OP2(esr)) {
case 0: /* ID_AA64PFR0_EL1 */
val = cpu_id_aa64pfr0;
break;
case 1: /* ID_AA64PFR1_EL1 */
val = cpu_id_aa64pfr1;
break;
case 2: /* ID_AA64PFR2_EL1 */
case 4: /* ID_AA64ZFR0_EL1 */
case 5: /* ID_AA64SMFR0_EL1 */
val = 0;
break;
default:
return 0;
}
break;
case 6:
switch (ISS_MSR_OP2(esr)) {
case 0: /* ID_AA64ISAR0_EL1 */
val = cpu_id_aa64isar0;
break;
case 1: /* ID_AA64ISAR1_EL1 */
val = cpu_id_aa64isar1;
break;
case 2: /* ID_AA64ISAR2_EL2 */
val = cpu_id_aa64isar2;
break;
default:
return 0;
}
break;
case 7:
switch (ISS_MSR_OP2(esr)) {
case 0: /* ID_AA64MMFR0_EL1 */
case 1: /* ID_AA64MMFR1_EL1 */
case 2: /* ID_AA64MMFR2_EL1 */
case 3: /* ID_AA64MMFR3_EL1 */
case 4: /* ID_AA64MMFR4_EL1 */
val = 0;
break;
default:
return 0;
}
break;
default:
return 0;
}
if (rt < 30)
frame->tf_x[rt] = val;
else if (rt == 30)
frame->tf_lr = val;
frame->tf_elr += 4;
return 1;
}
void
do_el1h_sync(struct trapframe *frame)
{
@ -288,6 +381,10 @@ do_el0_sync(struct trapframe *frame)
sv.sival_ptr = (void *)frame->tf_elr;
trapsignal(p, SIGILL, esr, ILL_BTCFI, sv);
break;
case EXCP_MSR:
if (emulate_msr(frame, esr))
break;
/* FALLTHROUGH */
case EXCP_FPAC:
curcpu()->ci_flush_bp();
sv.sival_ptr = (void *)frame->tf_elr;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: armreg.h,v 1.35 2024/06/23 10:17:16 kettenis Exp $ */
/* $OpenBSD: armreg.h,v 1.36 2024/07/24 21:24:18 kettenis Exp $ */
/*-
* Copyright (c) 2013, 2014 Andrew Turner
* Copyright (c) 2015 The FreeBSD Foundation
@ -171,6 +171,26 @@
#define ISS_DATA_DFSC_ECC_L3 (0x1f << 0)
#define ISS_DATA_DFSC_ALIGN (0x21 << 0)
#define ISS_DATA_DFSC_TLB_CONFLICT (0x30 << 0)
#define ISS_MSR_DIR_SHIFT 0
#define ISS_MSR_DIR (0x01 << ISS_MSR_DIR_SHIFT)
#define ISS_MSR_Rt_SHIFT 5
#define ISS_MSR_Rt_MASK (0x1f << ISS_MSR_Rt_SHIFT)
#define ISS_MSR_Rt(x) (((x) & ISS_MSR_Rt_MASK) >> ISS_MSR_Rt_SHIFT)
#define ISS_MSR_CRm_SHIFT 1
#define ISS_MSR_CRm_MASK (0xf << ISS_MSR_CRm_SHIFT)
#define ISS_MSR_CRm(x) (((x) & ISS_MSR_CRm_MASK) >> ISS_MSR_CRm_SHIFT)
#define ISS_MSR_CRn_SHIFT 10
#define ISS_MSR_CRn_MASK (0xf << ISS_MSR_CRn_SHIFT)
#define ISS_MSR_CRn(x) (((x) & ISS_MSR_CRn_MASK) >> ISS_MSR_CRn_SHIFT)
#define ISS_MSR_OP1_SHIFT 14
#define ISS_MSR_OP1_MASK (0x7 << ISS_MSR_OP1_SHIFT)
#define ISS_MSR_OP1(x) (((x) & ISS_MSR_OP1_MASK) >> ISS_MSR_OP1_SHIFT)
#define ISS_MSR_OP2_SHIFT 17
#define ISS_MSR_OP2_MASK (0x7 << ISS_MSR_OP2_SHIFT)
#define ISS_MSR_OP2(x) (((x) & ISS_MSR_OP2_MASK) >> ISS_MSR_OP2_SHIFT)
#define ISS_MSR_OP0_SHIFT 20
#define ISS_MSR_OP0_MASK (0x3 << ISS_MSR_OP0_SHIFT)
#define ISS_MSR_OP0(x) (((x) & ISS_MSR_OP0_MASK) >> ISS_MSR_OP0_SHIFT)
#define ESR_ELx_IL (0x01 << 25)
#define ESR_ELx_EC_SHIFT 26
#define ESR_ELx_EC_MASK (0x3f << 26)
@ -537,6 +557,10 @@
#define ID_AA64MMFR2_CCIDX_MASK (0xfULL << ID_AA64MMFR2_CCIDX_SHIFT)
#define ID_AA64MMFR2_CCIDX(x) ((x) & ID_AA64MMFR2_CCIDX_MASK)
#define ID_AA64MMFR2_CCIDX_IMPL (0x1ULL << ID_AA64MMFR2_CCIDX_SHIFT)
#define ID_AA64MMFR2_IDS_SHIFT 36
#define ID_AA64MMFR2_IDS_MASK (0xfULL << ID_AA64MMFR2_IDS_SHIFT)
#define ID_AA64MMFR2_IDS(x) ((x) & ID_AA64MMFR2_IDS_MASK)
#define ID_AA64MMFR2_IDS_IMPL (0x1ULL << ID_AA64MMFR2_IDS_SHIFT)
/* ID_AA64PFR0_EL1 */
#define ID_AA64PFR0_MASK 0xff0fffffffffffffULL

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.h,v 1.49 2024/07/17 15:21:59 kettenis Exp $ */
/* $OpenBSD: cpu.h,v 1.50 2024/07/24 21:24:18 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
*
@ -64,6 +64,9 @@
extern uint64_t cpu_id_aa64isar0;
extern uint64_t cpu_id_aa64isar1;
extern uint64_t cpu_id_aa64isar2;
extern uint64_t cpu_id_aa64mmfr0;
extern uint64_t cpu_id_aa64mmfr1;
extern uint64_t cpu_id_aa64mmfr2;
extern uint64_t cpu_id_aa64pfr0;
extern uint64_t cpu_id_aa64pfr1;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: qcpas.c,v 1.2 2023/07/01 15:50:18 drahn Exp $ */
/* $OpenBSD: qcpas.c,v 1.3 2024/07/25 20:21:40 kettenis Exp $ */
/*
* Copyright (c) 2023 Patrick Wildt <patrick@blueri.se>
*
@ -795,13 +795,6 @@ qcpas_glink_recv_open(struct qcpas_softc *sc, uint32_t rcid, uint32_t namelen)
return;
}
/* Assume we can leave HW dangling if proto init fails */
err = proto->init(NULL);
if (err) {
free(name, M_TEMP, namelen);
return;
}
ch = malloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO);
ch->ch_sc = sc;
ch->ch_proto = proto;
@ -811,6 +804,15 @@ qcpas_glink_recv_open(struct qcpas_softc *sc, uint32_t rcid, uint32_t namelen)
TAILQ_INIT(&ch->ch_r_intents);
TAILQ_INSERT_TAIL(&sc->sc_glink_channels, ch, ch_q);
/* Assume we can leave HW dangling if proto init fails */
err = proto->init(ch);
if (err) {
TAILQ_REMOVE(&sc->sc_glink_channels, ch, ch_q);
free(ch, M_TEMP, sizeof(*ch));
free(name, M_TEMP, namelen);
return;
}
msg.cmd = GLINK_CMD_OPEN_ACK;
msg.param1 = ch->ch_rcid;
msg.param2 = 0;
@ -1108,7 +1110,7 @@ struct battmgr_bat_status {
#define BATTMGR_BAT_STATE_CHARGING (1 << 1)
#define BATTMGR_BAT_STATE_CRITICAL_LOW (1 << 2)
uint32_t capacity;
uint32_t rate;
int32_t rate;
uint32_t battery_voltage;
uint32_t power_state;
#define BATTMGR_PWR_STATE_AC_ON (1 << 0)
@ -1151,7 +1153,7 @@ qcpas_pmic_rtr_battmgr_req_status(void *cookie)
#if NAPM > 0
struct apm_power_info qcpas_pmic_rtr_apm_power_info;
uint32_t qcpas_pmic_rtr_last_full_capacity;
void *qcpas_pmic_rtr_apm_cookie;
#endif
int
@ -1166,6 +1168,7 @@ qcpas_pmic_rtr_init(void *cookie)
info->battery_life = 0;
info->minutes_left = -1;
qcpas_pmic_rtr_apm_cookie = cookie;
apm_setinfohook(qcpas_pmic_rtr_apminfo);
#endif
return 0;
@ -1174,6 +1177,9 @@ qcpas_pmic_rtr_init(void *cookie)
int
qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
{
#if NAPM > 0
static uint32_t last_full_capacity;
#endif
struct pmic_glink_hdr hdr;
uint32_t notification;
extern int hw_power;
@ -1221,8 +1227,7 @@ qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
bat = malloc(sizeof(*bat), M_TEMP, M_WAITOK);
memcpy((void *)bat, buf + sizeof(hdr), sizeof(*bat));
#if NAPM > 0
qcpas_pmic_rtr_last_full_capacity =
bat->last_full_capacity;
last_full_capacity = bat->last_full_capacity;
#endif
free(bat, M_TEMP, sizeof(*bat));
break;
@ -1231,6 +1236,7 @@ qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
struct battmgr_bat_status *bat;
#if NAPM > 0
struct apm_power_info *info;
uint32_t delta;
#endif
if (len - sizeof(hdr) != sizeof(*bat)) {
printf("%s: invalid battgmr bat status\n",
@ -1239,15 +1245,17 @@ qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
}
#if NAPM > 0
/* Needs BAT_INFO fist */
if (!qcpas_pmic_rtr_last_full_capacity)
if (last_full_capacity == 0) {
wakeup(&qcpas_pmic_rtr_apm_power_info);
return 0;
}
#endif
bat = malloc(sizeof(*bat), M_TEMP, M_WAITOK);
memcpy((void *)bat, buf + sizeof(hdr), sizeof(*bat));
#if NAPM > 0
info = &qcpas_pmic_rtr_apm_power_info;
info->battery_life = ((bat->capacity * 100) /
qcpas_pmic_rtr_last_full_capacity);
last_full_capacity);
if (info->battery_life > 50)
info->battery_state = APM_BATT_HIGH;
else if (info->battery_life > 25)
@ -1259,6 +1267,16 @@ qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
else if (bat->battery_state & BATTMGR_BAT_STATE_CRITICAL_LOW)
info->battery_state = APM_BATT_CRITICAL;
if (bat->rate < 0)
delta = bat->capacity;
else
delta = last_full_capacity - bat->capacity;
if (bat->rate == 0)
info->minutes_left = -1;
else
info->minutes_left =
(60 * delta) / abs(bat->rate);
if (bat->power_state & BATTMGR_PWR_STATE_AC_ON) {
info->ac_state = APM_AC_ON;
hw_power = 1;
@ -1266,6 +1284,7 @@ qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
info->ac_state = APM_AC_OFF;
hw_power = 0;
}
wakeup(&qcpas_pmic_rtr_apm_power_info);
#endif
free(bat, M_TEMP, sizeof(*bat));
break;
@ -1289,8 +1308,15 @@ qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
int
qcpas_pmic_rtr_apminfo(struct apm_power_info *info)
{
memcpy(info, &qcpas_pmic_rtr_apm_power_info, sizeof(*info));
int error;
qcpas_pmic_rtr_battmgr_req_status(qcpas_pmic_rtr_apm_cookie);
error = tsleep_nsec(&qcpas_pmic_rtr_apm_power_info, PWAIT | PCATCH,
"qcapm", SEC_TO_NSEC(5));
if (error)
return error;
memcpy(info, &qcpas_pmic_rtr_apm_power_info, sizeof(*info));
return 0;
}
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: virtio.c,v 1.26 2024/07/23 19:14:05 sf Exp $ */
/* $OpenBSD: virtio.c,v 1.27 2024/07/25 08:35:40 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
@ -946,21 +946,43 @@ virtio_nused(struct virtqueue *vq)
void
virtio_vq_dump(struct virtqueue *vq)
{
#if VIRTIO_DEBUG >= 2
int i;
#endif
/* Common fields */
printf(" + addr: %p\n", vq);
printf(" + vq num: %d\n", vq->vq_num);
printf(" + vq mask: 0x%X\n", vq->vq_mask);
printf(" + vq index: %d\n", vq->vq_index);
printf(" + vq used idx: %d\n", vq->vq_used_idx);
printf(" + vq avail idx: %d\n", vq->vq_avail_idx);
printf(" + vq queued: %d\n",vq->vq_queued);
#if VIRTIO_DEBUG >= 2
for (i = 0; i < vq->vq_num; i++) {
struct vring_desc *desc = &vq->vq_desc[i];
printf(" D%-3d len:%d flags:%d next:%d\n", i, desc->len,
desc->flags, desc->next);
}
#endif
/* Avail ring fields */
printf(" + avail flags: 0x%X\n", vq->vq_avail->flags);
printf(" + avail idx: %d\n", vq->vq_avail->idx);
printf(" + avail event: %d\n", VQ_AVAIL_EVENT(vq));
#if VIRTIO_DEBUG >= 2
for (i = 0; i < vq->vq_num; i++)
printf(" A%-3d idx:%d\n", i, vq->vq_avail->ring[i]);
#endif
/* Used ring fields */
printf(" + used flags: 0x%X\n",vq->vq_used->flags);
printf(" + used idx: %d\n",vq->vq_used->idx);
printf(" + used event: %d\n", VQ_USED_EVENT(vq));
#if VIRTIO_DEBUG >= 2
for (i = 0; i < vq->vq_num; i++) {
printf(" U%-3d id:%d len:%d\n", i,
vq->vq_used->ring[i].id,
vq->vq_used->ring[i].len);
}
#endif
printf(" +++++++++++++++++++++++++++\n");
}
#endif

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: renice.8,v 1.25 2015/05/15 19:34:31 jmc Exp $
.\" $OpenBSD: renice.8,v 1.26 2024/07/25 13:40:55 jmc Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" from: @(#)renice.8 8.1 (Berkeley) 6/9/93
.\"
.Dd $Mdocdate: May 15 2015 $
.Dd $Mdocdate: July 25 2024 $
.Dt RENICE 8
.Os
.Sh NAME

View file

@ -1,4 +1,4 @@
/* $OpenBSD: channels.c,v 1.438 2024/05/17 00:30:23 djm Exp $ */
/* $OpenBSD: channels.c,v 1.439 2024/07/25 22:40:08 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -1004,14 +1004,16 @@ channel_format_status(const Channel *c)
{
char *ret = NULL;
xasprintf(&ret, "t%d [%s] %s%u i%u/%zu o%u/%zu e[%s]/%zu "
"fd %d/%d/%d sock %d cc %d io 0x%02x/0x%02x",
xasprintf(&ret, "t%d [%s] %s%u %s%u i%u/%zu o%u/%zu e[%s]/%zu "
"fd %d/%d/%d sock %d cc %d %s%u io 0x%02x/0x%02x",
c->type, c->xctype != NULL ? c->xctype : c->ctype,
c->have_remote_id ? "r" : "nr", c->remote_id,
c->mux_ctx != NULL ? "m" : "nm", c->mux_downstream_id,
c->istate, sshbuf_len(c->input),
c->ostate, sshbuf_len(c->output),
channel_format_extended_usage(c), sshbuf_len(c->extended),
c->rfd, c->wfd, c->efd, c->sock, c->ctl_chan,
c->have_ctl_child_id ? "c" : "nc", c->ctl_child_id,
c->io_want, c->io_ready);
return ret;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: channels.h,v 1.156 2024/05/23 23:47:16 jsg Exp $ */
/* $OpenBSD: channels.h,v 1.157 2024/07/25 22:40:08 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -139,6 +139,8 @@ struct Channel {
u_int io_ready; /* bitmask of SSH_CHAN_IO_* */
int pfds[4]; /* pollfd entries for rfd/wfd/efd/sock */
int ctl_chan; /* control channel (multiplexed connections) */
uint32_t ctl_child_id; /* child session for mux controllers */
int have_ctl_child_id;/* non-zero if ctl_child_id is valid */
int isatty; /* rfd is a tty */
int client_tty; /* (client) TTY has been requested */
int force_drain; /* force close on iEOF */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: mux.c,v 1.101 2023/11/23 03:37:05 dtucker Exp $ */
/* $OpenBSD: mux.c,v 1.102 2024/07/25 22:40:08 djm Exp $ */
/*
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
*
@ -188,8 +188,8 @@ mux_master_session_cleanup_cb(struct ssh *ssh, int cid, int force, void *unused)
fatal_f("channel %d missing control channel %d",
c->self, c->ctl_chan);
c->ctl_chan = -1;
cc->remote_id = 0;
cc->have_remote_id = 0;
cc->ctl_child_id = 0;
cc->have_ctl_child_id = 0;
chan_rcvd_oclose(ssh, cc);
}
channel_cancel_cleanup(ssh, c->self);
@ -204,12 +204,12 @@ mux_master_control_cleanup_cb(struct ssh *ssh, int cid, int force, void *unused)
debug3_f("entering for channel %d", cid);
if (c == NULL)
fatal_f("channel_by_id(%i) == NULL", cid);
if (c->have_remote_id) {
if ((sc = channel_by_id(ssh, c->remote_id)) == NULL)
if (c->have_ctl_child_id) {
if ((sc = channel_by_id(ssh, c->ctl_child_id)) == NULL)
fatal_f("channel %d missing session channel %u",
c->self, c->remote_id);
c->remote_id = 0;
c->have_remote_id = 0;
c->self, c->ctl_child_id);
c->ctl_child_id = 0;
c->have_ctl_child_id = 0;
sc->ctl_chan = -1;
if (sc->type != SSH_CHANNEL_OPEN &&
sc->type != SSH_CHANNEL_OPENING) {
@ -405,7 +405,7 @@ mux_master_process_new_session(struct ssh *ssh, u_int rid,
new_fd[0], new_fd[1], new_fd[2]);
/* XXX support multiple child sessions in future */
if (c->have_remote_id) {
if (c->have_ctl_child_id) {
debug2_f("session already open");
reply_error(reply, MUX_S_FAILURE, rid,
"Multiple sessions not supported");
@ -450,8 +450,8 @@ mux_master_process_new_session(struct ssh *ssh, u_int rid,
CHAN_EXTENDED_WRITE, "client-session", CHANNEL_NONBLOCK_STDIO);
nc->ctl_chan = c->self; /* link session -> control channel */
c->remote_id = nc->self; /* link control -> session channel */
c->have_remote_id = 1;
c->ctl_child_id = nc->self; /* link control -> session channel */
c->have_ctl_child_id = 1;
if (cctx->want_tty && escape_char != 0xffffffff) {
channel_register_filter(ssh, nc->self,
@ -990,7 +990,7 @@ mux_master_process_stdio_fwd(struct ssh *ssh, u_int rid,
debug3_f("got fds stdin %d, stdout %d", new_fd[0], new_fd[1]);
/* XXX support multiple child sessions in future */
if (c->have_remote_id) {
if (c->have_ctl_child_id) {
debug2_f("session already open");
reply_error(reply, MUX_S_FAILURE, rid,
"Multiple sessions not supported");
@ -1022,8 +1022,8 @@ mux_master_process_stdio_fwd(struct ssh *ssh, u_int rid,
free(chost);
nc->ctl_chan = c->self; /* link session -> control channel */
c->remote_id = nc->self; /* link control -> session channel */
c->have_remote_id = 1;
c->ctl_child_id = nc->self; /* link control -> session channel */
c->have_ctl_child_id = 1;
debug2_f("channel_new: %d control %d", nc->self, nc->ctl_chan);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: nchan.c,v 1.75 2024/02/01 02:37:33 djm Exp $ */
/* $OpenBSD: nchan.c,v 1.76 2024/07/25 22:40:08 djm Exp $ */
/*
* Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved.
*
@ -206,7 +206,7 @@ chan_send_close2(struct ssh *ssh, Channel *c)
{
int r;
debug2("channel %d: send close", c->self);
debug2("channel %d: send_close2", c->self);
if (c->ostate != CHAN_OUTPUT_CLOSED ||
c->istate != CHAN_INPUT_CLOSED) {
error("channel %d: cannot send close for istate/ostate %d/%d",
@ -216,6 +216,8 @@ chan_send_close2(struct ssh *ssh, Channel *c)
} else {
if (!c->have_remote_id)
fatal_f("channel %d: no remote_id", c->self);
debug2("channel %d: send close for remote id %u", c->self,
c->remote_id);
if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_CLOSE)) != 0 ||
(r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
(r = sshpkt_send(ssh)) != 0)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: servconf.c,v 1.411 2024/06/12 22:36:00 djm Exp $ */
/* $OpenBSD: servconf.c,v 1.412 2024/07/25 23:44:01 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@ -402,7 +402,7 @@ fill_default_server_options(ServerOptions *options)
if (options->per_source_penalty.penalty_crash == -1)
options->per_source_penalty.penalty_crash = 90;
if (options->per_source_penalty.penalty_grace == -1)
options->per_source_penalty.penalty_grace = 20;
options->per_source_penalty.penalty_grace = 10;
if (options->per_source_penalty.penalty_authfail == -1)
options->per_source_penalty.penalty_authfail = 5;
if (options->per_source_penalty.penalty_noauth == -1)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: filemode.c,v 1.47 2024/06/17 18:54:36 tb Exp $ */
/* $OpenBSD: filemode.c,v 1.48 2024/07/25 08:44:39 tb Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -313,7 +313,7 @@ print_signature_path(const char *crl, const char *aia, const struct auth *a)
{
if (crl != NULL)
printf("Signature path: %s\n", crl);
if (a->cert->mft != NULL)
if (a != NULL && a->cert != NULL && a->cert->mft != NULL)
printf(" %s\n", a->cert->mft);
if (aia != NULL)
printf(" %s\n", aia);
@ -352,7 +352,7 @@ proc_parser_file(char *file, unsigned char *buf, size_t len)
char *aia = NULL;
char *crl_uri = NULL;
time_t *expires = NULL, *notafter = NULL;
struct auth *a;
struct auth *a = NULL;
struct crl *c;
const char *errstr = NULL, *valid;
int status = 0;
@ -612,7 +612,7 @@ proc_parser_file(char *file, unsigned char *buf, size_t len)
else {
printf("\n");
if (status && aia != NULL) {
if (aia != NULL && status) {
print_signature_path(crl_uri, aia, a);
if (expires != NULL)
printf("Signature path expires: %s\n",