diff --git a/bin/csh/extern.h b/bin/csh/extern.h index cdbe62bbb..6a0744f6b 100644 --- a/bin/csh/extern.h +++ b/bin/csh/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.31 2018/09/18 17:48:22 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.32 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: extern.h,v 1.8 1996/10/31 23:50:54 christos Exp $ */ /*- @@ -201,7 +201,6 @@ int prefix(Char *, Char *); Char **saveblk(Char **); Char *strip(Char *); Char *quote(Char *); -char *strspl(char *, char *); void udvar(Char *); /* diff --git a/bin/md5/crc.h b/bin/md5/crc.h index 2000c489c..65d2c2ed2 100644 --- a/bin/md5/crc.h +++ b/bin/md5/crc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crc.h,v 1.4 2019/01/25 00:19:25 millert Exp $ */ +/* $OpenBSD: crc.h,v 1.5 2024/05/21 05:00:47 jsg Exp $ */ /* * Copyright (c) 2004 Todd C. Miller @@ -28,4 +28,3 @@ void CKSUM_Init(CKSUM_CTX *); void CKSUM_Update(CKSUM_CTX *, const u_int8_t *, size_t); void CKSUM_Final(CKSUM_CTX *); char *CKSUM_End(CKSUM_CTX *, char *); -char *CKSUM_Data(const u_int8_t *, size_t, char *); diff --git a/bin/mt/mt.h b/bin/mt/mt.h index da24d3d49..c677cb5a6 100644 --- a/bin/mt/mt.h +++ b/bin/mt/mt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mt.h,v 1.3 2003/06/02 23:32:08 millert Exp $ */ +/* $OpenBSD: mt.h,v 1.4 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: mt.h,v 1.1 1996/03/05 20:39:36 scottr Exp $ */ /*- @@ -37,8 +37,6 @@ int rmtopen(char *tape, int mode); int rmtioctl(int command, int count); struct mtget *rmtstatus(void); -void interrupt(int signo); /* in case operator bangs on console */ - /* * Exit status codes */ diff --git a/bin/stty/extern.h b/bin/stty/extern.h index beb5e1c1c..e6e8c41fe 100644 --- a/bin/stty/extern.h +++ b/bin/stty/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.6 2003/06/02 23:32:09 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.7 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: extern.h,v 1.8 1996/05/07 18:20:06 jtc Exp $ */ /*- @@ -34,15 +34,11 @@ extern char *__progname; -int c_cchars(const void *, const void *); -int c_modes(const void *, const void *); int csearch(char ***, struct info *); -void checkredirect(void); void gprint(struct termios *, struct winsize *, int); void gread(struct termios *, char *); int ksearch(char ***, struct info *); int msearch(char ***, struct info *); -void optlist(void); void print(struct termios *, struct winsize *, int, enum FMT); void usage(void); diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c index 94fb4b08c..6f17c4db6 100644 --- a/games/fortune/fortune/fortune.c +++ b/games/fortune/fortune/fortune.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fortune.c,v 1.63 2021/01/03 01:32:13 schwarze Exp $ */ +/* $OpenBSD: fortune.c,v 1.64 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $ */ /*- @@ -140,7 +140,6 @@ void sum_tbl(STRFILE *, STRFILE *); __dead void usage(void); void zero_tbl(STRFILE *); -char *conv_pat(char *); int find_matches(void); void matches_in_list(FILEDESC *); int maxlen_in_list(FILEDESC *); diff --git a/games/hack/hack.h b/games/hack/hack.h index b727453f2..8bdfff043 100644 --- a/games/hack/hack.h +++ b/games/hack/hack.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.h,v 1.14 2023/06/03 15:19:38 op Exp $*/ +/* $OpenBSD: hack.h,v 1.15 2024/05/21 05:00:47 jsg Exp $*/ /* $NetBSD: hack.h,v 1.3 1995/03/23 08:30:21 cgd Exp $*/ /* @@ -680,7 +680,6 @@ char *getdate(void); int phase_of_the_moon(void); int night(void); int midnight(void); -void gethdate(char *); void getlock(void); #ifdef MAIL void getmailstatus(void); diff --git a/games/hunt/hunt/display.h b/games/hunt/hunt/display.h index 08d9ba904..19a4d7eff 100644 --- a/games/hunt/hunt/display.h +++ b/games/hunt/hunt/display.h @@ -1,4 +1,4 @@ -/* $OpenBSD: display.h,v 1.3 2003/06/17 00:36:36 pjanzen Exp $ */ +/* $OpenBSD: display.h,v 1.4 2024/05/21 05:00:47 jsg Exp $ */ /* David Leonard , 1999. Public domain. */ void display_open(void); @@ -15,5 +15,3 @@ char display_atyx(int, int); void display_redraw_screen(void); int display_iskillchar(char); int display_iserasechar(char); - -extern int cur_row, cur_col; diff --git a/games/phantasia/main.c b/games/phantasia/main.c index 09fd37d9d..463e1ca1f 100644 --- a/games/phantasia/main.c +++ b/games/phantasia/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.22 2016/08/27 02:00:10 guenther Exp $ */ +/* $OpenBSD: main.c,v 1.23 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: main.c,v 1.3 1995/04/24 12:24:37 cgd Exp $ */ /* @@ -1131,7 +1131,7 @@ genchar(int type) / MODULES CALLED: signal(), wclear(), noecho(), cbreak(), initscr(), / wrefresh() / -/ GLOBAL INPUTS: *stdscr, ill_sig() +/ GLOBAL INPUTS: *stdscr / / GLOBAL OUTPUTS: Windows / diff --git a/games/phantasia/phantglobs.h b/games/phantasia/phantglobs.h index 7b0fc5a04..03fb7916a 100644 --- a/games/phantasia/phantglobs.h +++ b/games/phantasia/phantglobs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: phantglobs.h,v 1.7 2016/01/06 14:28:09 mestre Exp $ */ +/* $OpenBSD: phantglobs.h,v 1.8 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: phantglobs.h,v 1.3 1995/04/24 12:24:39 cgd Exp $ */ /* @@ -100,7 +100,6 @@ void genchar(int); int getanswer(char *, bool); void getstring(char *, int); void hitmonster(double); -void ill_sig(int); double infloat(void); void initialstate(void); void initplayer(struct player *); diff --git a/gnu/usr.bin/perl/MANIFEST b/gnu/usr.bin/perl/MANIFEST index c3ece93c3..975c48926 100644 --- a/gnu/usr.bin/perl/MANIFEST +++ b/gnu/usr.bin/perl/MANIFEST @@ -158,8 +158,8 @@ README.os400 Perl notes for OS/400 README.plan9 Perl notes for Plan 9 README.qnx Perl notes for QNX README.riscos Perl notes for RISC OS -README.openbsd Perl notes for SecBSD -README.secbsd Perl notes for Solaris +README.secbsd Perl notes for SecBSD +README.solaris Perl notes for Solaris README.synology Perl notes for Synology README.tru64 Perl notes for Tru64 README.tw Perl for Traditional Chinese (in Big5) diff --git a/lib/libcrypto/bio/bio.h b/lib/libcrypto/bio/bio.h index a96d2b294..848bb06c6 100644 --- a/lib/libcrypto/bio/bio.h +++ b/lib/libcrypto/bio/bio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bio.h,v 1.63 2024/03/02 09:22:41 tb Exp $ */ +/* $OpenBSD: bio.h,v 1.64 2024/05/19 07:12:50 jsg Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -364,10 +364,6 @@ int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, #define BIO_C_GET_WRITE_GUARANTEE 140 #define BIO_C_GET_READ_REQUEST 141 #define BIO_C_SHUTDOWN_WR 142 -#define BIO_C_NREAD0 143 -#define BIO_C_NREAD 144 -#define BIO_C_NWRITE0 145 -#define BIO_C_NWRITE 146 #define BIO_C_RESET_READ_REQUEST 147 #define BIO_C_SET_MD_CTX 148 @@ -566,11 +562,6 @@ int BIO_get_retry_reason(BIO *bio); void BIO_set_retry_reason(BIO *bio, int reason); BIO * BIO_dup_chain(BIO *in); -int BIO_nread0(BIO *bio, char **buf); -int BIO_nread(BIO *bio, char **buf, int num); -int BIO_nwrite0(BIO *bio, char **buf); -int BIO_nwrite(BIO *bio, char **buf, int num); - long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret); diff --git a/lib/libcrypto/cmac/cmac.c b/lib/libcrypto/cmac/cmac.c index 7ad343483..5c917439a 100644 --- a/lib/libcrypto/cmac/cmac.c +++ b/lib/libcrypto/cmac/cmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmac.c,v 1.23 2024/03/02 09:30:21 tb Exp $ */ +/* $OpenBSD: cmac.c,v 1.24 2024/05/20 14:53:37 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -182,7 +182,7 @@ int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, const EVP_CIPHER *cipher, ENGINE *impl) { - static unsigned char zero_iv[EVP_MAX_BLOCK_LENGTH]; + static const unsigned char zero_iv[EVP_MAX_BLOCK_LENGTH]; int block_size; /* All zeros means restart */ diff --git a/lib/libcrypto/cms/cms_local.h b/lib/libcrypto/cms/cms_local.h index 2e3a3637e..6be60e904 100644 --- a/lib/libcrypto/cms/cms_local.h +++ b/lib/libcrypto/cms/cms_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_local.h,v 1.5 2023/08/24 04:56:36 tb Exp $ */ +/* $OpenBSD: cms_local.h,v 1.6 2024/05/19 07:12:50 jsg Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -394,8 +394,6 @@ extern const ASN1_ITEM CMS_Attributes_Sign_it; extern const ASN1_ITEM CMS_Attributes_Verify_it; extern const ASN1_ITEM CMS_RecipientInfo_it; extern const ASN1_ITEM CMS_PasswordRecipientInfo_it; -CMS_IssuerAndSerialNumber *CMS_IssuerAndSerialNumber_new(void); -void CMS_IssuerAndSerialNumber_free(CMS_IssuerAndSerialNumber *a); #define CMS_SIGNERINFO_ISSUER_SERIAL 0 #define CMS_SIGNERINFO_KEYIDENTIFIER 1 @@ -423,9 +421,6 @@ int cms_SignerIdentifier_get0_signer_id(CMS_SignerIdentifier *sid, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno); int cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert); -CMS_ContentInfo *cms_CompressedData_create(int comp_nid); -BIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms); - BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm); int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain, X509_ALGOR *mdalg); diff --git a/lib/libcrypto/conf/conf_api.h b/lib/libcrypto/conf/conf_api.h index 95f938622..2793e8413 100644 --- a/lib/libcrypto/conf/conf_api.h +++ b/lib/libcrypto/conf/conf_api.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf_api.h,v 1.4 2014/06/12 15:49:28 deraadt Exp $ */ +/* $OpenBSD: conf_api.h,v 1.5 2024/05/19 07:12:50 jsg Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -77,7 +77,6 @@ STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); char *_CONF_get_string(const CONF *conf, const char *section, const char *name); -long _CONF_get_number(const CONF *conf, const char *section, const char *name); int _CONF_new_data(CONF *conf); void _CONF_free_data(CONF *conf); diff --git a/lib/libcrypto/dh/dh_err.c b/lib/libcrypto/dh/dh_err.c index dfa52b5b6..52fec7848 100644 --- a/lib/libcrypto/dh/dh_err.c +++ b/lib/libcrypto/dh/dh_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_err.c,v 1.19 2023/07/08 15:29:03 beck Exp $ */ +/* $OpenBSD: dh_err.c,v 1.21 2024/05/19 08:22:40 tb Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -65,50 +65,48 @@ #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason) -static ERR_STRING_DATA DH_str_functs[]= { +static ERR_STRING_DATA DH_str_functs[] = { {ERR_FUNC(0xfff), "CRYPTO_internal"}, {0, NULL} }; -static ERR_STRING_DATA DH_str_reasons[]= - { -{ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, -{ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, -{ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, -{ERR_REASON(DH_R_DECODE_ERROR) ,"decode error"}, -{ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, -{ERR_REASON(DH_R_KEYS_NOT_SET) ,"keys not set"}, -{ERR_REASON(DH_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, -{ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, -{ERR_REASON(DH_R_NON_FIPS_METHOD) ,"non fips method"}, -{ERR_REASON(DH_R_NO_PARAMETERS_SET) ,"no parameters set"}, -{ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, -{ERR_REASON(DH_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, -{ERR_REASON(DH_R_CHECK_INVALID_J_VALUE) ,"check invalid j value"}, -{ERR_REASON(DH_R_CHECK_INVALID_Q_VALUE) ,"check invalid q value"}, -{ERR_REASON(DH_R_CHECK_PUBKEY_INVALID) ,"check pubkey invalid"}, -{ERR_REASON(DH_R_CHECK_PUBKEY_TOO_LARGE) ,"check pubkey too large"}, -{ERR_REASON(DH_R_CHECK_PUBKEY_TOO_SMALL) ,"check pubkey too small"}, -{ERR_REASON(DH_R_CHECK_P_NOT_PRIME) ,"check p not prime"}, -{ERR_REASON(DH_R_CHECK_P_NOT_SAFE_PRIME) ,"check p not safe prime"}, -{ERR_REASON(DH_R_CHECK_Q_NOT_PRIME) ,"check q not prime"}, -{ERR_REASON(DH_R_MISSING_PUBKEY) ,"missing pubkey"}, -{ERR_REASON(DH_R_NOT_SUITABLE_GENERATOR) ,"not suitable generator"}, -{ERR_REASON(DH_R_UNABLE_TO_CHECK_GENERATOR),"unable to check generator"}, -{0,NULL} - }; +static ERR_STRING_DATA DH_str_reasons[] = { + {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, + {ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, + {ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, + {ERR_REASON(DH_R_DECODE_ERROR) ,"decode error"}, + {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, + {ERR_REASON(DH_R_KEYS_NOT_SET) ,"keys not set"}, + {ERR_REASON(DH_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, + {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, + {ERR_REASON(DH_R_NON_FIPS_METHOD) ,"non fips method"}, + {ERR_REASON(DH_R_NO_PARAMETERS_SET) ,"no parameters set"}, + {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, + {ERR_REASON(DH_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, + {ERR_REASON(DH_R_CHECK_INVALID_J_VALUE) ,"check invalid j value"}, + {ERR_REASON(DH_R_CHECK_INVALID_Q_VALUE) ,"check invalid q value"}, + {ERR_REASON(DH_R_CHECK_PUBKEY_INVALID) ,"check pubkey invalid"}, + {ERR_REASON(DH_R_CHECK_PUBKEY_TOO_LARGE) ,"check pubkey too large"}, + {ERR_REASON(DH_R_CHECK_PUBKEY_TOO_SMALL) ,"check pubkey too small"}, + {ERR_REASON(DH_R_CHECK_P_NOT_PRIME) ,"check p not prime"}, + {ERR_REASON(DH_R_CHECK_P_NOT_SAFE_PRIME) ,"check p not safe prime"}, + {ERR_REASON(DH_R_CHECK_Q_NOT_PRIME) ,"check q not prime"}, + {ERR_REASON(DH_R_MISSING_PUBKEY) ,"missing pubkey"}, + {ERR_REASON(DH_R_NOT_SUITABLE_GENERATOR) ,"not suitable generator"}, + {ERR_REASON(DH_R_UNABLE_TO_CHECK_GENERATOR),"unable to check generator"}, + {0,NULL} +}; #endif -void ERR_load_DH_strings(void) - { +void +ERR_load_DH_strings(void) +{ #ifndef OPENSSL_NO_ERR - - if (ERR_func_error_string(DH_str_functs[0].error) == NULL) - { - ERR_load_strings(0,DH_str_functs); - ERR_load_strings(0,DH_str_reasons); - } -#endif + if (ERR_func_error_string(DH_str_functs[0].error) == NULL) { + ERR_load_strings(0, DH_str_functs); + ERR_load_strings(0, DH_str_reasons); } +#endif +} LCRYPTO_ALIAS(ERR_load_DH_strings); diff --git a/lib/libcrypto/dsa/dsa_err.c b/lib/libcrypto/dsa/dsa_err.c index 6934fe14f..048fa8df4 100644 --- a/lib/libcrypto/dsa/dsa_err.c +++ b/lib/libcrypto/dsa/dsa_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_err.c,v 1.19 2023/07/08 14:28:15 beck Exp $ */ +/* $OpenBSD: dsa_err.c,v 1.21 2024/05/19 08:22:40 tb Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -65,40 +65,38 @@ #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason) -static ERR_STRING_DATA DSA_str_functs[]= { +static ERR_STRING_DATA DSA_str_functs[] = { {ERR_FUNC(0xfff), "CRYPTO_internal"}, {0, NULL} }; -static ERR_STRING_DATA DSA_str_reasons[]= - { -{ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, -{ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"}, -{ERR_REASON(DSA_R_BN_ERROR) ,"bn error"}, -{ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, -{ERR_REASON(DSA_R_DECODE_ERROR) ,"decode error"}, -{ERR_REASON(DSA_R_INVALID_DIGEST_TYPE) ,"invalid digest type"}, -{ERR_REASON(DSA_R_INVALID_PARAMETERS) ,"invalid parameters"}, -{ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"}, -{ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, -{ERR_REASON(DSA_R_NEED_NEW_SETUP_VALUES) ,"need new setup values"}, -{ERR_REASON(DSA_R_NON_FIPS_DSA_METHOD) ,"non fips dsa method"}, -{ERR_REASON(DSA_R_NO_PARAMETERS_SET) ,"no parameters set"}, -{ERR_REASON(DSA_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, -{0,NULL} - }; +static ERR_STRING_DATA DSA_str_reasons[] = { + {ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, + {ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"}, + {ERR_REASON(DSA_R_BN_ERROR) ,"bn error"}, + {ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, + {ERR_REASON(DSA_R_DECODE_ERROR) ,"decode error"}, + {ERR_REASON(DSA_R_INVALID_DIGEST_TYPE) ,"invalid digest type"}, + {ERR_REASON(DSA_R_INVALID_PARAMETERS) ,"invalid parameters"}, + {ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"}, + {ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, + {ERR_REASON(DSA_R_NEED_NEW_SETUP_VALUES) ,"need new setup values"}, + {ERR_REASON(DSA_R_NON_FIPS_DSA_METHOD) ,"non fips dsa method"}, + {ERR_REASON(DSA_R_NO_PARAMETERS_SET) ,"no parameters set"}, + {ERR_REASON(DSA_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, + {0,NULL} +}; #endif -void ERR_load_DSA_strings(void) - { +void +ERR_load_DSA_strings(void) +{ #ifndef OPENSSL_NO_ERR - - if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) - { - ERR_load_strings(0,DSA_str_functs); - ERR_load_strings(0,DSA_str_reasons); - } -#endif + if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) { + ERR_load_strings(0, DSA_str_functs); + ERR_load_strings(0, DSA_str_reasons); } +#endif +} LCRYPTO_ALIAS(ERR_load_DSA_strings); diff --git a/lib/libcrypto/ec/ec_err.c b/lib/libcrypto/ec/ec_err.c index 9f2253ddd..7ecbb6656 100644 --- a/lib/libcrypto/ec/ec_err.c +++ b/lib/libcrypto/ec/ec_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_err.c,v 1.18 2023/07/28 09:28:37 tb Exp $ */ +/* $OpenBSD: ec_err.c,v 1.19 2024/05/19 08:26:03 tb Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -70,8 +70,7 @@ static ERR_STRING_DATA EC_str_functs[] = { {0, NULL} }; -static ERR_STRING_DATA EC_str_reasons[] = -{ +static ERR_STRING_DATA EC_str_reasons[] = { {ERR_REASON(EC_R_ASN1_ERROR), "asn1 error"}, {ERR_REASON(EC_R_ASN1_UNKNOWN_FIELD), "asn1 unknown field"}, {ERR_REASON(EC_R_BAD_SIGNATURE), "bad signature"}, diff --git a/lib/libcrypto/idea/idea.h b/lib/libcrypto/idea/idea.h index e5ddd3a6f..81c3453bc 100644 --- a/lib/libcrypto/idea/idea.h +++ b/lib/libcrypto/idea/idea.h @@ -1,4 +1,4 @@ -/* $OpenBSD: idea.h,v 1.11 2023/07/07 12:51:58 beck Exp $ */ +/* $OpenBSD: idea.h,v 1.12 2024/05/19 07:12:50 jsg Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -79,7 +79,6 @@ typedef struct idea_key_st { IDEA_INT data[9][6]; } IDEA_KEY_SCHEDULE; -const char *idea_options(void); void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, IDEA_KEY_SCHEDULE *ks); void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); diff --git a/lib/libcrypto/man/BIO_s_bio.3 b/lib/libcrypto/man/BIO_s_bio.3 index b3e6c3d32..efda019df 100644 --- a/lib/libcrypto/man/BIO_s_bio.3 +++ b/lib/libcrypto/man/BIO_s_bio.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: BIO_s_bio.3,v 1.19 2023/04/29 12:01:53 schwarze Exp $ +.\" $OpenBSD: BIO_s_bio.3,v 1.20 2024/05/19 07:12:50 jsg Exp $ .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 .\" .\" This file was written by @@ -53,7 +53,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: April 29 2023 $ +.Dd $Mdocdate: May 19 2024 $ .Dt BIO_S_BIO 3 .Os .Sh NAME @@ -69,16 +69,6 @@ .Nm BIO_get_read_request , .Nm BIO_ctrl_get_read_request , .Nm BIO_ctrl_reset_read_request -.\" The following non-copying I/O functions are intentionally undocumented -.\" because they seem fragile and unused by anything: -.\" .Nm BIO_nread0 -.\" .Nm BIO_nread -.\" .Nm BIO_nwrite0 -.\" .Nm BIO_nwrite -.\" .Nm BIO_C_NREAD0 -.\" .Nm BIO_C_NREAD -.\" .Nm BIO_C_NWRITE0 -.\" .Nm BIO_C_NWRITE .Nd BIO pair BIO .Sh SYNOPSIS .In openssl/bio.h diff --git a/lib/libcrypto/rsa/rsa.h b/lib/libcrypto/rsa/rsa.h index 4fcef3a97..60512317b 100644 --- a/lib/libcrypto/rsa/rsa.h +++ b/lib/libcrypto/rsa/rsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa.h,v 1.65 2023/07/28 10:05:16 tb Exp $ */ +/* $OpenBSD: rsa.h,v 1.66 2024/05/19 07:12:50 jsg Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -274,8 +274,6 @@ int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); const RSA_METHOD *RSA_PKCS1_OpenSSL(void); const RSA_METHOD *RSA_PKCS1_SSLeay(void); -const RSA_METHOD *RSA_null_method(void); - int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); RSA *d2i_RSAPublicKey(RSA **a, const unsigned char **in, long len); diff --git a/lib/libcrypto/x509/x509_internal.h b/lib/libcrypto/x509/x509_internal.h index 280d1ae46..9b9980ece 100644 --- a/lib/libcrypto/x509/x509_internal.h +++ b/lib/libcrypto/x509/x509_internal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_internal.h,v 1.27 2023/11/13 10:33:00 tb Exp $ */ +/* $OpenBSD: x509_internal.h,v 1.28 2024/05/19 07:12:50 jsg Exp $ */ /* * Copyright (c) 2020 Bob Beck * @@ -134,7 +134,6 @@ int x509_constraints_check(struct x509_constraints_names *names, struct x509_constraints_names *excluded, int *error); int x509_constraints_chain(STACK_OF(X509) *chain, int *error, int *depth); -int x509_verify_cert_info_populate(X509 *cert); int x509_vfy_check_security_level(X509_STORE_CTX *ctx); __END_HIDDEN_DECLS diff --git a/lib/libkeynote/assertion.h b/lib/libkeynote/assertion.h index 950571ce6..b2210ca87 100644 --- a/lib/libkeynote/assertion.h +++ b/lib/libkeynote/assertion.h @@ -1,4 +1,4 @@ -/* $OpenBSD: assertion.h,v 1.5 2003/06/26 23:19:53 deraadt Exp $ */ +/* $OpenBSD: assertion.h,v 1.6 2024/05/21 11:13:08 jsg Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) * @@ -156,7 +156,6 @@ extern int keynote_in_action_authorizers(void *, int); extern struct keynote_session *keynote_find_session(int); extern void keynote_keylist_free(struct keylist *); extern void keynote_free_env(struct environment *); -extern int keynote_in_authorizers(void *, int); extern int keynote_sremove_assertion(int, int); extern unsigned int keynote_stringhash(char *, unsigned int); extern char *keynote_get_private_key(char *); diff --git a/lib/libkvm/kvm_private.h b/lib/libkvm/kvm_private.h index f3780055a..7c92d0ecd 100644 --- a/lib/libkvm/kvm_private.h +++ b/lib/libkvm/kvm_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_private.h,v 1.26 2018/05/03 15:47:41 zhuk Exp $ */ +/* $OpenBSD: kvm_private.h,v 1.27 2024/05/21 11:13:08 jsg Exp $ */ /* $NetBSD: kvm_private.h,v 1.7 1996/05/05 04:32:15 gwr Exp $ */ /*- @@ -99,7 +99,6 @@ struct __kvm { __BEGIN_HIDDEN_DECLS void _kvm_err(kvm_t *kd, const char *program, const char *fmt, ...) __attribute__((__format__ (printf, 3, 4))); -int _kvm_dump_mkheader(kvm_t *kd_live, kvm_t *kd_dump); void _kvm_freevtop(kvm_t *); int _kvm_initvtop(kvm_t *); int _kvm_kvatop(kvm_t *, u_long, paddr_t *); diff --git a/lib/libpcap/gencode.h b/lib/libpcap/gencode.h index 50c48ef27..562b39d92 100644 --- a/lib/libpcap/gencode.h +++ b/lib/libpcap/gencode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gencode.h,v 1.21 2020/08/03 03:40:02 dlg Exp $ */ +/* $OpenBSD: gencode.h,v 1.22 2024/05/21 11:13:08 jsg Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996 @@ -189,7 +189,6 @@ struct block *gen_pf_srnr(int); struct block *gen_pf_ruleset(char *); struct block *gen_pf_reason(int); struct block *gen_pf_action(int); -struct block *gen_pf_dir(int); struct block *gen_p80211_type(int, int); struct block *gen_p80211_fcdir(int); diff --git a/lib/libskey/skey.h b/lib/libskey/skey.h index 45bb2c66b..30e4ea514 100644 --- a/lib/libskey/skey.h +++ b/lib/libskey/skey.h @@ -10,7 +10,7 @@ * * Main client header * - * $OpenBSD: skey.h,v 1.22 2019/01/25 00:19:26 millert Exp $ + * $OpenBSD: skey.h,v 1.23 2024/05/21 11:13:08 jsg Exp $ */ #ifndef _SKEY_H_ @@ -71,7 +71,6 @@ int skeychallenge(struct skey *, char *, char *); int skeychallenge2(int, struct skey *, char *, char *); int skeylookup(struct skey *, char *); int skeyverify(struct skey *, char *); -int skeyzero(struct skey *); void sevenbit(char *); void backspace(char *); char *skipspace(char *); diff --git a/lib/libsndio/mio_priv.h b/lib/libsndio/mio_priv.h index f39833b19..1ec928f14 100644 --- a/lib/libsndio/mio_priv.h +++ b/lib/libsndio/mio_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mio_priv.h,v 1.13 2022/12/27 17:10:07 jmc Exp $ */ +/* $OpenBSD: mio_priv.h,v 1.14 2024/05/21 06:07:06 jsg Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -46,6 +46,5 @@ struct mio_ops { struct mio_hdl *_mio_rmidi_open(const char *, unsigned, int); struct mio_hdl *_mio_aucat_open(const char *, unsigned, int); void _mio_create(struct mio_hdl *, struct mio_ops *, unsigned, int); -void _mio_destroy(struct mio_hdl *); #endif /* !defined(MIO_PRIV_H) */ diff --git a/lib/libsndio/sio_priv.h b/lib/libsndio/sio_priv.h index ee933f6eb..168be19ac 100644 --- a/lib/libsndio/sio_priv.h +++ b/lib/libsndio/sio_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sio_priv.h,v 1.11 2022/12/27 17:10:07 jmc Exp $ */ +/* $OpenBSD: sio_priv.h,v 1.12 2024/05/21 06:07:06 jsg Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -69,7 +69,6 @@ struct sio_ops { struct sio_hdl *_sio_aucat_open(const char *, unsigned, int); struct sio_hdl *_sio_sun_open(const char *, unsigned, int); void _sio_create(struct sio_hdl *, struct sio_ops *, unsigned, int); -void _sio_destroy(struct sio_hdl *); void _sio_onmove_cb(struct sio_hdl *, int); void _sio_onvol_cb(struct sio_hdl *, unsigned); #ifdef DEBUG diff --git a/lib/libsndio/sioctl_priv.h b/lib/libsndio/sioctl_priv.h index 5a58ba890..5aab1effd 100644 --- a/lib/libsndio/sioctl_priv.h +++ b/lib/libsndio/sioctl_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sioctl_priv.h,v 1.2 2022/12/27 17:10:07 jmc Exp $ */ +/* $OpenBSD: sioctl_priv.h,v 1.3 2024/05/21 06:07:06 jsg Exp $ */ /* * Copyright (c) 2014-2020 Alexandre Ratchov * @@ -49,8 +49,6 @@ struct sioctl_ops { }; struct sioctl_hdl *_sioctl_aucat_open(const char *, unsigned int, int); -struct sioctl_hdl *_sioctl_obsd_open(const char *, unsigned int, int); -struct sioctl_hdl *_sioctl_fake_open(const char *, unsigned int, int); struct sioctl_hdl *_sioctl_sun_open(const char *, unsigned int, int); void _sioctl_create(struct sioctl_hdl *, struct sioctl_ops *, unsigned int, int); diff --git a/lib/libssl/ssl_local.h b/lib/libssl/ssl_local.h index 551bdd576..eeef569fa 100644 --- a/lib/libssl/ssl_local.h +++ b/lib/libssl/ssl_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_local.h,v 1.15 2024/05/10 05:08:05 tb Exp $ */ +/* $OpenBSD: ssl_local.h,v 1.16 2024/05/19 07:12:50 jsg Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1305,7 +1305,6 @@ int ssl_verify_alarm_type(long type); int SSL_SESSION_ticket(SSL_SESSION *ss, unsigned char **out, size_t *out_len); -const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); int ssl3_do_write(SSL *s, int type); int ssl3_send_alert(SSL *s, int level, int desc); int ssl3_get_req_cert_types(SSL *s, CBB *cbb); diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h index 28e28eb97..9674ff134 100644 --- a/libexec/ftpd/extern.h +++ b/libexec/ftpd/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.23 2021/05/23 17:01:21 jan Exp $ */ +/* $OpenBSD: extern.h,v 1.25 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: extern.h,v 1.2 1995/04/11 02:44:49 cgd Exp $ */ /* @@ -61,8 +61,6 @@ * @(#)extern.h 8.2 (Berkeley) 4/4/94 */ -void blkfree(char **); -char **copyblk(char **); void cwd(char *); void delete(const char *); void dologout(int); @@ -92,7 +90,6 @@ void reply_r(int, const char *, ...); enum ret_cmd { RET_FILE, RET_LIST }; void retrieve(enum ret_cmd, const char *); void send_file_list(char *); -void setproctitle(const char *, ...); void statcmd(void); void statfilecmd(const char *); void store(const char *, const char *, int); diff --git a/libexec/getty/extern.h b/libexec/getty/extern.h index e83d0c512..ecb2eddb4 100644 --- a/libexec/getty/extern.h +++ b/libexec/getty/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.6 2015/07/16 04:31:25 tedu Exp $*/ +/* $OpenBSD: extern.h,v 1.7 2024/05/19 10:30:43 jsg Exp $*/ /* * Copyright (c) 1993 @@ -31,21 +31,11 @@ * from: @(#)extern.h 8.1 (Berkeley) 6/4/93 */ -struct delayval; - -int adelay(int, struct delayval *); char *autobaud(void); -int delaybits(void); void gendefaults(void); -int getent(char *, char *); -int getflag(char *); -long getnum(char *); -char *getstr(char *, char **); void gettable(char *, char *); void makeenv(char *[]); char *portselector(void); -void set_ttydefaults(int); void setchars(void); void setdefaults(void); void setflags(int); -int speed(int); diff --git a/libexec/getty/gettytab.h b/libexec/getty/gettytab.h index cba986c05..709f307db 100644 --- a/libexec/getty/gettytab.h +++ b/libexec/getty/gettytab.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gettytab.h,v 1.8 2015/11/06 16:42:30 tedu Exp $*/ +/* $OpenBSD: gettytab.h,v 1.9 2024/05/19 10:30:43 jsg Exp $*/ /* * Copyright (c) 1983, 1993, 1994 @@ -151,12 +151,6 @@ struct gettyflags { #define NP gettyflags[21].value #define MB gettyflags[22].value -int getent(char *, char *); -long getnum(char *); -int getflag(char *); -char *getstr(char *, char **); - extern struct gettyflags gettyflags[]; extern struct gettynums gettynums[]; extern struct gettystrs gettystrs[]; -extern int hopcount; diff --git a/libexec/ld.so/resolve.h b/libexec/ld.so/resolve.h index 0b3278e6f..67f545d54 100644 --- a/libexec/ld.so/resolve.h +++ b/libexec/ld.so/resolve.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.h,v 1.107 2024/01/16 19:07:31 deraadt Exp $ */ +/* $OpenBSD: resolve.h,v 1.108 2024/05/21 05:00:47 jsg Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -322,7 +322,6 @@ void _dl_link_grpsym(elf_object_t *object); void _dl_cache_grpsym_list_setup(elf_object_t *_object); void _dl_link_grpref(elf_object_t *load_group, elf_object_t *load_object); void _dl_link_dlopen(elf_object_t *dep); -void _dl_unlink_dlopen(elf_object_t *dep); void _dl_notify_unload_shlib(elf_object_t *object); void _dl_unload_shlib(elf_object_t *object); void _dl_unload_dlopen(void); @@ -333,7 +332,6 @@ int _dl_match_file(struct sod *sodp, const char *name, int namelen); char *_dl_find_shlib(struct sod *sodp, char **searchpath, int nohints); void _dl_load_list_free(struct load_list *load_list); -void _dl_find_immutables(int type, elf_object_t *object, Elf_Ehdr *); void _dl_push_range_size(struct range_vector *v, vaddr_t start, vsize_t len); void _dl_apply_immutable(elf_object_t *object); diff --git a/libexec/mail.local/mail.local.h b/libexec/mail.local/mail.local.h index bc3137cb6..29b433de9 100644 --- a/libexec/mail.local/mail.local.h +++ b/libexec/mail.local/mail.local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mail.local.h,v 1.7 2020/02/09 14:59:21 millert Exp $ */ +/* $OpenBSD: mail.local.h,v 1.8 2024/05/21 05:00:47 jsg Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -29,7 +29,6 @@ * SUCH DAMAGE. */ -void baditem(char *); int deliver(int, char *, int); void merr(int, const char *, ...); void mwarn(const char *, ...); diff --git a/libexec/rpc.rquotad/rquotad.c b/libexec/rpc.rquotad/rquotad.c index e62abda5c..7b2568c1e 100644 --- a/libexec/rpc.rquotad/rquotad.c +++ b/libexec/rpc.rquotad/rquotad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rquotad.c,v 1.25 2023/03/08 04:43:05 guenther Exp $ */ +/* $OpenBSD: rquotad.c,v 1.26 2024/05/21 05:00:47 jsg Exp $ */ /* * by Manuel Bouyer (bouyer@ensta.fr). Public domain. @@ -30,7 +30,6 @@ void rquota_service(struct svc_req *request, SVCXPRT *transp); void sendquota(struct svc_req *request, SVCXPRT *transp); -void printerr_reply(SVCXPRT *transp); void initfs(void); int getfsquota(long id, char *path, struct dqblk *dqblk); int hasquota(struct fstab *fs, char **qfnamep); diff --git a/regress/usr.bin/ssh/unittests/kex/Makefile b/regress/usr.bin/ssh/unittests/kex/Makefile index 981affe3c..3c898408f 100644 --- a/regress/usr.bin/ssh/unittests/kex/Makefile +++ b/regress/usr.bin/ssh/unittests/kex/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.14 2023/02/02 12:12:52 djm Exp $ +# $OpenBSD: Makefile,v 1.15 2024/05/19 19:10:01 anton Exp $ PROG=test_kex SRCS=tests.c test_kex.c test_proposal.c @@ -14,6 +14,7 @@ SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c SRCS+=ssh-ed25519-sk.c sk-usbhid.c SRCS+= kex.c +SRCS+= kex-names.c SRCS+= dh.c SRCS+= kexdh.c SRCS+= kexecdh.c diff --git a/sbin/fdisk/cmd.h b/sbin/fdisk/cmd.h index 1a6b9f98b..0c63843b9 100644 --- a/sbin/fdisk/cmd.h +++ b/sbin/fdisk/cmd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.h,v 1.27 2022/07/10 20:34:31 krw Exp $ */ +/* $OpenBSD: cmd.h,v 1.28 2024/05/21 05:00:47 jsg Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -23,7 +23,6 @@ #define CMD_DIRTY 0x0004 int Xreinit(const char *, struct mbr *); -int Xdisk(const char *, struct mbr *); int Xmanual(const char *, struct mbr *); int Xedit(const char *, struct mbr *); int Xsetpid(const char *, struct mbr *); diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index 8e8badfe0..55f10d95a 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.93 2023/06/20 11:52:08 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.94 2024/05/21 05:00:47 jsg Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -46,7 +46,6 @@ struct gpt_header gh; struct gpt_partition gp[NGPTPARTITIONS]; const struct gpt_partition * const *sort_gpt(void); -int lba_start_cmp(const void *e1, const void *e2); int lba_free(uint64_t *, uint64_t *); int add_partition(const uint8_t *, const char *, uint64_t); int find_partition(const uint8_t *); diff --git a/sbin/fsdb/fsdb.h b/sbin/fsdb/fsdb.h index eed054adc..c54031cb7 100644 --- a/sbin/fsdb/fsdb.h +++ b/sbin/fsdb/fsdb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fsdb.h,v 1.11 2014/08/10 02:38:24 guenther Exp $ */ +/* $OpenBSD: fsdb.h,v 1.12 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: fsdb.h,v 1.4 1996/09/28 19:30:36 christos Exp $ */ /*- @@ -32,7 +32,6 @@ extern int bread(int fd, char *buf, daddr_t blk, long size); extern void bwrite(int fd, char *buf, daddr_t blk, long size); -extern void rwerror(char *mesg, daddr_t blk); extern int reply(char *question); struct cmdtable { diff --git a/sbin/iked/control.c b/sbin/iked/control.c index d690af946..f37d4867e 100644 --- a/sbin/iked/control.c +++ b/sbin/iked/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.38 2024/01/24 10:09:07 tobhe Exp $ */ +/* $OpenBSD: control.c,v 1.39 2024/05/21 05:00:47 jsg Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -44,7 +44,6 @@ struct ctl_conn *control_connbyfd(int); void control_close(int, struct control_sock *); void control_dispatch_imsg(int, short, void *); -void control_dispatch_parent(int, short, void *); void control_imsg_forward(struct imsg *); void control_imsg_forward_peerid(struct imsg *); void control_run(struct privsep *, struct privsep_proc *, void *); diff --git a/sbin/isakmpd/app.h b/sbin/isakmpd/app.h index 96a2864e4..0bb073060 100644 --- a/sbin/isakmpd/app.h +++ b/sbin/isakmpd/app.h @@ -1,4 +1,4 @@ -/* $OpenBSD: app.h,v 1.7 2004/04/15 18:39:25 deraadt Exp $ */ +/* $OpenBSD: app.h,v 1.8 2024/05/21 05:00:47 jsg Exp $ */ /* $EOM: app.h,v 1.4 1999/04/02 00:58:16 niklas Exp $ */ /* @@ -35,7 +35,6 @@ extern int app_socket; extern int app_none; -extern void app_conf_init_hook(void); extern void app_handler(void); extern void app_init(void); diff --git a/sbin/isakmpd/if.h b/sbin/isakmpd/if.h index 82d574d96..0b555d52b 100644 --- a/sbin/isakmpd/if.h +++ b/sbin/isakmpd/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.7 2004/04/15 18:39:25 deraadt Exp $ */ +/* $OpenBSD: if.h,v 1.8 2024/05/21 05:00:47 jsg Exp $ */ /* $EOM: if.h,v 1.2 1998/07/07 23:35:58 niklas Exp $ */ /* @@ -35,9 +35,7 @@ #include struct ifreq; -struct ifconf; extern int if_map(int (*) (char *, struct sockaddr *, void *), void *); -extern int siocgifconf(struct ifconf *); #endif /* _IF_H_ */ diff --git a/sbin/isakmpd/ike_phase_1.h b/sbin/isakmpd/ike_phase_1.h index 1252664b7..a41bf33c7 100644 --- a/sbin/isakmpd/ike_phase_1.h +++ b/sbin/isakmpd/ike_phase_1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ike_phase_1.h,v 1.4 2004/04/15 18:39:25 deraadt Exp $ */ +/* $OpenBSD: ike_phase_1.h,v 1.5 2024/05/21 05:00:47 jsg Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. @@ -47,7 +47,6 @@ extern int ike_phase_1_responder_send_SA(struct message *); extern int ike_phase_1_responder_send_ID_AUTH(struct message *); extern int ike_phase_1_send_AUTH(struct message *); extern int ike_phase_1_send_ID(struct message *); -extern int ike_phase_1_send_ID_AUTH(struct message *); extern int ike_phase_1_send_KE_NONCE(struct message *, size_t); #endif /* _IKE_PHASE_1_H_ */ diff --git a/sbin/isakmpd/message.h b/sbin/isakmpd/message.h index 822eeb8cd..83223de39 100644 --- a/sbin/isakmpd/message.h +++ b/sbin/isakmpd/message.h @@ -1,4 +1,4 @@ -/* $OpenBSD: message.h,v 1.29 2018/01/15 09:54:48 mpi Exp $ */ +/* $OpenBSD: message.h,v 1.30 2024/05/21 05:00:47 jsg Exp $ */ /* $EOM: message.h,v 1.51 2000/10/10 12:36:39 provos Exp $ */ /* @@ -173,9 +173,6 @@ struct message { TAILQ_HEAD(msg_head, message); -/* The number of different ISAKMP payloads supported. */ -extern u_int8_t payload_index_max; - extern int message_add_payload(struct message *, u_int8_t, u_int8_t *, size_t, int); extern int message_add_sa_payload(struct message *); @@ -185,7 +182,6 @@ extern u_int8_t *message_copy(struct message *, size_t, size_t *); extern void message_drop(struct message *, int, struct proto *, int, int); extern void message_dump_raw(char *, struct message *, int); extern void message_free(struct message *); -extern void message_init(void); extern int message_negotiate_sa(struct message *, int (*)(struct exchange *, struct sa *, struct sa *)); extern int message_recv(struct message *); diff --git a/sbin/isakmpd/policy.h b/sbin/isakmpd/policy.h index ed4b1f530..35b206794 100644 --- a/sbin/isakmpd/policy.h +++ b/sbin/isakmpd/policy.h @@ -1,4 +1,4 @@ -/* $OpenBSD: policy.h,v 1.17 2007/08/05 09:43:09 tom Exp $ */ +/* $OpenBSD: policy.h,v 1.18 2024/05/21 05:00:47 jsg Exp $ */ /* $EOM: policy.h,v 1.12 2000/09/28 12:53:27 niklas Exp $ */ /* @@ -38,10 +38,7 @@ extern int ignore_policy; extern int policy_asserts_num; -extern int x509_policy_asserts_num; -extern int x509_policy_asserts_num_alloc; extern char **policy_asserts; -extern char **x509_policy_asserts; extern struct exchange *policy_exchange; extern struct sa *policy_sa; extern struct sa *policy_isakmp_sa; diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 51bc54502..0ca61b39e 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mountd.c,v 1.91 2023/03/02 16:58:43 millert Exp $ */ +/* $OpenBSD: mountd.c,v 1.92 2024/05/21 05:00:47 jsg Exp $ */ /* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */ /* @@ -181,7 +181,6 @@ void free_host(struct hostlist *); void new_exportlist(int signo); void get_exportlist(void); int get_host(char *, struct grouplist *, struct grouplist *); -int get_num(char *); struct hostlist *get_ht(void); int get_line(void); void get_mountlist(void); diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index 3c15c7e32..253b8242d 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.h,v 1.62 2020/01/15 22:38:31 kn Exp $ */ +/* $OpenBSD: pfctl.h,v 1.63 2024/05/19 10:39:40 jsg Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -56,7 +56,6 @@ struct pfr_anchoritem { SLIST_HEAD(pfr_anchors, pfr_anchoritem); -int pfr_get_fd(void); int pfr_clr_tables(struct pfr_table *, int *, int); int pfr_add_tables(struct pfr_table *, int, int *, int); int pfr_del_tables(struct pfr_table *, int, int *, int); @@ -80,7 +79,6 @@ int pfr_buf_grow(struct pfr_buffer *, int); int pfr_buf_load(struct pfr_buffer *, char *, int, int); char *pf_strerror(int); int pfi_get_ifaces(const char *, struct pfi_kif *, int *); -int pfi_clr_istats(const char *, int *, int); void pfctl_print_title(char *); int pfctl_clear_tables(const char *, int); diff --git a/sbin/pfctl/pfctl_queue.c b/sbin/pfctl/pfctl_queue.c index 399f0f75a..1f0d45630 100644 --- a/sbin/pfctl/pfctl_queue.c +++ b/sbin/pfctl/pfctl_queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_queue.c,v 1.7 2019/06/28 13:32:45 deraadt Exp $ */ +/* $OpenBSD: pfctl_queue.c,v 1.8 2024/05/19 10:39:40 jsg Exp $ */ /* * Copyright (c) 2003 - 2013 Henning Brauer @@ -66,8 +66,6 @@ void pfctl_insert_queue_node(const struct pf_queuespec, struct pfctl_queue_node *pfctl_find_queue_node(const char *, const char *); void pfctl_print_queue_node(int, struct pfctl_queue_node *, int); -void print_qstats(struct queue_stats); -void pfctl_free_queue_node(struct pfctl_queue_node *); void pfctl_print_queue_nodestat(int, const struct pfctl_queue_node *); void update_avg(struct queue_stats *); diff --git a/sbin/pflogd/pflogd.h b/sbin/pflogd/pflogd.h index 26633d69f..f31b93a8d 100644 --- a/sbin/pflogd/pflogd.h +++ b/sbin/pflogd/pflogd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pflogd.h,v 1.7 2017/09/09 13:02:52 brynet Exp $ */ +/* $OpenBSD: pflogd.h,v 1.8 2024/05/21 05:00:47 jsg Exp $ */ /* * Copyright (c) 2003 Can Erkin Acar @@ -38,8 +38,6 @@ void priv_init(int, int, char **); int priv_init_pcap(int); int priv_set_snaplen(int snaplen); int priv_open_log(void); -int priv_move_log(void); -int priv_pcap_stats(struct pcap_stat *); int init_pcap(void); void set_pcap_filter(void); diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c index bbcd03eba..ccbc977eb 100644 --- a/sbin/unwind/frontend.c +++ b/sbin/unwind/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.80 2023/12/14 09:59:27 claudio Exp $ */ +/* $OpenBSD: frontend.c,v 1.81 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -144,7 +144,6 @@ void handle_route_message(struct rt_msghdr *, struct sockaddr **); void get_rtaddrs(int, struct sockaddr *, struct sockaddr **); -void rtmget_default(void); struct pending_query *find_pending_query(uint64_t); void parse_trust_anchor(struct trust_anchor_head *, int); void send_trust_anchors(struct trust_anchor_head *); diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c index 0c9aff8bb..5f025443c 100644 --- a/sbin/unwind/resolver.c +++ b/sbin/unwind/resolver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolver.c,v 1.165 2024/05/10 15:02:26 florian Exp $ */ +/* $OpenBSD: resolver.c,v 1.166 2024/05/21 05:00:48 jsg Exp $ */ /* @@ -181,8 +181,6 @@ void show_status(pid_t); void show_autoconf(pid_t); void show_mem(pid_t); void send_resolver_info(struct uw_resolver *, pid_t); -void send_detailed_resolver_info(struct uw_resolver *, - pid_t); void trust_anchor_resolve(void); void trust_anchor_timo(int, short, void *); void trust_anchor_resolve_done(struct uw_resolver *, void *, diff --git a/share/man/man7/mdoc.7 b/share/man/man7/mdoc.7 index 2ca9cc50f..485c9e9de 100644 --- a/share/man/man7/mdoc.7 +++ b/share/man/man7/mdoc.7 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mdoc.7,v 1.181 2022/01/13 08:39:24 schwarze Exp $ +.\" $OpenBSD: mdoc.7,v 1.183 2024/05/20 18:40:53 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons .\" Copyright (c) 2010, 2011, 2013-2020 Ingo Schwarze @@ -15,7 +15,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: January 13 2022 $ +.Dd $Mdocdate: May 20 2024 $ .Dt MDOC 7 .Os .Sh NAME @@ -439,7 +439,7 @@ in the alphabetical .Bl -column "Brq, Bro, Brc" description .It Ic \&Dd Ta document date: Cm $\&Mdocdate$ | Ar month day , year .It Ic \&Dt Ta document title: Ar TITLE section Op Ar arch -.It Ic \&Os Ta operating system version: Op Ar system Op Ar version +.It Ic \&Os Ta operating system footer: Op Ar footer text .It Ic \&Nm Ta document name (one argument) .It Ic \&Nd Ta document description (one line) .El @@ -1015,7 +1015,7 @@ A numbered list. No item heads can be specified. Formatted like .Fl bullet , -except that cardinal numbers are used in place of bullets, +except that ordinal numbers are used in place of bullets, starting at 1. .It Fl hang Like @@ -2087,31 +2087,28 @@ Examples: See also .Ic \&Oo . .Tg Os -.It Ic \&Os Op Ar system Op Ar version -Operating system version for display in the page footer. -This is the mandatory third macro of -any +.It Ic \&Os Op Ar footer text +The mandatory third macro of every .Nm file. +Usually, do not specify any arguments, +in particular not the operating system name and/or version. .Pp -The optional -.Ar system -parameter specifies the relevant operating system or environment. -It is suggested to leave it unspecified, in which case +If no argument is given, .Xr mandoc 1 -uses its +prints its .Fl Ios -argument or, if that isn't specified either, +argument in the page footer, or .Fa sysname and .Fa release as returned by -.Xr uname 3 . +.Xr uname 3 +by default. .Pp -Examples: -.Dl \&.Os -.Dl \&.Os KTH/CSC/TCS -.Dl \&.Os BSD 4.3 +Manual pages that are part of a portable software project can override +the default by giving the project name and version number as arguments, +but leaving it blank is never a bad choice. .Pp See also .Ic \&Dd diff --git a/share/man/man9/pool.9 b/share/man/man9/pool.9 index a4bdd8ea2..7880076e9 100644 --- a/share/man/man9/pool.9 +++ b/share/man/man9/pool.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pool.9,v 1.59 2020/09/25 14:20:20 deraadt Exp $ +.\" $OpenBSD: pool.9,v 1.60 2024/05/20 11:12:08 jca Exp $ .\" $NetBSD: pool.9,v 1.18 2001/06/21 11:59:01 wiz Exp $ .\" .\" Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: September 25 2020 $ +.Dd $Mdocdate: May 20 2024 $ .Dt POOL_INIT 9 .Os .Sh NAME @@ -276,9 +276,6 @@ The handle identifying the pool resource instance. The minimum number of items to keep in the pool. The number of pages in the pool will not decrease below the required value to accommodate the minimum number of items specified by this function. -Unlike -.Fn pool_prime , -this function does not allocate the necessary memory up-front. .El .Ss SETTING HARD LIMITS The function diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 758950f4e..57e3c6221 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.169 2024/05/12 16:49:38 guenther Exp $ */ +/* $OpenBSD: cpu.h,v 1.170 2024/05/21 23:16:06 jsg Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -428,7 +428,6 @@ void lgdt(struct region_descriptor *); struct pcb; void savectx(struct pcb *); -void switch_exit(struct proc *, void (*)(struct proc *)); void proc_trampoline(void); /* clock.c */ diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 82b7e1798..72e7d3381 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.188 2024/05/01 12:54:27 mpi Exp $ */ +/* $OpenBSD: cpu.h,v 1.189 2024/05/21 23:16:06 jsg Exp $ */ /* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */ /*- @@ -418,7 +418,6 @@ void lgdt(struct region_descriptor *); struct pcb; void savectx(struct pcb *); -void switch_exit(struct proc *); void proc_trampoline(void); /* clock.c */ diff --git a/sys/dev/ic/ufshci.c b/sys/dev/ic/ufshci.c index af352c247..15f95f730 100644 --- a/sys/dev/ic/ufshci.c +++ b/sys/dev/ic/ufshci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufshci.c,v 1.24 2024/05/16 10:52:11 mglocker Exp $ */ +/* $OpenBSD: ufshci.c,v 1.29 2024/05/21 18:19:22 mglocker Exp $ */ /* * Copyright (c) 2022 Marcus Glocker @@ -125,11 +125,6 @@ ufshci_intr(void *arg) if (status & UFSHCI_REG_IS_UTRCS) { DPRINTF(3, "%s: UTRCS interrupt\n", __func__); - /* Reset Interrupt Aggregation Counter and Timer. */ - UFSHCI_WRITE_4(sc, UFSHCI_REG_UTRIACR, - UFSHCI_REG_UTRIACR_IAEN | UFSHCI_REG_UTRIACR_CTR); - sc->sc_intraggr_enabled = 0; - ufshci_xfer_complete(sc); handled = 1; @@ -186,17 +181,38 @@ ufshci_attach(struct ufshci_softc *sc) DPRINTF(1, " BI=0x%04x\n", UFSHCI_REG_HCMID_BI(sc->sc_hcmid)); DPRINTF(1, " MIC=0x%04x\n", UFSHCI_REG_HCMID_MIC(sc->sc_hcmid)); - if (sc->sc_nutrs > 32) { - printf("%s: NUTRS can't be >32 (is %d)!\n", - sc->sc_dev.dv_xname, sc->sc_nutrs); + if (sc->sc_nutrs < UFSHCI_SLOTS_MIN || + sc->sc_nutrs > UFSHCI_SLOTS_MAX) { + printf("%s: Invalid NUTRS value %d (must be %d-%d)!\n", + sc->sc_dev.dv_xname, sc->sc_nutrs, + UFSHCI_SLOTS_MIN, UFSHCI_SLOTS_MAX); return 1; - } else if (sc->sc_nutrs == 1) { - sc->sc_iacth = sc->sc_nutrs; - } else if (sc->sc_nutrs > 1) { - sc->sc_iacth = sc->sc_nutrs - 1; } + if (sc->sc_nutrs == UFSHCI_SLOTS_MAX) + sc->sc_iacth = UFSHCI_INTR_AGGR_COUNT_MAX; + else + sc->sc_iacth = sc->sc_nutrs; DPRINTF(1, "Intr. aggr. counter threshold:\nIACTH=%d\n", sc->sc_iacth); + /* + * XXX: + * At the moment normal interrupts work better for us than interrupt + * aggregation, because: + * + * 1. With interrupt aggregation enabled, the I/O performance + * isn't better, but even slightly worse depending on the + * UFS controller and architecture. + * 2. With interrupt aggregation enabled we currently see + * intermittent SCSI command stalling. Probably there is a + * race condition where new SCSI commands are getting + * scheduled, while we miss to reset the interrupt aggregation + * counter/timer, which leaves us with no more interrupts + * triggered. This needs to be fixed, but I couldn't figure + * out yet how. + */ +#if 0 + sc->sc_flags |= UFSHCI_FLAGS_AGGR_INTR; /* Enable intr. aggregation */ +#endif ufshci_init(sc); if (ufshci_ccb_alloc(sc, sc->sc_nutrs) != 0) { @@ -233,6 +249,7 @@ ufshci_reset(struct ufshci_softc *sc) * Reset and enable host controller */ UFSHCI_WRITE_4(sc, UFSHCI_REG_HCE, UFSHCI_REG_HCE_HCE); + /* 7.1.1 Host Controller Initialization: 3) */ for (i = 0; i < retry; i++) { hce = UFSHCI_READ_4(sc, UFSHCI_REG_HCE); @@ -290,7 +307,8 @@ ufshci_dmamem_alloc(struct ufshci_softc *sc, size_t size) udm->udm_size = size; if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, - BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW | BUS_DMA_64BIT, + BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW | + (sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0, &udm->udm_map) != 0) goto udmfree; @@ -345,7 +363,6 @@ ufshci_init(struct ufshci_softc *sc) */ /* 7.1.1 Host Controller Initialization: 5) */ - //UFSHCI_WRITE_4(sc, UFSHCI_REG_IE, UFSHCI_REG_IE_UCCE | UFSHCI_WRITE_4(sc, UFSHCI_REG_IE, UFSHCI_REG_IE_UTRCE | UFSHCI_REG_IE_UTMRCE); @@ -371,8 +388,16 @@ ufshci_init(struct ufshci_softc *sc) */ /* 7.1.1 Host Controller Initialization: 11) */ - reg = UFSHCI_READ_4(sc, UFSHCI_REG_UTRIACR); - DPRINTF(2, "%s: UTRIACR=0x%08x\n", __func__, reg); + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) { + UFSHCI_WRITE_4(sc, UFSHCI_REG_UTRIACR, + UFSHCI_REG_UTRIACR_IAEN | + UFSHCI_REG_UTRIACR_IAPWEN | + UFSHCI_REG_UTRIACR_CTR | + UFSHCI_REG_UTRIACR_IACTH(sc->sc_iacth) | + UFSHCI_REG_UTRIACR_IATOVAL(UFSHCI_INTR_AGGR_TIMEOUT)); + } else { + UFSHCI_WRITE_4(sc, UFSHCI_REG_UTRIACR, 0); + } /* * 7.1.1 Host Controller Initialization: 12) @@ -496,7 +521,10 @@ ufshci_utr_cmd_nop(struct ufshci_softc *sc, struct ufshci_ccb *ccb, utrd->dw0 |= UFSHCI_UTRD_DW0_DD_NO; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2c) */ - utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) + utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + else + utrd->dw0 |= UFSHCI_UTRD_DW0_I_INT; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2d) */ utrd->dw2 = UFSHCI_UTRD_DW2_OCS_IOV; @@ -586,7 +614,10 @@ ufshci_utr_cmd_lun(struct ufshci_softc *sc, struct ufshci_ccb *ccb, utrd->dw0 |= UFSHCI_UTRD_DW0_DD_T2I; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2c) */ - utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) + utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + else + utrd->dw0 |= UFSHCI_UTRD_DW0_I_INT; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2d) */ utrd->dw2 = UFSHCI_UTRD_DW2_OCS_IOV; @@ -693,7 +724,10 @@ ufshci_utr_cmd_inquiry(struct ufshci_softc *sc, struct ufshci_ccb *ccb, utrd->dw0 |= UFSHCI_UTRD_DW0_DD_T2I; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2c) */ - utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) + utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + else + utrd->dw0 |= UFSHCI_UTRD_DW0_I_INT; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2d) */ utrd->dw2 = UFSHCI_UTRD_DW2_OCS_IOV; @@ -798,7 +832,10 @@ ufshci_utr_cmd_capacity16(struct ufshci_softc *sc, struct ufshci_ccb *ccb, utrd->dw0 |= UFSHCI_UTRD_DW0_DD_T2I; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2c) */ - utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) + utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + else + utrd->dw0 |= UFSHCI_UTRD_DW0_I_INT; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2d) */ utrd->dw2 = UFSHCI_UTRD_DW2_OCS_IOV; @@ -907,7 +944,10 @@ ufshci_utr_cmd_capacity(struct ufshci_softc *sc, struct ufshci_ccb *ccb, utrd->dw0 |= UFSHCI_UTRD_DW0_DD_T2I; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2c) */ - utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) + utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + else + utrd->dw0 |= UFSHCI_UTRD_DW0_I_INT; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2d) */ utrd->dw2 = UFSHCI_UTRD_DW2_OCS_IOV; @@ -1020,7 +1060,10 @@ ufshci_utr_cmd_io(struct ufshci_softc *sc, struct ufshci_ccb *ccb, utrd->dw0 |= UFSHCI_UTRD_DW0_DD_I2T; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2c) */ - utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) + utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + else + utrd->dw0 |= UFSHCI_UTRD_DW0_I_INT; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2d) */ utrd->dw2 = UFSHCI_UTRD_DW2_OCS_IOV; @@ -1134,7 +1177,10 @@ ufshci_utr_cmd_sync(struct ufshci_softc *sc, struct ufshci_ccb *ccb, utrd->dw0 |= UFSHCI_UTRD_DW0_DD_I2T; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2c) */ - utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) + utrd->dw0 |= UFSHCI_UTRD_DW0_I_REG; + else + utrd->dw0 |= UFSHCI_UTRD_DW0_I_INT; /* 7.2.1 Basic Steps when Building a UTP Transfer Request: 2d) */ utrd->dw2 = UFSHCI_UTRD_DW2_OCS_IOV; @@ -1247,6 +1293,13 @@ ufshci_xfer_complete(struct ufshci_softc *sc) DPRINTF(3, "slot %d completed\n", i); } + + /* 7.2.3: Reset Interrupt Aggregation Counter and Timer 4) */ + if (sc->sc_flags & UFSHCI_FLAGS_AGGR_INTR) { + UFSHCI_WRITE_4(sc, UFSHCI_REG_UTRIACR, + UFSHCI_REG_UTRIACR_IAEN | UFSHCI_REG_UTRIACR_CTR); + } + mtx_leave(&sc->sc_cmd_mtx); /* @@ -1287,7 +1340,8 @@ ufshci_ccb_alloc(struct ufshci_softc *sc, int nccbs) if (bus_dmamap_create(sc->sc_dmat, UFSHCI_UCD_PRDT_MAX_XFER, UFSHCI_UCD_PRDT_MAX_SEGS, UFSHCI_UCD_PRDT_MAX_XFER, 0, - BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW | BUS_DMA_64BIT, + BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW | + (sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0, &ccb->ccb_dmamap) != 0) goto free_maps; @@ -1361,17 +1415,6 @@ ufshci_scsi_cmd(struct scsi_xfer *xs) DPRINTF(3, "%s: cmd=0x%x\n", __func__, xs->cmd.opcode); - /* Schedule interrupt aggregation. */ - if (ISSET(xs->flags, SCSI_POLL) == 0 && sc->sc_intraggr_enabled == 0) { - UFSHCI_WRITE_4(sc, UFSHCI_REG_UTRIACR, - UFSHCI_REG_UTRIACR_IAEN | - UFSHCI_REG_UTRIACR_IAPWEN | - UFSHCI_REG_UTRIACR_CTR | - UFSHCI_REG_UTRIACR_IACTH(sc->sc_iacth) | - UFSHCI_REG_UTRIACR_IATOVAL(UFSHCI_INTR_AGGR_TIMEOUT)); - sc->sc_intraggr_enabled = 1; - } - switch (xs->cmd.opcode) { case READ_COMMAND: @@ -1381,7 +1424,6 @@ ufshci_scsi_cmd(struct scsi_xfer *xs) DPRINTF(3, "io read\n"); ufshci_scsi_io(xs, SCSI_DATA_IN); break; - case WRITE_COMMAND: case WRITE_10: case WRITE_12: @@ -1389,17 +1431,14 @@ ufshci_scsi_cmd(struct scsi_xfer *xs) DPRINTF(3, "io write\n"); ufshci_scsi_io(xs, SCSI_DATA_OUT); break; - case SYNCHRONIZE_CACHE: DPRINTF(3, "sync\n"); ufshci_scsi_sync(xs); break; - case INQUIRY: DPRINTF(3, "inquiry\n"); ufshci_scsi_inquiry(xs); break; - case READ_CAPACITY_16: DPRINTF(3, "capacity16\n"); ufshci_scsi_capacity16(xs); @@ -1408,7 +1447,6 @@ ufshci_scsi_cmd(struct scsi_xfer *xs) DPRINTF(3, "capacity\n"); ufshci_scsi_capacity(xs); break; - case TEST_UNIT_READY: case PREVENT_ALLOW: case START_STOP: diff --git a/sys/dev/ic/ufshcireg.h b/sys/dev/ic/ufshcireg.h index 741ecd1fe..bb1991ed7 100644 --- a/sys/dev/ic/ufshcireg.h +++ b/sys/dev/ic/ufshcireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ufshcireg.h,v 1.9 2024/05/16 10:52:11 mglocker Exp $ */ +/* $OpenBSD: ufshcireg.h,v 1.10 2024/05/20 20:08:04 mglocker Exp $ */ /* * Copyright (c) 2022 Marcus Glocker @@ -22,7 +22,9 @@ #define UFSHCI_UCD_PRDT_MAX_SEGS 64 #define UFSHCI_UCD_PRDT_MAX_XFER (UFSHCI_UCD_PRDT_MAX_SEGS * PAGE_SIZE) #define UFSHCI_INTR_AGGR_TIMEOUT 0x08 /* 320us (1 unit = 40us) */ -#define UFSHCI_MAX_UNITS 32 +#define UFSHCI_INTR_AGGR_COUNT_MAX 31 +#define UFSHCI_SLOTS_MIN 1 +#define UFSHCI_SLOTS_MAX 32 #define UFSHCI_LBS 4096 /* UFS Logical Block Size: For UFS minimum size shall be 4096 bytes */ diff --git a/sys/dev/ic/ufshcivar.h b/sys/dev/ic/ufshcivar.h index 7a4816a76..81e5bb2e1 100644 --- a/sys/dev/ic/ufshcivar.h +++ b/sys/dev/ic/ufshcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ufshcivar.h,v 1.5 2024/05/15 20:15:33 mglocker Exp $ */ +/* $OpenBSD: ufshcivar.h,v 1.7 2024/05/20 12:42:45 mglocker Exp $ */ /* * Copyright (c) 2022 Marcus Glocker @@ -57,10 +57,11 @@ struct ufshci_softc { bus_size_t sc_ios; bus_dma_tag_t sc_dmat; - uint8_t sc_intraggr_enabled; uint8_t sc_iacth; struct mutex sc_cmd_mtx; +#define UFSHCI_FLAGS_AGGR_INTR 1 + uint8_t sc_flags; uint32_t sc_ver; uint32_t sc_cap; uint32_t sc_hcpid; diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_job.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_job.c index 78476bc75..de9d7f3dc 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_job.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_job.c @@ -300,12 +300,15 @@ static struct dma_fence *amdgpu_job_run(struct drm_sched_job *sched_job) dma_fence_set_error(finished, -ECANCELED); if (finished->error < 0) { - DRM_INFO("Skip scheduling IBs!\n"); + dev_dbg(adev->dev, "Skip scheduling IBs in ring(%s)", + ring->name); } else { r = amdgpu_ib_schedule(ring, job->num_ibs, job->ibs, job, &fence); if (r) - DRM_ERROR("Error scheduling IBs (%d)\n", r); + dev_err(adev->dev, + "Error scheduling IBs (%d) in ring(%s)", r, + ring->name); } job->job_run_counter++; diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c index 1c24d4ac1..f4f80f6ec 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c @@ -1269,14 +1269,18 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, * amdgpu_bo_move_notify - notification about a memory move * @bo: pointer to a buffer object * @evict: if this move is evicting the buffer from the graphics address space + * @new_mem: new resource for backing the BO * * Marks the corresponding &amdgpu_bo buffer object as invalid, also performs * bookkeeping. * TTM driver callback which is called when ttm moves a buffer. */ -void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict) +void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, + bool evict, + struct ttm_resource *new_mem) { struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); + struct ttm_resource *old_mem = bo->resource; struct amdgpu_bo *abo; if (!amdgpu_bo_is_amdgpu_bo(bo)) @@ -1289,13 +1293,13 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict) #ifdef notyet if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && - bo->resource->mem_type != TTM_PL_SYSTEM) + old_mem && old_mem->mem_type != TTM_PL_SYSTEM) dma_buf_move_notify(abo->tbo.base.dma_buf); #endif - - /* remember the eviction */ - if (evict) - atomic64_inc(&adev->num_evictions); + + /* move_notify is called before move happens */ + trace_amdgpu_bo_move(abo, new_mem ? new_mem->mem_type : -1, + old_mem ? old_mem->mem_type : -1); } void amdgpu_bo_get_memory(struct amdgpu_bo *bo, diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.h b/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.h index 97c33ee13..b972f30ef 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.h +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.h @@ -329,7 +329,9 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata, int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, size_t buffer_size, uint32_t *metadata_size, uint64_t *flags); -void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict); +void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, + bool evict, + struct ttm_resource *new_mem); void amdgpu_bo_release_notify(struct ttm_buffer_object *bo); vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo); void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence, diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c index 6b9f0b7c0..bd04f289e 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c @@ -424,7 +424,7 @@ bool amdgpu_res_cpu_visible(struct amdgpu_device *adev, return false; if (res->mem_type == TTM_PL_SYSTEM || res->mem_type == TTM_PL_TT || - res->mem_type == AMDGPU_PL_PREEMPT) + res->mem_type == AMDGPU_PL_PREEMPT || res->mem_type == AMDGPU_PL_DOORBELL) return true; if (res->mem_type != TTM_PL_VRAM) @@ -432,7 +432,7 @@ bool amdgpu_res_cpu_visible(struct amdgpu_device *adev, amdgpu_res_first(res, 0, res->size, &cursor); while (cursor.remaining) { - if ((cursor.start + cursor.size) >= adev->gmc.visible_vram_size) + if ((cursor.start + cursor.size) > adev->gmc.visible_vram_size) return false; amdgpu_res_next(&cursor, cursor.size); } @@ -486,14 +486,16 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL)) { + amdgpu_bo_move_notify(bo, evict, new_mem); ttm_bo_move_null(bo, new_mem); - goto out; + return 0; } if (old_mem->mem_type == TTM_PL_SYSTEM && (new_mem->mem_type == TTM_PL_TT || new_mem->mem_type == AMDGPU_PL_PREEMPT)) { + amdgpu_bo_move_notify(bo, evict, new_mem); ttm_bo_move_null(bo, new_mem); - goto out; + return 0; } if ((old_mem->mem_type == TTM_PL_TT || old_mem->mem_type == AMDGPU_PL_PREEMPT) && @@ -503,9 +505,10 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, return r; amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm); + amdgpu_bo_move_notify(bo, evict, new_mem); ttm_resource_free(bo, &bo->resource); ttm_bo_assign_mem(bo, new_mem); - goto out; + return 0; } if (old_mem->mem_type == AMDGPU_PL_GDS || @@ -517,8 +520,9 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, new_mem->mem_type == AMDGPU_PL_OA || new_mem->mem_type == AMDGPU_PL_DOORBELL) { /* Nothing to save here */ + amdgpu_bo_move_notify(bo, evict, new_mem); ttm_bo_move_null(bo, new_mem); - goto out; + return 0; } if (bo->type == ttm_bo_type_device && @@ -530,23 +534,24 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; } - if (adev->mman.buffer_funcs_enabled) { - if (((old_mem->mem_type == TTM_PL_SYSTEM && - new_mem->mem_type == TTM_PL_VRAM) || - (old_mem->mem_type == TTM_PL_VRAM && - new_mem->mem_type == TTM_PL_SYSTEM))) { - hop->fpfn = 0; - hop->lpfn = 0; - hop->mem_type = TTM_PL_TT; - hop->flags = TTM_PL_FLAG_TEMPORARY; - return -EMULTIHOP; - } - - r = amdgpu_move_blit(bo, evict, new_mem, old_mem); - } else { - r = -ENODEV; + if (adev->mman.buffer_funcs_enabled && + ((old_mem->mem_type == TTM_PL_SYSTEM && + new_mem->mem_type == TTM_PL_VRAM) || + (old_mem->mem_type == TTM_PL_VRAM && + new_mem->mem_type == TTM_PL_SYSTEM))) { + hop->fpfn = 0; + hop->lpfn = 0; + hop->mem_type = TTM_PL_TT; + hop->flags = TTM_PL_FLAG_TEMPORARY; + return -EMULTIHOP; } + amdgpu_bo_move_notify(bo, evict, new_mem); + if (adev->mman.buffer_funcs_enabled) + r = amdgpu_move_blit(bo, evict, new_mem, old_mem); + else + r = -ENODEV; + if (r) { /* Check that all memory is CPU accessible */ if (!amdgpu_res_copyable(adev, old_mem) || @@ -560,11 +565,10 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, return r; } - trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type); -out: - /* update statistics */ + /* update statistics after the move */ + if (evict) + atomic64_inc(&adev->num_evictions); atomic64_add(bo->base.size, &adev->num_bytes_moved); - amdgpu_bo_move_notify(bo, evict); return 0; } @@ -1605,7 +1609,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, static void amdgpu_bo_delete_mem_notify(struct ttm_buffer_object *bo) { - amdgpu_bo_move_notify(bo, false); + amdgpu_bo_move_notify(bo, false, NULL); } static struct ttm_device_funcs amdgpu_bo_driver = { diff --git a/sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c b/sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c index d0fc62784..0284c9198 100644 --- a/sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c +++ b/sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c @@ -61,6 +61,11 @@ void aqua_vanjaram_doorbell_index_init(struct amdgpu_device *adev) adev->doorbell_index.max_assignment = AMDGPU_DOORBELL_LAYOUT1_MAX_ASSIGNMENT << 1; } +static bool aqua_vanjaram_xcp_vcn_shared(struct amdgpu_device *adev) +{ + return (adev->xcp_mgr->num_xcps > adev->vcn.num_vcn_inst); +} + static void aqua_vanjaram_set_xcp_id(struct amdgpu_device *adev, uint32_t inst_idx, struct amdgpu_ring *ring) { @@ -86,7 +91,7 @@ static void aqua_vanjaram_set_xcp_id(struct amdgpu_device *adev, case AMDGPU_RING_TYPE_VCN_ENC: case AMDGPU_RING_TYPE_VCN_JPEG: ip_blk = AMDGPU_XCP_VCN; - if (adev->xcp_mgr->mode == AMDGPU_CPX_PARTITION_MODE) + if (aqua_vanjaram_xcp_vcn_shared(adev)) inst_mask = 1 << (inst_idx * 2); break; default: @@ -139,10 +144,12 @@ static int aqua_vanjaram_xcp_sched_list_update( aqua_vanjaram_xcp_gpu_sched_update(adev, ring, ring->xcp_id); - /* VCN is shared by two partitions under CPX MODE */ + /* VCN may be shared by two partitions under CPX MODE in certain + * configs. + */ if ((ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC || - ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG) && - adev->xcp_mgr->mode == AMDGPU_CPX_PARTITION_MODE) + ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG) && + aqua_vanjaram_xcp_vcn_shared(adev)) aqua_vanjaram_xcp_gpu_sched_update(adev, ring, ring->xcp_id + 1); } diff --git a/sys/dev/pci/drm/amd/amdgpu/sdma_v4_4_2.c b/sys/dev/pci/drm/amd/amdgpu/sdma_v4_4_2.c index a8f2d889d..f624b1bd4 100644 --- a/sys/dev/pci/drm/amd/amdgpu/sdma_v4_4_2.c +++ b/sys/dev/pci/drm/amd/amdgpu/sdma_v4_4_2.c @@ -1613,19 +1613,9 @@ static int sdma_v4_4_2_set_ecc_irq_state(struct amdgpu_device *adev, u32 sdma_cntl; sdma_cntl = RREG32_SDMA(type, regSDMA_CNTL); - switch (state) { - case AMDGPU_IRQ_STATE_DISABLE: - sdma_cntl = REG_SET_FIELD(sdma_cntl, SDMA_CNTL, - DRAM_ECC_INT_ENABLE, 0); - WREG32_SDMA(type, regSDMA_CNTL, sdma_cntl); - break; - /* sdma ecc interrupt is enabled by default - * driver doesn't need to do anything to - * enable the interrupt */ - case AMDGPU_IRQ_STATE_ENABLE: - default: - break; - } + sdma_cntl = REG_SET_FIELD(sdma_cntl, SDMA_CNTL, DRAM_ECC_INT_ENABLE, + state == AMDGPU_IRQ_STATE_ENABLE ? 1 : 0); + WREG32_SDMA(type, regSDMA_CNTL, sdma_cntl); return 0; } diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c b/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c index 4fbdc942c..010e4af4e 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c @@ -1138,7 +1138,7 @@ static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep, goto err_unlock; } offset = dev->adev->rmmio_remap.bus_addr; - if (!offset) { + if (!offset || (PAGE_SIZE > 4096)) { err = -ENOMEM; goto err_unlock; } @@ -1516,7 +1516,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep, /* Find a KFD GPU device that supports the get_dmabuf_info query */ for (i = 0; kfd_topology_enum_kfd_devices(i, &dev) == 0; i++) - if (dev) + if (dev && !kfd_devcgroup_check_permission(dev)) break; if (!dev) return -EINVAL; @@ -1538,7 +1538,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep, if (xcp_id >= 0) args->gpu_id = dmabuf_adev->kfd.dev->nodes[xcp_id]->id; else - args->gpu_id = dmabuf_adev->kfd.dev->nodes[0]->id; + args->gpu_id = dev->id; args->flags = flags; /* Copy metadata buffer to user mode */ @@ -2307,7 +2307,7 @@ static int criu_restore_memory_of_gpu(struct kfd_process_device *pdd, return -EINVAL; } offset = pdd->dev->adev->rmmio_remap.bus_addr; - if (!offset) { + if (!offset || (PAGE_SIZE > 4096)) { pr_err("amdgpu_amdkfd_get_mmio_remap_phys_addr failed\n"); return -ENOMEM; } @@ -3348,6 +3348,9 @@ static int kfd_mmio_mmap(struct kfd_node *dev, struct kfd_process *process, if (vma->vm_end - vma->vm_start != PAGE_SIZE) return -EINVAL; + if (PAGE_SIZE > 4096) + return -EINVAL; + address = dev->adev->rmmio_remap.bus_addr; vm_flags_set(vma, VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE | diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_device.c b/sys/dev/pci/drm/amd/amdkfd/kfd_device.c index 93ce181eb..913c70a0e 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_device.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_device.c @@ -935,7 +935,6 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm) { struct kfd_node *node; int i; - int count; if (!kfd->init_complete) return; @@ -943,12 +942,10 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm) /* for runtime suspend, skip locking kfd */ if (!run_pm) { mutex_lock(&kfd_processes_mutex); - count = ++kfd_locked; - mutex_unlock(&kfd_processes_mutex); - /* For first KFD device suspend all the KFD processes */ - if (count == 1) + if (++kfd_locked == 1) kfd_suspend_all_processes(); + mutex_unlock(&kfd_processes_mutex); } for (i = 0; i < kfd->num_nodes; i++) { @@ -959,7 +956,7 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm) int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm) { - int ret, count, i; + int ret, i; if (!kfd->init_complete) return 0; @@ -973,12 +970,10 @@ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm) /* for runtime resume, skip unlocking kfd */ if (!run_pm) { mutex_lock(&kfd_processes_mutex); - count = --kfd_locked; - mutex_unlock(&kfd_processes_mutex); - - WARN_ONCE(count < 0, "KFD suspend / resume ref. error"); - if (count == 0) + if (--kfd_locked == 0) ret = kfd_resume_all_processes(); + WARN_ONCE(kfd_locked < 0, "KFD suspend / resume ref. error"); + mutex_unlock(&kfd_processes_mutex); } return ret; diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c index a7697ec81..f85ca6cb9 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c @@ -336,7 +336,8 @@ static void event_interrupt_wq_v10(struct kfd_node *dev, break; } kfd_signal_event_interrupt(pasid, context_id0 & 0x7fffff, 23); - } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) { + } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && + KFD_DBG_EC_TYPE_IS_PACKET(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0))) { kfd_set_dbg_ev_from_interrupt(dev, pasid, KFD_DEBUG_DOORBELL_ID(context_id0), KFD_EC_MASK(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0)), diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c index 2a65792fd..3ca9c160d 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c @@ -325,7 +325,8 @@ static void event_interrupt_wq_v11(struct kfd_node *dev, /* CP */ if (source_id == SOC15_INTSRC_CP_END_OF_PIPE) kfd_signal_event_interrupt(pasid, context_id0, 32); - else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) + else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && + KFD_DBG_EC_TYPE_IS_PACKET(KFD_CTXID0_CP_BAD_OP_ECODE(context_id0))) kfd_set_dbg_ev_from_interrupt(dev, pasid, KFD_CTXID0_DOORBELL_ID(context_id0), KFD_EC_MASK(KFD_CTXID0_CP_BAD_OP_ECODE(context_id0)), diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c index 27cdaea40..8a6729939 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c @@ -385,7 +385,8 @@ static void event_interrupt_wq_v9(struct kfd_node *dev, break; } kfd_signal_event_interrupt(pasid, sq_int_data, 24); - } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) { + } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && + KFD_DBG_EC_TYPE_IS_PACKET(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0))) { kfd_set_dbg_ev_from_interrupt(dev, pasid, KFD_DEBUG_DOORBELL_ID(context_id0), KFD_EC_MASK(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0)), diff --git a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 7b4824232..ff3730cd7 100644 --- a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2978,6 +2978,10 @@ static int dm_resume(void *handle) /* Do mst topology probing after resuming cached state*/ drm_connector_list_iter_begin(ddev, &iter); drm_for_each_connector_iter(connector, &iter) { + + if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK) + continue; + aconnector = to_amdgpu_dm_connector(connector); if (aconnector->dc_link->type != dc_connection_mst_branch || aconnector->mst_root) @@ -5760,6 +5764,9 @@ get_highest_refresh_rate_mode(struct amdgpu_dm_connector *aconnector, &aconnector->base.probed_modes : &aconnector->base.modes; + if (aconnector->base.connector_type == DRM_MODE_CONNECTOR_WRITEBACK) + return NULL; + if (aconnector->freesync_vid_base.clock != 0) return &aconnector->freesync_vid_base; @@ -8451,6 +8458,9 @@ static void amdgpu_dm_commit_audio(struct drm_device *dev, continue; notify: + if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK) + continue; + aconnector = to_amdgpu_dm_connector(connector); mutex_lock(&adev->dm.audio_lock); diff --git a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 045b11615..c92b4bc99 100644 --- a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -1465,7 +1465,9 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -1566,7 +1568,9 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -1651,7 +1655,9 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -1750,7 +1756,9 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -1835,7 +1843,9 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -1934,7 +1944,9 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -2015,7 +2027,9 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -2111,7 +2125,9 @@ static ssize_t dp_dsc_bits_per_pixel_write(struct file *f, const char __user *bu for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -2190,7 +2206,9 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -2246,7 +2264,9 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -2317,7 +2337,9 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } @@ -2388,7 +2410,9 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf, for (i = 0; i < MAX_PIPES; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink) break; } diff --git a/sys/dev/pci/drm/amd/display/dc/bios/bios_parser2.c b/sys/dev/pci/drm/amd/display/dc/bios/bios_parser2.c index 4c3c4c8de..93720cf06 100644 --- a/sys/dev/pci/drm/amd/display/dc/bios/bios_parser2.c +++ b/sys/dev/pci/drm/amd/display/dc/bios/bios_parser2.c @@ -2961,6 +2961,7 @@ static enum bp_result construct_integrated_info( result = get_integrated_info_v2_1(bp, info); break; case 2: + case 3: result = get_integrated_info_v2_2(bp, info); break; default: diff --git a/sys/dev/pci/drm/amd/display/dc/dcn31/dcn31_hpo_dp_link_encoder.c b/sys/dev/pci/drm/amd/display/dc/dcn31/dcn31_hpo_dp_link_encoder.c index 083a43c47..fa8623ccc 100644 --- a/sys/dev/pci/drm/amd/display/dc/dcn31/dcn31_hpo_dp_link_encoder.c +++ b/sys/dev/pci/drm/amd/display/dc/dcn31/dcn31_hpo_dp_link_encoder.c @@ -395,6 +395,12 @@ void dcn31_hpo_dp_link_enc_set_throttled_vcp_size( x), 25)); + // If y rounds up to integer, carry it over to x. + if (y >> 25) { + x += 1; + y = 0; + } + switch (stream_encoder_inst) { case 0: REG_SET_2(DP_DPHY_SYM32_VC_RATE_CNTL0, 0, diff --git a/sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c b/sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c index 1d1917e1b..cd674ef5a 100644 --- a/sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c +++ b/sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c @@ -226,7 +226,7 @@ static int smu_v13_0_4_system_features_control(struct smu_context *smu, bool en) struct amdgpu_device *adev = smu->adev; int ret = 0; - if (!en && !adev->in_s0ix) { + if (!en && adev->in_s4) { /* Adds a GFX reset as workaround just before sending the * MP1_UNLOAD message to prevent GC/RLC/PMFW from entering * an invalid state. diff --git a/sys/dev/pci/drm/drm_connector.c b/sys/dev/pci/drm/drm_connector.c index 9109b07ab..f2f13217b 100644 --- a/sys/dev/pci/drm/drm_connector.c +++ b/sys/dev/pci/drm/drm_connector.c @@ -2933,7 +2933,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, dev->mode_config.max_width, dev->mode_config.max_height); else - drm_dbg_kms(dev, "User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe", + drm_dbg_kms(dev, "User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe\n", connector->base.id, connector->name); } diff --git a/sys/dev/pci/drm/i915/display/intel_audio.c b/sys/dev/pci/drm/i915/display/intel_audio.c index 8731d99b5..294acf812 100644 --- a/sys/dev/pci/drm/i915/display/intel_audio.c +++ b/sys/dev/pci/drm/i915/display/intel_audio.c @@ -75,19 +75,6 @@ struct intel_audio_funcs { struct intel_crtc_state *crtc_state); }; -/* DP N/M table */ -#define LC_810M 810000 -#define LC_540M 540000 -#define LC_270M 270000 -#define LC_162M 162000 - -struct dp_aud_n_m { - int sample_rate; - int clock; - u16 m; - u16 n; -}; - struct hdmi_aud_ncts { int sample_rate; int clock; @@ -95,60 +82,6 @@ struct hdmi_aud_ncts { int cts; }; -/* Values according to DP 1.4 Table 2-104 */ -static const struct dp_aud_n_m dp_aud_n_m[] = { - { 32000, LC_162M, 1024, 10125 }, - { 44100, LC_162M, 784, 5625 }, - { 48000, LC_162M, 512, 3375 }, - { 64000, LC_162M, 2048, 10125 }, - { 88200, LC_162M, 1568, 5625 }, - { 96000, LC_162M, 1024, 3375 }, - { 128000, LC_162M, 4096, 10125 }, - { 176400, LC_162M, 3136, 5625 }, - { 192000, LC_162M, 2048, 3375 }, - { 32000, LC_270M, 1024, 16875 }, - { 44100, LC_270M, 784, 9375 }, - { 48000, LC_270M, 512, 5625 }, - { 64000, LC_270M, 2048, 16875 }, - { 88200, LC_270M, 1568, 9375 }, - { 96000, LC_270M, 1024, 5625 }, - { 128000, LC_270M, 4096, 16875 }, - { 176400, LC_270M, 3136, 9375 }, - { 192000, LC_270M, 2048, 5625 }, - { 32000, LC_540M, 1024, 33750 }, - { 44100, LC_540M, 784, 18750 }, - { 48000, LC_540M, 512, 11250 }, - { 64000, LC_540M, 2048, 33750 }, - { 88200, LC_540M, 1568, 18750 }, - { 96000, LC_540M, 1024, 11250 }, - { 128000, LC_540M, 4096, 33750 }, - { 176400, LC_540M, 3136, 18750 }, - { 192000, LC_540M, 2048, 11250 }, - { 32000, LC_810M, 1024, 50625 }, - { 44100, LC_810M, 784, 28125 }, - { 48000, LC_810M, 512, 16875 }, - { 64000, LC_810M, 2048, 50625 }, - { 88200, LC_810M, 1568, 28125 }, - { 96000, LC_810M, 1024, 16875 }, - { 128000, LC_810M, 4096, 50625 }, - { 176400, LC_810M, 3136, 28125 }, - { 192000, LC_810M, 2048, 16875 }, -}; - -static const struct dp_aud_n_m * -audio_config_dp_get_n_m(const struct intel_crtc_state *crtc_state, int rate) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(dp_aud_n_m); i++) { - if (rate == dp_aud_n_m[i].sample_rate && - crtc_state->port_clock == dp_aud_n_m[i].clock) - return &dp_aud_n_m[i]; - } - - return NULL; -} - static const struct { int clock; u32 config; @@ -386,47 +319,17 @@ hsw_dp_audio_config_update(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state) { struct drm_i915_private *i915 = to_i915(encoder->base.dev); - struct i915_audio_component *acomp = i915->display.audio.component; enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; - enum port port = encoder->port; - const struct dp_aud_n_m *nm; - int rate; - u32 tmp; - rate = acomp ? acomp->aud_sample_rate[port] : 0; - nm = audio_config_dp_get_n_m(crtc_state, rate); - if (nm) - drm_dbg_kms(&i915->drm, "using Maud %u, Naud %u\n", nm->m, - nm->n); - else - drm_dbg_kms(&i915->drm, "using automatic Maud, Naud\n"); + /* Enable time stamps. Let HW calculate Maud/Naud values */ + intel_de_rmw(i915, HSW_AUD_CFG(cpu_transcoder), + AUD_CONFIG_N_VALUE_INDEX | + AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK | + AUD_CONFIG_UPPER_N_MASK | + AUD_CONFIG_LOWER_N_MASK | + AUD_CONFIG_N_PROG_ENABLE, + AUD_CONFIG_N_VALUE_INDEX); - tmp = intel_de_read(i915, HSW_AUD_CFG(cpu_transcoder)); - tmp &= ~AUD_CONFIG_N_VALUE_INDEX; - tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK; - tmp &= ~AUD_CONFIG_N_PROG_ENABLE; - tmp |= AUD_CONFIG_N_VALUE_INDEX; - - if (nm) { - tmp &= ~AUD_CONFIG_N_MASK; - tmp |= AUD_CONFIG_N(nm->n); - tmp |= AUD_CONFIG_N_PROG_ENABLE; - } - - intel_de_write(i915, HSW_AUD_CFG(cpu_transcoder), tmp); - - tmp = intel_de_read(i915, HSW_AUD_M_CTS_ENABLE(cpu_transcoder)); - tmp &= ~AUD_CONFIG_M_MASK; - tmp &= ~AUD_M_CTS_M_VALUE_INDEX; - tmp &= ~AUD_M_CTS_M_PROG_ENABLE; - - if (nm) { - tmp |= nm->m; - tmp |= AUD_M_CTS_M_VALUE_INDEX; - tmp |= AUD_M_CTS_M_PROG_ENABLE; - } - - intel_de_write(i915, HSW_AUD_M_CTS_ENABLE(cpu_transcoder), tmp); } static void diff --git a/sys/dev/pci/drm/i915/display/intel_bios.c b/sys/dev/pci/drm/i915/display/intel_bios.c index 5694147a6..e7dcbcdb3 100644 --- a/sys/dev/pci/drm/i915/display/intel_bios.c +++ b/sys/dev/pci/drm/i915/display/intel_bios.c @@ -1035,22 +1035,11 @@ parse_lfp_backlight(struct drm_i915_private *i915, panel->vbt.backlight.type = INTEL_BACKLIGHT_DISPLAY_DDI; panel->vbt.backlight.controller = 0; if (i915->display.vbt.version >= 191) { - size_t exp_size; + const struct lfp_backlight_control_method *method; - if (i915->display.vbt.version >= 236) - exp_size = sizeof(struct bdb_lfp_backlight_data); - else if (i915->display.vbt.version >= 234) - exp_size = EXP_BDB_LFP_BL_DATA_SIZE_REV_234; - else - exp_size = EXP_BDB_LFP_BL_DATA_SIZE_REV_191; - - if (get_blocksize(backlight_data) >= exp_size) { - const struct lfp_backlight_control_method *method; - - method = &backlight_data->backlight_control[panel_type]; - panel->vbt.backlight.type = method->type; - panel->vbt.backlight.controller = method->controller; - } + method = &backlight_data->backlight_control[panel_type]; + panel->vbt.backlight.type = method->type; + panel->vbt.backlight.controller = method->controller; } panel->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; diff --git a/sys/dev/pci/drm/i915/display/intel_vbt_defs.h b/sys/dev/pci/drm/i915/display/intel_vbt_defs.h index a9f44abfc..b50cd0dca 100644 --- a/sys/dev/pci/drm/i915/display/intel_vbt_defs.h +++ b/sys/dev/pci/drm/i915/display/intel_vbt_defs.h @@ -897,11 +897,6 @@ struct lfp_brightness_level { u16 reserved; } __packed; -#define EXP_BDB_LFP_BL_DATA_SIZE_REV_191 \ - offsetof(struct bdb_lfp_backlight_data, brightness_level) -#define EXP_BDB_LFP_BL_DATA_SIZE_REV_234 \ - offsetof(struct bdb_lfp_backlight_data, brightness_precision_bits) - struct bdb_lfp_backlight_data { u8 entry_size; struct lfp_backlight_data_entry data[16]; diff --git a/sys/dev/pci/drm/i915/gt/intel_gt_ccs_mode.c b/sys/dev/pci/drm/i915/gt/intel_gt_ccs_mode.c index 044219c59..99b71bb7d 100644 --- a/sys/dev/pci/drm/i915/gt/intel_gt_ccs_mode.c +++ b/sys/dev/pci/drm/i915/gt/intel_gt_ccs_mode.c @@ -8,14 +8,14 @@ #include "intel_gt_ccs_mode.h" #include "intel_gt_regs.h" -void intel_gt_apply_ccs_mode(struct intel_gt *gt) +unsigned int intel_gt_apply_ccs_mode(struct intel_gt *gt) { int cslice; u32 mode = 0; int first_ccs = __ffs(CCS_MASK(gt)); if (!IS_DG2(gt->i915)) - return; + return 0; /* Build the value for the fixed CCS load balancing */ for (cslice = 0; cslice < I915_MAX_CCS; cslice++) { @@ -35,5 +35,5 @@ void intel_gt_apply_ccs_mode(struct intel_gt *gt) XEHP_CCS_MODE_CSLICE_MASK); } - intel_uncore_write(gt->uncore, XEHP_CCS_MODE, mode); + return mode; } diff --git a/sys/dev/pci/drm/i915/gt/intel_gt_ccs_mode.h b/sys/dev/pci/drm/i915/gt/intel_gt_ccs_mode.h index 9e5549cae..55547f2ff 100644 --- a/sys/dev/pci/drm/i915/gt/intel_gt_ccs_mode.h +++ b/sys/dev/pci/drm/i915/gt/intel_gt_ccs_mode.h @@ -8,6 +8,6 @@ struct intel_gt; -void intel_gt_apply_ccs_mode(struct intel_gt *gt); +unsigned int intel_gt_apply_ccs_mode(struct intel_gt *gt); #endif /* __INTEL_GT_CCS_MODE_H__ */ diff --git a/sys/dev/pci/drm/i915/gt/intel_workarounds.c b/sys/dev/pci/drm/i915/gt/intel_workarounds.c index be060b32b..8fbb0686c 100644 --- a/sys/dev/pci/drm/i915/gt/intel_workarounds.c +++ b/sys/dev/pci/drm/i915/gt/intel_workarounds.c @@ -2828,6 +2828,7 @@ add_render_compute_tuning_settings(struct intel_gt *gt, static void ccs_engine_wa_mode(struct intel_engine_cs *engine, struct i915_wa_list *wal) { struct intel_gt *gt = engine->gt; + u32 mode; if (!IS_DG2(gt->i915)) return; @@ -2844,7 +2845,8 @@ static void ccs_engine_wa_mode(struct intel_engine_cs *engine, struct i915_wa_li * After having disabled automatic load balancing we need to * assign all slices to a single CCS. We will call it CCS mode 1 */ - intel_gt_apply_ccs_mode(gt); + mode = intel_gt_apply_ccs_mode(gt); + wa_masked_en(wal, XEHP_CCS_MODE, mode); } /* diff --git a/sys/dev/pci/drm/include/linux/compiler.h b/sys/dev/pci/drm/include/linux/compiler.h index 7adb9742d..6fdf71abf 100644 --- a/sys/dev/pci/drm/include/linux/compiler.h +++ b/sys/dev/pci/drm/include/linux/compiler.h @@ -24,6 +24,7 @@ #define noinline __attribute__((__noinline__)) #define noinline_for_stack __attribute__((__noinline__)) #define fallthrough do {} while (0) +#define __counted_by(x) #define __PASTE(x,y) __CONCAT(x,y) diff --git a/sys/dev/pci/drm/radeon/pptable.h b/sys/dev/pci/drm/radeon/pptable.h index 8118c6f15..572ac8ddc 100644 --- a/sys/dev/pci/drm/radeon/pptable.h +++ b/sys/dev/pci/drm/radeon/pptable.h @@ -424,7 +424,7 @@ typedef struct _ATOM_PPLIB_SUMO_CLOCK_INFO{ typedef struct _ATOM_PPLIB_STATE_V2 { //number of valid dpm levels in this state; Driver uses it to calculate the whole - //size of the state: sizeof(ATOM_PPLIB_STATE_V2) + (ucNumDPMLevels - 1) * sizeof(UCHAR) + //size of the state: struct_size(ATOM_PPLIB_STATE_V2, clockInfoIndex, ucNumDPMLevels) UCHAR ucNumDPMLevels; //a index to the array of nonClockInfos @@ -432,14 +432,14 @@ typedef struct _ATOM_PPLIB_STATE_V2 /** * Driver will read the first ucNumDPMLevels in this array */ - UCHAR clockInfoIndex[1]; + UCHAR clockInfoIndex[] __counted_by(ucNumDPMLevels); } ATOM_PPLIB_STATE_V2; typedef struct _StateArray{ //how many states we have UCHAR ucNumEntries; - ATOM_PPLIB_STATE_V2 states[1]; + ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries); }StateArray; @@ -450,7 +450,7 @@ typedef struct _ClockInfoArray{ //sizeof(ATOM_PPLIB_CLOCK_INFO) UCHAR ucEntrySize; - UCHAR clockInfo[1]; + UCHAR clockInfo[] __counted_by(ucNumEntries); }ClockInfoArray; typedef struct _NonClockInfoArray{ @@ -460,7 +460,7 @@ typedef struct _NonClockInfoArray{ //sizeof(ATOM_PPLIB_NONCLOCK_INFO) UCHAR ucEntrySize; - ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[1]; + ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[] __counted_by(ucNumEntries); }NonClockInfoArray; typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Record diff --git a/sys/dev/pci/drm/ttm/ttm_tt.c b/sys/dev/pci/drm/ttm/ttm_tt.c index 0eee929b3..795d4f291 100644 --- a/sys/dev/pci/drm/ttm/ttm_tt.c +++ b/sys/dev/pci/drm/ttm/ttm_tt.c @@ -92,7 +92,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc) */ if (bdev->pool.use_dma_alloc && cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) { page_flags |= TTM_TT_FLAG_DECRYPTED; - drm_info(ddev, "TT memory decryption enabled."); + drm_info_once(ddev, "TT memory decryption enabled."); } bo->ttm = bdev->funcs->ttm_tt_create(bo, page_flags); diff --git a/sys/dev/pci/if_igc.c b/sys/dev/pci/if_igc.c index a23036070..b80326db8 100644 --- a/sys/dev/pci/if_igc.c +++ b/sys/dev/pci/if_igc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_igc.c,v 1.23 2024/05/07 18:35:23 jan Exp $ */ +/* $OpenBSD: if_igc.c,v 1.24 2024/05/21 11:19:39 bluhm Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause * @@ -107,21 +107,21 @@ void igc_setup_interface(struct igc_softc *); void igc_init(void *); void igc_start(struct ifqueue *); -int igc_txeof(struct tx_ring *); +int igc_txeof(struct igc_txring *); void igc_stop(struct igc_softc *); int igc_ioctl(struct ifnet *, u_long, caddr_t); int igc_rxrinfo(struct igc_softc *, struct if_rxrinfo *); -int igc_rxfill(struct rx_ring *); +int igc_rxfill(struct igc_rxring *); void igc_rxrefill(void *); -int igc_rxeof(struct rx_ring *); +int igc_rxeof(struct igc_rxring *); void igc_rx_checksum(uint32_t, struct mbuf *, uint32_t); void igc_watchdog(struct ifnet *); void igc_media_status(struct ifnet *, struct ifmediareq *); int igc_media_change(struct ifnet *); void igc_iff(struct igc_softc *); void igc_update_link_status(struct igc_softc *); -int igc_get_buf(struct rx_ring *, int); -int igc_tx_ctx_setup(struct tx_ring *, struct mbuf *, int, uint32_t *, +int igc_get_buf(struct igc_rxring *, int); +int igc_tx_ctx_setup(struct igc_txring *, struct mbuf *, int, uint32_t *, uint32_t *); void igc_configure_queues(struct igc_softc *); @@ -132,18 +132,18 @@ void igc_disable_intr(struct igc_softc *); int igc_intr_link(void *); int igc_intr_queue(void *); -int igc_allocate_transmit_buffers(struct tx_ring *); +int igc_allocate_transmit_buffers(struct igc_txring *); int igc_setup_transmit_structures(struct igc_softc *); -int igc_setup_transmit_ring(struct tx_ring *); +int igc_setup_transmit_ring(struct igc_txring *); void igc_initialize_transmit_unit(struct igc_softc *); void igc_free_transmit_structures(struct igc_softc *); -void igc_free_transmit_buffers(struct tx_ring *); -int igc_allocate_receive_buffers(struct rx_ring *); +void igc_free_transmit_buffers(struct igc_txring *); +int igc_allocate_receive_buffers(struct igc_rxring *); int igc_setup_receive_structures(struct igc_softc *); -int igc_setup_receive_ring(struct rx_ring *); +int igc_setup_receive_ring(struct igc_rxring *); void igc_initialize_receive_unit(struct igc_softc *); void igc_free_receive_structures(struct igc_softc *); -void igc_free_receive_buffers(struct rx_ring *); +void igc_free_receive_buffers(struct igc_rxring *); void igc_initialize_rss_mapping(struct igc_softc *); void igc_get_hw_control(struct igc_softc *); @@ -374,8 +374,8 @@ int igc_allocate_queues(struct igc_softc *sc) { struct igc_queue *iq; - struct tx_ring *txr; - struct rx_ring *rxr; + struct igc_txring *txr; + struct igc_rxring *rxr; int i, rsize, rxconf, tsize, txconf; /* Allocate the top level queue structs. */ @@ -387,7 +387,7 @@ igc_allocate_queues(struct igc_softc *sc) } /* Allocate the TX ring. */ - sc->tx_rings = mallocarray(sc->sc_nqueues, sizeof(struct tx_ring), + sc->tx_rings = mallocarray(sc->sc_nqueues, sizeof(struct igc_txring), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->tx_rings == NULL) { printf("%s: unable to allocate TX ring\n", DEVNAME(sc)); @@ -395,7 +395,7 @@ igc_allocate_queues(struct igc_softc *sc) } /* Allocate the RX ring. */ - sc->rx_rings = mallocarray(sc->sc_nqueues, sizeof(struct rx_ring), + sc->rx_rings = mallocarray(sc->sc_nqueues, sizeof(struct igc_rxring), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->rx_rings == NULL) { printf("%s: unable to allocate RX ring\n", DEVNAME(sc)); @@ -456,10 +456,12 @@ err_rx_desc: err_tx_desc: for (txr = sc->tx_rings; txconf > 0; txr++, txconf--) igc_dma_free(sc, &txr->txdma); - free(sc->rx_rings, M_DEVBUF, sc->sc_nqueues * sizeof(struct rx_ring)); + free(sc->rx_rings, M_DEVBUF, + sc->sc_nqueues * sizeof(struct igc_rxring)); sc->rx_rings = NULL; rx_fail: - free(sc->tx_rings, M_DEVBUF, sc->sc_nqueues * sizeof(struct tx_ring)); + free(sc->tx_rings, M_DEVBUF, + sc->sc_nqueues * sizeof(struct igc_txring)); sc->tx_rings = NULL; fail: return ENOMEM; @@ -833,8 +835,8 @@ igc_setup_interface(struct igc_softc *sc) for (i = 0; i < sc->sc_nqueues; i++) { struct ifqueue *ifq = ifp->if_ifqs[i]; struct ifiqueue *ifiq = ifp->if_iqs[i]; - struct tx_ring *txr = &sc->tx_rings[i]; - struct rx_ring *rxr = &sc->rx_rings[i]; + struct igc_txring *txr = &sc->tx_rings[i]; + struct igc_rxring *rxr = &sc->rx_rings[i]; ifq->ifq_softc = txr; txr->ifq = ifq; @@ -849,7 +851,7 @@ igc_init(void *arg) { struct igc_softc *sc = (struct igc_softc *)arg; struct ifnet *ifp = &sc->sc_ac.ac_if; - struct rx_ring *rxr; + struct igc_rxring *rxr; uint32_t ctrl = 0; int i, s; @@ -959,7 +961,7 @@ igc_start(struct ifqueue *ifq) { struct ifnet *ifp = ifq->ifq_if; struct igc_softc *sc = ifp->if_softc; - struct tx_ring *txr = ifq->ifq_softc; + struct igc_txring *txr = ifq->ifq_softc; union igc_adv_tx_desc *txdesc; struct igc_tx_buf *txbuf; bus_dmamap_t map; @@ -1067,7 +1069,7 @@ igc_start(struct ifqueue *ifq) } int -igc_txeof(struct tx_ring *txr) +igc_txeof(struct igc_txring *txr) { struct igc_softc *sc = txr->sc; struct ifqueue *ifq = txr->ifq; @@ -1223,7 +1225,7 @@ int igc_rxrinfo(struct igc_softc *sc, struct if_rxrinfo *ifri) { struct if_rxring_info *ifr; - struct rx_ring *rxr; + struct igc_rxring *rxr; int error, i, n = 0; ifr = mallocarray(sc->sc_nqueues, sizeof(*ifr), M_DEVBUF, @@ -1244,7 +1246,7 @@ igc_rxrinfo(struct igc_softc *sc, struct if_rxrinfo *ifri) } int -igc_rxfill(struct rx_ring *rxr) +igc_rxfill(struct igc_rxring *rxr) { struct igc_softc *sc = rxr->sc; int i, post = 0; @@ -1277,7 +1279,7 @@ igc_rxfill(struct rx_ring *rxr) void igc_rxrefill(void *xrxr) { - struct rx_ring *rxr = xrxr; + struct igc_rxring *rxr = xrxr; struct igc_softc *sc = rxr->sc; if (igc_rxfill(rxr)) { @@ -1296,7 +1298,7 @@ igc_rxrefill(void *xrxr) * *********************************************************************/ int -igc_rxeof(struct rx_ring *rxr) +igc_rxeof(struct igc_rxring *rxr) { struct igc_softc *sc = rxr->sc; struct ifnet *ifp = &sc->sc_ac.ac_if; @@ -1657,7 +1659,7 @@ igc_update_link_status(struct igc_softc *sc) * **********************************************************************/ int -igc_get_buf(struct rx_ring *rxr, int i) +igc_get_buf(struct igc_rxring *rxr, int i) { struct igc_softc *sc = rxr->sc; struct igc_rx_buf *rxbuf; @@ -1812,8 +1814,8 @@ igc_intr_queue(void *arg) struct igc_queue *iq = arg; struct igc_softc *sc = iq->sc; struct ifnet *ifp = &sc->sc_ac.ac_if; - struct rx_ring *rxr = iq->rxr; - struct tx_ring *txr = iq->txr; + struct igc_rxring *rxr = iq->rxr; + struct igc_txring *txr = iq->txr; if (ifp->if_flags & IFF_RUNNING) { igc_txeof(txr); @@ -1833,7 +1835,7 @@ igc_intr_queue(void *arg) * **********************************************************************/ int -igc_allocate_transmit_buffers(struct tx_ring *txr) +igc_allocate_transmit_buffers(struct igc_txring *txr) { struct igc_softc *sc = txr->sc; struct igc_tx_buf *txbuf; @@ -1875,7 +1877,7 @@ fail: int igc_setup_transmit_structures(struct igc_softc *sc) { - struct tx_ring *txr = sc->tx_rings; + struct igc_txring *txr = sc->tx_rings; int i; for (i = 0; i < sc->sc_nqueues; i++, txr++) { @@ -1895,7 +1897,7 @@ fail: * **********************************************************************/ int -igc_setup_transmit_ring(struct tx_ring *txr) +igc_setup_transmit_ring(struct igc_txring *txr) { struct igc_softc *sc = txr->sc; @@ -1927,7 +1929,7 @@ void igc_initialize_transmit_unit(struct igc_softc *sc) { struct ifnet *ifp = &sc->sc_ac.ac_if; - struct tx_ring *txr; + struct igc_txring *txr; struct igc_hw *hw = &sc->hw; uint64_t bus_addr; uint32_t tctl, txdctl = 0; @@ -1981,7 +1983,7 @@ igc_initialize_transmit_unit(struct igc_softc *sc) void igc_free_transmit_structures(struct igc_softc *sc) { - struct tx_ring *txr = sc->tx_rings; + struct igc_txring *txr = sc->tx_rings; int i; for (i = 0; i < sc->sc_nqueues; i++, txr++) @@ -1994,7 +1996,7 @@ igc_free_transmit_structures(struct igc_softc *sc) * **********************************************************************/ void -igc_free_transmit_buffers(struct tx_ring *txr) +igc_free_transmit_buffers(struct igc_txring *txr) { struct igc_softc *sc = txr->sc; struct igc_tx_buf *txbuf; @@ -2035,7 +2037,7 @@ igc_free_transmit_buffers(struct tx_ring *txr) **********************************************************************/ int -igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod, +igc_tx_ctx_setup(struct igc_txring *txr, struct mbuf *mp, int prod, uint32_t *cmd_type_len, uint32_t *olinfo_status) { struct ether_extracted ext; @@ -2140,7 +2142,7 @@ igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod, * **********************************************************************/ int -igc_allocate_receive_buffers(struct rx_ring *rxr) +igc_allocate_receive_buffers(struct igc_rxring *rxr) { struct igc_softc *sc = rxr->sc; struct igc_rx_buf *rxbuf; @@ -2183,7 +2185,7 @@ fail: int igc_setup_receive_structures(struct igc_softc *sc) { - struct rx_ring *rxr = sc->rx_rings; + struct igc_rxring *rxr = sc->rx_rings; int i; for (i = 0; i < sc->sc_nqueues; i++, rxr++) { @@ -2203,7 +2205,7 @@ fail: * **********************************************************************/ int -igc_setup_receive_ring(struct rx_ring *rxr) +igc_setup_receive_ring(struct igc_rxring *rxr) { struct igc_softc *sc = rxr->sc; struct ifnet *ifp = &sc->sc_ac.ac_if; @@ -2238,7 +2240,7 @@ igc_setup_receive_ring(struct rx_ring *rxr) void igc_initialize_receive_unit(struct igc_softc *sc) { - struct rx_ring *rxr = sc->rx_rings; + struct igc_rxring *rxr = sc->rx_rings; struct igc_hw *hw = &sc->hw; uint32_t rctl, rxcsum, srrctl = 0; int i; @@ -2342,7 +2344,7 @@ igc_initialize_receive_unit(struct igc_softc *sc) void igc_free_receive_structures(struct igc_softc *sc) { - struct rx_ring *rxr; + struct igc_rxring *rxr; int i; for (i = 0, rxr = sc->rx_rings; i < sc->sc_nqueues; i++, rxr++) @@ -2358,7 +2360,7 @@ igc_free_receive_structures(struct igc_softc *sc) * **********************************************************************/ void -igc_free_receive_buffers(struct rx_ring *rxr) +igc_free_receive_buffers(struct igc_rxring *rxr) { struct igc_softc *sc = rxr->sc; struct igc_rx_buf *rxbuf; diff --git a/sys/dev/pci/if_igc.h b/sys/dev/pci/if_igc.h index 52a8be581..24430e749 100644 --- a/sys/dev/pci/if_igc.h +++ b/sys/dev/pci/if_igc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_igc.h,v 1.3 2024/05/06 04:25:52 dlg Exp $ */ +/* $OpenBSD: if_igc.h,v 1.4 2024/05/21 11:19:39 bluhm Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause * @@ -250,14 +250,14 @@ struct igc_queue { char name[16]; pci_intr_handle_t ih; void *tag; - struct tx_ring *txr; - struct rx_ring *rxr; + struct igc_txring *txr; + struct igc_rxring *rxr; }; /* * The transmit ring, one per tx queue. */ -struct tx_ring { +struct igc_txring { struct igc_softc *sc; struct ifqueue *ifq; uint32_t me; @@ -273,7 +273,7 @@ struct tx_ring { /* * The Receive ring, one per rx queue. */ -struct rx_ring { +struct igc_rxring { struct igc_softc *sc; struct ifiqueue *ifiq; uint32_t me; @@ -316,8 +316,8 @@ struct igc_softc { unsigned int sc_nqueues; struct igc_queue *queues; - struct tx_ring *tx_rings; - struct rx_ring *rx_rings; + struct igc_txring *tx_rings; + struct igc_rxring *rx_rings; /* Multicast array memory */ uint8_t *mta; diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index 077946b8d..08d04a94c 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.214 2024/05/13 01:15:51 jsg Exp $ */ +/* $OpenBSD: if_ix.c,v 1.215 2024/05/21 11:19:39 bluhm Exp $ */ /****************************************************************************** @@ -131,39 +131,39 @@ void ixgbe_config_delay_values(struct ix_softc *); void ixgbe_add_media_types(struct ix_softc *); void ixgbe_config_link(struct ix_softc *); -int ixgbe_allocate_transmit_buffers(struct tx_ring *); +int ixgbe_allocate_transmit_buffers(struct ix_txring *); int ixgbe_setup_transmit_structures(struct ix_softc *); -int ixgbe_setup_transmit_ring(struct tx_ring *); +int ixgbe_setup_transmit_ring(struct ix_txring *); void ixgbe_initialize_transmit_units(struct ix_softc *); void ixgbe_free_transmit_structures(struct ix_softc *); -void ixgbe_free_transmit_buffers(struct tx_ring *); +void ixgbe_free_transmit_buffers(struct ix_txring *); -int ixgbe_allocate_receive_buffers(struct rx_ring *); +int ixgbe_allocate_receive_buffers(struct ix_rxring *); int ixgbe_setup_receive_structures(struct ix_softc *); -int ixgbe_setup_receive_ring(struct rx_ring *); +int ixgbe_setup_receive_ring(struct ix_rxring *); void ixgbe_initialize_receive_units(struct ix_softc *); void ixgbe_free_receive_structures(struct ix_softc *); -void ixgbe_free_receive_buffers(struct rx_ring *); +void ixgbe_free_receive_buffers(struct ix_rxring *); void ixgbe_initialize_rss_mapping(struct ix_softc *); -int ixgbe_rxfill(struct rx_ring *); +int ixgbe_rxfill(struct ix_rxring *); void ixgbe_rxrefill(void *); int ixgbe_intr(struct ix_softc *sc); void ixgbe_enable_intr(struct ix_softc *); void ixgbe_disable_intr(struct ix_softc *); -int ixgbe_txeof(struct tx_ring *); -int ixgbe_rxeof(struct rx_ring *); +int ixgbe_txeof(struct ix_txring *); +int ixgbe_rxeof(struct ix_rxring *); void ixgbe_rx_offload(uint32_t, uint16_t, struct mbuf *); void ixgbe_iff(struct ix_softc *); void ixgbe_map_queue_statistics(struct ix_softc *); void ixgbe_update_link_status(struct ix_softc *); -int ixgbe_get_buf(struct rx_ring *, int); -int ixgbe_encap(struct tx_ring *, struct mbuf *); +int ixgbe_get_buf(struct ix_rxring *, int); +int ixgbe_encap(struct ix_txring *, struct mbuf *); int ixgbe_dma_malloc(struct ix_softc *, bus_size_t, struct ixgbe_dma_alloc *, int); void ixgbe_dma_free(struct ix_softc *, struct ixgbe_dma_alloc *); static int - ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *, uint32_t *, + ixgbe_tx_ctx_setup(struct ix_txring *, struct mbuf *, uint32_t *, uint32_t *); void ixgbe_set_ivar(struct ix_softc *, uint8_t, uint8_t, int8_t); void ixgbe_configure_ivars(struct ix_softc *); @@ -188,8 +188,8 @@ int ixgbe_queue_intr(void *); #if NKSTAT > 0 static void ix_kstats(struct ix_softc *); -static void ix_rxq_kstats(struct ix_softc *, struct rx_ring *); -static void ix_txq_kstats(struct ix_softc *, struct tx_ring *); +static void ix_rxq_kstats(struct ix_softc *, struct ix_rxring *); +static void ix_txq_kstats(struct ix_softc *, struct ix_txring *); static void ix_kstats_tick(void *); #endif @@ -451,7 +451,7 @@ ixgbe_start(struct ifqueue *ifq) { struct ifnet *ifp = ifq->ifq_if; struct ix_softc *sc = ifp->if_softc; - struct tx_ring *txr = ifq->ifq_softc; + struct ix_txring *txr = ifq->ifq_softc; struct mbuf *m_head; unsigned int head, free, used; int post = 0; @@ -639,7 +639,7 @@ int ixgbe_rxrinfo(struct ix_softc *sc, struct if_rxrinfo *ifri) { struct if_rxring_info *ifr, ifr1; - struct rx_ring *rxr; + struct ix_rxring *rxr; int error, i; u_int n = 0; @@ -673,7 +673,7 @@ void ixgbe_watchdog(struct ifnet * ifp) { struct ix_softc *sc = (struct ix_softc *)ifp->if_softc; - struct tx_ring *txr = sc->tx_rings; + struct ix_txring *txr = sc->tx_rings; struct ixgbe_hw *hw = &sc->hw; int tx_hang = FALSE; int i; @@ -735,7 +735,7 @@ ixgbe_init(void *arg) { struct ix_softc *sc = (struct ix_softc *)arg; struct ifnet *ifp = &sc->arpcom.ac_if; - struct rx_ring *rxr = sc->rx_rings; + struct ix_rxring *rxr = sc->rx_rings; uint32_t k, txdctl, rxdctl, rxctrl, mhadd, itr; int i, s, err; @@ -1076,8 +1076,8 @@ ixgbe_queue_intr(void *vque) struct ix_queue *que = vque; struct ix_softc *sc = que->sc; struct ifnet *ifp = &sc->arpcom.ac_if; - struct rx_ring *rxr = que->rxr; - struct tx_ring *txr = que->txr; + struct ix_rxring *rxr = que->rxr; + struct ix_txring *txr = que->txr; if (ISSET(ifp->if_flags, IFF_RUNNING)) { ixgbe_rxeof(rxr); @@ -1101,8 +1101,8 @@ ixgbe_legacy_intr(void *arg) { struct ix_softc *sc = (struct ix_softc *)arg; struct ifnet *ifp = &sc->arpcom.ac_if; - struct rx_ring *rxr = sc->rx_rings; - struct tx_ring *txr = sc->tx_rings; + struct ix_rxring *rxr = sc->rx_rings; + struct ix_txring *txr = sc->tx_rings; int rv; rv = ixgbe_intr(sc); @@ -1423,7 +1423,7 @@ ixgbe_media_change(struct ifnet *ifp) **********************************************************************/ int -ixgbe_encap(struct tx_ring *txr, struct mbuf *m_head) +ixgbe_encap(struct ix_txring *txr, struct mbuf *m_head) { struct ix_softc *sc = txr->sc; uint32_t olinfo_status = 0, cmd_type_len; @@ -1953,8 +1953,8 @@ ixgbe_setup_interface(struct ix_softc *sc) for (i = 0; i < sc->num_queues; i++) { struct ifqueue *ifq = ifp->if_ifqs[i]; struct ifiqueue *ifiq = ifp->if_iqs[i]; - struct tx_ring *txr = &sc->tx_rings[i]; - struct rx_ring *rxr = &sc->rx_rings[i]; + struct ix_txring *txr = &sc->tx_rings[i]; + struct ix_rxring *rxr = &sc->rx_rings[i]; ifq->ifq_softc = txr; txr->ifq = ifq; @@ -2142,8 +2142,8 @@ ixgbe_allocate_queues(struct ix_softc *sc) { struct ifnet *ifp = &sc->arpcom.ac_if; struct ix_queue *que; - struct tx_ring *txr; - struct rx_ring *rxr; + struct ix_txring *txr; + struct ix_rxring *rxr; int rsize, tsize; int txconf = 0, rxconf = 0, i; @@ -2156,14 +2156,14 @@ ixgbe_allocate_queues(struct ix_softc *sc) /* Then allocate the TX ring struct memory */ if (!(sc->tx_rings = mallocarray(sc->num_queues, - sizeof(struct tx_ring), M_DEVBUF, M_NOWAIT | M_ZERO))) { + sizeof(struct ix_txring), M_DEVBUF, M_NOWAIT | M_ZERO))) { printf("%s: Unable to allocate TX ring memory\n", ifp->if_xname); goto fail; } /* Next allocate the RX */ if (!(sc->rx_rings = mallocarray(sc->num_queues, - sizeof(struct rx_ring), M_DEVBUF, M_NOWAIT | M_ZERO))) { + sizeof(struct ix_rxring), M_DEVBUF, M_NOWAIT | M_ZERO))) { printf("%s: Unable to allocate RX ring memory\n", ifp->if_xname); goto rx_fail; } @@ -2235,10 +2235,10 @@ err_rx_desc: err_tx_desc: for (txr = sc->tx_rings; txconf > 0; txr++, txconf--) ixgbe_dma_free(sc, &txr->txdma); - free(sc->rx_rings, M_DEVBUF, sc->num_queues * sizeof(struct rx_ring)); + free(sc->rx_rings, M_DEVBUF, sc->num_queues * sizeof(struct ix_rxring)); sc->rx_rings = NULL; rx_fail: - free(sc->tx_rings, M_DEVBUF, sc->num_queues * sizeof(struct tx_ring)); + free(sc->tx_rings, M_DEVBUF, sc->num_queues * sizeof(struct ix_txring)); sc->tx_rings = NULL; fail: return (ENOMEM); @@ -2252,7 +2252,7 @@ fail: * **********************************************************************/ int -ixgbe_allocate_transmit_buffers(struct tx_ring *txr) +ixgbe_allocate_transmit_buffers(struct ix_txring *txr) { struct ix_softc *sc = txr->sc; struct ifnet *ifp = &sc->arpcom.ac_if; @@ -2293,7 +2293,7 @@ fail: * **********************************************************************/ int -ixgbe_setup_transmit_ring(struct tx_ring *txr) +ixgbe_setup_transmit_ring(struct ix_txring *txr) { struct ix_softc *sc = txr->sc; int error; @@ -2325,7 +2325,7 @@ ixgbe_setup_transmit_ring(struct tx_ring *txr) int ixgbe_setup_transmit_structures(struct ix_softc *sc) { - struct tx_ring *txr = sc->tx_rings; + struct ix_txring *txr = sc->tx_rings; int i, error; for (i = 0; i < sc->num_queues; i++, txr++) { @@ -2348,7 +2348,7 @@ void ixgbe_initialize_transmit_units(struct ix_softc *sc) { struct ifnet *ifp = &sc->arpcom.ac_if; - struct tx_ring *txr; + struct ix_txring *txr; struct ixgbe_hw *hw = &sc->hw; int i; uint64_t tdba; @@ -2430,7 +2430,7 @@ ixgbe_initialize_transmit_units(struct ix_softc *sc) void ixgbe_free_transmit_structures(struct ix_softc *sc) { - struct tx_ring *txr = sc->tx_rings; + struct ix_txring *txr = sc->tx_rings; int i; for (i = 0; i < sc->num_queues; i++, txr++) @@ -2443,7 +2443,7 @@ ixgbe_free_transmit_structures(struct ix_softc *sc) * **********************************************************************/ void -ixgbe_free_transmit_buffers(struct tx_ring *txr) +ixgbe_free_transmit_buffers(struct ix_txring *txr) { struct ix_softc *sc = txr->sc; struct ixgbe_tx_buf *tx_buffer; @@ -2561,7 +2561,7 @@ ixgbe_tx_offload(struct mbuf *mp, uint32_t *vlan_macip_lens, } static int -ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, +ixgbe_tx_ctx_setup(struct ix_txring *txr, struct mbuf *mp, uint32_t *cmd_type_len, uint32_t *olinfo_status) { struct ixgbe_adv_tx_context_desc *TXD; @@ -2614,7 +2614,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, * **********************************************************************/ int -ixgbe_txeof(struct tx_ring *txr) +ixgbe_txeof(struct ix_txring *txr) { struct ix_softc *sc = txr->sc; struct ifqueue *ifq = txr->ifq; @@ -2684,7 +2684,7 @@ ixgbe_txeof(struct tx_ring *txr) * **********************************************************************/ int -ixgbe_get_buf(struct rx_ring *rxr, int i) +ixgbe_get_buf(struct ix_rxring *rxr, int i) { struct ix_softc *sc = rxr->sc; struct ixgbe_rx_buf *rxbuf; @@ -2733,7 +2733,7 @@ ixgbe_get_buf(struct rx_ring *rxr, int i) * **********************************************************************/ int -ixgbe_allocate_receive_buffers(struct rx_ring *rxr) +ixgbe_allocate_receive_buffers(struct ix_rxring *rxr) { struct ix_softc *sc = rxr->sc; struct ifnet *ifp = &sc->arpcom.ac_if; @@ -2774,7 +2774,7 @@ fail: * **********************************************************************/ int -ixgbe_setup_receive_ring(struct rx_ring *rxr) +ixgbe_setup_receive_ring(struct ix_rxring *rxr) { struct ix_softc *sc = rxr->sc; struct ifnet *ifp = &sc->arpcom.ac_if; @@ -2806,7 +2806,7 @@ ixgbe_setup_receive_ring(struct rx_ring *rxr) } int -ixgbe_rxfill(struct rx_ring *rxr) +ixgbe_rxfill(struct ix_rxring *rxr) { struct ix_softc *sc = rxr->sc; int post = 0; @@ -2842,7 +2842,7 @@ ixgbe_rxfill(struct rx_ring *rxr) void ixgbe_rxrefill(void *xrxr) { - struct rx_ring *rxr = xrxr; + struct ix_rxring *rxr = xrxr; struct ix_softc *sc = rxr->sc; if (ixgbe_rxfill(rxr)) { @@ -2862,7 +2862,7 @@ ixgbe_rxrefill(void *xrxr) int ixgbe_setup_receive_structures(struct ix_softc *sc) { - struct rx_ring *rxr = sc->rx_rings; + struct ix_rxring *rxr = sc->rx_rings; int i; for (i = 0; i < sc->num_queues; i++, rxr++) @@ -2886,7 +2886,7 @@ void ixgbe_initialize_receive_units(struct ix_softc *sc) { struct ifnet *ifp = &sc->arpcom.ac_if; - struct rx_ring *rxr = sc->rx_rings; + struct ix_rxring *rxr = sc->rx_rings; struct ixgbe_hw *hw = &sc->hw; uint32_t bufsz, fctrl, srrctl, rxcsum, rdrxctl; uint32_t hlreg; @@ -3061,7 +3061,7 @@ ixgbe_initialize_rss_mapping(struct ix_softc *sc) void ixgbe_free_receive_structures(struct ix_softc *sc) { - struct rx_ring *rxr; + struct ix_rxring *rxr; int i; for (i = 0, rxr = sc->rx_rings; i < sc->num_queues; i++, rxr++) @@ -3077,7 +3077,7 @@ ixgbe_free_receive_structures(struct ix_softc *sc) * **********************************************************************/ void -ixgbe_free_receive_buffers(struct rx_ring *rxr) +ixgbe_free_receive_buffers(struct ix_rxring *rxr) { struct ix_softc *sc; struct ixgbe_rx_buf *rxbuf; @@ -3116,7 +3116,7 @@ ixgbe_free_receive_buffers(struct rx_ring *rxr) * *********************************************************************/ int -ixgbe_rxeof(struct rx_ring *rxr) +ixgbe_rxeof(struct ix_rxring *rxr) { struct ix_softc *sc = rxr->sc; struct ifnet *ifp = &sc->arpcom.ac_if; @@ -3850,7 +3850,7 @@ ix_kstats(struct ix_softc *sc) } static void -ix_rxq_kstats(struct ix_softc *sc, struct rx_ring *rxr) +ix_rxq_kstats(struct ix_softc *sc, struct ix_rxring *rxr) { struct ix_rxq_kstats *stats; struct kstat *ks; @@ -3874,7 +3874,7 @@ ix_rxq_kstats(struct ix_softc *sc, struct rx_ring *rxr) } static void -ix_txq_kstats(struct ix_softc *sc, struct tx_ring *txr) +ix_txq_kstats(struct ix_softc *sc, struct ix_txring *txr) { struct ix_txq_kstats *stats; struct kstat *ks; @@ -3980,7 +3980,7 @@ int ix_rxq_kstats_read(struct kstat *ks) { struct ix_rxq_kstats *stats = ks->ks_data; - struct rx_ring *rxr = ks->ks_softc; + struct ix_rxring *rxr = ks->ks_softc; struct ix_softc *sc = rxr->sc; struct ixgbe_hw *hw = &sc->hw; uint32_t i = rxr->me; @@ -4007,7 +4007,7 @@ int ix_txq_kstats_read(struct kstat *ks) { struct ix_txq_kstats *stats = ks->ks_data; - struct tx_ring *txr = ks->ks_softc; + struct ix_txring *txr = ks->ks_softc; struct ix_softc *sc = txr->sc; struct ixgbe_hw *hw = &sc->hw; uint32_t i = txr->me; diff --git a/sys/dev/pci/if_ix.h b/sys/dev/pci/if_ix.h index ec2ac57e6..c1fc256d9 100644 --- a/sys/dev/pci/if_ix.h +++ b/sys/dev/pci/if_ix.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.h,v 1.46 2023/08/04 10:58:27 jan Exp $ */ +/* $OpenBSD: if_ix.h,v 1.47 2024/05/21 11:19:39 bluhm Exp $ */ /****************************************************************************** @@ -158,14 +158,14 @@ struct ix_queue { char name[8]; pci_intr_handle_t ih; void *tag; - struct tx_ring *txr; - struct rx_ring *rxr; + struct ix_txring *txr; + struct ix_rxring *rxr; }; /* * The transmit ring, one per tx queue */ -struct tx_ring { +struct ix_txring { struct ix_softc *sc; struct ifqueue *ifq; uint32_t me; @@ -190,7 +190,7 @@ struct tx_ring { /* * The Receive ring, one per rx queue */ -struct rx_ring { +struct ix_rxring { struct ix_softc *sc; struct ifiqueue *ifiq; uint32_t me; @@ -262,14 +262,14 @@ struct ix_softc { * Transmit rings: * Allocated at run time, an array of rings. */ - struct tx_ring *tx_rings; + struct ix_txring *tx_rings; int num_tx_desc; /* * Receive rings: * Allocated at run time, an array of rings. */ - struct rx_ring *rx_rings; + struct ix_rxring *rx_rings; uint64_t que_mask; int num_rx_desc; diff --git a/sys/dev/pci/if_mwx.c b/sys/dev/pci/if_mwx.c index 698b83d95..9b3466abc 100644 --- a/sys/dev/pci/if_mwx.c +++ b/sys/dev/pci/if_mwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mwx.c,v 1.2 2024/02/21 12:08:05 jsg Exp $ */ +/* $OpenBSD: if_mwx.c,v 1.3 2024/05/20 21:22:43 martijn Exp $ */ /* * Copyright (c) 2022 Claudio Jeker * Copyright (c) 2021 MediaTek Inc. @@ -1426,7 +1426,7 @@ mwx_txwi_alloc(struct mwx_softc *sc, int count) } } - for (i = count; i >= MT_PACKET_ID_FIRST; i--) + for (i = count - 1; i >= MT_PACKET_ID_FIRST; i--) LIST_INSERT_HEAD(&q->mt_freelist, &q->mt_data[i], mt_entry); return 0; diff --git a/sys/dev/pci/if_rge.c b/sys/dev/pci/if_rge.c index 07513add2..6a487c50f 100644 --- a/sys/dev/pci/if_rge.c +++ b/sys/dev/pci/if_rge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rge.c,v 1.24 2024/04/13 23:44:11 jsg Exp $ */ +/* $OpenBSD: if_rge.c,v 1.25 2024/05/20 01:51:32 kevlo Exp $ */ /* * Copyright (c) 2019, 2020, 2023 Kevin Lo @@ -209,7 +209,8 @@ rge_attach(struct device *parent, struct device *self, void *aux) /* * Allocate interrupt. */ - if (pci_intr_map_msi(pa, &ih) == 0) + if (pci_intr_map_msix(pa, 0, &ih) == 0 || + pci_intr_map_msi(pa, &ih) == 0) sc->rge_flags |= RGE_FLAG_MSI; else if (pci_intr_map(pa, &ih) != 0) { printf(": couldn't map interrupt\n"); diff --git a/sys/dev/pci/if_vmx.c b/sys/dev/pci/if_vmx.c index 28853b547..0c5883a1b 100644 --- a/sys/dev/pci/if_vmx.c +++ b/sys/dev/pci/if_vmx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vmx.c,v 1.85 2024/05/13 01:15:51 jsg Exp $ */ +/* $OpenBSD: if_vmx.c,v 1.86 2024/05/21 19:49:06 jan Exp $ */ /* * Copyright (c) 2013 Tsubai Masanari @@ -203,7 +203,7 @@ void vmxnet3_rxintr(struct vmxnet3_softc *, struct vmxnet3_rxqueue *); void vmxnet3_rxfill_tick(void *); void vmxnet3_rxfill(struct vmxnet3_rxring *); void vmxnet3_iff(struct vmxnet3_softc *); -void vmxnet3_rx_csum(struct vmxnet3_rxcompdesc *, struct mbuf *); +void vmxnet3_rx_offload(struct vmxnet3_rxcompdesc *, struct mbuf *); void vmxnet3_stop(struct ifnet *); void vmxnet3_reset(struct vmxnet3_softc *); int vmxnet3_init(struct vmxnet3_softc *); @@ -1127,14 +1127,8 @@ vmxnet3_rxintr(struct vmxnet3_softc *sc, struct vmxnet3_rxqueue *rq) } m->m_pkthdr.len = m->m_len = len; - vmxnet3_rx_csum(rxcd, m); -#if NVLAN > 0 - if (letoh32(rxcd->rxc_word2 & VMXNET3_RXC_VLAN)) { - m->m_flags |= M_VLANTAG; - m->m_pkthdr.ether_vtag = letoh32((rxcd->rxc_word2 >> - VMXNET3_RXC_VLANTAG_S) & VMXNET3_RXC_VLANTAG_M); - } -#endif + vmxnet3_rx_offload(rxcd, m); + if (((letoh32(rxcd->rxc_word0) >> VMXNET3_RXC_RSSTYPE_S) & VMXNET3_RXC_RSSTYPE_M) != VMXNET3_RXC_RSSTYPE_NONE) { m->m_pkthdr.ph_flowid = letoh32(rxcd->rxc_word1); @@ -1215,22 +1209,39 @@ vmxnet3_iff(struct vmxnet3_softc *sc) void -vmxnet3_rx_csum(struct vmxnet3_rxcompdesc *rxcd, struct mbuf *m) +vmxnet3_rx_offload(struct vmxnet3_rxcompdesc *rxcd, struct mbuf *m) { - if (letoh32(rxcd->rxc_word0 & VMXNET3_RXC_NOCSUM)) + /* + * VLAN Offload + */ + +#if NVLAN > 0 + if (ISSET(rxcd->rxc_word2, VMXNET3_RXC_VLAN)) { + SET(m->m_flags, M_VLANTAG); + m->m_pkthdr.ether_vtag = letoh32((rxcd->rxc_word2 >> + VMXNET3_RXC_VLANTAG_S) & VMXNET3_RXC_VLANTAG_M); + } +#endif + + /* + * Checksum Offload + */ + + if (ISSET(rxcd->rxc_word0, VMXNET3_RXC_NOCSUM)) return; - if ((rxcd->rxc_word3 & (VMXNET3_RXC_IPV4 | VMXNET3_RXC_IPSUM_OK)) == - (VMXNET3_RXC_IPV4 | VMXNET3_RXC_IPSUM_OK)) - m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK; + if (ISSET(rxcd->rxc_word3, VMXNET3_RXC_IPV4) && + ISSET(rxcd->rxc_word3, VMXNET3_RXC_IPSUM_OK)) + SET(m->m_pkthdr.csum_flags, M_IPV4_CSUM_IN_OK); - if (rxcd->rxc_word3 & VMXNET3_RXC_FRAGMENT) + if (ISSET(rxcd->rxc_word3, VMXNET3_RXC_FRAGMENT)) return; - if (rxcd->rxc_word3 & (VMXNET3_RXC_TCP | VMXNET3_RXC_UDP)) { - if (rxcd->rxc_word3 & VMXNET3_RXC_CSUM_OK) - m->m_pkthdr.csum_flags |= - M_TCP_CSUM_IN_OK | M_UDP_CSUM_IN_OK; + if (ISSET(rxcd->rxc_word3, VMXNET3_RXC_CSUM_OK)) { + if (ISSET(rxcd->rxc_word3, VMXNET3_RXC_TCP)) + SET(m->m_pkthdr.csum_flags, M_TCP_CSUM_IN_OK); + else if (ISSET(rxcd->rxc_word3, VMXNET3_RXC_UDP)) + SET(m->m_pkthdr.csum_flags, M_UDP_CSUM_IN_OK); } } diff --git a/sys/dev/pci/pcidevs b/sys/dev/pci/pcidevs index 365827fc9..733f751d4 100644 --- a/sys/dev/pci/pcidevs +++ b/sys/dev/pci/pcidevs @@ -1,4 +1,4 @@ -$OpenBSD: pcidevs,v 1.2074 2024/04/20 08:54:01 jsg Exp $ +$OpenBSD: pcidevs,v 1.2075 2024/05/21 07:03:55 jsg Exp $ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* @@ -790,8 +790,8 @@ product AMD 19_1X_PCIE_1 0x14a5 19h/1xh PCIE product AMD 19_1X_RCEC 0x14a6 19h/1xh RCEC product AMD 19_1X_PCIE_2 0x14a7 19h/1xh PCIE product AMD 19_1X_PCIE_3 0x14aa 19h/1xh PCIE -product AMD 19_1X_PCIE_4 0x14ac 19h/1xh PCIE -product AMD 19_1X_PCIE_5 0x14ab 19h/1xh PCIE +product AMD 19_1X_PCIE_4 0x14ab 19h/1xh PCIE +product AMD 19_1X_PCIE_5 0x14ac 19h/1xh PCIE product AMD 19_1X_DF_1 0x14ad 19h/1xh Data Fabric product AMD 19_1X_DF_2 0x14ae 19h/1xh Data Fabric product AMD 19_1X_DF_3 0x14af 19h/1xh Data Fabric @@ -1177,8 +1177,8 @@ product AQUANTIA AQC107 0x07b1 AQC107 product AQUANTIA AQC108 0x08b1 AQC108 product AQUANTIA AQC109 0x09b1 AQC109 product AQUANTIA AQC111 0x11b1 AQC111 -product AQUANTIA AQC112 0x12b1 AQC112 product AQUANTIA AQC116C 0x11c0 AQC116C +product AQUANTIA AQC112 0x12b1 AQC112 product AQUANTIA AQC115C 0x12c0 AQC115C product AQUANTIA AQC113C 0x14c0 AQC113C product AQUANTIA AQC113CA 0x34c0 AQC113CA @@ -8800,10 +8800,10 @@ product REALTEK RTL8723AE 0x8723 8723AE product REALTEK RTL8821AE 0x8821 8821AE product REALTEK RTL8852AE 0x8852 8852AE product REALTEK RTL8852AE_VT 0xa85a 8852AE-VT -product REALTEK RTL8852BE 0xb852 8852BE -product REALTEK RTL8852BE_2 0xb85b 8852BE product REALTEK RTL8723BE 0xb723 8723BE product REALTEK RTL8822BE 0xb822 8822BE +product REALTEK RTL8852BE 0xb852 8852BE +product REALTEK RTL8852BE_2 0xb85b 8852BE product REALTEK RTL8821CE 0xc821 8821CE product REALTEK RTL8822CE 0xc822 8822CE product REALTEK RTL8852CE 0xc852 8852CE @@ -9337,11 +9337,11 @@ product SYMBIOS YELLOWFIN_1 0x0701 Yellowfin product SYMBIOS YELLOWFIN_2 0x0702 Yellowfin product SYMBIOS 61C102 0x0901 61C102 product SYMBIOS 63C815 0x1000 63C815 +product SYMBIOS 1030R 0x1030 53c1030R product SYMBIOS MEGARAID_39XX 0x10e1 MegaRAID SAS39XX product SYMBIOS MEGARAID_39XX_2 0x10e2 MegaRAID SAS39XX product SYMBIOS MEGARAID_38XX 0x10e5 MegaRAID SAS38XX product SYMBIOS MEGARAID_38XX_2 0x10e6 MegaRAID SAS38XX -product SYMBIOS 1030R 0x1030 53c1030R product SYMBIOS MEGARAID 0x1960 MegaRAID /* Packet Engines products */ @@ -9958,16 +9958,16 @@ product VORTEX GDT_8X22RZ 0x02f6 GDT8x22RZ product VORTEX GDT_ICP 0x0300 ICP product VORTEX GDT_ICP2 0x0301 ICP +/* Beijing WangXun Technology products */ +product WANGXUN WX1860A2 0x0101 WX1860A2 +product WANGXUN WX1860AL1 0x010b WX1860AL1 + /* Nanjing QinHeng Electronics products */ product WCH CH352 0x3253 CH352 product WCH2 CH351 0x2273 CH351 product WCH2 CH382_2 0x3250 CH382 product WCH2 CH382_1 0x3253 CH382 -/* Beijing WangXun Technology products */ -product WANGXUN WX1860A2 0x0101 WX1860A2 -product WANGXUN WX1860AL1 0x010b WX1860AL1 - /* Western Digital products */ product WD WD33C193A 0x0193 WD33C193A product WD WD33C196A 0x0196 WD33C196A diff --git a/sys/dev/pci/pcidevs.h b/sys/dev/pci/pcidevs.h index d7b5112c6..67f880028 100644 --- a/sys/dev/pci/pcidevs.h +++ b/sys/dev/pci/pcidevs.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2074 2024/04/20 08:54:01 jsg Exp + * OpenBSD: pcidevs,v 1.2075 2024/05/21 07:03:55 jsg Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -795,8 +795,8 @@ #define PCI_PRODUCT_AMD_19_1X_RCEC 0x14a6 /* 19h/1xh RCEC */ #define PCI_PRODUCT_AMD_19_1X_PCIE_2 0x14a7 /* 19h/1xh PCIE */ #define PCI_PRODUCT_AMD_19_1X_PCIE_3 0x14aa /* 19h/1xh PCIE */ -#define PCI_PRODUCT_AMD_19_1X_PCIE_4 0x14ac /* 19h/1xh PCIE */ -#define PCI_PRODUCT_AMD_19_1X_PCIE_5 0x14ab /* 19h/1xh PCIE */ +#define PCI_PRODUCT_AMD_19_1X_PCIE_4 0x14ab /* 19h/1xh PCIE */ +#define PCI_PRODUCT_AMD_19_1X_PCIE_5 0x14ac /* 19h/1xh PCIE */ #define PCI_PRODUCT_AMD_19_1X_DF_1 0x14ad /* 19h/1xh Data Fabric */ #define PCI_PRODUCT_AMD_19_1X_DF_2 0x14ae /* 19h/1xh Data Fabric */ #define PCI_PRODUCT_AMD_19_1X_DF_3 0x14af /* 19h/1xh Data Fabric */ @@ -1182,8 +1182,8 @@ #define PCI_PRODUCT_AQUANTIA_AQC108 0x08b1 /* AQC108 */ #define PCI_PRODUCT_AQUANTIA_AQC109 0x09b1 /* AQC109 */ #define PCI_PRODUCT_AQUANTIA_AQC111 0x11b1 /* AQC111 */ -#define PCI_PRODUCT_AQUANTIA_AQC112 0x12b1 /* AQC112 */ #define PCI_PRODUCT_AQUANTIA_AQC116C 0x11c0 /* AQC116C */ +#define PCI_PRODUCT_AQUANTIA_AQC112 0x12b1 /* AQC112 */ #define PCI_PRODUCT_AQUANTIA_AQC115C 0x12c0 /* AQC115C */ #define PCI_PRODUCT_AQUANTIA_AQC113C 0x14c0 /* AQC113C */ #define PCI_PRODUCT_AQUANTIA_AQC113CA 0x34c0 /* AQC113CA */ @@ -8805,10 +8805,10 @@ #define PCI_PRODUCT_REALTEK_RTL8821AE 0x8821 /* 8821AE */ #define PCI_PRODUCT_REALTEK_RTL8852AE 0x8852 /* 8852AE */ #define PCI_PRODUCT_REALTEK_RTL8852AE_VT 0xa85a /* 8852AE-VT */ -#define PCI_PRODUCT_REALTEK_RTL8852BE 0xb852 /* 8852BE */ -#define PCI_PRODUCT_REALTEK_RTL8852BE_2 0xb85b /* 8852BE */ #define PCI_PRODUCT_REALTEK_RTL8723BE 0xb723 /* 8723BE */ #define PCI_PRODUCT_REALTEK_RTL8822BE 0xb822 /* 8822BE */ +#define PCI_PRODUCT_REALTEK_RTL8852BE 0xb852 /* 8852BE */ +#define PCI_PRODUCT_REALTEK_RTL8852BE_2 0xb85b /* 8852BE */ #define PCI_PRODUCT_REALTEK_RTL8821CE 0xc821 /* 8821CE */ #define PCI_PRODUCT_REALTEK_RTL8822CE 0xc822 /* 8822CE */ #define PCI_PRODUCT_REALTEK_RTL8852CE 0xc852 /* 8852CE */ @@ -9342,11 +9342,11 @@ #define PCI_PRODUCT_SYMBIOS_YELLOWFIN_2 0x0702 /* Yellowfin */ #define PCI_PRODUCT_SYMBIOS_61C102 0x0901 /* 61C102 */ #define PCI_PRODUCT_SYMBIOS_63C815 0x1000 /* 63C815 */ +#define PCI_PRODUCT_SYMBIOS_1030R 0x1030 /* 53c1030R */ #define PCI_PRODUCT_SYMBIOS_MEGARAID_39XX 0x10e1 /* MegaRAID SAS39XX */ #define PCI_PRODUCT_SYMBIOS_MEGARAID_39XX_2 0x10e2 /* MegaRAID SAS39XX */ #define PCI_PRODUCT_SYMBIOS_MEGARAID_38XX 0x10e5 /* MegaRAID SAS38XX */ #define PCI_PRODUCT_SYMBIOS_MEGARAID_38XX_2 0x10e6 /* MegaRAID SAS38XX */ -#define PCI_PRODUCT_SYMBIOS_1030R 0x1030 /* 53c1030R */ #define PCI_PRODUCT_SYMBIOS_MEGARAID 0x1960 /* MegaRAID */ /* Packet Engines products */ @@ -9963,16 +9963,16 @@ #define PCI_PRODUCT_VORTEX_GDT_ICP 0x0300 /* ICP */ #define PCI_PRODUCT_VORTEX_GDT_ICP2 0x0301 /* ICP */ +/* Beijing WangXun Technology products */ +#define PCI_PRODUCT_WANGXUN_WX1860A2 0x0101 /* WX1860A2 */ +#define PCI_PRODUCT_WANGXUN_WX1860AL1 0x010b /* WX1860AL1 */ + /* Nanjing QinHeng Electronics products */ #define PCI_PRODUCT_WCH_CH352 0x3253 /* CH352 */ #define PCI_PRODUCT_WCH2_CH351 0x2273 /* CH351 */ #define PCI_PRODUCT_WCH2_CH382_2 0x3250 /* CH382 */ #define PCI_PRODUCT_WCH2_CH382_1 0x3253 /* CH382 */ -/* Beijing WangXun Technology products */ -#define PCI_PRODUCT_WANGXUN_WX1860A2 0x0101 /* WX1860A2 */ -#define PCI_PRODUCT_WANGXUN_WX1860AL1 0x010b /* WX1860AL1 */ - /* Western Digital products */ #define PCI_PRODUCT_WD_WD33C193A 0x0193 /* WD33C193A */ #define PCI_PRODUCT_WD_WD33C196A 0x0196 /* WD33C196A */ diff --git a/sys/dev/pci/pcidevs_data.h b/sys/dev/pci/pcidevs_data.h index 8c9c40338..32dad94c9 100644 --- a/sys/dev/pci/pcidevs_data.h +++ b/sys/dev/pci/pcidevs_data.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2074 2024/04/20 08:54:01 jsg Exp + * OpenBSD: pcidevs,v 1.2075 2024/05/21 07:03:55 jsg Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -2911,14 +2911,14 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC111, "AQC111", }, - { - PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC112, - "AQC112", - }, { PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC116C, "AQC116C", }, + { + PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC112, + "AQC112", + }, { PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC115C, "AQC115C", @@ -31767,14 +31767,6 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8852AE_VT, "8852AE-VT", }, - { - PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8852BE, - "8852BE", - }, - { - PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8852BE_2, - "8852BE", - }, { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8723BE, "8723BE", @@ -31783,6 +31775,14 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8822BE, "8822BE", }, + { + PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8852BE, + "8852BE", + }, + { + PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8852BE_2, + "8852BE", + }, { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8821CE, "8821CE", @@ -33619,6 +33619,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_63C815, "63C815", }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1030R, + "53c1030R", + }, { PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_39XX, "MegaRAID SAS39XX", @@ -33635,10 +33639,6 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_38XX_2, "MegaRAID SAS38XX", }, - { - PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1030R, - "53c1030R", - }, { PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID, "MegaRAID", @@ -35827,6 +35827,14 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_ICP2, "ICP", }, + { + PCI_VENDOR_WANGXUN, PCI_PRODUCT_WANGXUN_WX1860A2, + "WX1860A2", + }, + { + PCI_VENDOR_WANGXUN, PCI_PRODUCT_WANGXUN_WX1860AL1, + "WX1860AL1", + }, { PCI_VENDOR_WCH, PCI_PRODUCT_WCH_CH352, "CH352", @@ -35843,14 +35851,6 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_WCH2, PCI_PRODUCT_WCH2_CH382_1, "CH382", }, - { - PCI_VENDOR_WANGXUN, PCI_PRODUCT_WANGXUN_WX1860A2, - "WX1860A2", - }, - { - PCI_VENDOR_WANGXUN, PCI_PRODUCT_WANGXUN_WX1860AL1, - "WX1860AL1", - }, { PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C193A, "WD33C193A", diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 039272429..6ac839921 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1,4 +1,4 @@ -$OpenBSD: usbdevs,v 1.763 2024/05/15 01:41:19 kevlo Exp $ +$OpenBSD: usbdevs,v 1.764 2024/05/21 07:13:29 jsg Exp $ /* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */ /* @@ -1004,8 +1004,8 @@ product APPLE WELLSPRING9_JIS 0x0274 Keyboard/Trackpad product APPLE WELLSPRING8_ANSI 0x0290 Keyboard/Trackpad product APPLE WELLSPRING8_ISO 0x0291 Keyboard/Trackpad product APPLE WELLSPRING8_JIS 0x0292 Keyboard/Trackpad -product APPLE WELLSPRINGM1_J293 0x0341 Keyboard/Trackpad product APPLE OPTMOUSE 0x0302 Optical mouse +product APPLE WELLSPRINGM1_J293 0x0341 Keyboard/Trackpad product APPLE BLUETOOTH_HCI 0x1000 HID-proxy product APPLE SPEAKERS 0x1101 Speakers product APPLE IPHONE 0x1290 iPhone diff --git a/sys/dev/usb/usbdevs.h b/sys/dev/usb/usbdevs.h index 82bf062f5..175e56ce2 100644 --- a/sys/dev/usb/usbdevs.h +++ b/sys/dev/usb/usbdevs.h @@ -1,10 +1,10 @@ -/* $OpenBSD: usbdevs.h,v 1.775 2024/05/15 01:41:41 kevlo Exp $ */ +/* $OpenBSD: usbdevs.h,v 1.776 2024/05/21 07:14:20 jsg Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: usbdevs,v 1.763 2024/05/15 01:41:19 kevlo Exp + * OpenBSD: usbdevs,v 1.764 2024/05/21 07:13:29 jsg Exp */ /* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */ @@ -1011,8 +1011,8 @@ #define USB_PRODUCT_APPLE_WELLSPRING8_ANSI 0x0290 /* Keyboard/Trackpad */ #define USB_PRODUCT_APPLE_WELLSPRING8_ISO 0x0291 /* Keyboard/Trackpad */ #define USB_PRODUCT_APPLE_WELLSPRING8_JIS 0x0292 /* Keyboard/Trackpad */ -#define USB_PRODUCT_APPLE_WELLSPRINGM1_J293 0x0341 /* Keyboard/Trackpad */ #define USB_PRODUCT_APPLE_OPTMOUSE 0x0302 /* Optical mouse */ +#define USB_PRODUCT_APPLE_WELLSPRINGM1_J293 0x0341 /* Keyboard/Trackpad */ #define USB_PRODUCT_APPLE_BLUETOOTH_HCI 0x1000 /* HID-proxy */ #define USB_PRODUCT_APPLE_SPEAKERS 0x1101 /* Speakers */ #define USB_PRODUCT_APPLE_IPHONE 0x1290 /* iPhone */ diff --git a/sys/dev/usb/usbdevs_data.h b/sys/dev/usb/usbdevs_data.h index c59bae93f..7efe52577 100644 --- a/sys/dev/usb/usbdevs_data.h +++ b/sys/dev/usb/usbdevs_data.h @@ -1,10 +1,10 @@ -/* $OpenBSD: usbdevs_data.h,v 1.769 2024/05/15 01:41:41 kevlo Exp $ */ +/* $OpenBSD: usbdevs_data.h,v 1.770 2024/05/21 07:14:20 jsg Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: usbdevs,v 1.763 2024/05/15 01:41:19 kevlo Exp + * OpenBSD: usbdevs,v 1.764 2024/05/21 07:13:29 jsg Exp */ /* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */ @@ -925,14 +925,14 @@ const struct usb_known_product usb_known_products[] = { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_WELLSPRING8_JIS, "Keyboard/Trackpad", }, - { - USB_VENDOR_APPLE, USB_PRODUCT_APPLE_WELLSPRINGM1_J293, - "Keyboard/Trackpad", - }, { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_OPTMOUSE, "Optical mouse", }, + { + USB_VENDOR_APPLE, USB_PRODUCT_APPLE_WELLSPRINGM1_J293, + "Keyboard/Trackpad", + }, { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HCI, "HID-proxy", diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index f881ff1c5..029b59309 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.220 2024/01/19 01:43:26 bluhm Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.221 2024/05/20 10:32:20 claudio Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -132,8 +132,6 @@ exit1(struct proc *p, int xexit, int xsig, int flags) /* nope, multi-threaded */ if (flags == EXIT_NORMAL) single_thread_set(p, SINGLE_EXIT); - else if (flags == EXIT_THREAD) - single_thread_check(p, 0); } if (flags == EXIT_NORMAL && !(pr->ps_flags & PS_EXITING)) { @@ -157,15 +155,27 @@ exit1(struct proc *p, int xexit, int xsig, int flags) } /* unlink ourselves from the active threads */ - SCHED_LOCK(s); + mtx_enter(&pr->ps_mtx); TAILQ_REMOVE(&pr->ps_threads, p, p_thr_link); - SCHED_UNLOCK(s); + pr->ps_threadcnt--; + pr->ps_exitcnt++; + + /* + * if somebody else wants to take us to single threaded mode, + * count ourselves out. + */ + if (pr->ps_single) { + if (--pr->ps_singlecnt == 0) + wakeup(&pr->ps_singlecnt); + } if ((p->p_flag & P_THREAD) == 0) { /* main thread gotta wait because it has the pid, et al */ - while (pr->ps_threadcnt > 1) - tsleep_nsec(&pr->ps_threads, PWAIT, "thrdeath", INFSLP); + while (pr->ps_threadcnt + pr->ps_exitcnt > 1) + msleep_nsec(&pr->ps_threads, &pr->ps_mtx, PWAIT, + "thrdeath", INFSLP); } + mtx_leave(&pr->ps_mtx); rup = pr->ps_ru; if (rup == NULL) { @@ -352,9 +362,11 @@ exit1(struct proc *p, int xexit, int xsig, int flags) /* just a thread? detach it from its process */ if (p->p_flag & P_THREAD) { /* scheduler_wait_hook(pr->ps_mainproc, p); XXX */ - if (--pr->ps_threadcnt == 1) + mtx_enter(&pr->ps_mtx); + pr->ps_exitcnt--; + if (pr->ps_threadcnt + pr->ps_exitcnt == 1) wakeup(&pr->ps_threads); - KASSERT(pr->ps_threadcnt > 0); + mtx_leave(&pr->ps_mtx); } /* @@ -829,7 +841,8 @@ process_zap(struct process *pr) if (otvp) vrele(otvp); - KASSERT(pr->ps_threadcnt == 1); + KASSERT(pr->ps_threadcnt == 0); + KASSERT(pr->ps_exitcnt == 1); if (pr->ps_ptstat != NULL) free(pr->ps_ptstat, M_SUBPROC, sizeof(*pr->ps_ptstat)); pool_put(&rusage_pool, pr->ps_ru); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index cb04697ab..27e043cb1 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.257 2024/01/24 19:23:38 cheloha Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.258 2024/05/20 10:32:20 claudio Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -535,7 +535,7 @@ thread_fork(struct proc *curp, void *stack, void *tcb, pid_t *tidptr, struct proc *p; pid_t tid; vaddr_t uaddr; - int s, error; + int error; if (stack == NULL) return EINVAL; @@ -559,7 +559,6 @@ thread_fork(struct proc *curp, void *stack, void *tcb, pid_t *tidptr, /* other links */ p->p_p = pr; - pr->ps_threadcnt++; /* local copies */ p->p_fd = pr->ps_fd; @@ -578,18 +577,19 @@ thread_fork(struct proc *curp, void *stack, void *tcb, pid_t *tidptr, LIST_INSERT_HEAD(&allproc, p, p_list); LIST_INSERT_HEAD(TIDHASH(p->p_tid), p, p_hash); - SCHED_LOCK(s); + mtx_enter(&pr->ps_mtx); TAILQ_INSERT_TAIL(&pr->ps_threads, p, p_thr_link); + pr->ps_threadcnt++; /* * if somebody else wants to take us to single threaded mode, * count ourselves in. */ if (pr->ps_single) { - atomic_inc_int(&pr->ps_singlecount); + pr->ps_singlecnt++; atomic_setbits_int(&p->p_flag, P_SUSPSINGLE); } - SCHED_UNLOCK(s); + mtx_leave(&pr->ps_mtx); /* * Return tid to parent thread and copy it out to userspace diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 22ccc54c7..4890a75f2 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_proc.c,v 1.97 2024/01/19 01:43:27 bluhm Exp $ */ +/* $OpenBSD: kern_proc.c,v 1.98 2024/05/20 10:32:20 claudio Exp $ */ /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ /* @@ -495,9 +495,9 @@ proc_printit(struct proc *p, const char *modif, p->p_p->ps_flags, PS_BITS, p->p_flag, P_BITS); (*pr)(" runpri=%u, usrpri=%u, slppri=%u, nice=%d\n", p->p_runpri, p->p_usrpri, p->p_slppri, p->p_p->ps_nice); - (*pr)(" wchan=%p, wmesg=%s, ps_single=%p\n", + (*pr)(" wchan=%p, wmesg=%s, ps_single=%p scnt=%d ecnt=%d\n", p->p_wchan, (p->p_wchan && p->p_wmesg) ? p->p_wmesg : "", - p->p_p->ps_single); + p->p_p->ps_single, p->p_p->ps_singlecnt, p->p_p->ps_exitcnt); (*pr)(" forw=%p, list=%p,%p\n", TAILQ_NEXT(p, p_runq), p->p_list.le_next, p->p_list.le_prev); (*pr)(" process=%p user=%p, vmspace=%p\n", diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index abe7d4f76..fa2e808c0 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.81 2024/04/17 09:41:44 claudio Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.82 2024/05/20 10:32:20 claudio Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -212,11 +212,13 @@ donice(struct proc *curp, struct process *chgpr, int n) if (n < chgpr->ps_nice && suser(curp)) return (EACCES); chgpr->ps_nice = n; - SCHED_LOCK(s); + mtx_enter(&chgpr->ps_mtx); TAILQ_FOREACH(p, &chgpr->ps_threads, p_thr_link) { + SCHED_LOCK(s); setpriority(p, p->p_estcpu, n); + SCHED_UNLOCK(s); } - SCHED_UNLOCK(s); + mtx_leave(&chgpr->ps_mtx); return (0); } diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index ba19fb015..35c8bdc37 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.327 2024/05/08 13:05:33 claudio Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.328 2024/05/20 10:32:20 claudio Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -2060,11 +2060,12 @@ userret(struct proc *p) } int -single_thread_check_locked(struct proc *p, int deep, int s) +single_thread_check_locked(struct proc *p, int deep) { struct process *pr = p->p_p; + int s; - SCHED_ASSERT_LOCKED(); + MUTEX_ASSERT_LOCKED(&pr->ps_mtx); if (pr->ps_single == NULL || pr->ps_single == p) return (0); @@ -2078,19 +2079,24 @@ single_thread_check_locked(struct proc *p, int deep, int s) return (EINTR); } - if (atomic_dec_int_nv(&pr->ps_singlecount) == 0) - wakeup(&pr->ps_singlecount); - if (pr->ps_flags & PS_SINGLEEXIT) { - SCHED_UNLOCK(s); + mtx_leave(&pr->ps_mtx); KERNEL_LOCK(); exit1(p, 0, 0, EXIT_THREAD_NOCHECK); /* NOTREACHED */ } + if (--pr->ps_singlecnt == 0) + wakeup(&pr->ps_singlecnt); + /* not exiting and don't need to unwind, so suspend */ + mtx_leave(&pr->ps_mtx); + + SCHED_LOCK(s); p->p_stat = SSTOP; mi_switch(); + SCHED_UNLOCK(s); + mtx_enter(&pr->ps_mtx); } while (pr->ps_single != NULL); return (0); @@ -2099,11 +2105,11 @@ single_thread_check_locked(struct proc *p, int deep, int s) int single_thread_check(struct proc *p, int deep) { - int s, error; + int error; - SCHED_LOCK(s); - error = single_thread_check_locked(p, deep, s); - SCHED_UNLOCK(s); + mtx_enter(&p->p_p->ps_mtx); + error = single_thread_check_locked(p, deep); + mtx_leave(&p->p_p->ps_mtx); return error; } @@ -2126,10 +2132,10 @@ single_thread_set(struct proc *p, int flags) KASSERT(curproc == p); - SCHED_LOCK(s); - error = single_thread_check_locked(p, flags & SINGLE_DEEP, s); + mtx_enter(&pr->ps_mtx); + error = single_thread_check_locked(p, flags & SINGLE_DEEP); if (error) { - SCHED_UNLOCK(s); + mtx_leave(&pr->ps_mtx); return error; } @@ -2148,27 +2154,17 @@ single_thread_set(struct proc *p, int flags) panic("single_thread_mode = %d", mode); #endif } - pr->ps_singlecount = 0; - membar_producer(); pr->ps_single = p; + pr->ps_singlecnt = pr->ps_threadcnt; + TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) { if (q == p) continue; - if (q->p_flag & P_WEXIT) { - if (mode == SINGLE_EXIT) { - if (q->p_stat == SSTOP) { - unsleep(q); - setrunnable(q); - atomic_inc_int(&pr->ps_singlecount); - } - } - continue; - } + SCHED_LOCK(s); atomic_setbits_int(&q->p_flag, P_SUSPSINGLE); switch (q->p_stat) { case SIDL: - case SRUN: - atomic_inc_int(&pr->ps_singlecount); + case SDEAD: break; case SSLEEP: /* if it's not interruptible, then just have to wait */ @@ -2176,30 +2172,33 @@ single_thread_set(struct proc *p, int flags) /* merely need to suspend? just stop it */ if (mode == SINGLE_SUSPEND) { q->p_stat = SSTOP; + --pr->ps_singlecnt; break; } /* need to unwind or exit, so wake it */ unsleep(q); setrunnable(q); } - atomic_inc_int(&pr->ps_singlecount); break; case SSTOP: if (mode == SINGLE_EXIT) { unsleep(q); setrunnable(q); - atomic_inc_int(&pr->ps_singlecount); - } - break; - case SDEAD: + } else + --pr->ps_singlecnt; break; case SONPROC: - atomic_inc_int(&pr->ps_singlecount); signotify(q); + /* FALLTHROUGH */ + case SRUN: break; } + SCHED_UNLOCK(s); } - SCHED_UNLOCK(s); + + /* count ourselfs out */ + --pr->ps_singlecnt; + mtx_leave(&pr->ps_mtx); if ((flags & SINGLE_NOWAIT) == 0) single_thread_wait(pr, 1); @@ -2218,14 +2217,14 @@ single_thread_wait(struct process *pr, int recheck) int wait; /* wait until they're all suspended */ - wait = pr->ps_singlecount > 0; - while (wait) { - sleep_setup(&pr->ps_singlecount, PWAIT, "suspend"); - wait = pr->ps_singlecount > 0; - sleep_finish(0, wait); + mtx_enter(&pr->ps_mtx); + while ((wait = pr->ps_singlecnt > 0)) { + msleep_nsec(&pr->ps_singlecnt, &pr->ps_mtx, PWAIT, "suspend", + INFSLP); if (!recheck) break; } + mtx_leave(&pr->ps_mtx); return wait; } @@ -2240,9 +2239,10 @@ single_thread_clear(struct proc *p, int flag) KASSERT(pr->ps_single == p); KASSERT(curproc == p); - SCHED_LOCK(s); + mtx_enter(&pr->ps_mtx); pr->ps_single = NULL; atomic_clearbits_int(&pr->ps_flags, PS_SINGLEUNWIND | PS_SINGLEEXIT); + TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) { if (q == p || (q->p_flag & P_SUSPSINGLE) == 0) continue; @@ -2253,6 +2253,7 @@ single_thread_clear(struct proc *p, int flag) * then clearing that either makes it runnable or puts * it back into some sleep queue */ + SCHED_LOCK(s); if (q->p_stat == SSTOP && (q->p_flag & flag) == 0) { if (q->p_wchan == NULL) setrunnable(q); @@ -2261,8 +2262,9 @@ single_thread_clear(struct proc *p, int flag) q->p_stat = SSLEEP; } } + SCHED_UNLOCK(s); } - SCHED_UNLOCK(s); + mtx_leave(&pr->ps_mtx); } void diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index e613b6774..44fe89745 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.202 2024/04/18 08:59:38 claudio Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.203 2024/05/20 10:32:20 claudio Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -581,15 +581,18 @@ sys_sched_yield(struct proc *p, void *v, register_t *retval) uint8_t newprio; int s; - SCHED_LOCK(s); /* * If one of the threads of a multi-threaded process called * sched_yield(2), drop its priority to ensure its siblings * can make some progress. */ + mtx_enter(&p->p_p->ps_mtx); newprio = p->p_usrpri; TAILQ_FOREACH(q, &p->p_p->ps_threads, p_thr_link) newprio = max(newprio, q->p_runpri); + mtx_leave(&p->p_p->ps_mtx); + + SCHED_LOCK(s); setrunqueue(p->p_cpu, p, newprio); p->p_ru.ru_nvcsw++; mi_switch(); diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 84c00f0e4..8d31047ac 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_init.c,v 1.43 2019/12/26 13:30:54 bluhm Exp $ */ +/* $OpenBSD: vfs_init.c,v 1.44 2024/05/20 09:11:21 mvs Exp $ */ /* $NetBSD: vfs_init.c,v 1.6 1996/02/09 19:00:58 christos Exp $ */ /* @@ -92,7 +92,7 @@ static struct vfsconf vfsconflist[] = { #endif #ifdef FUSE - { &fusefs_vfsops, MOUNT_FUSEFS, 18, 0, MNT_LOCAL, + { &fusefs_vfsops, MOUNT_FUSEFS, 18, 0, 0, sizeof(struct fusefs_args) }, #endif diff --git a/sys/miscfs/fuse/fuse_vfsops.c b/sys/miscfs/fuse/fuse_vfsops.c index c848894b3..4a2a7a311 100644 --- a/sys/miscfs/fuse/fuse_vfsops.c +++ b/sys/miscfs/fuse/fuse_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vfsops.c,v 1.46 2024/05/07 14:27:11 mvs Exp $ */ +/* $OpenBSD: fuse_vfsops.c,v 1.47 2024/05/20 09:11:21 mvs Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -114,8 +114,6 @@ fusefs_mount(struct mount *mp, const char *path, void *data, fmp->allow_other = args->allow_other; mp->mnt_data = fmp; - /* FUSE file system is not truly local. */ - mp->mnt_flag &= ~MNT_LOCAL; vfs_getnewfsid(mp); memset(mp->mnt_stat.f_mntonname, 0, MNAMELEN); diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index e1a7a6209..d5e8e2c25 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.265 2024/04/21 17:32:10 florian Exp $ */ +/* $OpenBSD: in6.c,v 1.266 2024/05/21 15:12:25 florian Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -743,8 +743,12 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, /* * We are done if we have simply modified an existing address. */ - if (!hostIsNew) + if (!hostIsNew) { + /* DAD sends RTM_CHGADDRATTR when done. */ + if (!(ia6->ia6_flags & IN6_IFF_TENTATIVE)) + rtm_addr(RTM_CHGADDRATTR, &ia6->ia_ifa); return (error); + } /* * Beyond this point, we should call in6_purgeaddr upon an error, diff --git a/sys/sys/proc.h b/sys/sys/proc.h index f7398ff56..3d6719dc9 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.360 2024/04/18 10:29:39 claudio Exp $ */ +/* $OpenBSD: proc.h,v 1.361 2024/05/20 10:32:20 claudio Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -145,7 +145,7 @@ struct process { struct ucred *ps_ucred; /* Process owner's identity. */ LIST_ENTRY(process) ps_list; /* List of all processes. */ - TAILQ_HEAD(,proc) ps_threads; /* [K|S] Threads in this process. */ + TAILQ_HEAD(,proc) ps_threads; /* [K|m] Threads in this process. */ LIST_ENTRY(process) ps_pglist; /* List of processes in pgrp. */ struct process *ps_pptr; /* Pointer to parent process. */ @@ -180,8 +180,9 @@ struct process { u_int ps_flags; /* [a] PS_* flags. */ int ps_siglist; /* Signals pending for the process. */ - struct proc *ps_single; /* [S] Thread for single-threading. */ - u_int ps_singlecount; /* [a] Not yet suspended threads. */ + struct proc *ps_single; /* [m] Thread for single-threading. */ + u_int ps_singlecnt; /* [m] Number of threads to suspend. */ + u_int ps_exitcnt; /* [m] Number of threads in exit1. */ int ps_traceflag; /* Kernel trace points. */ struct vnode *ps_tracevp; /* Trace to vnode. */ @@ -252,7 +253,7 @@ struct process { /* End area that is copied on creation. */ #define ps_endcopy ps_threadcnt - u_int ps_threadcnt; /* Number of threads. */ + u_int ps_threadcnt; /* [m] Number of threads. */ struct timespec ps_start; /* starting uptime. */ struct timeout ps_realit_to; /* [m] ITIMER_REAL timeout */ @@ -322,13 +323,14 @@ struct p_inentry { * U uidinfolk * l read only reference, see lim_read_enter() * o owned (modified only) by this thread + * m this proc's' `p->p_p->ps_mtx' */ struct proc { TAILQ_ENTRY(proc) p_runq; /* [S] current run/sleep queue */ LIST_ENTRY(proc) p_list; /* List of all threads. */ struct process *p_p; /* [I] The process of this thread. */ - TAILQ_ENTRY(proc) p_thr_link; /* Threads in a process linkage. */ + TAILQ_ENTRY(proc) p_thr_link; /* [K|m] Threads in a process linkage. */ TAILQ_ENTRY(proc) p_fut_link; /* Threads in a futex linkage. */ struct futex *p_futex; /* Current sleeping futex. */ diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c index f15aee252..d6242a152 100644 --- a/sys/uvm/uvm_amap.c +++ b/sys/uvm/uvm_amap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_amap.c,v 1.94 2024/04/17 13:17:31 mpi Exp $ */ +/* $OpenBSD: uvm_amap.c,v 1.95 2024/05/20 17:03:36 dv Exp $ */ /* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */ /* @@ -450,7 +450,7 @@ amap_free(struct vm_amap *amap) KASSERT((amap->am_flags & AMAP_SWAPOFF) == 0); if (amap->am_lock != NULL) { - KASSERT(amap->am_lock == NULL || !rw_write_held(amap->am_lock)); + KASSERT(!rw_write_held(amap->am_lock)); rw_obj_free(amap->am_lock); } diff --git a/usr.bin/aucat/aucat.1 b/usr.bin/aucat/aucat.1 index d265d17e1..53c3eea02 100644 --- a/usr.bin/aucat/aucat.1 +++ b/usr.bin/aucat/aucat.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: aucat.1,v 1.122 2024/05/12 06:24:44 jsg Exp $ +.\" $OpenBSD: aucat.1,v 1.123 2024/05/21 05:09:29 ratchov Exp $ .\" .\" Copyright (c) 2006 Alexandre Ratchov .\" @@ -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: May 12 2024 $ +.Dd $Mdocdate: May 21 2024 $ .Dt AUCAT 1 .Os .Sh NAME @@ -126,7 +126,7 @@ The position is expressed as the number of samples (at device sample rate). Audio file type. The following file types are supported: .Pp -.Bl -tag -width auto -compact +.Bl -tag -width autoX -compact .It Cm raw Headerless file. .It Cm wav @@ -203,12 +203,12 @@ can be controlled through MIDI as follows: a MIDI channel is assigned to each stream, and the volume is changed using the standard volume controller (number 7). -.Pp The master volume can be changed using the standard master volume system exclusive message. .Pp All audio files are controlled by the following MMC messages: -.Bl -tag -width relocate -offset indent +.Pp +.Bl -tag -width relocateX -offset indent -compact .It relocate All files are relocated to the requested time position. If it is beyond the end of a file, the file is temporarily diff --git a/usr.bin/cvs/diff.h b/usr.bin/cvs/diff.h index 9c297d519..8951612d6 100644 --- a/usr.bin/cvs/diff.h +++ b/usr.bin/cvs/diff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.h,v 1.22 2010/07/28 21:19:30 nicm Exp $ */ +/* $OpenBSD: diff.h,v 1.23 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -110,13 +110,6 @@ int ed_patch_lines(struct rcs_lines *, struct rcs_lines *); extern int diff_format; extern int diff_context; extern int diff3_conflicts; -extern int diff_aflag; -extern int diff_bflag; -extern int diff_dflag; -extern int diff_iflag; -extern int diff_pflag; -extern int diff_wflag; -extern char *diff_file; extern char diffargs[512]; /* XXX */ extern BUF *diffbuf; extern RCSNUM *diff_rev1; diff --git a/usr.bin/cvs/history.c b/usr.bin/cvs/history.c index d9647b72e..0e2e70496 100644 --- a/usr.bin/cvs/history.c +++ b/usr.bin/cvs/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.45 2017/07/20 13:39:11 okan Exp $ */ +/* $OpenBSD: history.c,v 1.46 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2007 Joris Vink * @@ -29,8 +29,6 @@ #include "cvs.h" #include "remote.h" -void cvs_history_local(struct cvs_file *); - static void history_compress(char *, const char *); struct cvs_cmd cvs_cmd_history = { diff --git a/usr.bin/cvs/log.h b/usr.bin/cvs/log.h index 6ca152070..4759b2496 100644 --- a/usr.bin/cvs/log.h +++ b/usr.bin/cvs/log.h @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.23 2008/06/10 01:00:34 joris Exp $ */ +/* $OpenBSD: log.h,v 1.24 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -46,7 +46,6 @@ void cvs_log(u_int, const char *, ...) __attribute__((format(printf, 2, 3))); void cvs_vlog(u_int, const char *, va_list); int cvs_printf(const char *, ...) __attribute__((format(printf, 1, 2))); -int cvs_vprintf(const char *, va_list); void fatal(const char *, ...) __dead __attribute__((format(printf, 1,2))); #endif /* LOG_H */ diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h index 55d8696c4..bfd7e1ec4 100644 --- a/usr.bin/cvs/rcs.h +++ b/usr.bin/cvs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.103 2017/08/28 19:33:20 otto Exp $ */ +/* $OpenBSD: rcs.h,v 1.104 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -211,7 +211,6 @@ const RCSNUM *rcs_branch_get(RCSFILE *); int rcs_branch_set(RCSFILE *, const RCSNUM *); int rcs_access_add(RCSFILE *, const char *); int rcs_access_remove(RCSFILE *, const char *); -int rcs_access_check(RCSFILE *, const char *); struct rcs_delta *rcs_findrev(RCSFILE *, RCSNUM *); int rcs_sym_add(RCSFILE *, const char *, RCSNUM *); int rcs_sym_check(const char *); @@ -229,7 +228,6 @@ void rcs_desc_set(RCSFILE *, const char *); const char *rcs_comment_lookup(const char *); const char *rcs_comment_get(RCSFILE *); void rcs_comment_set(RCSFILE *, const char *); -BUF *rcs_kwexp_buf(BUF *, RCSFILE *, RCSNUM *); void rcs_kwexp_set(RCSFILE *, int); int rcs_kwexp_get(RCSFILE *); int rcs_rev_add(RCSFILE *, RCSNUM *, const char *, time_t, @@ -240,7 +238,6 @@ int rcs_rev_remove(RCSFILE *, RCSNUM *); int rcs_state_set(RCSFILE *, RCSNUM *, const char *); const char *rcs_state_get(RCSFILE *, RCSNUM *); int rcs_state_check(const char *); -RCSNUM *rcs_tag_resolve(RCSFILE *, const char *); void rcs_write(RCSFILE *); int rcs_rev_write_stmp(RCSFILE *, RCSNUM *, char *, int); void rcs_rev_write_fd(RCSFILE *, RCSNUM *, int, int); @@ -252,8 +249,6 @@ BUF *rcs_rev_getbuf(RCSFILE *, RCSNUM *, int); void rcs_delta_stats(struct rcs_delta *, int *, int *); int rcs_kflag_get(const char *); -void rcs_kflag_usage(void); -int rcs_kw_expand(RCSFILE *, u_char *, size_t, size_t *); RCSNUM *rcsnum_alloc(void); RCSNUM *rcsnum_parse(const char *); diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h index 3d67704ee..e4aae79ab 100644 --- a/usr.bin/cvs/remote.h +++ b/usr.bin/cvs/remote.h @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.h,v 1.38 2017/08/28 19:33:20 otto Exp $ */ +/* $OpenBSD: remote.h,v 1.39 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2006 Joris Vink * @@ -49,7 +49,6 @@ extern int server_response; #define CVS_SERVER_QUESTIONABLE '?' void cvs_client_connect_to_server(void); -void cvs_client_disconnect(void); void cvs_client_send_logmsg(char *); void cvs_client_send_request(char *, ...) __attribute__((format(printf, 1, 2))); diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index c032350c5..bfcedb809 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.h,v 1.34 2020/11/01 18:16:08 jcs Exp $ */ +/* $OpenBSD: diff.h,v 1.35 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 1991, 1993 @@ -90,9 +90,6 @@ extern regex_t ignore_re; char *splice(char *, char *); int diffreg(char *, char *, int); -int easprintf(char **, const char *, ...); -void *emalloc(size_t); -void *erealloc(void *, size_t); void diffdir(char *, char *, int); void print_only(const char *, size_t, const char *); void print_status(int, char *, char *, char *); diff --git a/usr.bin/fgen/fgen.l b/usr.bin/fgen/fgen.l index cbaa70133..797c0c2f8 100644 --- a/usr.bin/fgen/fgen.l +++ b/usr.bin/fgen/fgen.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: fgen.l,v 1.17 2024/02/14 02:40:02 jsg Exp $ */ +/* $OpenBSD: fgen.l,v 1.18 2024/05/20 19:16:48 sobrado Exp $ */ /* $NetBSD: fgen.l,v 1.37 2016/03/08 20:13:44 christos Exp $ */ /* FLEX input for FORTH input file scanner */ /* @@ -1007,8 +1007,8 @@ apply_macros(YY_BUFFER_STATE yinput, const char *str) static void usage(void) { - (void)fprintf(stderr, "%s: [-d level] [-o outfile] \n", - getprogname()); + (void)fprintf(stderr, "usage: %s [-d level] [-o outfile] infile\n", + getprogname()); exit(EXIT_FAILURE); } diff --git a/usr.bin/fstat/fstat.h b/usr.bin/fstat/fstat.h index 3079fba06..df638eeab 100644 --- a/usr.bin/fstat/fstat.h +++ b/usr.bin/fstat/fstat.h @@ -40,7 +40,6 @@ extern int cflg; extern int fsflg; extern int sflg; extern int signo; -extern int error; extern struct fileargs fileargs; extern char *__progname; diff --git a/usr.bin/ftp/extern.h b/usr.bin/ftp/extern.h index 892afde13..e8a8b3bbb 100644 --- a/usr.bin/ftp/extern.h +++ b/usr.bin/ftp/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.53 2022/09/15 12:47:10 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.54 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: extern.h,v 1.17 1997/08/18 10:20:19 lukem Exp $ */ /* @@ -70,7 +70,6 @@ void abortrecv(int); void alarmtimer(int); int another(int *, char ***, const char *); int auto_fetch(int, char **, char *); -void blkfree(char **); void cdup(int, char **); void cmdabort(int); void cmdscanner(int); diff --git a/usr.bin/ftp/stringlist.h b/usr.bin/ftp/stringlist.h index bb2eaf5ee..5e9e090a9 100644 --- a/usr.bin/ftp/stringlist.h +++ b/usr.bin/ftp/stringlist.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stringlist.h,v 1.8 2019/05/16 12:44:18 florian Exp $ */ +/* $OpenBSD: stringlist.h,v 1.9 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: stringlist.h,v 1.2 1997/01/17 06:11:36 lukem Exp $ */ /* @@ -47,7 +47,6 @@ __BEGIN_DECLS StringList *sl_init(void); void sl_add(StringList *, char *); void sl_free(StringList *, int); -char *sl_find(StringList *, char *); __END_DECLS #endif /* _STRINGLIST_H */ diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h index ea8406b85..c7defe46c 100644 --- a/usr.bin/m4/extern.h +++ b/usr.bin/m4/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.55 2017/06/15 13:48:42 bcallah Exp $ */ +/* $OpenBSD: extern.h,v 1.56 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */ /*- @@ -93,7 +93,6 @@ extern int exit_code; /* misc.c */ extern void chrsave(int); -extern char *compute_prevep(void); extern void getdiv(int); extern ptrdiff_t indx(const char *, const char *); extern void initspaces(void); diff --git a/usr.bin/mail/extern.h b/usr.bin/mail/extern.h index 60a1088b8..955083980 100644 --- a/usr.bin/mail/extern.h +++ b/usr.bin/mail/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.29 2018/09/16 02:38:57 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.30 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: extern.h,v 1.7 1997/07/09 05:22:00 mikel Exp $ */ /*- @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.2 (Berkeley) 4/20/95 - * $OpenBSD: extern.h,v 1.29 2018/09/16 02:38:57 millert Exp $ + * $OpenBSD: extern.h,v 1.30 2024/05/21 05:00:48 jsg Exp $ */ struct name; @@ -147,7 +147,6 @@ struct ignoretab; int ignore1(char **, struct ignoretab *, char *); int ignoresig(int, struct sigaction *, sigset_t *); int igshow(struct ignoretab *, char *); -void intr(int); int inc(void *); int incfile(void); int isdate(char *); @@ -235,7 +234,6 @@ void sreset(void); pid_t start_command(char *cmd, sigset_t *nset, int infd, int outfd, ...); pid_t start_commandv(char *, sigset_t *, int, int, __va_list); int statusput(struct message *, FILE *, char *); -void stop(int); int stouch(void *); int swrite(void *); void tinit(void); @@ -247,7 +245,6 @@ int type(void *); int type1(int *, char *, int, int); int undeletecmd(void *); void unmark(int); -char **unpack(struct name *, struct name *); int unread(void *); void unregister_file(FILE *); int unset(void *); diff --git a/usr.bin/make/error.h b/usr.bin/make/error.h index a9ea1b4bf..6a5f83c09 100644 --- a/usr.bin/make/error.h +++ b/usr.bin/make/error.h @@ -1,6 +1,6 @@ #ifndef ERROR_H #define ERROR_H -/* $OpenBSD: error.h,v 1.13 2015/09/27 16:58:16 guenther Exp $ */ +/* $OpenBSD: error.h,v 1.14 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -59,7 +59,4 @@ extern void Finish(void); extern void Parse_Error(int, const char *, ...) __attribute__((__format__ (printf, 2, 3))); extern int fatal_errors; -/* Needed for fatal errors: we have to know whether we must abort other jobs - * or not */ -extern bool supervise_jobs; #endif diff --git a/usr.bin/make/init.h b/usr.bin/make/init.h index 2b9ca15ee..3720999ce 100644 --- a/usr.bin/make/init.h +++ b/usr.bin/make/init.h @@ -1,6 +1,6 @@ #ifndef INIT_H #define INIT_H -/* $OpenBSD: init.h,v 1.3 2010/07/19 19:46:44 espie Exp $ */ +/* $OpenBSD: init.h,v 1.4 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -32,6 +32,5 @@ * modules. */ extern void Init(void); -extern void End(void); #endif diff --git a/usr.bin/make/job.h b/usr.bin/make/job.h index 3b86c90a1..538605ec4 100644 --- a/usr.bin/make/job.h +++ b/usr.bin/make/job.h @@ -1,7 +1,7 @@ #ifndef _JOB_H_ #define _JOB_H_ -/* $OpenBSD: job.h,v 1.38 2020/06/03 12:41:39 espie Exp $ */ +/* $OpenBSD: job.h,v 1.39 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: job.h,v 1.5 1996/11/06 17:59:10 christos Exp $ */ /* @@ -93,7 +93,6 @@ extern void handle_all_signals(void); extern void determine_expensive_job(Job *); extern Job *runningJobs, *errorJobs, *availableJobs; extern void debug_job_printf(const char *, ...); -extern void handle_one_job(Job *); extern int check_dying_signal(void); extern const char *basedirectory; diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index a6dc2f9df..0c916c41d 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targ.c,v 1.86 2023/09/04 11:35:11 espie Exp $ */ +/* $OpenBSD: targ.c,v 1.87 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* @@ -88,11 +88,6 @@ * * Targ_Precious Return true if the target is precious and * should not be removed if we are interrupted. - * - * Debugging: - * Targ_PrintGraph Print out the entire graphm all variables - * and statistics for the directory cache. Should - * print something for suffixes, too, but... */ #include diff --git a/usr.bin/make/targ.h b/usr.bin/make/targ.h index 2d18fb61e..5212d0256 100644 --- a/usr.bin/make/targ.h +++ b/usr.bin/make/targ.h @@ -1,6 +1,6 @@ #ifndef TARG_H #define TARG_H -/* $OpenBSD: targ.h,v 1.15 2020/01/13 15:41:53 espie Exp $ */ +/* $OpenBSD: targ.h,v 1.16 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -56,7 +56,6 @@ extern bool Targ_Silent(GNode *); extern bool Targ_Precious(GNode *); extern void Targ_PrintCmd(void *); extern void Targ_PrintType(int); -extern void Targ_PrintGraph(int); extern bool node_is_real(GNode *); extern GNode *begin_node, *end_node, *interrupt_node, *DEFAULT; diff --git a/usr.bin/make/var.h b/usr.bin/make/var.h index 7ea1e9e58..e4751902a 100644 --- a/usr.bin/make/var.h +++ b/usr.bin/make/var.h @@ -1,6 +1,6 @@ #ifndef VAR_H #define VAR_H -/* $OpenBSD: var.h,v 1.20 2019/12/21 15:31:54 espie Exp $ */ +/* $OpenBSD: var.h,v 1.21 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2001 Marc Espie. * @@ -75,9 +75,6 @@ extern void Var_Deletei(const char *, const char *); /* SymTable_Init(t); * Inits the local symtable in a GNode. */ extern void SymTable_Init(SymTable *); -/* SymTable_destroy(t); - * Destroys the local symtable in a GNode. */ -extern void SymTable_Destroy(SymTable *); /* Several ways to parse a variable specification. */ /* value = Var_Parse(varspec, ctxt, undef_is_bad, &length, &freeit); diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h index 4cdea3160..28a0e8319 100644 --- a/usr.bin/mandoc/libmdoc.h +++ b/usr.bin/mandoc/libmdoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libmdoc.h,v 1.88 2018/12/31 04:55:42 schwarze Exp $ */ +/* $OpenBSD: libmdoc.h,v 1.89 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze @@ -75,7 +75,6 @@ void mdoc_tail_alloc(struct roff_man *, int, int, struct roff_node *mdoc_endbody_alloc(struct roff_man *, int, int, enum roff_tok, struct roff_node *); void mdoc_state(struct roff_man *, struct roff_node *); -const char *mdoc_a2arch(const char *); const char *mdoc_a2att(const char *); enum roff_sec mdoc_a2sec(const char *); const char *mdoc_a2st(const char *); diff --git a/usr.bin/mandoc/tbl_int.h b/usr.bin/mandoc/tbl_int.h index 299ceaaf7..39276e1af 100644 --- a/usr.bin/mandoc/tbl_int.h +++ b/usr.bin/mandoc/tbl_int.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tbl_int.h,v 1.2 2018/12/14 06:33:03 schwarze Exp $ */ +/* $OpenBSD: tbl_int.h,v 1.3 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011,2013,2015,2017,2018 Ingo Schwarze @@ -44,4 +44,3 @@ void tbl_option(struct tbl_node *, int, const char *, int *); void tbl_layout(struct tbl_node *, int, const char *, int); void tbl_data(struct tbl_node *, int, const char *, int); void tbl_cdata(struct tbl_node *, int, const char *, int); -void tbl_reset(struct tbl_node *); diff --git a/usr.bin/mg/cmode.c b/usr.bin/mg/cmode.c index 5155a7545..4a91c591c 100644 --- a/usr.bin/mg/cmode.c +++ b/usr.bin/mg/cmode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmode.c,v 1.22 2023/04/21 13:39:37 op Exp $ */ +/* $OpenBSD: cmode.c,v 1.23 2024/05/21 05:00:48 jsg Exp $ */ /* * This file is in the public domain. * @@ -35,7 +35,6 @@ static struct line *findnonblank(struct line *); static int isnonblank(const struct line *, int); void cmode_init(void); -int cc_comment(int, int); /* Keymaps */ diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h index 65ae2b43c..403635036 100644 --- a/usr.bin/mg/def.h +++ b/usr.bin/mg/def.h @@ -1,4 +1,4 @@ -/* $OpenBSD: def.h,v 1.180 2023/04/21 13:39:37 op Exp $ */ +/* $OpenBSD: def.h,v 1.181 2024/05/21 05:00:48 jsg Exp $ */ /* This file is in the public domain. */ @@ -754,7 +754,6 @@ extern int curgoal; extern int startrow; extern int epresf; extern int sgarbf; -extern int mode; extern int nrow; extern int ncol; extern int ttrow; diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c index de22013b2..41b25409e 100644 --- a/usr.bin/nm/nm.c +++ b/usr.bin/nm/nm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nm.c,v 1.55 2022/12/04 23:50:49 cheloha Exp $ */ +/* $OpenBSD: nm.c,v 1.56 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */ /* @@ -84,7 +84,6 @@ int rev; int fname(const void *, const void *); int rname(const void *, const void *); int value(const void *, const void *); -char *otherstring(struct xnlist *); int (*sfunc)(const void *, const void *) = fname; char typeletter(struct xnlist *); int mmbr_name(struct ar_hdr *, char **, int, int *, FILE *); diff --git a/usr.bin/openssl/apps.h b/usr.bin/openssl/apps.h index 1c0a2ebea..7a59b737e 100644 --- a/usr.bin/openssl/apps.h +++ b/usr.bin/openssl/apps.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.h,v 1.36 2024/05/18 08:48:31 jsg Exp $ */ +/* $OpenBSD: apps.h,v 1.37 2024/05/21 05:00:48 jsg Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -149,7 +149,6 @@ int ui_read(UI *ui, UI_STRING *uis); int ui_write(UI *ui, UI_STRING *uis); int ui_close(UI *ui); -int should_retry(int i); int str2fmt(char *s); void program_name(char *in, char *out, int size); #ifdef HEADER_X509_H diff --git a/usr.bin/rcs/rcs.h b/usr.bin/rcs/rcs.h index ec672a130..6215c566b 100644 --- a/usr.bin/rcs/rcs.h +++ b/usr.bin/rcs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.18 2017/08/29 16:47:33 otto Exp $ */ +/* $OpenBSD: rcs.h,v 1.19 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -223,7 +223,6 @@ int rcs_head_set(RCSFILE *, RCSNUM *); const RCSNUM *rcs_branch_get(RCSFILE *); int rcs_access_add(RCSFILE *, const char *); int rcs_access_remove(RCSFILE *, const char *); -int rcs_access_check(RCSFILE *, const char *); struct rcs_delta *rcs_findrev(RCSFILE *, RCSNUM *); int rcs_sym_add(RCSFILE *, const char *, RCSNUM *); int rcs_sym_remove(RCSFILE *, const char *); @@ -251,8 +250,6 @@ void rcs_write(RCSFILE *); void rcs_delta_stats(struct rcs_delta *, int *, int *); int rcs_kflag_get(const char *); -void rcs_kflag_usage(void); -int rcs_kw_expand(RCSFILE *, u_char *, size_t, size_t *); RCSNUM *rcsnum_alloc(void); RCSNUM *rcsnum_parse(const char *); diff --git a/usr.bin/rdist/defs.h b/usr.bin/rdist/defs.h index 3b0688e40..dc7ec1e91 100644 --- a/usr.bin/rdist/defs.h +++ b/usr.bin/rdist/defs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: defs.h,v 1.39 2021/06/22 20:19:28 jmc Exp $ */ +/* $OpenBSD: defs.h,v 1.40 2024/05/21 05:00:48 jsg Exp $ */ #ifndef __DEFS_H__ #define __DEFS_H__ @@ -184,7 +184,6 @@ ssize_t xwrite(int, void *, size_t); int init(int, char **, char **); void finish(void); void lostconn(void); -void coredump(void); void sighandler(int); int sendcmd(char, const char *, ...) __attribute__((__format__ (printf, 2, 3))); int remline(u_char *, int, int); @@ -193,8 +192,6 @@ char *getusername(uid_t, char *, opt_t); char *getgroupname(gid_t, char *, opt_t); int response(void); char *exptilde(char *, char *, size_t); -int becomeuser(void); -int becomeroot(void); int setfiletime(char *, time_t, time_t); char *getversion(void); void runcommand(char *); diff --git a/usr.bin/rsync/extern.h b/usr.bin/rsync/extern.h index 940db81d5..5bb23aaa4 100644 --- a/usr.bin/rsync/extern.h +++ b/usr.bin/rsync/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.48 2024/02/27 11:28:30 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.49 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -301,8 +301,6 @@ extern int verbose; void rsync_log(int, const char *, ...) __attribute__((format(printf, 2, 3))); -void rsync_warnx1(const char *, ...) - __attribute__((format(printf, 1, 2))); void rsync_warn(int, const char *, ...) __attribute__((format(printf, 2, 3))); void rsync_warnx(const char *, ...) @@ -316,7 +314,6 @@ void rsync_errx1(const char *, ...) int flist_del(struct sess *, int, const struct flist *, size_t); int flist_gen(struct sess *, size_t, char **, struct flist **, size_t *); -int flist_gen_local(struct sess *, const char *, struct flist **, size_t *); void flist_free(struct flist *, size_t); int flist_recv(struct sess *, int, struct flist **, size_t *); int flist_send(struct sess *, int, int, const struct flist *, size_t); diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c index 2d055f38a..256a788b4 100644 --- a/usr.bin/rsync/receiver.c +++ b/usr.bin/rsync/receiver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: receiver.c,v 1.32 2023/11/27 11:30:49 claudio Exp $ */ +/* $OpenBSD: receiver.c,v 1.33 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons @@ -281,7 +281,7 @@ rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root) if (sess->opts->del && sess->opts->recursive && !flist_gen_dels(sess, root, &dfl, &dflsz, fl, flsz)) { - ERRX1("flist_gen_local"); + ERRX1("rsync_receiver"); goto out; } diff --git a/usr.bin/sndiod/dev.h b/usr.bin/sndiod/dev.h index aeadb0ec9..6e7cdf66f 100644 --- a/usr.bin/sndiod/dev.h +++ b/usr.bin/sndiod/dev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.h,v 1.44 2024/04/22 10:39:51 ratchov Exp $ */ +/* $OpenBSD: dev.h,v 1.45 2024/05/19 00:05:43 jsg Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * @@ -301,7 +301,6 @@ int dev_init(struct dev *); void dev_done(struct dev *); int dev_ref(struct dev *); void dev_unref(struct dev *); -int dev_getpos(struct dev *); unsigned int dev_roundof(struct dev *, unsigned int); int dev_iscompat(struct dev *, struct dev *); @@ -366,7 +365,6 @@ int ctlslot_visible(struct ctlslot *, struct ctl *); struct ctl *ctlslot_lookup(struct ctlslot *, int); void ctlslot_update(struct ctlslot *); -void dev_label(struct dev *, int); void dev_ctlsync(struct dev *); #endif /* !defined(DEV_H) */ diff --git a/usr.bin/sndiod/file.h b/usr.bin/sndiod/file.h index 33a366e80..631212f22 100644 --- a/usr.bin/sndiod/file.h +++ b/usr.bin/sndiod/file.h @@ -1,4 +1,4 @@ -/* $OpenBSD: file.h,v 1.5 2016/01/08 16:17:31 ratchov Exp $ */ +/* $OpenBSD: file.h,v 1.6 2024/05/19 00:05:43 jsg Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * @@ -70,7 +70,6 @@ void timo_del(struct timo *); void filelist_init(void); void filelist_done(void); -void filelist_unlisten(void); struct file *file_new(struct fileops *, void *, char *, unsigned int); void file_del(struct file *); diff --git a/usr.bin/sndiod/midi.c b/usr.bin/sndiod/midi.c index 3290e6b5f..f2058f095 100644 --- a/usr.bin/sndiod/midi.c +++ b/usr.bin/sndiod/midi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midi.c,v 1.30 2024/05/03 05:18:09 ratchov Exp $ */ +/* $OpenBSD: midi.c,v 1.31 2024/05/19 00:05:43 jsg Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * @@ -32,7 +32,6 @@ void port_imsg(void *, unsigned char *, int); void port_omsg(void *, unsigned char *, int); void port_fill(void *, int); void port_exit(void *); -void port_exitall(struct port *); struct midiops port_midiops = { port_imsg, diff --git a/usr.bin/sndiod/siofile.h b/usr.bin/sndiod/siofile.h index c34f922d5..0b570091d 100644 --- a/usr.bin/sndiod/siofile.h +++ b/usr.bin/sndiod/siofile.h @@ -1,4 +1,4 @@ -/* $OpenBSD: siofile.h,v 1.5 2021/11/01 14:43:25 ratchov Exp $ */ +/* $OpenBSD: siofile.h,v 1.6 2024/05/19 00:05:43 jsg Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * @@ -39,7 +39,6 @@ struct dev_sio { int dev_sio_open(struct dev *); void dev_sio_close(struct dev *); -void dev_sio_log(struct dev *); void dev_sio_start(struct dev *); void dev_sio_stop(struct dev *); diff --git a/usr.bin/systat/systat.h b/usr.bin/systat/systat.h index 08113a5b7..e22fdfc16 100644 --- a/usr.bin/systat/systat.h +++ b/usr.bin/systat/systat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systat.h,v 1.26 2024/05/18 09:02:34 jsg Exp $ */ +/* $OpenBSD: systat.h,v 1.27 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: systat.h,v 1.2 1995/01/20 08:52:14 jtc Exp $ */ /*- @@ -52,13 +52,10 @@ extern char **dr_name; extern char hostname[]; extern double avenrun[3]; extern kvm_t *kd; -extern long ntext; extern int *dk_select; extern int dk_ndrive; extern int hz; extern double naptime; -extern size_t nhosts; -extern size_t nports; extern int protos; extern int verbose; extern int nflag; diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h index d5c9858b0..55d8ac9f6 100644 --- a/usr.bin/telnet/externs.h +++ b/usr.bin/telnet/externs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: externs.h,v 1.31 2017/07/07 09:14:26 fcambus Exp $ */ +/* $OpenBSD: externs.h,v 1.32 2024/05/21 05:00:48 jsg Exp $ */ /* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */ /* @@ -66,8 +66,7 @@ extern int resettermname, linemode, kludgelinemode, - want_status_response, - debug; /* Debug level */ + want_status_response; extern cc_t escape; /* Escape to command mode */ extern cc_t rlogin; /* Rlogin mode escape character */ @@ -79,10 +78,6 @@ extern char *prompt; /* Prompt for command. */ extern char - doopt[], - dont[], - will[], - wont[], will_wont_resp[], do_dont_resp[], options[], /* All the little options */ diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 305224fc9..0a9a557ff 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1216 2024/05/18 08:51:26 jsg Exp $ */ +/* $OpenBSD: tmux.h,v 1.1217 2024/05/19 03:27:58 jsg Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -3207,8 +3207,6 @@ void control_add_sub(struct client *, const char *, enum control_sub_type, void control_remove_sub(struct client *, const char *); /* control-notify.c */ -void control_notify_input(struct client *, struct window_pane *, - const u_char *, size_t); void control_notify_pane_mode_changed(int); void control_notify_window_layout_changed(struct window *); void control_notify_window_pane_changed(struct window *); diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c index 4964be11f..0b9aaaaeb 100644 --- a/usr.bin/yacc/reader.c +++ b/usr.bin/yacc/reader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: reader.c,v 1.34 2017/05/25 20:11:03 tedu Exp $ */ +/* $OpenBSD: reader.c,v 1.35 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */ /* @@ -84,7 +84,6 @@ char *get_tag(void); void declare_tokens(int); void declare_types(void); void declare_start(void); -void handle_expect(void); void read_declarations(void); void initialize_grammar(void); void expand_items(void); diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c index 1dac33b28..2f0d043d5 100644 --- a/usr.sbin/ac/ac.c +++ b/usr.sbin/ac/ac.c @@ -89,7 +89,6 @@ int do_tty(char *); FILE *file(char *); struct utmp_list *log_in(struct utmp_list *, struct utmp *); struct utmp_list *log_out(struct utmp_list *, struct utmp *); -int on_console(struct utmp_list *); void show(char *, time_t); void show_today(struct user_list *, struct utmp_list *, time_t); diff --git a/usr.sbin/acme-client/extern.h b/usr.sbin/acme-client/extern.h index 4b43b6ef4..c0277e44f 100644 --- a/usr.sbin/acme-client/extern.h +++ b/usr.sbin/acme-client/extern.h @@ -1,4 +1,4 @@ -/* $Id: extern.h,v 1.20 2020/09/14 16:00:17 florian Exp $ */ +/* $Id: extern.h,v 1.21 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons * @@ -241,7 +241,6 @@ int checkexit_ext(int *, pid_t, enum comp); * Base64 and URL encoding. * Returns a buffer or NULL on allocation error. */ -size_t base64buf(char *, const char *, size_t); size_t base64len(size_t); char *base64buf_url(const char *, size_t); diff --git a/usr.sbin/bgpd/logmsg.c b/usr.sbin/bgpd/logmsg.c index 01148181b..e16c05b8d 100644 --- a/usr.sbin/bgpd/logmsg.c +++ b/usr.sbin/bgpd/logmsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logmsg.c,v 1.13 2024/03/22 15:41:34 claudio Exp $ */ +/* $OpenBSD: logmsg.c,v 1.14 2024/05/20 10:00:00 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h index 8def9f03f..8849ec3e0 100644 --- a/usr.sbin/bgpd/rde.h +++ b/usr.sbin/bgpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.300 2024/05/18 11:17:30 jsg Exp $ */ +/* $OpenBSD: rde.h,v 1.301 2024/05/19 03:31:05 jsg Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker and @@ -381,8 +381,6 @@ void peer_imsg_flush(struct rde_peer *); RB_PROTOTYPE(peer_tree, rde_peer, entry, peer_cmp); /* rde_attr.c */ -int attr_write(void *, uint16_t, uint8_t, uint8_t, void *, - uint16_t); int attr_writebuf(struct ibuf *, uint8_t, uint8_t, void *, uint16_t); void attr_shutdown(void); @@ -595,8 +593,6 @@ void prefix_adjout_update(struct prefix *, struct rde_peer *, struct filterstate *, struct pt_entry *, uint32_t); void prefix_adjout_withdraw(struct prefix *); void prefix_adjout_destroy(struct prefix *); -void prefix_adjout_dump(struct rde_peer *, void *, - void (*)(struct prefix *, void *)); int prefix_dump_new(struct rde_peer *, uint8_t, unsigned int, void *, void (*)(struct prefix *, void *), void (*)(void *, uint8_t), int (*)(void *)); diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 9bd7d608f..43c61adb0 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.476 2024/05/16 09:38:21 claudio Exp $ */ +/* $OpenBSD: session.c,v 1.477 2024/05/20 10:01:52 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer @@ -87,7 +87,7 @@ int parse_open(struct peer *); int parse_update(struct peer *); int parse_rrefresh(struct peer *); void parse_notification(struct peer *); -int parse_capabilities(struct peer *, u_char *, uint16_t, uint32_t *); +int parse_capabilities(struct peer *, struct ibuf *, uint32_t *); int capa_neg_calc(struct peer *); void session_dispatch_imsg(struct imsgbuf *, int, u_int *); void session_up(struct peer *); @@ -115,6 +115,11 @@ u_int peer_cnt; struct mrt_head mrthead; time_t pauseaccept; +static const uint8_t marker[MSGSIZE_HEADER_MARKER] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +}; + static inline int peer_compare(const struct peer *a, const struct peer *b) { @@ -1380,13 +1385,10 @@ session_capa_add_afi(struct ibuf *b, uint8_t aid, uint8_t flags) struct bgp_msg * session_newmsg(enum msg_type msgtype, uint16_t len) { - u_char marker[MSGSIZE_HEADER_MARKER]; struct bgp_msg *msg; struct ibuf *buf; int errs = 0; - memset(marker, 0xff, sizeof(marker)); - if ((buf = ibuf_open(len)) == NULL) return (NULL); @@ -2063,9 +2065,6 @@ parse_header(struct peer *peer, u_char *data, uint16_t *len, uint8_t *type) { u_char *p; uint16_t olen; - static const uint8_t marker[MSGSIZE_HEADER_MARKER] = { 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; /* caller MUST make sure we are getting 19 bytes! */ p = data; @@ -2157,13 +2156,13 @@ parse_header(struct peer *peer, u_char *data, uint16_t *len, uint8_t *type) int parse_open(struct peer *peer) { - u_char *p, *op_val; + struct ibuf ibuf; + u_char *p; uint8_t version, rversion; uint16_t short_as, msglen; - uint16_t holdtime, oholdtime, myholdtime; + uint16_t holdtime, myholdtime; uint32_t as, bgpid; - uint16_t optparamlen, extlen, plen, op_len; - uint8_t op_type; + uint8_t optparamlen; p = peer->rbuf->rptr; p += MSGSIZE_HEADER_MARKER; @@ -2172,9 +2171,17 @@ parse_open(struct peer *peer) p = peer->rbuf->rptr; p += MSGSIZE_HEADER; /* header is already checked */ + msglen -= MSGSIZE_HEADER; - memcpy(&version, p, sizeof(version)); - p += sizeof(version); + /* XXX */ + ibuf_from_buffer(&ibuf, p, msglen); + + if (ibuf_get_n8(&ibuf, &version) == -1 || + ibuf_get_n16(&ibuf, &short_as) == -1 || + ibuf_get_n16(&ibuf, &holdtime) == -1 || + ibuf_get_n32(&ibuf, &bgpid) == -1 || + ibuf_get_n8(&ibuf, &optparamlen) == -1) + goto bad_len; if (version != BGP_VERSION) { log_peer_warnx(&peer->conf, @@ -2189,9 +2196,7 @@ parse_open(struct peer *peer) return (-1); } - memcpy(&short_as, p, sizeof(short_as)); - p += sizeof(short_as); - as = peer->short_as = ntohs(short_as); + as = peer->short_as = short_as; if (as == 0) { log_peer_warnx(&peer->conf, "peer requests unacceptable AS %u", as); @@ -2200,10 +2205,6 @@ parse_open(struct peer *peer) return (-1); } - memcpy(&oholdtime, p, sizeof(oholdtime)); - p += sizeof(oholdtime); - - holdtime = ntohs(oholdtime); if (holdtime && holdtime < peer->conf.min_holdtime) { log_peer_warnx(&peer->conf, "peer requests unacceptable holdtime %u", holdtime); @@ -2220,103 +2221,98 @@ parse_open(struct peer *peer) else peer->holdtime = myholdtime; - memcpy(&bgpid, p, sizeof(bgpid)); - p += sizeof(bgpid); - /* check bgpid for validity - just disallow 0 */ - if (ntohl(bgpid) == 0) { - log_peer_warnx(&peer->conf, "peer BGPID %u unacceptable", - ntohl(bgpid)); + if (bgpid == 0) { + log_peer_warnx(&peer->conf, "peer BGPID 0 unacceptable"); session_notification(peer, ERR_OPEN, ERR_OPEN_BGPID, NULL); change_state(peer, STATE_IDLE, EVNT_RCVD_OPEN); return (-1); } - peer->remote_bgpid = bgpid; + /* strore remote_bgpid in network byte order */ + peer->remote_bgpid = htonl(bgpid); - extlen = 0; - optparamlen = *p++; + if (optparamlen != 0) { + struct ibuf oparams, op; + uint8_t ext_type, op_type; + uint16_t ext_len, op_len; - if (optparamlen == 0) { - if (msglen != MSGSIZE_OPEN_MIN) { -bad_len: - log_peer_warnx(&peer->conf, - "corrupt OPEN message received: length mismatch"); - session_notification(peer, ERR_OPEN, 0, NULL); - change_state(peer, STATE_IDLE, EVNT_RCVD_OPEN); - return (-1); - } - } else { - if (msglen < MSGSIZE_OPEN_MIN + 1) + ibuf_from_ibuf(&oparams, &ibuf); + + /* check for RFC9072 encoding */ + if (ibuf_get_n8(&oparams, &ext_type) == -1) goto bad_len; - - op_type = *p; - if (op_type == OPT_PARAM_EXT_LEN) { - p++; - memcpy(&optparamlen, p, sizeof(optparamlen)); - optparamlen = ntohs(optparamlen); - p += sizeof(optparamlen); - extlen = 1; - } - - /* RFC9020 encoding has 3 extra bytes */ - if (optparamlen + 3 * extlen != msglen - MSGSIZE_OPEN_MIN) - goto bad_len; - } - - plen = optparamlen; - while (plen > 0) { - if (plen < 2 + extlen) - goto bad_len; - - memcpy(&op_type, p, sizeof(op_type)); - p += sizeof(op_type); - plen -= sizeof(op_type); - if (!extlen) { - op_len = *p++; - plen--; - } else { - memcpy(&op_len, p, sizeof(op_len)); - op_len = ntohs(op_len); - p += sizeof(op_len); - plen -= sizeof(op_len); - } - if (op_len > 0) { - if (plen < op_len) + if (ext_type == OPT_PARAM_EXT_LEN) { + if (ibuf_get_n16(&oparams, &ext_len) == -1) goto bad_len; - op_val = p; - p += op_len; - plen -= op_len; - } else - op_val = NULL; + /* skip RFC9072 header */ + if (ibuf_skip(&ibuf, 3) == -1) + goto bad_len; + } else { + ext_len = optparamlen; + ibuf_rewind(&oparams); + } - switch (op_type) { - case OPT_PARAM_CAPABILITIES: /* RFC 3392 */ - if (parse_capabilities(peer, op_val, op_len, - &as) == -1) { - session_notification(peer, ERR_OPEN, 0, NULL); + if (ibuf_truncate(&oparams, ext_len) == -1 || + ibuf_skip(&ibuf, ext_len) == -1) + goto bad_len; + + while (ibuf_size(&oparams) > 0) { + if (ibuf_get_n8(&oparams, &op_type) == -1) + goto bad_len; + + if (ext_type == OPT_PARAM_EXT_LEN) { + if (ibuf_get_n16(&oparams, &op_len) == -1) + goto bad_len; + } else { + uint8_t tmp; + if (ibuf_get_n8(&oparams, &tmp) == -1) + goto bad_len; + op_len = tmp; + } + + if (ibuf_get_ibuf(&oparams, op_len, &op) == -1) + goto bad_len; + + switch (op_type) { + case OPT_PARAM_CAPABILITIES: /* RFC 3392 */ + if (parse_capabilities(peer, &op, &as) == -1) { + session_notification(peer, ERR_OPEN, 0, + NULL); + change_state(peer, STATE_IDLE, + EVNT_RCVD_OPEN); + return (-1); + } + break; + case OPT_PARAM_AUTH: /* deprecated */ + default: + /* + * unsupported type + * the RFCs tell us to leave the data section + * empty and notify the peer with ERR_OPEN, + * ERR_OPEN_OPT. How the peer should know + * _which_ optional parameter we don't support + * is beyond me. + */ + log_peer_warnx(&peer->conf, + "received OPEN message with unsupported " + "optional parameter: type %u", op_type); + session_notification(peer, ERR_OPEN, + ERR_OPEN_OPT, NULL); change_state(peer, STATE_IDLE, EVNT_RCVD_OPEN); return (-1); } - break; - case OPT_PARAM_AUTH: /* deprecated */ - default: - /* - * unsupported type - * the RFCs tell us to leave the data section empty - * and notify the peer with ERR_OPEN, ERR_OPEN_OPT. - * How the peer should know _which_ optional parameter - * we don't support is beyond me. - */ - log_peer_warnx(&peer->conf, - "received OPEN message with unsupported optional " - "parameter: type %u", op_type); - session_notification(peer, ERR_OPEN, ERR_OPEN_OPT, - NULL); - change_state(peer, STATE_IDLE, EVNT_RCVD_OPEN); - return (-1); } } + if (ibuf_size(&ibuf) != 0) { + bad_len: + log_peer_warnx(&peer->conf, + "corrupt OPEN message received: length mismatch"); + session_notification(peer, ERR_OPEN, 0, NULL); + change_state(peer, STATE_IDLE, EVNT_RCVD_OPEN); + return (-1); + } + /* if remote-as is zero and it's a cloned neighbor, accept any */ if (peer->template && !peer->conf.remote_as && as != AS_TRANS) { peer->conf.remote_as = as; @@ -2381,6 +2377,7 @@ int parse_rrefresh(struct peer *peer) { struct route_refresh rr; + struct ibuf ibuf; uint16_t afi, datalen; uint8_t aid, safi, subtype; u_char *p; @@ -2392,21 +2389,17 @@ parse_rrefresh(struct peer *peer) p = peer->rbuf->rptr; p += MSGSIZE_HEADER; /* header is already checked */ + datalen -= MSGSIZE_HEADER; - /* - * We could check if we actually announced the capability but - * as long as the message is correctly encoded we don't care. - */ + /* XXX */ + ibuf_from_buffer(&ibuf, p, datalen); - /* afi, 2 byte */ - memcpy(&afi, p, sizeof(afi)); - afi = ntohs(afi); - p += 2; - /* subtype, 1 byte */ - subtype = *p; - p += 1; - /* safi, 1 byte */ - safi = *p; + if (ibuf_get_n16(&ibuf, &afi) == -1 || + ibuf_get_n8(&ibuf, &subtype) == -1 || + ibuf_get_n8(&ibuf, &safi) == -1) { + /* minimum size checked in session_process_msg() */ + fatalx("%s: message too small", __func__); + } /* check subtype if peer announced enhanced route refresh */ if (peer->capa.neg.enhanced_rr) { @@ -2432,11 +2425,9 @@ parse_rrefresh(struct peer *peer) log_peer_warnx(&peer->conf, "received RREFRESH: illegal len: %u byte", datalen); - p = peer->rbuf->rptr; - p += MSGSIZE_HEADER; - datalen -= MSGSIZE_HEADER; - session_notification_data(peer, ERR_RREFRESH, - ERR_RR_INV_LEN, p, datalen); + ibuf_rewind(&ibuf); + session_notification(peer, ERR_RREFRESH, + ERR_RR_INV_LEN, &ibuf); bgp_fsm(peer, EVNT_CON_FATAL); return (-1); } @@ -2530,58 +2521,38 @@ done: } int -parse_capabilities(struct peer *peer, u_char *d, uint16_t dlen, uint32_t *as) +parse_capabilities(struct peer *peer, struct ibuf *buf, uint32_t *as) { - u_char *capa_val; - uint32_t remote_as; - uint16_t len; - uint16_t afi; - uint16_t gr_header; - uint8_t safi; - uint8_t aid; - uint8_t flags; - uint8_t capa_code; - uint8_t capa_len; - uint8_t i; + struct ibuf capabuf; + uint16_t afi, gr_header; + uint8_t capa_code, capa_len; + uint8_t safi, aid, role, flags; - len = dlen; - while (len > 0) { - if (len < 2) { + while (ibuf_size(buf) > 0) { + if (ibuf_get_n8(buf, &capa_code) == -1 || + ibuf_get_n8(buf, &capa_len) == -1) { log_peer_warnx(&peer->conf, "Bad capabilities attr " - "length: %u, too short", len); + "length: too short"); + return (-1); + } + if (ibuf_get_ibuf(buf, capa_len, &capabuf) == -1) { + log_peer_warnx(&peer->conf, + "Received bad capabilities attr length: " + "len %zu smaller than capa_len %u", + ibuf_size(buf), capa_len); return (-1); } - memcpy(&capa_code, d, sizeof(capa_code)); - d += sizeof(capa_code); - len -= sizeof(capa_code); - memcpy(&capa_len, d, sizeof(capa_len)); - d += sizeof(capa_len); - len -= sizeof(capa_len); - if (capa_len > 0) { - if (len < capa_len) { - log_peer_warnx(&peer->conf, - "Bad capabilities attr length: " - "len %u smaller than capa_len %u", - len, capa_len); - return (-1); - } - capa_val = d; - d += capa_len; - len -= capa_len; - } else - capa_val = NULL; switch (capa_code) { case CAPA_MP: /* RFC 4760 */ - if (capa_len != 4) { + if (capa_len != 4 || + ibuf_get_n16(&capabuf, &afi) == -1 || + ibuf_skip(&capabuf, 1) == -1 || + ibuf_get_n8(&capabuf, &safi) == -1) { log_peer_warnx(&peer->conf, - "Bad multi protocol capability length: " - "%u", capa_len); + "Received bad multi protocol capability"); break; } - memcpy(&afi, capa_val, sizeof(afi)); - afi = ntohs(afi); - memcpy(&safi, capa_val + 3, sizeof(safi)); if (afi2aid(afi, safi, &aid) == -1) { log_peer_warnx(&peer->conf, "Received multi protocol capability: " @@ -2595,9 +2566,10 @@ parse_capabilities(struct peer *peer, u_char *d, uint16_t dlen, uint32_t *as) peer->capa.peer.refresh = 1; break; case CAPA_ROLE: - if (capa_len != 1) { + if (capa_len != 1 || + ibuf_get_n8(&capabuf, &role) == -1) { log_peer_warnx(&peer->conf, - "Bad role capability length: %u", capa_len); + "Received bad role capability"); break; } if (!peer->conf.ebgp) { @@ -2606,7 +2578,7 @@ parse_capabilities(struct peer *peer, u_char *d, uint16_t dlen, uint32_t *as) break; } peer->capa.peer.policy = 1; - peer->remote_role = capa2role(*capa_val); + peer->remote_role = capa2role(role); break; case CAPA_RESTART: if (capa_len == 2) { @@ -2616,29 +2588,35 @@ parse_capabilities(struct peer *peer, u_char *d, uint16_t dlen, uint32_t *as) break; } else if (capa_len % 4 != 2) { log_peer_warnx(&peer->conf, - "Bad graceful restart capability length: " - "%u", capa_len); + "Bad graceful restart capability"); + peer->capa.peer.grestart.restart = 0; + peer->capa.peer.grestart.timeout = 0; + break; + } + + if (ibuf_get_n16(&capabuf, &gr_header) == -1) { + bad_gr_restart: + log_peer_warnx(&peer->conf, + "Bad graceful restart capability"); peer->capa.peer.grestart.restart = 0; peer->capa.peer.grestart.timeout = 0; break; } - memcpy(&gr_header, capa_val, sizeof(gr_header)); - gr_header = ntohs(gr_header); peer->capa.peer.grestart.timeout = gr_header & CAPA_GR_TIMEMASK; if (peer->capa.peer.grestart.timeout == 0) { log_peer_warnx(&peer->conf, "Received " - "graceful restart timeout is zero"); + "graceful restart with zero timeout"); peer->capa.peer.grestart.restart = 0; break; } - for (i = 2; i <= capa_len - 4; i += 4) { - memcpy(&afi, capa_val + i, sizeof(afi)); - afi = ntohs(afi); - safi = capa_val[i + 2]; - flags = capa_val[i + 3]; + while (ibuf_size(&capabuf) > 0) { + if (ibuf_get_n16(&capabuf, &afi) == -1 || + ibuf_get_n8(&capabuf, &safi) == -1 || + ibuf_get_n8(&capabuf, &flags) == -1) + goto bad_gr_restart; if (afi2aid(afi, safi, &aid) == -1) { log_peer_warnx(&peer->conf, "Received graceful restart capa: " @@ -2658,15 +2636,13 @@ parse_capabilities(struct peer *peer, u_char *d, uint16_t dlen, uint32_t *as) } break; case CAPA_AS4BYTE: - if (capa_len != 4) { + if (capa_len != 4 || + ibuf_get_n32(&capabuf, as) == -1) { log_peer_warnx(&peer->conf, - "Bad AS4BYTE capability length: " - "%u", capa_len); + "Received bad AS4BYTE capability"); peer->capa.peer.as4byte = 0; break; } - memcpy(&remote_as, capa_val, sizeof(remote_as)); - *as = ntohl(remote_as); if (*as == 0) { log_peer_warnx(&peer->conf, "peer requests unacceptable AS %u", *as); @@ -2679,18 +2655,18 @@ parse_capabilities(struct peer *peer, u_char *d, uint16_t dlen, uint32_t *as) break; case CAPA_ADD_PATH: if (capa_len % 4 != 0) { + bad_add_path: log_peer_warnx(&peer->conf, - "Bad ADD-PATH capability length: " - "%u", capa_len); + "Received bad ADD-PATH capability"); memset(peer->capa.peer.add_path, 0, sizeof(peer->capa.peer.add_path)); break; } - for (i = 0; i <= capa_len - 4; i += 4) { - memcpy(&afi, capa_val + i, sizeof(afi)); - afi = ntohs(afi); - safi = capa_val[i + 2]; - flags = capa_val[i + 3]; + while (ibuf_size(&capabuf) > 0) { + if (ibuf_get_n16(&capabuf, &afi) == -1 || + ibuf_get_n8(&capabuf, &safi) == -1 || + ibuf_get_n8(&capabuf, &flags) == -1) + goto bad_add_path; if (afi2aid(afi, safi, &aid) == -1) { log_peer_warnx(&peer->conf, "Received ADD-PATH capa: " diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c index b817d9c92..a66949cda 100644 --- a/usr.sbin/btrace/btrace.c +++ b/usr.sbin/btrace/btrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btrace.c,v 1.90 2024/03/30 07:41:45 mpi Exp $ */ +/* $OpenBSD: btrace.c,v 1.91 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2019 - 2023 Martin Pieuchot @@ -80,7 +80,6 @@ void rule_printmaps(struct bt_rule *); * Language builtins & functions. */ uint64_t builtin_nsecs(struct dt_evt *); -const char *builtin_kstack(struct dt_evt *); const char *builtin_arg(struct dt_evt *, enum bt_argtype); struct bt_arg *fn_str(struct bt_arg *, struct dt_evt *, char *); int stmt_eval(struct bt_stmt *, struct dt_evt *); diff --git a/usr.sbin/btrace/btrace.h b/usr.sbin/btrace/btrace.h index 0e4c26da6..846c7f57c 100644 --- a/usr.sbin/btrace/btrace.h +++ b/usr.sbin/btrace/btrace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: btrace.h,v 1.14 2024/02/27 12:50:33 mpi Exp $ */ +/* $OpenBSD: btrace.h,v 1.15 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2019 - 2020 Martin Pieuchot @@ -38,7 +38,6 @@ unsigned long dt_get_offset(pid_t); /* ksyms.c */ struct syms; struct syms *kelf_open(const char *); -void kelf_offset(struct syms *, unsigned long); void kelf_close(struct syms *); int kelf_snprintsym(struct syms *, char *, size_t, unsigned long, unsigned long); diff --git a/usr.sbin/config/cmd.h b/usr.sbin/config/cmd.h index be476743c..66f1c23a8 100644 --- a/usr.sbin/config/cmd.h +++ b/usr.sbin/config/cmd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.h,v 1.8 2019/08/11 17:08:33 deraadt Exp $ */ +/* $OpenBSD: cmd.h,v 1.9 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -66,7 +66,6 @@ int Xlist(cmd_t *); int Xshow(cmd_t *); int Xexit(cmd_t *); int Xquit(cmd_t *); -int Xtimezone(cmd_t *); int Xnkmempg(cmd_t *); #endif /* _CMD_H */ diff --git a/usr.sbin/config/sem.h b/usr.sbin/config/sem.h index 4fbfcd679..6780cce2d 100644 --- a/usr.sbin/config/sem.h +++ b/usr.sbin/config/sem.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sem.h,v 1.13 2008/03/24 21:35:03 maja Exp $ */ +/* $OpenBSD: sem.h,v 1.14 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: sem.h,v 1.6 1996/11/11 23:40:10 gwr Exp $ */ /* @@ -58,7 +58,6 @@ void setconf(struct nvlist **, const char *, struct nvlist *); void adddev(const char *, const char *, struct nvlist *, int, int); void enabledev(const char *, const char *); void addpseudo(const char *name, int number, int disable); -const char *ref(const char *name); const char *starref(const char *name); const char *wildref(const char *name); diff --git a/usr.sbin/dhcpd/dhcpd.h b/usr.sbin/dhcpd/dhcpd.h index 0903c244d..9ec1db663 100644 --- a/usr.sbin/dhcpd/dhcpd.h +++ b/usr.sbin/dhcpd/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.68 2020/11/10 16:42:17 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.69 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -325,7 +325,6 @@ extern char *path_dhcpd_conf; extern char *path_dhcpd_db; int main(int, char *[]); -void cleanup(void); void lease_pinged(struct iaddr, u_int8_t *, int); void lease_ping_timeout(void *); void periodic_scan(void *); @@ -333,8 +332,6 @@ void periodic_scan(void *); /* conflex.c */ extern int lexline, lexchar; extern char *token_line, *tlname; -extern char comments[4096]; -extern int comment_index; extern int eol_token; void new_parse(char *); diff --git a/usr.sbin/dhcrelay/dhcpd.h b/usr.sbin/dhcrelay/dhcpd.h index 4a7dd50fa..6071db175 100644 --- a/usr.sbin/dhcrelay/dhcpd.h +++ b/usr.sbin/dhcrelay/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.23 2017/04/05 14:40:56 reyk Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.24 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -140,12 +140,6 @@ struct server_list { /* External definitions... */ -/* errwarn.c */ -void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); - /* bpf.c */ int if_register_bpf(struct interface_info *); void if_register_send(struct interface_info *); diff --git a/usr.sbin/dhcrelay6/dhcpd.h b/usr.sbin/dhcrelay6/dhcpd.h index 41703cc68..387e28abf 100644 --- a/usr.sbin/dhcrelay6/dhcpd.h +++ b/usr.sbin/dhcrelay6/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.1 2017/03/17 14:45:16 rzalamena Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.2 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2017 Rafael Zalamena @@ -151,7 +151,6 @@ void setup_iflist(void); struct interface_info *iflist_getbyname(const char *); struct interface_info *iflist_getbyindex(unsigned int); struct interface_info *iflist_getbyaddr6(struct in6_addr *); -int if_hasaddress(struct interface_info *); struct interface_info *register_interface(const char *, void (*)(struct protocol *)); void dispatch(void); diff --git a/usr.sbin/eeprom/defs.h b/usr.sbin/eeprom/defs.h index c3ee813f4..3457cd651 100644 --- a/usr.sbin/eeprom/defs.h +++ b/usr.sbin/eeprom/defs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: defs.h,v 1.7 2008/06/26 05:42:21 ray Exp $ */ +/* $OpenBSD: defs.h,v 1.8 2024/05/19 00:03:10 jsg Exp $ */ /* $NetBSD: defs.h,v 1.2 1996/02/28 01:13:20 thorpej Exp $ */ /*- @@ -33,41 +33,6 @@ #undef BUFSIZE #define BUFSIZE 1024 -#define IO_READ 0 -#define IO_WRITE 1 - -#define MAXIMUM(a, b) ((a) > (b) ? (a) : (b)) - -/* - * Misc. location declarations. - */ -#define EE_SIZE 0x500 -#define EE_WC_LOC 0x04 -#define EE_CKSUM_LOC 0x0c -#define EE_HWUPDATE_LOC 0x10 -#define EE_BANNER_ENABLE_LOC 0x20 - -/* - * Keyword table entry. Contains a pointer to the keyword, the - * offset into the prom where the value lives, and a pointer to - * the function that handles that value. - */ -struct keytabent { - char *kt_keyword; /* keyword for this entry */ - u_int kt_offset; /* offset into prom of value */ - void (*kt_handler)(struct keytabent *, char *); - /* handler function for this entry */ -}; - -/* - * String-value table entry. Maps a string to a numeric value and - * vice-versa. - */ -struct strvaltabent { - char *sv_str; /* the string ... */ - u_char sv_val; /* ... and the value */ -}; - /* * This is an entry in a table which describes a set of `exceptions'. * In other words, these are Openprom fields that we either can't @@ -79,24 +44,6 @@ struct extabent { /* handler function for this entry */ }; -/* Sun 3/4 EEPROM handlers. */ -void ee_hwupdate(struct keytabent *, char *); -void ee_num8(struct keytabent *, char *); -void ee_num16(struct keytabent *, char *); -void ee_screensize(struct keytabent *, char *); -void ee_truefalse(struct keytabent *, char *); -void ee_bootdev(struct keytabent *, char *); -void ee_kbdtype(struct keytabent *, char *); -void ee_constype(struct keytabent *, char *); -void ee_diagpath(struct keytabent *, char *); -void ee_banner(struct keytabent *, char *); -void ee_notsupp(struct keytabent *, char *); - -/* Sun 3/4 EEPROM checksum routines. */ -u_char ee_checksum(u_char *, size_t); -void ee_updatechecksums(void); -void ee_verifychecksums(void); - /* OpenPROM handlers. */ char *op_handler(char *, char *); void op_dump(void); diff --git a/usr.sbin/ikectl/ikectl.c b/usr.sbin/ikectl/ikectl.c index 85bb31d82..5d496a84d 100644 --- a/usr.sbin/ikectl/ikectl.c +++ b/usr.sbin/ikectl/ikectl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikectl.c,v 1.30 2022/12/04 11:54:31 tobhe Exp $ */ +/* $OpenBSD: ikectl.c,v 1.31 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2007-2013 Reyk Floeter @@ -45,7 +45,6 @@ struct imsgname { }; struct imsgname *monitor_lookup(uint8_t); -void monitor_id(struct imsg *); int monitor(struct imsg *); int show_string(struct imsg *); diff --git a/usr.sbin/iscsid/iscsid.h b/usr.sbin/iscsid/iscsid.h index 7fb1dfbde..47d3981e0 100644 --- a/usr.sbin/iscsid/iscsid.h +++ b/usr.sbin/iscsid/iscsid.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iscsid.h,v 1.18 2022/12/28 21:30:16 jmc Exp $ */ +/* $OpenBSD: iscsid.h,v 1.19 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -349,7 +349,6 @@ void session_config(struct session *, struct session_config *); void session_task_issue(struct session *, struct task *); void session_logout_issue(struct session *, struct task *); void session_schedule(struct session *); -void session_task_login(struct connection *); void session_fsm(struct session *, enum s_event, struct connection *, unsigned int); diff --git a/usr.sbin/ldapd/ldapd.h b/usr.sbin/ldapd/ldapd.h index 39ed38d6a..735369a78 100644 --- a/usr.sbin/ldapd/ldapd.h +++ b/usr.sbin/ldapd/ldapd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapd.h,v 1.36 2021/12/15 04:00:15 deraadt Exp $ */ +/* $OpenBSD: ldapd.h,v 1.37 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -336,12 +336,6 @@ enum ldapd_process { extern struct ldapd_stats stats; extern struct ldapd_config *conf; -void imsg_event_add(struct imsgev *iev); -int imsg_compose_event(struct imsgev *iev, u_int16_t type, - u_int32_t peerid, pid_t pid, int fd, void *data, - u_int16_t datalen); -int imsg_event_handle(struct imsgev *iev, short event); - /* conn.c */ extern struct conn_list conn_list; struct conn *conn_by_fd(int fd); @@ -376,7 +370,6 @@ int namespace_reopen_data(struct namespace *ns); int namespace_reopen_indx(struct namespace *ns); int namespace_set_data_fd(struct namespace *ns, int fd); int namespace_set_indx_fd(struct namespace *ns, int fd); -struct namespace *namespace_init(const char *suffix, const char *dir); void namespace_close(struct namespace *ns); void namespace_remove(struct namespace *ns); struct ber_element *namespace_get(struct namespace *ns, char *dn); @@ -435,7 +428,6 @@ char *ldap_now(void); void control_init(struct control_sock *); void control_listen(struct control_sock *); void control_accept(int, short, void *); -void control_dispatch_imsg(int, short, void *); void control_cleanup(struct control_sock *); int control_close_any(struct control_sock *); diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c index 0f1396ba5..55d6269d3 100644 --- a/usr.sbin/mrinfo/mrinfo.c +++ b/usr.sbin/mrinfo/mrinfo.c @@ -99,7 +99,6 @@ vifi_t numvifs; /* to keep loader happy */ char *inet_name(u_int32_t addr); void ask(u_int32_t dst); void ask2(u_int32_t dst); -u_int32_t host_addr(char *name); void usage(void); char * diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c index 8e6887435..7f81bb9be 100644 --- a/usr.sbin/ntpd/ntpd.c +++ b/usr.sbin/ntpd/ntpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.c,v 1.132 2021/07/16 14:36:09 mestre Exp $ */ +/* $OpenBSD: ntpd.c,v 1.133 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -46,7 +46,6 @@ int auto_preconditions(const struct ntpd_conf *); int main(int, char *[]); void check_child(void); int dispatch_imsg(struct ntpd_conf *, int, char **); -int dispatch_imsg_ctl(struct ntpd_conf *); void reset_adjtime(void); int ntpd_adjtime(double); void ntpd_adjfreq(double, int); diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h index 81d0c6c83..872d028d0 100644 --- a/usr.sbin/ntpd/ntpd.h +++ b/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.153 2023/12/20 15:36:36 otto Exp $ */ +/* $OpenBSD: ntpd.h,v 1.154 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -364,7 +364,6 @@ int ntp_sendmsg(int, struct sockaddr *, struct ntp_msg *); /* server.c */ int setup_listeners(struct servent *, struct ntpd_conf *, u_int *); -int ntp_reply(int, struct sockaddr *, struct ntp_msg *, int); int server_dispatch(int, struct ntpd_conf *); /* client.c */ diff --git a/usr.sbin/ospfctl/ospfctl.h b/usr.sbin/ospfctl/ospfctl.h index 3b1c088e7..2ea928066 100644 --- a/usr.sbin/ospfctl/ospfctl.h +++ b/usr.sbin/ospfctl/ospfctl.h @@ -34,7 +34,7 @@ struct output { void (*tail)(void); }; -extern const struct output show_output, json_output; +extern const struct output show_output; #define EOL0(flag) ((flag & F_CTL_SSV) ? ';' : '\n') diff --git a/usr.sbin/rad/rad.c b/usr.sbin/rad/rad.c index a0c317265..036a73e17 100644 --- a/usr.sbin/rad/rad.c +++ b/usr.sbin/rad/rad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rad.c,v 1.30 2024/05/17 06:50:14 florian Exp $ */ +/* $OpenBSD: rad.c,v 1.31 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -74,8 +74,6 @@ static int main_imsg_send_config(struct rad_conf *); int main_reload(void); int main_sendboth(enum imsg_type, void *, uint16_t); -void in6_prefixlen2mask(struct in6_addr *, int len); - struct rad_conf *main_conf; static struct imsgev *iev_frontend; static struct imsgev *iev_engine; diff --git a/usr.sbin/radiusd/radiusd_local.h b/usr.sbin/radiusd/radiusd_local.h index 2704ecc27..5cc4b2230 100644 --- a/usr.sbin/radiusd/radiusd_local.h +++ b/usr.sbin/radiusd/radiusd_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radiusd_local.h,v 1.6 2023/09/08 05:56:22 yasuoka Exp $ */ +/* $OpenBSD: radiusd_local.h,v 1.7 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2013 Internet Initiative Japan Inc. @@ -157,9 +157,6 @@ struct radius_query { ((_m)->fd >= 0 && \ ((_m)->capabilities & RADIUSD_MODULE_CAP_RESDECO) != 0) -extern struct radiusd_module mod_standard; -extern struct radiusd_module mod_radius; - int parse_config(const char *, struct radiusd *); void radiusd_conf_init(struct radiusd *); @@ -169,7 +166,6 @@ struct radiusd_module *radiusd_module_load(struct radiusd *, const char *, void radiusd_module_unload(struct radiusd_module *); void radiusd_access_request_answer(struct radius_query *); -int radiusd_access_request_fixup(struct radius_query *); void radiusd_access_request_aborted(struct radius_query *); void radius_attr_hide(const char *, const char *, const u_char *, u_char *, int); diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index f1abc79b1..9390969b2 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route6d.c,v 1.100 2020/12/29 19:48:27 benno Exp $ */ +/* $OpenBSD: route6d.c,v 1.101 2024/05/21 05:00:48 jsg Exp $ */ /* $KAME: route6d.c,v 1.111 2006/10/25 06:38:13 jinmei Exp $ */ /* @@ -191,7 +191,6 @@ void riprecv(void); void ripsend(struct ifc *, struct sockaddr_in6 *, int); int out_filter(struct riprt *, struct ifc *); void init(void); -void sockopt(struct ifc *); void ifconfig(void); void ifconfig1(const char *, const struct sockaddr *, struct ifc *, int); void rtrecv(void); diff --git a/usr.sbin/rpki-client/cert.c b/usr.sbin/rpki-client/cert.c index c4f347f22..3eb769f95 100644 --- a/usr.sbin/rpki-client/cert.c +++ b/usr.sbin/rpki-client/cert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cert.c,v 1.130 2024/04/21 19:27:44 claudio Exp $ */ +/* $OpenBSD: cert.c,v 1.131 2024/05/20 15:51:43 claudio Exp $ */ /* * Copyright (c) 2022 Theo Buehler * Copyright (c) 2021 Job Snijders @@ -34,6 +34,8 @@ extern ASN1_OBJECT *carepo_oid; /* 1.3.6.1.5.5.7.48.5 (caRepository) */ extern ASN1_OBJECT *manifest_oid; /* 1.3.6.1.5.5.7.48.10 (rpkiManifest) */ extern ASN1_OBJECT *notify_oid; /* 1.3.6.1.5.5.7.48.13 (rpkiNotify) */ +static int certid = TALSZ_MAX; + /* * Append an IP address structure to our list of results. * This will also constrain us to having at most one inheritance @@ -1103,6 +1105,7 @@ cert_buffer(struct ibuf *b, const struct cert *p) io_simple_buffer(b, &p->notafter, sizeof(p->notafter)); io_simple_buffer(b, &p->purpose, sizeof(p->purpose)); io_simple_buffer(b, &p->talid, sizeof(p->talid)); + io_simple_buffer(b, &p->certid, sizeof(p->certid)); io_simple_buffer(b, &p->repoid, sizeof(p->repoid)); io_simple_buffer(b, &p->ipsz, sizeof(p->ipsz)); io_simple_buffer(b, &p->asz, sizeof(p->asz)); @@ -1136,6 +1139,7 @@ cert_read(struct ibuf *b) io_read_buf(b, &p->notafter, sizeof(p->notafter)); io_read_buf(b, &p->purpose, sizeof(p->purpose)); io_read_buf(b, &p->talid, sizeof(p->talid)); + io_read_buf(b, &p->certid, sizeof(p->certid)); io_read_buf(b, &p->repoid, sizeof(p->repoid)); io_read_buf(b, &p->ipsz, sizeof(p->ipsz)); io_read_buf(b, &p->asz, sizeof(p->asz)); @@ -1167,7 +1171,11 @@ cert_read(struct ibuf *b) static inline int authcmp(struct auth *a, struct auth *b) { - return strcmp(a->cert->ski, b->cert->ski); + if (a->cert->certid > b->cert->certid) + return 1; + if (a->cert->certid < b->cert->certid) + return -1; + return 0; } RB_GENERATE_STATIC(auth_tree, auth, entry, authcmp); @@ -1185,33 +1193,48 @@ auth_tree_free(struct auth_tree *auths) } struct auth * -auth_find(struct auth_tree *auths, const char *aki) +auth_find(struct auth_tree *auths, int id) { struct auth a; struct cert c; - /* we look up the cert where the ski == aki */ - c.ski = (char *)aki; + c.certid = id; a.cert = &c; return RB_FIND(auth_tree, auths, &a); } struct auth * -auth_insert(struct auth_tree *auths, struct cert *cert, struct auth *issuer) +auth_insert(const char *fn, struct auth_tree *auths, struct cert *cert, + struct auth *issuer) { struct auth *na; - na = malloc(sizeof(*na)); + na = calloc(1, sizeof(*na)); if (na == NULL) err(1, NULL); + if (issuer == NULL) { + cert->certid = cert->talid; + } else { + cert->certid = ++certid; + if (certid > CERTID_MAX) + errx(1, "%s: too many certificates in store", fn); + na->depth = issuer->depth + 1; + } + + if (na->depth >= MAX_CERT_DEPTH) { + warnx("%s: maximum certificate chain depth exhausted", fn); + free(na); + return NULL; + } + na->issuer = issuer; na->cert = cert; na->any_inherits = x509_any_inherits(cert->x509); if (RB_INSERT(auth_tree, auths, na) != NULL) - err(1, "auth tree corrupted"); + errx(1, "auth tree corrupted"); return na; } diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index 9dd699717..6bdaab976 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.217 2024/04/21 19:27:44 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.218 2024/05/20 15:51:43 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -24,6 +24,9 @@ #include #include +#define CTASSERT(x) extern char _ctassert[(x) ? 1 : -1 ] \ + __attribute__((__unused__)) + enum cert_as_type { CERT_AS_ID, /* single identifier */ CERT_AS_INHERIT, /* inherit from issuer */ @@ -120,6 +123,7 @@ struct cert { struct cert_as *as; /* list of AS numbers and ranges */ size_t asz; /* length of "asz" */ int talid; /* cert is covered by which TAL */ + int certid; unsigned int repoid; /* repository of this cert file */ char *repo; /* CA repository (rsync:// uri) */ char *mft; /* manifest (rsync:// uri) */ @@ -212,6 +216,7 @@ struct mft { size_t filesz; /* number of filenames */ unsigned int repoid; int talid; + int certid; }; /* @@ -495,14 +500,16 @@ struct auth { struct cert *cert; /* owner information */ struct auth *issuer; /* pointer to issuer or NULL for TA cert */ int any_inherits; + int depth; }; /* * Tree of auth sorted by ski */ RB_HEAD(auth_tree, auth); -struct auth *auth_find(struct auth_tree *, const char *); -struct auth *auth_insert(struct auth_tree *, struct cert *, struct auth *); +struct auth *auth_find(struct auth_tree *, int); +struct auth *auth_insert(const char *, struct auth_tree *, struct cert *, + struct auth *); enum http_result { HTTP_FAILED, /* anything else */ @@ -560,6 +567,7 @@ struct entity { size_t datasz; /* length of optional data blob */ unsigned int repoid; /* repository identifier */ int talid; /* tal identifier */ + int certid; enum rtype type; /* type of entity (not RTYPE_EOF) */ enum location location; /* which directory the file lives in */ }; @@ -731,10 +739,6 @@ void crl_tree_free(struct crl_tree *); /* Validation of our objects. */ -struct auth *valid_ski_aki(const char *, struct auth_tree *, - const char *, const char *, const char *); -int valid_ta(const char *, struct auth_tree *, - const struct cert *); int valid_cert(const char *, struct auth *, const struct cert *); int valid_roa(const char *, struct cert *, struct roa *); int valid_filehash(int, const char *, size_t); @@ -826,7 +830,7 @@ void proc_http(char *, int) __attribute__((noreturn)); void proc_rrdp(int) __attribute__((noreturn)); /* Repository handling */ -int filepath_add(struct filepath_tree *, char *, time_t); +int filepath_add(struct filepath_tree *, char *, int, time_t); void rrdp_clear(unsigned int); void rrdp_session_save(unsigned int, struct rrdp_session *); void rrdp_session_free(struct rrdp_session *); @@ -981,6 +985,7 @@ int mkpathat(int, const char *); /* Maximum number of TAL files we'll load. */ #define TALSZ_MAX 8 +#define CERTID_MAX 1000000 /* * Maximum number of elements in the sbgp-ipAddrBlock (IP) and diff --git a/usr.sbin/rpki-client/filemode.c b/usr.sbin/rpki-client/filemode.c index 5590079a2..7ebeaeafe 100644 --- a/usr.sbin/rpki-client/filemode.c +++ b/usr.sbin/rpki-client/filemode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filemode.c,v 1.41 2024/04/21 19:27:44 claudio Exp $ */ +/* $OpenBSD: filemode.c,v 1.42 2024/05/20 15:51:43 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -47,6 +47,50 @@ static struct crl_tree crlt = RB_INITIALIZER(&crlt); struct tal *talobj[TALSZ_MAX]; +struct uripath { + RB_ENTRY(uripath) entry; + const char *uri; + struct cert *cert; +}; + +static RB_HEAD(uripath_tree, uripath) uritree; + +static inline int +uripathcmp(const struct uripath *a, const struct uripath *b) +{ + return strcmp(a->uri, b->uri); +} + +RB_PROTOTYPE(uripath_tree, uripath, entry, uripathcmp); + +static void +uripath_add(const char *uri, struct cert *cert) +{ + struct uripath *up; + + if ((up = calloc(1, sizeof(*up))) == NULL) + err(1, NULL); + if ((up->uri = strdup(uri)) == NULL) + err(1, NULL); + up->cert = cert; + if (RB_INSERT(uripath_tree, &uritree, up) != NULL) + errx(1, "corrupt AIA lookup tree"); +} + +static struct cert * +uripath_lookup(const char *uri) +{ + struct uripath needle = { .uri = uri }; + struct uripath *up; + + up = RB_FIND(uripath_tree, &uritree, &needle); + if (up == NULL) + return NULL; + return up->cert; +} + +RB_GENERATE(uripath_tree, uripath, entry, uripathcmp); + /* * Use the X509 CRL Distribution Points to locate the CRL needed for * verification. @@ -132,7 +176,7 @@ parse_load_cert(char *uri) * tree. Once the TA is located in the chain the chain is validated in * reverse order. */ -static void +static struct auth * parse_load_certchain(char *uri) { struct cert *stack[MAX_CERT_DEPTH] = { 0 }; @@ -144,18 +188,16 @@ parse_load_certchain(char *uri) int i; for (i = 0; i < MAX_CERT_DEPTH; i++) { + if ((cert = uripath_lookup(uri)) != NULL) { + a = auth_find(&auths, cert->certid); + break; + } filestack[i] = uri; stack[i] = cert = parse_load_cert(uri); if (cert == NULL || cert->purpose != CERT_PURPOSE_CA) { - warnx("failed to build authority chain"); + warnx("failed to build authority chain: %s", uri); goto fail; } - if (auth_find(&auths, cert->ski) != NULL) { - assert(i == 0); - goto fail; - } - if ((a = auth_find(&auths, cert->aki)) != NULL) - break; /* found chain to TA */ uri = cert->aia; } @@ -166,9 +208,9 @@ parse_load_certchain(char *uri) } /* TA found play back the stack and add all certs */ - for (; i >= 0; i--) { - cert = stack[i]; - uri = filestack[i]; + for (; i > 0; i--) { + cert = stack[i - 1]; + uri = filestack[i - 1]; crl = crl_get(&crlt, a); if (!valid_x509(uri, ctx, cert->x509, a, crl, &errstr) || @@ -178,14 +220,16 @@ parse_load_certchain(char *uri) goto fail; } cert->talid = a->cert->talid; - a = auth_insert(&auths, cert, a); + a = auth_insert(uri, &auths, cert, a); + uripath_add(uri, cert); stack[i] = NULL; } - return; + return a; fail: for (i = 0; i < MAX_CERT_DEPTH; i++) cert_free(stack[i]); + return NULL; } static void @@ -195,7 +239,7 @@ parse_load_ta(struct tal *tal) struct cert *cert; unsigned char *f = NULL; char *file; - size_t flen; + size_t flen, i; /* does not matter which URI, all end with same filename */ filename = strrchr(tal->uri[0], '/'); @@ -217,11 +261,14 @@ parse_load_ta(struct tal *tal) goto out; cert->talid = tal->id; + auth_insert(file, &auths, cert, NULL); + for (i = 0; i < tal->urisz; i++) { + if (strncasecmp(tal->uri[i], RSYNC_PROTO, RSYNC_PROTO_LEN) != 0) + continue; + /* Add all rsync uri since any of them could be used as AIA. */ + uripath_add(tal->uri[i], cert); + } - if (!valid_ta(file, &auths, cert)) - cert_free(cert); - else - auth_insert(&auths, cert, NULL); out: free(file); free(f); @@ -297,7 +344,7 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) struct spl *spl = NULL; struct tak *tak = NULL; struct tal *tal = NULL; - char *aia = NULL, *aki = NULL; + char *aia = NULL; char *crl_uri = NULL; time_t *expires = NULL, *notafter = NULL; struct auth *a; @@ -349,7 +396,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (aspa == NULL) break; aia = aspa->aia; - aki = aspa->aki; expires = &aspa->expires; notafter = &aspa->notafter; break; @@ -363,7 +409,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (cert == NULL) break; aia = cert->aia; - aki = cert->aki; x509 = cert->x509; if (X509_up_ref(x509) == 0) errx(1, "%s: X509_up_ref failed", __func__); @@ -381,7 +426,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (mft == NULL) break; aia = mft->aia; - aki = mft->aki; expires = &mft->expires; notafter = &mft->nextupdate; break; @@ -390,7 +434,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (gbr == NULL) break; aia = gbr->aia; - aki = gbr->aki; expires = &gbr->expires; notafter = &gbr->notafter; break; @@ -399,7 +442,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (geofeed == NULL) break; aia = geofeed->aia; - aki = geofeed->aki; expires = &geofeed->expires; notafter = &geofeed->notafter; break; @@ -408,7 +450,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (roa == NULL) break; aia = roa->aia; - aki = roa->aki; expires = &roa->expires; notafter = &roa->notafter; break; @@ -417,7 +458,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (rsc == NULL) break; aia = rsc->aia; - aki = rsc->aki; expires = &rsc->expires; notafter = &rsc->notafter; break; @@ -426,7 +466,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (spl == NULL) break; aia = spl->aia; - aki = spl->aki; expires = &spl->expires; notafter = &spl->notafter; break; @@ -435,7 +474,6 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (tak == NULL) break; aia = tak->aia; - aki = tak->aki; expires = &tak->expires; notafter = &tak->notafter; break; @@ -453,9 +491,7 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) if (aia != NULL) { x509_get_crl(x509, file, &crl_uri); parse_load_crl(crl_uri); - if (auth_find(&auths, aki) == NULL) - parse_load_certchain(aia); - a = auth_find(&auths, aki); + a = parse_load_certchain(aia); c = crl_get(&crlt, a); if ((status = valid_x509(file, ctx, x509, a, c, &errstr))) { diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index 3a124ef84..ffd010013 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.257 2024/04/08 14:02:13 tb Exp $ */ +/* $OpenBSD: main.c,v 1.258 2024/05/20 15:51:43 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -156,6 +156,7 @@ entity_read_req(struct ibuf *b, struct entity *ent) io_read_buf(b, &ent->location, sizeof(ent->location)); io_read_buf(b, &ent->repoid, sizeof(ent->repoid)); io_read_buf(b, &ent->talid, sizeof(ent->talid)); + io_read_buf(b, &ent->certid, sizeof(ent->certid)); io_read_str(b, &ent->path); io_read_str(b, &ent->file); io_read_str(b, &ent->mftaki); @@ -176,6 +177,7 @@ entity_write_req(const struct entity *ent) io_simple_buffer(b, &ent->location, sizeof(ent->location)); io_simple_buffer(b, &ent->repoid, sizeof(ent->repoid)); io_simple_buffer(b, &ent->talid, sizeof(ent->talid)); + io_simple_buffer(b, &ent->certid, sizeof(ent->certid)); io_str_buffer(b, ent->path); io_str_buffer(b, ent->file); io_str_buffer(b, ent->mftaki); @@ -191,7 +193,7 @@ entity_write_repo(const struct repo *rp) enum location loc = DIR_UNKNOWN; unsigned int repoid; char *path, *altpath; - int talid = 0; + int talid = 0, certid = 0; repoid = repo_id(rp); path = repo_basedir(rp, 0); @@ -201,6 +203,7 @@ entity_write_repo(const struct repo *rp) io_simple_buffer(b, &loc, sizeof(loc)); io_simple_buffer(b, &repoid, sizeof(repoid)); io_simple_buffer(b, &talid, sizeof(talid)); + io_simple_buffer(b, &certid, sizeof(certid)); io_str_buffer(b, path); io_str_buffer(b, altpath); io_buf_buffer(b, NULL, 0); /* ent->mftaki */ @@ -233,7 +236,7 @@ entityq_flush(struct entityq *q, struct repo *rp) */ static void entityq_add(char *path, char *file, enum rtype type, enum location loc, - struct repo *rp, unsigned char *data, size_t datasz, int talid, + struct repo *rp, unsigned char *data, size_t datasz, int talid, int certid, char *mftaki) { struct entity *p; @@ -244,6 +247,7 @@ entityq_add(char *path, char *file, enum rtype type, enum location loc, p->type = type; p->location = loc; p->talid = talid; + p->certid = certid; p->mftaki = mftaki; p->path = path; if (rp != NULL) @@ -419,7 +423,7 @@ queue_add_from_mft(const struct mft *mft) if ((mftaki = strdup(mft->aki)) == NULL) err(1, NULL); entityq_add(npath, nfile, f->type, f->location, rp, NULL, 0, - mft->talid, mftaki); + mft->talid, mft->certid, mftaki); } } @@ -442,7 +446,7 @@ queue_add_file(const char *file, enum rtype type, int talid) if ((nfile = strdup(file)) == NULL) err(1, NULL); /* Not in a repository, so directly add to queue. */ - entityq_add(NULL, nfile, type, DIR_UNKNOWN, NULL, buf, len, talid, + entityq_add(NULL, nfile, type, DIR_UNKNOWN, NULL, buf, len, talid, 0, NULL); } @@ -478,7 +482,7 @@ queue_add_from_tal(struct tal *tal) data = tal->pkey; tal->pkey = NULL; entityq_add(NULL, nfile, RTYPE_CER, DIR_VALID, repo, data, - tal->pkeysz, tal->id, NULL); + tal->pkeysz, tal->id, tal->id, NULL); } /* @@ -547,7 +551,7 @@ queue_add_from_cert(const struct cert *cert) } entityq_add(npath, nfile, RTYPE_MFT, DIR_UNKNOWN, repo, NULL, 0, - cert->talid, NULL); + cert->talid, cert->certid, NULL); } /* @@ -591,7 +595,7 @@ entity_process(struct ibuf *b, struct stats *st, struct vrp_tree *tree, if (filemode) goto done; - if (filepath_add(&fpt, file, mtime) == 0) { + if (filepath_add(&fpt, file, talid, mtime) == 0) { warnx("%s: File already visited", file); goto done; } diff --git a/usr.sbin/rpki-client/mft.c b/usr.sbin/rpki-client/mft.c index 8b6bf28d0..64db5f6ff 100644 --- a/usr.sbin/rpki-client/mft.c +++ b/usr.sbin/rpki-client/mft.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mft.c,v 1.114 2024/05/15 09:19:48 tb Exp $ */ +/* $OpenBSD: mft.c,v 1.115 2024/05/20 15:51:43 claudio Exp $ */ /* * Copyright (c) 2022 Theo Buehler * Copyright (c) 2019 Kristaps Dzonsons @@ -537,6 +537,7 @@ mft_buffer(struct ibuf *b, const struct mft *p) io_simple_buffer(b, &p->repoid, sizeof(p->repoid)); io_simple_buffer(b, &p->talid, sizeof(p->talid)); + io_simple_buffer(b, &p->certid, sizeof(p->certid)); io_str_buffer(b, p->path); io_str_buffer(b, p->aia); @@ -569,6 +570,7 @@ mft_read(struct ibuf *b) io_read_buf(b, &p->repoid, sizeof(p->repoid)); io_read_buf(b, &p->talid, sizeof(p->talid)); + io_read_buf(b, &p->certid, sizeof(p->certid)); io_read_str(b, &p->path); io_read_str(b, &p->aia); diff --git a/usr.sbin/rpki-client/parser.c b/usr.sbin/rpki-client/parser.c index f482d6768..98b1eac70 100644 --- a/usr.sbin/rpki-client/parser.c +++ b/usr.sbin/rpki-client/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.135 2024/04/21 19:27:44 claudio Exp $ */ +/* $OpenBSD: parser.c,v 1.136 2024/05/20 15:51:43 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -86,6 +86,39 @@ repo_add(unsigned int id, char *path, char *validpath) errx(1, "repository already added: id %d, %s", id, path); } +/* + * Return the issuer by its certificate id, or NULL on failure. + * Make sure the AKI is the same as the AKI listed on the Manifest, + * and that the SKI of the cert matches with the AKI. + */ +static struct auth * +find_issuer(const char *fn, int id, const char *aki, const char *mftaki) +{ + struct auth *a; + + a = auth_find(&auths, id); + if (a == NULL) { + warnx("%s: RFC 6487: unknown cert with SKI %s", fn, aki); + return NULL; + } + + if (mftaki != NULL) { + if (strcmp(aki, mftaki) != 0) { + warnx("%s: AKI %s doesn't match Manifest AKI %s", fn, + aki, mftaki); + return NULL; + } + } + + if (strcmp(aki, a->cert->ski) != 0) { + warnx("%s: AKI %s doesn't match issuer SKI %s", fn, + aki, a->cert->ski); + return NULL; + } + + return a; +} + /* * Build access path to file based on repoid, path, location and file values. */ @@ -137,7 +170,7 @@ proc_parser_roa(char *file, const unsigned char *der, size_t len, if ((roa = roa_parse(&x509, file, entp->talid, der, len)) == NULL) return NULL; - a = valid_ski_aki(file, &auths, roa->ski, roa->aki, entp->mftaki); + a = find_issuer(file, entp->certid, roa->aki, entp->mftaki); crl = crl_get(&crlt, a); if (!valid_x509(file, ctx, x509, a, crl, &errstr)) { @@ -172,7 +205,7 @@ proc_parser_spl(char *file, const unsigned char *der, size_t len, if ((spl = spl_parse(&x509, file, entp->talid, der, len)) == NULL) return NULL; - a = valid_ski_aki(file, &auths, spl->ski, spl->aki, entp->mftaki); + a = find_issuer(file, entp->certid, spl->aki, entp->mftaki); crl = crl_get(&crlt, a); if (!valid_x509(file, ctx, x509, a, crl, &errstr)) { @@ -336,7 +369,7 @@ proc_parser_mft_pre(struct entity *entp, char *file, struct crl **crl, if (*crl == NULL) *crl = parse_load_crl_from_mft(entp, mft, DIR_VALID, crlfile); - a = valid_ski_aki(file, &auths, mft->ski, mft->aki, NULL); + a = find_issuer(file, entp->certid, mft->aki, NULL); if (!valid_x509(file, ctx, x509, a, *crl, errstr)) goto err; X509_free(x509); @@ -344,6 +377,7 @@ proc_parser_mft_pre(struct entity *entp, char *file, struct crl **crl, mft->repoid = entp->repoid; mft->talid = a->cert->talid; + mft->certid = entp->certid; now = get_current_time(); /* check that now is not before from */ @@ -493,7 +527,7 @@ proc_parser_mft(struct entity *entp, struct mft **mp, char **crlfile, */ static struct cert * proc_parser_cert(char *file, const unsigned char *der, size_t len, - const char *mftaki) + const struct entity *entp) { struct cert *cert; struct crl *crl; @@ -507,7 +541,7 @@ proc_parser_cert(char *file, const unsigned char *der, size_t len, if (cert == NULL) return NULL; - a = valid_ski_aki(file, &auths, cert->ski, cert->aki, mftaki); + a = find_issuer(file, entp->certid, cert->aki, entp->mftaki); crl = crl_get(&crlt, a); if (!valid_x509(file, ctx, cert->x509, a, crl, &errstr) || @@ -531,7 +565,7 @@ proc_parser_cert(char *file, const unsigned char *der, size_t len, * Add validated CA certs to the RPKI auth tree. */ if (cert->purpose == CERT_PURPOSE_CA) - auth_insert(&auths, cert, a); + auth_insert(file, &auths, cert, a); return cert; } @@ -557,19 +591,12 @@ proc_parser_root_cert(char *file, const unsigned char *der, size_t len, cert = ta_parse(file, cert, pkey, pkeysz); if (cert == NULL) return NULL; - - if (!valid_ta(file, &auths, cert)) { - warnx("%s: certificate not a valid ta", file); - cert_free(cert); - return NULL; - } - cert->talid = talid; /* * Add valid roots to the RPKI auth tree. */ - auth_insert(&auths, cert, NULL); + auth_insert(file, &auths, cert, NULL); return cert; } @@ -590,7 +617,7 @@ proc_parser_gbr(char *file, const unsigned char *der, size_t len, if ((gbr = gbr_parse(&x509, file, entp->talid, der, len)) == NULL) return NULL; - a = valid_ski_aki(file, &auths, gbr->ski, gbr->aki, entp->mftaki); + a = find_issuer(file, entp->certid, gbr->aki, entp->mftaki); crl = crl_get(&crlt, a); /* return value can be ignored since nothing happens here */ @@ -623,7 +650,7 @@ proc_parser_aspa(char *file, const unsigned char *der, size_t len, if ((aspa = aspa_parse(&x509, file, entp->talid, der, len)) == NULL) return NULL; - a = valid_ski_aki(file, &auths, aspa->ski, aspa->aki, entp->mftaki); + a = find_issuer(file, entp->certid, aspa->aki, entp->mftaki); crl = crl_get(&crlt, a); if (!valid_x509(file, ctx, x509, a, crl, &errstr)) { @@ -658,7 +685,7 @@ proc_parser_tak(char *file, const unsigned char *der, size_t len, if ((tak = tak_parse(&x509, file, entp->talid, der, len)) == NULL) return NULL; - a = valid_ski_aki(file, &auths, tak->ski, tak->aki, entp->mftaki); + a = find_issuer(file, entp->certid, tak->aki, entp->mftaki); crl = crl_get(&crlt, a); if (!valid_x509(file, ctx, x509, a, crl, &errstr)) { @@ -764,8 +791,7 @@ parse_entity(struct entityq *q, struct msgbuf *msgq) f, flen, entp->data, entp->datasz, entp->talid); else - cert = proc_parser_cert(file, f, flen, - entp->mftaki); + cert = proc_parser_cert(file, f, flen, entp); if (cert != NULL) mtime = cert->notbefore; io_simple_buffer(b, &mtime, sizeof(mtime)); diff --git a/usr.sbin/rpki-client/repo.c b/usr.sbin/rpki-client/repo.c index 14ea81dea..43432cfd8 100644 --- a/usr.sbin/rpki-client/repo.c +++ b/usr.sbin/rpki-client/repo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repo.c,v 1.57 2024/04/21 19:27:44 claudio Exp $ */ +/* $OpenBSD: repo.c,v 1.58 2024/05/20 15:51:43 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -116,13 +116,14 @@ static void remove_contents(char *); * Database of all file path accessed during a run. */ struct filepath { - RB_ENTRY(filepath) entry; + RB_ENTRY(filepath) entry; char *file; time_t mtime; + unsigned int talmask; }; static inline int -filepathcmp(struct filepath *a, struct filepath *b) +filepathcmp(const struct filepath *a, const struct filepath *b) { return strcmp(a->file, b->file); } @@ -133,22 +134,28 @@ RB_PROTOTYPE(filepath_tree, filepath, entry, filepathcmp); * Functions to lookup which files have been accessed during computation. */ int -filepath_add(struct filepath_tree *tree, char *file, time_t mtime) +filepath_add(struct filepath_tree *tree, char *file, int id, time_t mtime) { - struct filepath *fp; + struct filepath *fp, *rfp; - if ((fp = malloc(sizeof(*fp))) == NULL) + CTASSERT(TALSZ_MAX < 8 * sizeof(fp->talmask)); + assert(id >= 0 && id < 8 * (int)sizeof(fp->talmask)); + + if ((fp = calloc(1, sizeof(*fp))) == NULL) err(1, NULL); - fp->mtime = mtime; if ((fp->file = strdup(file)) == NULL) err(1, NULL); + fp->mtime = mtime; - if (RB_INSERT(filepath_tree, tree, fp) != NULL) { + if ((rfp = RB_INSERT(filepath_tree, tree, fp)) != NULL) { /* already in the tree */ free(fp->file); free(fp); - return 0; + if (rfp->talmask & (1 << id)) + return 0; + fp = rfp; } + fp->talmask |= (1 << id); return 1; } @@ -906,7 +913,7 @@ rrdp_handle_file(unsigned int id, enum publish_type pt, char *uri, /* write new content or mark uri as deleted. */ if (pt == PUB_DEL) { - filepath_add(&rr->deleted, uri, 0); + filepath_add(&rr->deleted, uri, 0, 0); } else { fp = filepath_find(&rr->deleted, uri); if (fp != NULL) { diff --git a/usr.sbin/rpki-client/validate.c b/usr.sbin/rpki-client/validate.c index 73cf42eb0..f66518a47 100644 --- a/usr.sbin/rpki-client/validate.c +++ b/usr.sbin/rpki-client/validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: validate.c,v 1.73 2024/03/19 05:04:13 tb Exp $ */ +/* $OpenBSD: validate.c,v 1.74 2024/05/20 15:51:43 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -79,52 +79,6 @@ valid_ip(struct auth *a, enum afi afi, return valid_ip(a->issuer, afi, min, max); } -/* - * Make sure the AKI is the same as the AKI listed on the Manifest, - * and that the SKI doesn't already exist. - * Return the issuer by its AKI, or NULL on failure. - */ -struct auth * -valid_ski_aki(const char *fn, struct auth_tree *auths, - const char *ski, const char *aki, const char *mftaki) -{ - struct auth *a; - - if (mftaki != NULL) { - if (strcmp(aki, mftaki) != 0) { - warnx("%s: AKI doesn't match Manifest AKI", fn); - return NULL; - } - } - - if (auth_find(auths, ski) != NULL) { - warnx("%s: RFC 6487: duplicate SKI", fn); - return NULL; - } - - a = auth_find(auths, aki); - if (a == NULL) - warnx("%s: RFC 6487: unknown AKI", fn); - - return a; -} - -/* - * Validate a trust anchor by making sure that the SKI is unique. - * Returns 1 if valid, 0 otherwise. - */ -int -valid_ta(const char *fn, struct auth_tree *auths, const struct cert *cert) -{ - /* SKI must not be a dupe. */ - if (auth_find(auths, cert->ski) != NULL) { - warnx("%s: RFC 6487: duplicate SKI", fn); - return 0; - } - - return 1; -} - /* * Validate a non-TA certificate: make sure its IP and AS resources are * fully covered by those in the authority key (which must exist). diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h index c45e9c39b..e65307dd3 100644 --- a/usr.sbin/snmpd/snmpd.h +++ b/usr.sbin/snmpd/snmpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.h,v 1.119 2024/02/06 15:36:11 martijn Exp $ */ +/* $OpenBSD: snmpd.h,v 1.120 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -456,7 +456,6 @@ RB_PROTOTYPE(snmp_messages, snmp_message, sm_entry, snmp_messagecmp) /* trap.c */ void trap_init(void); -int trap_imsg(struct imsgev *, pid_t); int trap_send(struct ber_oid *, struct ber_element *); /* smi.c */ diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c index 055d11724..d444c8d9b 100644 --- a/usr.sbin/snmpd/snmpe.c +++ b/usr.sbin/snmpd/snmpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.c,v 1.94 2024/01/16 13:33:13 claudio Exp $ */ +/* $OpenBSD: snmpe.c,v 1.95 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -48,7 +48,6 @@ int snmpe_dispatch_parent(int, struct privsep_proc *, struct imsg *); int snmpe_parse(struct snmp_message *); void snmpe_tryparse(int, struct snmp_message *); int snmpe_parsevarbinds(struct snmp_message *); -void snmpe_sig_handler(int sig, short, void *); int snmpe_bind(struct address *); void snmpe_recvmsg(int fd, short, void *); void snmpe_readcb(int fd, short, void *); diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h index 4e055f3eb..893c78b5b 100644 --- a/usr.sbin/tcpdump/interface.h +++ b/usr.sbin/tcpdump/interface.h @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.h,v 1.87 2023/02/28 10:04:50 claudio Exp $ */ +/* $OpenBSD: interface.h,v 1.88 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -20,7 +20,7 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Id: interface.h,v 1.87 2023/02/28 10:04:50 claudio Exp $ (LBL) + * @(#) $Id: interface.h,v 1.88 2024/05/21 05:00:48 jsg Exp $ (LBL) */ #ifndef tcpdump_interface_h @@ -166,8 +166,6 @@ extern void safeputs(const char *); extern void safeputchar(int); extern void printb(char *, unsigned short, char *); -extern void wrapup(int); - extern __dead void error(const char *, ...) __attribute__((__format__ (printf, 1, 2))); extern void warning(const char *, ...) @@ -200,12 +198,9 @@ extern void bgp_print(const u_char *, int); extern void decnet_print(const u_char *, u_int, u_int); extern void default_print(const u_char *, u_int); extern void dvmrp_print(const u_char *, u_int); -extern void egp_print(const u_char *, u_int, const u_char *); extern void enc_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); extern void pflog_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); -extern void pflog_old_if_print(u_char *, const struct pcap_pkthdr *, - const u_char *); extern void pfsync_if_print(u_char *, const struct pcap_pkthdr *, const u_char *); extern void pfsync_ip_print(const u_char *, u_int, const u_char *); diff --git a/usr.sbin/tcpdump/print-gre.c b/usr.sbin/tcpdump/print-gre.c index 96e7a52e5..1a1c5e49d 100644 --- a/usr.sbin/tcpdump/print-gre.c +++ b/usr.sbin/tcpdump/print-gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-gre.c,v 1.34 2020/08/17 07:09:25 dlg Exp $ */ +/* $OpenBSD: print-gre.c,v 1.35 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -84,7 +84,6 @@ void gre_print_1(const u_char *, u_int); void gre_print_pptp(const u_char *, u_int, uint16_t); void gre_print_eoip(const u_char *, u_int, uint16_t); void gre_print_erspan(uint16_t, const u_char *, u_int); -void gre_print_erspan3(const u_char *, u_int); void gre_sre_print(u_int16_t, u_int8_t, u_int8_t, const u_char *, u_int); void gre_sre_ip_print(u_int8_t, u_int8_t, const u_char *, u_int); void gre_sre_asn_print(u_int8_t, u_int8_t, const u_char *, u_int); diff --git a/usr.sbin/tftpd/tftpd.c b/usr.sbin/tftpd/tftpd.c index 168df85e0..aec254a45 100644 --- a/usr.sbin/tftpd/tftpd.c +++ b/usr.sbin/tftpd/tftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftpd.c,v 1.50 2022/10/09 23:04:57 kn Exp $ */ +/* $OpenBSD: tftpd.c,v 1.51 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2012 David Gwynne @@ -166,7 +166,6 @@ void tftpd_events(void); void tftpd_recv(int, short, void *); int retry(struct tftp_client *); int tftp_flush(struct tftp_client *); -void tftp_end(struct tftp_client *); void tftp(struct tftp_client *, struct tftphdr *, size_t); void tftp_open(struct tftp_client *, const char *); diff --git a/usr.sbin/traceroute/traceroute.h b/usr.sbin/traceroute/traceroute.h index c148a6c2d..35c62e90d 100644 --- a/usr.sbin/traceroute/traceroute.h +++ b/usr.sbin/traceroute/traceroute.h @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.h,v 1.7 2021/09/03 09:13:00 florian Exp $ */ +/* $OpenBSD: traceroute.h,v 1.8 2024/05/21 05:00:48 jsg Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /* @@ -167,7 +167,4 @@ extern char *hostname; extern u_int16_t srcport; -extern int verbose; -extern int dump; - extern char *__progname; diff --git a/usr.sbin/ypldap/ldapclient.c b/usr.sbin/ypldap/ldapclient.c index cee23af20..9cd4e48d9 100644 --- a/usr.sbin/ypldap/ldapclient.c +++ b/usr.sbin/ypldap/ldapclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapclient.c,v 1.49 2023/07/18 13:06:33 claudio Exp $ */ +/* $OpenBSD: ldapclient.c,v 1.50 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver @@ -46,7 +46,6 @@ void client_sig_handler(int, short, void *); void client_dispatch_dns(int, short, void *); void client_dispatch_parent(int, short, void *); void client_shutdown(void); -void client_connect(int, short, void *); void client_configure(struct env *); void client_periodic_update(int, short, void *); int client_build_req(struct idm *, struct idm_req *, struct aldap_message *, diff --git a/usr.sbin/ypldap/ypldap.c b/usr.sbin/ypldap/ypldap.c index d2bc2a23d..3f9a7b39a 100644 --- a/usr.sbin/ypldap/ypldap.c +++ b/usr.sbin/ypldap/ypldap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypldap.c,v 1.24 2023/03/31 03:38:26 jmatthew Exp $ */ +/* $OpenBSD: ypldap.c,v 1.25 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -51,7 +51,6 @@ void main_trash_update(struct env *); void main_end_update(struct env *); int main_create_user_groups(struct env *); void purge_config(struct env *); -void reconfigure(struct env *); int pipe_main2client[2]; diff --git a/usr.sbin/ypserv/revnetgroup/hash.h b/usr.sbin/ypserv/revnetgroup/hash.h index edfadffec..3dfc210fa 100644 --- a/usr.sbin/ypserv/revnetgroup/hash.h +++ b/usr.sbin/ypserv/revnetgroup/hash.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.h,v 1.3 2013/12/05 14:20:53 jca Exp $ */ +/* $OpenBSD: hash.h,v 1.4 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 1995 * Bill Paul . All rights reserved. @@ -60,7 +60,6 @@ struct group_entry { #define LINSIZ 1024 * 10 -extern void store( struct group_entry ** , char *, char * ); extern void mstore( struct member_entry ** , char *, char *, char * ); extern void ngstore( struct group_entry **, char *, char * ); extern char *lookup( struct group_entry **, char * ); diff --git a/usr.sbin/ypserv/yppush/yppush.c b/usr.sbin/ypserv/yppush/yppush.c index c054a3bb9..6691fb728 100644 --- a/usr.sbin/ypserv/yppush/yppush.c +++ b/usr.sbin/ypserv/yppush/yppush.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.c,v 1.31 2015/01/16 06:40:23 deraadt Exp $ */ +/* $OpenBSD: yppush.c,v 1.32 2024/05/20 02:00:25 jsg Exp $ */ /* * Copyright (c) 1995 Mats O Jansson @@ -57,7 +57,6 @@ u_int32_t OrderNum; char *master; extern void yppush_xfrrespprog_1(struct svc_req *request, SVCXPRT *xprt); -extern bool_t xdr_ypreq_xfr(XDR *, struct ypreq_xfr *); static void usage(void) diff --git a/usr.sbin/ypserv/yppush/yppush.h b/usr.sbin/ypserv/yppush/yppush.h index aa07f0403..79fa3e2fe 100644 --- a/usr.sbin/ypserv/yppush/yppush.h +++ b/usr.sbin/ypserv/yppush/yppush.h @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.h,v 1.9 2003/07/15 06:10:46 deraadt Exp $ */ +/* $OpenBSD: yppush.h,v 1.10 2024/05/21 05:00:48 jsg Exp $ */ /* * Copyright (c) 1996 Mats O Jansson @@ -39,7 +39,6 @@ __BEGIN_DECLS bool_t xdr_yppush_status(XDR *, yppush_status *); bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr *); -void * yppushproc_null_1(void *, CLIENT *); void * yppushproc_null_1_svc(void *, struct svc_req *); char * yppush_err_string(enum yppush_status y); void yppush_xfrrespprog_1(struct svc_req *, SVCXPRT *);