sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-09-10 05:16:20 +00:00
parent 9bb7c570b7
commit 887dd091b7
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
35 changed files with 571 additions and 212 deletions

View File

@ -2505,6 +2505,7 @@
./usr/libexec/radiusd
./usr/libexec/radiusd/radiusd_bsdauth
./usr/libexec/radiusd/radiusd_radius
./usr/libexec/radiusd/radiusd_standard
./usr/libexec/reorder_kernel
./usr/libexec/rpc.rquotad
./usr/libexec/rpc.rstatd

View File

@ -1 +1 @@
# SecBSD 1.3-5b707e8: Wed Aug 23 00:00:00 UTC 2023 (Tezcatlipoca)
# SecBSD 1.3-c7a8681: Sun Sep 10 00:00:00 UTC 2023 (Tezcatlipoca)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: malloc.c,v 1.289 2023/06/30 06:24:58 otto Exp $ */
/* $OpenBSD: malloc.c,v 1.290 2023/09/09 06:52:40 asou Exp $ */
/*
* Copyright (c) 2008, 2010, 2011, 2016, 2023 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@ -2337,6 +2337,22 @@ RBT_HEAD(leaktree, leaknode);
RBT_PROTOTYPE(leaktree, leaknode, entry, leakcmp);
RBT_GENERATE(leaktree, leaknode, entry, leakcmp);
static void
wrtwarning(const char *func, char *msg, ...)
{
int saved_errno = errno;
va_list ap;
dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname,
getpid(), func != NULL ? func : "unknown");
va_start(ap, msg);
vdprintf(STDERR_FILENO, msg, ap);
va_end(ap);
dprintf(STDERR_FILENO, "\n");
errno = saved_errno;
}
static void
putleakinfo(struct leaktree *leaks, void *f, size_t sz, int cnt)
{
@ -2353,8 +2369,10 @@ putleakinfo(struct leaktree *leaks, void *f, size_t sz, int cnt)
if (page == NULL ||
used >= MALLOC_PAGESIZE / sizeof(struct leaknode)) {
page = MMAP(MALLOC_PAGESIZE, 0);
if (page == MAP_FAILED)
if (page == MAP_FAILED) {
wrtwarning(__func__, strerror(errno));
return;
}
used = 0;
}
p = &page[used++];

View File

@ -0,0 +1,118 @@
.\" $OpenBSD: EVP_PKEY_CTX_get_operation.3,v 1.1 2023/09/09 14:39:09 schwarze Exp $
.\"
.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" 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.
.\"
.Dd $Mdocdate: September 9 2023 $
.Dt EVP_PKEY_CTX_GET_OPERATION 3
.Os
.Sh NAME
.Nm EVP_PKEY_CTX_get_operation ,
.Nm EVP_PKEY_CTX_get0_pkey
.Nd inspect EVP_PKEY_CTX objects
.Sh SYNOPSIS
.In openssl/evp.h
.Ft int
.Fo EVP_PKEY_CTX_get_operation
.Fa "EVP_PKEY_CTX *ctx"
.Fc
.Ft EVP_PKEY *
.Fo EVP_PKEY_CTX_get0_pkey
.Fa "EVP_PKEY_CTX *ctx"
.Fc
.Sh DESCRIPTION
.Fn EVP_PKEY_CTX_get_operation
finds out which initialization function has been called on
.Fa ctx ,
if any:
.Bl -column EVP_PKEY_OP_VERIFYRECO EVP_PKEY_verify_recover_init
.It return value Ta initialized with Ta e.g. for
.It Dv EVP_PKEY_OP_DECRYPT Ta Xr EVP_PKEY_decrypt_init 3 Ta RSA, SM2
.It Dv EVP_PKEY_OP_DERIVE Ta Xr EVP_PKEY_derive_init 3 Ta HKDF
.It Dv EVP_PKEY_OP_ENCRYPT Ta Xr EVP_PKEY_encrypt_init 3 Ta RSA, SM2
.It Dv EVP_PKEY_OP_KEYGEN Ta Xr EVP_PKEY_keygen_init 3 Ta almost all
.It Dv EVP_PKEY_OP_PARAMGEN Ta Xr EVP_PKEY_paramgen_init 3 Ta DH, DSA, EC
.It Dv EVP_PKEY_OP_SIGN Ta Xr EVP_PKEY_sign_init 3 Ta DSA,EC,RSA,SM2
.It Dv EVP_PKEY_OP_SIGN Ta Xr EVP_DigestSignInit 3 Ta ED25519
.It Dv EVP_PKEY_OP_SIGNCTX Ta Xr EVP_DigestSignInit 3 Ta CMAC, HMAC
.It Dv EVP_PKEY_OP_UNDEFINED Ta not initialized Ta NONE
.It Dv EVP_PKEY_OP_VERIFY Ta Xr EVP_PKEY_verify_init 3 Ta DSA,EC,RSA,SM2
.It Dv EVP_PKEY_OP_VERIFY Ta Xr EVP_DigestVerifyInit 3 Ta ED25519
.It Dv EVP_PKEY_OP_VERIFYCTX Ta Xr EVP_DigestVerifyInit 3 Ta no built-in
.It Dv EVP_PKEY_OP_VERIFYRECOVER Ta Xr EVP_PKEY_verify_recover_init 3 Ta RSA
.El
.Pp
The rightmost column of the above table shows examples of algoritms
the return values can occur for.
For example, if
.Xr EVP_PKEY_base_id 3
returns
.Dv EVP_PKEY_HKDF ,
then calling
.Fn EVP_PKEY_CTX_get_operation
on a
.Vt EVP_PKEY_CTX
using that key may return
.Dv EVP_PKEY_OP_DERIVE .
.Pp
If the return value is
.Dv EVP_PKEY_OP_SIGNCTX
or
.Dv EVP_PKEY_OP_VERIFYCTX ,
the
.Fa ctx
supports
.Xr EVP_DigestSignUpdate 3
or
.Xr EVP_DigestVerifyUpdate 3 ,
respectively.
If the return value is
.Dv EVP_PKEY_OP_SIGN
or
.Dv EVP_PKEY_OP_VERIFY ,
if does not, and only one-shot signing or verification is supported.
.Pp
The return value
.Dv EVP_PKEY_OP_UNDEFINED
can for example occur if the
.Fa ctx
was freshly returned from
.Xr EVP_PKEY_CTX_new 3
or
.Xr EVP_PKEY_CTX_new_id 3
and not yet initialized.
.Sh RETURN VALUES
.Fn EVP_PKEY_CTX_get_operation
returns one of the
.Dv EVP_PKEY_OP_*
constants.
.Pp
.Fn EVP_PKEY_CTX_get0_pkey
returns an internal pointer to the
.Vt EVP_PKEY
object used by
.Fa ctx ,
without incrementing its reference count.
.Sh SEE ALSO
.Xr evp 3 ,
.Xr EVP_PKEY_base_id 3 ,
.Xr EVP_PKEY_CTX_ctrl 3 ,
.Xr EVP_PKEY_CTX_new 3 ,
.Xr EVP_PKEY_new 3
.Sh HISTORY
.Fn EVP_PKEY_CTX_get_operation
and
.Fn EVP_PKEY_CTX_get0_pkey
first appeared in OpenSSL 1.0.0 and have been available since
.Ox 4.9 .

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.12 2022/07/13 21:51:35 schwarze Exp $
.\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.13 2023/09/09 14:39:09 schwarze Exp $
.\" full merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100
.\"
.\" This file is a derived work.
@ -65,7 +65,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dd $Mdocdate: September 9 2023 $
.Dt EVP_PKEY_CTX_NEW 3
.Os
.Sh NAME
@ -159,6 +159,8 @@ if an error occurred.
.Xr EVP_PKEY_base_id 3 ,
.Xr EVP_PKEY_check 3 ,
.Xr EVP_PKEY_CTX_ctrl 3 ,
.Xr EVP_PKEY_CTX_get_operation 3 ,
.Xr EVP_PKEY_CTX_hkdf_mode 3 ,
.Xr EVP_PKEY_decrypt 3 ,
.Xr EVP_PKEY_derive 3 ,
.Xr EVP_PKEY_encrypt 3 ,

View File

@ -1,7 +1,24 @@
.\" $OpenBSD: EVP_PKEY_derive.3,v 1.8 2018/03/23 04:34:23 schwarze Exp $
.\" $OpenBSD: EVP_PKEY_derive.3,v 1.9 2023/09/09 14:26:35 schwarze Exp $
.\" full merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" 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.
.\"
.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2006, 2009, 2013, 2018 The OpenSSL Project.
.\" All rights reserved.
.\"
@ -49,12 +66,13 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 23 2018 $
.Dd $Mdocdate: September 9 2023 $
.Dt EVP_PKEY_DERIVE 3
.Os
.Sh NAME
.Nm EVP_PKEY_derive_init ,
.Nm EVP_PKEY_derive_set_peer ,
.Nm EVP_PKEY_CTX_get0_peerkey ,
.Nm EVP_PKEY_derive
.Nd derive public key algorithm shared secret
.Sh SYNOPSIS
@ -66,7 +84,11 @@
.Ft int
.Fo EVP_PKEY_derive_set_peer
.Fa "EVP_PKEY_CTX *ctx"
.Fa "EVP_PKEY *peer"
.Fa "EVP_PKEY *peerkey"
.Fc
.Ft EVP_PKEY *
.Fo EVP_PKEY_CTX_get0_peerkey
.Fa "EVP_PKEY_CTX *ctx"
.Fc
.Ft int
.Fo EVP_PKEY_derive
@ -75,19 +97,51 @@
.Fa "size_t *keylen"
.Fc
.Sh DESCRIPTION
The
.Fn EVP_PKEY_derive_init
function initializes a public key algorithm context using key
.Fa ctx->pkey
for shared secret derivation.
initializes the public key algorithm context
.Fa ctx
for shared secret derivation using the
.Vt EVP_PKEY
object already stored in
.Fa ctx .
The library provides built-in support for keys with an
.Xr EVP_PKEY_base_id 3
of
.Dv EVP_PKEY_DH ,
.Dv EVP_PKEY_EC ,
.Dv EVP_PKEY_GOSTR01 ,
.Dv EVP_PKEY_HKDF ,
and
.Dv EVP_PKEY_X25519 .
.Pp
After the call to
.Fn EVP_PKEY_derive_init ,
algorithm specific control operations can optionally be performed
to set any appropriate parameters for the operation.
.Pp
The
.Fn EVP_PKEY_derive_set_peer
function sets the peer key: this will normally be a public key.
configures the
.Fa ctx ,
which already needs to be initialized with
.Fn EVP_PKEY_derive_init ,
.Xr EVP_PKEY_encrypt_init 3 ,
or
.Xr EVP_PKEY_decrypt_init 3 ,
to use the
.Fa peerkey ,
which is normally a public key.
In case of success, the reference count of the
.Fa peerkey
is incremented by one.
Consequently, the caller needs to call
.Xr EVP_PKEY_free 3
on the
.Fa peerkey
when the caller no longer needs it, even if it is still in use by
.Fa ctx .
.Pp
The
.Fn EVP_PKEY_derive
function derives a shared secret using
derives a shared secret using
.Fa ctx .
If
.Fa key
@ -110,22 +164,45 @@ If the call is successful, the shared secret is written to
and the amount of data written to
.Fa keylen .
.Pp
After the call to
.Fn EVP_PKEY_derive_init ,
algorithm specific control operations can be performed to set any
appropriate parameters for the operation.
.Pp
The function
.Fn EVP_PKEY_derive
can be called more than once on the same context if several operations
are performed using the same parameters.
.Sh RETURN VALUES
.Fn EVP_PKEY_derive_init
.Fn EVP_PKEY_derive_init ,
.Fn EVP_PKEY_derive_set_peer ,
and
.Fn EVP_PKEY_derive
return 1 for success and 0 or a negative value for failure.
In particular, a return value of -2 indicates the operation is not
In particular, a return value of \-2 indicates the operation is not
supported by the public key algorithm.
.Pp
For
.Fn EVP_PKEY_derive_set_peer ,
a return value of \-1 can for example occur if
.Fa ctx
is not properly initialized, does not contain an
.Vt EVP_PKEY
that can be retrieved with
.Xr EVP_PKEY_CTX_get0_pkey 3 ,
the
.Xr EVP_PKEY_id 3
of both keys mismatch, or
.Xr EVP_PKEY_cmp_parameters 3
reports mismatching key parameters.
.Pp
.Fn EVP_PKEY_derive
fails with a return value of \-1 for example if
.Fa ctx
has not been successfully initialized with
.Fn EVP_PKEY_derive_init .
.Pp
.Fn EVP_PKEY_CTX_get0_peerkey
returns an internal pointer to the
.Fa peerkey
used by
.Fa ctx
without incrementing its reference count.
.Sh EXAMPLES
Derive shared secret (for example DH or EC keys):
.Bd -literal -offset indent
@ -173,6 +250,7 @@ if (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0)
.Sh HISTORY
.Fn EVP_PKEY_derive_init ,
.Fn EVP_PKEY_derive_set_peer ,
.Fn EVP_PKEY_CTX_get0_peerkey ,
and
.Fn EVP_PKEY_derive
first appeared in OpenSSL 1.0.0 and have been available since

View File

@ -1,8 +1,24 @@
.\" $OpenBSD: EVP_PKEY_keygen.3,v 1.11 2023/04/25 16:50:33 tb Exp $
.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
.\" selective merge up to: OpenSSL 48e5119a Jan 19 10:49:22 2018 +0100
.\" $OpenBSD: EVP_PKEY_keygen.3,v 1.12 2023/09/09 14:31:38 schwarze Exp $
.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" 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.
.\"
.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2006, 2009, 2013, 2015, 2016, 2018 The OpenSSL Project.
.\" All rights reserved.
.\"
@ -50,7 +66,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: April 25 2023 $
.Dd $Mdocdate: September 9 2023 $
.Dt EVP_PKEY_KEYGEN 3
.Os
.Sh NAME
@ -61,6 +77,7 @@
.Nm EVP_PKEY_gen_cb ,
.Nm EVP_PKEY_CTX_set_cb ,
.Nm EVP_PKEY_CTX_get_cb ,
.Nm EVP_PKEY_CTX_set0_keygen_info ,
.Nm EVP_PKEY_CTX_get_keygen_info ,
.Nm EVP_PKEY_CTX_set_app_data ,
.Nm EVP_PKEY_CTX_get_app_data
@ -98,6 +115,12 @@
.Fo EVP_PKEY_CTX_get_cb
.Fa "EVP_PKEY_CTX *ctx"
.Fc
.Ft void
.Fo EVP_PKEY_CTX_set0_keygen_info
.Fa "EVP_PKEY_CTX *ctx"
.Fa "int *dat"
.Fa "int datlen"
.Fc
.Ft int
.Fo EVP_PKEY_CTX_get_keygen_info
.Fa "EVP_PKEY_CTX *ctx"
@ -131,13 +154,22 @@ and
.Fn EVP_PKEY_paramgen
are similar except parameters are generated.
.Pp
The function
The functions
.Fn EVP_PKEY_CTX_set_cb
sets the key or parameter generation callback to
.Fa cb .
The function
and
.Fn EVP_PKEY_CTX_get_cb
returns the key or parameter generation callback.
set and retrieve the key or parameter generation callback, respectively.
.Pp
The function
.Fn EVP_PKEY_CTX_set0_keygen_info
sets the parameters associated with the generation operation to the array
.Fa dat
containing
.Ft datlen
integer parameters.
The caller retains ownership of the
.Fa dat
array; it will never be freed by the library.
.Pp
The function
.Fn EVP_PKEY_CTX_get_keygen_info
@ -209,6 +241,23 @@ and
return 1 for success and 0 or a negative value for failure.
In particular, a return value of -2 indicates the operation is not
supported by the public key algorithm.
.Pp
Callback functions of the type
.Fn EVP_PKEY_gen_cb
are supposed to return 1 on success or 0 on error.
.Pp
.Fn EVP_PKEY_CTX_get_cb
returns a function pointer to the currently installed callback function or
.Dv NULL
if no callback function is installed.
.Pp
.Fn EVP_PKEY_CTX_get_keygen_info
retuns the number of available parameters if
.Fa idx
is \-1, one of these parameters if
.Fa idx
is greater than or equal to zero but less than the number
of available parameters, or 0 otherwise.
.Sh EXAMPLES
Generate a 2048-bit RSA key:
.Bd -literal -offset indent

View File

@ -1,7 +1,24 @@
.\" $OpenBSD: EVP_PKEY_meth_new.3,v 1.5 2022/07/13 19:10:40 schwarze Exp $
.\" selective merge up to: OpenSSL 335a587b May 7 11:59:11 2019 +0200
.\" $OpenBSD: EVP_PKEY_meth_new.3,v 1.6 2023/09/09 14:35:23 schwarze Exp $
.\" selective merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200
.\"
.\" This file was written by Paul Yang <yang.yang@baishancloud.com>
.\" This file is a derived work.
.\" The changes are covered by the following Copyright and license:
.\"
.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" 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.
.\"
.\" The original file was written by Paul Yang <yang.yang@baishancloud.com>.
.\" Copyright (c) 2017 The OpenSSL Project. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -48,7 +65,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 13 2022 $
.Dd $Mdocdate: September 9 2023 $
.Dt EVP_PKEY_METH_NEW 3
.Os
.Sh NAME
@ -73,7 +90,9 @@
.Nm EVP_PKEY_meth_set_ctrl ,
.Nm EVP_PKEY_meth_set_check ,
.Nm EVP_PKEY_meth_set_public_check ,
.Nm EVP_PKEY_meth_set_param_check
.Nm EVP_PKEY_meth_set_param_check ,
.Nm EVP_PKEY_CTX_get_data ,
.Nm EVP_PKEY_CTX_set_data
.Nd manipulate an EVP_PKEY_METHOD structure
.Sh SYNOPSIS
.In openssl/evp.h
@ -202,6 +221,15 @@
.Fa "EVP_PKEY_METHOD *pmeth"
.Fa "int (*param_check)(EVP_PKEY *pkey)"
.Fc
.Ft void *
.Fo EVP_PKEY_CTX_get_data
.Fa "EVP_PKEY_CTX *ctx"
.Fc
.Ft void
.Fo EVP_PKEY_CTX_set_data
.Fa "EVP_PKEY_CTX *ctx"
.Fa "void *data"
.Fc
.Sh DESCRIPTION
The
.Vt EVP_PKEY_METHOD
@ -539,6 +567,24 @@ The
functions set the corresponding fields of
.Fa pmeth
to the arguments passed.
.Pp
.Fn EVP_PKEY_CTX_get_data
retrieves algorithm- and implementation-specific private key data from
.Fa ctx .
Public key algorithm implementations typically allocate and initialize
this data automatically in their
.Fn init
function.
.Pp
.Fn EVP_PKEY_CTX_set_data
transfers ownership of the given
.Fa data
to
.Fa ctx ,
replacing the existing algorithm- and implementation-specific
private key data.
It is the responsibility of the caller to free the existing data
before calling this function.
.Sh RETURN VALUES
.Fn EVP_PKEY_meth_new
returns a pointer to a new
@ -556,6 +602,10 @@ if no matching object is found.
.Pp
.Fn EVP_PKEY_meth_add0
returns 1 if the method is added successfully or 0 if an error occurred.
.Pp
.Fn EVP_PKEY_CTX_get_data
returns an internal pointer owned by
.Fa ctx .
.Sh SEE ALSO
.Xr EVP_DigestInit 3 ,
.Xr EVP_PKEY_meth_get0_info 3 ,
@ -578,8 +628,10 @@ returns 1 if the method is added successfully or 0 if an error occurred.
.Fn EVP_PKEY_meth_set_encrypt ,
.Fn EVP_PKEY_meth_set_decrypt ,
.Fn EVP_PKEY_meth_set_derive ,
.Fn EVP_PKEY_meth_set_ctrl ,
.Fn EVP_PKEY_CTX_get_data ,
and
.Fn EVP_PKEY_meth_set_ctrl
.Fn EVP_PKEY_CTX_set_data
first appeared in OpenSSL 1.0.0 and have been available since
.Ox 4.9 .
.Pp

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.267 2023/09/07 14:22:11 schwarze Exp $
# $OpenBSD: Makefile,v 1.268 2023/09/09 14:39:09 schwarze Exp $
.include <bsd.own.mk>
@ -181,6 +181,7 @@ MAN= \
EVP_OpenInit.3 \
EVP_PKCS82PKEY.3 \
EVP_PKEY_CTX_ctrl.3 \
EVP_PKEY_CTX_get_operation.3 \
EVP_PKEY_CTX_new.3 \
EVP_PKEY_CTX_set_hkdf_md.3 \
EVP_PKEY_add1_attr.3 \

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: evp.3,v 1.23 2023/09/07 14:22:11 schwarze Exp $
.\" $OpenBSD: evp.3,v 1.24 2023/09/09 14:39:09 schwarze Exp $
.\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100
.\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>,
@ -51,7 +51,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 7 2023 $
.Dd $Mdocdate: September 9 2023 $
.Dt EVP 3
.Os
.Sh NAME
@ -222,6 +222,7 @@ operations are more efficient using the high-level interfaces.
.Xr EVP_PKEY_check 3 ,
.Xr EVP_PKEY_cmp 3 ,
.Xr EVP_PKEY_CTX_ctrl 3 ,
.Xr EVP_PKEY_CTX_get_operation 3 ,
.Xr EVP_PKEY_CTX_new 3 ,
.Xr EVP_PKEY_CTX_set_hkdf_md 3 ,
.Xr EVP_PKEY_decrypt 3 ,

View File

@ -63,3 +63,5 @@ for p in permute:
else:
print("NO ECHO REPLY")
exit(2)
print("permutation done")
exit(0)

View File

@ -68,4 +68,5 @@ for a in ans:
if not reply:
print("NO ECHO REPLY FROM 64 FRAGMENTS")
exit(1)
print("echo reply from 64 fragments")
exit(0)

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.28 2020/12/30 21:40:33 kn Exp $
# $OpenBSD: Makefile,v 1.29 2023/09/08 21:15:02 bluhm Exp $
# The following ports must be installed:
#
@ -91,6 +91,10 @@ run-stack-frag6_queuelimit.py:
# the stack does not limit the amount of fragments during reassembly
@echo DISABLED
run-stack-frag6_doubleatomic.py: addr.py stamp-stack
# IPv6 stack accepts double atomic fragement, this is not a big issue
set +e; ${SUDO} ${PYTHON}frag6_doubleatomic.py; [[ $$? == 1 ]]
.for sp in stack pf
# Ping all addresses. This ensures that the ip addresses are configured

View File

@ -0,0 +1,49 @@
#!/usr/local/bin/python3
print("ping6 fragments with two consecutive atomic fragment header")
# |-IPv6-|-Frag-|-Frag-|-ICMP6-|-payload-|
import os
from addr import *
from scapy.all import *
pid=os.getpid()
eid=pid & 0xffff
payload=b"ABCDEFGHIJKLMNOP"
packet=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/ \
ICMPv6EchoRequest(id=eid, data=payload)
frag=[]
fid=pid & 0xffffffff
frag.append(IPv6ExtHdrFragment(id=fid)/ \
IPv6ExtHdrFragment(nh=58, id=fid)/bytes(packet)[40:64])
eth=[]
for f in frag:
pkt=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/f
eth.append(Ether(src=LOCAL_MAC, dst=REMOTE_MAC)/pkt)
if os.fork() == 0:
time.sleep(1)
sendp(eth, iface=LOCAL_IF)
os._exit(0)
ans=sniff(iface=LOCAL_IF, timeout=3, filter=
"ip6 and src "+REMOTE_ADDR6+" and dst "+LOCAL_ADDR6+" and icmp6")
for a in ans:
if a and a.type == ETH_P_IPV6 and \
ipv6nh[a.payload.nh] == 'ICMPv6' and \
icmp6types[a.payload.payload.type] == 'Echo Reply':
id=a.payload.payload.id
print("id=%#x" % (id))
if id != eid:
print("WRONG ECHO REPLY ID")
exit(2)
data=a.payload.payload.data
print("payload=%s" % (data))
if data == payload:
print("double atomic accepted")
exit(1)
print("PAYLOAD!=%s" % (payload))
exit(2)
print("no echo reply")
exit(0)

View File

@ -63,3 +63,5 @@ for p in permute:
else:
print("NO ECHO REPLY")
exit(2)
print("permutation done")
exit(0)

View File

@ -68,4 +68,5 @@ for a in ans:
if not reply:
print("NO ECHO REPLY FROM 64 FRAGMENTS")
exit(1)
print("echo reply from 64 fragments")
exit(0)

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: bsd.port.mk.5,v 1.621 2023/09/07 23:32:56 espie Exp $
.\" $OpenBSD: bsd.port.mk.5,v 1.626 2023/09/09 14:15:42 bentley Exp $
.\"
.\" Copyright (c) 2000-2008 Marc Espie
.\"
@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 7 2023 $
.Dd $Mdocdate: September 9 2023 $
.Dt BSD.PORT.MK 5
.Os
.Sh NAME
@ -2643,13 +2643,6 @@ Don't touch unless the default
target needs to be redefined.
Ideally, user-defined patch subtargets ought to test checkpatch.
In practice, they don't.
.It Ev PATCH_DEBUG
If set to
.Sq Yes ,
the
.Cm patch
stage will output extra debug information.
This is the default.
.It Ev PATCH_DIST_ARGS
Full list of options used while applying distribution patches.
.It Ev PATCH_DIST_STRIP
@ -3613,10 +3606,28 @@ and not intended to be a user setting.
See
.Ev WRKOBJDIR_MFS
for configuration.
.It Ev USE_NOBTCFI
If set to
.Sq Yes ,
writes a wrapper script to
.Pa ${WRKDIR}/bin/ld
in
.Cm patch
to request that the linker adds a
.Dv PT_OPENBSD_NOBTCFI
ELF section.
Use when a port does not work with the default strict enforcement of
indirect branch targets.
.Pp
Applies to all architectures; set
.Ev USE_NOBTCFI-${MACHINE_ARCH}
to apply to only a specific architecture.
.It Ev USE_NOEXECONLY
If set to
.Sq Yes ,
writes a wrapper script to ${WRKDIR}/bin/ld in
writes a wrapper script to
.Pa ${WRKDIR}/bin/ld
in
.Cm patch
adding
.Fl -no-execute-only .
@ -3625,9 +3636,11 @@ which are used by default by the linker on some architectures.
.It Ev USE_WXNEEDED
If set to
.Sq Yes ,
writes a wrapper script to ${WRKDIR}/bin/ld in
writes a wrapper script to
.Pa ${WRKDIR}/bin/ld
in
.Cm patch
to request that the linker adds an
to request that the linker adds a
.Dv PT_OPENBSD_WXNEEDED
ELF section.
Use when a port requires memory mappings that are both executable
@ -3700,10 +3713,6 @@ During ports building,
.Pa ${WRKDIR}/bin
is put at the front of the
.Ev PATH .
.It Ev WRKDIR_LINKNAME
Name of a symbolic link to create within the port directory which will
point to the port's ${WRKDIR}.
Deprecated.
.It Ev WRKDIST
Subdirectory of ${WRKDIR} in which the distribution files normally unpack.
Base for all patches.
@ -4536,8 +4545,10 @@ specifications.
All file sets of the base OS, including xenocara, must be installed
before building ports.
.It "Fatal: /usr/local/lib/X11/app-defaults should exist and be a symlink"
/usr/local/lib/X11/app-defaults is distributed as a symlink in the
xshare*.tgz file set.
.Pa /usr/local/lib/X11/app-defaults
is distributed as a symlink in the
.Pa xshare*.tgz
file set.
If xenocara was not fully installed before packages were added, it may
have been created as a directory instead.
.It "Fatal: the licensing info for <pkgname> is incomplete..."

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.287 2023/08/23 01:55:45 cheloha Exp $ */
/* $OpenBSD: machdep.c,v 1.288 2023/09/08 20:47:22 kn Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@ -2005,62 +2005,33 @@ getbootinfo(char *bootinfo, int bootinfo_size)
case BOOTARG_PCIINFO:
/* generated by i386 boot loader */
break;
case BOOTARG_CONSDEV:
if (q->ba_size > sizeof(bios_oconsdev_t) +
offsetof(struct _boot_args32, ba_arg)) {
case BOOTARG_CONSDEV: {
#if NCOM > 0
bios_consdev_t *cdp =
(bios_consdev_t*)q->ba_arg;
static const int ports[] =
{ 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
int unit = minor(cdp->consdev);
uint64_t consaddr = cdp->consaddr;
if (consaddr == -1 && unit >= 0 &&
unit < nitems(ports))
consaddr = ports[unit];
if (major(cdp->consdev) == 8 &&
consaddr != -1) {
comconsunit = unit;
comconsaddr = consaddr;
comconsrate = cdp->conspeed;
comconsfreq = cdp->consfreq;
comcons_reg_width = cdp->reg_width;
comcons_reg_shift = cdp->reg_shift;
if (cdp->flags & BCD_MMIO)
comconsiot = X86_BUS_SPACE_MEM;
else
comconsiot = X86_BUS_SPACE_IO;
}
#endif
#ifdef BOOTINFO_DEBUG
printf(" console 0x%x:%d",
cdp->consdev, cdp->conspeed);
#endif
} else {
#if NCOM > 0
bios_oconsdev_t *cdp =
(bios_oconsdev_t*)q->ba_arg;
static const int ports[] =
{ 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
int unit = minor(cdp->consdev);
int consaddr = cdp->consaddr;
if (consaddr == -1 && unit >= 0 &&
unit < nitems(ports))
consaddr = ports[unit];
if (major(cdp->consdev) == 8 &&
consaddr != -1) {
comconsunit = unit;
comconsaddr = consaddr;
comconsrate = cdp->conspeed;
bios_consdev_t *cdp = (bios_consdev_t*)q->ba_arg;
static const int ports[] =
{ 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
int unit = minor(cdp->consdev);
uint64_t consaddr = cdp->consaddr;
if (consaddr == -1 && unit >= 0 && unit < nitems(ports))
consaddr = ports[unit];
if (major(cdp->consdev) == 8 && consaddr != -1) {
comconsunit = unit;
comconsaddr = consaddr;
comconsrate = cdp->conspeed;
comconsfreq = cdp->consfreq;
comcons_reg_width = cdp->reg_width;
comcons_reg_shift = cdp->reg_shift;
if (cdp->flags & BCD_MMIO)
comconsiot = X86_BUS_SPACE_MEM;
else
comconsiot = X86_BUS_SPACE_IO;
}
}
#endif
#ifdef BOOTINFO_DEBUG
printf(" console 0x%x:%d",
cdp->consdev, cdp->conspeed);
printf(" console 0x%x:%d", cdp->consdev, cdp->conspeed);
#endif
}
break;
}
case BOOTARG_BOOTMAC:
bios_bootmac = (bios_bootmac_t *)q->ba_arg;
break;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: biosvar.h,v 1.31 2023/01/18 23:25:32 jsg Exp $ */
/* $OpenBSD: biosvar.h,v 1.32 2023/09/08 20:47:22 kn Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@ -172,14 +172,6 @@ typedef struct _bios_consdev {
int reg_shift;
} __packed bios_consdev_t;
/* Old interface; remove after OpenBSD 7.3 is released */
typedef struct _bios_oconsdev {
dev_t consdev;
int conspeed;
int consaddr;
int consfreq;
} __packed bios_oconsdev_t;
#define BOOTARG_BOOTMAC 7
typedef struct _bios_bootmac {
char mac[6];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: hotplug.c,v 1.22 2022/07/02 08:50:41 visa Exp $ */
/* $OpenBSD: hotplug.c,v 1.23 2023/09/08 20:00:27 mvs Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@ -25,6 +25,7 @@
#include <sys/fcntl.h>
#include <sys/hotplug.h>
#include <sys/ioctl.h>
#include <sys/selinfo.h>
#include <sys/vnode.h>
#define HOTPLUG_MAXEVENTS 64

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ure.c,v 1.32 2023/05/06 08:07:10 kevlo Exp $ */
/* $OpenBSD: if_ure.c,v 1.33 2023/09/09 14:23:37 kevlo Exp $ */
/*-
* Copyright (c) 2015, 2016, 2019 Kevin Lo <kevlo@openbsd.org>
* Copyright (c) 2020 Jonathon Fletcher <jonathon.fletcher@gmail.com>
@ -126,7 +126,6 @@ const struct usb_devno ure_devs[] = {
{ USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_EU300 },
{ USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8152B_1 },
{ USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8152B_2 },
{ USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8153 },
{ USB_VENDOR_TRENDNET, USB_PRODUCT_TRENDNET_RTL8156 },
{ USB_VENDOR_TTL, USB_PRODUCT_TTL_RTL8153 },
{ USB_VENDOR_TWINHEAD, USB_PRODUCT_TWINHEAD_RTL8153B },

View File

@ -1,4 +1,4 @@
$OpenBSD: usbdevs,v 1.758 2023/08/12 20:43:49 miod Exp $
$OpenBSD: usbdevs,v 1.759 2023/09/09 14:23:37 kevlo Exp $
/* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */
/*
@ -4478,7 +4478,7 @@ product TPLINK RTL8188EUS 0x010c RTL8188EUS
product TPLINK EU300 0x0601 EU300
product TPLINK RTL8152B_1 0x0602 RTL8152B
product TPLINK RTL8152B_2 0x0603 RTL8152B
product TPLINK RTL8153 0x0604 RTL8153
product TPLINK UB500 0x0604 UB500
/* Trek Technology products */
product TREK THUMBDRIVE 0x1111 ThumbDrive

View File

@ -1,10 +1,10 @@
/* $OpenBSD: usbdevs.h,v 1.770 2023/08/12 20:44:32 miod Exp $ */
/* $OpenBSD: usbdevs.h,v 1.771 2023/09/09 14:24:06 kevlo Exp $ */
/*
* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: usbdevs,v 1.758 2023/08/12 20:43:49 miod Exp
* OpenBSD: usbdevs,v 1.759 2023/09/09 14:23:37 kevlo Exp
*/
/* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */
@ -4485,7 +4485,7 @@
#define USB_PRODUCT_TPLINK_EU300 0x0601 /* EU300 */
#define USB_PRODUCT_TPLINK_RTL8152B_1 0x0602 /* RTL8152B */
#define USB_PRODUCT_TPLINK_RTL8152B_2 0x0603 /* RTL8152B */
#define USB_PRODUCT_TPLINK_RTL8153 0x0604 /* RTL8153 */
#define USB_PRODUCT_TPLINK_UB500 0x0604 /* UB500 */
/* Trek Technology products */
#define USB_PRODUCT_TREK_THUMBDRIVE 0x1111 /* ThumbDrive */

View File

@ -1,10 +1,10 @@
/* $OpenBSD: usbdevs_data.h,v 1.764 2023/08/12 20:44:32 miod Exp $ */
/* $OpenBSD: usbdevs_data.h,v 1.765 2023/09/09 14:24:06 kevlo Exp $ */
/*
* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: usbdevs,v 1.758 2023/08/12 20:43:49 miod Exp
* OpenBSD: usbdevs,v 1.759 2023/09/09 14:23:37 kevlo Exp
*/
/* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */
@ -11538,8 +11538,8 @@ const struct usb_known_product usb_known_products[] = {
"RTL8152B",
},
{
USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8153,
"RTL8153",
USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_UB500,
"UB500",
},
{
USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: wseventvar.h,v 1.11 2022/07/02 08:50:42 visa Exp $ */
/* $OpenBSD: wseventvar.h,v 1.12 2023/09/08 20:00:28 mvs Exp $ */
/* $NetBSD: wseventvar.h,v 1.1 1998/03/22 14:24:03 drochner Exp $ */
/*
@ -71,6 +71,7 @@
* @(#)event_var.h 8.1 (Berkeley) 6/11/93
*/
#include <sys/selinfo.h>
#include <sys/sigio.h>
/*

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cd9660_vnops.c,v 1.94 2023/03/08 04:43:08 guenther Exp $ */
/* $OpenBSD: cd9660_vnops.c,v 1.95 2023/09/08 20:00:28 mvs Exp $ */
/* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */
/*-
@ -961,7 +961,7 @@ cd9660_kqfilter(void *v)
kn->kn_hook = (caddr_t)vp;
klist_insert_locked(&vp->v_selectinfo.si_note, kn);
klist_insert_locked(&vp->v_klist, kn);
return (0);
}
@ -971,7 +971,7 @@ filt_cd9660detach(struct knote *kn)
{
struct vnode *vp = (struct vnode *)kn->kn_hook;
klist_remove_locked(&vp->v_selectinfo.si_note, kn);
klist_remove_locked(&vp->v_klist, kn);
}
int

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_clockintr.c,v 1.38 2023/09/06 02:33:18 cheloha Exp $ */
/* $OpenBSD: kern_clockintr.c,v 1.43 2023/09/09 16:34:39 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@ -43,7 +43,6 @@ uint32_t statclock_min; /* [I] minimum statclock period (ns) */
uint32_t statclock_mask; /* [I] set of allowed offsets */
uint64_t clockintr_advance_random(struct clockintr *, uint64_t, uint32_t);
void clockintr_cancel_locked(struct clockintr *);
void clockintr_hardclock(struct clockintr *, void *);
void clockintr_schedule(struct clockintr *, uint64_t);
void clockintr_schedule_locked(struct clockintr *, uint64_t);
@ -51,6 +50,9 @@ void clockintr_statclock(struct clockintr *, void *);
void clockqueue_intrclock_install(struct clockintr_queue *,
const struct intrclock *);
uint64_t clockqueue_next(const struct clockintr_queue *);
void clockqueue_pend_delete(struct clockintr_queue *, struct clockintr *);
void clockqueue_pend_insert(struct clockintr_queue *, struct clockintr *,
uint64_t);
void clockqueue_reset_intrclock(struct clockintr_queue *);
uint64_t nsec_advance(uint64_t *, uint64_t, uint64_t);
@ -255,12 +257,13 @@ clockintr_dispatch(void *frame)
if (cq->cq_uptime < cl->cl_expiration)
break;
}
clockintr_cancel_locked(cl);
clockqueue_pend_delete(cq, cl);
cq->cq_shadow.cl_expiration = cl->cl_expiration;
cq->cq_shadow.cl_func = cl->cl_func;
cq->cq_running = cl;
mtx_leave(&cq->cq_mtx);
cl->cl_func(&cq->cq_shadow, frame);
cq->cq_shadow.cl_func(&cq->cq_shadow, frame);
mtx_enter(&cq->cq_mtx);
cq->cq_running = NULL;
@ -270,7 +273,7 @@ clockintr_dispatch(void *frame)
}
if (ISSET(cq->cq_shadow.cl_flags, CLST_SHADOW_PENDING)) {
CLR(cq->cq_shadow.cl_flags, CLST_SHADOW_PENDING);
clockintr_schedule_locked(cl,
clockqueue_pend_insert(cq, cl,
cq->cq_shadow.cl_expiration);
}
run++;
@ -329,17 +332,7 @@ clockintr_advance(struct clockintr *cl, uint64_t period)
mtx_enter(&cq->cq_mtx);
expiration = cl->cl_expiration;
count = nsec_advance(&expiration, period, nsecuptime());
if (ISSET(cl->cl_flags, CLST_PENDING))
clockintr_cancel_locked(cl);
clockintr_schedule_locked(cl, expiration);
if (ISSET(cq->cq_flags, CQ_INTRCLOCK)) {
if (cl == TAILQ_FIRST(&cq->cq_pend)) {
if (cq == &curcpu()->ci_queue)
clockqueue_reset_intrclock(cq);
}
}
if (cl == cq->cq_running)
SET(cl->cl_flags, CLST_IGNORE_SHADOW);
mtx_leave(&cq->cq_mtx);
return count;
}
@ -377,7 +370,7 @@ clockintr_cancel(struct clockintr *cl)
mtx_enter(&cq->cq_mtx);
if (ISSET(cl->cl_flags, CLST_PENDING)) {
was_next = cl == TAILQ_FIRST(&cq->cq_pend);
clockintr_cancel_locked(cl);
clockqueue_pend_delete(cq, cl);
if (ISSET(cq->cq_flags, CQ_INTRCLOCK)) {
if (was_next && !TAILQ_EMPTY(&cq->cq_pend)) {
if (cq == &curcpu()->ci_queue)
@ -390,18 +383,6 @@ clockintr_cancel(struct clockintr *cl)
mtx_leave(&cq->cq_mtx);
}
void
clockintr_cancel_locked(struct clockintr *cl)
{
struct clockintr_queue *cq = cl->cl_queue;
MUTEX_ASSERT_LOCKED(&cq->cq_mtx);
KASSERT(ISSET(cl->cl_flags, CLST_PENDING));
TAILQ_REMOVE(&cq->cq_pend, cl, cl_plink);
CLR(cl->cl_flags, CLST_PENDING);
}
struct clockintr *
clockintr_establish(struct cpu_info *ci,
void (*func)(struct clockintr *, void *))
@ -433,9 +414,20 @@ clockintr_schedule(struct clockintr *cl, uint64_t expiration)
}
mtx_enter(&cq->cq_mtx);
if (ISSET(cl->cl_flags, CLST_PENDING))
clockintr_cancel_locked(cl);
clockintr_schedule_locked(cl, expiration);
mtx_leave(&cq->cq_mtx);
}
void
clockintr_schedule_locked(struct clockintr *cl, uint64_t expiration)
{
struct clockintr_queue *cq = cl->cl_queue;
MUTEX_ASSERT_LOCKED(&cq->cq_mtx);
if (ISSET(cl->cl_flags, CLST_PENDING))
clockqueue_pend_delete(cq, cl);
clockqueue_pend_insert(cq, cl, expiration);
if (ISSET(cq->cq_flags, CQ_INTRCLOCK)) {
if (cl == TAILQ_FIRST(&cq->cq_pend)) {
if (cq == &curcpu()->ci_queue)
@ -444,28 +436,6 @@ clockintr_schedule(struct clockintr *cl, uint64_t expiration)
}
if (cl == cq->cq_running)
SET(cl->cl_flags, CLST_IGNORE_SHADOW);
mtx_leave(&cq->cq_mtx);
}
void
clockintr_schedule_locked(struct clockintr *cl, uint64_t expiration)
{
struct clockintr *elm;
struct clockintr_queue *cq = cl->cl_queue;
MUTEX_ASSERT_LOCKED(&cq->cq_mtx);
KASSERT(!ISSET(cl->cl_flags, CLST_PENDING));
cl->cl_expiration = expiration;
TAILQ_FOREACH(elm, &cq->cq_pend, cl_plink) {
if (cl->cl_expiration < elm->cl_expiration)
break;
}
if (elm == NULL)
TAILQ_INSERT_TAIL(&cq->cq_pend, cl, cl_plink);
else
TAILQ_INSERT_BEFORE(elm, cl, cl_plink);
SET(cl->cl_flags, CLST_PENDING);
}
void
@ -541,6 +511,38 @@ clockqueue_next(const struct clockintr_queue *cq)
return TAILQ_FIRST(&cq->cq_pend)->cl_expiration;
}
void
clockqueue_pend_delete(struct clockintr_queue *cq, struct clockintr *cl)
{
MUTEX_ASSERT_LOCKED(&cq->cq_mtx);
KASSERT(ISSET(cl->cl_flags, CLST_PENDING));
TAILQ_REMOVE(&cq->cq_pend, cl, cl_plink);
CLR(cl->cl_flags, CLST_PENDING);
}
void
clockqueue_pend_insert(struct clockintr_queue *cq, struct clockintr *cl,
uint64_t expiration)
{
struct clockintr *elm;
MUTEX_ASSERT_LOCKED(&cq->cq_mtx);
KASSERT(!ISSET(cl->cl_flags, CLST_PENDING));
cl->cl_expiration = expiration;
TAILQ_FOREACH(elm, &cq->cq_pend, cl_plink) {
if (cl->cl_expiration < elm->cl_expiration)
break;
}
if (elm == NULL)
TAILQ_INSERT_TAIL(&cq->cq_pend, cl, cl_plink);
else
TAILQ_INSERT_BEFORE(elm, cl, cl_plink);
SET(cl->cl_flags, CLST_PENDING);
}
void
clockqueue_reset_intrclock(struct clockintr_queue *cq)
{

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sig.c,v 1.315 2023/09/08 09:06:31 claudio Exp $ */
/* $OpenBSD: kern_sig.c,v 1.316 2023/09/09 14:50:09 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@ -2109,12 +2109,14 @@ single_thread_set(struct proc *p, enum single_thread_mode mode, int wait)
TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) {
if (q == p)
continue;
SCHED_LOCK(s);
if (q->p_flag & P_WEXIT) {
SCHED_LOCK(s);
if (mode == SINGLE_EXIT && q->p_stat == SSTOP)
setrunnable(q);
SCHED_UNLOCK(s);
continue;
}
SCHED_LOCK(s);
atomic_setbits_int(&q->p_flag, P_SUSPSINGLE);
switch (q->p_stat) {
case SIDL:

View File

@ -1,4 +1,4 @@
/* $OpenBSD: fuse_device.c,v 1.38 2022/08/29 06:08:04 jsg Exp $ */
/* $OpenBSD: fuse_device.c,v 1.39 2023/09/08 20:00:28 mvs Exp $ */
/*
* Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@ -25,6 +25,7 @@
#include <sys/statvfs.h>
#include <sys/vnode.h>
#include <sys/fusebuf.h>
#include <sys/selinfo.h>
#include "fusefs_node.h"
#include "fusefs.h"

View File

@ -1,4 +1,4 @@
/* $OpenBSD: fuse_vnops.c,v 1.66 2022/06/26 05:20:42 visa Exp $ */
/* $OpenBSD: fuse_vnops.c,v 1.67 2023/09/08 20:00:28 mvs Exp $ */
/*
* Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@ -154,7 +154,7 @@ fusefs_kqfilter(void *v)
kn->kn_hook = (caddr_t)vp;
klist_insert_locked(&vp->v_selectinfo.si_note, kn);
klist_insert_locked(&vp->v_klist, kn);
return (0);
}
@ -164,7 +164,7 @@ filt_fusefsdetach(struct knote *kn)
{
struct vnode *vp = (struct vnode *)kn->kn_hook;
klist_remove_locked(&vp->v_selectinfo.si_note, kn);
klist_remove_locked(&vp->v_klist, kn);
}
int

View File

@ -1,4 +1,4 @@
/* $OpenBSD: msdosfs_vnops.c,v 1.139 2022/08/23 20:37:16 cheloha Exp $ */
/* $OpenBSD: msdosfs_vnops.c,v 1.140 2023/09/08 20:00:28 mvs Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */
/*-
@ -1970,7 +1970,7 @@ msdosfs_kqfilter(void *v)
kn->kn_hook = (caddr_t)vp;
klist_insert_locked(&vp->v_selectinfo.si_note, kn);
klist_insert_locked(&vp->v_klist, kn);
return (0);
}
@ -1980,7 +1980,7 @@ filt_msdosfsdetach(struct knote *kn)
{
struct vnode *vp = (struct vnode *)kn->kn_hook;
klist_remove_locked(&vp->v_selectinfo.si_note, kn);
klist_remove_locked(&vp->v_klist, kn);
}
int

View File

@ -1,4 +1,4 @@
/* $OpenBSD: nfs_kq.c,v 1.35 2023/03/08 04:43:09 guenther Exp $ */
/* $OpenBSD: nfs_kq.c,v 1.36 2023/09/08 20:00:28 mvs Exp $ */
/* $NetBSD: nfs_kq.c,v 1.7 2003/10/30 01:43:10 simonb Exp $ */
/*-
@ -185,7 +185,7 @@ filt_nfsdetach(struct knote *kn)
{
struct vnode *vp = (struct vnode *)kn->kn_hook;
klist_remove_locked(&vp->v_selectinfo.si_note, kn);
klist_remove_locked(&vp->v_klist, kn);
/* Remove the vnode from watch list */
if ((kn->kn_flags & (__EV_POLL | __EV_SELECT)) == 0)
@ -342,7 +342,7 @@ nfs_kqfilter(void *v)
return (error);
}
klist_insert_locked(&vp->v_selectinfo.si_note, kn);
klist_insert_locked(&vp->v_klist, kn);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vnode.h,v 1.168 2023/02/10 14:34:17 visa Exp $ */
/* $OpenBSD: vnode.h,v 1.169 2023/09/08 20:00:28 mvs Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
@ -37,8 +37,8 @@
#include <sys/buf.h>
#include <sys/types.h>
#include <sys/event.h>
#include <sys/queue.h>
#include <sys/selinfo.h>
#include <sys/tree.h>
/*
@ -127,7 +127,7 @@ struct vnode {
TAILQ_HEAD(, namecache) v_cache_dst; /* cache entries to us */
void *v_data; /* private data for fs */
struct selinfo v_selectinfo; /* identity of poller(s) */
struct klist v_klist; /* identity of poller(s) */
};
#define v_mountedhere v_un.vu_mountedhere
#define v_socket v_un.vu_socket
@ -246,7 +246,7 @@ extern int vttoif_tab[];
#define VATTR_NULL(vap) vattr_null(vap)
#define NULLVP ((struct vnode *)NULL)
#define VN_KNOTE(vp, b) \
knote_locked(&vp->v_selectinfo.si_note, (b))
knote_locked(&vp->v_klist, (b))
/*
* Global vnode data.

View File

@ -1,4 +1,4 @@
/* $OpenBSD: tmpfs_vnops.c,v 1.52 2022/06/26 05:20:42 visa Exp $ */
/* $OpenBSD: tmpfs_vnops.c,v 1.53 2023/09/08 20:00:28 mvs Exp $ */
/* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */
/*
@ -2627,7 +2627,7 @@ tmpfs_kqfilter(void *v)
kn->kn_hook = (caddr_t)vp;
klist_insert_locked(&vp->v_selectinfo.si_note, kn);
klist_insert_locked(&vp->v_klist, kn);
return (0);
}
@ -2637,7 +2637,7 @@ filt_tmpfsdetach(struct knote *kn)
{
struct vnode *vp = (struct vnode *)kn->kn_hook;
klist_remove_locked(&vp->v_selectinfo.si_note, kn);
klist_remove_locked(&vp->v_klist, kn);
}
int

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ufs_vnops.c,v 1.157 2023/03/08 04:43:09 guenther Exp $ */
/* $OpenBSD: ufs_vnops.c,v 1.158 2023/09/08 20:00:28 mvs Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
/*
@ -1921,7 +1921,7 @@ ufs_kqfilter(void *v)
kn->kn_hook = (caddr_t)vp;
klist_insert_locked(&vp->v_selectinfo.si_note, kn);
klist_insert_locked(&vp->v_klist, kn);
return (0);
}
@ -1931,7 +1931,7 @@ filt_ufsdetach(struct knote *kn)
{
struct vnode *vp = (struct vnode *)kn->kn_hook;
klist_remove_locked(&vp->v_selectinfo.si_note, kn);
klist_remove_locked(&vp->v_klist, kn);
}
int