From owner-svn-src-all@freebsd.org Sun Nov 8 00:00:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7EBED2D6058; Sun, 8 Nov 2020 00:00:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTDmK3BRwz4SsY; Sun, 8 Nov 2020 00:00:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6056A16959; Sun, 8 Nov 2020 00:00:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A800nFG054910; Sun, 8 Nov 2020 00:00:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A800ns4054909; Sun, 8 Nov 2020 00:00:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011080000.0A800ns4054909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 8 Nov 2020 00:00:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367467 - stable/11/contrib/libcxxrt X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/11/contrib/libcxxrt X-SVN-Commit-Revision: 367467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 00:00:49 -0000 Author: dim Date: Sun Nov 8 00:00:49 2020 New Revision: 367467 URL: https://svnweb.freebsd.org/changeset/base/367467 Log: MFC r367323: Update libcxxrt's private copy of elftoolchain demangler This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with the most recent version from upstream r3877. Similar to r367322, this fixes a number of possible assertions, and allows it to correctly demangle several names that it could not handle before. PR: 250702 MFC r367337: Make vector-related functions in libcxxrt's demangler static Follow-up to r367323 by re-adding static to a number of the functions copied from elftc's libelftc_vstr.c. This was requested by upstream. PR: 250702 Modified: stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c ============================================================================== --- stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c Sat Nov 7 23:57:57 2020 (r367466) +++ stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c Sun Nov 8 00:00:49 2020 (r367467) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2007, 2008 Hyogeol Lee + * Copyright (c) 2007 Hyogeol Lee + * Copyright (c) 2015-2017 Kai Wang * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,12 +55,17 @@ struct vector_str { }; #define BUFFER_GROWFACTOR 1.618 -#define VECTOR_DEF_CAPACITY 8 +#define BUFFER_GROW(x) (((x)+0.5)*BUFFER_GROWFACTOR) + +#define ELFTC_FAILURE 0 #define ELFTC_ISDIGIT(C) (isdigit((C) & 0xFF)) +#define ELFTC_SUCCESS 1 +#define VECTOR_DEF_CAPACITY 8 + enum type_qualifier { TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT, - TYPE_CST, TYPE_VEC + TYPE_CST, TYPE_VEC, TYPE_RREF }; struct vector_type_qualifier { @@ -73,35 +79,57 @@ enum read_cmd { READ_TYPE, READ_FUNC, READ_PTRMEM }; +struct read_cmd_item { + enum read_cmd cmd; + void *data; +}; + struct vector_read_cmd { size_t size, capacity; - enum read_cmd *r_container; + struct read_cmd_item *r_container; }; +enum push_qualifier { + PUSH_ALL_QUALIFIER, + PUSH_CV_QUALIFIER, + PUSH_NON_CV_QUALIFIER, +}; + struct cpp_demangle_data { struct vector_str output; /* output string vector */ - struct vector_str output_tmp; struct vector_str subst; /* substitution string vector */ struct vector_str tmpl; struct vector_str class_type; + struct vector_str *cur_output; /* ptr to current output vec */ struct vector_read_cmd cmd; - bool paren; /* parenthesis opened */ - bool pfirst; /* first element of parameter */ bool mem_rst; /* restrict member function */ bool mem_vat; /* volatile member function */ bool mem_cst; /* const member function */ + bool mem_ref; /* lvalue-ref member func */ + bool mem_rref; /* rvalue-ref member func */ + bool is_tmpl; /* template args */ + bool is_functype; /* function type */ + bool ref_qualifier; /* ref qualifier */ + enum type_qualifier ref_qualifier_type; /* ref qualifier type */ + enum push_qualifier push_qualifier; /* which qualifiers to push */ int func_type; const char *cur; /* current mangled name ptr */ const char *last_sname; /* last source name */ - int push_head; }; +struct type_delimit { + bool paren; + bool firstp; +}; + #define CPP_DEMANGLE_TRY_LIMIT 128 #define FLOAT_SPRINTF_TRY_LIMIT 5 #define FLOAT_QUADRUPLE_BYTES 16 #define FLOAT_EXTENED_BYTES 10 #define SIMPLE_HASH(x,y) (64 * x + y) +#define DEM_PUSH_STR(d,s) cpp_demangle_push_str((d), (s), strlen((s))) +#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s))) static size_t get_strlen_sum(const struct vector_str *v); static bool vector_str_grow(struct vector_str *v); @@ -213,7 +241,7 @@ vector_str_grow(struct vector_str *v) assert(v->capacity > 0); - tmp_cap = v->capacity * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(v->capacity); assert(tmp_cap > v->capacity); @@ -314,7 +342,7 @@ vector_str_push_vector_head(struct vector_str *dst, st if (dst == NULL || org == NULL) return (false); - tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(dst->size + org->size); if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) return (false); @@ -342,6 +370,47 @@ vector_str_push_vector_head(struct vector_str *dst, st } /** + * @brief Push org vector to the tail of det vector. + * @return false at failed, true at success. + */ +static bool +vector_str_push_vector(struct vector_str *dst, struct vector_str *org) +{ + size_t i, j, tmp_cap; + char **tmp_ctn; + + if (dst == NULL || org == NULL) + return (false); + + tmp_cap = BUFFER_GROW(dst->size + org->size); + + if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) + return (false); + + for (i = 0; i < dst->size; ++i) + tmp_ctn[i] = dst->container[i]; + + for (i = 0; i < org->size; ++i) + if ((tmp_ctn[i + dst->size] = strdup(org->container[i])) == + NULL) { + for (j = 0; j < i + dst->size; ++j) + free(tmp_ctn[j]); + + free(tmp_ctn); + + return (false); + } + + free(dst->container); + + dst->container = tmp_ctn; + dst->capacity = tmp_cap; + dst->size += org->size; + + return (true); +} + +/** * @brief Get new allocated flat string from vector between begin and end. * * If r_len is not NULL, string length will be returned. @@ -387,6 +456,7 @@ static int cpp_demangle_push_fp(struct cpp_demangle_da char *(*)(const char *, size_t)); static int cpp_demangle_push_str(struct cpp_demangle_data *, const char *, size_t); +static int cpp_demangle_pop_str(struct cpp_demangle_data *); static int cpp_demangle_push_subst(struct cpp_demangle_data *, const char *, size_t); static int cpp_demangle_push_subst_v(struct cpp_demangle_data *, @@ -419,16 +489,18 @@ static int cpp_demangle_read_number_as_string(struct c static int cpp_demangle_read_nv_offset(struct cpp_demangle_data *); static int cpp_demangle_read_offset(struct cpp_demangle_data *); static int cpp_demangle_read_offset_number(struct cpp_demangle_data *); -static int cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *); +static int cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *, + struct vector_type_qualifier *); static int cpp_demangle_read_sname(struct cpp_demangle_data *); static int cpp_demangle_read_subst(struct cpp_demangle_data *); static int cpp_demangle_read_subst_std(struct cpp_demangle_data *); static int cpp_demangle_read_subst_stdtmpl(struct cpp_demangle_data *, - const char *, size_t); + const char *); static int cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *); static int cpp_demangle_read_tmpl_args(struct cpp_demangle_data *); static int cpp_demangle_read_tmpl_param(struct cpp_demangle_data *); -static int cpp_demangle_read_type(struct cpp_demangle_data *, int); +static int cpp_demangle_read_type(struct cpp_demangle_data *, + struct type_delimit *); static int cpp_demangle_read_type_flat(struct cpp_demangle_data *, char **); static int cpp_demangle_read_uqname(struct cpp_demangle_data *); @@ -440,10 +512,12 @@ static char *decode_fp_to_float80(const char *, size_t static char *decode_fp_to_long_double(const char *, size_t); static int hex_to_dec(char); static void vector_read_cmd_dest(struct vector_read_cmd *); -static int vector_read_cmd_find(struct vector_read_cmd *, enum read_cmd); +static struct read_cmd_item *vector_read_cmd_find(struct vector_read_cmd *, + enum read_cmd); static int vector_read_cmd_init(struct vector_read_cmd *); static int vector_read_cmd_pop(struct vector_read_cmd *); -static int vector_read_cmd_push(struct vector_read_cmd *, enum read_cmd); +static int vector_read_cmd_push(struct vector_read_cmd *, enum read_cmd, + void *); static void vector_type_qualifier_dest(struct vector_type_qualifier *); static int vector_type_qualifier_init(struct vector_type_qualifier *); static int vector_type_qualifier_push(struct vector_type_qualifier *, @@ -460,14 +534,16 @@ char * __cxa_demangle_gnu3(const char *org) { struct cpp_demangle_data ddata; + struct vector_str ret_type; + struct type_delimit td; ssize_t org_len; unsigned int limit; - char *rtn = NULL; + char *rtn; + bool has_ret, more_type; - if (org == NULL) + if (org == NULL || (org_len = strlen(org)) < 2) return (NULL); - org_len = strlen(org); if (org_len > 11 && !strncmp(org, "_GLOBAL__I_", 11)) { if ((rtn = malloc(org_len + 19)) == NULL) return (NULL); @@ -476,52 +552,100 @@ __cxa_demangle_gnu3(const char *org) return (rtn); } - // Try demangling as a type for short encodings - if ((org_len < 2) || (org[0] != '_' || org[1] != 'Z' )) { - if (!cpp_demangle_data_init(&ddata, org)) - return (NULL); - if (!cpp_demangle_read_type(&ddata, 0)) - goto clean; - rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL); - goto clean; - } + if (org[0] != '_' || org[1] != 'Z') + return (NULL); - if (!cpp_demangle_data_init(&ddata, org + 2)) return (NULL); rtn = NULL; + has_ret = more_type = false; if (!cpp_demangle_read_encoding(&ddata)) goto clean; + /* + * Pop function name from substitution candidate list. + */ + if (*ddata.cur != 0 && ddata.subst.size >= 1) { + if (!vector_str_pop(&ddata.subst)) + goto clean; + } + + td.paren = false; + td.firstp = true; limit = 0; + + /* + * The first type is a return type if we just demangled template + * args. (the template args is right next to the function name, + * which means it's a template function) + */ + if (ddata.is_tmpl) { + ddata.is_tmpl = false; + if (!vector_str_init(&ret_type)) + goto clean; + ddata.cur_output = &ret_type; + has_ret = true; + } + while (*ddata.cur != '\0') { /* * Breaking at some gcc info at tail. e.g) @@GLIBCXX_3.4 */ if (*ddata.cur == '@' && *(ddata.cur + 1) == '@') break; - if (!cpp_demangle_read_type(&ddata, 1)) - goto clean; + + if (has_ret) { + /* Read return type */ + if (!cpp_demangle_read_type(&ddata, NULL)) + goto clean; + } else { + /* Read function arg type */ + if (!cpp_demangle_read_type(&ddata, &td)) + goto clean; + } + + if (has_ret) { + /* Push return type to the beginning */ + if (!VEC_PUSH_STR(&ret_type, " ")) + goto clean; + if (!vector_str_push_vector_head(&ddata.output, + &ret_type)) + goto clean; + ddata.cur_output = &ddata.output; + vector_str_dest(&ret_type); + has_ret = false; + more_type = true; + } else if (more_type) + more_type = false; if (limit++ > CPP_DEMANGLE_TRY_LIMIT) goto clean; } + if (more_type) + goto clean; if (ddata.output.size == 0) goto clean; - if (ddata.paren && !vector_str_push(&ddata.output, ")", 1)) + if (td.paren && !VEC_PUSH_STR(&ddata.output, ")")) goto clean; - if (ddata.mem_vat && !vector_str_push(&ddata.output, " volatile", 9)) + if (ddata.mem_vat && !VEC_PUSH_STR(&ddata.output, " volatile")) goto clean; - if (ddata.mem_cst && !vector_str_push(&ddata.output, " const", 6)) + if (ddata.mem_cst && !VEC_PUSH_STR(&ddata.output, " const")) goto clean; - if (ddata.mem_rst && !vector_str_push(&ddata.output, " restrict", 9)) + if (ddata.mem_rst && !VEC_PUSH_STR(&ddata.output, " restrict")) goto clean; + if (ddata.mem_ref && !VEC_PUSH_STR(&ddata.output, " &")) + goto clean; + if (ddata.mem_rref && !VEC_PUSH_STR(&ddata.output, " &&")) + goto clean; rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL); clean: + if (has_ret) + vector_str_dest(&ret_type); + cpp_demangle_data_dest(&ddata); return (rtn); @@ -538,7 +662,6 @@ cpp_demangle_data_dest(struct cpp_demangle_data *d) vector_str_dest(&d->class_type); vector_str_dest(&d->tmpl); vector_str_dest(&d->subst); - vector_str_dest(&d->output_tmp); vector_str_dest(&d->output); } @@ -551,43 +674,42 @@ cpp_demangle_data_init(struct cpp_demangle_data *d, co if (!vector_str_init(&d->output)) return (0); - if (!vector_str_init(&d->output_tmp)) - goto clean1; if (!vector_str_init(&d->subst)) - goto clean2; + goto clean1; if (!vector_str_init(&d->tmpl)) - goto clean3; + goto clean2; if (!vector_str_init(&d->class_type)) - goto clean4; + goto clean3; if (!vector_read_cmd_init(&d->cmd)) - goto clean5; + goto clean4; assert(d->output.container != NULL); - assert(d->output_tmp.container != NULL); assert(d->subst.container != NULL); assert(d->tmpl.container != NULL); assert(d->class_type.container != NULL); - d->paren = false; - d->pfirst = false; d->mem_rst = false; d->mem_vat = false; d->mem_cst = false; + d->mem_ref = false; + d->mem_rref = false; + d->is_tmpl = false; + d->is_functype = false; + d->ref_qualifier = false; + d->push_qualifier = PUSH_ALL_QUALIFIER; d->func_type = 0; d->cur = cur; + d->cur_output = &d->output; d->last_sname = NULL; - d->push_head = 0; return (1); -clean5: - vector_str_dest(&d->class_type); clean4: - vector_str_dest(&d->tmpl); + vector_str_dest(&d->class_type); clean3: - vector_str_dest(&d->subst); + vector_str_dest(&d->tmpl); clean2: - vector_str_dest(&d->output_tmp); + vector_str_dest(&d->subst); clean1: vector_str_dest(&d->output); @@ -632,13 +754,27 @@ cpp_demangle_push_str(struct cpp_demangle_data *ddata, if (ddata == NULL || str == NULL || len == 0) return (0); - if (ddata->push_head > 0) - return (vector_str_push(&ddata->output_tmp, str, len)); + /* + * is_tmpl is used to check if the type (function arg) is right next + * to template args, and should always be cleared whenever new string + * pushed. + */ + ddata->is_tmpl = false; - return (vector_str_push(&ddata->output, str, len)); + return (vector_str_push(ddata->cur_output, str, len)); } static int +cpp_demangle_pop_str(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL) + return (0); + + return (vector_str_pop(ddata->cur_output)); +} + +static int cpp_demangle_push_subst(struct cpp_demangle_data *ddata, const char *str, size_t len) { @@ -677,9 +813,11 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d struct vector_type_qualifier *v, const char *type_str) { struct vector_str subst_v; + enum type_qualifier t; size_t idx, e_idx, e_len; - int rtn; char *buf; + int rtn; + bool cv; if (ddata == NULL || v == NULL) return (0); @@ -691,18 +829,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d if (type_str != NULL) { if (!vector_str_init(&subst_v)) return (0); - if (!vector_str_push(&subst_v, type_str, strlen(type_str))) + if (!VEC_PUSH_STR(&subst_v, type_str)) goto clean; } + cv = true; e_idx = 0; while (idx > 0) { switch (v->q_container[idx - 1]) { case TYPE_PTR: - if (!cpp_demangle_push_str(ddata, "*", 1)) + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, "*")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, "*", 1)) + if (!VEC_PUSH_STR(&subst_v, "*")) goto clean; if (!cpp_demangle_push_subst_v(ddata, &subst_v)) @@ -711,10 +853,13 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_REF: - if (!cpp_demangle_push_str(ddata, "&", 1)) + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, "&")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, "&", 1)) + if (!VEC_PUSH_STR(&subst_v, "&")) goto clean; if (!cpp_demangle_push_subst_v(ddata, &subst_v)) @@ -722,11 +867,29 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d } break; + case TYPE_RREF: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, "&&")) + goto clean; + if (type_str != NULL) { + if (!VEC_PUSH_STR(&subst_v, "&&")) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, + &subst_v)) + goto clean; + } + break; + case TYPE_CMX: - if (!cpp_demangle_push_str(ddata, " complex", 8)) + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, " complex")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " complex", 8)) + if (!VEC_PUSH_STR(&subst_v, " complex")) goto clean; if (!cpp_demangle_push_subst_v(ddata, &subst_v)) @@ -735,11 +898,13 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_IMG: - if (!cpp_demangle_push_str(ddata, " imaginary", 10)) + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, " imaginary")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " imaginary", - 10)) + if (!VEC_PUSH_STR(&subst_v, " imaginary")) goto clean; if (!cpp_demangle_push_subst_v(ddata, &subst_v)) @@ -748,6 +913,9 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_EXT: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (v->ext_name.size == 0 || e_idx > v->ext_name.size - 1) goto clean; @@ -759,14 +927,13 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d snprintf(buf, e_len + 2, " %s", v->ext_name.container[e_idx]); - if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) { + if (!DEM_PUSH_STR(ddata, buf)) { free(buf); goto clean; } if (type_str != NULL) { - if (!vector_str_push(&subst_v, buf, - e_len + 1)) { + if (!VEC_PUSH_STR(&subst_v, buf)) { free(buf); goto clean; } @@ -781,11 +948,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_RST: - if (!cpp_demangle_push_str(ddata, " restrict", 9)) + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; + if (!DEM_PUSH_STR(ddata, " restrict")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " restrict", 9)) + if (!VEC_PUSH_STR(&subst_v, " restrict")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -793,11 +971,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_VAT: - if (!cpp_demangle_push_str(ddata, " volatile", 9)) + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; + if (!DEM_PUSH_STR(ddata, " volatile")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " volatile", 9)) + if (!VEC_PUSH_STR(&subst_v, " volatile")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -805,11 +994,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_CST: - if (!cpp_demangle_push_str(ddata, " const", 6)) + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; + if (!DEM_PUSH_STR(ddata, " const")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " const", 6)) + if (!VEC_PUSH_STR(&subst_v, " const")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -817,6 +1017,9 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_VEC: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (v->ext_name.size == 0 || e_idx > v->ext_name.size - 1) goto clean; @@ -827,13 +1030,12 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d goto clean; snprintf(buf, e_len + 12, " __vector(%s)", v->ext_name.container[e_idx]); - if (!cpp_demangle_push_str(ddata, buf, e_len + 11)) { + if (!DEM_PUSH_STR(ddata, buf)) { free(buf); goto clean; } if (type_str != NULL) { - if (!vector_str_push(&subst_v, buf, - e_len + 11)) { + if (!VEC_PUSH_STR(&subst_v, buf)) { free(buf); goto clean; } @@ -907,10 +1109,10 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat if (*(++ddata->cur) == '\0') return (0); - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); - if (!cpp_demangle_push_str(ddata, "[]", 2)) + if (!DEM_PUSH_STR(ddata, "[]")) return (0); } else { if (ELFTC_ISDIGIT(*ddata->cur) != 0) { @@ -923,13 +1125,13 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat assert(num_len > 0); if (*(++ddata->cur) == '\0') return (0); - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); - if (!cpp_demangle_push_str(ddata, "[", 1)) + if (!DEM_PUSH_STR(ddata, "[")) return (0); if (!cpp_demangle_push_str(ddata, num, num_len)) return (0); - if (!cpp_demangle_push_str(ddata, "]", 1)) + if (!DEM_PUSH_STR(ddata, "]")) return (0); } else { p_idx = ddata->output.size; @@ -953,11 +1155,11 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat free(exp); return (0); } - if (!cpp_demangle_read_type(ddata, 0)) { + if (!cpp_demangle_read_type(ddata, NULL)) { free(exp); return (0); } - if (!cpp_demangle_push_str(ddata, "[", 1)) { + if (!DEM_PUSH_STR(ddata, "[")) { free(exp); return (0); } @@ -965,7 +1167,7 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat free(exp); return (0); } - if (!cpp_demangle_push_str(ddata, "]", 1)) { + if (!DEM_PUSH_STR(ddata, "]")) { free(exp); return (0); } @@ -1001,10 +1203,10 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_dat switch (*(++ddata->cur)) { case '0': ddata->cur += 2; - return (cpp_demangle_push_str(ddata, "false", 5)); + return (DEM_PUSH_STR(ddata, "false")); case '1': ddata->cur += 2; - return (cpp_demangle_push_str(ddata, "true", 4)); + return (DEM_PUSH_STR(ddata, "true")); default: return (0); } @@ -1041,7 +1243,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_dat case 'x': case 'y': if (*(++ddata->cur) == 'n') { - if (!cpp_demangle_push_str(ddata, "-", 1)) + if (!DEM_PUSH_STR(ddata, "-")) return (0); ++ddata->cur; } @@ -1070,11 +1272,11 @@ cpp_demangle_read_expression(struct cpp_demangle_data switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { case SIMPLE_HASH('s', 't'): ddata->cur += 2; - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('s', 'r'): ddata->cur += 2; - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); if (!cpp_demangle_read_uqname(ddata)) return (0); @@ -1351,8 +1553,7 @@ cpp_demangle_read_expression_flat(struct cpp_demangle_ size_t i, p_idx, idx, exp_len; char *exp; - output = ddata->push_head > 0 ? &ddata->output_tmp : - &ddata->output; + output = &ddata->output; p_idx = output->size; @@ -1429,8 +1630,12 @@ static int cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c, struct vector_type_qualifier *v) { + struct type_delimit td; + struct read_cmd_item *rc; size_t class_type_size, class_type_len, limit; const char *class_type; + int i; + bool paren, non_cv_qualifier; if (ddata == NULL || *ddata->cur != 'F' || v == NULL) return (0); @@ -1441,12 +1646,43 @@ cpp_demangle_read_function(struct cpp_demangle_data *d *ext_c = 1; ++ddata->cur; } - if (!cpp_demangle_read_type(ddata, 0)) + + /* Return type */ + if (!cpp_demangle_read_type(ddata, NULL)) return (0); + if (*ddata->cur != 'E') { - if (!cpp_demangle_push_str(ddata, "(", 1)) + if (!DEM_PUSH_STR(ddata, " ")) return (0); - if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM)) { + + non_cv_qualifier = false; + if (v->size > 0) { + for (i = 0; (size_t) i < v->size; i++) { + if (v->q_container[i] != TYPE_RST && + v->q_container[i] != TYPE_VAT && + v->q_container[i] != TYPE_CST) { + non_cv_qualifier = true; + break; + } + } + } + + paren = false; + rc = vector_read_cmd_find(&ddata->cmd, READ_PTRMEM); + if (non_cv_qualifier || rc != NULL) { + if (!DEM_PUSH_STR(ddata, "(")) + return (0); + paren = true; + } + + /* Push non-cv qualifiers. */ + ddata->push_qualifier = PUSH_NON_CV_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, v, NULL)) + return (0); + + if (rc) { + if (non_cv_qualifier && !DEM_PUSH_STR(ddata, " ")) + return (0); if ((class_type_size = ddata->class_type.size) == 0) return (0); class_type = @@ -1458,42 +1694,69 @@ cpp_demangle_read_function(struct cpp_demangle_data *d if (!cpp_demangle_push_str(ddata, class_type, class_type_len)) return (0); - if (!cpp_demangle_push_str(ddata, "::*", 3)) + if (!DEM_PUSH_STR(ddata, "::*")) return (0); + /* Push pointer-to-member qualifiers. */ + ddata->push_qualifier = PUSH_ALL_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, rc->data, + NULL)) + return (0); ++ddata->func_type; - } else { - if (!cpp_demangle_push_type_qualifier(ddata, v, - (const char *) NULL)) + } + + if (paren) { + if (!DEM_PUSH_STR(ddata, ")")) return (0); - vector_type_qualifier_dest(v); - if (!vector_type_qualifier_init(v)) - return (0); + paren = false; } - if (!cpp_demangle_push_str(ddata, ")(", 2)) - return (0); - + td.paren = false; + td.firstp = true; limit = 0; + ddata->is_functype = true; for (;;) { - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, &td)) return (0); if (*ddata->cur == 'E') break; if (limit++ > CPP_DEMANGLE_TRY_LIMIT) return (0); } - - if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM) == 1) { - if (!cpp_demangle_push_type_qualifier(ddata, v, - (const char *) NULL)) + ddata->is_functype = false; + if (td.paren) { + if (!DEM_PUSH_STR(ddata, ")")) return (0); - vector_type_qualifier_dest(v); - if (!vector_type_qualifier_init(v)) - return (0); + td.paren = false; } - if (!cpp_demangle_push_str(ddata, ")", 1)) + /* Push CV qualifiers. */ + ddata->push_qualifier = PUSH_CV_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, v, NULL)) return (0); + + ddata->push_qualifier = PUSH_ALL_QUALIFIER; + + /* Release type qualifier vector. */ + vector_type_qualifier_dest(v); + if (!vector_type_qualifier_init(v)) + return (0); + + /* Push ref-qualifiers. */ + if (ddata->ref_qualifier) { + switch (ddata->ref_qualifier_type) { + case TYPE_REF: + if (!DEM_PUSH_STR(ddata, " &")) + return (0); + break; + case TYPE_RREF: + if (!DEM_PUSH_STR(ddata, " &&")) + return (0); + break; + default: + return (0); + } + ddata->ref_qualifier = false; + } } ++ddata->cur; @@ -1515,7 +1778,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d /* special name */ switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { case SIMPLE_HASH('G', 'A'): - if (!cpp_demangle_push_str(ddata, "hidden alias for ", 17)) + if (!DEM_PUSH_STR(ddata, "hidden alias for ")) return (0); ddata->cur += 2; if (*ddata->cur == '\0') @@ -1523,7 +1786,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d return (cpp_demangle_read_encoding(ddata)); case SIMPLE_HASH('G', 'R'): - if (!cpp_demangle_push_str(ddata, "reference temporary #", 21)) + if (!DEM_PUSH_STR(ddata, "reference temporary #")) return (0); ddata->cur += 2; if (*ddata->cur == '\0') @@ -1533,11 +1796,11 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d rtn = 0; if (!cpp_demangle_read_number_as_string(ddata, &num_str)) goto clean1; - if (!cpp_demangle_push_str(ddata, num_str, strlen(num_str))) + if (!DEM_PUSH_STR(ddata, num_str)) goto clean2; - if (!cpp_demangle_push_str(ddata, " for ", 5)) + if (!DEM_PUSH_STR(ddata, " for ")) goto clean2; - if (!cpp_demangle_push_str(ddata, name, strlen(name))) + if (!DEM_PUSH_STR(ddata, name)) goto clean2; rtn = 1; clean2: @@ -1552,14 +1815,12 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d return (0); switch (*ddata->cur) { case 'n': - if (!cpp_demangle_push_str(ddata, - "non-transaction clone for ", 26)) + if (!DEM_PUSH_STR(ddata, "non-transaction clone for ")) return (0); break; case 't': default: - if (!cpp_demangle_push_str(ddata, - "transaction clone for ", 22)) + if (!DEM_PUSH_STR(ddata, "transaction clone for ")) return (0); break; } @@ -1568,15 +1829,15 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d case SIMPLE_HASH('G', 'V'): /* sentry object for 1 time init */ - if (!cpp_demangle_push_str(ddata, "guard variable for ", 20)) + if (!DEM_PUSH_STR(ddata, "guard variable for ")) return (0); ddata->cur += 2; break; case SIMPLE_HASH('T', 'c'): /* virtual function covariant override thunk */ - if (!cpp_demangle_push_str(ddata, - "virtual function covariant override ", 36)) + if (!DEM_PUSH_STR(ddata, + "virtual function covariant override ")) return (0); ddata->cur += 2; if (*ddata->cur == '\0') @@ -1589,8 +1850,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d case SIMPLE_HASH('T', 'C'): /* construction vtable */ - if (!cpp_demangle_push_str(ddata, "construction vtable for ", - 24)) + if (!DEM_PUSH_STR(ddata, "construction vtable for ")) return (0); ddata->cur += 2; if (*ddata->cur == '\0') @@ -1602,11 +1862,11 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d goto clean3; if (*ddata->cur++ != '_') *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Nov 8 00:30:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 802B82D6D0E; Sun, 8 Nov 2020 00:30:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTFR23Gcvz4VPY; Sun, 8 Nov 2020 00:30:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62F35173C5; Sun, 8 Nov 2020 00:30:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A80Us3k075884; Sun, 8 Nov 2020 00:30:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A80Us5w075883; Sun, 8 Nov 2020 00:30:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011080030.0A80Us5w075883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 8 Nov 2020 00:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367468 - stable/12/sys/dev/ocs_fc X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ocs_fc X-SVN-Commit-Revision: 367468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 00:30:54 -0000 Author: mav Date: Sun Nov 8 00:30:53 2020 New Revision: 367468 URL: https://svnweb.freebsd.org/changeset/base/367468 Log: MFC r367041: Fix incorrect constants of target tag action. ocs_scsi_recv_cmd() receives the flags after ocs_get_flags_fcp_cmd(), which translates them from FCP_TASK_ATTR_* to OCS_SCSI_CMD_*. As result non-SIMPLE requests turned into HEAD or ORDERED depending on direction. Modified: stable/12/sys/dev/ocs_fc/ocs_cam.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ocs_fc/ocs_cam.c ============================================================================== --- stable/12/sys/dev/ocs_fc/ocs_cam.c Sun Nov 8 00:00:49 2020 (r367467) +++ stable/12/sys/dev/ocs_fc/ocs_cam.c Sun Nov 8 00:30:53 2020 (r367468) @@ -579,9 +579,9 @@ int32_t ocs_scsi_recv_cmd(ocs_io_t *io, uint64_t lun, if (flags & OCS_SCSI_CMD_SIMPLE) atio->tag_action = MSG_SIMPLE_Q_TAG; - else if (flags & FCP_TASK_ATTR_HEAD_OF_QUEUE) + else if (flags & OCS_SCSI_CMD_HEAD_OF_QUEUE) atio->tag_action = MSG_HEAD_OF_Q_TAG; - else if (flags & FCP_TASK_ATTR_ORDERED) + else if (flags & OCS_SCSI_CMD_ORDERED) atio->tag_action = MSG_ORDERED_Q_TAG; else atio->tag_action = 0; From owner-svn-src-all@freebsd.org Sun Nov 8 00:31:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7224F2D6BEE; Sun, 8 Nov 2020 00:31:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTFS62rnhz4VKr; Sun, 8 Nov 2020 00:31:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54B5C175A4; Sun, 8 Nov 2020 00:31:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A80Voos076846; Sun, 8 Nov 2020 00:31:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A80VoCc076845; Sun, 8 Nov 2020 00:31:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011080031.0A80VoCc076845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 8 Nov 2020 00:31:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367469 - stable/11/sys/dev/ocs_fc X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ocs_fc X-SVN-Commit-Revision: 367469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 00:31:50 -0000 Author: mav Date: Sun Nov 8 00:31:49 2020 New Revision: 367469 URL: https://svnweb.freebsd.org/changeset/base/367469 Log: MFC r367041: Fix incorrect constants of target tag action. ocs_scsi_recv_cmd() receives the flags after ocs_get_flags_fcp_cmd(), which translates them from FCP_TASK_ATTR_* to OCS_SCSI_CMD_*. As result non-SIMPLE requests turned into HEAD or ORDERED depending on direction. Modified: stable/11/sys/dev/ocs_fc/ocs_cam.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ocs_fc/ocs_cam.c ============================================================================== --- stable/11/sys/dev/ocs_fc/ocs_cam.c Sun Nov 8 00:30:53 2020 (r367468) +++ stable/11/sys/dev/ocs_fc/ocs_cam.c Sun Nov 8 00:31:49 2020 (r367469) @@ -579,9 +579,9 @@ int32_t ocs_scsi_recv_cmd(ocs_io_t *io, uint64_t lun, if (flags & OCS_SCSI_CMD_SIMPLE) atio->tag_action = MSG_SIMPLE_Q_TAG; - else if (flags & FCP_TASK_ATTR_HEAD_OF_QUEUE) + else if (flags & OCS_SCSI_CMD_HEAD_OF_QUEUE) atio->tag_action = MSG_HEAD_OF_Q_TAG; - else if (flags & FCP_TASK_ATTR_ORDERED) + else if (flags & OCS_SCSI_CMD_ORDERED) atio->tag_action = MSG_ORDERED_Q_TAG; else atio->tag_action = 0; From owner-svn-src-all@freebsd.org Sun Nov 8 00:59:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A888C2E0000; Sun, 8 Nov 2020 00:59:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTG3d47sPz4Wny; Sun, 8 Nov 2020 00:59:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CEC2175DB; Sun, 8 Nov 2020 00:59:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A80x92v091069; Sun, 8 Nov 2020 00:59:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A80x9vN091068; Sun, 8 Nov 2020 00:59:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011080059.0A80x9vN091068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 8 Nov 2020 00:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367470 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 367470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 00:59:09 -0000 Author: kib Date: Sun Nov 8 00:59:09 2020 New Revision: 367470 URL: https://svnweb.freebsd.org/changeset/base/367470 Log: MFC r367249: Cleanup of net/if_media.c: switch to ANSI C function definitions. Modified: stable/12/sys/net/if_media.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if_media.c ============================================================================== --- stable/12/sys/net/if_media.c Sun Nov 8 00:31:49 2020 (r367469) +++ stable/12/sys/net/if_media.c Sun Nov 8 00:59:09 2020 (r367470) @@ -85,11 +85,8 @@ static void ifmedia_printword(int); * Initialize if_media struct for a specific interface instance. */ void -ifmedia_init(ifm, dontcare_mask, change_callback, status_callback) - struct ifmedia *ifm; - int dontcare_mask; - ifm_change_cb_t change_callback; - ifm_stat_cb_t status_callback; +ifmedia_init(struct ifmedia *ifm, int dontcare_mask, + ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback) { LIST_INIT(&ifm->ifm_list); @@ -101,8 +98,7 @@ ifmedia_init(ifm, dontcare_mask, change_callback, stat } void -ifmedia_removeall(ifm) - struct ifmedia *ifm; +ifmedia_removeall(struct ifmedia *ifm) { struct ifmedia_entry *entry; @@ -119,11 +115,7 @@ ifmedia_removeall(ifm) * for a specific interface instance. */ void -ifmedia_add(ifm, mword, data, aux) - struct ifmedia *ifm; - int mword; - int data; - void *aux; +ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux) { struct ifmedia_entry *entry; @@ -154,10 +146,7 @@ ifmedia_add(ifm, mword, data, aux) * supported media for a specific interface instance. */ void -ifmedia_list_add(ifm, lp, count) - struct ifmedia *ifm; - struct ifmedia_entry *lp; - int count; +ifmedia_list_add(struct ifmedia *ifm, struct ifmedia_entry *lp, int count) { int i; @@ -174,10 +163,7 @@ ifmedia_list_add(ifm, lp, count) * media-change callback. */ void -ifmedia_set(ifm, target) - struct ifmedia *ifm; - int target; - +ifmedia_set(struct ifmedia *ifm, int target) { struct ifmedia_entry *match; @@ -219,11 +205,8 @@ compat_media(int media) * Device-independent media ioctl support function. */ int -ifmedia_ioctl(ifp, ifr, ifm, cmd) - struct ifnet *ifp; - struct ifreq *ifr; - struct ifmedia *ifm; - u_long cmd; +ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, + u_long cmd) { struct ifmedia_entry *match; struct ifmediareq *ifmr = (struct ifmediareq *) ifr; @@ -345,10 +328,7 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd) * */ static struct ifmedia_entry * -ifmedia_match(ifm, target, mask) - struct ifmedia *ifm; - int target; - int mask; +ifmedia_match(struct ifmedia *ifm, int target, int mask) { struct ifmedia_entry *match, *next; @@ -454,8 +434,7 @@ static const struct ifmedia_type_to_subtype ifmedia_ty * print a media word. */ static void -ifmedia_printword(ifmw) - int ifmw; +ifmedia_printword(int ifmw) { const struct ifmedia_description *desc; const struct ifmedia_type_to_subtype *ttos; From owner-svn-src-all@freebsd.org Sun Nov 8 01:00:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 385782D7FA6; Sun, 8 Nov 2020 01:00:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTG4q1B5Nz4XJt; Sun, 8 Nov 2020 01:00:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BF6317AD5; Sun, 8 Nov 2020 01:00:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A810AjG091237; Sun, 8 Nov 2020 01:00:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A810Aep091236; Sun, 8 Nov 2020 01:00:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011080100.0A810Aep091236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 8 Nov 2020 01:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367471 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 367471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 01:00:11 -0000 Author: kib Date: Sun Nov 8 01:00:10 2020 New Revision: 367471 URL: https://svnweb.freebsd.org/changeset/base/367471 Log: MFC r367250: Cleanup of net/if_media.c: some style. Modified: stable/12/sys/net/if_media.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if_media.c ============================================================================== --- stable/12/sys/net/if_media.c Sun Nov 8 00:59:09 2020 (r367470) +++ stable/12/sys/net/if_media.c Sun Nov 8 01:00:10 2020 (r367471) @@ -213,7 +213,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, st int error = 0; if (ifp == NULL || ifr == NULL || ifm == NULL) - return(EINVAL); + return (EINVAL); switch (cmd) { @@ -244,10 +244,9 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, st * Keep going in case the connected media changed. * Similarly, if best match changed (kernel debugger?). */ - if ((IFM_SUBTYPE(newmedia) != IFM_AUTO) && - (newmedia == ifm->ifm_media) && - (match == ifm->ifm_cur)) - return 0; + if (IFM_SUBTYPE(newmedia) != IFM_AUTO && + newmedia == ifm->ifm_media && match == ifm->ifm_cur) + return (0); /* * We found a match, now make the driver switch to it. @@ -347,7 +346,7 @@ ifmedia_match(struct ifmedia *ifm, int target, int mas } } - return match; + return (match); } /* @@ -363,7 +362,8 @@ ifmedia_baudrate(int mword) int i; for (i = 0; ifmedia_baudrate_descriptions[i].ifmb_word != 0; i++) { - if (IFM_TYPE_MATCH(mword, ifmedia_baudrate_descriptions[i].ifmb_word)) + if (IFM_TYPE_MATCH(mword, ifmedia_baudrate_descriptions[i]. + ifmb_word)) return (ifmedia_baudrate_descriptions[i].ifmb_baudrate); } From owner-svn-src-all@freebsd.org Sun Nov 8 01:01:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B81F2E03B3; Sun, 8 Nov 2020 01:01:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTG6J38dWz4X6b; Sun, 8 Nov 2020 01:01:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F2C61793E; Sun, 8 Nov 2020 01:01:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A811Sjn094465; Sun, 8 Nov 2020 01:01:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A811SSD094464; Sun, 8 Nov 2020 01:01:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011080101.0A811SSD094464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 8 Nov 2020 01:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367472 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 367472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 01:01:28 -0000 Author: kib Date: Sun Nov 8 01:01:27 2020 New Revision: 367472 URL: https://svnweb.freebsd.org/changeset/base/367472 Log: MFC r367251: Cleanup of net/if_media.c: simplify cleanup loop in ifmedia_removeall(). Modified: stable/12/sys/net/if_media.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if_media.c ============================================================================== --- stable/12/sys/net/if_media.c Sun Nov 8 01:00:10 2020 (r367471) +++ stable/12/sys/net/if_media.c Sun Nov 8 01:01:27 2020 (r367472) @@ -102,8 +102,7 @@ ifmedia_removeall(struct ifmedia *ifm) { struct ifmedia_entry *entry; - for (entry = LIST_FIRST(&ifm->ifm_list); entry; - entry = LIST_FIRST(&ifm->ifm_list)) { + while ((entry = LIST_FIRST(&ifm->ifm_list)) != NULL) { LIST_REMOVE(entry, ifm_list); free(entry, M_IFADDR); } From owner-svn-src-all@freebsd.org Sun Nov 8 01:02:41 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E4462E032D; Sun, 8 Nov 2020 01:02:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTG7j2D7Pz4Xlv; Sun, 8 Nov 2020 01:02:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EE82177CE; Sun, 8 Nov 2020 01:02:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A812fAn097091; Sun, 8 Nov 2020 01:02:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A812fMD097090; Sun, 8 Nov 2020 01:02:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011080102.0A812fMD097090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 8 Nov 2020 01:02:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367473 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 367473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 01:02:41 -0000 Author: kib Date: Sun Nov 8 01:02:40 2020 New Revision: 367473 URL: https://svnweb.freebsd.org/changeset/base/367473 Log: MFC r367252: net/if_media.c: improve IFMEDIA_DEBUG output. Modified: stable/12/sys/net/if_media.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if_media.c ============================================================================== --- stable/12/sys/net/if_media.c Sun Nov 8 01:01:27 2020 (r367472) +++ stable/12/sys/net/if_media.c Sun Nov 8 01:02:40 2020 (r367473) @@ -124,7 +124,7 @@ ifmedia_add(struct ifmedia *ifm, int mword, int data, printf("ifmedia_add: null ifm\n"); return; } - printf("Adding entry for "); + printf("Adding entry for (%#010x) ", mword); ifmedia_printword(mword); } #endif @@ -230,8 +230,8 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, st #ifdef IFMEDIA_DEBUG if (ifmedia_debug) { printf( - "ifmedia_ioctl: no media found for 0x%x\n", - newmedia); + "ifmedia_ioctl: no media found for %#010x mask %#010x\n", + newmedia, ifm->ifm_mask); } #endif return (ENXIO); @@ -338,7 +338,7 @@ ifmedia_match(struct ifmedia *ifm, int target, int mas #if defined(IFMEDIA_DEBUG) || defined(DIAGNOSTIC) if (match) { printf("ifmedia_match: multiple match for " - "0x%x/0x%x\n", target, mask); + "%#010x/%#010x\n", target, mask); } #endif match = next; From owner-svn-src-all@freebsd.org Sun Nov 8 02:20:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D762B2E2DAD; Sun, 8 Nov 2020 02:20:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTHsK5s2Tz4cLG; Sun, 8 Nov 2020 02:20:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7F7818988; Sun, 8 Nov 2020 02:20:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A82KLjj040308; Sun, 8 Nov 2020 02:20:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A82KL9D040307; Sun, 8 Nov 2020 02:20:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202011080220.0A82KL9D040307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Nov 2020 02:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367474 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 02:20:21 -0000 Author: imp Date: Sun Nov 8 02:20:21 2020 New Revision: 367474 URL: https://svnweb.freebsd.org/changeset/base/367474 Log: Be explicit about recompiling all the modules... Add a note about always recompiling all modules on every new kernel change / update. In addition, suggest using /usr/local/sys/modules so this happens automatically. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Nov 8 01:02:40 2020 (r367473) +++ head/UPDATING Sun Nov 8 02:20:21 2020 (r367474) @@ -2305,7 +2305,12 @@ COMMON ITEMS: [1] If you have third party modules, such as vmware, you should disable them at this point so they don't crash your - system on reboot. + system on reboot. Alternatively, you should rebuild all the + modules you have in your system and install them as well. If + you are running -current, you should seriously consider + placing all sources to all the modules for your system (or + symlinks to them) in /usr/local/sys/modules so this happens + automatically... [3] From the bootblocks, boot -s, and then do fsck -p From owner-svn-src-all@freebsd.org Sun Nov 8 02:46:04 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 902432E36A2; Sun, 8 Nov 2020 02:46:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTJR03cwGz4dgv; Sun, 8 Nov 2020 02:46:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F1CD18C74; Sun, 8 Nov 2020 02:46:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A82k4IW058427; Sun, 8 Nov 2020 02:46:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A82k4Fl058426; Sun, 8 Nov 2020 02:46:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202011080246.0A82k4Fl058426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Nov 2020 02:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367475 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 02:46:04 -0000 Author: imp Date: Sun Nov 8 02:46:04 2020 New Revision: 367475 URL: https://svnweb.freebsd.org/changeset/base/367475 Log: Also mention PORTS_MODULES PORTS_MODULES is also an effective way to update the tree. Also a minor rejustify on this an an adjacent paragraph. Suggested by: David Wolfskill Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Nov 8 02:20:21 2020 (r367474) +++ head/UPDATING Sun Nov 8 02:46:04 2020 (r367475) @@ -2303,14 +2303,16 @@ COMMON ITEMS: messages there. If in doubt, please track -stable which has much fewer pitfalls. - [1] If you have third party modules, such as vmware, you - should disable them at this point so they don't crash your - system on reboot. Alternatively, you should rebuild all the - modules you have in your system and install them as well. If - you are running -current, you should seriously consider - placing all sources to all the modules for your system (or - symlinks to them) in /usr/local/sys/modules so this happens - automatically... + [1] If you have third party modules, such as vmware, you should disable + them at this point so they don't crash your system on + reboot. Alternatively, you should rebuild all the modules you have in + your system and install them as well. If you are running -current, you + should seriously consider placing all sources to all the modules for + your system (or symlinks to them) in /usr/local/sys/modules so this + happens automatically. If all your modules come from ports, then adding + the port origin directories to PORTS_MODULES instead is also automatic + and effective, eg: + PORTS_MODULES+=x11/nvidia-driver [3] From the bootblocks, boot -s, and then do fsck -p @@ -2319,8 +2321,8 @@ COMMON ITEMS: sh /etc/rc.d/zfs start # mount zfs filesystem, if needed cd src # full path to source adjkerntz -i # if CMOS is wall time - Also, when doing a major release upgrade, it is required that - you boot into single user mode to do the installworld. + Also, when doing a major release upgrade, it is required that you boot + into single user mode to do the installworld. [4] Note: This step is non-optional. Failure to do this step can result in a significant reduction in the functionality of the From owner-svn-src-all@freebsd.org Sun Nov 8 02:50:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8BE62E34C7; Sun, 8 Nov 2020 02:50:37 +0000 (UTC) (envelope-from tmunro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTJXF5nl3z4f4l; Sun, 8 Nov 2020 02:50:37 +0000 (UTC) (envelope-from tmunro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFA9F18E74; Sun, 8 Nov 2020 02:50:37 +0000 (UTC) (envelope-from tmunro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A82obSJ058714; Sun, 8 Nov 2020 02:50:37 GMT (envelope-from tmunro@FreeBSD.org) Received: (from tmunro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A82oYE4058700; Sun, 8 Nov 2020 02:50:34 GMT (envelope-from tmunro@FreeBSD.org) Message-Id: <202011080250.0A82oYE4058700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tmunro set sender to tmunro@FreeBSD.org using -f From: Thomas Munro Date: Sun, 8 Nov 2020 02:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367476 - in head: include/xlocale lib/libc/locale share/colldef tools/tools/locale tools/tools/locale/tools usr.bin/localedef usr.bin/localedef/bootstrap X-SVN-Group: head X-SVN-Commit-Author: tmunro X-SVN-Commit-Paths: in head: include/xlocale lib/libc/locale share/colldef tools/tools/locale tools/tools/locale/tools usr.bin/localedef usr.bin/localedef/bootstrap X-SVN-Commit-Revision: 367476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 02:50:37 -0000 Author: tmunro Date: Sun Nov 8 02:50:34 2020 New Revision: 367476 URL: https://svnweb.freebsd.org/changeset/base/367476 Log: Add collation version support to querylocale(3). Provide a way to ask for an opaque version string for a locale_t, so that potential changes in sort order can be detected. Similar to ICU's ucol_getVersion() and Windows' GetNLSVersionEx(), this API is intended to allow databases to detect when text order-based indexes might need to be rebuilt. The CLDR version is extracted from CLDR source data by the Makefile under tools/tools/locale, written into the machine-generated Makefile under shared/colldef, passed to localedef -V, and then written into LC_COLLATE file headers. The initial version is 34.0. tools/tools/locale was recently updated to pull down 35.0, but the output hasn't been committed under share/colldef yet, so that will provide the first observable change when it happens. Other versioning schemes are possible in future, because the format is unspecified. Reviewed by: bapt, 0mp, kib, yuripv (albeit a long time ago) Differential Revision: https://reviews.freebsd.org/D17166 Modified: head/include/xlocale/_locale.h head/lib/libc/locale/collate.c head/lib/libc/locale/collate.h head/lib/libc/locale/querylocale.3 head/lib/libc/locale/xlocale.c head/lib/libc/locale/xlocale_private.h head/share/colldef/Makefile head/tools/tools/locale/Makefile head/tools/tools/locale/tools/cldr2def.pl head/usr.bin/localedef/bootstrap/bootstrap_xlocale_private.h head/usr.bin/localedef/collate.c head/usr.bin/localedef/localedef.1 head/usr.bin/localedef/localedef.c head/usr.bin/localedef/localedef.h Modified: head/include/xlocale/_locale.h ============================================================================== --- head/include/xlocale/_locale.h Sun Nov 8 02:46:04 2020 (r367475) +++ head/include/xlocale/_locale.h Sun Nov 8 02:50:34 2020 (r367476) @@ -43,6 +43,7 @@ #define LC_MESSAGES_MASK (1<<5) #define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \ LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) +#define LC_VERSION_MASK (1<<6) #define LC_GLOBAL_LOCALE ((locale_t)-1) #ifndef _LOCALE_T_DEFINED Modified: head/lib/libc/locale/collate.c ============================================================================== --- head/lib/libc/locale/collate.c Sun Nov 8 02:46:04 2020 (r367475) +++ head/lib/libc/locale/collate.c Sun Nov 8 02:50:34 2020 (r367476) @@ -140,7 +140,9 @@ __collate_load_tables_l(const char *encoding, struct x (void) _close(fd); return (_LDP_ERROR); } - if (sbuf.st_size < (COLLATE_STR_LEN + sizeof (info))) { + if (sbuf.st_size < (COLLATE_FMT_VERSION_LEN + + XLOCALE_DEF_VERSION_LEN + + sizeof (info))) { (void) _close(fd); errno = EINVAL; return (_LDP_ERROR); @@ -151,12 +153,14 @@ __collate_load_tables_l(const char *encoding, struct x return (_LDP_ERROR); } - if (strncmp(TMP, COLLATE_VERSION, COLLATE_STR_LEN) != 0) { + if (strncmp(TMP, COLLATE_FMT_VERSION, COLLATE_FMT_VERSION_LEN) != 0) { (void) munmap(map, sbuf.st_size); errno = EINVAL; return (_LDP_ERROR); } - TMP += COLLATE_STR_LEN; + TMP += COLLATE_FMT_VERSION_LEN; + strlcat(table->header.version, TMP, sizeof (table->header.version)); + TMP += XLOCALE_DEF_VERSION_LEN; info = (void *)TMP; TMP += sizeof (*info); Modified: head/lib/libc/locale/collate.h ============================================================================== --- head/lib/libc/locale/collate.h Sun Nov 8 02:46:04 2020 (r367475) +++ head/lib/libc/locale/collate.h Sun Nov 8 02:50:34 2020 (r367476) @@ -53,8 +53,10 @@ #endif #define COLLATE_STR_LEN 24 /* should be 64-bit multiple */ -#define COLLATE_VERSION "BSD 1.0\n" +#define COLLATE_FMT_VERSION_LEN 12 +#define COLLATE_FMT_VERSION "BSD 1.0\n" + #define COLLATE_MAX_PRIORITY (0x7fffffff) /* max signed value */ #define COLLATE_SUBST_PRIORITY (0x40000000) /* bit indicates subst table */ @@ -69,7 +71,8 @@ /* * The collate file format is as follows: * - * char version[COLLATE_STR_LEN]; // must be COLLATE_VERSION + * char fmt_version[COLLATE_FMT_VERSION_LEN]; // must be COLLATE_FMT_VERSION + * char def_version[XLOCALE_DEF_VERSION_LEN]; // NUL-terminated, may be empty * collate_info_t info; // see below, includes padding * collate_char_pri_t char_data[256]; // 8 bit char values * collate_subst_t subst[*]; // 0 or more substitutions Modified: head/lib/libc/locale/querylocale.3 ============================================================================== --- head/lib/libc/locale/querylocale.3 Sun Nov 8 02:46:04 2020 (r367475) +++ head/lib/libc/locale/querylocale.3 Sun Nov 8 02:50:34 2020 (r367476) @@ -27,12 +27,12 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2013 +.Dd November 8, 2020 .Dt QUERYLOCALE 3 .Os .Sh NAME .Nm querylocale -.Nd Look up the locale name for a specified category +.Nd Look up the locale name or version for a specified category .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -40,11 +40,22 @@ .Ft const char * .Fn querylocale "int mask" "locale_t locale" .Sh DESCRIPTION -Returns the name of the locale for the category specified by +Returns the name or version of the locale for the category specified by .Fa mask . -This possible values for the mask are the same as those in -.Xr newlocale 3 . -If more than one bit in the mask is set, the returned value is undefined. +The possible values for the mask are the same as those in +.Xr newlocale 3 , +when requesting the locale name. +Specify the bitwise OR of +.Fa LC_VERSION_MASK +and another mask value to request a version string. +Version strings can be compared to detect changes to the locale's definition. +The structure of the version string is unspecified. +Currently, version information is only available for +.Fa LC_COLLATE_MASK , +and an empty string is returned for other categories. +If more than one bit in the mask is set, not counting +.Fa LC_VERSION_MASK , +the returned value is undefined. .Sh SEE ALSO .Xr duplocale 3 , .Xr freelocale 3 , @@ -52,3 +63,12 @@ If more than one bit in the mask is set, the returned .Xr newlocale 3 , .Xr uselocale 3 , .Xr xlocale 3 +.Sh HISTORY +The +.Fn querylocale +function first appeared in +.Fx 9.1 , +and is based on the function of the same name in Darwin. +.Fa LC_VERSION_MASK +first appeared in +.Fx 13.0 . Modified: head/lib/libc/locale/xlocale.c ============================================================================== --- head/lib/libc/locale/xlocale.c Sun Nov 8 02:46:04 2020 (r367475) +++ head/lib/libc/locale/xlocale.c Sun Nov 8 02:50:34 2020 (r367476) @@ -231,6 +231,8 @@ static int dupcomponent(int type, locale_t base, local if (new->components[type]) { strncpy(new->components[type]->locale, src->locale, ENCODING_LEN); + strncpy(new->components[type]->version, src->version, + XLOCALE_DEF_VERSION_LEN); } } else if (base->components[type]) { new->components[type] = xlocale_retain(base->components[type]); @@ -346,17 +348,24 @@ freelocale(locale_t loc) } /* - * Returns the name of the locale for a particular component of a locale_t. + * Returns the name or version of the locale for a particular component of a + * locale_t. */ const char *querylocale(int mask, locale_t loc) { - int type = ffs(mask) - 1; + int type = ffs(mask & ~LC_VERSION_MASK) - 1; FIX_LOCALE(loc); if (type >= XLC_LAST) return (NULL); - if (loc->components[type]) - return (loc->components[type]->locale); - return ("C"); + if (mask & LC_VERSION_MASK) { + if (loc->components[type]) + return (loc->components[type]->version); + return (""); + } else { + if (loc->components[type]) + return (loc->components[type]->locale); + return ("C"); + } } /* Modified: head/lib/libc/locale/xlocale_private.h ============================================================================== --- head/lib/libc/locale/xlocale_private.h Sun Nov 8 02:46:04 2020 (r367475) +++ head/lib/libc/locale/xlocale_private.h Sun Nov 8 02:50:34 2020 (r367476) @@ -91,6 +91,9 @@ struct xlocale_refcounted { /** Function used to destroy this component, if one is required*/ void(*destructor)(void*); }; + +#define XLOCALE_DEF_VERSION_LEN 12 + /** * Header for a locale component. All locale components must begin with this * header. @@ -99,6 +102,8 @@ struct xlocale_component { struct xlocale_refcounted header; /** Name of the locale used for this component. */ char locale[ENCODING_LEN+1]; + /** Version of the definition for this component. */ + char version[XLOCALE_DEF_VERSION_LEN]; }; /** Modified: head/share/colldef/Makefile ============================================================================== --- head/share/colldef/Makefile Sun Nov 8 02:46:04 2020 (r367475) +++ head/share/colldef/Makefile Sun Nov 8 02:50:34 2020 (r367476) @@ -7,10 +7,13 @@ FILESNAME= LC_COLLATE .SUFFIXES: .src .LC_COLLATE MAPLOC= ${.CURDIR}/../../tools/tools/locale/etc/final-maps +CLDR_VERSION= "34.0" + .include .src.LC_COLLATE: localedef ${LOCALEDEF_ENDIAN} -D -U -i ${.IMPSRC} \ + -V ${CLDR_VERSION} \ -f ${MAPLOC}/map.${.TARGET:T:R:E:C/@.*//} ${.OBJDIR}/${.IMPSRC:T:R} LOCALES+= af_ZA.UTF-8 @@ -227,6 +230,7 @@ FILES+= $t.LC_COLLATE FILESDIR_$t.LC_COLLATE= ${LOCALEDIR}/$t $t.LC_COLLATE: ${.CURDIR}/$f.src localedef ${LOCALEDEF_ENDIAN} -D -U -i ${.ALLSRC} \ + -V ${CLDR_VERSION} \ -f ${MAPLOC}/map.${.TARGET:T:R:E:C/@.*//} \ ${.OBJDIR}/${.TARGET:T:R} .endfor Modified: head/tools/tools/locale/Makefile ============================================================================== --- head/tools/tools/locale/Makefile Sun Nov 8 02:46:04 2020 (r367475) +++ head/tools/tools/locale/Makefile Sun Nov 8 02:50:34 2020 (r367476) @@ -187,6 +187,8 @@ extract-${CLDRFILES_${N}:T}:: ${CLDRFILES_${N}:T} ${UN cd ${UNIDIR} && unzip -o ../${CLDRFILES_${N}:T} extract: extract-${CLDRFILES_${N}:T} .endfor + grep 'name="version"' ${UNIDIR}/tools/build.xml | \ + sed 's/.* value="//;s/".*//' > ${UNIDIR}/cldr-version patch:: .if exists(${PATCHDIR}) cd ${UNIDIR} && cat ${PATCHDIR}/patch-* | patch Modified: head/tools/tools/locale/tools/cldr2def.pl ============================================================================== --- head/tools/tools/locale/tools/cldr2def.pl Sun Nov 8 02:46:04 2020 (r367475) +++ head/tools/tools/locale/tools/cldr2def.pl Sun Nov 8 02:50:34 2020 (r367476) @@ -50,6 +50,8 @@ my $UNIDIR = undef; my $ETCDIR = undef; my $TYPE = undef; +my $CLDR_VERSION = undef; + my $result = GetOptions ( "unidir=s" => \$UNIDIR, "etc=s" => \$ETCDIR, @@ -500,6 +502,12 @@ EOF sub transform_collation { + # Read the CLDR version + open(FIN, "$UNIDIR/cldr-version") or die "Cannot open cldr-version"; + read FIN, $CLDR_VERSION, -s FIN; + close(FIN); + $CLDR_VERSION =~ s/\s*$//; + foreach my $l (sort keys(%languages)) { foreach my $f (sort keys(%{$languages{$l}})) { foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { @@ -861,8 +869,11 @@ sub make_makefile { my $SRCOUT4 = ""; my $MAPLOC; if ($TYPE eq "colldef") { + # In future, we might want to try to put the CLDR version into + # the .src files with some new syntax, instead of the makefile. $SRCOUT = "localedef \${LOCALEDEF_ENDIAN} -D -U " . "-i \${.IMPSRC} \\\n" . + "\t-V \${CLDR_VERSION} \\\n" . "\t-f \${MAPLOC}/map.\${.TARGET:T:R:E:C/@.*//} " . "\${.OBJDIR}/\${.IMPSRC:T:R}"; $MAPLOC = "MAPLOC=\t\t\${.CURDIR}/../../tools/tools/" . @@ -875,6 +886,7 @@ sub make_makefile { "\$t.LC_COLLATE: \${.CURDIR}/\$f.src\n" . "\tlocaledef \${LOCALEDEF_ENDIAN} -D -U " . "-i \${.ALLSRC} \\\n" . + "\t-V \${CLDR_VERSION} \\\n" . "\t\t-f \${MAPLOC}/map.\${.TARGET:T:R:E:C/@.*//} \\\n" . "\t\t\${.OBJDIR}/\${.TARGET:T:R}\n" . ".endfor\n\n"; @@ -916,6 +928,13 @@ FILESNAME= $FILESNAMES{$TYPE} .SUFFIXES: .src .${SRCOUT2} ${MAPLOC} EOF + + if ($TYPE eq "colldef") { + print FOUT < #include #include +#include "collate.h" #include "localedef.h" #include "parser.h" @@ -62,6 +63,7 @@ int undefok = 0; int warnok = 0; static char *locname = NULL; static char locpath[PATH_MAX]; +char *version = NULL; const char * category_name(void) @@ -253,6 +255,7 @@ usage(void) (void) fprintf(stderr, " -u encoding : assume encoding\n"); (void) fprintf(stderr, " -w widths : use screen widths file\n"); (void) fprintf(stderr, " -i locsrc : source file for locale\n"); + (void) fprintf(stderr, " -V version : version string for locale\n"); exit(4); } @@ -279,7 +282,7 @@ main(int argc, char **argv) (void) setlocale(LC_ALL, ""); - while ((c = getopt(argc, argv, "blw:i:cf:u:vUD")) != -1) { + while ((c = getopt(argc, argv, "blw:i:cf:u:vUDV:")) != -1) { switch (c) { case 'D': bsd = 1; @@ -314,6 +317,9 @@ main(int argc, char **argv) case '?': usage(); break; + case 'V': + version = optarg; + break; } } @@ -323,6 +329,11 @@ main(int argc, char **argv) locname = argv[argc - 1]; if (verbose) { (void) printf("Processing locale %s.\n", locname); + } + + if (version && strlen(version) >= XLOCALE_DEF_VERSION_LEN) { + (void) fprintf(stderr, "Version string too long.\n"); + exit(1); } if (cfname) { Modified: head/usr.bin/localedef/localedef.h ============================================================================== --- head/usr.bin/localedef/localedef.h Sun Nov 8 02:46:04 2020 (r367475) +++ head/usr.bin/localedef/localedef.h Sun Nov 8 02:50:34 2020 (r367476) @@ -55,6 +55,8 @@ extern int undefok; /* mostly ignore undefined symbols extern int warnok; extern int warnings; +extern char *version; + int yylex(void); void yyerror(const char *); _Noreturn void errf(const char *, ...) __printflike(1, 2); From owner-svn-src-all@freebsd.org Sun Nov 8 04:24:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B51BF2E53D2; Sun, 8 Nov 2020 04:24:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTLcZ4cvVz4kCh; Sun, 8 Nov 2020 04:24:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86F011A28E; Sun, 8 Nov 2020 04:24:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A84OU98021097; Sun, 8 Nov 2020 04:24:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A84OUVm021095; Sun, 8 Nov 2020 04:24:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011080424.0A84OUVm021095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 8 Nov 2020 04:24:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367477 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 04:24:30 -0000 Author: kevans Date: Sun Nov 8 04:24:29 2020 New Revision: 367477 URL: https://svnweb.freebsd.org/changeset/base/367477 Log: imgact_binmisc: limit the extent of match on incoming entries imgact_binmisc matches magic/mask from imgp->image_header, which is only a single page in size mapped from the first page of an image. One can specify an interpreter that matches on, e.g., --offset 4096 --size 256 to read up to 256 bytes past the mapped first page. The limitation is that we cannot specify a magic string that exceeds a single page, and we can't allow offset + size to exceed a single page either. A static assert has been added in case someone finds it useful to try and expand the size, but it does seem a little unlikely. While this looks kind of exploitable at a sideways squinty-glance, there are a couple of mitigating factors: 1.) imgact_binmisc is not enabled by default, 2.) entries may only be added by the superuser, 3.) trying to exploit this information to read what's mapped past the end would be worse than a root canal or some other relatably painful experience, and 4.) there's no way one could pull this off without it being completely obvious. The first page is mapped out of an sf_buf, the implementation of which (or lack thereof) depends on your platform. MFC after: 1 week Modified: head/sys/kern/imgact_binmisc.c head/sys/sys/imgact_binmisc.h Modified: head/sys/kern/imgact_binmisc.c ============================================================================== --- head/sys/kern/imgact_binmisc.c Sun Nov 8 02:50:34 2020 (r367476) +++ head/sys/kern/imgact_binmisc.c Sun Nov 8 04:24:29 2020 (r367477) @@ -236,6 +236,8 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) if (xbe->xbe_msize > IBE_MAGIC_MAX) return (EINVAL); + if (xbe->xbe_moffset + xbe->xbe_msize > IBE_MATCH_MAX) + return (EINVAL); for(cnt = 0, p = xbe->xbe_name; *p != 0; cnt++, p++) if (cnt >= IBE_NAME_MAX || !isascii((int)*p)) Modified: head/sys/sys/imgact_binmisc.h ============================================================================== --- head/sys/sys/imgact_binmisc.h Sun Nov 8 02:50:34 2020 (r367476) +++ head/sys/sys/imgact_binmisc.h Sun Nov 8 04:24:29 2020 (r367477) @@ -47,6 +47,11 @@ #define IBE_INTERP_LEN_MAX (MAXPATHLEN + IBE_ARG_LEN_MAX) #define IBE_MAX_ENTRIES 64 /* Max number of interpreter entries. */ +/* We only map the first page for identification purposes. */ +#define IBE_MATCH_MAX PAGE_SIZE +_Static_assert(IBE_MAGIC_MAX <= IBE_MATCH_MAX, + "Cannot identify binaries past the first page."); + /* * Imgact bin misc interpreter entry flags. */ From owner-svn-src-all@freebsd.org Sun Nov 8 07:49:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 441892E92BF; Sun, 8 Nov 2020 07:49:40 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTR9J1SlSz4sB6; Sun, 8 Nov 2020 07:49:40 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 254731C886; Sun, 8 Nov 2020 07:49:40 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A87nebF044149; Sun, 8 Nov 2020 07:49:40 GMT (envelope-from olivier@FreeBSD.org) Received: (from olivier@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A87ne9N044148; Sun, 8 Nov 2020 07:49:40 GMT (envelope-from olivier@FreeBSD.org) Message-Id: <202011080749.0A87ne9N044148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: olivier set sender to olivier@FreeBSD.org using -f From: Olivier Cochard Date: Sun, 8 Nov 2020 07:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367478 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: olivier X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 367478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 07:49:40 -0000 Author: olivier (ports committer) Date: Sun Nov 8 07:49:39 2020 New Revision: 367478 URL: https://svnweb.freebsd.org/changeset/base/367478 Log: Return the same value for smbios.chassis.maker as smbios.system.maker (and prevents returning a space character). Reviewed by: grehan Approved by: grehan Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27123 Modified: head/usr.sbin/bhyve/smbiostbl.c Modified: head/usr.sbin/bhyve/smbiostbl.c ============================================================================== --- head/usr.sbin/bhyve/smbiostbl.c Sun Nov 8 04:24:29 2020 (r367477) +++ head/usr.sbin/bhyve/smbiostbl.c Sun Nov 8 07:49:39 2020 (r367478) @@ -374,7 +374,7 @@ struct smbios_table_type3 smbios_type3_template = { }; const char *smbios_type3_strings[] = { - " ", /* manufacturer string */ + "FreeBSD", /* manufacturer string */ "1.0", /* version string */ "None", /* serial number string */ "None", /* asset tag string */ From owner-svn-src-all@freebsd.org Sun Nov 8 09:35:42 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AAA42EB575; Sun, 8 Nov 2020 09:35:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTTWf2ZWnz3DMd; Sun, 8 Nov 2020 09:35:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 407DA1DC34; Sun, 8 Nov 2020 09:35:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A89ZgD6011231; Sun, 8 Nov 2020 09:35:42 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A89Zgjv011230; Sun, 8 Nov 2020 09:35:42 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202011080935.0A89Zgjv011230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 8 Nov 2020 09:35:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367479 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 367479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 09:35:42 -0000 Author: tsoome Date: Sun Nov 8 09:35:41 2020 New Revision: 367479 URL: https://svnweb.freebsd.org/changeset/base/367479 Log: loader: cstyle cleanup of bootstrap.h No functional changes intended. Modified: head/stand/common/bootstrap.h Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Sun Nov 8 07:49:39 2020 (r367478) +++ head/stand/common/bootstrap.h Sun Nov 8 09:35:41 2020 (r367479) @@ -40,11 +40,11 @@ typedef int (bootblk_cmd_t)(int argc, char *argv[]); #define COMMAND_ERRBUFSZ (256) extern const char *command_errmsg; extern char command_errbuf[COMMAND_ERRBUFSZ]; -#define CMD_OK 0 -#define CMD_WARN 1 -#define CMD_ERROR 2 -#define CMD_CRIT 3 -#define CMD_FATAL 4 +#define CMD_OK 0 +#define CMD_WARN 1 +#define CMD_ERROR 2 +#define CMD_CRIT 3 +#define CMD_FATAL 4 /* interp.c */ void interact(void); @@ -52,9 +52,9 @@ void interp_emit_prompt(void); int interp_builtin_cmd(int argc, char *argv[]); /* Called by interp.c for interp_*.c embedded interpreters */ -int interp_include(const char *filename); /* Execute commands from filename */ -void interp_init(void); /* Initialize interpreater */ -int interp_run(const char *line); /* Run a single command */ +int interp_include(const char *); /* Execute commands from filename */ +void interp_init(void); /* Initialize interpreater */ +int interp_run(const char *); /* Run a single command */ /* interp_backslash.c */ char *backslash(const char *str); @@ -87,64 +87,70 @@ int bcache_strategy(void *devdata, int rw, daddr_t blk */ struct bcache_devdata { - int (*dv_strategy)(void *devdata, int rw, daddr_t blk, - size_t size, char *buf, size_t *rsize); - void *dv_devdata; - void *dv_cache; + int (*dv_strategy)(void *, int, daddr_t, size_t, char *, size_t *); + void *dv_devdata; + void *dv_cache; }; /* * Modular console support. */ -struct console +struct console { - const char *c_name; - const char *c_desc; - int c_flags; -#define C_PRESENTIN (1<<0) /* console can provide input */ -#define C_PRESENTOUT (1<<1) /* console can provide output */ -#define C_ACTIVEIN (1<<2) /* user wants input from console */ -#define C_ACTIVEOUT (1<<3) /* user wants output to console */ + const char *c_name; + const char *c_desc; + int c_flags; +#define C_PRESENTIN (1<<0) /* console can provide input */ +#define C_PRESENTOUT (1<<1) /* console can provide output */ +#define C_ACTIVEIN (1<<2) /* user wants input from console */ +#define C_ACTIVEOUT (1<<3) /* user wants output to console */ #define C_WIDEOUT (1<<4) /* c_out routine groks wide chars */ - void (* c_probe)(struct console *cp); /* set c_flags to match hardware */ - int (* c_init)(int arg); /* reinit XXX may need more args */ - void (* c_out)(int c); /* emit c */ - int (* c_in)(void); /* wait for and return input */ - int (* c_ready)(void); /* return nonzer if input waiting */ + + /* set c_flags to match hardware */ + void (* c_probe)(struct console *cp); + /* reinit XXX may need more args */ + int (* c_init)(int arg); + /* emit c */ + void (* c_out)(int c); + int (* c_in)(void); + /* wait for and return input */ + /* return nonzer if input waiting */ + int (* c_ready)(void); }; -extern struct console *consoles[]; -void cons_probe(void); +extern struct console *consoles[]; +void cons_probe(void); /* * Plug-and-play enumerator/configurator interface. */ -struct pnphandler +struct pnphandler { - const char *pp_name; /* handler/bus name */ - void (* pp_enumerate)(void); /* enumerate PnP devices, add to chain */ + const char *pp_name; /* handler/bus name */ + void (*pp_enumerate)(void); /* enumerate PnP devices, add to chain */ }; struct pnpident { - char *id_ident; /* ASCII identifier, actual format varies with bus/handler */ - STAILQ_ENTRY(pnpident) id_link; + /* ASCII identifier, actual format varies with bus/handler */ + char *id_ident; + STAILQ_ENTRY(pnpident) id_link; }; struct pnpinfo { - char *pi_desc; /* ASCII description, optional */ - int pi_revision; /* optional revision (or -1) if not supported */ - char *pi_module; /* module/args nominated to handle device */ - int pi_argc; /* module arguments */ - char **pi_argv; - struct pnphandler *pi_handler; /* handler which detected this device */ - STAILQ_HEAD(,pnpident) pi_ident; /* list of identifiers */ - STAILQ_ENTRY(pnpinfo) pi_link; + char *pi_desc; /* ASCII description, optional */ + int pi_revision; /* optional revision (or -1) if not supported */ + char *pi_module; /* module/args nominated to handle device */ + int pi_argc; /* module arguments */ + char **pi_argv; + struct pnphandler *pi_handler; /* handler which detected this device */ + STAILQ_HEAD(, pnpident) pi_ident; /* list of identifiers */ + STAILQ_ENTRY(pnpinfo) pi_link; }; STAILQ_HEAD(pnpinfo_stql, pnpinfo); -extern struct pnphandler *pnphandlers[]; /* provided by MD code */ +extern struct pnphandler *pnphandlers[]; /* provided by MD code */ void pnp_addident(struct pnpinfo *pi, char *ident); struct pnpinfo *pnp_allocinfo(void); @@ -157,7 +163,7 @@ char *pnp_eisaformat(uint8_t *data); * == 0 - Maybe ISA, search for read data port * > 0 - ISA in system, value is read data port address */ -extern int isapnp_readport; +extern int isapnp_readport; /* * Version information @@ -178,12 +184,12 @@ const char bootprog_interp[] = "$Interpreter:" interps * Metadata are allocated on our heap, and copied into kernel space * before executing the kernel. */ -struct file_metadata +struct file_metadata { - size_t md_size; - uint16_t md_type; - struct file_metadata *md_next; - char md_data[1]; /* data are immediately appended */ + size_t md_size; + uint16_t md_type; + struct file_metadata *md_next; + char md_data[1]; /* data are immediately appended */ }; struct preloaded_file; @@ -191,11 +197,11 @@ struct mod_depend; struct kernel_module { - char *m_name; /* module name */ - int m_version; /* module version */ -/* char *m_args;*/ /* arguments for the module */ - struct preloaded_file *m_fp; - struct kernel_module *m_next; + char *m_name; /* module name */ + int m_version; /* module version */ + /* char *m_args; */ /* arguments for the module */ + struct preloaded_file *m_fp; + struct kernel_module *m_next; }; /* @@ -209,47 +215,54 @@ struct kernel_module */ struct preloaded_file { - char *f_name; /* file name */ - char *f_type; /* verbose file type, eg 'ELF kernel', 'pnptable', etc. */ - char *f_args; /* arguments for the file */ - struct file_metadata *f_metadata; /* metadata that will be placed in the module directory */ - int f_loader; /* index of the loader that read the file */ - vm_offset_t f_addr; /* load address */ - size_t f_size; /* file size */ - struct kernel_module *f_modules; /* list of modules if any */ - struct preloaded_file *f_next; /* next file */ + char *f_name; /* file name */ + char *f_type; /* verbose file type, eg 'ELF kernel', 'pnptable', etc. */ + char *f_args; /* arguments for the file */ + /* metadata that will be placed in the module directory */ + struct file_metadata *f_metadata; + int f_loader; /* index of the loader that read the file */ + vm_offset_t f_addr; /* load address */ + size_t f_size; /* file size */ + struct kernel_module *f_modules; /* list of modules if any */ + struct preloaded_file *f_next; /* next file */ }; struct file_format { - /* Load function must return EFTYPE if it can't handle the module supplied */ - int (* l_load)(char *filename, uint64_t dest, struct preloaded_file **result); - /* Only a loader that will load a kernel (first module) should have an exec handler */ - int (* l_exec)(struct preloaded_file *mp); + /* + * Load function must return EFTYPE if it can't handle + * the module supplied + */ + int (*l_load)(char *, uint64_t, struct preloaded_file **); + /* + * Only a loader that will load a kernel (first module) + * should have an exec handler + */ + int (*l_exec)(struct preloaded_file *); }; -extern struct file_format *file_formats[]; /* supplied by consumer */ -extern struct preloaded_file *preloaded_files; +extern struct file_format *file_formats[]; /* supplied by consumer */ +extern struct preloaded_file *preloaded_files; -int mod_load(char *name, struct mod_depend *verinfo, int argc, char *argv[]); -int mod_loadkld(const char *name, int argc, char *argv[]); -void unload(void); +int mod_load(char *name, struct mod_depend *verinfo, int argc, char *argv[]); +int mod_loadkld(const char *name, int argc, char *argv[]); +void unload(void); struct preloaded_file *file_alloc(void); struct preloaded_file *file_findfile(const char *name, const char *type); struct file_metadata *file_findmetadata(struct preloaded_file *fp, int type); struct preloaded_file *file_loadraw(const char *name, char *type, int insert); void file_discard(struct preloaded_file *fp); -void file_addmetadata(struct preloaded_file *fp, int type, size_t size, void *p); -int file_addmodule(struct preloaded_file *fp, char *modname, int version, - struct kernel_module **newmp); +void file_addmetadata(struct preloaded_file *, int, size_t, void *); +int file_addmodule(struct preloaded_file *, char *, int, + struct kernel_module **); void file_removemetadata(struct preloaded_file *fp); /* MI module loaders */ #ifdef __elfN /* Relocation types. */ -#define ELF_RELOC_REL 1 -#define ELF_RELOC_RELA 2 +#define ELF_RELOC_REL 1 +#define ELF_RELOC_RELA 2 /* Relocation offset for some architectures */ extern uint64_t __elfN(relocation_offset); @@ -257,35 +270,33 @@ extern uint64_t __elfN(relocation_offset); struct elf_file; typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Size symidx); -int __elfN(loadfile)(char *filename, uint64_t dest, struct preloaded_file **result); -int __elfN(obj_loadfile)(char *filename, uint64_t dest, - struct preloaded_file **result); +int __elfN(loadfile)(char *, uint64_t, struct preloaded_file **); +int __elfN(obj_loadfile)(char *, uint64_t, struct preloaded_file **); int __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len); -int __elfN(loadfile_raw)(char *filename, uint64_t dest, - struct preloaded_file **result, int multiboot); -int __elfN(load_modmetadata)(struct preloaded_file *fp, uint64_t dest); +int __elfN(loadfile_raw)(char *, uint64_t, struct preloaded_file **, int); +int __elfN(load_modmetadata)(struct preloaded_file *, uint64_t); #endif /* - * Support for commands + * Support for commands */ -struct bootblk_command +struct bootblk_command { const char *c_name; const char *c_desc; bootblk_cmd_t *c_fn; }; -#define COMMAND_SET(tag, key, desc, func) \ +#define COMMAND_SET(tag, key, desc, func) \ static bootblk_cmd_t func; \ static struct bootblk_command _cmd_ ## tag = { key, desc, func }; \ DATA_SET(Xcommand_set, _cmd_ ## tag) SET_DECLARE(Xcommand_set, struct bootblk_command); -/* +/* * The intention of the architecture switch is to provide a convenient * encapsulation of the interface between the bootstrap MI and MD code. * MD code may selectively populate the switch at runtime based on the @@ -293,49 +304,52 @@ SET_DECLARE(Xcommand_set, struct bootblk_command); */ struct arch_switch { - /* Automatically load modules as required by detected hardware */ - int (*arch_autoload)(void); - /* Locate the device for (name), return pointer to tail in (*path) */ - int (*arch_getdev)(void **dev, const char *name, const char **path); - /* Copy from local address space to module address space, similar to bcopy() */ - ssize_t (*arch_copyin)(const void *src, vm_offset_t dest, - const size_t len); - /* Copy to local address space from module address space, similar to bcopy() */ - ssize_t (*arch_copyout)(const vm_offset_t src, void *dest, - const size_t len); - /* Read from file to module address space, same semantics as read() */ - ssize_t (*arch_readin)(readin_handle_t fd, vm_offset_t dest, - const size_t len); - /* Perform ISA byte port I/O (only for systems with ISA) */ - int (*arch_isainb)(int port); - void (*arch_isaoutb)(int port, int value); + /* Automatically load modules as required by detected hardware */ + int (*arch_autoload)(void); + /* Locate the device for (name), return pointer to tail in (*path) */ + int (*arch_getdev)(void **dev, const char *name, const char **path); + /* + * Copy from local address space to module address space, + * similar to bcopy() + */ + ssize_t (*arch_copyin)(const void *, vm_offset_t, const size_t); + /* + * Copy to local address space from module address space, + * similar to bcopy() + */ + ssize_t (*arch_copyout)(const vm_offset_t, void *, const size_t); + /* Read from file to module address space, same semantics as read() */ + ssize_t (*arch_readin)(readin_handle_t, vm_offset_t, const size_t); + /* Perform ISA byte port I/O (only for systems with ISA) */ + int (*arch_isainb)(int port); + void (*arch_isaoutb)(int port, int value); - /* - * Interface to adjust the load address according to the "object" - * being loaded. - */ - uint64_t (*arch_loadaddr)(u_int type, void *data, uint64_t addr); + /* + * Interface to adjust the load address according to the "object" + * being loaded. + */ + uint64_t (*arch_loadaddr)(u_int type, void *data, uint64_t addr); #define LOAD_ELF 1 /* data points to the ELF header. */ #define LOAD_RAW 2 /* data points to the file name. */ - /* - * Interface to inform MD code about a loaded (ELF) segment. This - * can be used to flush caches and/or set up translations. - */ + /* + * Interface to inform MD code about a loaded (ELF) segment. This + * can be used to flush caches and/or set up translations. + */ #ifdef __elfN - void (*arch_loadseg)(Elf_Ehdr *eh, Elf_Phdr *ph, uint64_t delta); + void (*arch_loadseg)(Elf_Ehdr *eh, Elf_Phdr *ph, uint64_t delta); #else - void (*arch_loadseg)(void *eh, void *ph, uint64_t delta); + void (*arch_loadseg)(void *eh, void *ph, uint64_t delta); #endif - /* Probe ZFS pool(s), if needed. */ - void (*arch_zfs_probe)(void); + /* Probe ZFS pool(s), if needed. */ + void (*arch_zfs_probe)(void); - /* Return the hypervisor name/type or NULL if not virtualized. */ - const char *(*arch_hypervisor)(void); + /* Return the hypervisor name/type or NULL if not virtualized. */ + const char *(*arch_hypervisor)(void); - /* For kexec-type loaders, get ksegment structure */ - void (*arch_kexec_kseg_get)(int *nseg, void **kseg); + /* For kexec-type loaders, get ksegment structure */ + void (*arch_kexec_kseg_get)(int *nseg, void **kseg); }; extern struct arch_switch archsw; From owner-svn-src-all@freebsd.org Sun Nov 8 09:49:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 141F32EBDF2; Sun, 8 Nov 2020 09:49:52 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTTr006fgz3F1v; Sun, 8 Nov 2020 09:49:52 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB2C11DE21; Sun, 8 Nov 2020 09:49:51 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A89npsB017824; Sun, 8 Nov 2020 09:49:51 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A89nplr017823; Sun, 8 Nov 2020 09:49:51 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202011080949.0A89nplr017823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 8 Nov 2020 09:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367480 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 367480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 09:49:52 -0000 Author: tsoome Date: Sun Nov 8 09:49:51 2020 New Revision: 367480 URL: https://svnweb.freebsd.org/changeset/base/367480 Log: loader: cstyle cleanup of bootstrap.h did miss a bit correct small issues - misplaced comment and typos. Modified: head/stand/common/bootstrap.h Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Sun Nov 8 09:35:41 2020 (r367479) +++ head/stand/common/bootstrap.h Sun Nov 8 09:49:51 2020 (r367480) @@ -111,10 +111,10 @@ struct console /* reinit XXX may need more args */ int (* c_init)(int arg); /* emit c */ - void (* c_out)(int c); - int (* c_in)(void); + void (* c_out)(int c); /* wait for and return input */ - /* return nonzer if input waiting */ + int (* c_in)(void); + /* return nonzero if input waiting */ int (* c_ready)(void); }; extern struct console *consoles[]; From owner-svn-src-all@freebsd.org Sun Nov 8 09:51:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FC3B2EBE79; Sun, 8 Nov 2020 09:51:00 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTTsJ1Wbkz3FTl; Sun, 8 Nov 2020 09:51:00 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C33A1DE9A; Sun, 8 Nov 2020 09:51:00 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A89p0DM017966; Sun, 8 Nov 2020 09:51:00 GMT (envelope-from netchild@FreeBSD.org) Received: (from netchild@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A89oxrZ017960; Sun, 8 Nov 2020 09:50:59 GMT (envelope-from netchild@FreeBSD.org) Message-Id: <202011080950.0A89oxrZ017960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: netchild set sender to netchild@FreeBSD.org using -f From: Alexander Leidinger Date: Sun, 8 Nov 2020 09:50:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367481 - in head: share/man/man4 sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: netchild X-SVN-Commit-Paths: in head: share/man/man4 sys/compat/linux X-SVN-Commit-Revision: 367481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 09:51:00 -0000 Author: netchild Date: Sun Nov 8 09:50:58 2020 New Revision: 367481 URL: https://svnweb.freebsd.org/changeset/base/367481 Log: - add more linux socket options (sorted by value) - map those IPv4 / IPv6 socket options which exist in FreeBSD + most of them visually verified to have the same type/layout of arguments + not tested with linux programs to behave as intended - be more human readable for known options which are not handled - be more verbose for unhandled socket message flags we know about - print the jail ID in linux_msg if run in a jail - add possibility to print debug message about known missing parts only once - add multiple levels of sysctl linux.debug: 1: print debug messages, tell about unimplemented stuff (only once) 2: like 1, but also print messages about implemented but not tested stuff (only once) 3+: like 2, but no rate limiting of messages - increase default linux debug level from 1 to 3 We are a lot more verbose in as we need to be (e.g. some of the IP socket options which are the same, and share the same memory layout, and are believed to work). The reason is that we have no good testsuite to test those linux-bits. The LTP or other test suites like the python one, are not fully up to the task we need. As such the excessive messages about emulated but not tested socket options. IMO any MFC (possible, but most probably not by me) should set the default debug level to 1. Discussed with: trasz Modified: head/share/man/man4/linux.4 head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h head/sys/compat/linux/linux_util.c head/sys/compat/linux/linux_util.h Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Sun Nov 8 09:49:51 2020 (r367480) +++ head/share/man/man4/linux.4 Sun Nov 8 09:50:58 2020 (r367481) @@ -98,7 +98,12 @@ tunables: .It Va compat.linux.debug Enable debugging messages. Set to 0 to silence them. -Defaults to 1. +Defaults to 3. +A setting of 1 prints debug messages, tells about unimplemented stuff (only +once). +Set to 2 is like 1, but also prints messages about implemented but not tested +stuff (only once). +Setting it to 3 or higher is like 2, but no rate limiting of messages. .It Va compat.linux.default_openfiles Default soft openfiles resource limit for Linux applications. Set to -1 to disable the limit. Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Sun Nov 8 09:49:51 2020 (r367480) +++ head/sys/compat/linux/linux_mib.c Sun Nov 8 09:50:58 2020 (r367481) @@ -63,7 +63,7 @@ static unsigned linux_osd_jail_slot; SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Linux mode"); -int linux_debug = 1; +int linux_debug = 3; SYSCTL_INT(_compat_linux, OID_AUTO, debug, CTLFLAG_RWTUN, &linux_debug, 0, "Log warnings from linux(4); or 0 to disable"); Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sun Nov 8 09:49:51 2020 (r367480) +++ head/sys/compat/linux/linux_socket.c Sun Nov 8 09:50:58 2020 (r367481) @@ -112,12 +112,37 @@ linux_to_bsd_ip_sockopt(int opt) { switch (opt) { + /* known and translated sockopts */ case LINUX_IP_TOS: return (IP_TOS); case LINUX_IP_TTL: return (IP_TTL); + case LINUX_IP_HDRINCL: + return (IP_HDRINCL); case LINUX_IP_OPTIONS: return (IP_OPTIONS); + case LINUX_IP_RECVOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_RECVOPTS"); + return (IP_RECVOPTS); + case LINUX_IP_RETOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_REETOPTS"); + return (IP_RETOPTS); + case LINUX_IP_RECVTTL: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_RECVTTL"); + return (IP_RECVTTL); + case LINUX_IP_RECVTOS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_RECVTOS"); + return (IP_RECVTOS); + case LINUX_IP_FREEBIND: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_FREEBIND"); + return (IP_BINDANY); + case LINUX_IP_IPSEC_POLICY: + /* we have this option, but not documented in ip(4) manpage */ + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_IPSEC_POLICY"); + return (IP_IPSEC_POLICY); + case LINUX_IP_MINTTL: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_MINTTL"); + return (IP_MINTTL); case LINUX_IP_MULTICAST_IF: return (IP_MULTICAST_IF); case LINUX_IP_MULTICAST_TTL: @@ -128,10 +153,120 @@ linux_to_bsd_ip_sockopt(int opt) return (IP_ADD_MEMBERSHIP); case LINUX_IP_DROP_MEMBERSHIP: return (IP_DROP_MEMBERSHIP); - case LINUX_IP_HDRINCL: - return (IP_HDRINCL); + case LINUX_IP_UNBLOCK_SOURCE: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_UNBLOCK_SOURCE"); + return (IP_UNBLOCK_SOURCE); + case LINUX_IP_BLOCK_SOURCE: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_BLOCK_SOURCE"); + return (IP_BLOCK_SOURCE); + case LINUX_IP_ADD_SOURCE_MEMBERSHIP: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_ADD_SOURCE_MEMBERSHIP"); + return (IP_ADD_SOURCE_MEMBERSHIP); + case LINUX_IP_DROP_SOURCE_MEMBERSHIP: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_DROP_SOURCE_MEMBERSHIP"); + return (IP_DROP_SOURCE_MEMBERSHIP); + case LINUX_MCAST_JOIN_GROUP: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_MCAST_JOIN_GROUP"); + return (MCAST_JOIN_GROUP); + case LINUX_MCAST_LEAVE_GROUP: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_MCAST_LEAVE_GROUP"); + return (MCAST_LEAVE_GROUP); + case LINUX_MCAST_JOIN_SOURCE_GROUP: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_MCAST_JOIN_SOURCE_GROUP"); + return (MCAST_JOIN_SOURCE_GROUP); + case LINUX_MCAST_LEAVE_SOURCE_GROUP: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_MCAST_LEAVE_SOURCE_GROUP"); + return (MCAST_LEAVE_SOURCE_GROUP); + + /* known but not implemented sockopts */ + case LINUX_IP_ROUTER_ALERT: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_ROUTER_ALERT (%d), you can not do user-space routing from linux programs", + opt); + return (-2); + case LINUX_IP_PKTINFO: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_PKTINFO (%d), you can not get extended packet info for datagram sockets in linux programs", + opt); + return (-2); + case LINUX_IP_PKTOPTIONS: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_PKTOPTIONS (%d)", + opt); + return (-2); + case LINUX_IP_MTU_DISCOVER: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_MTU_DISCOVER (%d), your linux program can not control path-MTU discovery", + opt); + return (-2); + case LINUX_IP_RECVERR: + /* needed by steam */ + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_RECVERR (%d), you can not get extended reliability info in linux programs", + opt); + return (-2); + case LINUX_IP_MTU: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_MTU (%d), your linux program can not control the MTU on this socket", + opt); + return (-2); + case LINUX_IP_XFRM_POLICY: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_XFRM_POLICY (%d)", + opt); + return (-2); + case LINUX_IP_PASSSEC: + /* needed by steam */ + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_PASSSEC (%d), you can not get IPSEC related credential information associated with this socket in linux programs -- if you do not use IPSEC, you can ignore this", + opt); + return (-2); + case LINUX_IP_TRANSPARENT: + /* IP_BINDANY or more? */ + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_TRANSPARENT (%d), you can not enable transparent proxying in linux programs -- note, IP_FREEBIND is supported, no idea if the FreeBSD IP_BINDANY is equivalent to the Linux IP_TRANSPARENT or not, any info is welcome", + opt); + return (-2); + case LINUX_IP_NODEFRAG: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_NODEFRAG (%d)", + opt); + return (-2); + case LINUX_IP_CHECKSUM: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_CHECKSUM (%d)", + opt); + return (-2); + case LINUX_IP_BIND_ADDRESS_NO_PORT: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_BIND_ADDRESS_NO_PORT (%d)", + opt); + return (-2); + case LINUX_IP_RECVFRAGSIZE: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_RECVFRAGSIZE (%d)", + opt); + return (-2); + case LINUX_MCAST_MSFILTER: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_MCAST_MSFILTER (%d)", + opt); + return (-2); + case LINUX_IP_MULTICAST_ALL: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_MULTICAST_ALL (%d), your linux program will not see all multicast groups joined by the entire system, only those the program joined itself on this socket", + opt); + return (-2); + case LINUX_IP_UNICAST_IF: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv4 socket option IP_UNICAST_IF (%d)", + opt); + return (-2); + + /* unknown sockopts */ + default: + return (-1); } - return (-1); } static int @@ -139,6 +274,28 @@ linux_to_bsd_ip6_sockopt(int opt) { switch (opt) { + /* known and translated sockopts */ + case LINUX_IPV6_2292PKTINFO: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_2292PKTINFO"); + return (IPV6_2292PKTINFO); + case LINUX_IPV6_2292HOPOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_2292HOPOPTS"); + return (IPV6_2292HOPOPTS); + case LINUX_IPV6_2292DSTOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_2292DSTOPTS"); + return (IPV6_2292DSTOPTS); + case LINUX_IPV6_2292RTHDR: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_2292RTHDR"); + return (IPV6_2292RTHDR); + case LINUX_IPV6_2292PKTOPTIONS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_2292PKTOPTIONS"); + return (IPV6_2292PKTOPTIONS); + case LINUX_IPV6_CHECKSUM: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_CHECKSUM"); + return (IPV6_CHECKSUM); + case LINUX_IPV6_2292HOPLIMIT: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_2292HOPLIMIT"); + return (IPV6_2292HOPLIMIT); case LINUX_IPV6_NEXTHOP: return (IPV6_NEXTHOP); case LINUX_IPV6_UNICAST_HOPS: @@ -155,40 +312,194 @@ linux_to_bsd_ip6_sockopt(int opt) return (IPV6_LEAVE_GROUP); case LINUX_IPV6_V6ONLY: return (IPV6_V6ONLY); - case LINUX_IPV6_DONTFRAG: - return (IPV6_DONTFRAG); -#if 0 - case LINUX_IPV6_CHECKSUM: - return (IPV6_CHECKSUM); + case LINUX_IPV6_IPSEC_POLICY: + /* we have this option, but not documented in ip6(4) manpage */ + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_IPSEC_POLICY"); + return (IPV6_IPSEC_POLICY); + case LINUX_MCAST_JOIN_GROUP: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_JOIN_GROUP"); + return (IPV6_JOIN_GROUP); + case LINUX_MCAST_LEAVE_GROUP: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_LEAVE_GROUP"); + return (IPV6_LEAVE_GROUP); case LINUX_IPV6_RECVPKTINFO: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_RECVPKTINFO"); return (IPV6_RECVPKTINFO); case LINUX_IPV6_PKTINFO: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_PKTINFO"); return (IPV6_PKTINFO); case LINUX_IPV6_RECVHOPLIMIT: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_RECVHOPLIMIT"); return (IPV6_RECVHOPLIMIT); case LINUX_IPV6_HOPLIMIT: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_HOPLIMIT"); return (IPV6_HOPLIMIT); case LINUX_IPV6_RECVHOPOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_RECVHOPOPTS"); return (IPV6_RECVHOPOPTS); case LINUX_IPV6_HOPOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_HOPOPTS"); return (IPV6_HOPOPTS); case LINUX_IPV6_RTHDRDSTOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_RTHDRDSTOPTS"); return (IPV6_RTHDRDSTOPTS); case LINUX_IPV6_RECVRTHDR: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_RECVRTHDR"); return (IPV6_RECVRTHDR); case LINUX_IPV6_RTHDR: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_RTHDR"); return (IPV6_RTHDR); case LINUX_IPV6_RECVDSTOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_RECVDSTOPTS"); return (IPV6_RECVDSTOPTS); case LINUX_IPV6_DSTOPTS: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_DSTOPTS"); return (IPV6_DSTOPTS); case LINUX_IPV6_RECVPATHMTU: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_RECVPATHMTU"); return (IPV6_RECVPATHMTU); case LINUX_IPV6_PATHMTU: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_PATHMTU"); return (IPV6_PATHMTU); -#endif + case LINUX_IPV6_DONTFRAG: + return (IPV6_DONTFRAG); + case LINUX_IPV6_AUTOFLOWLABEL: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_AUTOFLOWLABEL"); + return (IPV6_AUTOFLOWLABEL); + case LINUX_IPV6_ORIGDSTADDR: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_ORIGDSTADDR"); + return (IPV6_ORIGDSTADDR); + case LINUX_IPV6_FREEBIND: + LINUX_RATELIMIT_MSG_NOTTESTED("IPv6 socket option IPV6_FREEBIND"); + return (IPV6_BINDANY); + + /* known but not implemented sockopts */ + case LINUX_IPV6_ADDRFORM: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_ADDRFORM (%d), you linux program can not convert the socket to IPv4", + opt); + return (-2); + case LINUX_IPV6_AUTHHDR: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_AUTHHDR (%d), your linux program can not get the authentication header info of IPv6 packets", + opt); + return (-2); + case LINUX_IPV6_FLOWINFO: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_FLOWINFO (%d), your linux program can not get the flowid of IPv6 packets", + opt); + return (-2); + case LINUX_IPV6_ROUTER_ALERT: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_ROUTER_ALERT (%d), you can not do user-space routing from linux programs", + opt); + return (-2); + case LINUX_IPV6_MTU_DISCOVER: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_MTU_DISCOVER (%d), your linux program can not control path-MTU discovery", + opt); + return (-2); + case LINUX_IPV6_MTU: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_MTU (%d), your linux program can not control the MTU on this socket", + opt); + return (-2); + case LINUX_IPV6_JOIN_ANYCAST: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_JOIN_ANYCAST (%d)", + opt); + return (-2); + case LINUX_IPV6_LEAVE_ANYCAST: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_LEAVE_ANYCAST (%d)", + opt); + return (-2); + case LINUX_IPV6_MULTICAST_ALL: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_MULTICAST_ALL (%d)", + opt); + return (-2); + case LINUX_IPV6_ROUTER_ALERT_ISOLATE: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_ROUTER_ALERT_ISOLATE (%d)", + opt); + return (-2); + case LINUX_IPV6_FLOWLABEL_MGR: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_FLOWLABEL_MGR (%d)", + opt); + return (-2); + case LINUX_IPV6_FLOWINFO_SEND: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_FLOWINFO_SEND (%d)", + opt); + return (-2); + case LINUX_IPV6_XFRM_POLICY: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_XFRM_POLICY (%d)", + opt); + return (-2); + case LINUX_IPV6_HDRINCL: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_HDRINCL (%d)", + opt); + return (-2); + case LINUX_MCAST_BLOCK_SOURCE: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option MCAST_BLOCK_SOURCE (%d), your linux program may see more multicast stuff than it wants", + opt); + return (-2); + case LINUX_MCAST_UNBLOCK_SOURCE: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option MCAST_UNBLOCK_SOURCE (%d), your linux program may not see all the multicast stuff it wants", + opt); + return (-2); + case LINUX_MCAST_JOIN_SOURCE_GROUP: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option MCAST_JOIN_SOURCE_GROUP (%d), your linux program is not able to join a multicast source group", + opt); + return (-2); + case LINUX_MCAST_LEAVE_SOURCE_GROUP: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option MCAST_LEAVE_SOURCE_GROUP (%d), your linux program is not able to leave a multicast source group -- but it was also not able to join one, so no issue", + opt); + return (-2); + case LINUX_MCAST_MSFILTER: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option MCAST_MSFILTER (%d), your linux program can not manipulate the multicast filter, it may see more multicast data than it wants to see", + opt); + return (-2); + case LINUX_IPV6_ADDR_PREFERENCES: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_ADDR_PREFERENCES (%d)", + opt); + return (-2); + case LINUX_IPV6_MINHOPCOUNT: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_MINHOPCOUNT (%d)", + opt); + return (-2); + case LINUX_IPV6_TRANSPARENT: + /* IP_BINDANY or more? */ + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_TRANSPARENT (%d), you can not enable transparent proxying in linux programs -- note, IP_FREEBIND is supported, no idea if the FreeBSD IP_BINDANY is equivalent to the Linux IP_TRANSPARENT or not, any info is welcome", + opt); + return (-2); + case LINUX_IPV6_UNICAST_IF: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_UNICAST_IF (%d)", + opt); + return (-2); + case LINUX_IPV6_RECVFRAGSIZE: + LINUX_RATELIMIT_MSG_OPT1( + "unsupported IPv6 socket option IPV6_RECVFRAGSIZE (%d)", + opt); + return (-2); + + /* unknown sockopts */ + default: + return (-1); } - return (-1); } static int @@ -290,20 +601,24 @@ linux_to_bsd_msg_flags(int flags) ret_flags |= MSG_WAITALL; if (flags & LINUX_MSG_NOSIGNAL) ret_flags |= MSG_NOSIGNAL; -#if 0 /* not handled */ if (flags & LINUX_MSG_PROXY) - ; + LINUX_RATELIMIT_MSG_OPT1("socket message flag MSG_PROXY (%d) not handled", + LINUX_MSG_PROXY); if (flags & LINUX_MSG_FIN) - ; + LINUX_RATELIMIT_MSG_OPT1("socket message flag MSG_FIN (%d) not handled", + LINUX_MSG_FIN); if (flags & LINUX_MSG_SYN) - ; + LINUX_RATELIMIT_MSG_OPT1("socket message flag MSG_SYN (%d) not handled", + LINUX_MSG_SYN); if (flags & LINUX_MSG_CONFIRM) - ; + LINUX_RATELIMIT_MSG_OPT1("socket message flag MSG_CONFIRM (%d) not handled", + LINUX_MSG_CONFIRM); if (flags & LINUX_MSG_RST) - ; + LINUX_RATELIMIT_MSG_OPT1("socket message flag MSG_RST (%d) not handled", + LINUX_MSG_RST); if (flags & LINUX_MSG_ERRQUEUE) - ; -#endif + LINUX_RATELIMIT_MSG_OPT1("socket message flag MSG_ERRQUEUE (%d) not handled", + LINUX_MSG_ERRQUEUE); return (ret_flags); } @@ -1505,10 +1820,11 @@ linux_setsockopt(struct thread *td, struct linux_setso name = -1; break; } - if (name == -1) { - linux_msg(curthread, - "unsupported setsockopt level %d optname %d", - args->level, args->optname); + if (name < 0) { + if (name == -1) + linux_msg(curthread, + "unsupported setsockopt level %d optname %d", + args->level, args->optname); return (ENOPROTOOPT); } @@ -1605,10 +1921,11 @@ linux_getsockopt(struct thread *td, struct linux_getso name = -1; break; } - if (name == -1) { - linux_msg(curthread, - "unsupported getsockopt level %d optname %d", - args->level, args->optname); + if (name < 0) { + if (name == -1) + linux_msg(curthread, + "unsupported getsockopt level %d optname %d", + args->level, args->optname); return (EINVAL); } Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Sun Nov 8 09:49:51 2020 (r367480) +++ head/sys/compat/linux/linux_socket.h Sun Nov 8 09:50:58 2020 (r367481) @@ -204,24 +204,84 @@ int linux_accept(struct thread *td, struct linux_accep #define LINUX_IP_TTL 2 #define LINUX_IP_HDRINCL 3 #define LINUX_IP_OPTIONS 4 +#define LINUX_IP_ROUTER_ALERT 5 +#define LINUX_IP_RECVOPTS 6 +#define LINUX_IP_RETOPTS 7 +#define LINUX_IP_PKTINFO 8 +#define LINUX_IP_PKTOPTIONS 9 +#define LINUX_IP_MTU_DISCOVER 10 #define LINUX_IP_RECVERR 11 +#define LINUX_IP_RECVTTL 12 +#define LINUX_IP_RECVTOS 13 +#define LINUX_IP_MTU 14 +#define LINUX_IP_FREEBIND 15 +#define LINUX_IP_IPSEC_POLICY 16 +#define LINUX_IP_XFRM_POLICY 17 +#define LINUX_IP_PASSSEC 18 +#define LINUX_IP_TRANSPARENT 19 +#define LINUX_IP_MINTTL 21 +#define LINUX_IP_NODEFRAG 22 +#define LINUX_IP_CHECKSUM 23 +#define LINUX_IP_BIND_ADDRESS_NO_PORT 24 +#define LINUX_IP_RECVFRAGSIZE 25 + #define LINUX_IP_MULTICAST_IF 32 #define LINUX_IP_MULTICAST_TTL 33 #define LINUX_IP_MULTICAST_LOOP 34 #define LINUX_IP_ADD_MEMBERSHIP 35 #define LINUX_IP_DROP_MEMBERSHIP 36 +#define LINUX_IP_UNBLOCK_SOURCE 37 +#define LINUX_IP_BLOCK_SOURCE 38 +#define LINUX_IP_ADD_SOURCE_MEMBERSHIP 39 +#define LINUX_IP_DROP_SOURCE_MEMBERSHIP 40 +#define LINUX_IP_MSFILTER 41 +#define LINUX_MCAST_JOIN_GROUP 42 +#define LINUX_MCAST_BLOCK_SOURCE 43 +#define LINUX_MCAST_UNBLOCK_SOURCE 44 +#define LINUX_MCAST_LEAVE_GROUP 45 +#define LINUX_MCAST_JOIN_SOURCE_GROUP 46 +#define LINUX_MCAST_LEAVE_SOURCE_GROUP 47 +#define LINUX_MCAST_MSFILTER 48 +#define LINUX_IP_MULTICAST_ALL 49 +#define LINUX_IP_UNICAST_IF 50 + +#define LINUX_IPV6_ADDRFORM 1 +#define LINUX_IPV6_2292PKTINFO 2 +#define LINUX_IPV6_2292HOPOPTS 3 +#define LINUX_IPV6_2292DSTOPTS 4 +#define LINUX_IPV6_2292RTHDR 5 +#define LINUX_IPV6_2292PKTOPTIONS 6 #define LINUX_IPV6_CHECKSUM 7 +#define LINUX_IPV6_2292HOPLIMIT 8 #define LINUX_IPV6_NEXTHOP 9 +#define LINUX_IPV6_AUTHHDR 10 +#define LINUX_IPV6_FLOWINFO 11 + #define LINUX_IPV6_UNICAST_HOPS 16 #define LINUX_IPV6_MULTICAST_IF 17 #define LINUX_IPV6_MULTICAST_HOPS 18 #define LINUX_IPV6_MULTICAST_LOOP 19 #define LINUX_IPV6_ADD_MEMBERSHIP 20 #define LINUX_IPV6_DROP_MEMBERSHIP 21 +#define LINUX_IPV6_ROUTER_ALERT 22 +#define LINUX_IPV6_MTU_DISCOVER 23 +#define LINUX_IPV6_MTU 24 +#define LINUX_IPV6_RECVERR 25 #define LINUX_IPV6_V6ONLY 26 +#define LINUX_IPV6_JOIN_ANYCAST 27 +#define LINUX_IPV6_LEAVE_ANYCAST 28 +#define LINUX_IPV6_MULTICAST_ALL 29 +#define LINUX_IPV6_ROUTER_ALERT_ISOLATE 30 +#define LINUX_IPV6_FLOWLABEL_MGR 32 +#define LINUX_IPV6_FLOWINFO_SEND 33 + +#define LINUX_IPV6_IPSEC_POLICY 34 +#define LINUX_IPV6_XFRM_POLICY 35 +#define LINUX_IPV6_HDRINCL 36 + #define LINUX_IPV6_RECVPKTINFO 49 #define LINUX_IPV6_PKTINFO 50 #define LINUX_IPV6_RECVHOPLIMIT 51 @@ -236,6 +296,15 @@ int linux_accept(struct thread *td, struct linux_accep #define LINUX_IPV6_RECVPATHMTU 60 #define LINUX_IPV6_PATHMTU 61 #define LINUX_IPV6_DONTFRAG 62 + +#define LINUX_IPV6_AUTOFLOWLABEL 70 +#define LINUX_IPV6_ADDR_PREFERENCES 72 +#define LINUX_IPV6_MINHOPCOUNT 73 +#define LINUX_IPV6_ORIGDSTADDR 74 +#define LINUX_IPV6_TRANSPARENT 75 +#define LINUX_IPV6_UNICAST_IF 76 +#define LINUX_IPV6_RECVFRAGSIZE 77 +#define LINUX_IPV6_FREEBIND 78 #define LINUX_TCP_NODELAY 1 #define LINUX_TCP_MAXSEG 2 Modified: head/sys/compat/linux/linux_util.c ============================================================================== --- head/sys/compat/linux/linux_util.c Sun Nov 8 09:49:51 2020 (r367480) +++ head/sys/compat/linux/linux_util.c Sun Nov 8 09:50:58 2020 (r367481) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -96,7 +97,8 @@ linux_msg(const struct thread *td, const char *fmt, .. return; p = td->td_proc; - printf("linux: pid %d (%s): ", (int)p->p_pid, p->p_comm); + printf("linux: jid %d pid %d (%s): ", p->p_ucred->cr_prison->pr_id, + (int)p->p_pid, p->p_comm); va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); Modified: head/sys/compat/linux/linux_util.h ============================================================================== --- head/sys/compat/linux/linux_util.h Sun Nov 8 09:49:51 2020 (r367480) +++ head/sys/compat/linux/linux_util.h Sun Nov 8 09:50:58 2020 (r367481) @@ -155,4 +155,33 @@ void linux_free_get_char_devices(char *string); #define LINUX_CTR6(f, m, p1, p2, p3, p4, p5, p6) #endif -#endif /* !_LINUX_UTIL_H_ */ +/* + * Some macros for rate limiting messages: + * - noisy if compat.linux.debug = 1 + * - print only once if compat.linux.debug > 1 + */ +#define LINUX_RATELIMIT_MSG_NOTTESTED(_what) \ + do { \ + static int seen = 0; \ + \ + if (seen == 0 && linux_debug >= 2) { \ + linux_msg(curthread, "%s is not tested, please report on emulation@FreeBSD.org how it works", _what); \ + \ + if (linux_debug < 3) \ + seen = 1; \ + } \ + } while (0) + +#define LINUX_RATELIMIT_MSG_OPT1(_message, _opt1) \ + do { \ + static int seen = 0; \ + \ + if (seen == 0) { \ + linux_msg(curthread, _message, _opt1); \ + \ + if (linux_debug < 3) \ + seen = 1; \ + } \ + } while (0) + +#endif /* ! _LINUX_UTIL_H_ */ From owner-svn-src-all@freebsd.org Sun Nov 8 10:08:20 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A9162ECACD; Sun, 8 Nov 2020 10:08:20 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTVFJ3zsjz3GMw; Sun, 8 Nov 2020 10:08:20 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7756B1E2C1; Sun, 8 Nov 2020 10:08:20 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8A8KPq029957; Sun, 8 Nov 2020 10:08:20 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8A8KE0029956; Sun, 8 Nov 2020 10:08:20 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011081008.0A8A8KE0029956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Sun, 8 Nov 2020 10:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367482 - stable/12/share/man/man7 X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/share/man/man7 X-SVN-Commit-Revision: 367482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 10:08:20 -0000 Author: 0mp (doc,ports committer) Date: Sun Nov 8 10:08:20 2020 New Revision: 367482 URL: https://svnweb.freebsd.org/changeset/base/367482 Log: MFC r367256: Do not document default locations of the OpenBSD and NetBSD ports trees Our own Ports Collection is not targeting those systems at the moment, so let's stop documenting bits specific to OpenBSD and NetBSD in the ports documentation. Especially, that it might bit rot one day. Modified: stable/12/share/man/man7/ports.7 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man7/ports.7 ============================================================================== --- stable/12/share/man/man7/ports.7 Sun Nov 8 09:50:58 2020 (r367481) +++ stable/12/share/man/man7/ports.7 Sun Nov 8 10:08:20 2020 (r367482) @@ -372,14 +372,7 @@ You can change all of these. Location of the ports tree. This is .Pa /usr/ports -on -.Fx -and -.Ox , -and -.Pa /usr/pkgsrc -on -.Nx . +by default. .It Va WRKDIRPREFIX Where to create any temporary files. Useful if From owner-svn-src-all@freebsd.org Sun Nov 8 10:13:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DAEB2ECEBD; Sun, 8 Nov 2020 10:13:07 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTVLq0QYyz3GrX; Sun, 8 Nov 2020 10:13:07 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 018161E4B9; Sun, 8 Nov 2020 10:13:07 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8AD6KZ035875; Sun, 8 Nov 2020 10:13:06 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8AD6Ch035874; Sun, 8 Nov 2020 10:13:06 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011081013.0A8AD6Ch035874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Sun, 8 Nov 2020 10:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367483 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 367483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 10:13:07 -0000 Author: 0mp (doc,ports committer) Date: Sun Nov 8 10:13:06 2020 New Revision: 367483 URL: https://svnweb.freebsd.org/changeset/base/367483 Log: MFC r367256: Do not document default locations of the OpenBSD and NetBSD ports trees Our own Ports Collection is not targeting those systems at the moment, so let's stop documenting bits specific to OpenBSD and NetBSD in the ports documentation. Especially, that it might bit rot one day. Modified: stable/11/share/man/man7/ports.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/ports.7 ============================================================================== --- stable/11/share/man/man7/ports.7 Sun Nov 8 10:08:20 2020 (r367482) +++ stable/11/share/man/man7/ports.7 Sun Nov 8 10:13:06 2020 (r367483) @@ -361,14 +361,7 @@ You can change all of these. Location of the ports tree. This is .Pa /usr/ports -on -.Fx -and -.Ox , -and -.Pa /usr/pkgsrc -on -.Nx . +by default. .It Va WRKDIRPREFIX Where to create any temporary files. Useful if From owner-svn-src-all@freebsd.org Sun Nov 8 11:12:01 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 791492EDBBB; Sun, 8 Nov 2020 11:12:01 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTWfn33KHz3K7p; Sun, 8 Nov 2020 11:12:01 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B7D41F008; Sun, 8 Nov 2020 11:12:01 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8BC1Sr072364; Sun, 8 Nov 2020 11:12:01 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8BC019072361; Sun, 8 Nov 2020 11:12:00 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011081112.0A8BC019072361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 8 Nov 2020 11:12:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367484 - in head/sys: conf net X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: conf net X-SVN-Commit-Revision: 367484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 11:12:01 -0000 Author: melifaro Date: Sun Nov 8 11:12:00 2020 New Revision: 367484 URL: https://svnweb.freebsd.org/changeset/base/367484 Log: Move all ifaddr route creation business logic to net/route/route_ifaddr.c Differential Revision: https://reviews.freebsd.org/D26318 Modified: head/sys/conf/files head/sys/net/if.c head/sys/net/route.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Nov 8 10:13:06 2020 (r367483) +++ head/sys/conf/files Sun Nov 8 11:12:00 2020 (r367484) @@ -4174,6 +4174,7 @@ net/route/nhop_utils.c standard net/route/route_ctl.c standard net/route/route_ddb.c optional ddb net/route/route_helpers.c standard +net/route/route_ifaddrs.c standard net/route/route_tables.c standard net/route/route_temporal.c standard net/rss_config.c optional inet rss | inet6 rss Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sun Nov 8 10:13:06 2020 (r367483) +++ head/sys/net/if.c Sun Nov 8 11:12:00 2020 (r367484) @@ -1842,76 +1842,6 @@ ifa_free(struct ifaddr *ifa) NET_EPOCH_CALL(ifa_destroy, &ifa->ifa_epoch_ctx); } -static int -ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, - struct sockaddr *ia) -{ - struct rib_cmd_info rc; - struct epoch_tracker et; - int error; - struct rt_addrinfo info; - struct sockaddr_dl null_sdl; - struct ifnet *ifp; - struct ifaddr *rti_ifa = NULL; - - ifp = ifa->ifa_ifp; - - NET_EPOCH_ENTER(et); - bzero(&info, sizeof(info)); - if (cmd != RTM_DELETE) - info.rti_ifp = V_loif; - if (cmd == RTM_ADD) { - /* explicitly specify (loopback) ifa */ - if (info.rti_ifp != NULL) { - rti_ifa = ifaof_ifpforaddr(ifa->ifa_addr, info.rti_ifp); - if (rti_ifa != NULL) - ifa_ref(rti_ifa); - info.rti_ifa = rti_ifa; - } - } - info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED; - info.rti_info[RTAX_DST] = ia; - info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; - link_init_sdl(ifp, (struct sockaddr *)&null_sdl, ifp->if_type); - - error = rib_action(ifp->if_fib, cmd, &info, &rc); - NET_EPOCH_EXIT(et); - - if (rti_ifa != NULL) - ifa_free(rti_ifa); - - if (error == 0 || - (cmd == RTM_ADD && error == EEXIST) || - (cmd == RTM_DELETE && (error == ENOENT || error == ESRCH))) - return (error); - - log(LOG_DEBUG, "%s: %s failed for interface %s: %u\n", - __func__, otype, if_name(ifp), error); - - return (error); -} - -int -ifa_add_loopback_route(struct ifaddr *ifa, struct sockaddr *ia) -{ - - return (ifa_maintain_loopback_route(RTM_ADD, "insertion", ifa, ia)); -} - -int -ifa_del_loopback_route(struct ifaddr *ifa, struct sockaddr *ia) -{ - - return (ifa_maintain_loopback_route(RTM_DELETE, "deletion", ifa, ia)); -} - -int -ifa_switch_loopback_route(struct ifaddr *ifa, struct sockaddr *ia) -{ - - return (ifa_maintain_loopback_route(RTM_CHANGE, "switch", ifa, ia)); -} - /* * XXX: Because sockaddr_dl has deeper structure than the sockaddr * structs used to represent other address families, it is necessary Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sun Nov 8 10:13:06 2020 (r367483) +++ head/sys/net/route.c Sun Nov 8 11:12:00 2020 (r367484) @@ -72,20 +72,6 @@ #include #include -/* - * By default add routes to all fibs for new interfaces. - * Once this is set to 0 then only allocate routes on interface - * changes for the FIB of the caller when adding a new set of addresses - * to an interface. XXX this is a shotgun aproach to a problem that needs - * a more fine grained solution.. that will come. - * XXX also has the problems getting the FIB from curthread which will not - * always work given the fib can be overridden and prefixes can be added - * from the network stack context. - */ -VNET_DEFINE(u_int, rt_add_addr_allfibs) = 1; -SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RWTUN | CTLFLAG_VNET, - &VNET_NAME(rt_add_addr_allfibs), 0, ""); - VNET_PCPUSTAT_DEFINE(struct rtstat, rtstat); VNET_PCPUSTAT_SYSINIT(rtstat); @@ -864,196 +850,6 @@ rt_maskedcopy(struct sockaddr *src, struct sockaddr *d *cp2++ = *cp1++ & *cp3++; if (cp2 < cplim2) bzero((caddr_t)cp2, (unsigned)(cplim2 - cp2)); -} - -/* - * Set up a routing table entry, normally - * for an interface. - */ -static inline int -rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum) -{ - RIB_RLOCK_TRACKER; - struct epoch_tracker et; - struct sockaddr *dst; - struct sockaddr *netmask; - struct rib_cmd_info rc; - struct rt_addrinfo info; - int error = 0; - int startfib, endfib; - struct sockaddr_storage ss; - int didwork = 0; - int a_failure = 0; - struct sockaddr_dl_short sdl; - struct rib_head *rnh; - - if (flags & RTF_HOST) { - dst = ifa->ifa_dstaddr; - netmask = NULL; - } else { - dst = ifa->ifa_addr; - netmask = ifa->ifa_netmask; - } - if (dst->sa_len == 0) - return(EINVAL); - switch (dst->sa_family) { - case AF_INET6: - case AF_INET: - /* We support multiple FIBs. */ - break; - default: - fibnum = RT_DEFAULT_FIB; - break; - } - if (fibnum == RT_ALL_FIBS) { - if (V_rt_add_addr_allfibs == 0 && cmd == (int)RTM_ADD) - startfib = endfib = ifa->ifa_ifp->if_fib; - else { - startfib = 0; - endfib = rt_numfibs - 1; - } - } else { - KASSERT((fibnum < rt_numfibs), ("rtinit1: bad fibnum")); - startfib = fibnum; - endfib = fibnum; - } - - /* - * If it's a delete, check that if it exists, - * it's on the correct interface or we might scrub - * a route to another ifa which would - * be confusing at best and possibly worse. - */ - if (cmd == RTM_DELETE) { - /* - * It's a delete, so it should already exist.. - * If it's a net, mask off the host bits - * (Assuming we have a mask) - * XXX this is kinda inet specific.. - */ - if (netmask != NULL) { - rt_maskedcopy(dst, (struct sockaddr *)&ss, netmask); - dst = (struct sockaddr *)&ss; - } - } - bzero(&sdl, sizeof(struct sockaddr_dl_short)); - sdl.sdl_family = AF_LINK; - sdl.sdl_len = sizeof(struct sockaddr_dl_short); - sdl.sdl_type = ifa->ifa_ifp->if_type; - sdl.sdl_index = ifa->ifa_ifp->if_index; - /* - * Now go through all the requested tables (fibs) and do the - * requested action. Realistically, this will either be fib 0 - * for protocols that don't do multiple tables or all the - * tables for those that do. - */ - for ( fibnum = startfib; fibnum <= endfib; fibnum++) { - if (cmd == RTM_DELETE) { - struct radix_node *rn; - /* - * Look up an rtentry that is in the routing tree and - * contains the correct info. - */ - rnh = rt_tables_get_rnh(fibnum, dst->sa_family); - if (rnh == NULL) - /* this table doesn't exist but others might */ - continue; - RIB_RLOCK(rnh); - rn = rnh->rnh_lookup(dst, netmask, &rnh->head); -#ifdef RADIX_MPATH - if (rt_mpath_capable(rnh)) { - if (rn == NULL) - error = ESRCH; - else { - struct rtentry *rt = RNTORT(rn); - /* - * for interface route the gateway - * gateway is sockaddr_dl, so - * rt_mpath_matchgate must use the - * interface address - */ - rt = rt_mpath_matchgate(rt, - ifa->ifa_addr); - if (rt == NULL) - error = ESRCH; - } - } -#endif - error = (rn == NULL || - (rn->rn_flags & RNF_ROOT) || - RNTORT(rn)->rt_nhop->nh_ifa != ifa); - RIB_RUNLOCK(rnh); - if (error) { - /* this is only an error if bad on ALL tables */ - continue; - } - } - /* - * Do the actual request - */ - bzero((caddr_t)&info, sizeof(info)); - info.rti_ifa = ifa; - info.rti_flags = flags | - (ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; - info.rti_info[RTAX_DST] = dst; - info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sdl; - info.rti_info[RTAX_NETMASK] = netmask; - NET_EPOCH_ENTER(et); - error = rib_action(fibnum, cmd, &info, &rc); - if (error == 0 && rc.rc_rt != NULL) { - /* - * notify any listening routing agents of the change - */ - - /* TODO: interface routes/aliases */ - rt_newaddrmsg_fib(cmd, ifa, rc.rc_rt, fibnum); - didwork = 1; - } - NET_EPOCH_EXIT(et); - if (error) - a_failure = error; - } - if (cmd == RTM_DELETE) { - if (didwork) { - error = 0; - } else { - /* we only give an error if it wasn't in any table */ - error = ((flags & RTF_HOST) ? - EHOSTUNREACH : ENETUNREACH); - } - } else { - if (a_failure) { - /* return an error if any of them failed */ - error = a_failure; - } - } - return (error); -} - -/* - * Set up a routing table entry, normally - * for an interface. - */ -int -rtinit(struct ifaddr *ifa, int cmd, int flags) -{ - struct sockaddr *dst; - int fib = RT_DEFAULT_FIB; - - if (flags & RTF_HOST) { - dst = ifa->ifa_dstaddr; - } else { - dst = ifa->ifa_addr; - } - - switch (dst->sa_family) { - case AF_INET6: - case AF_INET: - /* We do support multiple FIBs. */ - fib = RT_ALL_FIBS; - break; - } - return (rtinit1(ifa, cmd, flags, fib)); } /* From owner-svn-src-all@freebsd.org Sun Nov 8 12:47:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECCB7460F2B; Sun, 8 Nov 2020 12:47:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTYn35DyHz3Pkg; Sun, 8 Nov 2020 12:47:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A65F5200C2; Sun, 8 Nov 2020 12:47:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8ClZjb027783; Sun, 8 Nov 2020 12:47:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8ClZ0J027782; Sun, 8 Nov 2020 12:47:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011081247.0A8ClZ0J027782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 8 Nov 2020 12:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367485 - head/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 367485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 12:47:36 -0000 Author: dim Date: Sun Nov 8 12:47:35 2020 New Revision: 367485 URL: https://svnweb.freebsd.org/changeset/base/367485 Log: Merge commit 354d3106c from llvm git (by Kai Luo): [PowerPC] Skip combining (uint_to_fp x) if x is not simple type Current powerpc64le backend hits ``` Combining: t7: f64 = uint_to_fp t6 llc: llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:291: llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a SimpleValueType!"' failed. ``` This patch fixes it by skipping combination if `t6` is not simple type. Fixed https://bugs.llvm.org/show_bug.cgi?id=47660. Reviewed By: #powerpc, steven.zhang Differential Revision: https://reviews.llvm.org/D88388 This should fix the llvm assertion mentioned above when building the following ports for powerpc64le: * audio/traverso * databases/percona57-pam-for-mysql * databases/percona57-server * emulators/citra * emulators/citra-qt5 * games/7kaa * graphics/dia * graphics/mandelbulber * graphics/pcl-pointclouds * net-p2p/libtorrent-rasterbar * textproc/htmldoc Requested by: pkubaj MFC after: 3 days Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sun Nov 8 11:12:00 2020 (r367484) +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sun Nov 8 12:47:35 2020 (r367485) @@ -14257,6 +14257,8 @@ SDValue PPCTargetLowering::combineFPToIntToFP(SDNode * // from the hardware. if (Op.getValueType() != MVT::f32 && Op.getValueType() != MVT::f64) return SDValue(); + if (!Op.getOperand(0).getValueType().isSimple()) + return SDValue(); if (Op.getOperand(0).getValueType().getSimpleVT() <= MVT(MVT::i1) || Op.getOperand(0).getValueType().getSimpleVT() > MVT(MVT::i64)) return SDValue(); From owner-svn-src-all@freebsd.org Sun Nov 8 13:30:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA2C4461C44; Sun, 8 Nov 2020 13:30:44 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTZkr4xqMz3hf8; Sun, 8 Nov 2020 13:30:44 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CEC32098F; Sun, 8 Nov 2020 13:30:44 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8DUiIh052398; Sun, 8 Nov 2020 13:30:44 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8DUio6052397; Sun, 8 Nov 2020 13:30:44 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011081330.0A8DUio6052397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 8 Nov 2020 13:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367486 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 367486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 13:30:44 -0000 Author: melifaro Date: Sun Nov 8 13:30:44 2020 New Revision: 367486 URL: https://svnweb.freebsd.org/changeset/base/367486 Log: Fix build broken by r367484: add route_ifaddrs.c. Pointy hat to: melifaro Reported by: jenkins Added: head/sys/net/route/route_ifaddrs.c (contents, props changed) Added: head/sys/net/route/route_ifaddrs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/route/route_ifaddrs.c Sun Nov 8 13:30:44 2020 (r367486) @@ -0,0 +1,309 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1980, 1986, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)route.c 8.3.1.1 (Berkeley) 2/23/95 + * $FreeBSD$ + */ + +#include "opt_mpath.h" +#include "opt_route.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* + * Control interface address fib propagation. + * By default, interface address routes are added to the fib of the interface. + * Once set to non-zero, adds interface address route to all fibs. + */ +VNET_DEFINE(u_int, rt_add_addr_allfibs) = 0; +SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RWTUN | CTLFLAG_VNET, + &VNET_NAME(rt_add_addr_allfibs), 0, ""); + +/* + * Set up a routing table entry, normally + * for an interface. + */ +static inline int +rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum) +{ + RIB_RLOCK_TRACKER; + struct epoch_tracker et; + struct sockaddr *dst; + struct sockaddr *netmask; + struct rib_cmd_info rc; + struct rt_addrinfo info; + int error = 0; + int startfib, endfib; + struct sockaddr_storage ss; + int didwork = 0; + int a_failure = 0; + struct sockaddr_dl_short sdl; + struct rib_head *rnh; + + if (flags & RTF_HOST) { + dst = ifa->ifa_dstaddr; + netmask = NULL; + } else { + dst = ifa->ifa_addr; + netmask = ifa->ifa_netmask; + } + if (dst->sa_len == 0) + return(EINVAL); + switch (dst->sa_family) { + case AF_INET6: + case AF_INET: + /* We support multiple FIBs. */ + break; + default: + fibnum = RT_DEFAULT_FIB; + break; + } + if (fibnum == RT_ALL_FIBS) { + if (V_rt_add_addr_allfibs == 0 && cmd == (int)RTM_ADD) + startfib = endfib = ifa->ifa_ifp->if_fib; + else { + startfib = 0; + endfib = rt_numfibs - 1; + } + } else { + KASSERT((fibnum < rt_numfibs), ("rtinit1: bad fibnum")); + startfib = fibnum; + endfib = fibnum; + } + + /* + * If it's a delete, check that if it exists, + * it's on the correct interface or we might scrub + * a route to another ifa which would + * be confusing at best and possibly worse. + */ + if (cmd == RTM_DELETE) { + /* + * It's a delete, so it should already exist.. + * If it's a net, mask off the host bits + * (Assuming we have a mask) + * XXX this is kinda inet specific.. + */ + if (netmask != NULL) { + rt_maskedcopy(dst, (struct sockaddr *)&ss, netmask); + dst = (struct sockaddr *)&ss; + } + } + bzero(&sdl, sizeof(struct sockaddr_dl_short)); + sdl.sdl_family = AF_LINK; + sdl.sdl_len = sizeof(struct sockaddr_dl_short); + sdl.sdl_type = ifa->ifa_ifp->if_type; + sdl.sdl_index = ifa->ifa_ifp->if_index; + /* + * Now go through all the requested tables (fibs) and do the + * requested action. Realistically, this will either be fib 0 + * for protocols that don't do multiple tables or all the + * tables for those that do. + */ + for ( fibnum = startfib; fibnum <= endfib; fibnum++) { + if (cmd == RTM_DELETE) { + struct radix_node *rn; + /* + * Look up an rtentry that is in the routing tree and + * contains the correct info. + */ + rnh = rt_tables_get_rnh(fibnum, dst->sa_family); + if (rnh == NULL) + /* this table doesn't exist but others might */ + continue; + RIB_RLOCK(rnh); + rn = rnh->rnh_lookup(dst, netmask, &rnh->head); + error = (rn == NULL || + (rn->rn_flags & RNF_ROOT) || + RNTORT(rn)->rt_nhop->nh_ifa != ifa); + RIB_RUNLOCK(rnh); + if (error) { + /* this is only an error if bad on ALL tables */ + continue; + } + } + /* + * Do the actual request + */ + bzero((caddr_t)&info, sizeof(info)); + info.rti_ifa = ifa; + info.rti_flags = flags | + (ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; + info.rti_info[RTAX_DST] = dst; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sdl; + info.rti_info[RTAX_NETMASK] = netmask; + NET_EPOCH_ENTER(et); + error = rib_action(fibnum, cmd, &info, &rc); + if (error == 0 && rc.rc_rt != NULL) { + /* + * notify any listening routing agents of the change + */ + + /* TODO: interface routes/aliases */ + rt_newaddrmsg_fib(cmd, ifa, rc.rc_rt, fibnum); + didwork = 1; + } + NET_EPOCH_EXIT(et); + if (error) + a_failure = error; + } + if (cmd == RTM_DELETE) { + if (didwork) { + error = 0; + } else { + /* we only give an error if it wasn't in any table */ + error = ((flags & RTF_HOST) ? + EHOSTUNREACH : ENETUNREACH); + } + } else { + if (a_failure) { + /* return an error if any of them failed */ + error = a_failure; + } + } + return (error); +} + +/* + * Set up a routing table entry, normally + * for an interface. + */ +int +rtinit(struct ifaddr *ifa, int cmd, int flags) +{ + struct sockaddr *dst; + int fib = RT_DEFAULT_FIB; + + if (flags & RTF_HOST) { + dst = ifa->ifa_dstaddr; + } else { + dst = ifa->ifa_addr; + } + + switch (dst->sa_family) { + case AF_INET6: + case AF_INET: + /* We do support multiple FIBs. */ + fib = RT_ALL_FIBS; + break; + } + return (rtinit1(ifa, cmd, flags, fib)); +} + +static int +ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, + struct sockaddr *ia) +{ + struct rib_cmd_info rc; + struct epoch_tracker et; + int error; + struct rt_addrinfo info; + struct sockaddr_dl null_sdl; + struct ifnet *ifp; + struct ifaddr *rti_ifa = NULL; + + ifp = ifa->ifa_ifp; + + NET_EPOCH_ENTER(et); + bzero(&info, sizeof(info)); + if (cmd != RTM_DELETE) + info.rti_ifp = V_loif; + if (cmd == RTM_ADD) { + /* explicitly specify (loopback) ifa */ + if (info.rti_ifp != NULL) { + rti_ifa = ifaof_ifpforaddr(ifa->ifa_addr, info.rti_ifp); + if (rti_ifa != NULL) + ifa_ref(rti_ifa); + info.rti_ifa = rti_ifa; + } + } + info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED; + info.rti_info[RTAX_DST] = ia; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; + link_init_sdl(ifp, (struct sockaddr *)&null_sdl, ifp->if_type); + + error = rib_action(ifp->if_fib, cmd, &info, &rc); + NET_EPOCH_EXIT(et); + + if (rti_ifa != NULL) + ifa_free(rti_ifa); + + if (error == 0 || + (cmd == RTM_ADD && error == EEXIST) || + (cmd == RTM_DELETE && (error == ENOENT || error == ESRCH))) + return (error); + + log(LOG_DEBUG, "%s: %s failed for interface %s: %u\n", + __func__, otype, if_name(ifp), error); + + return (error); +} + +int +ifa_add_loopback_route(struct ifaddr *ifa, struct sockaddr *ia) +{ + + return (ifa_maintain_loopback_route(RTM_ADD, "insertion", ifa, ia)); +} + +int +ifa_del_loopback_route(struct ifaddr *ifa, struct sockaddr *ia) +{ + + return (ifa_maintain_loopback_route(RTM_DELETE, "deletion", ifa, ia)); +} + +int +ifa_switch_loopback_route(struct ifaddr *ifa, struct sockaddr *ia) +{ + + return (ifa_maintain_loopback_route(RTM_CHANGE, "switch", ifa, ia)); +} + + From owner-svn-src-all@freebsd.org Sun Nov 8 14:08:01 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46269462CA3; Sun, 8 Nov 2020 14:08:01 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTbYs1V3Gz3kps; Sun, 8 Nov 2020 14:08:01 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25B8120C6C; Sun, 8 Nov 2020 14:08:01 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8E81If075806; Sun, 8 Nov 2020 14:08:01 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8E8109075805; Sun, 8 Nov 2020 14:08:01 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <202011081408.0A8E8109075805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 8 Nov 2020 14:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367487 - head/sys/contrib/openzfs/module/os/freebsd/zfs X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/os/freebsd/zfs X-SVN-Commit-Revision: 367487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 14:08:01 -0000 Author: oshogbo Date: Sun Nov 8 14:08:00 2020 New Revision: 367487 URL: https://svnweb.freebsd.org/changeset/base/367487 Log: Check if the ZVOL has been written before calling zil_async_to_sync. The ZIL will be opened on the first write, not earlier. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Mariusz Zaborski OpenZFS Pull Request: https://github.com/openzfs/zfs/pull/11152 PR: 250934 Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c Sun Nov 8 13:30:44 2020 (r367486) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c Sun Nov 8 14:08:00 2020 (r367487) @@ -890,7 +890,8 @@ zvol_cdev_open(struct cdev *dev, int flags, int fmt, s if (flags & (FSYNC | FDSYNC)) { zsd = &zv->zv_zso->zso_dev; zsd->zsd_sync_cnt++; - if (zsd->zsd_sync_cnt == 1) + if (zsd->zsd_sync_cnt == 1 && + (zv->zv_flags & ZVOL_WRITTEN_TO) != 0) zil_async_to_sync(zv->zv_zilog, ZVOL_OBJ); } From owner-svn-src-all@freebsd.org Sun Nov 8 15:55:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 444CF464C75; Sun, 8 Nov 2020 15:55:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTdxJ1Lgrz3qLd; Sun, 8 Nov 2020 15:55:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2116922590; Sun, 8 Nov 2020 15:55:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8Ft0Y4041946; Sun, 8 Nov 2020 15:55:00 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8FsxtL041919; Sun, 8 Nov 2020 15:54:59 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011081554.0A8FsxtL041919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 8 Nov 2020 15:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367488 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 15:55:00 -0000 Author: trasz Date: Sun Nov 8 15:54:59 2020 New Revision: 367488 URL: https://svnweb.freebsd.org/changeset/base/367488 Log: Move syscall_thread_{enter,exit}() into the slow path. This is only needed for syscalls from unloadable modules. Reviewed by: kib MFC after: 2 weeks Sponsored by: EPSRC Differential Revision: https://reviews.freebsd.org/D26988 Modified: head/sys/kern/kern_syscalls.c head/sys/kern/subr_syscall.c head/sys/sys/sysent.h Modified: head/sys/kern/kern_syscalls.c ============================================================================== --- head/sys/kern/kern_syscalls.c Sun Nov 8 14:08:00 2020 (r367487) +++ head/sys/kern/kern_syscalls.c Sun Nov 8 15:54:59 2020 (r367488) @@ -80,10 +80,13 @@ syscall_thread_drain(struct sysent *se) } int -_syscall_thread_enter(struct thread *td, struct sysent *se) +syscall_thread_enter(struct thread *td, struct sysent *se) { u_int32_t cnt, oldcnt; + KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0, + ("%s: not a static syscall", __func__)); + do { oldcnt = se->sy_thrcnt; if ((oldcnt & (SY_THR_DRAINING | SY_THR_ABSENT)) != 0) @@ -94,9 +97,12 @@ _syscall_thread_enter(struct thread *td, struct sysent } void -_syscall_thread_exit(struct thread *td, struct sysent *se) +syscall_thread_exit(struct thread *td, struct sysent *se) { u_int32_t cnt, oldcnt; + + KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0, + ("%s: not a static syscall", __func__)); do { oldcnt = se->sy_thrcnt; Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Sun Nov 8 14:08:00 2020 (r367487) +++ head/sys/kern/subr_syscall.c Sun Nov 8 15:54:59 2020 (r367488) @@ -61,6 +61,7 @@ syscallenter(struct thread *td) struct syscall_args *sa; struct sysent *se; int error, traced; + bool sy_thr_static; VM_CNT_INC(v_syscall); p = td->td_proc; @@ -128,12 +129,6 @@ syscallenter(struct thread *td) } #endif - error = syscall_thread_enter(td, se); - if (error != 0) { - td->td_errno = error; - goto retval; - } - /* * Fetch fast sigblock value at the time of syscall entry to * handle sleepqueue primitives which might call cursig(). @@ -145,8 +140,19 @@ syscallenter(struct thread *td) KASSERT((td->td_pflags & TDP_NERRNO) == 0, ("%s: TDP_NERRNO set", __func__)); + sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0; + if (__predict_false(SYSTRACE_ENABLED() || - AUDIT_SYSCALL_ENTER(sa->code, td))) { + AUDIT_SYSCALL_ENTER(sa->code, td) || + !sy_thr_static)) { + if (!sy_thr_static) { + error = syscall_thread_enter(td, se); + if (error != 0) { + td->td_errno = error; + goto retval; + } + } + #ifdef KDTRACE_HOOKS /* Give the syscall:::entry DTrace probe a chance to fire. */ if (__predict_false(se->sy_entry != 0)) @@ -176,6 +182,9 @@ syscallenter(struct thread *td) (*systrace_probe_func)(sa, SYSTRACE_RETURN, error ? -1 : td->td_retval[0]); #endif + + if (!sy_thr_static) + syscall_thread_exit(td, se); } else { error = (se->sy_call)(td, sa->args); /* Save the latest error return value. */ @@ -184,7 +193,6 @@ syscallenter(struct thread *td) else td->td_errno = error; } - syscall_thread_exit(td, se); retval: KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code), Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sun Nov 8 14:08:00 2020 (r367487) +++ head/sys/sys/sysent.h Sun Nov 8 15:54:59 2020 (r367488) @@ -294,26 +294,8 @@ struct nosys_args; int lkmnosys(struct thread *, struct nosys_args *); int lkmressys(struct thread *, struct nosys_args *); -int _syscall_thread_enter(struct thread *td, struct sysent *se); -void _syscall_thread_exit(struct thread *td, struct sysent *se); - -static inline int -syscall_thread_enter(struct thread *td, struct sysent *se) -{ - - if (__predict_true((se->sy_thrcnt & SY_THR_STATIC) != 0)) - return (0); - return (_syscall_thread_enter(td, se)); -} - -static inline void -syscall_thread_exit(struct thread *td, struct sysent *se) -{ - - if (__predict_true((se->sy_thrcnt & SY_THR_STATIC) != 0)) - return; - _syscall_thread_exit(td, se); -} +int syscall_thread_enter(struct thread *td, struct sysent *se); +void syscall_thread_exit(struct thread *td, struct sysent *se); int shared_page_alloc(int size, int align); int shared_page_fill(int size, int align, const void *data); From owner-svn-src-all@freebsd.org Sun Nov 8 17:10:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CA43466721; Sun, 8 Nov 2020 17:10:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTgc52fn7z3td5; Sun, 8 Nov 2020 17:10:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E10A2338E; Sun, 8 Nov 2020 17:10:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8HADSU085994; Sun, 8 Nov 2020 17:10:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8HADRR085993; Sun, 8 Nov 2020 17:10:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202011081710.0A8HADRR085993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 8 Nov 2020 17:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367489 - stable/12/usr.sbin/mergemaster X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/usr.sbin/mergemaster X-SVN-Commit-Revision: 367489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 17:10:13 -0000 Author: emaste Date: Sun Nov 8 17:10:12 2020 New Revision: 367489 URL: https://svnweb.freebsd.org/changeset/base/367489 Log: MFC r367042: mergemaster: Clarify installed and updated versions Describe "diff installed new" as "Displaying differences between installed and new." Previously mergemaster described them in the opposite order. PR: 249214 Reported by: Yuri Victorovich Modified: stable/12/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/12/usr.sbin/mergemaster/mergemaster.sh Sun Nov 8 15:54:59 2020 (r367488) +++ stable/12/usr.sbin/mergemaster/mergemaster.sh Sun Nov 8 17:10:12 2020 (r367489) @@ -143,7 +143,7 @@ diff_loop () { echo ' ====================================================================== ' echo '' ( - echo " *** Displaying differences between ${COMPFILE} and installed version:" + echo " *** Displaying differences between installed version and ${COMPFILE}:" echo '' diff ${DIFF_FLAG} ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" ) | ${PAGER} From owner-svn-src-all@freebsd.org Sun Nov 8 18:11:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 942112D16BC; Sun, 8 Nov 2020 18:11:12 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CThyS3hfJz4hn0; Sun, 8 Nov 2020 18:11:12 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7178D23DC7; Sun, 8 Nov 2020 18:11:12 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8IBC80043693; Sun, 8 Nov 2020 18:11:12 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8IBClQ043692; Sun, 8 Nov 2020 18:11:12 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011081811.0A8IBClQ043692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 8 Nov 2020 18:11:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367490 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 367490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 18:11:12 -0000 Author: melifaro Date: Sun Nov 8 18:11:12 2020 New Revision: 367490 URL: https://svnweb.freebsd.org/changeset/base/367490 Log: Temporarily revert setting net.add_addr_allfibs to 0. It accidentally sweeped in r367486. Revert to allow for proper commit message & warning. Modified: head/sys/net/route/route_ifaddrs.c Modified: head/sys/net/route/route_ifaddrs.c ============================================================================== --- head/sys/net/route/route_ifaddrs.c Sun Nov 8 17:10:12 2020 (r367489) +++ head/sys/net/route/route_ifaddrs.c Sun Nov 8 18:11:12 2020 (r367490) @@ -61,7 +61,7 @@ * By default, interface address routes are added to the fib of the interface. * Once set to non-zero, adds interface address route to all fibs. */ -VNET_DEFINE(u_int, rt_add_addr_allfibs) = 0; +VNET_DEFINE(u_int, rt_add_addr_allfibs) = 1; SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(rt_add_addr_allfibs), 0, ""); From owner-svn-src-all@freebsd.org Sun Nov 8 18:27:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE2BE2D1F8A; Sun, 8 Nov 2020 18:27:50 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTjKf6T9vz4jQp; Sun, 8 Nov 2020 18:27:50 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCA9B240D2; Sun, 8 Nov 2020 18:27:50 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8IRopB055225; Sun, 8 Nov 2020 18:27:50 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8IRoo6055223; Sun, 8 Nov 2020 18:27:50 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011081827.0A8IRoo6055223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 8 Nov 2020 18:27:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367491 - in head: . sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head: . sys/net/route X-SVN-Commit-Revision: 367491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 18:27:51 -0000 Author: melifaro Date: Sun Nov 8 18:27:49 2020 New Revision: 367491 URL: https://svnweb.freebsd.org/changeset/base/367491 Log: Switch net.add_addr_allfibs default to 0. The goal of the fib support is to provide multiple independent routing tables, isolated from each other. net.add_addr_allfibs default tries to shift gears in the opposite direction, unconditionally inserting all addresses to all of the fibs. There are use cases when this is necessary, however this is not a default expected behaviour, especially compared to other implementations. Provide WARNING message for the setups with multiple fibs to notify potential users of the feature. Differential Revision: https://reviews.freebsd.org/D26076 Modified: head/UPDATING head/sys/net/route/route_ifaddrs.c head/sys/net/route/route_tables.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Nov 8 18:11:12 2020 (r367490) +++ head/UPDATING Sun Nov 8 18:27:49 2020 (r367491) @@ -26,6 +26,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20201108: + Default value of net.add_addr_allfibs has been changed to 0. + If you have multi-fib configuration and rely on existence of all + interface routes in every fib, you need to set the above sysctl to 1. 20201030: The internal pre-processor in the calendar(1) program has been extended to support more C pre-processor commands (e.g. #ifdef, #else, Modified: head/sys/net/route/route_ifaddrs.c ============================================================================== --- head/sys/net/route/route_ifaddrs.c Sun Nov 8 18:11:12 2020 (r367490) +++ head/sys/net/route/route_ifaddrs.c Sun Nov 8 18:27:49 2020 (r367491) @@ -61,7 +61,7 @@ * By default, interface address routes are added to the fib of the interface. * Once set to non-zero, adds interface address route to all fibs. */ -VNET_DEFINE(u_int, rt_add_addr_allfibs) = 1; +VNET_DEFINE(u_int, rt_add_addr_allfibs) = 0; SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(rt_add_addr_allfibs), 0, ""); Modified: head/sys/net/route/route_tables.c ============================================================================== --- head/sys/net/route/route_tables.c Sun Nov 8 18:11:12 2020 (r367490) +++ head/sys/net/route/route_tables.c Sun Nov 8 18:27:49 2020 (r367491) @@ -183,6 +183,11 @@ grow_rtables(uint32_t num_tables) new_rt_tables = mallocarray(num_tables * (AF_MAX + 1), sizeof(void *), M_RTABLE, M_WAITOK | M_ZERO); + if ((num_tables > 1) && (V_rt_add_addr_allfibs == 0)) + printf("WARNING: Adding ifaddrs to all fibs has been turned off " + "by default. Consider tuning %s if needed\n", + "net.add_addr_allfibs"); + /* * Current rt_tables layout: * fib0[af0, af1, af2, .., AF_MAX]fib1[af0, af1, af2, .., Af_MAX].. From owner-svn-src-all@freebsd.org Sun Nov 8 18:47:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A2A92D2513; Sun, 8 Nov 2020 18:47:07 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTjlv0mSfz4jty; Sun, 8 Nov 2020 18:47:07 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03419241D1; Sun, 8 Nov 2020 18:47:07 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8Il6Nq067478; Sun, 8 Nov 2020 18:47:06 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8Il5OE067472; Sun, 8 Nov 2020 18:47:05 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202011081847.0A8Il5OE067472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Sun, 8 Nov 2020 18:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367492 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 367492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 18:47:07 -0000 Author: rscheff Date: Sun Nov 8 18:47:05 2020 New Revision: 367492 URL: https://svnweb.freebsd.org/changeset/base/367492 Log: Prevent premature SACK block transmission during loss recovery Under specific conditions, a window update can be sent with outdated SACK information. Some clients react to this by subsequently delaying loss recovery, making TCP perform very poorly. Reported by: chengc_netapp.com Reviewed by: rrs, jtl MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D24237 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_stacks/rack_bbr_common.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sun Nov 8 18:27:49 2020 (r367491) +++ head/sys/netinet/tcp_input.c Sun Nov 8 18:47:05 2020 (r367492) @@ -1462,6 +1462,29 @@ tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, stru } void +tcp_handle_wakeup(struct tcpcb *tp, struct socket *so) +{ + /* + * Since tp might be gone if the session entered + * the TIME_WAIT state before coming here, we need + * to check if the socket is still connected. + */ + if ((so->so_state & SS_ISCONNECTED) == 0) + return; + INP_LOCK_ASSERT(tp->t_inpcb); + if (tp->t_flags & TF_WAKESOR) { + tp->t_flags &= ~TF_WAKESOR; + SOCKBUF_UNLOCK_ASSERT(&so->so_rcv); + sorwakeup(so); + } + if (tp->t_flags & TF_WAKESOW) { + tp->t_flags &= ~TF_WAKESOW; + SOCKBUF_UNLOCK_ASSERT(&so->so_snd); + sowwakeup(so); + } +} + +void tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos) { @@ -1811,7 +1834,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru else if (!tcp_timer_active(tp, TT_PERSIST)) tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur); - sowwakeup(so); + tp->t_flags |= TF_WAKESOW; if (sbavail(&so->so_snd)) (void) tp->t_fb->tfb_tcp_output(tp); goto check_delack; @@ -1876,8 +1899,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru m_adj(m, drop_hdrlen); /* delayed header drop */ sbappendstream_locked(&so->so_rcv, m, 0); } - /* NB: sorwakeup_locked() does an implicit unlock. */ - sorwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_rcv); + tp->t_flags |= TF_WAKESOR; if (DELAY_ACK(tp, tlen)) { tp->t_flags |= TF_DELACK; } else { @@ -2811,8 +2834,8 @@ process_ACK: tp->snd_wnd = 0; ourfinisacked = 0; } - /* NB: sowwakeup_locked() does an implicit unlock. */ - sowwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_snd); + tp->t_flags |= TF_WAKESOW; m_freem(mfree); /* Detect una wraparound. */ if (!IN_RECOVERY(tp->t_flags) && @@ -3033,8 +3056,8 @@ dodata: /* XXX */ m_freem(m); else sbappendstream_locked(&so->so_rcv, m, 0); - /* NB: sorwakeup_locked() does an implicit unlock. */ - sorwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_rcv); + tp->t_flags |= TF_WAKESOR; } else { /* * XXX: Due to the header drop above "th" is @@ -3101,6 +3124,8 @@ dodata: /* XXX */ if (thflags & TH_FIN) { if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { socantrcvmore(so); + /* The socket upcall is handled by socantrcvmore. */ + tp->t_flags &= ~TF_WAKESOR; /* * If connection is half-synchronized * (ie NEEDSYN flag on) then delay ACK, @@ -3164,6 +3189,7 @@ check_delack: tp->t_flags &= ~TF_DELACK; tcp_timer_activate(tp, TT_DELACK, tcp_delacktime); } + tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); return; @@ -3197,6 +3223,7 @@ dropafterack: TCP_PROBE3(debug__input, tp, th, m); tp->t_flags |= TF_ACKNOW; (void) tp->t_fb->tfb_tcp_output(tp); + tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); m_freem(m); return; @@ -3204,6 +3231,7 @@ dropafterack: dropwithreset: if (tp != NULL) { tcp_dropwithreset(m, th, tp, tlen, rstreason); + tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); } else tcp_dropwithreset(m, th, NULL, tlen, rstreason); @@ -3219,8 +3247,10 @@ drop: &tcp_savetcp, 0); #endif TCP_PROBE3(debug__input, tp, th, m); - if (tp != NULL) + if (tp != NULL) { + tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); + } m_freem(m); } Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Sun Nov 8 18:27:49 2020 (r367491) +++ head/sys/netinet/tcp_reass.c Sun Nov 8 18:47:05 2020 (r367492) @@ -959,7 +959,8 @@ new_entry: } else { sbappendstream_locked(&so->so_rcv, m, 0); } - sorwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_rcv); + tp->t_flags |= TF_WAKESOR; return (flags); } if (tcp_new_limits) { @@ -1107,6 +1108,7 @@ present: #ifdef TCP_REASS_LOGGING tcp_reass_log_dump(tp); #endif - sorwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_rcv); + tp->t_flags |= TF_WAKESOR; return (flags); } Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Sun Nov 8 18:27:49 2020 (r367491) +++ head/sys/netinet/tcp_stacks/bbr.c Sun Nov 8 18:47:05 2020 (r367492) @@ -7876,8 +7876,8 @@ bbr_process_ack(struct mbuf *m, struct tcphdr *th, str acked_amount = min(acked, (int)sbavail(&so->so_snd)); tp->snd_wnd -= acked_amount; mfree = sbcut_locked(&so->so_snd, acked_amount); - /* NB: sowwakeup_locked() does an implicit unlock. */ - sowwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_snd); + tp->t_flags |= TF_WAKESOW; m_freem(mfree); if (SEQ_GT(th->th_ack, tp->snd_una)) { bbr_collapse_rtt(tp, bbr, TCP_REXMTVAL(tp)); @@ -8353,8 +8353,8 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, st appended = #endif sbappendstream_locked(&so->so_rcv, m, 0); - /* NB: sorwakeup_locked() does an implicit unlock. */ - sorwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_rcv); + tp->t_flags |= TF_WAKESOR; #ifdef NETFLIX_SB_LIMITS if (so->so_rcv.sb_shlim && appended != mcnt) counter_fo_release(so->so_rcv.sb_shlim, @@ -8414,6 +8414,8 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, st if (thflags & TH_FIN) { if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { socantrcvmore(so); + /* The socket upcall is handled by socantrcvmore. */ + tp->t_flags &= ~TF_WAKESOR; /* * If connection is half-synchronized (ie NEEDSYN * flag on) then delay ACK, so it may be piggybacked @@ -8604,8 +8606,8 @@ bbr_do_fastnewdata(struct mbuf *m, struct tcphdr *th, sbappendstream_locked(&so->so_rcv, m, 0); ctf_calc_rwin(so, tp); } - /* NB: sorwakeup_locked() does an implicit unlock. */ - sorwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_rcv); + tp->t_flags |= TF_WAKESOR; #ifdef NETFLIX_SB_LIMITS if (so->so_rcv.sb_shlim && mcnt != appended) counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended); @@ -8796,7 +8798,7 @@ bbr_fastack(struct mbuf *m, struct tcphdr *th, struct &tcp_savetcp, 0); #endif /* Wake up the socket if we have room to write more */ - sowwakeup(so); + tp->t_flags |= TF_WAKESOW; if (tp->snd_una == tp->snd_max) { /* Nothing left outstanding */ bbr_log_progress_event(bbr, tp, ticks, PROGRESS_CLEAR, __LINE__); @@ -11740,8 +11742,10 @@ bbr_do_segment(struct mbuf *m, struct tcphdr *th, stru } retval = bbr_do_segment_nounlock(m, th, so, tp, drop_hdrlen, tlen, iptos, 0, &tv); - if (retval == 0) + if (retval == 0) { + tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); + } } /* Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Sun Nov 8 18:27:49 2020 (r367491) +++ head/sys/netinet/tcp_stacks/rack.c Sun Nov 8 18:47:05 2020 (r367492) @@ -8344,8 +8344,8 @@ rack_process_ack(struct mbuf *m, struct tcphdr *th, st */ ourfinisacked = 1; } - /* NB: sowwakeup_locked() does an implicit unlock. */ - sowwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_snd); + tp->t_flags |= TF_WAKESOW; m_freem(mfree); if (rack->r_ctl.rc_early_recovery == 0) { if (IN_RECOVERY(tp->t_flags)) { @@ -8665,8 +8665,8 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, s appended = #endif sbappendstream_locked(&so->so_rcv, m, 0); - /* NB: sorwakeup_locked() does an implicit unlock. */ - sorwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_rcv); + tp->t_flags |= TF_WAKESOR; #ifdef NETFLIX_SB_LIMITS if (so->so_rcv.sb_shlim && appended != mcnt) counter_fo_release(so->so_rcv.sb_shlim, @@ -8731,6 +8731,8 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, s if (thflags & TH_FIN) { if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { socantrcvmore(so); + /* The socket upcall is handled by socantrcvmore. */ + tp->t_flags &= ~TF_WAKESOR; /* * If connection is half-synchronized (ie NEEDSYN * flag on) then delay ACK, so it may be piggybacked @@ -8922,8 +8924,8 @@ rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, sbappendstream_locked(&so->so_rcv, m, 0); ctf_calc_rwin(so, tp); } - /* NB: sorwakeup_locked() does an implicit unlock. */ - sorwakeup_locked(so); + SOCKBUF_UNLOCK(&so->so_rcv); + tp->t_flags |= TF_WAKESOR; #ifdef NETFLIX_SB_LIMITS if (so->so_rcv.sb_shlim && mcnt != appended) counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended); @@ -9140,7 +9142,7 @@ rack_fastack(struct mbuf *m, struct tcphdr *th, struct rack_timer_cancel(tp, rack, rack->r_ctl.rc_rcvtime, __LINE__); } /* Wake up the socket if we have room to write more */ - sowwakeup(so); + tp->t_flags |= TF_WAKESOW; if (sbavail(&so->so_snd)) { rack->r_wanted_output = 1; } @@ -11188,8 +11190,10 @@ rack_do_segment(struct mbuf *m, struct tcphdr *th, str tcp_get_usecs(&tv); } if(rack_do_segment_nounlock(m, th, so, tp, - drop_hdrlen, tlen, iptos, 0, &tv) == 0) + drop_hdrlen, tlen, iptos, 0, &tv) == 0) { + tcp_handle_wakeup(tp, so); INP_WUNLOCK(tp->t_inpcb); + } } struct rack_sendmap * Modified: head/sys/netinet/tcp_stacks/rack_bbr_common.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack_bbr_common.c Sun Nov 8 18:27:49 2020 (r367491) +++ head/sys/netinet/tcp_stacks/rack_bbr_common.c Sun Nov 8 18:47:05 2020 (r367492) @@ -458,6 +458,7 @@ ctf_do_queued_segments(struct socket *so, struct tcpcb /* We lost the tcpcb (maybe a RST came in)? */ return(1); } + tcp_handle_wakeup(tp, so); } return (0); } Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Sun Nov 8 18:27:49 2020 (r367491) +++ head/sys/netinet/tcp_var.h Sun Nov 8 18:47:05 2020 (r367492) @@ -381,7 +381,7 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF_NEEDFIN 0x00000800 /* send FIN (implicit state) */ #define TF_NOPUSH 0x00001000 /* don't push */ #define TF_PREVVALID 0x00002000 /* saved values for bad rxmit valid */ -#define TF_UNUSED1 0x00004000 /* unused */ +#define TF_WAKESOR 0x00004000 /* wake up receive socket */ #define TF_GPUTINPROG 0x00008000 /* Goodput measurement in progress */ #define TF_MORETOCOME 0x00010000 /* More data to be appended to sock */ #define TF_LQ_OVERFLOW 0x00020000 /* listen queue overflow */ @@ -393,9 +393,9 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF_FORCEDATA 0x00800000 /* force out a byte */ #define TF_TSO 0x01000000 /* TSO enabled on this connection */ #define TF_TOE 0x02000000 /* this connection is offloaded */ -#define TF_UNUSED3 0x04000000 /* unused */ -#define TF_UNUSED4 0x08000000 /* unused */ -#define TF_UNUSED5 0x10000000 /* unused */ +#define TF_WAKESOW 0x04000000 /* wake up send socket */ +#define TF_UNUSED1 0x08000000 /* unused */ +#define TF_UNUSED2 0x10000000 /* unused */ #define TF_CONGRECOVERY 0x20000000 /* congestion recovery mode */ #define TF_WASCRECOVERY 0x40000000 /* was in congestion recovery */ #define TF_FASTOPEN 0x80000000 /* TCP Fast Open indication */ @@ -931,7 +931,8 @@ char *tcp_log_addrs(struct in_conninfo *, struct tcphd const void *); char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); -int tcp_reass(struct tcpcb *, struct tcphdr *, tcp_seq *, int *, struct mbuf *); +int tcp_reass(struct tcpcb *, struct tcphdr *, tcp_seq *, int *, + struct mbuf *); void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); void tcp_dooptions(struct tcpopt *, u_char *, int, int); @@ -955,6 +956,7 @@ void hhook_run_tcp_est_in(struct tcpcb *tp, int tcp_input(struct mbuf **, int *, int); int tcp_autorcvbuf(struct mbuf *, struct tcphdr *, struct socket *, struct tcpcb *, int); +void tcp_handle_wakeup(struct tcpcb *, struct socket *); void tcp_do_segment(struct mbuf *, struct tcphdr *, struct socket *, struct tcpcb *, int, int, uint8_t); From owner-svn-src-all@freebsd.org Sun Nov 8 18:49:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 105D82D2624; Sun, 8 Nov 2020 18:49:24 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTjpW75PPz4kSQ; Sun, 8 Nov 2020 18:49:23 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E678124714; Sun, 8 Nov 2020 18:49:23 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8InNKH067650; Sun, 8 Nov 2020 18:49:23 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8InNCR067649; Sun, 8 Nov 2020 18:49:23 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202011081849.0A8InNCR067649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sun, 8 Nov 2020 18:49:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367493 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 367493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 18:49:24 -0000 Author: mhorne Date: Sun Nov 8 18:49:23 2020 New Revision: 367493 URL: https://svnweb.freebsd.org/changeset/base/367493 Log: igmp: convert igmpstat to use PCPU counters Currently there is no locking done to protect this structure. It is likely okay due to the low-volume nature of IGMP, but allows for the possibility of underflow. This appears to be one of the only holdouts of the conversion to counter(9) which was done for most protocol stat structures around 2013. This also updates the visibility of this stats structure so that it can be consumed from elsewhere in the kernel, consistent with the vast majority of VNET_PCPUSTAT structures. Reviewed by: kp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27023 Modified: head/sys/netinet/igmp.c head/sys/netinet/igmp_var.h Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sun Nov 8 18:47:05 2020 (r367492) +++ head/sys/netinet/igmp.c Sun Nov 8 18:49:23 2020 (r367493) @@ -230,16 +230,15 @@ VNET_DEFINE_STATIC(int, current_state_timers_running); #define V_state_change_timers_running VNET(state_change_timers_running) #define V_current_state_timers_running VNET(current_state_timers_running) +VNET_PCPUSTAT_DEFINE(struct igmpstat, igmpstat); +VNET_PCPUSTAT_SYSINIT(igmpstat); +VNET_PCPUSTAT_SYSUNINIT(igmpstat); + VNET_DEFINE_STATIC(LIST_HEAD(, igmp_ifsoftc), igi_head) = LIST_HEAD_INITIALIZER(igi_head); -VNET_DEFINE_STATIC(struct igmpstat, igmpstat) = { - .igps_version = IGPS_VERSION_3, - .igps_len = sizeof(struct igmpstat), -}; VNET_DEFINE_STATIC(struct timeval, igmp_gsrdelay) = {10, 0}; #define V_igi_head VNET(igi_head) -#define V_igmpstat VNET(igmpstat) #define V_igmp_gsrdelay VNET(igmp_gsrdelay) VNET_DEFINE_STATIC(int, igmp_recvifkludge) = 1; @@ -263,7 +262,8 @@ VNET_DEFINE_STATIC(int, igmp_default_version) = IGMP_V */ SYSCTL_PROC(_net_inet_igmp, IGMPCTL_STATS, stats, CTLFLAG_VNET | CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_MPSAFE, - &VNET_NAME(igmpstat), 0, sysctl_igmp_stat, "S,igmpstat", ""); + &VNET_NAME(igmpstat), 0, sysctl_igmp_stat, "S,igmpstat", + "IGMP statistics (struct igmpstat, netinet/igmp_var.h)"); SYSCTL_INT(_net_inet_igmp, OID_AUTO, recvifkludge, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(igmp_recvifkludge), 0, "Rewrite IGMPv1/v2 reports from 0.0.0.0 to contain subnet address"); @@ -347,22 +347,31 @@ sysctl_igmp_stat(SYSCTL_HANDLER_ARGS) int error; char *p; - error = sysctl_wire_old_buffer(req, sizeof(V_igmpstat)); + error = sysctl_wire_old_buffer(req, sizeof(struct igmpstat)); if (error) return (error); if (req->oldptr != NULL) { - if (req->oldlen < sizeof(V_igmpstat)) + if (req->oldlen < sizeof(struct igmpstat)) error = ENOMEM; - else - error = SYSCTL_OUT(req, &V_igmpstat, - sizeof(V_igmpstat)); + else { + /* + * Copy the counters, and explicitly set the struct's + * version and length fields. + */ + COUNTER_ARRAY_COPY(VNET(igmpstat), &igps0, + sizeof(struct igmpstat) / sizeof(uint64_t)); + igps0.igps_version = IGPS_VERSION_3; + igps0.igps_len = IGPS_VERSION3_LEN; + error = SYSCTL_OUT(req, &igps0, + sizeof(struct igmpstat)); + } } else - req->validlen = sizeof(V_igmpstat); + req->validlen = sizeof(struct igmpstat); if (error) goto out; if (req->newptr != NULL) { - if (req->newlen < sizeof(V_igmpstat)) + if (req->newlen < sizeof(struct igmpstat)) error = ENOMEM; else error = SYSCTL_IN(req, &igps0, @@ -379,12 +388,8 @@ sysctl_igmp_stat(SYSCTL_HANDLER_ARGS) error = EINVAL; goto out; } - /* - * Avoid overwrite of the version and length field. - */ - igps0.igps_version = V_igmpstat.igps_version; - igps0.igps_len = V_igmpstat.igps_len; - bcopy(&igps0, &V_igmpstat, sizeof(V_igmpstat)); + COUNTER_ARRAY_ZERO(VNET(igmpstat), + sizeof(struct igmpstat) / sizeof(uint64_t)); } out: return (error); Modified: head/sys/netinet/igmp_var.h ============================================================================== --- head/sys/netinet/igmp_var.h Sun Nov 8 18:47:05 2020 (r367492) +++ head/sys/netinet/igmp_var.h Sun Nov 8 18:49:23 2020 (r367493) @@ -54,6 +54,7 @@ struct igmpstat { /* * Structure header (to insulate ABI changes). + * XXX: unset inside the kernel, exported via sysctl_igmp_stat(). */ uint32_t igps_version; /* version of this structure */ uint32_t igps_len; /* length of this structure */ @@ -184,8 +185,12 @@ struct igmp_ifinfo { }; #ifdef _KERNEL -#define IGMPSTAT_ADD(name, val) V_igmpstat.name += (val) -#define IGMPSTAT_INC(name) IGMPSTAT_ADD(name, 1) +#include + +VNET_PCPUSTAT_DECLARE(struct igmpstat, igmpstat); +#define IGMPSTAT_ADD(name, val) \ + VNET_PCPUSTAT_ADD(struct igmpstat, igmpstat, name, (val)) +#define IGMPSTAT_INC(name) IGMPSTAT_ADD(name, 1) /* * Subsystem lock macros. From owner-svn-src-all@freebsd.org Sun Nov 8 19:02:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B67A82D2A23; Sun, 8 Nov 2020 19:02:22 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTk5V4t0Xz4l1l; Sun, 8 Nov 2020 19:02:22 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A26924B8F; Sun, 8 Nov 2020 19:02:22 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8J2MnF080279; Sun, 8 Nov 2020 19:02:22 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8J2MJs080278; Sun, 8 Nov 2020 19:02:22 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202011081902.0A8J2MJs080278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sun, 8 Nov 2020 19:02:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367494 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 367494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 19:02:22 -0000 Author: mhorne Date: Sun Nov 8 19:02:22 2020 New Revision: 367494 URL: https://svnweb.freebsd.org/changeset/base/367494 Log: Fix definition of rn_addmask() Add the missing static keyword present in the declaration. Reviewed by: melifaro Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27024 Modified: head/sys/net/radix.c Modified: head/sys/net/radix.c ============================================================================== --- head/sys/net/radix.c Sun Nov 8 18:49:23 2020 (r367493) +++ head/sys/net/radix.c Sun Nov 8 19:02:22 2020 (r367494) @@ -483,7 +483,7 @@ on1: return (tt); } -struct radix_node * +static struct radix_node * rn_addmask(void *n_arg, struct radix_mask_head *maskhead, int search, int skip) { unsigned char *netmask = n_arg; From owner-svn-src-all@freebsd.org Sun Nov 8 22:30:14 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C61B2D745E; Sun, 8 Nov 2020 22:30:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTpjL41cmz3BxW; Sun, 8 Nov 2020 22:30:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CBDB26E50; Sun, 8 Nov 2020 22:30:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8MUEBv005329; Sun, 8 Nov 2020 22:30:14 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8MUEeT005328; Sun, 8 Nov 2020 22:30:14 GMT (envelope-from np@FreeBSD.org) Message-Id: <202011082230.0A8MUEeT005328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 8 Nov 2020 22:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367495 - head/sys/dev/cxgbe/firmware X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/firmware X-SVN-Commit-Revision: 367495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 22:30:14 -0000 Author: np Date: Sun Nov 8 22:30:13 2020 New Revision: 367495 URL: https://svnweb.freebsd.org/changeset/base/367495 Log: cxgbe(4): Add the firmware binaries missing in r367428. Obtained from: Chelsio Communications MFC after: 5 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin (contents, props changed) Modified: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin ============================================================================== Binary file (source and/or target). No diff available. From owner-svn-src-all@freebsd.org Sun Nov 8 23:34:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30EAF2E109F; Sun, 8 Nov 2020 23:34:07 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTr730v7jz3Gjj; Sun, 8 Nov 2020 23:34:07 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0697F27BD1; Sun, 8 Nov 2020 23:34:07 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A8NY6XF048257; Sun, 8 Nov 2020 23:34:06 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A8NY6c8048256; Sun, 8 Nov 2020 23:34:06 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202011082334.0A8NY6c8048256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Sun, 8 Nov 2020 23:34:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367496 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 367496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2020 23:34:07 -0000 Author: bdragon Date: Sun Nov 8 23:34:06 2020 New Revision: 367496 URL: https://svnweb.freebsd.org/changeset/base/367496 Log: [PowerPC] Fix powerpc64le boot after HPT superpages addition The HPT is always stored in big-endian, as it is accessed directly by the hardware as well as the kernel. As such, it is necessary to convert values to and from native endian when running on LE. Some unconverted accesses snuck in accidentally with r367417. Apply the appropriate conversions to fix boot hanging on powerpc64le. Sponsored by: Tag1 Consulting, Inc. Modified: head/sys/powerpc/aim/moea64_native.c Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Sun Nov 8 22:30:13 2020 (r367495) +++ head/sys/powerpc/aim/moea64_native.c Sun Nov 8 23:34:06 2020 (r367496) @@ -384,7 +384,7 @@ moea64_pte_clear_native(struct pvo_entry *pvo, uint64_ static __always_inline int64_t moea64_pte_unset_locked(volatile struct lpte *pt, uint64_t vpn) { - uint64_t ptelo; + uint64_t ptelo, ptehi; /* * Invalidate the pte, briefly locking it to collect RC bits. No @@ -392,9 +392,10 @@ moea64_pte_unset_locked(volatile struct lpte *pt, uint */ isync(); critical_enter(); - pt->pte_hi = htobe64((be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED); + ptehi = (be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED; + pt->pte_hi = htobe64(ptehi); PTESYNC(); - TLBIE(vpn, pt->pte_hi); + TLBIE(vpn, ptehi); ptelo = be64toh(pt->pte_lo); *((volatile int32_t *)(&pt->pte_hi) + 1) = 0; /* Release lock */ critical_exit(); @@ -416,7 +417,7 @@ moea64_pte_unset_native(struct pvo_entry *pvo) rw_rlock(&moea64_eviction_lock); - if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) != pvo_ptevpn) { + if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) != pvo_ptevpn) { /* Evicted */ STAT_MOEA64(moea64_pte_overflow--); ret = -1; @@ -433,7 +434,7 @@ moea64_pte_replace_inval_native(struct pvo_entry *pvo, volatile struct lpte *pt) { struct lpte properpt; - uint64_t ptelo; + uint64_t ptelo, ptehi; moea64_pte_from_pvo(pvo, &properpt); @@ -452,9 +453,10 @@ moea64_pte_replace_inval_native(struct pvo_entry *pvo, */ isync(); critical_enter(); - pt->pte_hi = htobe64((be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED); + ptehi = (be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED; + pt->pte_hi = htobe64(ptehi); PTESYNC(); - TLBIE(pvo->pvo_vpn, pt->pte_hi); + TLBIE(pvo->pvo_vpn, ptehi); ptelo = be64toh(pt->pte_lo); EIEIO(); pt->pte_lo = htobe64(properpt.pte_lo); From owner-svn-src-all@freebsd.org Mon Nov 9 00:01:14 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CEA02E1C0F; Mon, 9 Nov 2020 00:01:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTrkL0YwCz3HgZ; Mon, 9 Nov 2020 00:01:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 048AE398; Mon, 9 Nov 2020 00:01:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A901DH9061856; Mon, 9 Nov 2020 00:01:13 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A901DcA061853; Mon, 9 Nov 2020 00:01:13 GMT (envelope-from np@FreeBSD.org) Message-Id: <202011090001.0A901DcA061853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 9 Nov 2020 00:01:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367497 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 367497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 00:01:14 -0000 Author: np Date: Mon Nov 9 00:01:13 2020 New Revision: 367497 URL: https://svnweb.freebsd.org/changeset/base/367497 Log: cxgbev(4): Use the MAC address set by the the PF if there is one. Query the firmware for the MAC address set by the PF for the VF and use it instead of the firmware generated MAC if it's available. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4vf_hw.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Sun Nov 8 23:34:06 2020 (r367496) +++ head/sys/dev/cxgbe/common/common.h Mon Nov 9 00:01:13 2020 (r367497) @@ -912,6 +912,8 @@ int t4vf_get_sge_params(struct adapter *adapter); int t4vf_get_rss_glb_config(struct adapter *adapter); int t4vf_get_vfres(struct adapter *adapter); int t4vf_prep_adapter(struct adapter *adapter); +int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port, + unsigned int *naddr, u8 *addr); int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid, enum t4_bar2_qtype qtype, int user, u64 *pbar2_qoffset, unsigned int *pbar2_qid); Modified: head/sys/dev/cxgbe/common/t4vf_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4vf_hw.c Sun Nov 8 23:34:06 2020 (r367496) +++ head/sys/dev/cxgbe/common/t4vf_hw.c Mon Nov 9 00:01:13 2020 (r367497) @@ -382,3 +382,49 @@ int t4vf_prep_adapter(struct adapter *adapter) return 0; } + +/* + * t4vf_get_vf_mac - Get the MAC address to be set to the VI of this VF. + * @adapter: The adapter + * @port: The port associated with vf + * @naddr: the number of ACL MAC addresses returned in addr + * @addr: Placeholder for MAC addresses + * + * Find the MAC address to be set to the VF's VI. The requested MAC address + * is from the host OS via callback in the PF driver. + */ +int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port, + unsigned int *naddr, u8 *addr) +{ + struct fw_acl_mac_cmd cmd; + int ret; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_ACL_MAC_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_READ); + cmd.en_to_len16 = cpu_to_be32((unsigned int)FW_LEN16(cmd)); + ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &cmd); + if (ret) + return ret; + + if (cmd.nmac < *naddr) + *naddr = cmd.nmac; + + switch (port) { + case 3: + memcpy(addr, cmd.macaddr3, sizeof(cmd.macaddr3)); + break; + case 2: + memcpy(addr, cmd.macaddr2, sizeof(cmd.macaddr2)); + break; + case 1: + memcpy(addr, cmd.macaddr1, sizeof(cmd.macaddr1)); + break; + case 0: + memcpy(addr, cmd.macaddr0, sizeof(cmd.macaddr0)); + break; + } + + return ret; +} Modified: head/sys/dev/cxgbe/t4_vf.c ============================================================================== --- head/sys/dev/cxgbe/t4_vf.c Sun Nov 8 23:34:06 2020 (r367496) +++ head/sys/dev/cxgbe/t4_vf.c Mon Nov 9 00:01:13 2020 (r367497) @@ -481,7 +481,7 @@ static int t4vf_attach(device_t dev) { struct adapter *sc; - int rc = 0, i, j, rqidx, tqidx; + int rc = 0, i, j, rqidx, tqidx, n, p, pmask; struct make_dev_args mda; struct intrs_and_queues iaq; struct sge *s; @@ -618,8 +618,10 @@ t4vf_attach(device_t dev) * First pass over all the ports - allocate VIs and initialize some * basic parameters like mac address, port type, etc. */ + pmask = sc->params.vfres.pmask; for_each_port(sc, i) { struct port_info *pi; + uint8_t mac[ETHER_ADDR_LEN]; pi = malloc(sizeof(*pi), M_CXGBE, M_ZERO | M_WAITOK); sc->port[i] = pi; @@ -644,6 +646,15 @@ t4vf_attach(device_t dev) sc->port[i] = NULL; goto done; } + + /* Prefer the MAC address set by the PF, if there is one. */ + n = 1; + p = ffs(pmask) - 1; + MPASS(p >= 0); + rc = t4vf_get_vf_mac(sc, p, &n, mac); + if (rc == 0 && n == 1) + t4_os_set_hw_addr(pi, mac); + pmask &= ~(1 << p); /* No t4_link_start. */ From owner-svn-src-all@freebsd.org Mon Nov 9 00:04:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35B812E231C; Mon, 9 Nov 2020 00:04:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTrpF16Mvz3JJH; Mon, 9 Nov 2020 00:04:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18EBE2C6; Mon, 9 Nov 2020 00:04:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A904aj4066777; Mon, 9 Nov 2020 00:04:36 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A904Zxe066772; Mon, 9 Nov 2020 00:04:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011090004.0A904Zxe066772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 00:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367498 - in head/sys: compat/linuxkpi/common/src dev/evdev kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/src dev/evdev kern sys X-SVN-Commit-Revision: 367498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 00:04:37 -0000 Author: mjg Date: Mon Nov 9 00:04:35 2020 New Revision: 367498 URL: https://svnweb.freebsd.org/changeset/base/367498 Log: kqueue: save space by using only one func pointer for assertions Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/dev/evdev/uinput.c head/sys/kern/kern_event.c head/sys/kern/uipc_socket.c head/sys/kern/vfs_subr.c head/sys/sys/event.h Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Nov 9 00:01:13 2020 (r367497) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Nov 9 00:04:35 2020 (r367498) @@ -422,26 +422,19 @@ linux_kq_unlock(void *arg) } static void -linux_kq_lock_owned(void *arg) +linux_kq_assert_lock(void *arg, int what) { #ifdef INVARIANTS spinlock_t *s = arg; - mtx_assert(&s->m, MA_OWNED); + if (what == LA_LOCKED) + mtx_assert(&s->m, MA_OWNED); + else + mtx_assert(&s->m, MA_NOTOWNED); #endif } static void -linux_kq_lock_unowned(void *arg) -{ -#ifdef INVARIANTS - spinlock_t *s = arg; - - mtx_assert(&s->m, MA_NOTOWNED); -#endif -} - -static void linux_file_kqfilter_poll(struct linux_file *, int); struct linux_file * @@ -457,8 +450,7 @@ linux_file_alloc(void) /* setup fields needed by kqueue support */ spin_lock_init(&filp->f_kqlock); knlist_init(&filp->f_selinfo.si_note, &filp->f_kqlock, - linux_kq_lock, linux_kq_unlock, - linux_kq_lock_owned, linux_kq_lock_unowned); + linux_kq_lock, linux_kq_unlock, linux_kq_assert_lock); return (filp); } Modified: head/sys/dev/evdev/uinput.c ============================================================================== --- head/sys/dev/evdev/uinput.c Mon Nov 9 00:01:13 2020 (r367497) +++ head/sys/dev/evdev/uinput.c Mon Nov 9 00:04:35 2020 (r367498) @@ -145,20 +145,16 @@ uinput_knlunlock(void *arg) } static void -uinput_knl_assert_locked(void *arg) +uinput_knl_assert_lock(void *arg, int what) { - sx_assert((struct sx*)arg, SA_XLOCKED); + if (what == LA_LOCKED) + sx_assert((struct sx*)arg, SA_XLOCKED); + else + sx_assert((struct sx*)arg, SA_UNLOCKED); } static void -uinput_knl_assert_unlocked(void *arg) -{ - - sx_assert((struct sx*)arg, SA_UNLOCKED); -} - -static void uinput_ev_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, int32_t value) { @@ -212,8 +208,7 @@ uinput_open(struct cdev *dev, int oflags, int devtype, sx_init(&state->ucs_lock, "uinput"); knlist_init(&state->ucs_selp.si_note, &state->ucs_lock, uinput_knllock, - uinput_knlunlock, uinput_knl_assert_locked, - uinput_knl_assert_unlocked); + uinput_knlunlock, uinput_knl_assert_lock); devfs_set_cdevpriv(state, uinput_dtor); return (0); Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Mon Nov 9 00:01:13 2020 (r367497) +++ head/sys/kern/kern_event.c Mon Nov 9 00:04:35 2020 (r367498) @@ -305,10 +305,10 @@ kn_leave_flux(struct knote *kn) } while (0) #ifdef INVARIANTS #define KNL_ASSERT_LOCKED(knl) do { \ - knl->kl_assert_locked((knl)->kl_lockarg); \ + knl->kl_assert_lock((knl)->kl_lockarg, LA_LOCKED); \ } while (0) #define KNL_ASSERT_UNLOCKED(knl) do { \ - knl->kl_assert_unlocked((knl)->kl_lockarg); \ + knl->kl_assert_lock((knl)->kl_lockarg, LA_UNLOCKED); \ } while (0) #else /* !INVARIANTS */ #define KNL_ASSERT_LOCKED(knl) do {} while(0) @@ -2375,20 +2375,16 @@ knlist_mtx_unlock(void *arg) } static void -knlist_mtx_assert_locked(void *arg) +knlist_mtx_assert_lock(void *arg, int what) { - mtx_assert((struct mtx *)arg, MA_OWNED); + if (what == LA_LOCKED) + mtx_assert((struct mtx *)arg, MA_OWNED); + else + mtx_assert((struct mtx *)arg, MA_NOTOWNED); } static void -knlist_mtx_assert_unlocked(void *arg) -{ - - mtx_assert((struct mtx *)arg, MA_NOTOWNED); -} - -static void knlist_rw_rlock(void *arg) { @@ -2403,23 +2399,19 @@ knlist_rw_runlock(void *arg) } static void -knlist_rw_assert_locked(void *arg) +knlist_rw_assert_lock(void *arg, int what) { - rw_assert((struct rwlock *)arg, RA_LOCKED); + if (what == LA_LOCKED) + rw_assert((struct rwlock *)arg, RA_LOCKED); + else + rw_assert((struct rwlock *)arg, RA_UNLOCKED); } -static void -knlist_rw_assert_unlocked(void *arg) -{ - - rw_assert((struct rwlock *)arg, RA_UNLOCKED); -} - void knlist_init(struct knlist *knl, void *lock, void (*kl_lock)(void *), void (*kl_unlock)(void *), - void (*kl_assert_locked)(void *), void (*kl_assert_unlocked)(void *)) + void (*kl_assert_lock)(void *, int)) { if (lock == NULL) @@ -2435,14 +2427,10 @@ knlist_init(struct knlist *knl, void *lock, void (*kl_ knl->kl_unlock = knlist_mtx_unlock; else knl->kl_unlock = kl_unlock; - if (kl_assert_locked == NULL) - knl->kl_assert_locked = knlist_mtx_assert_locked; + if (kl_assert_lock == NULL) + knl->kl_assert_lock = knlist_mtx_assert_lock; else - knl->kl_assert_locked = kl_assert_locked; - if (kl_assert_unlocked == NULL) - knl->kl_assert_unlocked = knlist_mtx_assert_unlocked; - else - knl->kl_assert_unlocked = kl_assert_unlocked; + knl->kl_assert_lock = kl_assert_lock; knl->kl_autodestroy = 0; SLIST_INIT(&knl->kl_list); @@ -2452,7 +2440,7 @@ void knlist_init_mtx(struct knlist *knl, struct mtx *lock) { - knlist_init(knl, lock, NULL, NULL, NULL, NULL); + knlist_init(knl, lock, NULL, NULL, NULL); } struct knlist * @@ -2470,7 +2458,7 @@ knlist_init_rw_reader(struct knlist *knl, struct rwloc { knlist_init(knl, lock, knlist_rw_rlock, knlist_rw_runlock, - knlist_rw_assert_locked, knlist_rw_assert_unlocked); + knlist_rw_assert_lock); } void Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Mon Nov 9 00:01:13 2020 (r367497) +++ head/sys/kern/uipc_socket.c Mon Nov 9 00:04:35 2020 (r367498) @@ -165,12 +165,10 @@ static int soreceive_rcvoob(struct socket *so, struct int flags); static void so_rdknl_lock(void *); static void so_rdknl_unlock(void *); -static void so_rdknl_assert_locked(void *); -static void so_rdknl_assert_unlocked(void *); +static void so_rdknl_assert_lock(void *, int); static void so_wrknl_lock(void *); static void so_wrknl_unlock(void *); -static void so_wrknl_assert_locked(void *); -static void so_wrknl_assert_unlocked(void *); +static void so_wrknl_assert_lock(void *, int); static void filt_sordetach(struct knote *kn); static int filt_soread(struct knote *kn, long hint); @@ -550,9 +548,9 @@ socreate(int dom, struct socket **aso, int type, int p mac_socket_create(cred, so); #endif knlist_init(&so->so_rdsel.si_note, so, so_rdknl_lock, so_rdknl_unlock, - so_rdknl_assert_locked, so_rdknl_assert_unlocked); + so_rdknl_assert_lock); knlist_init(&so->so_wrsel.si_note, so, so_wrknl_lock, so_wrknl_unlock, - so_wrknl_assert_locked, so_wrknl_assert_unlocked); + so_wrknl_assert_lock); /* * Auto-sizing of socket buffers is managed by the protocols and * the appropriate flags must be set in the pru_attach function. @@ -729,9 +727,9 @@ sonewconn(struct socket *head, int connstatus) mac_socket_newconn(head, so); #endif knlist_init(&so->so_rdsel.si_note, so, so_rdknl_lock, so_rdknl_unlock, - so_rdknl_assert_locked, so_rdknl_assert_unlocked); + so_rdknl_assert_lock); knlist_init(&so->so_wrsel.si_note, so, so_wrknl_lock, so_wrknl_unlock, - so_wrknl_assert_locked, so_wrknl_assert_unlocked); + so_wrknl_assert_lock); VNET_SO_ASSERT(head); if (soreserve(so, head->sol_sbsnd_hiwat, head->sol_sbrcv_hiwat)) { sodealloc(so); @@ -823,9 +821,9 @@ sopeeloff(struct socket *head) mac_socket_newconn(head, so); #endif knlist_init(&so->so_rdsel.si_note, so, so_rdknl_lock, so_rdknl_unlock, - so_rdknl_assert_locked, so_rdknl_assert_unlocked); + so_rdknl_assert_lock); knlist_init(&so->so_wrsel.si_note, so, so_wrknl_lock, so_wrknl_unlock, - so_wrknl_assert_locked, so_wrknl_assert_unlocked); + so_wrknl_assert_lock); VNET_SO_ASSERT(head); if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat)) { sodealloc(so); @@ -4189,28 +4187,24 @@ so_rdknl_unlock(void *arg) } static void -so_rdknl_assert_locked(void *arg) +so_rdknl_assert_lock(void *arg, int what) { struct socket *so = arg; - if (SOLISTENING(so)) - SOCK_LOCK_ASSERT(so); - else - SOCKBUF_LOCK_ASSERT(&so->so_rcv); + if (what == LA_LOCKED) { + if (SOLISTENING(so)) + SOCK_LOCK_ASSERT(so); + else + SOCKBUF_LOCK_ASSERT(&so->so_rcv); + } else { + if (SOLISTENING(so)) + SOCK_UNLOCK_ASSERT(so); + else + SOCKBUF_UNLOCK_ASSERT(&so->so_rcv); + } } static void -so_rdknl_assert_unlocked(void *arg) -{ - struct socket *so = arg; - - if (SOLISTENING(so)) - SOCK_UNLOCK_ASSERT(so); - else - SOCKBUF_UNLOCK_ASSERT(&so->so_rcv); -} - -static void so_wrknl_lock(void *arg) { struct socket *so = arg; @@ -4233,25 +4227,21 @@ so_wrknl_unlock(void *arg) } static void -so_wrknl_assert_locked(void *arg) +so_wrknl_assert_lock(void *arg, int what) { struct socket *so = arg; - if (SOLISTENING(so)) - SOCK_LOCK_ASSERT(so); - else - SOCKBUF_LOCK_ASSERT(&so->so_snd); -} - -static void -so_wrknl_assert_unlocked(void *arg) -{ - struct socket *so = arg; - - if (SOLISTENING(so)) - SOCK_UNLOCK_ASSERT(so); - else - SOCKBUF_UNLOCK_ASSERT(&so->so_snd); + if (what == LA_LOCKED) { + if (SOLISTENING(so)) + SOCK_LOCK_ASSERT(so); + else + SOCKBUF_LOCK_ASSERT(&so->so_snd); + } else { + if (SOLISTENING(so)) + SOCK_UNLOCK_ASSERT(so); + else + SOCKBUF_UNLOCK_ASSERT(&so->so_snd); + } } /* Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Nov 9 00:01:13 2020 (r367497) +++ head/sys/kern/vfs_subr.c Mon Nov 9 00:04:35 2020 (r367498) @@ -112,8 +112,7 @@ static void vgonel(struct vnode *); static bool vhold_recycle_free(struct vnode *); static void vfs_knllock(void *arg); static void vfs_knlunlock(void *arg); -static void vfs_knl_assert_locked(void *arg); -static void vfs_knl_assert_unlocked(void *arg); +static void vfs_knl_assert_lock(void *arg, int what); static void destroy_vpollinfo(struct vpollinfo *vi); static int v_inval_buf_range_locked(struct vnode *vp, struct bufobj *bo, daddr_t startlbn, daddr_t endlbn); @@ -4811,7 +4810,7 @@ v_addpollinfo(struct vnode *vp) vi = malloc(sizeof(*vi), M_VNODEPOLL, M_WAITOK | M_ZERO); mtx_init(&vi->vpi_lock, "vnode pollinfo", NULL, MTX_DEF); knlist_init(&vi->vpi_selinfo.si_note, vp, vfs_knllock, - vfs_knlunlock, vfs_knl_assert_locked, vfs_knl_assert_unlocked); + vfs_knlunlock, vfs_knl_assert_lock); VI_LOCK(vp); if (vp->v_pollinfo != NULL) { VI_UNLOCK(vp); @@ -6060,22 +6059,15 @@ vfs_knlunlock(void *arg) } static void -vfs_knl_assert_locked(void *arg) +vfs_knl_assert_lock(void *arg, int what) { #ifdef DEBUG_VFS_LOCKS struct vnode *vp = arg; - ASSERT_VOP_LOCKED(vp, "vfs_knl_assert_locked"); -#endif -} - -static void -vfs_knl_assert_unlocked(void *arg) -{ -#ifdef DEBUG_VFS_LOCKS - struct vnode *vp = arg; - - ASSERT_VOP_UNLOCKED(vp, "vfs_knl_assert_unlocked"); + if (what == LA_LOCKED) + ASSERT_VOP_LOCKED(vp, "vfs_knl_assert_locked"); + else + ASSERT_VOP_UNLOCKED(vp, "vfs_knl_assert_unlocked"); #endif } Modified: head/sys/sys/event.h ============================================================================== --- head/sys/sys/event.h Mon Nov 9 00:01:13 2020 (r367497) +++ head/sys/sys/event.h Mon Nov 9 00:04:35 2020 (r367498) @@ -224,8 +224,7 @@ struct knlist { struct klist kl_list; void (*kl_lock)(void *); /* lock function */ void (*kl_unlock)(void *); - void (*kl_assert_locked)(void *); - void (*kl_assert_unlocked)(void *); + void (*kl_assert_lock)(void *, int); void *kl_lockarg; /* argument passed to lock functions */ int kl_autodestroy; }; @@ -334,8 +333,7 @@ void knlist_add(struct knlist *knl, struct knote *kn, void knlist_remove(struct knlist *knl, struct knote *kn, int islocked); int knlist_empty(struct knlist *knl); void knlist_init(struct knlist *knl, void *lock, void (*kl_lock)(void *), - void (*kl_unlock)(void *), void (*kl_assert_locked)(void *), - void (*kl_assert_unlocked)(void *)); + void (*kl_unlock)(void *), void (*kl_assert_lock)(void *, int)); void knlist_init_mtx(struct knlist *knl, struct mtx *lock); void knlist_init_rw_reader(struct knlist *knl, struct rwlock *lock); void knlist_destroy(struct knlist *knl); From owner-svn-src-all@freebsd.org Mon Nov 9 00:04:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 381142E1FD4; Mon, 9 Nov 2020 00:04:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTrpg15Pkz3JgF; Mon, 9 Nov 2020 00:04:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1820B22E; Mon, 9 Nov 2020 00:04:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A904wIG066836; Mon, 9 Nov 2020 00:04:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A904wDw066835; Mon, 9 Nov 2020 00:04:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011090004.0A904wDw066835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 00:04:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367499 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 367499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 00:04:59 -0000 Author: mjg Date: Mon Nov 9 00:04:58 2020 New Revision: 367499 URL: https://svnweb.freebsd.org/changeset/base/367499 Log: bufcache: convert bo_numoutput from long to int int is wide enough and it plugs a hole in struct vnode, taking it down from 496 to 488 bytes. Modified: head/sys/sys/bufobj.h Modified: head/sys/sys/bufobj.h ============================================================================== --- head/sys/sys/bufobj.h Mon Nov 9 00:04:35 2020 (r367498) +++ head/sys/sys/bufobj.h Mon Nov 9 00:04:58 2020 (r367499) @@ -104,7 +104,7 @@ struct bufobj { void *bo_private; /* private pointer */ struct bufv bo_clean; /* i Clean buffers */ struct bufv bo_dirty; /* i Dirty buffers */ - long bo_numoutput; /* i Writes in progress */ + int bo_numoutput; /* i Writes in progress */ u_int bo_flag; /* i Flags */ int bo_domain; /* - Clean queue affinity */ int bo_bsize; /* - Block size for i/o */ From owner-svn-src-all@freebsd.org Mon Nov 9 00:05:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C4A22E24A5; Mon, 9 Nov 2020 00:05:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTrq60ZQbz3Jn7; Mon, 9 Nov 2020 00:05:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 054273B4; Mon, 9 Nov 2020 00:05:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A905Lpk066912; Mon, 9 Nov 2020 00:05:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A905Lqd066911; Mon, 9 Nov 2020 00:05:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011090005.0A905Lqd066911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 00:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367500 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 00:05:22 -0000 Author: mjg Date: Mon Nov 9 00:05:21 2020 New Revision: 367500 URL: https://svnweb.freebsd.org/changeset/base/367500 Log: procdesc: convert the zone to a malloc type The object is 128 bytes in size. Modified: head/sys/kern/sys_procdesc.c Modified: head/sys/kern/sys_procdesc.c ============================================================================== --- head/sys/kern/sys_procdesc.c Mon Nov 9 00:04:58 2020 (r367499) +++ head/sys/kern/sys_procdesc.c Mon Nov 9 00:05:21 2020 (r367500) @@ -92,7 +92,7 @@ __FBSDID("$FreeBSD$"); FEATURE(process_descriptors, "Process Descriptors"); -static uma_zone_t procdesc_zone; +MALLOC_DEFINE(M_PROCDESC, "procdesc", "process descriptors"); static fo_poll_t procdesc_poll; static fo_kqfilter_t procdesc_kqfilter; @@ -117,22 +117,6 @@ static struct fileops procdesc_ops = { }; /* - * Initialize with VFS so that process descriptors are available along with - * other file descriptor types. As long as it runs before init(8) starts, - * there shouldn't be a problem. - */ -static void -procdesc_init(void *dummy __unused) -{ - - procdesc_zone = uma_zcreate("procdesc", sizeof(struct procdesc), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - if (procdesc_zone == NULL) - panic("procdesc_init: procdesc_zone not initialized"); -} -SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_ANY, procdesc_init, NULL); - -/* * Return a locked process given a process descriptor, or ESRCH if it has * died. */ @@ -229,7 +213,7 @@ procdesc_new(struct proc *p, int flags) { struct procdesc *pd; - pd = uma_zalloc(procdesc_zone, M_WAITOK | M_ZERO); + pd = malloc(sizeof(*pd), M_PROCDESC, M_WAITOK | M_ZERO); pd->pd_proc = p; pd->pd_pid = p->p_pid; p->p_procdesc = pd; @@ -290,7 +274,7 @@ procdesc_free(struct procdesc *pd) knlist_destroy(&pd->pd_selinfo.si_note); PROCDESC_LOCK_DESTROY(pd); - uma_zfree(procdesc_zone, pd); + free(pd, M_PROCDESC); } } From owner-svn-src-all@freebsd.org Mon Nov 9 00:05:46 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 642032E2593; Mon, 9 Nov 2020 00:05:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTrqZ2KMDz3JtL; Mon, 9 Nov 2020 00:05:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42E7F4B6; Mon, 9 Nov 2020 00:05:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A905kZ9066983; Mon, 9 Nov 2020 00:05:46 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A905ku9066982; Mon, 9 Nov 2020 00:05:46 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011090005.0A905ku9066982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 00:05:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367501 - head/usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/usr.bin/vmstat X-SVN-Commit-Revision: 367501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 00:05:46 -0000 Author: mjg Date: Mon Nov 9 00:05:45 2020 New Revision: 367501 URL: https://svnweb.freebsd.org/changeset/base/367501 Log: vmstat: remove spurious newlines when reporting zones Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Mon Nov 9 00:05:21 2020 (r367500) +++ head/usr.bin/vmstat/vmstat.c Mon Nov 9 00:05:45 2020 (r367501) @@ -1500,7 +1500,7 @@ domemstat_zone(void) } xo_open_container("memory-zone-statistics"); xo_emit("{T:/%-20s} {T:/%6s} {T:/%6s} {T:/%8s} {T:/%8s} {T:/%8s} {T:/%8s}" - "{T:/%4s} {T:/%4s}\n\n", "ITEM", "SIZE", + "{T:/%4s} {T:/%4s}\n", "ITEM", "SIZE", "LIMIT", "USED", "FREE", "REQ", "FAIL", "SLEEP", "XDOMAIN"); xo_open_list("zone"); for (mtp = memstat_mtl_first(mtlp); mtp != NULL; @@ -1526,7 +1526,6 @@ domemstat_zone(void) memstat_mtl_free(mtlp); xo_close_list("zone"); xo_close_container("memory-zone-statistics"); - xo_emit("\n"); } static void From owner-svn-src-all@freebsd.org Mon Nov 9 00:08:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 810082E2756; Mon, 9 Nov 2020 00:08:36 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTrtr3FX4z3KGF; Mon, 9 Nov 2020 00:08:36 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E06F27CDE; Mon, 9 Nov 2020 00:08:36 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A908aps067154; Mon, 9 Nov 2020 00:08:36 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A908ZwL067151; Mon, 9 Nov 2020 00:08:35 GMT (envelope-from np@FreeBSD.org) Message-Id: <202011090008.0A908ZwL067151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 9 Nov 2020 00:08:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367502 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 367502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 00:08:36 -0000 Author: np Date: Mon Nov 9 00:08:35 2020 New Revision: 367502 URL: https://svnweb.freebsd.org/changeset/base/367502 Log: cxgbe(4): Allow the PF driver to set a VF's MAC address. The MAC address can be set with the optional mac-addr property in the VF section of the iovctl.conf(5) used to instantiate the VFs. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_iov.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Mon Nov 9 00:05:45 2020 (r367501) +++ head/sys/dev/cxgbe/common/common.h Mon Nov 9 00:08:35 2020 (r367502) @@ -691,6 +691,8 @@ void t4_idma_monitor_init(struct adapter *adapter, void t4_idma_monitor(struct adapter *adapter, struct sge_idma_monitor_state *idma, int hz, int ticks); +int t4_set_vf_mac(struct adapter *adapter, unsigned int pf, unsigned int vf, + unsigned int naddr, u8 *addr); unsigned int t4_get_regs_len(struct adapter *adapter); void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size); Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Mon Nov 9 00:05:45 2020 (r367501) +++ head/sys/dev/cxgbe/common/t4_hw.c Mon Nov 9 00:08:35 2020 (r367502) @@ -10202,6 +10202,48 @@ void t4_idma_monitor(struct adapter *adapter, } /** + * t4_set_vf_mac - Set MAC address for the specified VF + * @adapter: The adapter + * @pf: the PF used to instantiate the VFs + * @vf: one of the VFs instantiated by the specified PF + * @naddr: the number of MAC addresses + * @addr: the MAC address(es) to be set to the specified VF + */ +int t4_set_vf_mac(struct adapter *adapter, unsigned int pf, unsigned int vf, + unsigned int naddr, u8 *addr) +{ + struct fw_acl_mac_cmd cmd; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_ACL_MAC_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE | + V_FW_ACL_MAC_CMD_PFN(pf) | + V_FW_ACL_MAC_CMD_VFN(vf)); + + /* Note: Do not enable the ACL */ + cmd.en_to_len16 = cpu_to_be32((unsigned int)FW_LEN16(cmd)); + cmd.nmac = naddr; + + switch (pf) { + case 3: + memcpy(cmd.macaddr3, addr, sizeof(cmd.macaddr3)); + break; + case 2: + memcpy(cmd.macaddr2, addr, sizeof(cmd.macaddr2)); + break; + case 1: + memcpy(cmd.macaddr1, addr, sizeof(cmd.macaddr1)); + break; + case 0: + memcpy(cmd.macaddr0, addr, sizeof(cmd.macaddr0)); + break; + } + + return t4_wr_mbox(adapter, adapter->mbox, &cmd, sizeof(cmd), &cmd); +} + +/** * t4_read_pace_tbl - read the pace table * @adap: the adapter * @pace_vals: holds the returned values Modified: head/sys/dev/cxgbe/t4_iov.c ============================================================================== --- head/sys/dev/cxgbe/t4_iov.c Mon Nov 9 00:05:45 2020 (r367501) +++ head/sys/dev/cxgbe/t4_iov.c Mon Nov 9 00:08:35 2020 (r367502) @@ -42,12 +42,19 @@ __FBSDID("$FreeBSD$"); #endif #include "common/common.h" +#include "common/t4_regs.h" #include "t4_if.h" struct t4iov_softc { device_t sc_dev; device_t sc_main; bool sc_attached; + + int pf; + int regs_rid; + struct resource *regs_res; + bus_space_handle_t bh; + bus_space_tag_t bt; }; struct { @@ -113,6 +120,13 @@ struct { {0x6087, "Chelsio T6225-CR 87"}, }; +static inline uint32_t +t4iov_read_reg(struct t4iov_softc *sc, uint32_t reg) +{ + + return bus_space_read_4(sc->bt, sc->bh, reg); +} + static int t4iov_attach_child(device_t dev); static int @@ -179,10 +193,28 @@ static int t4iov_attach(device_t dev) { struct t4iov_softc *sc; + uint32_t pl_rev, whoami; sc = device_get_softc(dev); sc->sc_dev = dev; + sc->regs_rid = PCIR_BAR(0); + sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->regs_rid, RF_ACTIVE); + if (sc->regs_res == NULL) { + device_printf(dev, "cannot map registers.\n"); + return (ENXIO); + } + sc->bt = rman_get_bustag(sc->regs_res); + sc->bh = rman_get_bushandle(sc->regs_res); + + pl_rev = t4iov_read_reg(sc, A_PL_REV); + whoami = t4iov_read_reg(sc, A_PL_WHOAMI); + if (G_CHIPID(pl_rev) <= CHELSIO_T5) + sc->pf = G_SOURCEPF(whoami); + else + sc->pf = G_T6_SOURCEPF(whoami); + sc->sc_main = pci_find_dbsf(pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev), 4); if (sc->sc_main == NULL) @@ -218,6 +250,7 @@ t4iov_attach_child(device_t dev) #ifdef PCI_IOV pf_schema = pci_iov_schema_alloc_node(); vf_schema = pci_iov_schema_alloc_node(); + pci_iov_schema_add_unicast_mac(vf_schema, "mac-addr", 0, NULL); error = pci_iov_attach_name(dev, pf_schema, vf_schema, "%s", device_get_nameunit(pdev)); if (error) { @@ -266,6 +299,10 @@ t4iov_detach(device_t dev) if (error) return (error); } + if (sc->regs_res) { + bus_release_resource(dev, SYS_RES_MEMORY, sc->regs_rid, + sc->regs_res); + } return (0); } @@ -286,6 +323,34 @@ t4iov_iov_uninit(device_t dev) static int t4iov_add_vf(device_t dev, uint16_t vfnum, const struct nvlist *config) { + const void *mac; + struct t4iov_softc *sc; + struct adapter *adap; + uint8_t ma[ETHER_ADDR_LEN]; + size_t size; + int rc; + + if (nvlist_exists_binary(config, "mac-addr")) { + mac = nvlist_get_binary(config, "mac-addr", &size); + bcopy(mac, ma, ETHER_ADDR_LEN); + + sc = device_get_softc(dev); + MPASS(sc->sc_attached); + MPASS(sc->sc_main != NULL); + adap = device_get_softc(sc->sc_main); + if (begin_synchronized_op(adap, NULL, SLEEP_OK | INTR_OK, + "t4vfma") != 0) + return (ENXIO); + rc = -t4_set_vf_mac(adap, sc->pf, vfnum + 1, 1, ma); + end_synchronized_op(adap, 0); + if (rc != 0) { + device_printf(dev, + "Failed to set VF%d MAC address to " + "%02x:%02x:%02x:%02x:%02x:%02x, rc = %d\n", vfnum, + ma[0], ma[1], ma[2], ma[3], ma[4], ma[5], rc); + return (rc); + } + } return (0); } From owner-svn-src-all@freebsd.org Mon Nov 9 00:34:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31A332E3113; Mon, 9 Nov 2020 00:34:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTsSc0nCqz3Ljd; Mon, 9 Nov 2020 00:34:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D8749B2; Mon, 9 Nov 2020 00:34:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A90YNN2085268; Mon, 9 Nov 2020 00:34:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A90YNbE085267; Mon, 9 Nov 2020 00:34:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011090034.0A90YNbE085267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 00:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367503 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 367503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 00:34:24 -0000 Author: mjg Date: Mon Nov 9 00:34:23 2020 New Revision: 367503 URL: https://svnweb.freebsd.org/changeset/base/367503 Log: Add more per-cpu zones. This covers powers of 2 up to 64. Example pending user is ZFS. Modified: head/sys/kern/subr_pcpu.c head/sys/vm/uma.h Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Mon Nov 9 00:08:35 2020 (r367502) +++ head/sys/kern/subr_pcpu.c Mon Nov 9 00:34:23 2020 (r367503) @@ -133,17 +133,25 @@ SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_start /* * UMA_ZONE_PCPU zones for general kernel use. */ - uma_zone_t pcpu_zone_4; uma_zone_t pcpu_zone_8; +uma_zone_t pcpu_zone_16; +uma_zone_t pcpu_zone_32; +uma_zone_t pcpu_zone_64; static void pcpu_zones_startup(void) { - pcpu_zone_4 = uma_zcreate("pcpu-4", sizeof(uint32_t), + pcpu_zone_4 = uma_zcreate("pcpu-4", 4, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); - pcpu_zone_8 = uma_zcreate("pcpu-8", sizeof(uint64_t), + pcpu_zone_8 = uma_zcreate("pcpu-8", 8, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); + pcpu_zone_16 = uma_zcreate("pcpu-16", 16, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); + pcpu_zone_32 = uma_zcreate("pcpu-32", 32, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); + pcpu_zone_64 = uma_zcreate("pcpu-64", 64, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); } SYSINIT(pcpu_zones, SI_SUB_COUNTER, SI_ORDER_FIRST, pcpu_zones_startup, NULL); Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Mon Nov 9 00:08:35 2020 (r367502) +++ head/sys/vm/uma.h Mon Nov 9 00:34:23 2020 (r367503) @@ -668,6 +668,9 @@ size_t uma_zone_memory(uma_zone_t zone); */ extern uma_zone_t pcpu_zone_4; extern uma_zone_t pcpu_zone_8; +extern uma_zone_t pcpu_zone_16; +extern uma_zone_t pcpu_zone_32; +extern uma_zone_t pcpu_zone_64; /* * Exported statistics structures to be used by user space monitoring tools. From owner-svn-src-all@freebsd.org Mon Nov 9 00:39:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66A9A2E346B; Mon, 9 Nov 2020 00:39:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTsZs2RQDz3Lqs; Mon, 9 Nov 2020 00:39:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 468A1B06; Mon, 9 Nov 2020 00:39:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A90dnlY085681; Mon, 9 Nov 2020 00:39:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A90dnCh085680; Mon, 9 Nov 2020 00:39:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011090039.0A90dnCh085680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 9 Nov 2020 00:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367504 - stable/12/sbin/ifconfig X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sbin/ifconfig X-SVN-Commit-Revision: 367504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 00:39:49 -0000 Author: kib Date: Mon Nov 9 00:39:48 2020 New Revision: 367504 URL: https://svnweb.freebsd.org/changeset/base/367504 Log: MFC r367285: ifconfig: properly detect invalid mediaopt keywords. Modified: stable/12/sbin/ifconfig/ifmedia.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ifconfig/ifmedia.c ============================================================================== --- stable/12/sbin/ifconfig/ifmedia.c Mon Nov 9 00:34:23 2020 (r367503) +++ stable/12/sbin/ifconfig/ifmedia.c Mon Nov 9 00:39:48 2020 (r367504) @@ -566,7 +566,7 @@ get_media_options(int type, const char *val) struct ifmedia_description *desc; struct ifmedia_type_to_subtype *ttos; char *optlist, *optptr; - int option = 0, i, rval = 0; + int option, i, rval = 0; /* We muck with the string, so copy it. */ optlist = strdup(val); @@ -587,12 +587,13 @@ get_media_options(int type, const char *val) */ optptr = optlist; for (; (optptr = strtok(optptr, ",")) != NULL; optptr = NULL) { + option = -1; for (i = 0; ttos->options[i].desc != NULL; i++) { option = lookup_media_word(ttos->options[i].desc, optptr); if (option != -1) break; } - if (option == 0) + if (option == -1) errx(1, "unknown option: %s", optptr); rval |= option; } From owner-svn-src-all@freebsd.org Mon Nov 9 01:13:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADDE92E3B6C; Mon, 9 Nov 2020 01:13:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTtKh4YGCz3N2j; Mon, 9 Nov 2020 01:13:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EE13E7C; Mon, 9 Nov 2020 01:13:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A91DSV2010221; Mon, 9 Nov 2020 01:13:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A91DSg5010220; Mon, 9 Nov 2020 01:13:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011090113.0A91DSg5010220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 9 Nov 2020 01:13:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367505 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 01:13:28 -0000 Author: mav Date: Mon Nov 9 01:13:28 2020 New Revision: 367505 URL: https://svnweb.freebsd.org/changeset/base/367505 Log: MFC r367052: Enable bioq 'car limit' added at r335066 at 128 bios. Without the 'car limit' enabled (before this), running sequential ZFS scrub on HDD without command queuing support, I've measured latency on concurrent random reads reaching 4 seconds (surprised that not more). Enabling this reduced the latency to 65 milliseconds, while scrub still doing ~180MB/s. For disks with command queuing this does not make much difference (if any), since most time all the requests are queued down to the disk or HBA, leaving nothing in the queue to sort. And even if something does not fit, staying on the queue, it is likely not for long. To not limit sorting in such bursty scenarios I've added batched counter zeroing when the queue is getting empty. The internal scheduler of the SAS HDD I was testing seems to be even more loyal to random I/O, reducing the scrub speed to ~120MB/s. So in case somebody worried this is limit is too strict -- it actually looks relaxed. Modified: stable/12/sys/kern/subr_disk.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_disk.c ============================================================================== --- stable/12/sys/kern/subr_disk.c Mon Nov 9 00:39:48 2020 (r367504) +++ stable/12/sys/kern/subr_disk.c Mon Nov 9 01:13:28 2020 (r367505) @@ -26,7 +26,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int bioq_batchsize = 0; +static int bioq_batchsize = 128; SYSCTL_INT(_debug, OID_AUTO, bioq_batchsize, CTLFLAG_RW, &bioq_batchsize, 0, "BIOQ batch size"); @@ -172,6 +172,8 @@ bioq_remove(struct bio_queue_head *head, struct bio *b head->insert_point = NULL; TAILQ_REMOVE(&head->queue, bp, bio_queue); + if (TAILQ_EMPTY(&head->queue)) + head->batched = 0; head->total--; } From owner-svn-src-all@freebsd.org Mon Nov 9 01:14:23 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC0882E3C44; Mon, 9 Nov 2020 01:14:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTtLl4yDrz3N0c; Mon, 9 Nov 2020 01:14:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93663ECB; Mon, 9 Nov 2020 01:14:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A91ENH3010318; Mon, 9 Nov 2020 01:14:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A91ENJL010315; Mon, 9 Nov 2020 01:14:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011090114.0A91ENJL010315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 9 Nov 2020 01:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367506 - in stable/12/sys: cam dev/ahci dev/siis X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: cam dev/ahci dev/siis X-SVN-Commit-Revision: 367506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 01:14:23 -0000 Author: mav Date: Mon Nov 9 01:14:22 2020 New Revision: 367506 URL: https://svnweb.freebsd.org/changeset/base/367506 Log: MFC r367261: Add icc (Isochronous Command Completion) ccb_ataio field. Modified: stable/12/sys/cam/cam_ccb.h stable/12/sys/dev/ahci/ahci.c stable/12/sys/dev/siis/siis.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_ccb.h ============================================================================== --- stable/12/sys/cam/cam_ccb.h Mon Nov 9 01:13:28 2020 (r367505) +++ stable/12/sys/cam/cam_ccb.h Mon Nov 9 01:14:22 2020 (r367506) @@ -785,6 +785,8 @@ struct ccb_ataio { u_int32_t resid; /* Transfer residual length: 2's comp */ u_int8_t ata_flags; /* Flags for the rest of the buffer */ #define ATA_FLAG_AUX 0x1 +#define ATA_FLAG_ICC 0x2 + uint8_t icc; /* Isochronous Command Completion */ uint32_t aux; uint32_t unused; }; Modified: stable/12/sys/dev/ahci/ahci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci.c Mon Nov 9 01:13:28 2020 (r367505) +++ stable/12/sys/dev/ahci/ahci.c Mon Nov 9 01:14:22 2020 (r367506) @@ -2585,15 +2585,17 @@ ahci_setup_fis(struct ahci_channel *ch, struct ahci_cm fis[12] = ccb->ataio.cmd.sector_count; } fis[13] = ccb->ataio.cmd.sector_count_exp; + if (ccb->ataio.ata_flags & ATA_FLAG_ICC) + fis[14] = ccb->ataio.icc; fis[15] = ATA_A_4BIT; + if (ccb->ataio.ata_flags & ATA_FLAG_AUX) { + fis[16] = ccb->ataio.aux & 0xff; + fis[17] = (ccb->ataio.aux >> 8) & 0xff; + fis[18] = (ccb->ataio.aux >> 16) & 0xff; + fis[19] = (ccb->ataio.aux >> 24) & 0xff; + } } else { fis[15] = ccb->ataio.cmd.control; - } - if (ccb->ataio.ata_flags & ATA_FLAG_AUX) { - fis[16] = ccb->ataio.aux & 0xff; - fis[17] = (ccb->ataio.aux >> 8) & 0xff; - fis[18] = (ccb->ataio.aux >> 16) & 0xff; - fis[19] = (ccb->ataio.aux >> 24) & 0xff; } return (20); } Modified: stable/12/sys/dev/siis/siis.c ============================================================================== --- stable/12/sys/dev/siis/siis.c Mon Nov 9 01:13:28 2020 (r367505) +++ stable/12/sys/dev/siis/siis.c Mon Nov 9 01:14:22 2020 (r367506) @@ -1729,6 +1729,8 @@ siis_setup_fis(device_t dev, struct siis_cmd *ctp, uni fis[12] = ccb->ataio.cmd.sector_count; fis[13] = ccb->ataio.cmd.sector_count_exp; } + if (ccb->ataio.ata_flags & ATA_FLAG_ICC) + fis[14] = ccb->ataio.icc; fis[15] = ATA_A_4BIT; if (ccb->ataio.ata_flags & ATA_FLAG_AUX) { fis[16] = ccb->ataio.aux & 0xff; From owner-svn-src-all@freebsd.org Mon Nov 9 01:38:03 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4D2C2E460F; Mon, 9 Nov 2020 01:38:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTtt33vn7z3Nr0; Mon, 9 Nov 2020 01:38:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 746A6106D; Mon, 9 Nov 2020 01:38:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A91c3PF023136; Mon, 9 Nov 2020 01:38:03 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A91c39G023133; Mon, 9 Nov 2020 01:38:03 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202011090138.0A91c39G023133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Nov 2020 01:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367507 - in stable/12: share/man/man4 sys/dev/arcmsr X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/arcmsr X-SVN-Commit-Revision: 367507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 01:38:03 -0000 Author: delphij Date: Mon Nov 9 01:38:02 2020 New Revision: 367507 URL: https://svnweb.freebsd.org/changeset/base/367507 Log: MFC r358477,365113,366767: arcmsr(4) 1.50.00.00. Modified: stable/12/share/man/man4/arcmsr.4 stable/12/sys/dev/arcmsr/arcmsr.c stable/12/sys/dev/arcmsr/arcmsr.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/arcmsr.4 ============================================================================== --- stable/12/share/man/man4/arcmsr.4 Mon Nov 9 01:14:22 2020 (r367506) +++ stable/12/share/man/man4/arcmsr.4 Mon Nov 9 01:38:02 2020 (r367507) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2017 +.Dd October 15, 2020 .Dt ARCMSR 4 .Os .Sh NAME @@ -153,6 +153,8 @@ ARC-1882 ARC-1883 .It ARC-1884 +.It +ARC-1886 .El .Sh FILES .Bl -tag -width ".Pa /dev/arcmsr?" -compact Modified: stable/12/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/12/sys/dev/arcmsr/arcmsr.c Mon Nov 9 01:14:22 2020 (r367506) +++ stable/12/sys/dev/arcmsr/arcmsr.c Mon Nov 9 01:38:02 2020 (r367507) @@ -81,6 +81,7 @@ ** 1.30.00.00 11/30/2015 Ching Huang Added support ARC1203 ** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884 ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource +** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller ****************************************************************************************** */ @@ -130,29 +131,15 @@ __FBSDID("$FreeBSD$"); ************************************************************************** ************************************************************************** */ -#if __FreeBSD_version >= 500005 - #include - #include - #include - #include - #include -#else - #include - #include - #include -#endif +#include +#include +#include +#include +#include -#if !defined(CAM_NEW_TRAN_CODE) && __FreeBSD_version >= 700025 -#define CAM_NEW_TRAN_CODE 1 -#endif - -#if __FreeBSD_version > 500000 #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#else -#define arcmsr_callout_init(a) callout_init(a); -#endif -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.40.00.01 2017-10-30" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.00 2020-09-30" #include /* ************************************************************************** @@ -190,6 +177,7 @@ static void arcmsr_polling_devmap(void *arg); static void arcmsr_srb_timeout(void *arg); static void arcmsr_hbd_postqueue_isr(struct AdapterControlBlock *acb); static void arcmsr_hbe_postqueue_isr(struct AdapterControlBlock *acb); +static void arcmsr_hbf_postqueue_isr(struct AdapterControlBlock *acb); static void arcmsr_teardown_intr(device_t dev, struct AdapterControlBlock *acb); #ifdef ARCMSR_DEBUG1 static void arcmsr_dump_data(struct AdapterControlBlock *acb); @@ -220,12 +208,7 @@ static device_method_t arcmsr_methods[]={ DEVMETHOD(device_shutdown, arcmsr_shutdown), DEVMETHOD(device_suspend, arcmsr_suspend), DEVMETHOD(device_resume, arcmsr_resume), - -#if __FreeBSD_version >= 803000 DEVMETHOD_END -#else - { 0, 0 } -#endif }; static driver_t arcmsr_driver={ @@ -239,59 +222,23 @@ MODULE_DEPEND(arcmsr, cam, 1, 1, 1); #ifndef BUS_DMA_COHERENT #define BUS_DMA_COHERENT 0x04 /* hint: map memory in a coherent way */ #endif -#if __FreeBSD_version >= 501000 static struct cdevsw arcmsr_cdevsw={ - #if __FreeBSD_version >= 503000 .d_version = D_VERSION, - #endif - #if (__FreeBSD_version>=503000 && __FreeBSD_version<600034) - .d_flags = D_NEEDGIANT, - #endif .d_open = arcmsr_open, /* open */ .d_close = arcmsr_close, /* close */ .d_ioctl = arcmsr_ioctl, /* ioctl */ .d_name = "arcmsr", /* name */ }; -#else - #define ARCMSR_CDEV_MAJOR 180 - -static struct cdevsw arcmsr_cdevsw = { - arcmsr_open, /* open */ - arcmsr_close, /* close */ - noread, /* read */ - nowrite, /* write */ - arcmsr_ioctl, /* ioctl */ - nopoll, /* poll */ - nommap, /* mmap */ - nostrategy, /* strategy */ - "arcmsr", /* name */ - ARCMSR_CDEV_MAJOR, /* major */ - nodump, /* dump */ - nopsize, /* psize */ - 0 /* flags */ - }; -#endif /* ************************************************************************** ************************************************************************** */ -#if __FreeBSD_version < 500005 - static int arcmsr_open(dev_t dev, int flags, int fmt, struct proc *proc) -#else - #if __FreeBSD_version < 503000 - static int arcmsr_open(dev_t dev, int flags, int fmt, struct thread *proc) - #else - static int arcmsr_open(struct cdev *dev, int flags, int fmt, struct thread *proc) - #endif -#endif +static int arcmsr_open(struct cdev *dev, int flags, int fmt, struct thread *proc) { - #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb = dev->si_drv1; - #else - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); - #endif - if(acb == NULL) { + int unit = dev2unit(dev); + struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + + if (acb == NULL) { return ENXIO; } return (0); @@ -300,23 +247,12 @@ static struct cdevsw arcmsr_cdevsw = { ************************************************************************** ************************************************************************** */ -#if __FreeBSD_version < 500005 - static int arcmsr_close(dev_t dev, int flags, int fmt, struct proc *proc) -#else - #if __FreeBSD_version < 503000 - static int arcmsr_close(dev_t dev, int flags, int fmt, struct thread *proc) - #else - static int arcmsr_close(struct cdev *dev, int flags, int fmt, struct thread *proc) - #endif -#endif +static int arcmsr_close(struct cdev *dev, int flags, int fmt, struct thread *proc) { - #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb = dev->si_drv1; - #else - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); - #endif - if(acb == NULL) { + int unit = dev2unit(dev); + struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + + if (acb == NULL) { return ENXIO; } return 0; @@ -325,24 +261,12 @@ static struct cdevsw arcmsr_cdevsw = { ************************************************************************** ************************************************************************** */ -#if __FreeBSD_version < 500005 - static int arcmsr_ioctl(dev_t dev, u_long ioctl_cmd, caddr_t arg, int flags, struct proc *proc) -#else - #if __FreeBSD_version < 503000 - static int arcmsr_ioctl(dev_t dev, u_long ioctl_cmd, caddr_t arg, int flags, struct thread *proc) - #else - static int arcmsr_ioctl(struct cdev *dev, u_long ioctl_cmd, caddr_t arg, int flags, struct thread *proc) - #endif -#endif +static int arcmsr_ioctl(struct cdev *dev, u_long ioctl_cmd, caddr_t arg, int flags, struct thread *proc) { - #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb = dev->si_drv1; - #else - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); - #endif - - if(acb == NULL) { + int unit = dev2unit(dev); + struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + + if (acb == NULL) { return ENXIO; } return (arcmsr_iop_ioctlcmd(acb, ioctl_cmd, arg)); @@ -372,19 +296,20 @@ static u_int32_t arcmsr_disable_allintr( struct Adapte break; case ACB_ADAPTER_TYPE_C: { /* disable all outbound interrupt */ - intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask) ; /* disable outbound message0 int */ + intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask); /* disable outbound message0 int */ CHIP_REG_WRITE32(HBC_MessageUnit, 0, host_int_mask, intmask_org|ARCMSR_HBCMU_ALL_INTMASKENABLE); } break; case ACB_ADAPTER_TYPE_D: { /* disable all outbound interrupt */ - intmask_org = CHIP_REG_READ32(HBD_MessageUnit, 0, pcief0_int_enable) ; /* disable outbound message0 int */ + intmask_org = CHIP_REG_READ32(HBD_MessageUnit, 0, pcief0_int_enable); /* disable outbound message0 int */ CHIP_REG_WRITE32(HBD_MessageUnit, 0, pcief0_int_enable, ARCMSR_HBDMU_ALL_INT_DISABLE); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* disable all outbound interrupt */ - intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask) ; /* disable outbound message0 int */ + intmask_org = CHIP_REG_READ32(HBE_MessageUnit, 0, host_int_mask); /* disable outbound message0 int */ CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_mask, intmask_org | ARCMSR_HBEMU_ALL_INTMASKENABLE); } break; @@ -430,7 +355,8 @@ static void arcmsr_enable_allintr( struct AdapterContr acb->outbound_int_enable = mask; } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* enable outbound Post Queue, outbound doorbell Interrupt */ mask = ~(ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR | ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR); CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_mask, intmask_org & mask); @@ -529,7 +455,7 @@ static u_int8_t arcmsr_hbe_wait_msgint_ready(struct Ad { u_int32_t Index, read_doorbell; u_int8_t Retries = 0x00; - + do { for(Index=0; Index < 100; Index++) { read_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell); @@ -620,7 +546,7 @@ static void arcmsr_flush_hbd_cache(struct AdapterContr static void arcmsr_flush_hbe_cache(struct AdapterControlBlock *acb) { int retry_count = 30;/* enlarge wait flush adapter cache time: 10 minute */ - + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_FLUSH_CACHE); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); @@ -655,7 +581,8 @@ static void arcmsr_flush_adapter_cache(struct AdapterC arcmsr_flush_hbd_cache(acb); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { arcmsr_flush_hbe_cache(acb); } break; @@ -811,7 +738,8 @@ static void arcmsr_abort_allcmd(struct AdapterControlB arcmsr_abort_hbd_allcmd(acb); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { arcmsr_abort_hbe_allcmd(acb); } break; @@ -922,6 +850,7 @@ static void arcmsr_drain_donequeue(struct AdapterContr srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0)); /*frame must be 32 bytes aligned*/ break; case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: srb = acb->psrb_pool[flag_srb]; break; default: @@ -1012,7 +941,6 @@ static void arcmsr_done4abort_postqueue(struct Adapter } break; case ACB_ADAPTER_TYPE_C: { - while((CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_status) & ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR) && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { flag_srb = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_queueport_low); error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; @@ -1020,14 +948,15 @@ static void arcmsr_done4abort_postqueue(struct Adapter } } break; - case ACB_ADAPTER_TYPE_D: { - arcmsr_hbd_postqueue_isr(acb); - } + case ACB_ADAPTER_TYPE_D: + arcmsr_hbd_postqueue_isr(acb); break; - case ACB_ADAPTER_TYPE_E: { - arcmsr_hbe_postqueue_isr(acb); - } + case ACB_ADAPTER_TYPE_E: + arcmsr_hbe_postqueue_isr(acb); break; + case ACB_ADAPTER_TYPE_F: + arcmsr_hbf_postqueue_isr(acb); + break; } } /* @@ -1246,8 +1175,20 @@ static void arcmsr_post_srb(struct AdapterControlBlock ccb_post_stamp = (srb->smid | ((arc_cdb_size-1) >> 6)); CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_queueport_high, 0); CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); - } + } break; + case ACB_ADAPTER_TYPE_F: { + u_int32_t ccb_post_stamp, arc_cdb_size; + + if (srb->arc_cdb_size <= 0x300) + arc_cdb_size = (srb->arc_cdb_size - 1) >> 6 | 1; + else + arc_cdb_size = (((srb->arc_cdb_size + 0xff) >> 8) + 2) << 1 | 1; + ccb_post_stamp = (srb->smid | arc_cdb_size); + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_high, 0); + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); + } + break; } } /* @@ -1285,10 +1226,13 @@ static struct QBUFFER *arcmsr_get_iop_rqbuffer( struct break; case ACB_ADAPTER_TYPE_E: { struct HBE_MessageUnit *phbcmu = (struct HBE_MessageUnit *)acb->pmu; - + qbuffer = (struct QBUFFER *)&phbcmu->message_rbuffer; } break; + case ACB_ADAPTER_TYPE_F: + qbuffer = (struct QBUFFER *)acb->message_rbuffer; + break; } return(qbuffer); } @@ -1327,10 +1271,13 @@ static struct QBUFFER *arcmsr_get_iop_wqbuffer( struct break; case ACB_ADAPTER_TYPE_E: { struct HBE_MessageUnit *phbcmu = (struct HBE_MessageUnit *)acb->pmu; - + qbuffer = (struct QBUFFER *)&phbcmu->message_wbuffer; } break; + case ACB_ADAPTER_TYPE_F: + qbuffer = (struct QBUFFER *)acb->message_wbuffer; + break; } return(qbuffer); } @@ -1362,7 +1309,8 @@ static void arcmsr_iop_message_read(struct AdapterCont CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_OUT_READ); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* let IOP know data has been read */ acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_READ_OK; CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); @@ -1410,7 +1358,8 @@ static void arcmsr_iop_message_wrote(struct AdapterCon CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_IN_READY); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* ** push inbound doorbell tell iop, driver data write ok ** and wait reply on next hwinterrupt for next Qbuffer post @@ -1511,7 +1460,8 @@ static void arcmsr_stop_adapter_bgrb(struct AdapterCon arcmsr_stop_hbd_bgrb(acb); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { arcmsr_stop_hbe_bgrb(acb); } break; @@ -1540,7 +1490,6 @@ static void arcmsr_poll(struct cam_sim *psim) */ static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer) { - u_int8_t *pQbuffer; u_int8_t *buf1 = NULL; u_int32_t *iop_data, *buf2 = NULL; @@ -1585,7 +1534,6 @@ static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struc */ static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer) { - u_int8_t *pQbuffer; u_int8_t *iop_data; u_int32_t iop_len; @@ -1752,7 +1700,7 @@ static void arcmsr_rescan_lun(struct AdapterControlBlo union ccb *ccb; if ((ccb = (union ccb *)xpt_alloc_ccb_nowait()) == NULL) - return; + return; if (xpt_create_path(&path, NULL, cam_sim_path(acb->psim), target, lun) != CAM_REQ_CMP) { xpt_free_ccb(ccb); @@ -1767,7 +1715,6 @@ static void arcmsr_rescan_lun(struct AdapterControlBlo xpt_action(ccb); } - static void arcmsr_abort_dr_ccbs(struct AdapterControlBlock *acb, int target, int lun) { struct CommandControlBlock *srb; @@ -1842,10 +1789,18 @@ static void arcmsr_dr_handle(struct AdapterControlBloc devicemap = offsetof(struct HBE_MessageUnit, msgcode_rwbuffer[ARCMSR_FW_DEVMAP_OFFSET]); for (target = 0; target < 4; target++) { - deviceMapCurrent[target]=bus_space_read_4(acb->btag[0], acb->bhandle[0], devicemap); - devicemap += 4; + deviceMapCurrent[target]=bus_space_read_4(acb->btag[0], acb->bhandle[0], devicemap); + devicemap += 4; } break; + case ACB_ADAPTER_TYPE_F: + devicemap = ARCMSR_FW_DEVMAP_OFFSET; + for (target = 0; target < 4; target++) + { + deviceMapCurrent[target] = acb->msgcode_rwbuffer[devicemap]; + devicemap += 1; + } + break; } if(acb->acb_flags & ACB_F_BUS_HANG_ON) @@ -1856,7 +1811,7 @@ static void arcmsr_dr_handle(struct AdapterControlBloc ** adapter posted CONFIG message ** copy the new map, note if there are differences with the current map */ - pDevMap = (u_int8_t *)&deviceMapCurrent[0]; + pDevMap = (u_int8_t *)&deviceMapCurrent[0]; for (target = 0; target < ARCMSR_MAX_TARGETID - 1; target++) { if (*pDevMap != acb->device_map[target]) @@ -2043,7 +1998,7 @@ static void arcmsr_hbd_doorbell_isr(struct AdapterCont static void arcmsr_hbe_doorbell_isr(struct AdapterControlBlock *acb) { u_int32_t doorbell_status, in_doorbell; - + /* ******************************************************************* ** Maybe here we need to check wrqbuffer_lock is lock or not @@ -2084,7 +2039,7 @@ static void arcmsr_hba_postqueue_isr(struct AdapterCon while((flag_srb = CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_queueport)) != 0xFFFFFFFF) { /* check if command done with no error*/ - error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0) ? TRUE : FALSE; + error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0) ? TRUE : FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } /*drain reply FIFO*/ } @@ -2113,7 +2068,7 @@ static void arcmsr_hbb_postqueue_isr(struct AdapterCon index %= ARCMSR_MAX_HBB_POSTQUEUE; /*if last index number set it to 0 */ phbbmu->doneq_index = index; /* check if command done with no error*/ - error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; + error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } /*drain reply FIFO*/ } @@ -2131,7 +2086,7 @@ static void arcmsr_hbc_postqueue_isr(struct AdapterCon ** areca cdb command done ***************************************************************************** */ - bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); + bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); do { flag_srb = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_queueport_low); if (flag_srb == 0xFFFFFFFF) @@ -2141,7 +2096,7 @@ static void arcmsr_hbc_postqueue_isr(struct AdapterCon arcmsr_drain_donequeue(acb, flag_srb, error); throttling++; if(throttling == ARCMSR_HBC_ISR_THROTTLING_LEVEL) { - CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell,ARCMSR_HBCMU_DRV2IOP_POSTQUEUE_THROTTLING); + CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell, ARCMSR_HBCMU_DRV2IOP_POSTQUEUE_THROTTLING); throttling = 0; } } while(CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_status) & ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR); @@ -2214,7 +2169,7 @@ static void arcmsr_hbe_postqueue_isr(struct AdapterCon u_int16_t error; uint32_t doneq_index; uint16_t cmdSMID; - + /* ***************************************************************************** ** areca cdb command done @@ -2233,6 +2188,35 @@ static void arcmsr_hbe_postqueue_isr(struct AdapterCon acb->doneq_index = doneq_index; CHIP_REG_WRITE32(HBE_MessageUnit, 0, reply_post_consumer_index, doneq_index); } + +static void arcmsr_hbf_postqueue_isr(struct AdapterControlBlock *acb) +{ + uint16_t error; + uint32_t doneq_index; + uint16_t cmdSMID; + + /* + ***************************************************************************** + ** areca cdb command done + ***************************************************************************** + */ + bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + doneq_index = acb->doneq_index; + while (1) { + cmdSMID = acb->pCompletionQ[doneq_index].cmdSMID; + if (cmdSMID == 0xffff) + break; + error = (acb->pCompletionQ[doneq_index].cmdFlag & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; + arcmsr_drain_donequeue(acb, (u_int32_t)cmdSMID, error); + acb->pCompletionQ[doneq_index].cmdSMID = 0xffff; + doneq_index++; + if (doneq_index >= acb->completionQ_entry) + doneq_index = 0; + } + acb->doneq_index = doneq_index; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, reply_post_consumer_index, doneq_index); +} + /* ********************************************************************** ********************************************************************** @@ -2394,6 +2378,34 @@ static void arcmsr_handle_hbe_isr( struct AdapterContr host_interrupt_status = CHIP_REG_READ32(HBE_MessageUnit, 0, host_int_status); } while (host_interrupt_status & (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR | ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR)); } + +static void arcmsr_handle_hbf_isr( struct AdapterControlBlock *acb) +{ + u_int32_t host_interrupt_status; + /* + ********************************************* + ** check outbound intstatus + ********************************************* + */ + host_interrupt_status = CHIP_REG_READ32(HBF_MessageUnit, 0, host_int_status) & + (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR | + ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR); + if(!host_interrupt_status) { + /*it must be share irq*/ + return; + } + do { + /* MU doorbell interrupts*/ + if(host_interrupt_status & ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR) { + arcmsr_hbe_doorbell_isr(acb); + } + /* MU post queue interrupts*/ + if(host_interrupt_status & ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR) { + arcmsr_hbf_postqueue_isr(acb); + } + host_interrupt_status = CHIP_REG_READ32(HBF_MessageUnit, 0, host_int_status); + } while (host_interrupt_status & (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR | ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR)); +} /* ****************************************************************************** ****************************************************************************** @@ -2416,6 +2428,9 @@ static void arcmsr_interrupt(struct AdapterControlBloc case ACB_ADAPTER_TYPE_E: arcmsr_handle_hbe_isr(acb); break; + case ACB_ADAPTER_TYPE_F: + arcmsr_handle_hbf_isr(acb); + break; default: printf("arcmsr%d: interrupt service," " unknown adapter type =%d\n", acb->pci_unit, acb->adapter_type); @@ -2446,7 +2461,7 @@ static void arcmsr_polling_devmap(void *arg) CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); break; - case ACB_ADAPTER_TYPE_B: { + case ACB_ADAPTER_TYPE_B: { struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu; WRITE_CHIP_REG32(0, phbbmu->drv2iop_doorbell, ARCMSR_MESSAGE_GET_CONFIG); } @@ -2461,13 +2476,24 @@ static void arcmsr_polling_devmap(void *arg) CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); break; - case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_E: CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); - break; - } + break; + case ACB_ADAPTER_TYPE_F: { + u_int32_t outMsg1 = CHIP_REG_READ32(HBF_MessageUnit, 0, outbound_msgaddr1); + if (!(outMsg1 & ARCMSR_HBFMU_MESSAGE_FIRMWARE_OK) || + (outMsg1 & ARCMSR_HBFMU_MESSAGE_NO_VOLUME_CHANGE)) + goto nxt6s; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + break; + } + } +nxt6s: if((acb->acb_flags & ACB_F_SCSISTOPADAPTER) == 0) { callout_reset(&acb->devmap_callout, 5 * hz, arcmsr_polling_devmap, acb); /* polling per 5 seconds */ @@ -3066,7 +3092,7 @@ static void arcmsr_handle_virtual_command(struct Adapt case INQUIRY: { unsigned char inqdata[36]; char *buffer = pccb->csio.data_ptr; - + inqdata[0] = T_PROCESSOR; /* Periph Qualifier & Periph Dev Type */ inqdata[1] = 0; /* rem media bit & Dev Type Modifier */ inqdata[2] = 0; /* ISO, ECMA, & ANSI versions */ @@ -3160,7 +3186,6 @@ static void arcmsr_action(struct cam_sim *psim, union strlcpy(cpi->hba_vid, "ARCMSR", HBA_IDLEN); strlcpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(psim); - #ifdef CAM_NEW_TRAN_CODE if(acb->adapter_bus_speed == ACB_BUS_SPEED_12G) cpi->base_transfer_speed = 1200000; else if(acb->adapter_bus_speed == ACB_BUS_SPEED_6G) @@ -3183,14 +3208,13 @@ static void arcmsr_action(struct cam_sim *psim, union cpi->protocol_version = SCSI_REV_2; } cpi->protocol = PROTO_SCSI; - #endif cpi->ccb_h.status |= CAM_REQ_CMP; xpt_done(pccb); break; } case XPT_ABORT: { union ccb *pabort_ccb; - + pabort_ccb = pccb->cab.abort_ccb; switch (pabort_ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: @@ -3241,7 +3265,6 @@ static void arcmsr_action(struct cam_sim *psim, union break; } cts = &pccb->cts; - #ifdef CAM_NEW_TRAN_CODE { struct ccb_trans_settings_scsi *scsi; struct ccb_trans_settings_spi *spi; @@ -3288,22 +3311,6 @@ static void arcmsr_action(struct cam_sim *psim, union | CTS_SPI_VALID_BUS_WIDTH; } } - #else - { - cts->flags = (CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB); - if (acb->adapter_bus_speed == ACB_BUS_SPEED_6G) - cts->sync_period = 1; - else - cts->sync_period = 2; - cts->sync_offset = 32; - cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT; - cts->valid = CCB_TRANS_SYNC_RATE_VALID | - CCB_TRANS_SYNC_OFFSET_VALID | - CCB_TRANS_BUS_WIDTH_VALID | - CCB_TRANS_DISC_VALID | - CCB_TRANS_TQ_VALID; - } - #endif pccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(pccb); break; @@ -3319,38 +3326,7 @@ static void arcmsr_action(struct cam_sim *psim, union xpt_done(pccb); break; } -#if __FreeBSD_version >= 500000 cam_calc_geometry(&pccb->ccg, 1); -#else - { - struct ccb_calc_geometry *ccg; - u_int32_t size_mb; - u_int32_t secs_per_cylinder; - - ccg = &pccb->ccg; - if (ccg->block_size == 0) { - pccb->ccb_h.status = CAM_REQ_INVALID; - xpt_done(pccb); - break; - } - if(((1024L * 1024L)/ccg->block_size) < 0) { - pccb->ccb_h.status = CAM_REQ_INVALID; - xpt_done(pccb); - break; - } - size_mb = ccg->volume_size/((1024L * 1024L)/ccg->block_size); - if(size_mb > 1024 ) { - ccg->heads = 255; - ccg->secs_per_track = 63; - } else { - ccg->heads = 64; - ccg->secs_per_track = 32; - } - secs_per_cylinder = ccg->heads * ccg->secs_per_track; - ccg->cylinders = ccg->volume_size / secs_per_cylinder; - pccb->ccb_h.status |= CAM_REQ_CMP; - } -#endif xpt_done(pccb); break; default: @@ -3443,6 +3419,7 @@ static void arcmsr_start_adapter_bgrb(struct AdapterCo arcmsr_start_hbd_bgrb(acb); break; case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: arcmsr_start_hbe_bgrb(acb); break; } @@ -3584,7 +3561,7 @@ polling_ccb_retry: break; } if (acb->srboutstandingcount == 0) { - break; + break; } goto polling_ccb_retry; } @@ -3676,7 +3653,7 @@ static void arcmsr_polling_hbe_srbdone(struct AdapterC struct CommandControlBlock *srb; u_int32_t poll_srb_done=0, poll_count=0, doneq_index; u_int16_t error, cmdSMID; - + polling_ccb_retry: poll_count++; bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); @@ -3687,12 +3664,12 @@ polling_ccb_retry: break;/*chip FIFO no ccb for completion already*/ } else { UDELAY(25000); - if ((poll_count > 100) && (poll_srb != NULL)) { + if ((poll_count > 100) && (poll_srb != NULL)) { break; } - if (acb->srboutstandingcount == 0) { - break; - } + if (acb->srboutstandingcount == 0) { + break; + } goto polling_ccb_retry; } } @@ -3728,25 +3705,21 @@ polling_ccb_retry: static void arcmsr_polling_srbdone(struct AdapterControlBlock *acb, struct CommandControlBlock *poll_srb) { switch (acb->adapter_type) { - case ACB_ADAPTER_TYPE_A: { - arcmsr_polling_hba_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_A: + arcmsr_polling_hba_srbdone(acb, poll_srb); break; - case ACB_ADAPTER_TYPE_B: { - arcmsr_polling_hbb_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_B: + arcmsr_polling_hbb_srbdone(acb, poll_srb); break; - case ACB_ADAPTER_TYPE_C: { - arcmsr_polling_hbc_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_C: + arcmsr_polling_hbc_srbdone(acb, poll_srb); break; - case ACB_ADAPTER_TYPE_D: { - arcmsr_polling_hbd_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_D: + arcmsr_polling_hbd_srbdone(acb, poll_srb); break; - case ACB_ADAPTER_TYPE_E: { - arcmsr_polling_hbe_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: + arcmsr_polling_hbe_srbdone(acb, poll_srb); break; } } @@ -3963,14 +3936,14 @@ static void arcmsr_get_hbe_config(struct AdapterContro size_t iop_firm_version = offsetof(struct HBE_MessageUnit,msgcode_rwbuffer[ARCMSR_FW_VERS_OFFSET]); /*firm_version,17,68-83*/ size_t iop_device_map = offsetof(struct HBE_MessageUnit,msgcode_rwbuffer[ARCMSR_FW_DEVMAP_OFFSET]); int i; - + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); if(!arcmsr_hbe_wait_msgint_ready(acb)) { printf("arcmsr%d: wait 'get adapter firmware miscellaneous data' timeout \n", acb->pci_unit); } - + i = 0; while(i < 8) { *acb_firm_model = bus_space_read_1(acb->btag[0], acb->bhandle[0], iop_firm_model+i); @@ -4006,29 +3979,81 @@ static void arcmsr_get_hbe_config(struct AdapterContro ********************************************************************** ********************************************************************** */ +static void arcmsr_get_hbf_config(struct AdapterControlBlock *acb) +{ + u_int32_t *acb_firm_model = (u_int32_t *)acb->firm_model; + u_int32_t *acb_firm_version = (u_int32_t *)acb->firm_version; + u_int32_t *acb_device_map = (u_int32_t *)acb->device_map; + size_t iop_firm_model = ARCMSR_FW_MODEL_OFFSET; /*firm_model,15,60-67*/ + size_t iop_firm_version = ARCMSR_FW_VERS_OFFSET; /*firm_version,17,68-83*/ + size_t iop_device_map = ARCMSR_FW_DEVMAP_OFFSET; + int i; + + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) + printf("arcmsr%d: wait 'get adapter firmware miscellaneous data' timeout \n", acb->pci_unit); + + i = 0; + while(i < 2) { + *acb_firm_model = acb->msgcode_rwbuffer[iop_firm_model]; + /* 8 bytes firm_model, 15, 60-67*/ + acb_firm_model++; + iop_firm_model++; + i++; + } + i = 0; + while(i < 4) { + *acb_firm_version = acb->msgcode_rwbuffer[iop_firm_version]; + /* 16 bytes firm_version, 17, 68-83*/ + acb_firm_version++; + iop_firm_version++; + i++; + } + i = 0; + while(i < 4) { + *acb_device_map = acb->msgcode_rwbuffer[iop_device_map]; + acb_device_map++; + iop_device_map++; + i++; + } + printf("Areca RAID adapter%d: %s F/W version %s \n", acb->pci_unit, acb->firm_model, acb->firm_version); + acb->firm_request_len = acb->msgcode_rwbuffer[1]; /*firm_request_len, 1, 04-07*/ + acb->firm_numbers_queue = acb->msgcode_rwbuffer[2]; /*firm_numbers_queue, 2, 08-11*/ + acb->firm_sdram_size = acb->msgcode_rwbuffer[3]; /*firm_sdram_size, 3, 12-15*/ + acb->firm_ide_channels = acb->msgcode_rwbuffer[4]; /*firm_ide_channels, 4, 16-19*/ + acb->firm_cfg_version = acb->msgcode_rwbuffer[ARCMSR_FW_CFGVER_OFFSET]; /*firm_cfg_version, 25*/ + if(acb->firm_numbers_queue > ARCMSR_MAX_OUTSTANDING_CMD) + acb->maxOutstanding = ARCMSR_MAX_OUTSTANDING_CMD - 1; + else + acb->maxOutstanding = acb->firm_numbers_queue - 1; +} +/* +********************************************************************** +********************************************************************** +*/ static void arcmsr_get_firmware_spec(struct AdapterControlBlock *acb) { switch (acb->adapter_type) { - case ACB_ADAPTER_TYPE_A: { - arcmsr_get_hba_config(acb); - } + case ACB_ADAPTER_TYPE_A: + arcmsr_get_hba_config(acb); break; - case ACB_ADAPTER_TYPE_B: { - arcmsr_get_hbb_config(acb); - } + case ACB_ADAPTER_TYPE_B: + arcmsr_get_hbb_config(acb); break; - case ACB_ADAPTER_TYPE_C: { - arcmsr_get_hbc_config(acb); - } + case ACB_ADAPTER_TYPE_C: + arcmsr_get_hbc_config(acb); break; - case ACB_ADAPTER_TYPE_D: { - arcmsr_get_hbd_config(acb); - } + case ACB_ADAPTER_TYPE_D: + arcmsr_get_hbd_config(acb); break; - case ACB_ADAPTER_TYPE_E: { - arcmsr_get_hbe_config(acb); - } + case ACB_ADAPTER_TYPE_E: + arcmsr_get_hbe_config(acb); break; + case ACB_ADAPTER_TYPE_F: + arcmsr_get_hbf_config(acb); + break; } } /* @@ -4090,7 +4115,8 @@ static void arcmsr_wait_firmware_ready( struct Adapter } } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { while ((CHIP_REG_READ32(HBE_MessageUnit, 0, outbound_msgaddr1) & ARCMSR_HBEMU_MESSAGE_FIRMWARE_OK) == 0) { if (timeout++ > 4000) /* (4000*15)/1000 = 60 sec */ @@ -4143,7 +4169,8 @@ static void arcmsr_clear_doorbell_queue_buffer( struct CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_OUT_READ); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* empty doorbell Qbuffer if door bell ringed */ acb->in_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell); CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); /*clear doorbell interrupt */ @@ -4278,6 +4305,27 @@ static u_int32_t arcmsr_iop_confirm(struct AdapterCont } } break; + case ACB_ADAPTER_TYPE_F: { + u_int32_t cdb_phyaddr_lo32; + cdb_phyaddr_lo32 = srb_phyaddr_lo32 + offsetof(struct CommandControlBlock, arcmsr_cdb); + acb->msgcode_rwbuffer[0] = ARCMSR_SIGNATURE_SET_CONFIG; + acb->msgcode_rwbuffer[1] = ARCMSR_SIGNATURE_1886; + acb->msgcode_rwbuffer[2] = cdb_phyaddr_lo32; + acb->msgcode_rwbuffer[3] = srb_phyaddr_hi32; + acb->msgcode_rwbuffer[4] = SRB_SIZE; + cdb_phyaddr_lo32 = srb_phyaddr_lo32 + ARCMSR_SRBS_POOL_SIZE; + acb->msgcode_rwbuffer[5] = cdb_phyaddr_lo32; + acb->msgcode_rwbuffer[6] = srb_phyaddr_hi32; + acb->msgcode_rwbuffer[7] = COMPLETION_Q_POOL_SIZE; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_SET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) { + printf( "arcmsr%d: 'set srb high part physical address' timeout \n", acb->pci_unit); + return FALSE; + } + } + break; } return (TRUE); } @@ -4341,7 +4389,7 @@ static void arcmsr_map_free_srb(void *arg, bus_dma_seg return; } if((acb->adapter_type == ACB_ADAPTER_TYPE_C) || (acb->adapter_type == ACB_ADAPTER_TYPE_D) - || (acb->adapter_type == ACB_ADAPTER_TYPE_E)) + || (acb->adapter_type == ACB_ADAPTER_TYPE_E) || (acb->adapter_type == ACB_ADAPTER_TYPE_F)) { srb_tmp->cdb_phyaddr_low = srb_phyaddr; srb_tmp->cdb_phyaddr_high = (u_int32_t)((srb_phyaddr >> 16) >> 16); @@ -4356,6 +4404,15 @@ static void arcmsr_map_free_srb(void *arg, bus_dma_seg } if (acb->adapter_type == ACB_ADAPTER_TYPE_E) acb->pCompletionQ = (pCompletion_Q)srb_tmp; + else if (acb->adapter_type == ACB_ADAPTER_TYPE_F) { + acb->pCompletionQ = (pCompletion_Q)srb_tmp; + acb->completeQ_phys = srb_phyaddr; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 9 01:39:56 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 631DF2E42E6; Mon, 9 Nov 2020 01:39:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTtwD2Khhz3P9T; Mon, 9 Nov 2020 01:39:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42897143E; Mon, 9 Nov 2020 01:39:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A91du1a023275; Mon, 9 Nov 2020 01:39:56 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A91dtb8023272; Mon, 9 Nov 2020 01:39:55 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202011090139.0A91dtb8023272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Nov 2020 01:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367508 - in stable/11: share/man/man4 sys/dev/arcmsr X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/arcmsr X-SVN-Commit-Revision: 367508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 01:39:56 -0000 Author: delphij Date: Mon Nov 9 01:39:55 2020 New Revision: 367508 URL: https://svnweb.freebsd.org/changeset/base/367508 Log: MFC r358477,365113,366767: arcmsr(4) 1.50.00.00. Modified: stable/11/share/man/man4/arcmsr.4 stable/11/sys/dev/arcmsr/arcmsr.c stable/11/sys/dev/arcmsr/arcmsr.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/arcmsr.4 ============================================================================== --- stable/11/share/man/man4/arcmsr.4 Mon Nov 9 01:38:02 2020 (r367507) +++ stable/11/share/man/man4/arcmsr.4 Mon Nov 9 01:39:55 2020 (r367508) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2017 +.Dd October 15, 2020 .Dt ARCMSR 4 .Os .Sh NAME @@ -153,6 +153,8 @@ ARC-1882 ARC-1883 .It ARC-1884 +.It +ARC-1886 .El .Sh FILES .Bl -tag -width ".Pa /dev/arcmsr?" -compact Modified: stable/11/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/11/sys/dev/arcmsr/arcmsr.c Mon Nov 9 01:38:02 2020 (r367507) +++ stable/11/sys/dev/arcmsr/arcmsr.c Mon Nov 9 01:39:55 2020 (r367508) @@ -79,6 +79,7 @@ ** 1.30.00.00 11/30/2015 Ching Huang Added support ARC1203 ** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884 ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource +** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller ****************************************************************************************** */ @@ -128,29 +129,15 @@ __FBSDID("$FreeBSD$"); ************************************************************************** ************************************************************************** */ -#if __FreeBSD_version >= 500005 - #include - #include - #include - #include - #include -#else - #include - #include - #include -#endif +#include +#include +#include +#include +#include -#if !defined(CAM_NEW_TRAN_CODE) && __FreeBSD_version >= 700025 -#define CAM_NEW_TRAN_CODE 1 -#endif - -#if __FreeBSD_version > 500000 #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#else -#define arcmsr_callout_init(a) callout_init(a); -#endif -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.40.00.01 2017-10-30" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.00 2020-09-30" #include /* ************************************************************************** @@ -188,6 +175,7 @@ static void arcmsr_polling_devmap(void *arg); static void arcmsr_srb_timeout(void *arg); static void arcmsr_hbd_postqueue_isr(struct AdapterControlBlock *acb); static void arcmsr_hbe_postqueue_isr(struct AdapterControlBlock *acb); +static void arcmsr_hbf_postqueue_isr(struct AdapterControlBlock *acb); static void arcmsr_teardown_intr(device_t dev, struct AdapterControlBlock *acb); #ifdef ARCMSR_DEBUG1 static void arcmsr_dump_data(struct AdapterControlBlock *acb); @@ -218,12 +206,7 @@ static device_method_t arcmsr_methods[]={ DEVMETHOD(device_shutdown, arcmsr_shutdown), DEVMETHOD(device_suspend, arcmsr_suspend), DEVMETHOD(device_resume, arcmsr_resume), - -#if __FreeBSD_version >= 803000 DEVMETHOD_END -#else - { 0, 0 } -#endif }; static driver_t arcmsr_driver={ @@ -237,59 +220,23 @@ MODULE_DEPEND(arcmsr, cam, 1, 1, 1); #ifndef BUS_DMA_COHERENT #define BUS_DMA_COHERENT 0x04 /* hint: map memory in a coherent way */ #endif -#if __FreeBSD_version >= 501000 static struct cdevsw arcmsr_cdevsw={ - #if __FreeBSD_version >= 503000 .d_version = D_VERSION, - #endif - #if (__FreeBSD_version>=503000 && __FreeBSD_version<600034) - .d_flags = D_NEEDGIANT, - #endif .d_open = arcmsr_open, /* open */ .d_close = arcmsr_close, /* close */ .d_ioctl = arcmsr_ioctl, /* ioctl */ .d_name = "arcmsr", /* name */ }; -#else - #define ARCMSR_CDEV_MAJOR 180 - -static struct cdevsw arcmsr_cdevsw = { - arcmsr_open, /* open */ - arcmsr_close, /* close */ - noread, /* read */ - nowrite, /* write */ - arcmsr_ioctl, /* ioctl */ - nopoll, /* poll */ - nommap, /* mmap */ - nostrategy, /* strategy */ - "arcmsr", /* name */ - ARCMSR_CDEV_MAJOR, /* major */ - nodump, /* dump */ - nopsize, /* psize */ - 0 /* flags */ - }; -#endif /* ************************************************************************** ************************************************************************** */ -#if __FreeBSD_version < 500005 - static int arcmsr_open(dev_t dev, int flags, int fmt, struct proc *proc) -#else - #if __FreeBSD_version < 503000 - static int arcmsr_open(dev_t dev, int flags, int fmt, struct thread *proc) - #else - static int arcmsr_open(struct cdev *dev, int flags, int fmt, struct thread *proc) - #endif -#endif +static int arcmsr_open(struct cdev *dev, int flags, int fmt, struct thread *proc) { - #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb = dev->si_drv1; - #else - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); - #endif - if(acb == NULL) { + int unit = dev2unit(dev); + struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + + if (acb == NULL) { return ENXIO; } return (0); @@ -298,23 +245,12 @@ static struct cdevsw arcmsr_cdevsw = { ************************************************************************** ************************************************************************** */ -#if __FreeBSD_version < 500005 - static int arcmsr_close(dev_t dev, int flags, int fmt, struct proc *proc) -#else - #if __FreeBSD_version < 503000 - static int arcmsr_close(dev_t dev, int flags, int fmt, struct thread *proc) - #else - static int arcmsr_close(struct cdev *dev, int flags, int fmt, struct thread *proc) - #endif -#endif +static int arcmsr_close(struct cdev *dev, int flags, int fmt, struct thread *proc) { - #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb = dev->si_drv1; - #else - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); - #endif - if(acb == NULL) { + int unit = dev2unit(dev); + struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + + if (acb == NULL) { return ENXIO; } return 0; @@ -323,24 +259,12 @@ static struct cdevsw arcmsr_cdevsw = { ************************************************************************** ************************************************************************** */ -#if __FreeBSD_version < 500005 - static int arcmsr_ioctl(dev_t dev, u_long ioctl_cmd, caddr_t arg, int flags, struct proc *proc) -#else - #if __FreeBSD_version < 503000 - static int arcmsr_ioctl(dev_t dev, u_long ioctl_cmd, caddr_t arg, int flags, struct thread *proc) - #else - static int arcmsr_ioctl(struct cdev *dev, u_long ioctl_cmd, caddr_t arg, int flags, struct thread *proc) - #endif -#endif +static int arcmsr_ioctl(struct cdev *dev, u_long ioctl_cmd, caddr_t arg, int flags, struct thread *proc) { - #if __FreeBSD_version < 503000 - struct AdapterControlBlock *acb = dev->si_drv1; - #else - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); - #endif - - if(acb == NULL) { + int unit = dev2unit(dev); + struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + + if (acb == NULL) { return ENXIO; } return (arcmsr_iop_ioctlcmd(acb, ioctl_cmd, arg)); @@ -370,19 +294,20 @@ static u_int32_t arcmsr_disable_allintr( struct Adapte break; case ACB_ADAPTER_TYPE_C: { /* disable all outbound interrupt */ - intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask) ; /* disable outbound message0 int */ + intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask); /* disable outbound message0 int */ CHIP_REG_WRITE32(HBC_MessageUnit, 0, host_int_mask, intmask_org|ARCMSR_HBCMU_ALL_INTMASKENABLE); } break; case ACB_ADAPTER_TYPE_D: { /* disable all outbound interrupt */ - intmask_org = CHIP_REG_READ32(HBD_MessageUnit, 0, pcief0_int_enable) ; /* disable outbound message0 int */ + intmask_org = CHIP_REG_READ32(HBD_MessageUnit, 0, pcief0_int_enable); /* disable outbound message0 int */ CHIP_REG_WRITE32(HBD_MessageUnit, 0, pcief0_int_enable, ARCMSR_HBDMU_ALL_INT_DISABLE); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* disable all outbound interrupt */ - intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask) ; /* disable outbound message0 int */ + intmask_org = CHIP_REG_READ32(HBE_MessageUnit, 0, host_int_mask); /* disable outbound message0 int */ CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_mask, intmask_org | ARCMSR_HBEMU_ALL_INTMASKENABLE); } break; @@ -428,7 +353,8 @@ static void arcmsr_enable_allintr( struct AdapterContr acb->outbound_int_enable = mask; } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* enable outbound Post Queue, outbound doorbell Interrupt */ mask = ~(ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR | ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR); CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_mask, intmask_org & mask); @@ -527,7 +453,7 @@ static u_int8_t arcmsr_hbe_wait_msgint_ready(struct Ad { u_int32_t Index, read_doorbell; u_int8_t Retries = 0x00; - + do { for(Index=0; Index < 100; Index++) { read_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell); @@ -618,7 +544,7 @@ static void arcmsr_flush_hbd_cache(struct AdapterContr static void arcmsr_flush_hbe_cache(struct AdapterControlBlock *acb) { int retry_count = 30;/* enlarge wait flush adapter cache time: 10 minute */ - + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_FLUSH_CACHE); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); @@ -653,7 +579,8 @@ static void arcmsr_flush_adapter_cache(struct AdapterC arcmsr_flush_hbd_cache(acb); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { arcmsr_flush_hbe_cache(acb); } break; @@ -809,7 +736,8 @@ static void arcmsr_abort_allcmd(struct AdapterControlB arcmsr_abort_hbd_allcmd(acb); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { arcmsr_abort_hbe_allcmd(acb); } break; @@ -920,6 +848,7 @@ static void arcmsr_drain_donequeue(struct AdapterContr srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0)); /*frame must be 32 bytes aligned*/ break; case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: srb = acb->psrb_pool[flag_srb]; break; default: @@ -1010,7 +939,6 @@ static void arcmsr_done4abort_postqueue(struct Adapter } break; case ACB_ADAPTER_TYPE_C: { - while((CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_status) & ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR) && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { flag_srb = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_queueport_low); error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; @@ -1018,14 +946,15 @@ static void arcmsr_done4abort_postqueue(struct Adapter } } break; - case ACB_ADAPTER_TYPE_D: { - arcmsr_hbd_postqueue_isr(acb); - } + case ACB_ADAPTER_TYPE_D: + arcmsr_hbd_postqueue_isr(acb); break; - case ACB_ADAPTER_TYPE_E: { - arcmsr_hbe_postqueue_isr(acb); - } + case ACB_ADAPTER_TYPE_E: + arcmsr_hbe_postqueue_isr(acb); break; + case ACB_ADAPTER_TYPE_F: + arcmsr_hbf_postqueue_isr(acb); + break; } } /* @@ -1244,8 +1173,20 @@ static void arcmsr_post_srb(struct AdapterControlBlock ccb_post_stamp = (srb->smid | ((arc_cdb_size-1) >> 6)); CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_queueport_high, 0); CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); - } + } break; + case ACB_ADAPTER_TYPE_F: { + u_int32_t ccb_post_stamp, arc_cdb_size; + + if (srb->arc_cdb_size <= 0x300) + arc_cdb_size = (srb->arc_cdb_size - 1) >> 6 | 1; + else + arc_cdb_size = (((srb->arc_cdb_size + 0xff) >> 8) + 2) << 1 | 1; + ccb_post_stamp = (srb->smid | arc_cdb_size); + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_high, 0); + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); + } + break; } } /* @@ -1283,10 +1224,13 @@ static struct QBUFFER *arcmsr_get_iop_rqbuffer( struct break; case ACB_ADAPTER_TYPE_E: { struct HBE_MessageUnit *phbcmu = (struct HBE_MessageUnit *)acb->pmu; - + qbuffer = (struct QBUFFER *)&phbcmu->message_rbuffer; } break; + case ACB_ADAPTER_TYPE_F: + qbuffer = (struct QBUFFER *)acb->message_rbuffer; + break; } return(qbuffer); } @@ -1325,10 +1269,13 @@ static struct QBUFFER *arcmsr_get_iop_wqbuffer( struct break; case ACB_ADAPTER_TYPE_E: { struct HBE_MessageUnit *phbcmu = (struct HBE_MessageUnit *)acb->pmu; - + qbuffer = (struct QBUFFER *)&phbcmu->message_wbuffer; } break; + case ACB_ADAPTER_TYPE_F: + qbuffer = (struct QBUFFER *)acb->message_wbuffer; + break; } return(qbuffer); } @@ -1360,7 +1307,8 @@ static void arcmsr_iop_message_read(struct AdapterCont CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_OUT_READ); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* let IOP know data has been read */ acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_READ_OK; CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); @@ -1408,7 +1356,8 @@ static void arcmsr_iop_message_wrote(struct AdapterCon CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_IN_READY); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* ** push inbound doorbell tell iop, driver data write ok ** and wait reply on next hwinterrupt for next Qbuffer post @@ -1509,7 +1458,8 @@ static void arcmsr_stop_adapter_bgrb(struct AdapterCon arcmsr_stop_hbd_bgrb(acb); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { arcmsr_stop_hbe_bgrb(acb); } break; @@ -1538,7 +1488,6 @@ static void arcmsr_poll(struct cam_sim *psim) */ static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer) { - u_int8_t *pQbuffer; u_int8_t *buf1 = NULL; u_int32_t *iop_data, *buf2 = NULL; @@ -1583,7 +1532,6 @@ static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struc */ static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer) { - u_int8_t *pQbuffer; u_int8_t *iop_data; u_int32_t iop_len; @@ -1750,7 +1698,7 @@ static void arcmsr_rescan_lun(struct AdapterControlBlo union ccb *ccb; if ((ccb = (union ccb *)xpt_alloc_ccb_nowait()) == NULL) - return; + return; if (xpt_create_path(&path, NULL, cam_sim_path(acb->psim), target, lun) != CAM_REQ_CMP) { xpt_free_ccb(ccb); @@ -1765,7 +1713,6 @@ static void arcmsr_rescan_lun(struct AdapterControlBlo xpt_action(ccb); } - static void arcmsr_abort_dr_ccbs(struct AdapterControlBlock *acb, int target, int lun) { struct CommandControlBlock *srb; @@ -1840,10 +1787,18 @@ static void arcmsr_dr_handle(struct AdapterControlBloc devicemap = offsetof(struct HBE_MessageUnit, msgcode_rwbuffer[ARCMSR_FW_DEVMAP_OFFSET]); for (target = 0; target < 4; target++) { - deviceMapCurrent[target]=bus_space_read_4(acb->btag[0], acb->bhandle[0], devicemap); - devicemap += 4; + deviceMapCurrent[target]=bus_space_read_4(acb->btag[0], acb->bhandle[0], devicemap); + devicemap += 4; } break; + case ACB_ADAPTER_TYPE_F: + devicemap = ARCMSR_FW_DEVMAP_OFFSET; + for (target = 0; target < 4; target++) + { + deviceMapCurrent[target] = acb->msgcode_rwbuffer[devicemap]; + devicemap += 1; + } + break; } if(acb->acb_flags & ACB_F_BUS_HANG_ON) @@ -1854,7 +1809,7 @@ static void arcmsr_dr_handle(struct AdapterControlBloc ** adapter posted CONFIG message ** copy the new map, note if there are differences with the current map */ - pDevMap = (u_int8_t *)&deviceMapCurrent[0]; + pDevMap = (u_int8_t *)&deviceMapCurrent[0]; for (target = 0; target < ARCMSR_MAX_TARGETID - 1; target++) { if (*pDevMap != acb->device_map[target]) @@ -2041,7 +1996,7 @@ static void arcmsr_hbd_doorbell_isr(struct AdapterCont static void arcmsr_hbe_doorbell_isr(struct AdapterControlBlock *acb) { u_int32_t doorbell_status, in_doorbell; - + /* ******************************************************************* ** Maybe here we need to check wrqbuffer_lock is lock or not @@ -2082,7 +2037,7 @@ static void arcmsr_hba_postqueue_isr(struct AdapterCon while((flag_srb = CHIP_REG_READ32(HBA_MessageUnit, 0, outbound_queueport)) != 0xFFFFFFFF) { /* check if command done with no error*/ - error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0) ? TRUE : FALSE; + error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0) ? TRUE : FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } /*drain reply FIFO*/ } @@ -2111,7 +2066,7 @@ static void arcmsr_hbb_postqueue_isr(struct AdapterCon index %= ARCMSR_MAX_HBB_POSTQUEUE; /*if last index number set it to 0 */ phbbmu->doneq_index = index; /* check if command done with no error*/ - error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; + error = (flag_srb & ARCMSR_SRBREPLY_FLAG_ERROR_MODE0)?TRUE:FALSE; arcmsr_drain_donequeue(acb, flag_srb, error); } /*drain reply FIFO*/ } @@ -2129,7 +2084,7 @@ static void arcmsr_hbc_postqueue_isr(struct AdapterCon ** areca cdb command done ***************************************************************************** */ - bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); + bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); do { flag_srb = CHIP_REG_READ32(HBC_MessageUnit, 0, outbound_queueport_low); if (flag_srb == 0xFFFFFFFF) @@ -2139,7 +2094,7 @@ static void arcmsr_hbc_postqueue_isr(struct AdapterCon arcmsr_drain_donequeue(acb, flag_srb, error); throttling++; if(throttling == ARCMSR_HBC_ISR_THROTTLING_LEVEL) { - CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell,ARCMSR_HBCMU_DRV2IOP_POSTQUEUE_THROTTLING); + CHIP_REG_WRITE32(HBC_MessageUnit, 0, inbound_doorbell, ARCMSR_HBCMU_DRV2IOP_POSTQUEUE_THROTTLING); throttling = 0; } } while(CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_status) & ARCMSR_HBCMU_OUTBOUND_POSTQUEUE_ISR); @@ -2212,7 +2167,7 @@ static void arcmsr_hbe_postqueue_isr(struct AdapterCon u_int16_t error; uint32_t doneq_index; uint16_t cmdSMID; - + /* ***************************************************************************** ** areca cdb command done @@ -2231,6 +2186,35 @@ static void arcmsr_hbe_postqueue_isr(struct AdapterCon acb->doneq_index = doneq_index; CHIP_REG_WRITE32(HBE_MessageUnit, 0, reply_post_consumer_index, doneq_index); } + +static void arcmsr_hbf_postqueue_isr(struct AdapterControlBlock *acb) +{ + uint16_t error; + uint32_t doneq_index; + uint16_t cmdSMID; + + /* + ***************************************************************************** + ** areca cdb command done + ***************************************************************************** + */ + bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + doneq_index = acb->doneq_index; + while (1) { + cmdSMID = acb->pCompletionQ[doneq_index].cmdSMID; + if (cmdSMID == 0xffff) + break; + error = (acb->pCompletionQ[doneq_index].cmdFlag & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; + arcmsr_drain_donequeue(acb, (u_int32_t)cmdSMID, error); + acb->pCompletionQ[doneq_index].cmdSMID = 0xffff; + doneq_index++; + if (doneq_index >= acb->completionQ_entry) + doneq_index = 0; + } + acb->doneq_index = doneq_index; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, reply_post_consumer_index, doneq_index); +} + /* ********************************************************************** ********************************************************************** @@ -2392,6 +2376,34 @@ static void arcmsr_handle_hbe_isr( struct AdapterContr host_interrupt_status = CHIP_REG_READ32(HBE_MessageUnit, 0, host_int_status); } while (host_interrupt_status & (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR | ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR)); } + +static void arcmsr_handle_hbf_isr( struct AdapterControlBlock *acb) +{ + u_int32_t host_interrupt_status; + /* + ********************************************* + ** check outbound intstatus + ********************************************* + */ + host_interrupt_status = CHIP_REG_READ32(HBF_MessageUnit, 0, host_int_status) & + (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR | + ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR); + if(!host_interrupt_status) { + /*it must be share irq*/ + return; + } + do { + /* MU doorbell interrupts*/ + if(host_interrupt_status & ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR) { + arcmsr_hbe_doorbell_isr(acb); + } + /* MU post queue interrupts*/ + if(host_interrupt_status & ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR) { + arcmsr_hbf_postqueue_isr(acb); + } + host_interrupt_status = CHIP_REG_READ32(HBF_MessageUnit, 0, host_int_status); + } while (host_interrupt_status & (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR | ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR)); +} /* ****************************************************************************** ****************************************************************************** @@ -2414,6 +2426,9 @@ static void arcmsr_interrupt(struct AdapterControlBloc case ACB_ADAPTER_TYPE_E: arcmsr_handle_hbe_isr(acb); break; + case ACB_ADAPTER_TYPE_F: + arcmsr_handle_hbf_isr(acb); + break; default: printf("arcmsr%d: interrupt service," " unknown adapter type =%d\n", acb->pci_unit, acb->adapter_type); @@ -2444,7 +2459,7 @@ static void arcmsr_polling_devmap(void *arg) CHIP_REG_WRITE32(HBA_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); break; - case ACB_ADAPTER_TYPE_B: { + case ACB_ADAPTER_TYPE_B: { struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu; WRITE_CHIP_REG32(0, phbbmu->drv2iop_doorbell, ARCMSR_MESSAGE_GET_CONFIG); } @@ -2459,13 +2474,24 @@ static void arcmsr_polling_devmap(void *arg) CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); break; - case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_E: CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); - break; - } + break; + case ACB_ADAPTER_TYPE_F: { + u_int32_t outMsg1 = CHIP_REG_READ32(HBF_MessageUnit, 0, outbound_msgaddr1); + if (!(outMsg1 & ARCMSR_HBFMU_MESSAGE_FIRMWARE_OK) || + (outMsg1 & ARCMSR_HBFMU_MESSAGE_NO_VOLUME_CHANGE)) + goto nxt6s; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + break; + } + } +nxt6s: if((acb->acb_flags & ACB_F_SCSISTOPADAPTER) == 0) { callout_reset(&acb->devmap_callout, 5 * hz, arcmsr_polling_devmap, acb); /* polling per 5 seconds */ @@ -3064,7 +3090,7 @@ static void arcmsr_handle_virtual_command(struct Adapt case INQUIRY: { unsigned char inqdata[36]; char *buffer = pccb->csio.data_ptr; - + inqdata[0] = T_PROCESSOR; /* Periph Qualifier & Periph Dev Type */ inqdata[1] = 0; /* rem media bit & Dev Type Modifier */ inqdata[2] = 0; /* ISO, ECMA, & ANSI versions */ @@ -3158,7 +3184,6 @@ static void arcmsr_action(struct cam_sim *psim, union strlcpy(cpi->hba_vid, "ARCMSR", HBA_IDLEN); strlcpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(psim); - #ifdef CAM_NEW_TRAN_CODE if(acb->adapter_bus_speed == ACB_BUS_SPEED_12G) cpi->base_transfer_speed = 1200000; else if(acb->adapter_bus_speed == ACB_BUS_SPEED_6G) @@ -3181,14 +3206,13 @@ static void arcmsr_action(struct cam_sim *psim, union cpi->protocol_version = SCSI_REV_2; } cpi->protocol = PROTO_SCSI; - #endif cpi->ccb_h.status |= CAM_REQ_CMP; xpt_done(pccb); break; } case XPT_ABORT: { union ccb *pabort_ccb; - + pabort_ccb = pccb->cab.abort_ccb; switch (pabort_ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: @@ -3239,7 +3263,6 @@ static void arcmsr_action(struct cam_sim *psim, union break; } cts = &pccb->cts; - #ifdef CAM_NEW_TRAN_CODE { struct ccb_trans_settings_scsi *scsi; struct ccb_trans_settings_spi *spi; @@ -3286,22 +3309,6 @@ static void arcmsr_action(struct cam_sim *psim, union | CTS_SPI_VALID_BUS_WIDTH; } } - #else - { - cts->flags = (CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB); - if (acb->adapter_bus_speed == ACB_BUS_SPEED_6G) - cts->sync_period = 1; - else - cts->sync_period = 2; - cts->sync_offset = 32; - cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT; - cts->valid = CCB_TRANS_SYNC_RATE_VALID | - CCB_TRANS_SYNC_OFFSET_VALID | - CCB_TRANS_BUS_WIDTH_VALID | - CCB_TRANS_DISC_VALID | - CCB_TRANS_TQ_VALID; - } - #endif pccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(pccb); break; @@ -3317,38 +3324,7 @@ static void arcmsr_action(struct cam_sim *psim, union xpt_done(pccb); break; } -#if __FreeBSD_version >= 500000 cam_calc_geometry(&pccb->ccg, 1); -#else - { - struct ccb_calc_geometry *ccg; - u_int32_t size_mb; - u_int32_t secs_per_cylinder; - - ccg = &pccb->ccg; - if (ccg->block_size == 0) { - pccb->ccb_h.status = CAM_REQ_INVALID; - xpt_done(pccb); - break; - } - if(((1024L * 1024L)/ccg->block_size) < 0) { - pccb->ccb_h.status = CAM_REQ_INVALID; - xpt_done(pccb); - break; - } - size_mb = ccg->volume_size/((1024L * 1024L)/ccg->block_size); - if(size_mb > 1024 ) { - ccg->heads = 255; - ccg->secs_per_track = 63; - } else { - ccg->heads = 64; - ccg->secs_per_track = 32; - } - secs_per_cylinder = ccg->heads * ccg->secs_per_track; - ccg->cylinders = ccg->volume_size / secs_per_cylinder; - pccb->ccb_h.status |= CAM_REQ_CMP; - } -#endif xpt_done(pccb); break; default: @@ -3441,6 +3417,7 @@ static void arcmsr_start_adapter_bgrb(struct AdapterCo arcmsr_start_hbd_bgrb(acb); break; case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: arcmsr_start_hbe_bgrb(acb); break; } @@ -3582,7 +3559,7 @@ polling_ccb_retry: break; } if (acb->srboutstandingcount == 0) { - break; + break; } goto polling_ccb_retry; } @@ -3674,7 +3651,7 @@ static void arcmsr_polling_hbe_srbdone(struct AdapterC struct CommandControlBlock *srb; u_int32_t poll_srb_done=0, poll_count=0, doneq_index; u_int16_t error, cmdSMID; - + polling_ccb_retry: poll_count++; bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); @@ -3685,12 +3662,12 @@ polling_ccb_retry: break;/*chip FIFO no ccb for completion already*/ } else { UDELAY(25000); - if ((poll_count > 100) && (poll_srb != NULL)) { + if ((poll_count > 100) && (poll_srb != NULL)) { break; } - if (acb->srboutstandingcount == 0) { - break; - } + if (acb->srboutstandingcount == 0) { + break; + } goto polling_ccb_retry; } } @@ -3726,25 +3703,21 @@ polling_ccb_retry: static void arcmsr_polling_srbdone(struct AdapterControlBlock *acb, struct CommandControlBlock *poll_srb) { switch (acb->adapter_type) { - case ACB_ADAPTER_TYPE_A: { - arcmsr_polling_hba_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_A: + arcmsr_polling_hba_srbdone(acb, poll_srb); break; - case ACB_ADAPTER_TYPE_B: { - arcmsr_polling_hbb_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_B: + arcmsr_polling_hbb_srbdone(acb, poll_srb); break; - case ACB_ADAPTER_TYPE_C: { - arcmsr_polling_hbc_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_C: + arcmsr_polling_hbc_srbdone(acb, poll_srb); break; - case ACB_ADAPTER_TYPE_D: { - arcmsr_polling_hbd_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_D: + arcmsr_polling_hbd_srbdone(acb, poll_srb); break; - case ACB_ADAPTER_TYPE_E: { - arcmsr_polling_hbe_srbdone(acb, poll_srb); - } + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: + arcmsr_polling_hbe_srbdone(acb, poll_srb); break; } } @@ -3961,14 +3934,14 @@ static void arcmsr_get_hbe_config(struct AdapterContro size_t iop_firm_version = offsetof(struct HBE_MessageUnit,msgcode_rwbuffer[ARCMSR_FW_VERS_OFFSET]); /*firm_version,17,68-83*/ size_t iop_device_map = offsetof(struct HBE_MessageUnit,msgcode_rwbuffer[ARCMSR_FW_DEVMAP_OFFSET]); int i; - + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); if(!arcmsr_hbe_wait_msgint_ready(acb)) { printf("arcmsr%d: wait 'get adapter firmware miscellaneous data' timeout \n", acb->pci_unit); } - + i = 0; while(i < 8) { *acb_firm_model = bus_space_read_1(acb->btag[0], acb->bhandle[0], iop_firm_model+i); @@ -4004,29 +3977,81 @@ static void arcmsr_get_hbe_config(struct AdapterContro ********************************************************************** ********************************************************************** */ +static void arcmsr_get_hbf_config(struct AdapterControlBlock *acb) +{ + u_int32_t *acb_firm_model = (u_int32_t *)acb->firm_model; + u_int32_t *acb_firm_version = (u_int32_t *)acb->firm_version; + u_int32_t *acb_device_map = (u_int32_t *)acb->device_map; + size_t iop_firm_model = ARCMSR_FW_MODEL_OFFSET; /*firm_model,15,60-67*/ + size_t iop_firm_version = ARCMSR_FW_VERS_OFFSET; /*firm_version,17,68-83*/ + size_t iop_device_map = ARCMSR_FW_DEVMAP_OFFSET; + int i; + + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) + printf("arcmsr%d: wait 'get adapter firmware miscellaneous data' timeout \n", acb->pci_unit); + + i = 0; + while(i < 2) { + *acb_firm_model = acb->msgcode_rwbuffer[iop_firm_model]; + /* 8 bytes firm_model, 15, 60-67*/ + acb_firm_model++; + iop_firm_model++; + i++; + } + i = 0; + while(i < 4) { + *acb_firm_version = acb->msgcode_rwbuffer[iop_firm_version]; + /* 16 bytes firm_version, 17, 68-83*/ + acb_firm_version++; + iop_firm_version++; + i++; + } + i = 0; + while(i < 4) { + *acb_device_map = acb->msgcode_rwbuffer[iop_device_map]; + acb_device_map++; + iop_device_map++; + i++; + } + printf("Areca RAID adapter%d: %s F/W version %s \n", acb->pci_unit, acb->firm_model, acb->firm_version); + acb->firm_request_len = acb->msgcode_rwbuffer[1]; /*firm_request_len, 1, 04-07*/ + acb->firm_numbers_queue = acb->msgcode_rwbuffer[2]; /*firm_numbers_queue, 2, 08-11*/ + acb->firm_sdram_size = acb->msgcode_rwbuffer[3]; /*firm_sdram_size, 3, 12-15*/ + acb->firm_ide_channels = acb->msgcode_rwbuffer[4]; /*firm_ide_channels, 4, 16-19*/ + acb->firm_cfg_version = acb->msgcode_rwbuffer[ARCMSR_FW_CFGVER_OFFSET]; /*firm_cfg_version, 25*/ + if(acb->firm_numbers_queue > ARCMSR_MAX_OUTSTANDING_CMD) + acb->maxOutstanding = ARCMSR_MAX_OUTSTANDING_CMD - 1; + else + acb->maxOutstanding = acb->firm_numbers_queue - 1; +} +/* +********************************************************************** +********************************************************************** +*/ static void arcmsr_get_firmware_spec(struct AdapterControlBlock *acb) { switch (acb->adapter_type) { - case ACB_ADAPTER_TYPE_A: { - arcmsr_get_hba_config(acb); - } + case ACB_ADAPTER_TYPE_A: + arcmsr_get_hba_config(acb); break; - case ACB_ADAPTER_TYPE_B: { - arcmsr_get_hbb_config(acb); - } + case ACB_ADAPTER_TYPE_B: + arcmsr_get_hbb_config(acb); break; - case ACB_ADAPTER_TYPE_C: { - arcmsr_get_hbc_config(acb); - } + case ACB_ADAPTER_TYPE_C: + arcmsr_get_hbc_config(acb); break; - case ACB_ADAPTER_TYPE_D: { - arcmsr_get_hbd_config(acb); - } + case ACB_ADAPTER_TYPE_D: + arcmsr_get_hbd_config(acb); break; - case ACB_ADAPTER_TYPE_E: { - arcmsr_get_hbe_config(acb); - } + case ACB_ADAPTER_TYPE_E: + arcmsr_get_hbe_config(acb); break; + case ACB_ADAPTER_TYPE_F: + arcmsr_get_hbf_config(acb); + break; } } /* @@ -4088,7 +4113,8 @@ static void arcmsr_wait_firmware_ready( struct Adapter } } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { while ((CHIP_REG_READ32(HBE_MessageUnit, 0, outbound_msgaddr1) & ARCMSR_HBEMU_MESSAGE_FIRMWARE_OK) == 0) { if (timeout++ > 4000) /* (4000*15)/1000 = 60 sec */ @@ -4141,7 +4167,8 @@ static void arcmsr_clear_doorbell_queue_buffer( struct CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_OUT_READ); } break; - case ACB_ADAPTER_TYPE_E: { + case ACB_ADAPTER_TYPE_E: + case ACB_ADAPTER_TYPE_F: { /* empty doorbell Qbuffer if door bell ringed */ acb->in_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell); CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); /*clear doorbell interrupt */ @@ -4276,6 +4303,27 @@ static u_int32_t arcmsr_iop_confirm(struct AdapterCont } } break; + case ACB_ADAPTER_TYPE_F: { + u_int32_t cdb_phyaddr_lo32; + cdb_phyaddr_lo32 = srb_phyaddr_lo32 + offsetof(struct CommandControlBlock, arcmsr_cdb); + acb->msgcode_rwbuffer[0] = ARCMSR_SIGNATURE_SET_CONFIG; + acb->msgcode_rwbuffer[1] = ARCMSR_SIGNATURE_1886; + acb->msgcode_rwbuffer[2] = cdb_phyaddr_lo32; + acb->msgcode_rwbuffer[3] = srb_phyaddr_hi32; + acb->msgcode_rwbuffer[4] = SRB_SIZE; + cdb_phyaddr_lo32 = srb_phyaddr_lo32 + ARCMSR_SRBS_POOL_SIZE; + acb->msgcode_rwbuffer[5] = cdb_phyaddr_lo32; + acb->msgcode_rwbuffer[6] = srb_phyaddr_hi32; + acb->msgcode_rwbuffer[7] = COMPLETION_Q_POOL_SIZE; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_SET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBF_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) { + printf( "arcmsr%d: 'set srb high part physical address' timeout \n", acb->pci_unit); + return FALSE; + } + } + break; } return (TRUE); } @@ -4339,7 +4387,7 @@ static void arcmsr_map_free_srb(void *arg, bus_dma_seg return; } if((acb->adapter_type == ACB_ADAPTER_TYPE_C) || (acb->adapter_type == ACB_ADAPTER_TYPE_D) - || (acb->adapter_type == ACB_ADAPTER_TYPE_E)) + || (acb->adapter_type == ACB_ADAPTER_TYPE_E) || (acb->adapter_type == ACB_ADAPTER_TYPE_F)) { srb_tmp->cdb_phyaddr_low = srb_phyaddr; srb_tmp->cdb_phyaddr_high = (u_int32_t)((srb_phyaddr >> 16) >> 16); @@ -4354,6 +4402,15 @@ static void arcmsr_map_free_srb(void *arg, bus_dma_seg } if (acb->adapter_type == ACB_ADAPTER_TYPE_E) acb->pCompletionQ = (pCompletion_Q)srb_tmp; + else if (acb->adapter_type == ACB_ADAPTER_TYPE_F) { + acb->pCompletionQ = (pCompletion_Q)srb_tmp; + acb->completeQ_phys = srb_phyaddr; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 9 01:52:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B4552E47A2; Mon, 9 Nov 2020 01:52:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTvBS6jJrz3Prj; Mon, 9 Nov 2020 01:52:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D921415BF; Mon, 9 Nov 2020 01:52:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A91qGeo033833; Mon, 9 Nov 2020 01:52:16 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A91qFEh032323; Mon, 9 Nov 2020 01:52:15 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202011090152.0A91qFEh032323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Nov 2020 01:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367510 - in stable/12: include lib/libc/stdlib X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: include lib/libc/stdlib X-SVN-Commit-Revision: 367510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 01:52:17 -0000 Author: delphij Date: Mon Nov 9 01:52:15 2020 New Revision: 367510 URL: https://svnweb.freebsd.org/changeset/base/367510 Log: MFC r366781, r366866: Implement ptsname_r. Modified: stable/12/include/stdlib.h stable/12/lib/libc/stdlib/Makefile.inc stable/12/lib/libc/stdlib/Symbol.map stable/12/lib/libc/stdlib/ptsname.3 stable/12/lib/libc/stdlib/ptsname.c Directory Properties: stable/12/ (props changed) Modified: stable/12/include/stdlib.h ============================================================================== --- stable/12/include/stdlib.h Mon Nov 9 01:41:55 2020 (r367509) +++ stable/12/include/stdlib.h Mon Nov 9 01:52:15 2020 (r367510) @@ -207,7 +207,6 @@ double drand48(void); double erand48(unsigned short[3]); /* char *fcvt(double, int, int * __restrict, int * __restrict); */ /* char *gcvt(double, int, int * __restrict, int * __restrict); */ -int grantpt(int); char *initstate(unsigned int, char *, size_t); long jrand48(unsigned short[3]); char *l64a(long); @@ -219,8 +218,6 @@ char *mktemp(char *); #endif long mrand48(void); long nrand48(unsigned short[3]); -int posix_openpt(int); -char *ptsname(int); int putenv(char *); long random(void); unsigned short @@ -228,8 +225,18 @@ unsigned short char *setstate(/* const */ char *); void srand48(long); void srandom(unsigned int); +#endif /* __XSI_VISIBLE */ + +#if __XSI_VISIBLE +int grantpt(int); +int posix_openpt(int); +char *ptsname(int); int unlockpt(int); #endif /* __XSI_VISIBLE */ +#if __BSD_VISIBLE +/* ptsname_r will be included in POSIX issue 8 */ +int ptsname_r(int, char *, size_t); +#endif #if __BSD_VISIBLE extern const char *malloc_conf; Modified: stable/12/lib/libc/stdlib/Makefile.inc ============================================================================== --- stable/12/lib/libc/stdlib/Makefile.inc Mon Nov 9 01:41:55 2020 (r367509) +++ stable/12/lib/libc/stdlib/Makefile.inc Mon Nov 9 01:52:15 2020 (r367510) @@ -50,7 +50,7 @@ MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3 MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3 MLINKS+=insque.3 remque.3 MLINKS+=lsearch.3 lfind.3 -MLINKS+=ptsname.3 grantpt.3 ptsname.3 unlockpt.3 +MLINKS+=ptsname.3 grantpt.3 ptsname.3 ptsname_r.3 ptsname.3 unlockpt.3 MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3 qsort.3 qsort_r.3 MLINKS+=rand.3 rand_r.3 rand.3 srand.3 rand.3 sranddev.3 MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3 \ Modified: stable/12/lib/libc/stdlib/Symbol.map ============================================================================== --- stable/12/lib/libc/stdlib/Symbol.map Mon Nov 9 01:41:55 2020 (r367509) +++ stable/12/lib/libc/stdlib/Symbol.map Mon Nov 9 01:52:15 2020 (r367510) @@ -124,6 +124,10 @@ FBSD_1.5 { set_constraint_handler_s; }; +FBSD_1.6 { + ptsname_r; +}; + FBSDprivate_1.0 { __system; _system; Modified: stable/12/lib/libc/stdlib/ptsname.3 ============================================================================== --- stable/12/lib/libc/stdlib/ptsname.3 Mon Nov 9 01:41:55 2020 (r367509) +++ stable/12/lib/libc/stdlib/ptsname.3 Mon Nov 9 01:52:15 2020 (r367510) @@ -31,12 +31,13 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2008 +.Dd October 17, 2020 .Dt PTSNAME 3 .Os .Sh NAME .Nm grantpt , .Nm ptsname , +.Nm ptsname_r , .Nm unlockpt .Nd pseudo-terminal access functions .Sh LIBRARY @@ -47,6 +48,8 @@ .Fn grantpt "int fildes" .Ft "char *" .Fn ptsname "int fildes" +.Ft "int" +.Fn ptsname_r "int fildes" "char *buffer" "size_t buflen" .Ft int .Fn unlockpt "int fildes" .Sh DESCRIPTION @@ -87,12 +90,23 @@ and have been called. .Pp The +.Fn ptsname_r +function is the thread-safe version of +.Fn ptsname . +The caller must provide storage for the results of the full pathname of +the slave device in the +.Fa buffer +and +.Fa bufsize +arguments. +.Pp +The .Fn unlockpt function clears the lock held on the pseudo-terminal pair for the master device specified with .Fa fildes . .Sh RETURN VALUES -.Rv -std grantpt unlockpt +.Rv -std grantpt ptsname_r unlockpt .Pp The .Fn ptsname @@ -103,7 +117,8 @@ pointer is returned. .Sh ERRORS The .Fn grantpt , -.Fn ptsname +.Fn ptsname , +.Fn ptsname_r and .Fn unlockpt functions may fail and set @@ -116,6 +131,16 @@ is not a valid open file descriptor. .It Bq Er EINVAL .Fa fildes is not a master pseudo-terminal device. +.El +.Pp +In addition, the +.Fn ptsname_r +function may set +.Va errno +to: +.Bl -tag -width Er +.It Bq Er ERANGE +The buffer was too small. .El .Pp In addition, the Modified: stable/12/lib/libc/stdlib/ptsname.c ============================================================================== --- stable/12/lib/libc/stdlib/ptsname.c Mon Nov 9 01:41:55 2020 (r367509) +++ stable/12/lib/libc/stdlib/ptsname.c Mon Nov 9 01:52:15 2020 (r367510) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "un-namespace.h" /* @@ -71,23 +72,48 @@ __strong_reference(__isptmaster, grantpt); __strong_reference(__isptmaster, unlockpt); /* + * ptsname_r(): return the pathname of the slave pseudo-terminal device + * associated with the specified master. + */ +int +__ptsname_r(int fildes, char *buffer, size_t buflen) +{ + + if (buflen <= sizeof(_PATH_DEV)) { + errno = ERANGE; + return (-1); + } + + /* Make sure fildes points to a master device. */ + if (__isptmaster(fildes) != 0) + return (-1); + + memcpy(buffer, _PATH_DEV, sizeof(_PATH_DEV)); + buffer += sizeof(_PATH_DEV) - 1; + buflen -= sizeof(_PATH_DEV) - 1; + + if (fdevname_r(fildes, buffer, buflen) == NULL) { + if (errno == EINVAL) + errno = ERANGE; + return (-1); + } + + return (0); +} + +__strong_reference(__ptsname_r, ptsname_r); + +/* * ptsname(): return the pathname of the slave pseudo-terminal device * associated with the specified master. */ char * ptsname(int fildes) { - static char pt_slave[sizeof _PATH_DEV + SPECNAMELEN] = _PATH_DEV; - char *ret = NULL; + static char pt_slave[sizeof(_PATH_DEV) + SPECNAMELEN]; - /* Make sure fildes points to a master device. */ - if (__isptmaster(fildes) != 0) - goto done; + if (__ptsname_r(fildes, pt_slave, sizeof(pt_slave)) == 0) + return (pt_slave); - if (fdevname_r(fildes, pt_slave + (sizeof _PATH_DEV - 1), - sizeof pt_slave - (sizeof _PATH_DEV - 1)) != NULL) - ret = pt_slave; - -done: - return (ret); + return (NULL); } From owner-svn-src-all@freebsd.org Mon Nov 9 01:55:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B9FA2E48DB; Mon, 9 Nov 2020 01:55:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTvGB3cxmz3Pxg; Mon, 9 Nov 2020 01:55:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F3F5193F; Mon, 9 Nov 2020 01:55:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A91tUJh035419; Mon, 9 Nov 2020 01:55:30 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A91tUcU035418; Mon, 9 Nov 2020 01:55:30 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202011090155.0A91tUcU035418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Nov 2020 01:55:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367511 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 367511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 01:55:30 -0000 Author: delphij Date: Mon Nov 9 01:55:30 2020 New Revision: 367511 URL: https://svnweb.freebsd.org/changeset/base/367511 Log: Bump __FreeBSD_version after ptsname_r addition. Modified: stable/12/sys/sys/param.h Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Mon Nov 9 01:52:15 2020 (r367510) +++ stable/12/sys/sys/param.h Mon Nov 9 01:55:30 2020 (r367511) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1202503 /* Master, propagated to newvers */ +#define __FreeBSD_version 1202504 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Mon Nov 9 01:56:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFA482E4C1E; Mon, 9 Nov 2020 01:56:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTvGv55zMz3QHM; Mon, 9 Nov 2020 01:56:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1DAA181A; Mon, 9 Nov 2020 01:56:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A91u7ut035497; Mon, 9 Nov 2020 01:56:07 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A91u6Ce035493; Mon, 9 Nov 2020 01:56:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202011090156.0A91u6Ce035493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Nov 2020 01:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367512 - in stable/11: include lib/libc/stdlib X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: include lib/libc/stdlib X-SVN-Commit-Revision: 367512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 01:56:07 -0000 Author: delphij Date: Mon Nov 9 01:56:06 2020 New Revision: 367512 URL: https://svnweb.freebsd.org/changeset/base/367512 Log: MFC r366781, r366866: Implement ptsname_r. Modified: stable/11/include/stdlib.h stable/11/lib/libc/stdlib/Makefile.inc stable/11/lib/libc/stdlib/Symbol.map stable/11/lib/libc/stdlib/ptsname.3 stable/11/lib/libc/stdlib/ptsname.c Directory Properties: stable/11/ (props changed) Modified: stable/11/include/stdlib.h ============================================================================== --- stable/11/include/stdlib.h Mon Nov 9 01:55:30 2020 (r367511) +++ stable/11/include/stdlib.h Mon Nov 9 01:56:06 2020 (r367512) @@ -205,7 +205,6 @@ double drand48(void); double erand48(unsigned short[3]); /* char *fcvt(double, int, int * __restrict, int * __restrict); */ /* char *gcvt(double, int, int * __restrict, int * __restrict); */ -int grantpt(int); char *initstate(unsigned long /* XSI requires u_int */, char *, long); long jrand48(unsigned short[3]); char *l64a(long); @@ -217,8 +216,6 @@ char *mktemp(char *); #endif long mrand48(void); long nrand48(unsigned short[3]); -int posix_openpt(int); -char *ptsname(int); int putenv(char *); long random(void); unsigned short @@ -230,8 +227,18 @@ int setkey(const char *); char *setstate(/* const */ char *); void srand48(long); void srandom(unsigned long); +#endif /* __XSI_VISIBLE */ + +#if __XSI_VISIBLE +int grantpt(int); +int posix_openpt(int); +char *ptsname(int); int unlockpt(int); #endif /* __XSI_VISIBLE */ +#if __BSD_VISIBLE +/* ptsname_r will be included in POSIX issue 8 */ +int ptsname_r(int, char *, size_t); +#endif #if __BSD_VISIBLE extern const char *malloc_conf; Modified: stable/11/lib/libc/stdlib/Makefile.inc ============================================================================== --- stable/11/lib/libc/stdlib/Makefile.inc Mon Nov 9 01:55:30 2020 (r367511) +++ stable/11/lib/libc/stdlib/Makefile.inc Mon Nov 9 01:56:06 2020 (r367512) @@ -50,7 +50,7 @@ MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3 MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3 MLINKS+=insque.3 remque.3 MLINKS+=lsearch.3 lfind.3 -MLINKS+=ptsname.3 grantpt.3 ptsname.3 unlockpt.3 +MLINKS+=ptsname.3 grantpt.3 ptsname.3 ptsname_r.3 ptsname.3 unlockpt.3 MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3 qsort.3 qsort_r.3 MLINKS+=rand.3 rand_r.3 rand.3 srand.3 rand.3 sranddev.3 MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3 \ Modified: stable/11/lib/libc/stdlib/Symbol.map ============================================================================== --- stable/11/lib/libc/stdlib/Symbol.map Mon Nov 9 01:55:30 2020 (r367511) +++ stable/11/lib/libc/stdlib/Symbol.map Mon Nov 9 01:56:06 2020 (r367512) @@ -124,6 +124,10 @@ FBSD_1.5 { set_constraint_handler_s; }; +FBSD_1.6 { + ptsname_r; +}; + FBSDprivate_1.0 { __system; _system; Modified: stable/11/lib/libc/stdlib/ptsname.3 ============================================================================== --- stable/11/lib/libc/stdlib/ptsname.3 Mon Nov 9 01:55:30 2020 (r367511) +++ stable/11/lib/libc/stdlib/ptsname.3 Mon Nov 9 01:56:06 2020 (r367512) @@ -31,12 +31,13 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2008 +.Dd October 17, 2020 .Dt PTSNAME 3 .Os .Sh NAME .Nm grantpt , .Nm ptsname , +.Nm ptsname_r , .Nm unlockpt .Nd pseudo-terminal access functions .Sh LIBRARY @@ -47,6 +48,8 @@ .Fn grantpt "int fildes" .Ft "char *" .Fn ptsname "int fildes" +.Ft "int" +.Fn ptsname_r "int fildes" "char *buffer" "size_t buflen" .Ft int .Fn unlockpt "int fildes" .Sh DESCRIPTION @@ -87,12 +90,23 @@ and have been called. .Pp The +.Fn ptsname_r +function is the thread-safe version of +.Fn ptsname . +The caller must provide storage for the results of the full pathname of +the slave device in the +.Fa buffer +and +.Fa bufsize +arguments. +.Pp +The .Fn unlockpt function clears the lock held on the pseudo-terminal pair for the master device specified with .Fa fildes . .Sh RETURN VALUES -.Rv -std grantpt unlockpt +.Rv -std grantpt ptsname_r unlockpt .Pp The .Fn ptsname @@ -103,7 +117,8 @@ pointer is returned. .Sh ERRORS The .Fn grantpt , -.Fn ptsname +.Fn ptsname , +.Fn ptsname_r and .Fn unlockpt functions may fail and set @@ -116,6 +131,16 @@ is not a valid open file descriptor. .It Bq Er EINVAL .Fa fildes is not a master pseudo-terminal device. +.El +.Pp +In addition, the +.Fn ptsname_r +function may set +.Va errno +to: +.Bl -tag -width Er +.It Bq Er ERANGE +The buffer was too small. .El .Pp In addition, the Modified: stable/11/lib/libc/stdlib/ptsname.c ============================================================================== --- stable/11/lib/libc/stdlib/ptsname.c Mon Nov 9 01:55:30 2020 (r367511) +++ stable/11/lib/libc/stdlib/ptsname.c Mon Nov 9 01:56:06 2020 (r367512) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "un-namespace.h" /* @@ -69,23 +70,48 @@ __strong_reference(__isptmaster, grantpt); __strong_reference(__isptmaster, unlockpt); /* + * ptsname_r(): return the pathname of the slave pseudo-terminal device + * associated with the specified master. + */ +int +__ptsname_r(int fildes, char *buffer, size_t buflen) +{ + + if (buflen <= sizeof(_PATH_DEV)) { + errno = ERANGE; + return (-1); + } + + /* Make sure fildes points to a master device. */ + if (__isptmaster(fildes) != 0) + return (-1); + + memcpy(buffer, _PATH_DEV, sizeof(_PATH_DEV)); + buffer += sizeof(_PATH_DEV) - 1; + buflen -= sizeof(_PATH_DEV) - 1; + + if (fdevname_r(fildes, buffer, buflen) == NULL) { + if (errno == EINVAL) + errno = ERANGE; + return (-1); + } + + return (0); +} + +__strong_reference(__ptsname_r, ptsname_r); + +/* * ptsname(): return the pathname of the slave pseudo-terminal device * associated with the specified master. */ char * ptsname(int fildes) { - static char pt_slave[sizeof _PATH_DEV + SPECNAMELEN] = _PATH_DEV; - char *ret = NULL; + static char pt_slave[sizeof(_PATH_DEV) + SPECNAMELEN]; - /* Make sure fildes points to a master device. */ - if (__isptmaster(fildes) != 0) - goto done; + if (__ptsname_r(fildes, pt_slave, sizeof(pt_slave)) == 0) + return (pt_slave); - if (fdevname_r(fildes, pt_slave + (sizeof _PATH_DEV - 1), - sizeof pt_slave - (sizeof _PATH_DEV - 1)) != NULL) - ret = pt_slave; - -done: - return (ret); + return (NULL); } From owner-svn-src-all@freebsd.org Mon Nov 9 01:57:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 595772E4967; Mon, 9 Nov 2020 01:57:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTvJ426LGz3QC8; Mon, 9 Nov 2020 01:57:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B1DC1A0A; Mon, 9 Nov 2020 01:57:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A91v8jk035586; Mon, 9 Nov 2020 01:57:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A91v8WY035585; Mon, 9 Nov 2020 01:57:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202011090157.0A91v8WY035585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Nov 2020 01:57:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367513 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 367513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 01:57:08 -0000 Author: delphij Date: Mon Nov 9 01:57:07 2020 New Revision: 367513 URL: https://svnweb.freebsd.org/changeset/base/367513 Log: Bump __FreeBSD_version after ptsname_r addition. Modified: stable/11/sys/sys/param.h Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Mon Nov 9 01:56:06 2020 (r367512) +++ stable/11/sys/sys/param.h Mon Nov 9 01:57:07 2020 (r367513) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1104509 /* Master, propagated to newvers */ +#define __FreeBSD_version 1104510 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Mon Nov 9 03:02:34 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB47B2E5CA7; Mon, 9 Nov 2020 03:02:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTwlZ4qDQz3jMS; Mon, 9 Nov 2020 03:02:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98CD623E0; Mon, 9 Nov 2020 03:02:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A932YDP077853; Mon, 9 Nov 2020 03:02:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A932YdA077852; Mon, 9 Nov 2020 03:02:34 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202011090302.0A932YdA077852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 9 Nov 2020 03:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367514 - head/sys/dev/bxe X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/bxe X-SVN-Commit-Revision: 367514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 03:02:34 -0000 Author: imp Date: Mon Nov 9 03:02:34 2020 New Revision: 367514 URL: https://svnweb.freebsd.org/changeset/base/367514 Log: Remove newline from bxe description, it's not done elsewhere. Modified: head/sys/dev/bxe/bxe.c Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Mon Nov 9 01:57:07 2020 (r367513) +++ head/sys/dev/bxe/bxe.c Mon Nov 9 03:02:34 2020 (r367514) @@ -2520,7 +2520,7 @@ bxe_probe(device_t dev) /* Print out the device identity. */ snprintf(descbuf, BXE_DEVDESC_MAX, - "%s (%c%d) BXE v:%s\n", t->bxe_name, + "%s (%c%d) BXE v:%s", t->bxe_name, (((pci_read_config(dev, PCIR_REVID, 4) & 0xf0) >> 4) + 'A'), (pci_read_config(dev, PCIR_REVID, 4) & 0xf), From owner-svn-src-all@freebsd.org Mon Nov 9 05:17:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FF792E7BD9; Mon, 9 Nov 2020 05:17:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTzlD3d45z3p3Z; Mon, 9 Nov 2020 05:17:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E88B4162; Mon, 9 Nov 2020 05:17:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A95HS37054280; Mon, 9 Nov 2020 05:17:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A95HNbP054254; Mon, 9 Nov 2020 05:17:23 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202011090517.0A95HNbP054254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Nov 2020 05:17:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367515 - stable/12/contrib/less X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/contrib/less X-SVN-Commit-Revision: 367515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 05:17:28 -0000 Author: delphij Date: Mon Nov 9 05:17:23 2020 New Revision: 367515 URL: https://svnweb.freebsd.org/changeset/base/367515 Log: MFC r367005: MFV r366990: less v563. Relnotes: yes Modified: stable/12/contrib/less/NEWS stable/12/contrib/less/README stable/12/contrib/less/brac.c stable/12/contrib/less/ch.c stable/12/contrib/less/charset.c stable/12/contrib/less/charset.h stable/12/contrib/less/cmd.h stable/12/contrib/less/cmdbuf.c stable/12/contrib/less/command.c stable/12/contrib/less/compose.uni stable/12/contrib/less/cvt.c stable/12/contrib/less/decode.c stable/12/contrib/less/edit.c stable/12/contrib/less/filename.c stable/12/contrib/less/fmt.uni stable/12/contrib/less/forwback.c stable/12/contrib/less/funcs.h stable/12/contrib/less/help.c stable/12/contrib/less/ifile.c stable/12/contrib/less/input.c stable/12/contrib/less/jump.c stable/12/contrib/less/less.h stable/12/contrib/less/less.nro stable/12/contrib/less/lessecho.c stable/12/contrib/less/lessecho.nro stable/12/contrib/less/lesskey.c stable/12/contrib/less/lesskey.h stable/12/contrib/less/lesskey.nro stable/12/contrib/less/lglob.h stable/12/contrib/less/line.c stable/12/contrib/less/linenum.c stable/12/contrib/less/lsystem.c stable/12/contrib/less/main.c stable/12/contrib/less/mark.c stable/12/contrib/less/mkutable stable/12/contrib/less/optfunc.c stable/12/contrib/less/option.c stable/12/contrib/less/option.h stable/12/contrib/less/opttbl.c stable/12/contrib/less/os.c stable/12/contrib/less/output.c stable/12/contrib/less/pattern.c stable/12/contrib/less/pattern.h stable/12/contrib/less/pckeys.h stable/12/contrib/less/position.c stable/12/contrib/less/position.h stable/12/contrib/less/prompt.c stable/12/contrib/less/screen.c stable/12/contrib/less/scrsize.c stable/12/contrib/less/search.c stable/12/contrib/less/signal.c stable/12/contrib/less/tags.c stable/12/contrib/less/ttyin.c stable/12/contrib/less/ubin.uni stable/12/contrib/less/version.c stable/12/contrib/less/wide.uni Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/less/NEWS ============================================================================== --- stable/12/contrib/less/NEWS Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/NEWS Mon Nov 9 05:17:23 2020 (r367515) @@ -11,6 +11,31 @@ ====================================================================== + Major changes between "less" versions 551 and 563 + +* Update Unicode tables. + +* Treat Hangul Jamo medial vowels and final consonants as zero width. + +* Display error message immediately when -o is toggled and + input is not a pipe. + +* Fix regression: make screen repaint when "squished" and + a no-movement command is given. + +* Fix erroneous EOF calculation when F command is interrupted. + +* Make WIN32C version include this fix from 551: + Don't count lines in initial screen if using -X with -F. + +* Fix display bug in WIN32C version. + +* Fix memory corruption when built with libtermcap. + +* Support libtinfow. + +====================================================================== + Major changes between "less" versions 530 and 551 * Add --mouse option. Modified: stable/12/contrib/less/README ============================================================================== --- stable/12/contrib/less/README Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/README Mon Nov 9 05:17:23 2020 (r367515) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 551 + Less, version 563 - This is the distribution of less, version 551, released 11 Jun 2019. + This is the distribution of less, version 563, released 13 Jun 2020. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -32,6 +32,14 @@ This is the distribution of "less", a paginator simila The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. + +======================================================================= +PRE-INSTALLATION (when using git) + +If you are building from a clone of a git repository, +type "make -f Makefile.aut". +If you are building from a numbered release package (a tar or zip file +with a name like less-999.tar.gz or less-999.zip), you should skip this step. ======================================================================= INSTALLATION (Unix systems only): Modified: stable/12/contrib/less/brac.c ============================================================================== --- stable/12/contrib/less/brac.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/brac.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/ch.c ============================================================================== --- stable/12/contrib/less/ch.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/ch.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -408,6 +408,7 @@ end_logfile(VOID_PARAM) } close(logfile); logfile = -1; + free(namelogfile); namelogfile = NULL; } @@ -842,7 +843,8 @@ seekable(f) public void ch_set_eof(VOID_PARAM) { - ch_fsize = ch_fpos; + if (ch_fsize != NULL_POSITION && ch_fsize < ch_fpos) + ch_fsize = ch_fpos; } Modified: stable/12/contrib/less/charset.c ============================================================================== --- stable/12/contrib/less/charset.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/charset.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -509,7 +509,7 @@ prutfchar(ch) */ public int utf_len(ch) - unsigned char ch; + int ch; { if ((ch & 0x80) == 0) return 1; Modified: stable/12/contrib/less/charset.h ============================================================================== --- stable/12/contrib/less/charset.h Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/charset.h Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/cmd.h ============================================================================== --- stable/12/contrib/less/cmd.h Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/cmd.h Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/cmdbuf.c ============================================================================== --- stable/12/contrib/less/cmdbuf.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/cmdbuf.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -34,7 +34,7 @@ static int literal; /* Next input char should not be static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete(); +static int cmd_complete LESSPARAMS((int action)); /* * These variables are statics used by cmd_complete. */ @@ -960,10 +960,7 @@ cmd_istr(str) step_char(&s, +1, endline); action = cmd_ichar(os, s - os); if (action != CC_OK) - { - bell(); return (action); - } } return (CC_OK); } Modified: stable/12/contrib/less/command.c ============================================================================== --- stable/12/contrib/less/command.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/command.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -90,7 +90,7 @@ struct ungot { }; static struct ungot* ungot = NULL; -static void multi_search(); +static void multi_search LESSPARAMS((char *pattern, int n, int silent)); /* * Move the cursor to start of prompt line before executing a command. @@ -1806,6 +1806,12 @@ commands(VOID_PARAM) optgetname = FALSE; mca_opt_toggle(); c = getcc(); + cbuf = opt_toggle_disallowed(c); + if (cbuf != NULL) + { + error(cbuf, NULL_PARG); + break; + } goto again; case A_DISP_OPTION: Modified: stable/12/contrib/less/compose.uni ============================================================================== --- stable/12/contrib/less/compose.uni Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/compose.uni Mon Nov 9 05:17:23 2020 (r367515) @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Wed Feb 13 17:57:05 PST 2019 */ +/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x0300, 0x036f }, /* Mn */ { 0x0483, 0x0487 }, /* Mn */ { 0x0488, 0x0489 }, /* Me */ @@ -58,7 +58,7 @@ { 0x0b3f, 0x0b3f }, /* Mn */ { 0x0b41, 0x0b44 }, /* Mn */ { 0x0b4d, 0x0b4d }, /* Mn */ - { 0x0b56, 0x0b56 }, /* Mn */ + { 0x0b55, 0x0b56 }, /* Mn */ { 0x0b62, 0x0b63 }, /* Mn */ { 0x0b82, 0x0b82 }, /* Mn */ { 0x0bc0, 0x0bc0 }, /* Mn */ @@ -81,6 +81,7 @@ { 0x0d41, 0x0d44 }, /* Mn */ { 0x0d4d, 0x0d4d }, /* Mn */ { 0x0d62, 0x0d63 }, /* Mn */ + { 0x0d81, 0x0d81 }, /* Mn */ { 0x0dca, 0x0dca }, /* Mn */ { 0x0dd2, 0x0dd4 }, /* Mn */ { 0x0dd6, 0x0dd6 }, /* Mn */ @@ -88,8 +89,7 @@ { 0x0e34, 0x0e3a }, /* Mn */ { 0x0e47, 0x0e4e }, /* Mn */ { 0x0eb1, 0x0eb1 }, /* Mn */ - { 0x0eb4, 0x0eb9 }, /* Mn */ - { 0x0ebb, 0x0ebc }, /* Mn */ + { 0x0eb4, 0x0ebc }, /* Mn */ { 0x0ec8, 0x0ecd }, /* Mn */ { 0x0f18, 0x0f19 }, /* Mn */ { 0x0f35, 0x0f35 }, /* Mn */ @@ -112,6 +112,7 @@ { 0x1085, 0x1086 }, /* Mn */ { 0x108d, 0x108d }, /* Mn */ { 0x109d, 0x109d }, /* Mn */ + { 0x1160, 0x11ff }, /* Mn */ { 0x135d, 0x135f }, /* Mn */ { 0x1712, 0x1714 }, /* Mn */ { 0x1732, 0x1734 }, /* Mn */ @@ -140,6 +141,7 @@ { 0x1a7f, 0x1a7f }, /* Mn */ { 0x1ab0, 0x1abd }, /* Mn */ { 0x1abe, 0x1abe }, /* Me */ + { 0x1abf, 0x1ac0 }, /* Mn */ { 0x1b00, 0x1b03 }, /* Mn */ { 0x1b34, 0x1b34 }, /* Mn */ { 0x1b36, 0x1b3a }, /* Mn */ @@ -183,6 +185,7 @@ { 0xa806, 0xa806 }, /* Mn */ { 0xa80b, 0xa80b }, /* Mn */ { 0xa825, 0xa826 }, /* Mn */ + { 0xa82c, 0xa82c }, /* Mn */ { 0xa8c4, 0xa8c5 }, /* Mn */ { 0xa8e0, 0xa8f1 }, /* Mn */ { 0xa8ff, 0xa8ff }, /* Mn */ @@ -191,7 +194,7 @@ { 0xa980, 0xa982 }, /* Mn */ { 0xa9b3, 0xa9b3 }, /* Mn */ { 0xa9b6, 0xa9b9 }, /* Mn */ - { 0xa9bc, 0xa9bc }, /* Mn */ + { 0xa9bc, 0xa9bd }, /* Mn */ { 0xa9e5, 0xa9e5 }, /* Mn */ { 0xaa29, 0xaa2e }, /* Mn */ { 0xaa31, 0xaa32 }, /* Mn */ @@ -209,6 +212,8 @@ { 0xabe5, 0xabe5 }, /* Mn */ { 0xabe8, 0xabe8 }, /* Mn */ { 0xabed, 0xabed }, /* Mn */ + { 0xd7b0, 0xd7c6 }, /* Mn */ + { 0xd7cb, 0xd7fb }, /* Mn */ { 0xfb1e, 0xfb1e }, /* Mn */ { 0xfe00, 0xfe0f }, /* Mn */ { 0xfe20, 0xfe2f }, /* Mn */ @@ -222,6 +227,7 @@ { 0x10a3f, 0x10a3f }, /* Mn */ { 0x10ae5, 0x10ae6 }, /* Mn */ { 0x10d24, 0x10d27 }, /* Mn */ + { 0x10eab, 0x10eac }, /* Mn */ { 0x10f46, 0x10f50 }, /* Mn */ { 0x11001, 0x11001 }, /* Mn */ { 0x11038, 0x11046 }, /* Mn */ @@ -235,6 +241,7 @@ { 0x11180, 0x11181 }, /* Mn */ { 0x111b6, 0x111be }, /* Mn */ { 0x111c9, 0x111cc }, /* Mn */ + { 0x111cf, 0x111cf }, /* Mn */ { 0x1122f, 0x11231 }, /* Mn */ { 0x11234, 0x11234 }, /* Mn */ { 0x11236, 0x11237 }, /* Mn */ @@ -270,6 +277,12 @@ { 0x11727, 0x1172b }, /* Mn */ { 0x1182f, 0x11837 }, /* Mn */ { 0x11839, 0x1183a }, /* Mn */ + { 0x1193b, 0x1193c }, /* Mn */ + { 0x1193e, 0x1193e }, /* Mn */ + { 0x11943, 0x11943 }, /* Mn */ + { 0x119d4, 0x119d7 }, /* Mn */ + { 0x119da, 0x119db }, /* Mn */ + { 0x119e0, 0x119e0 }, /* Mn */ { 0x11a01, 0x11a0a }, /* Mn */ { 0x11a33, 0x11a38 }, /* Mn */ { 0x11a3b, 0x11a3e }, /* Mn */ @@ -296,7 +309,9 @@ { 0x11ef3, 0x11ef4 }, /* Mn */ { 0x16af0, 0x16af4 }, /* Mn */ { 0x16b30, 0x16b36 }, /* Mn */ + { 0x16f4f, 0x16f4f }, /* Mn */ { 0x16f8f, 0x16f92 }, /* Mn */ + { 0x16fe4, 0x16fe4 }, /* Mn */ { 0x1bc9d, 0x1bc9e }, /* Mn */ { 0x1d167, 0x1d169 }, /* Mn */ { 0x1d17b, 0x1d182 }, /* Mn */ @@ -314,6 +329,9 @@ { 0x1e01b, 0x1e021 }, /* Mn */ { 0x1e023, 0x1e024 }, /* Mn */ { 0x1e026, 0x1e02a }, /* Mn */ + { 0x1e130, 0x1e136 }, /* Mn */ + { 0x1e2ae, 0x1e2ae }, /* Mn */ + { 0x1e2ec, 0x1e2ef }, /* Mn */ { 0x1e8d0, 0x1e8d6 }, /* Mn */ { 0x1e944, 0x1e94a }, /* Mn */ { 0xe0100, 0xe01ef }, /* Mn */ Modified: stable/12/contrib/less/cvt.c ============================================================================== --- stable/12/contrib/less/cvt.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/cvt.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/decode.c ============================================================================== --- stable/12/contrib/less/decode.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/decode.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/edit.c ============================================================================== --- stable/12/contrib/less/edit.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/edit.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -854,7 +854,6 @@ loop: /* * Don't do anything. */ - free(filename); return; case 'q': quit(QUIT_OK); Modified: stable/12/contrib/less/filename.c ============================================================================== --- stable/12/contrib/less/filename.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/filename.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -795,7 +795,7 @@ lglob(filename) } /* - * @@@ + * Return canonical pathname. */ public char * lrealpath(path) Modified: stable/12/contrib/less/fmt.uni ============================================================================== --- stable/12/contrib/less/fmt.uni Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/fmt.uni Mon Nov 9 05:17:23 2020 (r367515) @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Wed Feb 13 17:57:05 PST 2019 */ +/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x00ad, 0x00ad }, /* Cf */ { 0x0600, 0x0605 }, /* Cf */ { 0x061c, 0x061c }, /* Cf */ @@ -14,6 +14,7 @@ { 0xfff9, 0xfffb }, /* Cf */ { 0x110bd, 0x110bd }, /* Cf */ { 0x110cd, 0x110cd }, /* Cf */ + { 0x13430, 0x13438 }, /* Cf */ { 0x1bca0, 0x1bca3 }, /* Cf */ { 0x1d173, 0x1d17a }, /* Cf */ { 0xe0001, 0xe0001 }, /* Cf */ Modified: stable/12/contrib/less/forwback.c ============================================================================== --- stable/12/contrib/less/forwback.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/forwback.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -21,7 +21,6 @@ public int screen_trashed; public int squished; public int no_back_scroll = 0; public int forw_prompt; -public int same_pos_bell = 1; extern int sigs; extern int top_scroll; @@ -290,7 +289,7 @@ forw(n, pos, force, only_last, nblank) forw_prompt = 1; } - if (nlines == 0 && !ignore_eoi && same_pos_bell) + if (nlines == 0 && !ignore_eoi) eof_bell(); else if (do_repaint) repaint(); @@ -350,7 +349,7 @@ back(n, pos, force, only_last) } } - if (nlines == 0 && same_pos_bell) + if (nlines == 0) eof_bell(); else if (do_repaint) repaint(); Modified: stable/12/contrib/less/funcs.h ============================================================================== --- stable/12/contrib/less/funcs.h Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/funcs.h Mon Nov 9 05:17:23 2020 (r367515) @@ -61,7 +61,7 @@ public int binary_char LESSPARAMS ((LWCHAR c)); public int control_char LESSPARAMS ((LWCHAR c)); public char * prchar LESSPARAMS ((LWCHAR c)); public char * prutfchar LESSPARAMS ((LWCHAR ch)); -public int utf_len LESSPARAMS ((unsigned char ch)); +public int utf_len LESSPARAMS ((int ch)); public int is_utf8_well_formed LESSPARAMS ((char *ss, int slen)); public void utf_skip_to_lead LESSPARAMS ((char **pp, char *limit)); public LWCHAR get_wchar LESSPARAMS ((constant char *p)); @@ -187,10 +187,10 @@ public void pshift_all LESSPARAMS ((VOID_PARAM)); public int is_ansi_end LESSPARAMS ((LWCHAR ch)); public int is_ansi_middle LESSPARAMS ((LWCHAR ch)); public void skip_ansi LESSPARAMS ((char **pp, constant char *limit)); -public int pappend LESSPARAMS ((unsigned char c, POSITION pos)); +public int pappend LESSPARAMS ((int c, POSITION pos)); public int pflushmbc LESSPARAMS ((VOID_PARAM)); public void pdone LESSPARAMS ((int endline, int chopped, int forw)); -public void set_status_col LESSPARAMS ((char c)); +public void set_status_col LESSPARAMS ((int c)); public int gline LESSPARAMS ((int i, int *ap)); public void null_line LESSPARAMS ((VOID_PARAM)); public POSITION forw_raw_line LESSPARAMS ((POSITION curr_pos, char **linep, int *line_lenp)); @@ -243,6 +243,7 @@ public void scan_option LESSPARAMS ((char *s)); public void toggle_option LESSPARAMS ((struct loption *o, int lower, char *s, int how_toggle)); public int opt_has_param LESSPARAMS ((struct loption *o)); public char * opt_prompt LESSPARAMS ((struct loption *o)); +public char * opt_toggle_disallowed LESSPARAMS ((int c)); public int isoptpending LESSPARAMS ((VOID_PARAM)); public void nopendopt LESSPARAMS ((VOID_PARAM)); public int getnum LESSPARAMS ((char **sp, char *printopt, int *errp)); Modified: stable/12/contrib/less/help.c ============================================================================== --- stable/12/contrib/less/help.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/help.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 18:12 on 2019/6/11 */ +/* This file was generated by mkhelp.pl from less.hlp at 3:34 on 2020/6/14 */ #include "less.h" constant char helpdata[] = { '\n', Modified: stable/12/contrib/less/ifile.c ============================================================================== --- stable/12/contrib/less/ifile.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/ifile.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/input.c ============================================================================== --- stable/12/contrib/less/input.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/input.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/jump.c ============================================================================== --- stable/12/contrib/less/jump.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/jump.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -219,7 +219,7 @@ jump_loc(pos, sline) nline -= sindex; if (nline > 0) forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0); - else if (nline < 0) + else back(-nline, position(TOP), 1, 0); #if HILITE_SEARCH if (show_attn) Modified: stable/12/contrib/less/less.h ============================================================================== --- stable/12/contrib/less/less.h Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/less.h Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/less.nro ============================================================================== --- stable/12/contrib/less/less.nro Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/less.nro Mon Nov 9 05:17:23 2020 (r367515) @@ -1,4 +1,5 @@ -.TH LESS 1 "Version 551: 11 Jun 2019" +'\" t +.TH LESS 1 "Version 563: 13 Jun 2020" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -21,19 +22,18 @@ less \- opposite of more .B " [\-# \fIshift\/\fP] [+[+]\fIcmd\/\fP] [\-\-] [\fIfilename\/\fP]..." .br (See the OPTIONS section for alternate option syntax with long option names.) - +. .SH DESCRIPTION .I Less is a program similar to -.I more -(1), but which allows backward movement +.IR more (1), +but which allows backward movement in the file as well as forward movement. Also, .I less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like -.I vi -(1). +.IR vi (1). .I Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals. @@ -48,7 +48,7 @@ and Commands may be preceded by a decimal number, called N in the descriptions below. The number is used by some commands, as indicated. - +. .SH COMMANDS In the following descriptions, ^X means control-X. ESC stands for the ESCAPE key; for example ESC-v means the @@ -229,7 +229,7 @@ that is, do a simple textual comparison. .RE .IP ?pattern Search backward in the file for the N-th line containing the pattern. -The search starts at the last line displayed +The search starts at the last line displayed (but see the \-a and \-j options, which change this). .sp Certain characters are special as in the / command: @@ -376,7 +376,7 @@ this will reset the option to the "opposite" of its de and print a message describing the new setting. This does not work for numeric or string-valued options. .IP \-\-! -Like the \-! command, but takes a long option name +Like the \-!\& command, but takes a long option name rather than a single option letter. .IP _ (Underscore.) @@ -405,7 +405,7 @@ Exits The following four commands may or may not be valid, depending on your particular installation. -.PP +. .IP v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable VISUAL if defined, @@ -425,7 +425,7 @@ On MS-DOS and OS/2 systems, the shell is the normal co .IP "| shell-command" represents any mark letter. Pipes a section of the input file to the given shell command. -The section of the file to be piped is between the position marked by +The section of the file to be piped is between the position marked by the letter and the current screen. The entire current screen is included, regardless of whether the marked position is before or after the current screen. @@ -434,7 +434,7 @@ If is \&.\& or newline, the current screen is pipe .IP "s filename" Save the input to a file. This only works if the input is a pipe, not an ordinary file. -.PP +. .SH OPTIONS Command line options are described below. Most options may be changed while @@ -518,7 +518,7 @@ This was the default behavior in less versions prior t Specifies the amount of buffer space .I less will use for each file, in units of kilobytes (1024 bytes). -By default 64\ K of buffer space is used for each file +By default 64\ KB of buffer space is used for each file (unless the file is a pipe; see the \-B option). The \-b option specifies instead that \fIn\fP kilobytes of buffer space should be used for each file. @@ -530,7 +530,7 @@ buffers are allocated automatically as needed. If a large amount of data is read from the pipe, this can cause a large amount of memory to be allocated. The \-B option disables this automatic allocation of buffers for pipes, -so that only 64\ K +so that only 64\ KB (or the amount of space specified by the \-b option) is used for the pipe. Warning: use of \-B can result in erroneous display, since only the @@ -563,8 +563,9 @@ A single number \fIN\fP is the same as \fIN.M\fP, where \fIM\fP is the normal background color. The color may start or end with \fBu\fP to use underline (with the normal color, if by itself), if the system supports it (Windows only). -\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering (SGR mode). - +\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering +(SGR mode). +. .IP "\-e or \-\-quit-at-eof" Causes .I less @@ -654,8 +655,8 @@ The status column is also used if the \-w or \-W optio Causes .I less to open and interpret the named file as a -.I lesskey -(1) file. +.IR lesskey (1) +file. Multiple \-k options may be specified. If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or if a lesskey file is found in a standard place (see KEY BINDINGS), @@ -746,7 +747,7 @@ to that string. \-Ph changes the prompt for the help screen. \-P= changes the message printed by the = command. \-Pw changes the message printed while waiting for data (in the F command). - +.sp 1 All prompt strings consist of a sequence of letters and special escape sequences. See the section on PROMPTS for more details. @@ -762,7 +763,7 @@ The default is to ring the terminal bell in all such c .IP "\-Q or \-\-QUIET or \-\-SILENT" Causes totally "quiet" operation: the terminal bell is never rung. -If the terminal has a "visual bell", it is used in all cases +If the terminal has a "visual bell", it is used in all cases where the terminal bell would have been rung. .IP "\-r or \-\-raw-control-chars" Causes "raw" control characters to be displayed. @@ -804,7 +805,7 @@ output. Causes lines longer than the screen width to be chopped (truncated) rather than wrapped. That is, the portion of a long line that does not fit in -the screen width is not shown. +the screen width is not displayed until you press RIGHT-ARROW. The default is to wrap long lines; that is, display the remainder on the next line. .IP "\-t\fItag\fP or \-\-tag=\fItag\fP" @@ -813,12 +814,12 @@ will edit the file containing that tag. For this to work, tag information must be available; for example, there may be a file in the current directory called "tags", which was previously built by -.I ctags -(1) or an equivalent command. +.IR ctags (1) +or an equivalent command. If the environment variable LESSGLOBALTAGS is set, it is taken to be the name of a command compatible with -.I global -(1), and that command is executed to find the tag. +.IR global (1), +and that command is executed to find the tag. (See http://www.gnu.org/software/global/global.html). The \-t option may also be specified from within .I less @@ -870,7 +871,7 @@ If only one \fIn\fP is specified, tab stops are set at If multiple values separated by commas are specified, tab stops are set at those positions, and then continue with the same spacing as the last two. -For example, \fI-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. +For example, \fI\-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. The default for \fIn\fP is 8. .IP "\-X or \-\-no-init" Disables sending the termcap initialization and deinitialization strings @@ -944,15 +945,15 @@ will display the contents of that new file. Enables mouse input: scrolling the mouse wheel down moves forward in the file, scrolling the mouse wheel up moves backwards in the file, -and clicking the mouse sets the "#" mark to the line +and clicking the mouse sets the "#" mark to the line where the mouse is clicked. -The number of lines to scroll when the wheel is moved +The number of lines to scroll when the wheel is moved can be set by the \-\-wheel-lines option. Mouse input works only on terminals which support X11 mouse reporting, -and on the Windows version of +and on the Windows version of .IR less . .IP "\-\-MOUSE" -Like \-\-mouse, except the direction scrolled +Like \-\-mouse, except the direction scrolled on mouse wheel movement is reversed. .IP "\-\-no-keypad" Disables sending the keypad initialization and deinitialization strings @@ -961,7 +962,7 @@ This is sometimes useful if the keypad strings make th keypad behave in an undesirable manner. .IP "\-\-no-histdups" This option changes the behavior so that if a search string or -file name is typed in, and the same string is already in the history list, +file name is typed in, and the same string is already in the history list, the existing copy is removed from the history list before the new one is added. Thus, a given string will appear only once in the history list. Normally, a string may appear multiple times. @@ -969,7 +970,7 @@ Normally, a string may appear multiple times. This option changes the character used to mark truncated lines. It may begin with a two-character attribute indicator like LESSBINFMT does. If there is no attribute indicator, standout is used. -If set to "-", truncated lines are not marked. +If set to "\-", truncated lines are not marked. .IP "\-\-save-marks" Save marks in the history file, so marks are retained across different invocations of \fIless\fP. @@ -1001,7 +1002,7 @@ If the option starts with ++, the initial command appl every file being viewed, not just the first one. The + command described previously may also be used to set (or change) an initial command for every file. - +. .SH "LINE EDITING" When entering command line at the bottom of the screen (for example, a filename for the :e command, @@ -1069,13 +1070,12 @@ If you have changed your line-kill character in Unix t other than ^U, that character is used instead of ^U. .IP "^G" Delete the entire command line and return to the main prompt. - +. .SH "KEY BINDINGS" You may define your own .I less commands by using the program -.I lesskey -(1) +.IR lesskey (1) to create a lesskey file. This file specifies a set of command keys and an action associated with each key. @@ -1125,7 +1125,7 @@ was built with a different sysconf directory than /usr that directory is where the sysless file is found.) On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_sysless. On OS/2 systems, the system-wide lesskey file is c:\esysless.ini. - +. .SH "INPUT PREPROCESSOR" You may define an "input preprocessor" for .IR less . @@ -1294,7 +1294,7 @@ Similarly, if the first two characters of LESSOPEN are the input pipe is used on standard input as well as other files. Again, in this case the dash is not considered to be part of the input pipe command. - +. .SH "NATIONAL CHARACTER SETS" There are three types of characters in the input file: .IP "normal characters" @@ -1349,7 +1349,7 @@ In this case, the environment variable LESSCHARDEF can to define a character set. It should be set to a string where each character in the string represents one character in the character set. -The character "." is used for a normal character, "c" for control, +The character ".\&" is used for a normal character, "c" for control, and "b" for binary. A decimal number may be used for repetition. For example, "bccc4b.\&" would mean character 0 is binary, @@ -1361,26 +1361,22 @@ represent any real character set.) .PP This table shows the value of LESSCHARDEF which is equivalent to each of the possible values for LESSCHARSET: -.sp - ascii\ 8bcccbcc18b95.b -.br - dos\ \ \ 8bcccbcc12bc5b95.b. -.br - ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b -.br - \ \ \ \ \ \ 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. -.br - IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc -.br - \ \ \ \ \ \ 191.b -.br - iso8859 8bcccbcc18b95.33b. -.br - koi8-r 8bcccbcc18b95.b128. -.br - latin1 8bcccbcc18b95.33b. -.br - next\ \ 8bcccbcc18b95.bb125.bb +. +.RS 5m +.TS +l l. +ascii 8bcccbcc18b95.b +dos 8bcccbcc12bc5b95.b. +ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b + 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. +IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc + 191.b +iso8859 8bcccbcc18b95.33b. +koi8-r 8bcccbcc18b95.b128. +latin1 8bcccbcc18b95.33b. +next 8bcccbcc18b95.bb125.bb +.TE +.RE .PP If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" @@ -1429,11 +1425,11 @@ setting ("*x") so specifying one will affect both; LESSUTFBINFMT is read after LESSBINFMT so its setting, if any, will have priority. Problematic octets in a UTF-8 file (octets of a truncated sequence, -octets of a complete but non-shortest form sequence, illegal octets, +octets of a complete but non-shortest form sequence, invalid octets, and stray trailing octets) are displayed individually using LESSBINFMT so as to facilitate diagnostic of how the UTF-8 file is ill-formed. - +. .SH "PROMPTS" The \-P option allows you to tailor the prompt to your preference. The string given to the \-P option replaces the specified prompt string. @@ -1500,7 +1496,8 @@ Causes any trailing spaces to be removed. Usually used at the end of the string, but may appear anywhere. .IP "%T" Normally expands to the word "file". -However if viewing files via a tags list using the \-t option, it expands to the word "tag". +However if viewing files via a tags list using the \-t option, +it expands to the word "tag". .IP "%x" Replaced by the name of the next input file in the list. .PP @@ -1620,7 +1617,7 @@ line number, followed by the shell-escaped file name. If your editor does not accept the "+linenumber" syntax, or has other differences in invocation syntax, the LESSEDIT variable can be changed to modify this default. - +. .SH SECURITY When the environment variable LESSSECURE is set to 1, .I less @@ -1641,14 +1638,14 @@ log files use of lesskey files .IP "\-t" use of tags files -.IP " " +.IP metacharacters in filenames, such as * -.IP " " +.IP filename completion (TAB, ^L) .RE .PP Less can also be compiled to be permanently in "secure" mode. - +. .SH "COMPATIBILITY WITH MORE" If the environment variable LESS_IS_MORE is set to 1, or if the program is invoked via a file link named "more", @@ -1666,7 +1663,7 @@ behaves as if the \-E option were set. .PP The \-m option works differently. If the \-m option is not set, the medium prompt is used, -and it is prefixed with the string "--More--". +and it is prefixed with the string "\-\-More\-\-". If the \-m option is set, the short prompt is used. .PP The \-n option acts like the \-z option. @@ -1678,12 +1675,12 @@ command rather than a search pattern. .PP The LESS environment variable is ignored, and the MORE environment variable is used in its place. - +. .SH "ENVIRONMENT VARIABLES" Environment variables may be specified either in the system environment as usual, or in a -.I lesskey -(1) file. +.IR lesskey (1) +file. If environment variables are defined in more than one place, variables defined in a local lesskey file take precedence over variables defined in the system environment, which take precedence @@ -1738,8 +1735,8 @@ See discussion under PROMPTS. .IP LESSGLOBALTAGS Name of the command used by the \-t option to find global tags. Normally should be set to "global" if your system has the -.I global -(1) command. If not set, global tags are not used. +.IR global (1) +command. If not set, global tags are not used. .IP LESSHISTFILE Name of the history file used to remember search commands and shell commands between invocations of @@ -1752,9 +1749,13 @@ on OS/2 systems. The maximum number of commands to save in the history file. The default is 100. .IP LESSKEY -Name of the default lesskey(1) file. +Name of the default +.IR lesskey (1) +file. .IP LESSKEY_SYSTEM -Name of the default system-wide lesskey(1) file. +Name of the default system-wide +.IR lesskey (1) +file. .IP LESSMETACHARS List of characters which are considered "metacharacters" by the shell. .IP LESSMETAESCAPE @@ -1773,8 +1774,8 @@ String to be appended to a directory name in filename Format for displaying non-printable Unicode code points. .IP LESS_IS_MORE Emulate the -.I more -(1) command. +.IR more (1) +command. .IP LINES Sets the number of lines on the screen. Takes precedence over the number of lines specified by the TERM variable. @@ -1791,19 +1792,19 @@ compatible mode. User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). .IP SHELL -The shell used to execute the ! command, as well as to expand filenames. +The shell used to execute the !\& command, as well as to expand filenames. .IP TERM The type of terminal on which .I less is being run. .IP VISUAL The name of the editor (used for the v command). - +. .SH "SEE ALSO" -lesskey(1) - +.BR lesskey (1) +. .SH COPYRIGHT -Copyright (C) 1984-2019 Mark Nudelman +Copyright (C) 1984-2020 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it @@ -1823,9 +1824,9 @@ less is distributed in the hope that it will be useful WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - +. .SH AUTHOR -.PP +. Mark Nudelman .br Report bugs at https://github.com/gwsw/less/issues. Modified: stable/12/contrib/less/lessecho.c ============================================================================== --- stable/12/contrib/less/lessecho.c Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/lessecho.c Mon Nov 9 05:17:23 2020 (r367515) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/lessecho.nro ============================================================================== --- stable/12/contrib/less/lessecho.nro Mon Nov 9 03:02:34 2020 (r367514) +++ stable/12/contrib/less/lessecho.nro Mon Nov 9 05:17:23 2020 (r367515) @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 551: 11 Jun 2019" +.TH LESSECHO 1 "Version 563: 13 Jun 2020" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS @@ -44,7 +44,7 @@ Specifies "n" to be the escape char for metachars, as Specifies that all arguments are to be quoted. The default is that only arguments containing metacharacters are quoted .SH "SEE ALSO" -less(1) +.BR less (1) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 9 05:20:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2681D2E7771; Mon, 9 Nov 2020 05:20:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CTzpJ0XYRz3pCM; Mon, 9 Nov 2020 05:20:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00BE34208; Mon, 9 Nov 2020 05:20:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A95K7j4054479; Mon, 9 Nov 2020 05:20:07 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A95K2o3054447; Mon, 9 Nov 2020 05:20:02 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202011090520.0A95K2o3054447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Nov 2020 05:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367516 - stable/11/contrib/less X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/contrib/less X-SVN-Commit-Revision: 367516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 05:20:08 -0000 Author: delphij Date: Mon Nov 9 05:20:02 2020 New Revision: 367516 URL: https://svnweb.freebsd.org/changeset/base/367516 Log: MFC r367005: MFV r366990: less v563. Relnotes: yes Modified: stable/11/contrib/less/NEWS stable/11/contrib/less/README stable/11/contrib/less/brac.c stable/11/contrib/less/ch.c stable/11/contrib/less/charset.c stable/11/contrib/less/charset.h stable/11/contrib/less/cmd.h stable/11/contrib/less/cmdbuf.c stable/11/contrib/less/command.c stable/11/contrib/less/compose.uni stable/11/contrib/less/cvt.c stable/11/contrib/less/decode.c stable/11/contrib/less/edit.c stable/11/contrib/less/filename.c stable/11/contrib/less/fmt.uni stable/11/contrib/less/forwback.c stable/11/contrib/less/funcs.h stable/11/contrib/less/help.c stable/11/contrib/less/ifile.c stable/11/contrib/less/input.c stable/11/contrib/less/jump.c stable/11/contrib/less/less.h stable/11/contrib/less/less.nro stable/11/contrib/less/lessecho.c stable/11/contrib/less/lessecho.nro stable/11/contrib/less/lesskey.c stable/11/contrib/less/lesskey.h stable/11/contrib/less/lesskey.nro stable/11/contrib/less/lglob.h stable/11/contrib/less/line.c stable/11/contrib/less/linenum.c stable/11/contrib/less/lsystem.c stable/11/contrib/less/main.c stable/11/contrib/less/mark.c stable/11/contrib/less/mkutable stable/11/contrib/less/optfunc.c stable/11/contrib/less/option.c stable/11/contrib/less/option.h stable/11/contrib/less/opttbl.c stable/11/contrib/less/os.c stable/11/contrib/less/output.c stable/11/contrib/less/pattern.c stable/11/contrib/less/pattern.h stable/11/contrib/less/pckeys.h stable/11/contrib/less/position.c stable/11/contrib/less/position.h stable/11/contrib/less/prompt.c stable/11/contrib/less/screen.c stable/11/contrib/less/scrsize.c stable/11/contrib/less/search.c stable/11/contrib/less/signal.c stable/11/contrib/less/tags.c stable/11/contrib/less/ttyin.c stable/11/contrib/less/ubin.uni stable/11/contrib/less/version.c stable/11/contrib/less/wide.uni Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/less/NEWS ============================================================================== --- stable/11/contrib/less/NEWS Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/NEWS Mon Nov 9 05:20:02 2020 (r367516) @@ -11,6 +11,31 @@ ====================================================================== + Major changes between "less" versions 551 and 563 + +* Update Unicode tables. + +* Treat Hangul Jamo medial vowels and final consonants as zero width. + +* Display error message immediately when -o is toggled and + input is not a pipe. + +* Fix regression: make screen repaint when "squished" and + a no-movement command is given. + +* Fix erroneous EOF calculation when F command is interrupted. + +* Make WIN32C version include this fix from 551: + Don't count lines in initial screen if using -X with -F. + +* Fix display bug in WIN32C version. + +* Fix memory corruption when built with libtermcap. + +* Support libtinfow. + +====================================================================== + Major changes between "less" versions 530 and 551 * Add --mouse option. Modified: stable/11/contrib/less/README ============================================================================== --- stable/11/contrib/less/README Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/README Mon Nov 9 05:20:02 2020 (r367516) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 551 + Less, version 563 - This is the distribution of less, version 551, released 11 Jun 2019. + This is the distribution of less, version 563, released 13 Jun 2020. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -32,6 +32,14 @@ This is the distribution of "less", a paginator simila The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. + +======================================================================= +PRE-INSTALLATION (when using git) + +If you are building from a clone of a git repository, +type "make -f Makefile.aut". +If you are building from a numbered release package (a tar or zip file +with a name like less-999.tar.gz or less-999.zip), you should skip this step. ======================================================================= INSTALLATION (Unix systems only): Modified: stable/11/contrib/less/brac.c ============================================================================== --- stable/11/contrib/less/brac.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/brac.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/ch.c ============================================================================== --- stable/11/contrib/less/ch.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/ch.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -408,6 +408,7 @@ end_logfile(VOID_PARAM) } close(logfile); logfile = -1; + free(namelogfile); namelogfile = NULL; } @@ -842,7 +843,8 @@ seekable(f) public void ch_set_eof(VOID_PARAM) { - ch_fsize = ch_fpos; + if (ch_fsize != NULL_POSITION && ch_fsize < ch_fpos) + ch_fsize = ch_fpos; } Modified: stable/11/contrib/less/charset.c ============================================================================== --- stable/11/contrib/less/charset.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/charset.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -509,7 +509,7 @@ prutfchar(ch) */ public int utf_len(ch) - unsigned char ch; + int ch; { if ((ch & 0x80) == 0) return 1; Modified: stable/11/contrib/less/charset.h ============================================================================== --- stable/11/contrib/less/charset.h Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/charset.h Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/cmd.h ============================================================================== --- stable/11/contrib/less/cmd.h Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/cmd.h Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/cmdbuf.c ============================================================================== --- stable/11/contrib/less/cmdbuf.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/cmdbuf.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -34,7 +34,7 @@ static int literal; /* Next input char should not be static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete(); +static int cmd_complete LESSPARAMS((int action)); /* * These variables are statics used by cmd_complete. */ @@ -960,10 +960,7 @@ cmd_istr(str) step_char(&s, +1, endline); action = cmd_ichar(os, s - os); if (action != CC_OK) - { - bell(); return (action); - } } return (CC_OK); } Modified: stable/11/contrib/less/command.c ============================================================================== --- stable/11/contrib/less/command.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/command.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -90,7 +90,7 @@ struct ungot { }; static struct ungot* ungot = NULL; -static void multi_search(); +static void multi_search LESSPARAMS((char *pattern, int n, int silent)); /* * Move the cursor to start of prompt line before executing a command. @@ -1806,6 +1806,12 @@ commands(VOID_PARAM) optgetname = FALSE; mca_opt_toggle(); c = getcc(); + cbuf = opt_toggle_disallowed(c); + if (cbuf != NULL) + { + error(cbuf, NULL_PARG); + break; + } goto again; case A_DISP_OPTION: Modified: stable/11/contrib/less/compose.uni ============================================================================== --- stable/11/contrib/less/compose.uni Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/compose.uni Mon Nov 9 05:20:02 2020 (r367516) @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Wed Feb 13 17:57:05 PST 2019 */ +/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x0300, 0x036f }, /* Mn */ { 0x0483, 0x0487 }, /* Mn */ { 0x0488, 0x0489 }, /* Me */ @@ -58,7 +58,7 @@ { 0x0b3f, 0x0b3f }, /* Mn */ { 0x0b41, 0x0b44 }, /* Mn */ { 0x0b4d, 0x0b4d }, /* Mn */ - { 0x0b56, 0x0b56 }, /* Mn */ + { 0x0b55, 0x0b56 }, /* Mn */ { 0x0b62, 0x0b63 }, /* Mn */ { 0x0b82, 0x0b82 }, /* Mn */ { 0x0bc0, 0x0bc0 }, /* Mn */ @@ -81,6 +81,7 @@ { 0x0d41, 0x0d44 }, /* Mn */ { 0x0d4d, 0x0d4d }, /* Mn */ { 0x0d62, 0x0d63 }, /* Mn */ + { 0x0d81, 0x0d81 }, /* Mn */ { 0x0dca, 0x0dca }, /* Mn */ { 0x0dd2, 0x0dd4 }, /* Mn */ { 0x0dd6, 0x0dd6 }, /* Mn */ @@ -88,8 +89,7 @@ { 0x0e34, 0x0e3a }, /* Mn */ { 0x0e47, 0x0e4e }, /* Mn */ { 0x0eb1, 0x0eb1 }, /* Mn */ - { 0x0eb4, 0x0eb9 }, /* Mn */ - { 0x0ebb, 0x0ebc }, /* Mn */ + { 0x0eb4, 0x0ebc }, /* Mn */ { 0x0ec8, 0x0ecd }, /* Mn */ { 0x0f18, 0x0f19 }, /* Mn */ { 0x0f35, 0x0f35 }, /* Mn */ @@ -112,6 +112,7 @@ { 0x1085, 0x1086 }, /* Mn */ { 0x108d, 0x108d }, /* Mn */ { 0x109d, 0x109d }, /* Mn */ + { 0x1160, 0x11ff }, /* Mn */ { 0x135d, 0x135f }, /* Mn */ { 0x1712, 0x1714 }, /* Mn */ { 0x1732, 0x1734 }, /* Mn */ @@ -140,6 +141,7 @@ { 0x1a7f, 0x1a7f }, /* Mn */ { 0x1ab0, 0x1abd }, /* Mn */ { 0x1abe, 0x1abe }, /* Me */ + { 0x1abf, 0x1ac0 }, /* Mn */ { 0x1b00, 0x1b03 }, /* Mn */ { 0x1b34, 0x1b34 }, /* Mn */ { 0x1b36, 0x1b3a }, /* Mn */ @@ -183,6 +185,7 @@ { 0xa806, 0xa806 }, /* Mn */ { 0xa80b, 0xa80b }, /* Mn */ { 0xa825, 0xa826 }, /* Mn */ + { 0xa82c, 0xa82c }, /* Mn */ { 0xa8c4, 0xa8c5 }, /* Mn */ { 0xa8e0, 0xa8f1 }, /* Mn */ { 0xa8ff, 0xa8ff }, /* Mn */ @@ -191,7 +194,7 @@ { 0xa980, 0xa982 }, /* Mn */ { 0xa9b3, 0xa9b3 }, /* Mn */ { 0xa9b6, 0xa9b9 }, /* Mn */ - { 0xa9bc, 0xa9bc }, /* Mn */ + { 0xa9bc, 0xa9bd }, /* Mn */ { 0xa9e5, 0xa9e5 }, /* Mn */ { 0xaa29, 0xaa2e }, /* Mn */ { 0xaa31, 0xaa32 }, /* Mn */ @@ -209,6 +212,8 @@ { 0xabe5, 0xabe5 }, /* Mn */ { 0xabe8, 0xabe8 }, /* Mn */ { 0xabed, 0xabed }, /* Mn */ + { 0xd7b0, 0xd7c6 }, /* Mn */ + { 0xd7cb, 0xd7fb }, /* Mn */ { 0xfb1e, 0xfb1e }, /* Mn */ { 0xfe00, 0xfe0f }, /* Mn */ { 0xfe20, 0xfe2f }, /* Mn */ @@ -222,6 +227,7 @@ { 0x10a3f, 0x10a3f }, /* Mn */ { 0x10ae5, 0x10ae6 }, /* Mn */ { 0x10d24, 0x10d27 }, /* Mn */ + { 0x10eab, 0x10eac }, /* Mn */ { 0x10f46, 0x10f50 }, /* Mn */ { 0x11001, 0x11001 }, /* Mn */ { 0x11038, 0x11046 }, /* Mn */ @@ -235,6 +241,7 @@ { 0x11180, 0x11181 }, /* Mn */ { 0x111b6, 0x111be }, /* Mn */ { 0x111c9, 0x111cc }, /* Mn */ + { 0x111cf, 0x111cf }, /* Mn */ { 0x1122f, 0x11231 }, /* Mn */ { 0x11234, 0x11234 }, /* Mn */ { 0x11236, 0x11237 }, /* Mn */ @@ -270,6 +277,12 @@ { 0x11727, 0x1172b }, /* Mn */ { 0x1182f, 0x11837 }, /* Mn */ { 0x11839, 0x1183a }, /* Mn */ + { 0x1193b, 0x1193c }, /* Mn */ + { 0x1193e, 0x1193e }, /* Mn */ + { 0x11943, 0x11943 }, /* Mn */ + { 0x119d4, 0x119d7 }, /* Mn */ + { 0x119da, 0x119db }, /* Mn */ + { 0x119e0, 0x119e0 }, /* Mn */ { 0x11a01, 0x11a0a }, /* Mn */ { 0x11a33, 0x11a38 }, /* Mn */ { 0x11a3b, 0x11a3e }, /* Mn */ @@ -296,7 +309,9 @@ { 0x11ef3, 0x11ef4 }, /* Mn */ { 0x16af0, 0x16af4 }, /* Mn */ { 0x16b30, 0x16b36 }, /* Mn */ + { 0x16f4f, 0x16f4f }, /* Mn */ { 0x16f8f, 0x16f92 }, /* Mn */ + { 0x16fe4, 0x16fe4 }, /* Mn */ { 0x1bc9d, 0x1bc9e }, /* Mn */ { 0x1d167, 0x1d169 }, /* Mn */ { 0x1d17b, 0x1d182 }, /* Mn */ @@ -314,6 +329,9 @@ { 0x1e01b, 0x1e021 }, /* Mn */ { 0x1e023, 0x1e024 }, /* Mn */ { 0x1e026, 0x1e02a }, /* Mn */ + { 0x1e130, 0x1e136 }, /* Mn */ + { 0x1e2ae, 0x1e2ae }, /* Mn */ + { 0x1e2ec, 0x1e2ef }, /* Mn */ { 0x1e8d0, 0x1e8d6 }, /* Mn */ { 0x1e944, 0x1e94a }, /* Mn */ { 0xe0100, 0xe01ef }, /* Mn */ Modified: stable/11/contrib/less/cvt.c ============================================================================== --- stable/11/contrib/less/cvt.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/cvt.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/decode.c ============================================================================== --- stable/11/contrib/less/decode.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/decode.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/edit.c ============================================================================== --- stable/11/contrib/less/edit.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/edit.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -854,7 +854,6 @@ loop: /* * Don't do anything. */ - free(filename); return; case 'q': quit(QUIT_OK); Modified: stable/11/contrib/less/filename.c ============================================================================== --- stable/11/contrib/less/filename.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/filename.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -795,7 +795,7 @@ lglob(filename) } /* - * @@@ + * Return canonical pathname. */ public char * lrealpath(path) Modified: stable/11/contrib/less/fmt.uni ============================================================================== --- stable/11/contrib/less/fmt.uni Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/fmt.uni Mon Nov 9 05:20:02 2020 (r367516) @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Wed Feb 13 17:57:05 PST 2019 */ +/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x00ad, 0x00ad }, /* Cf */ { 0x0600, 0x0605 }, /* Cf */ { 0x061c, 0x061c }, /* Cf */ @@ -14,6 +14,7 @@ { 0xfff9, 0xfffb }, /* Cf */ { 0x110bd, 0x110bd }, /* Cf */ { 0x110cd, 0x110cd }, /* Cf */ + { 0x13430, 0x13438 }, /* Cf */ { 0x1bca0, 0x1bca3 }, /* Cf */ { 0x1d173, 0x1d17a }, /* Cf */ { 0xe0001, 0xe0001 }, /* Cf */ Modified: stable/11/contrib/less/forwback.c ============================================================================== --- stable/11/contrib/less/forwback.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/forwback.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -21,7 +21,6 @@ public int screen_trashed; public int squished; public int no_back_scroll = 0; public int forw_prompt; -public int same_pos_bell = 1; extern int sigs; extern int top_scroll; @@ -290,7 +289,7 @@ forw(n, pos, force, only_last, nblank) forw_prompt = 1; } - if (nlines == 0 && !ignore_eoi && same_pos_bell) + if (nlines == 0 && !ignore_eoi) eof_bell(); else if (do_repaint) repaint(); @@ -350,7 +349,7 @@ back(n, pos, force, only_last) } } - if (nlines == 0 && same_pos_bell) + if (nlines == 0) eof_bell(); else if (do_repaint) repaint(); Modified: stable/11/contrib/less/funcs.h ============================================================================== --- stable/11/contrib/less/funcs.h Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/funcs.h Mon Nov 9 05:20:02 2020 (r367516) @@ -61,7 +61,7 @@ public int binary_char LESSPARAMS ((LWCHAR c)); public int control_char LESSPARAMS ((LWCHAR c)); public char * prchar LESSPARAMS ((LWCHAR c)); public char * prutfchar LESSPARAMS ((LWCHAR ch)); -public int utf_len LESSPARAMS ((unsigned char ch)); +public int utf_len LESSPARAMS ((int ch)); public int is_utf8_well_formed LESSPARAMS ((char *ss, int slen)); public void utf_skip_to_lead LESSPARAMS ((char **pp, char *limit)); public LWCHAR get_wchar LESSPARAMS ((constant char *p)); @@ -187,10 +187,10 @@ public void pshift_all LESSPARAMS ((VOID_PARAM)); public int is_ansi_end LESSPARAMS ((LWCHAR ch)); public int is_ansi_middle LESSPARAMS ((LWCHAR ch)); public void skip_ansi LESSPARAMS ((char **pp, constant char *limit)); -public int pappend LESSPARAMS ((unsigned char c, POSITION pos)); +public int pappend LESSPARAMS ((int c, POSITION pos)); public int pflushmbc LESSPARAMS ((VOID_PARAM)); public void pdone LESSPARAMS ((int endline, int chopped, int forw)); -public void set_status_col LESSPARAMS ((char c)); +public void set_status_col LESSPARAMS ((int c)); public int gline LESSPARAMS ((int i, int *ap)); public void null_line LESSPARAMS ((VOID_PARAM)); public POSITION forw_raw_line LESSPARAMS ((POSITION curr_pos, char **linep, int *line_lenp)); @@ -243,6 +243,7 @@ public void scan_option LESSPARAMS ((char *s)); public void toggle_option LESSPARAMS ((struct loption *o, int lower, char *s, int how_toggle)); public int opt_has_param LESSPARAMS ((struct loption *o)); public char * opt_prompt LESSPARAMS ((struct loption *o)); +public char * opt_toggle_disallowed LESSPARAMS ((int c)); public int isoptpending LESSPARAMS ((VOID_PARAM)); public void nopendopt LESSPARAMS ((VOID_PARAM)); public int getnum LESSPARAMS ((char **sp, char *printopt, int *errp)); Modified: stable/11/contrib/less/help.c ============================================================================== --- stable/11/contrib/less/help.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/help.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 18:12 on 2019/6/11 */ +/* This file was generated by mkhelp.pl from less.hlp at 3:34 on 2020/6/14 */ #include "less.h" constant char helpdata[] = { '\n', Modified: stable/11/contrib/less/ifile.c ============================================================================== --- stable/11/contrib/less/ifile.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/ifile.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/input.c ============================================================================== --- stable/11/contrib/less/input.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/input.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/jump.c ============================================================================== --- stable/11/contrib/less/jump.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/jump.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -219,7 +219,7 @@ jump_loc(pos, sline) nline -= sindex; if (nline > 0) forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0); - else if (nline < 0) + else back(-nline, position(TOP), 1, 0); #if HILITE_SEARCH if (show_attn) Modified: stable/11/contrib/less/less.h ============================================================================== --- stable/11/contrib/less/less.h Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/less.h Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/less.nro ============================================================================== --- stable/11/contrib/less/less.nro Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/less.nro Mon Nov 9 05:20:02 2020 (r367516) @@ -1,4 +1,5 @@ -.TH LESS 1 "Version 551: 11 Jun 2019" +'\" t +.TH LESS 1 "Version 563: 13 Jun 2020" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -21,19 +22,18 @@ less \- opposite of more .B " [\-# \fIshift\/\fP] [+[+]\fIcmd\/\fP] [\-\-] [\fIfilename\/\fP]..." .br (See the OPTIONS section for alternate option syntax with long option names.) - +. .SH DESCRIPTION .I Less is a program similar to -.I more -(1), but which allows backward movement +.IR more (1), +but which allows backward movement in the file as well as forward movement. Also, .I less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like -.I vi -(1). +.IR vi (1). .I Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals. @@ -48,7 +48,7 @@ and Commands may be preceded by a decimal number, called N in the descriptions below. The number is used by some commands, as indicated. - +. .SH COMMANDS In the following descriptions, ^X means control-X. ESC stands for the ESCAPE key; for example ESC-v means the @@ -229,7 +229,7 @@ that is, do a simple textual comparison. .RE .IP ?pattern Search backward in the file for the N-th line containing the pattern. -The search starts at the last line displayed +The search starts at the last line displayed (but see the \-a and \-j options, which change this). .sp Certain characters are special as in the / command: @@ -376,7 +376,7 @@ this will reset the option to the "opposite" of its de and print a message describing the new setting. This does not work for numeric or string-valued options. .IP \-\-! -Like the \-! command, but takes a long option name +Like the \-!\& command, but takes a long option name rather than a single option letter. .IP _ (Underscore.) @@ -405,7 +405,7 @@ Exits The following four commands may or may not be valid, depending on your particular installation. -.PP +. .IP v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable VISUAL if defined, @@ -425,7 +425,7 @@ On MS-DOS and OS/2 systems, the shell is the normal co .IP "| shell-command" represents any mark letter. Pipes a section of the input file to the given shell command. -The section of the file to be piped is between the position marked by +The section of the file to be piped is between the position marked by the letter and the current screen. The entire current screen is included, regardless of whether the marked position is before or after the current screen. @@ -434,7 +434,7 @@ If is \&.\& or newline, the current screen is pipe .IP "s filename" Save the input to a file. This only works if the input is a pipe, not an ordinary file. -.PP +. .SH OPTIONS Command line options are described below. Most options may be changed while @@ -518,7 +518,7 @@ This was the default behavior in less versions prior t Specifies the amount of buffer space .I less will use for each file, in units of kilobytes (1024 bytes). -By default 64\ K of buffer space is used for each file +By default 64\ KB of buffer space is used for each file (unless the file is a pipe; see the \-B option). The \-b option specifies instead that \fIn\fP kilobytes of buffer space should be used for each file. @@ -530,7 +530,7 @@ buffers are allocated automatically as needed. If a large amount of data is read from the pipe, this can cause a large amount of memory to be allocated. The \-B option disables this automatic allocation of buffers for pipes, -so that only 64\ K +so that only 64\ KB (or the amount of space specified by the \-b option) is used for the pipe. Warning: use of \-B can result in erroneous display, since only the @@ -563,8 +563,9 @@ A single number \fIN\fP is the same as \fIN.M\fP, where \fIM\fP is the normal background color. The color may start or end with \fBu\fP to use underline (with the normal color, if by itself), if the system supports it (Windows only). -\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering (SGR mode). - +\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering +(SGR mode). +. .IP "\-e or \-\-quit-at-eof" Causes .I less @@ -654,8 +655,8 @@ The status column is also used if the \-w or \-W optio Causes .I less to open and interpret the named file as a -.I lesskey -(1) file. +.IR lesskey (1) +file. Multiple \-k options may be specified. If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or if a lesskey file is found in a standard place (see KEY BINDINGS), @@ -746,7 +747,7 @@ to that string. \-Ph changes the prompt for the help screen. \-P= changes the message printed by the = command. \-Pw changes the message printed while waiting for data (in the F command). - +.sp 1 All prompt strings consist of a sequence of letters and special escape sequences. See the section on PROMPTS for more details. @@ -762,7 +763,7 @@ The default is to ring the terminal bell in all such c .IP "\-Q or \-\-QUIET or \-\-SILENT" Causes totally "quiet" operation: the terminal bell is never rung. -If the terminal has a "visual bell", it is used in all cases +If the terminal has a "visual bell", it is used in all cases where the terminal bell would have been rung. .IP "\-r or \-\-raw-control-chars" Causes "raw" control characters to be displayed. @@ -804,7 +805,7 @@ output. Causes lines longer than the screen width to be chopped (truncated) rather than wrapped. That is, the portion of a long line that does not fit in -the screen width is not shown. +the screen width is not displayed until you press RIGHT-ARROW. The default is to wrap long lines; that is, display the remainder on the next line. .IP "\-t\fItag\fP or \-\-tag=\fItag\fP" @@ -813,12 +814,12 @@ will edit the file containing that tag. For this to work, tag information must be available; for example, there may be a file in the current directory called "tags", which was previously built by -.I ctags -(1) or an equivalent command. +.IR ctags (1) +or an equivalent command. If the environment variable LESSGLOBALTAGS is set, it is taken to be the name of a command compatible with -.I global -(1), and that command is executed to find the tag. +.IR global (1), +and that command is executed to find the tag. (See http://www.gnu.org/software/global/global.html). The \-t option may also be specified from within .I less @@ -870,7 +871,7 @@ If only one \fIn\fP is specified, tab stops are set at If multiple values separated by commas are specified, tab stops are set at those positions, and then continue with the same spacing as the last two. -For example, \fI-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. +For example, \fI\-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. The default for \fIn\fP is 8. .IP "\-X or \-\-no-init" Disables sending the termcap initialization and deinitialization strings @@ -944,15 +945,15 @@ will display the contents of that new file. Enables mouse input: scrolling the mouse wheel down moves forward in the file, scrolling the mouse wheel up moves backwards in the file, -and clicking the mouse sets the "#" mark to the line +and clicking the mouse sets the "#" mark to the line where the mouse is clicked. -The number of lines to scroll when the wheel is moved +The number of lines to scroll when the wheel is moved can be set by the \-\-wheel-lines option. Mouse input works only on terminals which support X11 mouse reporting, -and on the Windows version of +and on the Windows version of .IR less . .IP "\-\-MOUSE" -Like \-\-mouse, except the direction scrolled +Like \-\-mouse, except the direction scrolled on mouse wheel movement is reversed. .IP "\-\-no-keypad" Disables sending the keypad initialization and deinitialization strings @@ -961,7 +962,7 @@ This is sometimes useful if the keypad strings make th keypad behave in an undesirable manner. .IP "\-\-no-histdups" This option changes the behavior so that if a search string or -file name is typed in, and the same string is already in the history list, +file name is typed in, and the same string is already in the history list, the existing copy is removed from the history list before the new one is added. Thus, a given string will appear only once in the history list. Normally, a string may appear multiple times. @@ -969,7 +970,7 @@ Normally, a string may appear multiple times. This option changes the character used to mark truncated lines. It may begin with a two-character attribute indicator like LESSBINFMT does. If there is no attribute indicator, standout is used. -If set to "-", truncated lines are not marked. +If set to "\-", truncated lines are not marked. .IP "\-\-save-marks" Save marks in the history file, so marks are retained across different invocations of \fIless\fP. @@ -1001,7 +1002,7 @@ If the option starts with ++, the initial command appl every file being viewed, not just the first one. The + command described previously may also be used to set (or change) an initial command for every file. - +. .SH "LINE EDITING" When entering command line at the bottom of the screen (for example, a filename for the :e command, @@ -1069,13 +1070,12 @@ If you have changed your line-kill character in Unix t other than ^U, that character is used instead of ^U. .IP "^G" Delete the entire command line and return to the main prompt. - +. .SH "KEY BINDINGS" You may define your own .I less commands by using the program -.I lesskey -(1) +.IR lesskey (1) to create a lesskey file. This file specifies a set of command keys and an action associated with each key. @@ -1125,7 +1125,7 @@ was built with a different sysconf directory than /usr that directory is where the sysless file is found.) On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_sysless. On OS/2 systems, the system-wide lesskey file is c:\esysless.ini. - +. .SH "INPUT PREPROCESSOR" You may define an "input preprocessor" for .IR less . @@ -1294,7 +1294,7 @@ Similarly, if the first two characters of LESSOPEN are the input pipe is used on standard input as well as other files. Again, in this case the dash is not considered to be part of the input pipe command. - +. .SH "NATIONAL CHARACTER SETS" There are three types of characters in the input file: .IP "normal characters" @@ -1349,7 +1349,7 @@ In this case, the environment variable LESSCHARDEF can to define a character set. It should be set to a string where each character in the string represents one character in the character set. -The character "." is used for a normal character, "c" for control, +The character ".\&" is used for a normal character, "c" for control, and "b" for binary. A decimal number may be used for repetition. For example, "bccc4b.\&" would mean character 0 is binary, @@ -1361,26 +1361,22 @@ represent any real character set.) .PP This table shows the value of LESSCHARDEF which is equivalent to each of the possible values for LESSCHARSET: -.sp - ascii\ 8bcccbcc18b95.b -.br - dos\ \ \ 8bcccbcc12bc5b95.b. -.br - ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b -.br - \ \ \ \ \ \ 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. -.br - IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc -.br - \ \ \ \ \ \ 191.b -.br - iso8859 8bcccbcc18b95.33b. -.br - koi8-r 8bcccbcc18b95.b128. -.br - latin1 8bcccbcc18b95.33b. -.br - next\ \ 8bcccbcc18b95.bb125.bb +. +.RS 5m +.TS +l l. +ascii 8bcccbcc18b95.b +dos 8bcccbcc12bc5b95.b. +ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b + 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. +IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc + 191.b +iso8859 8bcccbcc18b95.33b. +koi8-r 8bcccbcc18b95.b128. +latin1 8bcccbcc18b95.33b. +next 8bcccbcc18b95.bb125.bb +.TE +.RE .PP If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" @@ -1429,11 +1425,11 @@ setting ("*x") so specifying one will affect both; LESSUTFBINFMT is read after LESSBINFMT so its setting, if any, will have priority. Problematic octets in a UTF-8 file (octets of a truncated sequence, -octets of a complete but non-shortest form sequence, illegal octets, +octets of a complete but non-shortest form sequence, invalid octets, and stray trailing octets) are displayed individually using LESSBINFMT so as to facilitate diagnostic of how the UTF-8 file is ill-formed. - +. .SH "PROMPTS" The \-P option allows you to tailor the prompt to your preference. The string given to the \-P option replaces the specified prompt string. @@ -1500,7 +1496,8 @@ Causes any trailing spaces to be removed. Usually used at the end of the string, but may appear anywhere. .IP "%T" Normally expands to the word "file". -However if viewing files via a tags list using the \-t option, it expands to the word "tag". +However if viewing files via a tags list using the \-t option, +it expands to the word "tag". .IP "%x" Replaced by the name of the next input file in the list. .PP @@ -1620,7 +1617,7 @@ line number, followed by the shell-escaped file name. If your editor does not accept the "+linenumber" syntax, or has other differences in invocation syntax, the LESSEDIT variable can be changed to modify this default. - +. .SH SECURITY When the environment variable LESSSECURE is set to 1, .I less @@ -1641,14 +1638,14 @@ log files use of lesskey files .IP "\-t" use of tags files -.IP " " +.IP metacharacters in filenames, such as * -.IP " " +.IP filename completion (TAB, ^L) .RE .PP Less can also be compiled to be permanently in "secure" mode. - +. .SH "COMPATIBILITY WITH MORE" If the environment variable LESS_IS_MORE is set to 1, or if the program is invoked via a file link named "more", @@ -1666,7 +1663,7 @@ behaves as if the \-E option were set. .PP The \-m option works differently. If the \-m option is not set, the medium prompt is used, -and it is prefixed with the string "--More--". +and it is prefixed with the string "\-\-More\-\-". If the \-m option is set, the short prompt is used. .PP The \-n option acts like the \-z option. @@ -1678,12 +1675,12 @@ command rather than a search pattern. .PP The LESS environment variable is ignored, and the MORE environment variable is used in its place. - +. .SH "ENVIRONMENT VARIABLES" Environment variables may be specified either in the system environment as usual, or in a -.I lesskey -(1) file. +.IR lesskey (1) +file. If environment variables are defined in more than one place, variables defined in a local lesskey file take precedence over variables defined in the system environment, which take precedence @@ -1738,8 +1735,8 @@ See discussion under PROMPTS. .IP LESSGLOBALTAGS Name of the command used by the \-t option to find global tags. Normally should be set to "global" if your system has the -.I global -(1) command. If not set, global tags are not used. +.IR global (1) +command. If not set, global tags are not used. .IP LESSHISTFILE Name of the history file used to remember search commands and shell commands between invocations of @@ -1752,9 +1749,13 @@ on OS/2 systems. The maximum number of commands to save in the history file. The default is 100. .IP LESSKEY -Name of the default lesskey(1) file. +Name of the default +.IR lesskey (1) +file. .IP LESSKEY_SYSTEM -Name of the default system-wide lesskey(1) file. +Name of the default system-wide +.IR lesskey (1) +file. .IP LESSMETACHARS List of characters which are considered "metacharacters" by the shell. .IP LESSMETAESCAPE @@ -1773,8 +1774,8 @@ String to be appended to a directory name in filename Format for displaying non-printable Unicode code points. .IP LESS_IS_MORE Emulate the -.I more -(1) command. +.IR more (1) +command. .IP LINES Sets the number of lines on the screen. Takes precedence over the number of lines specified by the TERM variable. @@ -1791,19 +1792,19 @@ compatible mode. User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). .IP SHELL -The shell used to execute the ! command, as well as to expand filenames. +The shell used to execute the !\& command, as well as to expand filenames. .IP TERM The type of terminal on which .I less is being run. .IP VISUAL The name of the editor (used for the v command). - +. .SH "SEE ALSO" -lesskey(1) - +.BR lesskey (1) +. .SH COPYRIGHT -Copyright (C) 1984-2019 Mark Nudelman +Copyright (C) 1984-2020 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it @@ -1823,9 +1824,9 @@ less is distributed in the hope that it will be useful WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - +. .SH AUTHOR -.PP +. Mark Nudelman .br Report bugs at https://github.com/gwsw/less/issues. Modified: stable/11/contrib/less/lessecho.c ============================================================================== --- stable/11/contrib/less/lessecho.c Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/lessecho.c Mon Nov 9 05:20:02 2020 (r367516) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/lessecho.nro ============================================================================== --- stable/11/contrib/less/lessecho.nro Mon Nov 9 05:17:23 2020 (r367515) +++ stable/11/contrib/less/lessecho.nro Mon Nov 9 05:20:02 2020 (r367516) @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 551: 11 Jun 2019" +.TH LESSECHO 1 "Version 563: 13 Jun 2020" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS @@ -44,7 +44,7 @@ Specifies "n" to be the escape char for metachars, as Specifies that all arguments are to be quoted. The default is that only arguments containing metacharacters are quoted .SH "SEE ALSO" -less(1) +.BR less (1) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 9 08:53:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87E722EBFB5; Mon, 9 Nov 2020 08:53:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CV4XD3FrYz4VXK; Mon, 9 Nov 2020 08:53:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62A8668C9; Mon, 9 Nov 2020 08:53:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A98rGnC086817; Mon, 9 Nov 2020 08:53:16 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A98rF4b086813; Mon, 9 Nov 2020 08:53:15 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011090853.0A98rF4b086813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 9 Nov 2020 08:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367517 - in head/sys: compat/linux fs/fuse X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: compat/linux fs/fuse X-SVN-Commit-Revision: 367517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 08:53:16 -0000 Author: trasz Date: Mon Nov 9 08:53:15 2020 New Revision: 367517 URL: https://svnweb.freebsd.org/changeset/base/367517 Log: Make it possible to mount a fuse filesystem, such as squashfuse, from a Linux binary. Should come handy for AppImages. Reviewed by: asomers MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26959 Modified: head/sys/compat/linux/linux_file.c head/sys/fs/fuse/fuse_device.c head/sys/fs/fuse/fuse_ipc.h head/sys/fs/fuse/fuse_vfsops.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Mon Nov 9 05:20:02 2020 (r367516) +++ head/sys/compat/linux/linux_file.c Mon Nov 9 08:53:15 2020 (r367517) @@ -1181,13 +1181,15 @@ linux_pwritev(struct thread *td, struct linux_pwritev_ int linux_mount(struct thread *td, struct linux_mount_args *args) { - char fstypename[MFSNAMELEN]; - char *mntonname, *mntfromname; + struct mntarg *ma = NULL; + char *fstypename, *mntonname, *mntfromname, *data; int error, fsflags; + fstypename = malloc(MNAMELEN, M_TEMP, M_WAITOK); mntonname = malloc(MNAMELEN, M_TEMP, M_WAITOK); mntfromname = malloc(MNAMELEN, M_TEMP, M_WAITOK); - error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1, + data = NULL; + error = copyinstr(args->filesystemtype, fstypename, MNAMELEN - 1, NULL); if (error != 0) goto out; @@ -1208,6 +1210,31 @@ linux_mount(struct thread *td, struct linux_mount_args strcpy(fstypename, "linprocfs"); } else if (strcmp(fstypename, "vfat") == 0) { strcpy(fstypename, "msdosfs"); + } else if (strcmp(fstypename, "fuse") == 0) { + char *fuse_options, *fuse_option, *fuse_name; + + if (strcmp(mntfromname, "fuse") == 0) + strcpy(mntfromname, "/dev/fuse"); + + strcpy(fstypename, "fusefs"); + data = malloc(MNAMELEN, M_TEMP, M_WAITOK); + error = copyinstr(args->data, data, MNAMELEN - 1, NULL); + if (error != 0) + goto out; + + fuse_options = data; + while ((fuse_option = strsep(&fuse_options, ",")) != NULL) { + fuse_name = strsep(&fuse_option, "="); + if (fuse_name == NULL || fuse_option == NULL) + goto out; + ma = mount_arg(ma, fuse_name, fuse_option, -1); + } + + /* + * The FUSE server uses Linux errno values instead of FreeBSD + * ones; add a flag to tell fuse(4) to do errno translation. + */ + ma = mount_arg(ma, "linux_errnos", "1", -1); } fsflags = 0; @@ -1225,14 +1252,15 @@ linux_mount(struct thread *td, struct linux_mount_args if (args->rwflag & LINUX_MS_REMOUNT) fsflags |= MNT_UPDATE; - error = kernel_vmount(fsflags, - "fstype", fstypename, - "fspath", mntonname, - "from", mntfromname, - NULL); + ma = mount_arg(ma, "fstype", fstypename, -1); + ma = mount_arg(ma, "fspath", mntonname, -1); + ma = mount_arg(ma, "from", mntfromname, -1); + error = kernel_mount(ma, fsflags); out: + free(fstypename, M_TEMP); free(mntonname, M_TEMP); free(mntfromname, M_TEMP); + free(data, M_TEMP); return (error); } Modified: head/sys/fs/fuse/fuse_device.c ============================================================================== --- head/sys/fs/fuse/fuse_device.c Mon Nov 9 05:20:02 2020 (r367516) +++ head/sys/fs/fuse/fuse_device.c Mon Nov 9 08:53:15 2020 (r367517) @@ -89,6 +89,9 @@ __FBSDID("$FreeBSD$"); #include "fuse_internal.h" #include "fuse_ipc.h" +#include +#include + SDT_PROVIDER_DECLARE(fusefs); /* * Fuse trace probe: @@ -450,6 +453,15 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i } if ((err = uiomove(&ohead, sizeof(struct fuse_out_header), uio)) != 0) return (err); + + if (data->linux_errnos != 0 && ohead.error != 0) { + err = -ohead.error; + if (err < 0 || err >= nitems(linux_to_bsd_errtbl)) + return (EINVAL); + + /* '-', because it will get flipped again below */ + ohead.error = -linux_to_bsd_errtbl[err]; + } /* * We check header information (which is redundant) and compare it Modified: head/sys/fs/fuse/fuse_ipc.h ============================================================================== --- head/sys/fs/fuse/fuse_ipc.h Mon Nov 9 05:20:02 2020 (r367516) +++ head/sys/fs/fuse/fuse_ipc.h Mon Nov 9 08:53:15 2020 (r367517) @@ -217,6 +217,7 @@ struct fuse_data { struct selinfo ks_rsel; int daemon_timeout; + int linux_errnos; unsigned time_gran; uint64_t notimpl; uint64_t mnt_flag; Modified: head/sys/fs/fuse/fuse_vfsops.c ============================================================================== --- head/sys/fs/fuse/fuse_vfsops.c Mon Nov 9 05:20:02 2020 (r367516) +++ head/sys/fs/fuse/fuse_vfsops.c Mon Nov 9 08:53:15 2020 (r367517) @@ -300,6 +300,7 @@ fuse_vfsop_mount(struct mount *mp) uint64_t mntopts, __mntopts; uint32_t max_read; + int linux_errnos; int daemon_timeout; int fd; @@ -312,6 +313,7 @@ fuse_vfsop_mount(struct mount *mp) subtype = NULL; max_read = ~0; + linux_errnos = 0; err = 0; mntopts = 0; __mntopts = 0; @@ -337,6 +339,7 @@ fuse_vfsop_mount(struct mount *mp) FUSE_FLAGOPT(intr, FSESS_INTR); (void)vfs_scanopt(opts, "max_read=", "%u", &max_read); + (void)vfs_scanopt(opts, "linux_errnos", "%d", &linux_errnos); if (vfs_scanopt(opts, "timeout=", "%u", &daemon_timeout) == 1) { if (daemon_timeout < FUSE_MIN_DAEMON_TIMEOUT) daemon_timeout = FUSE_MIN_DAEMON_TIMEOUT; @@ -411,6 +414,7 @@ fuse_vfsop_mount(struct mount *mp) data->dataflags |= mntopts; data->max_read = max_read; data->daemon_timeout = daemon_timeout; + data->linux_errnos = linux_errnos; data->mnt_flag = mp->mnt_flag & MNT_UPDATEMASK; FUSE_UNLOCK(); From owner-svn-src-all@freebsd.org Mon Nov 9 09:30:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 308122EC2D4; Mon, 9 Nov 2020 09:30:50 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CV5MZ0bPYz4XGl; Mon, 9 Nov 2020 09:30:50 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07756716B; Mon, 9 Nov 2020 09:30:50 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A99UnAr006237; Mon, 9 Nov 2020 09:30:49 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A99UnAT006236; Mon, 9 Nov 2020 09:30:49 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011090930.0A99UnAT006236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Mon, 9 Nov 2020 09:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367518 - stable/12/sbin/mdconfig X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/sbin/mdconfig X-SVN-Commit-Revision: 367518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 09:30:50 -0000 Author: 0mp (doc,ports committer) Date: Mon Nov 9 09:30:49 2020 New Revision: 367518 URL: https://svnweb.freebsd.org/changeset/base/367518 Log: MFC r367420: Use Cm macros instead of Ar when referring to a specific memory disk type Modified: stable/12/sbin/mdconfig/mdconfig.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/mdconfig/mdconfig.8 ============================================================================== --- stable/12/sbin/mdconfig/mdconfig.8 Mon Nov 9 08:53:15 2020 (r367517) +++ stable/12/sbin/mdconfig/mdconfig.8 Mon Nov 9 09:30:49 2020 (r367518) @@ -127,7 +127,7 @@ Filename to use for the vnode type memory disk. The .Fl a and -.Fl t Ar vnode +.Fl t Cm vnode options are implied if not specified. .It Fl l List configured devices. @@ -170,7 +170,7 @@ When used without the option, the .Fl a and -.Fl t Ar swap +.Fl t Cm swap options are implied if not specified. .It Fl S Ar sectorsize Sectorsize to use for the memory disk, in bytes. @@ -246,7 +246,7 @@ The last form, is provided for convenience as an abbreviation of .Nm .Fl a -.Fl t Ar vnode +.Fl t Cm vnode .Fl f Ar file . .Sh EXAMPLES Create a disk with From owner-svn-src-all@freebsd.org Mon Nov 9 09:31:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A90D82EC1FD; Mon, 9 Nov 2020 09:31:21 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CV5N93x03z4XfR; Mon, 9 Nov 2020 09:31:21 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79EE96D7D; Mon, 9 Nov 2020 09:31:21 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A99VL2Q006307; Mon, 9 Nov 2020 09:31:21 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A99VLaJ006306; Mon, 9 Nov 2020 09:31:21 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011090931.0A99VLaJ006306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Mon, 9 Nov 2020 09:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367519 - stable/11/sbin/mdconfig X-SVN-Group: stable-11 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/11/sbin/mdconfig X-SVN-Commit-Revision: 367519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 09:31:21 -0000 Author: 0mp (doc,ports committer) Date: Mon Nov 9 09:31:21 2020 New Revision: 367519 URL: https://svnweb.freebsd.org/changeset/base/367519 Log: MFC r367420: Use Cm macros instead of Ar when referring to a specific memory disk type Modified: stable/11/sbin/mdconfig/mdconfig.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mdconfig/mdconfig.8 ============================================================================== --- stable/11/sbin/mdconfig/mdconfig.8 Mon Nov 9 09:30:49 2020 (r367518) +++ stable/11/sbin/mdconfig/mdconfig.8 Mon Nov 9 09:31:21 2020 (r367519) @@ -126,7 +126,7 @@ Filename to use for the vnode type memory disk. The .Fl a and -.Fl t Ar vnode +.Fl t Cm vnode options are implied if not specified. .It Fl l List configured devices. @@ -169,7 +169,7 @@ When used without the option, the .Fl a and -.Fl t Ar swap +.Fl t Cm swap options are implied if not specified. .It Fl S Ar sectorsize Sectorsize to use for the memory disk, in bytes. @@ -231,7 +231,7 @@ The last form, is provided for convenience as an abbreviation of .Nm .Fl a -.Fl t Ar vnode +.Fl t Cm vnode .Fl f Ar file . .Sh EXAMPLES Create a disk with From owner-svn-src-all@freebsd.org Mon Nov 9 13:12:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE4E94632C5; Mon, 9 Nov 2020 13:12:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVBGv60tZz4nc4; Mon, 9 Nov 2020 13:12:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C129611D41; Mon, 9 Nov 2020 13:12:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9DC7dZ049691; Mon, 9 Nov 2020 13:12:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9DC7vT049690; Mon, 9 Nov 2020 13:12:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011091312.0A9DC7vT049690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 9 Nov 2020 13:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367520 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 367520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 13:12:07 -0000 Author: tuexen Date: Mon Nov 9 13:12:07 2020 New Revision: 367520 URL: https://svnweb.freebsd.org/changeset/base/367520 Log: Fix a potential use-after-free bug introduced in https://svnweb.freebsd.org/changeset/base/363046 Thanks to Taylor Brandstetter for finding this issue using fuzz testing and reporting it in https://github.com/sctplab/usrsctp/issues/547 Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Mon Nov 9 09:31:21 2020 (r367519) +++ head/sys/netinet/sctp_indata.c Mon Nov 9 13:12:07 2020 (r367520) @@ -5494,7 +5494,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, unsigned int i, fwd_sz, m_size; uint32_t str_seq; struct sctp_stream_in *strm; - struct sctp_queued_to_read *control, *sv; + struct sctp_queued_to_read *control, *ncontrol, *sv; asoc = &stcb->asoc; if ((fwd_sz = ntohs(fwd->ch.chunk_length)) < sizeof(struct sctp_forward_tsn_chunk)) { @@ -5654,14 +5654,14 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, } strm = &asoc->strmin[sid]; if (ordered) { - TAILQ_FOREACH(control, &strm->inqueue, next_instrm) { + TAILQ_FOREACH_SAFE(control, &strm->inqueue, next_instrm, ncontrol) { if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn); } } } else { if (asoc->idata_supported) { - TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { + TAILQ_FOREACH_SAFE(control, &strm->uno_inqueue, next_instrm, ncontrol) { if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn); } From owner-svn-src-all@freebsd.org Mon Nov 9 13:20:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23CAD463715; Mon, 9 Nov 2020 13:20:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVBSJ0TLCz4pBw; Mon, 9 Nov 2020 13:20:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC92211FA4; Mon, 9 Nov 2020 13:20:15 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9DKFb5050233; Mon, 9 Nov 2020 13:20:15 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9DKESu050223; Mon, 9 Nov 2020 13:20:14 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011091320.0A9DKESu050223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 9 Nov 2020 13:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367521 - in head/sys: compat/linuxkpi/common/include/acpi compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/include/acpi compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi X-SVN-Commit-Revision: 367521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 13:20:16 -0000 Author: manu Date: Mon Nov 9 13:20:14 2020 New Revision: 367521 URL: https://svnweb.freebsd.org/changeset/base/367521 Log: LinuxKPI: Implement ACPI bits required by drm-kmod in base system It includes: ACPI_HANDLE() implementation. AC and VIDEO ACPI events notification support. Replacement of hand-rolled GPLed _DSM method evaluation helpers with in-base ones. Submitted by: wulf Differential Revision: https://reviews.freebsd.org/D26603 Added: head/sys/compat/linuxkpi/common/include/acpi/ head/sys/compat/linuxkpi/common/include/acpi/acpi.h (contents, props changed) head/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h (contents, props changed) head/sys/compat/linuxkpi/common/include/acpi/video.h (contents, props changed) head/sys/compat/linuxkpi/common/include/linux/acpi.h (contents, props changed) head/sys/compat/linuxkpi/common/src/linux_acpi.c (contents, props changed) Modified: head/sys/conf/files head/sys/modules/linuxkpi/Makefile Added: head/sys/compat/linuxkpi/common/include/acpi/acpi.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/acpi/acpi.h Mon Nov 9 13:20:14 2020 (r367521) @@ -0,0 +1,100 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017 Mark Johnston + * Copyright (c) 2020 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ACPI_ACPI_H_ +#define _ACPI_ACPI_H_ + +/* + * FreeBSD import of ACPICA has a typedef for BOOLEAN which conflicts with + * amdgpu driver. Workaround it on preprocessor level. + */ +#define ACPI_USE_SYSTEM_INTTYPES +#define BOOLEAN unsigned char +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef short INT16; +typedef unsigned int UINT32; +typedef int INT32; +typedef uint64_t UINT64; +typedef int64_t INT64; +#include +#undef BOOLEAN + +typedef ACPI_HANDLE acpi_handle; +typedef ACPI_OBJECT acpi_object; +typedef ACPI_OBJECT_HANDLER acpi_object_handler; +typedef ACPI_OBJECT_TYPE acpi_object_type; +typedef ACPI_STATUS acpi_status; +typedef ACPI_STRING acpi_string; +typedef ACPI_SIZE acpi_size; +typedef ACPI_WALK_CALLBACK acpi_walk_callback; + +static inline ACPI_STATUS +acpi_evaluate_object(ACPI_HANDLE Object, ACPI_STRING Pathname, + ACPI_OBJECT_LIST *ParameterObjects, ACPI_BUFFER *ReturnObjectBuffer) +{ + return (AcpiEvaluateObject( + Object, Pathname, ParameterObjects, ReturnObjectBuffer)); +} + +static inline const char * +acpi_format_exception(ACPI_STATUS Exception) +{ + return (AcpiFormatException(Exception)); +} + +static inline ACPI_STATUS +acpi_get_handle(ACPI_HANDLE Parent, ACPI_STRING Pathname, + ACPI_HANDLE *RetHandle) +{ + return (AcpiGetHandle(Parent, Pathname, RetHandle)); +} + +static inline ACPI_STATUS +acpi_get_data(ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, void **Data) +{ + return (AcpiGetData(ObjHandle, Handler, Data)); +} + +static inline ACPI_STATUS +acpi_get_name(ACPI_HANDLE Object, UINT32 NameType, ACPI_BUFFER *RetPathPtr) +{ + return (AcpiGetName(Object, NameType, RetPathPtr)); +} + +static inline ACPI_STATUS +acpi_get_table(ACPI_STRING Signature, UINT32 Instance, + ACPI_TABLE_HEADER **OutTable) +{ + return (AcpiGetTable(Signature, Instance, OutTable)); +} + +#endif /* _ACPI_ACPI_H_ */ Added: head/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h Mon Nov 9 13:20:14 2020 (r367521) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ACPI_ACPI_BUS_H_ +#define _ACPI_ACPI_BUS_H_ + +typedef char acpi_device_class[20]; + +struct acpi_bus_event { + acpi_device_class device_class; + uint32_t type; + uint32_t data; +}; + +ACPI_HANDLE bsd_acpi_get_handle(device_t bsddev); +bool acpi_check_dsm(ACPI_HANDLE handle, const char *uuid, int rev, + uint64_t funcs); +ACPI_OBJECT * acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid, + int rev, int func, ACPI_OBJECT *argv4, + ACPI_OBJECT_TYPE type); +int register_acpi_notifier(struct notifier_block *nb); +int unregister_acpi_notifier(struct notifier_block *nb); +uint32_t acpi_target_system_state(void); + +#endif /* !_ACPI_ACPI_BUS_H_ */ Added: head/sys/compat/linuxkpi/common/include/acpi/video.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/acpi/video.h Mon Nov 9 13:20:14 2020 (r367521) @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ACPI_VIDEO_H_ +#define _ACPI_VIDEO_H_ + +#define ACPI_VIDEO_CLASS "video" + +#define ACPI_VIDEO_NOTIFY_PROBE 0x81 + +#endif /* !_ACPI_VIDEO_H_ */ Added: head/sys/compat/linuxkpi/common/include/linux/acpi.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/acpi.h Mon Nov 9 13:20:14 2020 (r367521) @@ -0,0 +1,42 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_ACPI_H_ +#define _LINUX_ACPI_H_ + +#include + +#include +#include + +#define ACPI_HANDLE(dev) \ + ((dev)->bsddev != NULL ? bsd_acpi_get_handle((dev)->bsddev) : NULL) + +#endif /* _LINUX_ACPI_H_ */ Added: head/sys/compat/linuxkpi/common/src/linux_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/src/linux_acpi.c Mon Nov 9 13:20:14 2020 (r367521) @@ -0,0 +1,243 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Johannes Lundberg + * Copyright (c) 2020 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "opt_acpi.h" + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#define ACPI_AC_CLASS "ac_adapter" + +ACPI_MODULE_NAME("linux_acpi") + +enum { + LINUX_ACPI_ACAD, + LINUX_ACPI_VIDEO, + LINUX_ACPI_TAGS /* must be last */ +}; +_Static_assert(LINUX_ACPI_TAGS <= LINUX_NOTIFY_TAGS, + "Not enough space for tags in notifier_block structure"); + +#ifdef DEV_ACPI + +static uint32_t linux_acpi_target_sleep_state = ACPI_STATE_S0; + +static eventhandler_tag resume_tag; +static eventhandler_tag suspend_tag; + +ACPI_HANDLE +bsd_acpi_get_handle(device_t bsddev) +{ + return (acpi_get_handle(bsddev)); +} + +bool +acpi_check_dsm(ACPI_HANDLE handle, const char *uuid, int rev, uint64_t funcs) +{ + + if (funcs == 0) + return (false); + + /* + * From ACPI 6.3 spec 9.1.1: + * Bit 0 indicates whether there is support for any functions other + * than function 0 for the specified UUID and Revision ID. If set to + * zero, no functions are supported (other than function zero) for the + * specified UUID and Revision ID. + */ + funcs |= 1 << 0; + + return ((acpi_DSMQuery(handle, uuid, rev) & funcs) == funcs); +} + +ACPI_OBJECT * +acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid, int rev, + int func, ACPI_OBJECT *argv4, ACPI_OBJECT_TYPE type) +{ + ACPI_BUFFER buf; + + return (ACPI_SUCCESS(acpi_EvaluateDSMTyped(handle, uuid, rev, func, + argv4, &buf, type)) ? (ACPI_OBJECT *)buf.Pointer : NULL); +} + +static void +linux_handle_power_suspend_event(void *arg __unused) +{ + /* + * Only support S3 for now. + * acpi_sleep_event isn't always called so we use power_suspend_early + * instead which means we don't know what state we're switching to. + * TODO: Make acpi_sleep_event consistent + */ + linux_acpi_target_sleep_state = ACPI_STATE_S3; +} + +static void +linux_handle_power_resume_event(void *arg __unused) +{ + linux_acpi_target_sleep_state = ACPI_STATE_S0; +} + +static void +linux_handle_acpi_acad_event(void *arg, int data) +{ + struct notifier_block *nb = arg; + /* + * Event type information is lost ATM in FreeBSD ACPI event handler. + * Fortunately, drm-kmod do not distinct AC event types too, so we can + * use any type e.g. ACPI_NOTIFY_BUS_CHECK that suits notifier handler. + */ + struct acpi_bus_event abe = { + .device_class = ACPI_AC_CLASS, + .type = ACPI_NOTIFY_BUS_CHECK, + .data = data, + }; + + nb->notifier_call(nb, 0, &abe); +} + +static void +linux_handle_acpi_video_event(void *arg, int type) +{ + struct notifier_block *nb = arg; + struct acpi_bus_event abe = { + .device_class = ACPI_VIDEO_CLASS, + .type = type, + .data = 0, + }; + + nb->notifier_call(nb, 0, &abe); +} + +int +register_acpi_notifier(struct notifier_block *nb) +{ + nb->tags[LINUX_ACPI_ACAD] = EVENTHANDLER_REGISTER(acpi_acad_event, + linux_handle_acpi_acad_event, nb, EVENTHANDLER_PRI_FIRST); + nb->tags[LINUX_ACPI_VIDEO] = EVENTHANDLER_REGISTER(acpi_video_event, + linux_handle_acpi_video_event, nb, EVENTHANDLER_PRI_FIRST); + + return (0); +} + +int +unregister_acpi_notifier(struct notifier_block *nb) +{ + EVENTHANDLER_DEREGISTER(acpi_acad_event, nb->tags[LINUX_ACPI_ACAD]); + EVENTHANDLER_DEREGISTER(acpi_video_event, nb->tags[LINUX_ACPI_VIDEO]); + + return (0); +} + +uint32_t +acpi_target_system_state(void) +{ + return (linux_acpi_target_sleep_state); +} + +static void +linux_register_acpi_event_handlers(void *arg __unused) +{ + /* + * XXX johalun: acpi_{sleep,wakeup}_event can't be trusted, use + * power_{suspend_early,resume} 'acpiconf -s 3' or 'zzz' will not + * generate acpi_sleep_event... Lid open or wake on button generates + * acpi_wakeup_event on one of my Dell laptops but not the other + * (but it does power on)... is this a general thing? + */ + resume_tag = EVENTHANDLER_REGISTER(power_resume, + linux_handle_power_resume_event, NULL, EVENTHANDLER_PRI_FIRST); + suspend_tag = EVENTHANDLER_REGISTER(power_suspend_early, + linux_handle_power_suspend_event, NULL, EVENTHANDLER_PRI_FIRST); +} + +static void +linux_deregister_acpi_event_handlers(void *arg __unused) +{ + EVENTHANDLER_DEREGISTER(power_resume, resume_tag); + EVENTHANDLER_DEREGISTER(power_suspend_early, suspend_tag); +} + +SYSINIT(linux_acpi_events, SI_SUB_DRIVERS, SI_ORDER_ANY, + linux_register_acpi_event_handlers, NULL); +SYSUNINIT(linux_acpi_events, SI_SUB_DRIVERS, SI_ORDER_ANY, + linux_deregister_acpi_event_handlers, NULL); + +#else /* !DEV_ACPI */ + +ACPI_HANDLE +bsd_acpi_get_handle(device_t bsddev) +{ + return (NULL); +} + +bool +acpi_check_dsm(ACPI_HANDLE handle, const char *uuid, int rev, uint64_t funcs) +{ + return (false); +} + +ACPI_OBJECT * +acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid, int rev, + int func, ACPI_OBJECT *argv4, ACPI_OBJECT_TYPE type) +{ + return (NULL); +} + +int +register_acpi_notifier(struct notifier_block *nb) +{ + return (0); +} + +int +unregister_acpi_notifier(struct notifier_block *nb) +{ + return (0); +} + +uint32_t +acpi_target_system_state(void) +{ + return (ACPI_STATE_S0); +} + +#endif /* !DEV_ACPI */ Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Nov 9 13:12:07 2020 (r367520) +++ head/sys/conf/files Mon Nov 9 13:20:14 2020 (r367521) @@ -4528,6 +4528,8 @@ nlm/sm_inter_xdr.c optional nfslockd | nfsd # Linux Kernel Programming Interface compat/linuxkpi/common/src/linux_kmod.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_acpi.c optional compat_linuxkpi acpi \ + compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_compat.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_current.c optional compat_linuxkpi \ Modified: head/sys/modules/linuxkpi/Makefile ============================================================================== --- head/sys/modules/linuxkpi/Makefile Mon Nov 9 13:12:07 2020 (r367520) +++ head/sys/modules/linuxkpi/Makefile Mon Nov 9 13:20:14 2020 (r367521) @@ -23,6 +23,11 @@ SRCS= linux_compat.c \ linux_work.c \ linux_xarray.c +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" +SRCS+= opt_acpi.h linux_acpi.c +.endif + SRCS+= ${LINUXKPI_GENSRCS} CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include From owner-svn-src-all@freebsd.org Mon Nov 9 13:20:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F2F146371D; Mon, 9 Nov 2020 13:20:45 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVBSr6s28z4p4w; Mon, 9 Nov 2020 13:20:44 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE64611A41; Mon, 9 Nov 2020 13:20:44 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9DKiMJ053374; Mon, 9 Nov 2020 13:20:44 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9DKief053373; Mon, 9 Nov 2020 13:20:44 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011091320.0A9DKief053373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 9 Nov 2020 13:20:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367522 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 367522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 13:20:45 -0000 Author: manu Date: Mon Nov 9 13:20:44 2020 New Revision: 367522 URL: https://svnweb.freebsd.org/changeset/base/367522 Log: Bump __FreeBSD_version after linuxkpi changes Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Nov 9 13:20:14 2020 (r367521) +++ head/sys/sys/param.h Mon Nov 9 13:20:44 2020 (r367522) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300127 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300128 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Mon Nov 9 13:54:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31C004645A6; Mon, 9 Nov 2020 13:54:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVCCp0qhmz4rKM; Mon, 9 Nov 2020 13:54:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B21A1261B; Mon, 9 Nov 2020 13:54:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9DsTRt075217; Mon, 9 Nov 2020 13:54:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9DsTUW075216; Mon, 9 Nov 2020 13:54:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011091354.0A9DsTUW075216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 9 Nov 2020 13:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367523 - stable/12/usr.sbin/syslogd X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.sbin/syslogd X-SVN-Commit-Revision: 367523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 13:54:30 -0000 Author: markj Date: Mon Nov 9 13:54:29 2020 New Revision: 367523 URL: https://svnweb.freebsd.org/changeset/base/367523 Log: MFC r366576: syslogd: Avoid trimming host names in RFC 5424 mode PR: 250014 Modified: stable/12/usr.sbin/syslogd/syslogd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/12/usr.sbin/syslogd/syslogd.c Mon Nov 9 13:20:44 2020 (r367522) +++ stable/12/usr.sbin/syslogd/syslogd.c Mon Nov 9 13:54:29 2020 (r367523) @@ -2226,7 +2226,9 @@ cvthname(struct sockaddr *f) hl = strlen(hname); if (hl > 0 && hname[hl-1] == '.') hname[--hl] = '\0'; - trimdomain(hname, hl); + /* RFC 5424 prefers logging FQDNs. */ + if (RFC3164OutputFormat) + trimdomain(hname, hl); return (hname); } @@ -2853,7 +2855,9 @@ cfline(const char *line, const char *prog, const char hl = strlen(f->f_host); if (hl > 0 && f->f_host[hl-1] == '.') f->f_host[--hl] = '\0'; - trimdomain(f->f_host, hl); + /* RFC 5424 prefers logging FQDNs. */ + if (RFC3164OutputFormat) + trimdomain(f->f_host, hl); } /* save program name if any */ From owner-svn-src-all@freebsd.org Mon Nov 9 14:15:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B99C464D57; Mon, 9 Nov 2020 14:15:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVCgb34w6z4sZw; Mon, 9 Nov 2020 14:15:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5284512A45; Mon, 9 Nov 2020 14:15:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9EF7qI087539; Mon, 9 Nov 2020 14:15:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9EF6kt087538; Mon, 9 Nov 2020 14:15:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011091415.0A9EF6kt087538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 9 Nov 2020 14:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367524 - stable/12/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/opencrypto X-SVN-Commit-Revision: 367524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 14:15:07 -0000 Author: markj Date: Mon Nov 9 14:15:06 2020 New Revision: 367524 URL: https://svnweb.freebsd.org/changeset/base/367524 Log: Add hmac_init_ipad() and hmac_init_opad() This is a merge of a small portion of r359374 which makes it easier to maintain OpenCrypto drivers in stable/12. No functional change intended; this is a direct commit to stable/12. Discussed with: jhb Modified: stable/12/sys/opencrypto/crypto.c stable/12/sys/opencrypto/cryptodev.h Modified: stable/12/sys/opencrypto/crypto.c ============================================================================== --- stable/12/sys/opencrypto/crypto.c Mon Nov 9 13:54:29 2020 (r367523) +++ stable/12/sys/opencrypto/crypto.c Mon Nov 9 14:15:06 2020 (r367524) @@ -380,6 +380,53 @@ crypto_terminate(struct proc **pp, void *q) } static void +hmac_init_pad(const struct auth_hash *axf, const char *key, int klen, + void *auth_ctx, uint8_t padval) +{ + uint8_t hmac_key[HMAC_MAX_BLOCK_LEN]; + u_int i; + + KASSERT(axf->blocksize <= sizeof(hmac_key), + ("Invalid HMAC block size %d", axf->blocksize)); + + /* + * If the key is larger than the block size, use the digest of + * the key as the key instead. + */ + memset(hmac_key, 0, sizeof(hmac_key)); + if (klen > axf->blocksize) { + axf->Init(auth_ctx); + axf->Update(auth_ctx, key, klen); + axf->Final(hmac_key, auth_ctx); + klen = axf->hashsize; + } else + memcpy(hmac_key, key, klen); + + for (i = 0; i < axf->blocksize; i++) + hmac_key[i] ^= padval; + + axf->Init(auth_ctx); + axf->Update(auth_ctx, hmac_key, axf->blocksize); + explicit_bzero(hmac_key, sizeof(hmac_key)); +} + +void +hmac_init_ipad(const struct auth_hash *axf, const char *key, int klen, + void *auth_ctx) +{ + + hmac_init_pad(axf, key, klen, auth_ctx, HMAC_IPAD_VAL); +} + +void +hmac_init_opad(const struct auth_hash *axf, const char *key, int klen, + void *auth_ctx) +{ + + hmac_init_pad(axf, key, klen, auth_ctx, HMAC_OPAD_VAL); +} + +static void crypto_destroy(void) { struct crypto_ret_worker *ret_worker; Modified: stable/12/sys/opencrypto/cryptodev.h ============================================================================== --- stable/12/sys/opencrypto/cryptodev.h Mon Nov 9 13:54:29 2020 (r367523) +++ stable/12/sys/opencrypto/cryptodev.h Mon Nov 9 14:15:06 2020 (r367524) @@ -546,6 +546,14 @@ extern int crypto_usercrypto; /* userland may do cryp extern int crypto_userasymcrypto; /* userland may do asym crypto reqs */ extern int crypto_devallowsoft; /* only use hardware crypto */ +/* Helper routines for drivers to initialize auth contexts for HMAC. */ +struct auth_hash; + +void hmac_init_ipad(const struct auth_hash *axf, const char *key, int klen, + void *auth_ctx); +void hmac_init_opad(const struct auth_hash *axf, const char *key, int klen, + void *auth_ctx); + /* * Crypto-related utility routines used mainly by drivers. * From owner-svn-src-all@freebsd.org Mon Nov 9 15:36:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0718A466486; Mon, 9 Nov 2020 15:36:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVFT86lYbz3D1t; Mon, 9 Nov 2020 15:36:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA3261383F; Mon, 9 Nov 2020 15:36:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9FaCW7037108; Mon, 9 Nov 2020 15:36:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9FaB4j037101; Mon, 9 Nov 2020 15:36:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011091536.0A9FaB4j037101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 9 Nov 2020 15:36:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367525 - in stable/12: share/man/man4 sys/amd64/conf sys/conf sys/dev/qat sys/modules sys/modules/qat X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/amd64/conf sys/conf sys/dev/qat sys/modules sys/modules/qat X-SVN-Commit-Revision: 367525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 15:36:13 -0000 Author: markj Date: Mon Nov 9 15:36:11 2020 New Revision: 367525 URL: https://svnweb.freebsd.org/changeset/base/367525 Log: MFC r367386: Add qat(4) Added: stable/12/share/man/man4/qat.4 - copied unchanged from r367386, head/share/man/man4/qat.4 stable/12/sys/dev/qat/ - copied from r367386, head/sys/dev/qat/ stable/12/sys/modules/qat/ - copied from r367386, head/sys/modules/qat/ Modified: stable/12/share/man/man4/Makefile stable/12/sys/amd64/conf/NOTES stable/12/sys/conf/files.amd64 stable/12/sys/dev/qat/qat.c stable/12/sys/dev/qat/qat_hw15.c stable/12/sys/dev/qat/qat_hw15var.h stable/12/sys/dev/qat/qat_hw17.c stable/12/sys/dev/qat/qat_hw17var.h stable/12/sys/dev/qat/qatvar.h stable/12/sys/modules/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/Makefile ============================================================================== --- stable/12/share/man/man4/Makefile Mon Nov 9 14:15:06 2020 (r367524) +++ stable/12/share/man/man4/Makefile Mon Nov 9 15:36:11 2020 (r367525) @@ -442,6 +442,7 @@ MAN= aac.4 \ pty.4 \ puc.4 \ pwmc.4 \ + ${_qat.4} \ ${_qlxge.4} \ ${_qlxgb.4} \ ${_qlxgbe.4} \ @@ -845,6 +846,7 @@ _nvd.4= nvd.4 _nvme.4= nvme.4 _nvram.4= nvram.4 _padlock.4= padlock.4 +_qat.4= qat.4 _rr232x.4= rr232x.4 _speaker.4= speaker.4 _spkr.4= spkr.4 Copied: stable/12/share/man/man4/qat.4 (from r367386, head/share/man/man4/qat.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/man/man4/qat.4 Mon Nov 9 15:36:11 2020 (r367525, copy of r367386, head/share/man/man4/qat.4) @@ -0,0 +1,99 @@ +.\"- +.\" Copyright (c) 2020 Rubicon Communications, LLC (Netgate) +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 5, 2020 +.Dt QAT 4 +.Os +.Sh NAME +.Nm qat +.Nd Intel QuickAssist Technology (QAT) driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device crypto" +.Cd "device cryptodev" +.Cd "device qat" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following lines in +.Xr loader.conf 5 : +.Bd -literal -offset indent +qat_load="YES" +qat_c2xxxfw_load="YES" +qat_c3xxxfw_load="YES" +qat_c63xfw_load="YES" +qat_d15xxfw_load="YES" +qat_dh895xcc_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver implements +.Xr crypto 4 +support for some of the cryptographic acceleration functions of the Intel +QuickAssist device. +The +.Nm +driver supports the QAT devices integrated with Atom C2000 and C3000 and Xeon +C620 and D-1500 chipsets, and the Intel QAT Adapter 8950. +It can accelerate AES in CBC, CTR, XTS (except for the C2000) and GCM modes, +and can perform authenticated encryption combining the CBC, CTR and XTS modes +with SHA1-HMAC and SHA2-HMAC. +The +.Nm +driver can also compute SHA1 and SHA2 digests. +.Sh SEE ALSO +.Xr crypto 4 , +.Xr ipsec 4 , +.Xr pci 4 , +.Xr random 4 , +.Xr crypto 7 , +.Xr crypto 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0 . +.Sh AUTHORS +The +.Nm +driver was written for +.Nx +by +.An Hikaru Abe Aq Mt hikaru@iij.ad.jp +and ported to +.Fx +by +.An Mark Johnston Aq Mt markj@FreeBSD.org . +.Sh BUGS +Some Atom C2000 QAT devices have two acceleration engines instead of one. +The +.Nm +driver currently misbehaves when both are enabled and thus does not enable +the second acceleration engine if one is present. Modified: stable/12/sys/amd64/conf/NOTES ============================================================================== --- stable/12/sys/amd64/conf/NOTES Mon Nov 9 14:15:06 2020 (r367524) +++ stable/12/sys/amd64/conf/NOTES Mon Nov 9 15:36:11 2020 (r367525) @@ -496,6 +496,10 @@ device nvd # expose NVMe namespaces as dis device pmspcv # +# Intel QuickAssist +device qat + +# # SafeNet crypto driver: can be moved to the MI NOTES as soon as # it's tested on a big-endian machine # Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Mon Nov 9 14:15:06 2020 (r367524) +++ stable/12/sys/conf/files.amd64 Mon Nov 9 15:36:11 2020 (r367525) @@ -419,6 +419,15 @@ dev/nvme/nvme_util.c optional nvme dev/nvram/nvram.c optional nvram isa dev/random/ivy.c optional rdrand_rng dev/random/nehemiah.c optional padlock_rng +dev/qat/qat.c optional qat +dev/qat/qat_ae.c optional qat +dev/qat/qat_c2xxx.c optional qat +dev/qat/qat_c3xxx.c optional qat +dev/qat/qat_c62x.c optional qat +dev/qat/qat_d15xx.c optional qat +dev/qat/qat_dh895xcc.c optional qat +dev/qat/qat_hw15.c optional qat +dev/qat/qat_hw17.c optional qat dev/qlxge/qls_dbg.c optional qlxge pci dev/qlxge/qls_dump.c optional qlxge pci dev/qlxge/qls_hw.c optional qlxge pci Modified: stable/12/sys/dev/qat/qat.c ============================================================================== --- head/sys/dev/qat/qat.c Thu Nov 5 15:55:23 2020 (r367386) +++ stable/12/sys/dev/qat/qat.c Mon Nov 9 15:36:11 2020 (r367525) @@ -281,7 +281,7 @@ static int qat_start(struct device *); static int qat_detach(device_t); static int qat_newsession(device_t dev, crypto_session_t cses, - const struct crypto_session_params *csp); + struct cryptoini *cri); static void qat_freesession(device_t dev, crypto_session_t cses); static int qat_setup_msix_intr(struct qat_softc *); @@ -1259,11 +1259,11 @@ static enum hw_cipher_algo qat_aes_cipher_algo(int klen) { switch (klen) { - case HW_AES_128_KEY_SZ: + case HW_AES_128_KEY_SZ * 8: return HW_CIPHER_ALGO_AES128; - case HW_AES_192_KEY_SZ: + case HW_AES_192_KEY_SZ * 8: return HW_CIPHER_ALGO_AES192; - case HW_AES_256_KEY_SZ: + case HW_AES_256_KEY_SZ * 8: return HW_CIPHER_ALGO_AES256; default: panic("invalid key length %d", klen); @@ -1341,10 +1341,33 @@ qat_crypto_load_auth_session(const struct qat_crypto_d (*hash_def)->qshd_alg->qshai_digest_len); } +static bool +qat_is_hash(int alg) +{ + switch (alg) { + case CRYPTO_SHA1: + case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_256: + case CRYPTO_SHA2_256_HMAC: + case CRYPTO_SHA2_384: + case CRYPTO_SHA2_384_HMAC: + case CRYPTO_SHA2_512: + case CRYPTO_SHA2_512_HMAC: + case CRYPTO_AES_128_NIST_GMAC: + case CRYPTO_AES_192_NIST_GMAC: + case CRYPTO_AES_256_NIST_GMAC: + return true; + default: + return false; + } +} + struct qat_crypto_load_cb_arg { struct qat_session *qs; struct qat_sym_cookie *qsc; struct cryptop *crp; + struct cryptodesc *enc; + struct cryptodesc *mac; int error; }; @@ -1353,6 +1376,7 @@ qat_crypto_load_cb(void *_arg, bus_dma_segment_t *segs int error) { struct cryptop *crp; + struct cryptodesc *enc, *mac; struct flat_buffer_desc *flatbuf; struct qat_crypto_load_cb_arg *arg; struct qat_session *qs; @@ -1368,6 +1392,8 @@ qat_crypto_load_cb(void *_arg, bus_dma_segment_t *segs } crp = arg->crp; + enc = arg->enc; + mac = arg->mac; qs = arg->qs; qsc = arg->qsc; @@ -1377,16 +1403,16 @@ qat_crypto_load_cb(void *_arg, bus_dma_segment_t *segs * padded to a multiple of 16 bytes. To satisfy these * constraints we bounce the AAD into a per-request buffer. */ - crypto_copydata(crp, crp->crp_aad_start, crp->crp_aad_length, - qsc->qsc_gcm_aad); - memset(qsc->qsc_gcm_aad + crp->crp_aad_length, 0, - roundup2(crp->crp_aad_length, QAT_AES_GCM_AAD_ALIGN) - - crp->crp_aad_length); - skip = crp->crp_payload_start; - } else if (crp->crp_aad_length > 0) { - skip = crp->crp_aad_start; + crypto_copydata(crp->crp_flags, crp->crp_buf, mac->crd_skip, + mac->crd_len, qsc->qsc_gcm_aad); + memset(qsc->qsc_gcm_aad + mac->crd_len, 0, + roundup2(mac->crd_len, QAT_AES_GCM_AAD_ALIGN) - + mac->crd_len); + skip = enc->crd_skip; + } else if (mac != NULL) { + skip = mac->crd_skip; } else { - skip = crp->crp_payload_start; + skip = enc->crd_skip; } for (iseg = oseg = 0; iseg < nseg; iseg++) { @@ -1411,21 +1437,59 @@ qat_crypto_load_cb(void *_arg, bus_dma_segment_t *segs qsc->qsc_buf_list.num_buffers = oseg; } +static void +qat_crypto_load_cb2(void *arg, bus_dma_segment_t *segs, int nseg, + bus_size_t mapsize __unused, int error) +{ + qat_crypto_load_cb(arg, segs, nseg, error); +} + static int qat_crypto_load(struct qat_session *qs, struct qat_sym_cookie *qsc, - struct qat_crypto_desc const *desc, struct cryptop *crp) + struct cryptop *crp, struct cryptodesc *enc, struct cryptodesc *mac) { struct qat_crypto_load_cb_arg arg; int error; - crypto_read_iv(crp, qsc->qsc_iv_buf); + if (enc != NULL && (enc->crd_flags & CRD_F_ENCRYPT) != 0) { + if ((enc->crd_flags & CRD_F_IV_EXPLICIT) != 0) + memcpy(qsc->qsc_iv_buf, enc->crd_iv, qs->qs_ivlen); + else + arc4rand(qsc->qsc_iv_buf, qs->qs_ivlen, 0); + if ((enc->crd_flags & CRD_F_IV_PRESENT) == 0) { + crypto_copyback(crp->crp_flags, crp->crp_buf, + enc->crd_inject, qs->qs_ivlen, qsc->qsc_iv_buf); + } + } else if (enc != NULL) { + if ((enc->crd_flags & CRD_F_IV_EXPLICIT) != 0) { + memcpy(qsc->qsc_iv_buf, enc->crd_iv, qs->qs_ivlen); + } else { + crypto_copydata(crp->crp_flags, crp->crp_buf, + enc->crd_inject, qs->qs_ivlen, qsc->qsc_iv_buf); + } + } + arg.crp = crp; + arg.enc = enc; + arg.mac = mac; arg.qs = qs; arg.qsc = qsc; arg.error = 0; - error = bus_dmamap_load_crp(qsc->qsc_buf_dma_tag, qsc->qsc_buf_dmamap, - crp, qat_crypto_load_cb, &arg, BUS_DMA_NOWAIT); + + if ((crp->crp_flags & CRYPTO_F_IOV) != 0) { + error = bus_dmamap_load_uio(qsc->qsc_buf_dma_tag, + qsc->qsc_buf_dmamap, crp->crp_uio, + qat_crypto_load_cb2, &arg, BUS_DMA_NOWAIT); + } else if ((crp->crp_flags & CRYPTO_F_IMBUF) != 0) { + error = bus_dmamap_load_mbuf(qsc->qsc_buf_dma_tag, + qsc->qsc_buf_dmamap, crp->crp_mbuf, + qat_crypto_load_cb2, &arg, BUS_DMA_NOWAIT); + } else { + error = bus_dmamap_load(qsc->qsc_buf_dma_tag, + qsc->qsc_buf_dmamap, crp->crp_buf, crp->crp_ilen, + qat_crypto_load_cb, &arg, BUS_DMA_NOWAIT); + } if (error == 0) error = arg.error; return error; @@ -1615,6 +1679,12 @@ qat_crypto_deinit(struct qat_softc *sc) } } +static void +qat_crypto_register(struct qat_softc *sc, int alg) +{ + (void)crypto_register(sc->sc_crypto.qcy_cid, alg, QAT_MAXLEN, 0); +} + static int qat_crypto_start(struct qat_softc *sc) { @@ -1629,6 +1699,22 @@ qat_crypto_start(struct qat_softc *sc) return ENOENT; } + qat_crypto_register(sc, CRYPTO_AES_CBC); + qat_crypto_register(sc, CRYPTO_AES_ICM); + qat_crypto_register(sc, CRYPTO_AES_XTS); + qat_crypto_register(sc, CRYPTO_AES_NIST_GCM_16); + qat_crypto_register(sc, CRYPTO_AES_128_NIST_GMAC); + qat_crypto_register(sc, CRYPTO_AES_192_NIST_GMAC); + qat_crypto_register(sc, CRYPTO_AES_256_NIST_GMAC); + qat_crypto_register(sc, CRYPTO_SHA1); + qat_crypto_register(sc, CRYPTO_SHA1_HMAC); + qat_crypto_register(sc, CRYPTO_SHA2_256); + qat_crypto_register(sc, CRYPTO_SHA2_256_HMAC); + qat_crypto_register(sc, CRYPTO_SHA2_384); + qat_crypto_register(sc, CRYPTO_SHA2_384_HMAC); + qat_crypto_register(sc, CRYPTO_SHA2_512); + qat_crypto_register(sc, CRYPTO_SHA2_512_HMAC); + return 0; } @@ -1671,16 +1757,19 @@ qat_crypto_sym_rxintr(struct qat_softc *sc, void *arg, error = 0; if ((auth_sz = qs->qs_auth_mlen) != 0) { - if ((crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) != 0) { - crypto_copydata(crp, crp->crp_digest_start, - auth_sz, icv); + if (qs->qs_auth_algo == HW_AUTH_ALGO_GALOIS_128 && + (qsc->qsc_enc->crd_flags & CRD_F_ENCRYPT) == 0) { + crypto_copydata(crp->crp_flags, crp->crp_buf, + qsc->qsc_mac->crd_inject, auth_sz, + icv); if (timingsafe_bcmp(icv, qsc->qsc_auth_res, auth_sz) != 0) { error = EBADMSG; } } else { - crypto_copyback(crp, crp->crp_digest_start, - auth_sz, qsc->qsc_auth_res); + crypto_copyback(crp->crp_flags, crp->crp_buf, + qsc->qsc_mac->crd_inject, auth_sz, + qsc->qsc_auth_res); } } @@ -1706,9 +1795,9 @@ qat_crypto_sym_rxintr(struct qat_softc *sc, void *arg, } static int -qat_probesession(device_t dev, const struct crypto_session_params *csp) +qat_probesession(device_t dev, struct cryptoini *enc, struct cryptoini *mac) { - if (csp->csp_cipher_alg == CRYPTO_AES_XTS && + if (enc != NULL && enc->cri_alg == CRYPTO_AES_XTS && qat_lookup(dev)->qatp_chip == QAT_CHIP_C2XXX) { /* * AES-XTS is not supported by the NanoQAT. @@ -1716,24 +1805,30 @@ qat_probesession(device_t dev, const struct crypto_ses return EINVAL; } - switch (csp->csp_mode) { - case CSP_MODE_CIPHER: - switch (csp->csp_cipher_alg) { - case CRYPTO_AES_CBC: - case CRYPTO_AES_ICM: - if (csp->csp_ivlen != AES_BLOCK_LEN) + if (enc != NULL) { + switch (enc->cri_alg) { + case CRYPTO_AES_NIST_GCM_16: + if (mac == NULL || + (mac->cri_alg != CRYPTO_AES_128_NIST_GMAC && + mac->cri_alg != CRYPTO_AES_192_NIST_GMAC && + mac->cri_alg != CRYPTO_AES_256_NIST_GMAC)) return EINVAL; break; + case CRYPTO_AES_CBC: + case CRYPTO_AES_ICM: case CRYPTO_AES_XTS: - if (csp->csp_ivlen != AES_XTS_IV_LEN) + if (mac != NULL && + mac->cri_alg != CRYPTO_SHA1_HMAC && + mac->cri_alg != CRYPTO_SHA2_256_HMAC && + mac->cri_alg != CRYPTO_SHA2_384_HMAC && + mac->cri_alg != CRYPTO_SHA2_512_HMAC) return EINVAL; break; default: return EINVAL; } - break; - case CSP_MODE_DIGEST: - switch (csp->csp_auth_alg) { + } else { + switch (mac->cri_alg) { case CRYPTO_SHA1: case CRYPTO_SHA1_HMAC: case CRYPTO_SHA2_256: @@ -1743,59 +1838,18 @@ qat_probesession(device_t dev, const struct crypto_ses case CRYPTO_SHA2_512: case CRYPTO_SHA2_512_HMAC: break; - case CRYPTO_AES_NIST_GMAC: - if (csp->csp_ivlen != AES_GCM_IV_LEN) - return EINVAL; - break; default: return EINVAL; } - break; - case CSP_MODE_AEAD: - switch (csp->csp_cipher_alg) { - case CRYPTO_AES_NIST_GCM_16: - if (csp->csp_ivlen != AES_GCM_IV_LEN) - return EINVAL; - break; - default: - return EINVAL; - } - break; - case CSP_MODE_ETA: - switch (csp->csp_auth_alg) { - case CRYPTO_SHA1_HMAC: - case CRYPTO_SHA2_256_HMAC: - case CRYPTO_SHA2_384_HMAC: - case CRYPTO_SHA2_512_HMAC: - switch (csp->csp_cipher_alg) { - case CRYPTO_AES_CBC: - case CRYPTO_AES_ICM: - if (csp->csp_ivlen != AES_BLOCK_LEN) - return EINVAL; - break; - case CRYPTO_AES_XTS: - if (csp->csp_ivlen != AES_XTS_IV_LEN) - return EINVAL; - break; - default: - return EINVAL; - } - break; - default: - return EINVAL; - } - break; - default: - return EINVAL; } - return CRYPTODEV_PROBE_HARDWARE; + return 0; } static int -qat_newsession(device_t dev, crypto_session_t cses, - const struct crypto_session_params *csp) +qat_newsession(device_t dev, crypto_session_t cses, struct cryptoini *cri) { + struct cryptoini *enc, *mac; struct qat_crypto *qcy; struct qat_dmamem *qdm; struct qat_session *qs; @@ -1807,6 +1861,26 @@ qat_newsession(device_t dev, crypto_session_t cses, qs = crypto_get_driver_session(cses); qcy = &sc->sc_crypto; + enc = mac = NULL; + if (qat_is_hash(cri->cri_alg)) + mac = cri; + else + enc = cri; + cri = cri->cri_next; + + if (cri != NULL) { + if (enc == NULL && !qat_is_hash(cri->cri_alg)) + enc = cri; + if (mac == NULL && qat_is_hash(cri->cri_alg)) + mac = cri; + if (cri->cri_next != NULL || !(enc != NULL && mac != NULL)) + return EINVAL; + } + + error = qat_probesession(dev, enc, mac); + if (error != 0) + return error; + qdm = &qs->qs_desc_mem; error = qat_alloc_dmamem(sc, qdm, QAT_MAXSEG, sizeof(struct qat_crypto_desc) * 2, QAT_OPTIMAL_ALIGN); @@ -1830,91 +1904,103 @@ qat_newsession(device_t dev, crypto_session_t cses, qs->qs_status = QAT_SESSION_STATUS_ACTIVE; qs->qs_inflight = 0; - qs->qs_cipher_key = csp->csp_cipher_key; - qs->qs_cipher_klen = csp->csp_cipher_klen; - qs->qs_auth_key = csp->csp_auth_key; - qs->qs_auth_klen = csp->csp_auth_klen; + if (enc != NULL) { + qs->qs_cipher_key = enc->cri_key; + qs->qs_cipher_klen = enc->cri_klen / 8; + } + if (mac != NULL) { + qs->qs_auth_key = mac->cri_key; + qs->qs_auth_klen = mac->cri_klen / 8; + } - switch (csp->csp_cipher_alg) { - case CRYPTO_AES_CBC: - qs->qs_cipher_algo = qat_aes_cipher_algo(csp->csp_cipher_klen); - qs->qs_cipher_mode = HW_CIPHER_CBC_MODE; - break; - case CRYPTO_AES_ICM: - qs->qs_cipher_algo = qat_aes_cipher_algo(csp->csp_cipher_klen); - qs->qs_cipher_mode = HW_CIPHER_CTR_MODE; - break; - case CRYPTO_AES_XTS: - qs->qs_cipher_algo = - qat_aes_cipher_algo(csp->csp_cipher_klen / 2); - qs->qs_cipher_mode = HW_CIPHER_XTS_MODE; - break; - case CRYPTO_AES_NIST_GCM_16: - qs->qs_cipher_algo = qat_aes_cipher_algo(csp->csp_cipher_klen); - qs->qs_cipher_mode = HW_CIPHER_CTR_MODE; - qs->qs_auth_algo = HW_AUTH_ALGO_GALOIS_128; - qs->qs_auth_mode = HW_AUTH_MODE1; - break; - case 0: - break; - default: - panic("%s: unhandled cipher algorithm %d", __func__, - csp->csp_cipher_alg); + if (enc != NULL) { + switch (enc->cri_alg) { + case CRYPTO_AES_CBC: + qs->qs_cipher_algo = qat_aes_cipher_algo(enc->cri_klen); + qs->qs_cipher_mode = HW_CIPHER_CBC_MODE; + qs->qs_ivlen = AES_BLOCK_LEN; + break; + case CRYPTO_AES_ICM: + qs->qs_cipher_algo = qat_aes_cipher_algo(enc->cri_klen); + qs->qs_cipher_mode = HW_CIPHER_CTR_MODE; + qs->qs_ivlen = AES_BLOCK_LEN; + break; + case CRYPTO_AES_XTS: + qs->qs_cipher_algo = + qat_aes_cipher_algo(enc->cri_klen / 2); + qs->qs_cipher_mode = HW_CIPHER_XTS_MODE; + qs->qs_ivlen = AES_XTS_IV_LEN; + break; + case CRYPTO_AES_NIST_GCM_16: + qs->qs_cipher_algo = qat_aes_cipher_algo(enc->cri_klen); + qs->qs_cipher_mode = HW_CIPHER_CTR_MODE; + qs->qs_auth_algo = HW_AUTH_ALGO_GALOIS_128; + qs->qs_auth_mode = HW_AUTH_MODE1; + qs->qs_ivlen = AES_GCM_IV_LEN; + break; + case 0: + break; + default: + panic("%s: unhandled cipher algorithm %d", __func__, + enc->cri_alg); + } } - switch (csp->csp_auth_alg) { - case CRYPTO_SHA1_HMAC: - qs->qs_auth_algo = HW_AUTH_ALGO_SHA1; - qs->qs_auth_mode = HW_AUTH_MODE1; - break; - case CRYPTO_SHA1: - qs->qs_auth_algo = HW_AUTH_ALGO_SHA1; - qs->qs_auth_mode = HW_AUTH_MODE0; - break; - case CRYPTO_SHA2_256_HMAC: - qs->qs_auth_algo = HW_AUTH_ALGO_SHA256; - qs->qs_auth_mode = HW_AUTH_MODE1; - break; - case CRYPTO_SHA2_256: - qs->qs_auth_algo = HW_AUTH_ALGO_SHA256; - qs->qs_auth_mode = HW_AUTH_MODE0; - break; - case CRYPTO_SHA2_384_HMAC: - qs->qs_auth_algo = HW_AUTH_ALGO_SHA384; - qs->qs_auth_mode = HW_AUTH_MODE1; - break; - case CRYPTO_SHA2_384: - qs->qs_auth_algo = HW_AUTH_ALGO_SHA384; - qs->qs_auth_mode = HW_AUTH_MODE0; - break; - case CRYPTO_SHA2_512_HMAC: - qs->qs_auth_algo = HW_AUTH_ALGO_SHA512; - qs->qs_auth_mode = HW_AUTH_MODE1; - break; - case CRYPTO_SHA2_512: - qs->qs_auth_algo = HW_AUTH_ALGO_SHA512; - qs->qs_auth_mode = HW_AUTH_MODE0; - break; - case CRYPTO_AES_NIST_GMAC: - qs->qs_cipher_algo = qat_aes_cipher_algo(csp->csp_auth_klen); - qs->qs_cipher_mode = HW_CIPHER_CTR_MODE; - qs->qs_auth_algo = HW_AUTH_ALGO_GALOIS_128; - qs->qs_auth_mode = HW_AUTH_MODE1; + if (mac != NULL) { + switch (mac->cri_alg) { + case CRYPTO_SHA1_HMAC: + qs->qs_auth_algo = HW_AUTH_ALGO_SHA1; + qs->qs_auth_mode = HW_AUTH_MODE1; + break; + case CRYPTO_SHA1: + qs->qs_auth_algo = HW_AUTH_ALGO_SHA1; + qs->qs_auth_mode = HW_AUTH_MODE0; + break; + case CRYPTO_SHA2_256_HMAC: + qs->qs_auth_algo = HW_AUTH_ALGO_SHA256; + qs->qs_auth_mode = HW_AUTH_MODE1; + break; + case CRYPTO_SHA2_256: + qs->qs_auth_algo = HW_AUTH_ALGO_SHA256; + qs->qs_auth_mode = HW_AUTH_MODE0; + break; + case CRYPTO_SHA2_384_HMAC: + qs->qs_auth_algo = HW_AUTH_ALGO_SHA384; + qs->qs_auth_mode = HW_AUTH_MODE1; + break; + case CRYPTO_SHA2_384: + qs->qs_auth_algo = HW_AUTH_ALGO_SHA384; + qs->qs_auth_mode = HW_AUTH_MODE0; + break; + case CRYPTO_SHA2_512_HMAC: + qs->qs_auth_algo = HW_AUTH_ALGO_SHA512; + qs->qs_auth_mode = HW_AUTH_MODE1; + break; + case CRYPTO_SHA2_512: + qs->qs_auth_algo = HW_AUTH_ALGO_SHA512; + qs->qs_auth_mode = HW_AUTH_MODE0; + break; + case CRYPTO_AES_128_NIST_GMAC: + case CRYPTO_AES_192_NIST_GMAC: + case CRYPTO_AES_256_NIST_GMAC: + qs->qs_cipher_algo = qat_aes_cipher_algo(mac->cri_klen); + qs->qs_cipher_mode = HW_CIPHER_CTR_MODE; + qs->qs_auth_algo = HW_AUTH_ALGO_GALOIS_128; + qs->qs_auth_mode = HW_AUTH_MODE1; - qs->qs_cipher_key = qs->qs_auth_key; - qs->qs_cipher_klen = qs->qs_auth_klen; - break; - case 0: - break; - default: - panic("%s: unhandled auth algorithm %d", __func__, - csp->csp_auth_alg); + qs->qs_cipher_key = qs->qs_auth_key; + qs->qs_cipher_klen = qs->qs_auth_klen; + break; + case 0: + break; + default: + panic("%s: unhandled auth algorithm %d", __func__, + mac->cri_alg); + } } slices = 0; - switch (csp->csp_mode) { - case CSP_MODE_AEAD: - case CSP_MODE_ETA: + if (enc != NULL && mac != NULL) { /* auth then decrypt */ ddesc->qcd_slices[0] = FW_SLICE_AUTH; ddesc->qcd_slices[1] = FW_SLICE_CIPHER; @@ -1926,8 +2012,7 @@ qat_newsession(device_t dev, crypto_session_t cses, edesc->qcd_cipher_dir = HW_CIPHER_ENCRYPT; edesc->qcd_cmd_id = FW_LA_CMD_CIPHER_HASH; slices = 2; - break; - case CSP_MODE_CIPHER: + } else if (enc != NULL) { /* decrypt */ ddesc->qcd_slices[0] = FW_SLICE_CIPHER; ddesc->qcd_cipher_dir = HW_CIPHER_DECRYPT; @@ -1937,8 +2022,7 @@ qat_newsession(device_t dev, crypto_session_t cses, edesc->qcd_cipher_dir = HW_CIPHER_ENCRYPT; edesc->qcd_cmd_id = FW_LA_CMD_CIPHER; slices = 1; - break; - case CSP_MODE_DIGEST: + } else if (mac != NULL) { if (qs->qs_auth_algo == HW_AUTH_ALGO_GALOIS_128) { /* auth then decrypt */ ddesc->qcd_slices[0] = FW_SLICE_AUTH; @@ -1958,10 +2042,6 @@ qat_newsession(device_t dev, crypto_session_t cses, edesc->qcd_cmd_id = FW_LA_CMD_AUTH; slices = 1; } - break; - default: - panic("%s: unhandled crypto algorithm %d, %d", __func__, - csp->csp_cipher_alg, csp->csp_auth_alg); } ddesc->qcd_slices[slices] = FW_SLICE_DRAM_WR; edesc->qcd_slices[slices] = FW_SLICE_DRAM_WR; @@ -1969,13 +2049,13 @@ qat_newsession(device_t dev, crypto_session_t cses, qcy->qcy_sc->sc_hw.qhw_crypto_setup_desc(qcy, qs, ddesc); qcy->qcy_sc->sc_hw.qhw_crypto_setup_desc(qcy, qs, edesc); - if (csp->csp_auth_mlen != 0) - qs->qs_auth_mlen = csp->csp_auth_mlen; + if (mac != NULL && mac->cri_mlen != 0) + qs->qs_auth_mlen = mac->cri_mlen; else qs->qs_auth_mlen = edesc->qcd_auth_sz; /* Compute the GMAC by specifying a null cipher payload. */ - if (csp->csp_auth_alg == CRYPTO_AES_NIST_GMAC) + if (mac != NULL && mac->cri_alg == CRYPTO_AES_NIST_GMAC) ddesc->qcd_cmd_id = edesc->qcd_cmd_id = FW_LA_CMD_AUTH; return 0; @@ -2008,6 +2088,7 @@ qat_freesession(device_t dev, crypto_session_t cses) static int qat_process(device_t dev, struct cryptop *crp, int hint) { + struct cryptodesc *crd, *enc, *mac; struct qat_crypto *qcy; struct qat_crypto_bank *qcb; struct qat_crypto_desc const *desc; @@ -2022,14 +2103,31 @@ qat_process(device_t dev, struct cryptop *crp, int hin qs = crypto_get_driver_session(crp->crp_session); qsc = NULL; - if (__predict_false(crypto_buffer_len(&crp->crp_buf) > QAT_MAXLEN)) { + if (__predict_false(crp->crp_ilen > QAT_MAXLEN)) { error = E2BIG; goto fail1; } + crd = crp->crp_desc; + enc = mac = NULL; + if (qat_is_hash(crd->crd_alg)) + mac = crd; + else + enc = crd; + crd = crd->crd_next; + + if (crd != NULL) { + if (enc == NULL && !qat_is_hash(crd->crd_alg)) + enc = crd; + if (mac == NULL && qat_is_hash(crd->crd_alg)) + mac = crd; + if (crd->crd_next != NULL || !(enc != NULL && mac != NULL)) + return EINVAL; + } + mtx_lock(&qs->qs_session_mtx); if (qs->qs_auth_algo == HW_AUTH_ALGO_GALOIS_128) { - if (crp->crp_aad_length > QAT_GCM_AAD_SIZE_MAX) { + if (mac->crd_len > QAT_GCM_AAD_SIZE_MAX) { error = E2BIG; mtx_unlock(&qs->qs_session_mtx); goto fail1; @@ -2044,13 +2142,13 @@ qat_process(device_t dev, struct cryptop *crp, int hin * size updates here so that the device code can safely update * the session's recorded AAD size. */ - if (__predict_false(crp->crp_aad_length != qs->qs_aad_length)) { + if (__predict_false(mac->crd_len != qs->qs_aad_length)) { if (qs->qs_inflight == 0) { if (qs->qs_aad_length != -1) { counter_u64_add(sc->sc_gcm_aad_updates, 1); } - qs->qs_aad_length = crp->crp_aad_length; + qs->qs_aad_length = mac->crd_len; } else { qs->qs_need_wakeup = true; mtx_unlock(&qs->qs_session_mtx); @@ -2071,12 +2169,14 @@ qat_process(device_t dev, struct cryptop *crp, int hin goto fail2; } - if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) + if (enc != NULL && (enc->crd_flags & CRD_F_ENCRYPT) != 0) desc = qs->qs_enc_desc; else desc = qs->qs_dec_desc; - error = qat_crypto_load(qs, qsc, desc, crp); + qsc->qsc_enc = enc; + qsc->qsc_mac = mac; + error = qat_crypto_load(qs, qsc, crp, enc, mac); if (error != 0) goto fail2; @@ -2085,7 +2185,7 @@ qat_process(device_t dev, struct cryptop *crp, int hin qsbc->qsbc_session = qs; qsbc->qsbc_cb_tag = crp; - sc->sc_hw.qhw_crypto_setup_req_params(qcb, qs, desc, qsc, crp); + sc->sc_hw.qhw_crypto_setup_req_params(qcb, qs, desc, qsc, enc, mac); bus_dmamap_sync(qsc->qsc_buf_dma_tag, qsc->qsc_buf_dmamap, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); @@ -2118,7 +2218,6 @@ static device_method_t qat_methods[] = { DEVMETHOD(device_detach, qat_detach), /* Cryptodev interface */ - DEVMETHOD(cryptodev_probesession, qat_probesession), DEVMETHOD(cryptodev_newsession, qat_newsession), DEVMETHOD(cryptodev_freesession, qat_freesession), DEVMETHOD(cryptodev_process, qat_process), Modified: stable/12/sys/dev/qat/qat_hw15.c ============================================================================== --- head/sys/dev/qat/qat_hw15.c Thu Nov 5 15:55:23 2020 (r367386) +++ stable/12/sys/dev/qat/qat_hw15.c Mon Nov 9 15:36:11 2020 (r367525) @@ -546,19 +546,16 @@ qat_hw15_crypto_setup_cipher_desc(struct qat_crypto_de static void qat_hw15_crypto_setup_cipher_config(const struct qat_crypto_desc *desc, - const struct qat_session *qs, const struct cryptop *crp, + const struct qat_session *qs, const uint8_t *key, struct hw_cipher_config *cipher_config) { - const uint8_t *key; uint8_t *cipher_key; cipher_config->val = qat_crypto_load_cipher_session(desc, qs); cipher_config->reserved = 0; cipher_key = (uint8_t *)(cipher_config + 1); - if (crp != NULL && crp->crp_cipher_key != NULL) - key = crp->crp_cipher_key; - else + if (key == NULL) key = qs->qs_cipher_key; memcpy(cipher_key, key, qs->qs_cipher_klen); } @@ -610,11 +607,10 @@ qat_hw15_crypto_setup_auth_desc(struct qat_crypto_desc static void qat_hw15_crypto_setup_auth_setup(const struct qat_crypto_desc *desc, - const struct qat_session *qs, const struct cryptop *crp, + const struct qat_session *qs, const uint8_t *key, struct hw_auth_setup *auth_setup) { const struct qat_sym_hash_def *hash_def; - const uint8_t *key; uint8_t *state1, *state2; uint32_t state_sz, state1_sz, state2_sz, state1_pad_len, state2_pad_len; @@ -657,9 +653,7 @@ qat_hw15_crypto_setup_auth_setup(const struct qat_cryp auth_setup->auth_counter.counter = 0; break; case HW_AUTH_MODE1: - if (crp != NULL && crp->crp_auth_key != NULL) - key = crp->crp_auth_key; - else + if (key == NULL) key = qs->qs_auth_key; if (key != NULL) { qat_crypto_hmac_precompute(desc, key, @@ -769,7 +763,8 @@ qat_hw15_crypto_setup_desc(struct qat_crypto *qcy, str static void qat_hw15_crypto_req_setkey(const struct qat_crypto_desc *desc, const struct qat_session *qs, struct qat_sym_cookie *qsc, - struct fw_la_bulk_req *bulk_req, struct cryptop *crp) + struct fw_la_bulk_req *bulk_req, const struct cryptodesc *enc, + const struct cryptodesc *mac) { struct hw_auth_setup *auth_setup; struct hw_cipher_config *cipher_config; @@ -783,14 +778,14 @@ qat_hw15_crypto_req_setkey(const struct qat_crypto_des case FW_SLICE_CIPHER: cipher_config = (struct hw_cipher_config *) (cdesc + desc->qcd_cipher_offset); - qat_hw15_crypto_setup_cipher_config(desc, qs, crp, - cipher_config); + qat_hw15_crypto_setup_cipher_config(desc, qs, + enc->crd_key, cipher_config); break; case FW_SLICE_AUTH: auth_setup = (struct hw_auth_setup *) (cdesc + desc->qcd_auth_offset); - qat_hw15_crypto_setup_auth_setup(desc, qs, crp, - auth_setup); + qat_hw15_crypto_setup_auth_setup(desc, qs, + mac->crd_key, auth_setup); break; case FW_SLICE_DRAM_WR: i = MAX_FW_SLICE; /* end of chain */ @@ -806,7 +801,7 @@ qat_hw15_crypto_req_setkey(const struct qat_crypto_des void qat_hw15_crypto_setup_req_params(struct qat_crypto_bank *qcb, struct qat_session *qs, struct qat_crypto_desc const *desc, - struct qat_sym_cookie *qsc, struct cryptop *crp) + struct qat_sym_cookie *qsc, struct cryptodesc *enc, struct cryptodesc *mac) { struct qat_sym_bulk_cookie *qsbc; struct fw_la_bulk_req *bulk_req; @@ -830,9 +825,10 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_ban bulk_req->req_params_addr = qsc->qsc_bulk_req_params_buf_paddr; bulk_req->comn_ftr.next_request_addr = 0; bulk_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)qsc; - if (__predict_false(crp->crp_cipher_key != NULL || - crp->crp_auth_key != NULL)) { - qat_hw15_crypto_req_setkey(desc, qs, qsc, bulk_req, crp); + if (__predict_false( + (enc != NULL && (enc->crd_flags & CRD_F_KEY_EXPLICIT) != 0) || + (mac != NULL && (mac->crd_flags & CRD_F_KEY_EXPLICIT) != 0))) { + qat_hw15_crypto_req_setkey(desc, qs, qsc, bulk_req, enc, mac); } digest_paddr = 0; @@ -865,7 +861,7 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_ban * only. */ cipher_req->cipher_off = 0; - cipher_req->cipher_len = crp->crp_payload_length; + cipher_req->cipher_len = enc->crd_len; } auth_req->curr_id = FW_SLICE_AUTH; if (cmd_id == FW_LA_CMD_HASH_CIPHER || cmd_id == FW_LA_CMD_AUTH) @@ -877,11 +873,11 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_ban auth_req->auth_res_sz = desc->qcd_auth_sz; auth_req->auth_off = 0; - auth_req->auth_len = crp->crp_payload_length; + auth_req->auth_len = enc->crd_len; auth_req->hash_state_sz = - roundup2(crp->crp_aad_length, QAT_AES_GCM_AAD_ALIGN) >> 3; - auth_req->u1.aad_addr = crp->crp_aad_length > 0 ? + roundup2(mac->crd_len, QAT_AES_GCM_AAD_ALIGN) >> 3; + auth_req->u1.aad_addr = mac->crd_len > 0 ? qsc->qsc_gcm_aad_paddr : 0; /* @@ -889,7 +885,7 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_ban * when the AAD length changes between requests in a session and * is synchronized by qat_process(). */ - aad_sz = htobe32(crp->crp_aad_length); + aad_sz = htobe32(mac->crd_len); aad_szp1 = (uint32_t *)( __DECONST(uint8_t *, desc->qcd_content_desc) + desc->qcd_gcm_aad_sz_offset1); @@ -897,7 +893,7 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_ban desc->qcd_gcm_aad_sz_offset2; if (__predict_false(*aad_szp1 != aad_sz)) { *aad_szp1 = aad_sz; - *aad_szp2 = (uint8_t)roundup2(crp->crp_aad_length, + *aad_szp2 = (uint8_t)roundup2(mac->crd_len, QAT_AES_GCM_AAD_ALIGN); bus_dmamap_sync(qs->qs_desc_mem.qdm_dma_tag, qs->qs_desc_mem.qdm_dma_map, @@ -918,9 +914,9 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_ban cipher_req->curr_id = FW_SLICE_CIPHER; cipher_req->next_id = next_slice; - cipher_req->cipher_off = crp->crp_aad_length == 0 ? 0 : - crp->crp_payload_start - crp->crp_aad_start; - cipher_req->cipher_len = crp->crp_payload_length; + cipher_req->cipher_off = mac != NULL ? + mac->crd_len - enc->crd_len : 0; + cipher_req->cipher_len = enc->crd_len; cipher_req->state_address = qsc->qsc_iv_buf_paddr; } if (cmd_id != FW_LA_CMD_CIPHER) { @@ -941,8 +937,7 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_ban *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 9 15:37:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25099465E67; Mon, 9 Nov 2020 15:37:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVFVK0XHrz3DK1; Mon, 9 Nov 2020 15:37:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 054D413A6C; Mon, 9 Nov 2020 15:37:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9FbC6I037202; Mon, 9 Nov 2020 15:37:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9FbCx6037201; Mon, 9 Nov 2020 15:37:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011091537.0A9FbCx6037201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 9 Nov 2020 15:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367526 - in stable/12/sys: contrib/dev/qat modules modules/qatfw X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: contrib/dev/qat modules modules/qatfw X-SVN-Commit-Revision: 367526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 15:37:13 -0000 Author: markj Date: Mon Nov 9 15:37:12 2020 New Revision: 367526 URL: https://svnweb.freebsd.org/changeset/base/367526 Log: MFC r367387, r367422: Add firmware modules for qat(4) Added: stable/12/sys/contrib/dev/qat/ - copied from r367387, head/sys/contrib/dev/qat/ stable/12/sys/modules/qatfw/ - copied from r367387, head/sys/modules/qatfw/ Modified: stable/12/sys/contrib/dev/qat/mmp_firmware_c2xxx.bin (contents, props changed) stable/12/sys/contrib/dev/qat/mof_firmware_c2xxx.bin (contents, props changed) stable/12/sys/contrib/dev/qat/qat_895xcc.bin (contents, props changed) stable/12/sys/contrib/dev/qat/qat_895xcc_mmp.bin (contents, props changed) stable/12/sys/contrib/dev/qat/qat_c3xxx.bin (contents, props changed) stable/12/sys/contrib/dev/qat/qat_c3xxx_mmp.bin (contents, props changed) stable/12/sys/contrib/dev/qat/qat_c62x.bin (contents, props changed) stable/12/sys/contrib/dev/qat/qat_c62x_mmp.bin (contents, props changed) stable/12/sys/contrib/dev/qat/qat_d15xx.bin (contents, props changed) stable/12/sys/contrib/dev/qat/qat_d15xx_mmp.bin (contents, props changed) stable/12/sys/modules/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/contrib/dev/qat/mmp_firmware_c2xxx.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/mof_firmware_c2xxx.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/qat_895xcc.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/qat_895xcc_mmp.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/qat_c3xxx.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/qat_c3xxx_mmp.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/qat_c62x.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/qat_c62x_mmp.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/qat_d15xx.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/contrib/dev/qat/qat_d15xx_mmp.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/sys/modules/Makefile ============================================================================== --- stable/12/sys/modules/Makefile Mon Nov 9 15:36:11 2020 (r367525) +++ stable/12/sys/modules/Makefile Mon Nov 9 15:37:12 2020 (r367526) @@ -324,6 +324,7 @@ SUBDIR= \ puc \ pwm \ ${_qat} \ + ${_qatfw} \ ${_qlxge} \ ${_qlxgb} \ ${_qlxgbe} \ @@ -663,6 +664,7 @@ _ndis= ndis _ocs_fc= ocs_fc _pccard= pccard _qat= qat +_qatfw= qatfw .if ${MK_OFED} != "no" || defined(ALL_MODULES) _rdma= rdma .endif From owner-svn-src-all@freebsd.org Mon Nov 9 15:37:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E6494662CE; Mon, 9 Nov 2020 15:37:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVFWB1q2kz3DRQ; Mon, 9 Nov 2020 15:37:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 313CF137FD; Mon, 9 Nov 2020 15:37:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9FbvOv037294; Mon, 9 Nov 2020 15:37:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9Fbvtl037293; Mon, 9 Nov 2020 15:37:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011091537.0A9Fbvtl037293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 9 Nov 2020 15:37:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367527 - stable/12/tests/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/tests/sys/opencrypto X-SVN-Commit-Revision: 367527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 15:37:58 -0000 Author: markj Date: Mon Nov 9 15:37:57 2020 New Revision: 367527 URL: https://svnweb.freebsd.org/changeset/base/367527 Log: MFC r367388: cryptotest: Add qat(4) coverage Modified: stable/12/tests/sys/opencrypto/cryptotest.py Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/opencrypto/cryptotest.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptotest.py Mon Nov 9 15:37:12 2020 (r367526) +++ stable/12/tests/sys/opencrypto/cryptotest.py Mon Nov 9 15:37:57 2020 (r367527) @@ -49,9 +49,9 @@ def katg(base, glob): raise unittest.SkipTest("Missing %s test vectors" % (base)) return iglob(os.path.join(katdir, base, glob)) -aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0', 'safexcel0' ] +aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0', 'safexcel0', 'qat0' ] desmodules = [ 'cryptosoft0', ] -shamodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0', 'safexcel0' ] +shamodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0', 'safexcel0', 'qat0' ] def GenTestCase(cname): try: @@ -471,6 +471,7 @@ aesni = GenTestCase('aesni0') ccr = GenTestCase('ccr0') ccp = GenTestCase('ccp0') safexcel = GenTestCase('safexcel0') +qat = GenTestCase('qat0') if __name__ == '__main__': unittest.main() From owner-svn-src-all@freebsd.org Mon Nov 9 18:07:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAD31469EF8; Mon, 9 Nov 2020 18:07:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVJqY4RBVz3hdl; Mon, 9 Nov 2020 18:07:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B3BF15842; Mon, 9 Nov 2020 18:07:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9I7L0d038100; Mon, 9 Nov 2020 18:07:21 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9I7LAO038099; Mon, 9 Nov 2020 18:07:21 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202011091807.0A9I7LAO038099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 9 Nov 2020 18:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367528 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 18:07:21 -0000 Author: mhorne Date: Mon Nov 9 18:07:21 2020 New Revision: 367528 URL: https://svnweb.freebsd.org/changeset/base/367528 Log: MFC r366526: Handle kmod local relocation failures gracefully Modified: stable/12/sys/kern/link_elf_obj.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/link_elf_obj.c ============================================================================== --- stable/12/sys/kern/link_elf_obj.c Mon Nov 9 15:37:57 2020 (r367527) +++ stable/12/sys/kern/link_elf_obj.c Mon Nov 9 18:07:21 2020 (r367528) @@ -1660,9 +1660,11 @@ link_elf_reloc_local(linker_file_t lf, bool ifuncs) if (ELF_ST_BIND(sym->st_info) != STB_LOCAL) continue; if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC || - elf_is_ifunc_reloc(rel->r_info)) == ifuncs) - elf_reloc_local(lf, base, rel, ELF_RELOC_REL, - elf_obj_lookup); + elf_is_ifunc_reloc(rel->r_info)) != ifuncs) + continue; + if (elf_reloc_local(lf, base, rel, ELF_RELOC_REL, + elf_obj_lookup) != 0) + return (ENOEXEC); } } @@ -1688,9 +1690,11 @@ link_elf_reloc_local(linker_file_t lf, bool ifuncs) if (ELF_ST_BIND(sym->st_info) != STB_LOCAL) continue; if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC || - elf_is_ifunc_reloc(rela->r_info)) == ifuncs) - elf_reloc_local(lf, base, rela, ELF_RELOC_RELA, - elf_obj_lookup); + elf_is_ifunc_reloc(rela->r_info)) != ifuncs) + continue; + if (elf_reloc_local(lf, base, rela, ELF_RELOC_RELA, + elf_obj_lookup) != 0) + return (ENOEXEC); } } return (0); From owner-svn-src-all@freebsd.org Mon Nov 9 20:16:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8197446C25B; Mon, 9 Nov 2020 20:16:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVMhF2kvSz3qZx; Mon, 9 Nov 2020 20:16:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1604952973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=06RkWrsS4WMckY+c94xhe3c22piLJ6kOokFGuJ+PWO8=; b=xgExMqEfeTbUgoxNs3QTE10pt1bQ/U7IOt5sMxXgAXicRqoMvzNWTT75QcYr/xY+RGuFBC pR8xkaCHCe5Yd5QVYvp2peX0anM1NbS9Ix4tYvjcN1EAPf/ChHPNi+vFwI3ZHsOhtXGeWg nX3ONQmF2QSdrNQDr1fHcokM1YMTuY021UGHeTDt0Rgp30VKPQYxHz8miGB9xQjoucjhFX dj4WjuGRlXIew0yg+sIiFbadesb0MJSHKFxmDuRYCdCFSM0s66hvVgXfwqoSn2/PsEd4/k 47XQFtm6lYMkyK28As+8gCgzNNbvvzkgtZrDJdETNsm/3pFvRPBCiWnlOjNRzQ== Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 7F17C17805; Mon, 9 Nov 2020 20:16:12 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 84309DB2D; Mon, 9 Nov 2020 20:16:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id UF1f1igzQPiz; Mon, 9 Nov 2020 20:16:08 +0000 (UTC) Subject: Re: svn commit: r367459 - head/usr.sbin/syslogd DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 6FB71DB20 To: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011071917.0A7JHbUS079060@repo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <4b605497-6dd1-72fe-fb05-b45c61ee6fa8@FreeBSD.org> Date: Mon, 9 Nov 2020 12:16:07 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 In-Reply-To: <202011071917.0A7JHbUS079060@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DvEGZHRjSTag0u76mwejgpWCFKL1X8kJx" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1604952973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=06RkWrsS4WMckY+c94xhe3c22piLJ6kOokFGuJ+PWO8=; b=pPmC1AMFkVaDDyUa3Z1hlKCaSjqBv7Uv8bmR6odidr23uY6wmk2ePJTUa3Vjric9eeLMN0 PGnyaQXB/gvX0q8YR2zpdSqnPle0tg9kfH8XIRaE38w5n3GHZAZYp9E44CpoUrNueHh2DF rGpN3Dqacf0JD+MbYyT1Eiv6Ni1WiGSwlq7SvjA2jbDvgjR/T0EbeReB+pggv4WfIsBD2b B0Ap9UL9KPHTTaZxRpjj2nxhV3WOHmrjoyFqiYflQDkLJJ0IDpaqFbSRrdYHhg3JQA6yaG MRc7pWWL7BLk+daeX7eZuX6VNqWT87VFTa6rM/m7THNPGsxrCRWY+b9LtHpiuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1604952973; a=rsa-sha256; cv=none; b=AqSOOLabSZaKxfafskKDNKvlYMXj6rfET772LcQa2F856Y3nFkronWFHuHuFDtAk2Tbhd7 3C+hwloSCwnGkci4XuJk5fQ/3mhWVIl9lOr9lTKiQx3j1jV2ec2kBqgkC989pPXyqHQmXv W2DKfj//lJ68+YOQZwc8qrrjBw2m6wtA9/lCXbx7L/3uyZXjXYlYoJwnMXgwb7tbdc+IUl +Z5UJ79uEmnaY/gx8gLwdlFKCktNArIBZRr+pzbifJIULWPePs9geZ5ZsDCzPauEw+EwY8 mYMsZk8ri9FtIJWHQrTjVr0y7BYfcoSI5QL5ueGwllyjeh4nW4sHr8kaqbEVog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 20:16:13 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DvEGZHRjSTag0u76mwejgpWCFKL1X8kJx Content-Type: multipart/mixed; boundary="xQRNdJYoXBOGEU9TCnYnmX8FWGVxUTnsh"; protected-headers="v1" From: Bryan Drewery To: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <4b605497-6dd1-72fe-fb05-b45c61ee6fa8@FreeBSD.org> Subject: Re: svn commit: r367459 - head/usr.sbin/syslogd References: <202011071917.0A7JHbUS079060@repo.freebsd.org> In-Reply-To: <202011071917.0A7JHbUS079060@repo.freebsd.org> --xQRNdJYoXBOGEU9TCnYnmX8FWGVxUTnsh Content-Type: multipart/mixed; boundary="------------9CBC57D81FB1CF44779F663A" Content-Language: en-US This is a multi-part message in MIME format. --------------9CBC57D81FB1CF44779F663A Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thanks. I had the commit in a branch that had a debug commit after. The brace was rebased wrong. On 11/7/2020 11:17 AM, Cy Schubert wrote: > Author: cy > Date: Sat Nov 7 19:17:37 2020 > New Revision: 367459 > URL: https://svnweb.freebsd.org/changeset/base/367459 >=20 > Log: > Fix build post-r367455. > =20 > MFC after: 2 weeks > X-MFC with: r367455 >=20 > Modified: > head/usr.sbin/syslogd/syslogd.c >=20 > Modified: head/usr.sbin/syslogd/syslogd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/syslogd/syslogd.c Sat Nov 7 18:15:29 2020 (r367458) > +++ head/usr.sbin/syslogd/syslogd.c Sat Nov 7 19:17:37 2020 (r367459) > @@ -1873,7 +1873,7 @@ fprintlog_write(struct filed *f, struct iovlist *= il, i > continue; > if (sl->sl_sa =3D=3D NULL || > sl->sl_family =3D=3D AF_UNSPEC || > - sl->sl_family =3D=3D AF_LOCAL) { > + sl->sl_family =3D=3D AF_LOCAL) > continue; > lsent =3D sendmsg(sl->sl_socket, &msghdr, 0); > if (lsent =3D=3D (ssize_t)il->totalsize) >=20 --=20 Regards, Bryan Drewery --------------9CBC57D81FB1CF44779F663A-- --xQRNdJYoXBOGEU9TCnYnmX8FWGVxUTnsh-- --DvEGZHRjSTag0u76mwejgpWCFKL1X8kJx Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl+po4cFAwAAAAAACgkQNddxu25Gl89b 1ggAues8XaQpTjYn+ujNLEomZaJVX7zCzvFzMAfdKE4ogwi0Bdaaj+43FnJm+aEf6YQV/d8+9A4x MhJW1CaIShmm4z7ZwwtREtGgMHZ0qW4uW7/gKhQZq+ARbKvUvY5nCNlUu2taA8h63YlCUkV59OXT RGx6Rw7SKvkbv6mXpDw+WUXbGrPcSAUdNhhfyHGWXegxmGRx5VcjzjxMVb7T7PHgFTqQqkXYeRKS WZORZ0GXq2TSCcq/JcWRyEOjLqFUmzZ26ZHICiGLtlhsqQMfNoajrvwa1w5v21aFYajXaztjI17j X+Q90XVoCWK3tBMrdH9UhIuqMpIqGMCEZm+T5T3fmQ== =GE65 -----END PGP SIGNATURE----- --DvEGZHRjSTag0u76mwejgpWCFKL1X8kJx-- From owner-svn-src-all@freebsd.org Mon Nov 9 21:19:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12AE346D971; Mon, 9 Nov 2020 21:19:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVP5204zCz3tcx; Mon, 9 Nov 2020 21:19:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9F7A17C71; Mon, 9 Nov 2020 21:19:17 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9LJHGu051377; Mon, 9 Nov 2020 21:19:17 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9LJHkQ051376; Mon, 9 Nov 2020 21:19:17 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202011092119.0A9LJHkQ051376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 9 Nov 2020 21:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367529 - stable/12/sys/mips/mips X-SVN-Group: stable-12 X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: stable/12/sys/mips/mips X-SVN-Commit-Revision: 367529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 21:19:18 -0000 Author: jhibbits Date: Mon Nov 9 21:19:17 2020 New Revision: 367529 URL: https://svnweb.freebsd.org/changeset/base/367529 Log: MFC r367355: Fix UMA alignment for COP2 context structure. Modified: stable/12/sys/mips/mips/octeon_cop2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/mips/mips/octeon_cop2.c ============================================================================== --- stable/12/sys/mips/mips/octeon_cop2.c Mon Nov 9 18:07:21 2020 (r367528) +++ stable/12/sys/mips/mips/octeon_cop2.c Mon Nov 9 21:19:17 2020 (r367529) @@ -46,7 +46,7 @@ octeon_cop2_init(void* dummy) printf("Create COP2 context zone\n"); ctxzone = uma_zcreate("COP2 context", sizeof(struct octeon_cop2_state), - NULL, NULL, NULL, NULL, 8, 0); + NULL, NULL, NULL, NULL, UMA_ALIGN_LONG, 0); } struct octeon_cop2_state * From owner-svn-src-all@freebsd.org Mon Nov 9 21:49:42 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37C7E46E718; Mon, 9 Nov 2020 21:49:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVPm619QNz3w58; Mon, 9 Nov 2020 21:49:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16B1617F35; Mon, 9 Nov 2020 21:49:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9Lnfox069054; Mon, 9 Nov 2020 21:49:41 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9Lnfmh069050; Mon, 9 Nov 2020 21:49:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011092149.0A9Lnfmh069050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 9 Nov 2020 21:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367530 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 367530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 21:49:42 -0000 Author: tuexen Date: Mon Nov 9 21:49:40 2020 New Revision: 367530 URL: https://svnweb.freebsd.org/changeset/base/367530 Log: RFC 7323 specifies that: * TCP segments without timestamps should be dropped when support for the timestamp option has been negotiated. * TCP segments with timestamps should be processed normally if support for the timestamp option has not been negotiated. This patch enforces the above. PR: 250499 Reviewed by: gnn, rrs MFC after: 1 week Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D27148 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon Nov 9 21:19:17 2020 (r367529) +++ head/sys/netinet/tcp_input.c Mon Nov 9 21:49:40 2020 (r367530) @@ -977,8 +977,8 @@ findpcb: * XXXRW: It may be time to rethink timewait locking. */ if (inp->inp_flags & INP_TIMEWAIT) { - if (thflags & TH_SYN) - tcp_dooptions(&to, optp, optlen, TO_SYN); + tcp_dooptions(&to, optp, optlen, + (thflags & TH_SYN) ? TO_SYN : 0); /* * NB: tcp_twcheck unlocks the INP and frees the mbuf. */ @@ -1680,20 +1680,29 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru } /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session and vice versa. + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. */ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); + "segment silently dropped\n", s, __func__); free(s, M_TCPLOG); } + goto drop; } + /* + * If timestamps were not negotiated during SYN/ACK and a + * segment without a timestamp is received, ignore the + * timestamp and process the packet normally. + * See section 3.2 of RFC 7323. + */ if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "no action\n", s, __func__); + "segment processed normally\n", s, __func__); free(s, M_TCPLOG); } } Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Mon Nov 9 21:19:17 2020 (r367529) +++ head/sys/netinet/tcp_stacks/bbr.c Mon Nov 9 21:49:40 2020 (r367530) @@ -11430,12 +11430,6 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr #ifdef STATS stats_voi_update_abs_ulong(tp->t_stats, VOI_TCP_FRWIN, tiwin); #endif - /* - * Parse options on any incoming segment. - */ - tcp_dooptions(&to, (u_char *)(th + 1), - (th->th_off << 2) - sizeof(struct tcphdr), - (thflags & TH_SYN) ? TO_SYN : 0); if (m->m_flags & M_TSTMP) { /* Prefer the hardware timestamp if present */ @@ -11458,6 +11452,23 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr * Ok just get the current time. */ bbr->r_ctl.rc_rcvtime = lcts = cts = tcp_get_usecs(&bbr->rc_tv); + } + /* + * Parse options on any incoming segment. + */ + tcp_dooptions(&to, (u_char *)(th + 1), + (th->th_off << 2) - sizeof(struct tcphdr), + (thflags & TH_SYN) ? TO_SYN : 0); + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + retval = 0; + goto done_with_input; } /* * If echoed timestamp is later than the current time, fall back to Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Mon Nov 9 21:19:17 2020 (r367529) +++ head/sys/netinet/tcp_stacks/rack.c Mon Nov 9 21:49:40 2020 (r367530) @@ -10525,7 +10525,7 @@ rack_handoff_ok(struct tcpcb *tp) if ((tp->t_state == TCPS_SYN_SENT) || (tp->t_state == TCPS_SYN_RECEIVED)) { /* - * We really don't know if you support sack, + * We really don't know if you support sack, * you have to get to ESTAB or beyond to tell. */ return (EAGAIN); @@ -10868,7 +10868,27 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr ctf_do_dropwithreset(m, tp, th, BANDLIM_RST_OPENPORT, tlen); return(1); } + /* + * Parse options on any incoming segment. + */ + tcp_dooptions(&to, (u_char *)(th + 1), + (th->th_off << 2) - sizeof(struct tcphdr), + (thflags & TH_SYN) ? TO_SYN : 0); + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + way_out = 5; + retval = 0; + goto done_with_input; + } + + /* * Segment received on connection. Reset idle time and keep-alive * timer. XXX: This should be done after segment validation to * ignore broken/spoofed segs. @@ -10920,12 +10940,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr rack_cong_signal(tp, th, CC_ECN); } } - /* - * Parse options on any incoming segment. - */ - tcp_dooptions(&to, (u_char *)(th + 1), - (th->th_off << 2) - sizeof(struct tcphdr), - (thflags & TH_SYN) ? TO_SYN : 0); /* * If echoed timestamp is later than the current time, fall back to Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Mon Nov 9 21:19:17 2020 (r367529) +++ head/sys/netinet/tcp_syncache.c Mon Nov 9 21:49:40 2020 (r367530) @@ -1212,6 +1212,40 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt } /* + * If timestamps were not negotiated during SYN/ACK and a + * segment without a timestamp is received, ignore the + * timestamp and process the packet normally. + * See section 3.2 of RFC 7323. + */ + if (!(sc->sc_flags & SCF_TIMESTAMP) && + (to->to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp not " + "expected, segment processed normally\n", + s, __func__); + free(s, M_TCPLOG); + s = NULL; + } + } + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if ((sc->sc_flags & SCF_TIMESTAMP) && + !(to->to_flags & TOF_TS)) { + SCH_UNLOCK(sch); + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "segment silently dropped\n", s, __func__); + free(s, M_TCPLOG); + } + return (-1); /* Do not send RST */ + } + + /* * Pull out the entry to unlock the bucket row. * * NOTE: We must decrease TCPS_SYN_RECEIVED count here, not @@ -1254,32 +1288,6 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt log(LOG_DEBUG, "%s; %s: SEQ %u != IRS+1 %u, segment " "rejected\n", s, __func__, th->th_seq, sc->sc_irs); goto failed; - } - - /* - * If timestamps were not negotiated during SYN/ACK they - * must not appear on any segment during this session. - */ - if (!(sc->sc_flags & SCF_TIMESTAMP) && (to->to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) - log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "segment rejected\n", s, __func__); - goto failed; - } - - /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session. - * XXXAO: This is only informal as there have been unverified - * reports of non-compliants stacks. - */ - if ((sc->sc_flags & SCF_TIMESTAMP) && !(to->to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - s = NULL; - } } *lsop = syncache_socket(sc, *lsop, m); Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Mon Nov 9 21:19:17 2020 (r367529) +++ head/sys/netinet/tcp_timewait.c Mon Nov 9 21:49:40 2020 (r367530) @@ -376,7 +376,7 @@ tcp_twstart(struct tcpcb *tp) * looking for a pcb in the listen state. Returns 0 otherwise. */ int -tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr *th, +tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, struct mbuf *m, int tlen) { struct tcptw *tw; @@ -410,6 +410,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu */ if (thflags & TH_RST) goto drop; + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) { + goto drop; + } #if 0 /* PAWS not needed at the moment */ From owner-svn-src-all@freebsd.org Mon Nov 9 22:23:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89ED346EE2D; Mon, 9 Nov 2020 22:23:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVQW23XCNz4RrN; Mon, 9 Nov 2020 22:23:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C0C9186B3; Mon, 9 Nov 2020 22:23:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9MNQAf092260; Mon, 9 Nov 2020 22:23:26 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9MNQU1092259; Mon, 9 Nov 2020 22:23:26 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <202011092223.0A9MNQU1092259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 9 Nov 2020 22:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r367531 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 367531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 22:23:26 -0000 Author: gjb Date: Mon Nov 9 22:23:25 2020 New Revision: 367531 URL: https://svnweb.freebsd.org/changeset/base/367531 Log: Turn over releng/12.2 to so@ Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Mon Nov 9 21:49:40 2020 (r367530) +++ svnadmin/conf/approvers Mon Nov 9 22:23:25 2020 (r367531) @@ -20,8 +20,7 @@ #^stable/12/ re #^stable/11/ re ^release/ re -^releng/12.2/ re -^releng/12.[0-1]/ (security-officer|so) +^releng/12.[0-2]/ (security-officer|so) ^releng/11.[0-4]/ (security-officer|so) ^releng/10.[0-4]/ (security-officer|so) ^releng/9.[0-3]/ (security-officer|so) From owner-svn-src-all@freebsd.org Mon Nov 9 22:58:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D66F446FA86; Mon, 9 Nov 2020 22:58:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVRHT5lrBz4T5l; Mon, 9 Nov 2020 22:58:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B386518B52; Mon, 9 Nov 2020 22:58:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9MwTiX010176; Mon, 9 Nov 2020 22:58:29 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9MwTP4010174; Mon, 9 Nov 2020 22:58:29 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011092258.0A9MwTP4010174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 22:58:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367532 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 22:58:29 -0000 Author: mjg Date: Mon Nov 9 22:58:29 2020 New Revision: 367532 URL: https://svnweb.freebsd.org/changeset/base/367532 Log: malloc: retire mt_stats_zone in favor of pcpu_zone_64 Reviewed by: markj, imp Differential Revision: https://reviews.freebsd.org/D27142 Modified: head/sys/kern/kern_malloc.c head/sys/sys/malloc.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Mon Nov 9 22:23:25 2020 (r367531) +++ head/sys/kern/kern_malloc.c Mon Nov 9 22:58:29 2020 (r367532) @@ -174,11 +174,6 @@ struct { {0, NULL}, }; -/* - * Zone to allocate per-CPU storage for statistics. - */ -static uma_zone_t mt_stats_zone; - u_long vm_kmem_size; SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN, &vm_kmem_size, 0, "Size of kernel memory"); @@ -1184,9 +1179,6 @@ mallocinit(void *dummy) if (kmem_zmax < PAGE_SIZE || kmem_zmax > KMEM_ZMAX) kmem_zmax = KMEM_ZMAX; - mt_stats_zone = uma_zcreate("mt_stats_zone", - sizeof(struct malloc_type_stats), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, UMA_ZONE_PCPU); for (i = 0, indx = 0; kmemzones[indx].kz_size != 0; indx++) { int size = kmemzones[indx].kz_size; const char *name = kmemzones[indx].kz_name; @@ -1222,7 +1214,7 @@ malloc_init(void *data) mtp->ks_shortdesc, mtp->ks_version); mtip = &mtp->ks_mti; - mtip->mti_stats = uma_zalloc_pcpu(mt_stats_zone, M_WAITOK | M_ZERO); + mtip->mti_stats = uma_zalloc_pcpu(pcpu_zone_64, M_WAITOK | M_ZERO); mtp_set_subzone(mtp); mtx_lock(&malloc_mtx); @@ -1279,7 +1271,7 @@ malloc_uninit(void *data) temp_allocs, temp_bytes); } - uma_zfree_pcpu(mt_stats_zone, mtip->mti_stats); + uma_zfree_pcpu(pcpu_zone_64, mtip->mti_stats); } struct malloc_type * Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Mon Nov 9 22:23:25 2020 (r367531) +++ head/sys/sys/malloc.h Mon Nov 9 22:58:29 2020 (r367532) @@ -92,6 +92,9 @@ struct malloc_type_stats { uint64_t _mts_reserved3; /* Reserved field. */ }; +_Static_assert(sizeof(struct malloc_type_stats) == 64, + "allocations come from pcpu_zone_64"); + /* * Index definitions for the mti_probes[] array. */ From owner-svn-src-all@freebsd.org Mon Nov 9 22:59:42 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C3F246F8F1; Mon, 9 Nov 2020 22:59:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVRJt39Jmz4TWq; Mon, 9 Nov 2020 22:59:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F5C818DDB; Mon, 9 Nov 2020 22:59:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9MxgnS010233; Mon, 9 Nov 2020 22:59:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9Mxg5j010232; Mon, 9 Nov 2020 22:59:42 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011092259.0A9Mxg5j010232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 22:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367533 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 22:59:42 -0000 Author: mjg Date: Mon Nov 9 22:59:41 2020 New Revision: 367533 URL: https://svnweb.freebsd.org/changeset/base/367533 Log: malloc: provide 384 byte zone Total page count after buildworld on ZFS for 384 (if present) and 512 zones: before: 29713 after: 25946 per-zone page use: vm.uma.malloc_384.keg.domain.1.pages: 11621 vm.uma.malloc_384.keg.domain.0.pages: 11597 vm.uma.malloc_512.keg.domain.1.pages: 1280 vm.uma.malloc_512.keg.domain.0.pages: 1448 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27145 Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Mon Nov 9 22:58:29 2020 (r367532) +++ head/sys/kern/kern_malloc.c Mon Nov 9 22:59:41 2020 (r367533) @@ -163,6 +163,7 @@ struct { {64, "malloc-64", }, {128, "malloc-128", }, {256, "malloc-256", }, + {384, "malloc-384", }, {512, "malloc-512", }, {1024, "malloc-1024", }, {2048, "malloc-2048", }, From owner-svn-src-all@freebsd.org Mon Nov 9 23:00:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8775D46FAC7; Mon, 9 Nov 2020 23:00:30 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVRKp3RfYz4TZy; Mon, 9 Nov 2020 23:00:30 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 682FA18AF5; Mon, 9 Nov 2020 23:00:30 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9N0URI010353; Mon, 9 Nov 2020 23:00:30 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9N0UOg010352; Mon, 9 Nov 2020 23:00:30 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011092300.0A9N0UOg010352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 23:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367534 - head/usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/usr.bin/vmstat X-SVN-Commit-Revision: 367534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 23:00:30 -0000 Author: mjg Date: Mon Nov 9 23:00:29 2020 New Revision: 367534 URL: https://svnweb.freebsd.org/changeset/base/367534 Log: vmstat: drop the HighUse field from malloc dump It is hardwired to "-" since its introduction in 2005. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27141 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Mon Nov 9 22:59:41 2020 (r367533) +++ head/usr.bin/vmstat/vmstat.c Mon Nov 9 23:00:29 2020 (r367534) @@ -1433,8 +1433,8 @@ domemstat_malloc(void) } } xo_open_container("malloc-statistics"); - xo_emit("{T:/%13s} {T:/%5s} {T:/%6s} {T:/%7s} {T:/%8s} {T:Size(s)}\n", - "Type", "InUse", "MemUse", "HighUse", "Requests"); + xo_emit("{T:/%13s} {T:/%5s} {T:/%6s} {T:/%8s} {T:Size(s)}\n", + "Type", "InUse", "MemUse", "Requests"); xo_open_list("memory"); zones = memstat_malloc_zone_get_count(); for (mtp = memstat_mtl_first(mtlp); mtp != NULL; @@ -1444,10 +1444,9 @@ domemstat_malloc(void) continue; xo_open_instance("memory"); xo_emit("{k:type/%13s/%s} {:in-use/%5ju} " - "{:memory-use/%5ju}{U:K} {:high-use/%7s} " - "{:requests/%8ju} ", + "{:memory-use/%5ju}{U:K} {:requests/%8ju} ", memstat_get_name(mtp), (uintmax_t)memstat_get_count(mtp), - ((uintmax_t)memstat_get_bytes(mtp) + 1023) / 1024, "-", + ((uintmax_t)memstat_get_bytes(mtp) + 1023) / 1024, (uintmax_t)memstat_get_numallocs(mtp)); first = 1; xo_open_list("size"); From owner-svn-src-all@freebsd.org Mon Nov 9 23:02:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2765146FE4E; Mon, 9 Nov 2020 23:02:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVRMq0YtMz4TqS; Mon, 9 Nov 2020 23:02:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0673C19195; Mon, 9 Nov 2020 23:02:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9N2FDJ015040; Mon, 9 Nov 2020 23:02:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9N2D63015034; Mon, 9 Nov 2020 23:02:13 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011092302.0A9N2D63015034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 23:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367535 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 23:02:15 -0000 Author: mjg Date: Mon Nov 9 23:02:13 2020 New Revision: 367535 URL: https://svnweb.freebsd.org/changeset/base/367535 Log: vfs: group mount per-cpu vars into one struct While here move frequently read stuff into the same cacheline. This shrinks struct mount by 64 bytes. Tested by: pho Modified: head/sys/kern/vfs_cache.c head/sys/kern/vfs_default.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_vnops.c head/sys/sys/mount.h Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Nov 9 23:00:29 2020 (r367534) +++ head/sys/kern/vfs_cache.c Mon Nov 9 23:02:13 2020 (r367535) @@ -4249,6 +4249,7 @@ static int __noinline cache_fplookup_climb_mount(struct cache_fpl *fpl) { struct mount *mp, *prev_mp; + struct mount_pcpu *mpcpu, *prev_mpcpu; struct vnode *vp; seqc_t vp_seqc; @@ -4262,38 +4263,39 @@ cache_fplookup_climb_mount(struct cache_fpl *fpl) prev_mp = NULL; for (;;) { - if (!vfs_op_thread_enter_crit(mp)) { + if (!vfs_op_thread_enter_crit(mp, mpcpu)) { if (prev_mp != NULL) - vfs_op_thread_exit_crit(prev_mp); + vfs_op_thread_exit_crit(prev_mp, prev_mpcpu); return (cache_fpl_partial(fpl)); } if (prev_mp != NULL) - vfs_op_thread_exit_crit(prev_mp); + vfs_op_thread_exit_crit(prev_mp, prev_mpcpu); if (!vn_seqc_consistent(vp, vp_seqc)) { - vfs_op_thread_exit_crit(mp); + vfs_op_thread_exit_crit(mp, mpcpu); return (cache_fpl_partial(fpl)); } if (!cache_fplookup_mp_supported(mp)) { - vfs_op_thread_exit_crit(mp); + vfs_op_thread_exit_crit(mp, mpcpu); return (cache_fpl_partial(fpl)); } vp = atomic_load_ptr(&mp->mnt_rootvnode); if (vp == NULL || VN_IS_DOOMED(vp)) { - vfs_op_thread_exit_crit(mp); + vfs_op_thread_exit_crit(mp, mpcpu); return (cache_fpl_partial(fpl)); } vp_seqc = vn_seqc_read_any(vp); if (seqc_in_modify(vp_seqc)) { - vfs_op_thread_exit_crit(mp); + vfs_op_thread_exit_crit(mp, mpcpu); return (cache_fpl_partial(fpl)); } prev_mp = mp; + prev_mpcpu = mpcpu; mp = atomic_load_ptr(&vp->v_mountedhere); if (mp == NULL) break; } - vfs_op_thread_exit_crit(prev_mp); + vfs_op_thread_exit_crit(prev_mp, prev_mpcpu); fpl->tvp = vp; fpl->tvp_seqc = vp_seqc; return (0); Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Mon Nov 9 23:00:29 2020 (r367534) +++ head/sys/kern/vfs_default.c Mon Nov 9 23:02:13 2020 (r367535) @@ -663,6 +663,7 @@ vop_stdgetwritemount(ap) } */ *ap; { struct mount *mp; + struct mount_pcpu *mpcpu; struct vnode *vp; /* @@ -680,12 +681,12 @@ vop_stdgetwritemount(ap) *(ap->a_mpp) = NULL; return (0); } - if (vfs_op_thread_enter(mp)) { + if (vfs_op_thread_enter(mp, mpcpu)) { if (mp == vp->v_mount) { - vfs_mp_count_add_pcpu(mp, ref, 1); - vfs_op_thread_exit(mp); + vfs_mp_count_add_pcpu(mpcpu, ref, 1); + vfs_op_thread_exit(mp, mpcpu); } else { - vfs_op_thread_exit(mp); + vfs_op_thread_exit(mp, mpcpu); mp = NULL; } } else { Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Nov 9 23:00:29 2020 (r367534) +++ head/sys/kern/vfs_mount.c Mon Nov 9 23:02:13 2020 (r367535) @@ -127,14 +127,7 @@ mount_init(void *mem, int size, int flags) mtx_init(&mp->mnt_mtx, "struct mount mtx", NULL, MTX_DEF); mtx_init(&mp->mnt_listmtx, "struct mount vlist mtx", NULL, MTX_DEF); lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0); - mp->mnt_thread_in_ops_pcpu = uma_zalloc_pcpu(pcpu_zone_4, - M_WAITOK | M_ZERO); - mp->mnt_ref_pcpu = uma_zalloc_pcpu(pcpu_zone_4, - M_WAITOK | M_ZERO); - mp->mnt_lockref_pcpu = uma_zalloc_pcpu(pcpu_zone_4, - M_WAITOK | M_ZERO); - mp->mnt_writeopcount_pcpu = uma_zalloc_pcpu(pcpu_zone_4, - M_WAITOK | M_ZERO); + mp->mnt_pcpu = uma_zalloc_pcpu(pcpu_zone_16, M_WAITOK | M_ZERO); mp->mnt_ref = 0; mp->mnt_vfs_ops = 1; mp->mnt_rootvnode = NULL; @@ -147,10 +140,7 @@ mount_fini(void *mem, int size) struct mount *mp; mp = (struct mount *)mem; - uma_zfree_pcpu(pcpu_zone_4, mp->mnt_writeopcount_pcpu); - uma_zfree_pcpu(pcpu_zone_4, mp->mnt_lockref_pcpu); - uma_zfree_pcpu(pcpu_zone_4, mp->mnt_ref_pcpu); - uma_zfree_pcpu(pcpu_zone_4, mp->mnt_thread_in_ops_pcpu); + uma_zfree_pcpu(pcpu_zone_16, mp->mnt_pcpu); lockdestroy(&mp->mnt_explock); mtx_destroy(&mp->mnt_listmtx); mtx_destroy(&mp->mnt_mtx); @@ -462,11 +452,12 @@ sys_nmount(struct thread *td, struct nmount_args *uap) void vfs_ref(struct mount *mp) { + struct mount_pcpu *mpcpu; CTR2(KTR_VFS, "%s: mp %p", __func__, mp); - if (vfs_op_thread_enter(mp)) { - vfs_mp_count_add_pcpu(mp, ref, 1); - vfs_op_thread_exit(mp); + if (vfs_op_thread_enter(mp, mpcpu)) { + vfs_mp_count_add_pcpu(mpcpu, ref, 1); + vfs_op_thread_exit(mp, mpcpu); return; } @@ -478,11 +469,12 @@ vfs_ref(struct mount *mp) void vfs_rel(struct mount *mp) { + struct mount_pcpu *mpcpu; CTR2(KTR_VFS, "%s: mp %p", __func__, mp); - if (vfs_op_thread_enter(mp)) { - vfs_mp_count_sub_pcpu(mp, ref, 1); - vfs_op_thread_exit(mp); + if (vfs_op_thread_enter(mp, mpcpu)) { + vfs_mp_count_sub_pcpu(mpcpu, ref, 1); + vfs_op_thread_exit(mp, mpcpu); return; } @@ -503,6 +495,12 @@ vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp mp = uma_zalloc(mount_zone, M_WAITOK); bzero(&mp->mnt_startzero, __rangeof(struct mount, mnt_startzero, mnt_endzero)); + mp->mnt_kern_flag = 0; + mp->mnt_flag = 0; + mp->mnt_rootvnode = NULL; + mp->mnt_vnodecovered = NULL; + mp->mnt_op = NULL; + mp->mnt_vfc = NULL; TAILQ_INIT(&mp->mnt_nvnodelist); mp->mnt_nvnodelistsize = 0; TAILQ_INIT(&mp->mnt_lazyvnodelist); @@ -1513,6 +1511,7 @@ dounmount_cleanup(struct mount *mp, struct vnode *cove void vfs_op_enter(struct mount *mp) { + struct mount_pcpu *mpcpu; int cpu; MNT_ILOCK(mp); @@ -1523,12 +1522,16 @@ vfs_op_enter(struct mount *mp) } vfs_op_barrier_wait(mp); CPU_FOREACH(cpu) { - mp->mnt_ref += - zpcpu_replace_cpu(mp->mnt_ref_pcpu, 0, cpu); - mp->mnt_lockref += - zpcpu_replace_cpu(mp->mnt_lockref_pcpu, 0, cpu); - mp->mnt_writeopcount += - zpcpu_replace_cpu(mp->mnt_writeopcount_pcpu, 0, cpu); + mpcpu = vfs_mount_pcpu_remote(mp, cpu); + + mp->mnt_ref += mpcpu->mntp_ref; + mpcpu->mntp_ref = 0; + + mp->mnt_lockref += mpcpu->mntp_lockref; + mpcpu->mntp_lockref = 0; + + mp->mnt_writeopcount += mpcpu->mntp_writeopcount; + mpcpu->mntp_writeopcount = 0; } if (mp->mnt_ref <= 0 || mp->mnt_lockref < 0 || mp->mnt_writeopcount < 0) panic("%s: invalid count(s) on mp %p: ref %d lockref %d writeopcount %d\n", @@ -1581,13 +1584,13 @@ vfs_op_wait_func(void *arg, int cpu) { struct vfs_op_barrier_ipi *vfsopipi; struct mount *mp; - int *in_op; + struct mount_pcpu *mpcpu; vfsopipi = __containerof(arg, struct vfs_op_barrier_ipi, srcra); mp = vfsopipi->mp; - in_op = zpcpu_get_cpu(mp->mnt_thread_in_ops_pcpu, cpu); - while (atomic_load_int(in_op)) + mpcpu = vfs_mount_pcpu_remote(mp, cpu); + while (atomic_load_int(&mpcpu->mntp_thread_in_ops)) cpu_spinwait(); } @@ -1610,15 +1613,17 @@ vfs_op_barrier_wait(struct mount *mp) void vfs_assert_mount_counters(struct mount *mp) { + struct mount_pcpu *mpcpu; int cpu; if (mp->mnt_vfs_ops == 0) return; CPU_FOREACH(cpu) { - if (*zpcpu_get_cpu(mp->mnt_ref_pcpu, cpu) != 0 || - *zpcpu_get_cpu(mp->mnt_lockref_pcpu, cpu) != 0 || - *zpcpu_get_cpu(mp->mnt_writeopcount_pcpu, cpu) != 0) + mpcpu = vfs_mount_pcpu_remote(mp, cpu); + if (mpcpu->mntp_ref != 0 || + mpcpu->mntp_lockref != 0 || + mpcpu->mntp_writeopcount != 0) vfs_dump_mount_counters(mp); } } @@ -1626,33 +1631,34 @@ vfs_assert_mount_counters(struct mount *mp) void vfs_dump_mount_counters(struct mount *mp) { - int cpu, *count; + struct mount_pcpu *mpcpu; int ref, lockref, writeopcount; + int cpu; printf("%s: mp %p vfs_ops %d\n", __func__, mp, mp->mnt_vfs_ops); printf(" ref : "); ref = mp->mnt_ref; CPU_FOREACH(cpu) { - count = zpcpu_get_cpu(mp->mnt_ref_pcpu, cpu); - printf("%d ", *count); - ref += *count; + mpcpu = vfs_mount_pcpu_remote(mp, cpu); + printf("%d ", mpcpu->mntp_ref); + ref += mpcpu->mntp_ref; } printf("\n"); printf(" lockref : "); lockref = mp->mnt_lockref; CPU_FOREACH(cpu) { - count = zpcpu_get_cpu(mp->mnt_lockref_pcpu, cpu); - printf("%d ", *count); - lockref += *count; + mpcpu = vfs_mount_pcpu_remote(mp, cpu); + printf("%d ", mpcpu->mntp_lockref); + lockref += mpcpu->mntp_lockref; } printf("\n"); printf("writeopcount: "); writeopcount = mp->mnt_writeopcount; CPU_FOREACH(cpu) { - count = zpcpu_get_cpu(mp->mnt_writeopcount_pcpu, cpu); - printf("%d ", *count); - writeopcount += *count; + mpcpu = vfs_mount_pcpu_remote(mp, cpu); + printf("%d ", mpcpu->mntp_writeopcount); + writeopcount += mpcpu->mntp_writeopcount; } printf("\n"); @@ -1668,27 +1674,34 @@ vfs_dump_mount_counters(struct mount *mp) int vfs_mount_fetch_counter(struct mount *mp, enum mount_counter which) { - int *base, *pcpu; + struct mount_pcpu *mpcpu; int cpu, sum; switch (which) { case MNT_COUNT_REF: - base = &mp->mnt_ref; - pcpu = mp->mnt_ref_pcpu; + sum = mp->mnt_ref; break; case MNT_COUNT_LOCKREF: - base = &mp->mnt_lockref; - pcpu = mp->mnt_lockref_pcpu; + sum = mp->mnt_lockref; break; case MNT_COUNT_WRITEOPCOUNT: - base = &mp->mnt_writeopcount; - pcpu = mp->mnt_writeopcount_pcpu; + sum = mp->mnt_writeopcount; break; } - sum = *base; CPU_FOREACH(cpu) { - sum += *zpcpu_get_cpu(pcpu, cpu); + mpcpu = vfs_mount_pcpu_remote(mp, cpu); + switch (which) { + case MNT_COUNT_REF: + sum += mpcpu->mntp_ref; + break; + case MNT_COUNT_LOCKREF: + sum += mpcpu->mntp_lockref; + break; + case MNT_COUNT_WRITEOPCOUNT: + sum += mpcpu->mntp_writeopcount; + break; + } } return (sum); } Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Nov 9 23:00:29 2020 (r367534) +++ head/sys/kern/vfs_subr.c Mon Nov 9 23:02:13 2020 (r367535) @@ -734,17 +734,18 @@ SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_FIRST, vntblinit, NU int vfs_busy(struct mount *mp, int flags) { + struct mount_pcpu *mpcpu; MPASS((flags & ~MBF_MASK) == 0); CTR3(KTR_VFS, "%s: mp %p with flags %d", __func__, mp, flags); - if (vfs_op_thread_enter(mp)) { + if (vfs_op_thread_enter(mp, mpcpu)) { MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0); MPASS((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0); MPASS((mp->mnt_kern_flag & MNTK_REFEXPIRE) == 0); - vfs_mp_count_add_pcpu(mp, ref, 1); - vfs_mp_count_add_pcpu(mp, lockref, 1); - vfs_op_thread_exit(mp); + vfs_mp_count_add_pcpu(mpcpu, ref, 1); + vfs_mp_count_add_pcpu(mpcpu, lockref, 1); + vfs_op_thread_exit(mp, mpcpu); if (flags & MBF_MNTLSTLOCK) mtx_unlock(&mountlist_mtx); return (0); @@ -794,15 +795,16 @@ vfs_busy(struct mount *mp, int flags) void vfs_unbusy(struct mount *mp) { + struct mount_pcpu *mpcpu; int c; CTR2(KTR_VFS, "%s: mp %p", __func__, mp); - if (vfs_op_thread_enter(mp)) { + if (vfs_op_thread_enter(mp, mpcpu)) { MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0); - vfs_mp_count_sub_pcpu(mp, lockref, 1); - vfs_mp_count_sub_pcpu(mp, ref, 1); - vfs_op_thread_exit(mp); + vfs_mp_count_sub_pcpu(mpcpu, lockref, 1); + vfs_mp_count_sub_pcpu(mpcpu, ref, 1); + vfs_op_thread_exit(mp, mpcpu); return; } @@ -6399,18 +6401,19 @@ restart: int vfs_cache_root(struct mount *mp, int flags, struct vnode **vpp) { + struct mount_pcpu *mpcpu; struct vnode *vp; int error; - if (!vfs_op_thread_enter(mp)) + if (!vfs_op_thread_enter(mp, mpcpu)) return (vfs_cache_root_fallback(mp, flags, vpp)); vp = atomic_load_ptr(&mp->mnt_rootvnode); if (vp == NULL || VN_IS_DOOMED(vp)) { - vfs_op_thread_exit(mp); + vfs_op_thread_exit(mp, mpcpu); return (vfs_cache_root_fallback(mp, flags, vpp)); } vrefact(vp); - vfs_op_thread_exit(mp); + vfs_op_thread_exit(mp, mpcpu); error = vn_lock(vp, flags); if (error != 0) { vrele(vp); Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Mon Nov 9 23:00:29 2020 (r367534) +++ head/sys/kern/vfs_vnops.c Mon Nov 9 23:02:13 2020 (r367535) @@ -1761,13 +1761,14 @@ vn_closefile(struct file *fp, struct thread *td) static int vn_start_write_refed(struct mount *mp, int flags, bool mplocked) { + struct mount_pcpu *mpcpu; int error, mflags; if (__predict_true(!mplocked) && (flags & V_XSLEEP) == 0 && - vfs_op_thread_enter(mp)) { + vfs_op_thread_enter(mp, mpcpu)) { MPASS((mp->mnt_kern_flag & MNTK_SUSPEND) == 0); - vfs_mp_count_add_pcpu(mp, writeopcount, 1); - vfs_op_thread_exit(mp); + vfs_mp_count_add_pcpu(mpcpu, writeopcount, 1); + vfs_op_thread_exit(mp, mpcpu); return (0); } @@ -1917,15 +1918,16 @@ vn_start_secondary_write(struct vnode *vp, struct moun void vn_finished_write(struct mount *mp) { + struct mount_pcpu *mpcpu; int c; if (mp == NULL) return; - if (vfs_op_thread_enter(mp)) { - vfs_mp_count_sub_pcpu(mp, writeopcount, 1); - vfs_mp_count_sub_pcpu(mp, ref, 1); - vfs_op_thread_exit(mp); + if (vfs_op_thread_enter(mp, mpcpu)) { + vfs_mp_count_sub_pcpu(mpcpu, writeopcount, 1); + vfs_mp_count_sub_pcpu(mpcpu, ref, 1); + vfs_op_thread_exit(mp, mpcpu); return; } Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Nov 9 23:00:29 2020 (r367534) +++ head/sys/sys/mount.h Mon Nov 9 23:02:13 2020 (r367535) @@ -177,6 +177,16 @@ struct vfsopt { int seen; }; +struct mount_pcpu { + int mntp_thread_in_ops; + int mntp_ref; + int mntp_lockref; + int mntp_writeopcount; +}; + +_Static_assert(sizeof(struct mount_pcpu) == 16, + "the struct is allocated from pcpu 16 zone"); + /* * Structure per mounted filesystem. Each mounted filesystem has an * array of operations and an instance record. The filesystems are @@ -192,20 +202,23 @@ struct vfsopt { * */ struct mount { - struct mtx mnt_mtx; /* mount structure interlock */ + int mnt_vfs_ops; /* (i) pending vfs ops */ + int mnt_kern_flag; /* (i) kernel only flags */ + uint64_t mnt_flag; /* (i) flags shared with user */ + struct mount_pcpu *mnt_pcpu; /* per-CPU data */ + struct vnode *mnt_rootvnode; + struct vnode *mnt_vnodecovered; /* vnode we mounted on */ + struct vfsops *mnt_op; /* operations on fs */ + struct vfsconf *mnt_vfc; /* configuration info */ + struct mtx __aligned(CACHE_LINE_SIZE) mnt_mtx; /* mount structure interlock */ int mnt_gen; /* struct mount generation */ #define mnt_startzero mnt_list TAILQ_ENTRY(mount) mnt_list; /* (m) mount list */ - struct vfsops *mnt_op; /* operations on fs */ - struct vfsconf *mnt_vfc; /* configuration info */ - struct vnode *mnt_vnodecovered; /* vnode we mounted on */ struct vnode *mnt_syncer; /* syncer vnode */ int mnt_ref; /* (i) Reference count */ struct vnodelst mnt_nvnodelist; /* (i) list of vnodes */ int mnt_nvnodelistsize; /* (i) # of vnodes */ int mnt_writeopcount; /* (i) write syscalls pending */ - int mnt_kern_flag; /* (i) kernel only flags */ - uint64_t mnt_flag; /* (i) flags shared with user */ struct vfsoptlist *mnt_opt; /* current mount options */ struct vfsoptlist *mnt_optnew; /* new options passed to fs */ int mnt_maxsymlinklen; /* max size of short symlink */ @@ -229,12 +242,6 @@ struct mount { struct lock mnt_explock; /* vfs_export walkers lock */ TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */ TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ - int __aligned(CACHE_LINE_SIZE) mnt_vfs_ops;/* (i) pending vfs ops */ - int *mnt_thread_in_ops_pcpu; - int *mnt_ref_pcpu; - int *mnt_lockref_pcpu; - int *mnt_writeopcount_pcpu; - struct vnode *mnt_rootvnode; }; /* @@ -1054,7 +1061,7 @@ void resume_all_fs(void); /* * Code transitioning mnt_vfs_ops to > 0 issues IPIs until it observes - * all CPUs not executing code enclosed by mnt_thread_in_ops_pcpu. + * all CPUs not executing code enclosed by thread_in_ops_pcpu variable. * * This provides an invariant that by the time the last CPU is observed not * executing, everyone else entering will see the counter > 0 and exit. @@ -1064,52 +1071,58 @@ void resume_all_fs(void); * before making any changes or only make changes safe while the section is * executed. */ +#define vfs_mount_pcpu(mp) zpcpu_get(mp->mnt_pcpu) +#define vfs_mount_pcpu_remote(mp, cpu) zpcpu_get_cpu(mp->mnt_pcpu, cpu) + #define vfs_op_thread_entered(mp) ({ \ MPASS(curthread->td_critnest > 0); \ - *zpcpu_get(mp->mnt_thread_in_ops_pcpu) == 1; \ + struct mount_pcpu *_mpcpu = vfs_mount_pcpu(mp); \ + _mpcpu->mntp_thread_in_ops == 1; \ }) -#define vfs_op_thread_enter_crit(mp) ({ \ +#define vfs_op_thread_enter_crit(mp, _mpcpu) ({ \ bool _retval_crit = true; \ MPASS(curthread->td_critnest > 0); \ - MPASS(!vfs_op_thread_entered(mp)); \ - zpcpu_set_protected(mp->mnt_thread_in_ops_pcpu, 1); \ + _mpcpu = vfs_mount_pcpu(mp); \ + MPASS(mpcpu->mntp_thread_in_ops == 0); \ + _mpcpu->mntp_thread_in_ops = 1; \ __compiler_membar(); \ if (__predict_false(mp->mnt_vfs_ops > 0)) { \ - vfs_op_thread_exit_crit(mp); \ + vfs_op_thread_exit_crit(mp, _mpcpu); \ _retval_crit = false; \ } \ _retval_crit; \ }) -#define vfs_op_thread_enter(mp) ({ \ +#define vfs_op_thread_enter(mp, _mpcpu) ({ \ bool _retval; \ critical_enter(); \ - _retval = vfs_op_thread_enter_crit(mp); \ + _retval = vfs_op_thread_enter_crit(mp, _mpcpu); \ if (__predict_false(!_retval)) \ critical_exit(); \ _retval; \ }) -#define vfs_op_thread_exit_crit(mp) do { \ - MPASS(vfs_op_thread_entered(mp)); \ +#define vfs_op_thread_exit_crit(mp, _mpcpu) do { \ + MPASS(_mpcpu == vfs_mount_pcpu(mp)); \ + MPASS(_mpcpu->mntp_thread_in_ops == 1); \ __compiler_membar(); \ - zpcpu_set_protected(mp->mnt_thread_in_ops_pcpu, 0); \ + _mpcpu->mntp_thread_in_ops = 0; \ } while (0) -#define vfs_op_thread_exit(mp) do { \ - vfs_op_thread_exit_crit(mp); \ +#define vfs_op_thread_exit(mp, _mpcpu) do { \ + vfs_op_thread_exit_crit(mp, _mpcpu); \ critical_exit(); \ } while (0) -#define vfs_mp_count_add_pcpu(mp, count, val) do { \ - MPASS(vfs_op_thread_entered(mp)); \ - zpcpu_add_protected(mp->mnt_##count##_pcpu, val); \ +#define vfs_mp_count_add_pcpu(_mpcpu, count, val) do { \ + MPASS(_mpcpu->mntp_thread_in_ops == 1); \ + _mpcpu->mntp_##count += val; \ } while (0) -#define vfs_mp_count_sub_pcpu(mp, count, val) do { \ - MPASS(vfs_op_thread_entered(mp)); \ - zpcpu_sub_protected(mp->mnt_##count##_pcpu, val); \ +#define vfs_mp_count_sub_pcpu(_mpcpu, count, val) do { \ + MPASS(_mpcpu->mntp_thread_in_ops == 1); \ + _mpcpu->mntp_##count -= val; \ } while (0) #else /* !_KERNEL */ From owner-svn-src-all@freebsd.org Mon Nov 9 23:04:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4549746FEB1; Mon, 9 Nov 2020 23:04:31 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVRQR1VNzz4Twp; Mon, 9 Nov 2020 23:04:31 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2608119128; Mon, 9 Nov 2020 23:04:31 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9N4V6g015867; Mon, 9 Nov 2020 23:04:31 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9N4UVO015865; Mon, 9 Nov 2020 23:04:30 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011092304.0A9N4UVO015865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 23:04:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367536 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 23:04:31 -0000 Author: mjg Date: Mon Nov 9 23:04:30 2020 New Revision: 367536 URL: https://svnweb.freebsd.org/changeset/base/367536 Log: threads: introduce a limit for total number The intent is to replace the current id allocation method and a known upper bound will be useful. Reviewed by: kib (previous version), markj (previous version) Tested by: pho Differential Revision: https://reviews.freebsd.org/D27100 Modified: head/sys/kern/kern_thr.c head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Mon Nov 9 23:02:13 2020 (r367535) +++ head/sys/kern/kern_thr.c Mon Nov 9 23:04:30 2020 (r367536) @@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$"); static SYSCTL_NODE(_kern, OID_AUTO, threads, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "thread allocation"); -static int max_threads_per_proc = 1500; +int max_threads_per_proc = 1500; SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_per_proc, CTLFLAG_RW, &max_threads_per_proc, 0, "Limit on threads per proc"); Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Mon Nov 9 23:02:13 2020 (r367535) +++ head/sys/kern/kern_thread.c Mon Nov 9 23:04:30 2020 (r367536) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #ifdef HWPMC_HOOKS #include #endif +#include #include @@ -142,6 +143,12 @@ static lwpid_t tid_buffer[TID_BUFFER_SIZE]; static int tid_head, tid_tail; static MALLOC_DEFINE(M_TIDHASH, "tidhash", "thread hash"); +static int maxthread; +SYSCTL_INT(_kern, OID_AUTO, maxthread, CTLFLAG_RDTUN, + &maxthread, 0, "Maximum number of threads"); + +static int nthreads; + struct tidhashhead *tidhashtbl; u_long tidhash; struct rwlock tidhash_lock; @@ -154,8 +161,25 @@ EVENTHANDLER_LIST_DEFINE(thread_fini); static lwpid_t tid_alloc(void) { - lwpid_t tid; + static struct timeval lastfail; + static int curfail; + int nthreads_new; + lwpid_t tid; + nthreads_new = atomic_fetchadd_int(&nthreads, 1) + 1; + if (nthreads_new >= maxthread - 100) { + if (priv_check_cred(curthread->td_ucred, PRIV_MAXPROC) != 0 || + nthreads_new >= maxthread) { + atomic_subtract_int(&nthreads, 1); + if (ppsratecheck(&lastfail, &curfail, 1)) { + printf("maxthread limit exceeded by uid %u " + "(pid %d); consider increasing kern.maxthread\n", + curthread->td_ucred->cr_ruid, curproc->p_pid); + } + return (-1); + } + } + tid = alloc_unr(tid_unrhdr); if (tid != -1) return (tid); @@ -185,6 +209,7 @@ tid_free(lwpid_t tid) mtx_unlock(&tid_lock); if (tmp_tid != -1) free_unr(tid_unrhdr, tmp_tid); + atomic_subtract_int(&nthreads, 1); } /* @@ -199,8 +224,6 @@ thread_ctor(void *mem, int size, void *arg, int flags) td->td_state = TDS_INACTIVE; td->td_lastcpu = td->td_oncpu = NOCPU; - td->td_tid = tid_alloc(); - /* * Note that td_critnest begins life as 1 because the thread is not * running and is thereby implicitly waiting to be on the receiving @@ -208,7 +231,6 @@ thread_ctor(void *mem, int size, void *arg, int flags) */ td->td_critnest = 1; td->td_lend_user_pri = PRI_MAX; - EVENTHANDLER_DIRECT_INVOKE(thread_ctor, td); #ifdef AUDIT audit_thread_alloc(td); #endif @@ -253,9 +275,6 @@ thread_dtor(void *mem, int size, void *arg) osd_thread_exit(td); td_softdep_cleanup(td); MPASS(td->td_su == NULL); - - EVENTHANDLER_DIRECT_INVOKE(thread_dtor, td); - tid_free(td->td_tid); } /* @@ -325,6 +344,8 @@ proc_linkup(struct proc *p, struct thread *td) thread_link(td, p); } +extern int max_threads_per_proc; + /* * Initialize global thread allocation resources. */ @@ -333,6 +354,22 @@ threadinit(void) { uint32_t flags; + /* + * Place an upper limit on threads which can be allocated. + * + * Note that other factors may make the de facto limit much lower. + * + * Platform limits are somewhat arbitrary but deemed "more than good + * enough" for the foreseable future. + */ + if (maxthread == 0) { +#ifdef _LP64 + maxthread = MIN(maxproc * max_threads_per_proc, 1000000); +#else + maxthread = MIN(maxproc * max_threads_per_proc, 100000); +#endif + } + mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF); /* @@ -415,16 +452,25 @@ struct thread * thread_alloc(int pages) { struct thread *td; + lwpid_t tid; thread_reap(); /* check if any zombies to get */ - td = (struct thread *)uma_zalloc(thread_zone, M_WAITOK); + tid = tid_alloc(); + if (tid == -1) { + return (NULL); + } + + td = uma_zalloc(thread_zone, M_WAITOK); KASSERT(td->td_kstack == 0, ("thread_alloc got thread with kstack")); if (!vm_thread_new(td, pages)) { uma_zfree(thread_zone, td); + tid_free(tid); return (NULL); } + td->td_tid = tid; cpu_thread_alloc(td); + EVENTHANDLER_DIRECT_INVOKE(thread_ctor, td); return (td); } @@ -447,6 +493,7 @@ void thread_free(struct thread *td) { + EVENTHANDLER_DIRECT_INVOKE(thread_dtor, td); lock_profile_thread_exit(td); if (td->td_cpuset) cpuset_rel(td->td_cpuset); @@ -455,6 +502,8 @@ thread_free(struct thread *td) if (td->td_kstack != 0) vm_thread_dispose(td); callout_drain(&td->td_slpcallout); + tid_free(td->td_tid); + td->td_tid = -1; uma_zfree(thread_zone, td); } From owner-svn-src-all@freebsd.org Mon Nov 9 23:05:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 968C82D0010; Mon, 9 Nov 2020 23:05:28 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVRRX3skRz4VMG; Mon, 9 Nov 2020 23:05:28 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7783619197; Mon, 9 Nov 2020 23:05:28 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9N5Sit015930; Mon, 9 Nov 2020 23:05:28 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9N5SYe015929; Mon, 9 Nov 2020 23:05:28 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011092305.0A9N5SYe015929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 9 Nov 2020 23:05:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367537 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 23:05:28 -0000 Author: mjg Date: Mon Nov 9 23:05:28 2020 New Revision: 367537 URL: https://svnweb.freebsd.org/changeset/base/367537 Log: threads: reimplement tid allocation on top of a bitmap There are workloads with very bursty tid allocation and since unr tries very hard to have small-sized bitmaps it keeps reallocating memory. Just doing buildkernel gives almost 150k calls to free coming from unr. This also gets rid of the hack which tried to postpone TID reuse. Reviewed by: kib, markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D27101 Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Mon Nov 9 23:04:30 2020 (r367536) +++ head/sys/kern/kern_thread.c Mon Nov 9 23:05:28 2020 (r367537) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -138,9 +139,8 @@ static int thread_unsuspend_one(struct thread *td, str #define TID_BUFFER_SIZE 1024 struct mtx tid_lock; -static struct unrhdr *tid_unrhdr; -static lwpid_t tid_buffer[TID_BUFFER_SIZE]; -static int tid_head, tid_tail; +bitstr_t *tid_bitmap; + static MALLOC_DEFINE(M_TIDHASH, "tidhash", "thread hash"); static int maxthread; @@ -163,14 +163,14 @@ tid_alloc(void) { static struct timeval lastfail; static int curfail; - int nthreads_new; + static lwpid_t trytid; lwpid_t tid; - nthreads_new = atomic_fetchadd_int(&nthreads, 1) + 1; - if (nthreads_new >= maxthread - 100) { + mtx_lock(&tid_lock); + if (nthreads + 1 >= maxthread - 100) { if (priv_check_cred(curthread->td_ucred, PRIV_MAXPROC) != 0 || - nthreads_new >= maxthread) { - atomic_subtract_int(&nthreads, 1); + nthreads + 1 >= maxthread) { + mtx_unlock(&tid_lock); if (ppsratecheck(&lastfail, &curfail, 1)) { printf("maxthread limit exceeded by uid %u " "(pid %d); consider increasing kern.maxthread\n", @@ -180,36 +180,40 @@ tid_alloc(void) } } - tid = alloc_unr(tid_unrhdr); - if (tid != -1) - return (tid); - mtx_lock(&tid_lock); - if (tid_head == tid_tail) { - mtx_unlock(&tid_lock); - return (-1); + nthreads++; + /* + * It is an invariant that the bitmap is big enough to hold maxthread + * IDs. If we got to this point there has to be at least one free. + */ + if (trytid >= maxthread) + trytid = 0; + bit_ffc_at(tid_bitmap, trytid, maxthread, &tid); + if (tid == -1) { + KASSERT(trytid != 0, ("unexpectedly ran out of IDs")); + trytid = 0; + bit_ffc_at(tid_bitmap, trytid, maxthread, &tid); + KASSERT(tid != -1, ("unexpectedly ran out of IDs")); } - tid = tid_buffer[tid_head]; - tid_head = (tid_head + 1) % TID_BUFFER_SIZE; + bit_set(tid_bitmap, tid); + trytid++; mtx_unlock(&tid_lock); - return (tid); + return (tid + NO_PID); } static void -tid_free(lwpid_t tid) +tid_free(lwpid_t rtid) { - lwpid_t tmp_tid = -1; + lwpid_t tid; + KASSERT(rtid >= NO_PID, + ("%s: invalid tid %d\n", __func__, rtid)); + tid = rtid - NO_PID; mtx_lock(&tid_lock); - if ((tid_tail + 1) % TID_BUFFER_SIZE == tid_head) { - tmp_tid = tid_buffer[tid_head]; - tid_head = (tid_head + 1) % TID_BUFFER_SIZE; - } - tid_buffer[tid_tail] = tid; - tid_tail = (tid_tail + 1) % TID_BUFFER_SIZE; + KASSERT(bit_test(tid_bitmap, tid) != 0, + ("thread ID %d not allocated\n", rtid)); + bit_clear(tid_bitmap, tid); + nthreads--; mtx_unlock(&tid_lock); - if (tmp_tid != -1) - free_unr(tid_unrhdr, tmp_tid); - atomic_subtract_int(&nthreads, 1); } /* @@ -371,12 +375,7 @@ threadinit(void) } mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF); - - /* - * pid_max cannot be greater than PID_MAX. - * leave one number for thread0. - */ - tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock); + tid_bitmap = bit_alloc(maxthread, M_TIDHASH, M_WAITOK); flags = UMA_ZONE_NOFREE; #ifdef __aarch64__ From owner-svn-src-all@freebsd.org Mon Nov 9 23:34:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D57522D02A4; Mon, 9 Nov 2020 23:34:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVS545XGbz4WTW; Mon, 9 Nov 2020 23:34:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACC9719462; Mon, 9 Nov 2020 23:34:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9NYWNC033478; Mon, 9 Nov 2020 23:34:32 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9NYWsw033477; Mon, 9 Nov 2020 23:34:32 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202011092334.0A9NYWsw033477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 9 Nov 2020 23:34:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367538 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 367538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 23:34:32 -0000 Author: bz Date: Mon Nov 9 23:34:32 2020 New Revision: 367538 URL: https://svnweb.freebsd.org/changeset/base/367538 Log: arm64: bs_sr_ take II In r367327 generic_bs_sr_ were derived from mips. Given we are calling generic_bs_w_ and no write directly, we do not have to do the address calculations ourselves as eneric_bs_w_ will do a str val [bsh, offset]. All we actually have to do is increment offset. MFC after: 3 days Modified: head/sys/arm64/arm64/bus_machdep.c Modified: head/sys/arm64/arm64/bus_machdep.c ============================================================================== --- head/sys/arm64/arm64/bus_machdep.c Mon Nov 9 23:05:28 2020 (r367537) +++ head/sys/arm64/arm64/bus_machdep.c Mon Nov 9 23:34:32 2020 (r367538) @@ -136,40 +136,36 @@ static void generic_bs_sr_1(void *t, bus_space_handle_t bsh, bus_size_t offset, uint8_t value, size_t count) { - bus_addr_t addr = bsh + offset; - for (; count != 0; count--, addr++) - generic_bs_w_1(t, bsh, addr, value); + for (; count != 0; count--, offset++) + generic_bs_w_1(t, bsh, offset, value); } static void generic_bs_sr_2(void *t, bus_space_handle_t bsh, bus_size_t offset, uint16_t value, size_t count) { - bus_addr_t addr = bsh + offset; - for (; count != 0; count--, addr += 2) - generic_bs_w_2(t, bsh, addr, value); + for (; count != 0; count--, offset += 2) + generic_bs_w_2(t, bsh, offset, value); } static void generic_bs_sr_4(void *t, bus_space_handle_t bsh, bus_size_t offset, uint32_t value, size_t count) { - bus_addr_t addr = bsh + offset; - for (; count != 0; count--, addr += 4) - generic_bs_w_4(t, bsh, addr, value); + for (; count != 0; count--, offset += 4) + generic_bs_w_4(t, bsh, offset, value); } static void generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset, uint64_t value, size_t count) { - bus_addr_t addr = bsh + offset; - for (; count != 0; count--, addr += 8) - generic_bs_w_8(t, bsh, addr, value); + for (; count != 0; count--, offset += 8) + generic_bs_w_8(t, bsh, offset, value); } struct bus_space memmap_bus = { From owner-svn-src-all@freebsd.org Mon Nov 9 23:36:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 421492D03AE; Mon, 9 Nov 2020 23:36:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVS7m1L99z4WV8; Mon, 9 Nov 2020 23:36:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20BC6195A1; Mon, 9 Nov 2020 23:36:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9NaqZI033596; Mon, 9 Nov 2020 23:36:52 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9NaqlS033595; Mon, 9 Nov 2020 23:36:52 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202011092336.0A9NaqlS033595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 9 Nov 2020 23:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367539 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 367539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 23:36:52 -0000 Author: bz Date: Mon Nov 9 23:36:51 2020 New Revision: 367539 URL: https://svnweb.freebsd.org/changeset/base/367539 Log: usb_hub: fix whitespace Fix a whitespace "error" introduced in r367435 noticed when preparing the MFC. No functional changes. Modified: head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Nov 9 23:34:32 2020 (r367538) +++ head/sys/dev/usb/usb_hub.c Mon Nov 9 23:36:51 2020 (r367539) @@ -720,7 +720,7 @@ repeat: if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) || (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) { if (timeout) { - DPRINTFN(0, "giving up port %d reset - " + DPRINTFN(0, "giving up port %d reset - " "device vanished: change %#x status %#x\n", portno, sc->sc_st.port_change, sc->sc_st.port_status); From owner-svn-src-all@freebsd.org Mon Nov 9 23:38:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1E262D05BA; Mon, 9 Nov 2020 23:38:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVS9q4dQQz4Wt6; Mon, 9 Nov 2020 23:38:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D5C5195A2; Mon, 9 Nov 2020 23:38:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A9Ncdsm033671; Mon, 9 Nov 2020 23:38:39 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A9NcdZj033670; Mon, 9 Nov 2020 23:38:39 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202011092338.0A9NcdZj033670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 9 Nov 2020 23:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367540 - stable/12/sys/dev/usb X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/dev/usb X-SVN-Commit-Revision: 367540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 23:38:39 -0000 Author: bz Date: Mon Nov 9 23:38:39 2020 New Revision: 367540 URL: https://svnweb.freebsd.org/changeset/base/367540 Log: MFC r367435,367539: usb_hub: giving up port reset - device vanished Improve the output of the recently often experienced debug message in order to gather further data. PR: 237666 Modified: stable/12/sys/dev/usb/usb_hub.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/usb_hub.c ============================================================================== --- stable/12/sys/dev/usb/usb_hub.c Mon Nov 9 23:36:51 2020 (r367539) +++ stable/12/sys/dev/usb/usb_hub.c Mon Nov 9 23:38:39 2020 (r367540) @@ -756,8 +756,10 @@ repeat: if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) || (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) { if (timeout) { - DPRINTFN(0, "giving up port reset " - "- device vanished\n"); + DPRINTFN(0, "giving up port %d reset - " + "device vanished: change %#x status %#x\n", + portno, sc->sc_st.port_change, + sc->sc_st.port_status); goto error; } timeout = 1; From owner-svn-src-all@freebsd.org Tue Nov 10 01:13:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99FA52D28D6; Tue, 10 Nov 2020 01:13:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVVHp3zZkz4cW8; Tue, 10 Nov 2020 01:13:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7935A1A759; Tue, 10 Nov 2020 01:13:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AA1Dwtu092907; Tue, 10 Nov 2020 01:13:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AA1Dw93092906; Tue, 10 Nov 2020 01:13:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011100113.0AA1Dw93092906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Nov 2020 01:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367541 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 01:13:58 -0000 Author: mjg Date: Tue Nov 10 01:13:58 2020 New Revision: 367541 URL: https://svnweb.freebsd.org/changeset/base/367541 Log: thread: adds newer bits for r367537 The committed patch was an older version. Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Mon Nov 9 23:38:39 2020 (r367540) +++ head/sys/kern/kern_thread.c Tue Nov 10 01:13:58 2020 (r367541) @@ -138,8 +138,8 @@ static int thread_unsuspend_one(struct thread *td, str #define TID_BUFFER_SIZE 1024 -struct mtx tid_lock; -bitstr_t *tid_bitmap; +static struct mtx tid_lock; +static bitstr_t *tid_bitmap; static MALLOC_DEFINE(M_TIDHASH, "tidhash", "thread hash"); @@ -195,7 +195,7 @@ tid_alloc(void) KASSERT(tid != -1, ("unexpectedly ran out of IDs")); } bit_set(tid_bitmap, tid); - trytid++; + trytid = tid + 1; mtx_unlock(&tid_lock); return (tid + NO_PID); } From owner-svn-src-all@freebsd.org Tue Nov 10 01:31:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A2BB2D405B; Tue, 10 Nov 2020 01:31:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVVgb1GG6z4fDX; Tue, 10 Nov 2020 01:31:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E1DF1AB1D; Tue, 10 Nov 2020 01:31:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AA1V6io003560; Tue, 10 Nov 2020 01:31:06 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AA1V6UL003559; Tue, 10 Nov 2020 01:31:06 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011100131.0AA1V6UL003559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Nov 2020 01:31:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367542 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 01:31:07 -0000 Author: mjg Date: Tue Nov 10 01:31:06 2020 New Revision: 367542 URL: https://svnweb.freebsd.org/changeset/base/367542 Log: threads: remove the unused TID_BUFFER_SIZE macro Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue Nov 10 01:13:58 2020 (r367541) +++ head/sys/kern/kern_thread.c Tue Nov 10 01:31:06 2020 (r367542) @@ -136,8 +136,6 @@ static void thread_zombie(struct thread *); static int thread_unsuspend_one(struct thread *td, struct proc *p, bool boundary); -#define TID_BUFFER_SIZE 1024 - static struct mtx tid_lock; static bitstr_t *tid_bitmap; From owner-svn-src-all@freebsd.org Tue Nov 10 01:57:20 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E6882D5AD2; Tue, 10 Nov 2020 01:57:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVWFr1MR5z4h1d; Tue, 10 Nov 2020 01:57:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21C731B38A; Tue, 10 Nov 2020 01:57:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AA1vKPV016250; Tue, 10 Nov 2020 01:57:20 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AA1vKXA016249; Tue, 10 Nov 2020 01:57:20 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011100157.0AA1vKXA016249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Nov 2020 01:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367543 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 01:57:20 -0000 Author: mjg Date: Tue Nov 10 01:57:19 2020 New Revision: 367543 URL: https://svnweb.freebsd.org/changeset/base/367543 Log: thread: use tdfind in sysctl_kern_proc_kstack This treads linear scans for locked lookup, but more importantly removes the only consumer of thread_find. Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Nov 10 01:31:06 2020 (r367542) +++ head/sys/kern/kern_proc.c Tue Nov 10 01:57:19 2020 (r367543) @@ -2748,6 +2748,7 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) struct stack *st; struct sbuf sb; struct proc *p; + bool locked; name = (int *)arg1; error = pget((pid_t)name[0], PGET_NOTINEXEC | PGET_WANTREAD, &p); @@ -2787,12 +2788,15 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) lwpidarray[i] = td->td_tid; i++; } + PROC_UNLOCK(p); + locked = false; numthreads = i; for (i = 0; i < numthreads; i++) { - td = thread_find(p, lwpidarray[i]); + td = tdfind(lwpidarray[i], p->p_pid); if (td == NULL) { continue; } + locked = true; bzero(kkstp, sizeof(*kkstp)); (void)sbuf_new(&sb, kkstp->kkst_trace, sizeof(kkstp->kkst_trace), SBUF_FIXEDLEN); @@ -2806,14 +2810,16 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) kkstp->kkst_state = KKST_STATE_RUNNING; thread_unlock(td); PROC_UNLOCK(p); + locked = false; stack_sbuf_print(&sb, st); sbuf_finish(&sb); sbuf_delete(&sb); error = SYSCTL_OUT(req, kkstp, sizeof(*kkstp)); - PROC_LOCK(p); if (error) break; } + if (!locked) + PROC_LOCK(p); _PRELE(p); PROC_UNLOCK(p); if (lwpidarray != NULL) From owner-svn-src-all@freebsd.org Tue Nov 10 01:57:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76B8A2D5BC0; Tue, 10 Nov 2020 01:57:49 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVWGP2xkBz4hB9; Tue, 10 Nov 2020 01:57:49 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57E841B13B; Tue, 10 Nov 2020 01:57:49 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AA1vn71016304; Tue, 10 Nov 2020 01:57:49 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AA1vmtM016302; Tue, 10 Nov 2020 01:57:48 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011100157.0AA1vmtM016302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Nov 2020 01:57:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367544 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 01:57:49 -0000 Author: mjg Date: Tue Nov 10 01:57:48 2020 New Revision: 367544 URL: https://svnweb.freebsd.org/changeset/base/367544 Log: thread: retire thread_find tdfind should be used instead. Modified: head/sys/kern/kern_thread.c head/sys/sys/proc.h Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue Nov 10 01:57:19 2020 (r367543) +++ head/sys/kern/kern_thread.c Tue Nov 10 01:57:48 2020 (r367544) @@ -1325,19 +1325,6 @@ thread_single_end(struct proc *p, int mode) kick_proc0(); } -struct thread * -thread_find(struct proc *p, lwpid_t tid) -{ - struct thread *td; - - PROC_LOCK_ASSERT(p, MA_OWNED); - FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_tid == tid) - break; - } - return (td); -} - /* Locate a thread by number; return with proc lock held. */ struct thread * tdfind(lwpid_t tid, pid_t pid) Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Nov 10 01:57:19 2020 (r367543) +++ head/sys/sys/proc.h Tue Nov 10 01:57:48 2020 (r367544) @@ -1153,7 +1153,6 @@ void thread_suspend_one(struct thread *td); void thread_unlink(struct thread *td); void thread_unsuspend(struct proc *p); void thread_wait(struct proc *p); -struct thread *thread_find(struct proc *p, lwpid_t tid); void stop_all_proc(void); void resume_all_proc(void); From owner-svn-src-all@freebsd.org Tue Nov 10 02:26:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8453F2D6D4E; Tue, 10 Nov 2020 02:26:45 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVWvn3PRvz4jsR; Tue, 10 Nov 2020 02:26:45 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65DA61B7AF; Tue, 10 Nov 2020 02:26:45 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AA2Qjvc034109; Tue, 10 Nov 2020 02:26:45 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AA2Qjle034108; Tue, 10 Nov 2020 02:26:45 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202011100226.0AA2Qjle034108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 10 Nov 2020 02:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367545 - head/sys/netgraph X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/sys/netgraph X-SVN-Commit-Revision: 367545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 02:26:45 -0000 Author: eugen Date: Tue Nov 10 02:26:44 2020 New Revision: 367545 URL: https://svnweb.freebsd.org/changeset/base/367545 Log: ng_nat: unbreak ABI The revision r342168 broke ABI of ng_nat needlessly and the change was merged to stable branches breaking ABI there, too. Unbreak it. PR: 250722 MFC after: 1 week Modified: head/sys/netgraph/ng_nat.h Modified: head/sys/netgraph/ng_nat.h ============================================================================== --- head/sys/netgraph/ng_nat.h Tue Nov 10 01:57:48 2020 (r367544) +++ head/sys/netgraph/ng_nat.h Tue Nov 10 02:26:44 2020 (r367545) @@ -205,8 +205,6 @@ enum { NGM_NAT_SET_IPADDR = 1, NGM_NAT_SET_MODE, NGM_NAT_SET_TARGET, - NGM_NAT_SET_DLT, - NGM_NAT_GET_DLT, NGM_NAT_REDIRECT_PORT, NGM_NAT_REDIRECT_ADDR, NGM_NAT_REDIRECT_PROTO, @@ -216,4 +214,6 @@ enum { NGM_NAT_LIST_REDIRECTS, NGM_NAT_PROXY_RULE, NGM_NAT_LIBALIAS_INFO, + NGM_NAT_SET_DLT, + NGM_NAT_GET_DLT, }; From owner-svn-src-all@freebsd.org Tue Nov 10 04:50:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 609B62E1E26; Tue, 10 Nov 2020 04:50:47 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVb5x64y6z4q1f; Tue, 10 Nov 2020 04:50:45 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id cLc9kOKEg34axcLcAkPiuM; Mon, 09 Nov 2020 21:50:43 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5faa1c24 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=nNwsprhYR40A:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=d60N8XTBATa_YG_cODIA:9 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id C760B1531; Mon, 9 Nov 2020 20:50:39 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 0AA4od0U078230; Mon, 9 Nov 2020 20:50:39 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202011100450.0AA4od0U078230@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Bryan Drewery cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367459 - head/usr.sbin/syslogd In-reply-to: <4b605497-6dd1-72fe-fb05-b45c61ee6fa8@FreeBSD.org> References: <202011071917.0A7JHbUS079060@repo.freebsd.org> <4b605497-6dd1-72fe-fb05-b45c61ee6fa8@FreeBSD.org> Comments: In-reply-to Bryan Drewery message dated "Mon, 09 Nov 2020 12:16:07 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 09 Nov 2020 20:50:39 -0800 X-CMAE-Envelope: MS4xfPDkpo3EU9K6hQlgDOHdlYUMTRkUwKQP+b+ictBXTSXPFzbY8fzjfT4SNnnqdpZ2wMlT5LTdV+Xx61rYZWbOupNLmRUI6wrnn3Qx37LJ8Rr4LtWb+Jly 03mxYtGAcHriMeeIBgZCJLY/p++g6Knb2kZ4IXh0hcRjB0eJQvFmdIY52qVqpluTgTPu3CZmC6Dh21wlEt4Y33d8lhmWXHJVaxAd3R0V2J43KSfAdUX9kEhH a7vcSL9WJwgCLEi0eupH6IcLX4+D6M2u8jcAT7g8JOLZix4mFkJwf6laKMMOCMk9bSy1/6+RzYwK/rhECmfh8C4CEaord8DeQt+w+DvhxuM= X-Rspamd-Queue-Id: 4CVb5x64y6z4q1f X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.13) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-1.69 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-0.99)[-0.993]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MIME_TRACE(0.00)[0:+]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.134.13:from]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_VERYGOOD(0.00)[64.59.134.13:from]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 04:50:47 -0000 NP. That's happened to me a couple of times at $JOB. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. In message <4b605497-6dd1-72fe-fb05-b45c61ee6fa8@FreeBSD.org>, Bryan Drewery wr ites: > > Thanks. I had the commit in a branch that had a debug commit after. The > brace was rebased wrong. > > On 11/7/2020 11:17 AM, Cy Schubert wrote: > > Author: cy > > Date: Sat Nov 7 19:17:37 2020 > > New Revision: 367459 > > URL: https://svnweb.freebsd.org/changeset/base/367459 > >=20 > > Log: > > Fix build post-r367455. > > =20 > > MFC after: 2 weeks > > X-MFC with: r367455 > >=20 > > Modified: > > head/usr.sbin/syslogd/syslogd.c > >=20 > > Modified: head/usr.sbin/syslogd/syslogd.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D > > --- head/usr.sbin/syslogd/syslogd.c Sat Nov 7 18:15:29 2020 (r36745 > 8) > > +++ head/usr.sbin/syslogd/syslogd.c Sat Nov 7 19:17:37 2020 (r36745 > 9) > > @@ -1873,7 +1873,7 @@ fprintlog_write(struct filed *f, struct iovlist *= > il, i > > continue; > > if (sl->sl_sa =3D=3D NULL || > > sl->sl_family =3D=3D AF_UNSPEC || > > - sl->sl_family =3D=3D AF_LOCAL) { > > + sl->sl_family =3D=3D AF_LOCAL) > > continue; > > lsent =3D sendmsg(sl->sl_socket, &msghdr, 0); > > if (lsent =3D=3D (ssize_t)il->totalsize) > >=20 > > > --=20 > Regards, > Bryan Drewery > > --------------9CBC57D81FB1CF44779F663A > Content-Type: application/pgp-keys; > name="OpenPGP_0x35D771BB6E4697CF_and_old_rev.asc" > Content-Transfer-Encoding: base64 > Content-Disposition: attachment; > filename="OpenPGP_0x35D771BB6E4697CF_and_old_rev.asc" > > LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tDQoNCnhzQk5CRkpwaG1zQkNB > RGlGZ21TNGJJendaaWpyUzMxU2pFTXpnK241ek5lbGxnTStIa1Nod2VocHFDaXloWGRXcnZI > NmRUWmE2dTUNCjBwYlVJWDdkb1RSN1c3UFFIQ2pDVHF0cHd2Y2owZXVsWnZhK2lIRnArWHJi > Z1NGSG4rVlZYZ2tZUDJNRnlTeVpSRmFiRDJxcXpKQkUNCkpvZmhwdjRIdlk2dVFJNUs5OXBN > cUtyMVovbEhxc2lqWVl1NFJIMk9md0I1UGluSWQ3eGVsZHpXRW9uVm9DcityZnh6Ty9VcmdB > NnYNCi8zbGF5R1pjS05IRmptYzNOcW9OMURYdGRhRUhxdGpJb3p6Ym5kVmtINmxrRnZJcEly > STZpNW94OHB3cFZ4c3hMQ3IvNE11c2Q1Q1cNCmdIaWV0NWtTdzJTek5lQThGYnhkTFlDcFhO > VnUrdUJBQ0ViQ1VQK0NTTnkzTlZmRVV4c0JBQkVCQUFITkpFSnllV0Z1SUVSeVpYZGwNCmNu > a2dQR0prY21WM1pYSjVRRVp5WldWQ1UwUXViM0puUHNMQlhBUVFBUW9BQmdVQ1VtbUpsUUFL > Q1JCdWVDckFQSnNNK1RmZEQvOTMNCmlqVUlCOW94bU5EcEZqMERtQ0IyWlRZZTN0T0Y0WE9x > THJMTW9UaVpKbmNhU0xqRUhxcW8vaTYySFRtV2pSZjJoL0pwdGE4WmwzRCsNCmRpdlNkSjIr > RFdBb29aOU5hanQzRnhlckhVbXVFWldUR3lJSC9tQnZubUI2R2pCb0NDdE56SVQwL3FGeklT > R3RURFJQcHNwbHo5QXENCjczZHozczFadjUyWUt2a3d2MVp3d2svNGVmVGlqRTk0V3JOSXRv > QkRXaCtXbmU3WkpMMVVVK0tOTktJWUNCQ3Z4Mjk3bGsvby9ZbkcNCmxNdHpIL0ZxVVIzVHU0 > UWo4MTE2aWVpVno2eVJ3eWI0OGJWYUtjYzEya2F5SjhOOFVEamZZYjZ3Wjlvc3RQcjVaSEJ4 > N0tIY1hUTEENCm5vTGhObDdPdVVKNGROU2luY2lZYTB3d0xDRTJ2ZkhIcjNDN05BOEpUM2ZL > VElUVDZSekQ0VmtZN3BzUWN2blpBTC9ocGZsVXVldUUNCitnaWdZTmdSb00xZStrMENZRHow > QkZmY1BkKytNQTdEbnNjNUVXOUJnc210bUVuY0o4Z3htV2xtM3VrMEJZRjZ0clpheTR3eXJa > dkoNCm9vamNMVmkrYXAvbTUrYzRPbFZ0Uk9lVU9IUXVLdXQyZVk5bXkvU0lWcmZnUExBQ0hm > eTd4d3E5ZXgyNFpaQU1IUUdyeHJTYWVZMmwNClhGV0gzWmtVc3NES1pJd0V1dVkzc09lSlY2 > TnRDWklhV2JtVjhQRS9wbGw0eERBSmVFT0lUUGlIbU9wRUJBVDdVQndWMTZqZTNhUEYNCjhF > RDRhakc0RjAycXJpSC9YZWJncnR4eWZCSDFJMllFSlVNd1A4Z1R2VGxUOTJSd25PTTBmTEJj > aHI3OXAvR1pXRnp3QXRRaXhNSk0NCkJCTVJBZ0FNQlFKU2E5MmNCWU1IaGgrQUFBb0pFR0hZ > ZHNGRUNqUFN6aDhBblJkUXpFYlhFQVZ6dDJyV21GT1RVQUhGTHBvVUFKNDYNCkthNEYxcjBz > WC8zeWpJSmJVSDYxRlkxbWJjTEFYQVFRQVFJQUJnVUNVbXZwY0FBS0NSRDF6Mkt6SUhzYm9Y > MkVCLzR3NWxSUnM4ODINCjF3OXFHRkY5azJ2dWhxNEFKOWdNTHBJMEM5VFVOSk5RaU9sVEdh > Tmp2MVNXSEQ1bVlqZ3IxRHBiTVdSY05HbXlDbnNYZjZCdDF5NDENCm1VUUV5NUZ6YUxVYTVR > enFIdlIzWkd5NkNybFJDVmVqT01TMlZOQWxVOHI1YVh6MEVxTEhQNTVnb1FGYVE4aVEvY0Yv > R1laeFlOaW4NCk9vYmh5K3V5ZTJiWE16azI2MFhlSkZ0S1Z6RUFlNmpoNlE1KythMWRnNm1q > M0JROENEN3dhdERhY1k1WTZsb290UFRJQUN3cUdHb2YNCktCbHZNYW1MMVpWSXpKK0huamhs > S3NtVzRBV2hMRFQxUDFudzNzOUJ0TEIxNUtzc0Q0TE54TGF0ZGpsaWRodWxkYm9xUkRwdExu > NzMNCmlOM3dqVDdNQnJROGVGb0t5dlpNbFJONVBWNDl3c0JnQkJBQkNnQUtCUUpTYStkdUF3 > VUJlQUFLQ1JCU1R3dzNvTGxHb3dxNEIvb0MNCnFPeWRPL1E4bFRZY0M4K2t3b0VtMzBQekZ3 > Zk5BTzhvcHlHZjZuMGpwUzEwOW9vYkhSai9FOGlGSEd0VHROOFMyc0crMFp3Rk1lSUkNCnpY > QzJqdE5qRDIwSHRpd0k4TWh5YUdHck9kTVBFM042VTIrNzBodzRSdmZnS1pCTnJ5TXlKSkJx > UUptVXNkVEo4M09MZ1pGNldpdVYNCjVQYk1hSHd6U2NUL21zUyt5bmtVQjV6RzJmSVZ2SU5G > aU9oTm9wbGZSNlJJSjhMM1ZUUDF1RWNIb0V6Z1dtTDVWbTNkaHkxcWh4YlkNCnlVckxrTngr > ekJ5TEFsSi9TRTYxaHI5Sm9TcVJnUERzRWVWRDNQaW05eXl2cFp3cndFY2xUZ2dSdUNXYVYy > ZVpmN1dwK3ZFL0RzdDMNCmNBYk1FNVpOVm9jcVBVNzY3Mnl3dS9UNi9peVdneHZtZ1hrMXdz > RmNCQkFCQ2dBR0JRSlNib2c0QUFvSkVEZk4reWNsZGVTQVhmc1ENCkFLc0JpWUxnYWhkL1RV > d1JJVFNURS9xNUYwL0tjcFdqTGtYUlBBRHVwcHRkQThjaHZpbFhPNmFyZ3EvSzFFOGtsTzls > OFV6VU92TWoNCkNJTzhHS3lqNlBmdC9qSWoraE1vd1YySldKaU04cnpYL1VxbVdzZVVCK3ZE > N0d2L0lFb0VQYmNvNEoxUm1Md0ZrRHJncHN0azdhVXQNCmRnYVF2VUltb0s0Z2lwcDhaNHFM > VU9idlJLWTcrakdjR3dqZGk1bmdPTzV4aGtYUDh5Y21PRjdxeE8zdTFodkQ0K3VaWFJvbDI4 > bXYNCnJ1Tmdkd3djeU1YVzBDeDRYMEZrekpZN2lGUDNGNDRXUVlOR2QwL2hFRmowWVFxUUNj > dUNPSUoxd2t5Z0pyQkptTmNvZ2ZJSDlBemgNCkc3SE11eHdrYWRWZkQvMHJkTCtqU2Z3YVRI > YWZJYW9aNTRIbW9CWjVaSVkxL0ZXdmYxZ3NVTFNTd3RNVHlQU3REd0N5YXE3Tm1iNEQNCnZS > aUJTS1M3cUhZZ1lkaHlGaWxzeFM1N004M2w0bnF0QjVqcVJQN2gxaUY1T3NZR1ZNcDgxTWNT > cE93Sy9QQXByZ216MC9tZ3JHTXQNCi9VTUJaTjNTOHRSVHlLczVrM0xWK01tb2tFZzdOVG9M > NXJWa2ZtOWNsM2RRaFBlVFRFVjcyWjRHSXVtb2NjMFBTNzNJMGpxcGFteFMNCmxRTXNBUFJs > cXdkUUFINVJJR3VBMDBhYXUvMXlKb0hIdHgyK0ErUWx6WENXRnNXRVp6UkVzTEpJbjNDZ0F4 > a0NqV0drdVN6ZWFTS3ENClExeFFwZDVmblFybHlmYzkyeWx3TFFuZmNhR3N2cjZ0U0lDT0Nt > bFlHRVREK0NFQXBpNUVPTFpCV1RLdnR2RS9XeFRSd21lelZLVFENCndzQmNCQkFCQWdBR0JR > SlNjSWFiQUFvSkVOazNFSmVrYzhtUTBMOEgrd1JsL0Jpajg1YkNaVGJUQ0pWbGZTMjd6Vmsy > Z3RCMlRsMysNCjBSaUFLN3VNOU5mMXpvVUZRN2wyQlBESERuMk8vN3piYUxjbDNUcFhTRGdl > UndPZHpzZkZpbWJOaFVnTENpajV0TjF2V3hvQk42c0sNCi9Gdmd6ODFrR3gwUDZ4WnlSV2Rt > WlRhbHo1WU4rSFVWYmNjK3ltNmhHbkk5R2xidng5OGpjQklLcVJhMU5zOTRicHhOaTZ3ZXJ2 > enMNCkdqNzZyN3V3blBQNjVnOUNZNXluVjBlVVJWUGVHd25NVm9XSko3L3dwMEptNnJ6ZWtj > bUhTRmQ1U3JNRmFvdUpTQUhMQ3JWVWNlS2INCkovNzkxSjIrVXVJS1BwWWtiRmFjMVhGRHVF > dnFrS0dhdjc4dCtHVXpUNDdRTm1ML2Z4aWtvUDk3VzdrQUF2SWJzMEIzdFpNdHhEbEMNCllr > YkN3VndFRUFFQ0FBWUZBbEp5WURnQUNna1FKa25tS01YVFRRWDBGdy8vUkFnMGxMbjdkWE1K > RzhxMnUvSFVqbGRlNkxZM3ZuckcNCjU0TEVrSSswcHRtWmQwbWNFcXV6cFR1NlRsMmV1QUNq > S29JMG1BSkU1M0VGci9kcnFDRExnUHY3U0Y0ZzNkQnMzdk1oS2JqR3k3djANCkFGR0Nib2lE > K21pNlNqRlZWdExJd2hLVzBzT2F3dktxVVJzaDJQMElzcjZhY2k4cGRITmp4cENuR1JUVWE4 > ZEc3cGYzeVFlQ2RnRTQNCnFFR29OYk9oY0FvQ1J3dnFrYlpEUU1tYW84czF3UXFvRW9QSGgx > ZHV2ZENsT0dvZjZhYktnaTN5TDBRUTladFZURHBTaDlmWDJVZVgNCmI1cEM0bmxrSnpmL0li > eHhiWlBMR2xYSTZaa0owMEt5VksvUHNKV0J2RVpCOVo3MnV0WDkzdWlGeGliL0Uzb3llM1hR > RXBURU9nSjINClJUdWI5d1FkODZDN052dkd3bDRjN2d0dzZmVWNybDlkQ0JKWkpHRC9DSGxL > Qk5FRithWS9lQ2l2OE1tSktFMWhFeFdEbHpXREFyMTENCjRVVHNUZEI5VHc1YnFzdW5nOGtw > aTcyQlFIR0ZYM2RsOGtEQmR2YUV3RUJDQVZyL0pUcU5hZW83clBLRkttYmIwZXdraWN0UU9D > b20NClV6WUdybUFOZkRYVThYS3ZObTl2VWVGQzF6Vi9lb2N5VkxrRVByZ3lUL2tTY0FJRFlU > U1p0SzZXS1VreDZzUElVeCsyTy91bGgya1oNClZDSzF5czgwNkZZR0NHOUNrZGt1MmhtRHRn > WVdTclpEZDBpdjQ5NXNMMG9xMk5VcUM3bjdsWEMrVFh4YjVXRnV1SVV3NzA3azF6MnYNCkY0 > Q3JHSTEzem1ib1pXY1hjd3ZIMGlWMktTaXowcjRDRHlJQUt3NHlKeDNDd053RUVnRUNBQVlG > QWxRY1VBTUFDZ2tRanc3cnhIdEgNCkZzbVFIZ3YvV2Rld3FnSEdyUlRkVmsvMG1KZi96L3h0 > bko4TnZGV28yUHBXejROWkppV1BPQU9WUGRYaHVyUlFWaGYyaVlCS0dZUEsNClpEenlWV2l4 > QTRGZ2dtcjB5a2txUnJLSXluNXZMOU54ejgwdlFaRWpHVlR4Q1JuUjlGTVljSFlRSE85Y3VJ > OE5LVTZLRkZVVk1lRWkNCmVtemVtZkorOE9RZFQySkxyTWM1THluMXpjbGZQZGR1ZlQ3NWxq > MGJPMDd4M090SFVjOUNUOFNHcXFSVGwyRmlzdUJGdkRTTDZUYlcNCk8xZDkzUlpJZmdnMTFZ > VHhnMmx4MWtCYWxLQVZteVNnWjRvTnozMkZEWGtrbEtDZHdKa284VmJDRnVnUUJWalY2UUc5 > TmFTNHBEa1ENCjhBRm1vaE1aNDZwM3l3bTFseHUxbENmdTFFTTdjZHZZclRYY0FlUEMxakJi > U0NrcEdNM3BvcEhNOTZCN3Rnd3hVcjRnS2pHeTkzQ1oNCmVkUnA5MW14VGVHb1J0d1BscG1G > YWpoUk55VXQyVjBRbm9aUFdKTDJQeWQxYjM5ZkVLM3lWOHJMYmRFRFpwNEdFNjRSOEU2L2pN > M00NClZTWHE4L3Nwa2k4Y2xpWjlFeDFwSklTc2NadFJSSGxteUE4R0IvTDN5VWxReTgvUkVh > eG93SWk5amVOcE9qOVR3c0JjQkJBQkNBQUcNCkJRSlZlNXl0QUFvSkVEWFdsd25zZ0o0RWg1 > WUlBTU1id1VNeGlkSDdjWDNnYVo4WGNybFNkeGYxamJ3dDFYcU5oZGxaUE1abXVFUDcNCkdn > Njc2NnU2WTJZN3FjUTI3dkliT1IwZ2NlNEtZNXRSbXJyTkVWL3QvTXBHbmpVc240Q2NxMUs5 > aDloYm5FbVIzSTRiTGpXMVdvSU8NClY3bnNsbTN1UzZkTWthTGE2aDJNMFFTcmFsWmliRmlB > VkZNVFMyZmE1VVhEQjVFZ0tFTTliSUx5eEQyTm04SEJLZ3dJNlkvd0VvYnANCng4eGozSlhH > QTBuZFVJRXJxSUZxK3kvRnVRdTZQKzJWaTZSTUFWZG9HYnRBRU9LRXhlYjV6SWdXWHErVy8r > SEJJUjN0YTdHOUtkVnYNCm0zZEhPODI3dU1RVk52VHhuSndSS3Y1ZUluNGdKejZodTh2ZlQv > RDBkcmtpWEdEczRLV2ZmcXp5eDRiemx5QmUwY2pDd1Z3RUVBRUMNCkFBWUZBbFY3ZkpzQUNn > a1FUYUVVNWNTaTVYK1l5QS8vZU5Ody9mRFo2YkpZbE9RRzVsaFhsMy9qVEZucWJzWW84eGVz > UGU2M042bTANCmV1NWFOM1dYZE95bjV3TEpoR3BVai9qeEtpQzZGd2hyUjRUVW0va2lWTFYx > VnQyQzRQNTd6OWdENjBDbGViRFYxYUhzM3hERjJ1UVgNCldydUh0dDRlYWdzL1JURTN5bkRI > T2t6dS9ubXFhdGZVODlzWXA5OUwraEVhRExKZVA3WFVsclZHaWYvY0R0cnNCdThCL05VT1FU > b2cNCnlEaXRMbkJkZ3dYVStzSE5abW8xVTQ5N1VJT3lPclUxTW83RldoQk1FTHhSV2FaaFJW > T3B0dWQ5by9GWTMybCtrM0VpZDdualdmSzYNClpBcHFXRlh1SUFVOHJpb0xNNUtwQ2xGQkZC > YXNuajl3QUt5bDBkUFlNMHdOZTdyTEwwYkFJWmdNdUtOcU5JaGJzMklYNDQrUEl4bWsNCjdj > NDZMSTU2TWx5NFdLNjhqSFBVNU1LaW5NOTVKNWh0Z20zVHVsbDl6bCsyTityZXJKK05Tc3c1 > cWl2ZHJNRklMcDRSWkU5REZUMCsNCmpRazRsU0NodnRhVGxCM3kzOW41bEFiYlNyV2pBeTE3 > TklMaVdvV0VQQmFUR3JmTERpWlRyWmQwWFBBVTU3R3BXY0V4dDhoMXloVnQNClk5bm9UbXYw > eDNodllUdUk3N2lSRWNhMjBRWEYwTys1NjVhYnFselM2Mi92MURpcU5xK01WQy9Rd1k4bDFl > eVUvbkY0cEFHMDNwdUcNClFWemkxVXFQQWh6cWlGOWlzNUJudUJPSzJ1R1ZOOXpIVXpNM05I > d0tINmJudlNuVnpBQWxwdzF2eXlrM3pmZ05jSW1FYjh0V2NSb1YNClVpaTA5WTJ5eVowVGgy > VDU0QVN2WHlPMUo5cHRxTFBDd1Z3RUVBRUlBQVlGQWxWN2tsWUFDZ2tRMUQ5OEV4Qi82bThP > dFEvL2RYeDYNCkZZaUtaVmc5NTJtSTcyU3RsTm1QWm1FbE5aZ3V6Vm9yYlRvUktsZkpUc3Za > NmJBSEhTSFZnYVRmYzBIZngrNGdpMndtcUJac0lrRlINCm9DYlp0R01RR2tON0VBMUFkUHNs > Z3dtL2kvTUR4NkI5Rnh5ZEFGNjdaOGZmVUUvcnNacmNxbHB1TkJlMlBweElPM1hpL0s1M3Rt > TzENCjdRcFZBSDFZTWFHZmVjVTMyYU0xc2k3L25jY2JiK0NpNHlMY1RPMGMyRWVVOGJwNzRJ > MVdSQjM2azlmRVQrYkc1MkdCMnF0a3M1NmgNCnBpTkpzWDRWellDN2dtT1NkdFE4VnhaK3VE > ZWluQUxCemNEejNEVWw4L1ZGM3ZlbDhPRUQ1UVRCK2pRb0NXZ3V1NVlYQ1lCdFBHV3ENCm44 > dlpTMWVsK0VJZ0JLQTBhTC9UTzZjeTZJNjJoQ0UxNXhkU1o4cG81R0xOeFFVYTFYTDR6cGJs > TThob1ozTmJwYlVtandaSWxxdU4NCm84SzNUUFU0ZVg5YTEwclFXN0F6UFBSS0dKMmJkUUdF > Zmh5YTdMUHlhZCtuOVlxei9FSzhFc2RQUWVMeDMyMWpSZUFLV01SN3NpSUkNClU4a21qT290 > Y21KbmZjUFB2UDdHRzM5Q1FBUmZnaVhoQzY5UTJqVGRXYmhMTlp4WlJHV1ZWOHJyOXptMkJE > Q0ZKeDJTOWZTeEgwQ0INCjJjeDFvamlDSWN5d3pKSk5PQzlZUUozR0VveVVaOEhUV2Z2a25D > azFHREVLV0RjQ0pSeXE0d1NUTWROZlRvMDBrdHpTK1BpMVpoM3gNClh3bUU2SElkM2t1QVp2 > dWR5OFBiMW5tQWNwNWVyYmRncks0Q2RRZS96OHNCSXZsaTFUTXF6Nk85RXZlV0tsZ3RnWDFZ > SWtYQ3dWd0UNCkVBRUlBQVlGQWxWN2t2c0FDZ2tRMFQvNE4wN0xlMEtIcWcvL1lQZjh0WWdZ > N0dmVlhhcWUvWGtJV0x0L0krNnExNk42UWVDVkQ3cnMNCjNFMkFmUGd3SklTNWdtVjRyem5o > ZFl3WUtlY2pWUmNqVDNqUCtEN05lVEp4Q2QvZ0lpYjVDcmRnTFpib0VveUNQWnhrdFlibjh4 > RTENCkVsM0lQWTdDejRCejEvejFZZWM4dVRyQUhtRDRXMHVhWEYzSzdYZTVtVU5STzBWY3dn > TmwvTmgxR284YnQ1L282TFdHU3ZFZzJQcnoNCmVVZDFvK3YyWUxqRW0xZGxJaDNYNHpnV010 > eUdYWCtPbVlzRmtOdDBuMWEySzA1RUlJYVZmV1hNbzErUXc0d2ptN25mM0hMaXJKUlANCmF1 > UFduVldSNWg0aVZGQVRoNWNSSmxwU2VZbE51RlgyM2VjbzlMY25vVlFveTZ3L0dwU2U1VlRh > UnZGanFhbk9haHpvbDdyWVpkUkwNCnlCTkJIYnB0WE1FcjFTZGdUMklXSHZBS1l3RkVwbklH > SGl3VnhIQ3E1SGpDNVM2Y2g5ZkhndzVrR0IrMDI1S0picytWKzhhUGxDYWcNCnB4eEFCVU1E > MkM4cFdscEI2emZHMUFyMEFqRlI0WWZlNGQ0dlA2QlNGOHAxMEpxSkMyallQV3E3ZnRnTStK > SEFhanZJYjdrbWNXRVkNCjEvNS9yTHhQSGh5OFdmNnhRYzhyZ2NGY0lBMDcwMktWaklQeGZw > a3N1eFJIYnRHWlZlK215eUh2ZktBTk4xR1lhSmtIY0crOVN6bFoNCk9CaE9mYUlJY2VyWXJQ > SmlYQnY2dnc3ejh0SjhTdHlUREpsMzNJNnlMSjQ1VkI2YWZDYTNuZ202Y3VTWVo5dUJSc3Nn > MUNGZUNHc0MNCjNMNzU3Vzg3c1JtNDVDYUFKSXdTaWlYckMvWGRKeG5pQWlIQ3dXSUVFQUVJ > QUF3RkFsVjdrb29GZ3dlR0g0QUFDZ2tReUMzTFFGTS8NClN6dFlDaEFBdkE2emFZRnR0cEF0 > LzRmNEs2enZ4d2owOVVMdU5FdFJNanBRSzhIZ0pFUXdqZXY0NjFsTXRza0RwckF2OXBGdUE5 > NWsNCk1yK0Y3NytQNE8rbHRySlRPNDFVQ3JOckhnU3NsbEVUTXkzeFVkUWtrSWZCWUFQRXVl > a2pxZXZRWXVTcEZ2TFlXVDd1d0paMWs4aDgNCmVCMVRhMnkvYnVuUER2dkZBSXBwTkxDVG9Y > djhlTXRsOVl4bVBWMzdpYWFGTjlkUHdKTDg5L0hBcUo4OVpnVElJSDhVTmU3VjNGT1INClpC > WGxWUUZUT1ZDNTJrYThEWGZZbTI3Mnd6blhINzllcjl4RXFIOWhxMzNieTlTQ0dvcWNwNkFk > a0NpcU85WlNnelR6eW1OYjhidkoNCmxZVjVxcFZWRDVJTEJDV0xCTjZORXQrRzRRR2NnT0NF > eUloREs3TGRDQlZMTDBVM28wenZ6Sno4NUZ4M2NKSXY0U3FiMTlCU1phNVcNCnNTNldKb3F0 > aUdKRUhRc2xVUjFOdmUxZlhhSDlVNE50T1FBYjJnM3FkdHMvTTdlb2N1aEdyOUdGdEpmaXNP > bG5QS1cxeUZWMnpuYUENCkF2SHlVMlQ2QkFEOWtaNTBwUjFCMkFwNkVvZm1GR1hINTZJZlFO > Um1XSEJ6Z3ZaRmhSWVBvUDFvaFkxU29xMlFPL054MFpMZHBpb0kNCmk1TlRZdW1WcURGVzBw > MEZ0SVM5T1U1dm9hL1NWY1ZpVGJ0SGpYRWRYc2F6OG01U21aV3FyNTVKZ2lHYkNYbkpkemRZ > M21YMGJuZTENCis2cDllZDNTTnFGT00ydm1ONThQZ2gwQUpKTWx4S0JEcEpVU05YeUtlUmxj > VEJEUERDNnFyd2NOL1oyN3FWNHJmL3RHSi9Kams4Q24NCm9SaUxUcnZDWGdRUUVRb0FCZ1VD > VjF4SE5RQUtDUkJSaFFsb2JINWVnclBLQVA5RXhLMlFFa3h5dDhyYkhGRHcxN0liK1FIMXlk > ZXUNCm52NmVRdlE1aE1XMWpBRDlHdEtkSlJ4dVBnOFNTTmhhRUxscm5ZNFAvb0dYTFNkakVM > VEZRWmZtcDQvQ3dGd0VFQUVJQUFZRkFsZGYNCkxPd0FDZ2tRU2wrNGc1dVVnYkwyN3dmOUVr > RFRQc211UTQ5dXVvdFl6M0c5Y29kRm8vQWw5RXcyVzFCcm5ZVDRGdWd3K0s2SDM2bXkNCmVF > RGhYQnE1enNsOTlUUG5hanoxbEZJbmZZbzN5TU5vNFZWNzEzRzZDMWdET0VWckJ4SmpXZHgx > RkNNTXhLS1RZaHRjbUo0bVoxU0wNCkQraFhFN2RmYVo2ZFl5T0pBY0ZtQzQ1MGhQZHAzODN3 > RkdDZjB2b3RlTFQ2aU5qK1Z4cHlVM0Q4Z3MzTzFyWXlaS3NYTkFpZzRFRnQNCjRQY3NsUGho > SkdlYmxFN3hnTzMxbXdDNmNldEFoSnMyT2FRVHRyVzI5VVFMejkxV2N5dnFoNzg2cTcwK1pq > NVU2c3U5Y0JBRFVnTEkNCnJ3RTh5ZDMxT2Uwd2l2b3hreWhlN1ZScjAxMldOUmlFVWtpbHRa > ZG1IdkVUSWpITnY5U28rekh6d3EwdGQ4TEFsd1FUQVFvQVFRSWINCkF3VUxDUWdIQXdVVkNn > a0lDd1VXQXdJQkFBSWVBUUlYZ0FJWkFSWWhCUGtYUExMRHF1cDZYSW9mQ1RYWGNidHVScGZQ > QlFKZmhlV1cNCkJRa1Ezc1lyQUFvSkVEWFhjYnR1UnBmUGZla0gvUmZKWG9BU01VVkpGUyt4 > UDU2MVVqY3BnN3RlL1NBTHZnRTNDbWxhUG4zR3pOV0gNClFzT2ErbExxWlJVS3FIdkgvTnJS > eWdua1RRK29QWjRpNUY5VGtYSSs4Z2dBSjVSOUNySVFTU256aHMvSnB5MTA2cDluN2pvSVNH > cVQNCnFpQUNXanJuRUV5cHJWelFEc0pvTkhvT0o4S2NFQU1iOFZNZUNNSUNPOS8ycFE0K2Iw > TmNEM1NUNDd5NWZwQ1dQUlN5TjVmMzZJM1QNClpNeTdrSENYYUNXU3ZSVnU3V3Bnd3dxVi9Z > cExlNWxacHNsanl1b3VnS3laN2lmZ1V4TGxTbXFzWDdwcEg3RzNtLzB3cFVwMitKWVENCmYy > QkdwZzhBcDN0b3pFNHNSZ1lzeGZPUWRUaUQ2Z01jZUZZek51TlZ1TGF2NzFCcC9TZVVHbTdl > TW13cWlNU2h6eWZDd0pjRUV3RUsNCkFFRUNHd01GQ3drSUJ3TUZGUW9KQ0FzRkZnTUNBUUFD > SGdFQ0Y0QUNHUUVXSVFUNUZ6eXl3NnJxZWx5S0h3azExM0c3YmthWHp3VUMNClcrWVM3Z1VK > RFQ3emd3QUtDUkExMTNHN2JrYVh6L2F6Qi85MyszSDErYTg4aEZlVURYMWY4RXVJeGJwQzZE > MmVQcHdqUDB5c1I5NlINCkY5bXkyM2tHNUpPaTJ2SExua09TNmFJYmVWeFdkZkdPVTJ6SXJi > WjRKYmE1VGM2QXc5SWZXcTN0dURwQXhSb3B0Mm55Vk83Wkl5QmsNCkd0WW4vcTN2cnlPUVlj > Mk1FWVk5S0NsOHdZdC9UT2FIajNkeTlYVjM4Zk42NE5oVDhtUVhTSG83TStuMGUrRTl5VlpH > M2VwTnBlZjkNCjJaTnJvalRNdm5nWHcwWUdCTlJPZ2o5dkpGZEp3bmhpbVlFbGJLTkpCbEZC > N25lNzZDcWhsYVRMMjNkSmhPS2FlRHhPV0NXaFQ0NjUNClpmWm9tZ3dMM1ZQQ3hpS3VaK3Zt > bHp5eXFFUDBEWmVwb09vbjRDT2hYeWlDenBFNHN5MXZCT1R3VWpad3BqV3FVT2VjbzV0ZHdz > QjkNCkJCTUJDZ0FuQlFKU2FZWnJBaHNEQlFrSlpnR0FCUXNKQ0FjREJSVUtDUWdMQlJZREFn > RUFBaDRCQWhlQUFBb0pFRFhYY2J0dVJwZlANCmRWa0gvakhCWERCZE5GbFlUWlR0Z2ZDQXAr > Rm1YSmZxQ2FMcE1yVlZ1bUhKNmozeW5nOUxhWGt4R042STFaVUplTmxPa3pCSDFCcXYNCnJi > YnR1S3JYNVpxSlltdU9ocmc3cHRSQy9JcCtTY1drOHRRZTJzN1ZZMWhIVW5FeDFtVFQrcDgw > OCtxMDBGbHFOK2QzWXQxVXZkckQNCm5rcVYvMTJDMVhHalA0Z3dMRC83WmlSb25zWGlmUkJK > a3dVWGtmdzBkdkcvaVRHM2g4RXdzbEVxMWc5Tm5neGF3NGxHSHNGZXpNU2YNCmJhNS9aODFY > Tzg2djBtdTlITHY4NkpYZlN6cVd3OHRxei9aTXcxQmNRc1Y1NFd0dDc5WnpHWHRVZStKSU1l > QWVodFV6ZlZKMkpmaWsNCjZGMEpCOFNpeXVBK1I3V0oxQzYyaFlRTkZOR1VHSmR3L3RGNmFt > U0E3dHJDd0Z3RUVBRUtBQVlGQWxkY1VVSUFDZ2tRNWZlOHk2TzkNCjNmZ0VrQWYvY1pSWU9R > ZE1FUDVPbzdmbjVUb3BvdzcyaVNOekFMV3E5VTFVNDdMa25DNmRZaW1vbXhYQUpsY1QrV1ZD > cHgzeTlreFoNCklJVHdIdDFkU1cwN1FJVE9CaUZJZHB5clZsQkRtUUZERWVkcHpQaW4wL0lq > SnBxRzRZMy9BekhFRTdDL3hjU1JCUDRhbVhoUjdQOEgNCnJGQjdLWnl6cXEvRWp3RGhRWHM1 > VDk2dnF4SmNMREhaMjVkWUQ5WVpSeG8zbmY4V253UUp2VUtSQ3ZOSGw0azJSSUI4R0xUY3pV > SFUNCm1HOGxTUjA1dGw1amc1RUJaRk9nTFZ6am1ZZGx6dU1NWEZNNk1VYngvYlVrbFNKb1px > Nm5TeHBqdWFlc3RTY3RQZVM5OU1EbURWREMNCkFTNHhEL2RrZ1RiNzdLVENYQ1V4WXBROTZ2 > T2xuQmdFektpK3R6clVDRlJ6YjhMQVhBUVNBUW9BQmdVQ1YxekQ5d0FLQ1JEY1pTTlUNCm1V > YkdPcXN5Qi8wZlU1MlVTWmkycmF2VldobzQyWVhFUkpWaHFWdkNadi91V3JHOU4wZzRmU2Qx > eFpid0pSRjdGZnB2S0VhcE5oZlgNCitkWHA3d2lwN1UxTG1yVnBySEUydmZTWG1vajIyRm1n > bWlJMTV3cWFJc0xKUVVRVkJSaVNFaDJORFVUTmZxT1pjZ2c3SGc1V1dvMFoNCjJXYTFsUkVU > TWZjZjZGVW8vREh4Y2ZmVXpNZysxTFpQTDZRL0lmMStTWDNsZSsyOWZBSmhHUEVGWG5SbWpU > bXJERldTbDlSNGxpbVgNCnZCRUFDSXJWaGJpeldXeW9oclEzL3plYnAyZVJFRmpQQjJXMEUr > eEFCallmbkhPK1RMUk5TOTE4SmVmaFlETDNqQXd6cFRqMHJmclMNCkFrR2VCQitqZUt2YTE4 > UjhBTjY3dmhCZDY5bWRiZ0dyR2hraG9LWkxSaGNTZWEwRXdzRmNCQkFCQ0FBR0JRSlhYRzY4 > QUFvSkVGRFoNCmkvMTR0WFVjVTdNUC8xclM4WmNZSW1uNTZnV1Zva2VkQnVoQ1drcmRyVHNx > YS9WbWFXaldMNEhXWS9NRWk0STR6VWhBVGJ4VHdoazANCkJveDRCZzkrWVRZWmZkT3hvMjZx > N0lFa0VLdFhpOGhLd1I3N21OMkFQNEYrQ0hTcXM2c1VtNjFmSGVRdUtXR0dTejhNSVhrT1g4 > M0sNCnFJZnpSdjZGMkQ1dldWVDFZdEpjOGtvWTh6OWhGeXcyajBqODJiNVpkR04xUlRmZnZr > Sk1aN08xdjhLaElCRnNHazZkU214MzB5cGwNCkEwSGJ0NUxLWHJiZ0ZyNFVqMTNWamdKL0JC > MC9yWStSa2dFSXBYRzVxWDNvZTZLTXlDYVdtOVJOYzJkUHZoT0UxSnhuZlN6L0gxVHUNClgz > QW1ZazVaQjBBcDRUKzQyOTZGRzE3QWo5dmJjT2FzR2R0WTJFUFNuWXdHTWpUVXpsL0RTZ3ZH > UDdMeFoxb0tDN2hXUEtIVUl1dEQNCjNXR21sNEJVL01sSlJQRjNHd1hIck15VDF4R0s1bytz > ZG9uMUI4NEVkclk5bXBFTFJvREg5TzRoWTBRVXZ2QmVDM0ZTbG1RYlZJSWQNCk5FSHNPT3dQ > UWVDSTBqSmNNOVBXUXY4eVFNekhVUGIxdmJTeG5tRlIrMnh2aElFTmROMWszNnhUV1YwNXpY > M295Y05EdnpIR3h6TnENCm51dVVNZk9EZWVYZUpKMDcrRHkwSk1iVWVTS2Y1S2tWNkk0YUZy > V0dOMHRkRTNETENsK0ZxTkRYMGhrVU5maURxTkc1ZHJDU0w3ZlMNCk1NNGZ0eGZnd3N3MU9s > d0lqdlV5c1dRZ2xLTlk1em9SeXpSVzRUTlJCaVZyM0luRy9qdjJRcFg2bnJVZHFsT1hHYXdx > L1F3b3YrOFUNCmU5TXhhbDlBdUQvRndzRmNCQkFCQ2dBR0JRSlhYRTk0QUFvSkVBY1RJcG1T > ZVM1K3JBTVArZ0tqNVdyRDNvVEVUVlhNZWpidkt4ZTQNCkNKdWNpbVRSUTJ4TnYwR2FDNDQv > ckwrWHF2d1UrTVR2dG9CcXFOZ2liMnQ2b0M1NDZ3cUlwZVJPV2hZcUFsYXNHSHVPRXlMd0c5 > c2oNCm40R0E4RnA4ZHBOM0JLaHN3eXd5UmhxVk4rdWx1OGpiN2VLOCt5T2VOK0dvYWR0TnFl > T3VndXdGMnVDSGRmV1hrRjA2WXhrNFVVQnQNCm9sTkhBcmkxVkJUbVlwYWUyT1YzWUtPeWlt > MkJvd3phdk1WZVZqZW9hdUdZenJ1WkVNUFV0bTRyb0xWM25aVEk4TGN1UVV3VlN3M0kNCnpu > K2hJOFphY1AxK0k5K2xwTnlYaG9KM2VFY2tST0xVSU4wdCt1T05oNE9qTWZ1b2VoQ2tINkZu > eCsrSnVnSy9iUkZqbEZOL2dIc0ENClozb3lxWFd5ODAyMlhXa1ZWak9zU2ZjUHc2TUpiRXhi > TkdFWDFEM3A2U0J6cVNva2lMV3hreFd2amIya1FsZUJ5RzduWEhWSC9KbncNCkFkWStMazly > ek1TTG9rNkJwaG53WXlRcnNmMitZU2lyM29nSWcxSCt4T1c1V055RWdzRWZMdzVyQ3N0U0Uy > bS9vUEM5UXc0RHNyVGoNClQ3cHJxbWxtRms0Q1Qrc3hhSEdRVWFja1A3cnRocGVXaEcybE5L > SGVIdytJNzVVS1J5cldxQXZFK0FvWkJKRkJnZmxZNFgvRFZnQ3gNClJSQTZqNmVlMTBQWDdT > ZWYwckQrWDB4NkVYQnpkK1p5WTBRSzg2bUs4YUIyRkFXOTErZExiVzlxd3pSVHc2Z0NnSWtz > TWJLZjdzbUYNClhjL1RtT2psZkJuK0FxYUg0ZWg3TXVrV3h2YW9pcWwwcTJjdEE3dSswWGFp > RXE0UktxN2N3c0ZjQkJNQkNBQUdCUUpYWEdaMEFBb0oNCkVJU0VhdTlrbmxRc3Vrd1Ard1Jt > RERCNGxUbnlEaitNcHgxbTdZbzExc2VIOGFVTmEvMlgyZnF5STEzanpZNmgrTVpESWxNLzZT > aFANCklHa0dDN1YwK29wS3ZIUXYxVXJ5UlBZMkQvZzdoOFFRbzRwVFpodWtNMjFVeGdGNTVS > dWkxK1lMcGJRK0o3VjNZclNLUVRIcEZRL3QNCkRpRXF2TWpCV2xmS3dvdkVld0VkSnR4Q1Mw > OG1nVnVnbVRYbFRGMXF6UTBHWTR0MnJrSzg2enBhaThtWTJuczRJc09RaDJ1TVBzenUNCm5L > bVpSSVhFSURDV1c2OWdqaDdqNmxmZm5CKzBNbGFGYk5aSVI3dTVEeitYczFkTFhsTjRQSlVq > NVdTcDhtb05rUVV0d0dBc0xjeS8NCkxsVVhJbld6d0hLUU9OdW5RTks3VDMwMWk4VjJCd1Jz > eGhWVW9KWmU4TkNlSFVhYmZoZisrNFNWb0NoR0lqSE9TTFBESURFOGJqNFgNCmQrWEFzTWJn > MHVOS1ZHakhqU3dyQ1ZRa0YzcXJWS01qQnRhV2hjRU5aNjNiMlRRbkFuWndLTkRBZzg4S1BY > aXRlUDhIbFFheXBRVVcNCm1WZ3ltTkVOTFpxTTdycEpEU0tvMGlXbFlxNGswQ1g1Q01aRkk5 > bTJyQ0NlOHlzRmd1RE5YUE5TRjVPdkU4RmN3M1BhMTF1ZjdSN2INCmJJM1J4aXZmcEtQcDBU > NU5BeVZhVEg1MkVSMklqcWFqUU1iL0RpQStseEpyd1RvS0hRSHVMZEtVTTZidTg2QW9pTk85 > QndJckhyOSsNCmhkVFFnUlEwRWluREdQcW42N253Z1pDQXNSUDEvcklwNWJWcFFJeXRseEk0 > c0xOZ3RsaHByZkJsTHdsMzRWcFJYcFlkU0llUkx5aFENCm5TR0VXdm5kRXhiZkdSMVh3bDRF > RUJFSUFBWUZBbGRwU3ZzQUNna1FURGZ5N3g0QThVeEx6QUQrTmRqOGZBdU1zSC9RVG4rYk9r > N1ANCmVUTW9WK01KTUNFODR2eWg2d2ZHY0NFQS8xNGpNT0JzQ2hRSTdldTZNMm1EblF5SVBr > QWhBQmVwbE1EekxrNitFVWx4d3NGY0JCQUINCkNBQUdCUUpYWnl4RUFBb0pFUEIydHY4K21D > Uk5FT29QL1JZaGtzSWJnMUdpellxWGsxNEZVSy80OEdybkJoOGZHU2NPWlJBUGJ2dGUNCkRX > R3d5T3RMZWF4b3FpaGhpeGN6SDQ5dmwvWVBCM2VNQzlsdUZvSFZzWUtzNXZrRk1iN1dUd3Ra > MWwwK29kS3hua2JhZVl5dlhmRTYNCkdBTFAzMmhrYmJDQjhZT0F6N0ROMTVlcWpGbG0xWDRO > ZWFoMmV5YmNYc0F3bVphRWVySTcyMXNpcy81STJaRWREMm5yWUxVdE92QWgNCmNRYTMvTE1m > ei81QjRHM3p2NnIvOWh4QlBWUUhla1lDVWFmUU1EeDFud1ovMHB6RWhlZFZkb1B4c1FqWTNT > V1FzTUNiamVFbEVVNTkNCkZVbDBQM2hEVWpzM1dLOStoWFV2bFJkZFc1YVVXTlN0TksyWjdS > R0lxRlFFWVg1T2IwU2U4TTRJSFphWWpDVlJ5bVpVc3V1dmtpak4NCmNkRmkyb09STDJSTUxu > M0dwVTN6NExPcmhEUGI2VTNSbWw0dXhmUVBnK0hGMmZGZDJTaGNwTnY1bEh6K1dNeEw4M2ZQ > Y2xpSTNyMWYNCjJKSWkvSXVpVEphVFBEOTJxaDU4Q3JxUm5RVld4a0EzdnpRMkllVE1hRWxJ > WE92NllrSW9od3daNkxHKzZPMVJiT0hHSGR3ZTd3T3ANCk5WWWF0L2ZMTkp0bi9UUlBIbFBr > RVdhNXAwRmlqZmt5djBLOHgrUGIzN0ltdmZaMVZ3M2FYMEwrVERxQjBxcnUzcDFKQUNoMnlM > bisNCmZoeEVucC9NSG9BNlZxOWowdlRkT1RVb2lxTzREUXJQUEV0NEZpV2JVV2tVeDArcys3 > TFpiTmpFNHZwS2ZtVEc0RmZXcE5UQlNTN0sNCk9mT0xLbjB5UmJOeXZLU0VxVDc1QkpmRUJw > YkYyanY4d3NDQUJCTUJDZ0FxQWhzREJRa0paZ0dBQlFzSkNBY0RCUlVLQ1FnTEJSWUQNCkFn > RUFBaDRCQWhlQUJRSlNhWXVvQWhrQkFBb0pFRFhYY2J0dVJwZlBYQ2dILzJPOW5hWFVFeHJ3 > cEhuTy9kMlQzbEhOVnJqTDNobFUNCmUvbjMreVo2WUs1bDBGMXZWbjh1SzNjMDNPRVRNUjlP > Lzc3bUJrMkhUdlAzOGIzbXVrT0gyQUpRQmpjamliZ21qUGlTR0syZ0piUHINClR4dG4rMGNk > dEx0MmJObmVJVGVTWHlCRk52MlNFVURCN3lUQ1VOMk54MldxYlVVT2pHSjFHc3I2MjRXTzRp > U3M1VHFkSXVUOEZZMnMNClJBMWhIR2lxdXBFZXNKdjExM0FpSHhPSG9KNEdOZ3hpQnNxNllW > Q0hFM3R4M2VaODI0ZTU2Sm51anViMnVkK1dWWEZvKzZRZU0yMXcNCkZ0em5XMll2aHRNT3hx > U2dISGpRdEFDRnhEcjc3VlBJVHU3MGt1QU83TzI3OFNTM0MrdHRLUlhYUW9FOExpVWdhYjZu > R3h0L0F6MEoNCmRkM1BycVRDd1Z3RUVBRUNBQVlGQWxkZllRc0FDZ2tRcU54aEtNT2c0UkFW > a3cvNUFUU01VMTR3cFFMVE1IWnEyR01BQUVDeG1FMnANCk1rMGpIQ0s1RXlXUWFlaGo1ZzB4 > dldjTmFiZENBYmhBNHpFb0xsNmpQeFQ4ZmRmbzg1eXgzYW4xU2JvbCtraVF2UFIzV3k5MVdI > Ty8NCm8yRVJ2TG00WVc4RE1QbXBrdWlpY3FWRHJvcEdxS1ZoZGQ1OEZnT1lYTzNOanY4OG9k > bDB5WWp1RWt2ZmlGSXJpeFB4WU50SDJ5T0kNCk95cnZoZURHenRyR3V6S2NYTkNpVHhBYUps > U1l2b0w1SEpwd28zWFFRakdMcmcyeWNjaElkVXZRNUtrZHVrcU9vYzAwRDJac04rTlYNCjFP > b1Bkc0hZYTI4OXFUMkpORU02SDZmQnRnOUFkb3FRU0ZmOHZwaVU4V0FBYmtoSjVXeFBaU2E2 > R1Q4NENRZWwyN2hCUGprU1hZVXMNCkJhZGhKVzlrMmhMMUhibGp0Ym5CM245RlRyMlg0Rzgv > Ti9BTDg0Q2IxQjhSc1RXNzRXVFpkU2VEQmhjanNqVTZSTnZHanUxNjliOHoNCjBEV0ZScVlm > bFVIZHp3MEM4eHJXaE5rODRzWGliV2IxeVd3RlcrSnVpd2NUZ0M0eE1PQ0o5N21QSHVFU09D > WlRDNXY2TklOU0g2RWQNCjNsK2tpYTJsN2hWYkZ5UnA1Zk9mY1VvcnJ4SmRETTRuOFU5akM4 > b2lZL3dFSzg1Tk1YNEZ5bGpUYVpYVXRsRzMwd2kxOWJXa0RRWE4NCnZPUkIwclB3Rytmd01Q > Nk9CQTM5aXV5S1RHR29OM3gxc0tnSkJzdk50YTF5SVlrb0NCUklmOFppLzc0djNNZjgxclNz > YUtXYXpPZkENCng5WS9LSXVwaS9QU3dKNnYzbkg1T2krWXhwb2M3dVhFZFlSY3pFNjRkQVBF > cWFYQ3dJQUVFd0VLQUNvQ0d3TUZDd2tJQndNRkZRb0oNCkNBc0ZGZ01DQVFBQ0hnRUNGNEFD > R1FFRkFscm96aUlGQ1FwZ2V6Y0FDZ2tRTmRkeHUyNUdsOC84YVFmL1cvMUZpRDI0bm1OU0hp > TGgNCnhkcWNtRHhPeDhyWklkeDFiTVRBTkJlVEd0Z0dFTEYyV1hpalNscXhlMFQ4ZzhnOEZK > SlN4eVpJWnBOeEh3cFFXeDhYOVBKRENKdGINCjFnaVViWU1ZblBaSjJQMjgyQm9saktSNDRO > M0VuZFYzNjJCOVdycldLazJRSXc4Q0pJRG8xSFVmLzAyNStGZCtyR084dG84L3BIVEYNClZy > eXVkMU45bW1hb3NBV3dwK0F6M3RjRW1YRkxOZTVsZjlMbVhTS0JuWSsrQWRhS3pRUDlLY3Vi > eDJLT2gzR3dUYUdrZktTa1MzK1YNCldUVWJNYWhpRElVN25NZUVpVm5CNmJrUVZtTXJ5VWhj > OEw4WFN1R1ErR0txSEpCUmoxYlRsNUxWVEdvdlhzYXk3ejl4dSszeWpMdkENCnlPbytFRVZP > TUFuckp4N2lIMFR4YnMwZ1FuSjVZVzRnUkhKbGQyVnllU0E4WW5KNVlXNUFjMmhoZEc5M0xt > NWxkRDdDVEFRVEVRSUENCkRBVUNVbXZkblFXREI0WWZnQUFLQ1JCaDJIYkJSQW96MHIxOUFK > OXpMeURVeUtBSjdIOXJRNVRiZ1laVGkxak9CUUNjQ1ZuTTVvdjkNCnMvSnE4ZzJjNzZGZTBz > bnVkQnZDd0Z3RUVBRUNBQVlGQWxKcjZYSUFDZ2tROWM5aXN5QjdHNkVVdEFmK0lBTnhpa25X > ZWZZYUpJQ0wNCi9yZjVDOXVRRnhPUnBGMkJITjlZWXdjdlRDMjgxdUNsV3pqcUovakhWU2lT > bjUyK245MzlDNXdtSmhkdzBOc2pVTzFJYTRSWm02UW4NClRVK0tCbmtubExtSWxIUVZvSnIx > aVJaWDlrb3NMOFEwTjJwU2k1VDdhNzNXVER3VVcxZE93K29vMms4WVh1Q0xselEzQjJOVlYv > dngNCnYvU2lSNGp3RUxNWHVMV3FEbmZyWDZWdXNhNm1rVEc0K0d6R1ExNEpwK1FmbE1HMlNt > djg1N3hiQUpoREdJYzZLU2pBa3VGaFVUUWUNCmRYc2dMbWNVRUo3ZStZSXNlMGFXSHBVWUkr > Yk96S2dqRTE2eUhIZTlzcmVnSVRSWEFjYkVBSkNnSDJPaXhmOEpJYklNV28zTklsYnkNClZw > OEUvUVdLMDlBcFFkbjZmbk93bThMQVlBUVFBUW9BQ2dVQ1Vtdm5kQU1GQVhnQUNna1FVazhN > TjZDNVJxTkNGZ2YvVU9NSFZJdjUNCmg5UkJzMFJNZUUrdmNGZERGeEdhcjVHaUtSM3FoQ0ha > Mms3VzNIY3J3cW15SVlKbk1EcXZYK3ZDSlVLOUI3YjlNekJXRExYTUhWVTcNClNvYU9XalJT > aWVTVVVuRTZrWDFkYnArdGtZZmsyUnlwMlZxNno1K3cwL2hZVStQWWU2TWwvYmNKNml4bkV6 > Uk9hNmFEL0lNc2JOZXINCjFYVzNrdjNtQ3NDL2tQRjkyeUdyVGlqMHRXcGd5YmZvbVNDMWwz > Z3p4enU0QklXRFBXTUVQZjBRKzQ3ZWttVUN3Q2N5STZlNm1sRTgNClM4QVI1VEJPUHRETVZP > SDg3TUh1NU1rZjlwMmJzUEgzeHgrL2ZsVkMybFJQK1BsTkU4MXhmTC9GM0tYQXkxSVRSNGNp > N1ZRMCtQQngNCjFTZExLWU5Rak0yZ0xlbHJkcTVCdDNIWHBMMXFjTUxCWEFRUUFRb0FCZ1VD > VW02SU9BQUtDUkEzemZzbkpYWGtnRjRFRC80cytoMFYNCldoQ3VWV2xyc2hMOWNWdEJJUjMw > bk1mdmVNQkM4RkVJOE5wM2VDd2svQ1l2NjdCTVJ2YTl3eGVzWmlDRWhiL01qcXg1VUt0T1J5 > STENCnc3RmdSZURCZEQwZzJmdmFUYXY5Ny9sMDB5NkpRUnVRL2duQUpaUU1qMkFaU1BVY29K > dWg4U00xdmd5dmNpdDVmb0ZNdDZUampBTEMNCnRoQmxXNkJKeVc5M2ZlbnY0Vkw3cUlNMmZo > TDFVaG5lZ09UUHF2bXpOb3BhTHE4MC9pRHBhbjg3K1B0c0VwMDRyemY1c0Y4NCtFbWgNCitI > enQzSEorYTVhNkRGZDMxVS9Cc2h0cUp1cnZ4MGtXd3huMCtDOE1qdHFZZFhnS1pYNnliYzVO > RUhOcmFpMDgvcmp2dFVrMEhhS20NClc4alZJWGNsaUI5R3Mva1MrQityRnBPc2QrVUpkeksr > Z09OeHRobzZlRWsyV3lBbmc4NlZMV3RSN0p6NHhiQUFQemt0alB4VmYxOHINCnZMd2Jpd0pp > bERlVjlXYTQwWXdRQ3BZZlE1QXlFdXNQZXlnK2YxVjRQcVpGN0ZibG9yaDRnRVJXT1A0dS83 > RERkbzM0NzdnQmVvY0sNCnhlZU5rNzBiTGFLQWlXcDI5bVBGdUFBWjJuNkI4UjcrZzVTUU91 > dy85MUNNc1I1OXZtU2xmWDYxRUI5c2QzOFdmNGw3azNRRHZISDENCmtrc3pnZytDT3I3bnBm > VnphWlR3eFFNNkcvTWRNWHZrSnJJQW84eHNOczVtSlp0U3RXTFBPVFZlcnJ6UC82RHZ1b0Mw > YmFUUFhOTUUNClhRekliNDVDNWN4bXNaZC9vb0tIa3VUU2FzbjIzNkMzRE03akxkNmNUZ2Nn > OTlYbk12Qm5XZHdORmZmUWdid1hOM1g5UmNMQVhBUVENCkFRSUFCZ1VDVW5DR3F3QUtDUkRa > TnhDWHBIUEprR0hKQ0FDbTArY1U2R0IrZExjUDZlRVRmeHBrcmxsU3dFbGNJNGxxekxZSUNq > ODENCkpOUkFXTlcwcVJQYzJHejBQVytFUVVDMzZIOXlhZWxqd2pRUHRIZ1p0ZU15TkdEYXVB > R0lJVFdWdmFuKzNWQmkxa2tXbm9NSWtRUTcNCllxSWJMY2NlVGxKT0krUVZ3WnhHMWpTbTU0 > UEJZTkZGaGF5K3poQ1JpMUNoWUVHMStrMG5wV3ZkWW9RV2ZoZ2xIOW9vWlp5TmI1UngNCkU2 > M0dGRHZBVUJKbjVnN2paREpPdmdMZndIS2hVNEpsKzhzRHFKejhNQXhnYzJRZGM3cXByQ2xj > Vm5abUhERDh4MXd5YTZWUVB5NXgNCms4eW9CMDV5bENyNEh3bENWVmI2SmJnQng5QnB2YzVI > ZDAwd3ZJM2kzZGljRmpmRko2TDJGQlJqVWtraWphSzdLR09RSVZUTndzRGMNCkJCSUJBZ0FH > QlFKVUhGQVBBQW9KRUk4TzY4UjdSeGJKRlZRTUFMNEFNWjZ5d0o4cEMzdFFhc3pmTHcvM1lZ > RUVJcjRSWmYzQXVpMncNCkJsQjdqUitLOGJFc1BIdmJ5WTBYWnRVQ1RLcHN0UVB3WURtelBE > RHhPcHEwRHgrZkNhbEUyT1VlWEdSajJCeG4wNVRDZ0VmbFk3aXANCmdWN0poTXRVQkw2WGdZ > cGJ4aUtBK3JPbTV4YVZPQUVwSjdxaEhuSENaSkFCS3QxcC9xWXNPV1lGOEdCM1p4M0pFMjVB > NGl6TkVvQlcNCmdpYTl0OWlhVXhXUmRieDdHTll5cFhaNFZQV1I4ZWV4K3ViNU5oajAzenRK > WlVzc0czdjNsYWN1SVJucDFCVGdTVnVZbjdDa04zcnYNCm92N3RaZHhSYjUyVEhPZ014TG5l > V0tXdHQydW44ZlV0bWhCVVJuMjZnbk14SWY1MGlaaWNlOEhyRk96VnBiSks0dURYZi9tNUN4 > VFgNClA1T2JxcWNPWWdNcmxjL1M2bjFEelYyNWZBdXRFUGh0azFqRWU3dlJjdldwM2U3S3lH > eFJVa2JFZ1owNUVTZzNwcW51ZUVmb3ZwYloNClRObnltcWdwOG10NlB3ZWU0dTcyVnpoNGJJ > WTJleWkrdy9ERTlUUmhDWWtQOFNCVmpMTGF5cGtpUnVQWm56V1hLUlRqTFVPajdzeVkNCnha > WUNNcjd5MGNZZFZraUs1Y0xBWEFRUUFRZ0FCZ1VDVlh1Y3JRQUtDUkExMXBjSjdJQ2VCSXUw > Qi8wZjVPVGNQZXZGcDVjV3lJYkINCkYrcXVwdFdiRkhJbjgxVUZRL0lHTytFajF1dDZ2NXNP > M1VkUDF1ZGJXUmNTOXR2QXJBYzB5bFBBWW05NTVhcENtSUU1TytUbUR5M1QNCjZZSWRyRjRD > VHdzNG1BYmV2WHIxSlNmQ0k4V3VhT1dmMk53U0p1VkNPYmVlQ2w4d1NFaUl5Vm1tRGI5UjRN > eXRYSUFqVGtmZWxUZ3YNClAwNE1SSU13dUg5NjM5TVlIYWQ2RW5pQmlYeUxNbURmazE0QS9U > QVZwd1JGaEM3Y2owZy9VU1BTMnVYa3VqZkFWV3YvL0t6eE9POGQNCm9DUnRiV3cwa2VGNkY4 > MWFTVVF5RDNWbmI4VWVGeGlEZGhYcHBxMVZ5YkRINVl1NThYQ0M3YTNKa2RhTzBHV1ROMmxL > WXo1WlM2emMNClJWQm1yTk5DQXRSTU5zNVlqa1lud3NGY0JCQUJDQUFHQlFKVmU1SlhBQW9K > RU5RL2ZCTVFmK3B2dURBUC9SUUNxL2tNVWVEUWxjTEUNCjNpTFBOdFYwQ1N3a0EvRlp0aDZl > enRvMXRpQUZ2OEQ4cFNqMDQ2TGZPZTFlUmVDMjNlRU10bVJXa0tmMVlKQ20vS1REUFNwWDkx > eDANCjNsNU5jUzFFN2ZsaCtRZmRlOGlRdW1SNmFuSW9GN3BjNG5ZQUVxM2Fwcm91WmJOS0FG > QlpkNDFBajdQZTN5dDR2OGJSVG9SZWdudEgNCnMvWkljTURwbzFZQlprVkNkM1c0MEhMM3Az > SXNhR09zS05vMFhkaVB1K1lhVXd2OVZLSUJoZWdvS2o3RXlvWjUzRVBBVjJRN0tCcXANClZE > NmxqMUJ5VDBjdERTWnFrKzRUaVBrUkVXTXVCcDZhd0RMNFdZRVozVndDeEFYbWI2bUZ6Nm1S > ZU5sWExjMWpOUDJmN0xQc3dsTk8NClUxbUpITENqU0JEdkdXMGxVYXRhYnRCZ0pMRnp2MDI0 > UGo3eDhvTlY2YTBnSVRqWE5teWhCUUZoWFl6QjB4d0ZYMWNzWE0zbm1tU3INCjQ1ZDBxelVL > UXdOQlk5VmVYRXpQazN3VVlQaHRMSkIzTkpkcXhxbk1sSnlaU2JZRUhndzkvdk1YK1dGNFpt > V09PaVdoOVEwTVJKV0ENCnFyWXMzdm5mdGtLbS9VUFhna0xUYWN2c0FGeENSWmh6bG50UkRE > b3B2T2J1SUhvdWdwZCt1TkhTL1A4NHJGTmVMQUttYUROeE1TRVgNCkRYdzNKaEpETXJBMTJa > cllzc3BTbkYvUnRwMlc4UlE5c3k4RUpHaXBaTEtROG85TGdBRnpKQkhVaTFzMFV2cjlzT0k4 > TG5ibS9lUEENCkYzSGVwK3d4bHpFWjdBdEU1bGcvVDhRWi9CNUlNUVRZVDBBaUJqMUFlZHZw > RkZSa1M1RGhGUXFGNFRhQ3dzRmNCQkFCQ0FBR0JRSlYNCmU1TUFBQW9KRU5FLytEZE95M3RD > TzJFUC8xRnlRcDV6Y0JrZFNKUkE3NHhOVEw1Z1B5WVZXdjhEeE1MNi9oVS9IMUp2QXZZL2xE > SGsNCnpaK0hrVWJYRUcwZ3FJNW9GdXZPaUNYcFVobGJNbG5HcXJXbDRQQW5kMXFLVTN0bmlK > UDRRaHh4VldEOW03VlBwaUJoYjZ3R2RBT3ANCjJmMU5uKzYrZUxTN3YvSU1BMjlDRWRXMit3 > SHNxeG5WTEo5S1lNZ0N4NTl2YjJxRVMrcU9TZ2grS1hYN0ZpYTJGWHlwanBrejg3UnkNCnlN > dFBGcnd5LzhzdWZ4QWhZODlxSW1QWi9aQVg2Q0FaR2piNFVBbnVlWTdVTG1xdStHVDRIRjdx > SHg1RUU0b3c1TURTb2NPZGE0RmYNCmZDTFd3VDZja0lhRStRUEtEMVB0b3g2c1RhZ1AyaWxo > V2ZRdWJTMDQrbTJiZkFCUkhHUUVSUkhyUnhmTUdZY2pwZzNQNUVaSlp5eWoNCkVEcWdsaVRp > aFdMUDVTRUg5QXl2Nmw5OFpRL2ljSUd1ek1mTVlvdFIvQ0VUK3lRRDVUVGUrYU1aOEdyVUly > ZXNCMkxjaEk4cDJ4cFkNCmhlVC94dXd1cnN6c2RrS3pROVE5ZTMrYURDbG5lZjlNUFZzTFIz > cXFPcG1DbDdQb1dQcHNlTTVneFRPWDBLRER6NVdYRmNURmRFKzYNClFaQVBWZ0hwQmY3KzAz > R0pRYUhMZjFaVVJHUGZ1RjFnWWNWeXVndGQ0MndMTm5zUGxUemJqVkl2aENJVEt0aE80NXU5 > ZjdLajRwc2INCnhPUXYwZjUwc09aZnVoWGZHd1l1bElXeVQ5dHdYdFZWV2VhdkpjSnF3d0Nm > K2ZNUVdvbW5aemtGZndPYjFLb2NiU1RnaEYreTNTbXoNCjF6L0h5YVBxR2ZqZklLV2k1eHJG > SjlWYXdzRmlCQkFCQ0FBTUJRSlZlNUtLQllNSGhoK0FBQW9KRU1ndHkwQlRQMHM3d2NZUC8y > RkwNCjBRM1JRdXVZT3VUQXg1NlJWd0FlS3lBeldBMGNIc1ZZcExmekY3VWRRUkFLNFM3RGt3 > enZDbmpPbjFCZnA0bUFyNTdSNkM0WnNubGkNCjBJTmpHNXY5T2V4bEUzeFk0eGZqQ0tJbmE3 > SXVqN0ZXQmp3OFlTODVlc1kxd3N5VmgyZGN0UUVpWWMvUUFZUE5zSnlTUkZpMGJleEcNClgv > cDgxV0V6empLVXpCOUMrODhKNHVkaWQwRFFTOVVLeGFCTG5ScmlnbkFOSC9HTjc1S3kydTN2 > ZGJiZnFTb1RpS3E0dUtTYVRuSTcNCk1Kd3VuVUtqWWtjSnkwSlhiK0owVjhxaElyL1hWb0NT > MDA2dlI5b0RvOUZRTXlPZ1VYbFltbTRZS3ZTL1U1aWREb2VxdkZXRTMyYnQNCmZHZGdoYjcr > ZnEvOHZObVBDcFkyTUlSNUtFbGtmRmQ1SzVxTmNqbHZGZmtNVkd0R3RxbDlhQkdVb3hOQnVM > WVhQc2M4cmpFOXh1VHcNCmF2VWFaU0RhNk5vTXFBNXU0TnhVNlV4Yld0bnUxeWgzR1lMcUQ4 > SVBxK3hsOExqbkl2eWUvNndJQS9zeUdLV3ZXSk1DeDA3YUtTRGoNClkxR1htRnh5VWNrRDRy > NG5ZSUt5SWJlVTh4ZDNSYSt1OXMvNUM3N3lhOWpudEw0Nk9SU25laW51OE1mTDVZQjh2c0tz > TmNETlhCSjANCk05SHBJT2lVM29DSVplMkp1U1o0VFZaTFJCOThDRk1sTjRYRmF4QSt4V2dS > ZG9QWGdnZHVtK3NHSXFiWmZmTFI4bk15TWZjU005ZXINCmE2cWY5cUhLMVBadUJVN1pSbWJh > S3pMMk1WbTZLaE5VTXptQ1N0U1FiOWVNS2FNZGVVYmk4ZmhMenlQdUNaVGxucFE0cGo5WXdz > Q1UNCkJCTUJDZ0ErQWhzREJRc0pDQWNEQlJVS0NRZ0xCUllEQWdFQUFoNEJBaGVBRmlFRStS > Yzhzc09xNm5wY2loOEpOZGR4dTI1R2w4OEYNCkFsK0Y1Wm9GQ1JEZXhpc0FDZ2tRTmRkeHUy > NUdsOCt4WHdmK0tkSHFnZjh3S3doa1lYR1FTbFZhazJHTlVhQ2E1ZWM2Y0xRUzM0VWgNCnVp > blY4Q1hyNytCenV5THp4UThadDFJeUNqRUphMVM4d0JZR0dRL2RDNGpIRXFpdE5iTVVkc3RG > dllGcEVmM0pycnUwTVJGNVRuK1INCmxnSisxVWZaSE81endreUFyUVhGVEJCeURsdGJRaGl1 > N3J1OHNTQllScHhhaDFocjlwcG9PM09ZanIxQ296L1pYMVAxL29hMlIzanUNClhvZnl6UzB1 > emRKczRUL3Jzdi9EbElvcjJwd2JvVE5ucHhsU0RtcURNeHhEZFd5RVFTa2kwZ0JuT3ZYSjEy > MytmMDFOVjlFUXVXTzYNCkg0eGhLOXFvOG9jNWV0bW02R3dVVmxKeVhJeHdGY0ZIR0phZVA1 > dFMxSlVWS0cxcnFONTNEZjE3MzVFNUptMmVITWh4eWV4SXBzTEENCmxBUVRBUW9BUGdJYkF3 > VUxDUWdIQXdVVkNna0lDd1VXQXdJQkFBSWVBUUlYZ0JZaEJQa1hQTExEcXVwNlhJb2ZDVFhY > Y2J0dVJwZlANCkJRSmI1aEw0QlFrTlB2T0RBQW9KRURYWGNidHVScGZQUExZSC8wbzZZZHV3 > SEZVamZHVi84bWhsYW8vVEtwaTYwSUF2M1VjOFhONTkNCkQ2dkdyVEl1N0VEK0hDd01jQncw > MFZZc3MwSGZpUDVxQU1RQmFmbTFQUlRkOGtyODA4YXVmeFljNkNoTHRDWldyYitDZjZWTGhS > ZWcNCjhYcG9aa2h4ZzRudE1OVWFsSFBMOXZHWjNTTUNQMTIxNlFJTUY4SWM5RXRrUENBdzJK > SXphdTl1V0NWdVIvZVhCZ3NWVS93ZjlTMVANCmdiN0tnMTZoM2NjeGwxMU9QbzhkNVFLSmhl > czRXbUxhR25pM1JqTkVIU2FWRGtEZHgydDQ1Wk52ZXVFaVBYaDFxY3JtSXB4bkh1L0YNCjJt > UUs2SnRZSXdzYjhlNzB6cVZZaVd1bFZZa09ycWVMeWF5NDZZNGRONis5Vk53cStndXlpK0VP > WlNqbWJEanBDR1g4WVp6RFh4YkMNCndGd0VFQUVLQUFZRkFsZGNVVUlBQ2drUTVmZTh5Nk85 > M2ZpUGZnZi9jL1VHOWNCMmNvMW54UnhBK2NBYzdybmRLRklZdElNb3lsbjUNCllYclZTdklQ > aTQ0MnNzTkxCeDF6WmhucXZOaXVxemZiRncvUFdHdTg5VmdNamJVbTc2cFdIVnprK2trbVVw > WDlNTGJDa3lyY0p2R1UNCmNVZTEzSnJsajFNWk9mT2lsQmhFVng5WmFBL3d3WkdzTGhkbFNT > blc1ODhYMnVmVzNUWmV5cG0vU2tkSW9ibmI4dGFiTm1OZVdvVmcNCktLWW0vK1Z1d3Q3ZjFX > RnBoVi85RFpJOGhDM0ZOSFp1a0EwVksrZmUzL1Z3ZVpEVlZyQTk0V0NKUlh3R2pDcXU5VGRU > N0lhQ0duQTcNCnM1YVVWdXFJU21ENGpjYkczaDZmUm1WaW91dlpWUjR3bE9sVFBzTk5BVmh1 > VkZzM3ZCYzVxRFRRLzdoQ1JWZk4zRXBiK0xiTmVoMXANCmdjTEJYQVFUQVFnQUJnVUNWMXht > ZFFBS0NSQ0VoR3J2Wko1VUxLUVpFQUNhbm5qZGRIeGlUYzE3QVRQREJYd1pzTXpmdU9icXpK > OUUNCjRmNkYwWUVIR1ZQQ2Z0bVlXMmpqZVd4SE82QXc1ZStBTm0wN2kySHdkNEVqbkg4YUdL > RFEwemtsV3dWUjNkY1kxMGM4N3RrWHJuRkwNCjJpZFV1WllyK2NJeUZGVEZrUE4wRjAxSmY4 > VTFYeTNrcllNRVJzMWx4bWY3U0h5anltMWlEVjhNcGlzRE4rL2Nvdk41SXdJVS9iaWYNClRy > WkRJbkxNM2QrTmlmU0VLYnFOK2JVQzJESHM5TE9DdDJUMGJxNjMyTG9SMU9URWZyTzZ6WXh5 > Qmdha3lMUmFjZkYyUXN4NWdOelYNCmhESEZaU2RHdWwySnVyN1RzZFVaREdIcStRY09mTVlq > RUxtMUpFZ3dvaFVMaXBCZUdMaXdyVnd4QnhBVFdFM2p6MVdDWGJzRldXN0ENCjVrcU01eGM4 > QmRsdy9rLy9pNUNUQTFvWGF6Q2VWUTcwT242bnI4WlZrMkhPTXl6bFJGVC9uaForOEdHSCty > a0tkRG9ETkRzWTJWMkQNCk5kWVc4aXZUQkFrczZERC9ycEMyaEpoNlZETTgwMDYzTzdHcGJS > QXF5OGpZZ1gzaGgvaDlaZ01VZ3dGTmt2b28zeFdodVdiV0lwQTINClBUT2x6VUZValA4Nldh > WURLblZCWm10ZWovUzhuSDdML3hSUVc5OUsrSjNkUjMvNGlqQjIzRGlsNVZmOG1KMXR2Vno1 > V0Z1UFE3RlANCnJIZDBTWUdDdno2b2NmSVVBd1RZZWozMXdXbWRaNHE1SUxPcXY2RXE0K0dN > UE1acW1vK1VyMEdiWkVtVzhpOW90bFF1T292TXZjUHMNCjJBbEhxUW9uWlJ1dGRMazc1dmxm > S0dXbXpYQmpGVkpBMURXSy9zMHJTY0plQkJBUkNBQUdCUUpYYVVyN0FBb0pFRXczOHU4ZUFQ > Rk0NCmxiSUJBSm95SzBSRFlIQWhjVXBQMUhsMEFJbW9vR2FKeUIzSWw2RWxVWEIxUzgyVUFR > Q2k4ZkdtSWxrSmJVSDNVWHRBYXBMWEFIQ3ANCllEd3pXWnF2SDM1eHlUVFVoc0xCWEFRUUFR > Z0FCZ1VDVjJjc1JBQUtDUkR3ZHJiL1BwZ2tUVm5LRC85bmVvM0x6cWJ0Z0JXbDl2U2QNClJ1 > dFdkUjNsbVBocC8zaksyYXpsU0hJMys5NTBqclRRVmd4SWFiQ1RiWmlKYzYxdE9mdXBVZmow > UllWTUJSdHZTUCtZSUJCUmJhTzcNCmdXekh2Qzg5UUEvdmhBdlErakMxTXM3ZzhaNEN0NFBC > MXNDdXJjMC95KzRZOHhUcldlSmVNaHpvMXhuNHJjVjJYRE1wcllOWm1vV1kNCmZibjhJWWlr > Sm1CalhRRHlUTjIxb1IrUHRpZ1VhR3QxTGpUZDZyQU8weWg3VFJLSDYySUViZ3Y2QkFCNHBP > MWpDY1RXWUNxUk44aXgNCnZTaGF0eWZaUU9qWk85U2UvQmtkRHdVUENxeWtYT2lvVElPV2lN > K3I5eU5FWWI4bVVReUtFb2thTWVkR09pQU00UFhjYmRwdHRXYzkNCjJOVnExa3lRNWZOSUZE > SjJQOEQ1cGUyRSt6ZmJVeHNUOGlyVWxHTlF1b0ZxTVNiYjZKTWl4ZnBJeW1vQ1BMcWVDdkl2 > dzJtbXdjeWgNCkJLZGZRbnV1RkxrZ3g5ZTVKWExVQ0czTzk5RTlzMXJseDl0WGw4QTVkc1pP > UWloU1BJSVRkd3ZGRUVYZEZmVFB4K2M3Y2VEcEZDcFoNCnFQdDJBVWp4TmxtTHUvbTFlTWZZ > NkkvV0czanovVmtwQXdNOGIrZFgxVXEvSmJZQXlPdjl0OFJvZ2pnSmtITmt0dnZMZHNKN3lm > K0INCjVqSXRBL21EcnVpaTN1dk8wYmRBM2JrU3pxTjRpTEk5QmU3YjUwSTZlNHRJN1hjOWl0 > b0daRkRmaG9Hc3lsUko5VWFtQUd4dWNGdCsNCmlZMnREQXJMR2lQMlEvUWFuY09mdjVTSytC > YnZtVmNyMlRNMDIrbUsyYzZlVEwxNGxGRmZRdmVVaXNMQWZRUVRBUW9BSndVQ1VtbUwNCkF3 > SWJBd1VKQ1dZQmdBVUxDUWdIQXdVVkNna0lDd1VXQXdJQkFBSWVBUUlYZ0FBS0NSQTExM0c3 > YmthWHp4QVVCLzR3K01YZUxTakwNClVESmxNam9jOWpUWmVJOGhBWTlDWklnTFZyb0l0anMy > Q2dVRUZzeGVVWVJ1WkVkM3JUdzNXblNzcS9acTIrUHo5OC8wS0IvRkNleGoNCktrcWd2emxX > Yk15dVQ3Z1VscmJNUGdscU5ISFprQlQ3OW1iSXhTdkR3OWRwUEFma1o4Y2xUVGpwSVY4VGpP > V0lMM3hFZmJ4QkdJY2UNClBBWW42ZzUrS0FkUjk3V0hHQVRuUldrU3BJZVpoeG1RNmY3RytZ > NWlTWlFzVXNwdWxtcDk5UlhsNERTRDhOdFdmM2VIRUpiWmhkU00NCktDbjluRGx6UVIrS2JN > bDBMc0FrdUdvbm1EOXFZWGx1REtmWVJFK3pSdkgvdUNrNGNZVUlVY0ZlcGhOWlpiR0d2M2Mw > RytDTEJlSFENCk1XOWN4dEoxRTI2Uk9DVEorczdoa25PalJWc2l3c0I5QkJNQkNnQW5BaHNE > QlFzSkNBY0RCUlVLQ1FnTEJSWURBZ0VBQWg0QkFoZUENCkJRSmE2TTRuQlFrS1lIczNBQW9K > RURYWGNidHVScGZQYTRRSC8zOTVZL3JRbnlBS2VwV1plaXQxYTk2OEgwOFRtSXlLOXhrVml6 > UDkNCnVBRXpQK2JBcEY1QytUSlZ4UmJjcEM1c3NSSEkwaGpKYkhXeXlYeStXYkZTQWlaMUV4 > cWJ6UkpNVFQxWTJRVjRoR1lFN1Vwc1NqcEoNClRIdnFnODNhWFpJV3lRWCtDZHhjQ0dDYlNV > VHZBdWE0S05kMmVIeU5WSUpFb3hYZDJzVnJmU3dmM0ZodGo3Q1gvMHB4NFdldk02VHkNCmp6 > WHIvWnIrOFNSbGRkd0lWTGVSNC9DMU9IRFZGTnV5cm0vaGR2ZGg5eUJqR3NENm9xbkx0MkE0 > Tm1ybDkrRjgwR2hkM2MvOFRUUEUNCkpReCtObVJWNVRRQ2MxcUR1TG5kSXpWbkpmR1lxN21U > VjR2U1ZnUzNhbFdnMUFGZHZZdWp4MVpubFlianNFUzF2MWFGMzRPVk5Qek8NCndFMEVVbW1H > YXdFSUFLSlVVOStRMTlvVzFSSzVqVGYzbTU2aitzekljOFk5RGFMQzhSRVVLbDRVWkpCS0Jx > Q2w2YzBjdWtWQXBPRDkNCjJYb1U2aEpQbTJyTEV5cC9JY1ljUFBOVG5WdThEOGg5b2FnMkw4 > RWlGTjcrMmhrMHhHK2x3amM4dU9JWnljbWU3QUlKc0JVNEFaMXYNCjYzbHhtMmsxMDRod3Bp > YXRnYmU3MUdJR2w3cDFNWDZvdXNQL3dHelhDT0YyNUR4OXcwMkNlUmU3ekVNZmhuRmpTVWh6 > ZENDOWhhbjINCitLYVZCN3FJcU5SM2I4TmZid1JObHdQbUhxbGhYZmZVb3c5T3NRalNuVEs4 > V0tOUmx4N3h6VmNjWEl2V1Ayd0VDRnJtcW16TW1YcFMNCnJtSXVpV0VwRndaOXgyYTBQdmE4 > ZENOUmlDVlRLNTFJbFJYS2phQXhpTjF1SVVyTW02VUFFUUVBQWNMQWZBUVlBUW9BSmdJYkRC > WWgNCkJQa1hQTExEcXVwNlhJb2ZDVFhYY2J0dVJwZlBCUUpmaWVNSEJRa1E0c09jQUFvSkVE > WFhjYnR1UnBmUExKMEgvM3lPK2VPZFN2eWcNCi9HNkd2U2NHN3R1RGMrZEhKdGdqakIyRjVD > OUsxc0NsVld1eUVmdWwzZ2RBM2NTUUM1WnBZUDl2YmxDZ1p1Q1ZVSlc5cHg5SVF2cTgNCjJ3 > SWcwNTFvR1AzODB1ZDh1Skk4R2NDck5aNWM1TjNNUFNpWVhpVjhUUEtNcmlXSzAvZ3RYNllG > RUs5QzRoMEhDaHd3djl3MHF2NzANCm0zbUk2YjNpbW14RFVmUVJud2R6bGJ5emxhQm44S3Nv > SUhoUmhPK1psZzZuYnMyS1VqNmw5STJIMndhdDByK2dlbEVqbDY4VVlRdEMNClhKL3VtdS90 > REZxTno4b0tkdy85d21IK0JBOFBTQnRQbEZ5R20vdkdMNUtQU1NmRzFiRkFSUk5nNFBKM0k1 > RzB2aWw1UWd5VFFDZ28NClBYN1RUUUNjNWRITlg5SmpCYWYzamFOUTZCUEN3SHdFR0FFS0FD > WUNHd3dXSVFUNUZ6eXl3NnJxZWx5S0h3azExM0c3YmthWHp3VUMNClcrWVMrQVVKRFQ3empR > QUtDUkExMTNHN2JrYVh6d28zQi80cndiRHFYYVhtNllDNHMwalZPZjErTWxqZVFJc2JIUFZR > WjBJUmlnQ3ANCnpDRFNVRlRLUU9lYkE5aVVqOEphRjJEUHdkNnNqeVVVdi9YTUNMbCtTd3pT > aWptVk4wS2ZrODVYc3B6TmVmOFhtdGVLSzFtRVJrWW4NCkxXQndUTndwNnFlemcvQ3VrTmJv > Yk5IMDhjaVQrejJmeHRQdXdxSzVYOVE1UjRRN2VndGg1WFVUeGJ3THdJSmVyRWZWczRIRys2 > ODcNCm05aDFiV3lZSmVtQjI0TWdCdThmVGFWeGFzOGRTU3dESGFiZGd5R01LSXZxREhVVUpR > U01EYmlvMEl3aHM3bHgycDNYZDVCcndRTE0NCmlhVVBuS0JIcWZWTThBRFdsZHZIRjZ4YTlr > ZUJVam5FZWRLd1FOallmNzZsR0g2Ykx3YnlaY0xpZ0tGZFhZMVIyb29UWGkrUnhzRk4NCkJF > OS9LMlVCRUFDOWpjSnpEdHQ3TGloL2Njd3Y3MUZIeVZMOFgyM0Zzb2Ewb01IS2h3N281UDJQ > cVJmengzT0tWeWp6R1VUN3d6cm0NCldvWVBielhyUE1RbEhVTXEzSTM3RjJxMVhyQjYwZ2Er > aDhKcHpyeWRQd005b3BESUhhR21sY1lpdFRGaWdqa28vR3EraW9XK1lTTXINCjAzbEt1eHRz > UGdiMEdjRFBrcmhxNHNOTUhNWFZ3M2ZXQ0lpV3RTSHpocjVwNkFUamgrZ3F4VFFRN2htclJD > SVVJY2grUVFvYUJkc1oNCkk5bGVFV3djdk0xck0rQlN0Rmh5dTV2bmJkSlZwVEd1RS83ZmhB > eVYvTmNmMWlOMVVIRGk3T3cwS3B0TXpWZTBFTmtNOVFMdnBESzMNCkFyeXg1UFlVcHRTeGd0 > blJETHVSd3NvOHJzSFpOV09CUUFqUjlqS3B6WDlucWhyNGJWVU1sNjI5S0JMcXdzWnA3ZTk0 > Z0NPMytFWHINCjRMbitrL2FYRVoxM2o2Ky9OWmNtc0o5bnVOSHdrYTI1eUVWQ3dCbDRGSSs4 > UW1KRmMwVk1IQ2JaMytweW9XRFJpNFdXSmlNMi9FTXUNCnIvcXl4eDY3aDJEdXZxTVZDNXhy > b2hWbzN4emJmT3k4WW4wUCt0S2pMbXdseWtnSXlGUE4wU3JrVm13R3A2RzhZa2xnSDZYaE9K > SloNClhLaHpUaWN0NnQyNkpteEhrMnBibjEzMGF3dlJXTnVCVUhoUHRrY01uK0ZSZ3pwOTcw > aE0zNENKV3QrckxnOGkzTW9ibGhLMENhMTANCmUzL2szOUd1RnZpV2tkT1hsOWl5cFNSVXlp > MlNLZ0NWNlNkbmN0T2pLWWtiR2JRdHpQVDBZdFBva29EVHJQZmp3OWlSQndJaUdTMmQNCmhQ > ZE5wV1hKU3dBUkFRQUJ3c0ZmQkNBQkFnQUpCUUpWYmh1d0FoMEFBQW9KRUc1NEtzQThtd3o1 > VHI4UC9pa01HV1F4eE1YTXZ3VE0NCm5LNG5SbW5TSzMxUHR6b0JxY2lCU2dsc09RNFhjY0Uw > SEVIMVpMUDMxYmt1R3BFVW5oaXU4VTl2Nm43M1gvRTc2WjV5ampTclI0YWcNCll2bjJQM3h4 > elEzUXluV2dmVktKNlV0R2UxSTFKcEZQM29aYTEyU0lGbTR4WGU1RmpiREFhMDU0azlzVDZK > Vm1wK1c3bjdzWkgyVmENCk9ZNHZWcENLWHlnT25UQitTSGhSVFRoUzlVLzh3UUxuSy82bFI5 > N2VqYU02ZXJIN1lkRDVDYW5abmpJYUhuMjJxY3R2TWlFS243Z20NClh1eG84RW5KRkwwUENU > cUNFVWxZU1pOcUlqZ3Q1YlJFK1RSaURYS1hocGlHN0FNOGJKa1hQSXdKMGY3RlVUaWs3aHMy > dE0yaE5aWWkNCjVHR2s0cTZGZHFWUUhCQkJIYXpyVUJwOHRCMlFubnBsYnBFeUtiSUlMNHVJ > dEIwNmYwSW9selVTMEJlTmV6czkxT051ZW5NUTAyVUcNClZORmxjWTdDSE8xQmEydVVNaTdk > VkVhYXpGd0FBVWExVXRkNTFQaFdkUjM4dksxM3EyYzdOR1VCaEhKdklPbDR6eXVnQ05JUDRy > NW4NCnJLSGtleFczZnlNMGxqT1ZVLzlRdVFjbkRUSHlHUUJ3ZzVFOGZpa1p5K2pXWCszUURr > ZVorMitPWGtZbmQ2ajl2MDIwekgvYmJORW0NCmZ5VzFjNXA1K0ozUnlyYTU5UGNoTWhoMDh0 > VGc2cmlucHRRciszalJLc0txMEZYOTM3MTdRN09XWFFXMEE5dUVBbEYydFRyblROb1kNCmww > NzJ0cGVqN3M5Qlh2QXA3ZERVMVMwejR4SXlmaElOVVU2cUdzWlRUMGswYkQraDB5MlNleFMy > TENPYXpTQkNjbmxoYmlCRWNtVjMNClpYSjVJRHhpY25saGJrQnphR0YwYjNjdWJtVjBQc0pG > QkJNUkNBQUdCUUpQMEJ6bEFBb0pFRmk3bGh2UUt3RjVlNm9BbDBxcm9EWU8NCit3TStNWGtv > NWU3YStCckpIbE1BbjIrazNkUFhGN0ZnbTUrMnc1NlFQeTB2VVNMSHdrWUVFQkVDQUFZRkFr > K0RTU1lBQ2drUVdsTWUNCndLUGRzVlVKWUFDZEc2bkE4MXROMWM1NE5vdHdORzZtbks5K09M > TUFuMmJhaVBSenVrditiUS9FRGVuRHVPcnZ1MmF4d2tZRUVoRUMNCkFBWUZBbEdYemlJQUNn > a1FrMTN2UktDVEppc0VPd0NmZEoyRk5ST1hRcXVmdWlmblMrSyt3aUdycTdrQW4xMHdkZ2Fn > Zlhuak9lUEoNClZZRStWWlJvUEppdHdrWUVFeEVJQUFZRkFrL1FHZjBBQ2drUU5oeGZjS2wz > TGRNbWVnQ2ZSbEpWVE9LVkkxR0pWSHp6MUFmS0hnRFQNCktXZ0FvSmJxRHkyY0xrbnpzRHYr > eThYdlhjeDJqbWc1d2tZRUV4RUlBQVlGQWsvUUhVUUFDZ2tRWkpQWGowSkYxL1ZOandDZUtY > ZUENCnNPK2g2ZEs3WnQ0aW9tUkp4aHhVMzBvQW9NQXJZa0t3N0dXTUdYWENtemlWRllYdGRu > cXZ3c0JjQkJBQkFnQUdCUUpTT25YZUFBb0oNCkVOazNFSmVrYzhtUU1uVUgvMlBOTW5ISnh5 > eXlhN3JLd2dVOFNLc1NidkdDc2NyM0FuNkh2bU4vc3kxai9xTUxsVEdoNGptMyt6bmUNCm5o > TytwQkxLNUoxcjc1VngwSTlFNXdncnN0ZmxRdXhoa1lvanNnWHhrSXNhdUVRdDc0aWw2eEVq > S1BmWmVaNWhvVTdad1RwSWtpYVINCnpmKzdFOUhhc2dzZ1UzMyszTTh1OTFDMExGZzZDTXp5 > YnhydDlBU2RrR1RwTHloTkdqNW56dm9aSktqVHNvdFArK3QyMkZSdTB0Q08NCnVKVktBS0E2 > UzEvV3VtSm9NNldtbFFzdC9aS0Y2SjRoT0V0eGZSV1NRblY4aHBHY0RTRzhhZFAwOFdobElF > bjBmd0M0LzlWdXA2WjcNCmk3OC9UeURvMDZrckZRNEprdTY0RytlZW5QWkFsaFJ4UE1Xa0VN > MTA0YURDR21MVjVBMWg1MzNDd0Z3RUVBRUtBQVlGQWxKcGk4OEENCkNna1FOZGR4dTI1R2w4 > OUdJUWYrTUsvQnVhbFFBdGlEQXRwckdmNG5ieEptd1VxLzFHM1pMQnZoOEhPbzFOL290N25W > RGViMGZVS1kNCmNmdy9TYi9WRzZFVkMyTmJBNlY2QzF6TDV0N3c5OFNRbVo3TldkK2RCQ1BE > ZGhkNFN0TjNUVm1qaHJTWStybzROVWNCQis2TlRDU0wNCkhBd21kRnI4bG1LWHZ6ZC9VQmpO > M1JwcFZEckJEYmdTOXF1UWNVbmg2SGhvdHh2ODZDSnc2K29WL2IyelNtaHoyOFdIK2piY0k2 > ZjMNCnVYYnptRDFyelA1MmluTjZocXZQVlk0TlpvcEpSMFRBanRkUDFVNXpNVUFOcks2MU5i > UTQremlBTXFxQUx2bW9YU21PS0p2WUo3dGgNCmJ1M3NnZDY3UnRoTE5KMWwzdE02NDNFTDlP > cGdkek55VG04TDk2eFBUVzdKSFM2S0pmVE5PQTN2QmNMQVhBUVRBUUlBQmdVQ1QzOHMNCmNn > QUtDUkJmSUc2UHBPdFFoZWM2Qi8wVEFLbS9EbGNOeFFMYVlwRnJxK05xUUZBZGVYNG95NXly > WTdmb2FuQzA0STYvN1R0K3FQbHINCkNyeE5GR3NEUS8waFVnZkFTb1o5S1lEMUFYQ3htZTh0 > YnQ0bWtYbTRSdGFiWEw4cHFUcTc1allLNGRGelMvZ3hkZUNnditkeUp4SHUNCmpvL1lGRU9K > VFlZZzBmZUtGVG1aQ0VVSVpMNzNQODR4b1VyVEwwRlZKZm9rNk5qYmtocHZtSUU2bmRIVDVy > blE1VTlDNzdLSDF4UGINClczeU1iMW1qZW51U2RWdTlSRFRKUWRkZXRmOTJPa21BZE5MOHBS > ejN4TWY0dzdud284UVdza0ZXM3RaNVM3ZnBRcnJDbVJVc1lBT3kNCk1INFF5Y3k5Ri9rbHZo > L3V4amlEUmlFeCtJcy9SWU9FVnA5S3Blc0hwR1RrSERXbjJFaThqdWs5WHU5UHdzQmNCQk1C > QWdBR0JRSlANCnM2SnFBQW9KRUNybCt0QUdTa3ZxNWx3SC9peXgvR1kzaUg4NFJLYkdmMERE > eVNlWVRCSGZoTTVNMHA3bGRYRmN4R2JkUjlteHFYZHoNCjN2UEdPNG5wNGthUnkzQmVrWGdI > T2Y4cjE3VkROUHEzSGV2YnpJWDY0T1lieXBPcmNmN0FXWFVoUW5FL0lpZDgrMVM1cHNDTW1k > dm4NCjFaUGdYZXdUV0dWYk5mVkZlNjVpcHNhTlNjR08zOElOMGU2YUJaVTBaSFZ1dUd4NWtV > bldJUFpZZVUyM2lyMERGby83ZnBrYm5TMXYNCjRKSTJ2SGt3Qm81VlVjNS91cVlCNEZLck9E > b3lPUTV0Y2tSNGZndHM0RkM5WXNaNWFwc0FDN1g5QUJiT3VZVk4yQ3FDYTZUZHFXclgNClBS > ell1cXZBcW16T21wVURVRkJtRFpTa1BhRjluNWJieWdDYXBXeGVEaUZsZnNxMGxMNkhTNTRi > a0M3NGlWTEN3VndFRUFFQ0FBWUYNCkFrOS9MeTBBQ2drUTloNHAyTzBEVVJmVU1oQUFtUG1Q > YlFUU3pDYmxGR09GR3hSeUhzSXBTRGRQb2VHZVNqeTVYWm95MW43ODlQem8NCmU1aXJuQXhS > a0w2b0JrTXQxSDZTUjNXd09wZGx3eTRqT1l4RFJSM3c0NnVPY0F1azJKaXlFRjllZUsrc3VW > RnNjV0RJTWZ4c3I4WmMNCmlndVRzZDdNUDBZa3NXcWFRdWhZM0pybTdPZ0hGK2VqMTNsUDYv > MlBKeTR4dTN4bEI0a1hlYklhaUJTejkwcEtFRTRSQXFDM1VrLzUNCis0SEp5dXFCNjRDaFZa > RXNubW0veWt2RGJ4RmxueE5OcEF4bFpnQmdobi9GOWdBVlhMOWF4Sk5uMlM1ZUxUQVJpWVhN > L211Q3pUTmYNCnBJMEJXWjBxTnk2SlJVWTJydWx1aVMvT0NQT0NxV0tVeWFYVCtNV1VTQ3VD > Z2lnQlVON3YxaXVOeFFycHNrT1pTQUlRdjFCMms5YzINClNQQXVEcHlCZnRlT0RHOXhDdWFz > NGJpUWVEYnJ1TnZUWkhFRDRBVzdnNWx1YTRVTmYzQitTQ0E0RGlRUnRoWEU1RXNzL3V0bm5H > VHENCnR2aEtsWDZaVjVSM040NS8xUmFVRnFOeFVVaTlLRTMyMkQ4S0s5aUo2SUZBMHVvbnFp > YjFMREZyZXFtVVJpQzFEOUxhK1QrTm41VSsNCnJJekhMOTFrMUtPdW95bUhJOW5ZVWtqTWVh > Nm1oRXp4bWpsaXYvTHhsaDhHSjdGblFsZEFKNnZiQ2VNZ3BjbFUwTGJjQzJJQnpmb0UNCnMw > R29kN2U2cWh0RG42dGZIRkx5MFdCU2JFcFRlbyt4Y2N0OC8wYkJ5OFdSSXNvY0tXU3JjQlEw > a2RnVUNwbFZKOFNhWTNkOGJETXENClFnOWY2eXVmVkF1OXZRSWdKQkhSUHA0UDRCakN3VndF > RUFFS0FBWUZBbEp1Z0pzQUNna1FOODM3SnlWMTVJQVQvaEFBcGNwWjgzc00NCmp4SzBLVnNU > Z3o3ZE9ZekVFR09yc3Z1bFp5WERwbjNtNFNmczkxRXd6QlZxYU53QnJXUys4Q3FNMFR4c2pU > NU42MHRMdnBXRlF5SHQNCjRMemVvTndTWXRRd2JtVy8xSWduc29tMm15eUZucGJHRm1tRzhC > c0xoR1hWTzNQSnQ1RUdBOS9rR2pmb09kanFOcXFuNXQ0OFZ4SzMNCjFMUjY1NWVVc1B6MllB > SmxkL05VTDFDVkNVbXdXVnVucTZvT25oYUYyMUN4REkxaXNlVUJndEI3UC9DMHdYNCtDRXdh > TnA3SVExZXINCnBwOFkwd3k2MkMzUmFWRXhhMTFZSGg3UnZ4ZVFnZW0rM0hYbUJ6NXVNYjBq > bGdDQ1ViRHJ3Q05HVGhaVzdjbzRUa0VCMDlKZmpHS3MNCnBScnNLRk12SnV2K2t6NWRVYVlj > bG5UWEVCbG5oYkgvcHMvZGRycThPZ1gwNFVmWldyWTM2aS9UMUZKbE5lTTZCWXRiMkhoTjIx > UGgNClVEL1o5b2FzaHJFOUNhekpucmRVaDFPQVd5Wm1xTkhkMGRVSkQ3ai9JNEZmYWJuS1Rw > WVdreUR5ZHBXc1JuYlhQWGtBUldxeEU2ZSsNClRtci92VHF3dEFmSTZkbnpmdTNrNCtGWkhz > NnppZkcyeUF5R1U1UXFFdHREUUpkWmk4TXhxRFM1dTI4NTlrajlkN3NhL3VtVFJDOEcNCm5W > ZTVGU0JIdnozTHZ1RnAzVHM4M1UvZXV2dlg3Mk5jQ2ltdVA3WHFPNEJHNnA5eUZpMGJHV3FC > UWFaMExKenRCdTY2TDh4bUVmSHQNCkNsQk15ME1BRDVNVDQxbnpXWUJLSTFxK2pNMHBXVUw3 > ZTZRUUhEeDFveFRMR0NQaURyM2tJT2Z3ZXhVRUx2SjdEOG5Dd1g0RUV3RUMNCkFDZ0NHeU1G > Q1FsbUFZQUdDd2tJQndNQ0JoVUlBZ2tLQ3dRV0FnTUJBaDRCQWhlQUJRSlNRWlhWQUFvSkVH > NTRLc0E4bXd6NWVtd1ANCi9qMGJ5WW9KVkdhZ00xT2N0UGNzMENtTXNEMVR0WWhScHF2ajNX > NytxSEpTbnpqZlhFV2lodXdGREtkdzByUmlHclZuMzQ2dGJNWW0NCmRLV3VId0NVMVF3SzdR > dTVJMnVTa3EvRUZxN081U1JtS1FES2FRZUwvd3ZUcWNhQ2lNMjllZVdnTGFqQ3JwVUE2WWlM > TXlIQXV6bXINCjFTNXc5Y2pobmY2SGIwTEJRTThVL0pBYkxzZ1BTWkhSemNhenp3NmZzZEFj > TEtCVkZGSFhiaUd3NjFta2lzWlYrN1RIWFJ1dWZtS3MNCnpwNnVieUxHdUxYUWJZeVI2Q21l > dlB6dkU5aHNhaDlFc3FQRUdQK0dwcXlzZnIxVXl2M0UvdmE2eGxLbXRUVHJXZGwrMUhqQk9N > WmQNCks4am5yK0NWR3ltOGhla2paL2RVSE5DWjMxakJnNVhDd1IzeGtHVXZhWFZ4NVF6U0h6 > aXFuSmZhenV5b2FmNGQyM2VSclArcFdGdmQNCjZGWldTSVd5M0o4RjdEQXVjeXJCYlV2WmMr > QmQ5SWNyanR1QTZPdGUybWZiK0xGd0xhWkUxYXpiN3JLcEhFRFdMRjdWcHBVbmx5TE8NCldF > Nyt4OFZZMTMxeG9zTEVDOEVwOHFGQlFaMkgva0U4ZUNuenVmd2Z0a1VRYTU3VVcrdlN1WVZm > c21DOXpnYnZPUHZEbUVBRndVc2cNCmNZc1RNc0tGbVBwSkppMFA0MUhmQ3hZUzlmUDA5cW1C > eW54Zld5VEw0TVJkWUVzVklFaXdKeGZrd1lOUWYySU1sUVlLU0J1aE5FcXENCmJ4YlE4L05F > bVFSTlZvWEtad3IrMmduYk1QZFRPeU40TTk4UHFxaHVTdjF6V1RwT3I2cjk2aWNraXc1ZDFw > bmZKODlqRU5ITGR5Z2kNCndzRitCQk1CQWdBb0JRSlBmeXRsQWhzakJRa0paZ0dBQmdzSkNB > Y0RBZ1lWQ0FJSkNnc0VGZ0lEQVFJZUFRSVhnQUFLQ1JCdWVDckENClBKc00rVENTRUFDYjlS > Vk4va1Fjc0pmNzQ5SnNObHp0M3dyNUpyUmxsRDU4T295MkNqRjk3cEFaYzNTN0RBcFJWL2sy > bmFMakJIV1UNCkphYnVwb0VCQVFpNmpCMFVJVVFHMmtBVE15bjZaZFpoNkp2dFN6ajZ0K1FC > RDF2eGE3M1NQUlNqMTlyZ0N0NDBFS1o0SHRZOVFCeXINCk1vSUdqcTlETWFWbmQrbTNqem9Z > S1RUa1c4UnBHTUg0S2NZV0EydUdDYitFbUlXemtTZHlmNHFVK2hMb1VLbCtrQUpCVm9jc2RN > NjgNCk14Unpqd3lIZlpoc2pTZkxDZEs0QkdXVXR4MlR2TWowQkp0eVFHZXNXQ0VuZnA2VStB > L0FDZ00rNnYvbW9sLzBIUmt5TCtwdlQrOGENCnMveTA5M1QyL3ZRVnRjeEtkVFVpeENVaHFi > VTNaWEZiODkwM2k5YnpnSjgvWm5jczQydkczVENuTWJ2a3FEb05SREpKemdkZERuWFANCjZK > UW5ZOWJVaGpvbHAvYklkYVlrTk1ISkg5UUVMekxQSU1IMER4KytSRk1jMHowMzJ1NnVob01H > azJkMk1EbTkwNHBHOXdyVFNDQlkNCmpJQUZvVkIyYXJFdkRZK2FJRHFKWEY3Nm9RVGVUYlBH > dFRUM0ZoWWlUSjVJdXVwR0V2YXZuNzk5eE5qYm9IOFdlTXRlNzdQcmxjWkYNCnF1eHdnQk9E > WktJcmJjR0tPdzJBSHZZZCtwRjl2NFlIYU8wNHFPOHByM2FGU1R1OUdHOVRzMXh1WklsMWFn > WERINEFSTFBEaTgwODMNCmkrMW1yOFJ0L3JTMFhSQ2phUy9RWTJIYXYzYmNMaDU4M2hjcW52 > SUZQaDZGZEs0a2xQZXRjSURrTEdKbXJUdHpFT093cnNMWG5PM2YNCkRpRkYwQkFlNXNMQmdB > UVRBUUlBS3dJYkl3VUpDV1lCZ0FZTENRZ0hBd0lHRlFnQ0NRb0xCQllDQXdFQ0hnRUNGNEFG > QWs5L0xRQUMNCkdRRUFDZ2tRYm5ncXdEeWJEUG1zbEEvM1JHQ0VhU0dUcVovL2lua2Zkd1pE > eWpBNXdjZzgyQTRURVp1eHh0UEhlcmx2VVBJbEJobUENClFCYlVVWlYySVowOHludm5jbGtC > YnJYc254L3gwVWpicTFoTm5FU1JBRUx5MUhFcEt3MUtocUhYQ1pCS0p0elRUS2tXd1dKZGEy > ODINCnZVVVJON1NNUGgyZnFqTmIwVUtMRVNsdEpDS2hLTWtHM0JUNWVRc3FkbUtMVjlwU0Nq > M29TY1VXYVRiRHlYK0ptbkMraUtkdmd0cUYNCkxlODZjUXB6dkpIa29GT0hHN3hrWEg4R0lM > cm5CSW5vUGE0UjNjRzl0eU1xenlWWHhYWXA0T0lyQWZPandOdjg5cWIwUXpXSEdweDANCkg1 > V3ROWTlpZnNzRXlvNHI0SlMwQkpaeDNnQ1EyOEdmZFZicVNJSWNLRGxTaWJYc3pOd3B5amhy > RmJ0OGMwSlJuei9wUlp1T0ZWUm0NCjMyTCtpQXJDMGQ2ajBkUERMOStXOEx3Q1pqTUxXV0s5 > Vng4M1hsaFI3UnhQdEJhZlVaQlh5UzJzNE5pdXJ6dmFjK1B6Y3l1NUdDOEMNCm1MTXRJdDFM > c0pZRTYwQ0ljaGRuN1plVkNKaDIrcHhDaXZScW5jUUVUREZYL2o1K3d4TnZQS0FzcklCLzM4 > MUJ5WXEwMGNTYnpYRjANCk5LVFRyeVhqUmJXTzg4aEMrT1htdTR1eHhBM2Q4a0Q2Wm83ZVRm > UTMveG9wa1dEZG01a2t4alhsUXdpRHZJZ0RyWFY2NlJqc1p2RnANCkxxakxUUmo5U2VFNXhq > TnFMQ0F5RDlFRCtGZXFoT0tkOXpPV1V6aXpKOGJHS3U5bm84bGUwSlFTQXhyZDdTbXJhdUM2 > OFZVUmRQbGMNCmdVeFppMUhPbDNIMjJQL2lYaXcwbzhMQVhBUVFBUUlBQmdVQ1Q1WUoyQUFL > Q1JDZ3RlYWI2UHZPRVZHREIvMGJYL1FKT1ZEQUF1eWcNCm5rbTkySjFLS2plbTBTQnVkQUI0 > cSt1MGRDUC92SzJIa2Z4QUl5a1BqOGk0V0d4STNuZlI4a3g2ZnhTM2Nla1ZVTFFzNWtmN01u > c0UNCk9SekxOaFRqakJIdU5id3V2V3Y0ZzdzRnBqUTlGNFBqSkthdHZheWJVRVZDVjdmM2Vz > WWpSTDIzZXdJR1pwTE5wd0lhcnQ3WUhYdGENCnhRZFZHZllMTGRSaFdoU0U2YTBkblAvVjFL > blBYUGliY01hUk9qbmhRR3h1M1RjdU0rVHJpaXhJd3BReHVOOTVVSnlDcGF1SlF1N0UNCkJn > RklTRS9vZEdVTkhkQ2MrSFdGZlJESk4rVllaU3N0NXZYcjFGOWFVSWt0cGZTbXpTcjBIMXgr > YWZWYnUrZmU5WVFpM1lzcVEzZUcNCkNzL1U0dzgzMXJjR1NTY0tzLzdmYzBSSnpTSkNjbmxo > YmlCRWNtVjNaWEo1SUR4aVpISmxkMlZ5ZVVCbmJXRnBiQzVqYjIwK3dzRisNCkJCTUJBZ0Fv > QlFKUGZ5enpBaHNqQlFrSlpnR0FCZ3NKQ0FjREFnWVZDQUlKQ2dzRUZnSURBUUllQVFJWGdB > QUtDUkJ1ZUNyQVBKc00NCitiaDBFQUMxSHd2Z1ZlT2x0dm4xdm52bDVxREtyT0hJdDhSWFoz > bkdFZHdRNVVRR3pBM3MwcFMwTFFsdmZJazQ2OWpQTWFPdytXblgNCmVxemZaZFYyc1B6NHdF > dmQ2em1xbWVSSEtKKzBJcUh2ZlJjMyt1Z09BeGsxdWdpWkpLclRCQktNVVRnTXhzT2I3aHBo > aGpTU1RmbkMNCndKUU5qcXpvZE40UFR3ZFNmcUJDd2Y4M1UrbFUzVUZJSUlvdWl1ZU9jRzZ3 > TFhxTHlaY3N1ZlMvNmFEY01LLzBwZy9wKzRGZnVtemQNCjU5K2hhZnlGK0srYWhJVXZlR3lB > WkVTdWFRMmtOU3JnN2hMT3AycXVJa2dxa1dIOG53NlhxUm9VNGtvYVJkV3BpTE54Y2hXNDc2 > UUkNCkJVWWd1MDk0RWY2OFFmOFlySnBCZUhVYW5qUng4N0VpNmRpRGlOMW9CemRlbzBmS2xH > ODVRTDZwdEljSkd3cnl2TU5WWm8wUWV2MG0NCjZOV2NEanBWK2JKR2VxQzNEdHp5NjgzWnNs > cnU4QVprVTd3TnB2YmtNV01YNDg2cS9tNGhYcmQ4UGJWS0EzcFhLTFFYWmIrMk5RMXQNClpJ > WFk0c1ZPREZjb2swSWY5aWhQNUQ1eTgxdEwvMDlsNjhuR3VZRXRZc0ZDd252b011L3pyTVRo > U0UrTlJKVElSc0Nza1hTTjhLN1oNCnJScjVzY1dwakpPQjVsSDBab3dZY2k1ZHYrQXZ5UkFh > OC9VbEp0d3N5VG5YeG5hUHd6cGEwZkw4TEJUYXF3aEY5SExaZVpVbmQ3Y0INCnpwOUFJRjRr > RW5ZU0pVQnZ0TEpJdUxIbHRrK1A5VlJUTU8ydkJJY012YnNXS21ON2FNb21sSHQyU0RuVSt0 > aGFkZmpnNW11RTJMaHUNCkNtNzMrTUpHQkJBUkFnQUdCUUpQZzBrbUFBb0pFRnBUSHNDajNi > RlYrWFFBbjBVREplMEl5NFRFTU5MbjhlV290TGNPNldnc0FKOVINCjY0Q3ppaU5BTmlLeExt > YnJSN1ZESGo3VU84SkdCQklSQWdBR0JRSlJsODRwQUFvSkVKTmQ3MFNna3lZcldXTUFvSmZI > NW9iUHI3TTENClFpRVRzRW9xaGZmNGgrUDlBSjQ4TVJzNWxvclV3VW1VdjkyN2ZvWU9mdGx1 > dmNMQVhBUVFBUUlBQmdVQ1VqcDE1Z0FLQ1JEWk54Q1gNCnBIUEprRmlPQ0FDSitpMklpZk5P > SkRpaWtNMkhSMlNpNGk3ZjR2d3VHZnhhVDVwd0NWUlMvaEZjNXliVUNXRDQ4cnJ3Zy9PYmZJ > eHENCmhzOGkwYnBPelN6bnZuOXN5NjY5Vm9UaWFoSGgvUlhDOWsxYzRaOEhkUmJlYVNJYlNN > VExhTWQ5ZW9xcHB6a3BkZENVR3VCeVJ2TmUNCkQ4SmNqRGtQbE0wcEJNb1NsNW5ZVW9pd2l3 > R0VOaTRyT1pXMXJHb2h0d3N3TkZqeGtqZzdhUjF6R3M1cjdTUWRDcjNPanFBV0h1cTMNClFu > aENEUzgxT0pjUXh6NEpIOUdJZFgrVDJpNFRVbDRoYWZwMnVWL3BnL2dTU2VwRkhqTnVUUCtI > T0t2SU1KNm5ySkRLNzJLKzdJMlgNClNuV3hIN3NaT3UzdERLQXAxUWFMVDNxSjdqbGxGcHcv > M0pCRzBLeG9raFBaL0lEZ3dzQmNCQk1CQWdBR0JRSlBzNkpxQUFvSkVDcmwNCit0QUdTa3Zx > TGF3SC8xcWpEdFk4NVgxaXl4T08rUHFDMnBLY3c4ZlA1WU9EQitibjFKNU5qZjE3RVh0Rnhs > dXU3ZXZFaWRPbmVFZXANCkcxc29zZERWNXhNOTdaLzJ6clo5bnE0OTNhcGpsSXArU2xJNHFm > ZWJCTDR0aDkzTUlRWGJVUGZPQlZ5elVxQkZndXJnNWdWaXF1MzkNCkJFRkhmc3VvTzJaWWJq > QWNHOXVUd2NEV0lXU1Y3eGdta1RUS2djYmNRUHFBaitURVNvME96aDhqblc3T0RwdHRaa2JX > RDZuY3dBaEsNCjlnbWxkOFR4WlRhV1doby9zQ0txZThpN3ROUVM4a0lLWlVUbFRDaHQyM2tH > Rm5IalZ0eEVzTVdoYnZqODBwOTNUeSsyT0g1bjQxTzYNCjhUdUFLTVV3OEZDMEJUWVEydnRj > eW45ajFpSUpNWkhoaUdiZVBKNjdSQWE1YytPMktySEN3VndFRUFFQ0FBWUZBazkvTHkwQUNn > a1ENCjloNHAyTzBEVVJmS2F3LzdCQW5ndXpSRHV0eGJ0STNYbU9sVzFjenliNmVVYVJqSEJN > VE9ZbG5pQkpoSytxck5mNlEvZlo5NkJDZzkNCkdZTGErMUhJNEl0dE9lNEhXUlI4bWNvV0NX > L0NHeXhrM2d6M09CNVFGRFlxbFNuby9qZXE2L3FlRVhjMnBPeTVRQjVVQUNBc3dFREcNCjN5 > TnUwYU9oVis2ZnRKaXk4T25mcy81Z1l5NGhvRFNlcFdQUG1MQ0lsL2xCc1JUODNQQU8zaVQy > cWtGcGtuNFdUTEtGdnd0cXpzV0QNCjZldk5WNzNVcmpKOTRpSERaS1BVOXhvVFZZS255NFdj > SmlkVm50RktRV0VyUTczSzNYQ2x5SmFJUmNxTS8xdnJtais4SXhQTTFYU0wNCm1IR3ZBWEkx > bWl2YnlGZXRKa1plWGtHR0I2RUlBcFdHaEMwcFNvc1dGcmZuaE00cTdoTDNvSFhTU1RKNFNL > N1QzZkQ2aGp2ZXdkRi8NCnZkZDJBcWhsZy85RkVaOC9QeUFrc0NXcldqTm91a3BOS3JPb3Vq > WUk1Q0tDUlRwMmIxK21BaHBLMGxUTU1jQWpGTzN5L0F6T0NiTXMNCkpEaW04TVBTdE9FM05W > ZUhOTHdEYWRtUVg5QlJDcHVJdlBTMit5QkVDLzRKQWhxTlhCaW9qblNvcEZ2blNwU2w4Y2lj > ZWVlbk1oZ2sNCk5IU2s0Qld6T2NORnJYNlJpakVYaWtoZnJYejI3YUJpMFJuaDluVDhkMERp > WHhPVnY1UzREb1Z2aEZvY0MrRzV1UXY2c3FoRkVKV3ENClFjWDNESjdFeG5BQUF5WG5nVGJp > WkY2RnFlaUV0WVk5SWxnVklyazB4MnJPRVI5MzJRV3h6M0RwbjhqNEdxZUsvdkNIeTJUQi9E > czENCnJFdTlxT25RaWNRanp3SEN3VndFRUFFS0FBWUZBbEp1Z0pzQUNna1FOODM3SnlWMTVJ > RDM2US8vUk9YSHlUYkxPSG1UR2lTZlVia0cNCk96RVFSWDNWNWJ2QWcxc0lTNDJBakV2NEhy > UlNScUk4NTBmTDQxNGNYbjhSTXlpZHE3MkpTSGRiN0N2MWhyRTNDNmVFbTRHYXRYY20NCmdX > cnkwenhEemVmc3Z3aWxWR3l4dmc3NXluMVo1TGdVa21zeWRYYlJhYnYwNFhmaWIyOGc1OG9L > am0zVGdyRGY3UE9iUEd2WnVIcmoNCjRnTUU1RTZSZDdBQlVINjhydmF0Yi90UnRaUXVWc1Ex > dVZnNXNVOXZZejFiV2tFRGhLT1RBVW1PaWFHSmN4UWdHeEN2M1laVHZweEcNCkFNT21FeGow > cGJNSU1XMFlKTHQzSWtpdVJUR09yYUwyK0RGZmFNSlFMR3NlUTZVT2l2cERKVWpaZnJOREda > NnhFcURhK3BnVWxNL1YNCjM3VUhVbnc1ZVd5Y0ZHS21walpJRkkrUVBWM3N6ZXYwSW5TWTJ6 > UDl2NTBXdGFFOGcvRXUzVlZ3MEhNUkU2eEMzWGU4UnpwSlVnM1ANCnZrNnFES0s0b1lTeXBG > alBuS2sxaFZRM09xREYzRVhEUGx6cXEwczcvNE1EVmtpZG5aWkJPV2pzK3JqYTJBY2VqdGJ5 > elcvcmVHbHoNClhJVzhqSk9QNDhJMzNpT25KSEhYSGtHbUVOMTg0Q2dXRjBiL1VnNGh5RFVL > ZHdXT203V1lUdzVnSkg5S1lWZzA4RjJnK1JudHMxU20NClFFVlpMeGZ5RWltUzBsQ2t0TWV0 > RmprakdaakxRRTJCOTQ5azcyVHJsM3FtMW9pUStjamZhSHZJVDlJMjFvbFg3UTYrME9hTG0x > RlgNCm0vcWpxMDhldGdSTFowWWJGYjBHbHpjWGM2UjdtTHFzUVpWRnB4WWhpRzd0OTZ0MWcx > N1dqRHJDd0Z3RUVBRUNBQVlGQWsrV0NoUUENCkNna1FvTFhtbStqN3poSExPZ2Y5Ris2MXNO > T01zZjlFSG5IV0oxeGcwQWRrU3FqUDJxUjdaL29HNjQxUXpXWkc0S1dRQTBrY2dMOFYNCjRt > YUlrOTNFWWFCVURjLys5V2JPUk03eURtOWVyckloclcwSU1lNVE4d3A3cEtHbWdQdFM0QzBG > dGZDa3g5NllPTmZzR3RFbUFBZUYNCm9iR0hBb010R1N3b2N4eEZQcjF2c1k2UXJKTmdXRmdl > WDhvTHdrVlNaQ2FpMno1ZklyT2RzZ1Z4OUFHYmhpZ2RUQ3h2akRiQzRCY0YNCjdmMUZydEFl > K0pyalZHbmoxRVJENFdRNXdvR1NUNjVtM29jUEVDNXk0dWkwMTJ1SlZKWkpWanY5L2gzazBZ > OWxmZmRvNTFjSDIvbk4NCnVzS01JZXJLR2hZOXlHQ3ByNk9CYkVGUWxLZjhReTVGc1g4YkRh > SXlQay9KdnQwU0dOU0pvczU5RU0walFuSjVZVzRnUkhKbGQyVnkNCmVTQThZbko1WVc1QWVI > cHBZbWwwYVc5dUxtTnZiVDdDd1g0RUV3RUNBQ2dGQWs5L0xRY0NHeU1GQ1FsbUFZQUdDd2tJ > QndNQ0JoVUkNCkFna0tDd1FXQWdNQkFoNEJBaGVBQUFvSkVHNTRLc0E4bXd6NVhNc1FBS3dG > WFQyMTdRUCtOZC80aWg5Q2NwZSszd29ZQkJiZnNGL3MNCjJMbW5iK251WDl1MmE3a3lrNmRm > dUM1eDFtbVQ2KzFBVXBkM0VZNnd6N3g1c0RDTFZJTzhIU3BTdnZ1WU1zakkxZHlCcjBwTWJ5 > WE0NCkxxeExrclB3RnROSGs5dm83R240ckRhUkVhblE2Q1l3UStLRXZjL01xT3l3R0JuZUY1 > Z2NLRjhMUWNvVlR3cEZDN203QUNGdjJLUXgNCllKK3pSNTR6emk5Ty9OYjFhamx3OGJTVSsv > ZWdZT0NDdG8wWEQxQnFSVEwvWVp3a1V1UjMxZEVvejdNSjcyOUtUQVhGM1gyZ01VMDgNClpD > VEtSK0s2UnMxdUc4L2liZVBBYlpXSHRPeVplWTVUTUJKSXQzMlp2RmRJNmtEWEFpWk5XeTQw > eG90L2pTVFhsSXBsZkR5V24vU1ENCnQ0VjBSdmJ3ZFZiMlJVc3loOVI2c2hFcDAvaFU4M3ZH > eVdNZDNlSUswdEJLbjVzYXE1eGlJbkxGeGNlOERhWVBxUTNaL0NHZFRlb1gNCjhKQU1laklt > cUhkeDhKWFIreEZIemJtM2R3QlE0TGltdmJEQ1RxYVdNbzhoM003ay9rVDlZMEE1am1la3RB > WXNCU3gxd1dCQXMxb0oNCmxtS2VuWndMSEVjN0JGVVZPOVR2OG9uWmRHOXg2K2t4ZVluWWs5 > MWVkVVVUcmFMOHRwd2R4cWt3UjhsalJBTnJseWVFdEY3YkhrSVoNCkF4TERJc1gzbXovQjJ4 > RTZlOEl0RlJZa002eSthV3UrcEsyakJ0WUZOenlocjl6VFRzczZnQWlvMXdYNFNoNjhGUWNm > aFJKbmpxQVANClBIME9LOUFibHNKbEtNbG5lejl2L0dLRlhVQWdySDVIU21ocnN6WU13a1lF > RUJFQ0FBWUZBaytEU1NZQUNna1FXbE1ld0tQZHNWVkoNCjB3Q2ZTelc0RkczYTI0NnJVV2hJ > Q3ozS2VUdXRHUGtBb0ovWmNaZXdJOHpVTmF2Y1Z0cE1rRFRvYkRqM3drWUVFaEVDQUFZRkFs > R1gNCnppa0FDZ2tRazEzdlJLQ1RKaXR0YWdDZlVFbG5SZ20wUmlaRTFHbFgxcDM3UEdQeEZJ > NEFvSTZtTGRaa010cmhsWWxjUGFBZWl2OVgNCmtHOHF3c0JjQkJBQkFnQUdCUUpTT25YbkFB > b0pFTmszRUpla2M4bVE5ZFFILzI3Mi9sOGUzbnJ5L1VMMnBZSjJ5Rm9DSEUwQVpCK1YNClc3 > Zjd3cSsvZ2hzMXpBSzZrQ1M0bUV0a0FDYVV4S2JpcS93RTlGR1RpZ2g4a2c0TEdxdDdvbnFn > UExHcXplZzVpR1RYK0kyeHFwVGsNCjhyVTdDMzlXdU90T3FKQTNsdDdhd2hRWkRDQzVsMnJJ > UEM2RkFkY1g4ZEFDNzBaRFBZbXRwdkVHbVp3TjNLaGZWdzBGY21IQ09mSGgNCm5jdURyYkJX > WkRkN2xac20vMFB5L3lYUWNPYjBKbkRGNlY5ZCt0Z25yU2JvcmpidnRQQ1ZsSEFjQ0kxVktN > MUI2WmsvUnJxYWtGSksNCmd3QmxHRGRFSnE5V1QyMU12L2hEdVR4V2RWeER2YnNyWE5RbDQv > TXg5dSttSVpURkNNQXVwUmJEMEpma2ZIZGtxbzR4NFBpZktnT2gNCmFXN2Z2YmZDd0Z3RUV3 > RUNBQVlGQWsrem9tb0FDZ2tRS3VYNjBBWktTK3FFb1FmL2FhcDU2UmZSQWl3ek5FOFhCOGJ3 > bE9zOUZHNFkNCmo0U2YzYXYzbXBJV0d0WUQ2eDZDY0VTZE56aWh3VUVWaDBKb0labG5hekNs > alJlWGE4bHg4U1dMSW5pM2cyNGQwdHFxek5IbEpMY3INCktEQ2MzUStoWDZwWlQrTlZzUk02 > S2FOeHBCbzFPRUdBdFlMQU9teGt2L2tYUERINXZ0a09UZWd4Z09WRFptVmQ4YkZVQTNIY0Ft > L1cNClpXN2ZUQVNVTEI1RnBhcDgwUDNkZFpvcjZTZGRYV1Vyam0zM1d3Ykx0UWxhRVNlN3c3 > MDBQQWtTVDM0OGQxNjJqN1dyYWxrS2hRL1gNCkZqVXlqcGZtc0k3ckJVRW5RVXVxTFFPRFpE > TjlHZWJJZjZmckI4Z1JoZkVQTEFXUWphaEhCeDlOcUg5U3MzVURwd2pKaTVJM2JMWm4NCnZ2 > Zm5HZWhVL2NMQlhBUVFBUUlBQmdVQ1QzOHZMUUFLQ1JEMkhpblk3UU5SRitQd0QvOW1ibVBT > ZDdQVDlPOGdJTTVvZE1LeVNtM20NCnJXVnovNTBwU0NaNXZXa3BXeDJCa1MrdTEvNUJ0alJM > M1oxY3ByRW1YNlBxTmFwa3ZUNlRoQ05tRHVHTjEyVUNHZ05acWZkWEF4b1ANCkZMeGpsU3RQ > a1JjYTJLY3hXRXpVeWFIcEh3Q2dMeU5lL20zSjZiVUpoOG5mSkN6eFJkMnB4V25ZTTZHVVp6 > ZTZIekV6ekZzeDZZTG8NCkRLak5JeGRDdVpYMWVPbGNWZjRKTEJDbVFUMXNiWEdOUWE2RU1Z > bGVmWi9acU5XNUlHR2llR2ZkdFJNWmRWOGxZK0twb202NjdyWXUNCk9LL1F2N3I5cm93Wnc2 > b2ttZ3dVR2hFTW45L2p5UTBGQ0svOTVoNFc4VjA5bFQrS1ZlSjQvaVYyVEcvc1ZEaTJzaFpV > SDRmSFArMWENCnJIYitkWFhWRTh4MGx0ZFNKQ2pRMjBJYm1mSkJNWjB1UXhvR0ZDLzFCVjha > Ymx5MC9YMXF3a3Uvc2YxRndHNnVXb2Z6bm9QbUZZWWYNCkN2bThGSEQwM3BLaVpQaSs5NTV3 > bUtyaTRUNHVjUk1WVWlaZzhtWk1idnd4Mk9tditHZkJTTXo3di9lWkU2eXk1dHZPWlNkbllj > eHQNCi9lT1k4WmkxNHB6VlF2UkdyMU9GcytmY0VqczB1eUxlakFIS3c0cXpOeVZhQ1Zmcjly > WS9BZldaTUNwQytDenZ3eVRjZnNvbHdjUmwNCmc3V1FzcVBKVXhWdFMvWlFxZmZYZ05QRFlI > TVdLNXpUa25kaWVPVC8xS2ZUaVIxb0krRC9yd0xIbFQ0N3hxRTdadXJEL2w4OFd5d2ENCjNP > MEtxa3plYnV5T1VWdHRYRUpKM21uVmo2UmFBOWR3bVJNdjN3cWJvaEVrVllUMmdzTEJYQVFR > QVFvQUJnVUNVbTZBbXdBS0NSQTMNCnpmc25KWFhrZ0hTSUQvOXVEMFdEK3Y2emFTVGtjT1RM > dDkrU3l3TmlKY29LQjI5bWhMMkozcmxiUGJpakhCbkloNSsvbnd6aFZYajUNCjVBeVFjNTFF > UE9nQ3orQWdEZWNwZmM0TGowUVFYTHkxOHpTZll4WnVybXBQQ3VFRlpZa3BhenRJQVlJMHZG > UDllR0UyUDlUMWROVmQNCkxLQVUxblBleVljQ0xQSEZyYjdTWGFNRE1qd1UzblVSQkNMaFJp > S3lOVDVwWDE4SkliV2RULy9rNytSTEh3SVZadzlFclRLOElucEENCjZ5dDhkTUlZZU51NWVW > RmE3Nm5ZNnBSdzdaV0lrRVlveFFZeFE5K3ZLcllEVSs4QUFMWXRmMDBVVWdLVHRXeWlPcnF5 > ajIxZk5lSnoNCjk1bUR5VTFiS2pUWGswamRvaGZ6QXllMVk1VTh1OVFRZjE4dHhMdFN4anBK > Nmw0aFZGK2ZNaThFNDhxSFRmUU5wUWk2U1lhMk9SWjcNCm9LdE84Q3J1Q1BjOFpwb0drNFli > MWw2SHRWN2duTFJrM3gySk1RTmNYT3V3dStUU0NJczI0OUE2WGt4azdPeU1HSG9kZjlxUEx4 > akkNCjkxSWZBTEJqVzdtVFpraWNMUFpnK2dCeHFwUUYvTm9ySGZZVFkyb0U5b0szNDl1dVJ2 > TCtvU2RMa3ZMMDlIOGc2eFg1LzdGbzI4eTMNCkZFZWlQa3JJbkpIUjgwcklMV0ViaEFwY0JH > ZDBGUFREc0hQVWRiV0RtQTl2dHQvaUcvdnhBdTJuelVwejlYNjVIcjl4RmJ0MlY2azUNCkZC > UEs5YlBoMUNibkJIRVUvVmxjM1puK05pL1VkdmpNYjNkbzZPWUpwdUUzZHFWb21uclFZV0E3 > bEY4amllUGJDbTI5Y2FDejZ0dVENCitNUXdEYkJraXoyODRNTEFYQVFRQVFJQUJnVUNUNVlL > RkFBS0NSQ2d0ZWFiNlB2T0VhUWVCLzk0S0FUaUZ5VklzeUdBWVd6a05CRHkNCmQyelh1L0FE > Y0hCQ2xZRUlRdTFtODh1MktFTzFaS1pGT05VMk5EU0FLYW1RNFl2VFJJMm5UUThpbS9leVkz > TzVVMzMvVWdnV0NqNTgNCitzN3hIbVlDaXlEcTdlMElkbWQzVW1NRmNHbW9DTWRzczg0SDE5 > Y1NnTW9FMkFiazE2clJBYkx1YUJkQk52YmpmMGFBdDJZc0lDdGQNCndkRjBkWVFLbFFlTlZ2 > N3psSWt3SDN2MjBIMC83MkNvbUlacHpFdzgyN0tTTXFBY3BZRC9rbWlWUFJrQzgvYUJoSDd1 > dDhWbjQwZnkNCkxhRHpPak1SUlRuWHBWcE4vT2ZZZGVZS0FtYk85MkhYeFpXZW1HdzczSTl3 > TmtpbjI3eFhabmdXanE3bndLUXZGb05ZbnlsREVCaHgNCk1vWldxZ25LbHRUVnVIMGZ6U1JD > Y25saGJpQkVjbVYzWlhKNUlEeGlaSEpsZDJWeWVVQkdjbVZsUWxORUxtOXlaejdDUmdRU0VR > SUENCkJnVUNVWmZPS1FBS0NSQ1RYZTlFb0pNbUs4RitBS0NQZ2JNUWo0ZldIa1J5bElqNDlD > U25Pc0FDTUFDZ296NTIvVzhteEg3NitiTVgNCkdTNDJmaGFYYVluQ3dGd0VFQUVDQUFZRkFs > STZkZWNBQ2drUTJUY1FsNlJ6eVpDelFnZi9jcHhNUmRiaUtKMnZvLzFUTzJPWTdEbEENCklF > RDVCWjBoUzJkZVpTbVRYZk9ibGV0dnNTRWZ4eWNjVWp5NlRhMUFtMnh3Y1FoMnRJSTZmNisw > ZFlYSDNsd1RWOFR6STFSWDdHY3cNCnZNdlFOOWUvYm4rMkt6aDRvdEEvU2dSN0xNYVQ0YnlD > bUNmcDQ0N0JMV0poUVo3Qm1RRWYzMEo4Mm9uZ1VyMXF6S0VmZUxmL1RaVysNCjVFMWZBL0VN > N3RFZDFuMm1yMWgxVmpXaXdkVW9LSVJFWGk0a1JhU1hvdWVNRVlEdXNDUG9MZVFiU2NqUmFK > MXRVb1NlVTZsUlpOaXUNCmd5VURBbGF0c1NmelVUVzVEN0JjUjdPellBd1JoNnRGMmVGb1l3 > dEw4M0RGa1ZPRU4rSHdBVzB5ZStCT1pGWWIrLzd1Q1VvUUt3NDcNCkVtazhRZE10MEtFei9z > TEFYQVFRQVFvQUJnVUNVbW1MdVFBS0NSQTExM0c3YmthWHo5Z1VDQUNPaFpmd1Fla2hJVlcx > TmtVNFFDTU0NCmdiWEZrTGpaRzZGeitMYmhhOWRwbmltQTBZUTFod0pmYjZVTlRONG9CYXJi > dGllOXNRWWhzOUNRNGhubkRxVXlONjUwUm8waXAvdUUNCmhQOXNKeUh2MmpuUENTdXdzTGdI > MzVWN2dVQ0Fwc1ZCdXYwV3hWYUFOc0dFeUtSc3hDWU5oUkhvZjV0L2pkY2F6bmtPNWZyc0tD > cVoNCkNSMTB0SjQ3Q1N1QU5ldjJxeWp6Y3g2RVNDOGFlZTBKMWorVzVIbGVxTlM0UkZXOFNC > dThqNE9CRGZpQ0FzZGQ3WmFwcjQ2WEJjQ2QNCjRPVHhjcUpDZ00yaC9LemJ4R0F1a1loUW9Z > Yk10bnA1VFRleUNERE1LRnI2a2JKTHV0L0I4V2VmRFBqTFhPaGtYWXVxZXJwOUZaZy8NCkQv > cGUzcXVaUEplMHVCcXJ3c0ZjQkJBQkFnQUdCUUpSbDgvdUFBb0pFQ1pKNWlqRjAwMEZKOUVQ > L1I2U2wxdFNjRUhsNjNTU3JucHQNCkVSWElNc0hsVEk3KzlaaWxjL1pyaXlDYjViUDVZMG53 > UzRwc3RBelZoWlcrRVEzSjBwSjI0MUo4OHh5bkFWamYvM3dka01ha2hmeCsNCm9wZ2VXa1BB > WC9IdjhyUDgvZDhsUHRMcUViQlhVb1p1Y3c0ZTBaV2RQbTJQNkxZc2U1UlQyWHc5eDlCVTZt > RzVzQWdVdFlMaVNleDANCmhMZmI1ck1HMGI5ckpVbFlZcFlBeGdYOS9rYStseWhVQjlzNDFz > d2hwWi9JcEN4SDRBdEdGSkR1a25KVklCRXlWWDV0NGgyaDZmU1MNCjdGeHlORURoT2tyaGpB > cENibWZhMjBaYTYwenNSOGRMdDFQQlVyVU9IWW1hQzlrZ0FlaXpkVmkvWmgwUlRrWHoreGly > NnIwcXVMYWkNCmZxQ2VTRXlUb0NTY1hNMXRPdi95VlZsTTNHazNIUFNjUGZxNzFkbHp0a2Vm > UWtqVWNCWmlJMDh0ZTAyYWM5eWdmSWVCcVlzV2taTEQNClpXMU1KMTA0YTA4M2lWQ0dieVVl > Ym5jUXF1UEpVdDNVY1VSSUJVKzN3VlFZODM3RUxOYzJVQlJrK0VqV01EWGkra2JndHE2VFFX > M1YNCjE4NVQzNFQ3TmxHbUdJUnB4U21xcnFmcEIxUjF4NHNIZXpGRE55NlVwMU1CZDhuN2Ra > d0dIOWVPTDlMeHV4YVFGK0dRMkF2ZUVMOEsNCk9wTlBNbW1ob1QvWERiYysvU0w5bU9vZk9u > WUQzS1hwcEd4SDk3ZU43dEhZM0NBZXNTbXgwZTJ0SzFJblAvZHkyNDN3U2RRUHpCZ1ANCmFr > NUtjVmgzNExmQWJsZ28yZ2xIYU5VYmEyVVBjSjVtaFBvWm9NUmdJZ0N1TFZObE9CZWNNbXEz > d3NGY0JCQUJDZ0FHQlFKU2JvQ2INCkFBb0pFRGZOK3ljbGRlU0Flc0FQLzF6VEZjNmNvMnho > R3dseWxWU21ZakJ6VGlGUjNDbGt5b1JTcFpVS2dkYzNHTHJJY1VBOHgzMlENCjhpbzJoNFVv > Y0ZjMzVNaGV0UE1VRHJjSjBBVzdnck8xVjhaT3pZRkgramFkNkFMOTVyK0Q1NEtIWlJST3ZL > SzdTdHNab3ZObEdEY2MNCjJYby91elFMUnBhelh1cnlPTTNrRXRmT3BQUFdEQTFwOTN1N0pP > cjhaWVExNkNKK3FNZ3krN2lTUGZIZ3YzWWdTd1pnYlFMM3pmaFgNCmRtUWZDMmhxYU9HYmsv > SUw2TDlpWlRabno4cm0xdmdCdmYwSkNDSEd0dXlmdzQzZUViQTJYMFBJMzIreVVQQkdRa2U5 > czBXM2hjUnUNCjR4U0RKQWMyRjlIWnEweHRRaEZwYU1EMkNZOVZCTTlwaG05bmtTdUVITnM4 > ajRKVkdaL1JLVjUvWHlYcjA5QjA1VVJ6YVMxbnV0Tk0NCkRFUmZSYkE1QWNFN1NrdkJSTEpk > K21YTzcwYTBmcGJERlNjMU1BU2x5bmgzVXdVQ1o0RGpGU2U5bUhobHU3SEt3SmFNd2ZxRmhG > SnMNCjQ4dmFiTnJoWFV4MHdPRXJOSitCZ3ZlVFg3SVIyejdlS1JuT0dUUFZLNTBqbjJPZVUz > SlMvS3BPbHdLU21zeGhVcjN5NDlyZitsUmsNCnJsWkQyaDd5NE93b3BMYlBmclgyS01IM2NP > dFNlZUVHQWx4M29FN1RnUGM1b2l1dTJZS3BDTVBIYUNIbXoxVGs2clk0VHIyNUNPY24NCkNY > QjZGenVxLysyMnFGTlpEWlFqMSs0SVpEN0tIbkl3cm1kb2NsWldYZ1RUY1dpRWFGWUVPa2x3 > MlZKcTJkQWM3M2huUWsvUzBSdnINCmthRE1vb0ZYcS9vV3ZPQUJVUDc2d3NGL0JCTUJBZ0Fw > QWhzakJRa0paZ0dBQmdzSkNBY0RBZ1FWQWdnREJCWUNBd0VDSGdFQ0Y0QUYNCkFsSkJsZGtD > R1FFQUNna1Fibmdxd0R5YkRQbG1PaEFBcFc2WUl6bXhRTndOMTNMOEcvSisxMjB2aVZIaGVS > SFc1eGhVSlh6Y1JrRnANCmI0QXJHT2ZxMEpFeXZ0Ui9MQk9aZUYrVzZiZ0Zob1ZoUTYvRk41 > Smh2Y0gxUjFMa3p4WFh4Yko3WDFKWHRkd1dQcUZKV1Y5K25hUFINCjVZZEd2Y0NvajFpTUxj > L1MxT1lJNkFlM0NRWlpZUjkwWTdISGlKVzQ4b1dlNklNby85RHZaSGF2KzMrMmNTTlNNVGF0 > ZVVlcHBrTWgNCjdVeUovejhHbEE5WjZqN0xITVRUZUZ5NmdWUUtUS08zTllPaUY2K1dTU2VL > d3pMR01MdWhJeG1DcUt4YXlWdWVKL3hFOVM2U0hBTkENCm16VktjSHd6aWwvUGpBWWg4ZDBk > WHdKMkhFRmlKNzI0NDRWZGVKSjU1YkUyZ0Z5elpEdytuT01pYllxcXN1OWlJUVZDdGVXdnd0 > V3gNCk83bG1PWTJBek5qZ29YekExZzI2YWFGQnRTZ1NscXJDc3FicDFIYzNHWDVBakNSR0Z5 > SkRkSlplc1IvS3BBWDdTSU15aGVZK3JUMjENCm5iV3JHTm5IY2Y5SUJmWDNBZjRGWnJUc1Uv > U2hHRFI2eXZuZVZLM0Rra0NWODBqTlRhYXNRUDJJeFFpY1VpaEl1WWpGR3kzaWdZTXYNCkta > aGhMZ1BYREMwVURqYmJIUkF0M25PV2ZKa0I0VVFTWkxxUmtBQkxLbGJPUzdrV29WbkhEM3Zw > ck9nc1VpMlJxbjR5SDNIWFU2QncNCjJ3eElhcjNRcEs0OExXTHRwdFpoTXpPcXM3dFZ4RFhE > T0dhN2xseDBScFJwQ0pRWlRuQXFoOCtvTHBQaCtPQ2tqT01MWGs5UDdoajENCmN6cHNreDNO > UDBwRUhBOFJjM2xQRmpKMzdRTWlSNGpDd1h3RUV3RUNBQ1lGQWxBWlR4TUNHeU1GQ1FsbUFZ > QUdDd2tJQndNQ0JCVUMNCkNBTUVGZ0lEQVFJZUFRSVhnQUFLQ1JCdWVDckFQSnNNK2ZFYkVB > Q3ZFc0RzeUZZZEZXcVBvbXQ3SXU1WExsRFNpYk9qK2Y0R0pCcEINCkliOFAwUUFWYWg0Q2c2 > RGlJK0hRbGl3Z28xZEVPTko4YmkxTjZ0R01RV1dSRzlMQ3cxZWF6WnAyR1J5U0wwZVRkcExM > ZlNackprV0UNCkhpUE5XOUVLUHA4Y0pOQ254VE5KOTQ3TUUzaWNBaUErQzZmdGw2NURhUnZn > OFJqaVFQNHFtUHQ4bm5iYWI2VURNSVlWTyt1ekVnSlENCjRLN254VGsxdUw5TDdwbStYZ1lI > c2xGcmZvMlQyK2MzdUt4a0krWVVFTkxzMmVucHhoRUVaL3l2MkE3OENrRDJRSkZ0WHIyeUp0 > Q3oNCmtqeit0WkZzbDBBTjFJWkRyT1dVRTZXOFEyM00zMGxiMEEwcHRQdWpNS0k3UHZVa0NT > STFhMGpKRXBXQkVJZTJBR3doSTVielNrYkkNCmlYbkNHaU5zRE9LaXhtNURwQVBsR3BVelhC > K0VRS2xtbnFET2NVeWZrYWdrdHBUZy9mZHZwWDV3NFBPc0JnOTJGWEwyWmpZMFRCUTYNClVD > R2NMcjdKdGNNZWtDTDVhL2xsLzVONVBna3pPa3RwaHhqdEZGM3VsNE5hanMwUUpyT0poV2Nv > aVVYMXVIZmJudEwwc3d3TENlcTcNCkFnOUtYbXpBTVFHVlVUeWxuVGp1RWx2alJoUWluSW1l > cVFrcHJzb0YrbTNGazZzNlh0RmZHWDFKbjgxbkY5U29UUmVWb1d1c0ZPS2oNCllVd254anVX > TnRBcDRIMWthR3NMRGlxLzJwSVRmTW82RzlBQnJ6RUlCWGY0K1grUVppR3ZrbVg3Tnl6S3Ur > ODBCUnNkN2wxR0hQaUoNCkt5amUxK3hMdFV1eDQxYlVZdndRRSt4a290eE9HRGJLYVBhK2lN > N0JUUVJQZnl0bEFSQUF4R1pubUNkS05FbExqRjl5TnFEcFNIMWENCmU1VmF5Szk2K1hqSnhj > Z2JtTGsweVg0akMvMWFUeERzenVyWmw2U28rOGM3KytqbDBvSGpzR0FWZ0tHdUphZ1R5R3pW > UFlqTWRNbjANCjNTbkptZ2FCZzRpaHEwVk8wZWhBY1ErZ1Vta1F1b2dycUwrNlNDUXZOUlp2 > MmFsU0Y3S0JKTWFoTkdrdmlxYjJoY0NaMCtFR0g4VysNCmpENDQvYkhDckZKT25TcFBlNGZI > WEZrQUNVTXgwSWthMDBPWFVBQlQ3UmQvZjBqSzlZTUlPdTZjZTRtNCtMOUl1N01DT0pjQ3hY > OFcNCm1xRklOdG9JWGFvVk0zakpTNWVrS21md2t1K2FvVFhDUlY2M1Z1T25UaGl0bkE4Z1I3 > Z0lIemRiNzQwVmU4bTNtWWxkdGprZHA4MlgNCjRiNzBsd3h3SG9FZzZVTUszQ1hYWGRuMlN0 > azlXeGk5eDltSDloNDZSOXYxNUVwZ3h5bThKNWloNkJYUTdWU1FEbEpQVzM1anAzdUQNClNk > b3JmRnpuM083d2ZyOHpwUkRaOG9UeTk3VGxBQTh4dkNCM2tVUDB4MTVza0s2ck5VR0ZrbmNi > NFd6RnI1dXRvZU1JZmpmdGRvMUQNCkVwZVdDcmZ3YVJKRzZzZ0ZsdlFHNWlDLzhLZTd2S1dE > VmpVSlBmVkU2TE02UTd1SlY2S0pwa0RTN1VLS1RkT3B3ZXptN0Q5Zi94Q24NCi92Y2dDWm00 > NCsxdWczd2p2dElIUjRkQnlQQWJoWUpTYjQ0MFlRWkhOWjhHU1VLLzQ1cVM5Qy9CMkgwM3J4 > VUNIc1QrMEx5R09EKzQNCjBkUVRhaGNNTUp3TEtGeDM3K3hWdnZTY0xBTUNBWk9rK3pJOU40 > SmZMYXl2Y1pvZFhsOEFFUUVBQWNMQlpRUVlBUUlBRHdVQ1QzOHINClpRSWJEQVVKQ1dZQmdB > QUtDUkJ1ZUNyQVBKc00rVXpVRC80Ni9UWnNWTDRIK3ZNTmd1VHZDbXVsM3p0SytONW94d1hM > WkZNM2dDWVINCkV5Lzc4M0lLcG9IN1VTT2FyWlhhbjVYVitPdUpxS3B6bkpKSnVVV096TVNB > cnFZZHBPYmJ4anU5UE5NTEZjNnlIWkZLemtnZGJMOTANCmZOc1hqczQyR0V1VmdrOHZxbzVh > SHFkZW9ablZIV2l1N0RKdTBVN3J5dllPM2hwYUlRd1dTU0Juck5hdnoyNm0rYlIzWEVhNCtv > RXYNCm16TUVQOURHLzR5bUtGaE9nQnZqd0RHOXhrbjFwN05veXcrMTdjRVRZcC9rRTBDcEti > dGFzaFYvUU81K0Qxc0UwakoyUXkrVG1YaWwNCjUyTm5taGdOWlltKzZxM1VZVm04SjNqNHNZ > ektHTEFVUnBQa0puZmpTejZPbE1Kc2NCYWtRWi9vdWwvZWI2REN0dnFXZ1pUeU1MOTINCmsz > WnZRUGJrMFpNMTU5b3NDS2JrcFlFKzllcGdMYkxJUStIYWVORHg4VWtRY1dCUkg5cU0rUm5q > YlFFQldjNnFJaWhnV0s1VjhOYUINCmZBTW5VUDZNQlNrM1E3OXlWdlRCSjJ5b3lMbVFxT3c1 > YnRPamhiTzBibWJ5eEhPN1dQNmZGOVR1c3hEN281anB6aUpCY1RERmc2ZTANCjkrZWw0c2U4 > Tkhta3lLNG54RGRsSWFaa0hrNEFHTXYyOFkwdE1NMWZ2QnVJelRDZS82c0V5ajNTcWsvZ2hk > UmNDMEp0SGN0UUY0L3gNCmp3TEZsV0hqUXRiVGpPMkVsd1AvRmtKQ2xPUy85VmEyZDBDWGIz > bXYvK0d1YmtuR0FuWkpjNk9tbU1SOXRaQ2Iycm9MZmJVeHJXcTENCjNPL01TbU5rOUszMFhY > SHVlNkRLMmtoUWlMNmEwajRVbGNiQlRnUlRueWU0QVJBQXJlak1oOVN4TitiTFdXckxqMUll > OWFDa3NHYU4NCnJvKytMeE1nR0xmZzh2MW5nVHBPVEdRT3h4N25hcjI4bk1VMm45YjZhTGpi > bTFKT1hFM2luNVVvdHU4YmI3amh6a0xSeDN6TWx4UisNCkZJSisrMVN1RkQyMkdXZGV2ZEVa > SFlGZU52cVhNTjZHeTduSHRhY1VMTHRRTmNjcHRYNldTN1g3Mk01cVVZM2I5dld6alIvc2Vp > dG0NCkFLS2U4ZGZ2OW9uYjdLWFNkTTJxR2piQ29EMEhUZGxtbTc3VUliZVVHbGNCd05yTWpz > a2NndXFTczMzb2k3L1Z1WnR3UEg2WGxSN0MNCldNMHZOaWtrRFROODdUV2FZanJtMHZHZUJQ > bmE2NGloVUxCVE96cjN4QS9QQVlMbjJZNTB3RmNxdktYVVpzSGVBTzkxaTJpb2w5d1gNCkk2 > T2M4dEkyU01XTGlvd3JoVTBLK0JXS09YYU0wWXRDSXFyejBjN05FYmxpWEpUYlZFN0hKLzRn > WlJmZkRBRDV3eFZCQkFiTWJYUloNCjhnNGVoQjZYZkc3S1NlM1hITCtRZ0ZkOGVaNWFqOU9m > K2d6ZnF3YWxvc1JKMFRPV2JuaUxPR2tZcm9HTk1DSWVkbHJ2bXl2YXFkUEENCmwyRGlCNkNi > dmsxY0JMeVU0RUIvSWluRVIzcXpVSXZwczFkamt0TmtMM1dMSVQ0QUxrMmZ3ZEdRc0JzbVFI > OEMveDB6R0JHYXZhUFoNClJTT3BEdHJZYlA5QzlXcnNHdit5Rkc0TnByOFBIb0tKa3g1MlZD > RDJRNTEyY3l5UDVSUUZvSERQQytCREtXRVpmbFdBbkNLOVozOTkNCmhYdU52MjExdlcvdnV4 > TFRreVIwQnR2aEd6L0N4SFlCWVN5Z1RGb0h4T2xOUHVVQUlNRXRieWZDd2ZjRUlBRUNBS0VG > QWxleW9GeWENCkhRSlVhR2x6SUd0bGVTQjNZWE1nWjJWdVpYSmhkR1ZrSUdGeklIQmhjblFn > YjJZZ2RHaGxJRVYyYVd3ek1pQndjbTlxWldOMExncEoNCmRDQnBjeUJ1YjNRZ2IzZHVaV1Fn > WW5rZ2RHaGxJSFZ6WlhJZ1pHVnpZM0pwWW1Wa0lHbHVJSFJvWlNCVlNVUXVDbE5sWlNCb2RI > UncNCmN6b3ZMMlYyYVd3ek1pNWpiMjB2Y21WMmIydGxaQ0JtYjNJZ2JXOXlaU0JrWlhSaGFX > eHpMZ0FLQ1JCOXB1ZVJQSnNNK2VhbEQvNHMNCkVMc0ZIa0dZVmp0S3pNOWJIbU81M0VjbVZ4 > ejVRTldmTWRyZE4zcHVkYS96SzlCYTU0VGErRFBNWXNWeXF6TDcwUmI1djIxU1hvVjANCjBH > U2lSY2pjMnpMU2RDS2xldW5FWGdvWXNCaGtickFibWRsZFVOeXB6cWhpYmlDbEhXM0kyWGgv > S2tsdW43UlBlM2ZtU2xORUV4b0INCnRmUld5d2t2MkFMMG1jVHNMc1VhdFVMQWZpL1paT3hV > SWczMC9NNElycWY3dlE1TDBlV3BiR1Q5Y3V5OGV5N1lScHhhRVUyb05yaVgNCjVSaXFnRm4x > b1Q2aWVNMUtxOHA2aTJCaDF0NnlxbFBTS2ZDOGFYcGl1V1pQVTZ0OXZNRGlibzlMck1FMEtL > cXNoU3IyQ013UUZ3UjcNClNUUWI3TjFUTE5QdlQwTXduZVUwMEdyKzJCTGJQVmNEbGJ6ck0z > UzlPcmd6emFEcENpRzVPRUZTakQvMC9XYUZSZ0lrWGNFUjVHOHANCnZFY1VqbjRpbzNmOHJY > dWZEQklhK29XN2NuWmVzM1dmano4bUVMQmNuaVBISWlUSTloU3dWb1RxeTRxeHc5dTEvelRm > WllSdnRFSlINCktNK3ZaZlViRlQrRkNkVS9ESlNqNXN4MzRWT1hwUW1NWnpYekYvU1FMTk8y > M3lUdWpjc3dVbUFEdkpBQ2ltRWNoKzhyeFVFWk1nM0sNCmxaWGRQK0FuYTU1MFp1L2YwSFVI > RXBhb1dZdVN2c1JWNnBPak5POEE0M0VSMVZ6ZXdJS0lzVVY2cDYyMFdHMVo0UEJwWUlIL1B5 > Yi8NCmxub2pENThOWXBtOFdBOHVvdjg3ZTlMd0R6MU1OWWdjN1l0VE1RbGRNQitnMGdFUGVp > Vm50MHIxdWhZNExMc05XaUR6K2MyVng4MGsNClFuSjVZVzRnUkhKbGQyVnllU0E4WW1SeVpY > ZGxjbmxBUm5KbFpVSlRSQzV2Y21jK3dzRitCQk1CQWdBb0Foc3ZCZ3NKQ0FjREFnWVYNCkNB > SUpDZ3NFRmdJREFRSWVBUUlYZ0FVQ1UrQWNHQVVKQlVVSllBQUtDUkI5cHVlUlBKc00rZnlI > RUFDVjhGU0Q1Q2RSWUQ0dFBweUMNCmF0NTlUeUkwajhWTUd2N2NjWGcrTzJwN1czUjZWYWlL > dTBNNi9BbjcwYmJCdWVjMXJkeXUrUTFmM2dXL3c1LysrdmZMZG41MTg1cXYNClNrYjgvM0p0 > TEhmQktPYThJYTJYd0NPRUI2cDJ0TFg3VTZQdzUydFdlclhjdjdjUlA2SUY5K1g1S0xpd1FE > cmNnbzFKaEUwMk5LeVMNCmxnam85WFZFN3FQUTVpbnhiT1ptRW8waDlXNjFKb0dwSUlIcitq > RzJwNGFvK0daVlhiZDNPc05sWVA4ZHlTS0tQSXZWdlRzeVMvM0kNCk5kRjg1dUE4cDNEL0lQ > NHQrYzNsOUM2MVJPQkp0cmQ0cnR2YmZqT0NJK2lWOE4rT3ArZjJpN01DeVhZUmY5TWlET0My > SWFwZ1BMR1kNCktEa1RURFMzK2NTbUg3WE8zSS94TEIydjJXWlVFa0wxYktQT1NodWlNWk55 > MkUzRmpVS29FZXhWRFBhZEdHMHBsTTM3a3l0amZEa2wNCmoyVnNDY1h1UFl0UjF0V29mcE14 > MU1xWDFteGhuNjRkZ0FJN3RMbGcwOUJPYUIxY0prZE10UDZYMEJYMEdVczJBK0trc2F1YnZz > ZHoNCjNONDN4Z1c4RmQ1MzFBZWU1d0ZUd1VEMkcyT1NWOWhkSFhoSkhUTVFHdDhIU3lzRDBS > Z2R5OUNLazk2bEFVQk11QzVGNy9na085M1kNCmVRVW5iTVIzVkJlc3BraEgzSmtoMnNNZHNB > MkZpQllSZVBac1dMdEdMOGlxQXlHNUtMU2Yva2RyY210M3RDNUxKMndKa2lzOGtRYVoNCmdK > VW5Vc291MUpjaU1mWlBsZEpMVEtBUHhtelBuM0RLa3RQUUdxUnhQWW1HR2Jma1FYYWNpMXYv > LzhiQVRnUlRucFd4QVFnQW01OXoNCjRzVk1JeU84Lzl6WVpWTVlWZDZlVVNvMUxWbktVbmdR > M2h0ZGxPWjZncHZBMnc5VEhBUmUxam40dEcycFpCMkVqV0puSkJoa0NVNisNCmpXRFNyaTNP > S2xmVmh4Ym40dm1zV2ZwZmh0OVU3L3dCSkliejZ4elFOZnJlT2tXWlU0VHpBTTMrSUhwS2ZU > cDB4MEpCbVpZdURCUEoNCmJNKzlBSVgvYThIcTFqZGF0OHUrcFZqWXVJOUtvQVJFUnczZE1V > eEdlbGphQkNYREZDMmVKa0YrcDJpckp0Vnh4MUk2OU5sdnh2c2YNCkk2enRDQ1VxM3paZGUy > K0V4K0IvTkF5bWxaMzd2RE1oWFozMldsai9BQlFYQk5QQUp1QTRLdEprdzZRcGdkSXl0L05C > K0kxVC83bWQNCk02Vzhwb2ptTTAzb1Zkcmg0Tm9NWnIyaHBGNDdIUzZjQVFBZzZVS0RxOExB > OXdRZ0FRSUFvUVVDVjdLZ2o1b2RBbFJvYVhNZ2EyVjUNCklIZGhjeUJuWlc1bGNtRjBaV1Fn > WVhNZ2NHRnlkQ0J2WmlCMGFHVWdSWFpwYkRNeUlIQnliMnBsWTNRdUNrbDBJR2x6SUc1dmRD > QnYNCmQyNWxaQ0JpZVNCMGFHVWdkWE5sY2lCa1pYTmpjbWxpWldRZ2FXNGdkR2hsSUZWSlJD > NEtVMlZsSUdoMGRIQnpPaTh2WlhacGJETXkNCkxtTnZiUzl5WlhadmEyVmtJR1p2Y2lCdGIz > SmxJR1JsZEdGcGJITXVBQW9KRU1EeS9ldHVScGZQOTFjSC8yYjdzYk54MEpwUlZSQkQNCkIr > VDdMK0Evbml1dnlKcFRoZ3pmK3JJK1ZjdVBiSkdmdDJUNzM4NzQzY0V1VzMxM3dmanpTL1My > RlczV0hJUFI5TG9RTG11VitsVk8NCm0xY0cxZlhLRGoxdGdBOW8yTkhEUkpjajk4cDVYK2NG > eGg5Q1U3SlQ2T2ZrZ2JROGhpQWd2N2hWYkNwQVplK3hyNFlFeHlMNHo4WmoNCmhRM3drWURE > Z3FyMWhleFlWVWEzenVVK1FGQXJ4eEhld0V0cVF1bC9VLzlIamNpRmY1dmUzTnFvSUF5c2ZD > YXE5dmdBelNzRzVUSkQNCmY5akZtNnE1ek5kOER3Y0hHSG5oRTRheitXOUg4MWxHckR5S1VH > ZVRXZ2ZyN0dnSkpyQkFjTEh5Y3B4WHlzdDU3a2hUUDhPUEZOdmgNCmlKNUtiWi9LNXMvQWVP > YjlHNVpVcmVyTkpFSnllV0Z1SUVSeVpYZGxjbmtnUEdKa2NtVjNaWEo1UUVaeVpXVkNVMFF1 > YjNKblBzTEENCmZnUVRBUUlBS0FJYkx3WUxDUWdIQXdJR0ZRZ0NDUW9MQkJZQ0F3RUNIZ0VD > RjRBRkFsUGdMWGtGQ1FndjNjZ0FDZ2tRd1BMOTYyNUcNCmw4OGFCUWYvWEhxbCtXY0U1QTA2 > Vnlpc2ZTSnhYVEM1cUxSSjl4Ti9vOHNrKzdXVnFUK0ptSHB5Q3VrbWo5SXd0UElTVEgycjZx > bnkNCjExcTViT3RJZUxUNFFZSklhKzdVcVNyZ1VVZHVKcHhGTzN5ZWVwYkJxdWhEbmZzNnBq > NzNPMFpIM3RpdlZxVytiaGg1RDkrZlFwRGkNCmNRTlZwWDk0TmpsTys5anVCd0wzc2JZTUVu > YTAvTFg4UUF1ZGtRZDMyczdUK2ZHOVd3WDhWVm1mRTZBeUZLM1I2eXFhQjVyajMyWVkNCkdv > SmNLcXRsQitVNThLK3h2a0N2N1lDc1Z1TWRJc0E0Y25yRDNuWDdMZENkTUtKemhnam5USmty > Mlh5QkFGQWs4dVhEdTdPTEtYMnINCjBKb1BsVnEzdytVZWZqeDdrMTZvSlZRZUtRT3NDbm1r > QXl2c3JFZW04QWVMaGc9PQ0KPWtySU8NCi0tLS0tRU5EIFBHUCBQVUJMSUMgS0VZIEJMT0NL > LS0tLS0NCg== > --------------9CBC57D81FB1CF44779F663A-- > > --xQRNdJYoXBOGEU9TCnYnmX8FWGVxUTnsh-- > > --DvEGZHRjSTag0u76mwejgpWCFKL1X8kJx > Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" > Content-Description: OpenPGP digital signature > Content-Disposition: attachment; filename="OpenPGP_signature" > > -----BEGIN PGP SIGNATURE----- > > wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl+po4cFAwAAAAAACgkQNddxu25Gl89b > 1ggAues8XaQpTjYn+ujNLEomZaJVX7zCzvFzMAfdKE4ogwi0Bdaaj+43FnJm+aEf6YQV/d8+9A4x > MhJW1CaIShmm4z7ZwwtREtGgMHZ0qW4uW7/gKhQZq+ARbKvUvY5nCNlUu2taA8h63YlCUkV59OXT > RGx6Rw7SKvkbv6mXpDw+WUXbGrPcSAUdNhhfyHGWXegxmGRx5VcjzjxMVb7T7PHgFTqQqkXYeRKS > WZORZ0GXq2TSCcq/JcWRyEOjLqFUmzZ26ZHICiGLtlhsqQMfNoajrvwa1w5v21aFYajXaztjI17j > X+Q90XVoCWK3tBMrdH9UhIuqMpIqGMCEZm+T5T3fmQ== > =GE65 > -----END PGP SIGNATURE----- > > --DvEGZHRjSTag0u76mwejgpWCFKL1X8kJx-- From owner-svn-src-all@freebsd.org Tue Nov 10 07:47:25 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 322CC2E61D2; Tue, 10 Nov 2020 07:47:25 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVg1n0xWFz3FwJ; Tue, 10 Nov 2020 07:47:25 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1343B1F4A8; Tue, 10 Nov 2020 07:47:25 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AA7lO19032508; Tue, 10 Nov 2020 07:47:24 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AA7lOEh032507; Tue, 10 Nov 2020 07:47:24 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011100747.0AA7lOEh032507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 10 Nov 2020 07:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367546 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 367546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 07:47:25 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 10 07:47:24 2020 New Revision: 367546 URL: https://svnweb.freebsd.org/changeset/base/367546 Log: MFC r367291: rc.d/zfs: Add shutdown to KEYWORDS The problem is that without walling /etc/rc.d/zfs on shutdown, resources associated with ZFS mounts are not freed and the jails will remain in dying state. In addition, the dataset is now in a dangling state, as the jail it is attached to is dying. A known workaround for jails was to add the following lines to /etc/jail.conf, to make sure that "service zfs stop" is run when the jail is stopped: exec.stop = "/bin/sh /etc/rc.shutdown"; exec.stop += "/usr/sbin/service zfs stop || /usr/bin/true"; While the workaround seems to be okay-ish for the jail situation, it is still unclean. However, for physical hosts this may wreak havoc with the pool if shared spares are used, as "zfs unshare" is never invoked on shutdown. PR: 147444 Submitted by: Markus Stoff Reported by: Mykah Reviewed by: cy Approved by: cy (src) Relnotes: yes Modified: stable/12/libexec/rc/rc.d/zfs Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/zfs ============================================================================== --- stable/12/libexec/rc/rc.d/zfs Tue Nov 10 02:26:44 2020 (r367545) +++ stable/12/libexec/rc/rc.d/zfs Tue Nov 10 07:47:24 2020 (r367546) @@ -6,6 +6,7 @@ # PROVIDE: zfs # REQUIRE: zfsbe # BEFORE: FILESYSTEMS var +# KEYWORD: shutdown . /etc/rc.subr From owner-svn-src-all@freebsd.org Tue Nov 10 08:33:46 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FA202E7333; Tue, 10 Nov 2020 08:33:46 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVh3G0Nm0z3JTC; Tue, 10 Nov 2020 08:33:46 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0007D20031; Tue, 10 Nov 2020 08:33:45 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AA8Xj55063452; Tue, 10 Nov 2020 08:33:45 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AA8XjNR063451; Tue, 10 Nov 2020 08:33:45 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011100833.0AA8XjNR063451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 10 Nov 2020 08:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367547 - stable/12/tools/build X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/tools/build X-SVN-Commit-Revision: 367547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 08:33:46 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 10 08:33:45 2020 New Revision: 367547 URL: https://svnweb.freebsd.org/changeset/base/367547 Log: MFC r367072: Mount devfs inside a beinstall(8) chroot It turns out that without /dev/null beinstall is not able to complete and instead exits with messages similar to these: -------------------------------------------------------------- >>> Installing kernel GENERIC completed on Sun Oct 25 17:47:37 CET 2020 -------------------------------------------------------------- /tmp/beinstall.JleGoP/mnt: Inspecting dirs /usr/src /usr/obj/usr/src/amd64.amd64 --- installworld --- make[1]: "/usr/obj/usr/src/amd64.amd64/toolchain-metadata.mk" line 1: Using cached toolchain metadata from build at t480 on Sun Oct 25 15:53:28 CET 2020 make[2]: "/dev/null" line 2: Need an operator make[2]: Fatal errors encountered -- cannot continuemake[1]: "/usr/src/Makefile.inc1" line 593: CPUTYPE global should be set with ?=. Cleaning up ... umount -f /tmp/beinstall.JleGoP/mnt/usr/src /tmp/beinstall.JleGoP/mnt/usr/obj/usr/src/amd64.amd64 /tmp/beinstall.JleGoP/mnt Destroyed successfully error: Installworld failed! Upon a bit of debugging, it turns out that /dev/null inside the chroot environment is full random bytes, which cause "make -f /dev/null" to misbehave. Mounting a proper devfs inside the chroot seems to be the most appropriate way to fix it. will@ also noted that this change requires that whatever is needed in devfs must exist in the old kernel. Approved by: will Modified: stable/12/tools/build/beinstall.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/tools/build/beinstall.sh ============================================================================== --- stable/12/tools/build/beinstall.sh Tue Nov 10 07:47:24 2020 (r367546) +++ stable/12/tools/build/beinstall.sh Tue Nov 10 08:33:45 2020 (r367547) @@ -216,6 +216,7 @@ fi create_be_dirs "${srcdir}" "${objdir}" || errx "Unable to create BE dirs" mount -t nullfs "${srcdir}" "${BE_MNTPT}${srcdir}" || errx "Unable to mount src" mount -t nullfs "${objdir}" "${BE_MNTPT}${objdir}" || errx "Unable to mount obj" +mount -t devfs devfs "${BE_MNTPT}/dev" || errx "Unable to mount devfs" chroot ${BE_MNTPT} make "$@" -C ${srcdir} installworld || \ errx "Installworld failed!" From owner-svn-src-all@freebsd.org Tue Nov 10 08:59:56 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46D9C2E7F8F; Tue, 10 Nov 2020 08:59:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVhdS1cQjz3Kys; Tue, 10 Nov 2020 08:59:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A29720583; Tue, 10 Nov 2020 08:59:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AA8xtd6077325; Tue, 10 Nov 2020 08:59:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AA8xtmY077324; Tue, 10 Nov 2020 08:59:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011100859.0AA8xtmY077324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 10 Nov 2020 08:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367548 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 367548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 08:59:56 -0000 Author: kib Date: Tue Nov 10 08:59:55 2020 New Revision: 367548 URL: https://svnweb.freebsd.org/changeset/base/367548 Log: MFC r367296: if_media.c SIOCGMEDIAX handler: improve loop Modified: stable/12/sys/net/if_media.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if_media.c ============================================================================== --- stable/12/sys/net/if_media.c Tue Nov 10 08:33:45 2020 (r367547) +++ stable/12/sys/net/if_media.c Tue Nov 10 08:59:55 2020 (r367548) @@ -301,15 +301,17 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, st * allocate. */ i = 0; - LIST_FOREACH(ep, &ifm->ifm_list, ifm_list) - if (i++ < ifmr->ifm_count) { + LIST_FOREACH(ep, &ifm->ifm_list, ifm_list) { + if (i < ifmr->ifm_count) { error = copyout(&ep->ifm_media, - ifmr->ifm_ulist + i - 1, sizeof(int)); - if (error) + ifmr->ifm_ulist + i, sizeof(int)); + if (error != 0) break; } + i++; + } if (error == 0 && i > ifmr->ifm_count) - error = ifmr->ifm_count ? E2BIG : 0; + error = ifmr->ifm_count != 0 ? E2BIG : 0; ifmr->ifm_count = i; break; } From owner-svn-src-all@freebsd.org Tue Nov 10 10:17:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03C2C2EA3C7; Tue, 10 Nov 2020 10:17:12 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVkLb6bKkz3Qbp; Tue, 10 Nov 2020 10:17:11 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5110211D7; Tue, 10 Nov 2020 10:17:11 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAAHBZc027275; Tue, 10 Nov 2020 10:17:11 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAAHBjE027274; Tue, 10 Nov 2020 10:17:11 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011101017.0AAAHBjE027274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 10 Nov 2020 10:17:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367549 - head X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 10:17:12 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 10 10:17:11 2020 New Revision: 367549 URL: https://svnweb.freebsd.org/changeset/base/367549 Log: Add an entry to RELNOTES about renaming ACPI_DMAR to IOMMU Reviewed by: br (earlier version) Differential Revision: https://reviews.freebsd.org/D26813 Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Tue Nov 10 08:59:55 2020 (r367548) +++ head/RELNOTES Tue Nov 10 10:17:11 2020 (r367549) @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r366267: + Kernel option ACPI_DMAR was renamed to IOMMU. amd64's IOMMU subsystem + was split out from amd64 DMAR support and is now generic, i.e., it can + be used by all architectures. + r364896: A series of commits ending with r364896 added NFS over TLS to the kernel. This is believed to be compatible with From owner-svn-src-all@freebsd.org Tue Nov 10 10:19:56 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 092C92EA45A; Tue, 10 Nov 2020 10:19:56 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVkPl6xkTz3Qp3; Tue, 10 Nov 2020 10:19:55 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1557211D8; Tue, 10 Nov 2020 10:19:55 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAAJt1h027451; Tue, 10 Nov 2020 10:19:55 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAAJtTF027449; Tue, 10 Nov 2020 10:19:55 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011101019.0AAAJtTF027449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 10 Nov 2020 10:19:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367550 - in stable/12: libexec/rc share/man/man8 X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: in stable/12: libexec/rc share/man/man8 X-SVN-Commit-Revision: 367550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 10:19:56 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 10 10:19:55 2020 New Revision: 367550 URL: https://svnweb.freebsd.org/changeset/base/367550 Log: MFC r351863: rc: Honor ${name}_env when a custom *_cmd is defined (e.g., start_cmd) A user may set ${name}_env variable in rc.conf(5) in order to set additional environment variables for a service command. Unfortunately, at the moment this variable is only honored when the command is specified via the command variable. Those additional environment variables coming from ${name}_env are never set if the service is started via the ${rc_arg}_cmd variable (for example start_cmd). PR: 239692 Reviewed by: bcr, jilles Approved by: src (jilles) Requested by: koobs Modified: stable/12/libexec/rc/rc.subr stable/12/share/man/man8/rc.subr.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.subr ============================================================================== --- stable/12/libexec/rc/rc.subr Tue Nov 10 10:17:11 2020 (r367549) +++ stable/12/libexec/rc/rc.subr Tue Nov 10 10:19:55 2020 (r367550) @@ -1024,6 +1024,9 @@ run_rc_command() _postcmd=\$${rc_arg}_postcmd if [ -n "$_cmd" ]; then + if [ -n "$_env" ]; then + eval "export -- $_env" + fi _run_rc_precmd || return 1 _run_rc_doit "$_cmd $rc_extra_args" || return 1 _run_rc_postcmd Modified: stable/12/share/man/man8/rc.subr.8 ============================================================================== --- stable/12/share/man/man8/rc.subr.8 Tue Nov 10 10:17:11 2020 (r367549) +++ stable/12/share/man/man8/rc.subr.8 Tue Nov 10 10:19:55 2020 (r367550) @@ -556,9 +556,19 @@ is mounted. A list of environment variables to run .Va command with. -This will be passed as arguments to the +Those variables will be passed as arguments to the .Xr env 1 -utility. +utility unless +.Ar argument Ns Va _cmd +is defined. +In that case the contents of +.Va ${name}_env +will be exported via the +.Xr export 1 +builtin of +.Xr sh 1 , +which puts some limitations on the names of variables +(e.g., a variable name may not start with a digit). .It Va ${name}_env_file A file to source for environmental variables to run .Va command From owner-svn-src-all@freebsd.org Tue Nov 10 10:40:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8088E2EAEC2; Tue, 10 Nov 2020 10:40:45 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVksn3DDNz3hkZ; Tue, 10 Nov 2020 10:40:45 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61AEA216A8; Tue, 10 Nov 2020 10:40:45 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAAejXa040101; Tue, 10 Nov 2020 10:40:45 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAAejw6040085; Tue, 10 Nov 2020 10:40:45 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011101040.0AAAejw6040085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 10 Nov 2020 10:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367551 - head X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 10:40:45 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 10 10:40:44 2020 New Revision: 367551 URL: https://svnweb.freebsd.org/changeset/base/367551 Log: Add an entry for r351863 (honoring ${name}_env in rc(8) scripts) PR: 239692 Requested by: koobs Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Tue Nov 10 10:19:55 2020 (r367550) +++ head/RELNOTES Tue Nov 10 10:40:44 2020 (r367551) @@ -157,6 +157,13 @@ r352304: ntpd is no longer by default locked in memory. rlimit memlock 32 or rlimit memlock 0 can be used to restore this behaviour. +r351863: + rc.subr(8) now honors ${name}_env in all rc(8) scripts. Previously, + environment variables set by a user via ${name}_env were ignored + if the service defined a custom *_cmd variable to control the behavior + of the run_rc_command function, e.g., start_cmd, instead of relying on + the variables like command and command_args, + r351770,r352920,r352922,r352923: dd(1) now supports conv=fsync, conv=fdatasync, oflag=fsync, oflag=sync, and iflag=fullblock flags, compatible with illumos and GNU. From owner-svn-src-all@freebsd.org Tue Nov 10 11:32:02 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E2842EC786; Tue, 10 Nov 2020 11:32:02 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVm0y48W4z3ls6; Tue, 10 Nov 2020 11:32:02 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 818CC2239F; Tue, 10 Nov 2020 11:32:02 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AABW2bo074754; Tue, 10 Nov 2020 11:32:02 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AABW2Em074753; Tue, 10 Nov 2020 11:32:02 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011101132.0AABW2Em074753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 10 Nov 2020 11:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367552 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 367552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 11:32:02 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 10 11:32:01 2020 New Revision: 367552 URL: https://svnweb.freebsd.org/changeset/base/367552 Log: Do not document MOTIFLIB in ports(7) Perhaps it made sense in 1998 (r32836), but now it feels a bit out of place. We tend to avoid documenting non-essential ports variables in the manual page (we try to document them in the Porter's Handbook instead). MFC after: 1 week Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Tue Nov 10 10:40:44 2020 (r367551) +++ head/share/man/man7/ports.7 Tue Nov 10 11:32:01 2020 (r367552) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 3, 2020 +.Dd November 10, 2020 .Dt PORTS 7 .Os .Sh NAME @@ -509,9 +509,6 @@ Normally .Xr fetch 1 . .It Va FORCE_PKG_REGISTER If set, overwrite any existing package registration on the system. -.It Va MOTIFLIB -Location of -.Pa "libXm\&." Ns Brq Pa a , Ns Pa so . .It Va INTERACTIVE If defined, only operate on a port if it requires interaction. .It Va BATCH From owner-svn-src-all@freebsd.org Tue Nov 10 12:13:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A7D02EE4A0; Tue, 10 Nov 2020 12:13:19 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVmwb3VFFz3pX0; Tue, 10 Nov 2020 12:13:19 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B19422B47; Tue, 10 Nov 2020 12:13:19 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AACDJPP001281; Tue, 10 Nov 2020 12:13:19 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AACDIS2001278; Tue, 10 Nov 2020 12:13:18 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202011101213.0AACDIS2001278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 10 Nov 2020 12:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367553 - in stable/12: share/dtrace sys/netpfil/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/12: share/dtrace sys/netpfil/ipfw X-SVN-Commit-Revision: 367553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 12:13:19 -0000 Author: ae Date: Tue Nov 10 12:13:18 2020 New Revision: 367553 URL: https://svnweb.freebsd.org/changeset/base/367553 Log: MFC r366908 (modified for stable/12 KBI): Add dtrace SDT probe ipfw:::rule-matched. It helps to reduce complexity with debugging of large ipfw rulesets. Also define several constants and translators, that can by used by dtrace scripts with this probe. Obtained from: Yandex LLC Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D26879 Added: stable/12/share/dtrace/ipfw.d - copied, changed from r366908, head/share/dtrace/ipfw.d Modified: stable/12/share/dtrace/Makefile stable/12/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/dtrace/Makefile ============================================================================== --- stable/12/share/dtrace/Makefile Tue Nov 10 11:32:01 2020 (r367552) +++ stable/12/share/dtrace/Makefile Tue Nov 10 12:13:18 2020 (r367553) @@ -21,7 +21,7 @@ SCRIPTS= blocking \ SCRIPTSDIR= ${SHAREDIR}/dtrace -DSRCS= mbuf.d +DSRCS= mbuf.d ipfw.d FILES= ${DSRCS} FILESDIR= /usr/lib/dtrace Copied and modified: stable/12/share/dtrace/ipfw.d (from r366908, head/share/dtrace/ipfw.d) ============================================================================== --- head/share/dtrace/ipfw.d Wed Oct 21 15:01:33 2020 (r366908, copy source) +++ stable/12/share/dtrace/ipfw.d Tue Nov 10 12:13:18 2020 (r367553) @@ -68,29 +68,17 @@ inline string ipfw_retcodes[int ret] = /* ip_fw_args flags */ #pragma D binding "1.0" IPFW_ARGS_ETHER -inline int IPFW_ARGS_ETHER = 0x00010000; /* valid ethernet header */ +inline int IPFW_ARGS_ETHER = 0x0001; /* valid ethernet header */ #pragma D binding "1.0" IPFW_ARGS_NH4 -inline int IPFW_ARGS_NH4 = 0x00020000; /* IPv4 next hop in hopstore */ +inline int IPFW_ARGS_NH4 = 0x0002; /* IPv4 next hop in hopstore */ #pragma D binding "1.0" IPFW_ARGS_NH6 -inline int IPFW_ARGS_NH6 = 0x00040000; /* IPv6 next hop in hopstore */ +inline int IPFW_ARGS_NH6 = 0x0004; /* IPv6 next hop in hopstore */ #pragma D binding "1.0" IPFW_ARGS_NH4PTR -inline int IPFW_ARGS_NH4PTR = 0x00080000; /* IPv4 next hop in next_hop */ +inline int IPFW_ARGS_NH4PTR = 0x0008; /* IPv4 next hop in next_hop */ #pragma D binding "1.0" IPFW_ARGS_NH6PTR -inline int IPFW_ARGS_NH6PTR = 0x00100000; /* IPv6 next hop in next_hop6 */ +inline int IPFW_ARGS_NH6PTR = 0x0010; /* IPv6 next hop in next_hop6 */ #pragma D binding "1.0" IPFW_ARGS_REF -inline int IPFW_ARGS_REF = 0x00200000; /* valid ipfw_rule_ref */ -#pragma D binding "1.0" IPFW_ARGS_IN -inline int IPFW_ARGS_IN = 0x00400000; /* called on input */ -#pragma D binding "1.0" IPFW_ARGS_OUT -inline int IPFW_ARGS_OUT = 0x00800000; /* called on output */ -#pragma D binding "1.0" IPFW_ARGS_IP4 -inline int IPFW_ARGS_IP4 = 0x01000000; /* belongs to v4 ISR */ -#pragma D binding "1.0" IPFW_ARGS_IP6 -inline int IPFW_ARGS_IP6 = 0x02000000; /* belongs to v6 ISR */ -#pragma D binding "1.0" IPFW_ARGS_DROP -inline int IPFW_ARGS_DROP = 0x04000000; /* drop it (dummynet) */ -#pragma D binding "1.0" IPFW_ARGS_LENMASK -inline int IPFW_ARGS_LENMASK = 0x0000ffff; /* length of data in *mem */ +inline int IPFW_ARGS_REF = 0x0020; /* valid ipfw_rule_ref */ /* ipfw_rule_ref.info */ #pragma D binding "1.0" IPFW_INFO_MASK @@ -147,17 +135,13 @@ typedef struct ipfw_match_info { #pragma D binding "1.0" translator translator ipfw_match_info_t < struct ip_fw_args *p > { flags = p->flags; - m = (p->flags & IPFW_ARGS_LENMASK) ? NULL : p->m; - mem = (p->flags & IPFW_ARGS_LENMASK) ? p->mem : NULL; + m = p->m; + mem = NULL; inp = p->inp; - ifp = p->ifp; + ifp = p->oif; /* Initialize IP pointer corresponding to addr_type */ - ipp = (p->flags & IPFW_ARGS_IP4) ? - (p->flags & IPFW_ARGS_LENMASK) ? (struct ip *)p->mem : - (p->m != NULL) ? (struct ip *)p->m->m_data : NULL : NULL; - ip6p = (p->flags & IPFW_ARGS_IP6) ? - (p->flags & IPFW_ARGS_LENMASK) ? (struct ip6_hdr *)p->mem : - (p->m != NULL) ? (struct ip6_hdr *)p->m->m_data : NULL : NULL; + ipp = (p->m != NULL) ? (struct ip *)p->m->m_data : NULL; + ip6p = (p->m != NULL) ? (struct ip6_hdr *)p->m->m_data : NULL; /* fill f_id fields */ addr_type = p->f_id.addr_type; Modified: stable/12/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw2.c Tue Nov 10 11:32:01 2020 (r367552) +++ stable/12/sys/netpfil/ipfw/ip_fw2.c Tue Nov 10 12:13:18 2020 (r367553) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -105,6 +106,18 @@ __FBSDID("$FreeBSD$"); #include #endif +#define IPFW_PROBE(probe, arg0, arg1, arg2, arg3, arg4, arg5) \ + SDT_PROBE6(ipfw, , , probe, arg0, arg1, arg2, arg3, arg4, arg5) + +SDT_PROVIDER_DEFINE(ipfw); +SDT_PROBE_DEFINE6(ipfw, , , rule__matched, + "int", /* retval */ + "int", /* af */ + "void *", /* src addr */ + "void *", /* dst addr */ + "struct ip_fw_args *", /* args */ + "struct ip_fw *" /* rule */); + /* * static variables followed by global ones. * All ipfw global variables are here. @@ -3188,6 +3201,13 @@ do { \ struct ip_fw *rule = chain->map[f_pos]; /* Update statistics */ IPFW_INC_RULE_COUNTER(rule, pktlen); + IPFW_PROBE(rule__matched, retval, + is_ipv4 ? AF_INET : AF_INET6, + is_ipv4 ? (uintptr_t)&src_ip : + (uintptr_t)&args->f_id.src_ip6, + is_ipv4 ? (uintptr_t)&dst_ip : + (uintptr_t)&args->f_id.dst_ip6, + args, rule); } else { retval = IP_FW_DENY; printf("ipfw: ouch!, skip past end of rules, denying packet\n"); From owner-svn-src-all@freebsd.org Tue Nov 10 12:46:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EE802EF617; Tue, 10 Nov 2020 12:46:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVnfJ17Kdz3rmL; Tue, 10 Nov 2020 12:46:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 199B922E49; Tue, 10 Nov 2020 12:46:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AACjxrq019970; Tue, 10 Nov 2020 12:45:59 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AACjxJN019967; Tue, 10 Nov 2020 12:45:59 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202011101245.0AACjxJN019967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 10 Nov 2020 12:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367554 - in stable/12: share/man/man4 sys/netinet sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netinet sys/sys X-SVN-Commit-Revision: 367554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 12:46:00 -0000 Author: ae Date: Tue Nov 10 12:45:59 2020 New Revision: 367554 URL: https://svnweb.freebsd.org/changeset/base/367554 Log: MFC r366695: Implement SIOCGIFALIAS. It is lightweight way to check if an IPv4 address exists. Submitted by: Roy Marples Differential Revision: https://reviews.freebsd.org/D26636 Modified: stable/12/share/man/man4/netintro.4 stable/12/sys/netinet/in.c stable/12/sys/sys/sockio.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/netintro.4 ============================================================================== --- stable/12/share/man/man4/netintro.4 Tue Nov 10 12:13:18 2020 (r367553) +++ stable/12/share/man/man4/netintro.4 Tue Nov 10 12:45:59 2020 (r367554) @@ -28,7 +28,7 @@ .\" @(#)netintro.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd January 26, 2012 +.Dd October 14, 2020 .Dt NETINTRO 4 .Os .Sh NAME @@ -349,6 +349,13 @@ multiple masks or destination addresses, and also adop convention that specification of the default address means to delete the first address for the interface belonging to the address family in which the original socket was opened. +.It Dv SIOCGIFALIAS +This request provides means to get additional addresses +together with netmask and broadcast/destination from an +interface. +It also uses the +.Vt ifaliasreq +structure. .It Dv SIOCGIFCONF Get interface configuration list. This request takes an Modified: stable/12/sys/netinet/in.c ============================================================================== --- stable/12/sys/netinet/in.c Tue Nov 10 12:13:18 2020 (r367553) +++ stable/12/sys/netinet/in.c Tue Nov 10 12:45:59 2020 (r367554) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); static int in_aifaddr_ioctl(u_long, caddr_t, struct ifnet *, struct thread *); static int in_difaddr_ioctl(u_long, caddr_t, struct ifnet *, struct thread *); +static int in_gifaddr_ioctl(u_long, caddr_t, struct ifnet *, struct thread *); static void in_socktrim(struct sockaddr_in *); static void in_purgemaddrs(struct ifnet *); @@ -240,6 +241,11 @@ in_control(struct socket *so, u_long cmd, caddr_t data case SIOCGIFDSTADDR: case SIOCGIFNETMASK: break; + case SIOCGIFALIAS: + sx_xlock(&in_control_sx); + error = in_gifaddr_ioctl(cmd, data, ifp, td); + sx_xunlock(&in_control_sx); + return (error); case SIOCDIFADDR: sx_xlock(&in_control_sx); error = in_difaddr_ioctl(cmd, data, ifp, td); @@ -648,6 +654,60 @@ in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifne IFADDR_EVENT_DEL); ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ + return (0); +} + +static int +in_gifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) +{ + struct in_aliasreq *ifra = (struct in_aliasreq *)data; + const struct sockaddr_in *addr = &ifra->ifra_addr; + struct epoch_tracker et; + struct ifaddr *ifa; + struct in_ifaddr *ia; + + /* + * ifra_addr must be present and be of INET family. + */ + if (addr->sin_len != sizeof(struct sockaddr_in) || + addr->sin_family != AF_INET) + return (EINVAL); + + /* + * See whether address exist. + */ + ia = NULL; + NET_EPOCH_ENTER_ET(et); + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + struct in_ifaddr *it; + + if (ifa->ifa_addr->sa_family != AF_INET) + continue; + + it = (struct in_ifaddr *)ifa; + if (it->ia_addr.sin_addr.s_addr == addr->sin_addr.s_addr && + prison_check_ip4(td->td_ucred, &addr->sin_addr) == 0) { + ia = it; + break; + } + } + if (ia == NULL) { + NET_EPOCH_EXIT_ET(et); + return (EADDRNOTAVAIL); + } + + ifra->ifra_mask = ia->ia_sockmask; + if ((ifp->if_flags & IFF_POINTOPOINT) && + ia->ia_dstaddr.sin_family == AF_INET) + ifra->ifra_dstaddr = ia->ia_dstaddr; + else if ((ifp->if_flags & IFF_BROADCAST) && + ia->ia_broadaddr.sin_family == AF_INET) + ifra->ifra_broadaddr = ia->ia_broadaddr; + else + memset(&ifra->ifra_broadaddr, 0, + sizeof(ifra->ifra_broadaddr)); + + NET_EPOCH_EXIT_ET(et); return (0); } Modified: stable/12/sys/sys/sockio.h ============================================================================== --- stable/12/sys/sys/sockio.h Tue Nov 10 12:13:18 2020 (r367553) +++ stable/12/sys/sys/sockio.h Tue Nov 10 12:45:59 2020 (r367554) @@ -83,6 +83,7 @@ #define SIOCSIFDESCR _IOW('i', 41, struct ifreq) /* set ifnet descr */ #define SIOCGIFDESCR _IOWR('i', 42, struct ifreq) /* get ifnet descr */ #define SIOCAIFADDR _IOW('i', 43, struct ifaliasreq)/* add/chg IF alias */ +#define SIOCGIFALIAS _IOWR('i', 45, struct ifaliasreq)/* get IF alias */ #define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ #define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ From owner-svn-src-all@freebsd.org Tue Nov 10 12:58:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F04D2EF771; Tue, 10 Nov 2020 12:58:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVnwf2JGxz3sPr; Tue, 10 Nov 2020 12:58:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41F2E2305F; Tue, 10 Nov 2020 12:58:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AACwQY5026424; Tue, 10 Nov 2020 12:58:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AACwQFV026423; Tue, 10 Nov 2020 12:58:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101258.0AACwQFV026423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 12:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367555 - head/sys/dev/mlx4/mlx4_ib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_ib X-SVN-Commit-Revision: 367555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 12:58:26 -0000 Author: hselasky Date: Tue Nov 10 12:58:25 2020 New Revision: 367555 URL: https://svnweb.freebsd.org/changeset/base/367555 Log: Include GID type when deleting GIDs from HW table under RoCE in mlx4ib. Refer to the Linux commit mentioned below for a more detailed description. Linux commit: a18177925c252da7801149abe217c05b80884798 Requested by: Isilon MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Tue Nov 10 12:45:59 2020 (r367554) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Tue Nov 10 12:58:25 2020 (r367555) @@ -371,8 +371,13 @@ static int mlx4_ib_del_gid(struct ib_device *device, if (!gids) { ret = -ENOMEM; } else { - for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) - memcpy(&gids[i].gid, &port_gid_table->gids[i].gid, sizeof(union ib_gid)); + for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) { + memcpy(&gids[i].gid, + &port_gid_table->gids[i].gid, + sizeof(union ib_gid)); + gids[i].gid_type = + port_gid_table->gids[i].gid_type; + } } } spin_unlock_bh(&iboe->lock); From owner-svn-src-all@freebsd.org Tue Nov 10 13:10:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1E932EFDAD; Tue, 10 Nov 2020 13:10:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpBJ6YDrz3t8B; Tue, 10 Nov 2020 13:10:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D384723234; Tue, 10 Nov 2020 13:10:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADAGBZ033064; Tue, 10 Nov 2020 13:10:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADAG6d033060; Tue, 10 Nov 2020 13:10:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101310.0AADAG6d033060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367556 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi X-SVN-Commit-Revision: 367556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:10:17 -0000 Author: hselasky Date: Tue Nov 10 13:10:15 2020 New Revision: 367556 URL: https://svnweb.freebsd.org/changeset/base/367556 Log: MFC r364860 and r366996: Implement extensible arrays API using the existing radix tree implementation in the LinuxKPI. Differential Revision: https://reviews.freebsd.org/D25101 Reviewed by: kib @ Sponsored by: Mellanox Technologies // NVIDIA Networking Added: stable/12/sys/compat/linuxkpi/common/include/linux/xarray.h - copied, changed from r364860, head/sys/compat/linuxkpi/common/include/linux/xarray.h stable/12/sys/compat/linuxkpi/common/src/linux_xarray.c - copied unchanged from r364860, head/sys/compat/linuxkpi/common/src/linux_xarray.c Modified: stable/12/sys/conf/files stable/12/sys/modules/linuxkpi/Makefile Directory Properties: stable/12/ (props changed) Copied and modified: stable/12/sys/compat/linuxkpi/common/include/linux/xarray.h (from r364860, head/sys/compat/linuxkpi/common/include/linux/xarray.h) ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/xarray.h Thu Aug 27 10:28:12 2020 (r364860, copy source) +++ stable/12/sys/compat/linuxkpi/common/include/linux/xarray.h Tue Nov 10 13:10:15 2020 (r367556) @@ -91,4 +91,10 @@ xa_err(void *ptr) return (PTR_ERR_OR_ZERO(ptr)); } +static inline void +xa_init(struct xarray *xa) +{ + xa_init_flags(xa, 0); +} + #endif /* _LINUX_XARRAY_H_ */ Copied: stable/12/sys/compat/linuxkpi/common/src/linux_xarray.c (from r364860, head/sys/compat/linuxkpi/common/src/linux_xarray.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/src/linux_xarray.c Tue Nov 10 13:10:15 2020 (r367556, copy of r364860, head/sys/compat/linuxkpi/common/src/linux_xarray.c) @@ -0,0 +1,391 @@ +/*- + * Copyright (c) 2020 Mellanox Technologies, Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include + +/* + * This function removes the element at the given index and returns + * the pointer to the removed element, if any. + */ +void * +__xa_erase(struct xarray *xa, uint32_t index) +{ + XA_ASSERT_LOCKED(xa); + + return (radix_tree_delete(&xa->root, index)); +} + +void * +xa_erase(struct xarray *xa, uint32_t index) +{ + void *retval; + + xa_lock(xa); + retval = __xa_erase(xa, index); + xa_unlock(xa); + + return (retval); +} + +/* + * This function returns the element pointer at the given index. A + * value of NULL is returned if the element does not exist. + */ +void * +xa_load(struct xarray *xa, uint32_t index) +{ + void *retval; + + xa_lock(xa); + retval = radix_tree_lookup(&xa->root, index); + xa_unlock(xa); + + return (retval); +} + +/* + * This is an internal function used to sleep until more memory + * becomes available. + */ +static void +xa_vm_wait_locked(struct xarray *xa) +{ + xa_unlock(xa); + vm_wait(NULL); + xa_lock(xa); +} + +/* + * This function iterates the xarray until it finds a free slot where + * it can insert the element pointer to by "ptr". It starts at the + * index pointed to by "pindex" and updates this value at return. The + * "mask" argument defines the maximum index allowed, inclusivly, and + * must be a power of two minus one value. The "gfp" argument + * basically tells if we can wait for more memory to become available + * or not. This function returns zero upon success or a negative error + * code on failure. A typical error code is -ENOMEM which means either + * the xarray is full, or there was not enough internal memory + * available to complete the radix tree insertion. + */ +int +__xa_alloc(struct xarray *xa, uint32_t *pindex, void *ptr, uint32_t mask, gfp_t gfp) +{ + int retval; + + XA_ASSERT_LOCKED(xa); + + /* mask cannot be zero */ + MPASS(mask != 0); + + /* mask can be any power of two value minus one */ + MPASS((mask & (mask + 1)) == 0); + + *pindex = 0; +retry: + retval = radix_tree_insert(&xa->root, *pindex, ptr); + + switch (retval) { + case -EEXIST: + if (likely(*pindex != mask)) { + (*pindex)++; + goto retry; + } + retval = -ENOMEM; + break; + case -ENOMEM: + if (likely(gfp & M_WAITOK)) { + xa_vm_wait_locked(xa); + goto retry; + } + break; + default: + break; + } + return (retval); +} + +int +xa_alloc(struct xarray *xa, uint32_t *pindex, void *ptr, uint32_t mask, gfp_t gfp) +{ + int retval; + + xa_lock(xa); + retval = __xa_alloc(xa, pindex, ptr, mask, gfp); + xa_unlock(xa); + + return (retval); +} + +/* + * This function works the same like the "xa_alloc" function, except + * it wraps the next index value to zero when there are no entries + * left at the end of the xarray searching for a free slot from the + * beginning of the array. If the xarray is full -ENOMEM is returned. + */ +int +__xa_alloc_cyclic(struct xarray *xa, uint32_t *pindex, void *ptr, uint32_t mask, + uint32_t *pnext_index, gfp_t gfp) +{ + int retval; + int timeout = 1; + + XA_ASSERT_LOCKED(xa); + + /* mask cannot be zero */ + MPASS(mask != 0); + + /* mask can be any power of two value minus one */ + MPASS((mask & (mask + 1)) == 0); + + *pnext_index = 0; +retry: + retval = radix_tree_insert(&xa->root, *pnext_index, ptr); + + switch (retval) { + case -EEXIST: + if (unlikely(*pnext_index == mask) && !timeout--) { + retval = -ENOMEM; + break; + } + (*pnext_index)++; + (*pnext_index) &= mask; + goto retry; + case -ENOMEM: + if (likely(gfp & M_WAITOK)) { + xa_vm_wait_locked(xa); + goto retry; + } + break; + default: + break; + } + *pindex = *pnext_index; + + return (retval); +} + +int +xa_alloc_cyclic(struct xarray *xa, uint32_t *pindex, void *ptr, uint32_t mask, + uint32_t *pnext_index, gfp_t gfp) +{ + int retval; + + xa_lock(xa); + retval = __xa_alloc_cyclic(xa, pindex, ptr, mask, pnext_index, gfp); + xa_unlock(xa); + + return (retval); +} + +/* + * This function tries to insert an element at the given index. The + * "gfp" argument basically decides of this function can sleep or not + * trying to allocate internal memory for its radix tree. The + * function returns an error code upon failure. Typical error codes + * are element exists (-EEXIST) or out of memory (-ENOMEM). + */ +int +__xa_insert(struct xarray *xa, uint32_t index, void *ptr, gfp_t gfp) +{ + int retval; + + XA_ASSERT_LOCKED(xa); +retry: + retval = radix_tree_insert(&xa->root, index, ptr); + + switch (retval) { + case -ENOMEM: + if (likely(gfp & M_WAITOK)) { + xa_vm_wait_locked(xa); + goto retry; + } + break; + default: + break; + } + return (retval); +} + +int +xa_insert(struct xarray *xa, uint32_t index, void *ptr, gfp_t gfp) +{ + int retval; + + xa_lock(xa); + retval = __xa_insert(xa, index, ptr, gfp); + xa_unlock(xa); + + return (retval); +} + +/* + * This function updates the element at the given index and returns a + * pointer to the old element. The "gfp" argument basically decides of + * this function can sleep or not trying to allocate internal memory + * for its radix tree. The function returns an XA_ERROR() pointer code + * upon failure. Code using this function must always check if the + * return value is an XA_ERROR() code before using the returned value. + */ +void * +__xa_store(struct xarray *xa, uint32_t index, void *ptr, gfp_t gfp) +{ + int retval; + + XA_ASSERT_LOCKED(xa); +retry: + retval = radix_tree_store(&xa->root, index, &ptr); + + switch (retval) { + case 0: + break; + case -ENOMEM: + if (likely(gfp & M_WAITOK)) { + xa_vm_wait_locked(xa); + goto retry; + } + ptr = XA_ERROR(retval); + break; + default: + ptr = XA_ERROR(retval); + break; + } + return (ptr); +} + +void * +xa_store(struct xarray *xa, uint32_t index, void *ptr, gfp_t gfp) +{ + void *retval; + + xa_lock(xa); + retval = __xa_store(xa, index, ptr, gfp); + xa_unlock(xa); + + return (retval); +} + +/* + * This function initialize an xarray structure. + */ +void +xa_init_flags(struct xarray *xa, uint32_t flags) +{ + memset(xa, 0, sizeof(*xa)); + + mtx_init(&xa->mtx, "lkpi-xarray", NULL, MTX_DEF | MTX_RECURSE); + xa->root.gfp_mask = GFP_NOWAIT; +} + +/* + * This function destroys an xarray structure and all its internal + * memory and locks. + */ +void +xa_destroy(struct xarray *xa) +{ + struct radix_tree_iter iter; + void **ppslot; + + radix_tree_for_each_slot(ppslot, &xa->root, &iter, 0) + radix_tree_iter_delete(&xa->root, &iter, ppslot); + mtx_destroy(&xa->mtx); +} + +/* + * This function checks if an xarray is empty or not. + * It returns true if empty, else false. + */ +bool +__xa_empty(struct xarray *xa) +{ + struct radix_tree_iter iter = {}; + void **temp; + + XA_ASSERT_LOCKED(xa); + + return (!radix_tree_iter_find(&xa->root, &iter, &temp)); +} + +bool +xa_empty(struct xarray *xa) +{ + bool retval; + + xa_lock(xa); + retval = __xa_empty(xa); + xa_unlock(xa); + + return (retval); +} + +/* + * This function returns the next valid xarray entry based on the + * index given by "pindex". The valued pointed to by "pindex" is + * updated before return. + */ +void * +__xa_next(struct xarray *xa, unsigned long *pindex, bool not_first) +{ + struct radix_tree_iter iter = { .index = *pindex }; + void **ppslot; + void *retval; + bool found; + + XA_ASSERT_LOCKED(xa); + + if (not_first) { + /* advance to next index, if any */ + iter.index++; + if (iter.index == 0) + return (NULL); + } + + found = radix_tree_iter_find(&xa->root, &iter, &ppslot); + if (likely(found)) { + retval = *ppslot; + *pindex = iter.index; + } else { + retval = NULL; + } + return (retval); +} + +void * +xa_next(struct xarray *xa, unsigned long *pindex, bool not_first) +{ + void *retval; + + xa_lock(xa); + retval = __xa_next(xa, pindex, not_first); + xa_unlock(xa); + + return (retval); +} Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Tue Nov 10 12:58:25 2020 (r367555) +++ stable/12/sys/conf/files Tue Nov 10 13:10:15 2020 (r367556) @@ -4568,6 +4568,9 @@ compat/linuxkpi/common/src/linux_usb.c optional compa compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_work.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_xarray.c optional compat_linuxkpi \ + compile-with "${LINUXKPI_C}" + compat/linuxkpi/common/src/linux_seq_file.c optional compat_linuxkpi | lindebugfs \ compile-with "${LINUXKPI_C}" Modified: stable/12/sys/modules/linuxkpi/Makefile ============================================================================== --- stable/12/sys/modules/linuxkpi/Makefile Tue Nov 10 12:58:25 2020 (r367555) +++ stable/12/sys/modules/linuxkpi/Makefile Tue Nov 10 13:10:15 2020 (r367556) @@ -17,7 +17,8 @@ SRCS= linux_compat.c \ linux_slab.c \ linux_tasklet.c \ linux_usb.c \ - linux_work.c + linux_work.c \ + linux_xarray.c SRCS+= ${LINUXKPI_GENSRCS} From owner-svn-src-all@freebsd.org Tue Nov 10 13:13:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C536430307; Tue, 10 Nov 2020 13:13:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpGB2bR5z3tMg; Tue, 10 Nov 2020 13:13:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BF572362D; Tue, 10 Nov 2020 13:13:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADDc0T038869; Tue, 10 Nov 2020 13:13:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADDbrR038865; Tue, 10 Nov 2020 13:13:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101313.0AADDbrR038865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367557 - in stable/11/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi X-SVN-Commit-Revision: 367557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:13:38 -0000 Author: hselasky Date: Tue Nov 10 13:13:37 2020 New Revision: 367557 URL: https://svnweb.freebsd.org/changeset/base/367557 Log: MFC r364860 and r366996: Implement extensible arrays API using the existing radix tree implementation in the LinuxKPI. Differential Revision: https://reviews.freebsd.org/D25101 Reviewed by: kib @ Sponsored by: Mellanox Technologies // NVIDIA Networking Added: stable/11/sys/compat/linuxkpi/common/include/linux/xarray.h - copied, changed from r364860, head/sys/compat/linuxkpi/common/include/linux/xarray.h stable/11/sys/compat/linuxkpi/common/src/linux_xarray.c - copied, changed from r364860, head/sys/compat/linuxkpi/common/src/linux_xarray.c Modified: stable/11/sys/conf/files stable/11/sys/modules/linuxkpi/Makefile Directory Properties: stable/11/ (props changed) Copied and modified: stable/11/sys/compat/linuxkpi/common/include/linux/xarray.h (from r364860, head/sys/compat/linuxkpi/common/include/linux/xarray.h) ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/xarray.h Thu Aug 27 10:28:12 2020 (r364860, copy source) +++ stable/11/sys/compat/linuxkpi/common/include/linux/xarray.h Tue Nov 10 13:13:37 2020 (r367557) @@ -91,4 +91,10 @@ xa_err(void *ptr) return (PTR_ERR_OR_ZERO(ptr)); } +static inline void +xa_init(struct xarray *xa) +{ + xa_init_flags(xa, 0); +} + #endif /* _LINUX_XARRAY_H_ */ Copied and modified: stable/11/sys/compat/linuxkpi/common/src/linux_xarray.c (from r364860, head/sys/compat/linuxkpi/common/src/linux_xarray.c) ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_xarray.c Thu Aug 27 10:28:12 2020 (r364860, copy source) +++ stable/11/sys/compat/linuxkpi/common/src/linux_xarray.c Tue Nov 10 13:13:37 2020 (r367557) @@ -79,7 +79,7 @@ static void xa_vm_wait_locked(struct xarray *xa) { xa_unlock(xa); - vm_wait(NULL); + vm_wait(); xa_lock(xa); } Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Tue Nov 10 13:10:15 2020 (r367556) +++ stable/11/sys/conf/files Tue Nov 10 13:13:37 2020 (r367557) @@ -4332,6 +4332,8 @@ compat/linuxkpi/common/src/linux_usb.c optional compa compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_work.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_xarray.c optional compat_linuxkpi \ + compile-with "${LINUXKPI_C}" # OpenFabrics Enterprise Distribution (Infiniband) ofed/drivers/infiniband/core/ib_addr.c optional ofed \ Modified: stable/11/sys/modules/linuxkpi/Makefile ============================================================================== --- stable/11/sys/modules/linuxkpi/Makefile Tue Nov 10 13:10:15 2020 (r367556) +++ stable/11/sys/modules/linuxkpi/Makefile Tue Nov 10 13:13:37 2020 (r367557) @@ -17,7 +17,8 @@ SRCS= linux_compat.c \ linux_slab.c \ linux_tasklet.c \ linux_usb.c \ - linux_work.c + linux_work.c \ + linux_xarray.c SRCS+= ${LINUXKPI_GENSRCS} From owner-svn-src-all@freebsd.org Tue Nov 10 13:15:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 428354301E1; Tue, 10 Nov 2020 13:15:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpJp1GR5z3tmp; Tue, 10 Nov 2020 13:15:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E3B92362E; Tue, 10 Nov 2020 13:15:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADFrfs039045; Tue, 10 Nov 2020 13:15:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADFrZw039042; Tue, 10 Nov 2020 13:15:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101315.0AADFrZw039042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367558 - in stable/12/sys/dev/usb: . serial X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/usb: . serial X-SVN-Commit-Revision: 367558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:15:54 -0000 Author: hselasky Date: Tue Nov 10 13:15:53 2020 New Revision: 367558 URL: https://svnweb.freebsd.org/changeset/base/367558 Log: MFC r367096: Add new USB IDs. Submitted by: aleksi.kaalinpaa@kapsi.fi PR: 250675 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/usb/serial/uftdi.c stable/12/sys/dev/usb/usbdevs Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/12/sys/dev/usb/serial/uftdi.c Tue Nov 10 13:13:37 2020 (r367557) +++ stable/12/sys/dev/usb/serial/uftdi.c Tue Nov 10 13:15:53 2020 (r367558) @@ -293,6 +293,8 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = { UFTDI_DEV(BBELECTRONICS, USPTL4, 0), UFTDI_DEV(BBELECTRONICS, USTL4, 0), UFTDI_DEV(BBELECTRONICS, ZZ_PROG1_USB, 0), + UFTDI_DEV(BRAINBOXES, US257, 0), + UFTDI_DEV(BRAINBOXES, US25701, 0), UFTDI_DEV(CONTEC, COM1USBH, 0), UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 0), UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 0), Modified: stable/12/sys/dev/usb/usbdevs ============================================================================== --- stable/12/sys/dev/usb/usbdevs Tue Nov 10 13:13:37 2020 (r367557) +++ stable/12/sys/dev/usb/usbdevs Tue Nov 10 13:15:53 2020 (r367558) @@ -1416,6 +1416,10 @@ product BILLIONTON USBEL100 0x0988 USB100EL product BILLIONTON USBE100 0x8511 USBE100 product BILLIONTON USB2AR 0x90ff USB2AR Ethernet +/* Brainboxes Limited products */ +product BRAINBOXES US257 0x5001 US-257 USB2Serial 2xRS232 +product BRAINBOXES US25701 0x5002 US-25701 USB2Serial 2xRS232 + /* Broadcom products */ product BROADCOM BCM2033 0x2033 BCM2033 Bluetooth USB dongle From owner-svn-src-all@freebsd.org Tue Nov 10 13:16:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C53C4430439; Tue, 10 Nov 2020 13:16:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpKd5CQxz3thr; Tue, 10 Nov 2020 13:16:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5C1223799; Tue, 10 Nov 2020 13:16:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADGbJ5039153; Tue, 10 Nov 2020 13:16:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADGbE6039151; Tue, 10 Nov 2020 13:16:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101316.0AADGbE6039151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367559 - in stable/11/sys/dev/usb: . serial X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/usb: . serial X-SVN-Commit-Revision: 367559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:16:37 -0000 Author: hselasky Date: Tue Nov 10 13:16:37 2020 New Revision: 367559 URL: https://svnweb.freebsd.org/changeset/base/367559 Log: MFC r367096: Add new USB IDs. Submitted by: aleksi.kaalinpaa@kapsi.fi PR: 250675 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/usb/serial/uftdi.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/11/sys/dev/usb/serial/uftdi.c Tue Nov 10 13:15:53 2020 (r367558) +++ stable/11/sys/dev/usb/serial/uftdi.c Tue Nov 10 13:16:37 2020 (r367559) @@ -291,6 +291,8 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = { UFTDI_DEV(BBELECTRONICS, USPTL4, 0), UFTDI_DEV(BBELECTRONICS, USTL4, 0), UFTDI_DEV(BBELECTRONICS, ZZ_PROG1_USB, 0), + UFTDI_DEV(BRAINBOXES, US257, 0), + UFTDI_DEV(BRAINBOXES, US25701, 0), UFTDI_DEV(CONTEC, COM1USBH, 0), UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 0), UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 0), Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Tue Nov 10 13:15:53 2020 (r367558) +++ stable/11/sys/dev/usb/usbdevs Tue Nov 10 13:16:37 2020 (r367559) @@ -1355,6 +1355,10 @@ product BILLIONTON USBEL100 0x0988 USB100EL product BILLIONTON USBE100 0x8511 USBE100 product BILLIONTON USB2AR 0x90ff USB2AR Ethernet +/* Brainboxes Limited products */ +product BRAINBOXES US257 0x5001 US-257 USB2Serial 2xRS232 +product BRAINBOXES US25701 0x5002 US-25701 USB2Serial 2xRS232 + /* Broadcom products */ product BROADCOM BCM2033 0x2033 BCM2033 Bluetooth USB dongle From owner-svn-src-all@freebsd.org Tue Nov 10 13:18:46 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56F7843035F; Tue, 10 Nov 2020 13:18:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpN61zlYz3tjl; Tue, 10 Nov 2020 13:18:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3709F2379B; Tue, 10 Nov 2020 13:18:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADIjWu039321; Tue, 10 Nov 2020 13:18:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADIjwn039317; Tue, 10 Nov 2020 13:18:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101318.0AADIjwn039317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367560 - in stable/12: share/man/man4 sys/dev/usb sys/dev/usb/input X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/usb sys/dev/usb/input X-SVN-Commit-Revision: 367560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:18:46 -0000 Author: hselasky Date: Tue Nov 10 13:18:44 2020 New Revision: 367560 URL: https://svnweb.freebsd.org/changeset/base/367560 Log: MFC r367236: Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4). Submitted by: pedro martelletto Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/share/man/man4/uhid.4 stable/12/sys/dev/usb/input/uhid.c stable/12/sys/dev/usb/usb_generic.c stable/12/sys/dev/usb/usb_generic.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/uhid.4 ============================================================================== --- stable/12/share/man/man4/uhid.4 Tue Nov 10 13:16:37 2020 (r367559) +++ stable/12/share/man/man4/uhid.4 Tue Nov 10 13:18:44 2020 (r367560) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2018 +.Dd Oct 31, 2020 .Dt UHID 4 .Os .Sh NAME @@ -131,6 +131,11 @@ and the .Va ugd_maxlen fields. This call may fail if the device does not support this feature. +.It Dv USB_GET_DEVICEINFO Pq Vt "struct usb_device_info" +Returns information about the device, like USB vendor ID and USB product ID. +This call will not issue any USB transactions. +Also refer to +.Xr ugen 4 . .El .Pp Use Modified: stable/12/sys/dev/usb/input/uhid.c ============================================================================== --- stable/12/sys/dev/usb/input/uhid.c Tue Nov 10 13:16:37 2020 (r367559) +++ stable/12/sys/dev/usb/input/uhid.c Tue Nov 10 13:18:44 2020 (r367560) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define USB_DEBUG_VAR uhid_debug #include @@ -143,11 +144,13 @@ static usb_fifo_cmd_t uhid_stop_write; static usb_fifo_open_t uhid_open; static usb_fifo_close_t uhid_close; static usb_fifo_ioctl_t uhid_ioctl; +static usb_fifo_ioctl_t uhid_ioctl_post; static struct usb_fifo_methods uhid_fifo_methods = { .f_open = &uhid_open, .f_close = &uhid_close, .f_ioctl = &uhid_ioctl, + .f_ioctl_post = &uhid_ioctl_post, .f_start_read = &uhid_start_read, .f_stop_read = &uhid_stop_read, .f_start_write = &uhid_start_write, @@ -644,6 +647,24 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *ad case USB_GET_REPORT_ID: *(int *)addr = 0; /* XXX: we only support reportid 0? */ + break; + + default: + error = ENOIOCTL; + break; + } + return (error); +} + +static int +uhid_ioctl_post(struct usb_fifo *fifo, u_long cmd, void *addr, + int fflags) +{ + int error; + + switch (cmd) { + case USB_GET_DEVICEINFO: + error = ugen_fill_deviceinfo(fifo, addr); break; default: Modified: stable/12/sys/dev/usb/usb_generic.c ============================================================================== --- stable/12/sys/dev/usb/usb_generic.c Tue Nov 10 13:16:37 2020 (r367559) +++ stable/12/sys/dev/usb/usb_generic.c Tue Nov 10 13:18:44 2020 (r367560) @@ -109,8 +109,6 @@ static int ugen_set_interface(struct usb_fifo *, uint8 static int ugen_get_cdesc(struct usb_fifo *, struct usb_gen_descriptor *); static int ugen_get_sdesc(struct usb_fifo *, struct usb_gen_descriptor *); static int ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd); -static int usb_gen_fill_deviceinfo(struct usb_fifo *, - struct usb_device_info *); static int ugen_re_enumerate(struct usb_fifo *); static int ugen_iface_ioctl(struct usb_fifo *, u_long, void *, int); static uint8_t ugen_fs_get_complete(struct usb_fifo *, uint8_t *); @@ -817,7 +815,7 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g } /*------------------------------------------------------------------------* - * usb_gen_fill_deviceinfo + * ugen_fill_deviceinfo * * This function dumps information about an USB device to the * structure pointed to by the "di" argument. @@ -826,8 +824,8 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static int -usb_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di) +int +ugen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di) { struct usb_device *udev; struct usb_device *hub; @@ -2216,7 +2214,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void * case USB_DEVICEINFO: case USB_GET_DEVICEINFO: - error = usb_gen_fill_deviceinfo(f, addr); + error = ugen_fill_deviceinfo(f, addr); break; case USB_DEVICESTATS: Modified: stable/12/sys/dev/usb/usb_generic.h ============================================================================== --- stable/12/sys/dev/usb/usb_generic.h Tue Nov 10 13:16:37 2020 (r367559) +++ stable/12/sys/dev/usb/usb_generic.h Tue Nov 10 13:18:44 2020 (r367560) @@ -31,5 +31,6 @@ extern struct usb_fifo_methods usb_ugen_methods; int ugen_do_request(struct usb_fifo *f, struct usb_ctl_request *ur); +int ugen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di); #endif /* _USB_GENERIC_H_ */ From owner-svn-src-all@freebsd.org Tue Nov 10 13:21:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27B5C430797; Tue, 10 Nov 2020 13:21:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpQm2WC3z3vH3; Tue, 10 Nov 2020 13:21:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A569C234F5; Tue, 10 Nov 2020 13:21:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADL3CZ041500; Tue, 10 Nov 2020 13:21:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADL280041497; Tue, 10 Nov 2020 13:21:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101321.0AADL280041497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367561 - in stable/11: share/man/man4 sys/dev/usb sys/dev/usb/input X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/usb sys/dev/usb/input X-SVN-Commit-Revision: 367561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:21:06 -0000 Author: hselasky Date: Tue Nov 10 13:21:02 2020 New Revision: 367561 URL: https://svnweb.freebsd.org/changeset/base/367561 Log: MFC r367236: Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4). Submitted by: pedro martelletto Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/share/man/man4/uhid.4 stable/11/sys/dev/usb/input/uhid.c stable/11/sys/dev/usb/usb_generic.c stable/11/sys/dev/usb/usb_generic.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/uhid.4 ============================================================================== --- stable/11/share/man/man4/uhid.4 Tue Nov 10 13:18:44 2020 (r367560) +++ stable/11/share/man/man4/uhid.4 Tue Nov 10 13:21:02 2020 (r367561) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2006 +.Dd Oct 31, 2020 .Dt UHID 4 .Os .Sh NAME @@ -114,6 +114,11 @@ It should be or .Dv UHID_FEATURE_REPORT . This call may fail if the device does not support this feature. +.It Dv USB_GET_DEVICEINFO Pq Vt "struct usb_device_info" +Returns information about the device, like USB vendor ID and USB product ID. +This call will not issue any USB transactions. +Also refer to +.Xr ugen 4 . .El .Pp Use Modified: stable/11/sys/dev/usb/input/uhid.c ============================================================================== --- stable/11/sys/dev/usb/input/uhid.c Tue Nov 10 13:18:44 2020 (r367560) +++ stable/11/sys/dev/usb/input/uhid.c Tue Nov 10 13:21:02 2020 (r367561) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define USB_DEBUG_VAR uhid_debug #include @@ -141,11 +142,13 @@ static usb_fifo_cmd_t uhid_stop_write; static usb_fifo_open_t uhid_open; static usb_fifo_close_t uhid_close; static usb_fifo_ioctl_t uhid_ioctl; +static usb_fifo_ioctl_t uhid_ioctl_post; static struct usb_fifo_methods uhid_fifo_methods = { .f_open = &uhid_open, .f_close = &uhid_close, .f_ioctl = &uhid_ioctl, + .f_ioctl_post = &uhid_ioctl_post, .f_start_read = &uhid_start_read, .f_stop_read = &uhid_stop_read, .f_start_write = &uhid_start_write, @@ -642,6 +645,24 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *ad case USB_GET_REPORT_ID: *(int *)addr = 0; /* XXX: we only support reportid 0? */ + break; + + default: + error = ENOIOCTL; + break; + } + return (error); +} + +static int +uhid_ioctl_post(struct usb_fifo *fifo, u_long cmd, void *addr, + int fflags) +{ + int error; + + switch (cmd) { + case USB_GET_DEVICEINFO: + error = ugen_fill_deviceinfo(fifo, addr); break; default: Modified: stable/11/sys/dev/usb/usb_generic.c ============================================================================== --- stable/11/sys/dev/usb/usb_generic.c Tue Nov 10 13:18:44 2020 (r367560) +++ stable/11/sys/dev/usb/usb_generic.c Tue Nov 10 13:21:02 2020 (r367561) @@ -107,8 +107,6 @@ static int ugen_set_interface(struct usb_fifo *, uint8 static int ugen_get_cdesc(struct usb_fifo *, struct usb_gen_descriptor *); static int ugen_get_sdesc(struct usb_fifo *, struct usb_gen_descriptor *); static int ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd); -static int usb_gen_fill_deviceinfo(struct usb_fifo *, - struct usb_device_info *); static int ugen_re_enumerate(struct usb_fifo *); static int ugen_iface_ioctl(struct usb_fifo *, u_long, void *, int); static uint8_t ugen_fs_get_complete(struct usb_fifo *, uint8_t *); @@ -815,7 +813,7 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g } /*------------------------------------------------------------------------* - * usb_gen_fill_deviceinfo + * ugen_fill_deviceinfo * * This function dumps information about an USB device to the * structure pointed to by the "di" argument. @@ -824,8 +822,8 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static int -usb_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di) +int +ugen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di) { struct usb_device *udev; struct usb_device *hub; @@ -2214,7 +2212,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void * case USB_DEVICEINFO: case USB_GET_DEVICEINFO: - error = usb_gen_fill_deviceinfo(f, addr); + error = ugen_fill_deviceinfo(f, addr); break; case USB_DEVICESTATS: Modified: stable/11/sys/dev/usb/usb_generic.h ============================================================================== --- stable/11/sys/dev/usb/usb_generic.h Tue Nov 10 13:18:44 2020 (r367560) +++ stable/11/sys/dev/usb/usb_generic.h Tue Nov 10 13:21:02 2020 (r367561) @@ -29,5 +29,6 @@ extern struct usb_fifo_methods usb_ugen_methods; int ugen_do_request(struct usb_fifo *f, struct usb_ctl_request *ur); +int ugen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di); #endif /* _USB_GENERIC_H_ */ From owner-svn-src-all@freebsd.org Tue Nov 10 13:22:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 530FC430646; Tue, 10 Nov 2020 13:22:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpSs1wjFz3vR0; Tue, 10 Nov 2020 13:22:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34EB723574; Tue, 10 Nov 2020 13:22:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADMr01045464; Tue, 10 Nov 2020 13:22:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADMrvO045463; Tue, 10 Nov 2020 13:22:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101322.0AADMrvO045463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367562 - stable/12/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 367562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:22:53 -0000 Author: hselasky Date: Tue Nov 10 13:22:52 2020 New Revision: 367562 URL: https://svnweb.freebsd.org/changeset/base/367562 Log: MFC r367269: Fix for referencing file via its vnode in ibore. Use the native vnode lookup functions, instead of going via the LinuxKPI, because the file referenced is typically created outside the LinuxKPI, and the LinuxKPI's fdget() can only resolve file descriptor numbers which were created by itself. The vnode pointer is used as an identifier to identify XRCD handles which are sharing resources. This patch fixes the so-called XRCD support in ibcore for FreeBSD. Refer to ibv_open_xrcd(3) for more information how the file descriptor argument is used. Reviewed by: kib@ Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Tue Nov 10 13:21:02 2020 (r367561) +++ stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Tue Nov 10 13:22:52 2020 (r367562) @@ -666,11 +666,11 @@ err_put: struct xrcd_table_entry { struct rb_node node; struct ib_xrcd *xrcd; - struct inode *inode; + struct vnode *vnode; }; static int xrcd_table_insert(struct ib_uverbs_device *dev, - struct inode *inode, + struct vnode *vnode, struct ib_xrcd *xrcd) { struct xrcd_table_entry *entry, *scan; @@ -682,15 +682,15 @@ static int xrcd_table_insert(struct ib_uverbs_device * return -ENOMEM; entry->xrcd = xrcd; - entry->inode = inode; + entry->vnode = vnode; while (*p) { parent = *p; scan = rb_entry(parent, struct xrcd_table_entry, node); - if (inode < scan->inode) { + if ((uintptr_t)vnode < (uintptr_t)scan->vnode) { p = &(*p)->rb_left; - } else if (inode > scan->inode) { + } else if ((uintptr_t)vnode > (uintptr_t)scan->vnode) { p = &(*p)->rb_right; } else { kfree(entry); @@ -700,12 +700,12 @@ static int xrcd_table_insert(struct ib_uverbs_device * rb_link_node(&entry->node, parent, p); rb_insert_color(&entry->node, &dev->xrcd_tree); - igrab(inode); + vrefact(vnode); return 0; } static struct xrcd_table_entry *xrcd_table_search(struct ib_uverbs_device *dev, - struct inode *inode) + struct vnode *vnode) { struct xrcd_table_entry *entry; struct rb_node *p = dev->xrcd_tree.rb_node; @@ -713,9 +713,9 @@ static struct xrcd_table_entry *xrcd_table_search(stru while (p) { entry = rb_entry(p, struct xrcd_table_entry, node); - if (inode < entry->inode) + if ((uintptr_t)vnode < (uintptr_t)entry->vnode) p = p->rb_left; - else if (inode > entry->inode) + else if ((uintptr_t)vnode > (uintptr_t)entry->vnode) p = p->rb_right; else return entry; @@ -724,11 +724,11 @@ static struct xrcd_table_entry *xrcd_table_search(stru return NULL; } -static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode *inode) +static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct vnode *vnode) { struct xrcd_table_entry *entry; - entry = xrcd_table_search(dev, inode); + entry = xrcd_table_search(dev, vnode); if (!entry) return NULL; @@ -736,13 +736,13 @@ static struct ib_xrcd *find_xrcd(struct ib_uverbs_devi } static void xrcd_table_delete(struct ib_uverbs_device *dev, - struct inode *inode) + struct vnode *vnode) { struct xrcd_table_entry *entry; - entry = xrcd_table_search(dev, inode); + entry = xrcd_table_search(dev, vnode); if (entry) { - iput(inode); + vrele(vnode); rb_erase(&entry->node, &dev->xrcd_tree); kfree(entry); } @@ -758,8 +758,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil struct ib_udata udata; struct ib_uxrcd_object *obj; struct ib_xrcd *xrcd = NULL; - struct fd f = {NULL}; - struct inode *inode = NULL; + struct vnode *vnode = NULL; int ret = 0; int new_xrcd = 0; @@ -777,14 +776,11 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil if (cmd.fd != -1) { /* search for file descriptor */ - f = fdget(cmd.fd); - if (!f.file) { - ret = -EBADF; + ret = -fgetvp(curthread, cmd.fd, &cap_no_rights, &vnode); + if (ret != 0) goto err_tree_mutex_unlock; - } - inode = f.file->f_dentry->d_inode; - xrcd = find_xrcd(file->device, inode); + xrcd = find_xrcd(file->device, vnode); if (!xrcd && !(cmd.oflags & O_CREAT)) { /* no file descriptor. Need CREATE flag */ ret = -EAGAIN; @@ -814,7 +810,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil goto err; } - xrcd->inode = inode; + xrcd->vnode = vnode; xrcd->device = ib_dev; atomic_set(&xrcd->usecnt, 0); mutex_init(&xrcd->tgt_qp_mutex); @@ -831,10 +827,10 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil memset(&resp, 0, sizeof resp); resp.xrcd_handle = obj->uobject.id; - if (inode) { + if (vnode != NULL) { if (new_xrcd) { - /* create new inode/xrcd table entry */ - ret = xrcd_table_insert(file->device, inode, xrcd); + /* create new vnode/xrcd table entry */ + ret = xrcd_table_insert(file->device, vnode, xrcd); if (ret) goto err_insert_xrcd; } @@ -847,8 +843,8 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil goto err_copy; } - if (f.file) - fdput(f); + if (vnode != NULL) + vrele(vnode); mutex_lock(&file->mutex); list_add_tail(&obj->uobject.list, &file->ucontext->xrcd_list); @@ -861,9 +857,9 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil return in_len; err_copy: - if (inode) { + if (vnode != NULL) { if (new_xrcd) - xrcd_table_delete(file->device, inode); + xrcd_table_delete(file->device, vnode); atomic_dec(&xrcd->usecnt); } @@ -877,8 +873,8 @@ err: put_uobj_write(&obj->uobject); err_tree_mutex_unlock: - if (f.file) - fdput(f); + if (vnode != NULL) + vrele(vnode); mutex_unlock(&file->device->xrcd_tree_mutex); @@ -893,7 +889,7 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi struct ib_uverbs_close_xrcd cmd; struct ib_uobject *uobj; struct ib_xrcd *xrcd = NULL; - struct inode *inode = NULL; + struct vnode *vnode = NULL; struct ib_uxrcd_object *obj; int live; int ret = 0; @@ -909,7 +905,7 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi } xrcd = uobj->object; - inode = xrcd->inode; + vnode = xrcd->vnode; obj = container_of(uobj, struct ib_uxrcd_object, uobject); if (atomic_read(&obj->refcnt)) { put_uobj_write(uobj); @@ -917,14 +913,14 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi goto out; } - if (!inode || atomic_dec_and_test(&xrcd->usecnt)) { + if (!vnode || atomic_dec_and_test(&xrcd->usecnt)) { ret = ib_dealloc_xrcd(uobj->object); if (!ret) uobj->live = 0; } live = uobj->live; - if (inode && ret) + if (vnode && ret) atomic_inc(&xrcd->usecnt); put_uobj_write(uobj); @@ -932,8 +928,8 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi if (ret) goto out; - if (inode && !live) - xrcd_table_delete(file->device, inode); + if (vnode && !live) + xrcd_table_delete(file->device, vnode); idr_remove_uobj(&ib_uverbs_xrcd_idr, uobj); mutex_lock(&file->mutex); @@ -951,16 +947,16 @@ out: void ib_uverbs_dealloc_xrcd(struct ib_uverbs_device *dev, struct ib_xrcd *xrcd) { - struct inode *inode; + struct vnode *vnode; - inode = xrcd->inode; - if (inode && !atomic_dec_and_test(&xrcd->usecnt)) + vnode = xrcd->vnode; + if (vnode && !atomic_dec_and_test(&xrcd->usecnt)) return; ib_dealloc_xrcd(xrcd); - if (inode) - xrcd_table_delete(dev, inode); + if (vnode) + xrcd_table_delete(dev, vnode); } ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, From owner-svn-src-all@freebsd.org Tue Nov 10 13:31:02 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49FAE43085C; Tue, 10 Nov 2020 13:31:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpfG1Cwrz3vkj; Tue, 10 Nov 2020 13:31:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CF8B2326A; Tue, 10 Nov 2020 13:31:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADV1oD047392; Tue, 10 Nov 2020 13:31:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADV1oA047391; Tue, 10 Nov 2020 13:31:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101331.0AADV1oA047391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:31:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367563 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 367563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:31:02 -0000 Author: hselasky Date: Tue Nov 10 13:31:01 2020 New Revision: 367563 URL: https://svnweb.freebsd.org/changeset/base/367563 Log: MFC r367269: Fix for referencing file via its vnode in ibore. Use the native vnode lookup functions, instead of going via the LinuxKPI, because the file referenced is typically created outside the LinuxKPI, and the LinuxKPI's fdget() can only resolve file descriptor numbers which were created by itself. The vnode pointer is used as an identifier to identify XRCD handles which are sharing resources. This patch fixes the so-called XRCD support in ibcore for FreeBSD. Refer to ibv_open_xrcd(3) for more information how the file descriptor argument is used. Reviewed by: kib@ Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Tue Nov 10 13:22:52 2020 (r367562) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Tue Nov 10 13:31:01 2020 (r367563) @@ -666,11 +666,11 @@ err_put: struct xrcd_table_entry { struct rb_node node; struct ib_xrcd *xrcd; - struct inode *inode; + struct vnode *vnode; }; static int xrcd_table_insert(struct ib_uverbs_device *dev, - struct inode *inode, + struct vnode *vnode, struct ib_xrcd *xrcd) { struct xrcd_table_entry *entry, *scan; @@ -682,15 +682,15 @@ static int xrcd_table_insert(struct ib_uverbs_device * return -ENOMEM; entry->xrcd = xrcd; - entry->inode = inode; + entry->vnode = vnode; while (*p) { parent = *p; scan = rb_entry(parent, struct xrcd_table_entry, node); - if (inode < scan->inode) { + if ((uintptr_t)vnode < (uintptr_t)scan->vnode) { p = &(*p)->rb_left; - } else if (inode > scan->inode) { + } else if ((uintptr_t)vnode > (uintptr_t)scan->vnode) { p = &(*p)->rb_right; } else { kfree(entry); @@ -700,12 +700,12 @@ static int xrcd_table_insert(struct ib_uverbs_device * rb_link_node(&entry->node, parent, p); rb_insert_color(&entry->node, &dev->xrcd_tree); - igrab(inode); + vrefact(vnode); return 0; } static struct xrcd_table_entry *xrcd_table_search(struct ib_uverbs_device *dev, - struct inode *inode) + struct vnode *vnode) { struct xrcd_table_entry *entry; struct rb_node *p = dev->xrcd_tree.rb_node; @@ -713,9 +713,9 @@ static struct xrcd_table_entry *xrcd_table_search(stru while (p) { entry = rb_entry(p, struct xrcd_table_entry, node); - if (inode < entry->inode) + if ((uintptr_t)vnode < (uintptr_t)entry->vnode) p = p->rb_left; - else if (inode > entry->inode) + else if ((uintptr_t)vnode > (uintptr_t)entry->vnode) p = p->rb_right; else return entry; @@ -724,11 +724,11 @@ static struct xrcd_table_entry *xrcd_table_search(stru return NULL; } -static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode *inode) +static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct vnode *vnode) { struct xrcd_table_entry *entry; - entry = xrcd_table_search(dev, inode); + entry = xrcd_table_search(dev, vnode); if (!entry) return NULL; @@ -736,13 +736,13 @@ static struct ib_xrcd *find_xrcd(struct ib_uverbs_devi } static void xrcd_table_delete(struct ib_uverbs_device *dev, - struct inode *inode) + struct vnode *vnode) { struct xrcd_table_entry *entry; - entry = xrcd_table_search(dev, inode); + entry = xrcd_table_search(dev, vnode); if (entry) { - iput(inode); + vrele(vnode); rb_erase(&entry->node, &dev->xrcd_tree); kfree(entry); } @@ -758,8 +758,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil struct ib_udata udata; struct ib_uxrcd_object *obj; struct ib_xrcd *xrcd = NULL; - struct fd f = {NULL}; - struct inode *inode = NULL; + struct vnode *vnode = NULL; int ret = 0; int new_xrcd = 0; @@ -776,15 +775,15 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil mutex_lock(&file->device->xrcd_tree_mutex); if (cmd.fd != -1) { + cap_rights_t cap_no_rights; + cap_rights_init(&cap_no_rights); + /* search for file descriptor */ - f = fdget(cmd.fd); - if (!f.file) { - ret = -EBADF; + ret = -fgetvp(curthread, cmd.fd, &cap_no_rights, &vnode); + if (ret != 0) goto err_tree_mutex_unlock; - } - inode = f.file->f_dentry->d_inode; - xrcd = find_xrcd(file->device, inode); + xrcd = find_xrcd(file->device, vnode); if (!xrcd && !(cmd.oflags & O_CREAT)) { /* no file descriptor. Need CREATE flag */ ret = -EAGAIN; @@ -814,7 +813,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil goto err; } - xrcd->inode = inode; + xrcd->vnode = vnode; xrcd->device = ib_dev; atomic_set(&xrcd->usecnt, 0); mutex_init(&xrcd->tgt_qp_mutex); @@ -831,10 +830,10 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil memset(&resp, 0, sizeof resp); resp.xrcd_handle = obj->uobject.id; - if (inode) { + if (vnode != NULL) { if (new_xrcd) { - /* create new inode/xrcd table entry */ - ret = xrcd_table_insert(file->device, inode, xrcd); + /* create new vnode/xrcd table entry */ + ret = xrcd_table_insert(file->device, vnode, xrcd); if (ret) goto err_insert_xrcd; } @@ -847,8 +846,8 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil goto err_copy; } - if (f.file) - fdput(f); + if (vnode != NULL) + vrele(vnode); mutex_lock(&file->mutex); list_add_tail(&obj->uobject.list, &file->ucontext->xrcd_list); @@ -861,9 +860,9 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil return in_len; err_copy: - if (inode) { + if (vnode != NULL) { if (new_xrcd) - xrcd_table_delete(file->device, inode); + xrcd_table_delete(file->device, vnode); atomic_dec(&xrcd->usecnt); } @@ -877,8 +876,8 @@ err: put_uobj_write(&obj->uobject); err_tree_mutex_unlock: - if (f.file) - fdput(f); + if (vnode != NULL) + vrele(vnode); mutex_unlock(&file->device->xrcd_tree_mutex); @@ -893,7 +892,7 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi struct ib_uverbs_close_xrcd cmd; struct ib_uobject *uobj; struct ib_xrcd *xrcd = NULL; - struct inode *inode = NULL; + struct vnode *vnode = NULL; struct ib_uxrcd_object *obj; int live; int ret = 0; @@ -909,7 +908,7 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi } xrcd = uobj->object; - inode = xrcd->inode; + vnode = xrcd->vnode; obj = container_of(uobj, struct ib_uxrcd_object, uobject); if (atomic_read(&obj->refcnt)) { put_uobj_write(uobj); @@ -917,14 +916,14 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi goto out; } - if (!inode || atomic_dec_and_test(&xrcd->usecnt)) { + if (!vnode || atomic_dec_and_test(&xrcd->usecnt)) { ret = ib_dealloc_xrcd(uobj->object); if (!ret) uobj->live = 0; } live = uobj->live; - if (inode && ret) + if (vnode && ret) atomic_inc(&xrcd->usecnt); put_uobj_write(uobj); @@ -932,8 +931,8 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi if (ret) goto out; - if (inode && !live) - xrcd_table_delete(file->device, inode); + if (vnode && !live) + xrcd_table_delete(file->device, vnode); idr_remove_uobj(&ib_uverbs_xrcd_idr, uobj); mutex_lock(&file->mutex); @@ -951,16 +950,16 @@ out: void ib_uverbs_dealloc_xrcd(struct ib_uverbs_device *dev, struct ib_xrcd *xrcd) { - struct inode *inode; + struct vnode *vnode; - inode = xrcd->inode; - if (inode && !atomic_dec_and_test(&xrcd->usecnt)) + vnode = xrcd->vnode; + if (vnode && !atomic_dec_and_test(&xrcd->usecnt)) return; ib_dealloc_xrcd(xrcd); - if (inode) - xrcd_table_delete(dev, inode); + if (vnode) + xrcd_table_delete(dev, vnode); } ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, From owner-svn-src-all@freebsd.org Tue Nov 10 13:32:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F00BE430CE9; Tue, 10 Nov 2020 13:32:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVphL6VDpz3wDP; Tue, 10 Nov 2020 13:32:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD4FA2391E; Tue, 10 Nov 2020 13:32:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADWoNA051512; Tue, 10 Nov 2020 13:32:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADWo9i051510; Tue, 10 Nov 2020 13:32:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101332.0AADWo9i051510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367564 - in stable/12/sys/dev/usb: . quirk X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/usb: . quirk X-SVN-Commit-Revision: 367564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:32:51 -0000 Author: hselasky Date: Tue Nov 10 13:32:50 2020 New Revision: 367564 URL: https://svnweb.freebsd.org/changeset/base/367564 Log: MFC r366806: Add new USB quirk. PR: 250422 Submitted by: vidwer+fbsdbugs@gmail.com Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c stable/12/sys/dev/usb/usbdevs Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/12/sys/dev/usb/quirk/usb_quirk.c Tue Nov 10 13:31:01 2020 (r367563) +++ stable/12/sys/dev/usb/quirk/usb_quirk.c Tue Nov 10 13:32:50 2020 (r367564) @@ -221,6 +221,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(EMTEC, DANEELEC4GB, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, Modified: stable/12/sys/dev/usb/usbdevs ============================================================================== --- stable/12/sys/dev/usb/usbdevs Tue Nov 10 13:31:01 2020 (r367563) +++ stable/12/sys/dev/usb/usbdevs Tue Nov 10 13:32:50 2020 (r367564) @@ -1885,6 +1885,7 @@ product ELV USBI2C 0xe00f USB-I2C interface product EMS DUAL_SHOOTER 0x0003 PSX gun controller converter /* Emtec products */ +product EMTEC DANEELEC4GB 0x1e20 USB DISK Pro PMAP product EMTEC RUF2PS 0x2240 Flash Drive /* Encore products */ From owner-svn-src-all@freebsd.org Tue Nov 10 13:33:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F9D8430D28; Tue, 10 Nov 2020 13:33:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpjJ00vfz3wFR; Tue, 10 Nov 2020 13:33:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7234237EE; Tue, 10 Nov 2020 13:33:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADXd0H051629; Tue, 10 Nov 2020 13:33:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADXdIs051627; Tue, 10 Nov 2020 13:33:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101333.0AADXdIs051627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367565 - in stable/11/sys/dev/usb: . quirk X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/usb: . quirk X-SVN-Commit-Revision: 367565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:33:40 -0000 Author: hselasky Date: Tue Nov 10 13:33:39 2020 New Revision: 367565 URL: https://svnweb.freebsd.org/changeset/base/367565 Log: MFC r366806: Add new USB quirk. PR: 250422 Submitted by: vidwer+fbsdbugs@gmail.com Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/usb/quirk/usb_quirk.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/11/sys/dev/usb/quirk/usb_quirk.c Tue Nov 10 13:32:50 2020 (r367564) +++ stable/11/sys/dev/usb/quirk/usb_quirk.c Tue Nov 10 13:33:39 2020 (r367565) @@ -191,6 +191,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(EMTEC, DANEELEC4GB, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Tue Nov 10 13:32:50 2020 (r367564) +++ stable/11/sys/dev/usb/usbdevs Tue Nov 10 13:33:39 2020 (r367565) @@ -1811,6 +1811,7 @@ product ELV USBI2C 0xe00f USB-I2C interface product EMS DUAL_SHOOTER 0x0003 PSX gun controller converter /* Emtec products */ +product EMTEC DANEELEC4GB 0x1e20 USB DISK Pro PMAP product EMTEC RUF2PS 0x2240 Flash Drive /* Encore products */ From owner-svn-src-all@freebsd.org Tue Nov 10 13:36:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE76C430DD2; Tue, 10 Nov 2020 13:36:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVpm75Wytz4QpB; Tue, 10 Nov 2020 13:36:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B07FB236E2; Tue, 10 Nov 2020 13:36:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AADa7Rv051739; Tue, 10 Nov 2020 13:36:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AADa7i0051738; Tue, 10 Nov 2020 13:36:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011101336.0AADa7i0051738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Nov 2020 13:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367566 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 367566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 13:36:07 -0000 Author: hselasky Date: Tue Nov 10 13:36:07 2020 New Revision: 367566 URL: https://svnweb.freebsd.org/changeset/base/367566 Log: MFC r366751: Remove ifdefs around IS_ALIGNED() definition in the LinuxKPI. Discussed with: manu@ Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Nov 10 13:33:39 2020 (r367565) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Nov 10 13:36:07 2020 (r367566) @@ -135,10 +135,7 @@ extern const volatile int lkpi_build_bug_on_zero; #define ALIGN(x, y) roundup2((x), (y)) #undef PTR_ALIGN #define PTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), (a))) -#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 -/* Moved from linuxkpi_gplv2 */ #define IS_ALIGNED(x, a) (((x) & ((__typeof(x))(a) - 1)) == 0) -#endif #define DIV_ROUND_UP(x, n) howmany(x, n) #define __KERNEL_DIV_ROUND_UP(x, n) howmany(x, n) #define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n)) From owner-svn-src-all@freebsd.org Tue Nov 10 14:17:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D194D432112; Tue, 10 Nov 2020 14:17:05 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVqgP5cdqz4Sh4; Tue, 10 Nov 2020 14:17:05 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF0AC241A4; Tue, 10 Nov 2020 14:17:05 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAEH53L075050; Tue, 10 Nov 2020 14:17:05 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAEH5W6075049; Tue, 10 Nov 2020 14:17:05 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011101417.0AAEH5W6075049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 10 Nov 2020 14:17:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367567 - head/sbin/reboot X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/sbin/reboot X-SVN-Commit-Revision: 367567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 14:17:05 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 10 14:17:05 2020 New Revision: 367567 URL: https://svnweb.freebsd.org/changeset/base/367567 Log: Address a mandoc warning MFC after: 3 days Modified: head/sbin/reboot/boot_i386.8 Modified: head/sbin/reboot/boot_i386.8 ============================================================================== --- head/sbin/reboot/boot_i386.8 Tue Nov 10 13:36:07 2020 (r367566) +++ head/sbin/reboot/boot_i386.8 Tue Nov 10 14:17:05 2020 (r367567) @@ -89,7 +89,7 @@ from partition of either the floppy or the hard disk. This boot may be aborted by typing any character on the keyboard at the -.Ql boot: +.Ql boot\&: prompt. At this time, the following input will be accepted: .Bl -tag -width indent From owner-svn-src-all@freebsd.org Tue Nov 10 14:21:23 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97ED3431F60; Tue, 10 Nov 2020 14:21:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVqmM3qJbz4T7g; Tue, 10 Nov 2020 14:21:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7692823FC4; Tue, 10 Nov 2020 14:21:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAELNth076775; Tue, 10 Nov 2020 14:21:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAELNtk076774; Tue, 10 Nov 2020 14:21:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011101421.0AAELNtk076774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Nov 2020 14:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367568 - head/sys/contrib/openzfs/module/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/zfs X-SVN-Commit-Revision: 367568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 14:21:23 -0000 Author: mjg Date: Tue Nov 10 14:21:23 2020 New Revision: 367568 URL: https://svnweb.freebsd.org/changeset/base/367568 Log: zfs: g/c unused data_alloc_arena Modified: head/sys/contrib/openzfs/module/zfs/zio.c Modified: head/sys/contrib/openzfs/module/zfs/zio.c ============================================================================== --- head/sys/contrib/openzfs/module/zfs/zio.c Tue Nov 10 14:17:05 2020 (r367567) +++ head/sys/contrib/openzfs/module/zfs/zio.c Tue Nov 10 14:21:23 2020 (r367568) @@ -144,7 +144,6 @@ void zio_init(void) { size_t c; - vmem_t *data_alloc_arena = NULL; zio_cache = kmem_cache_create("zio_cache", sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0); @@ -213,8 +212,7 @@ zio_init(void) (void) snprintf(name, sizeof (name), "zio_data_buf_%lu", (ulong_t)size); zio_data_buf_cache[c] = kmem_cache_create(name, size, - align, NULL, NULL, NULL, NULL, - data_alloc_arena, data_cflags); + align, NULL, NULL, NULL, NULL, NULL, data_cflags); } } From owner-svn-src-all@freebsd.org Tue Nov 10 14:23:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DA9B432612; Tue, 10 Nov 2020 14:23:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVqq7477jz4TCK; Tue, 10 Nov 2020 14:23:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8095823FCA; Tue, 10 Nov 2020 14:23:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAENl0j080608; Tue, 10 Nov 2020 14:23:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAENlZH080607; Tue, 10 Nov 2020 14:23:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011101423.0AAENlZH080607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Nov 2020 14:23:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367569 - head/sys/contrib/openzfs/module/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/zfs X-SVN-Commit-Revision: 367569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 14:23:47 -0000 Author: mjg Date: Tue Nov 10 14:23:46 2020 New Revision: 367569 URL: https://svnweb.freebsd.org/changeset/base/367569 Log: zfs: combine zio caches if possible This deduplicates 2 sets of caches using the same sizes. Memory savings fluctuate a lot, one sample result is buildworld on zfs saving ~180MB RAM in reduced page count associated with zio caches. Modified: head/sys/contrib/openzfs/module/zfs/zio.c Modified: head/sys/contrib/openzfs/module/zfs/zio.c ============================================================================== --- head/sys/contrib/openzfs/module/zfs/zio.c Tue Nov 10 14:21:23 2020 (r367568) +++ head/sys/contrib/openzfs/module/zfs/zio.c Tue Nov 10 14:23:46 2020 (r367569) @@ -204,6 +204,19 @@ zio_init(void) if (align != 0) { char name[36]; + if (cflags == data_cflags) { + /* + * Resulting kmem caches would be identical. + * Save memory by creating only one. + */ + (void) snprintf(name, sizeof (name), + "zio_buf_comb_%lu", (ulong_t)size); + zio_buf_cache[c] = kmem_cache_create(name, + size, align, NULL, NULL, NULL, NULL, NULL, + cflags); + zio_data_buf_cache[c] = zio_buf_cache[c]; + continue; + } (void) snprintf(name, sizeof (name), "zio_buf_%lu", (ulong_t)size); zio_buf_cache[c] = kmem_cache_create(name, size, @@ -234,37 +247,55 @@ zio_init(void) void zio_fini(void) { - size_t c; - kmem_cache_t *last_cache = NULL; - kmem_cache_t *last_data_cache = NULL; + size_t i, j, n; + kmem_cache_t *cache; - for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) { -#ifdef _ILP32 - /* - * Cache size limited to 1M on 32-bit platforms until ARC - * buffers no longer require virtual address space. - */ - if (((c + 1) << SPA_MINBLOCKSHIFT) > zfs_max_recordsize) - break; -#endif + n = SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; + #if defined(ZFS_DEBUG) && !defined(_KERNEL) - if (zio_buf_cache_allocs[c] != zio_buf_cache_frees[c]) + for (i = 0; i < n; i++) { + if (zio_buf_cache_allocs[i] != zio_buf_cache_frees[i]) (void) printf("zio_fini: [%d] %llu != %llu\n", - (int)((c + 1) << SPA_MINBLOCKSHIFT), - (long long unsigned)zio_buf_cache_allocs[c], - (long long unsigned)zio_buf_cache_frees[c]); + (int)((i + 1) << SPA_MINBLOCKSHIFT), + (long long unsigned)zio_buf_cache_allocs[i], + (long long unsigned)zio_buf_cache_frees[i]); + } #endif - if (zio_buf_cache[c] != last_cache) { - last_cache = zio_buf_cache[c]; - kmem_cache_destroy(zio_buf_cache[c]); + + /* + * The same kmem cache can show up multiple times in both zio_buf_cache + * and zio_data_buf_cache. Do a wasteful but trivially correct scan to + * sort it out. + */ + for (i = 0; i < n; i++) { + cache = zio_buf_cache[i]; + if (cache == NULL) + continue; + for (j = i; j < n; j++) { + if (cache == zio_buf_cache[j]) + zio_buf_cache[j] = NULL; + if (cache == zio_data_buf_cache[j]) + zio_data_buf_cache[j] = NULL; } - zio_buf_cache[c] = NULL; + kmem_cache_destroy(cache); + } - if (zio_data_buf_cache[c] != last_data_cache) { - last_data_cache = zio_data_buf_cache[c]; - kmem_cache_destroy(zio_data_buf_cache[c]); + for (i = 0; i < n; i++) { + cache = zio_data_buf_cache[i]; + if (cache == NULL) + continue; + for (j = i; j < n; j++) { + if (cache == zio_data_buf_cache[j]) + zio_data_buf_cache[j] = NULL; } - zio_data_buf_cache[c] = NULL; + kmem_cache_destroy(cache); + } + + for (i = 0; i < n; i++) { + if (zio_buf_cache[i] != NULL) + panic("zio_fini: zio_buf_cache[%d] != NULL", (int)i); + if (zio_data_buf_cache[i] != NULL) + panic("zio_fini: zio_data_buf_cache[%d] != NULL", (int)i); } kmem_cache_destroy(zio_link_cache); From owner-svn-src-all@freebsd.org Tue Nov 10 18:05:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A11D437AEE; Tue, 10 Nov 2020 18:05:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVwkk0jKtz4jB3; Tue, 10 Nov 2020 18:05:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B2F426B74; Tue, 10 Nov 2020 18:05:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAI5H5I015965; Tue, 10 Nov 2020 18:05:17 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAI5HHT015964; Tue, 10 Nov 2020 18:05:17 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202011101805.0AAI5HHT015964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 10 Nov 2020 18:05:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367570 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 367570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 18:05:18 -0000 Author: bdrewery Date: Tue Nov 10 18:05:17 2020 New Revision: 367570 URL: https://svnweb.freebsd.org/changeset/base/367570 Log: makeman: Don't require filemon with MK_DIRDEPS_BUILD. MFC after: 2 weeks Reviewed by: sjg, dim (tested earlier version) Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27134 Modified: head/share/mk/local.meta.sys.mk Modified: head/share/mk/local.meta.sys.mk ============================================================================== --- head/share/mk/local.meta.sys.mk Tue Nov 10 14:23:46 2020 (r367569) +++ head/share/mk/local.meta.sys.mk Tue Nov 10 18:05:17 2020 (r367570) @@ -178,6 +178,10 @@ LDFLAGS_LAST+= -L${STAGE_LIBDIR} # we can use this but should not update it. UPDATE_DEPENDFILE= NO .endif +# Don't require filemon for makeman. +.if make(showconfig) +UPDATE_DEPENDFILE= NO +.endif # define the list of places that contain files we are responsible for .MAKE.META.BAILIWICK = ${SB} ${OBJROOT} ${STAGE_ROOT} From owner-svn-src-all@freebsd.org Tue Nov 10 18:07:14 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9878437AFF; Tue, 10 Nov 2020 18:07:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVwmy3S8nz4jMt; Tue, 10 Nov 2020 18:07:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6523827071; Tue, 10 Nov 2020 18:07:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAI7EjO016101; Tue, 10 Nov 2020 18:07:14 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAI7ECb016100; Tue, 10 Nov 2020 18:07:14 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202011101807.0AAI7ECb016100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 10 Nov 2020 18:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367571 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 18:07:14 -0000 Author: brooks Date: Tue Nov 10 18:07:13 2020 New Revision: 367571 URL: https://svnweb.freebsd.org/changeset/base/367571 Log: MFC r367302: sysvshm: pass relevant uap members as arguments Alter shmget_allocate_segment and shmget_existing to take the values they want from struct shmget_args rather than passing the struct around. In general, uap structures should only be the interface to sys_ functions. This makes one small functional change and records the allocated space rather than the requested space. If this turns out to be a problem (e.g. if software tries to find undersized segments by exact size rather than using keys), we can correct that easily. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27077 Modified: stable/12/sys/kern/sysv_shm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sysv_shm.c ============================================================================== --- stable/12/sys/kern/sysv_shm.c Tue Nov 10 18:05:17 2020 (r367570) +++ stable/12/sys/kern/sysv_shm.c Tue Nov 10 18:07:13 2020 (r367571) @@ -111,11 +111,6 @@ FEATURE(sysv_shm, "System V shared memory segments sup static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments"); -static int shmget_allocate_segment(struct thread *td, - struct shmget_args *uap, int mode); -static int shmget_existing(struct thread *td, struct shmget_args *uap, - int mode, int segnum); - #define SHMSEG_FREE 0x0200 #define SHMSEG_REMOVED 0x0400 #define SHMSEG_ALLOCATED 0x0800 @@ -134,6 +129,10 @@ static void shm_deallocate_segment(struct shmid_kernel static int shm_find_segment_by_key(struct prison *, key_t); static struct shmid_kernel *shm_find_segment(struct prison *, int, bool); static int shm_delete_mapping(struct vmspace *vm, struct shmmap_state *); +static int shmget_allocate_segment(struct thread *td, key_t key, size_t size, + int mode); +static int shmget_existing(struct thread *td, size_t size, int shmflg, + int mode, int segnum); static void shmrealloc(void); static int shminit(void); static int sysvshm_modload(struct module *, int, void *); @@ -659,7 +658,7 @@ done: static int -shmget_existing(struct thread *td, struct shmget_args *uap, int mode, +shmget_existing(struct thread *td, size_t size, int shmflg, int mode, int segnum) { struct shmid_kernel *shmseg; @@ -671,35 +670,34 @@ shmget_existing(struct thread *td, struct shmget_args KASSERT(segnum >= 0 && segnum < shmalloced, ("segnum %d shmalloced %d", segnum, shmalloced)); shmseg = &shmsegs[segnum]; - if ((uap->shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL)) + if ((shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL)) return (EEXIST); #ifdef MAC - error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, uap->shmflg); + error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, shmflg); if (error != 0) return (error); #endif - if (uap->size != 0 && uap->size > shmseg->u.shm_segsz) + if (size != 0 && size > shmseg->u.shm_segsz) return (EINVAL); td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm); return (0); } static int -shmget_allocate_segment(struct thread *td, struct shmget_args *uap, int mode) +shmget_allocate_segment(struct thread *td, key_t key, size_t size, int mode) { struct ucred *cred = td->td_ucred; struct shmid_kernel *shmseg; vm_object_t shm_object; int i, segnum; - size_t size; SYSVSHM_ASSERT_LOCKED(); - if (uap->size < shminfo.shmmin || uap->size > shminfo.shmmax) + if (size < shminfo.shmmin || size > shminfo.shmmax) return (EINVAL); if (shm_nused >= shminfo.shmmni) /* Any shmids left? */ return (ENOSPC); - size = round_page(uap->size); + size = round_page(size); if (shm_committed + btoc(size) > shminfo.shmall) return (ENOMEM); if (shm_last_free < 0) { @@ -760,10 +758,10 @@ shmget_allocate_segment(struct thread *td, struct shmg shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid; shmseg->u.shm_perm.cgid = shmseg->u.shm_perm.gid = cred->cr_gid; shmseg->u.shm_perm.mode = (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; - shmseg->u.shm_perm.key = uap->key; + shmseg->u.shm_perm.key = key; shmseg->u.shm_perm.seq = (shmseg->u.shm_perm.seq + 1) & 0x7fff; shmseg->cred = crhold(cred); - shmseg->u.shm_segsz = uap->size; + shmseg->u.shm_segsz = size; shmseg->u.shm_cpid = td->td_proc->p_pid; shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0; shmseg->u.shm_atime = shmseg->u.shm_dtime = 0; @@ -796,16 +794,18 @@ sys_shmget(struct thread *td, struct shmget_args *uap) mode = uap->shmflg & ACCESSPERMS; SYSVSHM_LOCK(); if (uap->key == IPC_PRIVATE) { - error = shmget_allocate_segment(td, uap, mode); + error = shmget_allocate_segment(td, uap->key, uap->size, mode); } else { segnum = shm_find_segment_by_key(td->td_ucred->cr_prison, uap->key); if (segnum >= 0) - error = shmget_existing(td, uap, mode, segnum); + error = shmget_existing(td, uap->size, uap->shmflg, + mode, segnum); else if ((uap->shmflg & IPC_CREAT) == 0) error = ENOENT; else - error = shmget_allocate_segment(td, uap, mode); + error = shmget_allocate_segment(td, uap->key, + uap->size, mode); } SYSVSHM_UNLOCK(); return (error); From owner-svn-src-all@freebsd.org Tue Nov 10 18:10:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66B59460B53; Tue, 10 Nov 2020 18:10:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVws72Wq4z4jWq; Tue, 10 Nov 2020 18:10:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4892427074; Tue, 10 Nov 2020 18:10:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAIApSx017212; Tue, 10 Nov 2020 18:10:51 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAIApms017211; Tue, 10 Nov 2020 18:10:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011101810.0AAIApms017211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Nov 2020 18:10:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367572 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 18:10:51 -0000 Author: mjg Date: Tue Nov 10 18:10:50 2020 New Revision: 367572 URL: https://svnweb.freebsd.org/changeset/base/367572 Log: Allow rtprio_thread to operate on threads of any process This in particular unbreaks rtkit. The limitation was a leftover of previous state, to quote a comment: /* * Though lwpid is unique, only current process is supported * since there is no efficient way to look up a LWP yet. */ Long since then a global tid hash was introduced to remedy the problem. Permission checks still apply. Submitted by: greg_unrelenting.technology (Greg V) Differential Revision: https://reviews.freebsd.org/D27158 Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Tue Nov 10 18:07:13 2020 (r367571) +++ head/sys/kern/kern_resource.c Tue Nov 10 18:10:50 2020 (r367572) @@ -315,8 +315,7 @@ sys_rtprio_thread(struct thread *td, struct rtprio_thr td1 = td; PROC_LOCK(p); } else { - /* Only look up thread in current process */ - td1 = tdfind(uap->lwpid, curproc->p_pid); + td1 = tdfind(uap->lwpid, -1); if (td1 == NULL) return (ESRCH); p = td1->td_proc; From owner-svn-src-all@freebsd.org Tue Nov 10 18:12:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA652460C22; Tue, 10 Nov 2020 18:12:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVwtd4xjCz4jYK; Tue, 10 Nov 2020 18:12:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CEB2271ED; Tue, 10 Nov 2020 18:12:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAIC9r3022069; Tue, 10 Nov 2020 18:12:09 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAIC9WO022068; Tue, 10 Nov 2020 18:12:09 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <202011101812.0AAIC9WO022068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Tue, 10 Nov 2020 18:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367573 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 367573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 18:12:09 -0000 Author: jtl Date: Tue Nov 10 18:12:09 2020 New Revision: 367573 URL: https://svnweb.freebsd.org/changeset/base/367573 Log: When destroying a UMA zone which has a reserve (set with uma_zone_reserve()), messages like the following appear on the console: "Freed UMA keg (Test zone) was not empty (0 items). Lost 528 pages of memory." When keg_drain_domain() is draining the zone, it tries to keep the number of items specified in the reservation. However, when we are destroying the UMA zone, we do not need to keep those items. Therefore, when destroying a non-secondary and non-cache zone, we should reset the keg reservation to 0 prior to draining the zone. Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27129 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Tue Nov 10 18:10:50 2020 (r367572) +++ head/sys/vm/uma_core.c Tue Nov 10 18:12:09 2020 (r367573) @@ -2791,6 +2791,10 @@ zone_dtor(void *arg, int size, void *udata) rw_wlock(&uma_rwlock); LIST_REMOVE(zone, uz_link); rw_wunlock(&uma_rwlock); + if ((zone->uz_flags & (UMA_ZONE_SECONDARY | UMA_ZFLAG_CACHE)) == 0) { + keg = zone->uz_keg; + keg->uk_reserve = 0; + } zone_reclaim(zone, M_WAITOK, true); /* From owner-svn-src-all@freebsd.org Tue Nov 10 19:04:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22E264619E9; Tue, 10 Nov 2020 19:04:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVy3W0Vsbz4lvP; Tue, 10 Nov 2020 19:04:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03FE027B14; Tue, 10 Nov 2020 19:04:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAJ4sXv053301; Tue, 10 Nov 2020 19:04:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAJ4sc5053300; Tue, 10 Nov 2020 19:04:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011101904.0AAJ4sc5053300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 10 Nov 2020 19:04:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367574 - head/lib/csu/common X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/csu/common X-SVN-Commit-Revision: 367574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 19:04:55 -0000 Author: jhb Date: Tue Nov 10 19:04:54 2020 New Revision: 367574 URL: https://svnweb.freebsd.org/changeset/base/367574 Log: Rename __JCR_LIST__ to __JCR_END__ in crtend.c. This is more consistent with the names used for .ctor and .dtor symbols and better reflects __JCR_END__'s role. Reviewed by: andrew Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27125 Modified: head/lib/csu/common/crtend.c Modified: head/lib/csu/common/crtend.c ============================================================================== --- head/lib/csu/common/crtend.c Tue Nov 10 18:12:09 2020 (r367573) +++ head/lib/csu/common/crtend.c Tue Nov 10 19:04:54 2020 (r367574) @@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$"); typedef void (*crt_func)(void); -static crt_func __JCR_LIST__[] __section(".jcr") __used = { +static crt_func __JCR_END__[] __section(".jcr") __used = { (crt_func)0 }; From owner-svn-src-all@freebsd.org Tue Nov 10 19:07:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1412F461BE6; Tue, 10 Nov 2020 19:07:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVy6W05kzz4mQj; Tue, 10 Nov 2020 19:07:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E667827D01; Tue, 10 Nov 2020 19:07:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAJ7UX9053482; Tue, 10 Nov 2020 19:07:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAJ7Us9053481; Tue, 10 Nov 2020 19:07:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011101907.0AAJ7Us9053481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 10 Nov 2020 19:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367575 - head/lib/csu/tests X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/csu/tests X-SVN-Commit-Revision: 367575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 19:07:31 -0000 Author: jhb Date: Tue Nov 10 19:07:30 2020 New Revision: 367575 URL: https://svnweb.freebsd.org/changeset/base/367575 Log: Fix dso_handle_check for PIE executables. PIE executables use crtbeginS.o and have a non-NULL dso_handle as a result. Reviewed by: andrew, emaste MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27126 Modified: head/lib/csu/tests/fini_test.c Modified: head/lib/csu/tests/fini_test.c ============================================================================== --- head/lib/csu/tests/fini_test.c Tue Nov 10 19:04:54 2020 (r367574) +++ head/lib/csu/tests/fini_test.c Tue Nov 10 19:07:30 2020 (r367575) @@ -141,9 +141,9 @@ dso_handle_check(void) { void *dso = __dso_handle; -#ifdef DSO_LIB +#if defined(DSO_LIB) || defined(__PIE__) ATF_REQUIRE_MSG(dso != NULL, - "Null __dso_handle in DSO"); + "Null __dso_handle in DSO/PIE"); #else ATF_REQUIRE_MSG(dso == NULL, "Invalid __dso_handle in non-DSO"); From owner-svn-src-all@freebsd.org Tue Nov 10 19:09:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73822461D3A; Tue, 10 Nov 2020 19:09:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVy8w2vKJz4mRc; Tue, 10 Nov 2020 19:09:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 565492756F; Tue, 10 Nov 2020 19:09:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAJ9ac8053615; Tue, 10 Nov 2020 19:09:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAJ9ZoX053612; Tue, 10 Nov 2020 19:09:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011101909.0AAJ9ZoX053612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 10 Nov 2020 19:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367576 - in head/lib/csu/tests: . dynamic dynamicpie X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/lib/csu/tests: . dynamic dynamicpie X-SVN-Commit-Revision: 367576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 19:09:36 -0000 Author: jhb Date: Tue Nov 10 19:09:35 2020 New Revision: 367576 URL: https://svnweb.freebsd.org/changeset/base/367576 Log: Add C startup code tests for PIE binaries. - Force dynamic to be a non-PIE binary. - Add a dynamicpie test which uses a PIE binary. Reviewed by: andrew Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27127 Added: head/lib/csu/tests/dynamicpie/ head/lib/csu/tests/dynamicpie/Makefile - copied, changed from r367573, head/lib/csu/tests/dynamic/Makefile Modified: head/lib/csu/tests/Makefile head/lib/csu/tests/dynamic/Makefile Modified: head/lib/csu/tests/Makefile ============================================================================== --- head/lib/csu/tests/Makefile Tue Nov 10 19:07:30 2020 (r367575) +++ head/lib/csu/tests/Makefile Tue Nov 10 19:09:35 2020 (r367576) @@ -3,6 +3,7 @@ SUBDIR= dso TESTS_SUBDIRS= dynamic TESTS_SUBDIRS+= dynamiclib +TESTS_SUBDIRS+= dynamicpie TESTS_SUBDIRS+= static SUBDIR_DEPEND_dynamiclib=dso Modified: head/lib/csu/tests/dynamic/Makefile ============================================================================== --- head/lib/csu/tests/dynamic/Makefile Tue Nov 10 19:07:30 2020 (r367575) +++ head/lib/csu/tests/dynamic/Makefile Tue Nov 10 19:09:35 2020 (r367576) @@ -2,5 +2,8 @@ .PATH: ${.CURDIR:H} +.include +MK_PIE= no + .include "../Makefile.tests" .include Copied and modified: head/lib/csu/tests/dynamicpie/Makefile (from r367573, head/lib/csu/tests/dynamic/Makefile) ============================================================================== --- head/lib/csu/tests/dynamic/Makefile Tue Nov 10 18:12:09 2020 (r367573, copy source) +++ head/lib/csu/tests/dynamicpie/Makefile Tue Nov 10 19:09:35 2020 (r367576) @@ -2,5 +2,8 @@ .PATH: ${.CURDIR:H} +.include +MK_PIE= yes + .include "../Makefile.tests" .include From owner-svn-src-all@freebsd.org Tue Nov 10 19:15:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4C5B461E6B; Tue, 10 Nov 2020 19:15:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVyHR5DF0z4n2X; Tue, 10 Nov 2020 19:15:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A63D727BB4; Tue, 10 Nov 2020 19:15:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAJFFKO059415; Tue, 10 Nov 2020 19:15:15 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAJFEWf059408; Tue, 10 Nov 2020 19:15:14 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202011101915.0AAJFEWf059408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 10 Nov 2020 19:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367577 - in head: share/mk sys/conf tools/build/options X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: share/mk sys/conf tools/build/options X-SVN-Commit-Revision: 367577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 19:15:15 -0000 Author: brooks Date: Tue Nov 10 19:15:13 2020 New Revision: 367577 URL: https://svnweb.freebsd.org/changeset/base/367577 Log: Support initializing stack variables on function entry There are two options: - WITH_INIT_ALL_ZERO: Zero all variables on the stack. - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns. The exact pattern are a compiler implementation detail and vary by type. They are somewhat documented in the LLVM commit message: https://reviews.llvm.org/rL349442 I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather than naming them after the LLVM specific compiler flags. In a range of consumer products, options like these are used in both debug and production builds with debugs builds using patterns (intended to provoke crashes on use of uninitialized values) and production using zeros (deemed more likely to lead to harmless misbehavior or NULL-pointer dereferences). Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27131 Added: head/tools/build/options/WITH_INIT_ALL_PATTERN (contents, props changed) head/tools/build/options/WITH_INIT_ALL_ZERO (contents, props changed) Modified: head/share/mk/bsd.compiler.mk head/share/mk/bsd.lib.mk head/share/mk/bsd.opts.mk head/share/mk/bsd.prog.mk head/sys/conf/kern.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Tue Nov 10 19:09:35 2020 (r367576) +++ head/share/mk/bsd.compiler.mk Tue Nov 10 19:15:13 2020 (r367577) @@ -24,6 +24,7 @@ # - c++11: supports full (or nearly full) C++11 programming environment. # - retpoline: supports the retpoline speculative execution vulnerability # mitigation. +# - init-all: supports stack variable initialization. # # These variables with an X_ prefix will also be provided if XCC is set. # @@ -214,7 +215,7 @@ ${X_}COMPILER_FEATURES= c++11 c++14 ${X_}COMPILER_FEATURES+= c++17 .endif .if ${${X_}COMPILER_TYPE} == "clang" -${X_}COMPILER_FEATURES+= retpoline +${X_}COMPILER_FEATURES+= retpoline init-all .endif .else Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Nov 10 19:09:35 2020 (r367576) +++ head/share/mk/bsd.lib.mk Tue Nov 10 19:15:13 2020 (r367577) @@ -85,6 +85,25 @@ LDFLAGS+= -Wl,-zretpolineplt .endif .endif +# Initialize stack variables on function entry +.if ${MK_INIT_ALL_ZERO} == "yes" +.if ${COMPILER_FEATURES:Minit-all} +CFLAGS+= -ftrivial-auto-var-init=zero \ + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang +CXXFLAGS+= -ftrivial-auto-var-init=zero \ + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang +.else +.warning InitAll (zeros) requested but not support by compiler +.endif +.elif ${MK_INIT_ALL_PATTERN} == "yes" +.if ${COMPILER_FEATURES:Minit-all} +CFLAGS+= -ftrivial-auto-var-init=pattern +CXXFLAGS+= -ftrivial-auto-var-init=pattern +.else +.warning InitAll (pattern) requested but not support by compiler +.endif +.endif + .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf*) CFLAGS+= ${DEBUG_FILES_CFLAGS} Modified: head/share/mk/bsd.opts.mk ============================================================================== --- head/share/mk/bsd.opts.mk Tue Nov 10 19:09:35 2020 (r367576) +++ head/share/mk/bsd.opts.mk Tue Nov 10 19:15:13 2020 (r367577) @@ -71,6 +71,8 @@ __DEFAULT_NO_OPTIONS = \ BIND_NOW \ CCACHE_BUILD \ CTF \ + INIT_ALL_PATTERN \ + INIT_ALL_ZERO \ INSTALL_AS_USER \ PIE \ RETPOLINE \ @@ -84,6 +86,10 @@ __DEFAULT_DEPENDENT_OPTIONS = \ .include + +.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes" +.error WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive. +.endif # # Supported NO_* options (if defined, MK_* will be forced to "no", Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Tue Nov 10 19:09:35 2020 (r367576) +++ head/share/mk/bsd.prog.mk Tue Nov 10 19:15:13 2020 (r367577) @@ -60,6 +60,25 @@ LDFLAGS+= -Wl,-zretpolineplt .endif .endif +# Initialize stack variables on function entry +.if ${MK_INIT_ALL_ZERO} == "yes" +.if ${COMPILER_FEATURES:Minit-all} +CFLAGS+= -ftrivial-auto-var-init=zero \ + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang +CXXFLAGS+= -ftrivial-auto-var-init=zero \ + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang +.else +.warning InitAll (zeros) requested but not support by compiler +.endif +.elif ${MK_INIT_ALL_PATTERN} == "yes" +.if ${COMPILER_FEATURES:Minit-all} +CFLAGS+= -ftrivial-auto-var-init=pattern +CXXFLAGS+= -ftrivial-auto-var-init=pattern +.else +.warning InitAll (pattern) requested but not support by compiler +.endif +.endif + .if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" CFLAGS += -mno-relax .endif Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Tue Nov 10 19:09:35 2020 (r367576) +++ head/sys/conf/kern.mk Tue Nov 10 19:15:13 2020 (r367577) @@ -228,6 +228,24 @@ CFLAGS+= -mretpoline .endif # +# Initialize stack variables on function entry +# +.if ${MK_INIT_ALL_ZERO} == "yes" +.if ${COMPILER_FEATURES:Minit-all} +CFLAGS+= -ftrivial-auto-var-init=zero \ + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang +.else +.warning InitAll (zeros) requested but not support by compiler +.endif +.elif ${MK_INIT_ALL_PATTERN} == "yes" +.if ${COMPILER_FEATURES:Minit-all} +CFLAGS+= -ftrivial-auto-var-init=pattern +.else +.warning InitAll (pattern) requested but not support by compiler +.endif +.endif + +# # Add -gdwarf-2 when compiling -g. The default starting in clang v3.4 # and gcc 4.8 is to generate DWARF version 4. However, our tools don't # cope well with DWARF 4, so force it to genereate DWARF2, which they Added: head/tools/build/options/WITH_INIT_ALL_PATTERN ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_INIT_ALL_PATTERN Tue Nov 10 19:15:13 2020 (r367577) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to build the base system or kernel with stack variables initialized to +.Pq compiler defined +debugging patterns on function entry. +This option requires the clang compiler. Added: head/tools/build/options/WITH_INIT_ALL_ZERO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_INIT_ALL_ZERO Tue Nov 10 19:15:13 2020 (r367577) @@ -0,0 +1,4 @@ +.\" $FreeBSD$ +Set to build the base system or kernel with stack variables initialized +to zero on function entry. +This option requires that the clang compiler be used. From owner-svn-src-all@freebsd.org Tue Nov 10 19:17:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9595C46240F; Tue, 10 Nov 2020 19:17:36 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVyL83vQcz4nJX; Tue, 10 Nov 2020 19:17:36 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id C81193C0199; Tue, 10 Nov 2020 19:17:29 +0000 (UTC) Date: Tue, 10 Nov 2020 19:17:29 +0000 From: Brooks Davis To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options Message-ID: <20201110191729.GC1959@spindle.one-eyed-alien.net> References: <202011101915.0AAJFEWf059408@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="98e8jtXdkpgskNou" Content-Disposition: inline In-Reply-To: <202011101915.0AAJFEWf059408@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 4CVyL83vQcz4nJX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 19:17:36 -0000 --98e8jtXdkpgskNou Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 10, 2020 at 07:15:14PM +0000, Brooks Davis wrote: > Author: brooks > Date: Tue Nov 10 19:15:13 2020 > New Revision: 367577 > URL: https://svnweb.freebsd.org/changeset/base/367577 >=20 > Log: > Support initializing stack variables on function entry > =20 > There are two options: > - WITH_INIT_ALL_ZERO: Zero all variables on the stack. > - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patter= ns. > =20 > The exact pattern are a compiler implementation detail and vary by type. > They are somewhat documented in the LLVM commit message: > https://reviews.llvm.org/rL349442 > I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather > than naming them after the LLVM specific compiler flags. > =20 > In a range of consumer products, options like these are used in > both debug and production builds with debugs builds using patterns > (intended to provoke crashes on use of uninitialized values) and > production using zeros (deemed more likely to lead to harmless > misbehavior or NULL-pointer dereferences). We've tested this extensively in CheriBSD on RISC-V, in the wild it's probably most tested on Arm64 and x86. Despite the silly compiler flag you'll spot in the code, the zeroing option isn't going away in practice as Apple, Google, and Microsoft all ship with this feature in some of their products. -- Brooks --98e8jtXdkpgskNou Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJfqudIAAoJEKzQXbSebgfAZ0sH/iQCtyUtdmDHgMiLUzFvYXtO jdpgwX2AjFMdXB7seJtGjhPthfwIb57byFp5AJ85vQ3MLMxw8Om+Fsi0MVuZwzeq t59+fiaxE2vmusYI3882duQw/0MHuPzxE54R7Euxo1tIaBk8rPQ1mP2r3j+p6cyk dlLjT8hJBM/k0Hx35FTTis3PRJQwS36atpS5csduL/yRi7rq8vExeNtyJwGVZdRe lQ0WDgZBhIgFyOpaZ+/iK2IhnOZjHKgmXYXfrfRVHfCQ7yRi+Xrrk+6HfcXW3yxa hjO3PhhDng0z8dlqDWmvMLUm49Hu9fmlzrjJ9ALK55C99F39ds9vIZW4p2jRuVw= =t2cp -----END PGP SIGNATURE----- --98e8jtXdkpgskNou-- From owner-svn-src-all@freebsd.org Tue Nov 10 19:44:48 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57429462932 for ; Tue, 10 Nov 2020 19:44:48 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVyxX1kPjz4pql for ; Tue, 10 Nov 2020 19:44:48 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82c.google.com with SMTP id i12so9477844qtj.0 for ; Tue, 10 Nov 2020 11:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TgsRsgtiZodzuo3EyIy74NAg6z7fJQb7KaLegRltPVI=; b=LtzrefZBYVaCBMnaDX46gf+Il4S6ZSMoCg89Zq3NBQO4M8ZMkElnwLB2tl6JkObt1Y EP4DXw7UEYCFSxNIxsubbkU/0fdi0YC1uLr+ZcEatdHxEQ6AGwa8yTqrjGDlp3vFy52Y zed9N6txhlxmb4lXGPjmBJ4cRo94ptVQewn+rR0OVrU7K0yK59qIafKxFR4MULsq09HE sDV0KOHLpvCpoPYC2vm5AGKrguW9WvMmZgqOYM0k2IZp2DqKFhpdhgjw6XKt80K/nNZe l612j2NQp1T83UKr0EiskpNcUfneqEKv7yAky1HA5xmSciFvUdxCntH4XtVuWPLctrqV WvNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TgsRsgtiZodzuo3EyIy74NAg6z7fJQb7KaLegRltPVI=; b=Pz23rX1vvZf/cotNnThDcvvPTkEacwGhCiZhvDHbqzZYfPdXE/CdNaOuAG63UfWtPa uuo7OrfzcqzFXLFLwk9YFVKmFTqI+uLT72l5u7UWZvKoy0oZ0OFba7JXs7WJfOBhngPm cTte1GUYYCJqJBtYp0SU3XHdLbna741FHFJuGBVBJ0EjY4P5/UXTRSoi8YRoSlEKlza0 7ILpaPqvSh1lq1Iz2Ju0UcDdU6YTW29KXc+/u17Rpo9DMMlTpv19hHvhQNqzLJz8ZB54 5N6EJGSGNkTkMbzdCL/cKBb1hfSfzalNP6t84K2YSox+I4FWji9TeFs6MeZBkI62lWsz vXRQ== X-Gm-Message-State: AOAM5304WqA9iCSuQqDoZLCshWbu8ac6CQhDX7myX+P8VAK+IRUfEU98 HCDxO4eMII6RzzDSQOPDycMRXQ== X-Google-Smtp-Source: ABdhPJxa12lTtv1eYmwqQkMlxO3rUEp1UqN0uNRO7HHp6K7futuwBTOs43Nx1Qs8cvEKJ9PU2wEhmQ== X-Received: by 2002:aed:3325:: with SMTP id u34mr20346601qtd.263.1605037487240; Tue, 10 Nov 2020 11:44:47 -0800 (PST) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id j63sm5264248qke.67.2020.11.10.11.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 11:44:46 -0800 (PST) Date: Tue, 10 Nov 2020 14:44:45 -0500 From: Shawn Webb To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options Message-ID: <20201110194445.wf5v63trwcv7fmzs@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202011101915.0AAJFEWf059408@repo.freebsd.org> <20201110191729.GC1959@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nfmjjteyn4azmpyh" Content-Disposition: inline In-Reply-To: <20201110191729.GC1959@spindle.one-eyed-alien.net> X-Rspamd-Queue-Id: 4CVyxX1kPjz4pql X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 19:44:48 -0000 --nfmjjteyn4azmpyh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 10, 2020 at 07:17:29PM +0000, Brooks Davis wrote: > On Tue, Nov 10, 2020 at 07:15:14PM +0000, Brooks Davis wrote: > > Author: brooks > > Date: Tue Nov 10 19:15:13 2020 > > New Revision: 367577 > > URL: https://svnweb.freebsd.org/changeset/base/367577 > >=20 > > Log: > > Support initializing stack variables on function entry > > =20 > > There are two options: > > - WITH_INIT_ALL_ZERO: Zero all variables on the stack. > > - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patt= erns. > > =20 > > The exact pattern are a compiler implementation detail and vary by ty= pe. > > They are somewhat documented in the LLVM commit message: > > https://reviews.llvm.org/rL349442 > > I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather > > than naming them after the LLVM specific compiler flags. > > =20 > > In a range of consumer products, options like these are used in > > both debug and production builds with debugs builds using patterns > > (intended to provoke crashes on use of uninitialized values) and > > production using zeros (deemed more likely to lead to harmless > > misbehavior or NULL-pointer dereferences). >=20 > We've tested this extensively in CheriBSD on RISC-V, in the wild it's > probably most tested on Arm64 and x86. >=20 > Despite the silly compiler flag you'll spot in the code, the zeroing > option isn't going away in practice as Apple, Google, and Microsoft all > ship with this feature in some of their products. HardenedBSD's testing of this last year on amd64 have (privately) shown the feature to really hinder performance on more complex applications (like when applied to clang/lld). A build of base without init all zero applied to clang/lld would take around 1.5 hours on my system. A build with it applied to clang/lld took around four hours, if my memory serves correctly. I would probably advise against applying it system-wide. But YMMV. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --nfmjjteyn4azmpyh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl+q7aoACgkQ/y5nonf4 4frTbBAAlm1FhCeENfnR8wP7eEF6ZN5zJ9OKgIdg4KuNJdjqk63h19XaOknMMd3Z CIDP4Lnmc7Uou8vhU6GBhlTrzf+D5CHWi4v9HbJSpF++jLbWn+p6r1eYMvH/jIok Sj4WyzPqBRyHyrp+1A2b9+UhpsiAZPdCccJRHuT8IPVWGUhP6W89xVNw2JFipc/t mmXKmxoQ61d2xQk5mx9vPxceDOxLTcZZDaF2O9MT9n91DeS1KheAfddler4z03zb lhbi+wzLRghI5ErQruonEdeleoIxQzDauwk0mGluzo/UMugOy+rab3SVf2+ogCgx Af5gMpXyHGfNJ7HCWyNzNnZ2GRUVecgSmNXnoSiGibBicvn1aXi2UkvaAKl4wwM+ JJrbJCctypDlGQcu8AoDTRHAdoAGWItFx+R8xDcz2sOxdn1crKJJE5ZzXsnrt4pO xad+IkwX9sHsInMGkIdsredIhzkZqNNJauEQ4tkQzt25cdhnngd55wK/Q61nxNEp /d+P61RjCn+4IO87Djrq6BPNKyG5p2lUgrA7Uu/2hgun0sskxtGvsZftZMlywZQq 7n/a0pvedQv0sxFsWSxZEqdA9aYFFHVYxB0hVRg9ank/3zOxwx+DO1NOe1+bd4bZ TVFecJX3rVKnZqfH+otPVK2V8qc5LjjeIxRj+9SaCSRtgQkF2+0= =AEdV -----END PGP SIGNATURE----- --nfmjjteyn4azmpyh-- From owner-svn-src-all@freebsd.org Tue Nov 10 19:54:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC519462F33; Tue, 10 Nov 2020 19:54:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CVz8v5wKgz4q4Y; Tue, 10 Nov 2020 19:54:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE0371F5; Tue, 10 Nov 2020 19:54:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AAJsdE5083974; Tue, 10 Nov 2020 19:54:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AAJsd1P083973; Tue, 10 Nov 2020 19:54:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011101954.0AAJsd1P083973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 10 Nov 2020 19:54:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367578 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 367578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 19:54:39 -0000 Author: jhb Date: Tue Nov 10 19:54:39 2020 New Revision: 367578 URL: https://svnweb.freebsd.org/changeset/base/367578 Log: Clear tp->tod in t4_pcb_detach(). Otherwise, a socket can have a non-NULL tp->tod while TF_TOE is clear. In particular, if a newly accepted socket falls back to non-TOE due to an active open failure, the non-TOE socket will still have tp->tod set even though TF_TOE is clear. Reviewed by: np MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27028 Modified: head/sys/dev/cxgbe/tom/t4_tom.c Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Tue Nov 10 19:15:13 2020 (r367577) +++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Nov 10 19:54:39 2020 (r367578) @@ -382,6 +382,7 @@ t4_pcb_detach(struct toedev *tod __unused, struct tcpc } #endif + tp->tod = NULL; tp->t_toe = NULL; tp->t_flags &= ~TF_TOE; toep->flags &= ~TPF_ATTACHED; From owner-svn-src-all@freebsd.org Tue Nov 10 20:47:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38D2A463FA6; Tue, 10 Nov 2020 20:47:00 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CW0KJ11NWz4sxj; Tue, 10 Nov 2020 20:46:59 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by mail-lf1-x131.google.com with SMTP id i6so64621lfd.1; Tue, 10 Nov 2020 12:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XjlgMnAgIWSg2rW6SWasKv25DHoYOjI22UdS9U7fW/k=; b=lxGYWuzOvchJMjLjAZOrjD7pBk9KEQoxuW3Z/BNJd4/jD96SoNX1MMBcqOkKWFGhDI m2iRWxRjvps5ZlM8Vnl8nuX0KCbefT6op3FMWy1nuSEOVvzQwe3/An7+D/4fFV3uyu8W VDsRrFV8iAP0o0ljgYCqbYubQ+gQFQs1URXEga+28NUP1LZtCNugtMTG18TvbAPze7Ev NmBaGGsYBxBt+U/8dnSwu1ueYCoQ2d9aDx5o3GaMSvuc1utqvEn5NB7omI9mGrInhAjQ ZSOOm/13Cx3nO0SLFHb5cGfQxL0eR2NVg5NRygDEwrxvgF5CpvKqtdrTKHXjBE0UaGhu BobA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XjlgMnAgIWSg2rW6SWasKv25DHoYOjI22UdS9U7fW/k=; b=osAcxWbtoEd21tm44JFsT+wwx3WAqckGhBaZZhdtC9R4IqjN9HSc9pl9PH/Wu8chZH ySyoSz6JnHaHKjLo/CQkFjdXL+FSsZAthGbKVT6nCXKy5yjTbpVdZ2lKTJE/a0xNcPzB CSr7K+1UIQoANU144slukBQ6gD2R4aWeTH1IsXJWMDbdAmBiBXsCzRciHfP4uYhdZ2Zd 0gSLQhbl70BflWjrm11iC2GCntH5gOCks8tJ54qPu8/gDDd0MgBAIhCADLvYpPd6FuMc rsrXe+FaUPLsJxslWqohl1751xyH/ZNloTk5HI1vBFU6qQwj8uqqa3wdC2/ZiHZ41a3S 2APA== X-Gm-Message-State: AOAM531TKKrlk+g9Xa0TvZXRiSbuzG1z7PQiJd4mz8IO400AjVa3+mSZ KYNxUOIMxS4Brm6PO3OSz07TB0qu+p9AV47qCDl0A4jX3QDBxA== X-Google-Smtp-Source: ABdhPJwf/POXAd8XS9GGzxxDwUsa81ejXzkXfrMJKfoHbmDsbFLn7b1o0no4zHXmPO/92p4YIQDOo7tEsVeS7ZD1YYs= X-Received: by 2002:a05:6512:3496:: with SMTP id v22mr7613928lfr.230.1605041217124; Tue, 10 Nov 2020 12:46:57 -0800 (PST) MIME-Version: 1.0 References: <202011101915.0AAJFEWf059408@repo.freebsd.org> In-Reply-To: <202011101915.0AAJFEWf059408@repo.freebsd.org> From: Matthew Macy Date: Tue, 10 Nov 2020 12:46:45 -0800 Message-ID: Subject: Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options To: Brooks Davis Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CW0KJ11NWz4sxj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 20:47:00 -0000 These flags aren't defined by default when building external kernel modules: gmake[2]: Entering directory '/usr/home/matt/devel/ZoF/module' env -u MAKEFLAGS make -C /home/matt/devel/ZoF/module -f Makefile.bsd -w make[3]: Entering directory `/home/matt/devel/ZoF/module' make[3]: "/usr/home/matt/devel/freebsd/sys/conf/kern.mk" line 233: Malformed conditional (${MK_INIT_ALL_ZERO} == "yes") make[3]: Fatal errors encountered -- cannot continue make[3]: stopped in /home/matt/devel/ZoF/module gmake[2]: *** [Makefile:53: modules-FreeBSD] Error 1 gmake[2]: Leaving directory '/usr/home/matt/devel/ZoF/module' On Tue, Nov 10, 2020 at 11:15 AM Brooks Davis wrote: > > Author: brooks > Date: Tue Nov 10 19:15:13 2020 > New Revision: 367577 > URL: https://svnweb.freebsd.org/changeset/base/367577 > > Log: > Support initializing stack variables on function entry > > There are two options: > - WITH_INIT_ALL_ZERO: Zero all variables on the stack. > - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns. > > The exact pattern are a compiler implementation detail and vary by type. > They are somewhat documented in the LLVM commit message: > https://reviews.llvm.org/rL349442 > I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather > than naming them after the LLVM specific compiler flags. > > In a range of consumer products, options like these are used in > both debug and production builds with debugs builds using patterns > (intended to provoke crashes on use of uninitialized values) and > production using zeros (deemed more likely to lead to harmless > misbehavior or NULL-pointer dereferences). > > Reviewed by: emaste > Obtained from: CheriBSD > Sponsored by: DARPA > Differential Revision: https://reviews.freebsd.org/D27131 > > Added: > head/tools/build/options/WITH_INIT_ALL_PATTERN (contents, props changed) > head/tools/build/options/WITH_INIT_ALL_ZERO (contents, props changed) > Modified: > head/share/mk/bsd.compiler.mk > head/share/mk/bsd.lib.mk > head/share/mk/bsd.opts.mk > head/share/mk/bsd.prog.mk > head/sys/conf/kern.mk > > Modified: head/share/mk/bsd.compiler.mk > ============================================================================== > --- head/share/mk/bsd.compiler.mk Tue Nov 10 19:09:35 2020 (r367576) > +++ head/share/mk/bsd.compiler.mk Tue Nov 10 19:15:13 2020 (r367577) > @@ -24,6 +24,7 @@ > # - c++11: supports full (or nearly full) C++11 programming environment. > # - retpoline: supports the retpoline speculative execution vulnerability > # mitigation. > +# - init-all: supports stack variable initialization. > # > # These variables with an X_ prefix will also be provided if XCC is set. > # > @@ -214,7 +215,7 @@ ${X_}COMPILER_FEATURES= c++11 c++14 > ${X_}COMPILER_FEATURES+= c++17 > .endif > .if ${${X_}COMPILER_TYPE} == "clang" > -${X_}COMPILER_FEATURES+= retpoline > +${X_}COMPILER_FEATURES+= retpoline init-all > .endif > > .else > > Modified: head/share/mk/bsd.lib.mk > ============================================================================== > --- head/share/mk/bsd.lib.mk Tue Nov 10 19:09:35 2020 (r367576) > +++ head/share/mk/bsd.lib.mk Tue Nov 10 19:15:13 2020 (r367577) > @@ -85,6 +85,25 @@ LDFLAGS+= -Wl,-zretpolineplt > .endif > .endif > > +# Initialize stack variables on function entry > +.if ${MK_INIT_ALL_ZERO} == "yes" > +.if ${COMPILER_FEATURES:Minit-all} > +CFLAGS+= -ftrivial-auto-var-init=zero \ > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang > +CXXFLAGS+= -ftrivial-auto-var-init=zero \ > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang > +.else > +.warning InitAll (zeros) requested but not support by compiler > +.endif > +.elif ${MK_INIT_ALL_PATTERN} == "yes" > +.if ${COMPILER_FEATURES:Minit-all} > +CFLAGS+= -ftrivial-auto-var-init=pattern > +CXXFLAGS+= -ftrivial-auto-var-init=pattern > +.else > +.warning InitAll (pattern) requested but not support by compiler > +.endif > +.endif > + > .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ > empty(DEBUG_FLAGS:M-gdwarf*) > CFLAGS+= ${DEBUG_FILES_CFLAGS} > > Modified: head/share/mk/bsd.opts.mk > ============================================================================== > --- head/share/mk/bsd.opts.mk Tue Nov 10 19:09:35 2020 (r367576) > +++ head/share/mk/bsd.opts.mk Tue Nov 10 19:15:13 2020 (r367577) > @@ -71,6 +71,8 @@ __DEFAULT_NO_OPTIONS = \ > BIND_NOW \ > CCACHE_BUILD \ > CTF \ > + INIT_ALL_PATTERN \ > + INIT_ALL_ZERO \ > INSTALL_AS_USER \ > PIE \ > RETPOLINE \ > @@ -84,6 +86,10 @@ __DEFAULT_DEPENDENT_OPTIONS = \ > > > .include > + > +.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes" > +.error WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive. > +.endif > > # > # Supported NO_* options (if defined, MK_* will be forced to "no", > > Modified: head/share/mk/bsd.prog.mk > ============================================================================== > --- head/share/mk/bsd.prog.mk Tue Nov 10 19:09:35 2020 (r367576) > +++ head/share/mk/bsd.prog.mk Tue Nov 10 19:15:13 2020 (r367577) > @@ -60,6 +60,25 @@ LDFLAGS+= -Wl,-zretpolineplt > .endif > .endif > > +# Initialize stack variables on function entry > +.if ${MK_INIT_ALL_ZERO} == "yes" > +.if ${COMPILER_FEATURES:Minit-all} > +CFLAGS+= -ftrivial-auto-var-init=zero \ > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang > +CXXFLAGS+= -ftrivial-auto-var-init=zero \ > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang > +.else > +.warning InitAll (zeros) requested but not support by compiler > +.endif > +.elif ${MK_INIT_ALL_PATTERN} == "yes" > +.if ${COMPILER_FEATURES:Minit-all} > +CFLAGS+= -ftrivial-auto-var-init=pattern > +CXXFLAGS+= -ftrivial-auto-var-init=pattern > +.else > +.warning InitAll (pattern) requested but not support by compiler > +.endif > +.endif > + > .if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" > CFLAGS += -mno-relax > .endif > > Modified: head/sys/conf/kern.mk > ============================================================================== > --- head/sys/conf/kern.mk Tue Nov 10 19:09:35 2020 (r367576) > +++ head/sys/conf/kern.mk Tue Nov 10 19:15:13 2020 (r367577) > @@ -228,6 +228,24 @@ CFLAGS+= -mretpoline > .endif > > # > +# Initialize stack variables on function entry > +# > +.if ${MK_INIT_ALL_ZERO} == "yes" > +.if ${COMPILER_FEATURES:Minit-all} > +CFLAGS+= -ftrivial-auto-var-init=zero \ > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang > +.else > +.warning InitAll (zeros) requested but not support by compiler > +.endif > +.elif ${MK_INIT_ALL_PATTERN} == "yes" > +.if ${COMPILER_FEATURES:Minit-all} > +CFLAGS+= -ftrivial-auto-var-init=pattern > +.else > +.warning InitAll (pattern) requested but not support by compiler > +.endif > +.endif > + > +# > # Add -gdwarf-2 when compiling -g. The default starting in clang v3.4 > # and gcc 4.8 is to generate DWARF version 4. However, our tools don't > # cope well with DWARF 4, so force it to genereate DWARF2, which they > > Added: head/tools/build/options/WITH_INIT_ALL_PATTERN > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/tools/build/options/WITH_INIT_ALL_PATTERN Tue Nov 10 19:15:13 2020 (r367577) > @@ -0,0 +1,5 @@ > +.\" $FreeBSD$ > +Set to build the base system or kernel with stack variables initialized to > +.Pq compiler defined > +debugging patterns on function entry. > +This option requires the clang compiler. > > Added: head/tools/build/options/WITH_INIT_ALL_ZERO > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/tools/build/options/WITH_INIT_ALL_ZERO Tue Nov 10 19:15:13 2020 (r367577) > @@ -0,0 +1,4 @@ > +.\" $FreeBSD$ > +Set to build the base system or kernel with stack variables initialized > +to zero on function entry. > +This option requires that the clang compiler be used. From owner-svn-src-all@freebsd.org Tue Nov 10 21:12:33 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18438464A57; Tue, 10 Nov 2020 21:12:33 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CW0tn0Fs5z4vLM; Tue, 10 Nov 2020 21:12:33 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFF26FC8; Tue, 10 Nov 2020 21:12:32 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AALCW0G033208; Tue, 10 Nov 2020 21:12:32 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AALCWgK033207; Tue, 10 Nov 2020 21:12:32 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202011102112.0AALCWgK033207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 10 Nov 2020 21:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367579 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 367579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 21:12:33 -0000 Author: brooks Date: Tue Nov 10 21:12:32 2020 New Revision: 367579 URL: https://svnweb.freebsd.org/changeset/base/367579 Log: Be more tolerant of share/mk and kern.mk mismatch When building out-of-tree modules, it appears that the system share/mk is used, but sys/conf/kern.mk is used. That results in MK_INIT_ALL_ZERO being undefined. In the interest of maximum compatability, check that MK_INIT_ALL_* and COMPILER_FEATURES are defined before comparing their values. Reported by: mmacy Sponsored by: DARPA Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Tue Nov 10 19:54:39 2020 (r367578) +++ head/sys/conf/kern.mk Tue Nov 10 21:12:32 2020 (r367579) @@ -230,15 +230,15 @@ CFLAGS+= -mretpoline # # Initialize stack variables on function entry # -.if ${MK_INIT_ALL_ZERO} == "yes" -.if ${COMPILER_FEATURES:Minit-all} +.if defined(MK_INIT_ALL_ZERO) && ${MK_INIT_ALL_ZERO} == "yes" +.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all} CFLAGS+= -ftrivial-auto-var-init=zero \ -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang .else .warning InitAll (zeros) requested but not support by compiler .endif -.elif ${MK_INIT_ALL_PATTERN} == "yes" -.if ${COMPILER_FEATURES:Minit-all} +.elif defined(MK_INIT_ALL_PATTERN) && ${MK_INIT_ALL_PATTERN} == "yes" +.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all} CFLAGS+= -ftrivial-auto-var-init=pattern .else .warning InitAll (pattern) requested but not support by compiler From owner-svn-src-all@freebsd.org Tue Nov 10 21:29:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B1B9465254; Tue, 10 Nov 2020 21:29:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CW1Fz2fNSz3C7F; Tue, 10 Nov 2020 21:29:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E1151623; Tue, 10 Nov 2020 21:29:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AALTBpF039939; Tue, 10 Nov 2020 21:29:11 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AALTB4q039938; Tue, 10 Nov 2020 21:29:11 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011102129.0AALTB4q039938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Nov 2020 21:29:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367580 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 21:29:11 -0000 Author: mjg Date: Tue Nov 10 21:29:10 2020 New Revision: 367580 URL: https://svnweb.freebsd.org/changeset/base/367580 Log: thread: tidy up r367543 "locked" variable is spurious in the committed version. Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Nov 10 21:12:32 2020 (r367579) +++ head/sys/kern/kern_proc.c Tue Nov 10 21:29:10 2020 (r367580) @@ -2748,7 +2748,6 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) struct stack *st; struct sbuf sb; struct proc *p; - bool locked; name = (int *)arg1; error = pget((pid_t)name[0], PGET_NOTINEXEC | PGET_WANTREAD, &p); @@ -2789,14 +2788,12 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) i++; } PROC_UNLOCK(p); - locked = false; numthreads = i; for (i = 0; i < numthreads; i++) { td = tdfind(lwpidarray[i], p->p_pid); if (td == NULL) { continue; } - locked = true; bzero(kkstp, sizeof(*kkstp)); (void)sbuf_new(&sb, kkstp->kkst_trace, sizeof(kkstp->kkst_trace), SBUF_FIXEDLEN); @@ -2810,7 +2807,6 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) kkstp->kkst_state = KKST_STATE_RUNNING; thread_unlock(td); PROC_UNLOCK(p); - locked = false; stack_sbuf_print(&sb, st); sbuf_finish(&sb); sbuf_delete(&sb); @@ -2818,10 +2814,7 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) if (error) break; } - if (!locked) - PROC_LOCK(p); - _PRELE(p); - PROC_UNLOCK(p); + PRELE(p); if (lwpidarray != NULL) free(lwpidarray, M_TEMP); stack_destroy(st); From owner-svn-src-all@freebsd.org Tue Nov 10 21:50:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34A724653E8; Tue, 10 Nov 2020 21:50:09 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CW1k83Qlfz3Cjx; Tue, 10 Nov 2020 21:50:08 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id B9CE13C0199; Tue, 10 Nov 2020 21:50:07 +0000 (UTC) Date: Tue, 10 Nov 2020 21:50:07 +0000 From: Brooks Davis To: Matthew Macy Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options Message-ID: <20201110215007.GD1959@spindle.one-eyed-alien.net> References: <202011101915.0AAJFEWf059408@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="V88s5gaDVPzZ0KCq" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 4CW1k83Qlfz3Cjx X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [0.10 / 15.00]; ARC_NA(0.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; FREEFALL_USER(0.00)[brooks]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_SPAM_SHORT(1.00)[0.997]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[199.48.129.229:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; SIGNED_PGP(-2.00)[]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_COUNT_ZERO(0.00)[0]; R_SPF_NA(0.00)[no SPF record]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RBL_DBL_DONT_QUERY_IPS(0.00)[199.48.129.229:from] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 21:50:09 -0000 --V88s5gaDVPzZ0KCq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Sorry about that. I've fixed it in r367579. -- Brooks On Tue, Nov 10, 2020 at 12:46:45PM -0800, Matthew Macy wrote: > These flags aren't defined by default when building external kernel modul= es: >=20 > gmake[2]: Entering directory '/usr/home/matt/devel/ZoF/module' > env -u MAKEFLAGS make -C /home/matt/devel/ZoF/module -f Makefile.bsd -w > make[3]: Entering directory `/home/matt/devel/ZoF/module' > make[3]: "/usr/home/matt/devel/freebsd/sys/conf/kern.mk" line 233: > Malformed conditional (${MK_INIT_ALL_ZERO} =3D=3D "yes") > make[3]: Fatal errors encountered -- cannot continue > make[3]: stopped in /home/matt/devel/ZoF/module > gmake[2]: *** [Makefile:53: modules-FreeBSD] Error 1 > gmake[2]: Leaving directory '/usr/home/matt/devel/ZoF/module' >=20 > On Tue, Nov 10, 2020 at 11:15 AM Brooks Davis wrote: > > > > Author: brooks > > Date: Tue Nov 10 19:15:13 2020 > > New Revision: 367577 > > URL: https://svnweb.freebsd.org/changeset/base/367577 > > > > Log: > > Support initializing stack variables on function entry > > > > There are two options: > > - WITH_INIT_ALL_ZERO: Zero all variables on the stack. > > - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patt= erns. > > > > The exact pattern are a compiler implementation detail and vary by ty= pe. > > They are somewhat documented in the LLVM commit message: > > https://reviews.llvm.org/rL349442 > > I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather > > than naming them after the LLVM specific compiler flags. > > > > In a range of consumer products, options like these are used in > > both debug and production builds with debugs builds using patterns > > (intended to provoke crashes on use of uninitialized values) and > > production using zeros (deemed more likely to lead to harmless > > misbehavior or NULL-pointer dereferences). > > > > Reviewed by: emaste > > Obtained from: CheriBSD > > Sponsored by: DARPA > > Differential Revision: https://reviews.freebsd.org/D27131 > > > > Added: > > head/tools/build/options/WITH_INIT_ALL_PATTERN (contents, props cha= nged) > > head/tools/build/options/WITH_INIT_ALL_ZERO (contents, props change= d) > > Modified: > > head/share/mk/bsd.compiler.mk > > head/share/mk/bsd.lib.mk > > head/share/mk/bsd.opts.mk > > head/share/mk/bsd.prog.mk > > head/sys/conf/kern.mk > > > > Modified: head/share/mk/bsd.compiler.mk > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/share/mk/bsd.compiler.mk Tue Nov 10 19:09:35 2020 = (r367576) > > +++ head/share/mk/bsd.compiler.mk Tue Nov 10 19:15:13 2020 = (r367577) > > @@ -24,6 +24,7 @@ > > # - c++11: supports full (or nearly full) C++11 programming enviro= nment. > > # - retpoline: supports the retpoline speculative execution vulnerabil= ity > > # mitigation. > > +# - init-all: supports stack variable initialization. > > # > > # These variables with an X_ prefix will also be provided if XCC is se= t. > > # > > @@ -214,7 +215,7 @@ ${X_}COMPILER_FEATURES=3D c++11 c++14 > > ${X_}COMPILER_FEATURES+=3D c++17 > > .endif > > .if ${${X_}COMPILER_TYPE} =3D=3D "clang" > > -${X_}COMPILER_FEATURES+=3D retpoline > > +${X_}COMPILER_FEATURES+=3D retpoline init-all > > .endif > > > > .else > > > > Modified: head/share/mk/bsd.lib.mk > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/share/mk/bsd.lib.mk Tue Nov 10 19:09:35 2020 (r36757= 6) > > +++ head/share/mk/bsd.lib.mk Tue Nov 10 19:15:13 2020 (r36757= 7) > > @@ -85,6 +85,25 @@ LDFLAGS+=3D -Wl,-zretpolineplt > > .endif > > .endif > > > > +# Initialize stack variables on function entry > > +.if ${MK_INIT_ALL_ZERO} =3D=3D "yes" > > +.if ${COMPILER_FEATURES:Minit-all} > > +CFLAGS+=3D -ftrivial-auto-var-init=3Dzero \ > > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from= -clang > > +CXXFLAGS+=3D -ftrivial-auto-var-init=3Dzero \ > > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from= -clang > > +.else > > +.warning InitAll (zeros) requested but not support by compiler > > +.endif > > +.elif ${MK_INIT_ALL_PATTERN} =3D=3D "yes" > > +.if ${COMPILER_FEATURES:Minit-all} > > +CFLAGS+=3D -ftrivial-auto-var-init=3Dpattern > > +CXXFLAGS+=3D -ftrivial-auto-var-init=3Dpattern > > +.else > > +.warning InitAll (pattern) requested but not support by compiler > > +.endif > > +.endif > > + > > .if ${MK_DEBUG_FILES} !=3D "no" && empty(DEBUG_FLAGS:M-g) && \ > > empty(DEBUG_FLAGS:M-gdwarf*) > > CFLAGS+=3D ${DEBUG_FILES_CFLAGS} > > > > Modified: head/share/mk/bsd.opts.mk > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/share/mk/bsd.opts.mk Tue Nov 10 19:09:35 2020 (r36757= 6) > > +++ head/share/mk/bsd.opts.mk Tue Nov 10 19:15:13 2020 (r36757= 7) > > @@ -71,6 +71,8 @@ __DEFAULT_NO_OPTIONS =3D \ > > BIND_NOW \ > > CCACHE_BUILD \ > > CTF \ > > + INIT_ALL_PATTERN \ > > + INIT_ALL_ZERO \ > > INSTALL_AS_USER \ > > PIE \ > > RETPOLINE \ > > @@ -84,6 +86,10 @@ __DEFAULT_DEPENDENT_OPTIONS =3D \ > > > > > > .include > > + > > +.if ${MK_INIT_ALL_PATTERN} =3D=3D "yes" && ${MK_INIT_ALL_ZERO} =3D=3D = "yes" > > +.error WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclu= sive. > > +.endif > > > > # > > # Supported NO_* options (if defined, MK_* will be forced to "no", > > > > Modified: head/share/mk/bsd.prog.mk > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/share/mk/bsd.prog.mk Tue Nov 10 19:09:35 2020 (r36757= 6) > > +++ head/share/mk/bsd.prog.mk Tue Nov 10 19:15:13 2020 (r36757= 7) > > @@ -60,6 +60,25 @@ LDFLAGS+=3D -Wl,-zretpolineplt > > .endif > > .endif > > > > +# Initialize stack variables on function entry > > +.if ${MK_INIT_ALL_ZERO} =3D=3D "yes" > > +.if ${COMPILER_FEATURES:Minit-all} > > +CFLAGS+=3D -ftrivial-auto-var-init=3Dzero \ > > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from= -clang > > +CXXFLAGS+=3D -ftrivial-auto-var-init=3Dzero \ > > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from= -clang > > +.else > > +.warning InitAll (zeros) requested but not support by compiler > > +.endif > > +.elif ${MK_INIT_ALL_PATTERN} =3D=3D "yes" > > +.if ${COMPILER_FEATURES:Minit-all} > > +CFLAGS+=3D -ftrivial-auto-var-init=3Dpattern > > +CXXFLAGS+=3D -ftrivial-auto-var-init=3Dpattern > > +.else > > +.warning InitAll (pattern) requested but not support by compiler > > +.endif > > +.endif > > + > > .if ${MACHINE_CPUARCH} =3D=3D "riscv" && ${LINKER_FEATURES:Mriscv-rela= xations} =3D=3D "" > > CFLAGS +=3D -mno-relax > > .endif > > > > Modified: head/sys/conf/kern.mk > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/conf/kern.mk Tue Nov 10 19:09:35 2020 (r36757= 6) > > +++ head/sys/conf/kern.mk Tue Nov 10 19:15:13 2020 (r36757= 7) > > @@ -228,6 +228,24 @@ CFLAGS+=3D -mretpoline > > .endif > > > > # > > +# Initialize stack variables on function entry > > +# > > +.if ${MK_INIT_ALL_ZERO} =3D=3D "yes" > > +.if ${COMPILER_FEATURES:Minit-all} > > +CFLAGS+=3D -ftrivial-auto-var-init=3Dzero \ > > + -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from= -clang > > +.else > > +.warning InitAll (zeros) requested but not support by compiler > > +.endif > > +.elif ${MK_INIT_ALL_PATTERN} =3D=3D "yes" > > +.if ${COMPILER_FEATURES:Minit-all} > > +CFLAGS+=3D -ftrivial-auto-var-init=3Dpattern > > +.else > > +.warning InitAll (pattern) requested but not support by compiler > > +.endif > > +.endif > > + > > +# > > # Add -gdwarf-2 when compiling -g. The default starting in clang v3.4 > > # and gcc 4.8 is to generate DWARF version 4. However, our tools don't > > # cope well with DWARF 4, so force it to genereate DWARF2, which they > > > > Added: head/tools/build/options/WITH_INIT_ALL_PATTERN > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/tools/build/options/WITH_INIT_ALL_PATTERN Tue Nov 10 19:1= 5:13 2020 (r367577) > > @@ -0,0 +1,5 @@ > > +.\" $FreeBSD$ > > +Set to build the base system or kernel with stack variables initialize= d to > > +.Pq compiler defined > > +debugging patterns on function entry. > > +This option requires the clang compiler. > > > > Added: head/tools/build/options/WITH_INIT_ALL_ZERO > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/tools/build/options/WITH_INIT_ALL_ZERO Tue Nov 10 19:15:13 202= 0 (r367577) > > @@ -0,0 +1,4 @@ > > +.\" $FreeBSD$ > > +Set to build the base system or kernel with stack variables initialized > > +to zero on function entry. > > +This option requires that the clang compiler be used. >=20 --V88s5gaDVPzZ0KCq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJfqwsOAAoJEKzQXbSebgfAwj0H/3WkVjGcexHVNAzAmxyvjJ0+ A75eGFyYwA2Lqbuykq/zGeenKjboOvuM292r363w6Gc9Qz87nHvf1tCXWNlR9qrk PE5uMOKzyEwP/oJgpToI04gt/cYvsD634+EiNRiOaSzkLti3JdEQQU8W7NBf+JqO CdrNx9/yt1gIkep3dlyLt6S/JHRW7CUqOZx2gTYwdzWDLvuKzHBDZqDSx0Wk+svk LqYfHaeLeNo7pY2xVoTek2aYACfewjhD9TOApG/hzWv0HYCO2USLCqeIUO2bjpU0 DXdsMJFl6VCuIa2ag7NFXdvLiV5jmbl1gOIER8hSi6ieQUXDucOq2YALA02Ahco= =uDFQ -----END PGP SIGNATURE----- --V88s5gaDVPzZ0KCq-- From owner-svn-src-all@freebsd.org Tue Nov 10 22:57:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A5A2466960; Tue, 10 Nov 2020 22:57:12 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CW3CX2dDDz3JKJ; Tue, 10 Nov 2020 22:57:12 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 9C5173C0199; Tue, 10 Nov 2020 22:57:11 +0000 (UTC) Date: Tue, 10 Nov 2020 22:57:11 +0000 From: Brooks Davis To: Shawn Webb Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options Message-ID: <20201110225711.GE1959@spindle.one-eyed-alien.net> References: <202011101915.0AAJFEWf059408@repo.freebsd.org> <20201110191729.GC1959@spindle.one-eyed-alien.net> <20201110194445.wf5v63trwcv7fmzs@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UfEAyuTBtIjiZzX6" Content-Disposition: inline In-Reply-To: <20201110194445.wf5v63trwcv7fmzs@mutt-hbsd> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 4CW3CX2dDDz3JKJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 22:57:12 -0000 --UfEAyuTBtIjiZzX6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 10, 2020 at 02:44:45PM -0500, Shawn Webb wrote: > On Tue, Nov 10, 2020 at 07:17:29PM +0000, Brooks Davis wrote: > > On Tue, Nov 10, 2020 at 07:15:14PM +0000, Brooks Davis wrote: > > > Author: brooks > > > Date: Tue Nov 10 19:15:13 2020 > > > New Revision: 367577 > > > URL: https://svnweb.freebsd.org/changeset/base/367577 > > >=20 > > > Log: > > > Support initializing stack variables on function entry > > > =20 > > > There are two options: > > > - WITH_INIT_ALL_ZERO: Zero all variables on the stack. > > > - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined pa= tterns. > > > =20 > > > The exact pattern are a compiler implementation detail and vary by = type. > > > They are somewhat documented in the LLVM commit message: > > > https://reviews.llvm.org/rL349442 > > > I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rath= er > > > than naming them after the LLVM specific compiler flags. > > > =20 > > > In a range of consumer products, options like these are used in > > > both debug and production builds with debugs builds using patterns > > > (intended to provoke crashes on use of uninitialized values) and > > > production using zeros (deemed more likely to lead to harmless > > > misbehavior or NULL-pointer dereferences). > >=20 > > We've tested this extensively in CheriBSD on RISC-V, in the wild it's > > probably most tested on Arm64 and x86. > >=20 > > Despite the silly compiler flag you'll spot in the code, the zeroing > > option isn't going away in practice as Apple, Google, and Microsoft all > > ship with this feature in some of their products. >=20 > HardenedBSD's testing of this last year on amd64 have (privately) > shown the feature to really hinder performance on more complex > applications (like when applied to clang/lld). A build of base > without init all zero applied to clang/lld would take around 1.5 > hours on my system. A build with it applied to clang/lld took around > four hours, if my memory serves correctly. I would probably advise > against applying it system-wide. But YMMV. I agree a more nuanced approach is likely useful in practice, but this does work and is part of the configuration we shipped for DARPA's FETT bug bounty. Hopefully this provides a starting point for further exploration. -- Brooks --UfEAyuTBtIjiZzX6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJfqxrHAAoJEKzQXbSebgfAtNYIAJCpuSTOYukQKyc6+56Xvn9G ht5hEAAjfqcmaVtu3pYnVsdlp/VjMmCMPkiWje5VSSpzQg5BHETX+/LW3GCR6ICo DKeMvtWBxz/pB0jAfIKMcjdfEzz4JC6FprNhmOwEdW7lj27YVf2qFHvzhppjCX4N 4G8wsWS/ENKkzAadPoPPPMzjz0oqaRaugBK9Z/20/pMtQ6akWlmeW+nZGq/CLUbl qTjp1AkTn2O5IzqQX2tytzE7R5e3azc7u/li5mVj/gb1NBn/8GgGAoZdBZhw2i3G DaALOM8lSybubDUS+yURs43chwn8D/qUBXUWAuaqeO78hg+FHBrd0Lsa9cGXOrw= =cDR1 -----END PGP SIGNATURE----- --UfEAyuTBtIjiZzX6-- From owner-svn-src-all@freebsd.org Tue Nov 10 23:25:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B912C46728F; Tue, 10 Nov 2020 23:25:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CW3qx4tHvz3KLS; Tue, 10 Nov 2020 23:25:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A2762CA2; Tue, 10 Nov 2020 23:25:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AANPH6v013776; Tue, 10 Nov 2020 23:25:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AANPH7T013774; Tue, 10 Nov 2020 23:25:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202011102325.0AANPH7T013774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 10 Nov 2020 23:25:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367581 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 367581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2020 23:25:17 -0000 Author: imp Date: Tue Nov 10 23:25:16 2020 New Revision: 367581 URL: https://svnweb.freebsd.org/changeset/base/367581 Log: Add INIT_ALL_ZERO and INIT_ALL_PATTERN to kern.opts.mk These options need to be in the kern.opts.mk file to be alive for kernel and module builds. This also reverts r367579 since that's not needed with this fix: the host's bsd.opts.mk is irrelevant. Reviewed by: brooks@ Differential Revision: https://reviews.freebsd.org/D27170 Modified: head/sys/conf/kern.mk head/sys/conf/kern.opts.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Tue Nov 10 21:29:10 2020 (r367580) +++ head/sys/conf/kern.mk Tue Nov 10 23:25:16 2020 (r367581) @@ -230,15 +230,15 @@ CFLAGS+= -mretpoline # # Initialize stack variables on function entry # -.if defined(MK_INIT_ALL_ZERO) && ${MK_INIT_ALL_ZERO} == "yes" -.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all} +.if ${MK_INIT_ALL_ZERO} == "yes" +.if ${COMPILER_FEATURES:Minit-all} CFLAGS+= -ftrivial-auto-var-init=zero \ -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang .else .warning InitAll (zeros) requested but not support by compiler .endif -.elif defined(MK_INIT_ALL_PATTERN) && ${MK_INIT_ALL_PATTERN} == "yes" -.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all} +.elif ${MK_INIT_ALL_PATTERN} == "yes" +.if ${COMPILER_FEATURES:Minit-all} CFLAGS+= -ftrivial-auto-var-init=pattern .else .warning InitAll (pattern) requested but not support by compiler Modified: head/sys/conf/kern.opts.mk ============================================================================== --- head/sys/conf/kern.opts.mk Tue Nov 10 21:29:10 2020 (r367580) +++ head/sys/conf/kern.opts.mk Tue Nov 10 23:25:16 2020 (r367581) @@ -52,6 +52,8 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ BHYVE_SNAPSHOT \ EXTRA_TCP_STACKS \ + INIT_ALL_PATTERN \ + INIT_ALL_ZERO \ KERNEL_RETPOLINE \ OFED \ RATELIMIT \ From owner-svn-src-all@freebsd.org Wed Nov 11 00:43:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3A322D06A8; Wed, 11 Nov 2020 00:43:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CW5Ys6bbwz3Nkj; Wed, 11 Nov 2020 00:43:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D33C43EA5; Wed, 11 Nov 2020 00:43:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AB0hD0U064081; Wed, 11 Nov 2020 00:43:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AB0hDtt064080; Wed, 11 Nov 2020 00:43:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011110043.0AB0hDtt064080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 11 Nov 2020 00:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367582 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 00:43:14 -0000 Author: kib Date: Wed Nov 11 00:43:13 2020 New Revision: 367582 URL: https://svnweb.freebsd.org/changeset/base/367582 Log: MFC r367120: Check for process group change in tty_wait_background(). PR: 250701 Modified: stable/12/sys/kern/tty.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/tty.c ============================================================================== --- stable/12/sys/kern/tty.c Tue Nov 10 23:25:16 2020 (r367581) +++ stable/12/sys/kern/tty.c Wed Nov 11 00:43:13 2020 (r367582) @@ -464,6 +464,19 @@ tty_wait_background(struct tty *tp, struct thread *td, sig = 0; } PGRP_LOCK(pg); + + /* + * pg may no longer be our process group. + * Re-check after locking process group. + */ + PROC_LOCK(p); + if (p->p_pgrp != pg) { + PROC_UNLOCK(p); + PGRP_UNLOCK(pg); + continue; + } + + PROC_UNLOCK(p); pgsignal(pg, ksi.ksi_signo, 1, &ksi); PGRP_UNLOCK(pg); From owner-svn-src-all@freebsd.org Wed Nov 11 06:28:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 417AB2D64D3 for ; Wed, 11 Nov 2020 06:28:09 +0000 (UTC) (envelope-from XFGGHJO25_npai+svn-src-all=freebsd.org.102148217@wedeo-news.com) Received: from wedeo-news.com (wedeo-news.com [212.83.132.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWFCq5Njfz3tfn for ; Wed, 11 Nov 2020 06:28:07 +0000 (UTC) (envelope-from XFGGHJO25_npai+svn-src-all=freebsd.org.102148217@wedeo-news.com) Received: from sendmail_check (localhost [127.0.0.1]) by wedeo-news.com (Postfix) with SMTP id E14D0264686 for ; Wed, 11 Nov 2020 07:27:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wedeo-news.com; s=oxidkim; t=1605076079; bh=2DRi0AE0GIDNTWYeHokWRJO350AL3R19qv9AmlsroT4=; h=List-Unsubscribe:From:To:Subject:Date:From; b=ao+/WOpS0UG1zxgLBH/DEVsho4Givj/T6a/w5VvSi+vIGjGMIoeJrjPpcmB9Z/1Oy qSavmLVVu3zCo9QHRieoHJnsT6+ds00aIe7O1SY4QAbZBtDzaKbw7epS2AFD8UZ/+3 2LHvobvXjbx6rrJxW7V4/CNA95ekdEUa2LkKUBRVAJ8sDYP9RqselSsvkxQ1NLWzTx BznO0bNKP8lM88WlLI92V4nXUvW6ikfv6inAS0bpQID0C9H2MQ11iw8RomnkJ2kUQa Hc5kyTLomdCXUdpVGQSArlSjxQRnrET5MUrff5tMz6UPQRBDouDABrjCAt3NsKfx1k dTTy0YtE8wZ4Q== X-MessageId: 887071717274795053||8386784583826745657676647082696966836846798271||102148217||8||887071717274795053 Message-ID: From: "Thierry" To: Subject: Question Date: Wed, 11 Nov 2020 07:25:07 +0100 X-Mailer: OxiMailing 8.5.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 4CWFCq5Njfz3tfn X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=wedeo-news.com header.s=oxidkim header.b=ao+/WOpS; dmarc=pass (policy=none) header.from=wedeo-news.com; spf=pass (mx1.freebsd.org: domain of XFGGHJO25_npai@wedeo-news.com designates 212.83.132.75 as permitted sender) smtp.mailfrom=XFGGHJO25_npai@wedeo-news.com X-Spamd-Result: default: False [-2.91 / 15.00]; RWL_MAILSPIKE_GOOD(0.00)[212.83.132.75:from]; ZERO_FONT(0.20)[2]; R_SPF_ALLOW(-0.20)[+a]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[wedeo-news.com:+]; DMARC_POLICY_ALLOW(-0.50)[wedeo-news.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[contact@wedeo-news.com,XFGGHJO25_npai@wedeo-news.com]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[212.83.132.75:from]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[svn-src-all=freebsd.org.102148217]; FROM_NEQ_ENVFROM(0.00)[contact@wedeo-news.com,XFGGHJO25_npai@wedeo-news.com]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[wedeo-news.com:s=oxidkim]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; HTML_SHORT_LINK_IMG_3(0.50)[]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[212.83.132.75:from:127.0.2.255]; MANY_INVISIBLE_PARTS(0.10)[2]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all] Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 06:28:09 -0000 Avez-vous..=2E Si vous ne voyez pas ce message correctement, [consultez-le en ligne] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZQ&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqlcmXn4+gnNmnk5Si0= GKMqqt8f4GDlZdidWidc5NkZ2Vgq3N2lnN6lG2ZdWaZZm2Zp2tqaWuckmiTa5xe05mn&v=3D8)= =2E [(image)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgp8eWnNFiy6Ni&= v=3D8) Bonjour, La fin d'ann=C3=A9e approche =C3=A0 grands pas ! Avez-vous un projet de vid=C3=A9o en dessin anim=C3=A9s ? [(image)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgqdGnq9eWyl+W0= qBj28Wpmp9z2Z9rjJ+dlMWab2ZoyA&v=3D8) Vid=C3=A9o en motion design : une communication impactante =E2=80=A2 Pr=C3=A9senter votre entreprise, produit ou service =E2=80=A2 Communiquer sur les mesures sanitaires=20 =E2=80=A2 Rassurer vos collaborateurs et clients + d'infos : [Cliquez-ici] = (mailto:thierry@wedeo.fr?subject=3DEn%20savoir%20plus%20sur%20le%20motion%2= 0design%20) Avez-vous pens=C3=A9 =C3=A0 vos voeux ? Figurez-vous que la carte de v=C5=93ux en motion design est = appr=C3=A9ci=C3=A9e pour son dynamisme et son efficacit=C3=A9. Ainsi, = faites place =C3=A0 l'originalit=C3=A9 et pr=C3=A9sentez vos voeux en = vid=C3=A9o ! [(image)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGasn9qmpZCUnJGFsYNgv= Jdkr9iWog&v=3D8) La vid=C3=A9o de voeux sur mesure =E2=80=A2 Renforcer le sentiment d=E2=80=99appartenance=20 =E2=80=A2 D=C3=A9livrer un message fort =E2=80=A2 Impacter votre entourage professionnel +d'infos : [Cliquez-ici] = (mailto:thierry@wedeo.fr?subject=3DEn%20savoir%20plus%20sur%20les%20vid%C3%= A9o%20de%20voeux) [(image)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgqdGnq9eWyl+W0= qBj28Wpmp9z2Z9+apvSZJWlj4OazA&v=3D8) La vid=C3=A9o de voeux personnalisable =E2=80=A2 Communiquer simplement et rapidement =E2=80=A2 Personnalisation =C3=A0 votre image =E2=80=A2 B=C3=A9n=C3=A9ficier d'une solution abordable + d'infos : [Cliquez-ici] = (mailto:thierry@wedeo.fr?subject=3DEn%20savoir%20plus%20sur%20la%20vid%C3%A= 9o%20de%20voeux) Prenez soin de vous et de vos proches ! Thierry Maillard / CEO =E2=98=8E=EF=B8=8F 06.12.98.41.16 Voir l'int=C3=A9gralit=C3=A9 de nos vid=C3=A9os: [Cliquez-ici] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgqdGnq9eWyl+W0= qBjx8yWpaWZz5GId429gbtmnHx5nXWgsJGOsX/ThnnFf5uT2p6bnKPW&v=3D8) [(image)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgp8eWnNFiy6Ni&= v=3D8) Un correspondant dans votre r=C3=A9gion =E2=80=A2 Agent =C3=AEle de france : 01.86.86.01.42 =E2=80=A2 Agent Ouest : 02.52.68.36.82 =E2=80=A2 Agent Est : 03.74.82.00.14 =E2=80=A2 Agent Sud : 04.28.63.00.35 =E2=80=A2 Agent Sud-Ouest : 05.36.28.10.79 [(image:Facebook)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xglsOVnMSj1Jxhx= qKhk7uam5yjsNGnnaXSdMikoJqelA&v=3D8) [(image:Youtube)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgqdGnq9eWyl+W0= qBjx8yWpaWZz5GId429gbtmnHx5nXWgsJGOsX/ThnnFf5uT2p6bnKPW&v=3D8) [(image:LinkedIn)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgnMugoseYzp9hx= qKhk8ekpKeV0dtiq5vIldJg&v=3D8) [(image:Instagram)] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgmdClq8Ob15Kgk= Zaj0ZOsnJuZ0sFi&v=3D8) Notre soci=C3=A9t=C3=A9 produit plus de 40 vid=C3=A9os motion design par = mois. Que vous soyez une TPE ou PME , nous vous accompagnons de A =C3=A0 Z = dans la r=C3=A9alisation de contenus attractives et captivants. = [Contactez-nous] = (https://wedeo-news.com/c6.php?ec=3D2&l=3Di3p9q3itgGlo&i=3DZGRolWSbY2hq&t= =3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaqp9xgp8eWnNFiy6Nix= qKi2MWYq5yukNCiqamT&v=3D8) Si vous ne souhaitez plus recevoir nos messages, suivez ce lien : [Veuillez me retirer de votre liste de diffusion] = (https://wedeo-news.com/d6.php?ec=3D2&l=3Di3p9q3itgGlo&e=3DpqqkkaPVlGSUnNFy= ltSXnMSnyV+i1Zo&i=3DZGRolWSbY2hq&v=3D8) From owner-svn-src-all@freebsd.org Wed Nov 11 08:48:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 161992E1A1D; Wed, 11 Nov 2020 08:48:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWJL409n4z4VXl; Wed, 11 Nov 2020 08:48:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED3F511CD3; Wed, 11 Nov 2020 08:48:43 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AB8mhFP062128; Wed, 11 Nov 2020 08:48:43 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AB8mhug062126; Wed, 11 Nov 2020 08:48:43 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011110848.0AB8mhug062126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 11 Nov 2020 08:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367583 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 08:48:44 -0000 Author: mjg Date: Wed Nov 11 08:48:43 2020 New Revision: 367583 URL: https://svnweb.freebsd.org/changeset/base/367583 Log: thread: fix thread0 tid allocation Startup code hardcodes the value instead of allocating it. The first spawned thread would then be a duplicate. Pointy hat: mjg Modified: head/sys/kern/init_main.c head/sys/kern/kern_thread.c head/sys/sys/proc.h Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Nov 11 00:43:13 2020 (r367582) +++ head/sys/kern/init_main.c Wed Nov 11 08:48:43 2020 (r367583) @@ -496,8 +496,7 @@ proc0_init(void *dummy __unused) p->p_klist = knlist_alloc(&p->p_mtx); STAILQ_INIT(&p->p_ktr); p->p_nice = NZERO; - /* pid_max cannot be greater than PID_MAX */ - td->td_tid = PID_MAX + 1; + td->td_tid = THREAD0_TID; LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); td->td_state = TDS_RUNNING; td->td_pri_class = PRI_TIMESHARE; Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Nov 11 00:43:13 2020 (r367582) +++ head/sys/kern/kern_thread.c Wed Nov 11 08:48:43 2020 (r367583) @@ -354,6 +354,7 @@ extern int max_threads_per_proc; void threadinit(void) { + lwpid_t tid0; uint32_t flags; /* @@ -374,6 +375,9 @@ threadinit(void) mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF); tid_bitmap = bit_alloc(maxthread, M_TIDHASH, M_WAITOK); + tid0 = tid_alloc(); + if (tid0 != THREAD0_TID) + panic("tid0 %d != %d\n", tid0, THREAD0_TID); flags = UMA_ZONE_NOFREE; #ifdef __aarch64__ Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Wed Nov 11 00:43:13 2020 (r367582) +++ head/sys/sys/proc.h Wed Nov 11 08:48:43 2020 (r367583) @@ -855,6 +855,7 @@ MALLOC_DECLARE(M_SUBPROC); */ #define PID_MAX 99999 #define NO_PID 100000 +#define THREAD0_TID NO_PID extern pid_t pid_max; #define SESS_LEADER(p) ((p)->p_session->s_leader == (p)) From owner-svn-src-all@freebsd.org Wed Nov 11 08:50:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B77532E1770; Wed, 11 Nov 2020 08:50:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWJMd4r2rz4VNk; Wed, 11 Nov 2020 08:50:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98F5C11F93; Wed, 11 Nov 2020 08:50:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AB8o5oA062279; Wed, 11 Nov 2020 08:50:05 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AB8o4VA062275; Wed, 11 Nov 2020 08:50:04 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011110850.0AB8o4VA062275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 11 Nov 2020 08:50:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367584 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 08:50:05 -0000 Author: mjg Date: Wed Nov 11 08:50:04 2020 New Revision: 367584 URL: https://svnweb.freebsd.org/changeset/base/367584 Log: thread: rework tidhash vs proc lock interaction Apart from minor clean up this gets rid of proc unlock/lock cycle on thread exit to work around LOR against tidhash lock. Modified: head/sys/kern/init_main.c head/sys/kern/kern_kthread.c head/sys/kern/kern_thr.c head/sys/kern/kern_thread.c head/sys/sys/proc.h Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Nov 11 08:48:43 2020 (r367583) +++ head/sys/kern/init_main.c Wed Nov 11 08:50:04 2020 (r367584) @@ -497,7 +497,7 @@ proc0_init(void *dummy __unused) STAILQ_INIT(&p->p_ktr); p->p_nice = NZERO; td->td_tid = THREAD0_TID; - LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); + tidhash_add(td); td->td_state = TDS_RUNNING; td->td_pri_class = PRI_TIMESHARE; td->td_user_pri = PUSER; Modified: head/sys/kern/kern_kthread.c ============================================================================== --- head/sys/kern/kern_kthread.c Wed Nov 11 08:48:43 2020 (r367583) +++ head/sys/kern/kern_kthread.c Wed Nov 11 08:50:04 2020 (r367584) @@ -350,15 +350,12 @@ kthread_exit(void) * The last exiting thread in a kernel process must tear down * the whole process. */ - rw_wlock(&tidhash_lock); PROC_LOCK(p); if (p->p_numthreads == 1) { PROC_UNLOCK(p); - rw_wunlock(&tidhash_lock); kproc_exit(0); } - LIST_REMOVE(td, td_hash); - rw_wunlock(&tidhash_lock); + tidhash_remove(td); umtx_thread_exit(td); tdsigcleanup(td); PROC_SLOCK(p); Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Wed Nov 11 08:48:43 2020 (r367583) +++ head/sys/kern/kern_thr.c Wed Nov 11 08:50:04 2020 (r367584) @@ -353,14 +353,13 @@ kern_thr_exit(struct thread *td) return (0); } - p->p_pendingexits++; td->td_dbgflags |= TDB_EXIT; - if (p->p_ptevents & PTRACE_LWP) + if (p->p_ptevents & PTRACE_LWP) { + p->p_pendingexits++; ptracestop(td, SIGTRAP, NULL); - PROC_UNLOCK(p); + p->p_pendingexits--; + } tidhash_remove(td); - PROC_LOCK(p); - p->p_pendingexits--; /* * The check above should prevent all other threads from this Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Nov 11 08:48:43 2020 (r367583) +++ head/sys/kern/kern_thread.c Wed Nov 11 08:50:04 2020 (r367584) @@ -147,9 +147,10 @@ SYSCTL_INT(_kern, OID_AUTO, maxthread, CTLFLAG_RDTUN, static int nthreads; -struct tidhashhead *tidhashtbl; -u_long tidhash; -struct rwlock tidhash_lock; +static LIST_HEAD(tidhashhead, thread) *tidhashtbl; +static u_long tidhash; +static struct rwlock tidhash_lock; +#define TIDHASH(tid) (&tidhashtbl[(tid) & tidhash]) EVENTHANDLER_LIST_DEFINE(thread_ctor); EVENTHANDLER_LIST_DEFINE(thread_dtor); @@ -1329,13 +1330,65 @@ thread_single_end(struct proc *p, int mode) kick_proc0(); } -/* Locate a thread by number; return with proc lock held. */ +/* + * Locate a thread by number and return with proc lock held. + * + * thread exit establishes proc -> tidhash lock ordering, but lookup + * takes tidhash first and needs to return locked proc. + * + * The problem is worked around by relying on type-safety of both + * structures and doing the work in 2 steps: + * - tidhash-locked lookup which saves both thread and proc pointers + * - proc-locked verification that the found thread still matches + */ +static bool +tdfind_hash(lwpid_t tid, pid_t pid, struct proc **pp, struct thread **tdp) +{ +#define RUN_THRESH 16 + struct proc *p; + struct thread *td; + int run; + bool locked; + + run = 0; + rw_rlock(&tidhash_lock); + locked = true; + LIST_FOREACH(td, TIDHASH(tid), td_hash) { + if (td->td_tid != tid) { + run++; + continue; + } + p = td->td_proc; + if (pid != -1 && p->p_pid != pid) { + td = NULL; + break; + } + if (run > RUN_THRESH) { + if (rw_try_upgrade(&tidhash_lock)) { + LIST_REMOVE(td, td_hash); + LIST_INSERT_HEAD(TIDHASH(td->td_tid), + td, td_hash); + rw_wunlock(&tidhash_lock); + locked = false; + break; + } + } + break; + } + if (locked) + rw_runlock(&tidhash_lock); + if (td == NULL) + return (false); + *pp = p; + *tdp = td; + return (true); +} + struct thread * tdfind(lwpid_t tid, pid_t pid) { -#define RUN_THRESH 16 + struct proc *p; struct thread *td; - int run = 0; td = curthread; if (td->td_tid == tid) { @@ -1345,34 +1398,24 @@ tdfind(lwpid_t tid, pid_t pid) return (td); } - rw_rlock(&tidhash_lock); - LIST_FOREACH(td, TIDHASH(tid), td_hash) { - if (td->td_tid == tid) { - if (pid != -1 && td->td_proc->p_pid != pid) { - td = NULL; - break; - } - PROC_LOCK(td->td_proc); - if (td->td_proc->p_state == PRS_NEW) { - PROC_UNLOCK(td->td_proc); - td = NULL; - break; - } - if (run > RUN_THRESH) { - if (rw_try_upgrade(&tidhash_lock)) { - LIST_REMOVE(td, td_hash); - LIST_INSERT_HEAD(TIDHASH(td->td_tid), - td, td_hash); - rw_wunlock(&tidhash_lock); - return (td); - } - } - break; + for (;;) { + if (!tdfind_hash(tid, pid, &p, &td)) + return (NULL); + PROC_LOCK(p); + if (td->td_tid != tid) { + PROC_UNLOCK(p); + continue; } - run++; + if (td->td_proc != p) { + PROC_UNLOCK(p); + continue; + } + if (p->p_state == PRS_NEW) { + PROC_UNLOCK(p); + return (NULL); + } + return (td); } - rw_runlock(&tidhash_lock); - return (td); } void Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Wed Nov 11 08:48:43 2020 (r367583) +++ head/sys/sys/proc.h Wed Nov 11 08:50:04 2020 (r367584) @@ -968,10 +968,6 @@ extern LIST_HEAD(pidhashhead, proc) *pidhashtbl; extern struct sx *pidhashtbl_lock; extern u_long pidhash; extern u_long pidhashlock; -#define TIDHASH(tid) (&tidhashtbl[(tid) & tidhash]) -extern LIST_HEAD(tidhashhead, thread) *tidhashtbl; -extern u_long tidhash; -extern struct rwlock tidhash_lock; #define PGRPHASH(pgid) (&pgrphashtbl[(pgid) & pgrphash]) extern LIST_HEAD(pgrphashhead, pgrp) *pgrphashtbl; From owner-svn-src-all@freebsd.org Wed Nov 11 08:51:04 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFABD2E1A5D; Wed, 11 Nov 2020 08:51:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWJNm6X1Fz4Vrc; Wed, 11 Nov 2020 08:51:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8B5711D59; Wed, 11 Nov 2020 08:51:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AB8p47V066193; Wed, 11 Nov 2020 08:51:04 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AB8p4aG066192; Wed, 11 Nov 2020 08:51:04 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011110851.0AB8p4aG066192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 11 Nov 2020 08:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367585 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 08:51:05 -0000 Author: mjg Date: Wed Nov 11 08:51:04 2020 New Revision: 367585 URL: https://svnweb.freebsd.org/changeset/base/367585 Log: thread: add more fine-grained tidhash locking Note this still does not scale but is enough to move it out of the way for the foreseable future. In particular a trivial benchmark spawning/killing threads stops contesting on tidhash. Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Nov 11 08:50:04 2020 (r367584) +++ head/sys/kern/kern_thread.c Wed Nov 11 08:51:04 2020 (r367585) @@ -149,8 +149,10 @@ static int nthreads; static LIST_HEAD(tidhashhead, thread) *tidhashtbl; static u_long tidhash; -static struct rwlock tidhash_lock; -#define TIDHASH(tid) (&tidhashtbl[(tid) & tidhash]) +static u_long tidhashlock; +static struct rwlock *tidhashtbl_lock; +#define TIDHASH(tid) (&tidhashtbl[(tid) & tidhash]) +#define TIDHASHLOCK(tid) (&tidhashtbl_lock[(tid) & tidhashlock]) EVENTHANDLER_LIST_DEFINE(thread_ctor); EVENTHANDLER_LIST_DEFINE(thread_dtor); @@ -355,6 +357,7 @@ extern int max_threads_per_proc; void threadinit(void) { + u_long i; lwpid_t tid0; uint32_t flags; @@ -395,7 +398,13 @@ threadinit(void) thread_ctor, thread_dtor, thread_init, thread_fini, 32 - 1, flags); tidhashtbl = hashinit(maxproc / 2, M_TIDHASH, &tidhash); - rw_init(&tidhash_lock, "tidhash"); + tidhashlock = (tidhash + 1) / 64; + if (tidhashlock > 0) + tidhashlock--; + tidhashtbl_lock = malloc(sizeof(*tidhashtbl_lock) * (tidhashlock + 1), + M_TIDHASH, M_WAITOK | M_ZERO); + for (i = 0; i < tidhashlock + 1; i++) + rw_init(&tidhashtbl_lock[i], "tidhash"); } /* @@ -1351,7 +1360,7 @@ tdfind_hash(lwpid_t tid, pid_t pid, struct proc **pp, bool locked; run = 0; - rw_rlock(&tidhash_lock); + rw_rlock(TIDHASHLOCK(tid)); locked = true; LIST_FOREACH(td, TIDHASH(tid), td_hash) { if (td->td_tid != tid) { @@ -1364,11 +1373,11 @@ tdfind_hash(lwpid_t tid, pid_t pid, struct proc **pp, break; } if (run > RUN_THRESH) { - if (rw_try_upgrade(&tidhash_lock)) { + if (rw_try_upgrade(TIDHASHLOCK(tid))) { LIST_REMOVE(td, td_hash); LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); - rw_wunlock(&tidhash_lock); + rw_wunlock(TIDHASHLOCK(tid)); locked = false; break; } @@ -1376,7 +1385,7 @@ tdfind_hash(lwpid_t tid, pid_t pid, struct proc **pp, break; } if (locked) - rw_runlock(&tidhash_lock); + rw_runlock(TIDHASHLOCK(tid)); if (td == NULL) return (false); *pp = p; @@ -1421,15 +1430,16 @@ tdfind(lwpid_t tid, pid_t pid) void tidhash_add(struct thread *td) { - rw_wlock(&tidhash_lock); + rw_wlock(TIDHASHLOCK(td->td_tid)); LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); - rw_wunlock(&tidhash_lock); + rw_wunlock(TIDHASHLOCK(td->td_tid)); } void tidhash_remove(struct thread *td) { - rw_wlock(&tidhash_lock); + + rw_wlock(TIDHASHLOCK(td->td_tid)); LIST_REMOVE(td, td_hash); - rw_wunlock(&tidhash_lock); + rw_wunlock(TIDHASHLOCK(td->td_tid)); } From owner-svn-src-all@freebsd.org Wed Nov 11 11:25:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E48C2E63A4; Wed, 11 Nov 2020 11:25:15 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWMpg398Kz4f2q; Wed, 11 Nov 2020 11:25:15 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F8F013B5C; Wed, 11 Nov 2020 11:25:15 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABBPFSW060292; Wed, 11 Nov 2020 11:25:15 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABBPFA3060291; Wed, 11 Nov 2020 11:25:15 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011111125.0ABBPFA3060291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Wed, 11 Nov 2020 11:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367586 - stable/12/usr.bin/usbhidaction X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/usr.bin/usbhidaction X-SVN-Commit-Revision: 367586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 11:25:15 -0000 Author: 0mp (doc,ports committer) Date: Wed Nov 11 11:25:14 2020 New Revision: 367586 URL: https://svnweb.freebsd.org/changeset/base/367586 Log: MFC r367097: Correct USB HID item in examples It turns out that examples were incorrectly referring to Volume_Up and Volume_Down, which are not defined at all. PR: 250683 Modified: stable/12/usr.bin/usbhidaction/usbhidaction.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/usbhidaction/usbhidaction.1 ============================================================================== --- stable/12/usr.bin/usbhidaction/usbhidaction.1 Wed Nov 11 08:51:04 2020 (r367585) +++ stable/12/usr.bin/usbhidaction/usbhidaction.1 Wed Nov 11 11:25:14 2020 (r367586) @@ -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 April 9, 2003 +.Dd October 28, 2020 .Dt USBHIDACTION 1 .Os .Sh NAME @@ -139,8 +139,8 @@ The following configuration file can be used to contro of Philips USB speakers with the HID controls on the speakers. .Bd -literal -offset indent # Configuration for various Philips USB speakers -Consumer:Volume_Up 1 0 mixer -f $1 vol +1 -Consumer:Volume_Down 1 0 mixer -f $1 vol -1 +Consumer:Volume_Increment 1 0 mixer -f $1 vol +1 +Consumer:Volume_Decrement 1 0 mixer -f $1 vol -1 # mute not supported #Consumer:Mute 1 0 mixer -f $1 mute Consumer:Channel_Top.Microsoft:Base_Up 1 0 mixer -f $1 bass +1 From owner-svn-src-all@freebsd.org Wed Nov 11 11:26:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EAE02E62EF; Wed, 11 Nov 2020 11:26:37 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWMrF2kV1z4fQl; Wed, 11 Nov 2020 11:26:37 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FDE013E91; Wed, 11 Nov 2020 11:26:37 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABBQb1E060410; Wed, 11 Nov 2020 11:26:37 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABBQbXO060409; Wed, 11 Nov 2020 11:26:37 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011111126.0ABBQbXO060409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Wed, 11 Nov 2020 11:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367587 - stable/11/usr.bin/usbhidaction X-SVN-Group: stable-11 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/11/usr.bin/usbhidaction X-SVN-Commit-Revision: 367587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 11:26:37 -0000 Author: 0mp (doc,ports committer) Date: Wed Nov 11 11:26:36 2020 New Revision: 367587 URL: https://svnweb.freebsd.org/changeset/base/367587 Log: MFC r367097: Correct USB HID item in examples It turns out that examples were incorrectly referring to Volume_Up and Volume_Down, which are not defined at all. PR: 250683 Modified: stable/11/usr.bin/usbhidaction/usbhidaction.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/usbhidaction/usbhidaction.1 ============================================================================== --- stable/11/usr.bin/usbhidaction/usbhidaction.1 Wed Nov 11 11:25:14 2020 (r367586) +++ stable/11/usr.bin/usbhidaction/usbhidaction.1 Wed Nov 11 11:26:36 2020 (r367587) @@ -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 April 9, 2003 +.Dd October 28, 2020 .Dt USBHIDACTION 1 .Os .Sh NAME @@ -139,8 +139,8 @@ The following configuration file can be used to contro of Philips USB speakers with the HID controls on the speakers. .Bd -literal -offset indent # Configuration for various Philips USB speakers -Consumer:Volume_Up 1 0 mixer -f $1 vol +1 -Consumer:Volume_Down 1 0 mixer -f $1 vol -1 +Consumer:Volume_Increment 1 0 mixer -f $1 vol +1 +Consumer:Volume_Decrement 1 0 mixer -f $1 vol -1 # mute not supported #Consumer:Mute 1 0 mixer -f $1 mute Consumer:Channel_Top.Microsoft:Base_Up 1 0 mixer -f $1 bass +1 From owner-svn-src-all@freebsd.org Wed Nov 11 13:44:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD0332EA441; Wed, 11 Nov 2020 13:44:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWQvJ4p5sz4nBd; Wed, 11 Nov 2020 13:44:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9782F155EC; Wed, 11 Nov 2020 13:44:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABDiSeP048135; Wed, 11 Nov 2020 13:44:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABDiR78048131; Wed, 11 Nov 2020 13:44:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011111344.0ABDiR78048131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Nov 2020 13:44:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367588 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 13:44:28 -0000 Author: markj Date: Wed Nov 11 13:44:27 2020 New Revision: 367588 URL: https://svnweb.freebsd.org/changeset/base/367588 Log: Fix a pair of races in SIGIO registration First, funsetownlst() list looks at the first element of the list to see whether it's processing a process or a process group list. Then it acquires the global sigio lock and processes the list. However, nothing prevents the first sigio tracker from being freed by a concurrent funsetown() before the sigio lock is acquired. Fix this by acquiring the global sigio lock immediately after checking whether the list is empty. Callers of funsetownlst() ensure that new sigio trackers cannot be added concurrently. Second, fsetown() uses funsetown() to remove an existing sigio structure from a file object. However, funsetown() uses a racy check to avoid the sigio lock, so two threads may call fsetown() on the same file object, both observe that no sigio tracker is present, and enqueue two sigio trackers for the same file object. However, if the file object is destroyed, funsetown() will only remove one sigio tracker, and funsetownlst() may later trigger a use-after-free when it clears the file object reference for each entry in the list. Fix this by introducing funsetown_locked(), which avoids the racy check. Reviewed by: kib Reported by: pho Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27157 Modified: head/sys/kern/kern_descrip.c head/sys/kern/kern_exit.c head/sys/kern/kern_proc.c head/sys/sys/signalvar.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Nov 11 11:26:36 2020 (r367587) +++ head/sys/kern/kern_descrip.c Wed Nov 11 13:44:27 2020 (r367588) @@ -1001,6 +1001,40 @@ unlock: return (error); } +static void +sigiofree(struct sigio *sigio) +{ + crfree(sigio->sio_ucred); + free(sigio, M_SIGIO); +} + +static struct sigio * +funsetown_locked(struct sigio *sigio) +{ + struct proc *p; + struct pgrp *pg; + + SIGIO_ASSERT_LOCKED(); + + if (sigio == NULL) + return (NULL); + *(sigio->sio_myref) = NULL; + if (sigio->sio_pgid < 0) { + pg = sigio->sio_pgrp; + PGRP_LOCK(pg); + SLIST_REMOVE(&sigio->sio_pgrp->pg_sigiolst, sigio, + sigio, sio_pgsigio); + PGRP_UNLOCK(pg); + } else { + p = sigio->sio_proc; + PROC_LOCK(p); + SLIST_REMOVE(&sigio->sio_proc->p_sigiolst, sigio, + sigio, sio_pgsigio); + PROC_UNLOCK(p); + } + return (sigio); +} + /* * If sigio is on the list associated with a process or process group, * disable signalling from the device, remove sigio from the list and @@ -1011,92 +1045,82 @@ funsetown(struct sigio **sigiop) { struct sigio *sigio; + /* Racy check, consumers must provide synchronization. */ if (*sigiop == NULL) return; + SIGIO_LOCK(); - sigio = *sigiop; - if (sigio == NULL) { - SIGIO_UNLOCK(); - return; - } - *(sigio->sio_myref) = NULL; - if ((sigio)->sio_pgid < 0) { - struct pgrp *pg = (sigio)->sio_pgrp; - PGRP_LOCK(pg); - SLIST_REMOVE(&sigio->sio_pgrp->pg_sigiolst, sigio, - sigio, sio_pgsigio); - PGRP_UNLOCK(pg); - } else { - struct proc *p = (sigio)->sio_proc; - PROC_LOCK(p); - SLIST_REMOVE(&sigio->sio_proc->p_sigiolst, sigio, - sigio, sio_pgsigio); - PROC_UNLOCK(p); - } + sigio = funsetown_locked(*sigiop); SIGIO_UNLOCK(); - crfree(sigio->sio_ucred); - free(sigio, M_SIGIO); + if (sigio != NULL) + sigiofree(sigio); } /* - * Free a list of sigio structures. - * We only need to lock the SIGIO_LOCK because we have made ourselves - * inaccessible to callers of fsetown and therefore do not need to lock - * the proc or pgrp struct for the list manipulation. + * Free a list of sigio structures. The caller must ensure that new sigio + * structures cannot be added after this point. For process groups this is + * guaranteed using the proctree lock; for processes, the P_WEXIT flag serves + * as an interlock. */ void funsetownlst(struct sigiolst *sigiolst) { struct proc *p; struct pgrp *pg; - struct sigio *sigio; + struct sigio *sigio, *tmp; + /* Racy check. */ sigio = SLIST_FIRST(sigiolst); if (sigio == NULL) return; + p = NULL; pg = NULL; + SIGIO_LOCK(); + sigio = SLIST_FIRST(sigiolst); + if (sigio == NULL) { + SIGIO_UNLOCK(); + return; + } + /* - * Every entry of the list should belong - * to a single proc or pgrp. + * Every entry of the list should belong to a single proc or pgrp. */ if (sigio->sio_pgid < 0) { pg = sigio->sio_pgrp; - PGRP_LOCK_ASSERT(pg, MA_NOTOWNED); + sx_assert(&proctree_lock, SX_XLOCKED); + PGRP_LOCK(pg); } else /* if (sigio->sio_pgid > 0) */ { p = sigio->sio_proc; - PROC_LOCK_ASSERT(p, MA_NOTOWNED); + PROC_LOCK(p); + KASSERT((p->p_flag & P_WEXIT) != 0, + ("%s: process %p is not exiting", __func__, p)); } - SIGIO_LOCK(); - while ((sigio = SLIST_FIRST(sigiolst)) != NULL) { - *(sigio->sio_myref) = NULL; + SLIST_FOREACH(sigio, sigiolst, sio_pgsigio) { + *sigio->sio_myref = NULL; if (pg != NULL) { KASSERT(sigio->sio_pgid < 0, ("Proc sigio in pgrp sigio list")); KASSERT(sigio->sio_pgrp == pg, ("Bogus pgrp in sigio list")); - PGRP_LOCK(pg); - SLIST_REMOVE(&pg->pg_sigiolst, sigio, sigio, - sio_pgsigio); - PGRP_UNLOCK(pg); } else /* if (p != NULL) */ { KASSERT(sigio->sio_pgid > 0, ("Pgrp sigio in proc sigio list")); KASSERT(sigio->sio_proc == p, ("Bogus proc in sigio list")); - PROC_LOCK(p); - SLIST_REMOVE(&p->p_sigiolst, sigio, sigio, - sio_pgsigio); - PROC_UNLOCK(p); } - SIGIO_UNLOCK(); - crfree(sigio->sio_ucred); - free(sigio, M_SIGIO); - SIGIO_LOCK(); } + + if (pg != NULL) + PGRP_UNLOCK(pg); + else + PROC_UNLOCK(p); SIGIO_UNLOCK(); + + SLIST_FOREACH_SAFE(sigio, sigiolst, sio_pgsigio, tmp) + sigiofree(sigio); } /* @@ -1110,7 +1134,7 @@ fsetown(pid_t pgid, struct sigio **sigiop) { struct proc *proc; struct pgrp *pgrp; - struct sigio *sigio; + struct sigio *osigio, *sigio; int ret; if (pgid == 0) { @@ -1120,13 +1144,14 @@ fsetown(pid_t pgid, struct sigio **sigiop) ret = 0; - /* Allocate and fill in the new sigio out of locks. */ sigio = malloc(sizeof(struct sigio), M_SIGIO, M_WAITOK); sigio->sio_pgid = pgid; sigio->sio_ucred = crhold(curthread->td_ucred); sigio->sio_myref = sigiop; sx_slock(&proctree_lock); + SIGIO_LOCK(); + osigio = funsetown_locked(*sigiop); if (pgid > 0) { proc = pfind(pgid); if (proc == NULL) { @@ -1142,20 +1167,21 @@ fsetown(pid_t pgid, struct sigio **sigiop) * restrict FSETOWN to the current process or process * group for maximum safety. */ - PROC_UNLOCK(proc); if (proc->p_session != curthread->td_proc->p_session) { + PROC_UNLOCK(proc); ret = EPERM; goto fail; } - pgrp = NULL; + sigio->sio_proc = proc; + SLIST_INSERT_HEAD(&proc->p_sigiolst, sigio, sio_pgsigio); + PROC_UNLOCK(proc); } else /* if (pgid < 0) */ { pgrp = pgfind(-pgid); if (pgrp == NULL) { ret = ESRCH; goto fail; } - PGRP_UNLOCK(pgrp); /* * Policy - Don't allow a process to FSETOWN a process @@ -1166,44 +1192,28 @@ fsetown(pid_t pgid, struct sigio **sigiop) * group for maximum safety. */ if (pgrp->pg_session != curthread->td_proc->p_session) { + PGRP_UNLOCK(pgrp); ret = EPERM; goto fail; } - proc = NULL; - } - funsetown(sigiop); - if (pgid > 0) { - PROC_LOCK(proc); - /* - * Since funsetownlst() is called without the proctree - * locked, we need to check for P_WEXIT. - * XXX: is ESRCH correct? - */ - if ((proc->p_flag & P_WEXIT) != 0) { - PROC_UNLOCK(proc); - ret = ESRCH; - goto fail; - } - SLIST_INSERT_HEAD(&proc->p_sigiolst, sigio, sio_pgsigio); - sigio->sio_proc = proc; - PROC_UNLOCK(proc); - } else { - PGRP_LOCK(pgrp); SLIST_INSERT_HEAD(&pgrp->pg_sigiolst, sigio, sio_pgsigio); sigio->sio_pgrp = pgrp; PGRP_UNLOCK(pgrp); } sx_sunlock(&proctree_lock); - SIGIO_LOCK(); *sigiop = sigio; SIGIO_UNLOCK(); + if (osigio != NULL) + sigiofree(osigio); return (0); fail: + SIGIO_UNLOCK(); sx_sunlock(&proctree_lock); - crfree(sigio->sio_ucred); - free(sigio, M_SIGIO); + sigiofree(sigio); + if (osigio != NULL) + sigiofree(osigio); return (ret); } Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Wed Nov 11 11:26:36 2020 (r367587) +++ head/sys/kern/kern_exit.c Wed Nov 11 13:44:27 2020 (r367588) @@ -358,7 +358,7 @@ exit1(struct thread *td, int rval, int signo) /* * Reset any sigio structures pointing to us as a result of - * F_SETOWN with our pid. + * F_SETOWN with our pid. The P_WEXIT flag interlocks with fsetown(). */ funsetownlst(&p->p_sigiolst); Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Wed Nov 11 11:26:36 2020 (r367587) +++ head/sys/kern/kern_proc.c Wed Nov 11 13:44:27 2020 (r367588) @@ -774,7 +774,8 @@ pgdelete(struct pgrp *pgrp) /* * Reset any sigio structures pointing to us as a result of - * F_SETOWN with our pgid. + * F_SETOWN with our pgid. The proctree lock ensures that + * new sigio structures will not be added after this point. */ funsetownlst(&pgrp->pg_sigiolst); Modified: head/sys/sys/signalvar.h ============================================================================== --- head/sys/sys/signalvar.h Wed Nov 11 11:26:36 2020 (r367587) +++ head/sys/sys/signalvar.h Wed Nov 11 13:44:27 2020 (r367588) @@ -337,7 +337,7 @@ struct thread; #define SIGIO_TRYLOCK() mtx_trylock(&sigio_lock) #define SIGIO_UNLOCK() mtx_unlock(&sigio_lock) #define SIGIO_LOCKED() mtx_owned(&sigio_lock) -#define SIGIO_ASSERT(type) mtx_assert(&sigio_lock, type) +#define SIGIO_ASSERT_LOCKED(type) mtx_assert(&sigio_lock, MA_OWNED) extern struct mtx sigio_lock; From owner-svn-src-all@freebsd.org Wed Nov 11 13:48:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD20C2EA898; Wed, 11 Nov 2020 13:48:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWQzX5SF2z4nLj; Wed, 11 Nov 2020 13:48:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9F38159F6; Wed, 11 Nov 2020 13:48:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABDm8OU048338; Wed, 11 Nov 2020 13:48:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABDm84Y048336; Wed, 11 Nov 2020 13:48:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011111348.0ABDm84Y048336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Nov 2020 13:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367589 - in head/sys: geom ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: geom ufs/ffs X-SVN-Commit-Revision: 367589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 13:48:08 -0000 Author: markj Date: Wed Nov 11 13:48:07 2020 New Revision: 367589 URL: https://svnweb.freebsd.org/changeset/base/367589 Log: ffs: Clamp BIO_SPEEDUP length On 32-bit platforms, the computed size of the BIO_SPEEDUP requested by softdep_request_cleanup() may be negative when assigned to bp->b_bcount, which has type "long". Clamp the size to LONG_MAX. Also convert the unused g_io_speedup() to use an off_t for the magnitude of the shortage for consistency with softdep_send_speedup(). Reviewed by: chs, kib Reported by: pho Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27081 Modified: head/sys/geom/geom.h head/sys/geom/geom_io.c head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Wed Nov 11 13:44:27 2020 (r367588) +++ head/sys/geom/geom.h Wed Nov 11 13:48:07 2020 (r367589) @@ -334,7 +334,8 @@ void g_io_deliver(struct bio *bp, int error); int g_io_getattr(const char *attr, struct g_consumer *cp, int *len, void *ptr); int g_io_zonecmd(struct disk_zone_args *zone_args, struct g_consumer *cp); int g_io_flush(struct g_consumer *cp); -int g_io_speedup(size_t shortage, u_int flags, size_t *resid, struct g_consumer *cp); +int g_io_speedup(off_t shortage, u_int flags, size_t *resid, + struct g_consumer *cp); void g_io_request(struct bio *bp, struct g_consumer *cp); struct bio *g_new_bio(void); struct bio *g_alloc_bio(void); Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Wed Nov 11 13:44:27 2020 (r367588) +++ head/sys/geom/geom_io.c Wed Nov 11 13:48:07 2020 (r367589) @@ -341,15 +341,15 @@ g_io_zonecmd(struct disk_zone_args *zone_args, struct * operation should be done. */ int -g_io_speedup(size_t shortage, u_int flags, size_t *resid, struct g_consumer *cp) +g_io_speedup(off_t shortage, u_int flags, size_t *resid, struct g_consumer *cp) { struct bio *bp; int error; KASSERT((flags & (BIO_SPEEDUP_TRIM | BIO_SPEEDUP_WRITE)) != 0, ("Invalid flags passed to g_io_speedup: %#x", flags)); - g_trace(G_T_BIO, "bio_speedup(%s, %zu, %#x)", cp->provider->name, - shortage, flags); + g_trace(G_T_BIO, "bio_speedup(%s, %jd, %#x)", cp->provider->name, + (intmax_t)shortage, flags); bp = g_new_bio(); if (bp == NULL) return (ENOMEM); Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Nov 11 13:44:27 2020 (r367588) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Nov 11 13:48:07 2020 (r367589) @@ -1464,7 +1464,7 @@ worklist_speedup(mp) } static void -softdep_send_speedup(struct ufsmount *ump, size_t shortage, u_int flags) +softdep_send_speedup(struct ufsmount *ump, off_t shortage, u_int flags) { struct buf *bp; @@ -1474,7 +1474,7 @@ softdep_send_speedup(struct ufsmount *ump, size_t shor bp = malloc(sizeof(*bp), M_TRIM, M_WAITOK | M_ZERO); bp->b_iocmd = BIO_SPEEDUP; bp->b_ioflags = flags; - bp->b_bcount = shortage; + bp->b_bcount = omin(shortage, LONG_MAX); g_vfs_strategy(ump->um_bo, bp); bufwait(bp); free(bp, M_TRIM); From owner-svn-src-all@freebsd.org Wed Nov 11 13:58:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3BFD2EACF4; Wed, 11 Nov 2020 13:58:44 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWRCm5dhrz4pNy; Wed, 11 Nov 2020 13:58:44 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 73CE926020D; Wed, 11 Nov 2020 14:58:36 +0100 (CET) Subject: Re: svn commit: r367588 - in head/sys: kern sys To: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011111344.0ABDiR78048131@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <447c18d6-8543-9cc9-83a2-cb053d999d86@selasky.org> Date: Wed, 11 Nov 2020 14:58:32 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 In-Reply-To: <202011111344.0ABDiR78048131@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CWRCm5dhrz4pNy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 13:58:44 -0000 On 11/11/20 2:44 PM, Mark Johnston wrote: > +#define SIGIO_ASSERT_LOCKED(type) mtx_assert(&sigio_lock, MA_OWNED) > Minor nit: "type" argument can be removed from macro. --HPS From owner-svn-src-all@freebsd.org Wed Nov 11 14:03:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D2A92EAD2C; Wed, 11 Nov 2020 14:03:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWRKf31FDz4pyp; Wed, 11 Nov 2020 14:03:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A66E15ED3; Wed, 11 Nov 2020 14:03:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABE3oU2060472; Wed, 11 Nov 2020 14:03:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABE3o8N060471; Wed, 11 Nov 2020 14:03:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011111403.0ABE3o8N060471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Nov 2020 14:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367590 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 367590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 14:03:50 -0000 Author: markj Date: Wed Nov 11 14:03:49 2020 New Revision: 367590 URL: https://svnweb.freebsd.org/changeset/base/367590 Log: Remove an extraneous parameter from SIGIO_ASSERT_LOCKED() Reported by: hselasky MFC with: r367588 Modified: head/sys/sys/signalvar.h Modified: head/sys/sys/signalvar.h ============================================================================== --- head/sys/sys/signalvar.h Wed Nov 11 13:48:07 2020 (r367589) +++ head/sys/sys/signalvar.h Wed Nov 11 14:03:49 2020 (r367590) @@ -337,7 +337,7 @@ struct thread; #define SIGIO_TRYLOCK() mtx_trylock(&sigio_lock) #define SIGIO_UNLOCK() mtx_unlock(&sigio_lock) #define SIGIO_LOCKED() mtx_owned(&sigio_lock) -#define SIGIO_ASSERT_LOCKED(type) mtx_assert(&sigio_lock, MA_OWNED) +#define SIGIO_ASSERT_LOCKED() mtx_assert(&sigio_lock, MA_OWNED) extern struct mtx sigio_lock; From owner-svn-src-all@freebsd.org Wed Nov 11 14:04:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0DC52EAE30; Wed, 11 Nov 2020 14:04:07 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWRKz5P1Rz4q0S; Wed, 11 Nov 2020 14:04:07 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72d.google.com with SMTP id n132so1720722qke.1; Wed, 11 Nov 2020 06:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IapRCPef0q0SsjShoqPdFYnhzyGsT3TUjLGeNwZ4Dqk=; b=pz3nVLPPJv2pLX4EcpzO1vw9N0X501iQOR4QWkD8nOBkSuZM+TdnHDLmUbSsRJehGq m90zWVi++EtIE4tQ/nrT/ffnVOMQYglin+w00ADhUhRNdcuAA06elLgJW1VtC/UIC3ji GeK7lq6l9KcGlGgIgB3QGdXxew3BnMRVE4eZZ4byPhahBFcQssdr193KhO729Yey6DcW YmF7WSoathrVbEbz78yh7V0R/ljz2uEoApi1urDhztlulKTYMGiBi5lw+B78jgFqg0YA MgdeIFkPeNw6n+P3FEPARPTkgIkapqPi2vZ1X1e5rXP5IUeS7b6nD0t5cs/TbVw4OhT2 dm/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=IapRCPef0q0SsjShoqPdFYnhzyGsT3TUjLGeNwZ4Dqk=; b=tayc4lA++5jgmbck65XuHuEPaliZ5GMuaiGGeqboM7FxOYTEX4NahkA89uh4o1WBvL GKUFZRHLVzDH+la/c/i6mC4RlQ2bp8ac/WPWZGJ4Vmegdz7Nhmz9Ub2+7exGMQdNTcGL N/Ng4MuEOZY/hvViooBeV2mr4lXGnp0vFau2c7Iv9TwLoJlKwx8c3PNtFU/FimQiHz0j BtXRNwMyz2mQtBjwomcULK59Z4k0QiOhHPTXfLo4taDA8b4awUXAR2owqomtO6OTTLIP B038TRfnSfkP4K9F3mzgx6jXDFioVbdqgDFd2cUCGtNVcTDPqHU/fyOqjXyRlpz2/u1f MBIg== X-Gm-Message-State: AOAM530A0trhu/OdInbCnsL1OuIKnI2LNj6jryFAaSCnXJ4STtopwRTu 76xptPYlyGKCxF16iqwDXxPW70C2sNE= X-Google-Smtp-Source: ABdhPJz6syg9cGp03qFIjPphvIKGqa/uAqIhRF+kkfXQXa6BDbS4uAboQi4NRzmHa1vl6GTOZ7Xpfw== X-Received: by 2002:a37:8cc1:: with SMTP id o184mr25734000qkd.205.1605103446821; Wed, 11 Nov 2020 06:04:06 -0800 (PST) Received: from raichu ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id w54sm2333924qtb.0.2020.11.11.06.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:04:06 -0800 (PST) Sender: Mark Johnston Date: Wed, 11 Nov 2020 09:04:01 -0500 From: Mark Johnston To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367588 - in head/sys: kern sys Message-ID: <20201111140401.GA89522@raichu> References: <202011111344.0ABDiR78048131@repo.freebsd.org> <447c18d6-8543-9cc9-83a2-cb053d999d86@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <447c18d6-8543-9cc9-83a2-cb053d999d86@selasky.org> X-Rspamd-Queue-Id: 4CWRKz5P1Rz4q0S X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 14:04:07 -0000 On Wed, Nov 11, 2020 at 02:58:32PM +0100, Hans Petter Selasky wrote: > On 11/11/20 2:44 PM, Mark Johnston wrote: > > +#define SIGIO_ASSERT_LOCKED(type) mtx_assert(&sigio_lock, MA_OWNED) > > > > Minor nit: "type" argument can be removed from macro. Fixed, thanks. From owner-svn-src-all@freebsd.org Wed Nov 11 14:06:46 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC4602EB05F; Wed, 11 Nov 2020 14:06:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWRP25pyqz4qB8; Wed, 11 Nov 2020 14:06:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA6BD15AC1; Wed, 11 Nov 2020 14:06:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABE6kdO060543; Wed, 11 Nov 2020 14:06:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABE6jJ0060539; Wed, 11 Nov 2020 14:06:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011111406.0ABE6jJ0060539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Nov 2020 14:06:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367591 - in stable/12/sys/amd64: amd64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys/amd64: amd64 include X-SVN-Commit-Revision: 367591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 14:06:47 -0000 Author: markj Date: Wed Nov 11 14:06:45 2020 New Revision: 367591 URL: https://svnweb.freebsd.org/changeset/base/367591 Log: MFC r367335: amd64: Make it easier to configure exception stack sizes Modified: stable/12/sys/amd64/amd64/machdep.c stable/12/sys/amd64/amd64/mp_machdep.c stable/12/sys/amd64/amd64/pmap.c stable/12/sys/amd64/include/intr_machdep.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Wed Nov 11 14:03:49 2020 (r367590) +++ stable/12/sys/amd64/amd64/machdep.c Wed Nov 11 14:06:45 2020 (r367591) @@ -679,10 +679,10 @@ struct user_segment_descriptor gdt[NGDT * MAXCPU];/* g static struct gate_descriptor idt0[NIDT]; struct gate_descriptor *idt = &idt0[0]; /* interrupt descriptor table */ -static char dblfault_stack[PAGE_SIZE] __aligned(16); -static char mce0_stack[PAGE_SIZE] __aligned(16); -static char nmi0_stack[PAGE_SIZE] __aligned(16); -static char dbg0_stack[PAGE_SIZE] __aligned(16); +static char dblfault_stack[DBLFAULT_STACK_SIZE] __aligned(16); +static char mce0_stack[MCE_STACK_SIZE] __aligned(16); +static char nmi0_stack[NMI_STACK_SIZE] __aligned(16); +static char dbg0_stack[DBG_STACK_SIZE] __aligned(16); CTASSERT(sizeof(struct nmi_pcpu) == 16); struct amd64tss common_tss[MAXCPU]; Modified: stable/12/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/mp_machdep.c Wed Nov 11 14:03:49 2020 (r367590) +++ stable/12/sys/amd64/amd64/mp_machdep.c Wed Nov 11 14:06:45 2020 (r367591) @@ -300,18 +300,19 @@ init_secondary(void) common_tss[cpu] = common_tss[0]; common_tss[cpu].tss_iobase = sizeof(struct amd64tss) + IOPERM_BITMAP_SIZE; - common_tss[cpu].tss_ist1 = (long)&doublefault_stack[PAGE_SIZE]; + common_tss[cpu].tss_ist1 = + (long)&doublefault_stack[DBLFAULT_STACK_SIZE]; /* The NMI stack runs on IST2. */ - np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&nmi_stack[NMI_STACK_SIZE]) - 1; common_tss[cpu].tss_ist2 = (long) np; /* The MC# stack runs on IST3. */ - np = ((struct nmi_pcpu *) &mce_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&mce_stack[MCE_STACK_SIZE]) - 1; common_tss[cpu].tss_ist3 = (long) np; /* The DB# stack runs on IST4. */ - np = ((struct nmi_pcpu *) &dbg_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&dbg_stack[DBG_STACK_SIZE]) - 1; common_tss[cpu].tss_ist4 = (long) np; /* Prepare private GDT */ @@ -353,15 +354,15 @@ init_secondary(void) common_tss[cpu].tss_rsp0 = 0; /* Save the per-cpu pointer for use by the NMI handler. */ - np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&nmi_stack[NMI_STACK_SIZE]) - 1; np->np_pcpu = (register_t) pc; /* Save the per-cpu pointer for use by the MC# handler. */ - np = ((struct nmi_pcpu *) &mce_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&mce_stack[MCE_STACK_SIZE]) - 1; np->np_pcpu = (register_t) pc; /* Save the per-cpu pointer for use by the DB# handler. */ - np = ((struct nmi_pcpu *) &dbg_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&dbg_stack[DBG_STACK_SIZE]) - 1; np->np_pcpu = (register_t) pc; wrmsr(MSR_FSBASE, 0); /* User value */ @@ -488,13 +489,14 @@ native_start_all_aps(void) /* allocate and set up an idle stack data page */ bootstacks[cpu] = (void *)kmem_malloc(kstack_pages * PAGE_SIZE, M_WAITOK | M_ZERO); - doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | - M_ZERO); - mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); + doublefault_stack = (char *)kmem_malloc(DBLFAULT_STACK_SIZE, + M_WAITOK | M_ZERO); + mce_stack = (char *)kmem_malloc(MCE_STACK_SIZE, + M_WAITOK | M_ZERO); nmi_stack = (char *)kmem_malloc_domainset( - DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + DOMAINSET_PREF(domain), NMI_STACK_SIZE, M_WAITOK | M_ZERO); dbg_stack = (char *)kmem_malloc_domainset( - DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + DOMAINSET_PREF(domain), DBG_STACK_SIZE, M_WAITOK | M_ZERO); dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_PREF(domain), DPCPU_SIZE, M_WAITOK | M_ZERO); Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Wed Nov 11 14:03:49 2020 (r367590) +++ stable/12/sys/amd64/amd64/pmap.c Wed Nov 11 14:06:45 2020 (r367591) @@ -156,6 +156,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -9637,16 +9638,16 @@ pmap_pti_init(void) CPU_FOREACH(i) { /* Doublefault stack IST 1 */ va = common_tss[i].tss_ist1; - pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); + pmap_pti_add_kva_locked(va - DBLFAULT_STACK_SIZE, va, false); /* NMI stack IST 2 */ va = common_tss[i].tss_ist2 + sizeof(struct nmi_pcpu); - pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); + pmap_pti_add_kva_locked(va - NMI_STACK_SIZE, va, false); /* MC# stack IST 3 */ va = common_tss[i].tss_ist3 + sizeof(struct nmi_pcpu); - pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); + pmap_pti_add_kva_locked(va - MCE_STACK_SIZE, va, false); /* DB# stack IST 4 */ va = common_tss[i].tss_ist4 + sizeof(struct nmi_pcpu); - pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); + pmap_pti_add_kva_locked(va - DBG_STACK_SIZE, va, false); } pmap_pti_add_kva_locked((vm_offset_t)kernphys + KERNBASE, (vm_offset_t)etext, true); Modified: stable/12/sys/amd64/include/intr_machdep.h ============================================================================== --- stable/12/sys/amd64/include/intr_machdep.h Wed Nov 11 14:03:49 2020 (r367590) +++ stable/12/sys/amd64/include/intr_machdep.h Wed Nov 11 14:06:45 2020 (r367591) @@ -41,4 +41,9 @@ struct nmi_pcpu { register_t __padding; /* pad to 16 bytes */ }; +#define DBLFAULT_STACK_SIZE PAGE_SIZE +#define NMI_STACK_SIZE PAGE_SIZE +#define MCE_STACK_SIZE PAGE_SIZE +#define DBG_STACK_SIZE PAGE_SIZE + #endif /* !__MACHINE_INTR_MACHDEP_H__ */ From owner-svn-src-all@freebsd.org Wed Nov 11 14:53:04 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C886F2EC51E; Wed, 11 Nov 2020 14:53:04 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWSQS39Wzz4sM6; Wed, 11 Nov 2020 14:53:04 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D6BF16880; Wed, 11 Nov 2020 14:53:04 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABEr3rc089572; Wed, 11 Nov 2020 14:53:03 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABEr3jh089571; Wed, 11 Nov 2020 14:53:03 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011111453.0ABEr3jh089571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Wed, 11 Nov 2020 14:53:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367592 - head/usr.bin/env X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.bin/env X-SVN-Commit-Revision: 367592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 14:53:05 -0000 Author: 0mp (doc,ports committer) Date: Wed Nov 11 14:53:03 2020 New Revision: 367592 URL: https://svnweb.freebsd.org/changeset/base/367592 Log: Document in the synopsis that -0 cannot be used with the utility argument Modified: head/usr.bin/env/env.1 Modified: head/usr.bin/env/env.1 ============================================================================== --- head/usr.bin/env/env.1 Wed Nov 11 14:06:45 2020 (r367591) +++ head/usr.bin/env/env.1 Wed Nov 11 14:53:03 2020 (r367592) @@ -31,7 +31,7 @@ .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp .\" $FreeBSD$ .\" -.Dd April 24, 2020 +.Dd November 11, 2020 .Dt ENV 1 .Os .Sh NAME @@ -41,11 +41,16 @@ .Nm .Op Fl 0iv .Op Fl L Ns | Ns Fl U Ar user Ns Op / Ns Ar class +.Op Fl u Ar name +.Op Ar name Ns = Ns Ar value ... +.Nm +.Op Fl iv +.Op Fl L Ns | Ns Fl U Ar user Ns Op / Ns Ar class .Op Fl P Ar altpath .Op Fl S Ar string .Op Fl u Ar name .Op Ar name Ns = Ns Ar value ... -.Op Ar utility Op Ar argument ... +.Ar utility Op Ar argument ... .Sh DESCRIPTION The .Nm From owner-svn-src-all@freebsd.org Wed Nov 11 15:01:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED1F32EC6F8; Wed, 11 Nov 2020 15:01:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWSby6Lxyz4t4t; Wed, 11 Nov 2020 15:01:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C24DB163CE; Wed, 11 Nov 2020 15:01:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABF1I4e093923; Wed, 11 Nov 2020 15:01:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABF1IwK093919; Wed, 11 Nov 2020 15:01:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011111501.0ABF1IwK093919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Nov 2020 15:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367593 - in head/sys/amd64: amd64 include vmm/amd vmm/intel X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/amd64: amd64 include vmm/amd vmm/intel X-SVN-Commit-Revision: 367593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 15:01:19 -0000 Author: markj Date: Wed Nov 11 15:01:17 2020 New Revision: 367593 URL: https://svnweb.freebsd.org/changeset/base/367593 Log: vmm: Make pmap_invalidate_ept() wait synchronously for guest exits Currently EPT TLB invalidation is done by incrementing a generation counter and issuing an IPI to all CPUs currently running vCPU threads. The VMM inner loop caches the most recently observed generation on each host CPU and invalidates TLB entries before executing the VM if the cached generation number is not the most recent value. pmap_invalidate_ept() issues IPIs to force each vCPU to stop executing guest instructions and reload the generation number. However, it does not actually wait for vCPUs to exit, potentially creating a window where guests may continue to reference stale TLB entries. Fix the problem by bracketing guest execution with an SMR read section which is entered before loading the invalidation generation. Then, pmap_invalidate_ept() increments the current write sequence before loading pm_active and sending IPIs, and polls readers to ensure that all vCPUs potentially operating with stale TLB entries have exited before pmap_invalidate_ept() returns. Also ensure that unsynchronized loads of the generation counter are wrapped with atomic(9), and stop (inconsistently) updating the invalidation counter and pm_active bitmask with acquire semantics. Reviewed by: grehan, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26910 Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/amd64/vmm/amd/svm.c head/sys/amd64/vmm/intel/vmx.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Nov 11 14:53:03 2020 (r367592) +++ head/sys/amd64/amd64/pmap.c Wed Nov 11 15:01:17 2020 (r367593) @@ -125,6 +125,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2647,7 +2648,7 @@ pmap_update_pde_store(pmap_t pmap, pd_entry_t *pde, pd * "all" host cpus and force any vcpu context to exit as a * side-effect. */ - atomic_add_acq_long(&pmap->pm_eptgen, 1); + atomic_add_long(&pmap->pm_eptgen, 1); break; default: panic("pmap_update_pde_store: bad pm_type %d", pmap->pm_type); @@ -2722,6 +2723,7 @@ pmap_update_pde_invalidate(pmap_t pmap, vm_offset_t va static __inline void pmap_invalidate_ept(pmap_t pmap) { + smr_seq_t goal; int ipinum; sched_pin(); @@ -2742,15 +2744,30 @@ pmap_invalidate_ept(pmap_t pmap) * Each vcpu keeps a cache of this counter and compares it * just before a vmresume. If the counter is out-of-date an * invept will be done to flush stale mappings from the TLB. + * + * To ensure that all vCPU threads have observed the new counter + * value before returning, we use SMR. Ordering is important here: + * the VMM enters an SMR read section before loading the counter + * and after updating the pm_active bit set. Thus, pm_active is + * a superset of active readers, and any reader that has observed + * the goal has observed the new counter value. */ - atomic_add_acq_long(&pmap->pm_eptgen, 1); + atomic_add_long(&pmap->pm_eptgen, 1); + goal = smr_advance(pmap->pm_eptsmr); + /* * Force the vcpu to exit and trap back into the hypervisor. */ ipinum = pmap->pm_flags & PMAP_NESTED_IPIMASK; ipi_selected(pmap->pm_active, ipinum); sched_unpin(); + + /* + * Ensure that all active vCPUs will observe the new generation counter + * value before executing any more guest instructions. + */ + smr_wait(pmap->pm_eptsmr, goal); } static cpuset_t @@ -4086,7 +4103,8 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, i * address space. * Install minimal kernel mappings in PTI case. */ - if (pm_type == PT_X86) { + switch (pm_type) { + case PT_X86: pmap->pm_cr3 = pmltop_phys; if (pmap_is_la57(pmap)) pmap_pinit_pml5(pmltop_pg); @@ -4107,6 +4125,11 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, i rangeset_init(&pmap->pm_pkru, pkru_dup_range, pkru_free_range, pmap, M_NOWAIT); } + break; + case PT_EPT: + case PT_RVI: + pmap->pm_eptsmr = smr_create("pmap", 0, 0); + break; } pmap->pm_root.rt_root = 0; Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Wed Nov 11 14:53:03 2020 (r367592) +++ head/sys/amd64/include/pmap.h Wed Nov 11 15:01:17 2020 (r367593) @@ -270,6 +270,7 @@ #include #include #include +#include #include @@ -371,6 +372,7 @@ struct pmap { struct pmap_statistics pm_stats; /* pmap statistics */ struct vm_radix pm_root; /* spare page table pages */ long pm_eptgen; /* EPT pmap generation id */ + smr_t pm_eptsmr; int pm_flags; struct pmap_pcids pm_pcids[MAXCPU]; struct rangeset pm_pkru; Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Wed Nov 11 14:53:03 2020 (r367592) +++ head/sys/amd64/vmm/amd/svm.c Wed Nov 11 15:01:17 2020 (r367593) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1800,15 +1801,17 @@ restore_host_tss(void) } static void -check_asid(struct svm_softc *sc, int vcpuid, pmap_t pmap, u_int thiscpu) +svm_pmap_activate(struct svm_softc *sc, int vcpuid, pmap_t pmap) { struct svm_vcpu *vcpustate; struct vmcb_ctrl *ctrl; long eptgen; + int cpu; bool alloc_asid; - KASSERT(CPU_ISSET(thiscpu, &pmap->pm_active), ("%s: nested pmap not " - "active on cpu %u", __func__, thiscpu)); + cpu = curcpu; + CPU_SET_ATOMIC(cpu, &pmap->pm_active); + smr_enter(pmap->pm_eptsmr); vcpustate = svm_get_vcpu(sc, vcpuid); ctrl = svm_get_vmcb_ctrl(sc, vcpuid); @@ -1849,10 +1852,10 @@ check_asid(struct svm_softc *sc, int vcpuid, pmap_t pm */ alloc_asid = false; - eptgen = pmap->pm_eptgen; + eptgen = atomic_load_long(&pmap->pm_eptgen); ctrl->tlb_ctrl = VMCB_TLB_FLUSH_NOTHING; - if (vcpustate->asid.gen != asid[thiscpu].gen) { + if (vcpustate->asid.gen != asid[cpu].gen) { alloc_asid = true; /* (c) and (d) */ } else if (vcpustate->eptgen != eptgen) { if (flush_by_asid()) @@ -1869,10 +1872,10 @@ check_asid(struct svm_softc *sc, int vcpuid, pmap_t pm } if (alloc_asid) { - if (++asid[thiscpu].num >= nasid) { - asid[thiscpu].num = 1; - if (++asid[thiscpu].gen == 0) - asid[thiscpu].gen = 1; + if (++asid[cpu].num >= nasid) { + asid[cpu].num = 1; + if (++asid[cpu].gen == 0) + asid[cpu].gen = 1; /* * If this cpu does not support "flush-by-asid" * then flush the entire TLB on a generation @@ -1882,8 +1885,8 @@ check_asid(struct svm_softc *sc, int vcpuid, pmap_t pm if (!flush_by_asid()) ctrl->tlb_ctrl = VMCB_TLB_FLUSH_ALL; } - vcpustate->asid.gen = asid[thiscpu].gen; - vcpustate->asid.num = asid[thiscpu].num; + vcpustate->asid.gen = asid[cpu].gen; + vcpustate->asid.num = asid[cpu].num; ctrl->asid = vcpustate->asid.num; svm_set_dirty(sc, vcpuid, VMCB_CACHE_ASID); @@ -1902,6 +1905,13 @@ check_asid(struct svm_softc *sc, int vcpuid, pmap_t pm ("ASID mismatch: %u/%u", ctrl->asid, vcpustate->asid.num)); } +static void +svm_pmap_deactivate(pmap_t pmap) +{ + smr_exit(pmap->pm_eptsmr); + CPU_CLR_ATOMIC(curcpu, &pmap->pm_active); +} + static __inline void disable_gintr(void) { @@ -2083,14 +2093,11 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t svm_inj_interrupts(svm_sc, vcpu, vlapic); - /* Activate the nested pmap on 'curcpu' */ - CPU_SET_ATOMIC_ACQ(curcpu, &pmap->pm_active); - /* * Check the pmap generation and the ASID generation to * ensure that the vcpu does not use stale TLB mappings. */ - check_asid(svm_sc, vcpu, pmap, curcpu); + svm_pmap_activate(svm_sc, vcpu, pmap); ctrl->vmcb_clean = vmcb_clean & ~vcpustate->dirty; vcpustate->dirty = 0; @@ -2102,7 +2109,7 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t svm_launch(vmcb_pa, gctx, get_pcpu()); svm_dr_leave_guest(gctx); - CPU_CLR_ATOMIC(curcpu, &pmap->pm_active); + svm_pmap_deactivate(pmap); /* * The host GDTR and IDTR is saved by VMRUN and restored Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Wed Nov 11 14:53:03 2020 (r367592) +++ head/sys/amd64/vmm/intel/vmx.c Wed Nov 11 15:01:17 2020 (r367593) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1273,7 +1274,7 @@ vmx_invvpid(struct vmx *vmx, int vcpu, pmap_t pmap, in * Note also that this will invalidate mappings tagged with 'vpid' * for "all" EP4TAs. */ - if (pmap->pm_eptgen == vmx->eptgen[curcpu]) { + if (atomic_load_long(&pmap->pm_eptgen) == vmx->eptgen[curcpu]) { invvpid_desc._res1 = 0; invvpid_desc._res2 = 0; invvpid_desc.vpid = vmxstate->vpid; @@ -2948,6 +2949,7 @@ vmx_pmap_activate(struct vmx *vmx, pmap_t pmap) cpu = curcpu; CPU_SET_ATOMIC(cpu, &pmap->pm_active); + smr_enter(pmap->pm_eptsmr); eptgen = atomic_load_long(&pmap->pm_eptgen); if (eptgen != vmx->eptgen[cpu]) { vmx->eptgen[cpu] = eptgen; @@ -2959,6 +2961,7 @@ vmx_pmap_activate(struct vmx *vmx, pmap_t pmap) static __inline void vmx_pmap_deactivate(struct vmx *vmx, pmap_t pmap) { + smr_exit(pmap->pm_eptsmr); CPU_CLR_ATOMIC(curcpu, &pmap->pm_active); } From owner-svn-src-all@freebsd.org Wed Nov 11 15:53:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44F632EDE0B; Wed, 11 Nov 2020 15:53:37 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWTmK08V7z3CQn; Wed, 11 Nov 2020 15:53:37 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC44216FF9; Wed, 11 Nov 2020 15:53:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABFraN6024939; Wed, 11 Nov 2020 15:53:36 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABFraMd024938; Wed, 11 Nov 2020 15:53:36 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202011111553.0ABFraMd024938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 11 Nov 2020 15:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367594 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 367594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 15:53:37 -0000 Author: ae Date: Wed Nov 11 15:53:36 2020 New Revision: 367594 URL: https://svnweb.freebsd.org/changeset/base/367594 Log: Fix possible NULL pointer dereference. lagg(4) replaces if_output method of its child interfaces and expects that this method can be called only by child interfaces. But it is possible that lagg_port_output() could be called by children of child interfaces. In this case ifnet's if_lagg field is NULL. Add check that lp is not NULL. Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Wed Nov 11 15:01:17 2020 (r367593) +++ head/sys/net/if_lagg.c Wed Nov 11 15:53:36 2020 (r367594) @@ -1145,7 +1145,8 @@ lagg_port_output(struct ifnet *ifp, struct mbuf *m, switch (dst->sa_family) { case pseudo_AF_HDRCMPLT: case AF_UNSPEC: - return ((*lp->lp_output)(ifp, m, dst, ro)); + if (lp != NULL) + return ((*lp->lp_output)(ifp, m, dst, ro)); } /* drop any other frames */ From owner-svn-src-all@freebsd.org Wed Nov 11 17:16:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 399DA2EFACD; Wed, 11 Nov 2020 17:16:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWWc8167Zz3H0K; Wed, 11 Nov 2020 17:16:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18FB6180CE; Wed, 11 Nov 2020 17:16:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABHGd7g071254; Wed, 11 Nov 2020 17:16:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABHGd7X071252; Wed, 11 Nov 2020 17:16:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011111716.0ABHGd7X071252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Nov 2020 17:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367595 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 367595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 17:16:40 -0000 Author: markj Date: Wed Nov 11 17:16:39 2020 New Revision: 367595 URL: https://svnweb.freebsd.org/changeset/base/367595 Log: vm_map: Handle kernel map entry allocator recursion On platforms without a direct map[*], vm_map_insert() may in rare situations need to allocate a kernel map entry in order to allocate kernel map entries. This poses a problem similar to the one solved for vmem boundary tags by vmem_bt_alloc(). In fact the kernel map case is a bit more complicated since we must allocate entries with the kernel map locked, whereas vmem can recurse into itself because boundary tags are allocated up-front. The solution is to add a custom slab allocator for kmapentzone which allocates KVA directly from kernel_map, bypassing the kmem_* layer. This avoids mutual recursion with the vmem btag allocator. Then, when vm_map_insert() allocates a new kernel map entry, it avoids triggering allocation of a new slab with M_NOVM until after the insertion is complete. Instead, vm_map_insert() allocates from the reserve and sets a flag in kernel_map to trigger re-population of the reserve just before the map is unlocked. This places an implicit upper bound on the number of kernel map entries that may be allocated before the kernel map lock is released, but in general a bound of 1 suffices. [*] This also comes up on amd64 with UMA_MD_SMALL_ALLOC undefined, a configuration required by some kernel sanitizers. Discussed with: kib, rlibby Reported by: andrew Tested by: pho (i386 and amd64 with !UMA_MD_SMALL_ALLOC) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26851 Modified: head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed Nov 11 15:53:36 2020 (r367594) +++ head/sys/vm/vm_map.c Wed Nov 11 17:16:39 2020 (r367595) @@ -175,29 +175,106 @@ static void vm_map_wire_entry_failure(vm_map_t map, vm start = end; \ } +#ifndef UMA_MD_SMALL_ALLOC + /* + * Allocate a new slab for kernel map entries. The kernel map may be locked or + * unlocked, depending on whether the request is coming from the kernel map or a + * submap. This function allocates a virtual address range directly from the + * kernel map instead of the kmem_* layer to avoid recursion on the kernel map + * lock and also to avoid triggering allocator recursion in the vmem boundary + * tag allocator. + */ +static void * +kmapent_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, + int wait) +{ + vm_offset_t addr; + int error, locked; + + *pflag = UMA_SLAB_PRIV; + + if (!(locked = vm_map_locked(kernel_map))) + vm_map_lock(kernel_map); + addr = vm_map_findspace(kernel_map, vm_map_min(kernel_map), bytes); + if (addr + bytes < addr || addr + bytes > vm_map_max(kernel_map)) + panic("%s: kernel map is exhausted", __func__); + error = vm_map_insert(kernel_map, NULL, 0, addr, addr + bytes, + VM_PROT_RW, VM_PROT_RW, MAP_NOFAULT); + if (error != KERN_SUCCESS) + panic("%s: vm_map_insert() failed: %d", __func__, error); + if (!locked) + vm_map_unlock(kernel_map); + error = kmem_back_domain(domain, kernel_object, addr, bytes, M_NOWAIT | + M_USE_RESERVE | (wait & M_ZERO)); + if (error == KERN_SUCCESS) { + return ((void *)addr); + } else { + if (!locked) + vm_map_lock(kernel_map); + vm_map_delete(kernel_map, addr, bytes); + if (!locked) + vm_map_unlock(kernel_map); + return (NULL); + } +} + +static void +kmapent_free(void *item, vm_size_t size, uint8_t pflag) +{ + vm_offset_t addr; + int error; + + if ((pflag & UMA_SLAB_PRIV) == 0) + /* XXX leaked */ + return; + + addr = (vm_offset_t)item; + kmem_unback(kernel_object, addr, size); + error = vm_map_remove(kernel_map, addr, addr + size); + KASSERT(error == KERN_SUCCESS, + ("%s: vm_map_remove failed: %d", __func__, error)); +} + +/* + * The worst-case upper bound on the number of kernel map entries that may be + * created before the zone must be replenished in _vm_map_unlock(). + */ +#define KMAPENT_RESERVE 1 + +#endif /* !UMD_MD_SMALL_ALLOC */ + +/* * vm_map_startup: * - * Initialize the vm_map module. Must be called before - * any other vm_map routines. + * Initialize the vm_map module. Must be called before any other vm_map + * routines. * - * Map and entry structures are allocated from the general - * purpose memory pool with some exceptions: - * - * - The kernel map and kmem submap are allocated statically. - * - Kernel map entries are allocated out of a static pool. - * - * These restrictions are necessary since malloc() uses the - * maps and requires map entries. + * User map and entry structures are allocated from the general purpose + * memory pool. Kernel maps are statically defined. Kernel map entries + * require special handling to avoid recursion; see the comments above + * kmapent_alloc() and in vm_map_entry_create(). */ - void vm_map_startup(void) { mtx_init(&map_sleep_mtx, "vm map sleep mutex", NULL, MTX_DEF); + + /* + * Disable the use of per-CPU buckets: map entry allocation is + * serialized by the kernel map lock. + */ kmapentzone = uma_zcreate("KMAP ENTRY", sizeof(struct vm_map_entry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, - UMA_ZONE_MTXCLASS | UMA_ZONE_VM); + UMA_ZONE_VM | UMA_ZONE_NOBUCKET); +#ifndef UMA_MD_SMALL_ALLOC + /* Reserve an extra map entry for use when replenishing the reserve. */ + uma_zone_reserve(kmapentzone, KMAPENT_RESERVE + 1); + uma_prealloc(kmapentzone, KMAPENT_RESERVE + 1); + uma_zone_set_allocf(kmapentzone, kmapent_alloc); + uma_zone_set_freef(kmapentzone, kmapent_free); +#endif + mapentzone = uma_zcreate("MAP ENTRY", sizeof(struct vm_map_entry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); vmspace_zone = uma_zcreate("VMSPACE", sizeof(struct vmspace), NULL, @@ -616,9 +693,15 @@ _vm_map_unlock(vm_map_t map, const char *file, int lin { VM_MAP_UNLOCK_CONSISTENT(map); - if (map->system_map) + if (map->system_map) { +#ifndef UMA_MD_SMALL_ALLOC + if (map == kernel_map && (map->flags & MAP_REPLENISH) != 0) { + uma_prealloc(kmapentzone, 1); + map->flags &= ~MAP_REPLENISH; + } +#endif mtx_unlock_flags_(&map->system_mtx, 0, file, line); - else { + } else { sx_xunlock_(&map->lock, file, line); vm_map_process_deferred(); } @@ -638,9 +721,11 @@ void _vm_map_unlock_read(vm_map_t map, const char *file, int line) { - if (map->system_map) + if (map->system_map) { + KASSERT((map->flags & MAP_REPLENISH) == 0, + ("%s: MAP_REPLENISH leaked", __func__)); mtx_unlock_flags_(&map->system_mtx, 0, file, line); - else { + } else { sx_sunlock_(&map->lock, file, line); vm_map_process_deferred(); } @@ -712,6 +797,8 @@ _vm_map_lock_downgrade(vm_map_t map, const char *file, { if (map->system_map) { + KASSERT((map->flags & MAP_REPLENISH) == 0, + ("%s: MAP_REPLENISH leaked", __func__)); mtx_assert_(&map->system_mtx, MA_OWNED, file, line); } else { VM_MAP_UNLOCK_CONSISTENT(map); @@ -755,10 +842,13 @@ _vm_map_unlock_and_wait(vm_map_t map, int timo, const VM_MAP_UNLOCK_CONSISTENT(map); mtx_lock(&map_sleep_mtx); - if (map->system_map) + if (map->system_map) { + KASSERT((map->flags & MAP_REPLENISH) == 0, + ("%s: MAP_REPLENISH leaked", __func__)); mtx_unlock_flags_(&map->system_mtx, 0, file, line); - else + } else { sx_xunlock_(&map->lock, file, line); + } return (msleep(&map->root, &map_sleep_mtx, PDROP | PVM, "vmmaps", timo)); } @@ -881,12 +971,33 @@ vm_map_entry_create(vm_map_t map) { vm_map_entry_t new_entry; - if (map->system_map) +#ifndef UMA_MD_SMALL_ALLOC + if (map == kernel_map) { + VM_MAP_ASSERT_LOCKED(map); + + /* + * A new slab of kernel map entries cannot be allocated at this + * point because the kernel map has not yet been updated to + * reflect the caller's request. Therefore, we allocate a new + * map entry, dipping into the reserve if necessary, and set a + * flag indicating that the reserve must be replenished before + * the map is unlocked. + */ + new_entry = uma_zalloc(kmapentzone, M_NOWAIT | M_NOVM); + if (new_entry == NULL) { + new_entry = uma_zalloc(kmapentzone, + M_NOWAIT | M_NOVM | M_USE_RESERVE); + kernel_map->flags |= MAP_REPLENISH; + } + } else +#endif + if (map->system_map) { new_entry = uma_zalloc(kmapentzone, M_NOWAIT); - else + } else { new_entry = uma_zalloc(mapentzone, M_WAITOK); - if (new_entry == NULL) - panic("vm_map_entry_create: kernel resources exhausted"); + } + KASSERT(new_entry != NULL, + ("vm_map_entry_create: kernel resources exhausted")); return (new_entry); } @@ -1771,6 +1882,8 @@ vm_map_findspace(vm_map_t map, vm_offset_t start, vm_s vm_map_entry_t header, llist, rlist, root, y; vm_size_t left_length, max_free_left, max_free_right; vm_offset_t gap_end; + + VM_MAP_ASSERT_LOCKED(map); /* * Request must fit within min/max VM address and must avoid Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Wed Nov 11 15:53:36 2020 (r367594) +++ head/sys/vm/vm_map.h Wed Nov 11 17:16:39 2020 (r367595) @@ -227,6 +227,7 @@ struct vm_map { #define MAP_IS_SUB_MAP 0x04 /* has parent */ #define MAP_ASLR 0x08 /* enabled ASLR */ #define MAP_ASLR_IGNSTART 0x10 +#define MAP_REPLENISH 0x20 #ifdef _KERNEL #if defined(KLD_MODULE) && !defined(KLD_TIED) From owner-svn-src-all@freebsd.org Wed Nov 11 18:00:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C337746162D; Wed, 11 Nov 2020 18:00:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWXZG5DcGz3L9Q; Wed, 11 Nov 2020 18:00:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6B4B18C0F; Wed, 11 Nov 2020 18:00:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABI06iv096133; Wed, 11 Nov 2020 18:00:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABI064n096132; Wed, 11 Nov 2020 18:00:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011111800.0ABI064n096132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Nov 2020 18:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367596 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 367596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 18:00:06 -0000 Author: markj Date: Wed Nov 11 18:00:06 2020 New Revision: 367596 URL: https://svnweb.freebsd.org/changeset/base/367596 Log: iflib: Free full mbuf chains when draining transmit queues Submitted by: Sai Rajesh Tallamraju Reviewed by: gallatin, hselasky MFC after: 1 week Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D27179 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Nov 11 17:16:39 2020 (r367595) +++ head/sys/net/iflib.c Wed Nov 11 18:00:06 2020 (r367596) @@ -1781,7 +1781,7 @@ iflib_txsd_free(if_ctx_t ctx, iflib_txq_t txq, int i) bus_dmamap_unload(txq->ift_tso_buf_tag, txq->ift_sds.ifsd_tso_map[i]); } - m_free(*mp); + m_freem(*mp); DBG_COUNTER_INC(tx_frees); *mp = NULL; } @@ -3660,7 +3660,7 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui DBG_COUNTER_INC(txq_drain_flushing); for (i = 0; i < avail; i++) { if (__predict_true(r->items[(cidx + i) & (r->size-1)] != (void *)txq)) - m_free(r->items[(cidx + i) & (r->size-1)]); + m_freem(r->items[(cidx + i) & (r->size-1)]); r->items[(cidx + i) & (r->size-1)] = NULL; } return (avail); From owner-svn-src-all@freebsd.org Wed Nov 11 18:43:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49D9C4627A1; Wed, 11 Nov 2020 18:43:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWYXm1NZGz3NdY; Wed, 11 Nov 2020 18:43:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 224E3190FD; Wed, 11 Nov 2020 18:43:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABIhqOU025779; Wed, 11 Nov 2020 18:43:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABIhpFM025778; Wed, 11 Nov 2020 18:43:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011111843.0ABIhpFM025778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 11 Nov 2020 18:43:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367597 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 18:43:52 -0000 Author: mjg Date: Wed Nov 11 18:43:51 2020 New Revision: 367597 URL: https://svnweb.freebsd.org/changeset/base/367597 Log: thread: lockless zombie list manipulation This gets rid of the most contended spinlock seen when creating/destroying threads in a loop. (modulo kstack) Tested by: alfredo (ppc64), bdragon (ppc64) Modified: head/sys/kern/kern_thread.c head/sys/sys/proc.h Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Nov 11 18:00:06 2020 (r367596) +++ head/sys/kern/kern_thread.c Wed Nov 11 18:43:51 2020 (r367597) @@ -128,9 +128,7 @@ SDT_PROBE_DEFINE(proc, , , lwp__exit); */ static uma_zone_t thread_zone; -TAILQ_HEAD(, thread) zombie_threads = TAILQ_HEAD_INITIALIZER(zombie_threads); -static struct mtx zombie_lock; -MTX_SYSINIT(zombie_lock, &zombie_lock, "zombie lock", MTX_SPIN); +static __exclusive_cache_line struct thread *thread_zombies; static void thread_zombie(struct thread *); static int thread_unsuspend_one(struct thread *td, struct proc *p, @@ -409,14 +407,20 @@ threadinit(void) /* * Place an unused thread on the zombie list. - * Use the slpq as that must be unused by now. */ void thread_zombie(struct thread *td) { - mtx_lock_spin(&zombie_lock); - TAILQ_INSERT_HEAD(&zombie_threads, td, td_slpq); - mtx_unlock_spin(&zombie_lock); + struct thread *ztd; + + ztd = atomic_load_ptr(&thread_zombies); + for (;;) { + td->td_zombie = ztd; + if (atomic_fcmpset_rel_ptr((uintptr_t *)&thread_zombies, + (uintptr_t *)&ztd, (uintptr_t)td)) + break; + continue; + } } /* @@ -430,29 +434,27 @@ thread_stash(struct thread *td) } /* - * Reap zombie resources. + * Reap zombie threads. */ void thread_reap(void) { - struct thread *td_first, *td_next; + struct thread *itd, *ntd; /* - * Don't even bother to lock if none at this instant, - * we really don't care about the next instant. + * Reading upfront is pessimal if followed by concurrent atomic_swap, + * but most of the time the list is empty. */ - if (!TAILQ_EMPTY(&zombie_threads)) { - mtx_lock_spin(&zombie_lock); - td_first = TAILQ_FIRST(&zombie_threads); - if (td_first) - TAILQ_INIT(&zombie_threads); - mtx_unlock_spin(&zombie_lock); - while (td_first) { - td_next = TAILQ_NEXT(td_first, td_slpq); - thread_cow_free(td_first); - thread_free(td_first); - td_first = td_next; - } + if (thread_zombies == NULL) + return; + + itd = (struct thread *)atomic_swap_ptr((uintptr_t *)&thread_zombies, + (uintptr_t)NULL); + while (itd != NULL) { + ntd = itd->td_zombie; + thread_cow_free(itd); + thread_free(itd); + itd = ntd; } } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Wed Nov 11 18:00:06 2020 (r367596) +++ head/sys/sys/proc.h Wed Nov 11 18:43:51 2020 (r367597) @@ -229,7 +229,10 @@ struct thread { struct proc *td_proc; /* (*) Associated process. */ TAILQ_ENTRY(thread) td_plist; /* (*) All threads in this proc. */ TAILQ_ENTRY(thread) td_runq; /* (t) Run queue. */ - TAILQ_ENTRY(thread) td_slpq; /* (t) Sleep queue. */ + union { + TAILQ_ENTRY(thread) td_slpq; /* (t) Sleep queue. */ + struct thread *td_zombie; /* Zombie list linkage */ + }; TAILQ_ENTRY(thread) td_lockq; /* (t) Lock queue. */ LIST_ENTRY(thread) td_hash; /* (d) Hash chain. */ struct cpuset *td_cpuset; /* (t) CPU affinity mask. */ From owner-svn-src-all@freebsd.org Wed Nov 11 18:45:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E99E462448; Wed, 11 Nov 2020 18:45:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWYZC0Mp7z3Nw6; Wed, 11 Nov 2020 18:45:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E95AF1926D; Wed, 11 Nov 2020 18:45:06 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABIj6kf026016; Wed, 11 Nov 2020 18:45:06 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABIj61D026015; Wed, 11 Nov 2020 18:45:06 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011111845.0ABIj61D026015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 11 Nov 2020 18:45:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367598 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 18:45:07 -0000 Author: mjg Date: Wed Nov 11 18:45:06 2020 New Revision: 367598 URL: https://svnweb.freebsd.org/changeset/base/367598 Log: thread: batch tid_free calls in thread_reap This eliminates the highly pessimal pattern of relocking from multiple CPUs in quick succession. Note this is still globally serialized. Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Nov 11 18:43:51 2020 (r367597) +++ head/sys/kern/kern_thread.c Wed Nov 11 18:45:06 2020 (r367598) @@ -133,6 +133,7 @@ static __exclusive_cache_line struct thread *thread_zo static void thread_zombie(struct thread *); static int thread_unsuspend_one(struct thread *td, struct proc *p, bool boundary); +static void thread_free_batched(struct thread *td); static struct mtx tid_lock; static bitstr_t *tid_bitmap; @@ -200,21 +201,41 @@ tid_alloc(void) } static void -tid_free(lwpid_t rtid) +tid_free_locked(lwpid_t rtid) { lwpid_t tid; + mtx_assert(&tid_lock, MA_OWNED); KASSERT(rtid >= NO_PID, ("%s: invalid tid %d\n", __func__, rtid)); tid = rtid - NO_PID; - mtx_lock(&tid_lock); KASSERT(bit_test(tid_bitmap, tid) != 0, ("thread ID %d not allocated\n", rtid)); bit_clear(tid_bitmap, tid); nthreads--; +} + +static void +tid_free(lwpid_t rtid) +{ + + mtx_lock(&tid_lock); + tid_free_locked(rtid); mtx_unlock(&tid_lock); } +static void +tid_free_batch(lwpid_t *batch, int n) +{ + int i; + + mtx_lock(&tid_lock); + for (i = 0; i < n; i++) { + tid_free_locked(batch[i]); + } + mtx_unlock(&tid_lock); +} + /* * Prepare a thread for use. */ @@ -440,6 +461,8 @@ void thread_reap(void) { struct thread *itd, *ntd; + lwpid_t tidbatch[16]; + int tidbatchn; /* * Reading upfront is pessimal if followed by concurrent atomic_swap, @@ -450,12 +473,23 @@ thread_reap(void) itd = (struct thread *)atomic_swap_ptr((uintptr_t *)&thread_zombies, (uintptr_t)NULL); + tidbatchn = 0; while (itd != NULL) { ntd = itd->td_zombie; + tidbatch[tidbatchn] = itd->td_tid; + tidbatchn++; thread_cow_free(itd); - thread_free(itd); + thread_free_batched(itd); + if (tidbatchn == nitems(tidbatch)) { + tid_free_batch(tidbatch, tidbatchn); + tidbatchn = 0; + } itd = ntd; } + + if (tidbatchn != 0) { + tid_free_batch(tidbatch, tidbatchn); + } } /* @@ -502,8 +536,8 @@ thread_alloc_stack(struct thread *td, int pages) /* * Deallocate a thread. */ -void -thread_free(struct thread *td) +static void +thread_free_batched(struct thread *td) { EVENTHANDLER_DIRECT_INVOKE(thread_dtor, td); @@ -515,9 +549,21 @@ thread_free(struct thread *td) if (td->td_kstack != 0) vm_thread_dispose(td); callout_drain(&td->td_slpcallout); - tid_free(td->td_tid); + /* + * Freeing handled by the caller. + */ td->td_tid = -1; uma_zfree(thread_zone, td); +} + +void +thread_free(struct thread *td) +{ + lwpid_t tid; + + tid = td->td_tid; + thread_free_batched(td); + tid_free(tid); } void From owner-svn-src-all@freebsd.org Wed Nov 11 21:27:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E62246617E; Wed, 11 Nov 2020 21:27:17 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWd9K2ccLz3pdX; Wed, 11 Nov 2020 21:27:17 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CA8B1B072; Wed, 11 Nov 2020 21:27:17 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABLRHLf024897; Wed, 11 Nov 2020 21:27:17 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABLRHTB024896; Wed, 11 Nov 2020 21:27:17 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202011112127.0ABLRHTB024896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Wed, 11 Nov 2020 21:27:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367599 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 367599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 21:27:17 -0000 Author: vmaffione Date: Wed Nov 11 21:27:16 2020 New Revision: 367599 URL: https://svnweb.freebsd.org/changeset/base/367599 Log: MFC r367093, r367117 iflib: add per-tx-queue netmap timer The way netmap TX is handled in iflib when TX interrupts are not used (IFC_NETMAP_TX_IRQ not set) has some issues: - The netmap_tx_irq() function gets called by iflib_timer(), which gets scheduled with tick granularity (hz). This is not frequent enough for 10Gbps NICs and beyond (e.g., ixgbe or ixl). The end result is that the transmitting netmap application is not woken up fast enough to saturate the link with small packets. - The iflib_timer() functions also calls isc_txd_credits_update() to ask for more TX completion updates. However, this violates the netmap requirement that only txsync can access the TX queue for datapath operations. Only netmap_tx_irq() may be called out of the txsync context. This change introduces per-tx-queue netmap timers, using microsecond granularity to ensure that netmap_tx_irq() can be called often enough to allow for maximum packet rate. The timer routine simply calls netmap_tx_irq() to wake up the netmap application. The latter will wake up and call txsync to collect TX completion updates. This change brings back line rate speed with small packets for ixgbe. For the time being, timer expiration is hardcoded to 90 microseconds, in order to avoid introducing a new sysctl. We may eventually implement an adaptive expiration period or use another deferred work mechanism in place of timers. Also, fix the timers usage to make sure that each queue is serviced by a different CPU. PR: 248652 Reported by: sg@efficientip.com Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Wed Nov 11 18:45:06 2020 (r367598) +++ stable/12/sys/net/iflib.c Wed Nov 11 21:27:16 2020 (r367599) @@ -348,6 +348,9 @@ struct iflib_txq { qidx_t ift_size; uint16_t ift_id; struct callout ift_timer; +#ifdef DEV_NETMAP + struct callout ift_netmap_timer; +#endif /* DEV_NETMAP */ if_txsd_vec_t ift_sds; uint8_t ift_qstatus; @@ -763,6 +766,7 @@ iflib_num_tx_descs(if_ctx_t ctx) MODULE_DEPEND(iflib, netmap, 1, 1, 1); static int netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init); +static void iflib_netmap_timer(void *arg); /* * device-specific sysctl variables: @@ -928,6 +932,8 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring return (0); } +#define NETMAP_TX_TIMER_US 90 + /* * Reconcile kernel and user view of the transmit ring. * @@ -1057,9 +1063,8 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl * Second part: reclaim buffers for completed transmissions. * * If there are unclaimed buffers, attempt to reclaim them. - * If none are reclaimed, and TX IRQs are not in use, do an initial - * minimal delay, then trigger the tx handler which will spin in the - * group task queue. + * If we don't manage to reclaim them all, and TX IRQs are not in use, + * trigger a per-tx-queue timer to try again later. */ if (kring->nr_hwtail != nm_prev(kring->nr_hwcur, lim)) { if (iflib_tx_credits_update(ctx, txq)) { @@ -1068,11 +1073,14 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim); } } + if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ)) if (kring->nr_hwtail != nm_prev(kring->nr_hwcur, lim)) { - callout_reset_on(&txq->ift_timer, hz < 2000 ? 1 : hz / 1000, - iflib_timer, txq, txq->ift_timer.c_cpu); - } + callout_reset_sbt_on(&txq->ift_netmap_timer, + NETMAP_TX_TIMER_US * SBT_1US, SBT_1US, + iflib_netmap_timer, txq, + txq->ift_netmap_timer.c_cpu, 0); + } return (0); } @@ -1275,28 +1283,16 @@ iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq) } static void -iflib_netmap_timer_adjust(if_ctx_t ctx, iflib_txq_t txq, uint32_t *reset_on) +iflib_netmap_timer(void *arg) { - struct netmap_kring *kring; - uint16_t txqid; + iflib_txq_t txq = arg; + if_ctx_t ctx = txq->ift_ctx; - txqid = txq->ift_id; - kring = netmap_kring_on(NA(ctx->ifc_ifp), txqid, NR_TX); - if (kring == NULL) - return; - - if (kring->nr_hwcur != nm_next(kring->nr_hwtail, kring->nkr_num_slots - 1)) { - bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, - BUS_DMASYNC_POSTREAD); - if (ctx->isc_txd_credits_update(ctx->ifc_softc, txqid, false)) - netmap_tx_irq(ctx->ifc_ifp, txqid); - if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ)) { - if (hz < 2000) - *reset_on = 1; - else - *reset_on = hz / 1000; - } - } + /* + * Wake up the netmap application, to give it a chance to + * call txsync and reclaim more completed TX buffers. + */ + netmap_tx_irq(ctx->ifc_ifp, txq->ift_id); } #define iflib_netmap_detach(ifp) netmap_detach(ifp) @@ -1308,8 +1304,6 @@ iflib_netmap_timer_adjust(if_ctx_t ctx, iflib_txq_t tx #define iflib_netmap_attach(ctx) (0) #define netmap_rx_irq(ifp, qid, budget) (0) -#define netmap_tx_irq(ifp, qid) do {} while (0) -#define iflib_netmap_timer_adjust(ctx, txq, reset_on) #endif @@ -2367,7 +2361,6 @@ iflib_timer(void *arg) if_ctx_t ctx = txq->ift_ctx; if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; uint64_t this_tick = ticks; - uint32_t reset_on = hz / 2; if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) return; @@ -2392,17 +2385,13 @@ iflib_timer(void *arg) } txq->ift_cleaned_prev = txq->ift_cleaned; } -#ifdef DEV_NETMAP - if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP) - iflib_netmap_timer_adjust(ctx, txq, &reset_on); -#endif /* handle any laggards */ if (txq->ift_db_pending) GROUPTASK_ENQUEUE(&txq->ift_task); sctx->isc_pause_frames = 0; if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) - callout_reset_on(&txq->ift_timer, reset_on, iflib_timer, txq, txq->ift_timer.c_cpu); + callout_reset_on(&txq->ift_timer, hz / 2, iflib_timer, txq, txq->ift_timer.c_cpu); return; hung: @@ -2476,6 +2465,9 @@ iflib_init_locked(if_ctx_t ctx) for (i = 0, txq = ctx->ifc_txqs; i < sctx->isc_ntxqsets; i++, txq++) { CALLOUT_LOCK(txq); callout_stop(&txq->ift_timer); +#ifdef DEV_NETMAP + callout_stop(&txq->ift_netmap_timer); +#endif /* DEV_NETMAP */ CALLOUT_UNLOCK(txq); iflib_netmap_txq_init(ctx, txq); } @@ -2565,6 +2557,9 @@ iflib_stop(if_ctx_t ctx) CALLOUT_LOCK(txq); callout_stop(&txq->ift_timer); +#ifdef DEV_NETMAP + callout_stop(&txq->ift_netmap_timer); +#endif /* DEV_NETMAP */ CALLOUT_UNLOCK(txq); /* clean any enqueued buffers */ @@ -3904,7 +3899,6 @@ _task_fn_admin(void *context) iflib_txq_t txq; int i; bool oactive, running, do_reset, do_watchdog, in_detach; - uint32_t reset_on = hz / 2; STATE_LOCK(ctx); running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING); @@ -3932,12 +3926,8 @@ _task_fn_admin(void *context) } IFDI_UPDATE_ADMIN_STATUS(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) { -#ifdef DEV_NETMAP - reset_on = hz / 2; - if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP) - iflib_netmap_timer_adjust(ctx, txq, &reset_on); -#endif - callout_reset_on(&txq->ift_timer, reset_on, iflib_timer, txq, txq->ift_timer.c_cpu); + callout_reset_on(&txq->ift_timer, hz / 2, iflib_timer, txq, + txq->ift_timer.c_cpu); } IFDI_LINK_INTR_ENABLE(ctx); if (do_reset) @@ -5090,6 +5080,9 @@ iflib_pseudo_deregister(if_ctx_t ctx) tqg = qgroup_if_io_tqg; for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) { callout_drain(&txq->ift_timer); +#ifdef DEV_NETMAP + callout_drain(&txq->ift_netmap_timer); +#endif /* DEV_NETMAP */ if (txq->ift_task.gt_uniq != NULL) taskqgroup_detach(tqg, &txq->ift_task); } @@ -5175,6 +5168,9 @@ iflib_device_deregister(if_ctx_t ctx) tqg = qgroup_if_io_tqg; for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) { callout_drain(&txq->ift_timer); +#ifdef DEV_NETMAP + callout_drain(&txq->ift_netmap_timer); +#endif /* DEV_NETMAP */ if (txq->ift_task.gt_uniq != NULL) taskqgroup_detach(tqg, &txq->ift_task); } @@ -5584,8 +5580,6 @@ iflib_queues_alloc(if_ctx_t ctx) } else { txq->ift_br_offset = 0; } - /* XXX fix this */ - txq->ift_timer.c_cpu = cpu; if (iflib_txsd_alloc(txq)) { device_printf(dev, "Critical Failure setting up TX buffers\n"); @@ -5598,6 +5592,11 @@ iflib_queues_alloc(if_ctx_t ctx) device_get_nameunit(dev), txq->ift_id); mtx_init(&txq->ift_mtx, txq->ift_mtx_name, NULL, MTX_DEF); callout_init_mtx(&txq->ift_timer, &txq->ift_mtx, 0); + txq->ift_timer.c_cpu = cpu; +#ifdef DEV_NETMAP + callout_init_mtx(&txq->ift_netmap_timer, &txq->ift_mtx, 0); + txq->ift_netmap_timer.c_cpu = cpu; +#endif /* DEV_NETMAP */ err = ifmp_ring_alloc(&txq->ift_br, 2048, txq, iflib_txq_drain, iflib_txq_can_drain, M_IFLIB, M_WAITOK); From owner-svn-src-all@freebsd.org Wed Nov 11 21:59:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51010467680; Wed, 11 Nov 2020 21:59:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWdth1rJbz3rR5; Wed, 11 Nov 2020 21:59:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 320A41B929; Wed, 11 Nov 2020 21:59:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABLxeKY043626; Wed, 11 Nov 2020 21:59:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABLxeYV043625; Wed, 11 Nov 2020 21:59:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011112159.0ABLxeYV043625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 11 Nov 2020 21:59:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367600 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 367600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 21:59:40 -0000 Author: mav Date: Wed Nov 11 21:59:39 2020 New Revision: 367600 URL: https://svnweb.freebsd.org/changeset/base/367600 Log: Make CTL nicer to increased MAXPHYS. Before this CTL always allocated MAXPHYS-sized buffers, even for 4KB I/O, that is even more overkill for MAXPHYS of 1MB. This change limits maximum allocation to 512KB if MAXPHYS is bigger, plus if one is above 128KB, adds new 128KB UMA zone for smaller I/Os. The patch factors out alloc/free, so later we could make it use more zones or malloc() if we'd like. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/cam/ctl/ctl_backend_block.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Wed Nov 11 21:27:16 2020 (r367599) +++ head/sys/cam/ctl/ctl_backend_block.c Wed Nov 11 21:59:39 2020 (r367600) @@ -102,7 +102,7 @@ __FBSDID("$FreeBSD$"); */ #define CTLBLK_HALF_IO_SIZE (512 * 1024) #define CTLBLK_MAX_IO_SIZE (CTLBLK_HALF_IO_SIZE * 2) -#define CTLBLK_MAX_SEG MAXPHYS +#define CTLBLK_MAX_SEG MIN(CTLBLK_HALF_IO_SIZE, MAXPHYS) #define CTLBLK_HALF_SEGS MAX(CTLBLK_HALF_IO_SIZE / CTLBLK_MAX_SEG, 1) #define CTLBLK_MAX_SEGS (CTLBLK_HALF_SEGS * 2) @@ -190,6 +190,9 @@ struct ctl_be_block_softc { SLIST_HEAD(, ctl_be_block_lun) lun_list; uma_zone_t beio_zone; uma_zone_t buf_zone; +#if (CTLBLK_MAX_SEG > 131072) + uma_zone_t buf128_zone; +#endif }; static struct ctl_be_block_softc backend_block_softc; @@ -299,6 +302,32 @@ static struct ctl_backend_driver ctl_be_block_driver = MALLOC_DEFINE(M_CTLBLK, "ctlblock", "Memory used for CTL block backend"); CTL_BACKEND_DECLARE(cbb, ctl_be_block_driver); +static void +ctl_alloc_seg(struct ctl_be_block_softc *softc, struct ctl_sg_entry *sg, + size_t len) +{ + +#if (CTLBLK_MAX_SEG > 131072) + if (len <= 131072) + sg->addr = uma_zalloc(softc->buf128_zone, M_WAITOK); + else +#endif + sg->addr = uma_zalloc(softc->buf_zone, M_WAITOK); + sg->len = len; +} + +static void +ctl_free_seg(struct ctl_be_block_softc *softc, struct ctl_sg_entry *sg) +{ + +#if (CTLBLK_MAX_SEG > 131072) + if (sg->len <= 131072) + uma_zfree(softc->buf128_zone, sg->addr); + else +#endif + uma_zfree(softc->buf_zone, sg->addr); +} + static struct ctl_be_block_io * ctl_alloc_beio(struct ctl_be_block_softc *softc) { @@ -317,12 +346,12 @@ ctl_real_free_beio(struct ctl_be_block_io *beio) int i; for (i = 0; i < beio->num_segs; i++) { - uma_zfree(softc->buf_zone, beio->sg_segs[i].addr); + ctl_free_seg(softc, &beio->sg_segs[i]); /* For compare we had two equal S/G lists. */ if (beio->two_sglists) { - uma_zfree(softc->buf_zone, - beio->sg_segs[i + CTLBLK_HALF_SEGS].addr); + ctl_free_seg(softc, + &beio->sg_segs[i + CTLBLK_HALF_SEGS]); } } @@ -1140,8 +1169,7 @@ ctl_be_block_dispatch_dev(struct ctl_be_block_lun *be_ /* * We have to limit our I/O size to the maximum supported by the - * backend device. Hopefully it is MAXPHYS. If the driver doesn't - * set it properly, use DFLTPHYS. + * backend device. */ if (csw) { max_iosize = dev->si_iosize_max; @@ -1330,8 +1358,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *b seglen -= seglen % cbe_lun->blocksize; } else seglen -= seglen % cbe_lun->blocksize; - beio->sg_segs[i].len = seglen; - beio->sg_segs[i].addr = uma_zalloc(softc->buf_zone, M_WAITOK); + ctl_alloc_seg(softc, &beio->sg_segs[i], seglen); DPRINTF("segment %d addr %p len %zd\n", i, beio->sg_segs[i].addr, beio->sg_segs[i].len); @@ -1603,18 +1630,17 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, /* * Setup the S/G entry for this chunk. */ - beio->sg_segs[i].len = min(CTLBLK_MAX_SEG, len_left); - beio->sg_segs[i].addr = uma_zalloc(softc->buf_zone, M_WAITOK); + ctl_alloc_seg(softc, &beio->sg_segs[i], + min(CTLBLK_MAX_SEG, len_left)); DPRINTF("segment %d addr %p len %zd\n", i, beio->sg_segs[i].addr, beio->sg_segs[i].len); /* Set up second segment for compare operation. */ if (beio->two_sglists) { - beio->sg_segs[i + CTLBLK_HALF_SEGS].len = - beio->sg_segs[i].len; - beio->sg_segs[i + CTLBLK_HALF_SEGS].addr = - uma_zalloc(softc->buf_zone, M_WAITOK); + ctl_alloc_seg(softc, + &beio->sg_segs[i + CTLBLK_HALF_SEGS], + beio->sg_segs[i].len); } beio->num_segs++; @@ -1932,8 +1958,8 @@ ctl_be_block_open_dev(struct ctl_be_block_lun *be_lun, maxio = dev->si_iosize_max; if (maxio <= 0) maxio = DFLTPHYS; - if (maxio > CTLBLK_MAX_IO_SIZE) - maxio = CTLBLK_MAX_IO_SIZE; + if (maxio > CTLBLK_MAX_SEG) + maxio = CTLBLK_MAX_SEG; } be_lun->lun_flush = ctl_be_block_flush_dev; be_lun->getattr = ctl_be_block_getattr_dev; @@ -2778,6 +2804,10 @@ ctl_be_block_init(void) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); softc->buf_zone = uma_zcreate("ctlblock", CTLBLK_MAX_SEG, NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); +#if (CTLBLK_MAX_SEG > 131072) + softc->buf128_zone = uma_zcreate("ctlblock128", 131072, + NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); +#endif SLIST_INIT(&softc->lun_list); return (0); } @@ -2803,6 +2833,9 @@ ctl_be_block_shutdown(void) } mtx_unlock(&softc->lock); uma_zdestroy(softc->buf_zone); +#if (CTLBLK_MAX_SEG > 131072) + uma_zdestroy(softc->buf128_zone); +#endif uma_zdestroy(softc->beio_zone); mtx_destroy(&softc->lock); sx_destroy(&softc->modify_lock); From owner-svn-src-all@freebsd.org Wed Nov 11 22:00:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 810BA4674B2; Wed, 11 Nov 2020 22:00:31 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWdvg3J2lz3rZw; Wed, 11 Nov 2020 22:00:31 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 641551B7F4; Wed, 11 Nov 2020 22:00:31 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABM0VEs043793; Wed, 11 Nov 2020 22:00:31 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABM0Vx4043792; Wed, 11 Nov 2020 22:00:31 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202011112200.0ABM0Vx4043792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 11 Nov 2020 22:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367601 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 367601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 22:00:31 -0000 Author: brooks Date: Wed Nov 11 22:00:30 2020 New Revision: 367601 URL: https://svnweb.freebsd.org/changeset/base/367601 Log: MFC r367302: sysvshm: pass relevant uap members as arguments Alter shmget_allocate_segment and shmget_existing to take the values they want from struct shmget_args rather than passing the struct around. In general, uap structures should only be the interface to sys_ functions. This makes one small functional change and records the allocated space rather than the requested space. If this turns out to be a problem (e.g. if software tries to find undersized segments by exact size rather than using keys), we can correct that easily. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27077 Modified: stable/11/sys/kern/sysv_shm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/sysv_shm.c ============================================================================== --- stable/11/sys/kern/sysv_shm.c Wed Nov 11 21:59:39 2020 (r367600) +++ stable/11/sys/kern/sysv_shm.c Wed Nov 11 22:00:30 2020 (r367601) @@ -102,11 +102,6 @@ FEATURE(sysv_shm, "System V shared memory segments sup static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments"); -static int shmget_allocate_segment(struct thread *td, - struct shmget_args *uap, int mode); -static int shmget_existing(struct thread *td, struct shmget_args *uap, - int mode, int segnum); - #define SHMSEG_FREE 0x0200 #define SHMSEG_REMOVED 0x0400 #define SHMSEG_ALLOCATED 0x0800 @@ -125,6 +120,10 @@ static void shm_deallocate_segment(struct shmid_kernel static int shm_find_segment_by_key(struct prison *, key_t); static struct shmid_kernel *shm_find_segment(struct prison *, int, bool); static int shm_delete_mapping(struct vmspace *vm, struct shmmap_state *); +static int shmget_allocate_segment(struct thread *td, key_t key, size_t size, + int mode); +static int shmget_existing(struct thread *td, size_t size, int shmflg, + int mode, int segnum); static void shmrealloc(void); static int shminit(void); static int sysvshm_modload(struct module *, int, void *); @@ -643,7 +642,7 @@ done: static int -shmget_existing(struct thread *td, struct shmget_args *uap, int mode, +shmget_existing(struct thread *td, size_t size, int shmflg, int mode, int segnum) { struct shmid_kernel *shmseg; @@ -655,35 +654,34 @@ shmget_existing(struct thread *td, struct shmget_args KASSERT(segnum >= 0 && segnum < shmalloced, ("segnum %d shmalloced %d", segnum, shmalloced)); shmseg = &shmsegs[segnum]; - if ((uap->shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL)) + if ((shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL)) return (EEXIST); #ifdef MAC - error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, uap->shmflg); + error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, shmflg); if (error != 0) return (error); #endif - if (uap->size != 0 && uap->size > shmseg->u.shm_segsz) + if (size != 0 && size > shmseg->u.shm_segsz) return (EINVAL); td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm); return (0); } static int -shmget_allocate_segment(struct thread *td, struct shmget_args *uap, int mode) +shmget_allocate_segment(struct thread *td, key_t key, size_t size, int mode) { struct ucred *cred = td->td_ucred; struct shmid_kernel *shmseg; vm_object_t shm_object; int i, segnum; - size_t size; SYSVSHM_ASSERT_LOCKED(); - if (uap->size < shminfo.shmmin || uap->size > shminfo.shmmax) + if (size < shminfo.shmmin || size > shminfo.shmmax) return (EINVAL); if (shm_nused >= shminfo.shmmni) /* Any shmids left? */ return (ENOSPC); - size = round_page(uap->size); + size = round_page(size); if (shm_committed + btoc(size) > shminfo.shmall) return (ENOMEM); if (shm_last_free < 0) { @@ -744,10 +742,10 @@ shmget_allocate_segment(struct thread *td, struct shmg shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid; shmseg->u.shm_perm.cgid = shmseg->u.shm_perm.gid = cred->cr_gid; shmseg->u.shm_perm.mode = (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; - shmseg->u.shm_perm.key = uap->key; + shmseg->u.shm_perm.key = key; shmseg->u.shm_perm.seq = (shmseg->u.shm_perm.seq + 1) & 0x7fff; shmseg->cred = crhold(cred); - shmseg->u.shm_segsz = uap->size; + shmseg->u.shm_segsz = size; shmseg->u.shm_cpid = td->td_proc->p_pid; shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0; shmseg->u.shm_atime = shmseg->u.shm_dtime = 0; @@ -780,16 +778,18 @@ sys_shmget(struct thread *td, struct shmget_args *uap) mode = uap->shmflg & ACCESSPERMS; SYSVSHM_LOCK(); if (uap->key == IPC_PRIVATE) { - error = shmget_allocate_segment(td, uap, mode); + error = shmget_allocate_segment(td, uap->key, uap->size, mode); } else { segnum = shm_find_segment_by_key(td->td_ucred->cr_prison, uap->key); if (segnum >= 0) - error = shmget_existing(td, uap, mode, segnum); + error = shmget_existing(td, uap->size, uap->shmflg, + mode, segnum); else if ((uap->shmflg & IPC_CREAT) == 0) error = ENOENT; else - error = shmget_allocate_segment(td, uap, mode); + error = shmget_allocate_segment(td, uap->key, + uap->size, mode); } SYSVSHM_UNLOCK(); return (error); From owner-svn-src-all@freebsd.org Wed Nov 11 22:15:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34944467948; Wed, 11 Nov 2020 22:15:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWfDt0XVnz3sXh; Wed, 11 Nov 2020 22:15:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 052AD1BD9D; Wed, 11 Nov 2020 22:15:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABMFPCp055896; Wed, 11 Nov 2020 22:15:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABMFPGj055895; Wed, 11 Nov 2020 22:15:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011112215.0ABMFPGj055895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 11 Nov 2020 22:15:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367602 - in stable: 11/contrib/llvm-project/clang/lib/Sema 12/contrib/llvm-project/clang/lib/Sema X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm-project/clang/lib/Sema 12/contrib/llvm-project/clang/lib/Sema X-SVN-Commit-Revision: 367602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 22:15:26 -0000 Author: dim Date: Wed Nov 11 22:15:25 2020 New Revision: 367602 URL: https://svnweb.freebsd.org/changeset/base/367602 Log: MFC r366683: Merge commit 35ecc7fe4 from llvm git (by Hubert Tong): [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast Fix premature decision in the presence of type-dependent expression operands on whether AltiVec vector initializations from single expressions are "splat" operations. Verify that the instantiation is able to determine the correct cast semantics for both the scalar type and the vector type case. Note that, because the change only affects the single-expression case (and the target type is an AltiVec-style vector type), the replacement of a parenthesized list with a parenthesized expression does not change the semantics of the program in a program-observable manner. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D88526 This should fix 'Assertion failed: (isScalarType()), function getScalarTypeKind, file /usr/src/contrib/llvm-project/clang/lib/AST /Type.cpp, line 2146', when building the graphics/opencv-core port for powerpc64le. Requested by: pkubaj Modified: stable/12/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp ============================================================================== --- stable/12/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp Wed Nov 11 22:00:30 2020 (r367601) +++ stable/12/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp Wed Nov 11 22:15:25 2020 (r367602) @@ -6809,7 +6809,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc } if (PE || PLE->getNumExprs() == 1) { Expr *E = (PE ? PE->getSubExpr() : PLE->getExpr(0)); - if (!E->getType()->isVectorType()) + if (!E->isTypeDependent() && !E->getType()->isVectorType()) isVectorLiteral = true; } else From owner-svn-src-all@freebsd.org Wed Nov 11 22:15:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 924234678E6; Wed, 11 Nov 2020 22:15:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWfDt3ny3z3shb; Wed, 11 Nov 2020 22:15:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74F0C1BF0C; Wed, 11 Nov 2020 22:15:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABMFQLx055902; Wed, 11 Nov 2020 22:15:26 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABMFQFF055901; Wed, 11 Nov 2020 22:15:26 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011112215.0ABMFQFF055901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 11 Nov 2020 22:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367602 - in stable: 11/contrib/llvm-project/clang/lib/Sema 12/contrib/llvm-project/clang/lib/Sema X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm-project/clang/lib/Sema 12/contrib/llvm-project/clang/lib/Sema X-SVN-Commit-Revision: 367602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 22:15:26 -0000 Author: dim Date: Wed Nov 11 22:15:25 2020 New Revision: 367602 URL: https://svnweb.freebsd.org/changeset/base/367602 Log: MFC r366683: Merge commit 35ecc7fe4 from llvm git (by Hubert Tong): [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast Fix premature decision in the presence of type-dependent expression operands on whether AltiVec vector initializations from single expressions are "splat" operations. Verify that the instantiation is able to determine the correct cast semantics for both the scalar type and the vector type case. Note that, because the change only affects the single-expression case (and the target type is an AltiVec-style vector type), the replacement of a parenthesized list with a parenthesized expression does not change the semantics of the program in a program-observable manner. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D88526 This should fix 'Assertion failed: (isScalarType()), function getScalarTypeKind, file /usr/src/contrib/llvm-project/clang/lib/AST /Type.cpp, line 2146', when building the graphics/opencv-core port for powerpc64le. Requested by: pkubaj Modified: stable/11/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp ============================================================================== --- stable/11/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp Wed Nov 11 22:00:30 2020 (r367601) +++ stable/11/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp Wed Nov 11 22:15:25 2020 (r367602) @@ -6809,7 +6809,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc } if (PE || PLE->getNumExprs() == 1) { Expr *E = (PE ? PE->getSubExpr() : PLE->getExpr(0)); - if (!E->getType()->isVectorType()) + if (!E->isTypeDependent() && !E->getType()->isVectorType()) isVectorLiteral = true; } else From owner-svn-src-all@freebsd.org Wed Nov 11 22:18:25 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A0B7467D4A; Wed, 11 Nov 2020 22:18:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWfJJ6rbHz3swB; Wed, 11 Nov 2020 22:18:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDCC81BF0E; Wed, 11 Nov 2020 22:18:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABMIOWT056113; Wed, 11 Nov 2020 22:18:24 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABMIOhp056112; Wed, 11 Nov 2020 22:18:24 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011112218.0ABMIOhp056112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 11 Nov 2020 22:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367603 - in stable: 11/contrib/llvm-project/llvm/lib/Target/PowerPC 12/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm-project/llvm/lib/Target/PowerPC 12/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 367603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 22:18:25 -0000 Author: dim Date: Wed Nov 11 22:18:24 2020 New Revision: 367603 URL: https://svnweb.freebsd.org/changeset/base/367603 Log: MFC r367485: Merge commit 354d3106c from llvm git (by Kai Luo): [PowerPC] Skip combining (uint_to_fp x) if x is not simple type Current powerpc64le backend hits ``` Combining: t7: f64 = uint_to_fp t6 llc: llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:291: llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a SimpleValueType!"' failed. ``` This patch fixes it by skipping combination if `t6` is not simple type. Fixed https://bugs.llvm.org/show_bug.cgi?id=47660. Reviewed By: #powerpc, steven.zhang Differential Revision: https://reviews.llvm.org/D88388 This should fix the llvm assertion mentioned above when building the following ports for powerpc64le: * audio/traverso * databases/percona57-pam-for-mysql * databases/percona57-server * emulators/citra * emulators/citra-qt5 * games/7kaa * graphics/dia * graphics/mandelbulber * graphics/pcl-pointclouds * net-p2p/libtorrent-rasterbar * textproc/htmldoc Requested by: pkubaj Modified: stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ============================================================================== --- stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Nov 11 22:15:25 2020 (r367602) +++ stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Nov 11 22:18:24 2020 (r367603) @@ -13371,6 +13371,8 @@ SDValue PPCTargetLowering::combineFPToIntToFP(SDNode * // from the hardware. if (Op.getValueType() != MVT::f32 && Op.getValueType() != MVT::f64) return SDValue(); + if (!Op.getOperand(0).getValueType().isSimple()) + return SDValue(); if (Op.getOperand(0).getValueType().getSimpleVT() <= MVT(MVT::i1) || Op.getOperand(0).getValueType().getSimpleVT() > MVT(MVT::i64)) return SDValue(); From owner-svn-src-all@freebsd.org Wed Nov 11 22:18:25 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58EE3467D4B; Wed, 11 Nov 2020 22:18:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWfJK24mVz3t0m; Wed, 11 Nov 2020 22:18:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A3061BEF7; Wed, 11 Nov 2020 22:18:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABMIPJI056119; Wed, 11 Nov 2020 22:18:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABMIPKL056118; Wed, 11 Nov 2020 22:18:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011112218.0ABMIPKL056118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 11 Nov 2020 22:18:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367603 - in stable: 11/contrib/llvm-project/llvm/lib/Target/PowerPC 12/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm-project/llvm/lib/Target/PowerPC 12/contrib/llvm-project/llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 367603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 22:18:25 -0000 Author: dim Date: Wed Nov 11 22:18:24 2020 New Revision: 367603 URL: https://svnweb.freebsd.org/changeset/base/367603 Log: MFC r367485: Merge commit 354d3106c from llvm git (by Kai Luo): [PowerPC] Skip combining (uint_to_fp x) if x is not simple type Current powerpc64le backend hits ``` Combining: t7: f64 = uint_to_fp t6 llc: llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:291: llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a SimpleValueType!"' failed. ``` This patch fixes it by skipping combination if `t6` is not simple type. Fixed https://bugs.llvm.org/show_bug.cgi?id=47660. Reviewed By: #powerpc, steven.zhang Differential Revision: https://reviews.llvm.org/D88388 This should fix the llvm assertion mentioned above when building the following ports for powerpc64le: * audio/traverso * databases/percona57-pam-for-mysql * databases/percona57-server * emulators/citra * emulators/citra-qt5 * games/7kaa * graphics/dia * graphics/mandelbulber * graphics/pcl-pointclouds * net-p2p/libtorrent-rasterbar * textproc/htmldoc Requested by: pkubaj Modified: stable/11/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ============================================================================== --- stable/11/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Nov 11 22:15:25 2020 (r367602) +++ stable/11/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Nov 11 22:18:24 2020 (r367603) @@ -13371,6 +13371,8 @@ SDValue PPCTargetLowering::combineFPToIntToFP(SDNode * // from the hardware. if (Op.getValueType() != MVT::f32 && Op.getValueType() != MVT::f64) return SDValue(); + if (!Op.getOperand(0).getValueType().isSimple()) + return SDValue(); if (Op.getOperand(0).getValueType().getSimpleVT() <= MVT(MVT::i1) || Op.getOperand(0).getValueType().getSimpleVT() > MVT(MVT::i64)) return SDValue(); From owner-svn-src-all@freebsd.org Wed Nov 11 22:35:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77283468295; Wed, 11 Nov 2020 22:35:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWfgw31Y4z3v7V; Wed, 11 Nov 2020 22:35:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A8981BD5A; Wed, 11 Nov 2020 22:35:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ABMZOoq068581; Wed, 11 Nov 2020 22:35:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ABMZOH9068580; Wed, 11 Nov 2020 22:35:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011112235.0ABMZOH9068580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 11 Nov 2020 22:35:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367604 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 22:35:24 -0000 Author: kevans Date: Wed Nov 11 22:35:23 2020 New Revision: 367604 URL: https://svnweb.freebsd.org/changeset/base/367604 Log: umtx: drop incorrect timespec32 definition This works for amd64, but none others -- drop it, because we already have a proper definition in sys/compat/freebsd32/freebsd32.h that correctly uses time32_t. MFC after: 1 week Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Wed Nov 11 22:18:24 2020 (r367603) +++ head/sys/kern/kern_umtx.c Wed Nov 11 22:35:23 2020 (r367604) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef COMPAT_FREEBSD32 +#include #include #endif @@ -4127,11 +4128,6 @@ sys__umtx_op(struct thread *td, struct _umtx_op_args * } #ifdef COMPAT_FREEBSD32 - -struct timespec32 { - int32_t tv_sec; - int32_t tv_nsec; -}; struct umtx_time32 { struct timespec32 timeout; From owner-svn-src-all@freebsd.org Thu Nov 12 00:29:23 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95EEC46B125; Thu, 12 Nov 2020 00:29:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWjCR3tfcz4Vcg; Thu, 12 Nov 2020 00:29:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77F6A1D453; Thu, 12 Nov 2020 00:29:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC0TN18037147; Thu, 12 Nov 2020 00:29:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC0TN87037146; Thu, 12 Nov 2020 00:29:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011120029.0AC0TN87037146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 12 Nov 2020 00:29:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367605 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 00:29:23 -0000 Author: mjg Date: Thu Nov 12 00:29:23 2020 New Revision: 367605 URL: https://svnweb.freebsd.org/changeset/base/367605 Log: thread: move nthread management out of tid_alloc While this adds more work single-threaded, it also enables SMP-related speed ups. Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Nov 11 22:35:23 2020 (r367604) +++ head/sys/kern/kern_thread.c Thu Nov 12 00:29:23 2020 (r367605) @@ -144,7 +144,7 @@ static int maxthread; SYSCTL_INT(_kern, OID_AUTO, maxthread, CTLFLAG_RDTUN, &maxthread, 0, "Maximum number of threads"); -static int nthreads; +static __exclusive_cache_line int nthreads; static LIST_HEAD(tidhashhead, thread) *tidhashtbl; static u_long tidhash; @@ -158,29 +158,52 @@ EVENTHANDLER_LIST_DEFINE(thread_dtor); EVENTHANDLER_LIST_DEFINE(thread_init); EVENTHANDLER_LIST_DEFINE(thread_fini); -static lwpid_t -tid_alloc(void) +static bool +thread_count_inc(void) { static struct timeval lastfail; static int curfail; - static lwpid_t trytid; - lwpid_t tid; + int nthreads_new; - mtx_lock(&tid_lock); - if (nthreads + 1 >= maxthread - 100) { + thread_reap(); + + nthreads_new = atomic_fetchadd_int(&nthreads, 1) + 1; + if (nthreads_new >= maxthread - 100) { if (priv_check_cred(curthread->td_ucred, PRIV_MAXPROC) != 0 || - nthreads + 1 >= maxthread) { - mtx_unlock(&tid_lock); + nthreads_new >= maxthread) { + atomic_subtract_int(&nthreads, 1); if (ppsratecheck(&lastfail, &curfail, 1)) { printf("maxthread limit exceeded by uid %u " "(pid %d); consider increasing kern.maxthread\n", curthread->td_ucred->cr_ruid, curproc->p_pid); } - return (-1); + return (false); } } + return (true); +} - nthreads++; +static void +thread_count_sub(int n) +{ + + atomic_subtract_int(&nthreads, n); +} + +static void +thread_count_dec(void) +{ + + thread_count_sub(1); +} + +static lwpid_t +tid_alloc(void) +{ + static lwpid_t trytid; + lwpid_t tid; + + mtx_lock(&tid_lock); /* * It is an invariant that the bitmap is big enough to hold maxthread * IDs. If we got to this point there has to be at least one free. @@ -212,7 +235,6 @@ tid_free_locked(lwpid_t rtid) KASSERT(bit_test(tid_bitmap, tid) != 0, ("thread ID %d not allocated\n", rtid)); bit_clear(tid_bitmap, tid); - nthreads--; } static void @@ -398,6 +420,10 @@ threadinit(void) mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF); tid_bitmap = bit_alloc(maxthread, M_TIDHASH, M_WAITOK); + /* + * Handle thread0. + */ + thread_count_inc(); tid0 = tid_alloc(); if (tid0 != THREAD0_TID) panic("tid0 %d != %d\n", tid0, THREAD0_TID); @@ -482,6 +508,7 @@ thread_reap(void) thread_free_batched(itd); if (tidbatchn == nitems(tidbatch)) { tid_free_batch(tidbatch, tidbatchn); + thread_count_sub(tidbatchn); tidbatchn = 0; } itd = ntd; @@ -489,6 +516,7 @@ thread_reap(void) if (tidbatchn != 0) { tid_free_batch(tidbatch, tidbatchn); + thread_count_sub(tidbatchn); } } @@ -501,18 +529,17 @@ thread_alloc(int pages) struct thread *td; lwpid_t tid; - thread_reap(); /* check if any zombies to get */ - - tid = tid_alloc(); - if (tid == -1) { + if (!thread_count_inc()) { return (NULL); } + tid = tid_alloc(); td = uma_zalloc(thread_zone, M_WAITOK); KASSERT(td->td_kstack == 0, ("thread_alloc got thread with kstack")); if (!vm_thread_new(td, pages)) { uma_zfree(thread_zone, td); tid_free(tid); + thread_count_dec(); return (NULL); } td->td_tid = tid; @@ -564,6 +591,7 @@ thread_free(struct thread *td) tid = td->td_tid; thread_free_batched(td); tid_free(tid); + thread_count_dec(); } void From owner-svn-src-all@freebsd.org Thu Nov 12 00:46:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BABAB46B7C6; Thu, 12 Nov 2020 00:46:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWjbd4yJ5z4WDX; Thu, 12 Nov 2020 00:46:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D1B91DC76; Thu, 12 Nov 2020 00:46:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC0krJT049661; Thu, 12 Nov 2020 00:46:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC0krBs049660; Thu, 12 Nov 2020 00:46:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011120046.0AC0krBs049660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Nov 2020 00:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367606 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 367606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 00:46:53 -0000 Author: kib Date: Thu Nov 12 00:46:53 2020 New Revision: 367606 URL: https://svnweb.freebsd.org/changeset/base/367606 Log: bhyve: avoid allocating BARs above the end of supported physical addresses. Read CPUID leaf 0x8000008 to determine max supported phys address and create BAR region right below it, reserving 1/4 of the supported guest physical address space to the 64bit BARs mappings. PR: 250802 (although the issue from PR is not fixed by the change) Noted and reviewed by: grehan Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D27095 Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Thu Nov 12 00:29:23 2020 (r367605) +++ head/usr.sbin/bhyve/pci_emul.c Thu Nov 12 00:46:53 2020 (r367606) @@ -33,6 +33,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include #include @@ -46,6 +49,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include "acpi.h" @@ -98,6 +103,7 @@ SET_DECLARE(pci_devemu_set, struct pci_devemu); static uint64_t pci_emul_iobase; static uint64_t pci_emul_membase32; static uint64_t pci_emul_membase64; +static uint64_t pci_emul_memlim64; #define PCI_EMUL_IOBASE 0x2000 #define PCI_EMUL_IOLIMIT 0x10000 @@ -108,9 +114,6 @@ SYSRES_MEM(PCI_EMUL_ECFG_BASE, PCI_EMUL_ECFG_SIZE); #define PCI_EMUL_MEMLIMIT32 PCI_EMUL_ECFG_BASE -#define PCI_EMUL_MEMBASE64 0xD000000000UL -#define PCI_EMUL_MEMLIMIT64 0xFD00000000UL - static struct pci_devemu *pci_emul_finddev(char *name); static void pci_lintr_route(struct pci_devinst *pi); static void pci_lintr_update(struct pci_devinst *pi); @@ -632,7 +635,7 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, baseptr = &hostbase; else baseptr = &pci_emul_membase64; - limit = PCI_EMUL_MEMLIMIT64; + limit = pci_emul_memlim64; mask = PCIM_BAR_MEM_BASE; lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_64 | PCIM_BAR_MEM_PREFETCH; @@ -1101,12 +1104,25 @@ init_pci(struct vmctx *ctx) struct slotinfo *si; struct funcinfo *fi; size_t lowmem; - int bus, slot, func; - int error; + uint64_t cpu_maxphysaddr, pci_emul_memresv64; + u_int regs[4]; + int bus, slot, func, error; pci_emul_iobase = PCI_EMUL_IOBASE; pci_emul_membase32 = vm_get_lowmem_limit(ctx); - pci_emul_membase64 = PCI_EMUL_MEMBASE64; + + do_cpuid(0x80000008, regs); + cpu_maxphysaddr = 1ULL << (regs[0] & 0xff); + if (cpu_maxphysaddr > VM_MAXUSER_ADDRESS_LA48) + cpu_maxphysaddr = VM_MAXUSER_ADDRESS_LA48; + pci_emul_memresv64 = cpu_maxphysaddr / 4; + /* + * Max power of 2 that is less then + * cpu_maxphysaddr - pci_emul_memresv64. + */ + pci_emul_membase64 = 1ULL << (flsl(cpu_maxphysaddr - + pci_emul_memresv64) - 1); + pci_emul_memlim64 = cpu_maxphysaddr; for (bus = 0; bus < MAXBUSES; bus++) { if ((bi = pci_businfo[bus]) == NULL) From owner-svn-src-all@freebsd.org Thu Nov 12 00:51:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C563546BAB7; Thu, 12 Nov 2020 00:51:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWjjP5H0Vz4Wwp; Thu, 12 Nov 2020 00:51:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A811A1DB7F; Thu, 12 Nov 2020 00:51:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC0prx5053152; Thu, 12 Nov 2020 00:51:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC0prMQ053151; Thu, 12 Nov 2020 00:51:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011120051.0AC0prMQ053151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Nov 2020 00:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367607 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 367607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 00:51:53 -0000 Author: kib Date: Thu Nov 12 00:51:53 2020 New Revision: 367607 URL: https://svnweb.freebsd.org/changeset/base/367607 Log: bhyve: increase allowed size for 64bit BAR allocation below 4G from 32 to 128 MB. Reviewed by: grehan Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D27095 Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Thu Nov 12 00:46:53 2020 (r367606) +++ head/usr.sbin/bhyve/pci_emul.c Thu Nov 12 00:51:53 2020 (r367607) @@ -625,9 +625,9 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, * Some drivers do not work well if the 64-bit BAR is allocated * above 4GB. Allow for this by allocating small requests under * 4GB unless then allocation size is larger than some arbitrary - * number (32MB currently). + * number (128MB currently). */ - if (size > 32 * 1024 * 1024) { + if (size > 128 * 1024 * 1024) { /* * XXX special case for device requiring peer-peer DMA */ From owner-svn-src-all@freebsd.org Thu Nov 12 01:18:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C801746D0A0; Thu, 12 Nov 2020 01:18:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWkHf5KW3z4YZh; Thu, 12 Nov 2020 01:18:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A98931E1B9; Thu, 12 Nov 2020 01:18:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC1I6vO068228; Thu, 12 Nov 2020 01:18:06 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC1I6YV068226; Thu, 12 Nov 2020 01:18:06 GMT (envelope-from np@FreeBSD.org) Message-Id: <202011120118.0AC1I6YV068226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 12 Nov 2020 01:18:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367608 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 367608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 01:18:06 -0000 Author: np Date: Thu Nov 12 01:18:05 2020 New Revision: 367608 URL: https://svnweb.freebsd.org/changeset/base/367608 Log: cxgbev(4): Make sure that the iq/eq map sizes are correct for VFs. This should have been part of r366929. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Nov 12 00:51:53 2020 (r367607) +++ head/sys/dev/cxgbe/t4_main.c Thu Nov 12 01:18:05 2020 (r367608) @@ -4467,9 +4467,9 @@ get_params__post_init(struct adapter *sc) "failed to query parameters (post_init2): %d.\n", rc); return (rc); } - MPASS(val[0] >= sc->sge.iq_start); + MPASS((int)val[0] >= sc->sge.iq_start); sc->sge.iqmap_sz = val[0] - sc->sge.iq_start + 1; - MPASS(val[1] >= sc->sge.eq_start); + MPASS((int)val[1] >= sc->sge.eq_start); sc->sge.eqmap_sz = val[1] - sc->sge.eq_start + 1; if (chip_id(sc) >= CHELSIO_T6) { Modified: head/sys/dev/cxgbe/t4_vf.c ============================================================================== --- head/sys/dev/cxgbe/t4_vf.c Thu Nov 12 00:51:53 2020 (r367607) +++ head/sys/dev/cxgbe/t4_vf.c Thu Nov 12 01:18:05 2020 (r367608) @@ -695,13 +695,16 @@ t4vf_attach(device_t dev) s->neq += sc->params.nports; /* ctrl queues: 1 per port */ s->niq = s->nrxq + 1; /* 1 extra for firmware event queue */ + s->iqmap_sz = s->niq; + s->eqmap_sz = s->neq; + s->rxq = malloc(s->nrxq * sizeof(struct sge_rxq), M_CXGBE, M_ZERO | M_WAITOK); s->txq = malloc(s->ntxq * sizeof(struct sge_txq), M_CXGBE, M_ZERO | M_WAITOK); - s->iqmap = malloc(s->niq * sizeof(struct sge_iq *), M_CXGBE, + s->iqmap = malloc(s->iqmap_sz * sizeof(struct sge_iq *), M_CXGBE, M_ZERO | M_WAITOK); - s->eqmap = malloc(s->neq * sizeof(struct sge_eq *), M_CXGBE, + s->eqmap = malloc(s->eqmap_sz * sizeof(struct sge_eq *), M_CXGBE, M_ZERO | M_WAITOK); sc->irq = malloc(sc->intr_count * sizeof(struct irq), M_CXGBE, From owner-svn-src-all@freebsd.org Thu Nov 12 02:21:14 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E94172D15B9; Thu, 12 Nov 2020 02:21:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWlhV6MV6z4g2H; Thu, 12 Nov 2020 02:21:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD9C61F096; Thu, 12 Nov 2020 02:21:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC2LE0f008536; Thu, 12 Nov 2020 02:21:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC2LEBZ008535; Thu, 12 Nov 2020 02:21:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011120221.0AC2LEBZ008535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Nov 2020 02:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367609 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 367609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 02:21:15 -0000 Author: kib Date: Thu Nov 12 02:21:14 2020 New Revision: 367609 URL: https://svnweb.freebsd.org/changeset/base/367609 Log: mlx5en: Refactor repeated code to register media type to mlx5e_ifm_add(). Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 01:18:05 2020 (r367608) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 02:21:14 2020 (r367609) @@ -4260,6 +4260,14 @@ mlx5e_snd_tag_free(struct m_snd_tag *pmt) } } +static void +mlx5e_ifm_add(struct mlx5e_priv *priv, int type) +{ + ifmedia_add(&priv->media, type | IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); +} + static void * mlx5e_create_ifp(struct mlx5_core_dev *mdev) { @@ -4463,21 +4471,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5e_mode_table[i][j]; if (media_entry.baudrate == 0) continue; - if (MLX5E_PROT_MASK(i) & eth_proto_cap) { - ifmedia_add(&priv->media, - media_entry.subtype | - IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, - media_entry.subtype | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); - } + if (MLX5E_PROT_MASK(i) & eth_proto_cap) + mlx5e_ifm_add(priv, media_entry.subtype); } } - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + mlx5e_ifm_add(priv, IFM_AUTO); /* Set autoselect by default */ ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX | From owner-svn-src-all@freebsd.org Thu Nov 12 02:22:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38C7F2D1764; Thu, 12 Nov 2020 02:22:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWljj01fSz4gFP; Thu, 12 Nov 2020 02:22:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E76C31EEDA; Thu, 12 Nov 2020 02:22:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC2MGB0010983; Thu, 12 Nov 2020 02:22:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC2MGwj010982; Thu, 12 Nov 2020 02:22:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011120222.0AC2MGwj010982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Nov 2020 02:22:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367610 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 367610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 02:22:17 -0000 Author: kib Date: Thu Nov 12 02:22:16 2020 New Revision: 367610 URL: https://svnweb.freebsd.org/changeset/base/367610 Log: mlx5en: Register all combinations of FDX/RXPAUSE/TXPAUSE as valid media types. Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 02:21:14 2020 (r367609) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 02:22:16 2020 (r367610) @@ -4264,6 +4264,15 @@ static void mlx5e_ifm_add(struct mlx5e_priv *priv, int type) { ifmedia_add(&priv->media, type | IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_ETH_RXPAUSE, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_ETH_TXPAUSE, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | + IFM_ETH_TXPAUSE, 0, NULL); ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); } From owner-svn-src-all@freebsd.org Thu Nov 12 02:23:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35DDC2D1C9D; Thu, 12 Nov 2020 02:23:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWll413Xkz4gg1; Thu, 12 Nov 2020 02:23:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 174121F1F6; Thu, 12 Nov 2020 02:23:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC2NRIM011083; Thu, 12 Nov 2020 02:23:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC2NRW3011082; Thu, 12 Nov 2020 02:23:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011120223.0AC2NRW3011082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Nov 2020 02:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367611 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 367611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 02:23:28 -0000 Author: kib Date: Thu Nov 12 02:23:27 2020 New Revision: 367611 URL: https://svnweb.freebsd.org/changeset/base/367611 Log: mlx5en: stop ignoring pauses and flow in the media reqs. Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 02:22:16 2020 (r367610) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 02:23:27 2020 (r367611) @@ -4449,8 +4449,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) /* Set default media status */ priv->media_status_last = IFM_AVALID; - priv->media_active_last = IFM_ETHER | IFM_AUTO | - IFM_ETH_RXPAUSE | IFM_FDX; + priv->media_active_last = IFM_ETHER | IFM_AUTO | IFM_FDX; /* setup default pauseframes configuration */ mlx5e_setup_pauseframes(priv); @@ -4470,7 +4469,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_en_err(ifp, "Query port media capability failed, %d\n", err); } - ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK, + ifmedia_init(&priv->media, IFM_IMASK, mlx5e_media_change, mlx5e_media_status); speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : MLX5E_LINK_SPEEDS_NUMBER; From owner-svn-src-all@freebsd.org Thu Nov 12 02:25:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 479F32D1C29; Thu, 12 Nov 2020 02:25:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWln31ZQbz4gxM; Thu, 12 Nov 2020 02:25:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 298361ED54; Thu, 12 Nov 2020 02:25:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC2PBmD011212; Thu, 12 Nov 2020 02:25:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC2PBgt011211; Thu, 12 Nov 2020 02:25:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011120225.0AC2PBgt011211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Nov 2020 02:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367612 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 367612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 02:25:11 -0000 Author: kib Date: Thu Nov 12 02:25:10 2020 New Revision: 367612 URL: https://svnweb.freebsd.org/changeset/base/367612 Log: mlx5en: Set ifmr_current same as ifmr_active. This both: - makes ifconfig media line similar to that of other drivers. - fixes ENXIO in case when paradoxical current media word is not registered. Now e.g. ifconfig mce0 -mediaopt txpause,rxpause works by disabling pauses if enabled. Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 02:23:27 2020 (r367611) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 02:25:10 2020 (r367612) @@ -499,7 +499,7 @@ mlx5e_media_status(struct ifnet *dev, struct ifmediare struct mlx5e_priv *priv = dev->if_softc; ifmr->ifm_status = priv->media_status_last; - ifmr->ifm_active = priv->media_active_last | + ifmr->ifm_current = ifmr->ifm_active = priv->media_active_last | (priv->params.rx_pauseframe_control ? IFM_ETH_RXPAUSE : 0) | (priv->params.tx_pauseframe_control ? IFM_ETH_TXPAUSE : 0); From owner-svn-src-all@freebsd.org Thu Nov 12 02:52:02 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87F812D2F95; Thu, 12 Nov 2020 02:52:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWmN23Vm7z4jLl; Thu, 12 Nov 2020 02:52:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B1CF1F26B; Thu, 12 Nov 2020 02:52:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC2q2Ys028563; Thu, 12 Nov 2020 02:52:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC2q1qU028560; Thu, 12 Nov 2020 02:52:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011120252.0AC2q1qU028560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Nov 2020 02:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367613 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 367613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 02:52:02 -0000 Author: kib Date: Thu Nov 12 02:52:01 2020 New Revision: 367613 URL: https://svnweb.freebsd.org/changeset/base/367613 Log: bhyve: remove a hack to map all 8G BARs 1:1 Suggested and reviewed by: grehan Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D27186 Modified: head/usr.sbin/bhyve/pci_emul.c head/usr.sbin/bhyve/pci_emul.h head/usr.sbin/bhyve/pci_passthru.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Thu Nov 12 02:25:10 2020 (r367612) +++ head/usr.sbin/bhyve/pci_emul.c Thu Nov 12 02:52:01 2020 (r367613) @@ -454,14 +454,6 @@ pci_emul_alloc_resource(uint64_t *baseptr, uint64_t li return (-1); } -int -pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type, - uint64_t size) -{ - - return (pci_emul_alloc_pbar(pdi, idx, 0, type, size)); -} - /* * Register (or unregister) the MMIO or I/O region associated with the BAR * register 'idx' of an emulated pci device. @@ -586,8 +578,8 @@ update_bar_address(struct pci_devinst *pi, uint64_t ad } int -pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, uint64_t hostbase, - enum pcibar_type type, uint64_t size) +pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type, + uint64_t size) { int error; uint64_t *baseptr, limit, addr, mask, lobits, bar; @@ -628,13 +620,7 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, * number (128MB currently). */ if (size > 128 * 1024 * 1024) { - /* - * XXX special case for device requiring peer-peer DMA - */ - if (size == 0x100000000UL) - baseptr = &hostbase; - else - baseptr = &pci_emul_membase64; + baseptr = &pci_emul_membase64; limit = pci_emul_memlim64; mask = PCIM_BAR_MEM_BASE; lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_64 | Modified: head/usr.sbin/bhyve/pci_emul.h ============================================================================== --- head/usr.sbin/bhyve/pci_emul.h Thu Nov 12 02:25:10 2020 (r367612) +++ head/usr.sbin/bhyve/pci_emul.h Thu Nov 12 02:52:01 2020 (r367613) @@ -221,8 +221,6 @@ int init_pci(struct vmctx *ctx); void pci_callback(void); int pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type, uint64_t size); -int pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, - uint64_t hostbase, enum pcibar_type type, uint64_t size); int pci_emul_add_msicap(struct pci_devinst *pi, int msgnum); int pci_emul_add_pciecap(struct pci_devinst *pi, int pcie_device_type); void pci_emul_capwrite(struct pci_devinst *pi, int offset, int bytes, Modified: head/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- head/usr.sbin/bhyve/pci_passthru.c Thu Nov 12 02:25:10 2020 (r367612) +++ head/usr.sbin/bhyve/pci_passthru.c Thu Nov 12 02:52:01 2020 (r367613) @@ -583,7 +583,7 @@ cfginitbar(struct vmctx *ctx, struct passthru_softc *s sc->psc_bar[i].addr = base; /* Allocate the BAR in the guest I/O or MMIO space */ - error = pci_emul_alloc_pbar(pi, i, base, bartype, size); + error = pci_emul_alloc_bar(pi, i, bartype, size); if (error) return (-1); From owner-svn-src-all@freebsd.org Thu Nov 12 09:15:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 502622E468E; Thu, 12 Nov 2020 09:15:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWwt41mytz3KmN; Thu, 12 Nov 2020 09:15:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FAC724404; Thu, 12 Nov 2020 09:15:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC9F7bM066273; Thu, 12 Nov 2020 09:15:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC9F7Hk066272; Thu, 12 Nov 2020 09:15:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011120915.0AC9F7Hk066272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 12 Nov 2020 09:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367614 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 367614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 09:15:08 -0000 Author: hselasky Date: Thu Nov 12 09:15:07 2020 New Revision: 367614 URL: https://svnweb.freebsd.org/changeset/base/367614 Log: When doing a USB alternate setting on an USB interface we need to re-configure the XHCI endpoint context. Differential Revision: https://reviews.freebsd.org/D27174 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Thu Nov 12 02:52:01 2020 (r367613) +++ head/sys/dev/usb/controller/xhci.c Thu Nov 12 09:15:07 2020 (r367614) @@ -4020,6 +4020,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo struct usb_endpoint *ep) { struct xhci_endpoint_ext *pepext; + struct xhci_softc *sc; + uint8_t index; + uint8_t epno; DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n", ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode); @@ -4036,6 +4039,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo USB_BUS_LOCK(udev->bus); pepext->trb_halted = 1; pepext->trb_running = 0; + + /* + * When doing an alternate setting, except for control + * endpoints, we need to re-configure the XHCI endpoint + * context: + */ + if ((edesc->bEndpointAddress & UE_ADDR) != 0) { + sc = XHCI_BUS2SC(udev->bus); + index = udev->controller_slot_id; + epno = XHCI_EPNO2EPID(edesc->bEndpointAddress); + sc->sc_hw.devs[index].ep_configured &= ~(1U << epno); + } USB_BUS_UNLOCK(udev->bus); } From owner-svn-src-all@freebsd.org Thu Nov 12 09:26:01 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1E6C2E4A0B; Thu, 12 Nov 2020 09:26:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CWx6d5cBbz3KwG; Thu, 12 Nov 2020 09:26:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B374E241D7; Thu, 12 Nov 2020 09:26:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AC9Q14r072369; Thu, 12 Nov 2020 09:26:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AC9Q1VK072368; Thu, 12 Nov 2020 09:26:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011120926.0AC9Q1VK072368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 12 Nov 2020 09:26:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367615 - head/sys/dev/sound/usb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/sound/usb X-SVN-Commit-Revision: 367615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 09:26:01 -0000 Author: hselasky Date: Thu Nov 12 09:26:01 2020 New Revision: 367615 URL: https://svnweb.freebsd.org/changeset/base/367615 Log: Add a tunable sysctl, hw.usb.uaudio.handle_hid, to allow disabling the the HID volume keys support in the USB audio driver. While at it re-organize the USB audio sysctls a bit. Differential Revision: https://reviews.freebsd.org/D27180 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Thu Nov 12 09:15:07 2020 (r367614) +++ head/sys/dev/sound/usb/uaudio.c Thu Nov 12 09:26:01 2020 (r367615) @@ -98,15 +98,12 @@ static int uaudio_default_rate = 0; /* use rate list static int uaudio_default_bits = 32; static int uaudio_default_channels = 0; /* use default */ static int uaudio_buffer_ms = 8; +static bool uaudio_handle_hid = true; -#ifdef USB_DEBUG -static int uaudio_debug; - static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "USB uaudio"); - -SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN, - &uaudio_debug, 0, "uaudio debug level"); +SYSCTL_BOOL(_hw_usb_uaudio, OID_AUTO, handle_hid, CTLFLAG_RWTUN, + &uaudio_handle_hid, 0, "uaudio handles any HID volume/mute keys, if set"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RWTUN, &uaudio_default_rate, 0, "uaudio default sample rate"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RWTUN, @@ -138,6 +135,12 @@ SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int), uaudio_buffer_ms_sysctl, "I", "uaudio buffering delay from 2ms to 8ms"); + +#ifdef USB_DEBUG +static int uaudio_debug; + +SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN, + &uaudio_debug, 0, "uaudio debug level"); #else #define uaudio_debug 0 #endif @@ -1116,10 +1119,12 @@ uaudio_attach(device_t dev) goto detach; } - if (uaudio_hid_probe(sc, uaa) == 0) { - device_printf(dev, "HID volume keys found.\n"); - } else { - device_printf(dev, "No HID volume keys found.\n"); + if (uaudio_handle_hid) { + if (uaudio_hid_probe(sc, uaa) == 0) { + device_printf(dev, "HID volume keys found.\n"); + } else { + device_printf(dev, "No HID volume keys found.\n"); + } } /* reload all mixer settings */ From owner-svn-src-all@freebsd.org Thu Nov 12 11:44:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BE732E78C1 for ; Thu, 12 Nov 2020 11:44:40 +0000 (UTC) (envelope-from chrishope@digiwebfirm.com) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CX0Bb2kPYz3hvw for ; Thu, 12 Nov 2020 11:44:39 +0000 (UTC) (envelope-from chrishope@digiwebfirm.com) Received: by mail-wm1-x341.google.com with SMTP id w24so5256240wmi.0 for ; Thu, 12 Nov 2020 03:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digiwebfirm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:from:date:message-id:subject:to; bh=8HiSeOFBa2Fb9gnrvoZ5YgoDe9KlfPV5acFcuQPL3CQ=; b=qV5bK0/AA93YjvLnLXViaCspURZix451faob7UTD8R0GdH2eArBg4099+VjZLgftOb ujx3kcIL+CMGQHzv5/kuHiZRJ27UkAvioCS1LDItqlzKnkZYedZ6zNKGiaummgcgNBKe 8U0lDV8lMY9FKIjiG0KDAAIWzoeY8DRC6iXW40LrLVZSNzZpb2N95dx4GEAcQvkXKQz4 gB3lahGkxsqErdCRnKPX3eYv7MolYv++Chw+WuBviEtTc1j4JJjxri6CIJP0c4d9PGTH e1K6H1nI7oeduNzgE7M1wuLgHZMaikHcbqScLzHIgjjy6saVhZVTDsOWJnEzRS82zq9G 3VSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=8HiSeOFBa2Fb9gnrvoZ5YgoDe9KlfPV5acFcuQPL3CQ=; b=st8LbzWidpHEC3AIwHWpzftn9tpy+fjJBiPXGrNftJXxntucboeRxEys7vdJxP9FvW kmR0smG0X4cHM1VoEk5Z9cLiQArQSmpD3jZ0nyMivXbAfxh4TrlbNsvYQ5z/rj4YOeHE ne9232KgqTu+E9XWkAw5Xf2mG/gJY95Y+CvwsTaE0GwPv1Bnw3/LR5nXxRWtPULiCOL4 zRd5lZkR2diC+AtYYXrbbbAPVTR1ZH5uQodCmJofV0epXekzkKME0ZYve3hz7pD+U/Ow WK8Y1pxRyYES+tDZwxG0eLymfdDS+pSDHAWa61U6O1cHUOEsDokl55lrtRYL03y+Y7Y2 utaQ== X-Gm-Message-State: AOAM530dmhLydL0tfHL+KETK9QVP6ndj4XTSC52zn/IkyHD0K2Yifwh/ wEU5GGrq7Yd0FZDVupSbGm43kIBr/hNXFWQ6yiyiXUdFVQE= X-Google-Smtp-Source: ABdhPJwDOBU/GWp9oW4FlpwrNtNYGbdHd7hlPnHkfTiZ/kuOUTMnVE514ENnmugkeM+ioeIRL1kmk5EIhWk19782pPo= X-Received: by 2002:a1c:98cd:: with SMTP id a196mr9421204wme.42.1605181477298; Thu, 12 Nov 2020 03:44:37 -0800 (PST) Received: from 52669349336 named unknown by gmailapi.google.com with HTTPREST; Thu, 12 Nov 2020 03:44:36 -0800 MIME-Version: 1.0 Sender: Chris Hope From: Chris Hope Date: Thu, 12 Nov 2020 03:44:36 -0800 X-Google-Sender-Auth: PKZLQ9jBfSRwk_C7ucHbqHCKPXw Message-ID: Subject: Re: gcu.info: Easy-to-follow steps to improve your site!! To: Svn-Src-All X-Rspamd-Queue-Id: 4CX0Bb2kPYz3hvw X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=digiwebfirm-com.20150623.gappssmtp.com header.s=20150623 header.b=qV5bK0/A; dmarc=none; spf=pass (mx1.freebsd.org: domain of chrishope@digiwebfirm.com designates 2a00:1450:4864:20::341 as permitted sender) smtp.mailfrom=chrishope@digiwebfirm.com X-Spamd-Result: default: False [-0.79 / 15.00]; FAKE_REPLY(1.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[digiwebfirm-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[digiwebfirm.com]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::341:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[digiwebfirm-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::341:from]; NEURAL_SPAM_SHORT(0.71)[0.712]; SUBJECT_ENDS_EXCLAIM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::341:from]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 11:44:40 -0000 Hello *gcu.info ,* , I was going through your website and I found it impressive!!! However, when I search for your business keywords I see your competitors ranked on the 1st page whereas I am unable to see your website anywhere on the first page of search engine results. Your website is great in terms of design and content. However, it doesn=E2= =80=99t follow Search Engine Guidelines. So, it has a very low visibility in search results. If you are interested then I will send you an *SEO package* and *price list= * . Kind Regards * Chris Hope! Business Development Manager* -------------------------------------------------------- *Note:* - Our next conversation will be on my corporate Email ID. If this is something you are interested, please respond to this email. If this is not your interest, don't worry, we will not email you again. From owner-svn-src-all@freebsd.org Thu Nov 12 14:04:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2747B2EB488; Thu, 12 Nov 2020 14:04:09 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CX3HY0cjcz3r3C; Thu, 12 Nov 2020 14:04:09 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07D5F279A5; Thu, 12 Nov 2020 14:04:09 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACE481k052516; Thu, 12 Nov 2020 14:04:08 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACE48gJ052515; Thu, 12 Nov 2020 14:04:08 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011121404.0ACE48gJ052515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 12 Nov 2020 14:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367616 - head/lib/libzstd X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/lib/libzstd X-SVN-Commit-Revision: 367616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 14:04:09 -0000 Author: manu Date: Thu Nov 12 14:04:08 2020 New Revision: 367616 URL: https://svnweb.freebsd.org/changeset/base/367616 Log: pkgbase: Move libprivatezstd from utilities to runtime libarchive depends on it by default and tar uses libarchive. So on a update : 1/ runtime contain tar 2/ runtime have libarchive in shlibs_required 3/ libarchive packages depends on utilities 4/ utilities depends on runtime 5/ kaboom All users of libprivatezstd (libarchive related stuff and objcopy/ar) are already in utilities. Discussed with: bapt Modified: head/lib/libzstd/Makefile Modified: head/lib/libzstd/Makefile ============================================================================== --- head/lib/libzstd/Makefile Thu Nov 12 09:26:01 2020 (r367615) +++ head/lib/libzstd/Makefile Thu Nov 12 14:04:08 2020 (r367616) @@ -40,6 +40,7 @@ CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXX LIBADD= pthread PRIVATELIB= yes +PACKAGE= runtime ZSTDDIR= ${SRCTOP}/sys/contrib/zstd .PATH: ${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \ From owner-svn-src-all@freebsd.org Thu Nov 12 15:00:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EEE22EC175; Thu, 12 Nov 2020 15:00:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CX4Xx5NZ3z3tgf; Thu, 12 Nov 2020 15:00:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F26E849E; Thu, 12 Nov 2020 15:00:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACF0mxM090201; Thu, 12 Nov 2020 15:00:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACF0mVn090198; Thu, 12 Nov 2020 15:00:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011121500.0ACF0mVn090198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 12 Nov 2020 15:00:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367617 - head/sys/dev/qat X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/qat X-SVN-Commit-Revision: 367617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 15:00:50 -0000 Author: markj Date: Thu Nov 12 15:00:48 2020 New Revision: 367617 URL: https://svnweb.freebsd.org/changeset/base/367617 Log: qat: Fix nits reported by Coverity MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/qat/qat.c head/sys/dev/qat/qat_ae.c head/sys/dev/qat/qatvar.h Modified: head/sys/dev/qat/qat.c ============================================================================== --- head/sys/dev/qat/qat.c Thu Nov 12 14:04:08 2020 (r367616) +++ head/sys/dev/qat/qat.c Thu Nov 12 15:00:48 2020 (r367617) @@ -573,7 +573,8 @@ qat_detach(device_t dev) sc->sc_ih_cookie = NULL; } if (sc->sc_ih != NULL) { - (void)bus_release_resource(dev, SYS_RES_IRQ, i + 1, sc->sc_ih); + (void)bus_release_resource(dev, SYS_RES_IRQ, + sc->sc_hw.qhw_num_banks + 1, sc->sc_ih); sc->sc_ih = NULL; } pci_release_msi(dev); Modified: head/sys/dev/qat/qat_ae.c ============================================================================== --- head/sys/dev/qat/qat_ae.c Thu Nov 12 14:04:08 2020 (r367616) +++ head/sys/dev/qat/qat_ae.c Thu Nov 12 15:00:48 2020 (r367617) @@ -2616,7 +2616,7 @@ qat_aefw_suof_load(struct qat_softc *sc, struct qat_dm static int qat_aefw_suof_write(struct qat_softc *sc) { - struct qat_suof_image *qsi = NULL; + struct qat_suof_image *qsi; int i, error = 0; for (i = 0; i < sc->sc_aefw_suof.qafs_num_simgs; i++) { @@ -2626,21 +2626,20 @@ qat_aefw_suof_write(struct qat_softc *sc) if (error) return error; error = qat_aefw_auth(sc, &qsi->qsi_dma); - if (error) - goto fail; + if (error) { + qat_free_dmamem(sc, &qsi->qsi_dma); + return error; + } error = qat_aefw_suof_load(sc, &qsi->qsi_dma); - if (error) - goto fail; - + if (error) { + qat_free_dmamem(sc, &qsi->qsi_dma); + return error; + } qat_free_dmamem(sc, &qsi->qsi_dma); } qat_free_mem(sc->sc_aefw_suof.qafs_simg); return 0; -fail: - if (qsi != NULL) - qat_free_dmamem(sc, &qsi->qsi_dma); - return error; } static int Modified: head/sys/dev/qat/qatvar.h ============================================================================== --- head/sys/dev/qat/qatvar.h Thu Nov 12 14:04:08 2020 (r367616) +++ head/sys/dev/qat/qatvar.h Thu Nov 12 15:00:48 2020 (r367617) @@ -594,7 +594,7 @@ struct qat_crypto_desc { bus_addr_t qcd_desc_paddr; bus_addr_t qcd_hash_state_paddr; - enum fw_slice qcd_slices[MAX_FW_SLICE]; + enum fw_slice qcd_slices[MAX_FW_SLICE + 1]; enum fw_la_cmd_id qcd_cmd_id; enum hw_cipher_dir qcd_cipher_dir; From owner-svn-src-all@freebsd.org Thu Nov 12 15:50:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 295042ED261; Thu, 12 Nov 2020 15:50:19 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CX5f30SC4z4RbC; Thu, 12 Nov 2020 15:50:19 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03181870; Thu, 12 Nov 2020 15:50:19 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACFoIjk021208; Thu, 12 Nov 2020 15:50:18 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACFoIDj021207; Thu, 12 Nov 2020 15:50:18 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011121550.0ACFoIDj021207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Thu, 12 Nov 2020 15:50:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367618 - head/sys/dev/md X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/sys/dev/md X-SVN-Commit-Revision: 367618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 15:50:19 -0000 Author: 0mp (doc,ports committer) Date: Thu Nov 12 15:50:18 2020 New Revision: 367618 URL: https://svnweb.freebsd.org/changeset/base/367618 Log: Fix a typo in a license comment Approved by: kaktus (src) Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Thu Nov 12 15:00:48 2020 (r367617) +++ head/sys/dev/md/md.c Thu Nov 12 15:50:18 2020 (r367618) @@ -13,7 +13,7 @@ */ /*- - * The following functions are based in the vn(4) driver: mdstart_swap(), + * The following functions are based on the vn(4) driver: mdstart_swap(), * mdstart_vnode(), mdcreate_swap(), mdcreate_vnode() and mddestroy(), * and as such under the following copyright: * From owner-svn-src-all@freebsd.org Thu Nov 12 16:44:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1727E2EE6A6; Thu, 12 Nov 2020 16:44:57 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CX6s473WNz4VLQ; Thu, 12 Nov 2020 16:44:56 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E44591746; Thu, 12 Nov 2020 16:44:56 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACGiuUQ058347; Thu, 12 Nov 2020 16:44:56 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACGiu99058346; Thu, 12 Nov 2020 16:44:56 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011121644.0ACGiu99058346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Thu, 12 Nov 2020 16:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367619 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 367619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 16:44:57 -0000 Author: 0mp (doc,ports committer) Date: Thu Nov 12 16:44:56 2020 New Revision: 367619 URL: https://svnweb.freebsd.org/changeset/base/367619 Log: Add a missing period and remove a macro from Bl's width argument MFC after: 3 days Modified: head/share/man/man9/VOP_RDWR.9 Modified: head/share/man/man9/VOP_RDWR.9 ============================================================================== --- head/share/man/man9/VOP_RDWR.9 Thu Nov 12 15:50:18 2020 (r367618) +++ head/share/man/man9/VOP_RDWR.9 Thu Nov 12 16:44:56 2020 (r367619) @@ -44,7 +44,7 @@ .Ft int .Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" .Sh DESCRIPTION -These entry points read or write the contents of a file +These entry points read or write the contents of a file. .Pp The arguments are: .Bl -tag -width ioflag @@ -66,7 +66,7 @@ read-ahead hint (in units of file system blocks) that should attempt. The low 16 bits are a bit mask which can contain the following flags: -.Bl -tag -width ".Dv IO_NODELOCKED" +.Bl -tag -width "IO_NODELOCKED" .It Dv IO_UNIT Do I/O as atomic unit. .It Dv IO_APPEND From owner-svn-src-all@freebsd.org Thu Nov 12 17:26:20 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E10D2EF36F; Thu, 12 Nov 2020 17:26:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CX7mr0KZDz4Xlt; Thu, 12 Nov 2020 17:26:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F20DD1E79; Thu, 12 Nov 2020 17:26:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACHQJVg084810; Thu, 12 Nov 2020 17:26:19 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACHQJUK084809; Thu, 12 Nov 2020 17:26:19 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202011121726.0ACHQJUK084809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 12 Nov 2020 17:26:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367620 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 367620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 17:26:20 -0000 Author: bz Date: Thu Nov 12 17:26:19 2020 New Revision: 367620 URL: https://svnweb.freebsd.org/changeset/base/367620 Log: MFC r367538: arm64: bs_sr_ take II In r367327 generic_bs_sr_ were derived from mips. Given we are calling generic_bs_w_ and no write directly, we do not have to do the address calculations ourselves as eneric_bs_w_ will do a str val [bsh, offset]. All we actually have to do is increment offset. Modified: stable/12/sys/arm64/arm64/bus_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/bus_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/bus_machdep.c Thu Nov 12 16:44:56 2020 (r367619) +++ stable/12/sys/arm64/arm64/bus_machdep.c Thu Nov 12 17:26:19 2020 (r367620) @@ -124,40 +124,36 @@ static void generic_bs_sr_1(void *t, bus_space_handle_t bsh, bus_size_t offset, uint8_t value, size_t count) { - bus_addr_t addr = bsh + offset; - for (; count != 0; count--, addr++) - generic_bs_w_1(t, bsh, addr, value); + for (; count != 0; count--, offset++) + generic_bs_w_1(t, bsh, offset, value); } static void generic_bs_sr_2(void *t, bus_space_handle_t bsh, bus_size_t offset, uint16_t value, size_t count) { - bus_addr_t addr = bsh + offset; - for (; count != 0; count--, addr += 2) - generic_bs_w_2(t, bsh, addr, value); + for (; count != 0; count--, offset += 2) + generic_bs_w_2(t, bsh, offset, value); } static void generic_bs_sr_4(void *t, bus_space_handle_t bsh, bus_size_t offset, uint32_t value, size_t count) { - bus_addr_t addr = bsh + offset; - for (; count != 0; count--, addr += 4) - generic_bs_w_4(t, bsh, addr, value); + for (; count != 0; count--, offset += 4) + generic_bs_w_4(t, bsh, offset, value); } static void generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset, uint64_t value, size_t count) { - bus_addr_t addr = bsh + offset; - for (; count != 0; count--, addr += 8) - generic_bs_w_8(t, bsh, addr, value); + for (; count != 0; count--, offset += 8) + generic_bs_w_8(t, bsh, offset, value); } struct bus_space memmap_bus = { From owner-svn-src-all@freebsd.org Thu Nov 12 17:28:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51FA72EF73B; Thu, 12 Nov 2020 17:28:30 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CX7qL1rgmz4XyJ; Thu, 12 Nov 2020 17:28:30 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 327D31E7A; Thu, 12 Nov 2020 17:28:30 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACHSUif084946; Thu, 12 Nov 2020 17:28:30 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACHSTEi084943; Thu, 12 Nov 2020 17:28:29 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011121728.0ACHSTEi084943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Thu, 12 Nov 2020 17:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367621 - head/share/examples/mdoc X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/examples/mdoc X-SVN-Commit-Revision: 367621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 17:28:30 -0000 Author: 0mp (doc,ports committer) Date: Thu Nov 12 17:28:29 2020 New Revision: 367621 URL: https://svnweb.freebsd.org/changeset/base/367621 Log: Remove macros from the width arguments passed to Bl macros I've not removed the Er macro from one of the lists in example.9, however, because it seems to be doing some special kind of magic. Let's leave it there for now. Modified: head/share/examples/mdoc/example.1 head/share/examples/mdoc/example.3 head/share/examples/mdoc/example.4 head/share/examples/mdoc/example.9 Modified: head/share/examples/mdoc/example.1 ============================================================================== --- head/share/examples/mdoc/example.1 Thu Nov 12 17:26:19 2020 (r367620) +++ head/share/examples/mdoc/example.1 Thu Nov 12 17:28:29 2020 (r367621) @@ -47,7 +47,7 @@ It is intended that this example can be used as a temp when writing a new manual page. .Pp The options are as follows: -.Bl -tag -width ".Fl d Ar argument" +.Bl -tag -width "-d Ar argument" .It Fl a Example optional .Fl a @@ -76,7 +76,7 @@ command ignores the .Ev EXAMPLE environment variable. .Sh FILES -.Bl -tag -width ".Pa /dev/null" -compact +.Bl -tag -width "/dev/null" -compact .It Pa /dev/null Example of a file in the .Sx FILES Modified: head/share/examples/mdoc/example.3 ============================================================================== --- head/share/examples/mdoc/example.3 Thu Nov 12 17:26:19 2020 (r367620) +++ head/share/examples/mdoc/example.3 Thu Nov 12 17:28:29 2020 (r367621) @@ -57,7 +57,7 @@ and The argument .Fa mode may have one of the following values: -.Bl -tag -width ".Dv EXAMPLE_ONE" +.Bl -tag -width "EXAMPLE_ONE" .It Dv EXAMPLE_ONE First example of a defined variable. .Dv EXAMPLE_ONE @@ -86,7 +86,7 @@ library function ignores the .Ev EXAMPLE environment variable. .Sh FILES -.Bl -tag -width ".Pa /dev/null" -compact +.Bl -tag -width "/dev/null" -compact .It Pa /dev/null Example of a file in the .Sx FILES Modified: head/share/examples/mdoc/example.4 ============================================================================== --- head/share/examples/mdoc/example.4 Thu Nov 12 17:26:19 2020 (r367620) +++ head/share/examples/mdoc/example.4 Thu Nov 12 17:28:29 2020 (r367621) @@ -59,7 +59,7 @@ when writing a new manual page. The .Nm driver supports the following ioctls: -.Bl -tag -width ".Dv EIOCNULL" +.Bl -tag -width "EIOCNULL" .It Dv EIOCEX Example ioctl. .It Dv EIOCNULL Modified: head/share/examples/mdoc/example.9 ============================================================================== --- head/share/examples/mdoc/example.9 Thu Nov 12 17:26:19 2020 (r367620) +++ head/share/examples/mdoc/example.9 Thu Nov 12 17:28:29 2020 (r367621) @@ -54,7 +54,7 @@ and The argument .Fa mode may have one of the following values: -.Bl -tag -width ".Dv EXAMPLE_ONE" +.Bl -tag -width "EXAMPLE_ONE" .It Dv EXAMPLE_ONE First example of a defined variable. .Dv EXAMPLE_ONE From owner-svn-src-all@freebsd.org Thu Nov 12 18:24:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BF67461776; Thu, 12 Nov 2020 18:24:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CX9456xLSz4cC5; Thu, 12 Nov 2020 18:24:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0C372EB9; Thu, 12 Nov 2020 18:24:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACIObkZ022058; Thu, 12 Nov 2020 18:24:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACIObtO022057; Thu, 12 Nov 2020 18:24:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011121824.0ACIObtO022057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 12 Nov 2020 18:24:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367622 - in head/sys/dev/usb: . quirk X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/usb: . quirk X-SVN-Commit-Revision: 367622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 18:24:38 -0000 Author: hselasky Date: Thu Nov 12 18:24:37 2020 New Revision: 367622 URL: https://svnweb.freebsd.org/changeset/base/367622 Log: Add more USB quirks. PR: 230038 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Thu Nov 12 17:28:29 2020 (r367621) +++ head/sys/dev/usb/quirk/usb_quirk.c Thu Nov 12 18:24:37 2020 (r367622) @@ -240,7 +240,9 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(GARMIN, DAKOTA20, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GARMIN, FORERUNNER230, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), + USB_QUIRK(GARMIN, GPSMAP62S, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Thu Nov 12 17:28:29 2020 (r367621) +++ head/sys/dev/usb/usbdevs Thu Nov 12 18:24:37 2020 (r367622) @@ -2253,7 +2253,9 @@ product FUJITSU AH_F401U 0x105b AH-F401U Air H device product FUJITSUSIEMENS SCR 0x0009 Fujitsu-Siemens SCR USB Reader /* Garmin products */ +product GARMIN DAKOTA20 0x23c0 Dakota 20 product GARMIN FORERUNNER230 0x086d ForeRunner 230 +product GARMIN GPSMAP62S 0x2459 GPSMAP 62s product GARMIN IQUE_3600 0x0004 iQue 3600 /* Gemalto products */ From owner-svn-src-all@freebsd.org Thu Nov 12 19:25:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DE3D462E55; Thu, 12 Nov 2020 19:25:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXBQM3d1Kz4fsh; Thu, 12 Nov 2020 19:25:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F325393F; Thu, 12 Nov 2020 19:25:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACJPVFq059104; Thu, 12 Nov 2020 19:25:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACJPVvU059103; Thu, 12 Nov 2020 19:25:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011121925.0ACJPVvU059103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 12 Nov 2020 19:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367623 - head/contrib/llvm-project/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/lld/ELF X-SVN-Commit-Revision: 367623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 19:25:31 -0000 Author: dim Date: Thu Nov 12 19:25:31 2020 New Revision: 367623 URL: https://svnweb.freebsd.org/changeset/base/367623 Log: Merge commit 8df4e6094 from llvm git (by Fangrui Song): [ELF] Don't consider SHF_ALLOC ".debug*" sections debug sections Fixes PR48071 * The Rust compiler produces SHF_ALLOC `.debug_gdb_scripts` (which normally does not have the flag) * `.debug_gdb_scripts` sections are removed from `inputSections` due to --strip-debug/--strip-all * When processing --gc-sections, pieces of a SHF_MERGE section can be marked live separately `=>` segfault when marking liveness of a `.debug_gdb_scripts` which is not split into pieces (because it is not in `inputSections`) This patch circumvents the problem by not treating SHF_ALLOC ".debug*" as debug sections (to prevent --strip-debug's stripping) (which is still useful on its own). Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D91291 This should fix lld segfaulting when linking the rust-based parts of the devel/py-maturin port. Reported by: Nick Venenga PR: 250783 MFC after: 3 days Modified: head/contrib/llvm-project/lld/ELF/InputSection.h Modified: head/contrib/llvm-project/lld/ELF/InputSection.h ============================================================================== --- head/contrib/llvm-project/lld/ELF/InputSection.h Thu Nov 12 18:24:37 2020 (r367622) +++ head/contrib/llvm-project/lld/ELF/InputSection.h Thu Nov 12 19:25:31 2020 (r367623) @@ -391,7 +391,8 @@ class InputSection : public InputSectionBase { (privat }; inline bool isDebugSection(const InputSectionBase &sec) { - return sec.name.startswith(".debug") || sec.name.startswith(".zdebug"); + return (sec.flags & llvm::ELF::SHF_ALLOC) == 0 && + (sec.name.startswith(".debug") || sec.name.startswith(".zdebug")); } // The list of all input sections. From owner-svn-src-all@freebsd.org Thu Nov 12 20:02:48 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9BA346393B; Thu, 12 Nov 2020 20:02:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXCFN3znqz4hPc; Thu, 12 Nov 2020 20:02:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71B8E43B7; Thu, 12 Nov 2020 20:02:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACK2mkB083556; Thu, 12 Nov 2020 20:02:48 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACK2mWK083555; Thu, 12 Nov 2020 20:02:48 GMT (envelope-from np@FreeBSD.org) Message-Id: <202011122002.0ACK2mWK083555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 12 Nov 2020 20:02:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367624 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 367624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 20:02:48 -0000 Author: np Date: Thu Nov 12 20:02:48 2020 New Revision: 367624 URL: https://svnweb.freebsd.org/changeset/base/367624 Log: cxgbe/t4_tom: Handle VXLAN-encapsulated SYNs correctly. TCP SYNs in inner traffic will hit hardware listeners when VXLAN/NVGRE rx parsing is enabled in the chip. t4_tom should pass on these SYNs to the kernel and let it deal with them as if they arrived on the non-TOE path. Reported by: Sony at Chelsio MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 12 19:25:31 2020 (r367623) +++ head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 12 20:02:48 2020 (r367624) @@ -1003,6 +1003,17 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc to->to_flags |= TOF_SACKPERM; } +static bool +encapsulated_syn(struct adapter *sc, const struct cpl_pass_accept_req *cpl) +{ + u_int hlen = be32toh(cpl->hdr_len); + + if (chip_id(sc) >= CHELSIO_T6) + return (G_T6_ETH_HDR_LEN(hlen) > sizeof(struct ether_vlan_header)); + else + return (G_ETH_HDR_LEN(hlen) > sizeof(struct ether_vlan_header)); +} + static void pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m, struct in_conninfo *inc, struct tcphdr *th, uint8_t *iptos) @@ -1194,22 +1205,38 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss CTR4(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p", __func__, stid, tid, lctx); + /* + * Figure out the port the SYN arrived on. We'll look for an exact VI + * match in a bit but in case we don't find any we'll use the main VI as + * the incoming ifnet. + */ + l2info = be16toh(cpl->l2info); + pi = sc->port[G_SYN_INTF(l2info)]; + hw_ifp = pi->vi[0].ifp; + m->m_pkthdr.rcvif = hw_ifp; + CURVNET_SET(lctx->vnet); /* before any potential REJECT */ /* + * If VXLAN/NVGRE parsing is enabled then SYNs in the inner traffic will + * also hit the listener. We don't want to offload those. + */ + if (encapsulated_syn(sc, cpl)) { + REJECT_PASS_ACCEPT_REQ(true); + } + + /* * Use the MAC index to lookup the associated VI. If this SYN didn't * match a perfect MAC filter, punt. */ - l2info = be16toh(cpl->l2info); - pi = sc->port[G_SYN_INTF(l2info)]; if (!(l2info & F_SYN_XACT_MATCH)) { - REJECT_PASS_ACCEPT_REQ(false); + REJECT_PASS_ACCEPT_REQ(true); } for_each_vi(pi, v, vi) { if (vi->xact_addr_filt == G_SYN_MAC_IDX(l2info)) goto found; } - REJECT_PASS_ACCEPT_REQ(false); + REJECT_PASS_ACCEPT_REQ(true); found: hw_ifp = vi->ifp; /* the cxgbe ifnet */ m->m_pkthdr.rcvif = hw_ifp; From owner-svn-src-all@freebsd.org Thu Nov 12 20:20:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5F0F46402D; Thu, 12 Nov 2020 20:20:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXCf44NMqz4hy6; Thu, 12 Nov 2020 20:20:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89BA84053; Thu, 12 Nov 2020 20:20:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACKKiGQ089905; Thu, 12 Nov 2020 20:20:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACKKiXq089903; Thu, 12 Nov 2020 20:20:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011122020.0ACKKiXq089903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 12 Nov 2020 20:20:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367625 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 367625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 20:20:44 -0000 Author: mav Date: Thu Nov 12 20:20:43 2020 New Revision: 367625 URL: https://svnweb.freebsd.org/changeset/base/367625 Log: Fix panic if NVMe is detached before the intrhook call. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Thu Nov 12 20:02:48 2020 (r367624) +++ head/sys/dev/nvme/nvme.c Thu Nov 12 20:20:43 2020 (r367625) @@ -139,9 +139,14 @@ nvme_attach(device_t dev) } int -nvme_detach (device_t dev) +nvme_detach(device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); + + if (ctrlr->config_hook.ich_arg != NULL) { + config_intrhook_disestablish(&ctrlr->config_hook); + ctrlr->config_hook.ich_arg = NULL; + } nvme_ctrlr_destruct(ctrlr, dev); return (0); Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Thu Nov 12 20:02:48 2020 (r367624) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Nov 12 20:20:43 2020 (r367625) @@ -1135,6 +1135,7 @@ nvme_ctrlr_start_config_hook(void *arg) fail: nvme_ctrlr_fail(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); + ctrlr->config_hook.ich_arg = NULL; return; } @@ -1152,6 +1153,7 @@ fail: nvme_sysctl_initialize_ctrlr(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); + ctrlr->config_hook.ich_arg = NULL; ctrlr->is_initialized = 1; nvme_notify_new_controller(ctrlr); From owner-svn-src-all@freebsd.org Thu Nov 12 20:20:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECBB7463FA2; Thu, 12 Nov 2020 20:20:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXCfK6PZxz4jNw; Thu, 12 Nov 2020 20:20:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF0A543F2; Thu, 12 Nov 2020 20:20:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACKKvCp090943; Thu, 12 Nov 2020 20:20:57 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACKKvFa090942; Thu, 12 Nov 2020 20:20:57 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011122020.0ACKKvFa090942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 12 Nov 2020 20:20:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367626 - head/sys/geom/bde X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/geom/bde X-SVN-Commit-Revision: 367626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 20:20:58 -0000 Author: mjg Date: Thu Nov 12 20:20:57 2020 New Revision: 367626 URL: https://svnweb.freebsd.org/changeset/base/367626 Log: gbde: replace malloc_last_fail with a kludge This facilitates removal of malloc_last_fail without really impacting anything. Modified: head/sys/geom/bde/g_bde_work.c Modified: head/sys/geom/bde/g_bde_work.c ============================================================================== --- head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:43 2020 (r367625) +++ head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:57 2020 (r367626) @@ -77,6 +77,20 @@ #include #include +/* + * FIXME: This used to call malloc_last_fail which in practice was almost + * guaranteed to return time_uptime even in face of severe memory shortage. + * As GBDE is the only consumer the kludge below was added to facilitate the + * removal with minimial changes. The code should be fixed to respond to memory + * pressure (e.g., by using lowmem eventhandler) instead. + */ +static int +g_bde_malloc_last_fail(void) +{ + + return (time_uptime); +} + static void g_bde_delete_sector(struct g_bde_softc *wp, struct g_bde_sector *sp); static struct g_bde_sector * g_bde_new_sector(struct g_bde_work *wp, u_int len); static void g_bde_release_keysector(struct g_bde_work *wp); @@ -210,7 +224,7 @@ g_bde_get_keysector(struct g_bde_work *wp) g_trace(G_T_TOPOLOGY, "g_bde_get_keysector(%p, %jd)", wp, (intmax_t)offset); sc = wp->softc; - if (malloc_last_fail() < g_bde_ncache) + if (g_bde_malloc_last_fail() < g_bde_ncache) g_bde_purge_sector(sc, -1); sp = TAILQ_FIRST(&sc->freelist); @@ -228,7 +242,7 @@ g_bde_get_keysector(struct g_bde_work *wp) if (sp->ref == 1) sp->owner = wp; } else { - if (malloc_last_fail() < g_bde_ncache) { + if (g_bde_malloc_last_fail() < g_bde_ncache) { TAILQ_FOREACH(sp, &sc->freelist, list) if (sp->ref == 0) break; @@ -311,7 +325,7 @@ g_bde_purge_sector(struct g_bde_softc *sc, int fractio if (fraction > 0) n = sc->ncache / fraction + 1; else - n = g_bde_ncache - malloc_last_fail(); + n = g_bde_ncache - g_bde_malloc_last_fail(); if (n < 0) return; if (n > sc->ncache) From owner-svn-src-all@freebsd.org Thu Nov 12 20:22:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE022464055; Thu, 12 Nov 2020 20:22:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXChg4Xknz4jvM; Thu, 12 Nov 2020 20:22:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EF3E490B; Thu, 12 Nov 2020 20:22:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACKMxrY096168; Thu, 12 Nov 2020 20:22:59 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACKMxXx096165; Thu, 12 Nov 2020 20:22:59 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011122022.0ACKMxXx096165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 12 Nov 2020 20:22:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367627 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 20:22:59 -0000 Author: mjg Date: Thu Nov 12 20:22:58 2020 New Revision: 367627 URL: https://svnweb.freebsd.org/changeset/base/367627 Log: malloc: retire malloc_last_fail The routine does not serve any practical purpose. Memory can be allocated in many other ways and most consumers pass the M_WAITOK flag, making malloc not fail in the first place. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27143 Modified: head/sys/kern/kern_malloc.c head/sys/sys/malloc.h head/sys/sys/param.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Thu Nov 12 20:20:57 2020 (r367626) +++ head/sys/kern/kern_malloc.c Thu Nov 12 20:22:58 2020 (r367627) @@ -231,11 +231,6 @@ static int sysctl_kern_mprof(SYSCTL_HANDLER_ARGS); static int sysctl_kern_malloc_stats(SYSCTL_HANDLER_ARGS); -/* - * time_uptime of the last malloc(9) failure (induced or real). - */ -static time_t t_malloc_fail; - #if defined(MALLOC_MAKE_FAILURES) || (MALLOC_DEBUG_MAXZONES > 1) static SYSCTL_NODE(_debug, OID_AUTO, malloc, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Kernel malloc debugging options"); @@ -373,13 +368,6 @@ mtp_get_subzone(struct malloc_type *mtp) } #endif /* MALLOC_DEBUG_MAXZONES > 1 */ -int -malloc_last_fail(void) -{ - - return (time_uptime - t_malloc_fail); -} - /* * An allocation has succeeded -- update malloc type statistics for the * amount of bucket size. Occurs within a critical section so that the @@ -535,7 +523,6 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_ atomic_add_int(&malloc_nowait_count, 1); if ((malloc_nowait_count % malloc_failure_rate) == 0) { atomic_add_int(&malloc_failure_count, 1); - t_malloc_fail = time_uptime; *vap = NULL; return (EJUSTRETURN); } @@ -662,7 +649,6 @@ void * if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -730,7 +716,6 @@ malloc_domainset(size_t size, struct malloc_type *mtp, if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -761,7 +746,6 @@ malloc_exec(size_t size, struct malloc_type *mtp, int if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -791,7 +775,6 @@ malloc_domainset_exec(size_t size, struct malloc_type if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Thu Nov 12 20:20:57 2020 (r367626) +++ head/sys/sys/malloc.h Thu Nov 12 20:22:58 2020 (r367627) @@ -252,7 +252,6 @@ void *malloc_domainset_exec(size_t size, struct malloc struct domainset *ds, int flags) __malloc_like __result_use_check __alloc_size(1); void malloc_init(void *); -int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_type_list(malloc_type_list_func_t *, void *); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Nov 12 20:20:57 2020 (r367626) +++ head/sys/sys/param.h Thu Nov 12 20:22:58 2020 (r367627) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300128 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300129 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Thu Nov 12 21:58:48 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D518466199; Thu, 12 Nov 2020 21:58:48 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXFqD0sNPz4p9P; Thu, 12 Nov 2020 21:58:48 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F3B65830; Thu, 12 Nov 2020 21:58:48 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ACLwlm8052145; Thu, 12 Nov 2020 21:58:47 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ACLwl0n052142; Thu, 12 Nov 2020 21:58:47 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <202011122158.0ACLwl0n052142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Thu, 12 Nov 2020 21:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367628 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: gnn X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 367628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 21:58:48 -0000 Author: gnn Date: Thu Nov 12 21:58:47 2020 New Revision: 367628 URL: https://svnweb.freebsd.org/changeset/base/367628 Log: An earlier commit effectively turned out the fast forwading path due to its lack of support for ICMP redirects. The following commit adds redirects to the fastforward path, again allowing for decent forwarding performance in the kernel. Reviewed by: ae, melifaro Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Modified: head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_input.c head/sys/netinet/ip_var.h Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Thu Nov 12 20:22:58 2020 (r367627) +++ head/sys/netinet/ip_fastfwd.c Thu Nov 12 21:58:47 2020 (r367628) @@ -111,6 +111,43 @@ __FBSDID("$FreeBSD$"); #include +#define V_ipsendredirects VNET(ipsendredirects) + +static struct mbuf * +ip_redir_alloc(struct mbuf *m, struct nhop_object *nh, + struct ip *ip, in_addr_t *addr) +{ + struct mbuf *mcopy = m_gethdr(M_NOWAIT, m->m_type); + if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_NOWAIT)) { + /* + * It's probably ok if the pkthdr dup fails (because + * the deep copy of the tag chain failed), but for now + * be conservative and just discard the copy since + * code below may some day want the tags. + */ + m_free(mcopy); + return (NULL); + } + mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy)); + mcopy->m_pkthdr.len = mcopy->m_len; + m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); + + if (nh != NULL && + ((nh->nh_flags & (NHF_REDIRECT|NHF_DEFAULT)) == 0)) { + struct in_ifaddr *nh_ia = (struct in_ifaddr *)(nh->nh_ifa); + u_long src = ntohl(ip->ip_src.s_addr); + + if (nh_ia != NULL && (src & nh_ia->ia_subnetmask) == nh_ia->ia_subnet) { + if (nh->nh_flags & NHF_GATEWAY) + *addr = nh->gw4_sa.sin_addr.s_addr; + else + *addr = ip->ip_dst.s_addr; + } + } + return (mcopy); +} + + static int ip_findroute(struct nhop_object **pnh, struct in_addr dest, struct mbuf *m) { @@ -156,13 +193,14 @@ ip_tryforward(struct mbuf *m) { struct ip *ip; struct mbuf *m0 = NULL; - struct nhop_object *nh; + struct nhop_object *nh = NULL; struct sockaddr_in dst; struct in_addr dest, odest, rtdest; uint16_t ip_len, ip_off; int error = 0; struct m_tag *fwd_tag = NULL; - + struct mbuf *mcopy = NULL; + struct in_addr redest; /* * Are we active and forwarding packets? */ @@ -387,6 +425,13 @@ passout: dst.sin_addr = dest; /* + * Handle redirect case. + */ + redest.s_addr = 0; + if (V_ipsendredirects && (nh->nh_ifp == m->m_pkthdr.rcvif)) + mcopy = ip_redir_alloc(m, nh, ip, &redest.s_addr); + + /* * Check if packet fits MTU or if hardware will fragment for us */ if (ip_len <= nh->nh_mtu) { @@ -455,7 +500,16 @@ passout: IPSTAT_INC(ips_forward); IPSTAT_INC(ips_fastforward); } + + /* Send required redirect */ + if (mcopy != NULL) { + icmp_error(mcopy, ICMP_REDIRECT, ICMP_REDIRECT_HOST, redest.s_addr, 0); + mcopy = NULL; /* Freed by caller */ + } + consumed: + if (mcopy != NULL) + m_freem(mcopy); return NULL; drop: if (m) Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Thu Nov 12 20:22:58 2020 (r367627) +++ head/sys/netinet/ip_input.c Thu Nov 12 21:58:47 2020 (r367628) @@ -111,8 +111,11 @@ SYSCTL_INT(_net_inet_ip, IPCTL_FORWARDING, forwarding, &VNET_NAME(ipforwarding), 0, "Enable IP forwarding between interfaces"); -VNET_DEFINE_STATIC(int, ipsendredirects) = 1; /* XXX */ -#define V_ipsendredirects VNET(ipsendredirects) +/* + * Respond with an ICMP host redirect when we forward a packet out of + * the same interface on which it was received. See RFC 792. + */ +VNET_DEFINE(int, ipsendredirects) = 1; SYSCTL_INT(_net_inet_ip, IPCTL_SENDREDIRECTS, redirect, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsendredirects), 0, "Enable sending IP redirects"); @@ -571,7 +574,7 @@ tooshort: * case skip another inbound firewall processing and update * ip pointer. */ - if (V_ipforwarding != 0 && V_ipsendredirects == 0 + if (V_ipforwarding != 0 #if defined(IPSEC) || defined(IPSEC_SUPPORT) && (!IPSEC_ENABLED(ipv4) || IPSEC_CAPS(ipv4, m, IPSEC_CAP_OPERABLE) == 0) Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Thu Nov 12 20:22:58 2020 (r367627) +++ head/sys/netinet/ip_var.h Thu Nov 12 21:58:47 2020 (r367628) @@ -182,6 +182,7 @@ struct inpcbinfo; VNET_DECLARE(int, ip_defttl); /* default IP ttl */ VNET_DECLARE(int, ipforwarding); /* ip forwarding */ +VNET_DECLARE(int, ipsendredirects); #ifdef IPSTEALTH VNET_DECLARE(int, ipstealth); /* stealth forwarding */ #endif @@ -197,6 +198,7 @@ extern struct pr_usrreqs rip_usrreqs; #define V_ip_id VNET(ip_id) #define V_ip_defttl VNET(ip_defttl) #define V_ipforwarding VNET(ipforwarding) +#define V_ipsendredirects VNET(ipsendredirects) #ifdef IPSTEALTH #define V_ipstealth VNET(ipstealth) #endif From owner-svn-src-all@freebsd.org Thu Nov 12 22:12:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0553D4661F0; Thu, 12 Nov 2020 22:12:38 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXG796LyTz4pgX; Thu, 12 Nov 2020 22:12:37 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-oi1-x229.google.com with SMTP id j7so8164589oie.12; Thu, 12 Nov 2020 14:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hZ44B0PGqFtPHTBcc9vPRRZ21qSno4Fe8YS1vFXzn8I=; b=fL+ktIOv9iwotnH/fqnvZwf1FpKxo9lP5rBRKmkFbEQw5zpijrZ8jkTJaGfn84tPFS wKOKOeHnLP743k+Up13fpG9wNVPMkRArmeFFxREdlNfB5UGp8HV+Az7PAkX0BzCXaLDe LA9oLqOzvjfn5x10tnd1ldTYccvXdM2TBIcgebyr2L566MQAW7XA+Vpg4wmR4jgGQUVI TEQR5SX2E8XyT1Ibouz4xuS7e5OuV0cPvjQnnNFvkBWYnrqDbOCZnNAKzqpLstMmmkKN 5CKfdrA1Wj5iHxoONjrLXWZWseo/NkGBizM1BaYUKhHz0x5TV08rt1FrSraCLXRw7lN9 uFZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hZ44B0PGqFtPHTBcc9vPRRZ21qSno4Fe8YS1vFXzn8I=; b=LvNLYnfipLph6DWRPOzu5LXVQ7wiwpbKUQNMJwDf1kuBWuDa/STE+QG1AiEZmRvjtq IOhVbtaX8DWbU07JJXQ4IH/PZ5SoyXeC7O+uXFuWekOSA+uebg99IB3fRzm4LfKgSo/2 ezTLXiLScpcpPBLGKOlZGEhkBtKs4YxvwEKP5rLI9mjbrU1VU6pgQ2Ws1QBnS30+33+3 IUe4xznUwLlsIJixm7jPgdBUK8b2z1eskFs3wNIsG0CeyLCvfTK57dabwZwGS3MtXPyO 5TrxU4uM8dZ0kouRSELNqFl8UEyHPs2r+eYyIR4bJzsFfBdSGfXDPDnNVvyGj07MLznc VeXg== X-Gm-Message-State: AOAM53397hZrr66D9dNIRwzq+iUf3hgDHb//gw8WEJxXy+tAWattwZ0x GNCHvVbvKOZVJmOMplkk5V+pL/8S7xV67I08XfLaFndN X-Google-Smtp-Source: ABdhPJxQgvTKV9tbgZx/W6P1soOubuYDxGb1pBtI6wLmkNCKfzHzX6VVVpOZxLWvhTu5ZaajSt/C0t4vjkCgGBpnk/E= X-Received: by 2002:aca:ef06:: with SMTP id n6mr1186831oih.173.1605219156393; Thu, 12 Nov 2020 14:12:36 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a4a:c689:0:0:0:0:0 with HTTP; Thu, 12 Nov 2020 14:12:35 -0800 (PST) In-Reply-To: <202011122020.0ACKKvFa090942@repo.freebsd.org> References: <202011122020.0ACKKvFa090942@repo.freebsd.org> From: Oliver Pinter Date: Thu, 12 Nov 2020 23:12:35 +0100 Message-ID: Subject: Re: svn commit: r367626 - head/sys/geom/bde To: Mateusz Guzik Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CXG796LyTz4pgX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 22:12:38 -0000 On Thursday, November 12, 2020, Mateusz Guzik wrote: > Author: mjg > Date: Thu Nov 12 20:20:57 2020 > New Revision: 367626 > URL: https://svnweb.freebsd.org/changeset/base/367626 > > Log: > gbde: replace malloc_last_fail with a kludge > > This facilitates removal of malloc_last_fail without really impacting > anything. > > Modified: > head/sys/geom/bde/g_bde_work.c > > Modified: head/sys/geom/bde/g_bde_work.c > ============================================================ > ================== > --- head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:43 2020 > (r367625) > +++ head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:57 2020 > (r367626) > @@ -77,6 +77,20 @@ > #include > #include > > +/* > + * FIXME: This used to call malloc_last_fail which in practice was almost > + * guaranteed to return time_uptime even in face of severe memory > shortage. > + * As GBDE is the only consumer the kludge below was added to facilitate > the > + * removal with minimial changes. The code should be fixed to respond to > memory > + * pressure (e.g., by using lowmem eventhandler) instead. > + */ > +static int > +g_bde_malloc_last_fail(void) > +{ > + > + return (time_uptime); > +} > + Previously malloc_last_fail returned a relatively small number - if i read the code correctly: -int -malloc_last_fail(void) -{ - - return (time_uptime - t_malloc_fail); -} - > static void g_bde_delete_sector(struct g_bde_softc *wp, struct > g_bde_sector *sp); > static struct g_bde_sector * g_bde_new_sector(struct g_bde_work *wp, > u_int len); > static void g_bde_release_keysector(struct g_bde_work *wp); > @@ -210,7 +224,7 @@ g_bde_get_keysector(struct g_bde_work *wp) > g_trace(G_T_TOPOLOGY, "g_bde_get_keysector(%p, %jd)", wp, > (intmax_t)offset); > sc = wp->softc; > > - if (malloc_last_fail() < g_bde_ncache) > + if (g_bde_malloc_last_fail() < g_bde_ncache) > g_bde_purge_sector(sc, -1); And in this case, the semantic change renders all of these calls from alway true to always false expression. > > sp = TAILQ_FIRST(&sc->freelist); > @@ -228,7 +242,7 @@ g_bde_get_keysector(struct g_bde_work *wp) > if (sp->ref == 1) > sp->owner = wp; > } else { > - if (malloc_last_fail() < g_bde_ncache) { > + if (g_bde_malloc_last_fail() < g_bde_ncache) { > TAILQ_FOREACH(sp, &sc->freelist, list) > if (sp->ref == 0) > break; > @@ -311,7 +325,7 @@ g_bde_purge_sector(struct g_bde_softc *sc, int fractio > if (fraction > 0) > n = sc->ncache / fraction + 1; > else > - n = g_bde_ncache - malloc_last_fail(); > + n = g_bde_ncache - g_bde_malloc_last_fail(); > if (n < 0) > return; > if (n > sc->ncache) > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Thu Nov 12 22:14:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95F2C46653F; Thu, 12 Nov 2020 22:14:52 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXG9l678Xz4q5T; Thu, 12 Nov 2020 22:14:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x334.google.com with SMTP id 10so6550075wml.2; Thu, 12 Nov 2020 14:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Soosa3Kxfg5+F5WZhnp6wJJvvWgViW4M8k+Qk1OazP4=; b=XJyAizW+c/0iK13Ysn1noaXF5zjiCDTZNl0oIay0nw705iQRcVH40tBQu+BggOKD/R 5zcsy7V2L4DRk7BtWucpPyRR8mDDUs8diOJ9auDvs749KUsE8Dobs/AsLorB+NlXUgKI HZWKdsfwYOOZSUjtmXSVTkJPLrk7f6VzdSqqE7whZpr5j/mGiX7ecXPA+6VWSpxGu2p5 EbqFLpu1cAMVjxw5XB6hTeGeM1hcKcjjNDrf2mhR0f9VpzGiudXD3REiXMWVvq5NHnCV 9+zOgmlfanHzUOP0nP8keDp3B3s1D0w/sXhvecEbPq8BKTf+PPe12nUmF36aIVNPYEXW OUFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Soosa3Kxfg5+F5WZhnp6wJJvvWgViW4M8k+Qk1OazP4=; b=TOv5IljERDntUMm5/Y1Ro7VYk349fMognYTerPyuMtrtgnJBNkjblhR29eew8cZWms cn6UXDdNIZP5OIuUV69cSgNV0E4S6FKjyewsY4GqG04kNXesZ0IepmfQ8yjx6p5t6Wpa eZjKGEjTmc0CnPE9ZxRCEU7FNWOsxyyMi0PHGkaFCBypZvRI3zW1yVXXrT6k2MQAKsep /H0E2BgmMp9sGfCbkSOz2D9kXB9RPUhpPvhPEARNRyJ528t2AmhcZmf7L27VhruWEov+ S2DxoJEvqMh0N+RBaTMgeK+cCBto15TmtBu7PPlg1WdBlZ6XHtIAjjo+UKL7Yw+j6/c2 7Rrw== X-Gm-Message-State: AOAM532mngVd1BydogwrITxeGNsx1FdJmcIBuQon2wR7Y0I09tlqCia1 tUT5G0WAoTgNW28kvFEVKwLKBetdJ9MVXPoXFFw= X-Google-Smtp-Source: ABdhPJzZsP7DwKAbSxD1Qg1raIRG9kkQ61UjAgAwRhVNnxhHXfmR5r2UbAv41Yj79wlaktK7ZSFVx3zTO73fGZLNx7E= X-Received: by 2002:a1c:e442:: with SMTP id b63mr1878799wmh.10.1605219289770; Thu, 12 Nov 2020 14:14:49 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:dec7:0:0:0:0:0 with HTTP; Thu, 12 Nov 2020 14:14:48 -0800 (PST) In-Reply-To: References: <202011122020.0ACKKvFa090942@repo.freebsd.org> From: Mateusz Guzik Date: Thu, 12 Nov 2020 23:14:48 +0100 Message-ID: Subject: Re: svn commit: r367626 - head/sys/geom/bde To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CXG9l678Xz4q5T X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=XJyAizW+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::334 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::334:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::334:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::334:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 22:14:52 -0000 On 11/12/20, Oliver Pinter wrote: > On Thursday, November 12, 2020, Mateusz Guzik wrote: > >> Author: mjg >> Date: Thu Nov 12 20:20:57 2020 >> New Revision: 367626 >> URL: https://svnweb.freebsd.org/changeset/base/367626 >> >> Log: >> gbde: replace malloc_last_fail with a kludge >> >> This facilitates removal of malloc_last_fail without really impacting >> anything. >> >> Modified: >> head/sys/geom/bde/g_bde_work.c >> >> Modified: head/sys/geom/bde/g_bde_work.c >> ============================================================ >> ================== >> --- head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:43 2020 >> (r367625) >> +++ head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:57 2020 >> (r367626) >> @@ -77,6 +77,20 @@ >> #include >> #include >> >> +/* >> + * FIXME: This used to call malloc_last_fail which in practice was >> almost >> + * guaranteed to return time_uptime even in face of severe memory >> shortage. >> + * As GBDE is the only consumer the kludge below was added to facilitate >> the >> + * removal with minimial changes. The code should be fixed to respond to >> memory >> + * pressure (e.g., by using lowmem eventhandler) instead. >> + */ >> +static int >> +g_bde_malloc_last_fail(void) >> +{ >> + >> + return (time_uptime); >> +} >> + > > > Previously malloc_last_fail returned a relatively small number - if i read > the code correctly: > > -int > -malloc_last_fail(void) > -{ > - > - return (time_uptime - t_malloc_fail); > -} > - > > >> static void g_bde_delete_sector(struct g_bde_softc *wp, struct >> g_bde_sector *sp); >> static struct g_bde_sector * g_bde_new_sector(struct g_bde_work *wp, >> u_int len); >> static void g_bde_release_keysector(struct g_bde_work *wp); >> @@ -210,7 +224,7 @@ g_bde_get_keysector(struct g_bde_work *wp) >> g_trace(G_T_TOPOLOGY, "g_bde_get_keysector(%p, %jd)", wp, >> (intmax_t)offset); >> sc = wp->softc; >> >> - if (malloc_last_fail() < g_bde_ncache) >> + if (g_bde_malloc_last_fail() < g_bde_ncache) >> g_bde_purge_sector(sc, -1); > > > And in this case, the semantic change renders all of these calls from alway > true to always false expression. > t_malloc_fail value was almost guaranteed to always be 0, so there is no actual change. The hack was put in place so that gbde does not stall work on malloc. gbde itself definitely needs love. > >> >> sp = TAILQ_FIRST(&sc->freelist); >> @@ -228,7 +242,7 @@ g_bde_get_keysector(struct g_bde_work *wp) >> if (sp->ref == 1) >> sp->owner = wp; >> } else { >> - if (malloc_last_fail() < g_bde_ncache) { >> + if (g_bde_malloc_last_fail() < g_bde_ncache) { >> TAILQ_FOREACH(sp, &sc->freelist, list) >> if (sp->ref == 0) >> break; >> @@ -311,7 +325,7 @@ g_bde_purge_sector(struct g_bde_softc *sc, int >> fractio >> if (fraction > 0) >> n = sc->ncache / fraction + 1; >> else >> - n = g_bde_ncache - malloc_last_fail(); >> + n = g_bde_ncache - g_bde_malloc_last_fail(); >> if (n < 0) >> return; >> if (n > sc->ncache) >> _______________________________________________ >> svn-src-head@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-head >> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >> > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Fri Nov 13 01:53:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C807B46AD33; Fri, 13 Nov 2020 01:53:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXM2b5Hzwz51JN; Fri, 13 Nov 2020 01:53:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8343109EE; Fri, 13 Nov 2020 01:53:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AD1rxOj000152; Fri, 13 Nov 2020 01:53:59 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AD1rx7m000151; Fri, 13 Nov 2020 01:53:59 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202011130153.0AD1rx7m000151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 13 Nov 2020 01:53:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367629 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 367629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 01:53:59 -0000 Author: adrian Date: Fri Nov 13 01:53:59 2020 New Revision: 367629 URL: https://svnweb.freebsd.org/changeset/base/367629 Log: [malloc] quieten -Werror=missing-braces with malloc.h wth gcc-6.4 This sets off gcc-6.4 to spit out a 'error: missing braces around initializer' error when compiling this. Remove it as it isn't needed. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D27183 Modified: head/sys/sys/malloc.h Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Thu Nov 12 21:58:47 2020 (r367628) +++ head/sys/sys/malloc.h Fri Nov 13 01:53:59 2020 (r367629) @@ -147,7 +147,6 @@ struct malloc_type_header { .ks_next = NULL, \ .ks_version = M_VERSION, \ .ks_shortdesc = shortdesc, \ - .ks_mti = { 0 }, \ } \ }; \ SYSINIT(type##_init, SI_SUB_KMEM, SI_ORDER_THIRD, malloc_init, \ From owner-svn-src-all@freebsd.org Fri Nov 13 02:05:48 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5CF146B685; Fri, 13 Nov 2020 02:05:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXMJD4vflz52B3; Fri, 13 Nov 2020 02:05:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B362107D9; Fri, 13 Nov 2020 02:05:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AD25mrV006660; Fri, 13 Nov 2020 02:05:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AD25kqZ006647; Fri, 13 Nov 2020 02:05:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011130205.0AD25kqZ006647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Nov 2020 02:05:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367630 - in head/sbin/nvmecontrol: . modules/wdc X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sbin/nvmecontrol: . modules/wdc X-SVN-Commit-Revision: 367630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 02:05:48 -0000 Author: mav Date: Fri Nov 13 02:05:45 2020 New Revision: 367630 URL: https://svnweb.freebsd.org/changeset/base/367630 Log: Improve nvmecontrol error reporting. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sbin/nvmecontrol/comnd.c head/sbin/nvmecontrol/devlist.c head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/format.c head/sbin/nvmecontrol/identify.c head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/modules/wdc/wdc.c head/sbin/nvmecontrol/ns.c head/sbin/nvmecontrol/nvmecontrol.c head/sbin/nvmecontrol/nvmecontrol.h head/sbin/nvmecontrol/passthru.c head/sbin/nvmecontrol/perftest.c head/sbin/nvmecontrol/power.c head/sbin/nvmecontrol/reset.c head/sbin/nvmecontrol/resv.c head/sbin/nvmecontrol/sanitize.c Modified: head/sbin/nvmecontrol/comnd.c ============================================================================== --- head/sbin/nvmecontrol/comnd.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/comnd.c Fri Nov 13 02:05:45 2020 (r367630) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "comnd.h" @@ -77,7 +78,7 @@ gen_usage(const struct cmd *t) SLIST_FOREACH(walker, &t->subcmd, link) { print_usage(walker); } - exit(1); + exit(EX_USAGE); } int @@ -158,7 +159,7 @@ arg_help(int argc __unused, char * const *argv, const fprintf(stderr, "%-30.30s - %s\n", buf, opts[i].descr); } } - exit(1); + exit(EX_USAGE); } static int @@ -188,10 +189,10 @@ arg_parse(int argc, char * const * argv, const struct n++; lopts = malloc((n + 2) * sizeof(struct option)); if (lopts == NULL) - err(1, "option memory"); + err(EX_OSERR, "option memory"); p = shortopts = malloc((2 * n + 3) * sizeof(char)); if (shortopts == NULL) - err(1, "shortopts memory"); + err(EX_OSERR, "shortopts memory"); idx = 0; for (i = 0; i < n; i++) { lopts[i].name = opts[i].long_arg; @@ -279,7 +280,7 @@ bad_arg: fprintf(stderr, "Bad value to --%s: %s\n", opts[idx].long_arg, optarg); free(lopts); free(shortopts); - exit(1); + exit(EX_USAGE); } /* @@ -301,7 +302,7 @@ cmd_load_dir(const char *dir __unused, cmd_load_cb_t c continue; asprintf(&path, "%s/%s", dir, dent->d_name); if (path == NULL) - err(1, "Can't malloc for path, giving up."); + err(EX_OSERR, "Can't malloc for path, giving up."); if ((h = dlopen(path, RTLD_NOW | RTLD_GLOBAL)) == NULL) warnx("Can't load %s: %s", path, dlerror()); else { Modified: head/sbin/nvmecontrol/devlist.c ============================================================================== --- head/sbin/nvmecontrol/devlist.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/devlist.c Fri Nov 13 02:05:45 2020 (r367630) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -102,12 +103,14 @@ devlist(const struct cmd *f, int argc, char *argv[]) continue; found++; - read_controller_data(fd, &cdata); + if (read_controller_data(fd, &cdata)) + continue; nvme_strvis(mn, cdata.mn, sizeof(mn), NVME_MODEL_NUMBER_LENGTH); printf("%6s: %s\n", name, mn); for (i = 0; i < cdata.nn; i++) { - read_namespace_data(fd, i + 1, &nsdata); + if (read_namespace_data(fd, i + 1, &nsdata)) + continue; if (nsdata.nsze == 0) continue; sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr, @@ -124,7 +127,7 @@ devlist(const struct cmd *f, int argc, char *argv[]) if (found == 0) { printf("No NVMe controllers found.\n"); - exit(1); + exit(EX_UNAVAILABLE); } exit(0); Modified: head/sbin/nvmecontrol/firmware.c ============================================================================== --- head/sbin/nvmecontrol/firmware.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/firmware.c Fri Nov 13 02:05:45 2020 (r367630) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -123,9 +124,9 @@ read_image_file(const char *path, void **buf, int32_t *buf = NULL; if ((fd = open(path, O_RDONLY)) < 0) - err(1, "unable to open '%s'", path); + err(EX_NOINPUT, "unable to open '%s'", path); if (fstat(fd, &sb) < 0) - err(1, "unable to stat '%s'", path); + err(EX_NOINPUT, "unable to stat '%s'", path); /* * The NVMe spec does not explicitly state a maximum firmware image @@ -139,16 +140,16 @@ read_image_file(const char *path, void **buf, int32_t * a bit. */ if (sb.st_size > INT32_MAX) - errx(1, "size of file '%s' is too large (%jd bytes)", + errx(EX_USAGE, "size of file '%s' is too large (%jd bytes)", path, (intmax_t)sb.st_size); filesize = (int32_t)sb.st_size; if ((*buf = malloc(filesize)) == NULL) - errx(1, "unable to malloc %d bytes", filesize); + errx(EX_OSERR, "unable to malloc %d bytes", filesize); if ((*size = read(fd, *buf, filesize)) < 0) - err(1, "error reading '%s'", path); + err(EX_IOERR, "error reading '%s'", path); /* XXX assuming no short reads */ if (*size != filesize) - errx(1, + errx(EX_IOERR, "error reading '%s' (read %d bytes, requested %d bytes)", path, *size, filesize); close(fd); @@ -168,12 +169,12 @@ update_firmware(int fd, uint8_t *payload, int32_t payl if (fwug != 0 && fwug != 0xFF) max_xfer_size = ((uint64_t)fwug << 12); else if (ioctl(fd, NVME_GET_MAX_XFER_SIZE, &max_xfer_size) < 0) - err(1, "query max transfer size failed"); + err(EX_IOERR, "query max transfer size failed"); if (max_xfer_size > NVME_MAX_XFER_SIZE) max_xfer_size = NVME_MAX_XFER_SIZE; if ((chunk = aligned_alloc(PAGE_SIZE, max_xfer_size)) == NULL) - errx(1, "unable to malloc %zd bytes", (size_t)max_xfer_size); + errx(EX_OSERR, "unable to malloc %zd bytes", (size_t)max_xfer_size); while (resid > 0) { size = (resid >= (int32_t)max_xfer_size) ? @@ -189,10 +190,10 @@ update_firmware(int fd, uint8_t *payload, int32_t payl pt.is_read = 0; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "firmware download request failed"); + err(EX_IOERR, "firmware download request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "firmware download request returned error"); + errx(EX_IOERR, "firmware download request returned error"); resid -= size; off += size; @@ -212,7 +213,7 @@ activate_firmware(int fd, int slot, int activate_actio pt.is_read = 0; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "firmware activate request failed"); + err(EX_IOERR, "firmware activate request failed"); sct = NVME_STATUS_GET_SCT(pt.cpl.status); sc = NVME_STATUS_GET_SC(pt.cpl.status); @@ -222,7 +223,7 @@ activate_firmware(int fd, int slot, int activate_actio return 1; if (nvme_completion_is_error(&pt.cpl)) - errx(1, "firmware activate request returned error"); + errx(EX_IOERR, "firmware activate request returned error"); return 0; } @@ -278,32 +279,33 @@ firmware(const struct cmd *f, int argc, char *argv[]) } free(path); - read_controller_data(fd, &cdata); + if (read_controller_data(fd, &cdata)) + errx(EX_IOERR, "Identify request failed"); oacs_fw = (cdata.oacs >> NVME_CTRLR_DATA_OACS_FIRMWARE_SHIFT) & NVME_CTRLR_DATA_OACS_FIRMWARE_MASK; if (oacs_fw == 0) - errx(1, + errx(EX_UNAVAILABLE, "controller does not support firmware activate/download"); fw_slot1_ro = (cdata.frmw >> NVME_CTRLR_DATA_FRMW_SLOT1_RO_SHIFT) & NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK; if (opt.fw_img && opt.slot == 1 && fw_slot1_ro) - errx(1, "slot %d is marked as read only", opt.slot); + errx(EX_UNAVAILABLE, "slot %d is marked as read only", opt.slot); fw_num_slots = (cdata.frmw >> NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT) & NVME_CTRLR_DATA_FRMW_NUM_SLOTS_MASK; if (opt.slot > fw_num_slots) - errx(1, + errx(EX_UNAVAILABLE, "slot %d specified but controller only supports %d slots", opt.slot, fw_num_slots); if (opt.activate && opt.fw_img == NULL && !slot_has_valid_firmware(fd, opt.slot)) - errx(1, + errx(EX_UNAVAILABLE, "slot %d does not contain valid firmware,\n" "try 'nvmecontrol logpage -p 3 %s' to get a list " "of available images\n", @@ -336,7 +338,7 @@ firmware(const struct cmd *f, int argc, char *argv[]) if (strncasecmp(prompt, "yes", 3) == 0) break; if (strncasecmp(prompt, "no", 2) == 0) - exit(1); + exit(EX_DATAERR); printf("Please answer \"yes\" or \"no\". "); } Modified: head/sbin/nvmecontrol/format.c ============================================================================== --- head/sbin/nvmecontrol/format.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/format.c Fri Nov 13 02:05:45 2020 (r367630) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -159,29 +160,31 @@ format(const struct cmd *f, int argc, char *argv[]) free(path); /* Check that controller can execute this command. */ - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); if (((cd.oacs >> NVME_CTRLR_DATA_OACS_FORMAT_SHIFT) & NVME_CTRLR_DATA_OACS_FORMAT_MASK) == 0) - errx(1, "controller does not support format"); + errx(EX_UNAVAILABLE, "controller does not support format"); if (((cd.fna >> NVME_CTRLR_DATA_FNA_CRYPTO_ERASE_SHIFT) & NVME_CTRLR_DATA_FNA_CRYPTO_ERASE_MASK) == 0 && ses == SES_CRYPTO) - errx(1, "controller does not support cryptographic erase"); + errx(EX_UNAVAILABLE, "controller does not support cryptographic erase"); if (nsid != NVME_GLOBAL_NAMESPACE_TAG) { if (((cd.fna >> NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT) & NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK) && ses == SES_NONE) - errx(1, "controller does not support per-NS format"); + errx(EX_UNAVAILABLE, "controller does not support per-NS format"); if (((cd.fna >> NVME_CTRLR_DATA_FNA_ERASE_ALL_SHIFT) & NVME_CTRLR_DATA_FNA_ERASE_ALL_MASK) && ses != SES_NONE) - errx(1, "controller does not support per-NS erase"); + errx(EX_UNAVAILABLE, "controller does not support per-NS erase"); /* Try to keep previous namespace parameters. */ - read_namespace_data(fd, nsid, &nsd); + if (read_namespace_data(fd, nsid, &nsd)) + errx(EX_IOERR, "Identify request failed"); if (lbaf < 0) lbaf = (nsd.flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & NVME_NS_DATA_FLBAS_FORMAT_MASK; if (lbaf > nsd.nlbaf) - errx(1, "LBA format is out of range"); + errx(EX_USAGE, "LBA format is out of range"); if (ms < 0) ms = (nsd.flbas >> NVME_NS_DATA_FLBAS_EXTENDED_SHIFT) & NVME_NS_DATA_FLBAS_EXTENDED_MASK; @@ -211,10 +214,10 @@ format(const struct cmd *f, int argc, char *argv[]) (ms << 4) + lbaf); if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "format request failed"); + err(EX_IOERR, "format request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "format request returned error"); + errx(EX_IOERR, "format request returned error"); close(fd); exit(0); } Modified: head/sbin/nvmecontrol/identify.c ============================================================================== --- head/sbin/nvmecontrol/identify.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/identify.c Fri Nov 13 02:05:45 2020 (r367630) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -191,7 +192,8 @@ identify_ctrlr(int fd) struct nvme_controller_data cdata; int hexlength; - read_controller_data(fd, &cdata); + if (read_controller_data(fd, &cdata)) + errx(EX_IOERR, "Identify request failed"); close(fd); if (opt.hex) { @@ -214,7 +216,8 @@ identify_ns(int fd, uint32_t nsid) struct nvme_namespace_data nsdata; int hexlength; - read_namespace_data(fd, nsid, &nsdata); + if (read_namespace_data(fd, nsid, &nsdata)) + errx(EX_IOERR, "Identify request failed"); close(fd); if (opt.hex) { Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/logpage.c Fri Nov 13 02:05:45 2020 (r367630) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -183,7 +184,7 @@ get_log_buffer(uint32_t size) void *buf; if ((buf = malloc(size)) == NULL) - errx(1, "unable to malloc %u bytes", size); + errx(EX_OSERR, "unable to malloc %u bytes", size); memset(buf, 0, size); return (buf); @@ -217,7 +218,7 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "get log page request failed"); + err(EX_IOERR, "get log page request failed"); /* Convert data to host endian */ switch (log_page) { @@ -259,7 +260,7 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, } if (nvme_completion_is_error(&pt.cpl)) - errx(1, "get log page request returned error"); + errx(EX_IOERR, "get log page request returned error"); } static void @@ -659,7 +660,7 @@ logpage_help(void) fprintf(stderr, "0x%02x %-10s %s\n", f->log_page, v, f->name); } - exit(1); + exit(EX_USAGE); } static void @@ -697,7 +698,8 @@ logpage(const struct cmd *f, int argc, char *argv[]) } free(path); - read_controller_data(fd, &cdata); + if (read_controller_data(fd, &cdata)) + errx(EX_IOERR, "Identify request failed"); ns_smart = (cdata.lpa >> NVME_CTRLR_DATA_LPA_NS_SMART_SHIFT) & NVME_CTRLR_DATA_LPA_NS_SMART_MASK; @@ -709,10 +711,10 @@ logpage(const struct cmd *f, int argc, char *argv[]) */ if (nsid != NVME_GLOBAL_NAMESPACE_TAG) { if (opt.page != NVME_LOG_HEALTH_INFORMATION) - errx(1, "log page %d valid only at controller level", + errx(EX_USAGE, "log page %d valid only at controller level", opt.page); if (ns_smart == 0) - errx(1, + errx(EX_UNAVAILABLE, "controller does not support per namespace " "smart/health information"); } Modified: head/sbin/nvmecontrol/modules/wdc/wdc.c ============================================================================== --- head/sbin/nvmecontrol/modules/wdc/wdc.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/modules/wdc/wdc.c Fri Nov 13 02:05:45 2020 (r367630) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -123,7 +124,8 @@ wdc_append_serial_name(int fd, char *buf, size_t len, len -= strlen(buf); buf += strlen(buf); - read_controller_data(fd, &cdata); + if (read_controller_data(fd, &cdata)) + errx(EX_IOERR, "Identify request failed"); memcpy(sn, cdata.sn, NVME_SERIAL_NUMBER_LENGTH); walker = sn + NVME_SERIAL_NUMBER_LENGTH - 1; while (walker > sn && *walker == ' ') @@ -151,9 +153,9 @@ wdc_get_data(int fd, uint32_t opcode, uint32_t len, ui pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "wdc_get_data request failed"); + err(EX_IOERR, "wdc_get_data request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "wdc_get_data request returned error"); + errx(EX_IOERR, "wdc_get_data request returned error"); } static void @@ -174,7 +176,7 @@ wdc_do_dump_e6(int fd, char *tmpl, const char *suffix, offset = 0; hdr = malloc(len); if (hdr == NULL) - errx(1, "Can't get buffer to read dump"); + errx(EX_OSERR, "Can't get buffer to read dump"); wdc_get_data(fd, opcode, len, offset, cmd, hdr, len, false); if (memcmp("E6LG", hdr, 4) == 0) { e6lg_flag = true; @@ -183,10 +185,10 @@ wdc_do_dump_e6(int fd, char *tmpl, const char *suffix, /* XXX overwrite protection? */ fd2 = open(tmpl, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd2 < 0) - err(1, "open %s", tmpl); + err(EX_CANTCREAT, "open %s", tmpl); buf = aligned_alloc(PAGE_SIZE, NVME_MAX_XFER_SIZE); if (buf == NULL) - errx(1, "Can't get buffer to read dump"); + errx(EX_OSERR, "Can't get buffer to read dump"); offset = 0; len = NVME_MAX_XFER_SIZE; first = 1; @@ -198,7 +200,7 @@ wdc_do_dump_e6(int fd, char *tmpl, const char *suffix, if (first) { len = be32dec(buf + len_off); if (len == 0) - errx(1, "No data for %s", suffix); + errx(EX_PROTOCOL, "No data for %s", suffix); printf("Dumping %d bytes of version %d.%d log to %s\n", len, buf[8], buf[9], tmpl); @@ -212,7 +214,7 @@ wdc_do_dump_e6(int fd, char *tmpl, const char *suffix, first = 0; } if (write(fd2, buf, resid) != (ssize_t)resid) - err(1, "write"); + err(EX_IOERR, "write"); offset += resid; len -= resid; } while (len > 0); @@ -238,9 +240,9 @@ wdc_get_data_dui(int fd, uint32_t opcode, uint32_t len pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "wdc_get_data_dui request failed"); + err(EX_IOERR, "wdc_get_data_dui request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "wdc_get_data_dui request returned error"); + errx(EX_IOERR, "wdc_get_data_dui request returned error"); } static uint8_t @@ -274,7 +276,7 @@ wdc_get_dui_log_size(int fd, uint32_t opcode, uint8_t len = 1024; hdr = (uint8_t*)malloc(len); if (hdr == NULL) - errx(1, "Can't get buffer to read header"); + errx(EX_OSERR, "Can't get buffer to read header"); wdc_get_data_dui(fd, opcode, len, 0, hdr, len); hdr += len_off; @@ -307,7 +309,7 @@ wdc_get_dui_log_size(int fd, uint32_t opcode, uint8_t } } else - errx(1, "ERROR : No valid header "); + errx(EX_PROTOCOL, "ERROR : No valid header "); *log_size = dui_size; free(hdr); @@ -326,13 +328,13 @@ wdc_do_dump_dui(int fd, char *tmpl, uint8_t data_area, wdc_append_serial_name(fd, tmpl, MAXPATHLEN, suffix); wdc_get_dui_log_size(fd, opcode, data_area, &log_len, len_off); if (log_len == 0) - errx(1, "No data for %s", suffix); + errx(EX_PROTOCOL, "No data for %s", suffix); fd2 = open(tmpl, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd2 < 0) - err(1, "open %s", tmpl); + err(EX_CANTCREAT, "open %s", tmpl); buf = aligned_alloc(PAGE_SIZE, NVME_MAX_XFER_SIZE); if (buf == NULL) - errx(1, "Can't get buffer to read dump"); + errx(EX_OSERR, "Can't get buffer to read dump"); offset = 0; first = 1; @@ -347,7 +349,7 @@ wdc_do_dump_dui(int fd, char *tmpl, uint8_t data_area, first = 0; } if (write(fd2, buf, resid) != (ssize_t)resid) - err(1, "write"); + err(EX_IOERR, "write"); offset += resid; log_len -= resid; } @@ -376,7 +378,8 @@ wdc_cap_diag(const struct cmd *f, int argc, char *argv } strlcpy(tmpl, opt.template, sizeof(tmpl)); open_dev(opt.dev, &fd, 1, 1); - read_controller_data(fd, &cdata); + if (read_controller_data(fd, &cdata)) + errx(EX_IOERR, "Identify request failed"); vid = cdata.vid; switch (vid) { @@ -390,11 +393,10 @@ wdc_cap_diag(const struct cmd *f, int argc, char *argv WDC_NVME_CAP_DIAG_OPCODE_FA, 512); break; default: - errx(1, "ERROR : WDC: unsupported device (%#x) for this command", vid); + errx(EX_UNAVAILABLE, "ERROR : WDC: unsupported device (%#x) for this command", vid); } close(fd); - - exit(1); + exit(0); } static void Modified: head/sbin/nvmecontrol/ns.c ============================================================================== --- head/sbin/nvmecontrol/ns.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/ns.c Fri Nov 13 02:05:45 2020 (r367630) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -414,12 +415,13 @@ nsactive(const struct cmd *f, int argc, char *argv[]) open_dev(path, &fd, 0, 1); } free(path); - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); memset(&pt, 0, sizeof(pt)); pt.cmd.opc = NVME_OPC_IDENTIFY; @@ -429,9 +431,9 @@ nsactive(const struct cmd *f, int argc, char *argv[]) pt.len = sizeof(list); pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + err(EX_IOERR, "identify request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + errx(EX_IOERR, "identify request returned error"); printf("Active namespaces:\n"); for (i = 0; list[i] != 0; i++) @@ -459,12 +461,13 @@ nsallocated(const struct cmd *f, int argc, char *argv[ open_dev(path, &fd, 0, 1); } free(path); - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); memset(&pt, 0, sizeof(pt)); pt.cmd.opc = NVME_OPC_IDENTIFY; @@ -474,9 +477,9 @@ nsallocated(const struct cmd *f, int argc, char *argv[ pt.len = sizeof(list); pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + err(EX_IOERR, "identify request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + errx(EX_IOERR, "identify request returned error"); printf("Allocated namespaces:\n"); for (i = 0; list[i] != 0; i++) @@ -504,12 +507,13 @@ nscontrollers(const struct cmd *f, int argc, char *arg open_dev(path, &fd, 0, 1); } free(path); - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); memset(&pt, 0, sizeof(pt)); pt.cmd.opc = NVME_OPC_IDENTIFY; @@ -518,9 +522,9 @@ nscontrollers(const struct cmd *f, int argc, char *arg pt.len = sizeof(clist); pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + err(EX_IOERR, "identify request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + errx(EX_IOERR, "identify request returned error"); n = le16toh(clist[0]); printf("NVM subsystem includes %d controller(s):\n", n); @@ -565,12 +569,13 @@ nscreate(const struct cmd *f, int argc, char *argv[]) open_dev(path, &fd, 1, 1); } free(path); - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); /* Allow namespaces sharing if Multi-Path I/O is supported. */ if (create_opt.nmic == NONE) { @@ -605,10 +610,10 @@ nscreate(const struct cmd *f, int argc, char *argv[]) pt.len = sizeof(struct nvme_namespace_data); pt.is_read = 0; /* passthrough writes data to ctrlr */ if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0) - errx(1, "ioctl request to %s failed: %d", create_opt.dev, result); + errx(EX_IOERR, "ioctl request to %s failed: %d", create_opt.dev, result); if (nvme_completion_is_error(&pt.cpl)) { - errx(1, "namespace creation failed: %s", + errx(EX_IOERR, "namespace creation failed: %s", get_res_str((pt.cpl.status >> NVME_STATUS_SC_SHIFT) & NVME_STATUS_SC_MASK)); } @@ -642,12 +647,13 @@ nsdelete(const struct cmd *f, int argc, char *argv[]) if (delete_opt.nsid != NONE) nsid = delete_opt.nsid; free(path); - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); memset(&pt, 0, sizeof(pt)); pt.cmd.opc = NVME_OPC_NAMESPACE_MANAGEMENT; @@ -658,10 +664,10 @@ nsdelete(const struct cmd *f, int argc, char *argv[]) pt.cmd.nsid = nsid; if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0) - errx(1, "ioctl request to %s failed: %d", delete_opt.dev, result); + errx(EX_IOERR, "ioctl request to %s failed: %d", delete_opt.dev, result); if (nvme_completion_is_error(&pt.cpl)) { - errx(1, "namespace deletion failed: %s", + errx(EX_IOERR, "namespace deletion failed: %s", get_res_str((pt.cpl.status >> NVME_STATUS_SC_SHIFT) & NVME_STATUS_SC_MASK)); } @@ -708,12 +714,13 @@ nsattach(const struct cmd *f, int argc, char *argv[]) } if (attach_opt.nsid != NONE) nsid = attach_opt.nsid; - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); if (attach_opt.ctrlrid == NONE) { /* Get full list of controllers to attach to. */ @@ -724,9 +731,9 @@ nsattach(const struct cmd *f, int argc, char *argv[]) pt.len = sizeof(clist); pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + err(EX_IOERR, "identify request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + errx(EX_IOERR, "identify request returned error"); } else { /* By default attach to this controller. */ if (attach_opt.ctrlrid == NONE - 1) @@ -744,10 +751,10 @@ nsattach(const struct cmd *f, int argc, char *argv[]) pt.len = sizeof(clist); if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0) - errx(1, "ioctl request to %s failed: %d", attach_opt.dev, result); + errx(EX_IOERR, "ioctl request to %s failed: %d", attach_opt.dev, result); if (nvme_completion_is_error(&pt.cpl)) { - errx(1, "namespace attach failed: %s", + errx(EX_IOERR, "namespace attach failed: %s", get_res_str((pt.cpl.status >> NVME_STATUS_SC_SHIFT) & NVME_STATUS_SC_MASK)); } @@ -779,12 +786,13 @@ nsdetach(const struct cmd *f, int argc, char *argv[]) } if (detach_opt.nsid != NONE) nsid = detach_opt.nsid; - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); if (detach_opt.ctrlrid == NONE) { /* Get list of controllers this namespace attached to. */ @@ -796,9 +804,9 @@ nsdetach(const struct cmd *f, int argc, char *argv[]) pt.len = sizeof(clist); pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + err(EX_IOERR, "identify request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + errx(EX_IOERR, "identify request returned error"); if (clist[0] == 0) { detach_opt.ctrlrid = cd.ctrlr_id; memset(&clist, 0, sizeof(clist)); @@ -822,10 +830,10 @@ nsdetach(const struct cmd *f, int argc, char *argv[]) pt.len = sizeof(clist); if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0) - errx(1, "ioctl request to %s failed: %d", detach_opt.dev, result); + errx(EX_IOERR, "ioctl request to %s failed: %d", detach_opt.dev, result); if (nvme_completion_is_error(&pt.cpl)) { - errx(1, "namespace detach failed: %s", + errx(EX_IOERR, "namespace detach failed: %s", get_res_str((pt.cpl.status >> NVME_STATUS_SC_SHIFT) & NVME_STATUS_SC_MASK)); } @@ -857,12 +865,13 @@ nsattached(const struct cmd *f, int argc, char *argv[] } if (attached_opt.nsid != NONE) nsid = attached_opt.nsid; - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); memset(&pt, 0, sizeof(pt)); pt.cmd.opc = NVME_OPC_IDENTIFY; @@ -872,9 +881,9 @@ nsattached(const struct cmd *f, int argc, char *argv[] pt.len = sizeof(clist); pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + err(EX_IOERR, "identify request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + errx(EX_IOERR, "identify request returned error"); n = le16toh(clist[0]); printf("Attached %d controller(s):\n", n); @@ -910,12 +919,13 @@ nsidentify(const struct cmd *f, int argc, char *argv[] } if (identify_opt.nsid != NONE) nsid = identify_opt.nsid; - read_controller_data(fd, &cd); + if (read_controller_data(fd, &cd)) + errx(EX_IOERR, "Identify request failed"); /* Check that controller can execute this command. */ if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0) - errx(1, "controller does not support namespace management"); + errx(EX_UNAVAILABLE, "controller does not support namespace management"); memset(&pt, 0, sizeof(pt)); pt.cmd.opc = NVME_OPC_IDENTIFY; @@ -926,10 +936,10 @@ nsidentify(const struct cmd *f, int argc, char *argv[] pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + err(EX_IOERR, "identify request failed"); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + errx(EX_IOERR, "identify request returned error"); close(fd); @@ -939,7 +949,7 @@ nsidentify(const struct cmd *f, int argc, char *argv[] break; } if (i == sizeof(nsdata)) - errx(1, "namespace %d is not allocated", nsid); + errx(EX_UNAVAILABLE, "namespace %d is not allocated", nsid); /* Convert data to host endian */ nvme_namespace_data_swapbytes(&nsdata); Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/nvmecontrol.c Fri Nov 13 02:05:45 2020 (r367630) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -96,7 +97,7 @@ print_hex(void *data, uint32_t length) print_bytes(data, length); } -void +int read_controller_data(int fd, struct nvme_controller_data *cdata) { struct nvme_pt_command pt; @@ -109,16 +110,17 @@ read_controller_data(int fd, struct nvme_controller_da pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + return (errno); /* Convert data to host endian */ nvme_controller_data_swapbytes(cdata); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + return (EIO); + return (0); } -void +int read_namespace_data(int fd, uint32_t nsid, struct nvme_namespace_data *nsdata) { struct nvme_pt_command pt; @@ -132,13 +134,14 @@ read_namespace_data(int fd, uint32_t nsid, struct nvme pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "identify request failed"); + return (errno); /* Convert data to host endian */ nvme_namespace_data_swapbytes(nsdata); if (nvme_completion_is_error(&pt.cpl)) - errx(1, "identify request returned error"); + return (EIO); + return (0); } int @@ -150,7 +153,7 @@ open_dev(const char *str, int *fd, int write, int exit *fd = open(full_path, write ? O_RDWR : O_RDONLY); if (*fd < 0) { if (exit_on_error) { - err(1, "could not open %s%s", full_path, + err(EX_OSFILE, "could not open %s%s", full_path, write ? " for write" : ""); } else return (errno); @@ -165,7 +168,7 @@ get_nsid(int fd, char **ctrlr_str, uint32_t *nsid) struct nvme_get_nsid gnsid; if (ioctl(fd, NVME_GET_NSID, &gnsid) < 0) - err(1, "NVME_GET_NSID ioctl failed"); + err(EX_OSERR, "NVME_GET_NSID ioctl failed"); if (ctrlr_str != NULL) *ctrlr_str = strndup(gnsid.cdev, sizeof(gnsid.cdev)); if (nsid != NULL) Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/nvmecontrol.h Fri Nov 13 02:05:45 2020 (r367630) @@ -70,8 +70,8 @@ void logpage_register(struct logpage_function *p); int open_dev(const char *str, int *fd, int write, int exit_on_error); void get_nsid(int fd, char **ctrlr_str, uint32_t *nsid); -void read_controller_data(int fd, struct nvme_controller_data *cdata); -void read_namespace_data(int fd, uint32_t nsid, struct nvme_namespace_data *nsdata); +int read_controller_data(int fd, struct nvme_controller_data *cdata); +int read_namespace_data(int fd, uint32_t nsid, struct nvme_namespace_data *nsdata); void print_hex(void *data, uint32_t length); void print_namespace(struct nvme_namespace_data *nsdata); void read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, Modified: head/sbin/nvmecontrol/passthru.c ============================================================================== --- head/sbin/nvmecontrol/passthru.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/passthru.c Fri Nov 13 02:05:45 2020 (r367630) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -167,9 +168,9 @@ passthru(const struct cmd *f, int argc, char *argv[]) open_dev(opt.dev, &fd, 1, 1); if (opt.read && opt.write) - errx(1, "need exactly one of --read or --write"); + errx(EX_USAGE, "need exactly one of --read or --write"); if (opt.data_len != 0 && !opt.read && !opt.write) - errx(1, "need exactly one of --read or --write"); + errx(EX_USAGE, "need exactly one of --read or --write"); if (*opt.ifn && (ifd = open(opt.ifn, O_RDONLY)) == -1) { warn("open %s", opt.ifn); goto cleanup; @@ -183,7 +184,7 @@ passthru(const struct cmd *f, int argc, char *argv[]) } #else if (opt.metadata_len != 0) - errx(1, "metadata not supported on FreeBSD"); + errx(EX_UNAVAILABLE, "metadata not supported on FreeBSD"); #endif if (opt.data_len) { if (posix_memalign(&data, getpagesize(), opt.data_len)) { @@ -244,7 +245,7 @@ passthru(const struct cmd *f, int argc, char *argv[]) errno = 0; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) - err(1, "passthrough request failed"); + err(EX_IOERR, "passthrough request failed"); /* XXX report status */ if (opt.read) { if (opt.binary) @@ -260,7 +261,7 @@ cleanup: if (ifd > -1) close(ifd); if (errno) - exit(1); + exit(EX_IOERR); } static void Modified: head/sbin/nvmecontrol/perftest.c ============================================================================== --- head/sbin/nvmecontrol/perftest.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/perftest.c Fri Nov 13 02:05:45 2020 (r367630) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -180,7 +181,7 @@ perftest(const struct cmd *f, int argc, char *argv[]) io_test.size = opt.size; open_dev(opt.dev, &fd, 1, 1); if (ioctl(fd, ioctl_cmd, &io_test) < 0) - err(1, "ioctl NVME_IO_TEST failed"); + err(EX_IOERR, "ioctl NVME_IO_TEST failed"); close(fd); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 13 03:43:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BE7146DB0A for ; Fri, 13 Nov 2020 03:43:58 +0000 (UTC) (envelope-from LTJVRYG84_npai+svn-src-all=freebsd.org.102150176@loursonblanc-news.com) Received: from loursonblanc-news.com (loursonblanc-news.com [62.4.26.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXPTT1NPCz56kT for ; Fri, 13 Nov 2020 03:43:57 +0000 (UTC) (envelope-from LTJVRYG84_npai+svn-src-all=freebsd.org.102150176@loursonblanc-news.com) Received: from LTJVRYG84 (localhost [127.0.0.1]) by loursonblanc-news.com (Postfix) with SMTP id D4D011E0B96 for ; Fri, 13 Nov 2020 04:43:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=loursonblanc-news.com; s=oxidkim; t=1605239027; bh=ND56WfR3+OGnyxrWsZNSk35hEczURChnh/DKnmhl+jI=; h=List-Unsubscribe:From:To:Subject:Date:From; b=IeiwFON6zVJHsY6s430GO+OjFbfL5AZM5XYgnzIoc9Ou5+Bf8ijTjd/NDuESoanjo fCTBsOLMOxZZ2A+OD5OWhIAwytmIL+A4I1yQKmJ0ueG1Y7puYRJOSe/bWwgiOTwWko f/bTAN+Hgr43F+xJjMAJJtybyMuN5yARjvOtl+77e98yc03lvZe0zDjYhgZ5Ix0KfG /7gR6KHUEpVgj/hmG/GWa9jROap7vT4ynhIdEitRHzPB4iYSUzlAAsvPavWv+YFlt3 +dHiYQBEovs+6rhOY4RZTMLcxslXByRGV+YF8h5sNK8OCINSMKtc9eN+iPyku+XZsv tKRluy2vd8L0A== X-MessageId: 768474868289715652||8386784583826745657676647082696966836846798271||102150176||8||768474868289715652 Message-ID: From: "Dominique" To: Subject: Information pour novembre Date: Fri, 13 Nov 2020 04:42:49 +0100 X-Mailer: OxiMailing 8.5.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 4CXPTT1NPCz56kT X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=loursonblanc-news.com header.s=oxidkim header.b=IeiwFON6; dmarc=pass (policy=none) header.from=loursonblanc-news.com; spf=pass (mx1.freebsd.org: domain of LTJVRYG84_npai@loursonblanc-news.com designates 62.4.26.69 as permitted sender) smtp.mailfrom=LTJVRYG84_npai@loursonblanc-news.com X-Spamd-Result: default: False [-1.56 / 15.00]; ZERO_FONT(0.10)[1]; R_SPF_ALLOW(-0.20)[+a]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[loursonblanc-news.com:+]; DMARC_POLICY_ALLOW(-0.50)[loursonblanc-news.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[contact@loursonblanc-news.com,LTJVRYG84_npai@loursonblanc-news.com]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:12876, ipnet:62.4.0.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[svn-src-all=freebsd.org.102150176]; FROM_NEQ_ENVFROM(0.00)[contact@loursonblanc-news.com,LTJVRYG84_npai@loursonblanc-news.com]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[loursonblanc-news.com:s=oxidkim]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; HTML_SHORT_LINK_IMG_1(2.00)[]; MIME_GOOD(-0.10)[multipart/related,multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; MANY_INVISIBLE_PARTS(0.05)[1]; RWL_MAILSPIKE_VERYGOOD(0.00)[62.4.26.69:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all] Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 03:43:58 -0000 En cette p=C3=A9riode..=2E Si vous ne voyez pas ce message correctement, [consultez-le en ligne] = (https://loursonblanc-news.com/c6.php?ec=3D2&l=3Df4iAuoK8eG9n&i=3DZGRolWWTY= m5p&t=3DZQ&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGafn9qko9Ggmc6V= 05Rg0Zir15KYpqRjr7Z9ioi9d5tlZmxonXNppXV7lnqcd2eadm2dm3p9aXiomXR1bJ12k2Rukma= YYKDKog&v=3D8)=2E Bonjour, En cette p=C3=A9riode de crise sanitaire, prendre soin de ses clients, = partenaires et salari=C3=A9s fait partie des priorit=C3=A9s de toute = entreprise.=20 Avez-vous besoin de masques jetables pour prot=C3=A9ger vos clients & = collaborateurs ? Nous vous proposons des Masques certif=C3=A9s: - Type 1, 2R et enfants =C3=80 partir de 0.09 =E2=82=AC HT pi=C3=A8ce (pour les grandes quantit=C3=A9s) livrables imm=C3=A9diatement Pas d=E2=80=99acompte Paiement int=C3=A9gral apr=C3=A8s la livraison=2E [(image)] = (https://loursonblanc-news.com/c6.php?ec=3D2&l=3Df4iAuoK8eG9n&i=3DZGRolWWTY= m5p&t=3DZA&e=3DpqqkkaPVlGSUnNFyltSXnMSnyV+i1Zo&u=3Dm6iq1KOdYGaXn9KbnsujrMd0= 0aCo1aaj0sahmKWXkcil&v=3D8) [Demandez un devis : cliquez-ici] = (mailto:thierry@createurdevisite.fr?subject=3DEn%20savoir%20plus%20sur%20le= s%20masques%20chirurgicaux&body=3DIndiquez-nous%20le%20type%20et%20nombre%2= 0de%20masques.%0D%0A%0D%0AVous%20recevrez%20imm%C3%A9diatement%20un%20devis= %20%3A%20%0D%0A%0D%0AType%20%3A%0D%0A) Ou r=C3=A9pondez simplement =C3=A0 ce mail =C3=80 votre disposition=2E Tr=C3=A8s cordialement, DOMINIQUE DRUON +33 6 24 62 55 85 [dominique@loursonblanc.fr] (mailto:dominique@loursonblanc.fr) L=E2=80=99Ourson Blanc Livraison partout Europe et Domtom 59 bis rue des Poutrains=20 59200 Tourcoing Siret : 82746685500018 Si vous ne souhaitez plus recevoir nos messages, suivez ce lien : [Veuillez me retirer de votre liste de diffusion] = (https://loursonblanc-news.com/d6.php?ec=3D2&l=3Df4iAuoK8eG9n&e=3DpqqkkaPVl= GSUnNFyltSXnMSnyV+i1Zo&i=3DZGRolWWTYm5p&v=3D8) From owner-svn-src-all@freebsd.org Fri Nov 13 09:31:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9E1A2D3CB2; Fri, 13 Nov 2020 09:31:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXYC24qXTz3Q6H; Fri, 13 Nov 2020 09:31:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9872516319; Fri, 13 Nov 2020 09:31:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AD9Vwb3082845; Fri, 13 Nov 2020 09:31:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AD9VwBL082843; Fri, 13 Nov 2020 09:31:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011130931.0AD9VwBL082843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 13 Nov 2020 09:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367631 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 09:31:58 -0000 Author: kib Date: Fri Nov 13 09:31:57 2020 New Revision: 367631 URL: https://svnweb.freebsd.org/changeset/base/367631 Log: Implement vn_lock_pair(). In collaboration with: pho Reviewed by: mckusick (previous version), markj (previous version) Tested by: markj (syzkaller), pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26136 Modified: head/sys/kern/vfs_vnops.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Fri Nov 13 02:05:45 2020 (r367630) +++ head/sys/kern/vfs_vnops.c Fri Nov 13 09:31:57 2020 (r367631) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -275,6 +276,10 @@ restart: vn_finished_write(mp); if (error) { NDFREE(ndp, NDF_ONLY_PNBUF); + if (error == ERELOOKUP) { + NDREINIT(ndp); + goto restart; + } return (error); } fmode &= ~O_TRUNC; @@ -1524,6 +1529,7 @@ vn_truncate(struct file *fp, off_t length, struct ucre vp = fp->f_vnode; +retry: /* * Lock the whole range for truncation. Otherwise split i/o * might happen partly before and partly after the truncation. @@ -1550,6 +1556,8 @@ out: vn_finished_write(mp); out1: vn_rangelock_unlock(vp, rl_cookie); + if (error == ERELOOKUP) + goto retry; return (error); } @@ -3317,4 +3325,92 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, } return (error); +} + +static u_long vn_lock_pair_pause_cnt; +SYSCTL_ULONG(_debug, OID_AUTO, vn_lock_pair_pause, CTLFLAG_RD, + &vn_lock_pair_pause_cnt, 0, + "Count of vn_lock_pair deadlocks"); + +static void +vn_lock_pair_pause(const char *wmesg) +{ + atomic_add_long(&vn_lock_pair_pause_cnt, 1); + pause(wmesg, prng32_bounded(hz / 10)); +} + +/* + * Lock pair of vnodes vp1, vp2, avoiding lock order reversal. + * vp1_locked indicates whether vp1 is exclusively locked; if not, vp1 + * must be unlocked. Same for vp2 and vp2_locked. One of the vnodes + * can be NULL. + * + * The function returns with both vnodes exclusively locked, and + * guarantees that it does not create lock order reversal with other + * threads during its execution. Both vnodes could be unlocked + * temporary (and reclaimed). + */ +void +vn_lock_pair(struct vnode *vp1, bool vp1_locked, struct vnode *vp2, + bool vp2_locked) +{ + int error; + + if (vp1 == NULL && vp2 == NULL) + return; + if (vp1 != NULL) { + if (vp1_locked) + ASSERT_VOP_ELOCKED(vp1, "vp1"); + else + ASSERT_VOP_UNLOCKED(vp1, "vp1"); + } else { + vp1_locked = true; + } + if (vp2 != NULL) { + if (vp2_locked) + ASSERT_VOP_ELOCKED(vp2, "vp2"); + else + ASSERT_VOP_UNLOCKED(vp2, "vp2"); + } else { + vp2_locked = true; + } + if (!vp1_locked && !vp2_locked) { + vn_lock(vp1, LK_EXCLUSIVE | LK_RETRY); + vp1_locked = true; + } + + for (;;) { + if (vp1_locked && vp2_locked) + break; + if (vp1_locked && vp2 != NULL) { + if (vp1 != NULL) { + error = VOP_LOCK1(vp2, LK_EXCLUSIVE | LK_NOWAIT, + __FILE__, __LINE__); + if (error == 0) + break; + VOP_UNLOCK(vp1); + vp1_locked = false; + vn_lock_pair_pause("vlp1"); + } + vn_lock(vp2, LK_EXCLUSIVE | LK_RETRY); + vp2_locked = true; + } + if (vp2_locked && vp1 != NULL) { + if (vp2 != NULL) { + error = VOP_LOCK1(vp1, LK_EXCLUSIVE | LK_NOWAIT, + __FILE__, __LINE__); + if (error == 0) + break; + VOP_UNLOCK(vp2); + vp2_locked = false; + vn_lock_pair_pause("vlp2"); + } + vn_lock(vp1, LK_EXCLUSIVE | LK_RETRY); + vp1_locked = true; + } + } + if (vp1 != NULL) + ASSERT_VOP_ELOCKED(vp1, "vp1 ret"); + if (vp2 != NULL) + ASSERT_VOP_ELOCKED(vp2, "vp2 ret"); } Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Fri Nov 13 02:05:45 2020 (r367630) +++ head/sys/sys/vnode.h Fri Nov 13 09:31:57 2020 (r367631) @@ -729,6 +729,8 @@ bool vn_isdisk_error(struct vnode *vp, int *errp); bool vn_isdisk(struct vnode *vp); int _vn_lock(struct vnode *vp, int flags, const char *file, int line); #define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__) +void vn_lock_pair(struct vnode *vp1, bool vp1_locked, struct vnode *vp2, + bool vp2_locked); int vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp); int vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags, struct ucred *cred, struct file *fp); From owner-svn-src-all@freebsd.org Fri Nov 13 09:42:33 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F12652D4F6F; Fri, 13 Nov 2020 09:42:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXYRF6Q39z3gyV; Fri, 13 Nov 2020 09:42:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEFD2160D8; Fri, 13 Nov 2020 09:42:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AD9gXCL090590; Fri, 13 Nov 2020 09:42:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AD9gWim090587; Fri, 13 Nov 2020 09:42:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011130942.0AD9gWim090587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 13 Nov 2020 09:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367632 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 09:42:34 -0000 Author: kib Date: Fri Nov 13 09:42:32 2020 New Revision: 367632 URL: https://svnweb.freebsd.org/changeset/base/367632 Log: Allow some VOPs to return ERELOOKUP to indicate VFS operation restart at top level. Restart syscalls and some sync operations when filesystem indicated ERELOOKUP condition, mostly for VOPs operating on metdata. In particular, lookup results cached in the inode/v_data is no longer valid and needs recalculating. Right now this should be nop. Assert that ERELOOKUP is catched everywhere and not returned to userspace, by asserting that td_errno != ERELOOKUP on syscall return path. In collaboration with: pho Reviewed by: mckusick (previous version), markj Tested by: markj (syzkaller), pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26136 Modified: head/sys/kern/subr_syscall.c head/sys/kern/uipc_usrreq.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Fri Nov 13 09:31:57 2020 (r367631) +++ head/sys/kern/subr_syscall.c Fri Nov 13 09:42:32 2020 (r367632) @@ -217,6 +217,8 @@ syscallret(struct thread *td) KASSERT((td->td_pflags & TDP_FORKING) == 0, ("fork() did not clear TDP_FORKING upon completion")); + KASSERT(td->td_errno != ERELOOKUP, + ("ERELOOKUP not consumed syscall %d", td->td_sa.code)); p = td->td_proc; sa = &td->td_sa; Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Fri Nov 13 09:31:57 2020 (r367631) +++ head/sys/kern/uipc_usrreq.c Fri Nov 13 09:42:32 2020 (r367632) @@ -671,6 +671,8 @@ restart: vput(nd.ni_dvp); if (error) { vn_finished_write(mp); + if (error == ERELOOKUP) + goto restart; goto error; } vp = nd.ni_vp; Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Nov 13 09:31:57 2020 (r367631) +++ head/sys/kern/vfs_subr.c Fri Nov 13 09:42:32 2020 (r367632) @@ -1937,7 +1937,10 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpf } if (bo->bo_dirty.bv_cnt > 0) { BO_UNLOCK(bo); - if ((error = BO_SYNC(bo, MNT_WAIT)) != 0) + do { + error = BO_SYNC(bo, MNT_WAIT); + } while (error == ERELOOKUP); + if (error != 0) return (error); /* * XXX We could save a lock/unlock if this was only @@ -3678,7 +3681,9 @@ loop: vm_object_page_clean(vp->v_object, 0, 0, 0); VM_OBJECT_WUNLOCK(vp->v_object); } - error = VOP_FSYNC(vp, MNT_WAIT, td); + do { + error = VOP_FSYNC(vp, MNT_WAIT, td); + } while (error == ERELOOKUP); if (error != 0) { VOP_UNLOCK(vp); vdrop(vp); Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Fri Nov 13 09:31:57 2020 (r367631) +++ head/sys/kern/vfs_syscalls.c Fri Nov 13 09:42:32 2020 (r367632) @@ -1384,6 +1384,8 @@ restart: NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); vn_finished_write(mp); + if (error == ERELOOKUP) + goto restart; return (error); } @@ -1470,6 +1472,8 @@ out: vput(nd.ni_dvp); vn_finished_write(mp); NDFREE(&nd, NDF_ONLY_PNBUF); + if (error == ERELOOKUP) + goto restart; return (error); } @@ -1568,7 +1572,7 @@ kern_linkat(struct thread *td, int fd1, int fd2, const return (error); NDFREE(&nd, NDF_ONLY_PNBUF); error = kern_linkat_vp(td, nd.ni_vp, fd2, path2, segflag); - } while (error == EAGAIN); + } while (error == EAGAIN || error == ERELOOKUP); return (error); } @@ -1741,6 +1745,8 @@ out2: NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); vn_finished_write(mp); + if (error == ERELOOKUP) + goto restart; out: if (segflg != UIO_SYSSPACE) uma_zfree(namei_zone, tmppath); @@ -1791,6 +1797,8 @@ restart: NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); vn_finished_write(mp); + if (error == ERELOOKUP) + goto restart; return (error); } @@ -1937,6 +1945,8 @@ out: vrele(vp); else vput(vp); + if (error == ERELOOKUP) + goto restart; fdout: if (fp != NULL) fdrop(fp, td); @@ -3395,7 +3405,8 @@ kern_truncate(struct thread *td, const char *path, enu int error; if (length < 0) - return(EINVAL); + return (EINVAL); +retry: NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td); if ((error = namei(&nd)) != 0) return (error); @@ -3424,6 +3435,8 @@ kern_truncate(struct thread *td, const char *path, enu vn_finished_write(mp); vn_rangelock_unlock(vp, rl_cookie); vrele(vp); + if (error == ERELOOKUP) + goto retry; return (error); } @@ -3479,6 +3492,7 @@ kern_fsync(struct thread *td, int fd, bool fullsync) if (!fullsync) /* XXXKIB: compete outstanding aio writes */; #endif +retry: error = vn_start_write(vp, &mp, V_WAIT | PCATCH); if (error != 0) goto drop; @@ -3498,6 +3512,8 @@ kern_fsync(struct thread *td, int fd, bool fullsync) error = fullsync ? VOP_FSYNC(vp, MNT_WAIT, td) : VOP_FDATASYNC(vp, td); VOP_UNLOCK(vp); vn_finished_write(mp); + if (error == ERELOOKUP) + goto retry; drop: fdrop(fp, td); return (error); @@ -3679,7 +3695,7 @@ again: * are links to the same vnode), then there is nothing to do. */ if (fvp == tvp) - error = -1; + error = ERESTART; #ifdef MAC else error = mac_vnode_check_rename_to(td->td_ucred, tdvp, @@ -3708,8 +3724,10 @@ out: out1: if (fromnd.ni_startdir) vrele(fromnd.ni_startdir); - if (error == -1) + if (error == ERESTART) return (0); + if (error == ERELOOKUP) + goto again; return (error); } @@ -3803,6 +3821,8 @@ out: if (error == 0) vput(nd.ni_vp); vn_finished_write(mp); + if (error == ERELOOKUP) + goto restart; return (error); } @@ -3903,6 +3923,8 @@ out: vrele(nd.ni_dvp); else vput(nd.ni_dvp); + if (error == ERELOOKUP) + goto restart; fdout: if (fp != NULL) fdrop(fp, td); @@ -4416,7 +4438,8 @@ kern_fhlinkat(struct thread *td, int fd, const char *p if (error != 0) return (error); VOP_UNLOCK(vp); - } while ((error = kern_linkat_vp(td, vp, fd, path, pathseg)) == EAGAIN); + error = kern_linkat_vp(td, vp, fd, path, pathseg); + } while (error == EAGAIN || error == ERELOOKUP); return (error); } From owner-svn-src-all@freebsd.org Fri Nov 13 09:48:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 788372D580A; Fri, 13 Nov 2020 09:48:55 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXYZb2yMKz3hGg; Fri, 13 Nov 2020 09:48:55 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 584DB16681; Fri, 13 Nov 2020 09:48:55 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AD9mtrD091103; Fri, 13 Nov 2020 09:48:55 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AD9mt8V091102; Fri, 13 Nov 2020 09:48:55 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011130948.0AD9mt8V091102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Fri, 13 Nov 2020 09:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367633 - stable/12/sbin/reboot X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/sbin/reboot X-SVN-Commit-Revision: 367633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 09:48:55 -0000 Author: 0mp (doc,ports committer) Date: Fri Nov 13 09:48:54 2020 New Revision: 367633 URL: https://svnweb.freebsd.org/changeset/base/367633 Log: MFC r367567: Address a mandoc warning Modified: stable/12/sbin/reboot/boot_i386.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/reboot/boot_i386.8 ============================================================================== --- stable/12/sbin/reboot/boot_i386.8 Fri Nov 13 09:42:32 2020 (r367632) +++ stable/12/sbin/reboot/boot_i386.8 Fri Nov 13 09:48:54 2020 (r367633) @@ -107,7 +107,7 @@ from partition of either the floppy or the hard disk. This boot may be aborted by typing any character on the keyboard at the -.Ql boot: +.Ql boot\&: prompt. At this time, the following input will be accepted: .Bl -tag -width indent From owner-svn-src-all@freebsd.org Fri Nov 13 09:49:23 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F55C2D581D; Fri, 13 Nov 2020 09:49:23 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXYb735Mrz3hNH; Fri, 13 Nov 2020 09:49:23 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C8F8164BA; Fri, 13 Nov 2020 09:49:23 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AD9nNmh091172; Fri, 13 Nov 2020 09:49:23 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AD9nNjC091171; Fri, 13 Nov 2020 09:49:23 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011130949.0AD9nNjC091171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Fri, 13 Nov 2020 09:49:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r367634 - stable/11/sbin/reboot X-SVN-Group: stable-11 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/11/sbin/reboot X-SVN-Commit-Revision: 367634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 09:49:23 -0000 Author: 0mp (doc,ports committer) Date: Fri Nov 13 09:49:22 2020 New Revision: 367634 URL: https://svnweb.freebsd.org/changeset/base/367634 Log: MFC r367567: Address a mandoc warning Modified: stable/11/sbin/reboot/boot_i386.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/reboot/boot_i386.8 ============================================================================== --- stable/11/sbin/reboot/boot_i386.8 Fri Nov 13 09:48:54 2020 (r367633) +++ stable/11/sbin/reboot/boot_i386.8 Fri Nov 13 09:49:22 2020 (r367634) @@ -107,7 +107,7 @@ from partition of either the floppy or the hard disk. This boot may be aborted by typing any character on the keyboard at the -.Ql boot: +.Ql boot\&: prompt. At this time, the following input will be accepted: .Bl -tag -width indent From owner-svn-src-all@freebsd.org Fri Nov 13 10:35:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BF5E2D62B3; Fri, 13 Nov 2020 10:35:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXZbr31pxz3kXB; Fri, 13 Nov 2020 10:35:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0ADAYnTt003173 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 13 Nov 2020 12:34:52 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0ADAYnTt003173 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0ADAYncQ003172; Fri, 13 Nov 2020 12:34:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 Nov 2020 12:34:49 +0200 From: Konstantin Belousov To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367631 - in head/sys: kern sys Message-ID: References: <202011130931.0AD9VwBL082843@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202011130931.0AD9VwBL082843@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CXZbr31pxz3kXB X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [2.91 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; TO_DN_NONE(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; NEURAL_SPAM_MEDIUM(0.99)[0.992]; SPAMHAUS_ZRD(0.00)[2001:470:d5e7:1::1:from:127.0.2.255]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:470:d5e7:1::1:from]; NEURAL_SPAM_LONG(1.00)[0.997]; NEURAL_SPAM_SHORT(0.92)[0.919]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 10:35:05 -0000 On Fri, Nov 13, 2020 at 09:31:58AM +0000, Konstantin Belousov wrote: > Author: kib > Date: Fri Nov 13 09:31:57 2020 > New Revision: 367631 > URL: https://svnweb.freebsd.org/changeset/base/367631 > > Log: > Implement vn_lock_pair(). > > In collaboration with: pho > Reviewed by: mckusick (previous version), markj (previous version) > Tested by: markj (syzkaller), pho > Sponsored by: The FreeBSD Foundation > Differential revision: https://reviews.freebsd.org/D26136 > > Modified: > head/sys/kern/vfs_vnops.c > head/sys/sys/vnode.h > > Modified: head/sys/kern/vfs_vnops.c > ============================================================================== > --- head/sys/kern/vfs_vnops.c Fri Nov 13 02:05:45 2020 (r367630) > +++ head/sys/kern/vfs_vnops.c Fri Nov 13 09:31:57 2020 (r367631) > @@ -275,6 +276,10 @@ restart: > vn_finished_write(mp); > if (error) { > NDFREE(ndp, NDF_ONLY_PNBUF); > + if (error == ERELOOKUP) { > + NDREINIT(ndp); > + goto restart; > + } > return (error); > } > fmode &= ~O_TRUNC; > @@ -1524,6 +1529,7 @@ vn_truncate(struct file *fp, off_t length, struct ucre > > vp = fp->f_vnode; > > +retry: > /* > * Lock the whole range for truncation. Otherwise split i/o > * might happen partly before and partly after the truncation. > @@ -1550,6 +1556,8 @@ out: > vn_finished_write(mp); > out1: > vn_rangelock_unlock(vp, rl_cookie); > + if (error == ERELOOKUP) > + goto retry; > return (error); > } These chunks really belong to r367632 and not r367631, they leaked there due to my mishandling of the split. I am sorry for that, but I do not think it is reasonable to revert and re-commit. From owner-svn-src-all@freebsd.org Fri Nov 13 13:07:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 479792E295E; Fri, 13 Nov 2020 13:07:45 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXf011cY0z3twK; Fri, 13 Nov 2020 13:07:45 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A4A8184F0; Fri, 13 Nov 2020 13:07:45 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADD7j7e015301; Fri, 13 Nov 2020 13:07:45 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADD7jTG015300; Fri, 13 Nov 2020 13:07:45 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <202011131307.0ADD7jTG015300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Fri, 13 Nov 2020 13:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367635 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: gnn X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 367635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 13:07:45 -0000 Author: gnn Date: Fri Nov 13 13:07:44 2020 New Revision: 367635 URL: https://svnweb.freebsd.org/changeset/base/367635 Log: Followup pointed out by ae@ Modified: head/sys/netinet/ip_fastfwd.c Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Fri Nov 13 09:49:22 2020 (r367634) +++ head/sys/netinet/ip_fastfwd.c Fri Nov 13 13:07:44 2020 (r367635) @@ -118,7 +118,11 @@ ip_redir_alloc(struct mbuf *m, struct nhop_object *nh, struct ip *ip, in_addr_t *addr) { struct mbuf *mcopy = m_gethdr(M_NOWAIT, m->m_type); - if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_NOWAIT)) { + + if (mcopy == NULL) + return (NULL); + + if (m_dup_pkthdr(mcopy, m, M_NOWAIT) == 0) { /* * It's probably ok if the pkthdr dup fails (because * the deep copy of the tag chain failed), but for now From owner-svn-src-all@freebsd.org Fri Nov 13 13:18:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 271082E2EBE; Fri, 13 Nov 2020 13:18:49 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXfDn0Z3Mz3v9j; Fri, 13 Nov 2020 13:18:49 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0199E18D95; Fri, 13 Nov 2020 13:18:49 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADDIm6d021643; Fri, 13 Nov 2020 13:18:48 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADDIm6k021642; Fri, 13 Nov 2020 13:18:48 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202011131318.0ADDIm6k021642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 13 Nov 2020 13:18:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367636 - head X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 13:18:49 -0000 Author: arichardson Date: Fri Nov 13 13:18:48 2020 New Revision: 367636 URL: https://svnweb.freebsd.org/changeset/base/367636 Log: Makefile.inc1: remove no-longer required variable This variable is unsed since r364760 but I forgot to delete it in that commit. Reported By: bdrewery Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Nov 13 13:07:44 2020 (r367635) +++ head/Makefile.inc1 Fri Nov 13 13:18:48 2020 (r367636) @@ -2117,11 +2117,6 @@ update: .PHONY # which don't have the APIs required by the targets built in bootstrap-tools, # build-tools or cross-tools. # - -# libnv and libsbuf are requirements for config(8), which is an unconditional -# bootstrap-tool. -_config_deps= lib/libnv lib/libsbuf - legacy: .PHONY .if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0 @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ From owner-svn-src-all@freebsd.org Fri Nov 13 13:36:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 748A82E35B5; Fri, 13 Nov 2020 13:36:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXfdW2swWz3wLh; Fri, 13 Nov 2020 13:36:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5593B1912B; Fri, 13 Nov 2020 13:36:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADDalfP034140; Fri, 13 Nov 2020 13:36:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADDalsp034139; Fri, 13 Nov 2020 13:36:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011131336.0ADDalsp034139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 13 Nov 2020 13:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367637 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 13:36:47 -0000 Author: mjg Date: Fri Nov 13 13:36:46 2020 New Revision: 367637 URL: https://svnweb.freebsd.org/changeset/base/367637 Log: MFC r367352,r367353: pipe: fix POLLHUP handling if no events were specified pipe: whitespace nit in previous Modified: stable/12/sys/kern/sys_pipe.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_pipe.c ============================================================================== --- stable/12/sys/kern/sys_pipe.c Fri Nov 13 13:18:48 2020 (r367636) +++ stable/12/sys/kern/sys_pipe.c Fri Nov 13 13:36:46 2020 (r367637) @@ -1446,13 +1446,17 @@ pipe_poll(struct file *fp, int events, struct ucred *a } if (revents == 0) { - if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM)) { + /* + * Add ourselves regardless of eventmask as we have to return + * POLLHUP even if it was not asked for. + */ + if ((fp->f_flag & FREAD) != 0) { selrecord(td, &rpipe->pipe_sel); if (SEL_WAITING(&rpipe->pipe_sel)) rpipe->pipe_state |= PIPE_SEL; } - if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM)) { + if ((fp->f_flag & FWRITE) != 0) { selrecord(td, &wpipe->pipe_sel); if (SEL_WAITING(&wpipe->pipe_sel)) wpipe->pipe_state |= PIPE_SEL; From owner-svn-src-all@freebsd.org Fri Nov 13 13:38:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C97AE2E381B; Fri, 13 Nov 2020 13:38:08 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXfg45PK5z4QxZ; Fri, 13 Nov 2020 13:38:08 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC25D18F40; Fri, 13 Nov 2020 13:38:08 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADDc816034258; Fri, 13 Nov 2020 13:38:08 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADDc82O034257; Fri, 13 Nov 2020 13:38:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011131338.0ADDc82O034257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 13 Nov 2020 13:38:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367638 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 13:38:08 -0000 Author: mjg Date: Fri Nov 13 13:38:08 2020 New Revision: 367638 URL: https://svnweb.freebsd.org/changeset/base/367638 Log: MFC r367572: Allow rtprio_thread to operate on threads of any process Modified: stable/12/sys/kern/kern_resource.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_resource.c ============================================================================== --- stable/12/sys/kern/kern_resource.c Fri Nov 13 13:36:46 2020 (r367637) +++ stable/12/sys/kern/kern_resource.c Fri Nov 13 13:38:08 2020 (r367638) @@ -303,8 +303,7 @@ sys_rtprio_thread(struct thread *td, struct rtprio_thr td1 = td; PROC_LOCK(p); } else { - /* Only look up thread in current process */ - td1 = tdfind(uap->lwpid, curproc->p_pid); + td1 = tdfind(uap->lwpid, -1); if (td1 == NULL) return (ESRCH); p = td1->td_proc; From owner-svn-src-all@freebsd.org Fri Nov 13 13:47:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 224412E3E05; Fri, 13 Nov 2020 13:47:19 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXfsg09Fpz4RSg; Fri, 13 Nov 2020 13:47:19 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB7681936E; Fri, 13 Nov 2020 13:47:18 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADDlIZX040666; Fri, 13 Nov 2020 13:47:18 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADDlINZ040665; Fri, 13 Nov 2020 13:47:18 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011131347.0ADDlINZ040665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Fri, 13 Nov 2020 13:47:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367639 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 367639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 13:47:19 -0000 Author: 0mp (doc,ports committer) Date: Fri Nov 13 13:47:18 2020 New Revision: 367639 URL: https://svnweb.freebsd.org/changeset/base/367639 Log: Reference setprogname(3) in setproctitle(3) The reference to setproctitle(3) in the setprogname(3) manual is already in place. MFC after: 3 days Modified: head/lib/libc/gen/setproctitle.3 Modified: head/lib/libc/gen/setproctitle.3 ============================================================================== --- head/lib/libc/gen/setproctitle.3 Fri Nov 13 13:38:08 2020 (r367638) +++ head/lib/libc/gen/setproctitle.3 Fri Nov 13 13:47:18 2020 (r367639) @@ -20,7 +20,7 @@ .\" $FreeBSD$ .\" .\" The following requests are required for all man pages. -.Dd July 4, 2018 +.Dd November 13, 2020 .Dt SETPROCTITLE 3 .Os .Sh NAME @@ -69,6 +69,7 @@ setproctitle("talking to %s", inet_ntoa(addr)); .Sh SEE ALSO .Xr ps 1 , .Xr w 1 , +.Xr setprogname 3 , .Xr kvm 3 , .Xr kvm_getargv 3 , .Xr printf 3 From owner-svn-src-all@freebsd.org Fri Nov 13 14:48:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF55C2E4E56; Fri, 13 Nov 2020 14:48:37 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXhDP5LNkz4V5C; Fri, 13 Nov 2020 14:48:37 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA86019C4C; Fri, 13 Nov 2020 14:48:37 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADEmbTE076967; Fri, 13 Nov 2020 14:48:37 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADEmbGf076966; Fri, 13 Nov 2020 14:48:37 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011131448.0ADEmbGf076966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Fri, 13 Nov 2020 14:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367640 - head/usr.bin/uname X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.bin/uname X-SVN-Commit-Revision: 367640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 14:48:37 -0000 Author: 0mp (doc,ports committer) Date: Fri Nov 13 14:48:37 2020 New Revision: 367640 URL: https://svnweb.freebsd.org/changeset/base/367640 Log: Explicitly note in the EXAMPLES section that uname(3) contains more details MFC after: 1 week Modified: head/usr.bin/uname/uname.1 Modified: head/usr.bin/uname/uname.1 ============================================================================== --- head/usr.bin/uname/uname.1 Fri Nov 13 13:47:18 2020 (r367639) +++ head/usr.bin/uname/uname.1 Fri Nov 13 14:48:37 2020 (r367640) @@ -28,7 +28,7 @@ .\" @(#)uname.1 8.3 (Berkeley) 4/8/94 .\" $FreeBSD$ .\" -.Dd August 10, 2020 +.Dd Novermber 13, 2020 .Dt UNAME 1 .Os .Sh NAME @@ -119,6 +119,9 @@ utility (except for .Fl a ) will allow the corresponding data to be set to the contents of the environment variable. +See +.Xr uname 3 +for more information. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES From owner-svn-src-all@freebsd.org Fri Nov 13 14:56:34 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B59902E559B; Fri, 13 Nov 2020 14:56:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXhPZ4mDYz4VW5; Fri, 13 Nov 2020 14:56:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9639A19A6B; Fri, 13 Nov 2020 14:56:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADEuYmW083256; Fri, 13 Nov 2020 14:56:34 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADEuYwt083255; Fri, 13 Nov 2020 14:56:34 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011131456.0ADEuYwt083255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Fri, 13 Nov 2020 14:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367641 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 367641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 14:56:34 -0000 Author: 0mp (doc,ports committer) Date: Fri Nov 13 14:56:34 2020 New Revision: 367641 URL: https://svnweb.freebsd.org/changeset/base/367641 Log: Add a missing Nm macro All functions documented in a manual page should be enumerated with the Nm macros. Modified: head/lib/libc/gen/setproctitle.3 Modified: head/lib/libc/gen/setproctitle.3 ============================================================================== --- head/lib/libc/gen/setproctitle.3 Fri Nov 13 14:48:37 2020 (r367640) +++ head/lib/libc/gen/setproctitle.3 Fri Nov 13 14:56:34 2020 (r367641) @@ -25,6 +25,7 @@ .Os .Sh NAME .Nm setproctitle +.Nm setproctitle_fast .Nd set process title .Sh SYNOPSIS .In sys/types.h From owner-svn-src-all@freebsd.org Fri Nov 13 16:24:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 385D42E6D5D; Fri, 13 Nov 2020 16:24:54 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXkMV0M6vz4ZVx; Fri, 13 Nov 2020 16:24:53 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f51.google.com with SMTP id n15so9411449otl.8; Fri, 13 Nov 2020 08:24:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=L9Wey0GtLOLu2tJ4CH/c0ALzCICtUfoImGYBuE/sRXA=; b=JoboaOPvzSJ4urvtRk6GsZnRBOJLuO9zeMu2U0CUJrqWKxURKfnb4g/ZZGZ1TdNE0Z k8b3wsAnySJvojEW4FttyyCiNPHwBleOfLFbAcs1PYxS8r7jr/RI8/yxF02w7bAPNM/0 vT/LuHFxUGTTF9PC2zcrXTX+hxS+g5Jv2EKE3jfN/09Jfo27S5JddCWGB4WTSaRfPtzs jFaKopSVkzleMKW1Sk+apGwS6AaC8xNiAj9rdfbRXaNmlYePRSlPEiOGesty8snoQQcW LXX4LwfM1JHFC7C3GDQs6mqwhXVGhLCiEo0vkB/KPiCKjdRg0Nwt8Tpg4WT5Y/Ie3tMo gDOA== X-Gm-Message-State: AOAM532ei33u7kXnt6FfnZlT2NWQhbuTGYkoleXi/ldRrp6NKlsqh8L4 qluQQ0lgFhqvnH3geUoWhhrJ5jOcFDc= X-Google-Smtp-Source: ABdhPJyeeTy3tgZpfrncTEpvz0LQ07o/CNEcArh4q85Sgvm7CEAwgFe9kkiJmuoQhpQ7cfxFosoOiQ== X-Received: by 2002:a05:6830:789:: with SMTP id w9mr2066052ots.243.1605284687507; Fri, 13 Nov 2020 08:24:47 -0800 (PST) Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com. [209.85.161.52]) by smtp.gmail.com with ESMTPSA id 64sm2043659otq.26.2020.11.13.08.24.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Nov 2020 08:24:47 -0800 (PST) Received: by mail-oo1-f52.google.com with SMTP id c25so2276081ooe.13; Fri, 13 Nov 2020 08:24:47 -0800 (PST) X-Received: by 2002:a4a:9486:: with SMTP id k6mr2090362ooi.85.1605284682065; Fri, 13 Nov 2020 08:24:42 -0800 (PST) MIME-Version: 1.0 References: <202011130931.0AD9VwBL082843@repo.freebsd.org> In-Reply-To: <202011130931.0AD9VwBL082843@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 13 Nov 2020 08:24:30 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r367631 - in head/sys: kern sys To: Konstantin Belousov Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CXkMV0M6vz4ZVx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 16:24:54 -0000 Hi Konstantin, On Fri, Nov 13, 2020 at 1:32 AM Konstantin Belousov wrote: > > Author: kib > Date: Fri Nov 13 09:31:57 2020 > New Revision: 367631 > URL: https://svnweb.freebsd.org/changeset/base/367631 > > Log: > Implement vn_lock_pair(). > > Modified: head/sys/kern/vfs_vnops.c > ============================================================================== > --- head/sys/kern/vfs_vnops.c Fri Nov 13 02:05:45 2020 (r367630) > +++ head/sys/kern/vfs_vnops.c Fri Nov 13 09:31:57 2020 (r367631) > @@ -3317,4 +3325,92 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, > ... > + > +static void > +vn_lock_pair_pause(const char *wmesg) > +{ > + atomic_add_long(&vn_lock_pair_pause_cnt, 1); > + pause(wmesg, prng32_bounded(hz / 10)); > +} This function is called when the try-lock of the second lock in the pair (either order) fails. The back-off period is up to 100ms, expected average 50ms. That seems really high? Separately: prng32_bounded() may return 0, which is transparently converted to the equivalent of 1 by pause_sbt(9). This means a 1 tick pause is marginally more likely than any other possible duration. It probably doesn't matter. Thanks, Conrad > + > +/* > + * Lock pair of vnodes vp1, vp2, avoiding lock order reversal. > + * vp1_locked indicates whether vp1 is exclusively locked; if not, vp1 > + * must be unlocked. Same for vp2 and vp2_locked. One of the vnodes > + * can be NULL. > + * > + * The function returns with both vnodes exclusively locked, and > + * guarantees that it does not create lock order reversal with other > + * threads during its execution. Both vnodes could be unlocked > + * temporary (and reclaimed). > + */ > +void > +vn_lock_pair(struct vnode *vp1, bool vp1_locked, struct vnode *vp2, > + bool vp2_locked) > +{ > + int error; > + > + if (vp1 == NULL && vp2 == NULL) > + return; > + if (vp1 != NULL) { > + if (vp1_locked) > + ASSERT_VOP_ELOCKED(vp1, "vp1"); > + else > + ASSERT_VOP_UNLOCKED(vp1, "vp1"); > + } else { > + vp1_locked = true; > + } > + if (vp2 != NULL) { > + if (vp2_locked) > + ASSERT_VOP_ELOCKED(vp2, "vp2"); > + else > + ASSERT_VOP_UNLOCKED(vp2, "vp2"); > + } else { > + vp2_locked = true; > + } > + if (!vp1_locked && !vp2_locked) { > + vn_lock(vp1, LK_EXCLUSIVE | LK_RETRY); > + vp1_locked = true; > + } > + > + for (;;) { > + if (vp1_locked && vp2_locked) > + break; > + if (vp1_locked && vp2 != NULL) { > + if (vp1 != NULL) { > + error = VOP_LOCK1(vp2, LK_EXCLUSIVE | LK_NOWAIT, > + __FILE__, __LINE__); > + if (error == 0) > + break; > + VOP_UNLOCK(vp1); > + vp1_locked = false; > + vn_lock_pair_pause("vlp1"); (Pause called here and in similar elided case for vp2 -> vp1 below.) > + } > + vn_lock(vp2, LK_EXCLUSIVE | LK_RETRY); > + vp2_locked = true; > + } From owner-svn-src-all@freebsd.org Fri Nov 13 16:38:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B6EC2E7297; Fri, 13 Nov 2020 16:38:31 +0000 (UTC) (envelope-from martin@vx.sk) Received: from mail.vx.sk (mail.vx.sk [IPv6:2a01:4f8:191:9029::4]) by mx1.freebsd.org (Postfix) with ESMTP id 4CXkg94CjXz4bCT; Fri, 13 Nov 2020 16:38:29 +0000 (UTC) (envelope-from martin@vx.sk) Received: from mail.vx.sk (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id EE7621D9BDF; Fri, 13 Nov 2020 17:38:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=vx.sk; h= content-transfer-encoding:mime-version:content-type:content-type :user-agent:in-reply-to:subject:subject:from:from:message-id :date:date:received:received:received; s=1; t=1605285501; x= 1607099902; bh=Du8iAPMSEvWijtnChlun4boFtUp6gASBvA0or8WvVJM=; b=l jfEHBpSzI8ZxztM7kogZMb4bLcoFIpWPBtofp8erj5Aroox92OAx4WIUt/ueEii9 +NGRjRb06f9PSr45tX23HPfFPgk6LOTqGo68ebuDJvgGWiDA0EZtUeCNBoDXIG2l ufAqNuiCYljgWT7QanInatbvxSZKzfmrZtO1TZb/mWM/Ik8qoSffmtPBq4pLBp0B 1f3A78JVTJ1ypMm0XfoBa6MrWkD6z0XhLYwqAY81kcPQFSgWVwbrsMwJHkPSs/6N R5LoV8yrbm8Pt1POhgvHquRki0scz6qPaUo9KVogeKD1l6Z7ymxWkydf3JFQJ9qE lRHnWmWrLRYjjT4mcwbbA== X-Virus-Scanned: amavisd-new at mail.vx.sk Received: from mail.vx.sk by mail.vx.sk (amavisd-new, unix socket) with LMTP id jR8_fe4ZpbcX; Fri, 13 Nov 2020 17:38:21 +0100 (CET) Received: from mail.vx.sk (localhost [IPv6:::1]) by mail.vx.sk (Postfix) with ESMTPSA id A01CD1D9C49; Fri, 13 Nov 2020 17:38:21 +0100 (CET) Received: from 188-167-136-198.dynamic.chello.sk (188-167-136-198.dynamic.chello.sk [188.167.136.198]) by mail.vx.sk (Horde Framework) with HTTPS; Fri, 13 Nov 2020 17:38:21 +0100 Date: Fri, 13 Nov 2020 17:38:21 +0100 Message-ID: <20201113173821.Horde.jq1A9wp72tHUvM10uhYxhOq@mail.vx.sk> From: martin@vx.sk To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: Re: svn commit: r367359 - stable/12/sys/dev/pci In-Reply-To: <202011050257.0A52veoR086637@repo.freebsd.org> User-Agent: Horde Application Framework 5 MIME-Version: 1.0 X-Rspamd-Queue-Id: 4CXkg94CjXz4bCT X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=vx.sk header.s=1 header.b=l jfEHBp; dmarc=none; spf=pass (mx1.freebsd.org: domain of martin@vx.sk designates 2a01:4f8:191:9029::4 as permitted sender) smtp.mailfrom=martin@vx.sk X-Spamd-Result: default: False [-3.40 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; FREEFALL_USER(0.00)[martin]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[vx.sk]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2a01:4f8:191:9029::4:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[vx.sk:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_NO_DN(0.00)[]; R_DKIM_ALLOW(-0.20)[vx.sk:s=1]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a01:4f8:191:9029::4:from]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-stable-12,svn-src-stable]; RECEIVED_SPAMHAUS_PBL(0.00)[188.167.136.198:received] Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: =?utf-8?b?U3Byw6F2YQ==?= s =?utf-8?b?xI1pc3TDvW0=?= textom X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 16:38:31 -0000 I am encountering a problem with hw.pci.enable_aspm: System: ASUS RS500A-E10-RS12U CPU: AMD EPYC 7502 32-Core. NVMe drive model: Micron 9300 PRO Number of NVMe drives: 10 Using X2APIC When hw.pci.enable_aspm is enabled, PCIe hot plug of Micron NVMe =20 drives does not work (including detection on boot) and the system =20 reports the following errors for the vast majority of the drives: Nov 13 15:11:30 xxx kernel: pcib9: Timed out waiting for Data Link =20 Layer Active Nov 13 15:12:17 xxx kernel: pcib30: Timed out waiting for Data Link =20 Layer Active Nov 13 15:12:44 xxx kernel: pcib29: Timed out waiting for Data Link =20 Layer Active Nov 13 15:13:04 xxx kernel: pcib11: Timed out waiting for Data Link =20 Layer Active ... Flipping the tunable back to 0 workarounds the problem. Reproduced both on latest head and stable/12. Best regards, mm Quoting Alexander Motin : > Author: mav > Date: Thu Nov=C2=A0 5 02:57:40 2020 > New Revision: 367359 > URL: https://svnweb.freebsd.org/changeset/base/367359 > > Log: > MFC r364038: Enable hw.pci.enable_aspm tunable by default. > > While effects on power saving is only a guess, effects on hot-plug are > clearly visible.=C2=A0 Lets try to enable it and see what happen. > > Modified: > stable/12/sys/dev/pci/pci.c > Directory Properties: > stable/12/=C2=A0 =C2=A0(props changed) > > Modified: stable/12/sys/dev/pci/pci.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/12/sys/dev/pci/pci.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 Thu Nov=C2=A0= 5 02:12:33 2020=C2=A0 =C2=A0 =C2=A0 =20 > =C2=A0 (r367358) > +++ stable/12/sys/dev/pci/pci.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 Thu Nov=C2=A0= 5 02:57:40 2020=C2=A0 =C2=A0 =C2=A0 =20 > =C2=A0 (r367359) > @@ -411,7 +411,7 @@ static int pci_enable_ari =3D 1; > SYSCTL_INT(_hw_pci, OID_AUTO, enable_ari, CTLFLAG_RDTUN, &pci_enable_ar= i, > =C2=A0 =C2=A0 0, "Enable support for PCIe Alternative RID Interpretatio= n"); > > -int pci_enable_aspm; > +int pci_enable_aspm =3D 1; > SYSCTL_INT(_hw_pci, OID_AUTO, enable_aspm, CTLFLAG_RDTUN, =20 > &pci_enable_aspm,=C2=A0 =C2=A0 0, "Enable support for PCIe Active State= Power =20 > Management"); From owner-svn-src-all@freebsd.org Fri Nov 13 16:47:43 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 145482E75ED; Fri, 13 Nov 2020 16:47:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXksq03xQz4c1X; Fri, 13 Nov 2020 16:47:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E94EB1B258; Fri, 13 Nov 2020 16:47:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADGlgSc051703; Fri, 13 Nov 2020 16:47:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADGlgg7051701; Fri, 13 Nov 2020 16:47:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011131647.0ADGlgg7051701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 13 Nov 2020 16:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367642 - head/bin/df X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/bin/df X-SVN-Commit-Revision: 367642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 16:47:43 -0000 Author: markj Date: Fri Nov 13 16:47:42 2020 New Revision: 367642 URL: https://svnweb.freebsd.org/changeset/base/367642 Log: df: Remove support for mounting devices This was marked deprecated in r329092, over two and a half years ago. This functionality is also buggy per PR 237368. PR: 237368 Reviewed by: brooks, cem, emaste, imp Differential Revision: https://reviews.freebsd.org/D27197 Modified: head/bin/df/Makefile head/bin/df/df.1 head/bin/df/df.c Modified: head/bin/df/Makefile ============================================================================== --- head/bin/df/Makefile Fri Nov 13 14:56:34 2020 (r367641) +++ head/bin/df/Makefile Fri Nov 13 16:47:42 2020 (r367642) @@ -10,9 +10,6 @@ SRCS= df.c vfslist.c CFLAGS+= -I${MOUNT} -CFLAGS+= -DMOUNT_CHAR_DEVS -SRCS+= getmntopts.c - LIBADD= xo util .include Modified: head/bin/df/df.1 ============================================================================== --- head/bin/df/df.1 Fri Nov 13 14:56:34 2020 (r367641) +++ head/bin/df/df.1 Fri Nov 13 16:47:42 2020 (r367642) @@ -48,6 +48,7 @@ The .Nm utility displays statistics about the amount of free disk space on the specified +mounted .Ar file system or on the file system of which .Ar file Modified: head/bin/df/df.c ============================================================================== --- head/bin/df/df.c Fri Nov 13 14:56:34 2020 (r367641) +++ head/bin/df/df.c Fri Nov 13 16:47:42 2020 (r367642) @@ -52,16 +52,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef MOUNT_CHAR_DEVS -#include -#endif #include #include #include #include -#ifdef MOUNT_CHAR_DEVS -#include -#endif #include #include #include @@ -106,9 +100,6 @@ imax(int a, int b) static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag; static int thousands; -#ifdef MOUNT_CHAR_DEVS -static struct ufs_args mdev; -#endif static const struct option long_options[] = { @@ -123,21 +114,11 @@ main(int argc, char *argv[]) struct statfs statfsbuf, totalbuf; struct maxwidths maxwidths; struct statfs *mntbuf; -#ifdef MOUNT_CHAR_DEVS - struct iovec *iov = NULL; -#endif const char *fstype; -#ifdef MOUNT_CHAR_DEVS - char *mntpath; - char errmsg[255] = {0}; -#endif char *mntpt; const char **vfslist; int i, mntsize; int ch, rv; -#ifdef MOUNT_CHAR_DEVS - int iovlen = 0; -#endif fstype = "ufs"; (void)setlocale(LC_ALL, ""); @@ -255,66 +236,15 @@ main(int argc, char *argv[]) continue; } } else if (S_ISCHR(stbuf.st_mode)) { - if ((mntpt = getmntpt(*argv)) == NULL) { -#ifdef MOUNT_CHAR_DEVS - xo_warnx( - "df on unmounted devices is deprecated"); - mdev.fspec = *argv; - mntpath = strdup("/tmp/df.XXXXXX"); - if (mntpath == NULL) { - xo_warn("strdup failed"); - rv = 1; - continue; - } - mntpt = mkdtemp(mntpath); - if (mntpt == NULL) { - xo_warn("mkdtemp(\"%s\") failed", mntpath); - rv = 1; - free(mntpath); - continue; - } - if (iov != NULL) - free_iovec(&iov, &iovlen); - build_iovec_argf(&iov, &iovlen, "fstype", "%s", - fstype); - build_iovec_argf(&iov, &iovlen, "fspath", "%s", - mntpath); - build_iovec_argf(&iov, &iovlen, "from", "%s", - *argv); - build_iovec(&iov, &iovlen, "errmsg", errmsg, - sizeof(errmsg)); - if (nmount(iov, iovlen, - MNT_RDONLY|MNT_NOEXEC) < 0) { - if (errmsg[0]) - xo_warn("%s: %s", *argv, - errmsg); - else - xo_warn("%s", *argv); - rv = 1; - (void)rmdir(mntpt); - free(mntpath); - continue; - } else if (statfs(mntpt, &statfsbuf) == 0) { - statfsbuf.f_mntonname[0] = '\0'; - prtstat(&statfsbuf, &maxwidths); - if (cflag) - addstat(&totalbuf, &statfsbuf); - } else { - xo_warn("%s", *argv); - rv = 1; - } - (void)unmount(mntpt, 0); - (void)rmdir(mntpt); - free(mntpath); - continue; -#else + mntpt = getmntpt(*argv); + if (mntpt == NULL) { xo_warnx("%s: not mounted", *argv); rv = 1; continue; -#endif } - } else + } else { mntpt = *argv; + } /* * Statfs does not take a `wait' flag, so we cannot From owner-svn-src-all@freebsd.org Fri Nov 13 16:49:42 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A14B2E78C1; Fri, 13 Nov 2020 16:49:42 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXkw60CGdz4c2g; Fri, 13 Nov 2020 16:49:42 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE08D1B440; Fri, 13 Nov 2020 16:49:41 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADGnf4a051852; Fri, 13 Nov 2020 16:49:41 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADGnfMd051850; Fri, 13 Nov 2020 16:49:41 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202011131649.0ADGnfMd051850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Fri, 13 Nov 2020 16:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367643 - in head: sys/dev/ofw usr.sbin/ofwdump X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head: sys/dev/ofw usr.sbin/ofwdump X-SVN-Commit-Revision: 367643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 16:49:42 -0000 Author: bdragon Date: Fri Nov 13 16:49:41 2020 New Revision: 367643 URL: https://svnweb.freebsd.org/changeset/base/367643 Log: [PowerPC] Allow traversal of oversize OF properties. In standards such as LoPAPR, property names in excess of the usual 31 characters exist. This breaks property traversal. While in IEEE 1275-1994, nextprop is defined explicitly to work with a 32-byte region of memory, using a larger buffer should be fine. There is actually no way to pass a buffer length to the nextprop call in the OF client interface, so SLOF actually just blindly overflows the buffer. So we have to defensively make the buffer larger, to avoid memory corruption when reading out long properties on live OF systems. Note also that on real-mode OF, things are pretty tight because we are allocating against a static bounce buffer in low memory, so we can't just use a huge buffer to work around this without it being wasteful of our limited amount of 32-bit physical memory. This allows a patched ofwdump to operate properly on SLOF (i.e. pseries) systems, as well as any other PowerPC systems with overlength properties. Reviewed by: jhibbits MFC after: 2 weeks Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D26669 Modified: head/sys/dev/ofw/openfirmio.c head/sys/dev/ofw/openfirmio.h head/usr.sbin/ofwdump/ofwdump.c Modified: head/sys/dev/ofw/openfirmio.c ============================================================================== --- head/sys/dev/ofw/openfirmio.c Fri Nov 13 16:47:42 2020 (r367642) +++ head/sys/dev/ofw/openfirmio.c Fri Nov 13 16:49:41 2020 (r367643) @@ -115,7 +115,7 @@ openfirm_ioctl(struct cdev *dev, u_long cmd, caddr_t d phandle_t node; int len, ok, error; char *name, *value; - char newname[32]; + char newname[OFIOCSUGGPROPNAMELEN]; if ((flags & FREAD) == 0) return (EBADF); @@ -222,8 +222,19 @@ openfirm_ioctl(struct cdev *dev, u_long cmd, caddr_t d break; } len = strlen(newname) + 1; - if (len > of->of_buflen) + if (len > of->of_buflen) { + /* + * Passed buffer was insufficient. + * + * Instead of returning an error here, truncate the + * property name to fit the buffer. + * + * This allows us to retain compatibility with old + * tools which always pass a 32 character buffer. + */ len = of->of_buflen; + newname[len - 1] = '\0'; + } else of->of_buflen = len; error = copyout(newname, of->of_buf, len); Modified: head/sys/dev/ofw/openfirmio.h ============================================================================== --- head/sys/dev/ofw/openfirmio.h Fri Nov 13 16:47:42 2020 (r367642) +++ head/sys/dev/ofw/openfirmio.h Fri Nov 13 16:49:41 2020 (r367643) @@ -76,4 +76,18 @@ struct ofiocdesc { /* Maximum accepted value length (maximum of nvramrc property). */ #define OFIOCMAXVALUE 8192 +/* + * While IEEE 1275-1994 states in 3.2.2.1.1 that property names are 1-31 + * printable characters, in practice, this limit has been ignored. + * Noncompliant properties have been codified in standards such as LoPAPR. + * + * This is a suggested buffer length that should be large enough to hold + * any property name currently seen in device trees, without being overly + * wasteful of memory. + * + * If a future version of the Devicetree specification updates the property + * names length requirement, this value will be updated to match. + */ +#define OFIOCSUGGPROPNAMELEN 64 + #endif /* _DEV_OFW_OPENFIRMIO_H_ */ Modified: head/usr.sbin/ofwdump/ofwdump.c ============================================================================== --- head/usr.sbin/ofwdump/ofwdump.c Fri Nov 13 16:47:42 2020 (r367642) +++ head/usr.sbin/ofwdump/ofwdump.c Fri Nov 13 16:49:41 2020 (r367643) @@ -144,7 +144,7 @@ static void ofw_dump_properties(int fd, phandle_t n, int level, int raw, int str) { int nlen; - char prop[32]; + char prop[OFIOCSUGGPROPNAMELEN]; for (nlen = ofw_firstprop(fd, n, prop, sizeof(prop)); nlen != 0; nlen = ofw_nextprop(fd, n, prop, prop, sizeof(prop))) From owner-svn-src-all@freebsd.org Fri Nov 13 16:56:04 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BF682E7B85; Fri, 13 Nov 2020 16:56:04 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXl3S0Zvjz4cQj; Fri, 13 Nov 2020 16:56:04 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F020D1B0F3; Fri, 13 Nov 2020 16:56:03 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADGu327057746; Fri, 13 Nov 2020 16:56:03 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADGu3Vx057745; Fri, 13 Nov 2020 16:56:03 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202011131656.0ADGu3Vx057745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Fri, 13 Nov 2020 16:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367644 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 367644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 16:56:04 -0000 Author: bdragon Date: Fri Nov 13 16:56:03 2020 New Revision: 367644 URL: https://svnweb.freebsd.org/changeset/base/367644 Log: [PowerPC64LE] Radix MMU fixes for LE. There were many, many endianness fixes needed for Radix MMU. The Radix pagetable is stored in BE (as it is read and written to by the MMU hw), so we need to convert back and forth every time we interact with it when running in LE. With these changes, I can successfully boot with radix enabled on POWER9 hw. Reviewed by: luporl, jhibbits Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D27181 Modified: head/sys/powerpc/aim/mmu_radix.c Modified: head/sys/powerpc/aim/mmu_radix.c ============================================================================== --- head/sys/powerpc/aim/mmu_radix.c Fri Nov 13 16:49:41 2020 (r367643) +++ head/sys/powerpc/aim/mmu_radix.c Fri Nov 13 16:56:03 2020 (r367644) @@ -309,7 +309,7 @@ pmap_l3e_to_pte(pt_entry_t *l3e, vm_offset_t va) pt_entry_t *pte; vm_paddr_t ptepa; - ptepa = (*l3e & NLB_MASK); + ptepa = (be64toh(*l3e) & NLB_MASK); pte = (pt_entry_t *)PHYS_TO_DMAP(ptepa); return (&pte[pmap_pte_index(va)]); } @@ -321,7 +321,7 @@ pmap_l2e_to_l3e(pt_entry_t *l2e, vm_offset_t va) pt_entry_t *l3e; vm_paddr_t l3pa; - l3pa = (*l2e & NLB_MASK); + l3pa = (be64toh(*l2e) & NLB_MASK); l3e = (pml3_entry_t *)PHYS_TO_DMAP(l3pa); return (&l3e[pmap_pml3e_index(va)]); } @@ -333,7 +333,7 @@ pmap_l1e_to_l2e(pt_entry_t *l1e, vm_offset_t va) pt_entry_t *l2e; vm_paddr_t l2pa; - l2pa = (*l1e & NLB_MASK); + l2pa = (be64toh(*l1e) & NLB_MASK); l2e = (pml2_entry_t *)PHYS_TO_DMAP(l2pa); return (&l2e[pmap_pml2e_index(va)]); @@ -352,7 +352,7 @@ pmap_pml2e(pmap_t pmap, vm_offset_t va) pt_entry_t *l1e; l1e = pmap_pml1e(pmap, va); - if (l1e == NULL || (*l1e & RPTE_VALID) == 0) + if (l1e == NULL || (be64toh(*l1e) & RPTE_VALID) == 0) return (NULL); return (pmap_l1e_to_l2e(l1e, va)); } @@ -363,7 +363,7 @@ pmap_pml3e(pmap_t pmap, vm_offset_t va) pt_entry_t *l2e; l2e = pmap_pml2e(pmap, va); - if (l2e == NULL || (*l2e & RPTE_VALID) == 0) + if (l2e == NULL || (be64toh(*l2e) & RPTE_VALID) == 0) return (NULL); return (pmap_l2e_to_l3e(l2e, va)); } @@ -374,7 +374,7 @@ pmap_pte(pmap_t pmap, vm_offset_t va) pt_entry_t *l3e; l3e = pmap_pml3e(pmap, va); - if (l3e == NULL || (*l3e & RPTE_VALID) == 0) + if (l3e == NULL || (be64toh(*l3e) & RPTE_VALID) == 0) return (NULL); return (pmap_l3e_to_pte(l3e, va)); } @@ -819,13 +819,13 @@ pa_cmp(const void *a, const void *b) #define pte_load_clear(ptep) atomic_swap_long(ptep, 0) #define pte_store(ptep, pte) do { \ MPASS((pte) & (RPTE_EAA_R | RPTE_EAA_W | RPTE_EAA_X)); \ - *(u_long *)(ptep) = (u_long)((pte) | PG_V | RPTE_LEAF); \ + *(u_long *)(ptep) = htobe64((u_long)((pte) | PG_V | RPTE_LEAF)); \ } while (0) /* * NB: should only be used for adding directories - not for direct mappings */ #define pde_store(ptep, pa) do { \ - *(u_long *)(ptep) = (u_long)(pa|RPTE_VALID|RPTE_SHIFT); \ + *(u_long *)(ptep) = htobe64((u_long)(pa|RPTE_VALID|RPTE_SHIFT)); \ } while (0) #define pte_clear(ptep) do { \ @@ -885,7 +885,7 @@ kvtopte(vm_offset_t va) pt_entry_t *l3e; l3e = pmap_pml3e(kernel_pmap, va); - if ((*l3e & RPTE_VALID) == 0) + if ((be64toh(*l3e) & RPTE_VALID) == 0) return (NULL); return (pmap_l3e_to_pte(l3e, va)); } @@ -897,8 +897,8 @@ mmu_radix_kenter(vm_offset_t va, vm_paddr_t pa) pte = kvtopte(va); MPASS(pte != NULL); - *pte = pa | RPTE_VALID | RPTE_LEAF | RPTE_EAA_R | RPTE_EAA_W | \ - RPTE_EAA_P | PG_M | PG_A; + *pte = htobe64(pa | RPTE_VALID | RPTE_LEAF | RPTE_EAA_R | \ + RPTE_EAA_W | RPTE_EAA_P | PG_M | PG_A); } bool @@ -915,17 +915,17 @@ pmap_nofault_pte(pmap_t pmap, vm_offset_t va, int *is_ va &= PG_PS_FRAME; l3e = pmap_pml3e(pmap, va); - if (l3e == NULL || (*l3e & PG_V) == 0) + if (l3e == NULL || (be64toh(*l3e) & PG_V) == 0) return (NULL); - if (*l3e & RPTE_LEAF) { + if (be64toh(*l3e) & RPTE_LEAF) { *is_l3e = 1; return (l3e); } *is_l3e = 0; va &= PG_FRAME; pte = pmap_l3e_to_pte(l3e, va); - if (pte == NULL || (*pte & PG_V) == 0) + if (pte == NULL || (be64toh(*pte) & PG_V) == 0) return (NULL); return (pte); } @@ -942,7 +942,7 @@ pmap_nofault(pmap_t pmap, vm_offset_t va, vm_prot_t fl retry: if ((pte = pmap_nofault_pte(pmap, va, &is_l3e)) == NULL) return (KERN_INVALID_ADDRESS); - origpte = newpte = *pte; + origpte = newpte = be64toh(*pte); if (startpte == 0) { startpte = origpte; if (((flags & VM_PROT_WRITE) && (startpte & PG_M)) || @@ -963,7 +963,7 @@ pmap_nofault(pmap_t pmap, vm_offset_t va, vm_prot_t fl #endif PMAP_LOCK(pmap); if ((pte = pmap_nofault_pte(pmap, va, &is_l3e)) == NULL || - *pte != origpte) { + be64toh(*pte) != origpte) { PMAP_UNLOCK(pmap); return (KERN_FAILURE); } @@ -992,7 +992,7 @@ pmap_nofault(pmap_t pmap, vm_offset_t va, vm_prot_t fl break; } - if (!atomic_cmpset_long(pte, origpte, newpte)) + if (!atomic_cmpset_long(pte, htobe64(origpte), htobe64(newpte))) goto retry; ptesync(); PMAP_UNLOCK(pmap); @@ -1432,12 +1432,12 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l pv = &pc->pc_pventry[field * 64 + bit]; va = pv->pv_va; l3e = pmap_pml3e(pmap, va); - if ((*l3e & RPTE_LEAF) != 0) + if ((be64toh(*l3e) & RPTE_LEAF) != 0) continue; pte = pmap_l3e_to_pte(l3e, va); - if ((*pte & PG_W) != 0) + if ((be64toh(*pte) & PG_W) != 0) continue; - tpte = pte_load_clear(pte); + tpte = be64toh(pte_load_clear(pte)); m = PHYS_TO_VM_PAGE(tpte & PG_FRAME); if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); @@ -1456,7 +1456,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l } } pc->pc_map[field] |= 1UL << bit; - pmap_unuse_pt(pmap, va, *l3e, &free); + pmap_unuse_pt(pmap, va, be64toh(*l3e), &free); freed++; } } @@ -1764,7 +1764,7 @@ mmu_radix_dmap_range(vm_paddr_t start, vm_paddr_t end) while (start < end) { pteval = start | DMAP_PAGE_BITS; pte = pmap_pml1e(kernel_pmap, PHYS_TO_DMAP(start)); - if ((*pte & RPTE_VALID) == 0) { + if ((be64toh(*pte) & RPTE_VALID) == 0) { page = alloc_pt_page(); pde_store(pte, page); } @@ -1773,7 +1773,7 @@ mmu_radix_dmap_range(vm_paddr_t start, vm_paddr_t end) end - start >= L2_PAGE_SIZE) { start += L2_PAGE_SIZE; goto done; - } else if ((*pte & RPTE_VALID) == 0) { + } else if ((be64toh(*pte) & RPTE_VALID) == 0) { page = alloc_pt_page(); pde_store(pte, page); } @@ -1783,7 +1783,7 @@ mmu_radix_dmap_range(vm_paddr_t start, vm_paddr_t end) end - start >= L3_PAGE_SIZE) { start += L3_PAGE_SIZE; goto done; - } else if ((*pte & RPTE_VALID) == 0) { + } else if ((be64toh(*pte) & RPTE_VALID) == 0) { page = alloc_pt_page(); pde_store(pte, page); } @@ -1820,7 +1820,7 @@ mmu_radix_setup_pagetables(vm_size_t hwphyssz) bzero(kernel_pmap, sizeof(struct pmap)); PMAP_LOCK_INIT(kernel_pmap); - ptpages = allocpages(2); + ptpages = allocpages(3); l1phys = moea64_bootstrap_alloc(RADIX_PGD_SIZE, RADIX_PGD_SIZE); validate_addr(l1phys, RADIX_PGD_SIZE); if (bootverbose) @@ -1837,10 +1837,10 @@ mmu_radix_setup_pagetables(vm_size_t hwphyssz) */ pages = ptpages; pte = pmap_pml1e(kernel_pmap, VM_MIN_KERNEL_ADDRESS); - *pte = (pages | RPTE_VALID | RPTE_SHIFT); + *pte = htobe64(pages | RPTE_VALID | RPTE_SHIFT); pages += PAGE_SIZE; pte = pmap_l1e_to_l2e(pte, VM_MIN_KERNEL_ADDRESS); - *pte = (pages | RPTE_VALID | RPTE_SHIFT); + *pte = htobe64(pages | RPTE_VALID | RPTE_SHIFT); pages += PAGE_SIZE; pte = pmap_l2e_to_l3e(pte, VM_MIN_KERNEL_ADDRESS); /* @@ -1856,7 +1856,7 @@ mmu_radix_setup_pagetables(vm_size_t hwphyssz) } KPTphys = pages; for (int i = 0; i < nkpt; i++, pte++, pages += PAGE_SIZE) - *pte = (pages | RPTE_VALID | RPTE_SHIFT); + *pte = htobe64(pages | RPTE_VALID | RPTE_SHIFT); kernel_vm_end = VM_MIN_KERNEL_ADDRESS + nkpt * L3_PAGE_SIZE; if (bootverbose) printf("kernel_pmap pml1 %p\n", kernel_pmap->pm_pml1); @@ -2192,14 +2192,14 @@ mmu_radix_advise(pmap_t pmap, vm_offset_t sva, vm_offs PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { l1e = pmap_pml1e(pmap, sva); - if ((*l1e & PG_V) == 0) { + if ((be64toh(*l1e) & PG_V) == 0) { va_next = (sva + L1_PAGE_SIZE) & ~L1_PAGE_MASK; if (va_next < sva) va_next = eva; continue; } l2e = pmap_l1e_to_l2e(l1e, sva); - if ((*l2e & PG_V) == 0) { + if ((be64toh(*l2e) & PG_V) == 0) { va_next = (sva + L2_PAGE_SIZE) & ~L2_PAGE_MASK; if (va_next < sva) va_next = eva; @@ -2209,7 +2209,7 @@ mmu_radix_advise(pmap_t pmap, vm_offset_t sva, vm_offs if (va_next < sva) va_next = eva; l3e = pmap_l2e_to_l3e(l2e, sva); - oldl3e = *l3e; + oldl3e = be64toh(*l3e); if ((oldl3e & PG_V) == 0) continue; else if ((oldl3e & RPTE_LEAF) != 0) { @@ -2235,9 +2235,9 @@ mmu_radix_advise(pmap_t pmap, vm_offset_t sva, vm_offs */ if ((oldl3e & PG_W) == 0) { pte = pmap_l3e_to_pte(l3e, sva); - KASSERT((*pte & PG_V) != 0, + KASSERT((be64toh(*pte) & PG_V) != 0, ("pmap_advise: invalid PTE")); - pmap_remove_pte(pmap, pte, sva, *l3e, NULL, + pmap_remove_pte(pmap, pte, sva, be64toh(*l3e), NULL, &lock); anychanged = TRUE; } @@ -2251,21 +2251,21 @@ mmu_radix_advise(pmap_t pmap, vm_offset_t sva, vm_offs pte++, sva += PAGE_SIZE) { MPASS(pte == pmap_pte(pmap, sva)); - if ((*pte & (PG_MANAGED | PG_V)) != (PG_MANAGED | PG_V)) + if ((be64toh(*pte) & (PG_MANAGED | PG_V)) != (PG_MANAGED | PG_V)) goto maybe_invlrng; - else if ((*pte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { + else if ((be64toh(*pte) & (PG_M | PG_RW)) == (PG_M | PG_RW)) { if (advice == MADV_DONTNEED) { /* * Future calls to pmap_is_modified() * can be avoided by making the page * dirty now. */ - m = PHYS_TO_VM_PAGE(*pte & PG_FRAME); + m = PHYS_TO_VM_PAGE(be64toh(*pte) & PG_FRAME); vm_page_dirty(m); } - atomic_clear_long(pte, PG_M | PG_A); - } else if ((*pte & PG_A) != 0) - atomic_clear_long(pte, PG_A); + atomic_clear_long(pte, htobe64(PG_M | PG_A)); + } else if ((be64toh(*pte) & PG_A) != 0) + atomic_clear_long(pte, htobe64(PG_A)); else goto maybe_invlrng; anychanged = TRUE; @@ -2409,7 +2409,7 @@ restart: } va = pv->pv_va; l3e = pmap_pml3e(pmap, va); - oldl3e = *l3e; + oldl3e = be64toh(*l3e); if ((oldl3e & PG_RW) != 0) { if (pmap_demote_l3e_locked(pmap, l3e, va, &lock)) { if ((oldl3e & PG_W) == 0) { @@ -2421,12 +2421,12 @@ restart: va += VM_PAGE_TO_PHYS(m) - (oldl3e & PG_PS_FRAME); pte = pmap_l3e_to_pte(l3e, va); - oldpte = *pte; + oldpte = be64toh(*pte); if ((oldpte & PG_V) != 0) { while (!atomic_cmpset_long(pte, - oldpte, - (oldpte | RPTE_EAA_R) & ~(PG_M | PG_RW))) - oldpte = *pte; + htobe64(oldpte), + htobe64((oldpte | RPTE_EAA_R) & ~(PG_M | PG_RW)))) + oldpte = be64toh(*pte); vm_page_dirty(m); pmap_invalidate_page(pmap, va); } @@ -2449,11 +2449,11 @@ restart: } } l3e = pmap_pml3e(pmap, pv->pv_va); - KASSERT((*l3e & RPTE_LEAF) == 0, ("pmap_clear_modify: found" + KASSERT((be64toh(*l3e) & RPTE_LEAF) == 0, ("pmap_clear_modify: found" " a 2mpage in page %p's pv list", m)); pte = pmap_l3e_to_pte(l3e, pv->pv_va); - if ((*pte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { - atomic_clear_long(pte, PG_M); + if ((be64toh(*pte) & (PG_M | PG_RW)) == (PG_M | PG_RW)) { + atomic_clear_long(pte, htobe64(PG_M)); pmap_invalidate_page(pmap, pv->pv_va); } PMAP_UNLOCK(pmap); @@ -2496,7 +2496,7 @@ mmu_radix_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_of pt_entry_t *src_pte, *dst_pte; l1e = pmap_pml1e(src_pmap, addr); - if ((*l1e & PG_V) == 0) { + if ((be64toh(*l1e) & PG_V) == 0) { va_next = (addr + L1_PAGE_SIZE) & ~L1_PAGE_MASK; if (va_next < addr) va_next = end_addr; @@ -2504,7 +2504,7 @@ mmu_radix_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_of } l2e = pmap_l1e_to_l2e(l1e, addr); - if ((*l2e & PG_V) == 0) { + if ((be64toh(*l2e) & PG_V) == 0) { va_next = (addr + L2_PAGE_SIZE) & ~L2_PAGE_MASK; if (va_next < addr) va_next = end_addr; @@ -2516,7 +2516,7 @@ mmu_radix_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_of va_next = end_addr; l3e = pmap_l2e_to_l3e(l2e, addr); - srcptepaddr = *l3e; + srcptepaddr = be64toh(*l3e); if (srcptepaddr == 0) continue; @@ -2530,10 +2530,10 @@ mmu_radix_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_of l3e = (pml3_entry_t *) PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dst_pdpg)); l3e = &l3e[pmap_pml3e_index(addr)]; - if (*l3e == 0 && ((srcptepaddr & PG_MANAGED) == 0 || + if (be64toh(*l3e) == 0 && ((srcptepaddr & PG_MANAGED) == 0 || pmap_pv_insert_l3e(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - *l3e = srcptepaddr & ~PG_W; + *l3e = htobe64(srcptepaddr & ~PG_W); pmap_resident_count_inc(dst_pmap, L3_PAGE_SIZE / PAGE_SIZE); atomic_add_long(&pmap_l3e_mappings, 1); @@ -2555,7 +2555,7 @@ mmu_radix_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_of dstmpte = NULL; while (addr < va_next) { pt_entry_t ptetemp; - ptetemp = *src_pte; + ptetemp = be64toh(*src_pte); /* * we only virtual copy managed pages */ @@ -2569,7 +2569,7 @@ mmu_radix_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_of dst_pte = (pt_entry_t *) PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpte)); dst_pte = &dst_pte[pmap_pte_index(addr)]; - if (*dst_pte == 0 && + if (be64toh(*dst_pte) == 0 && pmap_try_insert_pv_entry(dst_pmap, addr, PHYS_TO_VM_PAGE(ptetemp & PG_FRAME), &lock)) { @@ -2578,8 +2578,8 @@ mmu_radix_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_of * accessed (referenced) bits * during the copy. */ - *dst_pte = ptetemp & ~(PG_W | PG_M | - PG_A); + *dst_pte = htobe64(ptetemp & ~(PG_W | PG_M | + PG_A)); pmap_resident_count_inc(dst_pmap, 1); } else { SLIST_INIT(&free); @@ -2635,10 +2635,29 @@ static void mmu_radix_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) { + void *a_cp, *b_cp; + vm_offset_t a_pg_offset, b_pg_offset; + int cnt; CTR6(KTR_PMAP, "%s(%p, %#x, %p, %#x, %#x)", __func__, ma, a_offset, mb, b_offset, xfersize); - UNIMPLEMENTED(); + + while (xfersize > 0) { + a_pg_offset = a_offset & PAGE_MASK; + cnt = min(xfersize, PAGE_SIZE - a_pg_offset); + a_cp = (char *)(uintptr_t)PHYS_TO_DMAP( + VM_PAGE_TO_PHYS(ma[a_offset >> PAGE_SHIFT])) + + a_pg_offset; + b_pg_offset = b_offset & PAGE_MASK; + cnt = min(cnt, PAGE_SIZE - b_pg_offset); + b_cp = (char *)(uintptr_t)PHYS_TO_DMAP( + VM_PAGE_TO_PHYS(mb[b_offset >> PAGE_SHIFT])) + + b_pg_offset; + bcopy(a_cp, b_cp, cnt); + a_offset += cnt; + b_offset += cnt; + xfersize -= cnt; + } } #if VM_NRESERVLEVEL > 0 @@ -2664,7 +2683,7 @@ pmap_promote_l3e(pmap_t pmap, pml3_entry_t *pde, vm_of * either invalid, unused, or does not map the first 4KB physical page * within a 2MB page. */ - firstpte = (pt_entry_t *)PHYS_TO_DMAP(*pde & PG_FRAME); + firstpte = (pt_entry_t *)PHYS_TO_DMAP(be64toh(*pde) & PG_FRAME); setpde: newpde = *firstpte; if ((newpde & ((PG_FRAME & L3_PAGE_MASK) | PG_A | PG_V)) != (PG_A | PG_V)) { @@ -2677,7 +2696,7 @@ setpde: * When PG_M is already clear, PG_RW can be cleared without * a TLB invalidation. */ - if (!atomic_cmpset_long(firstpte, newpde, (newpde | RPTE_EAA_R) & ~RPTE_EAA_W)) + if (!atomic_cmpset_long(firstpte, htobe64(newpde), htobe64((newpde | RPTE_EAA_R) & ~RPTE_EAA_W))) goto setpde; newpde &= ~RPTE_EAA_W; } @@ -2690,7 +2709,7 @@ setpde: pa = (newpde & (PG_PS_FRAME | PG_A | PG_V)) + L3_PAGE_SIZE - PAGE_SIZE; for (pte = firstpte + NPTEPG - 1; pte > firstpte; pte--) { setpte: - oldpte = *pte; + oldpte = be64toh(*pte); if ((oldpte & (PG_FRAME | PG_A | PG_V)) != pa) { CTR2(KTR_PMAP, "pmap_promote_l3e: failure for va %#lx" " in pmap %p", va, pmap); @@ -2701,7 +2720,7 @@ setpte: * When PG_M is already clear, PG_RW can be cleared * without a TLB invalidation. */ - if (!atomic_cmpset_long(pte, oldpte, (oldpte | RPTE_EAA_R) & ~RPTE_EAA_W)) + if (!atomic_cmpset_long(pte, htobe64(oldpte), htobe64((oldpte | RPTE_EAA_R) & ~RPTE_EAA_W))) goto setpte; oldpte &= ~RPTE_EAA_W; CTR2(KTR_PMAP, "pmap_promote_l3e: protect for va %#lx" @@ -2721,7 +2740,7 @@ setpte: * mapping the superpage is demoted by pmap_demote_pde() or * destroyed by pmap_remove_pde(). */ - mpte = PHYS_TO_VM_PAGE(*pde & PG_FRAME); + mpte = PHYS_TO_VM_PAGE(be64toh(*pde) & PG_FRAME); KASSERT(mpte >= vm_page_array && mpte < &vm_page_array[vm_page_array_size], ("pmap_promote_l3e: page table page is out of range")); @@ -2827,11 +2846,11 @@ mmu_radix_enter(pmap_t pmap, vm_offset_t va, vm_page_t */ retry: l3e = pmap_pml3e(pmap, va); - if (l3e != NULL && (*l3e & PG_V) != 0 && ((*l3e & RPTE_LEAF) == 0 || + if (l3e != NULL && (be64toh(*l3e) & PG_V) != 0 && ((be64toh(*l3e) & RPTE_LEAF) == 0 || pmap_demote_l3e_locked(pmap, l3e, va, &lock))) { pte = pmap_l3e_to_pte(l3e, va); if (va < VM_MAXUSER_ADDRESS && mpte == NULL) { - mpte = PHYS_TO_VM_PAGE(*l3e & PG_FRAME); + mpte = PHYS_TO_VM_PAGE(be64toh(*l3e) & PG_FRAME); mpte->ref_count++; } } else if (va < VM_MAXUSER_ADDRESS) { @@ -2853,7 +2872,7 @@ retry: } else panic("pmap_enter: invalid page directory va=%#lx", va); - origpte = *pte; + origpte = be64toh(*pte); pv = NULL; /* @@ -2903,7 +2922,7 @@ retry: vm_page_aflag_set(m, PGA_WRITEABLE); if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0) { if ((newpte & (PG_A|PG_M)) != (origpte & (PG_A|PG_M))) { - if (!atomic_cmpset_long(pte, origpte, newpte)) + if (!atomic_cmpset_long(pte, htobe64(origpte), htobe64(newpte))) goto retry; if ((newpte & PG_M) != (origpte & PG_M)) vm_page_dirty(m); @@ -2928,7 +2947,7 @@ retry: * * For consistency, handle unmanaged mappings the same way. */ - origpte = pte_load_clear(pte); + origpte = be64toh(pte_load_clear(pte)); KASSERT((origpte & PG_FRAME) == opa, ("pmap_enter: unexpected pa update for %#lx", va)); if ((origpte & PG_MANAGED) != 0) { @@ -3008,7 +3027,7 @@ retry: */ if ((origpte & PG_V) != 0) { validate: - origpte = pte_load_store(pte, newpte); + origpte = be64toh(pte_load_store(pte, htobe64(newpte))); KASSERT((origpte & PG_FRAME) == pa, ("pmap_enter: unexpected pa update for %#lx", va)); if ((newpte & PG_M) == 0 && (origpte & (PG_M | PG_RW)) == @@ -3123,7 +3142,7 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry } l3e = (pml3_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pdpg)); l3e = &l3e[pmap_pml3e_index(va)]; - oldl3e = *l3e; + oldl3e = be64toh(*l3e); if ((oldl3e & PG_V) != 0) { KASSERT(pdpg->ref_count > 1, ("pmap_enter_pde: pdpg's wire count is too low")); @@ -3150,7 +3169,7 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry } vm_page_free_pages_toq(&free, true); if (va >= VM_MAXUSER_ADDRESS) { - mt = PHYS_TO_VM_PAGE(*l3e & PG_FRAME); + mt = PHYS_TO_VM_PAGE(be64toh(*l3e) & PG_FRAME); if (pmap_insert_pt_page(pmap, mt)) { /* * XXX Currently, this can't happen because @@ -3160,7 +3179,7 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry panic("pmap_enter_pde: trie insert failed"); } } else - KASSERT(*l3e == 0, ("pmap_enter_pde: non-zero pde %p", + KASSERT(be64toh(*l3e) == 0, ("pmap_enter_pde: non-zero pde %p", l3e)); } if ((newpde & PG_MANAGED) != 0) { @@ -3287,10 +3306,10 @@ mmu_radix_enter_quick_locked(pmap_t pmap, vm_offset_t * attempt to allocate a page table page. If this * attempt fails, we don't retry. Instead, we give up. */ - if (ptepa && (*ptepa & PG_V) != 0) { - if (*ptepa & RPTE_LEAF) + if (ptepa && (be64toh(*ptepa) & PG_V) != 0) { + if (be64toh(*ptepa) & RPTE_LEAF) return (NULL); - mpte = PHYS_TO_VM_PAGE(*ptepa & PG_FRAME); + mpte = PHYS_TO_VM_PAGE(be64toh(*ptepa) & PG_FRAME); mpte->ref_count++; } else { /* @@ -3308,7 +3327,7 @@ mmu_radix_enter_quick_locked(pmap_t pmap, vm_offset_t mpte = NULL; pte = pmap_pte(pmap, va); } - if (*pte) { + if (be64toh(*pte)) { if (mpte != NULL) { mpte->ref_count--; mpte = NULL; @@ -3385,8 +3404,8 @@ mmu_radix_extract(pmap_t pmap, vm_offset_t va) l3e = pmap_pml3e(pmap, va); if (__predict_false(l3e == NULL)) return (0); - if (*l3e & RPTE_LEAF) { - pa = (*l3e & PG_PS_FRAME) | (va & L3_PAGE_MASK); + if (be64toh(*l3e) & RPTE_LEAF) { + pa = (be64toh(*l3e) & PG_PS_FRAME) | (va & L3_PAGE_MASK); pa |= (va & L3_PAGE_MASK); } else { /* @@ -3400,7 +3419,7 @@ mmu_radix_extract(pmap_t pmap, vm_offset_t va) pte = pmap_l3e_to_pte(l3e, va); if (__predict_false(pte == NULL)) return (0); - pa = *pte; + pa = be64toh(*pte); pa = (pa & PG_FRAME) | (va & PAGE_MASK); pa |= (va & PAGE_MASK); } @@ -3420,13 +3439,14 @@ mmu_radix_extract_and_hold(pmap_t pmap, vm_offset_t va CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, pmap, va, prot); PMAP_LOCK(pmap); l3ep = pmap_pml3e(pmap, va); - if (l3ep != NULL && (l3e = *l3ep)) { + if (l3ep != NULL && (l3e = be64toh(*l3ep))) { if (l3e & RPTE_LEAF) { if ((l3e & PG_RW) || (prot & VM_PROT_WRITE) == 0) m = PHYS_TO_VM_PAGE((l3e & PG_PS_FRAME) | (va & L3_PAGE_MASK)); } else { - pte = *pmap_l3e_to_pte(l3ep, va); + /* Native endian PTE, do not pass to pmap functions */ + pte = be64toh(*pmap_l3e_to_pte(l3ep, va)); if ((pte & PG_V) && ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) m = PHYS_TO_VM_PAGE(pte & PG_FRAME); @@ -3456,7 +3476,7 @@ mmu_radix_growkernel(vm_offset_t addr) addr = vm_map_max(kernel_map); while (kernel_vm_end < addr) { l2e = pmap_pml2e(kernel_pmap, kernel_vm_end); - if ((*l2e & PG_V) == 0) { + if ((be64toh(*l2e) & PG_V) == 0) { /* We need a new PDP entry */ nkpg = vm_page_alloc(NULL, kernel_vm_end >> L2_PAGE_SIZE_SHIFT, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | @@ -3470,7 +3490,7 @@ mmu_radix_growkernel(vm_offset_t addr) continue; /* try again */ } l3e = pmap_l2e_to_l3e(l2e, kernel_vm_end); - if ((*l3e & PG_V) != 0) { + if ((be64toh(*l3e) & PG_V) != 0) { kernel_vm_end = (kernel_vm_end + L3_PAGE_SIZE) & ~L3_PAGE_MASK; if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { kernel_vm_end = vm_map_max(kernel_map); @@ -3549,6 +3569,7 @@ mmu_radix_init() vm_size_t s; int error, i, pv_npg; + /* XXX is this really needed for POWER? */ /* L1TF, reserve page @0 unconditionally */ vm_page_blacklist_add(0, bootverbose); @@ -3665,7 +3686,7 @@ restart: mask |= PG_RW | PG_M; if (accessed) mask |= PG_V | PG_A; - rv = (*pte & mask) == mask; + rv = (be64toh(*pte) & mask) == mask; PMAP_UNLOCK(pmap); if (rv) goto out; @@ -3692,7 +3713,7 @@ restart: mask |= PG_RW | PG_M; if (accessed) mask |= PG_V | PG_A; - rv = (*pte & mask) == mask; + rv = (be64toh(*pte) & mask) == mask; PMAP_UNLOCK(pmap); if (rv) goto out; @@ -3736,9 +3757,9 @@ mmu_radix_is_prefaultable(pmap_t pmap, vm_offset_t add rv = FALSE; PMAP_LOCK(pmap); l3e = pmap_pml3e(pmap, addr); - if (l3e != NULL && (*l3e & (RPTE_LEAF | PG_V)) == PG_V) { + if (l3e != NULL && (be64toh(*l3e) & (RPTE_LEAF | PG_V)) == PG_V) { pte = pmap_l3e_to_pte(l3e, addr); - rv = (*pte & PG_V) == 0; + rv = (be64toh(*pte) & PG_V) == 0; } PMAP_UNLOCK(pmap); return (rv); @@ -3815,7 +3836,7 @@ retry: } } l3e = pmap_pml3e(pmap, pv->pv_va); - oldl3e = *l3e; + oldl3e = be64toh(*l3e); if ((oldl3e & (PG_M | PG_RW)) == (PG_M | PG_RW)) { /* * Although "oldpde" is mapping a 2MB page, because @@ -3846,7 +3867,7 @@ retry: if ((((pa >> PAGE_SHIFT) ^ (pv->pv_va >> L3_PAGE_SIZE_SHIFT) ^ (uintptr_t)pmap) & (NPTEPG - 1)) == 0 && (oldl3e & PG_W) == 0) { - atomic_clear_long(l3e, PG_A); + atomic_clear_long(l3e, htobe64(PG_A)); pmap_invalidate_page(pmap, pv->pv_va); cleared++; KASSERT(lock == VM_PAGE_TO_PV_LIST_LOCK(m), @@ -3885,14 +3906,14 @@ small_mappings: } } l3e = pmap_pml3e(pmap, pv->pv_va); - KASSERT((*l3e & RPTE_LEAF) == 0, + KASSERT((be64toh(*l3e) & RPTE_LEAF) == 0, ("pmap_ts_referenced: found a 2mpage in page %p's pv list", m)); pte = pmap_l3e_to_pte(l3e, pv->pv_va); - if ((*pte & (PG_M | PG_RW)) == (PG_M | PG_RW)) + if ((be64toh(*pte) & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - if ((*pte & PG_A) != 0) { - atomic_clear_long(pte, PG_A); + if ((be64toh(*pte) & PG_A) != 0) { + atomic_clear_long(pte, htobe64(PG_A)); pmap_invalidate_page(pmap, pv->pv_va); cleared++; } @@ -3987,7 +4008,7 @@ mmu_radix_object_init_pt(pmap_t pmap, vm_offset_t addr } l3e = (pml3_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pdpg)); l3e = &l3e[pmap_pml3e_index(addr)]; - if ((*l3e & PG_V) == 0) { + if ((be64toh(*l3e) & PG_V) == 0) { pa |= PG_M | PG_A | PG_RW; pte_store(l3e, pa); pmap_resident_count_inc(pmap, L3_PAGE_SIZE / PAGE_SIZE); @@ -4085,7 +4106,7 @@ restart: } } pte = pmap_pte(pmap, pv->pv_va); - if ((*pte & PG_W) != 0) + if ((be64toh(*pte) & PG_W) != 0) count++; PMAP_UNLOCK(pmap); } @@ -4106,7 +4127,7 @@ restart: } } pte = pmap_pml3e(pmap, pv->pv_va); - if ((*pte & PG_W) != 0) + if ((be64toh(*pte) & PG_W) != 0) count++; PMAP_UNLOCK(pmap); } @@ -4213,7 +4234,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str pml1index = pdpindex >> RPTE_SHIFT; l1e = &pmap->pm_pml1[pml1index]; - if ((*l1e & PG_V) == 0) { + if ((be64toh(*l1e) & PG_V) == 0) { /* Have to allocate a new pdp, recurse */ if (_pmap_allocpte(pmap, NUPDE + NUPDPE + pml1index, lockp) == NULL) { @@ -4223,10 +4244,10 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str } } else { /* Add reference to l2e page */ - pdppg = PHYS_TO_VM_PAGE(*l1e & PG_FRAME); + pdppg = PHYS_TO_VM_PAGE(be64toh(*l1e) & PG_FRAME); pdppg->ref_count++; } - l2e = (pml2_entry_t *)PHYS_TO_DMAP(*l1e & PG_FRAME); + l2e = (pml2_entry_t *)PHYS_TO_DMAP(be64toh(*l1e) & PG_FRAME); /* Now find the pdp page */ l2e = &l2e[pdpindex & RPTE_MASK]; @@ -4245,7 +4266,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str /* First, find the pdp and check that its valid. */ l1e = &pmap->pm_pml1[pml1index]; - if ((*l1e & PG_V) == 0) { + if ((be64toh(*l1e) & PG_V) == 0) { /* Have to allocate a new pd, recurse */ if (_pmap_allocpte(pmap, NUPDE + pdpindex, lockp) == NULL) { @@ -4253,12 +4274,12 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str vm_page_free_zero(m); return (NULL); } - l2e = (pml2_entry_t *)PHYS_TO_DMAP(*l1e & PG_FRAME); + l2e = (pml2_entry_t *)PHYS_TO_DMAP(be64toh(*l1e) & PG_FRAME); l2e = &l2e[pdpindex & RPTE_MASK]; } else { - l2e = (pml2_entry_t *)PHYS_TO_DMAP(*l1e & PG_FRAME); + l2e = (pml2_entry_t *)PHYS_TO_DMAP(be64toh(*l1e) & PG_FRAME); l2e = &l2e[pdpindex & RPTE_MASK]; - if ((*l2e & PG_V) == 0) { + if ((be64toh(*l2e) & PG_V) == 0) { /* Have to allocate a new pd, recurse */ if (_pmap_allocpte(pmap, NUPDE + pdpindex, lockp) == NULL) { @@ -4268,11 +4289,11 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str } } else { /* Add reference to the pd page */ - pdpg = PHYS_TO_VM_PAGE(*l2e & PG_FRAME); + pdpg = PHYS_TO_VM_PAGE(be64toh(*l2e) & PG_FRAME); pdpg->ref_count++; } } - l3e = (pml3_entry_t *)PHYS_TO_DMAP(*l2e & PG_FRAME); + l3e = (pml3_entry_t *)PHYS_TO_DMAP(be64toh(*l2e) & PG_FRAME); /* Now we know where the page directory page is */ l3e = &l3e[ptepindex & RPTE_MASK]; @@ -4291,9 +4312,9 @@ pmap_allocl3e(pmap_t pmap, vm_offset_t va, struct rwlo retry: pdpe = pmap_pml2e(pmap, va); - if (pdpe != NULL && (*pdpe & PG_V) != 0) { + if (pdpe != NULL && (be64toh(*pdpe) & PG_V) != 0) { /* Add a reference to the pd page. */ - pdpg = PHYS_TO_VM_PAGE(*pdpe & PG_FRAME); + pdpg = PHYS_TO_VM_PAGE(be64toh(*pdpe) & PG_FRAME); pdpg->ref_count++; } else { /* Allocate a pd page. */ @@ -4327,7 +4348,7 @@ retry: * This supports switching from a 2MB page to a * normal 4K page. */ - if (pd != NULL && (*pd & (RPTE_LEAF | PG_V)) == (RPTE_LEAF | PG_V)) { + if (pd != NULL && (be64toh(*pd) & (RPTE_LEAF | PG_V)) == (RPTE_LEAF | PG_V)) { if (!pmap_demote_l3e_locked(pmap, pd, va, lockp)) { /* * Invalidation of the 2MB page mapping may have caused @@ -4341,8 +4362,8 @@ retry: * If the page table page is mapped, we just increment the * hold count, and activate it. */ - if (pd != NULL && (*pd & PG_V) != 0) { - m = PHYS_TO_VM_PAGE(*pd & PG_FRAME); + if (pd != NULL && (be64toh(*pd) & PG_V) != 0) { + m = PHYS_TO_VM_PAGE(be64toh(*pd) & PG_FRAME); m->ref_count++; } else { /* @@ -4387,7 +4408,7 @@ pmap_protect_l3e(pmap_t pmap, pt_entry_t *l3e, vm_offs ("pmap_protect_l3e: sva is not 2mpage aligned")); anychanged = FALSE; retry: - oldpde = newpde = *l3e; + oldpde = newpde = be64toh(*l3e); if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == (PG_MANAGED | PG_M | PG_RW)) { eva = sva + L3_PAGE_SIZE; @@ -4407,7 +4428,7 @@ retry: * PG_PROMOTED. The impending invalidation will remove any * lingering 4KB page mappings from the TLB. */ - if (!atomic_cmpset_long(l3e, oldpde, newpde & ~PG_PROMOTED)) + if (!atomic_cmpset_long(l3e, htobe64(oldpde), htobe64(newpde & ~PG_PROMOTED))) goto retry; anychanged = TRUE; } @@ -4448,7 +4469,7 @@ mmu_radix_protect(pmap_t pmap, vm_offset_t sva, vm_off PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { l1e = pmap_pml1e(pmap, sva); - if ((*l1e & PG_V) == 0) { + if ((be64toh(*l1e) & PG_V) == 0) { va_next = (sva + L1_PAGE_SIZE) & ~L1_PAGE_MASK; if (va_next < sva) va_next = eva; @@ -4456,7 +4477,7 @@ mmu_radix_protect(pmap_t pmap, vm_offset_t sva, vm_off } l2e = pmap_l1e_to_l2e(l1e, sva); - if ((*l2e & PG_V) == 0) { + if ((be64toh(*l2e) & PG_V) == 0) { va_next = (sva + L2_PAGE_SIZE) & ~L2_PAGE_MASK; if (va_next < sva) va_next = eva; @@ -4468,7 +4489,7 @@ mmu_radix_protect(pmap_t pmap, vm_offset_t sva, vm_off va_next = eva; l3e = pmap_l2e_to_l3e(l2e, sva); - ptpaddr = *l3e; + ptpaddr = be64toh(*l3e); /* * Weed out invalid mappings. @@ -4506,7 +4527,7 @@ mmu_radix_protect(pmap_t pmap, vm_offset_t sva, vm_off retry: MPASS(pte == pmap_pte(pmap, sva)); - obits = pbits = *pte; + obits = pbits = be64toh(*pte); if ((pbits & PG_V) == 0) continue; @@ -4523,7 +4544,7 @@ retry: pbits |= PG_X; if (pbits != obits) { - if (!atomic_cmpset_long(pte, obits, pbits)) + if (!atomic_cmpset_long(pte, htobe64(obits), htobe64(pbits))) goto retry; if (obits & (PG_A|PG_M)) { anychanged = TRUE; @@ -4569,8 +4590,8 @@ mmu_radix_qenter(vm_offset_t sva, vm_page_t *ma, int c m = *ma++; cache_bits = pmap_cache_bits(m->md.mdpg_cache_attrs); pa = VM_PAGE_TO_PHYS(m) | cache_bits | attr_bits; - if (*pte != pa) { - oldpte |= *pte; + if (be64toh(*pte) != pa) { + oldpte |= be64toh(*pte); pte_store(pte, pa); } va += PAGE_SIZE; @@ -4699,14 +4720,14 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_ /* We just released a PT, unhold the matching PD */ vm_page_t pdpg; - pdpg = PHYS_TO_VM_PAGE(*pmap_pml2e(pmap, va) & PG_FRAME); + pdpg = PHYS_TO_VM_PAGE(be64toh(*pmap_pml2e(pmap, va)) & PG_FRAME); pmap_unwire_ptp(pmap, va, pdpg, free); } if (m->pindex >= NUPDE && m->pindex < (NUPDE + NUPDPE)) { /* We just released a PD, unhold the matching PDP */ vm_page_t pdppg; - pdppg = PHYS_TO_VM_PAGE(*pmap_pml1e(pmap, va) & PG_FRAME); + pdppg = PHYS_TO_VM_PAGE(be64toh(*pmap_pml1e(pmap, va)) & PG_FRAME); pmap_unwire_ptp(pmap, va, pdppg, free); } @@ -4787,7 +4808,7 @@ pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte) pt_entry_t *pte; for (pte = firstpte; pte < firstpte + NPTEPG; pte++) { - *pte = newpte; + *pte = htobe64(newpte); newpte += PAGE_SIZE; } } @@ -4817,7 +4838,7 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, vm_offset_t sva; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - oldpde = *l3e; + oldpde = be64toh(*l3e); KASSERT((oldpde & (RPTE_LEAF | PG_V)) == (RPTE_LEAF | PG_V), ("pmap_demote_l3e: oldpde is missing RPTE_LEAF and/or PG_V %lx", oldpde)); @@ -4870,7 +4891,7 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, pmap_fill_ptp(firstpte, oldpde); } - KASSERT((*firstpte & PG_FRAME) == (oldpde & PG_FRAME), + KASSERT((be64toh(*firstpte) & PG_FRAME) == (oldpde & PG_FRAME), ("pmap_demote_l3e: firstpte and newpte map different physical" " addresses")); @@ -4878,7 +4899,7 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, * If the mapping has changed attributes, update the page table * entries. */ - if ((*firstpte & PG_PTE_PROMOTE) != (oldpde & PG_PTE_PROMOTE)) + if ((be64toh(*firstpte) & PG_PTE_PROMOTE) != (oldpde & PG_PTE_PROMOTE)) pmap_fill_ptp(firstpte, oldpde); /* @@ -4957,7 +4978,7 @@ pmap_remove_l3e(pmap_t pmap, pml3_entry_t *pdq, vm_off PMAP_LOCK_ASSERT(pmap, MA_OWNED); KASSERT((sva & L3_PAGE_MASK) == 0, ("pmap_remove_l3e: sva is not 2mpage aligned")); - oldpde = pte_load_clear(pdq); + oldpde = be64toh(pte_load_clear(pdq)); if (oldpde & PG_W) pmap->pm_stats.wired_count -= (L3_PAGE_SIZE / PAGE_SIZE); pmap_resident_count_dec(pmap, L3_PAGE_SIZE / PAGE_SIZE); @@ -4989,7 +5010,7 @@ pmap_remove_l3e(pmap_t pmap, pml3_entry_t *pdq, vm_off pmap_add_delayed_free_list(mpte, free, FALSE); } } - return (pmap_unuse_pt(pmap, sva, *pmap_pml2e(pmap, sva), free)); + return (pmap_unuse_pt(pmap, sva, be64toh(*pmap_pml2e(pmap, sva)), free)); } /* @@ -5004,7 +5025,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offse vm_page_t m; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - oldpte = pte_load_clear(ptq); + oldpte = be64toh(pte_load_clear(ptq)); if (oldpte & RPTE_WIRED) pmap->pm_stats.wired_count -= 1; pmap_resident_count_dec(pmap, 1); @@ -5038,16 +5059,16 @@ pmap_remove_page(pmap_t pmap, vm_offset_t va, pml3_ent bool invalidate_all; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((*l3e & RPTE_VALID) == 0) { + if ((be64toh(*l3e) & RPTE_VALID) == 0) { return (false); } pte = pmap_l3e_to_pte(l3e, va); - if ((*pte & RPTE_VALID) == 0) { + if ((be64toh(*pte) & RPTE_VALID) == 0) { return (false); } lock = NULL; - invalidate_all = pmap_remove_pte(pmap, pte, va, *l3e, free, &lock); + invalidate_all = pmap_remove_pte(pmap, pte, va, be64toh(*l3e), free, &lock); if (lock != NULL) rw_wunlock(lock); if (!invalidate_all) @@ -5081,7 +5102,7 @@ pmap_remove_ptes(pmap_t pmap, vm_offset_t sva, vm_offs *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 13 18:25:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD1CC2E9828; Fri, 13 Nov 2020 18:25:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXn2C5xF3z4hlg; Fri, 13 Nov 2020 18:25:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE8CA1C5F1; Fri, 13 Nov 2020 18:25:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADIP7G6013485; Fri, 13 Nov 2020 18:25:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADIP7Lg013484; Fri, 13 Nov 2020 18:25:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202011131825.0ADIP7Lg013484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 13 Nov 2020 18:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367645 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 367645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 18:25:07 -0000 Author: emaste Date: Fri Nov 13 18:25:07 2020 New Revision: 367645 URL: https://svnweb.freebsd.org/changeset/base/367645 Log: ip_fastfwd: style(9) tidy for r367628 Discussed with: gnn MFC with: r367628 Modified: head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_input.c Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Fri Nov 13 16:56:03 2020 (r367644) +++ head/sys/netinet/ip_fastfwd.c Fri Nov 13 18:25:07 2020 (r367645) @@ -131,17 +131,18 @@ ip_redir_alloc(struct mbuf *m, struct nhop_object *nh, */ m_free(mcopy); return (NULL); - } + } mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy)); mcopy->m_pkthdr.len = mcopy->m_len; m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); - + if (nh != NULL && ((nh->nh_flags & (NHF_REDIRECT|NHF_DEFAULT)) == 0)) { struct in_ifaddr *nh_ia = (struct in_ifaddr *)(nh->nh_ifa); u_long src = ntohl(ip->ip_src.s_addr); - - if (nh_ia != NULL && (src & nh_ia->ia_subnetmask) == nh_ia->ia_subnet) { + + if (nh_ia != NULL && + (src & nh_ia->ia_subnetmask) == nh_ia->ia_subnet) { if (nh->nh_flags & NHF_GATEWAY) *addr = nh->gw4_sa.sin_addr.s_addr; else Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Fri Nov 13 16:56:03 2020 (r367644) +++ head/sys/netinet/ip_input.c Fri Nov 13 18:25:07 2020 (r367645) @@ -111,7 +111,7 @@ SYSCTL_INT(_net_inet_ip, IPCTL_FORWARDING, forwarding, &VNET_NAME(ipforwarding), 0, "Enable IP forwarding between interfaces"); -/* +/* * Respond with an ICMP host redirect when we forward a packet out of * the same interface on which it was received. See RFC 792. */ From owner-svn-src-all@freebsd.org Fri Nov 13 18:30:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 886D72EA427; Fri, 13 Nov 2020 18:30:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXn8q3Km8z4jYS; Fri, 13 Nov 2020 18:30:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x32e.google.com with SMTP id p22so9366080wmg.3; Fri, 13 Nov 2020 10:30:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JgE1FTKBZcA2LepvqEZxb2reZVhRjgBv6ZO925sFyYM=; b=rLdB7bznx1/IbclTnBL4Brq7c4bQA+SuWYWvKsBKY6H5xcuX+5WshdOeUigh6uq07H xS8m5aWpSBapRi4oEI0xgD1ltFQhHL0iJ5hjM/zasnq0Mt18c0/wLP1WiQt5sFcRsUUN 8HSgQxuRDe62LrDFLurFTjm7T3VTrriKW2dVbT+Bp5ewyAeTu/lyZLk5/J7BDTy/FiCt Lbx100Li9IHcg2tp9UhVGJA0ZFMRjm2MYgt7cJOOEsMUH6VhFbfqclZKy+WYh5SQ5FrL nRZr8PFVX1Ccu2M2mqerU9J+ThhY3nNSABweB+gYJwA9RlE50ivPf4ZDNaYFvzVJJFRH mVYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JgE1FTKBZcA2LepvqEZxb2reZVhRjgBv6ZO925sFyYM=; b=Y2a59ALIA9xbC2ZhnChI6RF9dIvowBqQUyMYNwTxuo8YwkyV9r3LTz85efaUNDyDOv /2KHQ59xyo/qDU8CTgsfNW4LY7rsu1czmQYn5PeUlb9Dm1t0pKZRk8NoBsWVJjbWA9wN cpGsIpaxmvtlajmtbpqeoCCmZsyxK+zOUtalt809FQqqyyYJWlMbLaXDjE4b9NVeB/in 56qRI+hlmJagEsz/wq+8yPnSQiJqHMRBoLf8tMnoTaEVvn7ivLx8xZZUxGU1uHzqZslQ qIa5cLVVzXQRTGAcByCcAYUAIQmF+8SsHZwbV7uOUNnOFSl4HpJbk+KFFEA2/v00wRuE WXdw== X-Gm-Message-State: AOAM5321+Sg3XbUIiobC/e8X5OTI0TJG3Vf5wCK5DOVJ/+ykzEJQQmF3 GXLDggxDVt3Hoh/lz5xBXw2NxtYmst9B7vATaYhHsH0KgMY= X-Google-Smtp-Source: ABdhPJx9ACTGMmx2csSJN1EGEYh8VxKdoVv9m69oQyJ9j5KRahbvCXHmv518TAOIGXxs1Q7lMA4x6vfsGefs84zn1tI= X-Received: by 2002:a1c:e442:: with SMTP id b63mr3969705wmh.10.1605292248731; Fri, 13 Nov 2020 10:30:48 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:dec7:0:0:0:0:0 with HTTP; Fri, 13 Nov 2020 10:30:47 -0800 (PST) In-Reply-To: <202011130931.0AD9VwBL082843@repo.freebsd.org> References: <202011130931.0AD9VwBL082843@repo.freebsd.org> From: Mateusz Guzik Date: Fri, 13 Nov 2020 19:30:47 +0100 Message-ID: Subject: Re: svn commit: r367631 - in head/sys: kern sys To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CXn8q3Km8z4jYS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 18:30:51 -0000 On 11/13/20, Konstantin Belousov wrote: > +static u_long vn_lock_pair_pause_cnt; > +SYSCTL_ULONG(_debug, OID_AUTO, vn_lock_pair_pause, CTLFLAG_RD, > + &vn_lock_pair_pause_cnt, 0, > + "Count of vn_lock_pair deadlocks"); > + > +static void > +vn_lock_pair_pause(const char *wmesg) > +{ > + atomic_add_long(&vn_lock_pair_pause_cnt, 1); > + pause(wmesg, prng32_bounded(hz / 10)); > +} > + > +/* > + * Lock pair of vnodes vp1, vp2, avoiding lock order reversal. > + * vp1_locked indicates whether vp1 is exclusively locked; if not, vp1 > + * must be unlocked. Same for vp2 and vp2_locked. One of the vnodes > + * can be NULL. > + * > + * The function returns with both vnodes exclusively locked, and > + * guarantees that it does not create lock order reversal with other > + * threads during its execution. Both vnodes could be unlocked > + * temporary (and reclaimed). > + */ > +void > +vn_lock_pair(struct vnode *vp1, bool vp1_locked, struct vnode *vp2, > + bool vp2_locked) > +{ > + int error; > + > + if (vp1 == NULL && vp2 == NULL) > + return; > + if (vp1 != NULL) { > + if (vp1_locked) > + ASSERT_VOP_ELOCKED(vp1, "vp1"); > + else > + ASSERT_VOP_UNLOCKED(vp1, "vp1"); > + } else { > + vp1_locked = true; > + } > + if (vp2 != NULL) { > + if (vp2_locked) > + ASSERT_VOP_ELOCKED(vp2, "vp2"); > + else > + ASSERT_VOP_UNLOCKED(vp2, "vp2"); > + } else { > + vp2_locked = true; > + } > + if (!vp1_locked && !vp2_locked) { > + vn_lock(vp1, LK_EXCLUSIVE | LK_RETRY); > + vp1_locked = true; > + } > + > + for (;;) { > + if (vp1_locked && vp2_locked) > + break; > + if (vp1_locked && vp2 != NULL) { > + if (vp1 != NULL) { > + error = VOP_LOCK1(vp2, LK_EXCLUSIVE | LK_NOWAIT, > + __FILE__, __LINE__); > + if (error == 0) > + break; > + VOP_UNLOCK(vp1); > + vp1_locked = false; > + vn_lock_pair_pause("vlp1"); > + } > + vn_lock(vp2, LK_EXCLUSIVE | LK_RETRY); > + vp2_locked = true; > + } > + if (vp2_locked && vp1 != NULL) { > + if (vp2 != NULL) { > + error = VOP_LOCK1(vp1, LK_EXCLUSIVE | LK_NOWAIT, > + __FILE__, __LINE__); > + if (error == 0) > + break; > + VOP_UNLOCK(vp2); > + vp2_locked = false; > + vn_lock_pair_pause("vlp2"); > + } > + vn_lock(vp1, LK_EXCLUSIVE | LK_RETRY); > + vp1_locked = true; > + } > + } > + if (vp1 != NULL) > + ASSERT_VOP_ELOCKED(vp1, "vp1 ret"); > + if (vp2 != NULL) > + ASSERT_VOP_ELOCKED(vp2, "vp2 ret"); > } > Multiple callers who get here with flipped addresses can end up failing against each other in an indefinite loop. Instead, after initial trylocking fails, the routine should establish ordering it will follow for itself, for example by sorting by address. Then pseudo-code would be: retry: vn_lock(lower, ...); if (!VOP_LOCK(higher, LK_NOWAIT ...)) { vn_unlock(lower); vn_lock(higher); vn_unlock(higher); goto retry; } Note this also eliminates the pause. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Fri Nov 13 18:34:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D9B32EA781; Fri, 13 Nov 2020 18:34:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXnDj3flNz4kGS; Fri, 13 Nov 2020 18:34:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E4C61CB18; Fri, 13 Nov 2020 18:34:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADIYDTY020036; Fri, 13 Nov 2020 18:34:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADIYDOo020035; Fri, 13 Nov 2020 18:34:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202011131834.0ADIYDOo020035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 13 Nov 2020 18:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367646 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 367646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 18:34:13 -0000 Author: emaste Date: Fri Nov 13 18:34:13 2020 New Revision: 367646 URL: https://svnweb.freebsd.org/changeset/base/367646 Log: Disable kernel INIT_ALL_ZERO on amd64 It is currently incompatible with kernel ifunc memset. PR: 251083 MFC with: r367577 Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/kern.opts.mk Modified: head/sys/conf/kern.opts.mk ============================================================================== --- head/sys/conf/kern.opts.mk Fri Nov 13 18:25:07 2020 (r367645) +++ head/sys/conf/kern.opts.mk Fri Nov 13 18:34:13 2020 (r367646) @@ -68,6 +68,11 @@ __DEFAULT_NO_OPTIONS = \ # affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP. # Things that don't work based on the CPU +.if ${MACHINE} == "amd64" +# PR251083 conflict between INIT_ALL_ZERO and ifunc memset +BROKEN_OPTIONS+= INIT_ALL_ZERO +.endif + .if ${MACHINE_CPUARCH} == "arm" . if ${MACHINE_ARCH:Marmv[67]*} == "" BROKEN_OPTIONS+= CDDL ZFS From owner-svn-src-all@freebsd.org Fri Nov 13 18:50:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC37C2EA6D6; Fri, 13 Nov 2020 18:50:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXnbN505wz4kyF; Fri, 13 Nov 2020 18:50:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DF3D1C677; Fri, 13 Nov 2020 18:50:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADIoO90026491; Fri, 13 Nov 2020 18:50:24 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADIoOIe026490; Fri, 13 Nov 2020 18:50:24 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202011131850.0ADIoOIe026490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 13 Nov 2020 18:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367647 - head/tests/sys/vm X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/tests/sys/vm X-SVN-Commit-Revision: 367647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 18:50:24 -0000 Author: adrian Date: Fri Nov 13 18:50:24 2020 New Revision: 367647 URL: https://svnweb.freebsd.org/changeset/base/367647 Log: [tests] Fix unused variable warning in gcc Reviewed by: markj, imp, cem, Approved by: markj Differential Revision: https://reviews.freebsd.org/D26792 Modified: head/tests/sys/vm/page_fault_signal.c Modified: head/tests/sys/vm/page_fault_signal.c ============================================================================== --- head/tests/sys/vm/page_fault_signal.c Fri Nov 13 18:34:13 2020 (r367646) +++ head/tests/sys/vm/page_fault_signal.c Fri Nov 13 18:50:24 2020 (r367647) @@ -107,7 +107,6 @@ ATF_TC_WITHOUT_HEAD(page_fault_signal__segv_accerr_2); ATF_TC_BODY(page_fault_signal__segv_accerr_2, tc) { int *p; - volatile int dummy; int sz; sz = getpagesize(); @@ -115,7 +114,7 @@ ATF_TC_BODY(page_fault_signal__segv_accerr_2, tc) ATF_REQUIRE(p != MAP_FAILED); if (sigsetjmp(sig_env, 1) == 0) { setup_signals(); - dummy = *p; + (void)*(volatile int *)p; } (void)munmap(p, sz); ATF_CHECK_EQ(SIGSEGV, last_sig); From owner-svn-src-all@freebsd.org Fri Nov 13 19:08:43 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F3342EB01B; Fri, 13 Nov 2020 19:08:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXp0W06yFz4lvg; Fri, 13 Nov 2020 19:08:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E70361CFB8; Fri, 13 Nov 2020 19:08:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADJ8gRB038840; Fri, 13 Nov 2020 19:08:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADJ8goO038839; Fri, 13 Nov 2020 19:08:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202011131908.0ADJ8goO038839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 13 Nov 2020 19:08:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367648 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 367648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:08:43 -0000 Author: emaste Date: Fri Nov 13 19:08:42 2020 New Revision: 367648 URL: https://svnweb.freebsd.org/changeset/base/367648 Log: Fix `make makeman` after r367577 WITH_INIT_ALL_ZERO and WITH_INIT_ALL_PATTERN are mutually exclusive. The .error when they were both set broke makeman so demote it to a warning (and presumably the compiler will fail on an error later on). We could improve this to make one take precedence but this is sufficient for now. MFC with: r367577 Sponsored by: The FreeBSD Foundation Modified: head/share/mk/bsd.opts.mk Modified: head/share/mk/bsd.opts.mk ============================================================================== --- head/share/mk/bsd.opts.mk Fri Nov 13 18:50:24 2020 (r367647) +++ head/share/mk/bsd.opts.mk Fri Nov 13 19:08:42 2020 (r367648) @@ -88,7 +88,7 @@ __DEFAULT_DEPENDENT_OPTIONS = \ .include .if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes" -.error WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive. +.warning WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive. .endif # From owner-svn-src-all@freebsd.org Fri Nov 13 19:09:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C4062EB030; Fri, 13 Nov 2020 19:09:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXp1G0LZDz4mH1; Fri, 13 Nov 2020 19:09:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F34D31D330; Fri, 13 Nov 2020 19:09:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADJ9L9D038916; Fri, 13 Nov 2020 19:09:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADJ9LrG038915; Fri, 13 Nov 2020 19:09:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202011131909.0ADJ9LrG038915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 13 Nov 2020 19:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367649 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 367649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:09:22 -0000 Author: emaste Date: Fri Nov 13 19:09:21 2020 New Revision: 367649 URL: https://svnweb.freebsd.org/changeset/base/367649 Log: src.conf.5: regenerate after r367577 INIT_ALL_ZERO / INIT_ALL_PATTERN Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Fri Nov 13 19:08:42 2020 (r367648) +++ head/share/man/man5/src.conf.5 Fri Nov 13 19:09:21 2020 (r367649) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd November 4, 2020 +.Dd November 13, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -757,6 +757,15 @@ Set to not build .Xr inetd 8 . .It Va WITHOUT_INET_SUPPORT Set to build libraries, programs, and kernel modules without IPv4 support. +.It Va WITH_INIT_ALL_PATTERN +Set to build the base system or kernel with stack variables initialized to +.Pq compiler defined +debugging patterns on function entry. +This option requires the clang compiler. +.It Va WITH_INIT_ALL_ZERO +Set to build the base system or kernel with stack variables initialized +to zero on function entry. +This option requires that the clang compiler be used. .It Va WITHOUT_INSTALLLIB Set this to not install optional libraries. For example, when creating a From owner-svn-src-all@freebsd.org Fri Nov 13 19:13:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2CAD2EB1F8; Fri, 13 Nov 2020 19:13:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXp5S2PJdz4mvh; Fri, 13 Nov 2020 19:12:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0ADJCqWQ026795 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 13 Nov 2020 21:12:55 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0ADJCqWQ026795 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0ADJCq8T026794; Fri, 13 Nov 2020 21:12:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 Nov 2020 21:12:52 +0200 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r367631 - in head/sys: kern sys Message-ID: References: <202011130931.0AD9VwBL082843@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CXp5S2PJdz4mvh X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:13:00 -0000 On Fri, Nov 13, 2020 at 08:24:30AM -0800, Conrad Meyer wrote: > Hi Konstantin, > > On Fri, Nov 13, 2020 at 1:32 AM Konstantin Belousov wrote: > > > > Author: kib > > Date: Fri Nov 13 09:31:57 2020 > > New Revision: 367631 > > URL: https://svnweb.freebsd.org/changeset/base/367631 > > > > Log: > > Implement vn_lock_pair(). > > > > Modified: head/sys/kern/vfs_vnops.c > > ============================================================================== > > --- head/sys/kern/vfs_vnops.c Fri Nov 13 02:05:45 2020 (r367630) > > +++ head/sys/kern/vfs_vnops.c Fri Nov 13 09:31:57 2020 (r367631) > > @@ -3317,4 +3325,92 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, > > ... > > + > > +static void > > +vn_lock_pair_pause(const char *wmesg) > > +{ > > + atomic_add_long(&vn_lock_pair_pause_cnt, 1); > > + pause(wmesg, prng32_bounded(hz / 10)); > > +} > > This function is called when the try-lock of the second lock in the > pair (either order) fails. The back-off period is up to 100ms, > expected average 50ms. That seems really high? It is called only in deadlock avoidance case, where we already have to drop to slow path for other reasons (this is coming in the patch that I hope to commit today). My selection of numbers were driven by more or less realistic estimates of the vnode lock ownership time for sync io on very busy HDD, there was a short discussion of it with Mark in review. > > Separately: prng32_bounded() may return 0, which is transparently > converted to the equivalent of 1 by pause_sbt(9). This means a 1 tick > pause is marginally more likely than any other possible duration. It > probably doesn't matter. I do not quite understand the point. Do you want the 0->1 conversion be explicit there ? Or something else ? From owner-svn-src-all@freebsd.org Fri Nov 13 19:14:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EA822EB268; Fri, 13 Nov 2020 19:14:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXp7d3yQDz4mtM; Fri, 13 Nov 2020 19:14:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0ADJEjMW026842 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 13 Nov 2020 21:14:48 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0ADJEjMW026842 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0ADJEjDL026841; Fri, 13 Nov 2020 21:14:45 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 Nov 2020 21:14:45 +0200 From: Konstantin Belousov To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367631 - in head/sys: kern sys Message-ID: References: <202011130931.0AD9VwBL082843@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CXp7d3yQDz4mtM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:14:54 -0000 On Fri, Nov 13, 2020 at 07:30:47PM +0100, Mateusz Guzik wrote: > On 11/13/20, Konstantin Belousov wrote: > > +static u_long vn_lock_pair_pause_cnt; > > +SYSCTL_ULONG(_debug, OID_AUTO, vn_lock_pair_pause, CTLFLAG_RD, > > + &vn_lock_pair_pause_cnt, 0, > > + "Count of vn_lock_pair deadlocks"); > > + > > +static void > > +vn_lock_pair_pause(const char *wmesg) > > +{ > > + atomic_add_long(&vn_lock_pair_pause_cnt, 1); > > + pause(wmesg, prng32_bounded(hz / 10)); > > +} > > + > > +/* > > + * Lock pair of vnodes vp1, vp2, avoiding lock order reversal. > > + * vp1_locked indicates whether vp1 is exclusively locked; if not, vp1 > > + * must be unlocked. Same for vp2 and vp2_locked. One of the vnodes > > + * can be NULL. > > + * > > + * The function returns with both vnodes exclusively locked, and > > + * guarantees that it does not create lock order reversal with other > > + * threads during its execution. Both vnodes could be unlocked > > + * temporary (and reclaimed). > > + */ > > +void > > +vn_lock_pair(struct vnode *vp1, bool vp1_locked, struct vnode *vp2, > > + bool vp2_locked) > > +{ > > + int error; > > + > > + if (vp1 == NULL && vp2 == NULL) > > + return; > > + if (vp1 != NULL) { > > + if (vp1_locked) > > + ASSERT_VOP_ELOCKED(vp1, "vp1"); > > + else > > + ASSERT_VOP_UNLOCKED(vp1, "vp1"); > > + } else { > > + vp1_locked = true; > > + } > > + if (vp2 != NULL) { > > + if (vp2_locked) > > + ASSERT_VOP_ELOCKED(vp2, "vp2"); > > + else > > + ASSERT_VOP_UNLOCKED(vp2, "vp2"); > > + } else { > > + vp2_locked = true; > > + } > > + if (!vp1_locked && !vp2_locked) { > > + vn_lock(vp1, LK_EXCLUSIVE | LK_RETRY); > > + vp1_locked = true; > > + } > > + > > + for (;;) { > > + if (vp1_locked && vp2_locked) > > + break; > > + if (vp1_locked && vp2 != NULL) { > > + if (vp1 != NULL) { > > + error = VOP_LOCK1(vp2, LK_EXCLUSIVE | LK_NOWAIT, > > + __FILE__, __LINE__); > > + if (error == 0) > > + break; > > + VOP_UNLOCK(vp1); > > + vp1_locked = false; > > + vn_lock_pair_pause("vlp1"); > > + } > > + vn_lock(vp2, LK_EXCLUSIVE | LK_RETRY); > > + vp2_locked = true; > > + } > > + if (vp2_locked && vp1 != NULL) { > > + if (vp2 != NULL) { > > + error = VOP_LOCK1(vp1, LK_EXCLUSIVE | LK_NOWAIT, > > + __FILE__, __LINE__); > > + if (error == 0) > > + break; > > + VOP_UNLOCK(vp2); > > + vp2_locked = false; > > + vn_lock_pair_pause("vlp2"); > > + } > > + vn_lock(vp1, LK_EXCLUSIVE | LK_RETRY); > > + vp1_locked = true; > > + } > > + } > > + if (vp1 != NULL) > > + ASSERT_VOP_ELOCKED(vp1, "vp1 ret"); > > + if (vp2 != NULL) > > + ASSERT_VOP_ELOCKED(vp2, "vp2 ret"); > > } > > > > Multiple callers who get here with flipped addresses can end up > failing against each other in an indefinite loop. > > Instead, after initial trylocking fails, the routine should establish > ordering it will follow for itself, for example by sorting by address. > > Then pseudo-code would be: > retry: > vn_lock(lower, ...); > if (!VOP_LOCK(higher, LK_NOWAIT ...)) { > vn_unlock(lower); > vn_lock(higher); > vn_unlock(higher); > goto retry; > } > > Note this also eliminates the pause. I disagree. It will conflict with normal locking order with 50% probability. My code switches between two orders, eventually getting out of this situation. From owner-svn-src-all@freebsd.org Fri Nov 13 19:17:33 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BA2F2EB5BE for ; Fri, 13 Nov 2020 19:17:33 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXpBj188Bz4nLs for ; Fri, 13 Nov 2020 19:17:33 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f46.google.com with SMTP id a65so10283523wme.1 for ; Fri, 13 Nov 2020 11:17:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JeOCoD9b2v9dQ0oaM79ClsfCysF0Vni1Xvvwpd3tcfE=; b=h5oVS+wG2wkaqszDB3aZMxYoPCsCOnw585Wx29H/rRa0VQFggNImguQjr1VcEdgOv7 ouZnULHENaez2YaY5CPHw2uQakVHesjGxaXRQrFiyjRrcZKgv50MYN+WGh/QiuThY9nZ cZNpB8kh00+P+o6y/BXSoYVoWfUL6032+ZjneHOm+FZwyjctBUz3QczCuMeifiPGok2f 90T2JnPaqJ5a0OocNu3GcOzHrGnsp3Obk7gVdP0AbhVtSf425HPo39fwdn10kor9VeFD FdGx9lAVrzuEhGWw0n0JGH9vnsEG6riQiodGBJ69xyQFCUySvc+MnnaEla3Hq0knqlVm 2HvQ== X-Gm-Message-State: AOAM53149Lz4FdOHmUNkmlIcJQK8Z8gXpxxqqV3jHnJB1B3XoinP6ixG yNhFyNQKlsk7gHyZ6Wwt6z/ZGg== X-Google-Smtp-Source: ABdhPJyKW/GemKGFeUS2CwuWoE/yb0/dVtlaa704r9G71YDNcj40b5k1BdzUavDcLgTHtrCIhAU18A== X-Received: by 2002:a1c:4c0a:: with SMTP id z10mr3966203wmf.96.1605295051046; Fri, 13 Nov 2020 11:17:31 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id v16sm11828220wml.33.2020.11.13.11.17.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Nov 2020 11:17:30 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: svn commit: r367648 - head/share/mk From: Jessica Clarke In-Reply-To: <202011131908.0ADJ8goO038839@repo.freebsd.org> Date: Fri, 13 Nov 2020 19:17:28 +0000 Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <647236BA-1263-4ABA-B03F-3789592EB649@freebsd.org> References: <202011131908.0ADJ8goO038839@repo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CXpBj188Bz4nLs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:17:33 -0000 On 13 Nov 2020, at 19:08, Ed Maste wrote: > > Author: emaste > Date: Fri Nov 13 19:08:42 2020 > New Revision: 367648 > URL: https://svnweb.freebsd.org/changeset/base/367648 > > Log: > Fix `make makeman` after r367577 > > WITH_INIT_ALL_ZERO and WITH_INIT_ALL_PATTERN are mutually exclusive. > The .error when they were both set broke makeman so demote it to a > warning (and presumably the compiler will fail on an error later on). > > We could improve this to make one take precedence but this is sufficient > for now. You won't get an error. Currently bsd.{prog,lib}.mk and kern.mk check MK_INIT_ALL_ZERO then MK_INIT_ALL_PATTERN so the former takes precedence, but I suspect that if you were to pass the compiler flags for both the last flag would just override anything else, as is the case for most compiler flags. Jess From owner-svn-src-all@freebsd.org Fri Nov 13 19:22:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04F6A2EB88C; Fri, 13 Nov 2020 19:22:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXpJs6hF0z4nLn; Fri, 13 Nov 2020 19:22:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8DCA1D552; Fri, 13 Nov 2020 19:22:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADJMrjk051010; Fri, 13 Nov 2020 19:22:53 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADJMrmC051009; Fri, 13 Nov 2020 19:22:53 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011131922.0ADJMrmC051009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 13 Nov 2020 19:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367650 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:22:54 -0000 Author: mjg Date: Fri Nov 13 19:22:53 2020 New Revision: 367650 URL: https://svnweb.freebsd.org/changeset/base/367650 Log: malloc: retire MALLOC_PROFILE The global array has prohibitive performance impact on multicore systems. The same data (and more) can be obtained with dtrace. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27199 Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Fri Nov 13 19:09:21 2020 (r367649) +++ head/sys/kern/kern_malloc.c Fri Nov 13 19:22:53 2020 (r367650) @@ -223,12 +223,6 @@ SYSCTL_PROC(_vm_malloc, OID_AUTO, zone_sizes, */ struct mtx malloc_mtx; -#ifdef MALLOC_PROFILE -uint64_t krequests[KMEM_ZSIZE + 1]; - -static int sysctl_kern_mprof(SYSCTL_HANDLER_ARGS); -#endif - static int sysctl_kern_malloc_stats(SYSCTL_HANDLER_ARGS); #if defined(MALLOC_MAKE_FAILURES) || (MALLOC_DEBUG_MAXZONES > 1) @@ -635,9 +629,6 @@ void * size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; indx = kmemsize[size >> KMEM_ZSHIFT]; zone = kmemzones[indx].kz_zone[mtp_get_subzone(mtp)]; -#ifdef MALLOC_PROFILE - krequests[size >> KMEM_ZSHIFT]++; -#endif va = uma_zalloc(zone, flags); if (va != NULL) size = zone->uz_size; @@ -673,9 +664,6 @@ malloc_domain(size_t *sizep, int *indxp, struct malloc size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; indx = kmemsize[size >> KMEM_ZSHIFT]; zone = kmemzones[indx].kz_zone[mtp_get_subzone(mtp)]; -#ifdef MALLOC_PROFILE - krequests[size >> KMEM_ZSHIFT]++; -#endif va = uma_zalloc_domain(zone, NULL, domain, flags); if (va != NULL) *sizep = zone->uz_size; @@ -1495,52 +1483,3 @@ DB_SHOW_COMMAND(multizone_matches, db_show_multizone_m } #endif /* MALLOC_DEBUG_MAXZONES > 1 */ #endif /* DDB */ - -#ifdef MALLOC_PROFILE - -static int -sysctl_kern_mprof(SYSCTL_HANDLER_ARGS) -{ - struct sbuf sbuf; - uint64_t count; - uint64_t waste; - uint64_t mem; - int error; - int rsize; - int size; - int i; - - waste = 0; - mem = 0; - - error = sysctl_wire_old_buffer(req, 0); - if (error != 0) - return (error); - sbuf_new_for_sysctl(&sbuf, NULL, 128, req); - sbuf_printf(&sbuf, - "\n Size Requests Real Size\n"); - for (i = 0; i < KMEM_ZSIZE; i++) { - size = i << KMEM_ZSHIFT; - rsize = kmemzones[kmemsize[i]].kz_size; - count = (long long unsigned)krequests[i]; - - sbuf_printf(&sbuf, "%6d%28llu%11d\n", size, - (unsigned long long)count, rsize); - - if ((rsize * count) > (size * count)) - waste += (rsize * count) - (size * count); - mem += (rsize * count); - } - sbuf_printf(&sbuf, - "\nTotal memory used:\t%30llu\nTotal Memory wasted:\t%30llu\n", - (unsigned long long)mem, (unsigned long long)waste); - error = sbuf_finish(&sbuf); - sbuf_delete(&sbuf); - return (error); -} - -SYSCTL_OID(_kern, OID_AUTO, mprof, - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, NULL, 0, - sysctl_kern_mprof, "A", - "Malloc Profiling"); -#endif /* MALLOC_PROFILE */ From owner-svn-src-all@freebsd.org Fri Nov 13 19:47:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A96C2EC128; Fri, 13 Nov 2020 19:47:17 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXps10jqlz4pp2; Fri, 13 Nov 2020 19:47:17 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BF0E1D992; Fri, 13 Nov 2020 19:47:17 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADJlGvq064617; Fri, 13 Nov 2020 19:47:16 GMT (envelope-from bcran@FreeBSD.org) Received: (from bcran@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADJlGbr064616; Fri, 13 Nov 2020 19:47:16 GMT (envelope-from bcran@FreeBSD.org) Message-Id: <202011131947.0ADJlGbr064616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcran set sender to bcran@FreeBSD.org using -f From: Rebecca Cran Date: Fri, 13 Nov 2020 19:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367651 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: bcran X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 367651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:47:17 -0000 Author: bcran Date: Fri Nov 13 19:47:16 2020 New Revision: 367651 URL: https://svnweb.freebsd.org/changeset/base/367651 Log: bhyve: update smbiostbl.c to bump the version and release date Since lots of work has been done on bhyve since 2014, increase the version to 13.0 to match 13-CURRENT, and update the release date. Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D27147 Modified: head/usr.sbin/bhyve/smbiostbl.c Modified: head/usr.sbin/bhyve/smbiostbl.c ============================================================================== --- head/usr.sbin/bhyve/smbiostbl.c Fri Nov 13 19:22:53 2020 (r367650) +++ head/usr.sbin/bhyve/smbiostbl.c Fri Nov 13 19:47:16 2020 (r367651) @@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$"); #define SMBIOS_BASE 0xF1000 +#define FIRMWARE_VERSION "13.0" +#define FIRMWARE_RELEASE_DATE "11/10/2020" + /* BHYVE_ACPI_BASE - SMBIOS_BASE) */ #define SMBIOS_MAX_LENGTH (0xF2400 - 0xF1000) @@ -323,9 +326,9 @@ struct smbios_table_type0 smbios_type0_template = { }; const char *smbios_type0_strings[] = { - "BHYVE", /* vendor string */ - "1.00", /* bios version string */ - "03/14/2014", /* bios release date string */ + "BHYVE", /* vendor string */ + FIRMWARE_VERSION, /* bios version string */ + FIRMWARE_RELEASE_DATE, /* bios release date string */ NULL }; From owner-svn-src-all@freebsd.org Fri Nov 13 19:55:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64BA62EC580; Fri, 13 Nov 2020 19:55:24 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXq2N2L4Dz4qWb; Fri, 13 Nov 2020 19:55:24 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 3D5213D1B; Fri, 13 Nov 2020 19:55:24 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f172.google.com with SMTP id 3so7587225qtx.3; Fri, 13 Nov 2020 11:55:24 -0800 (PST) X-Gm-Message-State: AOAM533BnviqK/Ub+IMatZRPwmzX7KP/nP/NilOtaFjXPA1mnWCWt4ow au40mpf/vWwmhYX2wLsNHjGiFIcbIAmPR/7VWT4= X-Google-Smtp-Source: ABdhPJwq2JGaCiUBLCVIyybWevIULGNLJSALwe6MLPb11Z33OIFUIDhS3RNHlYWGTtUID5e7vK0ZMUYJSvhNvttD0D4= X-Received: by 2002:ac8:4e87:: with SMTP id 7mr3416242qtp.310.1605297323419; Fri, 13 Nov 2020 11:55:23 -0800 (PST) MIME-Version: 1.0 References: <202011131850.0ADIoOIe026490@repo.freebsd.org> In-Reply-To: <202011131850.0ADIoOIe026490@repo.freebsd.org> From: Kyle Evans Date: Fri, 13 Nov 2020 13:55:09 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r367647 - head/tests/sys/vm To: Adrian Chadd Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:55:24 -0000 On Fri, Nov 13, 2020 at 12:50 PM Adrian Chadd wrote: > > Author: adrian > Date: Fri Nov 13 18:50:24 2020 > New Revision: 367647 > URL: https://svnweb.freebsd.org/changeset/base/367647 > > Log: > [tests] Fix unused variable warning in gcc > > Reviewed by: markj, imp, cem, > Approved by: markj > Differential Revision: https://reviews.freebsd.org/D26792 > > Modified: > head/tests/sys/vm/page_fault_signal.c > > Modified: head/tests/sys/vm/page_fault_signal.c > ============================================================================== > --- head/tests/sys/vm/page_fault_signal.c Fri Nov 13 18:34:13 2020 (r367646) > +++ head/tests/sys/vm/page_fault_signal.c Fri Nov 13 18:50:24 2020 (r367647) > @@ -115,7 +114,7 @@ ATF_TC_BODY(page_fault_signal__segv_accerr_2, tc) > ATF_REQUIRE(p != MAP_FAILED); > if (sigsetjmp(sig_env, 1) == 0) { > setup_signals(); > - dummy = *p; > + (void)*(volatile int *)p; > } > (void)munmap(p, sz); > ATF_CHECK_EQ(SIGSEGV, last_sig); A minor nit, we could/should probably add an explicit atf_tc_fail() after the access. While it seems unlikely that the compiler might elide it and it would still fail anyways because last_sig would certainly not be SIGSEGV, it'd be good to catch it earlier with an explicit fail. I don't recall how good atf-c's diagnostics are otherwise, if it'd be clear that last_sig == 0 or not without requiring further triage. Thanks, Kyle Evans From owner-svn-src-all@freebsd.org Fri Nov 13 20:03:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1309A2EBFF5 for ; Fri, 13 Nov 2020 20:03:19 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXqCV5gxwz4qlY for ; Fri, 13 Nov 2020 20:03:18 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72a.google.com with SMTP id v143so10018426qkb.2 for ; Fri, 13 Nov 2020 12:03:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=PhJ1AV869pj3vOC8tLB/cyOkeOKryxJuwkoxHkKl1Ik=; b=ASf9fiTB3lLQR7OXfaY1F1Cz7kHswMkfIfGq8SxtfaUfFDVjrwSR5IdNJzZCwW6Cwg yTjmZstcpgo40udqHcrgpJ5AdO6n8tdqxWzVAi8I9UlodjlHgEgbMEc816hqo1VQgxbZ d5vnBwoB9StyLdIibE5mDyY2qEZnv627hPCwwxS9H7E2inpV0rynabMAnHTJMOuchvr6 FWIn3U8E30y94jmFeAhjbEgZIRkrIXhoBVsqSyHNcdHAFyagPoubPRw1vdS9tbPX0VbU nlTnKKDYCRhVzpp0SFsxkiyocSNIsrThQcwqXhCyEIvBVdR9PystnCpPwDO+b6C4/HOH 7MZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PhJ1AV869pj3vOC8tLB/cyOkeOKryxJuwkoxHkKl1Ik=; b=mKPJaSb4krrJHcYns17jGORG9ftdgEpyTu6whhM5x0HCMtusP7Nlr8wmdcXT8viaPt i1BinTERjSUnTy5Fkc09fr1ypVqNr7qD+cyiqQLR+aeep+WvZsis0d+TBoXdvfFT77o5 fbJUYkYYeCv6KsX8k20TjTxyPR2ipwv+u1mnvpjBd2gafPgbwDJdVMp+EXUvMVnGYAU1 c2YBy1Eu8TR953+0kG6p+Cp3WuRlIAenVXveidFn0dDKrokX7it2D+M4oUCAzsKunDKA phOHEImJvFxnXaiGD/S+O/SgwuKnEcxY/56cTBmYB6K0rn/TinS2VQIRVl7zyOqeml8T R06g== X-Gm-Message-State: AOAM5333WM/0cp1KFNTqWM3x3UZZ2Qaqc2E3c0kGbNZBOiel9nVNwEm5 t1AQvET6HYs0j7ZSZnY+mPLBng== X-Google-Smtp-Source: ABdhPJy6y4Zj3rw6ufdgNNgnG/DZRDGodPOHia+y4IstZEtmlxeg8Va1pHLd28HOYC5D1DBkliW7gw== X-Received: by 2002:a37:7846:: with SMTP id t67mr3654501qkc.196.1605297797689; Fri, 13 Nov 2020 12:03:17 -0800 (PST) Received: from mutt-hbsd ([38.140.209.220]) by smtp.gmail.com with ESMTPSA id s68sm7418700qkc.43.2020.11.13.12.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 12:03:16 -0800 (PST) Date: Fri, 13 Nov 2020 15:03:16 -0500 From: Shawn Webb To: Rebecca Cran Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367651 - head/usr.sbin/bhyve Message-ID: <20201113200316.3wa4xfdu6hohk4ny@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202011131947.0ADJlGbr064616@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uxhql5wmb3dysgfy" Content-Disposition: inline In-Reply-To: <202011131947.0ADJlGbr064616@repo.freebsd.org> X-Rspamd-Queue-Id: 4CXqCV5gxwz4qlY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 20:03:19 -0000 --uxhql5wmb3dysgfy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 13, 2020 at 07:47:16PM +0000, Rebecca Cran wrote: > Author: bcran > Date: Fri Nov 13 19:47:16 2020 > New Revision: 367651 > URL: https://svnweb.freebsd.org/changeset/base/367651 >=20 > Log: > bhyve: update smbiostbl.c to bump the version and release date > =20 > Since lots of work has been done on bhyve since 2014, increase the vers= ion > to 13.0 to match 13-CURRENT, and update the release date. > =20 > Reviewed by: grehan > Differential Revision: https://reviews.freebsd.org/D27147 >=20 > Modified: > head/usr.sbin/bhyve/smbiostbl.c >=20 > Modified: head/usr.sbin/bhyve/smbiostbl.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/bhyve/smbiostbl.c Fri Nov 13 19:22:53 2020 (r367650) > +++ head/usr.sbin/bhyve/smbiostbl.c Fri Nov 13 19:47:16 2020 (r367651) > @@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$"); > =20 > #define SMBIOS_BASE 0xF1000 > =20 > +#define FIRMWARE_VERSION "13.0" > +#define FIRMWARE_RELEASE_DATE "11/10/2020" Style nit: shouldn't there be a tab between #define and the macro? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --uxhql5wmb3dysgfy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl+u5oEACgkQ/y5nonf4 4froNw//XrQjOJkNUJo3JwCg/8pPd5XmFVOQLFIVtPT2RjcEOYv5i5gyy0dhOTqp C9GfEcK56/YYFvf5kX37mxVol4FOy2umM54RQNvXAujTDpCkoI5cPCOx8+JSlI5W hAwYx/eeK8mq+NPc1crvINIlHVeByQ1RLrAwbACcoGjWaJV0oFTqs6KBZtW9uP/B gNtb0dNHpEnNx2wXnA8PIKRgiLjduo1IlWxXjVSMu4eFRECAkbxmBr5Y8yg5Rg+N bx1hj1vfUzGzgwABEBzUZOP61KLJU0Jexks1wgITCcS3qh8hgX+D5Qc6eUDbDsdT DZ2udzsc7q5mLg2X03WY7X5QOog3jMesN+PaHOKUv1y9sl2MnysvkWkVqk4B4bWK xvi5s3Bh14XI7mEDwEN1gD8hELCexbYaN/0xHJGoVaADRsEpGWo5oDcrk2kFi6Bb Le8E3uHobhn6ykcmb/UIYKvWoog2OqDLV3Ibbjyun4xkMtRZ5Ca4Ip+AB2VxSAZd KOjk18z1xC7SArL+j3bsfoaY4tKHKRWk9tRL8qsLIEjPpODygHSA6G0WIPUJdnLJ IsFbBKpaby64BnXHFNYBIpP1QzFIobYYsxX0VUV14ZgjxTZ8t9Jz2/0fPRmTF0Hw 8stuTSryalyvrRQPTy9nT0ABjTeKw5XuI6sUD4YgIKLEx7DM6hw= =jdcg -----END PGP SIGNATURE----- --uxhql5wmb3dysgfy-- From owner-svn-src-all@freebsd.org Fri Nov 13 21:07:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 289102ED8B2; Fri, 13 Nov 2020 21:07:10 +0000 (UTC) (envelope-from rebecca@bsdio.com) Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXrdB08PYz4vFf; Fri, 13 Nov 2020 21:07:09 +0000 (UTC) (envelope-from rebecca@bsdio.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=bsdio.com; s=xmission; h=Subject:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Sender:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=HQTP27XK4mm3BJ6kc7WPQRedlDnfTfNybP7hjpQslsk=; b=mwuBJdag8mvV0bJ1g7ARmCgV4N muLxoob47dic1tcCpQJ+IZYEjJVUveA1cKzmsyFDljS19q58ek4a/Ar29DpaDhmUW8Zse+EIv95cJ 39SjpfOv6ZPSFhvnwqViXv/zQu6xHSqmhgmoQVHLmOv2/BaKqxQrsBKJIi9TQjT7n33U=; Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kdgHj-00AOA0-L5; Fri, 13 Nov 2020 14:07:07 -0700 Received: from mta4.zcs.xmission.com ([166.70.13.68]) by in01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1kdgHj-0005kY-4B; Fri, 13 Nov 2020 14:07:07 -0700 Received: from localhost (localhost [127.0.0.1]) by mta4.zcs.xmission.com (Postfix) with ESMTP id D7798500203; Fri, 13 Nov 2020 14:07:06 -0700 (MST) X-Amavis-Modified: Mail body modified (using disclaimer) - mta4.zcs.xmission.com Received: from mta4.zcs.xmission.com ([127.0.0.1]) by localhost (mta4.zcs.xmission.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id jMRRXhs348xl; Fri, 13 Nov 2020 14:07:06 -0700 (MST) Received: from [10.0.10.142] (c-174-52-16-57.hsd1.ut.comcast.net [174.52.16.57]) by mta4.zcs.xmission.com (Postfix) with ESMTPSA id 9ECF35001C5; Fri, 13 Nov 2020 14:07:06 -0700 (MST) To: Shawn Webb , Rebecca Cran Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011131947.0ADJlGbr064616@repo.freebsd.org> <20201113200316.3wa4xfdu6hohk4ny@mutt-hbsd> From: Rebecca Cran Message-ID: <57dc312b-2264-22cd-0ef1-31083d404d4c@bsdio.com> Date: Fri, 13 Nov 2020 14:07:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201113200316.3wa4xfdu6hohk4ny@mutt-hbsd> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-XM-SPF: eid=1kdgHj-0005kY-4B; ; ; mid=<57dc312b-2264-22cd-0ef1-31083d404d4c@bsdio.com>; ; ; hst=in01.mta.xmission.com; ; ; ip=166.70.13.68; ; ; frm=rebecca@bsdio.com; ; ; spf=none X-SA-Exim-Connect-IP: 166.70.13.68 X-SA-Exim-Mail-From: rebecca@bsdio.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa08.xmission.com X-Spam-Level: X-Spam-Status: No, score=0.1 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,NICE_REPLY_A,T_TM2_M_HEADER_IN_MSG,TooManyTo_001 autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5001] * 0.3 TooManyTo_001 Multiple "To" Header Recipients 2x (uncommon) * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; IP=ok Body=1 Fuz1=1] [Fuz2=1] * -0.0 NICE_REPLY_A Looks like a legit reply (A) X-Spam-DCC: XMission; sa08 1397; IP=ok Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Shawn Webb , Rebecca Cran X-Spam-Relay-Country: X-Spam-Timing: total 308 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 14 (4.4%), b_tie_ro: 11 (3.7%), parse: 1.46 (0.5%), extract_message_metadata: 5.0 (1.6%), get_uri_detail_list: 0.24 (0.1%), tests_pri_-1000: 3.0 (1.0%), tests_pri_-950: 1.78 (0.6%), tests_pri_-900: 1.46 (0.5%), tests_pri_-90: 105 (34.3%), check_bayes: 103 (33.5%), b_tokenize: 6 (2.0%), b_tok_get_all: 5.0 (1.6%), b_comp_prob: 2.2 (0.7%), b_tok_touch_all: 84 (27.4%), b_finish: 1.56 (0.5%), tests_pri_0: 160 (52.2%), check_dkim_signature: 0.47 (0.2%), check_dkim_adsp: 75 (24.3%), poll_dns_idle: 68 (22.2%), tests_pri_10: 3.9 (1.3%), tests_pri_500: 9 (2.8%), rewrite_mail: 0.00 (0.0%) Subject: Re: svn commit: r367651 - head/usr.sbin/bhyve X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) X-Rspamd-Queue-Id: 4CXrdB08PYz4vFf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 21:07:10 -0000 On 11/13/20 1:03 PM, Shawn Webb wrote: > > Style nit: shouldn't there be a tab between #define and the macro? Thanks, I'll try and remember that in future. -- Rebecca Cran From owner-svn-src-all@freebsd.org Fri Nov 13 21:41:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC4C42EE15D; Fri, 13 Nov 2020 21:41:19 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXsNb4pz5z3CrG; Fri, 13 Nov 2020 21:41:19 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D3741F088; Fri, 13 Nov 2020 21:41:19 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADLfJ4q035740; Fri, 13 Nov 2020 21:41:19 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADLfF9H034858; Fri, 13 Nov 2020 21:41:15 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <202011132141.0ADLfF9H034858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 13 Nov 2020 21:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r367652 - in vendor-sys/acpica/dist: . generate/lint generate/unix/acpihelp source/common source/compiler source/components/events source/components/namespace source/include source/tool... X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in vendor-sys/acpica/dist: . generate/lint generate/unix/acpihelp source/common source/compiler source/components/events source/components/namespace source/include source/tools/acpihelp X-SVN-Commit-Revision: 367652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 21:41:19 -0000 Author: jkim Date: Fri Nov 13 21:41:15 2020 New Revision: 367652 URL: https://svnweb.freebsd.org/changeset/base/367652 Log: Import ACPICA 20201113. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/lint/std32.lnt vendor-sys/acpica/dist/generate/lint/std64.lnt vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile vendor-sys/acpica/dist/source/common/ahuuids.c vendor-sys/acpica/dist/source/compiler/aslbtypes.c vendor-sys/acpica/dist/source/compiler/aslcodegen.c vendor-sys/acpica/dist/source/compiler/aslmap.c vendor-sys/acpica/dist/source/compiler/aslmessages.c vendor-sys/acpica/dist/source/compiler/aslmessages.h vendor-sys/acpica/dist/source/compiler/aslnamesp.c vendor-sys/acpica/dist/source/compiler/aslopcodes.c vendor-sys/acpica/dist/source/compiler/aslprimaries.y vendor-sys/acpica/dist/source/compiler/aslrules.y vendor-sys/acpica/dist/source/compiler/asltypes.y vendor-sys/acpica/dist/source/components/events/evregion.c vendor-sys/acpica/dist/source/components/namespace/nspredef.c vendor-sys/acpica/dist/source/components/namespace/nsprepkg.c vendor-sys/acpica/dist/source/components/namespace/nsrepair2.c vendor-sys/acpica/dist/source/include/accommon.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/acuuid.h vendor-sys/acpica/dist/source/tools/acpihelp/acpihelp.h vendor-sys/acpica/dist/source/tools/acpihelp/ahdecode.c vendor-sys/acpica/dist/source/tools/acpihelp/ahmain.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/changes.txt Fri Nov 13 21:41:15 2020 (r367652) @@ -1,6 +1,94 @@ ---------------------------------------- +13 November 2020. Summary of changes for version 20201113: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Interpreter: fixed a memory leak by using use existing buffer in _HID +repair. There was a memory leak that occurred when a _CID object is +defined as a package containing string objects. When _CID is checked for +any possible repairs, it calls a helper function to repair _HID (because +_CID basically contains multiple _HID entries). The _HID repair function +assumes that string objects are standalone objects that are not contained +inside of any packages. The _HID repair function replaced the string +object with a brand new object and attempted to delete the old object by +decrementing the reference count of the old object. Strings inside of +packages have a reference count of 2 so the _HID repair function leaves +this object in a dangling state and causes a memory leak. Instead of +allocating a brand new object and removing the old object, use the +existing object when repairing the _HID object. + +Added function trace macros to improve namespace debugging. The namespace +repair mechanism does not have function tracing macros. Add several trace +macros to improve debuggability. + +Handle "orphan" _REG methods for GPIO OpRegions. Before this change +AcpiEvExecuteRegMethods() had special handling to handle "orphan" (no +matching OpRegion declared) _REG methods for EC nodes. On Intel Cherry +Trail devices there are 2 possible ACPI OpRegions for accessing GPIOs. +The standard GeneralPurposeIo OpRegion and the Cherry Trail - specific +UserDefined 0x9X OpRegions. Having 2 different types of OpRegions leads +to potential issues with checks for OpRegion availability, or in other +words checks if _REG has been called for the OpRegion which the ACPI code +wants to use. Except for the "orphan" EC handling, ACPICA core does not +call _REG on an ACPI node which does not define an OpRegion matching the +type being registered; and the reference design DSDT, from which most +Cherry Trail DSDTs are derived, does not define GeneralPurposeIo, nor +UserDefined(0x93) OpRegions for the GPO2 (UID 3) device, because no pins +were assigned ACPI controlled functions in the reference design. Together +this leads to the perfect storm, at least on the Cherry Trail based +Medion Akayo E1239T. This design does use a GPO2 pin from its ACPI code +and has added the Cherry Trail specific UserDefined(0x93) opregion to its +GPO2 ACPI node to access this pin. But it uses a "has _REG been called" +availability check for the standard GeneralPurposeIo OpRegion. This +clearly is a bug in the DSDT, but this does work under Windows. This +issue leads to the intel vbtn driver reporting the device always being in +tablet-mode at boot, even if it is in laptop mode. Which in turn causes +userspace to ignore touchpad events. So in other words, this issue causes +the touchpad to not work at boot. This change fixes this by extending the +"orphan" _REG method handling to also apply to GPIO address-space +handlers. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: Added more info to namespace dump file (-ln option). In a separate +section of the dump file (after the main namespace dump), emit the full +pathname for each namespace node, its type, and the ASL filename and line +number where it is declared. + +AcpiHelp: Added an option to display/decode iASL exceptions. Option is: - +x [Hex Value] where "Hex Value" is the iASL exception code. If Hex Value +is omitted, all iASL exceptions are displayed. + +iASL: Use StringLiteral instead of StringData for some ASL macros. The +use of the stringData rule allows for some "string" oriented opcodes +(Such as ToString, ToHexString, etc.) None of which make sense with the +macros in question. This change modifies the StringData part of the rule +for these macros to a simple string literal - thus disallowing the use +of ToString, ToHexString, etc. +The following ASL operators (macros) are affected: +EisaId +Fprintf +Printf +ToUuid +Unicode +Note: The MS compiler requires the use of string literals for these +operators also. + +iASL: Added a remark for an unknown UUID: ASL_MSG_UUID_NOT_FOUND. Search +the list of "known" UUIDs for the input to the ToUUID macro. + +Added 5 new UUIDs to the known UUID table. All related to NVDIMM and the +NFIT table. + + +---------------------------------------- + 25 September 2020. Summary of changes for version 20200925: This release is available at https://acpica.org/downloads @@ -41,7 +129,7 @@ names: _SBT _SBW -AML Disassembler: Added a new command, "All ". This command will evaluate all objects in the current namespace whose NameString contains the input NameSeg as the last element of the NameString. Useful for debugging. @@ -55,6 +143,11 @@ with lengths that exceed the initializer list. iASL: added more detail to external resolution error message when compiling multiple definition blocks. +iASL: added a remark for an attempt to create a nameseg or namestring +containing lower-case letters. This should prevent declaring multiple +namesegs or namestrings in an attempt to refer to different objects (with +different cases), but actually refer to the same object(s). + iASL: improve alias analysis by saving object type. If the alias is a method type, the parameter count is also recorded. @@ -3702,7 +3795,7 @@ iASL compiler, all ACPICA utilities, and the test suit Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix GPE storm issues. A raw gpe handling mechanism was created to allow better handling of GPE storms that aren't easily managed by the normal handler. The raw handler -allows disabling/renabling of the the GPE so that interrupt storms can be +allows disabling/renabling of the GPE so that interrupt storms can be avoided in cases where events cannot be timely serviced. In this scenario, handlers should use the AcpiSetGpe() API to disable/enable the GPE. This API will leave the reference counts undisturbed, thereby Modified: vendor-sys/acpica/dist/generate/lint/std32.lnt ============================================================================== --- vendor-sys/acpica/dist/generate/lint/std32.lnt Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/generate/lint/std32.lnt Fri Nov 13 21:41:15 2020 (r367652) @@ -6,7 +6,7 @@ -d_MSC_VER=1 +fll // enable long long +rw(__asm) // enable in-line assembly --esym( 950, __asm) +-esym( 950, __asm) // Used to track stack use -si4 -sp4 Modified: vendor-sys/acpica/dist/generate/lint/std64.lnt ============================================================================== --- vendor-sys/acpica/dist/generate/lint/std64.lnt Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/generate/lint/std64.lnt Fri Nov 13 21:41:15 2020 (r367652) @@ -14,4 +14,4 @@ -si4 -sl4 -sp8 -sll8 co.lnt -options.lnt +options.lnt Modified: vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile Fri Nov 13 21:41:15 2020 (r367652) @@ -22,7 +22,8 @@ vpath %.c \ $(ACPIHELP)\ $(ACPICA_COMMON)\ $(ACPICA_UTILITIES)\ - $(ACPICA_OSL) + $(ACPICA_OSL)\ + $(ASL_COMPILER) HEADERS = \ $(wildcard $(ACPIHELP)/*.h) @@ -40,6 +41,7 @@ OBJECTS = \ $(OBJDIR)/ahmain.o\ $(OBJDIR)/ahtable.o\ $(OBJDIR)/ahuuids.o\ + $(OBJDIR)/aslmessages.o\ $(OBJDIR)/getopt.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/utdebug.o\ Modified: vendor-sys/acpica/dist/source/common/ahuuids.c ============================================================================== --- vendor-sys/acpica/dist/source/common/ahuuids.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/common/ahuuids.c Fri Nov 13 21:41:15 2020 (r367652) @@ -181,6 +181,7 @@ const AH_UUID Gbl_AcpiUuids[] = {"Physical Presence Interface", UUID_PHYSICAL_PRESENCE}, {"[Non-volatile DIMM and NFIT table]", NULL}, + {"NVDIMM Device", UUID_NFIT_DIMM}, {"Volatile Memory Region", UUID_VOLATILE_MEMORY}, {"Persistent Memory Region", UUID_PERSISTENT_MEMORY}, {"NVDIMM Control Region", UUID_CONTROL_REGION}, @@ -189,6 +190,10 @@ const AH_UUID Gbl_AcpiUuids[] = {"Volatile Virtual CD", UUID_VOLATILE_VIRTUAL_CD}, {"Persistent Virtual Disk", UUID_PERSISTENT_VIRTUAL_DISK}, {"Persistent Virtual CD", UUID_PERSISTENT_VIRTUAL_CD}, + {"Microsoft NVDIMM Command set",UUID_NFIT_DIMM_N_MSFT}, + {"HP NDIMM HPE1", UUID_NFIT_DIMM_N_HPE1}, + {"HP NDIMM HPE2", UUID_NFIT_DIMM_N_HPE2}, + {"Virtual NVDIMM", UUID_NFIT_DIMM_N_HYPERV}, {"[Processor Properties]", NULL}, {"Cache Properties", UUID_CACHE_PROPERTIES}, Modified: vendor-sys/acpica/dist/source/compiler/aslbtypes.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslbtypes.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslbtypes.c Fri Nov 13 21:41:15 2020 (r367652) @@ -672,7 +672,7 @@ AnMapObjTypeToBtype ( * * PARAMETERS: Btype - Bitfield of ACPI types * - * RETURN: The Etype corresponding the the Btype + * RETURN: The Etype corresponding the Btype * * DESCRIPTION: Convert a bitfield type to an encoded type * Modified: vendor-sys/acpica/dist/source/compiler/aslcodegen.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcodegen.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslcodegen.c Fri Nov 13 21:41:15 2020 (r367652) @@ -700,7 +700,7 @@ CgUpdateHeader ( Checksum = (UINT8) (0 - Sum); - /* Re-write the the checksum byte */ + /* Re-write the checksum byte */ FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset + ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum)); Modified: vendor-sys/acpica/dist/source/compiler/aslmap.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmap.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslmap.c Fri Nov 13 21:41:15 2020 (r367652) @@ -538,7 +538,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* UART_SERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* UART_SERIALBUSV2 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, OP_AML_PACKAGE, 0), +/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, OP_AML_PACKAGE, ACPI_BTYPE_BUFFER), /* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0), /* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0), /* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_PRESERVE, 0, 0), Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.c Fri Nov 13 21:41:15 2020 (r367652) @@ -384,6 +384,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_EXTERNAL_FOUND_HERE */ "External declaration below ", /* ASL_MSG_LOWER_CASE_NAMESEG */ "At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case", /* ASL_MSG_LOWER_CASE_NAMEPATH */ "At least one lower case letter found in NamePath, ASL is case insensitive - converting to upper case", +/* ASL_MSG_UUID_NOT_FOUND */ "Unknown UUID string" }; /* Table compiler */ @@ -457,7 +458,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs)) { - return ("[Unknown ASL Compiler exception ID]"); + return ("[Unknown iASL Compiler exception ID]"); } } @@ -470,7 +471,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs)) { - return ("[Unknown Table Compiler exception ID]"); + return ("[Unknown iASL Table Compiler exception ID]"); } } @@ -483,7 +484,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs)) { - return ("[Unknown Preprocessor exception ID]"); + return ("[Unknown iASL Preprocessor exception ID]"); } } @@ -491,7 +492,7 @@ AeDecodeMessageId ( else { - return ("[Unknown exception/component ID]"); + return ("[Unknown iASL exception ID]"); } return (MessageTable[Index]); @@ -559,3 +560,79 @@ AeBuildFullExceptionCode ( */ return (((Level + 1) * 1000) + MessageId); } + + +#ifdef ACPI_HELP_APP +/******************************************************************************* + * + * FUNCTION: AhDecodeAslException + * + * PARAMETERS: HexString - iASL status string from command line, in + * hex. If null, display all exceptions. + * + * RETURN: None + * + * DESCRIPTION: Decode and display an iASL exception code. Note1: a + * NULL string for HexString displays all known iASL exceptions. Note2: + * implements the -x option for AcpiHelp. + * + ******************************************************************************/ + +#define AH_DISPLAY_ASL_EXCEPTION_TEXT(Status, Exception) \ + printf ("%.4X: %s\n", Status, Exception) + +#define AH_DISPLAY_EXCEPTION(Status, Name) \ + printf ("%.4X: %s\n", Status, Name) + + +void +AhDecodeAslException ( + char *HexString) +{ + UINT32 i; + UINT32 MessageId; + const char *OneException; + UINT32 Index = 1; + + + /* + * A null input string means to decode and display all known + * exception codes. + */ + if (!HexString) + { + printf ("All defined iASL exception codes:\n\n"); + printf ("Main iASL exceptions:\n\n"); + AH_DISPLAY_EXCEPTION (0, + "AE_OK (No error occurred)"); + + /* Display codes in each block of exception types */ + + for (i = 1; Index < ACPI_ARRAY_LENGTH (AslCompilerMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslCompilerMsgs[i]); + } + + printf ("\niASL Table Compiler exceptions:\n\n"); + Index = ASL_MSG_TABLE_COMPILER; + for (i = 0; i < ACPI_ARRAY_LENGTH (AslTableCompilerMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslTableCompilerMsgs[i]); + } + + printf ("\niASL Preprocessor exceptions:\n\n"); + Index = ASL_MSG_PREPROCESSOR; + for (i = 0; i < ACPI_ARRAY_LENGTH (AslPreprocessorMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslPreprocessorMsgs[i]); + } + return; + } + + /* HexString is valid - convert it to a MessageId and decode it */ + + MessageId = strtol (HexString, NULL, 16); + OneException = AeDecodeMessageId ((UINT16) MessageId); + AH_DISPLAY_ASL_EXCEPTION_TEXT (MessageId, OneException); +} +#endif Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Nov 13 21:41:15 2020 (r367652) @@ -152,7 +152,6 @@ #ifndef __ASLMESSAGES_H #define __ASLMESSAGES_H - /* These values must match error type string tables in aslmessages.c */ typedef enum @@ -167,9 +166,12 @@ typedef enum } ASL_MESSAGE_TYPES; - #define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings for types above */ +void +AhDecodeAslException ( + char *HexString); + /* * Exception code blocks, 0 - 999 * Available for new exception blocks: 600 - 999 @@ -386,6 +388,7 @@ typedef enum ASL_MSG_EXTERNAL_FOUND_HERE, ASL_MSG_LOWER_CASE_NAMESEG, ASL_MSG_LOWER_CASE_NAMEPATH, + ASL_MSG_UUID_NOT_FOUND, /* These messages are used by the Data Table compiler only */ Modified: vendor-sys/acpica/dist/source/compiler/aslnamesp.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslnamesp.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslnamesp.c Fri Nov 13 21:41:15 2020 (r367652) @@ -226,8 +226,8 @@ NsDisplayNamespace ( /* File header */ - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n"); - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n"); + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n" + "Count Depth Name - Type\n\n"); /* Walk entire namespace from the root */ @@ -239,14 +239,21 @@ NsDisplayNamespace ( return (Status); } - /* Print the full pathname for each namespace node */ + /* Print the full pathname for each namespace node in the common namespace */ - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, + "\nNamespace pathnames and where declared:\n" + "\n\n"); Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL, NULL, NULL); + /* + * We just dumped the entire common namespace, we don't want to do it + * again for other input files. + */ + AslGbl_NsOutputFlag = FALSE; return (Status); } @@ -512,7 +519,7 @@ NsDoOneNamespaceObject ( * * RETURN: Status * - * DESCRIPTION: Print the full pathname for a namespace node. + * DESCRIPTION: Print the full pathname and addtional info for a namespace node. * ******************************************************************************/ @@ -528,6 +535,13 @@ NsDoOnePathname ( ACPI_BUFFER TargetPath; + /* Ignore predefined namespace nodes and External declarations */ + + if (!Node->Op || (Node->Flags & ANOBJ_IS_EXTERNAL)) + { + return (AE_OK); + } + TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiNsHandleToPathname (Node, &TargetPath, FALSE); if (ACPI_FAILURE (Status)) @@ -535,8 +549,15 @@ NsDoOnePathname ( return (Status); } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", - ACPI_CAST_PTR (char, TargetPath.Pointer)); + /* + * Print the full pathname (and other information) + * for each namespace node in the common namespace + */ + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%-41s %-12s %s, %u\n", + ACPI_CAST_PTR (char, TargetPath.Pointer), + AcpiUtGetTypeName (Node->Type), + Node->Op->Asl.Filename, Node->Op->Asl.LogicalLineNumber); + ACPI_FREE (TargetPath.Pointer); return (AE_OK); } Modified: vendor-sys/acpica/dist/source/compiler/aslopcodes.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslopcodes.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslopcodes.c Fri Nov 13 21:41:15 2020 (r367652) @@ -798,7 +798,13 @@ OpcDoUuId ( } else { + /* Convert UUID string to a buffer, check for a known UUID */ + AcpiUtConvertStringToUuid (InString, Buffer); + if (!AcpiAhMatchUuid (Buffer)) + { + AslError (ASL_REMARK, ASL_MSG_UUID_NOT_FOUND, Op, NULL); + } } /* Change Op to a Buffer */ Modified: vendor-sys/acpica/dist/source/compiler/aslprimaries.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslprimaries.y Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslprimaries.y Fri Nov 13 21:41:15 2020 (r367652) @@ -500,7 +500,7 @@ DivideTerm EISAIDTerm : PARSEOP_EISAID PARSEOP_OPEN_PAREN - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_EISAID, $3);} | PARSEOP_EISAID PARSEOP_OPEN_PAREN @@ -635,7 +635,7 @@ FprintfTerm : PARSEOP_FPRINTF PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FPRINTF);} TermArg ',' - StringData + StringLiteral PrintfArgList PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$6,$7);} | PARSEOP_FPRINTF @@ -1091,7 +1091,7 @@ PowerResTerm PrintfTerm : PARSEOP_PRINTF PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PRINTF);} - StringData + StringLiteral PrintfArgList PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} | PARSEOP_PRINTF @@ -1412,7 +1412,7 @@ ToStringTerm ToUUIDTerm : PARSEOP_TOUUID PARSEOP_OPEN_PAREN - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_TOUUID, $3);} | PARSEOP_TOUUID PARSEOP_OPEN_PAREN @@ -1422,7 +1422,7 @@ ToUUIDTerm UnicodeTerm : PARSEOP_UNICODE PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_UNICODE);} - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,0,$4);} | PARSEOP_UNICODE PARSEOP_OPEN_PAREN Modified: vendor-sys/acpica/dist/source/compiler/aslrules.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslrules.y Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/aslrules.y Fri Nov 13 21:41:15 2020 (r367652) @@ -523,6 +523,10 @@ StringData | String {} ; +StringLiteral + : String {} + ; + ByteConst : Integer {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);} ; Modified: vendor-sys/acpica/dist/source/compiler/asltypes.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asltypes.y Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/compiler/asltypes.y Fri Nov 13 21:41:15 2020 (r367652) @@ -178,6 +178,7 @@ NoEcho(' %type RequiredTarget %type SimpleName %type StringData +%type StringLiteral %type Target %type Term %type TermArg Modified: vendor-sys/acpica/dist/source/components/events/evregion.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evregion.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/components/events/evregion.c Fri Nov 13 21:41:15 2020 (r367652) @@ -164,9 +164,11 @@ extern UINT8 AcpiGbl_DefaultAddressSpaces[]; /* Local prototypes */ static void -AcpiEvOrphanEcRegMethod ( - ACPI_NAMESPACE_NODE *EcDeviceNode); +AcpiEvExecuteOrphanRegMethod ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_ADR_SPACE_TYPE SpaceId); + static ACPI_STATUS AcpiEvRegRun ( ACPI_HANDLE ObjHandle, @@ -869,11 +871,13 @@ AcpiEvExecuteRegMethods ( (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &Info, NULL); - /* Special case for EC: handle "orphan" _REG methods with no region */ - - if (SpaceId == ACPI_ADR_SPACE_EC) + /* + * Special case for EC and GPIO: handle "orphan" _REG methods with + * no region. + */ + if (SpaceId == ACPI_ADR_SPACE_EC || SpaceId == ACPI_ADR_SPACE_GPIO) { - AcpiEvOrphanEcRegMethod (Node); + AcpiEvExecuteOrphanRegMethod (Node, SpaceId); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, @@ -954,32 +958,29 @@ AcpiEvRegRun ( /******************************************************************************* * - * FUNCTION: AcpiEvOrphanEcRegMethod + * FUNCTION: AcpiEvExecuteOrphanRegMethod * - * PARAMETERS: EcDeviceNode - Namespace node for an EC device + * PARAMETERS: DeviceNode - Namespace node for an ACPI device + * SpaceId - The address space ID * * RETURN: None * - * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC + * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI * device. This is a _REG method that has no corresponding region - * within the EC device scope. The orphan _REG method appears to - * have been enabled by the description of the ECDT in the ACPI - * specification: "The availability of the region space can be - * detected by providing a _REG method object underneath the - * Embedded Controller device." + * within the device's scope. ACPI tables depending on these + * "orphan" _REG methods have been seen for both EC and GPIO + * Operation Regions. Presumably the Windows ACPI implementation + * always calls the _REG method independent of the presence of + * an actual Operation Region with the correct address space ID. * - * To quickly access the EC device, we use the EcDeviceNode used - * during EC handler installation. Otherwise, we would need to - * perform a time consuming namespace walk, executing _HID - * methods to find the EC device. - * * MUTEX: Assumes the namespace is locked * ******************************************************************************/ static void -AcpiEvOrphanEcRegMethod ( - ACPI_NAMESPACE_NODE *EcDeviceNode) +AcpiEvExecuteOrphanRegMethod ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_ADR_SPACE_TYPE SpaceId) { ACPI_HANDLE RegMethod; ACPI_NAMESPACE_NODE *NextNode; @@ -988,10 +989,10 @@ AcpiEvOrphanEcRegMethod ( ACPI_OBJECT Objects[2]; - ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); + ACPI_FUNCTION_TRACE (EvExecuteOrphanRegMethod); - if (!EcDeviceNode) + if (!DeviceNode) { return_VOID; } @@ -1002,7 +1003,7 @@ AcpiEvOrphanEcRegMethod ( /* Get a handle to a _REG method immediately under the EC device */ - Status = AcpiGetHandle (EcDeviceNode, METHOD_NAME__REG, &RegMethod); + Status = AcpiGetHandle (DeviceNode, METHOD_NAME__REG, &RegMethod); if (ACPI_FAILURE (Status)) { goto Exit; /* There is no _REG method present */ @@ -1015,25 +1016,25 @@ AcpiEvOrphanEcRegMethod ( * with other space IDs to be present; but the code below will then * execute the _REG method with the EmbeddedControl SpaceID argument. */ - NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); + NextNode = AcpiNsGetNextNode (DeviceNode, NULL); while (NextNode) { if ((NextNode->Type == ACPI_TYPE_REGION) && (NextNode->Object) && - (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) + (NextNode->Object->Region.SpaceId == SpaceId)) { goto Exit; /* Do not execute the _REG */ } - NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); + NextNode = AcpiNsGetNextNode (DeviceNode, NextNode); } - /* Evaluate the _REG(EmbeddedControl,Connect) method */ + /* Evaluate the _REG(SpaceId,Connect) method */ Args.Count = 2; Args.Pointer = Objects; Objects[0].Type = ACPI_TYPE_INTEGER; - Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; + Objects[0].Integer.Value = SpaceId; Objects[1].Type = ACPI_TYPE_INTEGER; Objects[1].Integer.Value = ACPI_REG_CONNECT; Modified: vendor-sys/acpica/dist/source/components/namespace/nspredef.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nspredef.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/components/namespace/nspredef.c Fri Nov 13 21:41:15 2020 (r367652) @@ -223,13 +223,14 @@ AcpiNsCheckReturnValue ( ACPI_STATUS Status; const ACPI_PREDEFINED_INFO *Predefined; + ACPI_FUNCTION_TRACE (NsCheckReturnValue); /* If not a predefined name, we cannot validate the return object */ Predefined = Info->Predefined; if (!Predefined) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -239,7 +240,7 @@ AcpiNsCheckReturnValue ( if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -259,7 +260,7 @@ AcpiNsCheckReturnValue ( (!Predefined->Info.ExpectedBtypes) || (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -325,7 +326,7 @@ Exit: Node->Flags |= ANOBJ_EVALUATED; } - return (Status); + return_ACPI_STATUS (Status); } Modified: vendor-sys/acpica/dist/source/components/namespace/nsprepkg.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsprepkg.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/components/namespace/nsprepkg.c Fri Nov 13 21:41:15 2020 (r367652) @@ -214,7 +214,7 @@ AcpiNsCheckPackage ( UINT32 i; - ACPI_FUNCTION_NAME (NsCheckPackage); + ACPI_FUNCTION_TRACE (NsCheckPackage); /* The package info for this name is in the next table entry */ @@ -245,13 +245,13 @@ AcpiNsCheckPackage ( { if (Package->RetInfo.Type == ACPI_PTYPE1_VAR) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return Package has no elements (empty)")); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } /* @@ -305,7 +305,7 @@ AcpiNsCheckPackage ( Package->RetInfo.ObjectType1, i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements++; @@ -338,7 +338,7 @@ AcpiNsCheckPackage ( Package->RetInfo3.ObjectType[i], i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } } else @@ -349,7 +349,7 @@ AcpiNsCheckPackage ( Package->RetInfo3.TailObjectType, i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } } @@ -365,7 +365,7 @@ AcpiNsCheckPackage ( Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements++; @@ -384,7 +384,7 @@ AcpiNsCheckPackage ( Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* @@ -428,7 +428,7 @@ AcpiNsCheckPackage ( Info, ReturnObject, ReturnObjectPtr); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* Update locals to point to the new package (of 1 element) */ @@ -466,7 +466,7 @@ AcpiNsCheckPackage ( Package->RetInfo.ObjectType1, 0); if (ACPI_FAILURE(Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* Validate length of the UUID buffer */ @@ -475,14 +475,14 @@ AcpiNsCheckPackage ( { ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Invalid length for UUID Buffer")); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } Status = AcpiNsCheckObjectType(Info, Elements + 1, Package->RetInfo.ObjectType2, 0); if (ACPI_FAILURE(Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements += 2; @@ -498,10 +498,10 @@ AcpiNsCheckPackage ( "Invalid internal return type in table entry: %X", Package->RetInfo.Type)); - return (AE_AML_INTERNAL); + return_ACPI_STATUS (AE_AML_INTERNAL); } - return (Status); + return_ACPI_STATUS (Status); PackageTooSmall: @@ -512,7 +512,7 @@ PackageTooSmall: "Return Package is too small - found %u elements, expected %u", Count, ExpectedCount)); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } @@ -865,6 +865,8 @@ AcpiNsCheckPackageElements ( UINT32 i; + ACPI_FUNCTION_TRACE (NsCheckPackageElements); + /* * Up to two groups of package elements are supported by the data * structure. All elements in each group must be of the same type. @@ -876,7 +878,7 @@ AcpiNsCheckPackageElements ( Type1, i + StartIndex); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } ThisElement++; @@ -888,11 +890,11 @@ AcpiNsCheckPackageElements ( Type2, (i + Count1 + StartIndex)); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } ThisElement++; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } Modified: vendor-sys/acpica/dist/source/components/namespace/nsrepair2.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsrepair2.c Fri Nov 13 19:47:16 2020 (r367651) +++ vendor-sys/acpica/dist/source/components/namespace/nsrepair2.c Fri Nov 13 21:41:15 2020 (r367652) @@ -321,16 +321,18 @@ AcpiNsComplexRepairs ( ACPI_STATUS Status; + ACPI_FUNCTION_TRACE (NsComplexRepairs); + /* Check if this name is in the list of repairable names */ Predefined = AcpiNsMatchComplexRepair (Node); if (!Predefined) { - return (ValidateStatus); + return_ACPI_STATUS (ValidateStatus); } Status = Predefined->RepairFunction (Info, ReturnObjectPtr); - return (Status); + return_ACPI_STATUS (Status); } @@ -526,20 +528,21 @@ AcpiNsRepair_CID ( UINT16 OriginalRefCount; UINT32 i; + ACPI_FUNCTION_TRACE (NsRepair_CID); /* Check for _CID as a simple string */ if (ReturnObject->Common.Type == ACPI_TYPE_STRING) { Status = AcpiNsRepair_HID (Info, ReturnObjectPtr); - return (Status); + return_ACPI_STATUS (Status); } /* Exit if not a Package */ if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* Examine each element of the _CID package */ @@ -553,7 +556,7 @@ AcpiNsRepair_CID ( Status = AcpiNsRepair_HID (Info, ElementPtr); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } if (OriginalElement != *ElementPtr) @@ -567,7 +570,7 @@ AcpiNsRepair_CID ( ElementPtr++; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } @@ -687,9 +690,8 @@ AcpiNsRepair_HID ( ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT *NewString; - char *Source; char *Dest; + char *Source; ACPI_FUNCTION_NAME (NsRepair_HID); @@ -699,7 +701,7 @@ AcpiNsRepair_HID ( if (ReturnObject->Common.Type != ACPI_TYPE_STRING) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } if (ReturnObject->String.Length == 0) @@ -711,17 +713,9 @@ AcpiNsRepair_HID ( /* Return AE_OK anyway, let driver handle it */ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); + return_ACPI_STATUS (AE_OK); } - /* It is simplest to always create a new string object */ - - NewString = AcpiUtCreateStringObject (ReturnObject->String.Length); - if (!NewString) - { - return (AE_NO_MEMORY); - } - /* * Remove a leading asterisk if present. For some unknown reason, there * are many machines in the field that contains IDs like this. @@ -732,7 +726,7 @@ AcpiNsRepair_HID ( if (*Source == '*') { Source++; - NewString->String.Length--; + ReturnObject->String.Length--; ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Removed invalid leading asterisk\n", Info->FullPathname)); @@ -746,14 +740,13 @@ AcpiNsRepair_HID ( * "NNNN####" where N is an uppercase letter or decimal digit, and * # is a hex digit. */ - for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) + for (Dest = ReturnObject->String.Pointer; *Source; Dest++, Source++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 13 21:41:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB1752EE3C0; Fri, 13 Nov 2020 21:41:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXsP74QBZz3CsD; Fri, 13 Nov 2020 21:41:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 804A91F107; Fri, 13 Nov 2020 21:41:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADLflfd037241; Fri, 13 Nov 2020 21:41:47 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADLfl8g037240; Fri, 13 Nov 2020 21:41:47 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <202011132141.0ADLfl8g037240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 13 Nov 2020 21:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r367653 - vendor-sys/acpica/20201113 X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: vendor-sys/acpica/20201113 X-SVN-Commit-Revision: 367653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 21:41:47 -0000 Author: jkim Date: Fri Nov 13 21:41:47 2020 New Revision: 367653 URL: https://svnweb.freebsd.org/changeset/base/367653 Log: Tag ACPICA 20201113. Added: vendor-sys/acpica/20201113/ - copied from r367652, vendor-sys/acpica/dist/ From owner-svn-src-all@freebsd.org Fri Nov 13 22:45:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 504A92EF4B4; Fri, 13 Nov 2020 22:45:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXtpg1gPzz3GPH; Fri, 13 Nov 2020 22:45:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C25C1F573; Fri, 13 Nov 2020 22:45:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADMjVpk076406; Fri, 13 Nov 2020 22:45:31 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADMjRP1076384; Fri, 13 Nov 2020 22:45:27 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <202011132245.0ADMjRP1076384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 13 Nov 2020 22:45:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367654 - in head/sys/contrib/dev/acpica: . common compiler components/events components/namespace include X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/sys/contrib/dev/acpica: . common compiler components/events components/namespace include X-SVN-Commit-Revision: 367654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 22:45:31 -0000 Author: jkim Date: Fri Nov 13 22:45:26 2020 New Revision: 367654 URL: https://svnweb.freebsd.org/changeset/base/367654 Log: MFV: r367652 Merge ACPICA 20201113. Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/ahuuids.c head/sys/contrib/dev/acpica/compiler/aslbtypes.c head/sys/contrib/dev/acpica/compiler/aslcodegen.c head/sys/contrib/dev/acpica/compiler/aslmap.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslnamesp.c head/sys/contrib/dev/acpica/compiler/aslopcodes.c head/sys/contrib/dev/acpica/compiler/aslprimaries.y head/sys/contrib/dev/acpica/compiler/aslrules.y head/sys/contrib/dev/acpica/compiler/asltypes.y head/sys/contrib/dev/acpica/components/events/evregion.c head/sys/contrib/dev/acpica/components/namespace/nspredef.c head/sys/contrib/dev/acpica/components/namespace/nsprepkg.c head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c head/sys/contrib/dev/acpica/include/accommon.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acuuid.h Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/changes.txt Fri Nov 13 22:45:26 2020 (r367654) @@ -1,6 +1,94 @@ ---------------------------------------- +13 November 2020. Summary of changes for version 20201113: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Interpreter: fixed a memory leak by using use existing buffer in _HID +repair. There was a memory leak that occurred when a _CID object is +defined as a package containing string objects. When _CID is checked for +any possible repairs, it calls a helper function to repair _HID (because +_CID basically contains multiple _HID entries). The _HID repair function +assumes that string objects are standalone objects that are not contained +inside of any packages. The _HID repair function replaced the string +object with a brand new object and attempted to delete the old object by +decrementing the reference count of the old object. Strings inside of +packages have a reference count of 2 so the _HID repair function leaves +this object in a dangling state and causes a memory leak. Instead of +allocating a brand new object and removing the old object, use the +existing object when repairing the _HID object. + +Added function trace macros to improve namespace debugging. The namespace +repair mechanism does not have function tracing macros. Add several trace +macros to improve debuggability. + +Handle "orphan" _REG methods for GPIO OpRegions. Before this change +AcpiEvExecuteRegMethods() had special handling to handle "orphan" (no +matching OpRegion declared) _REG methods for EC nodes. On Intel Cherry +Trail devices there are 2 possible ACPI OpRegions for accessing GPIOs. +The standard GeneralPurposeIo OpRegion and the Cherry Trail - specific +UserDefined 0x9X OpRegions. Having 2 different types of OpRegions leads +to potential issues with checks for OpRegion availability, or in other +words checks if _REG has been called for the OpRegion which the ACPI code +wants to use. Except for the "orphan" EC handling, ACPICA core does not +call _REG on an ACPI node which does not define an OpRegion matching the +type being registered; and the reference design DSDT, from which most +Cherry Trail DSDTs are derived, does not define GeneralPurposeIo, nor +UserDefined(0x93) OpRegions for the GPO2 (UID 3) device, because no pins +were assigned ACPI controlled functions in the reference design. Together +this leads to the perfect storm, at least on the Cherry Trail based +Medion Akayo E1239T. This design does use a GPO2 pin from its ACPI code +and has added the Cherry Trail specific UserDefined(0x93) opregion to its +GPO2 ACPI node to access this pin. But it uses a "has _REG been called" +availability check for the standard GeneralPurposeIo OpRegion. This +clearly is a bug in the DSDT, but this does work under Windows. This +issue leads to the intel vbtn driver reporting the device always being in +tablet-mode at boot, even if it is in laptop mode. Which in turn causes +userspace to ignore touchpad events. So in other words, this issue causes +the touchpad to not work at boot. This change fixes this by extending the +"orphan" _REG method handling to also apply to GPIO address-space +handlers. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: Added more info to namespace dump file (-ln option). In a separate +section of the dump file (after the main namespace dump), emit the full +pathname for each namespace node, its type, and the ASL filename and line +number where it is declared. + +AcpiHelp: Added an option to display/decode iASL exceptions. Option is: - +x [Hex Value] where "Hex Value" is the iASL exception code. If Hex Value +is omitted, all iASL exceptions are displayed. + +iASL: Use StringLiteral instead of StringData for some ASL macros. The +use of the stringData rule allows for some "string" oriented opcodes +(Such as ToString, ToHexString, etc.) None of which make sense with the +macros in question. This change modifies the StringData part of the rule +for these macros to a simple string literal - thus disallowing the use +of ToString, ToHexString, etc. +The following ASL operators (macros) are affected: +EisaId +Fprintf +Printf +ToUuid +Unicode +Note: The MS compiler requires the use of string literals for these +operators also. + +iASL: Added a remark for an unknown UUID: ASL_MSG_UUID_NOT_FOUND. Search +the list of "known" UUIDs for the input to the ToUUID macro. + +Added 5 new UUIDs to the known UUID table. All related to NVDIMM and the +NFIT table. + + +---------------------------------------- + 25 September 2020. Summary of changes for version 20200925: This release is available at https://acpica.org/downloads @@ -41,7 +129,7 @@ names: _SBT _SBW -AML Disassembler: Added a new command, "All ". This command will evaluate all objects in the current namespace whose NameString contains the input NameSeg as the last element of the NameString. Useful for debugging. @@ -55,6 +143,11 @@ with lengths that exceed the initializer list. iASL: added more detail to external resolution error message when compiling multiple definition blocks. +iASL: added a remark for an attempt to create a nameseg or namestring +containing lower-case letters. This should prevent declaring multiple +namesegs or namestrings in an attempt to refer to different objects (with +different cases), but actually refer to the same object(s). + iASL: improve alias analysis by saving object type. If the alias is a method type, the parameter count is also recorded. @@ -3702,7 +3795,7 @@ iASL compiler, all ACPICA utilities, and the test suit Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix GPE storm issues. A raw gpe handling mechanism was created to allow better handling of GPE storms that aren't easily managed by the normal handler. The raw handler -allows disabling/renabling of the the GPE so that interrupt storms can be +allows disabling/renabling of the GPE so that interrupt storms can be avoided in cases where events cannot be timely serviced. In this scenario, handlers should use the AcpiSetGpe() API to disable/enable the GPE. This API will leave the reference counts undisturbed, thereby Modified: head/sys/contrib/dev/acpica/common/ahuuids.c ============================================================================== --- head/sys/contrib/dev/acpica/common/ahuuids.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/common/ahuuids.c Fri Nov 13 22:45:26 2020 (r367654) @@ -181,6 +181,7 @@ const AH_UUID Gbl_AcpiUuids[] = {"Physical Presence Interface", UUID_PHYSICAL_PRESENCE}, {"[Non-volatile DIMM and NFIT table]", NULL}, + {"NVDIMM Device", UUID_NFIT_DIMM}, {"Volatile Memory Region", UUID_VOLATILE_MEMORY}, {"Persistent Memory Region", UUID_PERSISTENT_MEMORY}, {"NVDIMM Control Region", UUID_CONTROL_REGION}, @@ -189,6 +190,10 @@ const AH_UUID Gbl_AcpiUuids[] = {"Volatile Virtual CD", UUID_VOLATILE_VIRTUAL_CD}, {"Persistent Virtual Disk", UUID_PERSISTENT_VIRTUAL_DISK}, {"Persistent Virtual CD", UUID_PERSISTENT_VIRTUAL_CD}, + {"Microsoft NVDIMM Command set",UUID_NFIT_DIMM_N_MSFT}, + {"HP NDIMM HPE1", UUID_NFIT_DIMM_N_HPE1}, + {"HP NDIMM HPE2", UUID_NFIT_DIMM_N_HPE2}, + {"Virtual NVDIMM", UUID_NFIT_DIMM_N_HYPERV}, {"[Processor Properties]", NULL}, {"Cache Properties", UUID_CACHE_PROPERTIES}, Modified: head/sys/contrib/dev/acpica/compiler/aslbtypes.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslbtypes.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslbtypes.c Fri Nov 13 22:45:26 2020 (r367654) @@ -672,7 +672,7 @@ AnMapObjTypeToBtype ( * * PARAMETERS: Btype - Bitfield of ACPI types * - * RETURN: The Etype corresponding the the Btype + * RETURN: The Etype corresponding the Btype * * DESCRIPTION: Convert a bitfield type to an encoded type * Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcodegen.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c Fri Nov 13 22:45:26 2020 (r367654) @@ -700,7 +700,7 @@ CgUpdateHeader ( Checksum = (UINT8) (0 - Sum); - /* Re-write the the checksum byte */ + /* Re-write the checksum byte */ FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset + ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum)); Modified: head/sys/contrib/dev/acpica/compiler/aslmap.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmap.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslmap.c Fri Nov 13 22:45:26 2020 (r367654) @@ -538,7 +538,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* UART_SERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* UART_SERIALBUSV2 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, OP_AML_PACKAGE, 0), +/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, OP_AML_PACKAGE, ACPI_BTYPE_BUFFER), /* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0), /* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0), /* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_PRESERVE, 0, 0), Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c Fri Nov 13 22:45:26 2020 (r367654) @@ -384,6 +384,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_EXTERNAL_FOUND_HERE */ "External declaration below ", /* ASL_MSG_LOWER_CASE_NAMESEG */ "At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case", /* ASL_MSG_LOWER_CASE_NAMEPATH */ "At least one lower case letter found in NamePath, ASL is case insensitive - converting to upper case", +/* ASL_MSG_UUID_NOT_FOUND */ "Unknown UUID string" }; /* Table compiler */ @@ -457,7 +458,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs)) { - return ("[Unknown ASL Compiler exception ID]"); + return ("[Unknown iASL Compiler exception ID]"); } } @@ -470,7 +471,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs)) { - return ("[Unknown Table Compiler exception ID]"); + return ("[Unknown iASL Table Compiler exception ID]"); } } @@ -483,7 +484,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs)) { - return ("[Unknown Preprocessor exception ID]"); + return ("[Unknown iASL Preprocessor exception ID]"); } } @@ -491,7 +492,7 @@ AeDecodeMessageId ( else { - return ("[Unknown exception/component ID]"); + return ("[Unknown iASL exception ID]"); } return (MessageTable[Index]); @@ -559,3 +560,79 @@ AeBuildFullExceptionCode ( */ return (((Level + 1) * 1000) + MessageId); } + + +#ifdef ACPI_HELP_APP +/******************************************************************************* + * + * FUNCTION: AhDecodeAslException + * + * PARAMETERS: HexString - iASL status string from command line, in + * hex. If null, display all exceptions. + * + * RETURN: None + * + * DESCRIPTION: Decode and display an iASL exception code. Note1: a + * NULL string for HexString displays all known iASL exceptions. Note2: + * implements the -x option for AcpiHelp. + * + ******************************************************************************/ + +#define AH_DISPLAY_ASL_EXCEPTION_TEXT(Status, Exception) \ + printf ("%.4X: %s\n", Status, Exception) + +#define AH_DISPLAY_EXCEPTION(Status, Name) \ + printf ("%.4X: %s\n", Status, Name) + + +void +AhDecodeAslException ( + char *HexString) +{ + UINT32 i; + UINT32 MessageId; + const char *OneException; + UINT32 Index = 1; + + + /* + * A null input string means to decode and display all known + * exception codes. + */ + if (!HexString) + { + printf ("All defined iASL exception codes:\n\n"); + printf ("Main iASL exceptions:\n\n"); + AH_DISPLAY_EXCEPTION (0, + "AE_OK (No error occurred)"); + + /* Display codes in each block of exception types */ + + for (i = 1; Index < ACPI_ARRAY_LENGTH (AslCompilerMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslCompilerMsgs[i]); + } + + printf ("\niASL Table Compiler exceptions:\n\n"); + Index = ASL_MSG_TABLE_COMPILER; + for (i = 0; i < ACPI_ARRAY_LENGTH (AslTableCompilerMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslTableCompilerMsgs[i]); + } + + printf ("\niASL Preprocessor exceptions:\n\n"); + Index = ASL_MSG_PREPROCESSOR; + for (i = 0; i < ACPI_ARRAY_LENGTH (AslPreprocessorMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslPreprocessorMsgs[i]); + } + return; + } + + /* HexString is valid - convert it to a MessageId and decode it */ + + MessageId = strtol (HexString, NULL, 16); + OneException = AeDecodeMessageId ((UINT16) MessageId); + AH_DISPLAY_ASL_EXCEPTION_TEXT (MessageId, OneException); +} +#endif Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Fri Nov 13 22:45:26 2020 (r367654) @@ -152,7 +152,6 @@ #ifndef __ASLMESSAGES_H #define __ASLMESSAGES_H - /* These values must match error type string tables in aslmessages.c */ typedef enum @@ -167,9 +166,12 @@ typedef enum } ASL_MESSAGE_TYPES; - #define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings for types above */ +void +AhDecodeAslException ( + char *HexString); + /* * Exception code blocks, 0 - 999 * Available for new exception blocks: 600 - 999 @@ -386,6 +388,7 @@ typedef enum ASL_MSG_EXTERNAL_FOUND_HERE, ASL_MSG_LOWER_CASE_NAMESEG, ASL_MSG_LOWER_CASE_NAMEPATH, + ASL_MSG_UUID_NOT_FOUND, /* These messages are used by the Data Table compiler only */ Modified: head/sys/contrib/dev/acpica/compiler/aslnamesp.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslnamesp.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslnamesp.c Fri Nov 13 22:45:26 2020 (r367654) @@ -226,8 +226,8 @@ NsDisplayNamespace ( /* File header */ - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n"); - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n"); + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n" + "Count Depth Name - Type\n\n"); /* Walk entire namespace from the root */ @@ -239,14 +239,21 @@ NsDisplayNamespace ( return (Status); } - /* Print the full pathname for each namespace node */ + /* Print the full pathname for each namespace node in the common namespace */ - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, + "\nNamespace pathnames and where declared:\n" + "\n\n"); Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL, NULL, NULL); + /* + * We just dumped the entire common namespace, we don't want to do it + * again for other input files. + */ + AslGbl_NsOutputFlag = FALSE; return (Status); } @@ -512,7 +519,7 @@ NsDoOneNamespaceObject ( * * RETURN: Status * - * DESCRIPTION: Print the full pathname for a namespace node. + * DESCRIPTION: Print the full pathname and addtional info for a namespace node. * ******************************************************************************/ @@ -528,6 +535,13 @@ NsDoOnePathname ( ACPI_BUFFER TargetPath; + /* Ignore predefined namespace nodes and External declarations */ + + if (!Node->Op || (Node->Flags & ANOBJ_IS_EXTERNAL)) + { + return (AE_OK); + } + TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiNsHandleToPathname (Node, &TargetPath, FALSE); if (ACPI_FAILURE (Status)) @@ -535,8 +549,15 @@ NsDoOnePathname ( return (Status); } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", - ACPI_CAST_PTR (char, TargetPath.Pointer)); + /* + * Print the full pathname (and other information) + * for each namespace node in the common namespace + */ + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%-41s %-12s %s, %u\n", + ACPI_CAST_PTR (char, TargetPath.Pointer), + AcpiUtGetTypeName (Node->Type), + Node->Op->Asl.Filename, Node->Op->Asl.LogicalLineNumber); + ACPI_FREE (TargetPath.Pointer); return (AE_OK); } Modified: head/sys/contrib/dev/acpica/compiler/aslopcodes.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslopcodes.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslopcodes.c Fri Nov 13 22:45:26 2020 (r367654) @@ -798,7 +798,13 @@ OpcDoUuId ( } else { + /* Convert UUID string to a buffer, check for a known UUID */ + AcpiUtConvertStringToUuid (InString, Buffer); + if (!AcpiAhMatchUuid (Buffer)) + { + AslError (ASL_REMARK, ASL_MSG_UUID_NOT_FOUND, Op, NULL); + } } /* Change Op to a Buffer */ Modified: head/sys/contrib/dev/acpica/compiler/aslprimaries.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslprimaries.y Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslprimaries.y Fri Nov 13 22:45:26 2020 (r367654) @@ -500,7 +500,7 @@ DivideTerm EISAIDTerm : PARSEOP_EISAID PARSEOP_OPEN_PAREN - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_EISAID, $3);} | PARSEOP_EISAID PARSEOP_OPEN_PAREN @@ -635,7 +635,7 @@ FprintfTerm : PARSEOP_FPRINTF PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FPRINTF);} TermArg ',' - StringData + StringLiteral PrintfArgList PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$6,$7);} | PARSEOP_FPRINTF @@ -1091,7 +1091,7 @@ PowerResTerm PrintfTerm : PARSEOP_PRINTF PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PRINTF);} - StringData + StringLiteral PrintfArgList PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} | PARSEOP_PRINTF @@ -1412,7 +1412,7 @@ ToStringTerm ToUUIDTerm : PARSEOP_TOUUID PARSEOP_OPEN_PAREN - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_TOUUID, $3);} | PARSEOP_TOUUID PARSEOP_OPEN_PAREN @@ -1422,7 +1422,7 @@ ToUUIDTerm UnicodeTerm : PARSEOP_UNICODE PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_UNICODE);} - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,0,$4);} | PARSEOP_UNICODE PARSEOP_OPEN_PAREN Modified: head/sys/contrib/dev/acpica/compiler/aslrules.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslrules.y Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/aslrules.y Fri Nov 13 22:45:26 2020 (r367654) @@ -523,6 +523,10 @@ StringData | String {} ; +StringLiteral + : String {} + ; + ByteConst : Integer {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);} ; Modified: head/sys/contrib/dev/acpica/compiler/asltypes.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asltypes.y Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/compiler/asltypes.y Fri Nov 13 22:45:26 2020 (r367654) @@ -178,6 +178,7 @@ NoEcho(' %type RequiredTarget %type SimpleName %type StringData +%type StringLiteral %type Target %type Term %type TermArg Modified: head/sys/contrib/dev/acpica/components/events/evregion.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evregion.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/components/events/evregion.c Fri Nov 13 22:45:26 2020 (r367654) @@ -164,9 +164,11 @@ extern UINT8 AcpiGbl_DefaultAddressSpaces[]; /* Local prototypes */ static void -AcpiEvOrphanEcRegMethod ( - ACPI_NAMESPACE_NODE *EcDeviceNode); +AcpiEvExecuteOrphanRegMethod ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_ADR_SPACE_TYPE SpaceId); + static ACPI_STATUS AcpiEvRegRun ( ACPI_HANDLE ObjHandle, @@ -869,11 +871,13 @@ AcpiEvExecuteRegMethods ( (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &Info, NULL); - /* Special case for EC: handle "orphan" _REG methods with no region */ - - if (SpaceId == ACPI_ADR_SPACE_EC) + /* + * Special case for EC and GPIO: handle "orphan" _REG methods with + * no region. + */ + if (SpaceId == ACPI_ADR_SPACE_EC || SpaceId == ACPI_ADR_SPACE_GPIO) { - AcpiEvOrphanEcRegMethod (Node); + AcpiEvExecuteOrphanRegMethod (Node, SpaceId); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, @@ -954,32 +958,29 @@ AcpiEvRegRun ( /******************************************************************************* * - * FUNCTION: AcpiEvOrphanEcRegMethod + * FUNCTION: AcpiEvExecuteOrphanRegMethod * - * PARAMETERS: EcDeviceNode - Namespace node for an EC device + * PARAMETERS: DeviceNode - Namespace node for an ACPI device + * SpaceId - The address space ID * * RETURN: None * - * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC + * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI * device. This is a _REG method that has no corresponding region - * within the EC device scope. The orphan _REG method appears to - * have been enabled by the description of the ECDT in the ACPI - * specification: "The availability of the region space can be - * detected by providing a _REG method object underneath the - * Embedded Controller device." + * within the device's scope. ACPI tables depending on these + * "orphan" _REG methods have been seen for both EC and GPIO + * Operation Regions. Presumably the Windows ACPI implementation + * always calls the _REG method independent of the presence of + * an actual Operation Region with the correct address space ID. * - * To quickly access the EC device, we use the EcDeviceNode used - * during EC handler installation. Otherwise, we would need to - * perform a time consuming namespace walk, executing _HID - * methods to find the EC device. - * * MUTEX: Assumes the namespace is locked * ******************************************************************************/ static void -AcpiEvOrphanEcRegMethod ( - ACPI_NAMESPACE_NODE *EcDeviceNode) +AcpiEvExecuteOrphanRegMethod ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_ADR_SPACE_TYPE SpaceId) { ACPI_HANDLE RegMethod; ACPI_NAMESPACE_NODE *NextNode; @@ -988,10 +989,10 @@ AcpiEvOrphanEcRegMethod ( ACPI_OBJECT Objects[2]; - ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); + ACPI_FUNCTION_TRACE (EvExecuteOrphanRegMethod); - if (!EcDeviceNode) + if (!DeviceNode) { return_VOID; } @@ -1002,7 +1003,7 @@ AcpiEvOrphanEcRegMethod ( /* Get a handle to a _REG method immediately under the EC device */ - Status = AcpiGetHandle (EcDeviceNode, METHOD_NAME__REG, &RegMethod); + Status = AcpiGetHandle (DeviceNode, METHOD_NAME__REG, &RegMethod); if (ACPI_FAILURE (Status)) { goto Exit; /* There is no _REG method present */ @@ -1015,25 +1016,25 @@ AcpiEvOrphanEcRegMethod ( * with other space IDs to be present; but the code below will then * execute the _REG method with the EmbeddedControl SpaceID argument. */ - NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); + NextNode = AcpiNsGetNextNode (DeviceNode, NULL); while (NextNode) { if ((NextNode->Type == ACPI_TYPE_REGION) && (NextNode->Object) && - (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) + (NextNode->Object->Region.SpaceId == SpaceId)) { goto Exit; /* Do not execute the _REG */ } - NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); + NextNode = AcpiNsGetNextNode (DeviceNode, NextNode); } - /* Evaluate the _REG(EmbeddedControl,Connect) method */ + /* Evaluate the _REG(SpaceId,Connect) method */ Args.Count = 2; Args.Pointer = Objects; Objects[0].Type = ACPI_TYPE_INTEGER; - Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; + Objects[0].Integer.Value = SpaceId; Objects[1].Type = ACPI_TYPE_INTEGER; Objects[1].Integer.Value = ACPI_REG_CONNECT; Modified: head/sys/contrib/dev/acpica/components/namespace/nspredef.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nspredef.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/components/namespace/nspredef.c Fri Nov 13 22:45:26 2020 (r367654) @@ -223,13 +223,14 @@ AcpiNsCheckReturnValue ( ACPI_STATUS Status; const ACPI_PREDEFINED_INFO *Predefined; + ACPI_FUNCTION_TRACE (NsCheckReturnValue); /* If not a predefined name, we cannot validate the return object */ Predefined = Info->Predefined; if (!Predefined) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -239,7 +240,7 @@ AcpiNsCheckReturnValue ( if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -259,7 +260,7 @@ AcpiNsCheckReturnValue ( (!Predefined->Info.ExpectedBtypes) || (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -325,7 +326,7 @@ Exit: Node->Flags |= ANOBJ_EVALUATED; } - return (Status); + return_ACPI_STATUS (Status); } Modified: head/sys/contrib/dev/acpica/components/namespace/nsprepkg.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsprepkg.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/components/namespace/nsprepkg.c Fri Nov 13 22:45:26 2020 (r367654) @@ -214,7 +214,7 @@ AcpiNsCheckPackage ( UINT32 i; - ACPI_FUNCTION_NAME (NsCheckPackage); + ACPI_FUNCTION_TRACE (NsCheckPackage); /* The package info for this name is in the next table entry */ @@ -245,13 +245,13 @@ AcpiNsCheckPackage ( { if (Package->RetInfo.Type == ACPI_PTYPE1_VAR) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return Package has no elements (empty)")); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } /* @@ -305,7 +305,7 @@ AcpiNsCheckPackage ( Package->RetInfo.ObjectType1, i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements++; @@ -338,7 +338,7 @@ AcpiNsCheckPackage ( Package->RetInfo3.ObjectType[i], i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } } else @@ -349,7 +349,7 @@ AcpiNsCheckPackage ( Package->RetInfo3.TailObjectType, i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } } @@ -365,7 +365,7 @@ AcpiNsCheckPackage ( Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements++; @@ -384,7 +384,7 @@ AcpiNsCheckPackage ( Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* @@ -428,7 +428,7 @@ AcpiNsCheckPackage ( Info, ReturnObject, ReturnObjectPtr); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* Update locals to point to the new package (of 1 element) */ @@ -466,7 +466,7 @@ AcpiNsCheckPackage ( Package->RetInfo.ObjectType1, 0); if (ACPI_FAILURE(Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* Validate length of the UUID buffer */ @@ -475,14 +475,14 @@ AcpiNsCheckPackage ( { ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Invalid length for UUID Buffer")); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } Status = AcpiNsCheckObjectType(Info, Elements + 1, Package->RetInfo.ObjectType2, 0); if (ACPI_FAILURE(Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements += 2; @@ -498,10 +498,10 @@ AcpiNsCheckPackage ( "Invalid internal return type in table entry: %X", Package->RetInfo.Type)); - return (AE_AML_INTERNAL); + return_ACPI_STATUS (AE_AML_INTERNAL); } - return (Status); + return_ACPI_STATUS (Status); PackageTooSmall: @@ -512,7 +512,7 @@ PackageTooSmall: "Return Package is too small - found %u elements, expected %u", Count, ExpectedCount)); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } @@ -865,6 +865,8 @@ AcpiNsCheckPackageElements ( UINT32 i; + ACPI_FUNCTION_TRACE (NsCheckPackageElements); + /* * Up to two groups of package elements are supported by the data * structure. All elements in each group must be of the same type. @@ -876,7 +878,7 @@ AcpiNsCheckPackageElements ( Type1, i + StartIndex); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } ThisElement++; @@ -888,11 +890,11 @@ AcpiNsCheckPackageElements ( Type2, (i + Count1 + StartIndex)); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } ThisElement++; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } Modified: head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c Fri Nov 13 22:45:26 2020 (r367654) @@ -321,16 +321,18 @@ AcpiNsComplexRepairs ( ACPI_STATUS Status; + ACPI_FUNCTION_TRACE (NsComplexRepairs); + /* Check if this name is in the list of repairable names */ Predefined = AcpiNsMatchComplexRepair (Node); if (!Predefined) { - return (ValidateStatus); + return_ACPI_STATUS (ValidateStatus); } Status = Predefined->RepairFunction (Info, ReturnObjectPtr); - return (Status); + return_ACPI_STATUS (Status); } @@ -526,20 +528,21 @@ AcpiNsRepair_CID ( UINT16 OriginalRefCount; UINT32 i; + ACPI_FUNCTION_TRACE (NsRepair_CID); /* Check for _CID as a simple string */ if (ReturnObject->Common.Type == ACPI_TYPE_STRING) { Status = AcpiNsRepair_HID (Info, ReturnObjectPtr); - return (Status); + return_ACPI_STATUS (Status); } /* Exit if not a Package */ if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* Examine each element of the _CID package */ @@ -553,7 +556,7 @@ AcpiNsRepair_CID ( Status = AcpiNsRepair_HID (Info, ElementPtr); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } if (OriginalElement != *ElementPtr) @@ -567,7 +570,7 @@ AcpiNsRepair_CID ( ElementPtr++; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } @@ -687,9 +690,8 @@ AcpiNsRepair_HID ( ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT *NewString; - char *Source; char *Dest; + char *Source; ACPI_FUNCTION_NAME (NsRepair_HID); @@ -699,7 +701,7 @@ AcpiNsRepair_HID ( if (ReturnObject->Common.Type != ACPI_TYPE_STRING) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } if (ReturnObject->String.Length == 0) @@ -711,17 +713,9 @@ AcpiNsRepair_HID ( /* Return AE_OK anyway, let driver handle it */ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); + return_ACPI_STATUS (AE_OK); } - /* It is simplest to always create a new string object */ - - NewString = AcpiUtCreateStringObject (ReturnObject->String.Length); - if (!NewString) - { - return (AE_NO_MEMORY); - } - /* * Remove a leading asterisk if present. For some unknown reason, there * are many machines in the field that contains IDs like this. @@ -732,7 +726,7 @@ AcpiNsRepair_HID ( if (*Source == '*') { Source++; - NewString->String.Length--; + ReturnObject->String.Length--; ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Removed invalid leading asterisk\n", Info->FullPathname)); @@ -746,14 +740,13 @@ AcpiNsRepair_HID ( * "NNNN####" where N is an uppercase letter or decimal digit, and * # is a hex digit. */ - for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) + for (Dest = ReturnObject->String.Pointer; *Source; Dest++, Source++) { *Dest = (char) toupper ((int) *Source); } + ReturnObject->String.Pointer[ReturnObject->String.Length] = 0; - AcpiUtRemoveReference (ReturnObject); - *ReturnObjectPtr = NewString; - return (AE_OK); + return_ACPI_STATUS (AE_OK); } Modified: head/sys/contrib/dev/acpica/include/accommon.h ============================================================================== --- head/sys/contrib/dev/acpica/include/accommon.h Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/include/accommon.h Fri Nov 13 22:45:26 2020 (r367654) @@ -155,7 +155,7 @@ /* * Common set of includes for all ACPICA source files. * We put them here because we don't want to duplicate them - * in the the source code again and again. + * in the source code again and again. * * Note: The order of these include files is important. */ Modified: head/sys/contrib/dev/acpica/include/acpixf.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acpixf.h Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/include/acpixf.h Fri Nov 13 22:45:26 2020 (r367654) @@ -154,7 +154,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20200925 +#define ACPI_CA_VERSION 0x20201113 #include #include Modified: head/sys/contrib/dev/acpica/include/acuuid.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acuuid.h Fri Nov 13 21:41:47 2020 (r367653) +++ head/sys/contrib/dev/acpica/include/acuuid.h Fri Nov 13 22:45:26 2020 (r367654) @@ -181,6 +181,7 @@ /* NVDIMM - NFIT table */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 13 23:18:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88C01460C8C; Fri, 13 Nov 2020 23:18:05 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXvXF3T3Kz3JJb; Fri, 13 Nov 2020 23:18:05 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A44820150; Fri, 13 Nov 2020 23:18:05 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ADNI53F095272; Fri, 13 Nov 2020 23:18:05 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ADNI5Nt095271; Fri, 13 Nov 2020 23:18:05 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202011132318.0ADNI5Nt095271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 13 Nov 2020 23:18:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367655 - head/lib/libbsnmp X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/lib/libbsnmp X-SVN-Commit-Revision: 367655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 23:18:05 -0000 Author: brooks Date: Fri Nov 13 23:18:04 2020 New Revision: 367655 URL: https://svnweb.freebsd.org/changeset/base/367655 Log: Add missing src.opts.mk include This was missed in r364221 so tests were not built. Reviewed by: bdrewery Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27210 Modified: head/lib/libbsnmp/Makefile Modified: head/lib/libbsnmp/Makefile ============================================================================== --- head/lib/libbsnmp/Makefile Fri Nov 13 22:45:26 2020 (r367654) +++ head/lib/libbsnmp/Makefile Fri Nov 13 23:18:04 2020 (r367655) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + SUBDIR= libbsnmp SUBDIR.${MK_TESTS}+= tests From owner-svn-src-all@freebsd.org Sat Nov 14 00:47:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B7C246384C; Sat, 14 Nov 2020 00:47:11 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXxW33Ym1z3PCr; Sat, 14 Nov 2020 00:47:11 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id DE4426762; Sat, 14 Nov 2020 00:47:10 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.43.20110804 Date: Fri, 13 Nov 2020 16:47:08 -0800 Subject: Re: svn commit: r367651 - head/usr.sbin/bhyve From: Ravi Pokala To: Rebecca Cran , , , Message-ID: <328D3129-4682-491B-A28F-D6739E52ABE8@panasas.com> Thread-Topic: svn commit: r367651 - head/usr.sbin/bhyve References: <202011131947.0ADJlGbr064616@repo.freebsd.org> In-Reply-To: <202011131947.0ADJlGbr064616@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 00:47:11 -0000 > +#define FIRMWARE_RELEASE_DATE "11/10/2020" Might I suggest "2020-11-10", as sorting, logic, ${DEITY}, and ISO-8601 dem= and? ;-) Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Rebecca Cran Date: 2020-11-13, Friday at 11:47 To: , , Subject: svn commit: r367651 - head/usr.sbin/bhyve Author: bcran Date: Fri Nov 13 19:47:16 2020 New Revision: 367651 URL: https://svnweb.freebsd.org/changeset/base/367651 Log: bhyve: update smbiostbl.c to bump the version and release date Since lots of work has been done on bhyve since 2014, increase the ve= rsion to 13.0 to match 13-CURRENT, and update the release date. Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D27147 Modified: head/usr.sbin/bhyve/smbiostbl.c Modified: head/usr.sbin/bhyve/smbiostbl.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/usr.sbin/bhyve/smbiostbl.c Fri Nov 13 19:22:53 2020 (r367650) +++ head/usr.sbin/bhyve/smbiostbl.c Fri Nov 13 19:47:16 2020 (r367651) @@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$"); #define SMBIOS_BASE 0xF1000 +#define FIRMWARE_VERSION "13.0" +#define FIRMWARE_RELEASE_DATE "11/10/2020" + /* BHYVE_ACPI_BASE - SMBIOS_BASE) */ #define SMBIOS_MAX_LENGTH (0xF2400 - 0xF1000) @@ -323,9 +326,9 @@ struct smbios_table_type0 smbios_type0_template =3D { }; const char *smbios_type0_strings[] =3D { - "BHYVE", /* vendor string */ - "1.00", /* bios version string */ - "03/14/2014", /* bios release date string */ + "BHYVE", /* vendor string */ + FIRMWARE_VERSION, /* bios version string */ + FIRMWARE_RELEASE_DATE, /* bios release date string */ NULL }; From owner-svn-src-all@freebsd.org Sat Nov 14 00:53:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FFE7463AB5 for ; Sat, 14 Nov 2020 00:53:11 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXxdz2csFz3PWb for ; Sat, 14 Nov 2020 00:53:11 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f52.google.com with SMTP id j7so12167931wrp.3 for ; Fri, 13 Nov 2020 16:53:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ID4pCHw2fLBil52z+aTxuC4S5OF2rizsh1BQVx8ZHvs=; b=nQIAlkjmKs5YC8fbMjqwaV2raecGTiKfjY0VbniXF1tP0SGMCFcuXIBYqUflCBuauh Y8FGezzKpF5e/bwSYwCuBHwOTgDYmComGmZocGR94PwACSeqWW+RmA6U/SfT7PvTrJqo pbDMubcH0NK+busaGDEiDjl52Z9ykuPt6bcnWmAQ57SrlCMllwO5ktX52U3+1jxsWSc4 HfxjLfXtLcW6XrZu5bVR3JdnfXH5v5DXBmNSbrIOMluBpzKOx8spUVQ+RIruQuKZSo+d EhGrVTu0qNomwu6Q/fyxxJQSfF/KudDsd5RiOFm5H98JRl9ETgF22VorlRKf4iPvM0T4 cb8Q== X-Gm-Message-State: AOAM531HzptJrPOFaFv3wbJpNt9OkIuqcR0PZi4i0Ge1EwCHlYf4KhRn fpkHYp/sQIjrtLWYE8eu5u9/Ww== X-Google-Smtp-Source: ABdhPJw1xUwDKNz9KH1yJhHnXcrNfhPErWoQadNYQlFSJDT5nJXHz6NRqyaFAxUBMpKei3owBPZvTw== X-Received: by 2002:adf:f0c2:: with SMTP id x2mr6579305wro.184.1605315189900; Fri, 13 Nov 2020 16:53:09 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id m20sm15835762wrg.81.2020.11.13.16.53.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Nov 2020 16:53:09 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: svn commit: r367651 - head/usr.sbin/bhyve From: Jessica Clarke In-Reply-To: <328D3129-4682-491B-A28F-D6739E52ABE8@panasas.com> Date: Sat, 14 Nov 2020 00:53:07 +0000 Cc: Rebecca Cran , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202011131947.0ADJlGbr064616@repo.freebsd.org> <328D3129-4682-491B-A28F-D6739E52ABE8@panasas.com> To: Ravi Pokala X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CXxdz2csFz3PWb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 00:53:11 -0000 On 14 Nov 2020, at 00:47, Ravi Pokala wrote: >=20 >> +#define FIRMWARE_RELEASE_DATE "11/10/2020" >=20 > Might I suggest "2020-11-10", as sorting, logic, ${DEITY}, and = ISO-8601 demand? ;-) Alas that is a "feature" of the specification: String number of the BIOS release date. The date string, if supplied, is in either mm/dd/yy or mm/dd/yyyy format. If the year portion of the string is two digits, the year is assumed to be 19yy. NOTE: The mm/dd/yyyy format is required for SMBIOS version 2.3 and later. (SMBIOS Specification version 3.4.0c) It might be worth putting a comment in so people don't accidentally change it to the wrong thing in future though, given it's currently ambiguous otherwise. Jess From owner-svn-src-all@freebsd.org Sat Nov 14 00:58:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A489D463CBF; Sat, 14 Nov 2020 00:58:07 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXxlg4BkPz3PtY; Sat, 14 Nov 2020 00:58:07 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id DE0CE6769; Sat, 14 Nov 2020 00:58:06 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.43.20110804 Date: Fri, 13 Nov 2020 16:58:03 -0800 Subject: Re: svn commit: r367651 - head/usr.sbin/bhyve From: Ravi Pokala To: Jessica Clarke CC: Rebecca Cran , , , Message-ID: <26286559-64EA-4E5B-B5E6-3BD2C1C949FF@panasas.com> Thread-Topic: svn commit: r367651 - head/usr.sbin/bhyve References: <202011131947.0ADJlGbr064616@repo.freebsd.org> <328D3129-4682-491B-A28F-D6739E52ABE8@panasas.com> In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 00:58:07 -0000 -----Original Message----- From: on behalf of Jessica Clarke Date: 2020-11-13, Friday at 16:53 To: Ravi Pokala Cc: Rebecca Cran , , , Subject: Re: svn commit: r367651 - head/usr.sbin/bhyve On 14 Nov 2020, at 00:47, Ravi Pokala wrote: > >> +#define FIRMWARE_RELEASE_DATE "11/10/2020" > > Might I suggest "2020-11-10", as sorting, logic, ${DEITY}, and ISO-8601 demand? ;-) Alas that is a "feature" of the specification: String number of the BIOS release date. The date string, if supplied, is in either mm/dd/yy or mm/dd/yyyy format. If the year portion of the string is two digits, the year is assumed to be 19yy. NOTE: The mm/dd/yyyy format is required for SMBIOS version 2.3 and later. (SMBIOS Specification version 3.4.0c) Yeah, it occurred to me that it might be something like that shortly after I hit "send". :-p It might be worth putting a comment in so people don't accidentally change it to the wrong thing in future though, given it's currently ambiguous otherwise. That would be appreciated. Thanks, Ravi (rpokala@) Jess From owner-svn-src-all@freebsd.org Sat Nov 14 00:59:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B716A463EAF; Sat, 14 Nov 2020 00:59:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXxnl4LHhz3Q3L; Sat, 14 Nov 2020 00:59:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87FDE2170C; Sat, 14 Nov 2020 00:59:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE0xtKr058009; Sat, 14 Nov 2020 00:59:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE0xtT1058008; Sat, 14 Nov 2020 00:59:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011140059.0AE0xtT1058008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 00:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367656 - stable/12/usr.bin/diff X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/usr.bin/diff X-SVN-Commit-Revision: 367656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 00:59:55 -0000 Author: kevans Date: Sat Nov 14 00:59:55 2020 New Revision: 367656 URL: https://svnweb.freebsd.org/changeset/base/367656 Log: MFC r367076: diff: don't force the format to 'context' with -p immediately Instead, leave the fomat as unspecified (if it hasn't been) and use the -p flag as a hint to 'context' if no other formatting option is specified. This fixes `diff -purw`, used frequently by emaste, and matches the behavior of its GNU counterpart. PR: 250015 Modified: stable/12/usr.bin/diff/diff.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/diff/diff.c ============================================================================== --- stable/12/usr.bin/diff/diff.c Fri Nov 13 23:18:04 2020 (r367655) +++ stable/12/usr.bin/diff/diff.c Sat Nov 14 00:59:55 2020 (r367656) @@ -210,17 +210,6 @@ main(int argc, char **argv) diff_format = D_NREVERSE; break; case 'p': - /* - * If it's not unset and it's not set to context or - * unified, we'll error out here as a conflicting - * format. If it's unset, we'll go ahead and set it to - * context. - */ - if (FORMAT_MISMATCHED(D_CONTEXT) && - FORMAT_MISMATCHED(D_UNIFIED)) - conflicting_format(); - if (diff_format == D_UNSET) - diff_format = D_CONTEXT; dflags |= D_PROTOTYPE; break; case 'P': @@ -320,6 +309,8 @@ main(int argc, char **argv) newarg = optind != prevoptind; prevoptind = optind; } + if (diff_format == D_UNSET && (dflags & D_PROTOTYPE) != 0) + diff_format = D_CONTEXT; if (diff_format == D_UNSET) diff_format = D_NORMAL; argc -= optind; From owner-svn-src-all@freebsd.org Sat Nov 14 01:28:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A60C1466483; Sat, 14 Nov 2020 01:28:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXyQF4CMzz3jDk; Sat, 14 Nov 2020 01:28:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8170F2196F; Sat, 14 Nov 2020 01:28:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE1S57V076371; Sat, 14 Nov 2020 01:28:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE1S4WH076368; Sat, 14 Nov 2020 01:28:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011140128.0AE1S4WH076368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 01:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367657 - in stable/12: sys/kern sys/sys usr.sbin/binmiscctl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: sys/kern sys/sys usr.sbin/binmiscctl X-SVN-Commit-Revision: 367657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 01:28:05 -0000 Author: kevans Date: Sat Nov 14 01:28:04 2020 New Revision: 367657 URL: https://svnweb.freebsd.org/changeset/base/367657 Log: MFC imgact_binmisc housecleaning: r367361, r367439, r367441-r367442, r367444, r367452, r367456, r367477 r367361: imgact_binmisc: fix up some minor nits - Removed a bunch of redundant headers - Don't explicitly initialize to 0 - The !error check prior to setting imgp->interpreter_name is redundant, all error paths should and do return or go to 'done'. We have larger problems otherwise. r367439: imgact_binmisc: minor re-organization of imgact_binmisc_exec exits Notably, streamline error paths through the existing 'done' label, making it easier to quickly verify correct cleanup. Future work might add a kernel-only flag to indicate that a interpreter uses #a. Currently, all executions via imgact_binmisc pay the penalty of constructing sname/fname, even if they will not use it. qemu-user-static doesn't need it, the stock rc script for qemu-user-static certainly doesn't use it, and I suspect these are the vast majority of (if not the only) current users. r367441: binmiscctl(8): miscellaneous cleanup - Bad whitespace in Makefile. - Reordered headers, sys/ first. - Annotated fatal/usage __dead2 to help `make analyze` out a little bit. - Spell a couple of sizeof constructs as "nitems" and "howmany" instead. r367442: imgact_binmisc: validate flags coming from userland We may want to reserve bits in the future for kernel-only use, so start rejecting any that aren't the two that we're currently expecting from userland. r367444: imgact_binmisc: abstract away the list lock (NFC) This module handles relatively few execs (initial qemu-user-static, then qemu-user-static handles exec'ing itself for binaries it's already running), but all execs pay the price of at least taking the relatively expensive sx/slock to check for a match when this module is loaded. Future work will almost certainly swap this out for another lock, perhaps an rmslock. The RLOCK/WLOCK phrasing was chosen based on what the callers are really wanting, rather than using the verbiage typically appropriate for an sx. r367452: imgact_binmisc: reorder members of struct imgact_binmisc_entry (NFC) This doesn't change anything at the moment since the out-of-order elements were a pair of uint32_t, but future additions may have caused unnecessary padding by following the existing precedent. r367456: imgact_binmisc: move some calculations out of the exec path The offset we need to account for in the interpreter string comes in two variants: 1. Fixed - macros other than #a that will not vary from invocation to invocation 2. Variable - #a, which is substitued with the argv0 that we're replacing Note that we don't have a mechanism to modify an existing entry. By recording both of these offset requirements when the interpreter is added, we can avoid some unnecessary calculations in the exec path. Most importantly, we can know up-front whether we need to grab calculate/grab the the filename for this interpreter. We also get to avoid walking the string a first time looking for macros. For most invocations, it's a swift exit as they won't have any, but there's no point entering a loop and searching for the macro indicator if we already know there will not be one. While we're here, go ahead and only calculate the argv0 name length once per invocation. While it's unlikely that we'll have more than one #a, there's no reason to recalculate it every time we encounter an #a when it will not change. I have not bothered trying to benchmark this at all, because it's arguably a minor and straightforward/obvious improvement. r367477: imgact_binmisc: limit the extent of match on incoming entries imgact_binmisc matches magic/mask from imgp->image_header, which is only a single page in size mapped from the first page of an image. One can specify an interpreter that matches on, e.g., --offset 4096 --size 256 to read up to 256 bytes past the mapped first page. The limitation is that we cannot specify a magic string that exceeds a single page, and we can't allow offset + size to exceed a single page either. A static assert has been added in case someone finds it useful to try and expand the size, but it does seem a little unlikely. While this looks kind of exploitable at a sideways squinty-glance, there are a couple of mitigating factors: 1.) imgact_binmisc is not enabled by default, 2.) entries may only be added by the superuser, 3.) trying to exploit this information to read what's mapped past the end would be worse than a root canal or some other relatably painful experience, and 4.) there's no way one could pull this off without it being completely obvious. The first page is mapped out of an sf_buf, the implementation of which (or lack thereof) depends on your platform. Modified: stable/12/sys/kern/imgact_binmisc.c stable/12/sys/sys/imgact_binmisc.h stable/12/usr.sbin/binmiscctl/Makefile stable/12/usr.sbin/binmiscctl/binmiscctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_binmisc.c ============================================================================== --- stable/12/sys/kern/imgact_binmisc.c Sat Nov 14 00:59:55 2020 (r367656) +++ stable/12/sys/kern/imgact_binmisc.c Sat Nov 14 01:28:04 2020 (r367657) @@ -29,17 +29,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include #include #include #include #include -#include #include #include #include +#include #include #include @@ -61,16 +58,18 @@ __FBSDID("$FreeBSD$"); * Node of the interpreter list. */ typedef struct imgact_binmisc_entry { + SLIST_ENTRY(imgact_binmisc_entry) link; char *ibe_name; uint8_t *ibe_magic; - uint32_t ibe_moffset; - uint32_t ibe_msize; uint8_t *ibe_mask; uint8_t *ibe_interpreter; + ssize_t ibe_interp_offset; uint32_t ibe_interp_argcnt; uint32_t ibe_interp_length; + uint32_t ibe_argv0_cnt; uint32_t ibe_flags; - SLIST_ENTRY(imgact_binmisc_entry) link; + uint32_t ibe_moffset; + uint32_t ibe_msize; } imgact_binmisc_entry_t; /* @@ -97,10 +96,20 @@ MALLOC_DEFINE(M_BINMISC, KMOD_NAME, "misc binary image static SLIST_HEAD(, imgact_binmisc_entry) interpreter_list = SLIST_HEAD_INITIALIZER(interpreter_list); -static int interp_list_entry_count = 0; +static int interp_list_entry_count; static struct sx interp_list_sx; +#define INTERP_LIST_WLOCK() sx_xlock(&interp_list_sx) +#define INTERP_LIST_RLOCK() sx_slock(&interp_list_sx) +#define INTERP_LIST_WUNLOCK() sx_xunlock(&interp_list_sx) +#define INTERP_LIST_RUNLOCK() sx_sunlock(&interp_list_sx) + +#define INTERP_LIST_LOCK_INIT() sx_init(&interp_list_sx, KMOD_NAME) +#define INTERP_LIST_LOCK_DESTROY() sx_destroy(&interp_list_sx) + +#define INTERP_LIST_ASSERT_LOCKED() sx_assert(&interp_list_sx, SA_LOCKED) + /* * Populate the entry with the information about the interpreter. */ @@ -147,7 +156,8 @@ imgact_binmisc_populate_interp(char *str, imgact_binmi * Allocate memory and populate a new entry for the interpreter table. */ static imgact_binmisc_entry_t * -imgact_binmisc_new_entry(ximgact_binmisc_entry_t *xbe) +imgact_binmisc_new_entry(ximgact_binmisc_entry_t *xbe, ssize_t interp_offset, + int argv0_cnt) { imgact_binmisc_entry_t *ibe = NULL; size_t namesz = min(strlen(xbe->xbe_name) + 1, IBE_NAME_MAX); @@ -168,7 +178,8 @@ imgact_binmisc_new_entry(ximgact_binmisc_entry_t *xbe) ibe->ibe_moffset = xbe->xbe_moffset; ibe->ibe_msize = xbe->xbe_msize; ibe->ibe_flags = xbe->xbe_flags; - + ibe->ibe_interp_offset = interp_offset; + ibe->ibe_argv0_cnt = argv0_cnt; return (ibe); } @@ -201,7 +212,7 @@ imgact_binmisc_find_entry(char *name) { imgact_binmisc_entry_t *ibe; - sx_assert(&interp_list_sx, SA_LOCKED); + INTERP_LIST_ASSERT_LOCKED(); SLIST_FOREACH(ibe, &interpreter_list, link) { if (strncmp(name, ibe->ibe_name, IBE_NAME_MAX) == 0) @@ -220,10 +231,13 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) { imgact_binmisc_entry_t *ibe; char *p; - int cnt; + ssize_t interp_offset; + int argv0_cnt, cnt; if (xbe->xbe_msize > IBE_MAGIC_MAX) return (EINVAL); + if (xbe->xbe_moffset + xbe->xbe_msize > IBE_MATCH_MAX) + return (EINVAL); for(cnt = 0, p = xbe->xbe_name; *p != 0; cnt++, p++) if (cnt >= IBE_NAME_MAX || !isascii((int)*p)) @@ -235,23 +249,21 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) /* Make sure we don't have any invalid #'s. */ p = xbe->xbe_interpreter; - while (1) { - p = strchr(p, '#'); - if (!p) - break; - + interp_offset = 0; + argv0_cnt = 0; + while ((p = strchr(p, '#')) != NULL) { p++; switch(*p) { case ISM_POUND: /* "##" */ p++; + interp_offset--; break; - case ISM_OLD_ARGV0: /* "#a" */ p++; + argv0_cnt++; break; - case 0: default: /* Anything besides the above is invalid. */ @@ -259,18 +271,18 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) } } - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); if (imgact_binmisc_find_entry(xbe->xbe_name) != NULL) { - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (EEXIST); } /* Preallocate a new entry. */ - ibe = imgact_binmisc_new_entry(xbe); + ibe = imgact_binmisc_new_entry(xbe, interp_offset, argv0_cnt); SLIST_INSERT_HEAD(&interpreter_list, ibe, link); interp_list_entry_count++; - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (0); } @@ -284,14 +296,14 @@ imgact_binmisc_remove_entry(char *name) { imgact_binmisc_entry_t *ibe; - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); if ((ibe = imgact_binmisc_find_entry(name)) == NULL) { - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (ENOENT); } SLIST_REMOVE(&interpreter_list, ibe, imgact_binmisc_entry, link); interp_list_entry_count--; - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); imgact_binmisc_destroy_entry(ibe); @@ -307,14 +319,14 @@ imgact_binmisc_disable_entry(char *name) { imgact_binmisc_entry_t *ibe; - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); if ((ibe = imgact_binmisc_find_entry(name)) == NULL) { - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (ENOENT); } ibe->ibe_flags &= ~IBF_ENABLED; - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (0); } @@ -328,14 +340,14 @@ imgact_binmisc_enable_entry(char *name) { imgact_binmisc_entry_t *ibe; - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); if ((ibe = imgact_binmisc_find_entry(name)) == NULL) { - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (ENOENT); } ibe->ibe_flags |= IBF_ENABLED; - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (0); } @@ -346,8 +358,7 @@ imgact_binmisc_populate_xbe(ximgact_binmisc_entry_t *x { uint32_t i; - sx_assert(&interp_list_sx, SA_LOCKED); - + INTERP_LIST_ASSERT_LOCKED(); memset(xbe, 0, sizeof(*xbe)); strlcpy(xbe->xbe_name, ibe->ibe_name, IBE_NAME_MAX); @@ -378,14 +389,14 @@ imgact_binmisc_lookup_entry(char *name, ximgact_binmis imgact_binmisc_entry_t *ibe; int error = 0; - sx_slock(&interp_list_sx); + INTERP_LIST_RLOCK(); if ((ibe = imgact_binmisc_find_entry(name)) == NULL) { - sx_sunlock(&interp_list_sx); + INTERP_LIST_RUNLOCK(); return (ENOENT); } error = imgact_binmisc_populate_xbe(xbe, ibe); - sx_sunlock(&interp_list_sx); + INTERP_LIST_RUNLOCK(); return (error); } @@ -400,7 +411,7 @@ imgact_binmisc_get_all_entries(struct sysctl_req *req) imgact_binmisc_entry_t *ibe; int error = 0, count; - sx_slock(&interp_list_sx); + INTERP_LIST_RLOCK(); count = interp_list_entry_count; xbe = malloc(sizeof(*xbe) * count, M_BINMISC, M_WAITOK|M_ZERO); @@ -410,7 +421,7 @@ imgact_binmisc_get_all_entries(struct sysctl_req *req) if (error) break; } - sx_sunlock(&interp_list_sx); + INTERP_LIST_RUNLOCK(); if (!error) error = SYSCTL_OUT(req, xbe, sizeof(*xbe) * count); @@ -437,6 +448,8 @@ sysctl_kern_binmisc(SYSCTL_HANDLER_ARGS) return (error); if (IBE_VERSION != xbe.xbe_version) return (EINVAL); + if ((xbe.xbe_flags & ~IBF_VALID_UFLAGS) != 0) + return (EINVAL); if (interp_list_entry_count == IBE_MAX_ENTRIES) return (ENOSPC); error = imgact_binmisc_add_entry(&xbe); @@ -547,7 +560,7 @@ imgact_binmisc_find_interpreter(const char *image_head int i; size_t sz; - sx_assert(&interp_list_sx, SA_LOCKED); + INTERP_LIST_ASSERT_LOCKED(); SLIST_FOREACH(ibe, &interpreter_list, link) { if (!(IBF_ENABLED & ibe->ibe_flags)) @@ -578,35 +591,47 @@ imgact_binmisc_exec(struct image_params *imgp) const char *image_header = imgp->image_header; const char *fname = NULL; int error = 0; - size_t offset, l; +#ifdef INVARIANTS + int argv0_cnt = 0; +#endif + size_t namelen, offset; imgact_binmisc_entry_t *ibe; struct sbuf *sname; char *s, *d; + sname = NULL; + namelen = 0; /* Do we have an interpreter for the given image header? */ - sx_slock(&interp_list_sx); + INTERP_LIST_RLOCK(); if ((ibe = imgact_binmisc_find_interpreter(image_header)) == NULL) { - sx_sunlock(&interp_list_sx); - return (-1); + error = -1; + goto done; } /* No interpreter nesting allowed. */ if (imgp->interpreted & IMGACT_BINMISC) { - sx_sunlock(&interp_list_sx); - return (ENOEXEC); + error = ENOEXEC; + goto done; } imgp->interpreted |= IMGACT_BINMISC; - if (imgp->args->fname != NULL) { - fname = imgp->args->fname; - sname = NULL; - } else { - /* Use the fdescfs(5) path for fexecve(2). */ - sname = sbuf_new_auto(); - sbuf_printf(sname, "/dev/fd/%d", imgp->args->fd); - sbuf_finish(sname); - fname = sbuf_data(sname); + /* + * Don't bother with the overhead of putting fname together if we're not + * using #a. + */ + if (ibe->ibe_argv0_cnt != 0) { + if (imgp->args->fname != NULL) { + fname = imgp->args->fname; + } else { + /* Use the fdescfs(5) path for fexecve(2). */ + sname = sbuf_new_auto(); + sbuf_printf(sname, "/dev/fd/%d", imgp->args->fd); + sbuf_finish(sname); + fname = sbuf_data(sname); + } + + namelen = strlen(fname); } @@ -615,43 +640,17 @@ imgact_binmisc_exec(struct image_params *imgp) * we first shift all the other values in the `begin_argv' area to * provide the exact amount of room for the values added. Set up * `offset' as the number of bytes to be added to the `begin_argv' - * area. + * area. ibe_interp_offset is the fixed offset from macros present in + * the interpreter string. */ - offset = ibe->ibe_interp_length; + offset = ibe->ibe_interp_length + ibe->ibe_interp_offset; - /* Adjust the offset for #'s. */ - s = ibe->ibe_interpreter; - while (1) { - s = strchr(s, '#'); - if (!s) - break; + /* Variable offset to be added from macros to the interpreter string. */ + MPASS(ibe->ibe_argv0_cnt == 0 || namelen > 0); + offset += ibe->ibe_argv0_cnt * (namelen - 2); - s++; - switch(*s) { - case ISM_POUND: - /* "##" -> "#": reduce offset by one. */ - offset--; - break; - - case ISM_OLD_ARGV0: - /* "#a" -> (old argv0): increase offset to fit fname */ - offset += strlen(fname) - 2; - break; - - default: - /* Hmm... This shouldn't happen. */ - sx_sunlock(&interp_list_sx); - printf("%s: Unknown macro #%c sequence in " - "interpreter string\n", KMOD_NAME, *(s + 1)); - error = EINVAL; - goto done; - } - s++; - } - /* Check to make sure we won't overrun the stringspace. */ if (offset > imgp->args->stringspace) { - sx_sunlock(&interp_list_sx); error = E2BIG; goto done; } @@ -684,26 +683,20 @@ imgact_binmisc_exec(struct image_params *imgp) /* "##": Replace with a single '#' */ *d++ = '#'; break; - case ISM_OLD_ARGV0: /* "#a": Replace with old arg0 (fname). */ - if ((l = strlen(fname)) != 0) { - memcpy(d, fname, l); - d += l; - } + MPASS(ibe->ibe_argv0_cnt >= ++argv0_cnt); + memcpy(d, fname, namelen); + d += namelen; break; - default: - /* Shouldn't happen but skip it if it does. */ - break; + __assert_unreachable(); } break; - case ' ': /* Replace space with NUL to separate arguments. */ *d++ = '\0'; break; - default: *d++ = *s; break; @@ -711,13 +704,14 @@ imgact_binmisc_exec(struct image_params *imgp) s++; } *d = '\0'; - sx_sunlock(&interp_list_sx); - if (!error) - imgp->interpreter_name = imgp->args->begin_argv; + /* Catch ibe->ibe_argv0_cnt counting more #a than we did. */ + MPASS(ibe->ibe_argv0_cnt == argv0_cnt); + imgp->interpreter_name = imgp->args->begin_argv; done: + INTERP_LIST_RUNLOCK(); if (sname) sbuf_delete(sname); return (error); @@ -727,7 +721,7 @@ static void imgact_binmisc_init(void *arg) { - sx_init(&interp_list_sx, KMOD_NAME); + INTERP_LIST_LOCK_INIT(); } static void @@ -736,15 +730,15 @@ imgact_binmisc_fini(void *arg) imgact_binmisc_entry_t *ibe, *ibe_tmp; /* Free all the interpreters. */ - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); SLIST_FOREACH_SAFE(ibe, &interpreter_list, link, ibe_tmp) { SLIST_REMOVE(&interpreter_list, ibe, imgact_binmisc_entry, link); imgact_binmisc_destroy_entry(ibe); } - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); - sx_destroy(&interp_list_sx); + INTERP_LIST_LOCK_DESTROY(); } SYSINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE, imgact_binmisc_init, Modified: stable/12/sys/sys/imgact_binmisc.h ============================================================================== --- stable/12/sys/sys/imgact_binmisc.h Sat Nov 14 00:59:55 2020 (r367656) +++ stable/12/sys/sys/imgact_binmisc.h Sat Nov 14 01:28:04 2020 (r367657) @@ -47,11 +47,18 @@ #define IBE_INTERP_LEN_MAX (MAXPATHLEN + IBE_ARG_LEN_MAX) #define IBE_MAX_ENTRIES 64 /* Max number of interpreter entries. */ +/* We only map the first page for identification purposes. */ +#define IBE_MATCH_MAX PAGE_SIZE +_Static_assert(IBE_MAGIC_MAX <= IBE_MATCH_MAX, + "Cannot identify binaries past the first page."); + /* * Imgact bin misc interpreter entry flags. */ #define IBF_ENABLED 0x0001 /* Entry is active. */ #define IBF_USE_MASK 0x0002 /* Use mask on header magic field. */ + +#define IBF_VALID_UFLAGS 0x0003 /* Bits allowed from userland. */ /* * Used with sysctlbyname() to pass imgact bin misc entries in and out of the Modified: stable/12/usr.sbin/binmiscctl/Makefile ============================================================================== --- stable/12/usr.sbin/binmiscctl/Makefile Sat Nov 14 00:59:55 2020 (r367656) +++ stable/12/usr.sbin/binmiscctl/Makefile Sat Nov 14 01:28:04 2020 (r367657) @@ -3,7 +3,7 @@ # .include - + PROG= binmiscctl MAN= binmiscctl.8 Modified: stable/12/usr.sbin/binmiscctl/binmiscctl.c ============================================================================== --- stable/12/usr.sbin/binmiscctl/binmiscctl.c Sat Nov 14 00:59:55 2020 (r367656) +++ stable/12/usr.sbin/binmiscctl/binmiscctl.c Sat Nov 14 01:28:04 2020 (r367657) @@ -28,6 +28,12 @@ #include __FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include + #include #include #include @@ -37,12 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include - enum cmd { CMD_ADD = 0, CMD_REMOVE, @@ -134,7 +134,7 @@ static char const *cmd_sysctl_name[] = { IBE_SYSCTL_NAME_LIST }; -static void +static void __dead2 usage(const char *format, ...) { va_list args; @@ -150,7 +150,7 @@ usage(const char *format, ...) fprintf(stderr, "\n"); fprintf(stderr, "usage: %s command [args...]\n\n", __progname); - for(i = 0; i < ( sizeof (cmds) / sizeof (cmds[0])); i++) { + for(i = 0; i < nitems(cmds); i++) { fprintf(stderr, "%s:\n", cmds[i].desc); fprintf(stderr, "\t%s %s %s\n\n", __progname, cmds[i].name, cmds[i].args); @@ -159,7 +159,7 @@ usage(const char *format, ...) exit (error); } -static void +static void __dead2 fatal(const char *format, ...) { va_list args; @@ -232,7 +232,7 @@ demux_cmd(__unused int argc, char *const argv[]) optind = 1; optreset = 1; - for(i = 0; i < ( sizeof (cmds) / sizeof (cmds[0])); i++) { + for(i = 0; i < nitems(cmds); i++) { if (!strcasecmp(cmds[i].name, argv[0])) { return (i); } @@ -505,7 +505,7 @@ main(int argc, char **argv) free(xbe_outp); fatal("Fatal: %s", strerror(errno)); } - for(i = 0; i < (xbe_out_sz / sizeof(xbe_out)); i++) + for(i = 0; i < howmany(xbe_out_sz, sizeof(xbe_out)); i++) printxbe(&xbe_outp[i]); } From owner-svn-src-all@freebsd.org Sat Nov 14 01:39:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 840A4466C50; Sat, 14 Nov 2020 01:39:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXygN3PKfz3kHp; Sat, 14 Nov 2020 01:39:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6797522087; Sat, 14 Nov 2020 01:39:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE1dSFL082875; Sat, 14 Nov 2020 01:39:28 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE1dSm5082874; Sat, 14 Nov 2020 01:39:28 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202011140139.0AE1dSm5082874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 14 Nov 2020 01:39:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367658 - head X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 01:39:28 -0000 Author: rmacklem Date: Sat Nov 14 01:39:27 2020 New Revision: 367658 URL: https://svnweb.freebsd.org/changeset/base/367658 Log: Add an entry for r367026, r367423. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Sat Nov 14 01:28:04 2020 (r367657) +++ head/RELNOTES Sat Nov 14 01:39:27 2020 (r367658) @@ -10,6 +10,14 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r367423: + This commit added a new startup scripts variable called + nfsv4_server_only which uses the -R option on mountd added by r367026. + When nfsv4_server_only is set to "YES" in /etc/rc.conf, the NFS server + only handles NFSv4 and does not register with rpcbind. As such, rpcbind + does not need to be running. Useful for sites which consider rpcbind a + security issue. + r366267: Kernel option ACPI_DMAR was renamed to IOMMU. amd64's IOMMU subsystem was split out from amd64 DMAR support and is now generic, i.e., it can From owner-svn-src-all@freebsd.org Sat Nov 14 01:45:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A389B46733E; Sat, 14 Nov 2020 01:45:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXypR4CPMz3kqg; Sat, 14 Nov 2020 01:45:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83B67221F5; Sat, 14 Nov 2020 01:45:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE1jZ1D088876; Sat, 14 Nov 2020 01:45:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE1jZ2n088874; Sat, 14 Nov 2020 01:45:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011140145.0AE1jZ2n088874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 14 Nov 2020 01:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367659 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 367659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 01:45:35 -0000 Author: mav Date: Sat Nov 14 01:45:34 2020 New Revision: 367659 URL: https://svnweb.freebsd.org/changeset/base/367659 Log: Add PMRCAP printing and fix earlier CAP_HI. MFC after: 3 days Modified: head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 14 01:39:27 2020 (r367658) +++ head/sys/dev/nvme/nvme.h Sat Nov 14 01:45:34 2020 (r367659) @@ -150,6 +150,36 @@ #define NVME_AQA_REG_ACQS_SHIFT (16) #define NVME_AQA_REG_ACQS_MASK (0xFFF) +#define NVME_PMRCAP_REG_RDS_SHIFT (3) +#define NVME_PMRCAP_REG_RDS_MASK (0x1) +#define NVME_PMRCAP_REG_WDS_SHIFT (4) +#define NVME_PMRCAP_REG_WDS_MASK (0x1) +#define NVME_PMRCAP_REG_BIR_SHIFT (5) +#define NVME_PMRCAP_REG_BIR_MASK (0x7) +#define NVME_PMRCAP_REG_PMRTU_SHIFT (8) +#define NVME_PMRCAP_REG_PMRTU_MASK (0x3) +#define NVME_PMRCAP_REG_PMRWBM_SHIFT (10) +#define NVME_PMRCAP_REG_PMRWBM_MASK (0xf) +#define NVME_PMRCAP_REG_PMRTO_SHIFT (16) +#define NVME_PMRCAP_REG_PMRTO_MASK (0xff) +#define NVME_PMRCAP_REG_CMSS_SHIFT (24) +#define NVME_PMRCAP_REG_CMSS_MASK (0x1) + +#define NVME_PMRCAP_RDS(x) \ + (((x) >> NVME_PMRCAP_REG_RDS_SHIFT) & NVME_PMRCAP_REG_RDS_MASK) +#define NVME_PMRCAP_WDS(x) \ + (((x) >> NVME_PMRCAP_REG_WDS_SHIFT) & NVME_PMRCAP_REG_WDS_MASK) +#define NVME_PMRCAP_BIR(x) \ + (((x) >> NVME_PMRCAP_REG_BIR_SHIFT) & NVME_PMRCAP_REG_BIR_MASK) +#define NVME_PMRCAP_PMRTU(x) \ + (((x) >> NVME_PMRCAP_REG_PMRTU_SHIFT) & NVME_PMRCAP_REG_PMRTU_MASK) +#define NVME_PMRCAP_PMRWBM(x) \ + (((x) >> NVME_PMRCAP_REG_PMRWBM_SHIFT) & NVME_PMRCAP_REG_PMRWBM_MASK) +#define NVME_PMRCAP_PMRTO(x) \ + (((x) >> NVME_PMRCAP_REG_PMRTO_SHIFT) & NVME_PMRCAP_REG_PMRTO_MASK) +#define NVME_PMRCAP_CMSS(x) \ + (((x) >> NVME_PMRCAP_REG_CMSS_SHIFT) & NVME_PMRCAP_REG_CMSS_MASK) + /* Command field definitions */ #define NVME_CMD_FUSE_SHIFT (8) Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Sat Nov 14 01:39:27 2020 (r367658) +++ head/sys/dev/nvme/nvme_ctrlr.c Sat Nov 14 01:45:34 2020 (r367659) @@ -1367,7 +1367,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de struct make_dev_args md_args; uint32_t cap_lo; uint32_t cap_hi; - uint32_t to, vs; + uint32_t to, vs, pmrcap; uint8_t mpsmin; int status, timeout_period; @@ -1390,20 +1390,32 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de cap_hi = nvme_mmio_read_4(ctrlr, cap_hi); if (bootverbose) { device_printf(dev, "CapHi: 0x%08x: DSTRD %u%s, CSS %x%s, " - "MPSMIN %u, MPSMAX %u %s%s\n", cap_hi, + "MPSMIN %u, MPSMAX %u%s%s\n", cap_hi, NVME_CAP_HI_DSTRD(cap_hi), - NVME_CAP_HI_NSSRS(cap_lo) ? ", NSSRS" : "", + NVME_CAP_HI_NSSRS(cap_hi) ? ", NSSRS" : "", NVME_CAP_HI_CSS(cap_hi), - NVME_CAP_HI_BPS(cap_lo) ? ", BPS" : "", + NVME_CAP_HI_BPS(cap_hi) ? ", BPS" : "", NVME_CAP_HI_MPSMIN(cap_hi), NVME_CAP_HI_MPSMAX(cap_hi), - NVME_CAP_HI_PMRS(cap_lo) ? ", PMRS" : "", - NVME_CAP_HI_CMBS(cap_lo) ? ", CMBS" : ""); + NVME_CAP_HI_PMRS(cap_hi) ? ", PMRS" : "", + NVME_CAP_HI_CMBS(cap_hi) ? ", CMBS" : ""); } if (bootverbose) { vs = nvme_mmio_read_4(ctrlr, vs); device_printf(dev, "Version: 0x%08x: %d.%d\n", vs, NVME_MAJOR(vs), NVME_MINOR(vs)); + } + if (bootverbose && NVME_CAP_HI_PMRS(cap_hi)) { + pmrcap = nvme_mmio_read_4(ctrlr, pmrcap); + device_printf(dev, "PMRCap: 0x%08x: BIR %u%s%s, PMRTU %u, " + "PMRWBM %x, PMRTO %u%s\n", pmrcap, + NVME_PMRCAP_BIR(pmrcap), + NVME_PMRCAP_RDS(pmrcap) ? ", RDS" : "", + NVME_PMRCAP_WDS(pmrcap) ? ", WDS" : "", + NVME_PMRCAP_PMRTU(pmrcap), + NVME_PMRCAP_PMRWBM(pmrcap), + NVME_PMRCAP_PMRTO(pmrcap), + NVME_PMRCAP_CMSS(pmrcap) ? ", CMSS" : ""); } ctrlr->dstrd = NVME_CAP_HI_DSTRD(cap_hi) + 2; From owner-svn-src-all@freebsd.org Sat Nov 14 01:49:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 983E34678C3; Sat, 14 Nov 2020 01:49:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXyvK3sFSz3lGS; Sat, 14 Nov 2020 01:49:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 772F2221FB; Sat, 14 Nov 2020 01:49:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE1nnIb089105; Sat, 14 Nov 2020 01:49:49 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE1nnBc089104; Sat, 14 Nov 2020 01:49:49 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202011140149.0AE1nnBc089104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 14 Nov 2020 01:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367660 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 367660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 01:49:49 -0000 Author: rmacklem Date: Sat Nov 14 01:49:49 2020 New Revision: 367660 URL: https://svnweb.freebsd.org/changeset/base/367660 Log: Fix startup of gssd when /usr is a separately mounted local file system. meowthink@gmail.com reported that the gssd daemon was not starting, because /etc/rc.d/gssd was executed before his local /usr file system was mounted. He fixed the problem by adding mountcritlocal to the REQUIRED line. This fix seems safe and works for a separately mounted /usr file system on a local disk. The case of a separately mounted remote /usr file system (such as NFS) is still broken, but there is no obvious solution for that. Adding mountcritremote would fix the problem, but it would cause a POLA violation, because all kerberized NFS mounts in /etc/fstab would need the "late" option specified to work. Submitted by: meowthink@gmail.com Reported by: meowthink@gmail.com Reviewed by: 0mp MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D27203 Modified: head/libexec/rc/rc.d/gssd Modified: head/libexec/rc/rc.d/gssd ============================================================================== --- head/libexec/rc/rc.d/gssd Sat Nov 14 01:45:34 2020 (r367659) +++ head/libexec/rc/rc.d/gssd Sat Nov 14 01:49:49 2020 (r367660) @@ -4,7 +4,7 @@ # # PROVIDE: gssd -# REQUIRE: root +# REQUIRE: root mountcritlocal # KEYWORD: nojail shutdown . /etc/rc.subr From owner-svn-src-all@freebsd.org Sat Nov 14 01:55:03 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E91A467CCA; Sat, 14 Nov 2020 01:55:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXz1M20Mpz3lnC; Sat, 14 Nov 2020 01:55:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37639222AA; Sat, 14 Nov 2020 01:55:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE1t3Wx095032; Sat, 14 Nov 2020 01:55:03 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE1t33N095031; Sat, 14 Nov 2020 01:55:03 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202011140155.0AE1t33N095031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 14 Nov 2020 01:55:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367661 - head X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 01:55:03 -0000 Author: rmacklem Date: Sat Nov 14 01:55:02 2020 New Revision: 367661 URL: https://svnweb.freebsd.org/changeset/base/367661 Log: Add a entry for r367660. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Sat Nov 14 01:49:49 2020 (r367660) +++ head/RELNOTES Sat Nov 14 01:55:02 2020 (r367661) @@ -10,6 +10,16 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r367660: + Fixes the case where gssd will not startup because /usr is a separate + local file system that is not yet mounted. It does not fix the case + where /usr is a separately mounted remote file system (such as NFS). + This latter case can be fixed by adding mountcritremote to the + REQUIRED line. Unfortunately doing so implies that all Kerberized + NFS mounts in /etc/fstab will need the "late" mount option. + This was not done, since the requirement for "late" would introduce + a POLA violation. + r367423: This commit added a new startup scripts variable called nfsv4_server_only which uses the -R option on mountd added by r367026. From owner-svn-src-all@freebsd.org Sat Nov 14 01:55:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF25B467D0C; Sat, 14 Nov 2020 01:55:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXz2L5VYcz3lxl; Sat, 14 Nov 2020 01:55:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF19722506; Sat, 14 Nov 2020 01:55:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE1tsYm095118; Sat, 14 Nov 2020 01:55:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE1ts7P095117; Sat, 14 Nov 2020 01:55:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011140155.0AE1ts7P095117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 01:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367662 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 01:55:54 -0000 Author: kevans Date: Sat Nov 14 01:55:54 2020 New Revision: 367662 URL: https://svnweb.freebsd.org/changeset/base/367662 Log: MFC r367440: epoch: support non-preemptible epochs checking in_epoch() Previously, non-preemptible epochs could not check; in_epoch() would always fail, usually because non-preemptible epochs don't imply THREAD_NO_SLEEPING. For default epochs, it's easy enough to verify that we're in the given epoch: if we're in a critical section and our record for the given epoch is active, then we're in it. This patch also adds some additional INVARIANTS bookkeeping. Notably, we set and check the recorded thread in epoch_enter/epoch_exit to try and catch some edge-cases for the caller. It also checks upon freeing that none of the records had a thread in the epoch, which may make it a little easier to diagnose some improper use if epoch_free() took place while some other thread was inside. This version differs slightly from what was just previously reviewed by the below-listed, in that in_epoch() will assert that no CPU has this thread recorded even if it *is* currently in a critical section. This is intended to catch cases where the caller might have somehow messed up critical section nesting, we can catch both if they exited the critical section or if they exited, migrated, then re-entered (on the wrong CPU). Modified: stable/12/sys/kern/subr_epoch.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_epoch.c ============================================================================== --- stable/12/sys/kern/subr_epoch.c Sat Nov 14 01:55:02 2020 (r367661) +++ stable/12/sys/kern/subr_epoch.c Sat Nov 14 01:55:54 2020 (r367662) @@ -69,6 +69,10 @@ typedef struct epoch_record { /* fields above are part of KBI and cannot be modified */ struct epoch_context er_drain_ctx; struct epoch *er_parent; +#ifdef INVARIANTS + /* Used to verify record ownership for non-preemptible epochs. */ + struct thread *er_td; +#endif } __aligned(EPOCH_ALIGN) *epoch_record_t; struct epoch { @@ -251,6 +255,9 @@ done: void epoch_free(epoch_t epoch) { +#ifdef INVARIANTS + int cpu; +#endif EPOCH_LOCK(); @@ -264,6 +271,21 @@ epoch_free(epoch_t epoch) * to zero, by calling epoch_wait() on the global_epoch: */ epoch_wait(global_epoch); +#ifdef INVARIANTS + CPU_FOREACH(cpu) { + epoch_record_t er; + + er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); + + /* + * Sanity check: none of the records should be in use anymore. + * We drained callbacks above and freeing the pcpu records is + * imminent. + */ + MPASS(er->er_td == NULL); + MPASS(TAILQ_EMPTY(&er->er_tdlist)); + } +#endif uma_zfree_pcpu(pcpu_zone_record, epoch->e_pcpu_record); mtx_destroy(&epoch->e_drain_mtx); sx_destroy(&epoch->e_drain_sx); @@ -306,6 +328,8 @@ epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et) td->td_pre_epoch_prio = td->td_priority; er = epoch_currecord(epoch); + /* Record-level tracking is reserved for non-preemptible epochs. */ + MPASS(er->er_td == NULL); TAILQ_INSERT_TAIL(&er->er_tdlist, et, et_link); ck_epoch_begin(&er->er_record, &et->et_section); critical_exit(); @@ -324,6 +348,15 @@ epoch_enter(epoch_t epoch) td->td_epochnest++; critical_enter(); er = epoch_currecord(epoch); +#ifdef INVARIANTS + if (er->er_record.active == 0) { + MPASS(er->er_td == NULL); + er->er_td = curthread; + } else { + /* We've recursed, just make sure our accounting isn't wrong. */ + MPASS(er->er_td == curthread); + } +#endif ck_epoch_begin(&er->er_record, NULL); } @@ -351,6 +384,8 @@ epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et) #endif #ifdef INVARIANTS et->et_td = (void*)0xDEADBEEF; + /* Record-level tracking is reserved for non-preemptible epochs. */ + MPASS(er->er_td == NULL); #endif ck_epoch_end(&er->er_record, &et->et_section); TAILQ_REMOVE(&er->er_tdlist, et, et_link); @@ -372,6 +407,11 @@ epoch_exit(epoch_t epoch) td->td_epochnest--; er = epoch_currecord(epoch); ck_epoch_end(&er->er_record, NULL); +#ifdef INVARIANTS + MPASS(er->er_td == curthread); + if (er->er_record.active == 0) + er->er_td = NULL; +#endif critical_exit(); } @@ -662,18 +702,18 @@ epoch_call_task(void *arg __unused) } } -int -in_epoch_verbose(epoch_t epoch, int dump_onfail) +static int +in_epoch_verbose_preempt(epoch_t epoch, int dump_onfail) { + epoch_record_t er; struct epoch_tracker *tdwait; struct thread *td; - epoch_record_t er; + MPASS(epoch != NULL); + MPASS((epoch->e_flags & EPOCH_PREEMPT) != 0); td = curthread; if (td->td_epochnest == 0) return (0); - if (__predict_false((epoch) == NULL)) - return (0); critical_enter(); er = epoch_currecord(epoch); TAILQ_FOREACH(tdwait, &er->er_tdlist, et_link) @@ -692,6 +732,66 @@ in_epoch_verbose(epoch_t epoch, int dump_onfail) #endif critical_exit(); return (0); +} + +#ifdef INVARIANTS +static void +epoch_assert_nocpu(epoch_t epoch, struct thread *td) +{ + epoch_record_t er; + int cpu; + bool crit; + + crit = td->td_critnest > 0; + + /* Check for a critical section mishap. */ + CPU_FOREACH(cpu) { + er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); + KASSERT(er->er_td != td, + ("%s critical section in epoch from cpu %d", + (crit ? "exited" : "re-entered"), cpu)); + } +} +#else +#define epoch_assert_nocpu(e, td) +#endif + +int +in_epoch_verbose(epoch_t epoch, int dump_onfail) +{ + epoch_record_t er; + struct thread *td; + + if (__predict_false((epoch) == NULL)) + return (0); + if ((epoch->e_flags & EPOCH_PREEMPT) != 0) + return (in_epoch_verbose_preempt(epoch, dump_onfail)); + + /* + * The thread being in a critical section is a necessary + * condition to be correctly inside a non-preemptible epoch, + * so it's definitely not in this epoch. + */ + td = curthread; + if (td->td_critnest == 0) { + epoch_assert_nocpu(epoch, td); + return (0); + } + + /* + * The current cpu is in a critical section, so the epoch record will be + * stable for the rest of this function. Knowing that the record is not + * active is sufficient for knowing whether we're in this epoch or not, + * since it's a pcpu record. + */ + er = epoch_currecord(epoch); + if (er->er_record.active == 0) { + epoch_assert_nocpu(epoch, td); + return (0); + } + + MPASS(er->er_td == td); + return (1); } int From owner-svn-src-all@freebsd.org Sat Nov 14 01:58:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E820A2D0310; Sat, 14 Nov 2020 01:58:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXz5Q5lBKz3lyf; Sat, 14 Nov 2020 01:58:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 929C02231C; Sat, 14 Nov 2020 01:58:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE1wYdS095290; Sat, 14 Nov 2020 01:58:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE1wYWG095289; Sat, 14 Nov 2020 01:58:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011140158.0AE1wYWG095289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 01:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367663 - stable/12/sys/dev/vt X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/dev/vt X-SVN-Commit-Revision: 367663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 01:58:35 -0000 Author: kevans Date: Sat Nov 14 01:58:33 2020 New Revision: 367663 URL: https://svnweb.freebsd.org/changeset/base/367663 Log: MFC r367448: vt: resolve conflict between VT_ALT_TO_ESC_HACK and DBG When using the ALT+CTRL+ESC sequence to break into kdb, the keyboard is completely borked when you return. watch(8) shows that it's working, but it's inserting escape sequences. Further investigation revealed that VT_ALT_TO_ESC_HACK is the default and directly conflicts with this sequence, so upon return from the debugger ALKED is set. If they triggered the break to debugger, it's safe to assume they didn't mean to use VT_ALT_TO_ESC_HACK, so just unset it to reduce the surprise when the keyboard seems non-functional upon return. Modified: stable/12/sys/dev/vt/vt_core.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/vt/vt_core.c ============================================================================== --- stable/12/sys/dev/vt/vt_core.c Sat Nov 14 01:55:54 2020 (r367662) +++ stable/12/sys/dev/vt/vt_core.c Sat Nov 14 01:58:33 2020 (r367663) @@ -725,13 +725,22 @@ vt_scroll(struct vt_window *vw, int offset, int whence } static int -vt_machine_kbdevent(int c) +vt_machine_kbdevent(struct vt_device *vd, int c) { switch (c) { case SPCLKEY | DBG: /* kbdmap(5) keyword `debug`. */ - if (vt_kbd_debug) + if (vt_kbd_debug) { kdb_enter(KDB_WHY_BREAK, "manual escape to debugger"); +#if VT_ALT_TO_ESC_HACK + /* + * There's an unfortunate conflict between SPCLKEY|DBG + * and VT_ALT_TO_ESC_HACK. Just assume they didn't mean + * it if we got to here. + */ + vd->vd_kbstate &= ~ALKED; +#endif + } return (1); case SPCLKEY | HALT: /* kbdmap(5) keyword `halt`. */ if (vt_kbd_halt) @@ -864,7 +873,7 @@ vt_processkey(keyboard_t *kbd, struct vt_device *vd, i return (0); #endif - if (vt_machine_kbdevent(c)) + if (vt_machine_kbdevent(vd, c)) return (0); if (vw->vw_flags & VWF_SCROLL) { From owner-svn-src-all@freebsd.org Sat Nov 14 02:00:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B982C2D0531; Sat, 14 Nov 2020 02:00:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXz824nqSz3mPl; Sat, 14 Nov 2020 02:00:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9762D220DA; Sat, 14 Nov 2020 02:00:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE20oR4097835; Sat, 14 Nov 2020 02:00:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE20ovq097834; Sat, 14 Nov 2020 02:00:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011140200.0AE20ovq097834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 02:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367664 - stable/12/usr.sbin/ngctl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/usr.sbin/ngctl X-SVN-Commit-Revision: 367664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 02:00:50 -0000 Author: kevans Date: Sat Nov 14 02:00:50 2020 New Revision: 367664 URL: https://svnweb.freebsd.org/changeset/base/367664 Log: MFC r366430: ngctl: add -c (compact output) for the dot command The output of "ngctl dot" is suitable for small netgraph networks. Even moderate complex netgraph setups (about a dozen nodes) are hard to understand from the .dot output, because each node and each hook are shown as a full blown structure. This patch allows to generate much more compact output and graphs by omitting the extra structures for the individual hooks. Instead the names of the hooks are labels to the edges. Modified: stable/12/usr.sbin/ngctl/dot.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/ngctl/dot.c ============================================================================== --- stable/12/usr.sbin/ngctl/dot.c Sat Nov 14 01:58:33 2020 (r367663) +++ stable/12/usr.sbin/ngctl/dot.c Sat Nov 14 02:00:50 2020 (r367664) @@ -2,6 +2,7 @@ /* * dot.c * + * Copyright (c) 2019 Lutz Donnerhacke * Copyright (c) 2004 Brian Fundakowski Feldman * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. @@ -53,9 +54,11 @@ static int DotCmd(int ac, char **av); const struct ngcmd dot_cmd = { DotCmd, - "dot [outputfile]", + "dot [-c] [outputfile]", "Produce a GraphViz (.dot) of the entire netgraph.", - "If no outputfile is specified, stdout will be assumed.", + "If no outputfile is specified, stdout will be assumed." + " The optional -c argument generates a graph without separate" + " structures for edge names. Such a graph is more compact.", { "graphviz", "confdot" } }; @@ -66,12 +69,16 @@ DotCmd(int ac, char **av) struct namelist *nlist; FILE *f = stdout; int ch; + int compact = 0; u_int i; /* Get options */ optind = 1; - while ((ch = getopt(ac, av, "")) != -1) { + while ((ch = getopt(ac, av, "c")) != -1) { switch (ch) { + case 'c': + compact = 1; + break; case '?': default: return (CMDRTN_USAGE); @@ -109,9 +116,14 @@ DotCmd(int ac, char **av) } nlist = (struct namelist *)nlresp->data; - fprintf(f, "graph netgraph {\n"); - /* TODO: implement rank = same or subgraphs at some point */ - fprintf(f, "\tedge [ weight = 1.0 ];\n"); + if (compact) { + fprintf(f, "digraph netgraph {\n"); + fprintf(f, "\tedge [ dir = \"none\", fontsize = 10 ];\n"); + } else { + fprintf(f, "graph netgraph {\n"); + /* TODO: implement rank = same or subgraphs at some point */ + fprintf(f, "\tedge [ weight = 1.0 ];\n"); + } fprintf(f, "\tnode [ shape = record, fontsize = 12 ] {\n"); for (i = 0; i < nlist->numnames; i++) fprintf(f, "\t\t\"%jx\" [ label = \"{%s:|{%s|[%jx]:}}\" ];\n", @@ -159,30 +171,40 @@ DotCmd(int ac, char **av) continue; } - fprintf(f, "\tnode [ shape = octagon, fontsize = 10 ] {\n"); - for (j = 0; j < ninfo->hooks; j++) - fprintf(f, "\t\t\"%jx.%s\" [ label = \"%s\" ];\n", - (uintmax_t)nlist->nodeinfo[i].id, - hlist->link[j].ourhook, hlist->link[j].ourhook); - fprintf(f, "\t};\n"); + if (!compact) { + fprintf(f, "\tnode [ shape = octagon, fontsize = 10 ] {\n"); + for (j = 0; j < ninfo->hooks; j++) + fprintf(f, "\t\t\"%jx.%s\" [ label = \"%s\" ];\n", + (uintmax_t)nlist->nodeinfo[i].id, + hlist->link[j].ourhook, hlist->link[j].ourhook); + fprintf(f, "\t};\n"); - fprintf(f, "\t{\n\t\tedge [ weight = 2.0, style = bold ];\n"); - for (j = 0; j < ninfo->hooks; j++) - fprintf(f, "\t\t\"%jx\" -- \"%jx.%s\";\n", - (uintmax_t)nlist->nodeinfo[i].id, - (uintmax_t)nlist->nodeinfo[i].id, - hlist->link[j].ourhook); - fprintf(f, "\t};\n"); + fprintf(f, "\t{\n\t\tedge [ weight = 2.0, style = bold ];\n"); + for (j = 0; j < ninfo->hooks; j++) + fprintf(f, "\t\t\"%jx\" -- \"%jx.%s\";\n", + (uintmax_t)nlist->nodeinfo[i].id, + (uintmax_t)nlist->nodeinfo[i].id, + hlist->link[j].ourhook); + fprintf(f, "\t};\n"); + } for (j = 0; j < ninfo->hooks; j++) { /* Only print the edges going in one direction. */ if (hlist->link[j].nodeinfo.id > nlist->nodeinfo[i].id) continue; - fprintf(f, "\t\"%jx.%s\" -- \"%jx.%s\";\n", - (uintmax_t)nlist->nodeinfo[i].id, - hlist->link[j].ourhook, - (uintmax_t)hlist->link[j].nodeinfo.id, - hlist->link[j].peerhook); + if (compact) { + fprintf(f, "\t\"%jx\" -> \"%jx\" [ headlabel = \"%s\", taillabel = \"%s\" ] ;\n", + (uintmax_t)hlist->link[j].nodeinfo.id, + (uintmax_t)nlist->nodeinfo[i].id, + hlist->link[j].ourhook, + hlist->link[j].peerhook); + } else { + fprintf(f, "\t\"%jx.%s\" -- \"%jx.%s\";\n", + (uintmax_t)nlist->nodeinfo[i].id, + hlist->link[j].ourhook, + (uintmax_t)hlist->link[j].nodeinfo.id, + hlist->link[j].peerhook); + } } free(hlresp); } From owner-svn-src-all@freebsd.org Sat Nov 14 02:03:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C8582D0578; Sat, 14 Nov 2020 02:03:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXzCC3216z3mkV; Sat, 14 Nov 2020 02:03:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AD1222684; Sat, 14 Nov 2020 02:03:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE23ZSV001172; Sat, 14 Nov 2020 02:03:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE23Zi1001171; Sat, 14 Nov 2020 02:03:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011140203.0AE23Zi1001171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 02:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367665 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 367665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 02:03:35 -0000 Author: kevans Date: Sat Nov 14 02:03:34 2020 New Revision: 367665 URL: https://svnweb.freebsd.org/changeset/base/367665 Log: MFC r366275: Makefile.inc1: sysent: parallel subordinate sysent targets makesyscalls.lua (and indeed makesyscalls.sh) are both safe to be run in parallel, so let's do it. This is a trivial difference because runtime per-target is pretty small, but I like seeing it run in parallel when my muscle memory types `make -sj4`. Modified: stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Modified: stable/12/Makefile.inc1 ============================================================================== --- stable/12/Makefile.inc1 Sat Nov 14 02:00:50 2020 (r367664) +++ stable/12/Makefile.inc1 Sat Nov 14 02:03:34 2020 (r367665) @@ -1475,9 +1475,13 @@ _sysent_dirs+= sys/amd64/linux \ sys/amd64/linux32 \ sys/arm64/linux \ sys/i386/linux + sysent: .PHONY .for _dir in ${_sysent_dirs} +sysent-${_dir}: .PHONY ${_+_}${MAKE} -C ${.CURDIR}/${_dir} sysent + +sysent: sysent-${_dir} .endfor # From owner-svn-src-all@freebsd.org Sat Nov 14 02:11:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 004662D09F7; Sat, 14 Nov 2020 02:11:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXzMs6Wg9z3myR; Sat, 14 Nov 2020 02:11:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D27062269C; Sat, 14 Nov 2020 02:11:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE2B5kS002394; Sat, 14 Nov 2020 02:11:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE2B4fv002385; Sat, 14 Nov 2020 02:11:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011140211.0AE2B4fv002385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 02:11:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367666 - in stable/12: . stand/lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: . stand/lua X-SVN-Commit-Revision: 367666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 02:11:06 -0000 Author: kevans Date: Sat Nov 14 02:11:04 2020 New Revision: 367666 URL: https://svnweb.freebsd.org/changeset/base/367666 Log: MFC r366435: lualoader: improve the design of the brand-/logo- mechanism In the previous world order, any brand/logo was forced to pull in the drawer and call drawer.add{Brand,Logo} with the name their brand/logo is taking and a table describing it. In the new world order, these files just need to return a table that maps out graphics types to a table of the exact same format as what was previously being passed back into the drawer. The appeal here is not needing to grab a reference back to the drawer module and having a cleaner data-driven looking format for these. The format has been renamed to 'gfx-*' prefixes and each one can provide a logo and a brand. drawer.addBrand/drawer.addLogo will remain in place until FreeBSD 13, as there's no overhead to them and it's not yet worth the break in compatibility with any pre-existing brands and logos. Added: stable/12/stand/lua/gfx-beastie.lua - copied unchanged from r366435, head/stand/lua/gfx-beastie.lua stable/12/stand/lua/gfx-beastiebw.lua - copied unchanged from r366435, head/stand/lua/gfx-beastiebw.lua stable/12/stand/lua/gfx-fbsdbw.lua - copied unchanged from r366435, head/stand/lua/gfx-fbsdbw.lua stable/12/stand/lua/gfx-orb.lua - copied unchanged from r366435, head/stand/lua/gfx-orb.lua stable/12/stand/lua/gfx-orbbw.lua - copied unchanged from r366435, head/stand/lua/gfx-orbbw.lua Deleted: stable/12/stand/lua/logo-beastie.lua stable/12/stand/lua/logo-beastiebw.lua stable/12/stand/lua/logo-fbsdbw.lua stable/12/stand/lua/logo-orb.lua stable/12/stand/lua/logo-orbbw.lua Modified: stable/12/ObsoleteFiles.inc stable/12/stand/lua/Makefile stable/12/stand/lua/drawer.lua Directory Properties: stable/12/ (props changed) Modified: stable/12/ObsoleteFiles.inc ============================================================================== --- stable/12/ObsoleteFiles.inc Sat Nov 14 02:03:34 2020 (r367665) +++ stable/12/ObsoleteFiles.inc Sat Nov 14 02:11:04 2020 (r367666) @@ -38,6 +38,13 @@ # xargs -n1 | sort | uniq -d; # done +# 20201004: logo files renamed to type-agnostic gfx-*.lua +OLD_FILES+=boot/lua/logo-beastie.lua +OLD_FILES+=boot/lua/logo-beastiebw.lua +OLD_FILES+=boot/lua/logo-fbsdbw.lua +OLD_FILES+=boot/lua/logo-orb.lua +OLD_FILES+=boot/lua/logo-orbbw.lua + # 20200722: new clang import which bumps version from 10.0.0 to 10.0.1. OLD_FILES+=usr/lib/clang/10.0.0/include/cuda_wrappers/algorithm OLD_FILES+=usr/lib/clang/10.0.0/include/cuda_wrappers/complex Modified: stable/12/stand/lua/Makefile ============================================================================== --- stable/12/stand/lua/Makefile Sat Nov 14 02:03:34 2020 (r367665) +++ stable/12/stand/lua/Makefile Sat Nov 14 02:11:04 2020 (r367666) @@ -20,11 +20,11 @@ FILES= cli.lua \ drawer.lua \ hook.lua \ loader.lua \ - logo-beastie.lua \ - logo-beastiebw.lua \ - logo-fbsdbw.lua \ - logo-orb.lua \ - logo-orbbw.lua \ + gfx-beastie.lua \ + gfx-beastiebw.lua \ + gfx-fbsdbw.lua \ + gfx-orb.lua \ + gfx-orbbw.lua \ menu.lua \ password.lua \ screen.lua Modified: stable/12/stand/lua/drawer.lua ============================================================================== --- stable/12/stand/lua/drawer.lua Sat Nov 14 02:03:34 2020 (r367665) +++ stable/12/stand/lua/drawer.lua Sat Nov 14 02:11:04 2020 (r367666) @@ -61,6 +61,35 @@ local function menuEntryName(drawing_menu, entry) return entry.name end +local function processFile(gfxname) + if gfxname == nil then + return false, "Missing filename" + end + + local ret = try_include('gfx-' .. gfxname) + if ret == nil then + return false, "Failed to include gfx-" .. gfxname + end + + -- Legacy format + if type(ret) ~= "table" then + return true + end + + for gfxtype, def in pairs(ret) do + if gfxtype == "brand" then + drawer.addBrand(gfxname, def) + elseif gfxtype == "logo" then + drawer.addLogo(gfxname, def) + else + return false, "Unknown graphics type '" .. gfxtype .. + "'" + end + end + + return true +end + local function getBranddef(brand) if brand == nil then return nil @@ -70,7 +99,18 @@ local function getBranddef(brand) -- Try to pull it in if branddef == nil then - try_include('brand-' .. brand) + local res, err = processFile(brand) + if not res then + -- This fallback should go away after FreeBSD 13. + try_include('brand-' .. brand) + -- If the fallback also failed, print whatever error + -- we encountered in the original processing. + if branddefs[brand] == nil then + print(err) + return nil + end + end + branddef = branddefs[brand] end @@ -86,7 +126,18 @@ local function getLogodef(logo) -- Try to pull it in if logodef == nil then - try_include('logo-' .. logo) + local res, err = processFile(logo) + if not res then + -- This fallback should go away after FreeBSD 13. + try_include('logo-' .. logo) + -- If the fallback also failed, print whatever error + -- we encountered in the original processing. + if logodefs[logo] == nil then + print(err) + return nil + end + end + logodef = logodefs[logo] end @@ -364,6 +415,8 @@ drawer.default_bw_logodef = 'orbbw' -- drawer module in case it's a filesystem issue. drawer.default_fallback_logodef = 'none' +-- These should go away after FreeBSD 13; only available for backwards +-- compatibility with old logo- files. function drawer.addBrand(name, def) branddefs[name] = def end Copied: stable/12/stand/lua/gfx-beastie.lua (from r366435, head/stand/lua/gfx-beastie.lua) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/lua/gfx-beastie.lua Sat Nov 14 02:11:04 2020 (r367666, copy of r366435, head/stand/lua/gfx-beastie.lua) @@ -0,0 +1,55 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2018 Kyle Evans +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + +return { + logo = { + graphic = { + " \027[31m, ,", + " /( )`", + " \\ \\___ / |", + " /- \027[37m_\027[31m `-/ '", + " (\027[37m/\\/ \\\027[31m \\ /\\", + " \027[37m/ / |\027[31m ` \\", + " \027[34mO O \027[37m) \027[31m/ |", + " \027[37m`-^--'\027[31m`< '", + " (_.) _ ) /", + " `.___/` /", + " `-----' /", + " \027[33m<----.\027[31m __ / __ \\", + " \027[33m<----|====\027[31mO)))\027[33m==\027[31m) \\) /\027[33m====|", + " \027[33m<----'\027[31m `--' `.__,' \\", + " | |", + " \\ / /\\", + " \027[36m______\027[31m( (_ / \\______/", + " \027[36m,' ,-----' |", + " `--{__________)\027[m", + }, + requires_color = true, + } +} Copied: stable/12/stand/lua/gfx-beastiebw.lua (from r366435, head/stand/lua/gfx-beastiebw.lua) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/lua/gfx-beastiebw.lua Sat Nov 14 02:11:04 2020 (r367666, copy of r366435, head/stand/lua/gfx-beastiebw.lua) @@ -0,0 +1,54 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2018 Kyle Evans +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + +return { + logo = { + graphic = { + " , ,", + " /( )`", + " \\ \\___ / |", + " /- _ `-/ '", + " (/\\/ \\ \\ /\\", + " / / | ` \\", + " O O ) / |", + " `-^--'`< '", + " (_.) _ ) /", + " `.___/` /", + " `-----' /", + " <----. __ / __ \\", + " <----|====O)))==) \\) /====|", + " <----' `--' `.__,' \\", + " | |", + " \\ / /\\", + " ______( (_ / \\______/", + " ,' ,-----' |", + " `--{__________)", + }, + } +} Copied: stable/12/stand/lua/gfx-fbsdbw.lua (from r366435, head/stand/lua/gfx-fbsdbw.lua) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/lua/gfx-fbsdbw.lua Sat Nov 14 02:11:04 2020 (r367666, copy of r366435, head/stand/lua/gfx-fbsdbw.lua) @@ -0,0 +1,49 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2018 Kyle Evans +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + +return { + logo = { + graphic = { + " ______", + " | ____| __ ___ ___ ", + " | |__ | '__/ _ \\/ _ \\", + " | __|| | | __/ __/", + " | | | | | | |", + " |_| |_| \\___|\\___|", + " ____ _____ _____", + " | _ \\ / ____| __ \\", + " | |_) | (___ | | | |", + " | _ < \\___ \\| | | |", + " | |_) |____) | |__| |", + " | | | |", + " |____/|_____/|_____/", + }, + shift = {x = 5, y = 4}, + } +} Copied: stable/12/stand/lua/gfx-orb.lua (from r366435, head/stand/lua/gfx-orb.lua) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/lua/gfx-orb.lua Sat Nov 14 02:11:04 2020 (r367666, copy of r366435, head/stand/lua/gfx-orb.lua) @@ -0,0 +1,52 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2018 Kyle Evans +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + +return { + logo = { + graphic = { + " \027[31m``` \027[31;1m`\027[31m", + " s` `.....---...\027[31;1m....--.``` -/\027[31m", + " +o .--` \027[31;1m/y:` +.\027[31m", + " yo`:. \027[31;1m:o `+-\027[31m", + " y/ \027[31;1m-/` -o/\027[31m", + " .- \027[31;1m::/sy+:.\027[31m", + " / \027[31;1m`-- /\027[31m", + " `: \027[31;1m:`\027[31m", + " `: \027[31;1m:`\027[31m", + " / \027[31;1m/\027[31m", + " .- \027[31;1m-.\027[31m", + " -- \027[31;1m-.\027[31m", + " `:` \027[31;1m`:`", + " \027[31;1m.-- `--.", + " .---.....----.\027[m", + }, + requires_color = true, + shift = {x = 2, y = 4}, + } +} Copied: stable/12/stand/lua/gfx-orbbw.lua (from r366435, head/stand/lua/gfx-orbbw.lua) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/lua/gfx-orbbw.lua Sat Nov 14 02:11:04 2020 (r367666, copy of r366435, head/stand/lua/gfx-orbbw.lua) @@ -0,0 +1,51 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2018 Kyle Evans +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + +return { + logo = { + graphic = { + " ``` `", + " s` `.....---.......--.``` -/", + " +o .--` /y:` +.", + " yo`:. :o `+-", + " y/ -/` -o/", + " .- ::/sy+:.", + " / `-- /", + " `: :`", + " `: :`", + " / /", + " .- -.", + " -- -.", + " `:` `:`", + " .-- `--.", + " .---.....----.", + }, + shift = {x = 2, y = 4}, + } +} From owner-svn-src-all@freebsd.org Sat Nov 14 02:11:56 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A013E2D0F02; Sat, 14 Nov 2020 02:11:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXzNr49wGz3nLM; Sat, 14 Nov 2020 02:11:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 824B3224C0; Sat, 14 Nov 2020 02:11:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE2BuEY003992; Sat, 14 Nov 2020 02:11:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE2Bu06003991; Sat, 14 Nov 2020 02:11:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011140211.0AE2Bu06003991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 02:11:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367667 - stable/12/lib/libc/stdlib X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/lib/libc/stdlib X-SVN-Commit-Revision: 367667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 02:11:56 -0000 Author: kevans Date: Sat Nov 14 02:11:56 2020 New Revision: 367667 URL: https://svnweb.freebsd.org/changeset/base/367667 Log: MFC r366770: libc: typo fix (s/involes/involves) Modified: stable/12/lib/libc/stdlib/bsearch.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/stdlib/bsearch.c ============================================================================== --- stable/12/lib/libc/stdlib/bsearch.c Sat Nov 14 02:11:04 2020 (r367666) +++ stable/12/lib/libc/stdlib/bsearch.c Sat Nov 14 02:11:56 2020 (r367667) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); * is odd, moving left simply involves halving lim: e.g., when lim * is 5 we look at item 2, so we change lim to 2 so that we will * look at items 0 & 1. If lim is even, the same applies. If lim - * is odd, moving right again involes halving lim, this time moving + * is odd, moving right again involves halving lim, this time moving * the base up one item past p: e.g., when lim is 5 we change base * to item 3 and make lim 2 so that we will look at items 3 and 4. * If lim is even, however, we have to shrink it by one before From owner-svn-src-all@freebsd.org Sat Nov 14 02:32:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 921992D1C18; Sat, 14 Nov 2020 02:32:50 +0000 (UTC) (envelope-from rebecca@bsdio.com) Received: from out01.mta.xmission.com (out01.mta.xmission.com [166.70.13.231]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXzry32kFz3pZZ; Sat, 14 Nov 2020 02:32:50 +0000 (UTC) (envelope-from rebecca@bsdio.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=bsdio.com; s=xmission; h=Subject:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Sender:Reply-To:Cc:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=w0Chb3pSK6sndz9QSdWCtfAcwRCWpPUQ1pRiGay5lX0=; b=rfd/nw2xYTm9XY+0z6Wi9ubm0t Erp9uNR/gdswnTVKeVctii8VlOsZwYzVzWpecnaqUfsjnnuQ4wJ7yG6WW4x6iDJN1MNm1cmkgz9rl HHxyQlTXfdsGY18sAvTJ/hYPqMrKktF9FLq55KvLYWbHhThuQRrvIIgEYexkZZIeJIac=; Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kdlMs-008nQQ-SC; Fri, 13 Nov 2020 19:32:46 -0700 Received: from mta4.zcs.xmission.com ([166.70.13.68]) by in01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1kdlMs-0006Ul-B8; Fri, 13 Nov 2020 19:32:46 -0700 Received: from localhost (localhost [127.0.0.1]) by mta4.zcs.xmission.com (Postfix) with ESMTP id 29A6B500402; Fri, 13 Nov 2020 19:32:46 -0700 (MST) X-Amavis-Modified: Mail body modified (using disclaimer) - mta4.zcs.xmission.com Received: from mta4.zcs.xmission.com ([127.0.0.1]) by localhost (mta4.zcs.xmission.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id luSk1_erWOaN; Fri, 13 Nov 2020 19:32:46 -0700 (MST) Received: from [10.0.10.142] (c-174-52-16-57.hsd1.ut.comcast.net [174.52.16.57]) by mta4.zcs.xmission.com (Postfix) with ESMTPSA id C2D0450039F; Fri, 13 Nov 2020 19:32:45 -0700 (MST) To: Ravi Pokala , Rebecca Cran , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011131947.0ADJlGbr064616@repo.freebsd.org> <328D3129-4682-491B-A28F-D6739E52ABE8@panasas.com> From: Rebecca Cran Message-ID: <054dbbb6-7b7e-03d5-5599-0d62ea82b59e@bsdio.com> Date: Fri, 13 Nov 2020 19:32:45 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <328D3129-4682-491B-A28F-D6739E52ABE8@panasas.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-XM-SPF: eid=1kdlMs-0006Ul-B8; ; ; mid=<054dbbb6-7b7e-03d5-5599-0d62ea82b59e@bsdio.com>; ; ; hst=in01.mta.xmission.com; ; ; ip=166.70.13.68; ; ; frm=rebecca@bsdio.com; ; ; spf=none X-SA-Exim-Connect-IP: 166.70.13.68 X-SA-Exim-Mail-From: rebecca@bsdio.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa03.xmission.com X-Spam-Level: * X-Spam-Status: No, score=1.7 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,NICE_REPLY_A,T_TM2_M_HEADER_IN_MSG,TooManyTo_001, TooManyTo_002,TooManyTo_003,TooManyTo_004 autolearn=disabled version=3.4.2 X-Spam-Virus: No X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5006] * 0.5 TooManyTo_004 Multiple "To" Header Recipients 5x (uncommon) * 0.6 TooManyTo_003 Multiple "To" Header Recipients 4x (uncommon) * 0.3 TooManyTo_001 Multiple "To" Header Recipients 2x (uncommon) * 0.5 TooManyTo_002 Multiple "To" Header Recipients 3x (uncommon) * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; IP=ok Body=1 Fuz1=1] [Fuz2=1] * -0.0 NICE_REPLY_A Looks like a legit reply (A) X-Spam-DCC: XMission; sa03 1397; IP=ok Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Ravi Pokala , Rebecca Cran , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Spam-Relay-Country: X-Spam-Timing: total 299 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 4.4 (1.5%), b_tie_ro: 3.2 (1.1%), parse: 1.18 (0.4%), extract_message_metadata: 4.3 (1.4%), get_uri_detail_list: 0.38 (0.1%), tests_pri_-1000: 2.1 (0.7%), tests_pri_-950: 1.16 (0.4%), tests_pri_-900: 0.90 (0.3%), tests_pri_-90: 69 (23.1%), check_bayes: 68 (22.6%), b_tokenize: 3.8 (1.3%), b_tok_get_all: 4.1 (1.4%), b_comp_prob: 1.08 (0.4%), b_tok_touch_all: 56 (18.7%), b_finish: 0.84 (0.3%), tests_pri_0: 203 (67.9%), check_dkim_signature: 0.58 (0.2%), check_dkim_adsp: 105 (35.2%), poll_dns_idle: 100 (33.5%), tests_pri_10: 2.6 (0.9%), tests_pri_500: 7 (2.4%), rewrite_mail: 0.00 (0.0%) Subject: Re: svn commit: r367651 - head/usr.sbin/bhyve X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) X-Rspamd-Queue-Id: 4CXzry32kFz3pZZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 02:32:50 -0000 On 11/13/20 5:47 PM, Ravi Pokala wrote: >> +#define FIRMWARE_RELEASE_DATE "11/10/2020" > Might I suggest "2020-11-10", as sorting, logic, ${DEITY}, and ISO-8601 demand? ;-) I wish! I'll add a comment clarifying that the specification mandates mm/dd/yyyy. -- Rebecca Cran From owner-svn-src-all@freebsd.org Sat Nov 14 05:10:41 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF3BC2D6500; Sat, 14 Nov 2020 05:10:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CY3M54PyRz4T6X; Sat, 14 Nov 2020 05:10:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89F5A24AA9; Sat, 14 Nov 2020 05:10:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE5AfE2014700; Sat, 14 Nov 2020 05:10:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE5AeXT014693; Sat, 14 Nov 2020 05:10:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011140510.0AE5AeXT014693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Nov 2020 05:10:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367668 - in head/sys/ufs: ffs ufs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/ufs: ffs ufs X-SVN-Commit-Revision: 367668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 05:10:41 -0000 Author: kib Date: Sat Nov 14 05:10:39 2020 New Revision: 367668 URL: https://svnweb.freebsd.org/changeset/base/367668 Log: Add a framework that tracks exclusive vnode lock generation count for UFS. This count is memoized together with the lookup metadata in directory inode, and we assert that accesses to lookup metadata are done under the same lock generation as they were stored. Enabled under DIAGNOSTICS. UFS saves additional data for parent dirent when doing lookup (i_offset, i_count, i_endoff), and this data is used later by VOPs operating on dirents. If parent vnode exclusive lock is dropped and re-acquired between lookup and the VOP call, we corrupt directories. Framework asserts that corruption cannot occur that way, by tracking vnode lock generation counter. Updates to inode dirent members also save the counter, while users compare current and saved counters values. Also, fix a case in ufs_lookup_ino() where i_offset and i_count could be updated under shared lock. It is not a bug on its own since dvp i_offset results from such lookup cannot be used, but it causes false positive in the checker. In collaboration with: pho Reviewed by: mckusick (previous version), markj Tested by: markj (syzkaller), pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26136 Modified: head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/inode.h head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Sat Nov 14 02:11:56 2020 (r367667) +++ head/sys/ufs/ffs/ffs_alloc.c Sat Nov 14 05:10:39 2020 (r367668) @@ -3468,7 +3468,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) break; } dp = VTOI(dvp); - dp->i_offset = 12; /* XXX mastertemplate.dot_reclen */ + SET_I_OFFSET(dp, 12); /* XXX mastertemplate.dot_reclen */ error = ufs_dirrewrite(dp, VTOI(fdvp), (ino_t)cmd.size, DT_DIR, 0); cache_purge(fdvp); Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sat Nov 14 02:11:56 2020 (r367667) +++ head/sys/ufs/ffs/ffs_softdep.c Sat Nov 14 05:10:39 2020 (r367668) @@ -8764,11 +8764,11 @@ softdep_change_directoryentry_offset(bp, dp, base, old if (MOUNTEDSUJ(mp)) { flags = DEPALLOC; jmvref = newjmvref(dp, de->d_ino, - dp->i_offset + (oldloc - base), - dp->i_offset + (newloc - base)); + I_OFFSET(dp) + (oldloc - base), + I_OFFSET(dp) + (newloc - base)); } - lbn = lblkno(ump->um_fs, dp->i_offset); - offset = blkoff(ump->um_fs, dp->i_offset); + lbn = lblkno(ump->um_fs, I_OFFSET(dp)); + offset = blkoff(ump->um_fs, I_OFFSET(dp)); oldoffset = offset + (oldloc - base); newoffset = offset + (newloc - base); ACQUIRE_LOCK(ump); @@ -9280,7 +9280,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp) jremref = dotremref = dotdotremref = NULL; if (DOINGSUJ(dvp)) { if (isrmdir) { - jremref = newjremref(dirrem, dp, ip, dp->i_offset, + jremref = newjremref(dirrem, dp, ip, I_OFFSET(dp), ip->i_effnlink + 2); dotremref = newjremref(dirrem, ip, ip, DOT_OFFSET, ip->i_effnlink + 1); @@ -9288,12 +9288,12 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp) dp->i_effnlink + 1); dotdotremref->jr_state |= MKDIR_PARENT; } else - jremref = newjremref(dirrem, dp, ip, dp->i_offset, + jremref = newjremref(dirrem, dp, ip, I_OFFSET(dp), ip->i_effnlink + 1); } ACQUIRE_LOCK(ump); - lbn = lblkno(ump->um_fs, dp->i_offset); - offset = blkoff(ump->um_fs, dp->i_offset); + lbn = lblkno(ump->um_fs, I_OFFSET(dp)); + offset = blkoff(ump->um_fs, I_OFFSET(dp)); pagedep_lookup(UFSTOVFS(ump), bp, dp->i_number, lbn, DEPALLOC, &pagedep); dirrem->dm_pagedep = pagedep; @@ -9304,7 +9304,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp) * the jremref is preserved for any potential diradd in this * location. This can not coincide with a rmdir. */ - if (dp->i_offset == DOTDOT_OFFSET) { + if (I_OFFSET(dp) == DOTDOT_OFFSET) { if (isrmdir) panic("newdirrem: .. directory change during remove?"); jremref = cancel_mkdir_dotdot(dp, dirrem, jremref); @@ -9405,7 +9405,7 @@ softdep_setup_directory_change(bp, dp, ip, newinum, is mp = ITOVFS(dp); ump = VFSTOUFS(mp); - offset = blkoff(ump->um_fs, dp->i_offset); + offset = blkoff(ump->um_fs, I_OFFSET(dp)); KASSERT(MOUNTEDSOFTDEP(mp) != 0, ("softdep_setup_directory_change called on non-softdep filesystem")); @@ -9508,7 +9508,7 @@ softdep_setup_directory_change(bp, dp, ip, newinum, is KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, ("softdep_setup_directory_change: bad jaddref %p", jaddref)); - jaddref->ja_diroff = dp->i_offset; + jaddref->ja_diroff = I_OFFSET(dp); jaddref->ja_diradd = dap; LIST_INSERT_HEAD(&pagedep->pd_diraddhd[DIRADDHASH(offset)], dap, da_pdlist); @@ -9527,7 +9527,7 @@ softdep_setup_directory_change(bp, dp, ip, newinum, is * committed when need to move the dot and dotdot references to * this new name. */ - if (inodedep->id_mkdiradd && dp->i_offset != DOTDOT_OFFSET) + if (inodedep->id_mkdiradd && I_OFFSET(dp) != DOTDOT_OFFSET) merge_diradd(inodedep, dap); FREE_LOCK(ump); } Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sat Nov 14 02:11:56 2020 (r367667) +++ head/sys/ufs/ffs/ffs_vfsops.c Sat Nov 14 05:10:39 2020 (r367668) @@ -2001,6 +2001,9 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags) ip->i_nextclustercg = -1; ip->i_flag = fs->fs_magic == FS_UFS1_MAGIC ? 0 : IN_UFS2; ip->i_mode = 0; /* ensure error cases below throw away vnode */ +#ifdef DIAGNOSTIC + ufs_init_trackers(ip); +#endif #ifdef QUOTA { int i; Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Sat Nov 14 02:11:56 2020 (r367667) +++ head/sys/ufs/ffs/ffs_vnops.c Sat Nov 14 05:10:39 2020 (r367668) @@ -434,16 +434,20 @@ ffs_lock(ap) struct vop_lock1_args /* { struct vnode *a_vp; int a_flags; - struct thread *a_td; char *file; int line; } */ *ap; { +#if !defined(NO_FFS_SNAPSHOT) || defined(DIAGNOSTIC) + struct vnode *vp = ap->a_vp; +#endif /* !NO_FFS_SNAPSHOT || DIAGNOSTIC */ +#ifdef DIAGNOSTIC + struct inode *ip; +#endif /* DIAGNOSTIC */ + int result; #ifndef NO_FFS_SNAPSHOT - struct vnode *vp; int flags; struct lock *lkp; - int result; /* * Adaptive spinning mixed with SU leads to trouble. use a giant hammer @@ -456,12 +460,11 @@ ffs_lock(ap) case LK_SHARED: case LK_UPGRADE: case LK_EXCLUSIVE: - vp = ap->a_vp; flags = ap->a_flags; for (;;) { #ifdef DEBUG_VFS_LOCKS VNPASS(vp->v_holdcnt != 0, vp); -#endif +#endif /* DEBUG_VFS_LOCKS */ lkp = vp->v_vnlock; result = lockmgr_lock_flags(lkp, flags, &VI_MTX(vp)->lock_object, ap->a_file, ap->a_line); @@ -483,28 +486,67 @@ ffs_lock(ap) flags = (flags & ~LK_TYPE_MASK) | LK_EXCLUSIVE; flags &= ~LK_INTERLOCK; } +#ifdef DIAGNOSTIC + switch (ap->a_flags & LK_TYPE_MASK) { + case LK_UPGRADE: + case LK_EXCLUSIVE: + if (result == 0 && vp->v_vnlock->lk_recurse == 0) { + ip = VTOI(vp); + if (ip != NULL) + ip->i_lock_gen++; + } + } +#endif /* DIAGNOSTIC */ break; default: +#ifdef DIAGNOSTIC + if ((ap->a_flags & LK_TYPE_MASK) == LK_DOWNGRADE) { + ip = VTOI(vp); + if (ip != NULL) + ufs_unlock_tracker(ip); + } +#endif /* DIAGNOSTIC */ result = VOP_LOCK1_APV(&ufs_vnodeops, ap); + break; } - return (result); -#else +#else /* NO_FFS_SNAPSHOT */ /* * See above for an explanation. */ if ((ap->a_flags & LK_NODDLKTREAT) != 0) ap->a_flags |= LK_ADAPTIVE; - return (VOP_LOCK1_APV(&ufs_vnodeops, ap)); -#endif +#ifdef DIAGNOSTIC + if ((ap->a_flags & LK_TYPE_MASK) == LK_DOWNGRADE) { + ip = VTOI(vp); + if (ip != NULL) + ufs_unlock_tracker(ip); + } +#endif /* DIAGNOSTIC */ + result = VOP_LOCK1_APV(&ufs_vnodeops, ap); +#endif /* NO_FFS_SNAPSHOT */ +#ifdef DIAGNOSTIC + switch (ap->a_flags & LK_TYPE_MASK) { + case LK_UPGRADE: + case LK_EXCLUSIVE: + if (result == 0 && vp->v_vnlock->lk_recurse == 0) { + ip = VTOI(vp); + if (ip != NULL) + ip->i_lock_gen++; + } + } +#endif /* DIAGNOSTIC */ + return (result); } #ifdef INVARIANTS static int ffs_unlock_debug(struct vop_unlock_args *ap) { - struct vnode *vp = ap->a_vp; - struct inode *ip = VTOI(vp); + struct vnode *vp; + struct inode *ip; + vp = ap->a_vp; + ip = VTOI(vp); if (ip->i_flag & UFS_INODE_FLAG_LAZY_MASK_ASSERTABLE) { if ((vp->v_mflag & VMP_LAZYLIST) == 0) { VI_LOCK(vp); @@ -514,6 +556,11 @@ ffs_unlock_debug(struct vop_unlock_args *ap) VI_UNLOCK(vp); } } +#ifdef DIAGNOSTIC + if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE && ip != NULL && + vp->v_vnlock->lk_recurse == 0) + ufs_unlock_tracker(ip); +#endif return (VOP_UNLOCK_APV(&ufs_vnodeops, ap)); } #endif Modified: head/sys/ufs/ufs/inode.h ============================================================================== --- head/sys/ufs/ufs/inode.h Sat Nov 14 02:11:56 2020 (r367667) +++ head/sys/ufs/ufs/inode.h Sat Nov 14 05:10:39 2020 (r367668) @@ -44,12 +44,24 @@ #include #include #include +#ifdef DIAGNOSTIC +#include +#endif /* * This must agree with the definition in . */ #define doff_t int32_t +#ifdef DIAGNOSTIC +struct iown_tracker { + struct thread *tr_owner; + struct stack tr_st; + struct stack tr_unlock; + int tr_gen; +}; +#endif + /* * The inode is used to describe each active (or recently active) file in the * UFS filesystem. It is composed of two types of information. The first part @@ -94,6 +106,12 @@ struct inode { doff_t i_endoff; /* End of useful stuff in directory. */ doff_t i_diroff; /* Offset in dir, where we found last entry. */ doff_t i_offset; /* Offset of free space in directory. */ +#ifdef DIAGNOSTIC + int i_lock_gen; + struct iown_tracker i_count_tracker; + struct iown_tracker i_endoff_tracker; + struct iown_tracker i_offset_tracker; +#endif int i_nextclustercg; /* last cg searched for cluster */ @@ -254,6 +272,35 @@ struct ufid { uint32_t ufid_ino; /* File number (ino). */ uint32_t ufid_gen; /* Generation number. */ }; + +#ifdef DIAGNOSTIC +void ufs_init_trackers(struct inode *ip); +void ufs_unlock_tracker(struct inode *ip); + +doff_t ufs_get_i_offset(struct inode *ip, const char *file, int line); +void ufs_set_i_offset(struct inode *ip, doff_t off, const char *file, int line); +#define I_OFFSET(ip) ufs_get_i_offset(ip, __FILE__, __LINE__) +#define SET_I_OFFSET(ip, off) ufs_set_i_offset(ip, off, __FILE__, __LINE__) + +int32_t ufs_get_i_count(struct inode *ip, const char *file, int line); +void ufs_set_i_count(struct inode *ip, int32_t cnt, const char *file, int line); +#define I_COUNT(ip) ufs_get_i_count(ip, __FILE__, __LINE__) +#define SET_I_COUNT(ip, cnt) ufs_set_i_count(ip, cnt, __FILE__, __LINE__) + +doff_t ufs_get_i_endoff(struct inode *ip, const char *file, int line); +void ufs_set_i_endoff(struct inode *ip, doff_t off, const char *file, int line); +#define I_ENDOFF(ip) ufs_get_i_endoff(ip, __FILE__, __LINE__) +#define SET_I_ENDOFF(ip, off) ufs_set_i_endoff(ip, off, __FILE__, __LINE__) + +#else +#define I_OFFSET(ip) ((ip)->i_offset) +#define SET_I_OFFSET(ip, off) ((ip)->i_offset = (off)) +#define I_COUNT(ip) ((ip)->i_count) +#define SET_I_COUNT(ip, cnt) ((ip)->i_count = cnt) +#define I_ENDOFF(ip) ((ip)->i_endoff) +#define SET_I_ENDOFF(ip, off) ((ip)->i_endoff = off) +#endif + #endif /* _KERNEL */ #endif /* !_UFS_UFS_INODE_H_ */ Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Sat Nov 14 02:11:56 2020 (r367667) +++ head/sys/ufs/ufs/ufs_lookup.c Sat Nov 14 05:10:39 2020 (r367668) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #ifdef DIAGNOSTIC static int dirchk = 1; @@ -504,22 +505,22 @@ notfound: * dp->i_offset + dp->i_count. */ if (slotstatus == NONE) { - dp->i_offset = roundup2(dp->i_size, DIRBLKSIZ); - dp->i_count = 0; - enduseful = dp->i_offset; + SET_I_OFFSET(dp, roundup2(dp->i_size, DIRBLKSIZ)); + SET_I_COUNT(dp, 0); + enduseful = I_OFFSET(dp); } else if (nameiop == DELETE) { - dp->i_offset = slotoffset; - if ((dp->i_offset & (DIRBLKSIZ - 1)) == 0) - dp->i_count = 0; + SET_I_OFFSET(dp, slotoffset); + if ((I_OFFSET(dp) & (DIRBLKSIZ - 1)) == 0) + SET_I_COUNT(dp, 0); else - dp->i_count = dp->i_offset - prevoff; + SET_I_COUNT(dp, I_OFFSET(dp) - prevoff); } else { - dp->i_offset = slotoffset; - dp->i_count = slotsize; + SET_I_OFFSET(dp, slotoffset); + SET_I_COUNT(dp, slotsize); if (enduseful < slotoffset + slotsize) enduseful = slotoffset + slotsize; } - dp->i_endoff = roundup2(enduseful, DIRBLKSIZ); + SET_I_ENDOFF(dp, roundup2(enduseful, DIRBLKSIZ)); /* * We return with the directory locked, so that * the parameters we set up above will still be @@ -575,24 +576,32 @@ found: if (nameiop == DELETE && (flags & ISLASTCN)) { if (flags & LOCKPARENT) ASSERT_VOP_ELOCKED(vdp, __FUNCTION__); - /* - * Return pointer to current entry in dp->i_offset, - * and distance past previous entry (if there - * is a previous entry in this block) in dp->i_count. - * Save directory inode pointer in ndp->ni_dvp for dirremove(). - * - * Technically we shouldn't be setting these in the - * WANTPARENT case (first lookup in rename()), but any - * lookups that will result in directory changes will - * overwrite these. - */ - dp->i_offset = i_offset; - if ((dp->i_offset & (DIRBLKSIZ - 1)) == 0) - dp->i_count = 0; - else - dp->i_count = dp->i_offset - prevoff; + + if (VOP_ISLOCKED(vdp) == LK_EXCLUSIVE) { + /* + * Return pointer to current entry in + * dp->i_offset, and distance past previous + * entry (if there is a previous entry in this + * block) in dp->i_count. + * + * We shouldn't be setting these in the + * WANTPARENT case (first lookup in rename()), but any + * lookups that will result in directory changes will + * overwrite these. + */ + SET_I_OFFSET(dp, i_offset); + if ((I_OFFSET(dp) & (DIRBLKSIZ - 1)) == 0) + SET_I_COUNT(dp, 0); + else + SET_I_COUNT(dp, I_OFFSET(dp) - prevoff); + } if (dd_ino != NULL) return (0); + + /* + * Save directory inode pointer in ndp->ni_dvp for + * dirremove(). + */ if ((error = VFS_VGET(vdp->v_mount, ino, LK_EXCLUSIVE, &tdp)) != 0) return (error); @@ -629,7 +638,7 @@ found: * Careful about locking second inode. * This can only occur if the target is ".". */ - dp->i_offset = i_offset; + SET_I_OFFSET(dp, i_offset); if (dp->i_number == ino) return (EISDIR); if (dd_ino != NULL) @@ -887,14 +896,14 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) dp = VTOI(dvp); newentrysize = DIRSIZ(OFSFMT(dvp), dirp); - if (dp->i_count == 0) { + if (I_COUNT(dp) == 0) { /* * If dp->i_count is 0, then namei could find no * space in the directory. Here, dp->i_offset will * be on a directory block boundary and we will write the * new entry into a fresh block. */ - if (dp->i_offset & (DIRBLKSIZ - 1)) + if (I_OFFSET(dp) & (DIRBLKSIZ - 1)) panic("ufs_direnter: newblk"); flags = BA_CLRBUF; if (!DOINGSOFTDEP(dvp) && !DOINGASYNC(dvp)) @@ -907,28 +916,28 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) } #endif old_isize = dp->i_size; - vnode_pager_setsize(dvp, (u_long)dp->i_offset + DIRBLKSIZ); - if ((error = UFS_BALLOC(dvp, (off_t)dp->i_offset, DIRBLKSIZ, + vnode_pager_setsize(dvp, (u_long)I_OFFSET(dp) + DIRBLKSIZ); + if ((error = UFS_BALLOC(dvp, (off_t)I_OFFSET(dp), DIRBLKSIZ, cr, flags, &bp)) != 0) { if (DOINGSOFTDEP(dvp) && newdirbp != NULL) bdwrite(newdirbp); vnode_pager_setsize(dvp, (u_long)old_isize); return (error); } - dp->i_size = dp->i_offset + DIRBLKSIZ; + dp->i_size = I_OFFSET(dp) + DIRBLKSIZ; DIP_SET(dp, i_size, dp->i_size); - dp->i_endoff = dp->i_size; + SET_I_ENDOFF(dp, dp->i_size); UFS_INODE_SET_FLAG(dp, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); dirp->d_reclen = DIRBLKSIZ; - blkoff = dp->i_offset & + blkoff = I_OFFSET(dp) & (VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_iosize - 1); bcopy((caddr_t)dirp, (caddr_t)bp->b_data + blkoff,newentrysize); #ifdef UFS_DIRHASH if (dp->i_dirhash != NULL) { - ufsdirhash_newblk(dp, dp->i_offset); - ufsdirhash_add(dp, dirp, dp->i_offset); + ufsdirhash_newblk(dp, I_OFFSET(dp)); + ufsdirhash_add(dp, dirp, I_OFFSET(dp)); ufsdirhash_checkblock(dp, (char *)bp->b_data + blkoff, - dp->i_offset); + I_OFFSET(dp)); } #endif if (DOINGSOFTDEP(dvp)) { @@ -944,7 +953,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) (bp->b_data + blkoff))->d_reclen = DIRBLKSIZ; blkoff += DIRBLKSIZ; } - if (softdep_setup_directory_add(bp, dp, dp->i_offset, + if (softdep_setup_directory_add(bp, dp, I_OFFSET(dp), dirp->d_ino, newdirbp, 1)) UFS_INODE_SET_FLAG(dp, IN_NEEDSYNC); if (newdirbp) @@ -1001,15 +1010,15 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) * * N.B. - THIS IS AN ARTIFACT OF 4.2 AND SHOULD NEVER HAPPEN. */ - if (dp->i_offset + dp->i_count > dp->i_size) { - dp->i_size = dp->i_offset + dp->i_count; + if (I_OFFSET(dp) + I_COUNT(dp) > dp->i_size) { + dp->i_size = I_OFFSET(dp) + I_COUNT(dp); DIP_SET(dp, i_size, dp->i_size); UFS_INODE_SET_FLAG(dp, IN_SIZEMOD | IN_MODIFIED); } /* * Get the block containing the space for the new directory entry. */ - error = UFS_BLKATOFF(dvp, (off_t)dp->i_offset, &dirbuf, &bp); + error = UFS_BLKATOFF(dvp, (off_t)I_OFFSET(dp), &dirbuf, &bp); if (error) { if (DOINGSOFTDEP(dvp) && newdirbp != NULL) bdwrite(newdirbp); @@ -1024,7 +1033,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) ep = (struct direct *)dirbuf; dsize = ep->d_ino ? DIRSIZ(OFSFMT(dvp), ep) : 0; spacefree = ep->d_reclen - dsize; - for (loc = ep->d_reclen; loc < dp->i_count; ) { + for (loc = ep->d_reclen; loc < I_COUNT(dp); ) { nep = (struct direct *)(dirbuf + loc); /* Trim the existing slot (NB: dsize may be zero). */ @@ -1052,8 +1061,8 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) #ifdef UFS_DIRHASH if (dp->i_dirhash != NULL) ufsdirhash_move(dp, nep, - dp->i_offset + ((char *)nep - dirbuf), - dp->i_offset + ((char *)ep - dirbuf)); + I_OFFSET(dp) + ((char *)nep - dirbuf), + I_OFFSET(dp) + ((char *)ep - dirbuf)); #endif if (DOINGSOFTDEP(dvp)) softdep_change_directoryentry_offset(bp, dp, dirbuf, @@ -1094,19 +1103,19 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) #ifdef UFS_DIRHASH if (dp->i_dirhash != NULL && (ep->d_ino == 0 || dirp->d_reclen == spacefree)) - ufsdirhash_add(dp, dirp, dp->i_offset + ((char *)ep - dirbuf)); + ufsdirhash_add(dp, dirp, I_OFFSET(dp) + ((char *)ep - dirbuf)); #endif bcopy((caddr_t)dirp, (caddr_t)ep, (u_int)newentrysize); #ifdef UFS_DIRHASH if (dp->i_dirhash != NULL) ufsdirhash_checkblock(dp, dirbuf - - (dp->i_offset & (DIRBLKSIZ - 1)), - rounddown2(dp->i_offset, DIRBLKSIZ)); + (I_OFFSET(dp) & (DIRBLKSIZ - 1)), + rounddown2(I_OFFSET(dp), DIRBLKSIZ)); #endif if (DOINGSOFTDEP(dvp)) { (void) softdep_setup_directory_add(bp, dp, - dp->i_offset + (caddr_t)ep - dirbuf, + I_OFFSET(dp) + (caddr_t)ep - dirbuf, dirp->d_ino, newdirbp, 0); if (newdirbp != NULL) bdwrite(newdirbp); @@ -1128,10 +1137,10 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) * lock on the newly entered node. */ if (isrename == 0 && error == 0 && - dp->i_endoff && dp->i_endoff < dp->i_size) { + I_ENDOFF(dp) != 0 && I_ENDOFF(dp) < dp->i_size) { if (tvp != NULL) VOP_UNLOCK(tvp); - error = UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, + error = UFS_TRUNCATE(dvp, (off_t)I_ENDOFF(dp), IO_NORMAL | (DOINGASYNC(dvp) ? 0 : IO_SYNC), cr); if (error != 0) vn_printf(dvp, @@ -1139,7 +1148,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) error); #ifdef UFS_DIRHASH if (error == 0 && dp->i_dirhash != NULL) - ufsdirhash_dirtrunc(dp, dp->i_endoff); + ufsdirhash_dirtrunc(dp, I_ENDOFF(dp)); #endif error = 0; if (tvp != NULL) @@ -1190,9 +1199,9 @@ ufs_dirremove(dvp, ip, flags, isrmdir) } } if (flags & DOWHITEOUT) - offset = dp->i_offset; + offset = I_OFFSET(dp); else - offset = dp->i_offset - dp->i_count; + offset = I_OFFSET(dp) - I_COUNT(dp); if ((error = UFS_BLKATOFF(dvp, offset, (char **)&ep, &bp)) != 0) { if (ip) { ip->i_effnlink++; @@ -1216,7 +1225,7 @@ ufs_dirremove(dvp, ip, flags, isrmdir) goto out; } /* Set 'rep' to the entry being removed. */ - if (dp->i_count == 0) + if (I_COUNT(dp) == 0) rep = ep; else rep = (struct direct *)((char *)ep + ep->d_reclen); @@ -1226,7 +1235,7 @@ ufs_dirremove(dvp, ip, flags, isrmdir) * that `ep' is the previous entry when dp->i_count != 0. */ if (dp->i_dirhash != NULL) - ufsdirhash_remove(dp, rep, dp->i_offset); + ufsdirhash_remove(dp, rep, I_OFFSET(dp)); #endif if (ip && rep->d_ino != ip->i_number) panic("ufs_dirremove: ip %ju does not match dirent ino %ju\n", @@ -1240,7 +1249,7 @@ ufs_dirremove(dvp, ip, flags, isrmdir) rep->d_type = 0; rep->d_ino = 0; - if (dp->i_count != 0) { + if (I_COUNT(dp) != 0) { /* * Collapse new free space into previous entry. */ @@ -1250,8 +1259,8 @@ ufs_dirremove(dvp, ip, flags, isrmdir) #ifdef UFS_DIRHASH if (dp->i_dirhash != NULL) ufsdirhash_checkblock(dp, (char *)ep - - ((dp->i_offset - dp->i_count) & (DIRBLKSIZ - 1)), - rounddown2(dp->i_offset, DIRBLKSIZ)); + ((I_OFFSET(dp) - I_COUNT(dp)) & (DIRBLKSIZ - 1)), + rounddown2(I_OFFSET(dp), DIRBLKSIZ)); #endif out: error = 0; @@ -1313,7 +1322,7 @@ ufs_dirrewrite(dp, oip, newinum, newtype, isrmdir) UFS_INODE_SET_FLAG(oip, IN_CHANGE); } - error = UFS_BLKATOFF(vdp, (off_t)dp->i_offset, (char **)&ep, &bp); + error = UFS_BLKATOFF(vdp, (off_t)I_OFFSET(dp), (char **)&ep, &bp); if (error == 0 && ep->d_namlen == 2 && ep->d_name[1] == '.' && ep->d_name[0] == '.' && ep->d_ino != oip->i_number) { brelse(bp); @@ -1522,3 +1531,115 @@ ufs_checkpath(ino_t source_ino, ino_t parent_ino, stru vput(vp); return (error); } + +#ifdef DIAGNOSTIC +static void +ufs_assert_inode_offset_owner(struct inode *ip, struct iown_tracker *tr, + const char *name, const char *file, int line) +{ + char msg[128]; + + snprintf(msg, sizeof(msg), "at %s@%d", file, line); + ASSERT_VOP_ELOCKED(ITOV(ip), msg); + MPASS((ip->i_mode & IFMT) == IFDIR); + if (curthread == tr->tr_owner && ip->i_lock_gen == tr->tr_gen) + return; + printf("locked at\n"); + stack_print(&tr->tr_st); + printf("unlocked at\n"); + stack_print(&tr->tr_unlock); + panic("%s ip %p %jd offset owner %p %d gen %d " + "curthread %p %d gen %d at %s@%d\n", + name, ip, (uintmax_t)ip->i_number, tr->tr_owner, + tr->tr_owner->td_tid, tr->tr_gen, + curthread, curthread->td_tid, ip->i_lock_gen, + file, line); +} + +static void +ufs_set_inode_offset_owner(struct inode *ip, struct iown_tracker *tr, + const char *file, int line) +{ + char msg[128]; + + snprintf(msg, sizeof(msg), "at %s@%d", file, line); + ASSERT_VOP_ELOCKED(ITOV(ip), msg); + MPASS((ip->i_mode & IFMT) == IFDIR); + tr->tr_owner = curthread; + tr->tr_gen = ip->i_lock_gen; + stack_save(&tr->tr_st); +} + +static void +ufs_init_one_tracker(struct iown_tracker *tr) +{ + tr->tr_owner = NULL; + stack_zero(&tr->tr_st); +} + +void +ufs_init_trackers(struct inode *ip) +{ + ufs_init_one_tracker(&ip->i_offset_tracker); + ufs_init_one_tracker(&ip->i_count_tracker); + ufs_init_one_tracker(&ip->i_endoff_tracker); +} + +void +ufs_unlock_tracker(struct inode *ip) +{ + if (ip->i_count_tracker.tr_gen == ip->i_lock_gen) + stack_save(&ip->i_count_tracker.tr_unlock); + if (ip->i_offset_tracker.tr_gen == ip->i_lock_gen) + stack_save(&ip->i_offset_tracker.tr_unlock); + if (ip->i_endoff_tracker.tr_gen == ip->i_lock_gen) + stack_save(&ip->i_endoff_tracker.tr_unlock); + ip->i_lock_gen++; +} + +doff_t +ufs_get_i_offset(struct inode *ip, const char *file, int line) +{ + ufs_assert_inode_offset_owner(ip, &ip->i_offset_tracker, "i_offset", + file, line); + return (ip->i_offset); +} + +void +ufs_set_i_offset(struct inode *ip, doff_t off, const char *file, int line) +{ + ufs_set_inode_offset_owner(ip, &ip->i_offset_tracker, file, line); + ip->i_offset = off; +} + +int32_t +ufs_get_i_count(struct inode *ip, const char *file, int line) +{ + ufs_assert_inode_offset_owner(ip, &ip->i_count_tracker, "i_count", + file, line); + return (ip->i_count); +} + +void +ufs_set_i_count(struct inode *ip, int32_t cnt, const char *file, int line) +{ + ufs_set_inode_offset_owner(ip, &ip->i_count_tracker, file, line); + ip->i_count = cnt; +} + +doff_t +ufs_get_i_endoff(struct inode *ip, const char *file, int line) +{ + ufs_assert_inode_offset_owner(ip, &ip->i_endoff_tracker, "i_endoff", + file, line); + return (ip->i_endoff); +} + +void +ufs_set_i_endoff(struct inode *ip, doff_t off, const char *file, int line) +{ + ufs_set_inode_offset_owner(ip, &ip->i_endoff_tracker, file, line); + ip->i_endoff = off; +} + +#endif Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Sat Nov 14 02:11:56 2020 (r367667) +++ head/sys/ufs/ufs/ufs_vnops.c Sat Nov 14 05:10:39 2020 (r367668) @@ -1481,9 +1481,9 @@ relock: if (error) goto bad; /* Setup tdvp for directory compaction if needed. */ - if (tdp->i_count && tdp->i_endoff && - tdp->i_endoff < tdp->i_size) - endoff = tdp->i_endoff; + if (I_COUNT(tdp) != 0 && I_ENDOFF(tdp) != 0 && + I_ENDOFF(tdp) < tdp->i_size) + endoff = I_ENDOFF(tdp); } else { if (ITODEV(tip) != ITODEV(tdp) || ITODEV(tip) != ITODEV(fip)) panic("ufs_rename: EXDEV"); @@ -1611,7 +1611,7 @@ relock: } else if (DOINGSUJ(tdvp)) /* Journal must account for each new link. */ softdep_setup_dotdot_link(tdp, fip); - fip->i_offset = mastertemplate.dot_reclen; + SET_I_OFFSET(fip, mastertemplate.dot_reclen); ufs_dirrewrite(fip, fdp, newparent, DT_DIR, 0); cache_purge(fdvp); } From owner-svn-src-all@freebsd.org Sat Nov 14 05:17:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05EC42D66F0; Sat, 14 Nov 2020 05:17:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CY3VS6bLxz4Tlp; Sat, 14 Nov 2020 05:17:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0F1B24A49; Sat, 14 Nov 2020 05:17:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE5H4gx020954; Sat, 14 Nov 2020 05:17:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE5H4iW020953; Sat, 14 Nov 2020 05:17:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011140517.0AE5H4iW020953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Nov 2020 05:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367669 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 367669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 05:17:05 -0000 Author: kib Date: Sat Nov 14 05:17:04 2020 New Revision: 367669 URL: https://svnweb.freebsd.org/changeset/base/367669 Log: Add a framework that tracks exclusive vnode lock generation count for UFS. This count is memoized together with the lookup metadata in directory inode, and we assert that accesses to lookup metadata are done under the same lock generation as they were stored. Enabled under DIAGNOSTICS. UFS saves additional data for parent dirent when doing lookup (i_offset, i_count, i_endoff), and this data is used later by VOPs operating on dirents. If parent vnode exclusive lock is dropped and re-acquired between lookup and the VOP call, we corrupt directories. Framework asserts that corruption cannot occur that way, by tracking vnode lock generation counter. Updates to inode dirent members also save the counter, while users compare current and saved counters values. Also, fix a case in ufs_lookup_ino() where i_offset and i_count could be updated under shared lock. It is not a bug on its own since dvp i_offset results from such lookup cannot be used, but it causes false positive in the checker. In collaboration with: pho Reviewed by: mckusick (previous version), markj Tested by: markj (syzkaller), pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26136 Modified: head/sys/ufs/ffs/ffs_inode.c Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Sat Nov 14 05:10:39 2020 (r367668) +++ head/sys/ufs/ffs/ffs_inode.c Sat Nov 14 05:17:04 2020 (r367669) @@ -67,6 +67,17 @@ __FBSDID("$FreeBSD$"); static int ffs_indirtrunc(struct inode *, ufs2_daddr_t, ufs2_daddr_t, ufs2_daddr_t, int, ufs2_daddr_t *); +static void +ffs_inode_bwrite(struct vnode *vp, struct buf *bp, int flags) +{ + if ((flags & IO_SYNC) != 0) + bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); + else + bawrite(bp); +} + /* * Update the access, modified, and inode change times as specified by the * IN_ACCESS, IN_UPDATE, and IN_CHANGE flags respectively. Write the inode @@ -357,12 +368,7 @@ ffs_truncate(vp, length, flags, cred) DIP_SET(ip, i_size, length); if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; - if (flags & IO_SYNC) - bwrite(bp); - else if (DOINGASYNC(vp)) - bdwrite(bp); - else - bawrite(bp); + ffs_inode_bwrite(vp, bp, flags); UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); return (ffs_update(vp, waitforupdate)); } @@ -478,12 +484,7 @@ ffs_truncate(vp, length, flags, cred) allocbuf(bp, size); if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; - if (flags & IO_SYNC) - bwrite(bp); - else if (DOINGASYNC(vp)) - bdwrite(bp); - else - bawrite(bp); + ffs_inode_bwrite(vp, bp, flags); UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); } /* From owner-svn-src-all@freebsd.org Sat Nov 14 05:19:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F01032D654D; Sat, 14 Nov 2020 05:19:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CY3YX6Pw8z4V3N; Sat, 14 Nov 2020 05:19:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEBDE24A4A; Sat, 14 Nov 2020 05:19:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE5JiJw021148; Sat, 14 Nov 2020 05:19:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE5Jikq021147; Sat, 14 Nov 2020 05:19:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011140519.0AE5Jikq021147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Nov 2020 05:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367670 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 367670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 05:19:45 -0000 Author: kib Date: Sat Nov 14 05:19:44 2020 New Revision: 367670 URL: https://svnweb.freebsd.org/changeset/base/367670 Log: Revert r367669 to re-commit with proper message Modified: head/sys/ufs/ffs/ffs_inode.c Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Sat Nov 14 05:17:04 2020 (r367669) +++ head/sys/ufs/ffs/ffs_inode.c Sat Nov 14 05:19:44 2020 (r367670) @@ -67,17 +67,6 @@ __FBSDID("$FreeBSD$"); static int ffs_indirtrunc(struct inode *, ufs2_daddr_t, ufs2_daddr_t, ufs2_daddr_t, int, ufs2_daddr_t *); -static void -ffs_inode_bwrite(struct vnode *vp, struct buf *bp, int flags) -{ - if ((flags & IO_SYNC) != 0) - bwrite(bp); - else if (DOINGASYNC(vp)) - bdwrite(bp); - else - bawrite(bp); -} - /* * Update the access, modified, and inode change times as specified by the * IN_ACCESS, IN_UPDATE, and IN_CHANGE flags respectively. Write the inode @@ -368,7 +357,12 @@ ffs_truncate(vp, length, flags, cred) DIP_SET(ip, i_size, length); if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; - ffs_inode_bwrite(vp, bp, flags); + if (flags & IO_SYNC) + bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); + else + bawrite(bp); UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); return (ffs_update(vp, waitforupdate)); } @@ -484,7 +478,12 @@ ffs_truncate(vp, length, flags, cred) allocbuf(bp, size); if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; - ffs_inode_bwrite(vp, bp, flags); + if (flags & IO_SYNC) + bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); + else + bawrite(bp); UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); } /* From owner-svn-src-all@freebsd.org Sat Nov 14 05:20:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AAB22D6556; Sat, 14 Nov 2020 05:20:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CY3Yr3Rjkz4TyJ; Sat, 14 Nov 2020 05:20:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 694032477E; Sat, 14 Nov 2020 05:20:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE5K0Zl021249; Sat, 14 Nov 2020 05:20:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE5K0JG021248; Sat, 14 Nov 2020 05:20:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011140520.0AE5K0JG021248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Nov 2020 05:20:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367671 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 367671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 05:20:00 -0000 Author: kib Date: Sat Nov 14 05:19:59 2020 New Revision: 367671 URL: https://svnweb.freebsd.org/changeset/base/367671 Log: Add ffs_inode_bwrite() helper. In collaboration with: pho Reviewed by: mckusick (previous version), markj Tested by: markj (syzkaller), pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26136 Modified: head/sys/ufs/ffs/ffs_inode.c Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Sat Nov 14 05:19:44 2020 (r367670) +++ head/sys/ufs/ffs/ffs_inode.c Sat Nov 14 05:19:59 2020 (r367671) @@ -67,6 +67,17 @@ __FBSDID("$FreeBSD$"); static int ffs_indirtrunc(struct inode *, ufs2_daddr_t, ufs2_daddr_t, ufs2_daddr_t, int, ufs2_daddr_t *); +static void +ffs_inode_bwrite(struct vnode *vp, struct buf *bp, int flags) +{ + if ((flags & IO_SYNC) != 0) + bwrite(bp); + else if (DOINGASYNC(vp)) + bdwrite(bp); + else + bawrite(bp); +} + /* * Update the access, modified, and inode change times as specified by the * IN_ACCESS, IN_UPDATE, and IN_CHANGE flags respectively. Write the inode @@ -357,12 +368,7 @@ ffs_truncate(vp, length, flags, cred) DIP_SET(ip, i_size, length); if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; - if (flags & IO_SYNC) - bwrite(bp); - else if (DOINGASYNC(vp)) - bdwrite(bp); - else - bawrite(bp); + ffs_inode_bwrite(vp, bp, flags); UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); return (ffs_update(vp, waitforupdate)); } @@ -478,12 +484,7 @@ ffs_truncate(vp, length, flags, cred) allocbuf(bp, size); if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; - if (flags & IO_SYNC) - bwrite(bp); - else if (DOINGASYNC(vp)) - bdwrite(bp); - else - bawrite(bp); + ffs_inode_bwrite(vp, bp, flags); UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); } /* From owner-svn-src-all@freebsd.org Sat Nov 14 05:30:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 192282D6C58; Sat, 14 Nov 2020 05:30:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CY3nd02jQz4VTd; Sat, 14 Nov 2020 05:30:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE70A24F4B; Sat, 14 Nov 2020 05:30:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AE5UCkQ027852; Sat, 14 Nov 2020 05:30:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AE5UBC4027844; Sat, 14 Nov 2020 05:30:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011140530.0AE5UBC4027844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Nov 2020 05:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367672 - in head/sys/ufs: ffs ufs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/ufs: ffs ufs X-SVN-Commit-Revision: 367672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 05:30:13 -0000 Author: kib Date: Sat Nov 14 05:30:10 2020 New Revision: 367672 URL: https://svnweb.freebsd.org/changeset/base/367672 Log: Handle LoR in flush_pagedep_deps(). When operating in SU or SU+J mode, ffs_syncvnode() might need to instantiate other vnode by inode number while owning syncing vnode lock. Typically this other vnode is the parent of our vnode, but due to renames occuring right before fsync (or during fsync when we drop the syncing vnode lock, see below) it might be no longer parent. More, the called function flush_pagedep_deps() needs to lock other vnode while owning the lock for vnode which owns the buffer, for which the dependencies are flushed. This creates another instance of the same LoR as was fixed in softdep_sync(). Put the generic code for safe relocking into new SU helper get_parent_vp() and use it in flush_pagedep_deps(). The case for safe relocking of two vnodes with undefined lock order was extracted into vn helper vn_lock_pair(). Due to call sequence ffs_syncvnode()->softdep_sync_buf()->flush_pagedep_deps(), ffs_syncvnode() indicates with ERELOOKUP that passed vnode was unlocked in process, and can return ENOENT if the passed vnode reclaimed. All callers of the function were inspected. Because UFS namei lookups store auxiliary information about directory entry in in-memory directory inode, and this information is then used by UFS code that creates/removed directory entry in the actual mutating VOPs, it is critical that directory vnode lock is not dropped between lookup and VOP. For softdep_prelink(), which ensures that later link/unlink operation can proceed without overflowing the journal, calls were moved to the place where it is safe to drop processing VOP because mutations are not yet applied. Then, ERELOOKUP causes restart of the whole VFS operation (typically VFS syscall) at top level, including the re-lookup of the involved pathes. [Note that we already do the same restart for failing calls to vn_start_write(), so formally this patch does not introduce new behavior.] Similarly, unsafe calls to fsync in snapshot creation code were plugged. A possible view on these failures is that it does not make sense to continue creating snapshot if the snapshot vnode was reclaimed due to forced unmount. It is possible that relock/ERELOOKUP situation occurs in ffs_truncate() called from ufs_inactive(). In this case, dropping the vnode lock is not safe. Detect the situation with VI_DOINGINACT and reschedule inactivation by setting VI_OWEINACT. ufs_inactive() rechecks VI_OWEINACT and avoids reclaiming vnode is truncation failed this way. In ffs_truncate(), allocation of the EOF block for partial truncation is re-done after vnode is synced, since we cannot leave the buffer locked through ffs_syncvnode(). In collaboration with: pho Reviewed by: mckusick (previous version), markj Tested by: markj (syzkaller), pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26136 Modified: head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/ufs_inode.c head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ffs/ffs_extern.h Sat Nov 14 05:30:10 2020 (r367672) @@ -173,6 +173,9 @@ void softdep_load_inodeblock(struct inode *); void softdep_freefile(struct vnode *, ino_t, int); int softdep_request_cleanup(struct fs *, struct vnode *, struct ucred *, int); +int softdep_prerename(struct vnode *, struct vnode *, struct vnode *, + struct vnode *); +int softdep_prelink(struct vnode *, struct vnode *, int); void softdep_setup_freeblocks(struct inode *, off_t, int); void softdep_setup_inomapdep(struct buf *, struct inode *, ino_t, int); void softdep_setup_blkmapdep(struct buf *, struct mount *, ufs2_daddr_t, Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ffs/ffs_inode.c Sat Nov 14 05:30:10 2020 (r367672) @@ -462,6 +462,8 @@ ffs_truncate(vp, length, flags, cred) error = UFS_BALLOC(vp, length - 1, 1, cred, flags, &bp); if (error) return (error); + ffs_inode_bwrite(vp, bp, flags); + /* * When we are doing soft updates and the UFS_BALLOC * above fills in a direct block hole with a full sized @@ -473,6 +475,10 @@ ffs_truncate(vp, length, flags, cred) if (DOINGSOFTDEP(vp) && lbn < UFS_NDADDR && fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize && (error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0) + return (error); + + error = UFS_BALLOC(vp, length - 1, 1, cred, flags, &bp); + if (error) return (error); ip->i_size = length; DIP_SET(ip, i_size, length); Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ffs/ffs_snapshot.c Sat Nov 14 05:30:10 2020 (r367672) @@ -301,6 +301,8 @@ restart: NDFREE(&nd, NDF_ONLY_PNBUF); vn_finished_write(wrtmp); vrele(nd.ni_dvp); + if (error == ERELOOKUP) + goto restart; return (error); } vp = nd.ni_vp; @@ -368,8 +370,12 @@ restart: if (error) goto out; bawrite(nbp); - if (cg % 10 == 0) - ffs_syncvnode(vp, MNT_WAIT, 0); + if (cg % 10 == 0) { + error = ffs_syncvnode(vp, MNT_WAIT, 0); + /* vp possibly reclaimed if unlocked */ + if (error != 0) + goto out; + } } /* * Copy all the cylinder group maps. Although the @@ -391,8 +397,8 @@ restart: goto out; error = cgaccount(cg, vp, nbp, 1); bawrite(nbp); - if (cg % 10 == 0) - ffs_syncvnode(vp, MNT_WAIT, 0); + if (cg % 10 == 0 && error == 0) + error = ffs_syncvnode(vp, MNT_WAIT, 0); if (error) goto out; } Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ffs/ffs_softdep.c Sat Nov 14 05:30:10 2020 (r367672) @@ -609,6 +609,27 @@ softdep_freework(wkhd) panic("softdep_freework called"); } +int +softdep_prerename(fdvp, fvp, tdvp, tvp) + struct vnode *fdvp; + struct vnode *fvp; + struct vnode *tdvp; + struct vnode *tvp; +{ + + panic("softdep_prerename called"); +} + +int +softdep_prelink(dvp, vp, will_direnter) + struct vnode *dvp; + struct vnode *vp; + int will_direnter; +{ + + panic("softdep_prelink called"); +} + #else FEATURE(softupdates, "FFS soft-updates support"); @@ -748,7 +769,7 @@ static void unlinked_inodedep(struct mount *, struct i static void clear_unlinked_inodedep(struct inodedep *); static struct inodedep *first_unlinked_inodedep(struct ufsmount *); static int flush_pagedep_deps(struct vnode *, struct mount *, - struct diraddhd *); + struct diraddhd *, struct buf *); static int free_pagedep(struct pagedep *); static int flush_newblk_dep(struct vnode *, struct mount *, ufs_lbn_t); static int flush_inodedep_deps(struct vnode *, struct mount *, ino_t); @@ -925,7 +946,6 @@ static void journal_unmount(struct ufsmount *); static int journal_space(struct ufsmount *, int); static void journal_suspend(struct ufsmount *); static int journal_unsuspend(struct ufsmount *ump); -static void softdep_prelink(struct vnode *, struct vnode *); static void add_to_journal(struct worklist *); static void remove_from_journal(struct worklist *); static bool softdep_excess_items(struct ufsmount *, int); @@ -1390,6 +1410,136 @@ SYSCTL_INT(_debug_softdep, OID_AUTO, print_threads, CT static TAILQ_HEAD(, mount_softdeps) softdepmounts; /* + * This function fetches inode inum on mount point mp. We already + * hold a locked vnode vp, and might have a locked buffer bp belonging + * to vp. + + * We must not block on acquiring the new inode lock as we will get + * into a lock-order reversal with the buffer lock and possibly get a + * deadlock. Thus if we cannot instantiate the requested vnode + * without sleeping on its lock, we must unlock the vnode and the + * buffer before doing a blocking on the vnode lock. We return + * ERELOOKUP if we have had to unlock either the vnode or the buffer so + * that the caller can reassess its state. + * + * Top-level VFS code (for syscalls and other consumers, e.g. callers + * of VOP_FSYNC() in syncer) check for ERELOOKUP and restart at safe + * point. + * + * Since callers expect to operate on fully constructed vnode, we also + * recheck v_data after relock, and return ENOENT if NULL. + * + * If unlocking bp, we must unroll dequeueing its unfinished + * dependencies, and clear scan flag, before unlocking. If unlocking + * vp while it is under deactivation, we re-queue deactivation. + */ +static int +get_parent_vp(struct vnode *vp, struct mount *mp, ino_t inum, struct buf *bp, + struct diraddhd *diraddhdp, struct diraddhd *unfinishedp, + struct vnode **rvp) +{ + struct vnode *pvp; + struct diradd *dap; + int error; + bool bplocked; + + ASSERT_VOP_ELOCKED(vp, "child vnode must be locked"); + for (bplocked = true, pvp = NULL;;) { + error = ffs_vgetf(mp, inum, LK_EXCLUSIVE | LK_NOWAIT, &pvp, + FFSV_FORCEINSMQ); + if (error == 0) { + /* + * Since we could have unlocked vp, the inode + * number could no longer indicate a + * constructed node. In this case, we must + * restart the syscall. + */ + if (VTOI(pvp)->i_mode == 0 || !bplocked) { + if (VTOI(pvp)->i_mode == 0) + vgone(pvp); + vput(pvp); + error = ERELOOKUP; + goto out; + } + + error = 0; + goto out1; + } + if (bp != NULL && bplocked) { + /* + * Requeue unfinished dependencies before + * unlocking buffer, which could make + * diraddhdp invalid. + */ + ACQUIRE_LOCK(VFSTOUFS(mp)); + while ((dap = LIST_FIRST(unfinishedp)) != NULL) { + LIST_REMOVE(dap, da_pdlist); + LIST_INSERT_HEAD(diraddhdp, dap, da_pdlist); + } + FREE_LOCK(VFSTOUFS(mp)); + bp->b_vflags &= ~BV_SCANNED; + BUF_NOREC(bp); + BUF_UNLOCK(bp); + bplocked = false; + } + + /* + * Do not drop vnode lock while inactivating. This + * would result in leaks of the VI flags and + * reclaiming of non-truncated vnode. Instead, + * re-schedule inactivation hoping that we would be + * able to sync inode later. + */ + if ((vp->v_iflag & VI_DOINGINACT) != 0) { + VI_LOCK(vp); + vp->v_iflag |= VI_OWEINACT; + VI_UNLOCK(vp); + return (ERELOOKUP); + } + + VOP_UNLOCK(vp); + error = ffs_vgetf(mp, inum, LK_EXCLUSIVE, &pvp, + FFSV_FORCEINSMQ); + if (error != 0) { + MPASS(error != ERELOOKUP); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + break; + } + if (VTOI(pvp)->i_mode == 0) { + vgone(pvp); + vput(pvp); + pvp = NULL; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + error = ERELOOKUP; + break; + } + error = vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT); + if (error == 0) + break; + vput(pvp); + pvp = NULL; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + if (vp->v_data == NULL) { + error = ENOENT; + break; + } + } + if (bp != NULL) { + MPASS(!bplocked); + error = ERELOOKUP; + } + if (error != 0 && pvp != NULL) { + vput(pvp); + pvp = NULL; + } +out1: + *rvp = pvp; +out: + ASSERT_VOP_ELOCKED(vp, "child vnode must be locked on return"); + return (error); +} + +/* * This function cleans the worklist for a filesystem. * Each filesystem running with soft dependencies gets its own * thread to run in this function. The thread is started up in @@ -3096,47 +3246,206 @@ softdep_prealloc(vp, waitok) } /* + * Try hard to sync all data and metadata for the vnode, and workitems + * flushing which might conflict with the vnode lock. This is a + * helper for softdep_prerename(). + */ +static int +softdep_prerename_vnode(ump, vp) + struct ufsmount *ump; + struct vnode *vp; +{ + int error; + + ASSERT_VOP_ELOCKED(vp, "prehandle"); + if (vp->v_data == NULL) + return (0); + error = VOP_FSYNC(vp, MNT_WAIT, curthread); + if (error != 0) + return (error); + ACQUIRE_LOCK(ump); + process_removes(vp); + process_truncates(vp); + FREE_LOCK(ump); + return (0); +} + +/* + * Must be called from VOP_RENAME() after all vnodes are locked. + * Ensures that there is enough journal space for rename. It is + * sufficiently different from softdep_prelink() by having to handle + * four vnodes. + */ +int +softdep_prerename(fdvp, fvp, tdvp, tvp) + struct vnode *fdvp; + struct vnode *fvp; + struct vnode *tdvp; + struct vnode *tvp; +{ + struct ufsmount *ump; + int error; + + ump = VFSTOUFS(fdvp->v_mount); + + if (journal_space(ump, 0)) + return (0); + + VOP_UNLOCK(tdvp); + VOP_UNLOCK(fvp); + if (tvp != NULL && tvp != tdvp) + VOP_UNLOCK(tvp); + + error = softdep_prerename_vnode(ump, fdvp); + VOP_UNLOCK(fdvp); + if (error != 0) + return (error); + + VOP_LOCK(fvp, LK_EXCLUSIVE | LK_RETRY); + error = softdep_prerename_vnode(ump, fvp); + VOP_UNLOCK(fvp); + if (error != 0) + return (error); + + if (tdvp != fdvp) { + VOP_LOCK(tdvp, LK_EXCLUSIVE | LK_RETRY); + error = softdep_prerename_vnode(ump, tdvp); + VOP_UNLOCK(tdvp); + if (error != 0) + return (error); + } + + if (tvp != fvp && tvp != NULL) { + VOP_LOCK(tvp, LK_EXCLUSIVE | LK_RETRY); + error = softdep_prerename_vnode(ump, tvp); + VOP_UNLOCK(tvp); + if (error != 0) + return (error); + } + + ACQUIRE_LOCK(ump); + softdep_speedup(ump); + process_worklist_item(UFSTOVFS(ump), 2, LK_NOWAIT); + if (journal_space(ump, 0) == 0) { + softdep_speedup(ump); + if (journal_space(ump, 1) == 0) + journal_suspend(ump); + } + FREE_LOCK(ump); + return (ERELOOKUP); +} + +/* * Before adjusting a link count on a vnode verify that we have sufficient * journal space. If not, process operations that depend on the currently * locked pair of vnodes to try to flush space as the syncer, buf daemon, * and softdep flush threads can not acquire these locks to reclaim space. + * + * Returns 0 if all owned locks are still valid and were not dropped + * in the process, in other case it returns either an error from sync, + * or ERELOOKUP if any of the locks were re-acquired. In the later + * case, the state of the vnodes cannot be relied upon and our VFS + * syscall must be restarted at top level from the lookup. */ -static void -softdep_prelink(dvp, vp) +int +softdep_prelink(dvp, vp, will_direnter) struct vnode *dvp; struct vnode *vp; + int will_direnter; { struct ufsmount *ump; + int error, error1; + ASSERT_VOP_ELOCKED(dvp, "prelink dvp"); + if (vp != NULL) + ASSERT_VOP_ELOCKED(vp, "prelink vp"); ump = VFSTOUFS(dvp->v_mount); - LOCK_OWNED(ump); + /* * Nothing to do if we have sufficient journal space. * If we currently hold the snapshot lock, we must avoid * handling other resources that could cause deadlock. + * + * will_direnter == 1: In case allocated a directory block in + * an indirect block, we must prevent holes in the directory + * created if directory entries are written out of order. To + * accomplish this we fsync when we extend a directory into + * indirects. During rename it's not safe to drop the tvp + * lock so sync must be delayed until it is. + * + * This synchronous step could be removed if fsck and the + * kernel were taught to fill in sparse directories rather + * than panic. */ - if (journal_space(ump, 0) || (vp && IS_SNAPSHOT(VTOI(vp)))) - return; + if (journal_space(ump, 0) || (vp != NULL && IS_SNAPSHOT(VTOI(vp)))) { + error = 0; + if (will_direnter && (vp == NULL || !IS_SNAPSHOT(VTOI(vp)))) { + if (vp != NULL) + VOP_UNLOCK(vp); + error = ffs_syncvnode(dvp, MNT_WAIT, 0); + if (vp != NULL) { + error1 = vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT); + if (error1 != 0) { + vn_lock_pair(dvp, true, vp, false); + if (error == 0) + error = ERELOOKUP; + } else if (vp->v_data == NULL) { + error = ERELOOKUP; + } + } + } + return (error); + } + stat_journal_low++; - FREE_LOCK(ump); - if (vp) + if (vp != NULL) { + VOP_UNLOCK(dvp); ffs_syncvnode(vp, MNT_NOWAIT, 0); + vn_lock_pair(dvp, false, vp, true); + if (dvp->v_data == NULL) + return (ERELOOKUP); + } + if (vp != NULL) + VOP_UNLOCK(vp); ffs_syncvnode(dvp, MNT_WAIT, 0); - ACQUIRE_LOCK(ump); + VOP_UNLOCK(dvp); + /* Process vp before dvp as it may create .. removes. */ - if (vp) { + if (vp != NULL) { + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + if (vp->v_data == NULL) { + vn_lock_pair(dvp, false, vp, true); + return (ERELOOKUP); + } + ACQUIRE_LOCK(ump); process_removes(vp); process_truncates(vp); + FREE_LOCK(ump); + VOP_UNLOCK(vp); } + + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); + if (dvp->v_data == NULL) { + vn_lock_pair(dvp, true, vp, false); + return (ERELOOKUP); + } + + ACQUIRE_LOCK(ump); process_removes(dvp); process_truncates(dvp); + VOP_UNLOCK(dvp); softdep_speedup(ump); + process_worklist_item(UFSTOVFS(ump), 2, LK_NOWAIT); if (journal_space(ump, 0) == 0) { softdep_speedup(ump); if (journal_space(ump, 1) == 0) journal_suspend(ump); } + FREE_LOCK(ump); + + vn_lock_pair(dvp, false, vp, false); + return (ERELOOKUP); } static void @@ -4742,7 +5051,6 @@ softdep_setup_create(dp, ip) KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, ("softdep_setup_create: No addref structure present.")); } - softdep_prelink(dvp, NULL); FREE_LOCK(ITOUMP(dp)); } @@ -4777,7 +5085,6 @@ softdep_setup_dotdot_link(dp, ip) if (jaddref) TAILQ_INSERT_TAIL(&inodedep->id_inoreflst, &jaddref->ja_ref, if_deps); - softdep_prelink(dvp, ITOV(ip)); FREE_LOCK(ITOUMP(dp)); } @@ -4808,7 +5115,6 @@ softdep_setup_link(dp, ip) if (jaddref) TAILQ_INSERT_TAIL(&inodedep->id_inoreflst, &jaddref->ja_ref, if_deps); - softdep_prelink(dvp, ITOV(ip)); FREE_LOCK(ITOUMP(dp)); } @@ -4858,7 +5164,6 @@ softdep_setup_mkdir(dp, ip) if (DOINGSUJ(dvp)) TAILQ_INSERT_TAIL(&inodedep->id_inoreflst, &dotdotaddref->ja_ref, if_deps); - softdep_prelink(ITOV(dp), NULL); FREE_LOCK(ITOUMP(dp)); } @@ -4879,7 +5184,6 @@ softdep_setup_rmdir(dp, ip) ACQUIRE_LOCK(ITOUMP(dp)); (void) inodedep_lookup_ip(ip); (void) inodedep_lookup_ip(dp); - softdep_prelink(dvp, ITOV(ip)); FREE_LOCK(ITOUMP(dp)); } @@ -4900,7 +5204,6 @@ softdep_setup_unlink(dp, ip) ACQUIRE_LOCK(ITOUMP(dp)); (void) inodedep_lookup_ip(ip); (void) inodedep_lookup_ip(dp); - softdep_prelink(dvp, ITOV(ip)); FREE_LOCK(ITOUMP(dp)); } @@ -12622,25 +12925,12 @@ restart: * for details on possible races. */ FREE_LOCK(ump); - if (ffs_vgetf(mp, parentino, LK_NOWAIT | LK_EXCLUSIVE, &pvp, - FFSV_FORCEINSMQ)) { - /* - * Unmount cannot proceed after unlock because - * caller must have called vn_start_write(). - */ - VOP_UNLOCK(vp); - error = ffs_vgetf(mp, parentino, LK_EXCLUSIVE, - &pvp, FFSV_FORCEINSMQ); - MPASS(VTOI(pvp)->i_mode != 0); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (VN_IS_DOOMED(vp)) { - if (error == 0) - vput(pvp); - error = ENOENT; - } - if (error != 0) - return (error); - } + error = get_parent_vp(vp, mp, parentino, NULL, NULL, NULL, + &pvp); + if (error == ERELOOKUP) + error = 0; + if (error != 0) + return (error); /* * All MKDIR_PARENT dependencies and all the NEWBLOCK pagedeps * that are contained in direct blocks will be resolved by @@ -12964,9 +13254,11 @@ top: for (i = 0; i < DAHASHSZ; i++) { if (LIST_FIRST(&pagedep->pd_diraddhd[i]) == 0) continue; - if ((error = flush_pagedep_deps(vp, wk->wk_mp, - &pagedep->pd_diraddhd[i]))) { - BUF_NOREC(bp); + error = flush_pagedep_deps(vp, wk->wk_mp, + &pagedep->pd_diraddhd[i], bp); + if (error != 0) { + if (error != ERELOOKUP) + BUF_NOREC(bp); goto out_unlock; } } @@ -13200,10 +13492,11 @@ flush_newblk_dep(vp, mp, lbn) * Eliminate a pagedep dependency by flushing out all its diradd dependencies. */ static int -flush_pagedep_deps(pvp, mp, diraddhdp) +flush_pagedep_deps(pvp, mp, diraddhdp, locked_bp) struct vnode *pvp; struct mount *mp; struct diraddhd *diraddhdp; + struct buf *locked_bp; { struct inodedep *inodedep; struct inoref *inoref; @@ -13270,10 +13563,10 @@ restart: } if (dap->da_state & MKDIR_BODY) { FREE_LOCK(ump); - if ((error = ffs_vgetf(mp, inum, LK_EXCLUSIVE, &vp, - FFSV_FORCEINSMQ))) + error = get_parent_vp(pvp, mp, inum, locked_bp, + diraddhdp, &unfinished, &vp); + if (error != 0) break; - MPASS(VTOI(vp)->i_mode != 0); error = flush_newblk_dep(vp, mp, 0); /* * If we still have the dependency we might need to @@ -13335,10 +13628,10 @@ retry: */ if (dap == LIST_FIRST(diraddhdp)) { FREE_LOCK(ump); - if ((error = ffs_vgetf(mp, inum, LK_EXCLUSIVE, &vp, - FFSV_FORCEINSMQ))) + error = get_parent_vp(pvp, mp, inum, locked_bp, + diraddhdp, &unfinished, &vp); + if (error != 0) break; - MPASS(VTOI(vp)->i_mode != 0); error = ffs_update(vp, 1); vput(vp); if (error) Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ffs/ffs_vfsops.c Sat Nov 14 05:30:10 2020 (r367672) @@ -1861,8 +1861,14 @@ loop: #ifdef QUOTA qsyncvp(vp); #endif - if ((error = ffs_syncvnode(vp, waitfor, 0)) != 0) - allerror = error; + for (;;) { + error = ffs_syncvnode(vp, waitfor, 0); + if (error == ERELOOKUP) + continue; + if (error != 0) + allerror = error; + break; + } vput(vp); } /* Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ffs/ffs_vnops.c Sat Nov 14 05:30:10 2020 (r367672) @@ -253,7 +253,7 @@ ffs_syncvnode(struct vnode *vp, int waitfor, int flags struct buf *bp, *nbp; ufs_lbn_t lbn; int error, passes; - bool still_dirty, wait; + bool still_dirty, unlocked, wait; ip = VTOI(vp); ip->i_flag &= ~IN_NEEDSYNC; @@ -277,6 +277,7 @@ ffs_syncvnode(struct vnode *vp, int waitfor, int flags error = 0; passes = 0; wait = false; /* Always do an async pass first. */ + unlocked = false; lbn = lblkno(ITOFS(ip), (ip->i_size + ITOFS(ip)->fs_bsize - 1)); BO_LOCK(bo); loop: @@ -325,6 +326,26 @@ loop: if (!LIST_EMPTY(&bp->b_dep) && (error = softdep_sync_buf(vp, bp, wait ? MNT_WAIT : MNT_NOWAIT)) != 0) { + /* + * Lock order conflict, buffer was already unlocked, + * and vnode possibly unlocked. + */ + if (error == ERELOOKUP) { + if (vp->v_data == NULL) + return (EBADF); + unlocked = true; + if (DOINGSOFTDEP(vp) && waitfor == MNT_WAIT && + (error = softdep_sync_metadata(vp)) != 0) { + if (ffs_fsfail_cleanup(ump, error)) + error = 0; + return (unlocked && error == 0 ? + ERELOOKUP : error); + } + /* Re-evaluate inode size */ + lbn = lblkno(ITOFS(ip), (ip->i_size + + ITOFS(ip)->fs_bsize - 1)); + goto next; + } /* I/O error. */ if (error != EBUSY) { BUF_UNLOCK(bp); @@ -361,9 +382,11 @@ next: if (waitfor != MNT_WAIT) { BO_UNLOCK(bo); if ((flags & NO_INO_UPDT) != 0) - return (0); - else - return (ffs_update(vp, 0)); + return (unlocked ? ERELOOKUP : 0); + error = ffs_update(vp, 0); + if (error == 0 && unlocked) + error = ERELOOKUP; + return (error); } /* Drain IO to see if we're done. */ bufobj_wwait(bo, 0, 0); @@ -419,6 +442,8 @@ next: } else if ((ip->i_flags & (IN_SIZEMOD | IN_IBLKDATA)) != 0) { error = ffs_update(vp, 1); } + if (error == 0 && unlocked) + error = ERELOOKUP; return (error); } Modified: head/sys/ufs/ufs/ufs_inode.c ============================================================================== --- head/sys/ufs/ufs/ufs_inode.c Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ufs/ufs_inode.c Sat Nov 14 05:30:10 2020 (r367672) @@ -166,7 +166,8 @@ ufs_inactive(ap) isize += ip->i_din2->di_extsize; if (ip->i_effnlink <= 0 && isize && !UFS_RDONLY(ip)) error = UFS_TRUNCATE(vp, (off_t)0, IO_EXT | IO_NORMAL, NOCRED); - if (ip->i_nlink <= 0 && ip->i_mode && !UFS_RDONLY(ip)) { + if (ip->i_nlink <= 0 && ip->i_mode != 0 && !UFS_RDONLY(ip) && + (vp->v_iflag & VI_OWEINACT) == 0) { #ifdef QUOTA if (!getinoquota(ip)) (void)chkiq(ip, -1, NOCRED, FORCE); @@ -207,10 +208,12 @@ out: * If we are done with the inode, reclaim it * so that it can be reused immediately. */ - if (ip->i_mode == 0) + if (ip->i_mode == 0 && (vp->v_iflag & VI_OWEINACT) == 0) vrecycle(vp); if (mp != NULL) vn_finished_secondary_write(mp); + if (error == ERELOOKUP) + error = 0; return (error); } Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ufs/ufs_lookup.c Sat Nov 14 05:30:10 2020 (r367672) @@ -961,27 +961,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) bdwrite(bp); if ((dp->i_flag & IN_NEEDSYNC) == 0) return (UFS_UPDATE(dvp, 0)); - /* - * We have just allocated a directory block in an - * indirect block. We must prevent holes in the - * directory created if directory entries are - * written out of order. To accomplish this we - * fsync when we extend a directory into indirects. - * During rename it's not safe to drop the tvp lock - * so sync must be delayed until it is. - * - * This synchronous step could be removed if fsck and - * the kernel were taught to fill in sparse - * directories rather than panic. - */ - if (isrename) - return (0); - if (tvp != NULL) - VOP_UNLOCK(tvp); - (void) VOP_FSYNC(dvp, MNT_WAIT, td); - if (tvp != NULL) - vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY); - return (error); + return (0); } if (DOINGASYNC(dvp)) { bdwrite(bp); Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Sat Nov 14 05:19:59 2020 (r367671) +++ head/sys/ufs/ufs/ufs_vnops.c Sat Nov 14 05:30:10 2020 (r367672) @@ -1006,10 +1006,16 @@ ufs_remove(ap) td = curthread; ip = VTOI(vp); if ((ip->i_flags & (NOUNLINK | IMMUTABLE | APPEND)) || - (VTOI(dvp)->i_flags & APPEND)) { - error = EPERM; - goto out; + (VTOI(dvp)->i_flags & APPEND)) + return (EPERM); + if (DOINGSOFTDEP(dvp)) { + error = softdep_prelink(dvp, vp, true); + if (error != 0) { + MPASS(error == ERELOOKUP); + return (error); + } } + #ifdef UFS_GJOURNAL ufs_gjournal_orphan(vp); #endif @@ -1030,7 +1036,6 @@ ufs_remove(ap) (void) VOP_FSYNC(dvp, MNT_WAIT, td); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } -out: return (error); } @@ -1067,6 +1072,15 @@ ufs_link(ap) if ((cnp->cn_flags & HASBUF) == 0) panic("ufs_link: no name"); #endif + + if (DOINGSOFTDEP(tdvp)) { + error = softdep_prelink(tdvp, vp, true); + if (error != 0) { + MPASS(error == ERELOOKUP); + return (error); + } + } + if (VTOI(tdvp)->i_effnlink < 2) { print_bad_link_count("ufs_link", tdvp); error = EINVAL; @@ -1089,6 +1103,7 @@ ufs_link(ap) error = EPERM; goto out; } + ip->i_effnlink++; ip->i_nlink++; DIP_SET(ip, i_nlink, ip->i_nlink); @@ -1129,6 +1144,15 @@ ufs_whiteout(ap) struct direct newdir; int error = 0; + if (DOINGSOFTDEP(dvp) && (ap->a_flags == CREATE || + ap->a_flags == DELETE)) { + error = softdep_prelink(dvp, NULL, true); + if (error != 0) { + MPASS(error == ERELOOKUP); + return (error); + } + } + switch (ap->a_flags) { case LOOKUP: /* 4.4 format directories support whiteout operations */ @@ -1338,6 +1362,18 @@ relock: goto relock; } } + + if (DOINGSOFTDEP(fdvp)) { + error = softdep_prerename(fdvp, fvp, tdvp, tvp); + if (error != 0) { + if (error == ERELOOKUP) { + atomic_add_int(&rename_restarts, 1); + goto relock; + } + goto releout; + } + } + fdp = VTOI(fdvp); fip = VTOI(fvp); tdp = VTOI(tdvp); @@ -1649,8 +1685,10 @@ unlockout: * are no longer needed. */ if (error == 0 && endoff != 0) { - error = UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | - (DOINGASYNC(tdvp) ? 0 : IO_SYNC), tcnp->cn_cred); + do { + error = UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | + (DOINGASYNC(tdvp) ? 0 : IO_SYNC), tcnp->cn_cred); + } while (error == ERELOOKUP); if (error != 0 && !ffs_fsfail_cleanup(VFSTOUFS(mp), error)) vn_printf(tdvp, "ufs_rename: failed to truncate, error %d\n", @@ -1668,8 +1706,11 @@ unlockout: */ error = 0; } - if (error == 0 && tdp->i_flag & IN_NEEDSYNC) - error = VOP_FSYNC(tdvp, MNT_WAIT, td); + if (error == 0 && tdp->i_flag & IN_NEEDSYNC) { + do { + error = VOP_FSYNC(tdvp, MNT_WAIT, td); + } while (error == ERELOOKUP); + } vput(tdvp); return (error); @@ -1918,6 +1959,7 @@ ufs_mkdir(ap) } dmode = vap->va_mode & 0777; dmode |= IFDIR; + /* * Must simulate part of ufs_makeinode here to acquire the inode, * but not have it entered in the parent directory. The entry is @@ -1928,6 +1970,15 @@ ufs_mkdir(ap) error = EINVAL; goto out; } + + if (DOINGSOFTDEP(dvp)) { + error = softdep_prelink(dvp, NULL, true); + if (error != 0) { + MPASS(error == ERELOOKUP); + return (error); + } + } + error = UFS_VALLOC(dvp, dmode, cnp->cn_cred, &tvp); if (error) goto out; @@ -2184,6 +2235,14 @@ ufs_rmdir(ap) error = EINVAL; goto out; } + if (DOINGSOFTDEP(dvp)) { + error = softdep_prelink(dvp, vp, false); + if (error != 0) { + MPASS(error == ERELOOKUP); + return (error); + } + } + #ifdef UFS_GJOURNAL ufs_gjournal_orphan(vp); #endif @@ -2702,6 +2761,13 @@ ufs_makeinode(mode, dvp, vpp, cnp, callfunc) if (pdir->i_effnlink < 2) { print_bad_link_count(callfunc, dvp); return (EINVAL); + } + if (DOINGSOFTDEP(dvp)) { + error = softdep_prelink(dvp, NULL, true); + if (error != 0) { + MPASS(error == ERELOOKUP); + return (error); + } } error = UFS_VALLOC(dvp, mode, cnp->cn_cred, &tvp); if (error) From owner-svn-src-all@freebsd.org Sat Nov 14 10:34:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62B2D2E57FA; Sat, 14 Nov 2020 10:34:19 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYBXW24pvz4mQs; Sat, 14 Nov 2020 10:34:19 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A4429C6; Sat, 14 Nov 2020 10:34:19 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEAYJ4g021362; Sat, 14 Nov 2020 10:34:19 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEAYJsm021361; Sat, 14 Nov 2020 10:34:19 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202011141034.0AEAYJsm021361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 14 Nov 2020 10:34:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367673 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 367673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 10:34:19 -0000 Author: wulf Date: Sat Nov 14 10:34:18 2020 New Revision: 367673 URL: https://svnweb.freebsd.org/changeset/base/367673 Log: LinuxKPI: Exclude linux/acpi.h content on non-ACPI archs. LinuxKPI ACPI support is based on FreeBSD import of ACPICA which can be compiled only on aarch64, amd64 and i386. Ifdef-out broken parts on our side to avoid patching of vendor code. This fixes drm-devel-kmod build on powerpc64(le). Reported by: pkubaj Modified: head/sys/compat/linuxkpi/common/include/linux/acpi.h Modified: head/sys/compat/linuxkpi/common/include/linux/acpi.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/acpi.h Sat Nov 14 05:30:10 2020 (r367672) +++ head/sys/compat/linuxkpi/common/include/linux/acpi.h Sat Nov 14 10:34:18 2020 (r367673) @@ -33,10 +33,14 @@ #include +#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) + #include #include #define ACPI_HANDLE(dev) \ ((dev)->bsddev != NULL ? bsd_acpi_get_handle((dev)->bsddev) : NULL) + +#endif #endif /* _LINUX_ACPI_H_ */ From owner-svn-src-all@freebsd.org Sat Nov 14 10:56:41 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 357BC2E65EF; Sat, 14 Nov 2020 10:56:41 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYC2K12mnz4nL8; Sat, 14 Nov 2020 10:56:41 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16186D65; Sat, 14 Nov 2020 10:56:41 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEAuebs034029; Sat, 14 Nov 2020 10:56:40 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEAue8P034028; Sat, 14 Nov 2020 10:56:40 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202011141056.0AEAue8P034028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 14 Nov 2020 10:56:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367674 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 367674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 10:56:41 -0000 Author: tsoome Date: Sat Nov 14 10:56:40 2020 New Revision: 367674 URL: https://svnweb.freebsd.org/changeset/base/367674 Log: loader: cstyle cleanup of console.c cstyle cleanup only, no functional changes intended. Modified: head/stand/common/console.c Modified: head/stand/common/console.c ============================================================================== --- head/stand/common/console.c Sat Nov 14 10:34:18 2020 (r367673) +++ head/stand/common/console.c Sat Nov 14 10:56:40 2020 (r367674) @@ -49,97 +49,102 @@ static int twiddle_set(struct env_var *ev, int flags, void cons_probe(void) { - int cons; - int active; - char *prefconsole; + int cons; + int active; + char *prefconsole; - /* We want a callback to install the new value when this var changes. */ - env_setenv("twiddle_divisor", EV_VOLATILE, "1", twiddle_set, env_nounset); + /* We want a callback to install the new value when this var changes. */ + env_setenv("twiddle_divisor", EV_VOLATILE, "1", twiddle_set, + env_nounset); - /* Do all console probes */ - for (cons = 0; consoles[cons] != NULL; cons++) { - consoles[cons]->c_flags = 0; - consoles[cons]->c_probe(consoles[cons]); - } - /* Now find the first working one */ - active = -1; - for (cons = 0; consoles[cons] != NULL && active == -1; cons++) { - consoles[cons]->c_flags = 0; - consoles[cons]->c_probe(consoles[cons]); - if (consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT)) - active = cons; - } - /* Force a console even if all probes failed */ - if (active == -1) - active = 0; + /* Do all console probes */ + for (cons = 0; consoles[cons] != NULL; cons++) { + consoles[cons]->c_flags = 0; + consoles[cons]->c_probe(consoles[cons]); + } + /* Now find the first working one */ + active = -1; + for (cons = 0; consoles[cons] != NULL && active == -1; cons++) { + consoles[cons]->c_flags = 0; + consoles[cons]->c_probe(consoles[cons]); + if (consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT)) + active = cons; + } + /* Force a console even if all probes failed */ + if (active == -1) + active = 0; - /* Check to see if a console preference has already been registered */ - prefconsole = getenv("console"); - if (prefconsole != NULL) - prefconsole = strdup(prefconsole); - if (prefconsole != NULL) { - unsetenv("console"); /* we want to replace this */ - cons_change(prefconsole); - } else { - consoles[active]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; - consoles[active]->c_init(0); - prefconsole = strdup(consoles[active]->c_name); - } + /* Check to see if a console preference has already been registered */ + prefconsole = getenv("console"); + if (prefconsole != NULL) + prefconsole = strdup(prefconsole); + if (prefconsole != NULL) { + unsetenv("console"); /* we want to replace this */ + cons_change(prefconsole); + } else { + consoles[active]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; + consoles[active]->c_init(0); + prefconsole = strdup(consoles[active]->c_name); + } - printf("Consoles: "); - for (cons = 0; consoles[cons] != NULL; cons++) - if (consoles[cons]->c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) - printf("%s ", consoles[cons]->c_desc); - printf("\n"); + printf("Consoles: "); + for (cons = 0; consoles[cons] != NULL; cons++) + if (consoles[cons]->c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) + printf("%s ", consoles[cons]->c_desc); + printf("\n"); - if (prefconsole != NULL) { - env_setenv("console", EV_VOLATILE, prefconsole, cons_set, - env_nounset); - free(prefconsole); - } + if (prefconsole != NULL) { + env_setenv("console", EV_VOLATILE, prefconsole, cons_set, + env_nounset); + free(prefconsole); + } } int getchar(void) { - int cons; - int rv; + int cons; + int rv; - /* Loop forever polling all active consoles */ - for(;;) - for (cons = 0; consoles[cons] != NULL; cons++) - if ((consoles[cons]->c_flags & (C_PRESENTIN | C_ACTIVEIN)) == - (C_PRESENTIN | C_ACTIVEIN) && - ((rv = consoles[cons]->c_in()) != -1)) - return(rv); + /* Loop forever polling all active consoles */ + for (;;) { + for (cons = 0; consoles[cons] != NULL; cons++) { + if ((consoles[cons]->c_flags & + (C_PRESENTIN | C_ACTIVEIN)) == + (C_PRESENTIN | C_ACTIVEIN) && + ((rv = consoles[cons]->c_in()) != -1)) + return (rv); + } + } } int ischar(void) { - int cons; + int cons; - for (cons = 0; consoles[cons] != NULL; cons++) - if ((consoles[cons]->c_flags & (C_PRESENTIN | C_ACTIVEIN)) == - (C_PRESENTIN | C_ACTIVEIN) && - (consoles[cons]->c_ready() != 0)) - return(1); - return(0); + for (cons = 0; consoles[cons] != NULL; cons++) + if ((consoles[cons]->c_flags & (C_PRESENTIN | C_ACTIVEIN)) == + (C_PRESENTIN | C_ACTIVEIN) && + (consoles[cons]->c_ready() != 0)) + return (1); + return (0); } void putchar(int c) { - int cons; + int cons; - /* Expand newlines */ - if (c == '\n') - putchar('\r'); + /* Expand newlines */ + if (c == '\n') + putchar('\r'); - for (cons = 0; consoles[cons] != NULL; cons++) - if ((consoles[cons]->c_flags & (C_PRESENTOUT | C_ACTIVEOUT)) == - (C_PRESENTOUT | C_ACTIVEOUT)) - consoles[cons]->c_out(c); + for (cons = 0; consoles[cons] != NULL; cons++) { + if ((consoles[cons]->c_flags & (C_PRESENTOUT | C_ACTIVEOUT)) == + (C_PRESENTOUT | C_ACTIVEOUT)) + consoles[cons]->c_out(c); + } } /* @@ -148,12 +153,12 @@ putchar(int c) static int cons_find(const char *name) { - int cons; + int cons; - for (cons = 0; consoles[cons] != NULL; cons++) - if (!strcmp(consoles[cons]->c_name, name)) - return (cons); - return (-1); + for (cons = 0; consoles[cons] != NULL; cons++) + if (strcmp(consoles[cons]->c_name, name) == 0) + return (cons); + return (-1); } /* @@ -162,22 +167,23 @@ cons_find(const char *name) static int cons_set(struct env_var *ev, int flags, const void *value) { - int ret; + int ret; - if ((value == NULL) || (cons_check(value) == 0)) { - /* - * Return CMD_OK instead of CMD_ERROR to prevent forth syntax error, - * which would prevent it processing any further loader.conf entries. - */ - return (CMD_OK); - } + if ((value == NULL) || (cons_check(value) == 0)) { + /* + * Return CMD_OK instead of CMD_ERROR to prevent forth syntax + * error, which would prevent it processing any further + * loader.conf entries. + */ + return (CMD_OK); + } - ret = cons_change(value); - if (ret != CMD_OK) - return (ret); + ret = cons_change(value); + if (ret != CMD_OK) + return (ret); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return (CMD_OK); + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + return (CMD_OK); } /* @@ -186,36 +192,36 @@ cons_set(struct env_var *ev, int flags, const void *va static int cons_check(const char *string) { - int cons, found, failed; - char *curpos, *dup, *next; + int cons, found, failed; + char *curpos, *dup, *next; - dup = next = strdup(string); - found = failed = 0; - while (next != NULL) { - curpos = strsep(&next, " ,"); - if (*curpos != '\0') { - cons = cons_find(curpos); - if (cons == -1) { - printf("console %s is invalid!\n", curpos); - failed++; - } else { - found++; - } + dup = next = strdup(string); + found = failed = 0; + while (next != NULL) { + curpos = strsep(&next, " ,"); + if (*curpos != '\0') { + cons = cons_find(curpos); + if (cons == -1) { + printf("console %s is invalid!\n", curpos); + failed++; + } else { + found++; + } + } } - } - free(dup); + free(dup); - if (found == 0) - printf("no valid consoles!\n"); + if (found == 0) + printf("no valid consoles!\n"); - if (found == 0 || failed != 0) { - printf("Available consoles:\n"); - for (cons = 0; consoles[cons] != NULL; cons++) - printf(" %s\n", consoles[cons]->c_name); - } + if (found == 0 || failed != 0) { + printf("Available consoles:\n"); + for (cons = 0; consoles[cons] != NULL; cons++) + printf(" %s\n", consoles[cons]->c_name); + } - return (found); + return (found); } /* @@ -224,56 +230,64 @@ cons_check(const char *string) static int cons_change(const char *string) { - int cons, active; - char *curpos, *dup, *next; + int cons, active; + char *curpos, *dup, *next; - /* Disable all consoles */ - for (cons = 0; consoles[cons] != NULL; cons++) { - consoles[cons]->c_flags &= ~(C_ACTIVEIN | C_ACTIVEOUT); - } + /* Disable all consoles */ + for (cons = 0; consoles[cons] != NULL; cons++) { + consoles[cons]->c_flags &= ~(C_ACTIVEIN | C_ACTIVEOUT); + } - /* Enable selected consoles */ - dup = next = strdup(string); - active = 0; - while (next != NULL) { - curpos = strsep(&next, " ,"); - if (*curpos == '\0') - continue; - cons = cons_find(curpos); - if (cons >= 0) { - consoles[cons]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; - consoles[cons]->c_init(0); - if ((consoles[cons]->c_flags & (C_PRESENTIN | C_PRESENTOUT)) == - (C_PRESENTIN | C_PRESENTOUT)) { - active++; - continue; - } + /* Enable selected consoles */ + dup = next = strdup(string); + active = 0; + while (next != NULL) { + curpos = strsep(&next, " ,"); + if (*curpos == '\0') + continue; + cons = cons_find(curpos); + if (cons >= 0) { + consoles[cons]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; + consoles[cons]->c_init(0); + if ((consoles[cons]->c_flags & + (C_PRESENTIN | C_PRESENTOUT)) == + (C_PRESENTIN | C_PRESENTOUT)) { + active++; + continue; + } - if (active != 0) { - /* If no consoles have initialised we wouldn't see this. */ - printf("console %s failed to initialize\n", consoles[cons]->c_name); - } + if (active != 0) { + /* + * If no consoles have initialised we + * wouldn't see this. + */ + printf("console %s failed to initialize\n", + consoles[cons]->c_name); + } + } } - } - free(dup); + free(dup); - if (active == 0) { - /* All requested consoles failed to initialise, try to recover. */ - for (cons = 0; consoles[cons] != NULL; cons++) { - consoles[cons]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; - consoles[cons]->c_init(0); - if ((consoles[cons]->c_flags & - (C_PRESENTIN | C_PRESENTOUT)) == - (C_PRESENTIN | C_PRESENTOUT)) - active++; + if (active == 0) { + /* + * All requested consoles failed to initialise, + * try to recover. + */ + for (cons = 0; consoles[cons] != NULL; cons++) { + consoles[cons]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; + consoles[cons]->c_init(0); + if ((consoles[cons]->c_flags & + (C_PRESENTIN | C_PRESENTOUT)) == + (C_PRESENTIN | C_PRESENTOUT)) + active++; + } + + if (active == 0) + return (CMD_ERROR); /* Recovery failed. */ } - if (active == 0) - return (CMD_ERROR); /* Recovery failed. */ - } - - return (CMD_OK); + return (CMD_OK); } /* @@ -287,16 +301,16 @@ cons_change(const char *string) static int twiddle_set(struct env_var *ev, int flags, const void *value) { - u_long tdiv; - char * eptr; + u_long tdiv; + char *eptr; - tdiv = strtoul(value, &eptr, 0); - if (*(const char *)value == 0 || *eptr != 0) { - printf("invalid twiddle_divisor '%s'\n", (const char *)value); - return (CMD_ERROR); - } - twiddle_divisor((u_int)tdiv); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + tdiv = strtoul(value, &eptr, 0); + if (*(const char *)value == 0 || *eptr != 0) { + printf("invalid twiddle_divisor '%s'\n", (const char *)value); + return (CMD_ERROR); + } + twiddle_divisor((u_int)tdiv); + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return(CMD_OK); + return (CMD_OK); } From owner-svn-src-all@freebsd.org Sat Nov 14 11:48:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD3BA2E773F; Sat, 14 Nov 2020 11:48:28 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYDB45PP0z4qRp; Sat, 14 Nov 2020 11:48:28 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A19581575; Sat, 14 Nov 2020 11:48:28 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEBmS7S065730; Sat, 14 Nov 2020 11:48:28 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEBmSmJ065729; Sat, 14 Nov 2020 11:48:28 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202011141148.0AEBmSmJ065729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 14 Nov 2020 11:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367675 - stable/12/sys/dev/ichiic X-SVN-Group: stable-12 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/12/sys/dev/ichiic X-SVN-Commit-Revision: 367675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 11:48:28 -0000 Author: wulf Date: Sat Nov 14 11:48:28 2020 New Revision: 367675 URL: https://svnweb.freebsd.org/changeset/base/367675 Log: MFC r367230: ig4(4): Add PCI IDs for Intel Comet Lake I2C controllers. Modified: stable/12/sys/dev/ichiic/ig4_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ichiic/ig4_pci.c ============================================================================== --- stable/12/sys/dev/ichiic/ig4_pci.c Sat Nov 14 10:56:40 2020 (r367674) +++ stable/12/sys/dev/ichiic/ig4_pci.c Sat Nov 14 11:48:28 2020 (r367675) @@ -107,6 +107,20 @@ static int ig4iic_pci_detach(device_t dev); #define PCI_CHIP_CANNONLAKE_H_I2C_1 0xa3698086 #define PCI_CHIP_CANNONLAKE_H_I2C_2 0xa36a8086 #define PCI_CHIP_CANNONLAKE_H_I2C_3 0xa36b8086 +#define PCI_CHIP_COMETLAKE_LP_I2C_0 0x02e88086 +#define PCI_CHIP_COMETLAKE_LP_I2C_1 0x02e98086 +#define PCI_CHIP_COMETLAKE_LP_I2C_2 0x02ea8086 +#define PCI_CHIP_COMETLAKE_LP_I2C_3 0x02eb8086 +#define PCI_CHIP_COMETLAKE_LP_I2C_4 0x02c58086 +#define PCI_CHIP_COMETLAKE_LP_I2C_5 0x02c68086 +#define PCI_CHIP_COMETLAKE_H_I2C_0 0x06e88086 +#define PCI_CHIP_COMETLAKE_H_I2C_1 0x06e98086 +#define PCI_CHIP_COMETLAKE_H_I2C_2 0x06ea8086 +#define PCI_CHIP_COMETLAKE_H_I2C_3 0x06eb8086 +#define PCI_CHIP_COMETLAKE_V_I2C_0 0xa3e08086 +#define PCI_CHIP_COMETLAKE_V_I2C_1 0xa3e18086 +#define PCI_CHIP_COMETLAKE_V_I2C_2 0xa3e28086 +#define PCI_CHIP_COMETLAKE_V_I2C_3 0xa3e38086 struct ig4iic_pci_device { uint32_t devid; @@ -156,6 +170,20 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = { PCI_CHIP_CANNONLAKE_H_I2C_1, "Intel Cannon Lake-H I2C Controller-1", IG4_CANNONLAKE}, { PCI_CHIP_CANNONLAKE_H_I2C_2, "Intel Cannon Lake-H I2C Controller-2", IG4_CANNONLAKE}, { PCI_CHIP_CANNONLAKE_H_I2C_3, "Intel Cannon Lake-H I2C Controller-3", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_LP_I2C_0, "Intel Comet Lake-LP I2C Controller-0", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_LP_I2C_1, "Intel Comet Lake-LP I2C Controller-1", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_LP_I2C_2, "Intel Comet Lake-LP I2C Controller-2", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_LP_I2C_3, "Intel Comet Lake-LP I2C Controller-3", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_LP_I2C_4, "Intel Comet Lake-LP I2C Controller-4", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_LP_I2C_5, "Intel Comet Lake-LP I2C Controller-5", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_H_I2C_0, "Intel Comet Lake-H I2C Controller-0", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_H_I2C_1, "Intel Comet Lake-H I2C Controller-1", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_H_I2C_2, "Intel Comet Lake-H I2C Controller-2", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_H_I2C_3, "Intel Comet Lake-H I2C Controller-3", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_V_I2C_0, "Intel Comet Lake-V I2C Controller-0", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_V_I2C_1, "Intel Comet Lake-V I2C Controller-1", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_V_I2C_2, "Intel Comet Lake-V I2C Controller-2", IG4_CANNONLAKE}, + { PCI_CHIP_COMETLAKE_V_I2C_3, "Intel Comet Lake-V I2C Controller-3", IG4_CANNONLAKE}, }; static int From owner-svn-src-all@freebsd.org Sat Nov 14 11:51:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF7B32E7B19; Sat, 14 Nov 2020 11:51:37 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYDFj5NC7z4qmK; Sat, 14 Nov 2020 11:51:37 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB6E31A00; Sat, 14 Nov 2020 11:51:37 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEBpbBC067755; Sat, 14 Nov 2020 11:51:37 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEBpb7b067754; Sat, 14 Nov 2020 11:51:37 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202011141151.0AEBpb7b067754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 14 Nov 2020 11:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367676 - stable/12/sbin/devmatch X-SVN-Group: stable-12 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/12/sbin/devmatch X-SVN-Commit-Revision: 367676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 11:51:37 -0000 Author: wulf Date: Sat Nov 14 11:51:37 2020 New Revision: 367676 URL: https://svnweb.freebsd.org/changeset/base/367676 Log: MFC r367237: devmatch(8): Respect mask field when matching strings of Z type. While here, add debug output for this action. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D26823 Modified: stable/12/sbin/devmatch/devmatch.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/devmatch/devmatch.c ============================================================================== --- stable/12/sbin/devmatch/devmatch.c Sat Nov 14 11:48:28 2020 (r367675) +++ stable/12/sbin/devmatch/devmatch.c Sat Nov 14 11:51:37 2020 (r367676) @@ -349,7 +349,12 @@ search_hints(const char *bus, const char *dev, const c } if (*cp == 'D') break; + if (bit >= 0 && ((1 << bit) & mask) == 0) + break; s = pnpval_as_str(cp + 2, pnpinfo); + if (verbose_flag) + printf("Matching %s (%c) table=%s tomatch=%s\n", + cp + 2, *cp, s, val1); if (strcmp(s, val1) != 0) notme++; break; From owner-svn-src-all@freebsd.org Sat Nov 14 12:02:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B77E2E8A83; Sat, 14 Nov 2020 12:02:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYDVg1jtjz4rX6; Sat, 14 Nov 2020 12:02:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 242D41476; Sat, 14 Nov 2020 12:02:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEC2pXo078581; Sat, 14 Nov 2020 12:02:51 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEC2o1Q078576; Sat, 14 Nov 2020 12:02:50 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202011141202.0AEC2o1Q078576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 14 Nov 2020 12:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367677 - in stable/12/sys/dev: acpi_support acpica iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in stable/12/sys/dev: acpi_support acpica iicbus X-SVN-Commit-Revision: 367677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 12:02:51 -0000 Author: wulf Date: Sat Nov 14 12:02:50 2020 New Revision: 367677 URL: https://svnweb.freebsd.org/changeset/base/367677 Log: MFC r367239-367241: r367239: Add plug and play information macroses for ACPI and I2C buses. Matching table format is compatible with ACPI_ID_PROBE bus method. Note that while ACPI_ID_PROBE matches against _HID and all _CIDs, current acpi_pnpinfo_str() exports only _HID and first _CID. That means second and further _CIDs should be added to both acpi_pnpinfo_str() and ACPICOMPAT_PNP_INFO if device matching against them is required. r367240: acpi_wmi(4): Add ACPI_PNP_INFO r367241: acpi_dock(4): Add ACPI_PNP_INFO Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D26824 Modified: stable/12/sys/dev/acpi_support/acpi_wmi.c stable/12/sys/dev/acpica/acpi_dock.c stable/12/sys/dev/acpica/acpivar.h stable/12/sys/dev/iicbus/iicbus.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpi_support/acpi_wmi.c ============================================================================== --- stable/12/sys/dev/acpi_support/acpi_wmi.c Sat Nov 14 11:51:37 2020 (r367676) +++ stable/12/sys/dev/acpi_support/acpi_wmi.c Sat Nov 14 12:02:50 2020 (r367677) @@ -201,6 +201,7 @@ DRIVER_MODULE(acpi_wmi, acpi, acpi_wmi_driver, acpi_wm MODULE_VERSION(acpi_wmi, 1); MODULE_DEPEND(acpi_wmi, acpi, 1, 1, 1); static char *wmi_ids[] = {"PNP0C14", NULL}; +ACPI_PNP_INFO(wmi_ids); /* * Probe for the PNP0C14 ACPI node Modified: stable/12/sys/dev/acpica/acpi_dock.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_dock.c Sat Nov 14 11:51:37 2020 (r367676) +++ stable/12/sys/dev/acpica/acpi_dock.c Sat Nov 14 12:02:50 2020 (r367677) @@ -64,6 +64,8 @@ struct acpi_dock_softc { ACPI_SERIAL_DECL(dock, "ACPI Docking Station"); +static char *acpi_dock_pnp_ids[] = {"PNP0C15", NULL}; + /* * Utility functions */ @@ -545,3 +547,4 @@ static devclass_t acpi_dock_devclass; DRIVER_MODULE(acpi_dock, acpi, acpi_dock_driver, acpi_dock_devclass, 0, 0); MODULE_DEPEND(acpi_dock, acpi, 1, 1, 1); +ACPI_PNP_INFO(acpi_dock_pnp_ids); Modified: stable/12/sys/dev/acpica/acpivar.h ============================================================================== --- stable/12/sys/dev/acpica/acpivar.h Sat Nov 14 11:51:37 2020 (r367676) +++ stable/12/sys/dev/acpica/acpivar.h Sat Nov 14 12:02:50 2020 (r367677) @@ -232,6 +232,20 @@ extern int acpi_quirks; #define ACPI_Q_MADT_IRQ0 (1 << 2) /* + * Plug and play information for device matching. Matching table format + * is compatible with ids parameter of ACPI_ID_PROBE bus method. + * + * XXX: While ACPI_ID_PROBE matches against _HID and all _CIDs, current + * acpi_pnpinfo_str() exports only _HID and first _CID. That means second + * and further _CIDs should be added to both acpi_pnpinfo_str() and + * ACPICOMPAT_PNP_INFO if device matching against them is required. + */ +#define ACPICOMPAT_PNP_INFO(t, busname) \ + MODULE_PNP_INFO("Z:_HID", busname, t##hid, t, nitems(t)-1); \ + MODULE_PNP_INFO("Z:_CID", busname, t##cid, t, nitems(t)-1); +#define ACPI_PNP_INFO(t) ACPICOMPAT_PNP_INFO(t, acpi) + +/* * Note that the low ivar values are reserved to provide * interface compatibility with ISA drivers which can also * attach to ACPI. Modified: stable/12/sys/dev/iicbus/iicbus.h ============================================================================== --- stable/12/sys/dev/iicbus/iicbus.h Sat Nov 14 11:51:37 2020 (r367676) +++ stable/12/sys/dev/iicbus/iicbus.h Sat Nov 14 12:02:50 2020 (r367677) @@ -77,6 +77,12 @@ IICBUS_ACCESSOR(addr, ADDR, uint32_t) #define IICBUS_FDT_PNP_INFO(t) #endif +#ifdef DEV_ACPI +#define IICBUS_ACPI_PNP_INFO(t) ACPICOMPAT_PNP_INFO(t, iicbus) +#else +#define IICBUS_ACPI_PNP_INFO(t) +#endif + int iicbus_generic_intr(device_t dev, int event, char *buf); void iicbus_init_frequency(device_t dev, u_int bus_freq); From owner-svn-src-all@freebsd.org Sat Nov 14 13:07:42 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 071A42EA10E; Sat, 14 Nov 2020 13:07:42 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYFxT6t0zz4vXM; Sat, 14 Nov 2020 13:07:41 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DADE324FB; Sat, 14 Nov 2020 13:07:41 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AED7fT3017642; Sat, 14 Nov 2020 13:07:41 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AED7fuL017641; Sat, 14 Nov 2020 13:07:41 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011141307.0AED7fuL017641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Sat, 14 Nov 2020 13:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367678 - head/usr.sbin/freebsd-update X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.sbin/freebsd-update X-SVN-Commit-Revision: 367678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 13:07:42 -0000 Author: 0mp (doc,ports committer) Date: Sat Nov 14 13:07:41 2020 New Revision: 367678 URL: https://svnweb.freebsd.org/changeset/base/367678 Log: Document the PAGER environment variable Sometimes users want to use freebsd-update(8) in a non-interactive way and what they often miss is that they have to set PAGER to cat(1) in order to avoid interactive prompts from less(1). MFC after: 4 weeks Modified: head/usr.sbin/freebsd-update/freebsd-update.8 Modified: head/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.8 Sat Nov 14 12:02:50 2020 (r367677) +++ head/usr.sbin/freebsd-update/freebsd-update.8 Sat Nov 14 13:07:41 2020 (r367678) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2019 +.Dd November 14, 2020 .Dt FREEBSD-UPDATE 8 .Os .Sh NAME @@ -193,6 +193,20 @@ System", since if the system has been tampered with it cannot be trusted to operate correctly. If you intend to use this command for intrusion-detection purposes, make sure you boot from a secure disk (e.g., a CD). +.El +.Sh ENVIRONMENT +.Bl -tag -width "PAGER" +.It Ev PAGER +The pager program used to present various reports during the execution. +.Po +Default: +.Dq Pa /usr/bin/less . +.Pc +.Pp +.Ev PAGER +can be set to +.Dq cat +when a non-interactive pager is desired. .El .Sh FILES .Bl -tag -width "/etc/freebsd-update.conf" From owner-svn-src-all@freebsd.org Sat Nov 14 13:39:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7A542EAB39; Sat, 14 Nov 2020 13:39:45 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYGfT3kr7z3CqM; Sat, 14 Nov 2020 13:39:45 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-ot1-x334.google.com with SMTP id n89so11527161otn.3; Sat, 14 Nov 2020 05:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Fxtvl5QMsbOXqPD+0tevMFm0pwpkdZCHNzXKLV392Oc=; b=myrTMA8AgTOoaJQFp+69m5ypIe9nJ5Znc9yY9HuixmAXHOmeVnri+z69BMHrpdCENl wAeMQSKVAwWCNIgNVHDewe5jaiLtOrFsaWGBRnmynQj/rW8pzz8CFL5q+zg3PPOR7+w4 JhTVJg8rdxhMQQt+6U5ow36uuegS9+iGO4UFB+mld68ohSFKVDdESfwHcVzTIHMss4+o whaKutDUxV85GrW1aN6J2cz2LzqABpkvhM70rHevA6sZZtEoq5hBtMB9W/oJqLUh4ljZ XHBCa2oRH/iL3zwzirmqOly+7GUKDFcdXzrlUB6b4lsvJ/qtEqJbPfpR8JLDf9SXRkk8 9tWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Fxtvl5QMsbOXqPD+0tevMFm0pwpkdZCHNzXKLV392Oc=; b=DONV5yDmLuzWNeaNxMt73v+paNkHTZYHeOC3Xato4SUsFpC+o5BkkAtIU+ZNC0eeFV kUGEkgdHCBJNeg2IumYgI3buQ4Ds1XWl6RKdUWA/4o9H4AC5F+Us0nVsU0q4fln57jI6 97OKTgQkF/tDuEi4BI3ibi5YI+RfVZHb6NUGycCjMgBfDtyHUNWgfCYbroYOJrymmRoy bxYVaB9zRlz1TX2Z9kUCtODmSrHs9nZbxvDdwXVklWkdWCeWfsx+FY6CVZMksYUiKB/n miNb9PVvelZp0ZjKI/GCpki8remh5G8pnaA1bteVDnHCpqVbTYlcoJl0CnUmsdeec/2L IuYA== X-Gm-Message-State: AOAM533vS4pRSv+RmwAmqjOl8TZpIGZ/0YuNLPzwPvk1+NAJ1322sAIw X76W0lqLvJO4QvxqOZqYHk2UrOVpKvNCEQ== X-Google-Smtp-Source: ABdhPJw7Kx/fkGjzSyIQxYoEXGok3uXhtedeiDHhV1PK47nGXFs0o7lu36EkA3s0CGrsw/NG2+sWdA== X-Received: by 2002:a05:6830:1002:: with SMTP id a2mr5014084otp.316.1605361184222; Sat, 14 Nov 2020 05:39:44 -0800 (PST) Received: from spectre.mavhome.dp.ua ([2600:1700:3580:3560:228:f8ff:fe04:d12]) by smtp.gmail.com with ESMTPSA id a5sm2346651oto.1.2020.11.14.05.39.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 Nov 2020 05:39:43 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r367359 - stable/12/sys/dev/pci To: martin@vx.sk Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <20201113173821.Horde.jq1A9wp72tHUvM10uhYxhOq@mail.vx.sk> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: Date: Sat, 14 Nov 2020 08:39:42 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.0 MIME-Version: 1.0 In-Reply-To: <20201113173821.Horde.jq1A9wp72tHUvM10uhYxhOq@mail.vx.sk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CYGfT3kr7z3CqM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 13:39:45 -0000 Martin, I've never seen such issues. Could you send me verbose `dmesg`, `devinfo -v` and `lspci -vv` outputs with and without the tunable set? I guess your BIOS sets some things differently from all I've tested. On 13.11.2020 11:38, martin@vx.sk wrote: > I am encountering a problem with hw.pci.enable_aspm: > > System: ASUS RS500A-E10-RS12U > CPU: AMD EPYC 7502 32-Core. > NVMe drive model: Micron 9300 PRO > Number of NVMe drives: 10 > > Using X2APIC > > When hw.pci.enable_aspm is enabled, PCIe hot plug of Micron NVMe drives > does not work (including detection on boot) and the system reports the > following errors for the vast majority of the drives: > > Nov 13 15:11:30 xxx kernel: pcib9: Timed out waiting for Data Link Layer > Active > Nov 13 15:12:17 xxx kernel: pcib30: Timed out waiting for Data Link > Layer Active > Nov 13 15:12:44 xxx kernel: pcib29: Timed out waiting for Data Link > Layer Active > Nov 13 15:13:04 xxx kernel: pcib11: Timed out waiting for Data Link > Layer Active > ... > > Flipping the tunable back to 0 workarounds the problem. > > Reproduced both on latest head and stable/12. -- Alexander Motin From owner-svn-src-all@freebsd.org Sat Nov 14 14:15:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AEB02EB29F; Sat, 14 Nov 2020 14:15:50 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYHS62ZJYz3FHq; Sat, 14 Nov 2020 14:15:50 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B07D34AF; Sat, 14 Nov 2020 14:15:50 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEEFoUf060572; Sat, 14 Nov 2020 14:15:50 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEEFomU060571; Sat, 14 Nov 2020 14:15:50 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202011141415.0AEEFomU060571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Sat, 14 Nov 2020 14:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367679 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 367679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 14:15:50 -0000 Author: gbe (doc committer) Date: Sat Nov 14 14:15:49 2020 New Revision: 367679 URL: https://svnweb.freebsd.org/changeset/base/367679 Log: MFC r366580: bpf(4): Update the man page to reflect reality PR: 131918 Submitted by: guy at alum dot mit dot edu Reviewed by: gnn, gbe Approved by: gnn Differential Revision: https://reviews.freebsd.org/D25993 Modified: stable/12/share/man/man4/bpf.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/bpf.4 ============================================================================== --- stable/12/share/man/man4/bpf.4 Sat Nov 14 13:07:41 2020 (r367678) +++ stable/12/share/man/man4/bpf.4 Sat Nov 14 14:15:49 2020 (r367679) @@ -49,7 +49,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 21, 2016 +.Dd October 9, 2020 .Dt BPF 4 .Os .Sh NAME @@ -73,12 +73,6 @@ ioctl. A given interface can be shared by multiple listeners, and the filter underlying each descriptor will see an identical packet stream. .Pp -A separate device file is required for each minor device. -If a file is in use, the open will fail and -.Va errno -will be set to -.Er EBUSY . -.Pp Associated with each open instance of a .Nm file is a user-settable packet filter. @@ -86,19 +80,6 @@ Whenever a packet is received by an interface, all file descriptors listening on that interface apply their filter. Each descriptor that accepts the packet receives its own copy. .Pp -The packet filter will support any link level protocol that has fixed length -headers. -Currently, only Ethernet, -.Tn SLIP , -and -.Tn PPP -drivers have been modified to interact with -.Nm . -.Pp -Since packet data is in network byte order, applications should use the -.Xr byteorder 3 -macros to extract multi-byte values. -.Pp A packet can be sent out on the network by writing to a .Nm file descriptor. @@ -313,7 +294,7 @@ with If the requested buffer size cannot be accommodated, the closest allowable size will be set and returned in the argument. A read call will result in -.Er EIO +.Er EINVAL if it is passed a buffer that is not this size. .It Dv BIOCGDLT .Pq Li u_int @@ -324,6 +305,43 @@ The device types, prefixed with .Dq Li DLT_ , are defined in .In net/bpf.h . +.It Dv BIOCGDLTLIST +.Pq Li "struct bpf_dltlist" +Returns an array of the available types of the data link layer +underlying the attached interface: +.Bd -literal -offset indent +struct bpf_dltlist { + u_int bfl_len; + u_int *bfl_list; +}; +.Ed +.Pp +The available types are returned in the array pointed to by the +.Va bfl_list +field while their length in u_int is supplied to the +.Va bfl_len +field. +.Er ENOMEM +is returned if there is not enough buffer space and +.Er EFAULT +is returned if a bad address is encountered. +The +.Va bfl_len +field is modified on return to indicate the actual length in u_int +of the array returned. +If +.Va bfl_list +is +.Dv NULL , +the +.Va bfl_len +field is set to indicate the required length of an array in u_int. +.It Dv BIOCSDLT +.Pq Li u_int +Changes the type of the data link layer underlying the attached interface. +.Er EINVAL +is returned if no interface has been specified or the specified +type is not available for the interface. .It Dv BIOCPROMISC Forces the interface into promiscuous mode. All packets, not just those destined for the local host, are processed. @@ -331,6 +349,9 @@ Since more than one file can be listening on a given i a listener that opened its interface non-promiscuously may receive packets promiscuously. This problem can be remedied with an appropriate filter. +.Pp +The interface remains in promiscuous mode until all files listening +promiscuously are closed. .It Dv BIOCFLUSH Flushes the buffer of incoming packets, and resets the statistics that are returned by BIOCGSTATS. @@ -344,7 +365,7 @@ structure. All other fields are undefined. .It Dv BIOCSETIF .Pq Li "struct ifreq" -Sets the hardware interface associate with the file. +Sets the hardware interface associated with the file. This command must be performed before any packets can be read. The device is indicated by name using the @@ -357,7 +378,7 @@ Additionally, performs the actions of .It Dv BIOCSRTIMEOUT .It Dv BIOCGRTIMEOUT .Pq Li "struct timeval" -Set or get the read timeout parameter. +Sets or gets the read timeout parameter. The argument specifies the length of time to wait before timing out on a read request. @@ -387,7 +408,7 @@ kernel because of buffer overflows .El .It Dv BIOCIMMEDIATE .Pq Li u_int -Enable or disable +Enables or disables .Dq immediate mode , based on the truth value of the argument. When immediate mode is enabled, reads return immediately upon packet @@ -407,7 +428,7 @@ An array of instructions and its length is passed in u the following structure: .Bd -literal struct bpf_program { - int bf_len; + u_int bf_len; struct bpf_insn *bf_insns; }; .Ed @@ -469,10 +490,18 @@ An incompatible filter may result in undefined behavior (most likely, an error returned by .Fn ioctl or haphazard packet matching). +.It Dv BIOCGRSIG +.It Dv BIOCSRSIG +.Pq Li u_int +Sets or gets the receive signal. +This signal will be sent to the process or process group specified by +.Dv FIOSETOWN . +It defaults to +.Dv SIGIO . .It Dv BIOCSHDRCMPLT .It Dv BIOCGHDRCMPLT .Pq Li u_int -Set or get the status of the +Sets or gets the status of the .Dq header complete flag. Set to zero if the link level source address should be filled in automatically @@ -489,7 +518,7 @@ Use and .Dv BIOCGDIRECTION instead. -Set or get the flag determining whether locally generated packets on the +Sets or gets the flag determining whether locally generated packets on the interface should be returned by BPF. Set to zero to see only incoming packets on the interface. Set to one to see packets originating locally and remotely on the interface. @@ -497,7 +526,7 @@ This flag is initialized to one by default. .It Dv BIOCSDIRECTION .It Dv BIOCGDIRECTION .Pq Li u_int -Set or get the setting determining whether incoming, outgoing, or all packets +Sets or gets the setting determining whether incoming, outgoing, or all packets on the interface should be returned by BPF. Set to .Dv BPF_D_IN @@ -631,6 +660,57 @@ therefore ownership is not assigned, the user process against .Vt bzh_user_gen . .El +.Sh STANDARD IOCTLS +.Nm +now supports several standard +.Xr ioctl 2 Ns 's +which allow the user to do async and/or non-blocking I/O to an open +.I bpf +file descriptor. +.Bl -tag -width SIOCGIFADDR +.It Dv FIONREAD +.Pq Li int +Returns the number of bytes that are immediately available for reading. +.It Dv SIOCGIFADDR +.Pq Li "struct ifreq" +Returns the address associated with the interface. +.It Dv FIONBIO +.Pq Li int +Sets or clears non-blocking I/O. +If arg is non-zero, then doing a +.Xr read 2 +when no data is available will return -1 and +.Va errno +will be set to +.Er EAGAIN . +If arg is zero, non-blocking I/O is disabled. +Note: setting this overrides the timeout set by +.Dv BIOCSRTIMEOUT . +.It Dv FIOASYNC +.Pq Li int +Enables or disables async I/O. +When enabled (arg is non-zero), the process or process group specified by +.Dv FIOSETOWN +will start receiving +.Dv SIGIO 's +when packets arrive. +Note that you must do an +.Dv FIOSETOWN +in order for this to take affect, +as the system will not default this for you. +The signal may be changed via +.Dv BIOCSRSIG . +.It Dv FIOSETOWN +.It Dv FIOGETOWN +.Pq Li int +Sets or gets the process or process group (if negative) that should +receive +.Dv SIGIO +when packets are available. +The signal may be changed using +.Dv BIOCSRSIG +(see above). +.El .Sh BPF HEADER One of the following structures is prepended to each packet returned by .Xr read 2 @@ -750,10 +830,10 @@ and implicit program counter. The following structure defines the instruction format: .Bd -literal struct bpf_insn { - u_short code; - u_char jt; - u_char jf; - u_long k; + u_short code; + u_char jt; + u_char jf; + bpf_u_int32 k; }; .Ed .Pp @@ -964,7 +1044,7 @@ variables controls the behaviour of the .Nm subsystem .Bl -tag -width indent -.It Va net.bpf.optimize_writers: No 0 +.It Va net.bpf.optimize_writers : No 0 Various programs use BPF to send (but not receive) raw packets (cdpd, lldpd, dhcpd, dhcp relays, etc. are good examples of such programs). They do not need incoming packets to be send to them. @@ -973,20 +1053,20 @@ makes new BPF users to be attached to write-only inter explicitly specifies read filter via .Fn pcap_set_filter . This removes any performance degradation for high-speed interfaces. -.It Va net.bpf.stats: +.It Va net.bpf.stats : Binary interface for retrieving general statistics. -.It Va net.bpf.zerocopy_enable: No 0 +.It Va net.bpf.zerocopy_enable : No 0 Permits zero-copy to be used with net BPF readers. Use with caution. -.It Va net.bpf.maxinsns: No 512 +.It Va net.bpf.maxinsns : No 512 Maximum number of instructions that BPF program can contain. Use .Xr tcpdump 1 .Fl d option to determine approximate number of instruction for any filter. -.It Va net.bpf.maxbufsize: No 524288 +.It Va net.bpf.maxbufsize : No 524288 Maximum buffer size to allocate for packets buffer. -.It Va net.bpf.bufsize: No 4096 +.It Va net.bpf.bufsize : No 4096 Default buffer size to allocate for packets buffer. .El .Sh EXAMPLES @@ -1052,7 +1132,6 @@ struct bpf_insn insns[] = { .Xr kqueue 2 , .Xr poll 2 , .Xr select 2 , -.Xr byteorder 3 , .Xr ng_bpf 4 , .Xr bpf 9 .Rs @@ -1100,8 +1179,6 @@ This could be fixed in the kernel with additional proc However, we favor the model where all files must assume that the interface is promiscuous, and if so desired, must utilize a filter to reject foreign packets. -.Pp -Data link protocols with variable length headers are not currently supported. .Pp The .Dv SEESENT , From owner-svn-src-all@freebsd.org Sat Nov 14 14:50:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AF242EC373; Sat, 14 Nov 2020 14:50:35 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYJDB6vSQz3HVV; Sat, 14 Nov 2020 14:50:34 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFE943E06; Sat, 14 Nov 2020 14:50:34 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEEoYZr079088; Sat, 14 Nov 2020 14:50:34 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEEoYWL079087; Sat, 14 Nov 2020 14:50:34 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <202011141450.0AEEoYWL079087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 14 Nov 2020 14:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367680 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 367680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 14:50:35 -0000 Author: jtl Date: Sat Nov 14 14:50:34 2020 New Revision: 367680 URL: https://svnweb.freebsd.org/changeset/base/367680 Log: Fix implicit automatic local port selection for IPv6 during connect calls. When a user creates a TCP socket and tries to connect to the socket without explicitly binding the socket to a local address, the connect call implicitly chooses an appropriate local port. When evaluating candidate local ports, the algorithm checks for conflicts with existing ports by doing a lookup in the connection hash table. In this circumstance, both the IPv4 and IPv6 code look for exact matches in the hash table. However, the IPv4 code goes a step further and checks whether the proposed 4-tuple will match wildcard (e.g. TCP "listen") entries. The IPv6 code has no such check. The missing wildcard check can cause problems when connecting to a local server. It is possible that the algorithm will choose the same value for the local port as the foreign port uses. This results in a connection with identical source and destination addresses and ports. Changing the IPv6 code to align with the IPv4 code's behavior fixes this problem. Reviewed by: tuexen Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27164 Modified: head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Sat Nov 14 14:15:49 2020 (r367679) +++ head/sys/netinet6/in6_pcb.c Sat Nov 14 14:50:34 2020 (r367680) @@ -464,7 +464,8 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr rehash = false; error = in_pcb_lport_dest(inp, (struct sockaddr *) &laddr6, &inp->inp_lport, - (struct sockaddr *) sin6, sin6->sin6_port, cred, 0); + (struct sockaddr *) sin6, sin6->sin6_port, cred, + INPLOOKUP_WILDCARD); if (error) return (error); } From owner-svn-src-all@freebsd.org Sat Nov 14 15:19:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3371B2ECA58; Sat, 14 Nov 2020 15:19:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYJsm0h0bz3JpG; Sat, 14 Nov 2020 15:19:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09E7B4500; Sat, 14 Nov 2020 15:19:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEFJe8A097676; Sat, 14 Nov 2020 15:19:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEFJauR097657; Sat, 14 Nov 2020 15:19:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011141519.0AEFJauR097657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 15:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367681 - in stable/12/contrib/lua: . doc src X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/contrib/lua: . doc src X-SVN-Commit-Revision: 367681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 15:19:40 -0000 Author: kevans Date: Sat Nov 14 15:19:36 2020 New Revision: 367681 URL: https://svnweb.freebsd.org/changeset/base/367681 Log: MFC r366769: MFC r366760: lua: update to 5.3.6 This release contains some minor bugfixes; notably: - 2x minor Makefile fixes (not used in base) - Long brackets with a huge number of '=' overflow some internal buffer arithmetic. - Joining an upvalue with itself can cause a use-after-free crash. See here for examples: http://www.lua.org/bugs.html#5.3.5 Modified: stable/12/contrib/lua/Makefile stable/12/contrib/lua/README stable/12/contrib/lua/doc/contents.html stable/12/contrib/lua/doc/manual.html stable/12/contrib/lua/doc/readme.html stable/12/contrib/lua/src/Makefile stable/12/contrib/lua/src/lapi.c stable/12/contrib/lua/src/lauxlib.c stable/12/contrib/lua/src/lcode.c stable/12/contrib/lua/src/ldebug.c stable/12/contrib/lua/src/liolib.c stable/12/contrib/lua/src/llex.c stable/12/contrib/lua/src/lobject.c stable/12/contrib/lua/src/lparser.c stable/12/contrib/lua/src/lua.h stable/12/contrib/lua/src/lundump.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/lua/Makefile ============================================================================== --- stable/12/contrib/lua/Makefile Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/Makefile Sat Nov 14 15:19:36 2020 (r367681) @@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1 # Lua version and release. V= 5.3 -R= $V.4 +R= $V.6 # Targets start here. all: $(PLAT) Modified: stable/12/contrib/lua/README ============================================================================== --- stable/12/contrib/lua/README Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/README Sat Nov 14 15:19:36 2020 (r367681) @@ -1,5 +1,5 @@ -This is Lua 5.3.5, released on 26 Jun 2018. +This is Lua 5.3.6, released on 14 Sep 2020. For installation instructions, license details, and further information about Lua, see doc/readme.html. Modified: stable/12/contrib/lua/doc/contents.html ============================================================================== --- stable/12/contrib/lua/doc/contents.html Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/doc/contents.html Sat Nov 14 15:19:36 2020 (r367681) @@ -32,7 +32,7 @@ For a complete introduction to Lua programming, see th

-Copyright © 2015–2018 Lua.org, PUC-Rio. +Copyright © 2015–2020 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -318,6 +318,37 @@ Freely available under the terms of the utf8.len
utf8.offset
+

metamethods

+

+__add
+__band
+__bnot
+__bor
+__bxor
+__call
+__concat
+__div
+__eq
+__gc
+__idiv
+__index
+__le
+__len
+__lt
+__metatable
+__mod
+__mode
+__mul
+__name
+__newindex
+__pairs
+__pow
+__shl
+__shr
+__sub
+__tostring
+__unm
+

environment
variables

LUA_CPATH
@@ -609,10 +640,10 @@ Freely available under the terms of the

Modified: stable/12/contrib/lua/doc/manual.html ============================================================================== --- stable/12/contrib/lua/doc/manual.html Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/doc/manual.html Sat Nov 14 15:19:36 2020 (r367681) @@ -19,7 +19,7 @@ by Roberto Ierusalimschy, Luiz Henrique de Figueiredo,

-Copyright © 2015–2018 Lua.org, PUC-Rio. +Copyright © 2015–2020 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -10972,10 +10972,10 @@ and LiteralString, see §3.1.)

Modified: stable/12/contrib/lua/doc/readme.html ============================================================================== --- stable/12/contrib/lua/doc/readme.html Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/doc/readme.html Sat Nov 14 15:19:36 2020 (r367681) @@ -107,7 +107,7 @@ Here are the details.
  1. Open a terminal window and move to -the top-level directory, which is named lua-5.3.5. +the top-level directory, which is named lua-5.3.6. The Makefile there controls both the build process and the installation process.

  2. @@ -328,7 +328,7 @@ For details, see this.
    -Copyright © 1994–2017 Lua.org, PUC-Rio. +Copyright © 1994–2020 Lua.org, PUC-Rio.

    Permission is hereby granted, free of charge, to any person obtaining a copy @@ -355,10 +355,10 @@ THE SOFTWARE.

    Modified: stable/12/contrib/lua/src/Makefile ============================================================================== --- stable/12/contrib/lua/src/Makefile Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/Makefile Sat Nov 14 15:19:36 2020 (r367681) @@ -102,7 +102,7 @@ c89: freebsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" generic: $(ALL) Modified: stable/12/contrib/lua/src/lapi.c ============================================================================== --- stable/12/contrib/lua/src/lapi.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/lapi.c Sat Nov 14 15:19:36 2020 (r367681) @@ -1254,13 +1254,12 @@ LUA_API const char *lua_setupvalue (lua_State *L, int } -static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { +static UpVal **getupvalref (lua_State *L, int fidx, int n) { LClosure *f; StkId fi = index2addr(L, fidx); api_check(L, ttisLclosure(fi), "Lua function expected"); f = clLvalue(fi); api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); - if (pf) *pf = f; return &f->upvals[n - 1]; /* get its upvalue pointer */ } @@ -1269,7 +1268,7 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, i StkId fi = index2addr(L, fidx); switch (ttype(fi)) { case LUA_TLCL: { /* lua closure */ - return *getupvalref(L, fidx, n, NULL); + return *getupvalref(L, fidx, n); } case LUA_TCCL: { /* C closure */ CClosure *f = clCvalue(fi); @@ -1286,9 +1285,10 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, i LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, int fidx2, int n2) { - LClosure *f1; - UpVal **up1 = getupvalref(L, fidx1, n1, &f1); - UpVal **up2 = getupvalref(L, fidx2, n2, NULL); + UpVal **up1 = getupvalref(L, fidx1, n1); + UpVal **up2 = getupvalref(L, fidx2, n2); + if (*up1 == *up2) + return; luaC_upvdeccount(L, *up1); *up1 = *up2; (*up1)->refcount++; Modified: stable/12/contrib/lua/src/lauxlib.c ============================================================================== --- stable/12/contrib/lua/src/lauxlib.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/lauxlib.c Sat Nov 14 15:19:36 2020 (r367681) @@ -1011,8 +1011,13 @@ static void *l_alloc (void *ud, void *ptr, size_t osiz free(ptr); return NULL; } - else - return realloc(ptr, nsize); + else { /* cannot fail when shrinking a block */ + void *newptr = realloc(ptr, nsize); + if (newptr == NULL && ptr != NULL && nsize <= osize) + return ptr; /* keep the original block */ + else /* no fail or not shrinking */ + return newptr; /* use the new block */ + } } Modified: stable/12/contrib/lua/src/lcode.c ============================================================================== --- stable/12/contrib/lua/src/lcode.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/lcode.c Sat Nov 14 15:19:36 2020 (r367681) @@ -1061,7 +1061,7 @@ static void codecomp (FuncState *fs, BinOpr opr, expde /* -** Aplly prefix operation 'op' to expression 'e'. +** Apply prefix operation 'op' to expression 'e'. */ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP}; Modified: stable/12/contrib/lua/src/ldebug.c ============================================================================== --- stable/12/contrib/lua/src/ldebug.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/ldebug.c Sat Nov 14 15:19:36 2020 (r367681) @@ -133,10 +133,11 @@ static const char *upvalname (Proto *p, int uv) { static const char *findvararg (CallInfo *ci, int n, StkId *pos) { int nparams = clLvalue(ci->func)->p->numparams; - if (n >= cast_int(ci->u.l.base - ci->func) - nparams) + int nvararg = cast_int(ci->u.l.base - ci->func) - nparams; + if (n <= -nvararg) return NULL; /* no such vararg */ else { - *pos = ci->func + nparams + n; + *pos = ci->func + nparams - n; return "(*vararg)"; /* generic name for any vararg */ } } @@ -148,7 +149,7 @@ static const char *findlocal (lua_State *L, CallInfo * StkId base; if (isLua(ci)) { if (n < 0) /* access to vararg values? */ - return findvararg(ci, -n, pos); + return findvararg(ci, n, pos); else { base = ci->u.l.base; name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); Modified: stable/12/contrib/lua/src/liolib.c ============================================================================== --- stable/12/contrib/lua/src/liolib.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/liolib.c Sat Nov 14 15:19:36 2020 (r367681) @@ -277,6 +277,8 @@ static int io_popen (lua_State *L) { const char *filename = luaL_checkstring(L, 1); const char *mode = luaL_optstring(L, 2, "r"); LStream *p = newprefile(L); + luaL_argcheck(L, ((mode[0] == 'r' || mode[0] == 'w') && mode[1] == '\0'), + 2, "invalid mode"); p->f = l_popen(L, filename, mode); p->closef = &io_pclose; return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; Modified: stable/12/contrib/lua/src/llex.c ============================================================================== --- stable/12/contrib/lua/src/llex.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/llex.c Sat Nov 14 15:19:36 2020 (r367681) @@ -244,12 +244,12 @@ static int read_numeral (LexState *ls, SemInfo *seminf /* -** skip a sequence '[=*[' or ']=*]'; if sequence is well formed, return -** its number of '='s; otherwise, return a negative number (-1 iff there -** are no '='s after initial bracket) +** reads a sequence '[=*[' or ']=*]', leaving the last bracket. +** If sequence is well formed, return its number of '='s + 2; otherwise, +** return 1 if there is no '='s or 0 otherwise (an unfinished '[==...'). */ -static int skip_sep (LexState *ls) { - int count = 0; +static size_t skip_sep (LexState *ls) { + size_t count = 0; int s = ls->current; lua_assert(s == '[' || s == ']'); save_and_next(ls); @@ -257,11 +257,14 @@ static int skip_sep (LexState *ls) { save_and_next(ls); count++; } - return (ls->current == s) ? count : (-count) - 1; + return (ls->current == s) ? count + 2 + : (count == 0) ? 1 + : 0; + } -static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { +static void read_long_string (LexState *ls, SemInfo *seminfo, size_t sep) { int line = ls->linenumber; /* initial line (for error message) */ save_and_next(ls); /* skip 2nd '[' */ if (currIsNewline(ls)) /* string starts with a newline? */ @@ -295,8 +298,8 @@ static void read_long_string (LexState *ls, SemInfo *s } } endloop: if (seminfo) - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), - luaZ_bufflen(ls->buff) - 2*(2 + sep)); + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + sep, + luaZ_bufflen(ls->buff) - 2 * sep); } @@ -444,9 +447,9 @@ static int llex (LexState *ls, SemInfo *seminfo) { /* else is a comment */ next(ls); if (ls->current == '[') { /* long comment? */ - int sep = skip_sep(ls); + size_t sep = skip_sep(ls); luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ - if (sep >= 0) { + if (sep >= 2) { read_long_string(ls, NULL, sep); /* skip long comment */ luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ break; @@ -458,12 +461,12 @@ static int llex (LexState *ls, SemInfo *seminfo) { break; } case '[': { /* long string or simply '[' */ - int sep = skip_sep(ls); - if (sep >= 0) { + size_t sep = skip_sep(ls); + if (sep >= 2) { read_long_string(ls, seminfo, sep); return TK_STRING; } - else if (sep != -1) /* '[=...' missing second bracket */ + else if (sep == 0) /* '[=...' missing second bracket */ lexerror(ls, "invalid long string delimiter", TK_STRING); return '['; } Modified: stable/12/contrib/lua/src/lobject.c ============================================================================== --- stable/12/contrib/lua/src/lobject.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/lobject.c Sat Nov 14 15:19:36 2020 (r367681) @@ -266,7 +266,7 @@ static const char *l_str2dloc (const char *s, lua_Numb ** - 'n'/'N' means 'inf' or 'nan' (which should be rejected) ** - '.' just optimizes the search for the common case (nothing special) ** This function accepts both the current locale or a dot as the radix -** mark. If the convertion fails, it may mean number has a dot but +** mark. If the conversion fails, it may mean number has a dot but ** locale accepts something else. In that case, the code copies 's' ** to a buffer (because 's' is read-only), changes the dot to the ** current locale radix mark, and tries to convert again. Modified: stable/12/contrib/lua/src/lparser.c ============================================================================== --- stable/12/contrib/lua/src/lparser.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/lparser.c Sat Nov 14 15:19:36 2020 (r367681) @@ -544,6 +544,7 @@ static void open_func (LexState *ls, FuncState *fs, Bl fs->bl = NULL; f = fs->f; f->source = ls->source; + luaC_objbarrier(ls->L, f, f->source); f->maxstacksize = 2; /* registers 0/1 are always valid */ enterblock(fs, bl, 0); } @@ -1616,6 +1617,7 @@ static void mainfunc (LexState *ls, FuncState *fs) { fs->f->is_vararg = 1; /* main function is always declared vararg */ init_exp(&v, VLOCAL, 0); /* create and... */ newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */ + luaC_objbarrier(ls->L, fs->f, ls->envn); luaX_next(ls); /* read first token */ statlist(ls); /* parse main body */ check(ls, TK_EOS); @@ -1634,6 +1636,7 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer * sethvalue(L, L->top, lexstate.h); /* anchor it */ luaD_inctop(L); funcstate.f = cl->p = luaF_newproto(L); + luaC_objbarrier(L, cl, cl->p); funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ lua_assert(iswhite(funcstate.f)); /* do not need barrier here */ lexstate.buff = buff; Modified: stable/12/contrib/lua/src/lua.h ============================================================================== --- stable/12/contrib/lua/src/lua.h Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/lua.h Sat Nov 14 15:19:36 2020 (r367681) @@ -1,5 +1,4 @@ /* -** $Id: lua.h,v 1.332.1.2 2018/06/13 16:58:17 roberto Exp $ ** Lua - A Scripting Language ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** See Copyright Notice at the end of this file @@ -19,11 +18,11 @@ #define LUA_VERSION_MAJOR "5" #define LUA_VERSION_MINOR "3" #define LUA_VERSION_NUM 503 -#define LUA_VERSION_RELEASE "5" +#define LUA_VERSION_RELEASE "6" #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE -#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2018 Lua.org, PUC-Rio" +#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2020 Lua.org, PUC-Rio" #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" @@ -460,7 +459,7 @@ struct lua_Debug { /****************************************************************************** -* Copyright (C) 1994-2018 Lua.org, PUC-Rio. +* Copyright (C) 1994-2020 Lua.org, PUC-Rio. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the Modified: stable/12/contrib/lua/src/lundump.c ============================================================================== --- stable/12/contrib/lua/src/lundump.c Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/src/lundump.c Sat Nov 14 15:19:36 2020 (r367681) @@ -85,8 +85,10 @@ static lua_Integer LoadInteger (LoadState *S) { } -static TString *LoadString (LoadState *S) { +static TString *LoadString (LoadState *S, Proto *p) { + lua_State *L = S->L; size_t size = LoadByte(S); + TString *ts; if (size == 0xFF) LoadVar(S, size); if (size == 0) @@ -94,13 +96,17 @@ static TString *LoadString (LoadState *S) { else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ char buff[LUAI_MAXSHORTLEN]; LoadVector(S, buff, size); - return luaS_newlstr(S->L, buff, size); + ts = luaS_newlstr(L, buff, size); } else { /* long string */ - TString *ts = luaS_createlngstrobj(S->L, size); + ts = luaS_createlngstrobj(L, size); + setsvalue2s(L, L->top, ts); /* anchor it ('loadVector' can GC) */ + luaD_inctop(L); LoadVector(S, getstr(ts), size); /* load directly in final place */ - return ts; + L->top--; /* pop string */ } + luaC_objbarrier(L, p, ts); + return ts; } @@ -140,7 +146,7 @@ static void LoadConstants (LoadState *S, Proto *f) { break; case LUA_TSHRSTR: case LUA_TLNGSTR: - setsvalue2n(S->L, o, LoadString(S)); + setsvalue2n(S->L, o, LoadString(S, f)); break; default: lua_assert(0); @@ -158,6 +164,7 @@ static void LoadProtos (LoadState *S, Proto *f) { f->p[i] = NULL; for (i = 0; i < n; i++) { f->p[i] = luaF_newproto(S->L); + luaC_objbarrier(S->L, f, f->p[i]); LoadFunction(S, f->p[i], f->source); } } @@ -189,18 +196,18 @@ static void LoadDebug (LoadState *S, Proto *f) { for (i = 0; i < n; i++) f->locvars[i].varname = NULL; for (i = 0; i < n; i++) { - f->locvars[i].varname = LoadString(S); + f->locvars[i].varname = LoadString(S, f); f->locvars[i].startpc = LoadInt(S); f->locvars[i].endpc = LoadInt(S); } n = LoadInt(S); for (i = 0; i < n; i++) - f->upvalues[i].name = LoadString(S); + f->upvalues[i].name = LoadString(S, f); } static void LoadFunction (LoadState *S, Proto *f, TString *psource) { - f->source = LoadString(S); + f->source = LoadString(S, f); if (f->source == NULL) /* no source in dump? */ f->source = psource; /* reuse parent's source */ f->linedefined = LoadInt(S); @@ -271,6 +278,7 @@ LClosure *luaU_undump(lua_State *L, ZIO *Z, const char setclLvalue(L, L->top, cl); luaD_inctop(L); cl->p = luaF_newproto(L); + luaC_objbarrier(L, cl, cl->p); LoadFunction(&S, cl->p, NULL); lua_assert(cl->nupvalues == cl->p->sizeupvalues); luai_verifycode(L, buff, cl->p); From owner-svn-src-all@freebsd.org Sat Nov 14 15:21:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D7752ECC71; Sat, 14 Nov 2020 15:21:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYJvj2Fcvz3KJc; Sat, 14 Nov 2020 15:21:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4027944CB; Sat, 14 Nov 2020 15:21:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEFLLKT098626; Sat, 14 Nov 2020 15:21:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEFLKgU098624; Sat, 14 Nov 2020 15:21:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011141521.0AEFLKgU098624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 15:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367682 - in stable/12: lib/libbe tools/build/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: lib/libbe tools/build/mk X-SVN-Commit-Revision: 367682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 15:21:21 -0000 Author: kevans Date: Sat Nov 14 15:21:20 2020 New Revision: 367682 URL: https://svnweb.freebsd.org/changeset/base/367682 Log: MFC r366820-r366821: libbe(3) documentation improvements r366820: libbe(3): document be_snapshot() While toying around with lua bindings for libbe(3), I discovered that I apparently never documented this, despite having documented be_is_auto_snapshot_name that references it. r366821: libbe(3): install MLINKS for all of the functions provided Modified: stable/12/lib/libbe/Makefile stable/12/lib/libbe/libbe.3 stable/12/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libbe/Makefile ============================================================================== --- stable/12/lib/libbe/Makefile Sat Nov 14 15:19:36 2020 (r367681) +++ stable/12/lib/libbe/Makefile Sat Nov 14 15:21:20 2020 (r367682) @@ -12,6 +12,41 @@ SHLIB_MINOR= 0 SRCS= be.c be_access.c be_error.c be_info.c INCS= be.h MAN= libbe.3 +MLINKS+= libbe.3 be_activate.3 +MLINKS+= libbe.3 be_active_name.3 +MLINKS+= libbe.3 be_active_path.3 +MLINKS+= libbe.3 be_create_depth.3 +MLINKS+= libbe.3 be_create_from_existing_snap.3 +MLINKS+= libbe.3 be_create_from_existing.3 +MLINKS+= libbe.3 be_create.3 +MLINKS+= libbe.3 be_deactivate.3 +MLINKS+= libbe.3 be_destroy.3 +MLINKS+= libbe.3 be_exists.3 +MLINKS+= libbe.3 be_export.3 +MLINKS+= libbe.3 be_get_bootenv_props.3 +MLINKS+= libbe.3 be_get_dataset_props.3 +MLINKS+= libbe.3 be_get_dataset_snapshots.3 +MLINKS+= libbe.3 be_import.3 +MLINKS+= libbe.3 be_is_auto_snapshot_name.3 +MLINKS+= libbe.3 be_mount.3 +MLINKS+= libbe.3 be_mounted_at.3 +MLINKS+= libbe.3 be_nextboot_name.3 +MLINKS+= libbe.3 be_nextboot_path.3 +MLINKS+= libbe.3 be_nicenum.3 +MLINKS+= libbe.3 be_prop_list_alloc.3 +MLINKS+= libbe.3 be_prop_list_free.3 +MLINKS+= libbe.3 be_rename.3 +MLINKS+= libbe.3 be_root_concat.3 +MLINKS+= libbe.3 be_root_path.3 +MLINKS+= libbe.3 be_snapshot.3 +MLINKS+= libbe.3 be_unmount.3 +MLINKS+= libbe.3 be_validate_name.3 +MLINKS+= libbe.3 be_validate_snap.3 +MLINKS+= libbe.3 libbe_close.3 +MLINKS+= libbe.3 libbe_errno.3 +MLINKS+= libbe.3 libbe_error_description.3 +MLINKS+= libbe.3 libbe_init.3 +MLINKS+= libbe.3 libbe_print_on_error.3 WARNS?= 2 IGNORE_PRAGMA= yes Modified: stable/12/lib/libbe/libbe.3 ============================================================================== --- stable/12/lib/libbe/libbe.3 Sat Nov 14 15:19:36 2020 (r367681) +++ stable/12/lib/libbe/libbe.3 Sat Nov 14 15:21:20 2020 (r367682) @@ -58,6 +58,9 @@ .Ft const char * Ns .Fn be_root_path "libbe_handle_t *hdl" .Pp +.Ft int Ns +.Fn be_snapshot "libbe_handle_t *hdl" "const char *be_name" "const char *snap_name" "bool recursive" "char *result" +.Pp .Ft bool Ns .Fn be_is_auto_snapshot_name "libbe_handle_t *hdl" "const char *snap" .Pp @@ -214,6 +217,30 @@ active on reboot. The .Fn be_root_path function returns the boot environment root path. +.Pp +The +.Fn be_snapshot +function creates a snapshot of +.Fa be_name +named +.Fa snap_name . +A +.Dv NULL +.Fa snap_name +may be used, indicating that +.Fn be_snaphot +should derive the snapshot name from the current date and time. +If +.Fa recursive +is set, then +.Fn be_snapshot +will recursively snapshot the dataset. +If +.Fa result +is not +.Dv NULL , +then it will be populated with the final +.Dq Fa be_name Ns @ Ns Fa snap_name . .Pp The .Fn be_is_auto_snapshot_name Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Sat Nov 14 15:19:36 2020 (r367681) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Sat Nov 14 15:21:20 2020 (r367682) @@ -1394,6 +1394,41 @@ OLD_LIBS+=usr/lib32/libzpool.so.2 OLD_FILES+=usr/sbin/zfsd OLD_FILES+=usr/sbin/zhack OLD_FILES+=usr/sbin/zdb +OLD_FILES+=usr/share/man/man3/be_activate.3.gz +OLD_FILES+=usr/share/man/man3/be_active_name.3.gz +OLD_FILES+=usr/share/man/man3/be_active_path.3.gz +OLD_FILES+=usr/share/man/man3/be_create_depth.3.gz +OLD_FILES+=usr/share/man/man3/be_create_from_existing_snap.3.gz +OLD_FILES+=usr/share/man/man3/be_create_from_existing.3.gz +OLD_FILES+=usr/share/man/man3/be_create.3.gz +OLD_FILES+=usr/share/man/man3/be_deactivate.3.gz +OLD_FILES+=usr/share/man/man3/be_destroy.3.gz +OLD_FILES+=usr/share/man/man3/be_exists.3.gz +OLD_FILES+=usr/share/man/man3/be_export.3.gz +OLD_FILES+=usr/share/man/man3/be_get_bootenv_props.3.gz +OLD_FILES+=usr/share/man/man3/be_get_dataset_props.3.gz +OLD_FILES+=usr/share/man/man3/be_get_dataset_snapshots.3.gz +OLD_FILES+=usr/share/man/man3/be_import.3.gz +OLD_FILES+=usr/share/man/man3/be_is_auto_snapshot_name.3.gz +OLD_FILES+=usr/share/man/man3/be_mount.3.gz +OLD_FILES+=usr/share/man/man3/be_mounted_at.3.gz +OLD_FILES+=usr/share/man/man3/be_nextboot_name.3.gz +OLD_FILES+=usr/share/man/man3/be_nextboot_path.3.gz +OLD_FILES+=usr/share/man/man3/be_nicenum.3.gz +OLD_FILES+=usr/share/man/man3/be_prop_list_alloc.3.gz +OLD_FILES+=usr/share/man/man3/be_prop_list_free.3.gz +OLD_FILES+=usr/share/man/man3/be_rename.3.gz +OLD_FILES+=usr/share/man/man3/be_root_concat.3.gz +OLD_FILES+=usr/share/man/man3/be_root_path.3.gz +OLD_FILES+=usr/share/man/man3/be_snapshot.3.gz +OLD_FILES+=usr/share/man/man3/be_unmount.3.gz +OLD_FILES+=usr/share/man/man3/be_validate_name.3.gz +OLD_FILES+=usr/share/man/man3/be_validate_snap.3.gz +OLD_FILES+=usr/share/man/man3/libbe_close.3.gz +OLD_FILES+=usr/share/man/man3/libbe_errno.3.gz +OLD_FILES+=usr/share/man/man3/libbe_error_description.3.gz +OLD_FILES+=usr/share/man/man3/libbe_init.3.gz +OLD_FILES+=usr/share/man/man3/libbe_print_on_error.3.gz OLD_FILES+=usr/share/man/man3/libbe.3.gz OLD_FILES+=usr/share/man/man7/zpool-features.7.gz OLD_FILES+=usr/share/man/man8/bectl.8.gz From owner-svn-src-all@freebsd.org Sat Nov 14 15:26:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D9752ECA75; Sat, 14 Nov 2020 15:26:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYK1R3xYGz3KXp; Sat, 14 Nov 2020 15:26:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A27944DC; Sat, 14 Nov 2020 15:26:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEFQJsa003847; Sat, 14 Nov 2020 15:26:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEFQIwS003844; Sat, 14 Nov 2020 15:26:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011141526.0AEFQIwS003844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 15:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367683 - stable/12/lib/libbe X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/lib/libbe X-SVN-Commit-Revision: 367683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 15:26:19 -0000 Author: kevans Date: Sat Nov 14 15:26:18 2020 New Revision: 367683 URL: https://svnweb.freebsd.org/changeset/base/367683 Log: MFC r366819: libbe(3): const'ify a couple arguments libbe will never need to mutate these as we either process them into a local buffer or we just don't touch them and write to a separate out argument. Modified: stable/12/lib/libbe/be.h stable/12/lib/libbe/be_access.c stable/12/lib/libbe/be_info.c stable/12/lib/libbe/libbe.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libbe/be.h ============================================================================== --- stable/12/lib/libbe/be.h Sat Nov 14 15:21:20 2020 (r367682) +++ stable/12/lib/libbe/be.h Sat Nov 14 15:26:18 2020 (r367683) @@ -111,8 +111,8 @@ typedef enum { BE_MNT_DEEP = 1 << 1, } be_mount_opt_t; -int be_mount(libbe_handle_t *, char *, char *, int, char *); -int be_unmount(libbe_handle_t *, char *, int); +int be_mount(libbe_handle_t *, const char *, const char *, int, char *); +int be_unmount(libbe_handle_t *, const char *, int); int be_mounted_at(libbe_handle_t *, const char *path, nvlist_t *); /* Error related functions: be_error.c */ @@ -124,7 +124,7 @@ void libbe_print_on_error(libbe_handle_t *, bool); int be_root_concat(libbe_handle_t *, const char *, char *); int be_validate_name(libbe_handle_t * __unused, const char *); int be_validate_snap(libbe_handle_t *, const char *); -int be_exists(libbe_handle_t *, char *); +int be_exists(libbe_handle_t *, const char *); int be_export(libbe_handle_t *, const char *, int fd); int be_import(libbe_handle_t *, const char *, int fd); Modified: stable/12/lib/libbe/be_access.c ============================================================================== --- stable/12/lib/libbe/be_access.c Sat Nov 14 15:21:20 2020 (r367682) +++ stable/12/lib/libbe/be_access.c Sat Nov 14 15:26:18 2020 (r367683) @@ -232,8 +232,8 @@ be_mounted_at(libbe_handle_t *lbh, const char *path, n * usage */ int -be_mount(libbe_handle_t *lbh, char *bootenv, char *mountpoint, int flags, - char *result_loc) +be_mount(libbe_handle_t *lbh, const char *bootenv, const char *mountpoint, + int flags, char *result_loc) { char be[BE_MAXPATHLEN]; char mnt_temp[BE_MAXPATHLEN]; @@ -288,7 +288,7 @@ be_mount(libbe_handle_t *lbh, char *bootenv, char *mou * usage */ int -be_unmount(libbe_handle_t *lbh, char *bootenv, int flags) +be_unmount(libbe_handle_t *lbh, const char *bootenv, int flags) { int err; char be[BE_MAXPATHLEN]; Modified: stable/12/lib/libbe/be_info.c ============================================================================== --- stable/12/lib/libbe/be_info.c Sat Nov 14 15:21:20 2020 (r367682) +++ stable/12/lib/libbe/be_info.c Sat Nov 14 15:26:18 2020 (r367683) @@ -294,7 +294,7 @@ be_prop_list_free(nvlist_t *be_list) * Usage */ int -be_exists(libbe_handle_t *lbh, char *be) +be_exists(libbe_handle_t *lbh, const char *be) { char buf[BE_MAXPATHLEN]; Modified: stable/12/lib/libbe/libbe.3 ============================================================================== --- stable/12/lib/libbe/libbe.3 Sat Nov 14 15:21:20 2020 (r367682) +++ stable/12/lib/libbe/libbe.3 Sat Nov 14 15:26:18 2020 (r367683) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 16, 2019 +.Dd November 14, 2020 .Dt LIBBE 3 .Os .Sh NAME @@ -93,13 +93,13 @@ .\" BE_MNT_DEEP = 1 << 1, .\" } be_mount_opt_t .Ft int -.Fn be_mount "libbe_handle_t *hdl" "char *be_name" "char *mntpoint" "int flags" "char *result" +.Fn be_mount "libbe_handle_t *hdl" "const char *be_name" "const char *mntpoint" "int flags" "char *result" .Pp .Ft int .Fn be_mounted_at "libbe_handle_t *hdl" "const char *path" "nvlist_t *details" .Pp .Ft int -.Fn be_unmount "libbe_handle_t *hdl" "char *be_name" "int flags" +.Fn be_unmount "libbe_handle_t *hdl" "const char *be_name" "int flags" .Pp .Ft int .Fn libbe_errno "libbe_handle_t *hdl" @@ -120,7 +120,7 @@ .Fn be_validate_snap "libbe_handle_t *hdl" "const char *snap" .Pp .Ft int -.Fn be_exists "libbe_handle_t *hdl" "char *be_name" +.Fn be_exists "libbe_handle_t *hdl" "const char *be_name" .Pp .Ft int .Fn be_export "libbe_handle_t *hdl" "const char *be_name" "int fd" From owner-svn-src-all@freebsd.org Sat Nov 14 15:33:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7579E2ED1F2; Sat, 14 Nov 2020 15:33:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYK9w2vd0z3KnS; Sat, 14 Nov 2020 15:33:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56B2C4808; Sat, 14 Nov 2020 15:33:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEFXexj010281; Sat, 14 Nov 2020 15:33:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEFXedN010280; Sat, 14 Nov 2020 15:33:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011141533.0AEFXedN010280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 15:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367684 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 15:33:40 -0000 Author: kevans Date: Sat Nov 14 15:33:39 2020 New Revision: 367684 URL: https://svnweb.freebsd.org/changeset/base/367684 Log: MFC r367604: umtx: drop incorrect timespec32 definition This works for amd64, but none others -- drop it, because we already have a proper definition in sys/compat/freebsd32/freebsd32.h that correctly uses time32_t. Modified: stable/12/sys/kern/kern_umtx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_umtx.c ============================================================================== --- stable/12/sys/kern/kern_umtx.c Sat Nov 14 15:26:18 2020 (r367683) +++ stable/12/sys/kern/kern_umtx.c Sat Nov 14 15:33:39 2020 (r367684) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef COMPAT_FREEBSD32 +#include #include #endif @@ -4121,11 +4122,6 @@ sys__umtx_op(struct thread *td, struct _umtx_op_args * } #ifdef COMPAT_FREEBSD32 - -struct timespec32 { - int32_t tv_sec; - int32_t tv_nsec; -}; struct umtx_time32 { struct timespec32 timeout; From owner-svn-src-all@freebsd.org Sat Nov 14 15:44:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13D0A2ED45B; Sat, 14 Nov 2020 15:44:29 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYKQN6yltz3LMZ; Sat, 14 Nov 2020 15:44:28 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E204E4993; Sat, 14 Nov 2020 15:44:28 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEFiShD016256; Sat, 14 Nov 2020 15:44:28 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEFiScm016255; Sat, 14 Nov 2020 15:44:28 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <202011141544.0AEFiScm016255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 14 Nov 2020 15:44:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367685 - head/tests/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/tests/sys/netinet X-SVN-Commit-Revision: 367685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 15:44:29 -0000 Author: jtl Date: Sat Nov 14 15:44:28 2020 New Revision: 367685 URL: https://svnweb.freebsd.org/changeset/base/367685 Log: Add a regression test for the port-selection behavior fixed in r367680. Reviewed by: markj, olivier, tuexen Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27173 Added: head/tests/sys/netinet/tcp_connect_port_test.c (contents, props changed) Modified: head/tests/sys/netinet/Makefile Modified: head/tests/sys/netinet/Makefile ============================================================================== --- head/tests/sys/netinet/Makefile Sat Nov 14 15:33:39 2020 (r367684) +++ head/tests/sys/netinet/Makefile Sat Nov 14 15:44:28 2020 (r367685) @@ -7,7 +7,8 @@ BINDIR= ${TESTSDIR} ATF_TESTS_C= ip_reass_test \ so_reuseport_lb_test \ - socket_afinet + socket_afinet \ + tcp_connect_port_test ATF_TESTS_SH= carp fibs fibs_test redirect divert forward output lpm TEST_METADATA.output+= required_programs="python" Added: head/tests/sys/netinet/tcp_connect_port_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet/tcp_connect_port_test.c Sat Nov 14 15:44:28 2020 (r367685) @@ -0,0 +1,334 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Netflix, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define SYSCTLBAKFILE "tmp.net.inet.ip.portrange.randomized" + +/* + * Check if port allocation is randomized. If so, update it. Save the old + * value of the sysctl so it can be updated later. + */ +static void +disable_random_ports(void) +{ + int error, fd, random_new, random_save; + size_t sysctlsz; + + /* + * Pre-emptively unlink our restoration file, so we will do no + * restoration on error. + */ + unlink(SYSCTLBAKFILE); + + /* + * Disable the net.inet.ip.portrange.randomized sysctl. Save the + * old value so we can restore it, if necessary. + */ + random_new = 0; + sysctlsz = sizeof(random_save); + error = sysctlbyname("net.inet.ip.portrange.randomized", &random_save, + &sysctlsz, &random_new, sizeof(random_new)); + if (error) { + warn("sysctlbyname(\"net.inet.ip.portrange.randomized\") " + "failed"); + atf_tc_skip("Unable to set sysctl"); + } + if (sysctlsz != sizeof(random_save)) { + fprintf(stderr, "Error: unexpected sysctl value size " + "(expected %zu, actual %zu)\n", sizeof(random_save), + sysctlsz); + goto restore_sysctl; + } + + /* Open the backup file, write the contents, and close it. */ + fd = open(SYSCTLBAKFILE, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, + S_IRUSR|S_IWUSR); + if (fd < 0) { + warn("error opening sysctl backup file"); + goto restore_sysctl; + } + error = write(fd, &random_save, sizeof(random_save)); + if (error < 0) { + warn("error writing saved value to sysctl backup file"); + goto cleanup_and_restore; + } + if (error != (int)sizeof(random_save)) { + fprintf(stderr, + "Error writing saved value to sysctl backup file: " + "(expected %zu, actual %d)\n", sizeof(random_save), error); + goto cleanup_and_restore; + } + error = close(fd); + if (error) { + warn("error closing sysctl backup file"); +cleanup_and_restore: + (void)close(fd); + (void)unlink(SYSCTLBAKFILE); +restore_sysctl: + (void)sysctlbyname("net.inet.ip.portrange.randomized", NULL, + NULL, &random_save, sysctlsz); + atf_tc_skip("Error setting sysctl"); + } +} + +/* + * Restore the sysctl value from the backup file and delete the backup file. + */ +static void +restore_random_ports(void) +{ + int error, fd, random_save; + + /* Open the backup file, read the contents, close it, and delete it. */ + fd = open(SYSCTLBAKFILE, O_RDONLY); + if (fd < 0) { + warn("error opening sysctl backup file"); + return; + } + error = read(fd, &random_save, sizeof(random_save)); + if (error < 0) { + warn("error reading saved value from sysctl backup file"); + return; + } + if (error != (int)sizeof(random_save)) { + fprintf(stderr, + "Error reading saved value from sysctl backup file: " + "(expected %zu, actual %d)\n", sizeof(random_save), error); + return; + } + error = close(fd); + if (error) + warn("error closing sysctl backup file"); + error = unlink(SYSCTLBAKFILE); + if (error) + warn("error removing sysctl backup file"); + + /* Restore the saved sysctl value. */ + error = sysctlbyname("net.inet.ip.portrange.randomized", NULL, NULL, + &random_save, sizeof(random_save)); + if (error) + warn("sysctlbyname(\"net.inet.ip.portrange.randomized\") " + "failed while restoring value"); +} + +/* + * Given a domain and sockaddr, open a listening socket with automatic port + * selection. Then, try to connect 64K times. Ensure the connected socket never + * uses an overlapping port. + */ +static void +connect_loop(int domain, const struct sockaddr *addr) +{ + union { + struct sockaddr saddr; + struct sockaddr_in saddr4; + struct sockaddr_in6 saddr6; + } su_clnt, su_srvr; + socklen_t salen; + int asock, csock, error, i, lsock; + const struct linger lopt = { 1, 0 }; + + /* + * Disable the net.inet.ip.portrange.randomized sysctl. Assuming an + * otherwise idle system, this makes the kernel try all possible + * ports sequentially and makes it more likely it will try the + * port on which we have a listening socket. + */ + disable_random_ports(); + + /* Setup the listen socket. */ + lsock = socket(domain, SOCK_STREAM, 0); + ATF_REQUIRE_MSG(lsock >= 0, "socket() for listen socket failed: %s", + strerror(errno)); + error = bind(lsock, addr, addr->sa_len); + ATF_REQUIRE_MSG(error == 0, "bind() failed: %s", strerror(errno)); + error = listen(lsock, 1); + ATF_REQUIRE_MSG(error == 0, "listen() failed: %s", strerror(errno)); + + /* + * Get the address of the listen socket, which will be the destination + * address for our connection attempts. + */ + salen = sizeof(su_srvr); + error = getsockname(lsock, &su_srvr.saddr, &salen); + ATF_REQUIRE_MSG(error == 0, + "getsockname() for listen socket failed: %s", + strerror(errno)); + ATF_REQUIRE_MSG(salen == (domain == PF_INET ? + sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)), + "unexpected sockaddr size"); + ATF_REQUIRE_MSG(su_srvr.saddr.sa_len == (domain == PF_INET ? + sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)), + "unexpected sa_len size"); + + /* Open 64K connections in a loop. */ + for (i = 0; i < 65536; i++) { + csock = socket(domain, SOCK_STREAM, 0); + ATF_REQUIRE_MSG(csock >= 0, + "socket() for client socket %d failed: %s", + i, strerror(errno)); + + error = connect(csock, &su_srvr.saddr, su_srvr.saddr.sa_len); + ATF_REQUIRE_MSG(error == 0, + "connect() for client socket %d failed: %s", + i, strerror(errno)); + + error = setsockopt(csock, SOL_SOCKET, SO_LINGER, &lopt, + sizeof(lopt)); + ATF_REQUIRE_MSG(error == 0, + "Setting linger for client socket %d failed: %s", + i, strerror(errno)); + + /* Ascertain the client socket address. */ + salen = sizeof(su_clnt); + error = getsockname(csock, &su_clnt.saddr, &salen); + ATF_REQUIRE_MSG(error == 0, + "getsockname() for client socket %d failed: %s", + i, strerror(errno)); + ATF_REQUIRE_MSG(salen == (domain == PF_INET ? + sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)), + "unexpected sockaddr size for client socket %d", i); + + /* Ensure the ports do not match. */ + switch (domain) { + case PF_INET: + ATF_REQUIRE_MSG(su_clnt.saddr4.sin_port != + su_srvr.saddr4.sin_port, + "client socket %d using the same port as server", + i); + break; + case PF_INET6: + ATF_REQUIRE_MSG(su_clnt.saddr6.sin6_port != + su_srvr.saddr6.sin6_port, + "client socket %d using the same port as server", + i); + break; + } + + /* Accept the socket and close both ends. */ + asock = accept(lsock, NULL, NULL); + ATF_REQUIRE_MSG(asock >= 0, + "accept() failed for client socket %d: %s", + i, strerror(errno)); + + error = close(asock); + ATF_REQUIRE_MSG(error == 0, + "close() failed for accepted socket %d: %s", + i, strerror(errno)); + + error = close(csock); + ATF_REQUIRE_MSG(error == 0, + "close() failed for client socket %d: %s", + i, strerror(errno)); + } +} + +ATF_TC_WITH_CLEANUP(basic_ipv4); +ATF_TC_HEAD(basic_ipv4, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "descr", + "Check automatic local port assignment during TCP connect calls"); +} + +ATF_TC_BODY(basic_ipv4, tc) +{ + struct sockaddr_in saddr4; + + memset(&saddr4, 0, sizeof(saddr4)); + saddr4.sin_len = sizeof(saddr4); + saddr4.sin_family = AF_INET; + saddr4.sin_port = htons(0); + saddr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + connect_loop(PF_INET, (const struct sockaddr *)&saddr4); +} + +ATF_TC_CLEANUP(basic_ipv4, tc) +{ + + restore_random_ports(); +} + +ATF_TC_WITH_CLEANUP(basic_ipv6); +ATF_TC_HEAD(basic_ipv6, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "descr", + "Check automatic local port assignment during TCP connect calls"); +} + +ATF_TC_BODY(basic_ipv6, tc) +{ + struct sockaddr_in6 saddr6; + + memset(&saddr6, 0, sizeof(saddr6)); + saddr6.sin6_len = sizeof(saddr6); + saddr6.sin6_family = AF_INET6; + saddr6.sin6_port = htons(0); + saddr6.sin6_addr = in6addr_loopback; + + connect_loop(PF_INET6, (const struct sockaddr *)&saddr6); +} + +ATF_TC_CLEANUP(basic_ipv6, tc) +{ + + restore_random_ports(); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, basic_ipv4); + ATF_TP_ADD_TC(tp, basic_ipv6); + + return (atf_no_error()); +} + From owner-svn-src-all@freebsd.org Sat Nov 14 15:59:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B43C2ED87F; Sat, 14 Nov 2020 15:59:09 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYKlJ6TJrz3MBm; Sat, 14 Nov 2020 15:59:08 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 0AEFx1lT071547; Sat, 14 Nov 2020 07:59:01 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 0AEFx1j0071546; Sat, 14 Nov 2020 07:59:01 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202011141559.0AEFx1j0071546@gndrsh.dnsmgr.net> Subject: Re: svn commit: r367678 - head/usr.sbin/freebsd-update In-Reply-To: <202011141307.0AED7fuL017641@repo.freebsd.org> To: Mateusz Piotrowski <0mp@freebsd.org> Date: Sat, 14 Nov 2020 07:59:01 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4CYKlJ6TJrz3MBm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 15:59:09 -0000 > Author: 0mp (doc,ports committer) > Date: Sat Nov 14 13:07:41 2020 > New Revision: 367678 > URL: https://svnweb.freebsd.org/changeset/base/367678 > > Log: > Document the PAGER environment variable > > Sometimes users want to use freebsd-update(8) in a non-interactive way and > what they often miss is that they have to set PAGER to cat(1) in order to > avoid interactive prompts from less(1). Which was caused by the change of invoking more(1) as less(1) causing this regression, as when invoked as more(1) it falls off the end of empty input and causes no such interactive prompt. Setting PAGER to more(1) also fixes this. > > MFC after: 4 weeks > > Modified: > head/usr.sbin/freebsd-update/freebsd-update.8 > > Modified: head/usr.sbin/freebsd-update/freebsd-update.8 > ============================================================================== > --- head/usr.sbin/freebsd-update/freebsd-update.8 Sat Nov 14 12:02:50 2020 (r367677) > +++ head/usr.sbin/freebsd-update/freebsd-update.8 Sat Nov 14 13:07:41 2020 (r367678) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd September 24, 2019 > +.Dd November 14, 2020 > .Dt FREEBSD-UPDATE 8 > .Os > .Sh NAME > @@ -193,6 +193,20 @@ System", since if the system has been tampered with > it cannot be trusted to operate correctly. > If you intend to use this command for intrusion-detection > purposes, make sure you boot from a secure disk (e.g., a CD). > +.El > +.Sh ENVIRONMENT > +.Bl -tag -width "PAGER" > +.It Ev PAGER > +The pager program used to present various reports during the execution. > +.Po > +Default: > +.Dq Pa /usr/bin/less . > +.Pc > +.Pp > +.Ev PAGER > +can be set to > +.Dq cat > +when a non-interactive pager is desired. > .El > .Sh FILES > .Bl -tag -width "/etc/freebsd-update.conf" > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Nov 14 17:20:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8FFD2EF5B8; Sat, 14 Nov 2020 17:20:17 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYMXx5h2gz3Qkb; Sat, 14 Nov 2020 17:20:17 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ej1-f47.google.com with SMTP id o9so18418990ejg.1; Sat, 14 Nov 2020 09:20:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=a9HfmkRuWN4ALXjejuh0c4dQzjUTUQYzulgSERPPtmY=; b=G6R16ECNCMbJ86QV8G1giu2T/J3Ebgf2dIiZJBczDPEsxCRwRnebp0fIpO+cwwcYxA UWQ9YipNzVEONNsNtjWtPWtztXK4IF0HyYRJ0QsQ2uSAfIOKEYG1vgtMjvdBBJ/qYS04 eVjmI1JFP8SF4uLbfL7Fy5MENj7hqLaeLSgj+DBOmQLZYs4t/FYrMukFr2kiBwvB8Pjm iZtJ2N1gy+PxK4/NXcLJgYu4Kh+mLUXjGeBUhd17V1v5ZFvspJEsZ52T21B8xWjP7TF+ rQXz7G5XgMm+tBA0lDrV4sp3h+uGXiCb7i9srGoMmVcE8Cc5SfaOiWK+swMwGcYQ9wWh lLag== X-Gm-Message-State: AOAM5302DyowqC5REmi58VrXmRgXHQ+/j9vCin8HKWh6sKdhVo4W5633 ONPUk/cT5YjKwh/J7WE9GFeJTODSAGM= X-Google-Smtp-Source: ABdhPJx+ikwiAIXfxqRVYxbNyuxIam+KU9gNr1Gs5Ueru276DgOw4uBprNQAtUM1PfjL0ksCnvrcvQ== X-Received: by 2002:a17:906:d20a:: with SMTP id w10mr7519403ejz.3.1605374415839; Sat, 14 Nov 2020 09:20:15 -0800 (PST) Received: from ?IPv6:2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8? ([2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8]) by smtp.gmail.com with ESMTPSA id m26sm6963049ejb.45.2020.11.14.09.20.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 Nov 2020 09:20:15 -0800 (PST) Subject: Re: svn commit: r367678 - head/usr.sbin/freebsd-update To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011141559.0AEFx1j0071546@gndrsh.dnsmgr.net> From: Mateusz Piotrowski <0mp@FreeBSD.org> Message-ID: Date: Sat, 14 Nov 2020 18:20:19 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <202011141559.0AEFx1j0071546@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 4CYMXx5h2gz3Qkb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 17:20:17 -0000 Hello Rodney, On 11/14/20 4:59 PM, Rodney W. Grimes wrote: >> Author: 0mp (doc,ports committer) >> Date: Sat Nov 14 13:07:41 2020 >> New Revision: 367678 >> URL: https://svnweb.freebsd.org/changeset/base/367678 >> >> Log: >> Document the PAGER environment variable >> >> Sometimes users want to use freebsd-update(8) in a non-interactive way and >> what they often miss is that they have to set PAGER to cat(1) in order to >> avoid interactive prompts from less(1). > Which was caused by the change of invoking more(1) as less(1) causing > this regression, as when invoked as more(1) it falls off the end of > empty input and causes no such interactive prompt. > > Setting PAGER to more(1) also fixes this. Mmm, I'm not sure if that would work. If I run "jot 1000 | more" in my terminal I still get an interactive prompt. Could it be that you are referring to a different more(1) implementation? I'm clearly missing something. From owner-svn-src-all@freebsd.org Sat Nov 14 17:49:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8328B460CD7; Sat, 14 Nov 2020 17:49:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYNBg3Gb0z3jTl; Sat, 14 Nov 2020 17:49:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 5DFB0DBD9; Sat, 14 Nov 2020 17:49:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f41.google.com with SMTP id e5so6639404qvs.1; Sat, 14 Nov 2020 09:49:31 -0800 (PST) X-Gm-Message-State: AOAM532MQDNKAk6qPAhhbaRvpks2lM4ZX0U30T0tLU7EWqfE0R3Og3A5 ZGhntgHY3BUfwTpYdKzXxRCVtiv7+k8/frzJuwg= X-Google-Smtp-Source: ABdhPJxiQUG6KluASavAyNmdAnueVemt7Z6CnQM2W2Rme7w6vm37clML5HCU8u5Jv6iZMviAtDSshWmUo3ctl31JTw0= X-Received: by 2002:a05:6214:2e1:: with SMTP id h1mr7885273qvu.60.1605376170905; Sat, 14 Nov 2020 09:49:30 -0800 (PST) MIME-Version: 1.0 References: <202011141559.0AEFx1j0071546@gndrsh.dnsmgr.net> In-Reply-To: From: Kyle Evans Date: Sat, 14 Nov 2020 11:49:19 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r367678 - head/usr.sbin/freebsd-update To: Mateusz Piotrowski <0mp@freebsd.org> Cc: "Rodney W. Grimes" , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 17:49:31 -0000 On Sat, Nov 14, 2020 at 11:20 AM Mateusz Piotrowski <0mp@freebsd.org> wrote: > > Hello Rodney, > > On 11/14/20 4:59 PM, Rodney W. Grimes wrote: > >> Author: 0mp (doc,ports committer) > >> Date: Sat Nov 14 13:07:41 2020 > >> New Revision: 367678 > >> URL: https://svnweb.freebsd.org/changeset/base/367678 > >> > >> Log: > >> Document the PAGER environment variable > >> > >> Sometimes users want to use freebsd-update(8) in a non-interactive way and > >> what they often miss is that they have to set PAGER to cat(1) in order to > >> avoid interactive prompts from less(1). > > Which was caused by the change of invoking more(1) as less(1) causing > > this regression, as when invoked as more(1) it falls off the end of > > empty input and causes no such interactive prompt. > > > > Setting PAGER to more(1) also fixes this. > > Mmm, I'm not sure if that would work. If I run "jot 1000 | more" in my terminal I still get an > interactive prompt. Could it be that you are referring to a different more(1) implementation? I'm > clearly missing something. > more(1) is more or less like `less -E`, which is a default PAGER I had advocated for back when it changed. It can be mostly non-interactive as long as your diffs are small, but it's definitely much less painful. From owner-svn-src-all@freebsd.org Sat Nov 14 17:57:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 967C9461188; Sat, 14 Nov 2020 17:57:51 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYNNH3tNWz3kKs; Sat, 14 Nov 2020 17:57:51 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 783A76290; Sat, 14 Nov 2020 17:57:51 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEHvpMU098204; Sat, 14 Nov 2020 17:57:51 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEHvo1m098201; Sat, 14 Nov 2020 17:57:50 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <202011141757.0AEHvo1m098201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 14 Nov 2020 17:57:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367686 - head/lib/libutil X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/lib/libutil X-SVN-Commit-Revision: 367686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 17:57:51 -0000 Author: scottl Date: Sat Nov 14 17:57:50 2020 New Revision: 367686 URL: https://svnweb.freebsd.org/changeset/base/367686 Log: Add the library function getlocalbase and its manual page. This helps to unify the retrieval of the various ways that the local software base directory, typically "/usr/local", is expressed in the system. Reviewed by: se Differential Revision: https://reviews.freebsd.org/D27022 Added: head/lib/libutil/getlocalbase.3 (contents, props changed) head/lib/libutil/getlocalbase.c (contents, props changed) Modified: head/lib/libutil/Makefile head/lib/libutil/libutil.h Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Sat Nov 14 15:44:28 2020 (r367685) +++ head/lib/libutil/Makefile Sat Nov 14 17:57:50 2020 (r367686) @@ -12,7 +12,8 @@ PACKAGE= runtime LIB= util SHLIB_MAJOR= 9 -SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ +SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c \ + getlocalbase.c gr_util.c \ hexdump.c humanize_number.c kinfo_getfile.c \ kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c \ kinfo_getvmobject.c kld.c \ @@ -30,7 +31,7 @@ CFLAGS+= -DINET6 CFLAGS+= -I${.CURDIR} -I${SRCTOP}/lib/libc/gen/ -MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \ +MAN+= expand_number.3 flopen.3 fparseln.3 getlocalbase.3 hexdump.3 \ humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ login_auth.3 login_cap.3 \ Added: head/lib/libutil/getlocalbase.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libutil/getlocalbase.3 Sat Nov 14 17:57:50 2020 (r367686) @@ -0,0 +1,110 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright 2020 Scott Long +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd Oct 28, 2020 +.Dt GETLOCALBASE 3 +.Os +.Sh NAME +.Nm getlocalbase +.Nd "return the path to the local software directory" +.Sh LIBRARY +.Lb libutil +.Sh SYNOPSIS +.In libutil.h +.Ft ssize_t +.Fn getlocalbase "char *path" "size_t len" +.Sh DESCRIPTION +The +.Fn getlocalbase +function returns the path to the local software base directory. +Normally this is the +.Pa /usr/local +directory. +First the +.Ev LOCALBASE +environment variable is checked. +If that doesn't exist then the +.Va user.localbase +sysctl is checked. +If that also doesn't exist then the value of the +.Dv _PATH_LOCALBASE +compile-time variable is used. +If that is undefined then the default of +.Pa /usr/local +is used. +.Pp +The +.Fa path +argument points to a caller-supplied buffer to hold the resulting pathname. +The +.Fa len +argument is the length of the caller-supplied buffer. +.Sh IMPLEMENTATION NOTES +Calls to +.Fn getlocalpath +will perform a setugid check on the running binary before checking the +environment. +.Sh RETURN VALUES +If the request completes without error, the size of the string copied into the +buffer, including the terminating NUL, is returned. +If an error occurred or the buffer was too small to hold the string, +.Fn getlocalbase +returns -1 and sets +.Em errno +to indicate the error condition. +.Sh ENVIRONMENT +The +.Fn getlocalbase +library function retrieves the +.Ev LOCALBASE +environment variable. +.Sh ERRORS +The +.Fn getlocalbase +function will fail and set +.Va errno +for the following conditions: +.Bl -tag -width Er +.It Bq Er EINVAL +One of the passed in parameters is NULL or zero. +.It Bq Er ENOMEM +There isn't enough space in the passed in buffer to hold the pathname string. +.El +.Sh SEE ALSO +.Xr env 1 , +.Xr src.conf 5 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +library function first appeared in +.Fx 13.0 . +.Sh AUTHORS +This +manual page was written by +.An Scott Long Aq Mt scottl@FreeBSD.org . Added: head/lib/libutil/getlocalbase.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libutil/getlocalbase.c Sat Nov 14 17:57:50 2020 (r367686) @@ -0,0 +1,75 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2020 Scott Long + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +ssize_t +getlocalbase(char *path, size_t pathlen) +{ + size_t tmplen; + const char *tmppath; + + if ((pathlen == 0) || (path == NULL)) { + errno = EINVAL; + return (-1); + } + + tmppath = NULL; + tmplen = pathlen; + if (issetugid() == 0) + tmppath = getenv("LOCALBASE"); + + if ((tmppath == NULL) && + (sysctlbyname("user.localbase", path, &tmplen, NULL, 0) == 0)) { + return (tmplen); + } + + if (tmppath == NULL) +#ifdef _PATH_LOCALBASE + tmppath = _PATH_LOCALBASE; +#else + tmppath = "/usr/local"; +#endif + + tmplen = strlcpy(path, tmppath, pathlen); + if ((tmplen < 0) || (tmplen >= (ssize_t)pathlen)) { + errno = ENOMEM; + tmplen = -1; + } + + return (tmplen); +} Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Sat Nov 14 15:44:28 2020 (r367685) +++ head/lib/libutil/libutil.h Sat Nov 14 17:57:50 2020 (r367686) @@ -98,6 +98,7 @@ int flopen(const char *_path, int _flags, ...); int flopenat(int _dirfd, const char *_path, int _flags, ...); int forkpty(int *_amaster, char *_name, struct termios *_termp, struct winsize *_winp); +ssize_t getlocalbase(char *path, size_t pathlen); void hexdump(const void *_ptr, int _length, const char *_hdr, int _flags); int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); From owner-svn-src-all@freebsd.org Sat Nov 14 18:01:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92C6546128D; Sat, 14 Nov 2020 18:01:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYNSD3pftz3kNq; Sat, 14 Nov 2020 18:01:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75A59605C; Sat, 14 Nov 2020 18:01:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEI1GX2000293; Sat, 14 Nov 2020 18:01:16 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEI1FCM000287; Sat, 14 Nov 2020 18:01:15 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <202011141801.0AEI1FCM000287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 14 Nov 2020 18:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367687 - in head: sbin/nvmecontrol usr.sbin/mailwrapper usr.sbin/pkg X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head: sbin/nvmecontrol usr.sbin/mailwrapper usr.sbin/pkg X-SVN-Commit-Revision: 367687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 18:01:16 -0000 Author: scottl Date: Sat Nov 14 18:01:14 2020 New Revision: 367687 URL: https://svnweb.freebsd.org/changeset/base/367687 Log: Replace hardcoded references to _PATH_LOCALBASE with calls to getlocalbase.3 Reviewed by: imp, se Modified: head/sbin/nvmecontrol/comnd.c head/sbin/nvmecontrol/comnd.h head/sbin/nvmecontrol/nvmecontrol.c head/usr.sbin/mailwrapper/mailwrapper.c head/usr.sbin/pkg/Makefile head/usr.sbin/pkg/pkg.c Modified: head/sbin/nvmecontrol/comnd.c ============================================================================== --- head/sbin/nvmecontrol/comnd.c Sat Nov 14 17:57:50 2020 (r367686) +++ head/sbin/nvmecontrol/comnd.c Sat Nov 14 18:01:14 2020 (r367687) @@ -287,7 +287,7 @@ bad_arg: * Loads all the .so's from the specified directory. */ void -cmd_load_dir(const char *dir __unused, cmd_load_cb_t cb __unused, void *argp __unused) +cmd_load_dir(char *dir, cmd_load_cb_t cb, void *argp) { DIR *d; struct dirent *dent; Modified: head/sbin/nvmecontrol/comnd.h ============================================================================== --- head/sbin/nvmecontrol/comnd.h Sat Nov 14 17:57:50 2020 (r367686) +++ head/sbin/nvmecontrol/comnd.h Sat Nov 14 18:01:14 2020 (r367687) @@ -96,7 +96,7 @@ void cmd_register(struct cmd *, struct cmd *); int arg_parse(int argc, char * const *argv, const struct cmd *f); void arg_help(int argc, char * const *argv, const struct cmd *f); void cmd_init(void); -void cmd_load_dir(const char *dir, cmd_load_cb_t *cb, void *argp); +void cmd_load_dir(char *dir, cmd_load_cb_t *cb, void *argp); int cmd_dispatch(int argc, char *argv[], const struct cmd *); #endif /* COMND_H */ Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Sat Nov 14 17:57:50 2020 (r367686) +++ head/sbin/nvmecontrol/nvmecontrol.c Sat Nov 14 18:01:14 2020 (r367687) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -178,11 +179,17 @@ get_nsid(int fd, char **ctrlr_str, uint32_t *nsid) int main(int argc, char *argv[]) { + char locallib[MAXPATHLEN]; + size_t len; cmd_init(); - cmd_load_dir("/lib/nvmecontrol", NULL, NULL); - cmd_load_dir(_PATH_LOCALBASE "/lib/nvmecontrol", NULL, NULL); + snprintf(locallib, MAXPATHLEN, "/lib/nvmecontrol"); + cmd_load_dir(locallib, NULL, NULL); + if ((len = getlocalbase(locallib, MAXPATHLEN)) > 0) { + strlcat(locallib, "/lib/nvmecontrol", MAXPATHLEN - len); + cmd_load_dir(locallib, NULL, NULL); + } cmd_dispatch(argc, argv, NULL); Modified: head/usr.sbin/mailwrapper/mailwrapper.c ============================================================================== --- head/usr.sbin/mailwrapper/mailwrapper.c Sat Nov 14 17:57:50 2020 (r367686) +++ head/usr.sbin/mailwrapper/mailwrapper.c Sat Nov 14 18:01:14 2020 (r367687) @@ -105,8 +105,10 @@ main(int argc, char *argv[], char *envp[]) initarg(&al); addarg(&al, argv[0]); - snprintf(localmailerconf, MAXPATHLEN, "%s/etc/mail/mailer.conf", - getenv("LOCALBASE") ? getenv("LOCALBASE") : _PATH_LOCALBASE); + if ((len = getlocalbase(localmailerconf, MAXPATHLEN)) != 0) + err(EX_OSERR, "cannot determine local path"); + + strlcat(localmailerconf, "/etc/mail/mailer.conf", MAXPATHLEN - len); mailerconf = localmailerconf; if ((config = fopen(localmailerconf, "r")) == NULL) Modified: head/usr.sbin/pkg/Makefile ============================================================================== --- head/usr.sbin/pkg/Makefile Sat Nov 14 17:57:50 2020 (r367686) +++ head/usr.sbin/pkg/Makefile Sat Nov 14 18:01:14 2020 (r367687) @@ -25,6 +25,6 @@ MAN= pkg.7 CFLAGS+=-I${SRCTOP}/contrib/libucl/include .PATH: ${SRCTOP}/contrib/libucl/include -LIBADD= archive fetch ucl sbuf crypto ssl +LIBADD= archive fetch ucl sbuf crypto ssl util .include Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Sat Nov 14 17:57:50 2020 (r367686) +++ head/usr.sbin/pkg/pkg.c Sat Nov 14 18:01:14 2020 (r367687) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1037,6 +1038,7 @@ main(int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; const char *pkgarg; + size_t len; int i; bool bootstrap_only, force, yes; @@ -1045,8 +1047,11 @@ main(int argc, char *argv[]) pkgarg = NULL; yes = false; - snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", - getenv("LOCALBASE") ? getenv("LOCALBASE") : _PATH_LOCALBASE); + if ((len = getlocalbase(pkgpath, MAXPATHLEN)) != 0) { + fprintf(stderr, "Cannot determine local path\n"); + exit(EXIT_FAILURE); + } + strlcat(pkgpath, "/sbin/pkg", MAXPATHLEN - len); if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) { bootstrap_only = true; From owner-svn-src-all@freebsd.org Sat Nov 14 18:06:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 489084612B2; Sat, 14 Nov 2020 18:06:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYNZN1bHFz3kkY; Sat, 14 Nov 2020 18:06:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29EA46262; Sat, 14 Nov 2020 18:06:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEI6Zi1006838; Sat, 14 Nov 2020 18:06:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEI6ZhB006837; Sat, 14 Nov 2020 18:06:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011141806.0AEI6ZhB006837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 18:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367688 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 18:06:36 -0000 Author: kevans Date: Sat Nov 14 18:06:35 2020 New Revision: 367688 URL: https://svnweb.freebsd.org/changeset/base/367688 Log: Makefile: re-wordsmith the blurb about xtoolchain ports The new version only includes a specific version once, and uses the one that's currently advised by tinderbox: -gcc6. It also advises just installing the pkg, but mentions in a side-note at the end where to find the source in the ports tree. Reviewed by: jrtc27 Suggested by: jhb (use default from tinderbox) Differential Revision: https://reviews.freebsd.org/D26820 Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Sat Nov 14 18:01:14 2020 (r367687) +++ head/Makefile Sat Nov 14 18:06:35 2020 (r367688) @@ -89,14 +89,16 @@ # 10. `reboot' # 11. `make delete-old-libs' (in case no 3rd party program uses them anymore) # -# For individuals wanting to build from source with GCC from ports, first build -# or install an appropriate flavor of devel/freebsd-gcc9. The packages produced -# by this port are named "${TARGET_ARCH}-gcc9" -- note that not all -# architectures supported by FreeBSD have an external gcc toolchain available. +# For individuals wanting to build from source with GCC from ports, first +# install the appropriate GCC cross toolchain package: +# `pkg install ${TARGET_ARCH}-gccN` # -# Once the appropriate freebsd-gcc package is installed, simply pass -# CROSS_TOOLCHAIN=${TARGET_ARCH}-gcc9 while building with the above steps, -# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc9`. +# Once you have installed the necessary cross toolchain, simply pass +# CROSS_TOOLCHAIN=${TARGET_ARCH}-gccN while building with the above steps, +# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc6`. +# +# The ${TARGET_ARCH}-gccN packages are provided as flavors of the +# devel/freebsd-gccN ports. # # See src/UPDATING `COMMON ITEMS' for more complete information. # From owner-svn-src-all@freebsd.org Sat Nov 14 18:43:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22A5846239C; Sat, 14 Nov 2020 18:43:39 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYPP70YCXz3mYx; Sat, 14 Nov 2020 18:43:39 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p4fd3a1f5.dip0.t-ipconnect.de [79.211.161.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 729D6ED81; Sat, 14 Nov 2020 18:43:38 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Sat, 14 Nov 2020 19:43:38 +0100 From: Gordon Bergling To: Scott Long Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367686 - head/lib/libutil Message-ID: References: <202011141757.0AEHvo1m098201@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202011141757.0AEHvo1m098201@repo.freebsd.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 7:40PM up 3 days, 1:46, 4 users, load averages: 0.29, 0.34, 0.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 18:43:39 -0000 Hi Scott, this somehow breaks the build. --------------------------------------------------------------------- ===> lib/msun (obj,all,install) /tank/nfs_public/tiny/src/lib/libutil/getlocalbase.c:69:30: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'ssize_t' (aka 'long') [-Werror,-Wsign-compare] if ((tmplen < 0) || (tmplen >= (ssize_t)pathlen)) { ~~~~~~ ^ ~~~~~~~~~~~~~~~~ 1 error generated. --- getlocalbase.o --- *** [getlocalbase.o] Error code 1 ..................................................................... Got this on arm64 with the following src.conf: WITH_MALLOC_PRODUCTION=1 WITH_EXTRA_TCP_STACKS=1 WITH_BEARSSL=1 WITH_PIE=1 WITH_RETPOLINE=1 --Gordon On Sat, Nov 14, 2020 at 05:57:50PM +0000, Scott Long wrote: > Author: scottl > Date: Sat Nov 14 17:57:50 2020 > New Revision: 367686 > URL: https://svnweb.freebsd.org/changeset/base/367686 > > Log: > Add the library function getlocalbase and its manual page. This helps to > unify the retrieval of the various ways that the local software base directory, > typically "/usr/local", is expressed in the system. > > Reviewed by: se > Differential Revision: https://reviews.freebsd.org/D27022 > > Added: > head/lib/libutil/getlocalbase.3 (contents, props changed) > head/lib/libutil/getlocalbase.c (contents, props changed) > Modified: > head/lib/libutil/Makefile > head/lib/libutil/libutil.h > > Modified: head/lib/libutil/Makefile > ============================================================================== > --- head/lib/libutil/Makefile Sat Nov 14 15:44:28 2020 (r367685) > +++ head/lib/libutil/Makefile Sat Nov 14 17:57:50 2020 (r367686) > @@ -12,7 +12,8 @@ PACKAGE= runtime > LIB= util > SHLIB_MAJOR= 9 > > -SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ > +SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c \ > + getlocalbase.c gr_util.c \ > hexdump.c humanize_number.c kinfo_getfile.c \ > kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c \ > kinfo_getvmobject.c kld.c \ > @@ -30,7 +31,7 @@ CFLAGS+= -DINET6 > > CFLAGS+= -I${.CURDIR} -I${SRCTOP}/lib/libc/gen/ > > -MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \ > +MAN+= expand_number.3 flopen.3 fparseln.3 getlocalbase.3 hexdump.3 \ > humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ > kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ > login_auth.3 login_cap.3 \ > > Added: head/lib/libutil/getlocalbase.3 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libutil/getlocalbase.3 Sat Nov 14 17:57:50 2020 (r367686) > @@ -0,0 +1,110 @@ > +.\" > +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD > +.\" > +.\" Copyright 2020 Scott Long > +.\" > +.\" Redistribution and use in source and binary forms, with or without > +.\" modification, are permitted provided that the following conditions > +.\" are met: > +.\" 1. Redistributions of source code must retain the above copyright > +.\" notice, this list of conditions and the following disclaimer. > +.\" 2. Redistributions in binary form must reproduce the above copyright > +.\" notice, this list of conditions and the following disclaimer in the > +.\" documentation and/or other materials provided with the distribution. > +.\" > +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > +.\" SUCH DAMAGE. > +.\" > +.\" $FreeBSD$ > +.\" > +.Dd Oct 28, 2020 > +.Dt GETLOCALBASE 3 > +.Os > +.Sh NAME > +.Nm getlocalbase > +.Nd "return the path to the local software directory" > +.Sh LIBRARY > +.Lb libutil > +.Sh SYNOPSIS > +.In libutil.h > +.Ft ssize_t > +.Fn getlocalbase "char *path" "size_t len" > +.Sh DESCRIPTION > +The > +.Fn getlocalbase > +function returns the path to the local software base directory. > +Normally this is the > +.Pa /usr/local > +directory. > +First the > +.Ev LOCALBASE > +environment variable is checked. > +If that doesn't exist then the > +.Va user.localbase > +sysctl is checked. > +If that also doesn't exist then the value of the > +.Dv _PATH_LOCALBASE > +compile-time variable is used. > +If that is undefined then the default of > +.Pa /usr/local > +is used. > +.Pp > +The > +.Fa path > +argument points to a caller-supplied buffer to hold the resulting pathname. > +The > +.Fa len > +argument is the length of the caller-supplied buffer. > +.Sh IMPLEMENTATION NOTES > +Calls to > +.Fn getlocalpath > +will perform a setugid check on the running binary before checking the > +environment. > +.Sh RETURN VALUES > +If the request completes without error, the size of the string copied into the > +buffer, including the terminating NUL, is returned. > +If an error occurred or the buffer was too small to hold the string, > +.Fn getlocalbase > +returns -1 and sets > +.Em errno > +to indicate the error condition. > +.Sh ENVIRONMENT > +The > +.Fn getlocalbase > +library function retrieves the > +.Ev LOCALBASE > +environment variable. > +.Sh ERRORS > +The > +.Fn getlocalbase > +function will fail and set > +.Va errno > +for the following conditions: > +.Bl -tag -width Er > +.It Bq Er EINVAL > +One of the passed in parameters is NULL or zero. > +.It Bq Er ENOMEM > +There isn't enough space in the passed in buffer to hold the pathname string. > +.El > +.Sh SEE ALSO > +.Xr env 1 , > +.Xr src.conf 5 , > +.Xr sysctl 8 > +.Sh HISTORY > +The > +.Nm > +library function first appeared in > +.Fx 13.0 . > +.Sh AUTHORS > +This > +manual page was written by > +.An Scott Long Aq Mt scottl@FreeBSD.org . > > Added: head/lib/libutil/getlocalbase.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libutil/getlocalbase.c Sat Nov 14 17:57:50 2020 (r367686) > @@ -0,0 +1,75 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright 2020 Scott Long > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +ssize_t > +getlocalbase(char *path, size_t pathlen) > +{ > + size_t tmplen; > + const char *tmppath; > + > + if ((pathlen == 0) || (path == NULL)) { > + errno = EINVAL; > + return (-1); > + } > + > + tmppath = NULL; > + tmplen = pathlen; > + if (issetugid() == 0) > + tmppath = getenv("LOCALBASE"); > + > + if ((tmppath == NULL) && > + (sysctlbyname("user.localbase", path, &tmplen, NULL, 0) == 0)) { > + return (tmplen); > + } > + > + if (tmppath == NULL) > +#ifdef _PATH_LOCALBASE > + tmppath = _PATH_LOCALBASE; > +#else > + tmppath = "/usr/local"; > +#endif > + > + tmplen = strlcpy(path, tmppath, pathlen); > + if ((tmplen < 0) || (tmplen >= (ssize_t)pathlen)) { > + errno = ENOMEM; > + tmplen = -1; > + } > + > + return (tmplen); > +} > > Modified: head/lib/libutil/libutil.h > ============================================================================== > --- head/lib/libutil/libutil.h Sat Nov 14 15:44:28 2020 (r367685) > +++ head/lib/libutil/libutil.h Sat Nov 14 17:57:50 2020 (r367686) > @@ -98,6 +98,7 @@ int flopen(const char *_path, int _flags, ...); > int flopenat(int _dirfd, const char *_path, int _flags, ...); > int forkpty(int *_amaster, char *_name, > struct termios *_termp, struct winsize *_winp); > +ssize_t getlocalbase(char *path, size_t pathlen); > void hexdump(const void *_ptr, int _length, const char *_hdr, int _flags); > int humanize_number(char *_buf, size_t _len, int64_t _number, > const char *_suffix, int _scale, int _flags); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" -- From owner-svn-src-all@freebsd.org Sat Nov 14 18:44:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B6214624D7; Sat, 14 Nov 2020 18:44:32 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYPQ772TSz3n52; Sat, 14 Nov 2020 18:44:31 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 1D6F65C007C; Sat, 14 Nov 2020 13:44:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 14 Nov 2020 13:44:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=u OSBZkwg6n90URinrQFe4mhxcvXoccMmEvK1o8n7VEc=; b=WM0u5i5JnuytGM14j 57EIwcCNHEupn6PzTpZ8l/hAFdHJ+ViyIT914vPHCzL4ujHDnQ8Md0qqPvqTh8HP T4yVgLGxYWznW/1OOhGCfD9jvwb2o7P7hPwoD8DszEit5cqJVyACEb6dk469GCN1 xdLPtTD0/Gdy3y1T/Bor/sghJjyxEqx//yzfM7Z+bDwFcJqlhdsyivWGuIFYNOwG VtoXNqjHAOZVYjKryRZW2dKLIMnh+1/b4XYhqzg93vrYCibZ6CVeU3YCqyOxms9w ErROWZQD4Hv4LOjhil5B10xojXb5kFgCDG+jNBoFF4ccwEX+UYBLLCWg8m2uDFDO w5VSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=uOSBZkwg6n90URinrQFe4mhxcvXoccMmEvK1o8n7V Ec=; b=LzStyPMw25aixPTgpwPIZi2xm9AKswE4v1779JenCX/lcKR8MlsFB0NK4 m0awvxODOwBOk/aWddoDSLtpiv8V4I1icZRs1l/PcHufFH2RnuPZIdE8QhSaaUi9 7Ks7ULgaNa42gJgrjiE1fh5G0Ijr56qWInGWc8ZBhvhW+3wj0neBn98qnzsJgwkF BY2ySP2NLOFTOyGfWDA8gUJuIVMUgq9hx8DZGydCqHoHgxC50K/tFOA5w8U13XJT htJdpqNAHa9QkLnfUVSYGlqgyW7d9U0bGkpv782OH8ySBah/wW8+iHALwg9BTIXc +Au5BfFuddRkgT1Fc5WOzjOQVYJ2g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvjedguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enufhorhhtvgguuchrvggtihhpshculdegtddmnecujfgurheptggguffhjgffgffkfhfv ofesthhqmhdthhdtjeenucfhrhhomhepufgtohhtthcunfhonhhguceoshgtohhtthhlse hsrghmshgtohdrohhrgheqnecuggftrfgrthhtvghrnhepuefggfdtheduueduteeluddt tdfgffegjeejtedtfffgteeugeegudffvedvtefgnecuffhomhgrihhnpehfrhgvvggssh gurdhorhhgpdhthhgvrdhprgdpohhfrdhprgenucfkphepkedrgeeirdekledrvddufeen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehstghoth htlhesshgrmhhstghordhorhhg X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id 570AD3280065; Sat, 14 Nov 2020 13:44:30 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: svn commit: r367686 - head/lib/libutil From: Scott Long In-Reply-To: Date: Sat, 14 Nov 2020 11:44:29 -0700 Cc: Scott Long , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2236AF89-1624-46B1-A170-7C7B5B4BB5E6@samsco.org> References: <202011141757.0AEHvo1m098201@repo.freebsd.org> To: Gordon Bergling X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CYPQ772TSz3n52 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 18:44:32 -0000 Hi, Yeah, I=E2=80=99m working on a fix, sorry. I made a last minute change = that I thought I had tested, but apparently hadn=E2=80=99t. Scott > On Nov 14, 2020, at 11:43 AM, Gordon Bergling wrote: >=20 > Hi Scott, >=20 > this somehow breaks the build. >=20 > --------------------------------------------------------------------- > =3D=3D=3D> lib/msun (obj,all,install) > /tank/nfs_public/tiny/src/lib/libutil/getlocalbase.c:69:30: error: = comparison of integers of different signs: 'size_t' (aka 'unsigned = long') and 'ssize_t' (aka 'long') [-Werror,-Wsign-compare] > if ((tmplen < 0) || (tmplen >=3D (ssize_t)pathlen)) { > ~~~~~~ ^ ~~~~~~~~~~~~~~~~ > 1 error generated. > --- getlocalbase.o --- > *** [getlocalbase.o] Error code 1 > ..................................................................... >=20 > Got this on arm64 with the following src.conf: >=20 > WITH_MALLOC_PRODUCTION=3D1 > WITH_EXTRA_TCP_STACKS=3D1 > WITH_BEARSSL=3D1 > WITH_PIE=3D1 > WITH_RETPOLINE=3D1 >=20 > --Gordon >=20 > On Sat, Nov 14, 2020 at 05:57:50PM +0000, Scott Long wrote: >> Author: scottl >> Date: Sat Nov 14 17:57:50 2020 >> New Revision: 367686 >> URL: https://svnweb.freebsd.org/changeset/base/367686 >>=20 >> Log: >> Add the library function getlocalbase and its manual page. This = helps to >> unify the retrieval of the various ways that the local software base = directory, >> typically "/usr/local", is expressed in the system. >>=20 >> Reviewed by: se >> Differential Revision: https://reviews.freebsd.org/D27022 >>=20 >> Added: >> head/lib/libutil/getlocalbase.3 (contents, props changed) >> head/lib/libutil/getlocalbase.c (contents, props changed) >> Modified: >> head/lib/libutil/Makefile >> head/lib/libutil/libutil.h >>=20 >> Modified: head/lib/libutil/Makefile >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/lib/libutil/Makefile Sat Nov 14 15:44:28 2020 = (r367685) >> +++ head/lib/libutil/Makefile Sat Nov 14 17:57:50 2020 = (r367686) >> @@ -12,7 +12,8 @@ PACKAGE=3D runtime >> LIB=3D util >> SHLIB_MAJOR=3D 9 >>=20 >> -SRCS=3D _secure_path.c auth.c expand_number.c flopen.c = fparseln.c gr_util.c \ >> +SRCS=3D _secure_path.c auth.c expand_number.c flopen.c = fparseln.c \ >> + getlocalbase.c gr_util.c \ >> hexdump.c humanize_number.c kinfo_getfile.c \ >> kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c \ >> kinfo_getvmobject.c kld.c \ >> @@ -30,7 +31,7 @@ CFLAGS+=3D -DINET6 >>=20 >> CFLAGS+=3D -I${.CURDIR} -I${SRCTOP}/lib/libc/gen/ >>=20 >> -MAN+=3D expand_number.3 flopen.3 fparseln.3 hexdump.3 \ >> +MAN+=3D expand_number.3 flopen.3 fparseln.3 getlocalbase.3 = hexdump.3 \ >> humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ >> kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ >> login_auth.3 login_cap.3 \ >>=20 >> Added: head/lib/libutil/getlocalbase.3 >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- /dev/null 00:00:00 1970 (empty, because file is newly = added) >> +++ head/lib/libutil/getlocalbase.3 Sat Nov 14 17:57:50 2020 = (r367686) >> @@ -0,0 +1,110 @@ >> +.\" >> +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD >> +.\" >> +.\" Copyright 2020 Scott Long >> +.\" >> +.\" Redistribution and use in source and binary forms, with or = without >> +.\" modification, are permitted provided that the following = conditions >> +.\" are met: >> +.\" 1. Redistributions of source code must retain the above = copyright >> +.\" notice, this list of conditions and the following disclaimer. >> +.\" 2. Redistributions in binary form must reproduce the above = copyright >> +.\" notice, this list of conditions and the following disclaimer = in the >> +.\" documentation and/or other materials provided with the = distribution. >> +.\" >> +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS = IS'' AND >> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED = TO, THE >> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOSE >> +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE >> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL >> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF = SUBSTITUTE GOODS >> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) >> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT >> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING = IN ANY WAY >> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF >> +.\" SUCH DAMAGE. >> +.\" >> +.\" $FreeBSD$ >> +.\" >> +.Dd Oct 28, 2020 >> +.Dt GETLOCALBASE 3 >> +.Os >> +.Sh NAME >> +.Nm getlocalbase >> +.Nd "return the path to the local software directory" >> +.Sh LIBRARY >> +.Lb libutil >> +.Sh SYNOPSIS >> +.In libutil.h >> +.Ft ssize_t >> +.Fn getlocalbase "char *path" "size_t len" >> +.Sh DESCRIPTION >> +The >> +.Fn getlocalbase >> +function returns the path to the local software base directory. >> +Normally this is the >> +.Pa /usr/local >> +directory. >> +First the >> +.Ev LOCALBASE >> +environment variable is checked. >> +If that doesn't exist then the >> +.Va user.localbase >> +sysctl is checked. >> +If that also doesn't exist then the value of the >> +.Dv _PATH_LOCALBASE >> +compile-time variable is used. >> +If that is undefined then the default of >> +.Pa /usr/local >> +is used. >> +.Pp >> +The >> +.Fa path >> +argument points to a caller-supplied buffer to hold the resulting = pathname. >> +The >> +.Fa len >> +argument is the length of the caller-supplied buffer. >> +.Sh IMPLEMENTATION NOTES >> +Calls to >> +.Fn getlocalpath >> +will perform a setugid check on the running binary before checking = the >> +environment. >> +.Sh RETURN VALUES >> +If the request completes without error, the size of the string = copied into the >> +buffer, including the terminating NUL, is returned. >> +If an error occurred or the buffer was too small to hold the string, >> +.Fn getlocalbase >> +returns -1 and sets >> +.Em errno >> +to indicate the error condition. >> +.Sh ENVIRONMENT >> +The >> +.Fn getlocalbase >> +library function retrieves the >> +.Ev LOCALBASE >> +environment variable. >> +.Sh ERRORS >> +The >> +.Fn getlocalbase >> +function will fail and set >> +.Va errno >> +for the following conditions: >> +.Bl -tag -width Er >> +.It Bq Er EINVAL >> +One of the passed in parameters is NULL or zero. >> +.It Bq Er ENOMEM >> +There isn't enough space in the passed in buffer to hold the = pathname string. >> +.El >> +.Sh SEE ALSO >> +.Xr env 1 , >> +.Xr src.conf 5 , >> +.Xr sysctl 8 >> +.Sh HISTORY >> +The >> +.Nm >> +library function first appeared in >> +.Fx 13.0 . >> +.Sh AUTHORS >> +This >> +manual page was written by >> +.An Scott Long Aq Mt scottl@FreeBSD.org . >>=20 >> Added: head/lib/libutil/getlocalbase.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- /dev/null 00:00:00 1970 (empty, because file is newly = added) >> +++ head/lib/libutil/getlocalbase.c Sat Nov 14 17:57:50 2020 = (r367686) >> @@ -0,0 +1,75 @@ >> +/*- >> + * SPDX-License-Identifier: BSD-2-Clause >> + * >> + * Copyright 2020 Scott Long >> + * >> + * Redistribution and use in source and binary forms, with or = without >> + * modification, are permitted provided that the following = conditions >> + * are met: >> + * 1. Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * 2. Redistributions in binary form must reproduce the above = copyright >> + * notice, this list of conditions and the following disclaimer = in the >> + * documentation and/or other materials provided with the = distribution. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS = IS'' AND >> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, = THE >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOSE >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE = LIABLE >> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL >> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS >> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) >> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT >> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN = ANY WAY >> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF >> + * SUCH DAMAGE. >> + */ >> + >> +#include >> +__FBSDID("$FreeBSD$"); >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +ssize_t >> +getlocalbase(char *path, size_t pathlen) >> +{ >> + size_t tmplen; >> + const char *tmppath; >> + >> + if ((pathlen =3D=3D 0) || (path =3D=3D NULL)) { >> + errno =3D EINVAL; >> + return (-1); >> + } >> + >> + tmppath =3D NULL; >> + tmplen =3D pathlen; >> + if (issetugid() =3D=3D 0) >> + tmppath =3D getenv("LOCALBASE"); >> + >> + if ((tmppath =3D=3D NULL) && >> + (sysctlbyname("user.localbase", path, &tmplen, NULL, 0) =3D=3D= 0)) { >> + return (tmplen); >> + } >> + >> + if (tmppath =3D=3D NULL) >> +#ifdef _PATH_LOCALBASE >> + tmppath =3D _PATH_LOCALBASE; >> +#else >> + tmppath =3D "/usr/local"; >> +#endif >> + >> + tmplen =3D strlcpy(path, tmppath, pathlen); >> + if ((tmplen < 0) || (tmplen >=3D (ssize_t)pathlen)) { >> + errno =3D ENOMEM; >> + tmplen =3D -1; >> + } >> + >> + return (tmplen); >> +} >>=20 >> Modified: head/lib/libutil/libutil.h >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/lib/libutil/libutil.h Sat Nov 14 15:44:28 2020 = (r367685) >> +++ head/lib/libutil/libutil.h Sat Nov 14 17:57:50 2020 = (r367686) >> @@ -98,6 +98,7 @@ int flopen(const char *_path, int _flags, = ...); >> int flopenat(int _dirfd, const char *_path, int _flags, ...); >> int forkpty(int *_amaster, char *_name, >> struct termios *_termp, struct winsize *_winp); >> +ssize_t getlocalbase(char *path, size_t pathlen); >> void hexdump(const void *_ptr, int _length, const char *_hdr, int = _flags); >> int humanize_number(char *_buf, size_t _len, int64_t _number, >> const char *_suffix, int _scale, int _flags); >> _______________________________________________ >> svn-src-head@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-head >> To unsubscribe, send any mail to = "svn-src-head-unsubscribe@freebsd.org" >=20 > --=20 From owner-svn-src-all@freebsd.org Sat Nov 14 19:04:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 928EF462E9C; Sat, 14 Nov 2020 19:04:37 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYPsK3qLJz3p7p; Sat, 14 Nov 2020 19:04:37 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73AA66B7D; Sat, 14 Nov 2020 19:04:37 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJ4bCE044002; Sat, 14 Nov 2020 19:04:37 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJ4bXA043999; Sat, 14 Nov 2020 19:04:37 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <202011141904.0AEJ4bXA043999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 14 Nov 2020 19:04:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367689 - head/lib/libutil X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/lib/libutil X-SVN-Commit-Revision: 367689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:04:37 -0000 Author: scottl Date: Sat Nov 14 19:04:36 2020 New Revision: 367689 URL: https://svnweb.freebsd.org/changeset/base/367689 Log: Fix a problem with r367686 related to the use of ssize_t. Not sure how this escaped prior testing, but it should be better now. Reported by: lots Modified: head/lib/libutil/getlocalbase.c head/lib/libutil/libutil.h Modified: head/lib/libutil/getlocalbase.c ============================================================================== --- head/lib/libutil/getlocalbase.c Sat Nov 14 18:06:35 2020 (r367688) +++ head/lib/libutil/getlocalbase.c Sat Nov 14 19:04:36 2020 (r367689) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -66,10 +67,16 @@ getlocalbase(char *path, size_t pathlen) #endif tmplen = strlcpy(path, tmppath, pathlen); - if ((tmplen < 0) || (tmplen >= (ssize_t)pathlen)) { + if ((tmplen < 0) || (tmplen >= pathlen)) { errno = ENOMEM; - tmplen = -1; + return (-1); } - return (tmplen); + /* It's unlikely that the buffer would be this big */ + if (tmplen >= SSIZE_MAX) { + errno = ENOMEM; + return (-1); + } + + return ((ssize_t)tmplen); } Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Sat Nov 14 18:06:35 2020 (r367688) +++ head/lib/libutil/libutil.h Sat Nov 14 19:04:36 2020 (r367689) @@ -65,6 +65,11 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif +#ifndef _SSIZE_T_DECLARED +typedef __ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif + #ifndef _UID_T_DECLARED typedef __uid_t uid_t; #define _UID_T_DECLARED From owner-svn-src-all@freebsd.org Sat Nov 14 19:16:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B6754630C6; Sat, 14 Nov 2020 19:16:40 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYQ7D0pK8z3pxF; Sat, 14 Nov 2020 19:16:40 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E7F57128; Sat, 14 Nov 2020 19:16:40 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJGdw6050064; Sat, 14 Nov 2020 19:16:39 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJGdth050063; Sat, 14 Nov 2020 19:16:39 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <202011141916.0AEJGdth050063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 14 Nov 2020 19:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367690 - head/usr.bin/login X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.bin/login X-SVN-Commit-Revision: 367690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:16:40 -0000 Author: bapt Date: Sat Nov 14 19:16:39 2020 New Revision: 367690 URL: https://svnweb.freebsd.org/changeset/base/367690 Log: Change the default locale to C.UTF-8 The C.UTF-8 locales is the same as the actual C locale except it does support the unicode character set. But the collation etc are still the same as the C locale one. Reviewed by: many Approved by: many Differential Revision: https://reviews.freebsd.org/D26973 Modified: head/usr.bin/login/login.conf Modified: head/usr.bin/login/login.conf ============================================================================== --- head/usr.bin/login/login.conf Sat Nov 14 19:04:36 2020 (r367689) +++ head/usr.bin/login/login.conf Sat Nov 14 19:16:39 2020 (r367690) @@ -47,8 +47,9 @@ default:\ :umtxp=unlimited:\ :priority=0:\ :ignoretime@:\ - :umask=022: - + :umask=022:\ + :charset=UTF-8:\ + :lang=C.UTF-8: # # A collection of common class names - forward them all to 'default' From owner-svn-src-all@freebsd.org Sat Nov 14 19:19:27 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A18C14630B7; Sat, 14 Nov 2020 19:19:27 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYQBR4BG6z3pdl; Sat, 14 Nov 2020 19:19:27 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E3E971AD; Sat, 14 Nov 2020 19:19:27 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJJRM5050257; Sat, 14 Nov 2020 19:19:27 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJJR72050256; Sat, 14 Nov 2020 19:19:27 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011141919.0AEJJR72050256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 14 Nov 2020 19:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367691 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:19:27 -0000 Author: mjg Date: Sat Nov 14 19:19:27 2020 New Revision: 367691 URL: https://svnweb.freebsd.org/changeset/base/367691 Log: thread: pad tid lock On a kernel with other changes this bumps 104-way thread creation/destruction from 0.96 mln ops/s to 1.1 mln ops/s. Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sat Nov 14 19:16:39 2020 (r367690) +++ head/sys/kern/kern_thread.c Sat Nov 14 19:19:27 2020 (r367691) @@ -135,7 +135,7 @@ static int thread_unsuspend_one(struct thread *td, str bool boundary); static void thread_free_batched(struct thread *td); -static struct mtx tid_lock; +static __exclusive_cache_line struct mtx tid_lock; static bitstr_t *tid_bitmap; static MALLOC_DEFINE(M_TIDHASH, "tidhash", "thread hash"); From owner-svn-src-all@freebsd.org Sat Nov 14 19:20:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47A2946325F; Sat, 14 Nov 2020 19:20:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYQCp1cNQz3pqt; Sat, 14 Nov 2020 19:20:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A2B27227; Sat, 14 Nov 2020 19:20:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJKbqm050397; Sat, 14 Nov 2020 19:20:37 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJKbpO050396; Sat, 14 Nov 2020 19:20:37 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011141920.0AEJKbpO050396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 14 Nov 2020 19:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367692 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 367692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:20:38 -0000 Author: mjg Date: Sat Nov 14 19:20:37 2020 New Revision: 367692 URL: https://svnweb.freebsd.org/changeset/base/367692 Log: cred: reorder cr_audit to be closer to the lock This makes cr_uid avoid sharing. Modified: head/sys/sys/ucred.h Modified: head/sys/sys/ucred.h ============================================================================== --- head/sys/sys/ucred.h Sat Nov 14 19:19:27 2020 (r367691) +++ head/sys/sys/ucred.h Sat Nov 14 19:20:37 2020 (r367692) @@ -63,6 +63,7 @@ struct ucred { struct mtx cr_mtx; u_int cr_ref; /* (c) reference count */ u_int cr_users; /* (c) proc + thread using this cred */ + struct auditinfo_addr cr_audit; /* Audit properties. */ #define cr_startcopy cr_uid uid_t cr_uid; /* effective user id */ uid_t cr_ruid; /* real user id */ @@ -78,7 +79,6 @@ struct ucred { void *cr_pspare2[2]; /* general use 2 */ #define cr_endcopy cr_label struct label *cr_label; /* MAC label */ - struct auditinfo_addr cr_audit; /* Audit properties. */ gid_t *cr_groups; /* groups */ int cr_agroups; /* Available groups */ gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small groups */ From owner-svn-src-all@freebsd.org Sat Nov 14 19:20:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFD204630E0; Sat, 14 Nov 2020 19:20:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYQDB6YJgz3qGM; Sat, 14 Nov 2020 19:20:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3F8A70D7; Sat, 14 Nov 2020 19:20:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJKwKZ052067; Sat, 14 Nov 2020 19:20:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJKwjD052066; Sat, 14 Nov 2020 19:20:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011141920.0AEJKwjD052066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 14 Nov 2020 19:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367693 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:20:59 -0000 Author: mjg Date: Sat Nov 14 19:20:58 2020 New Revision: 367693 URL: https://svnweb.freebsd.org/changeset/base/367693 Log: thread: rework tid batch to use helpers Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sat Nov 14 19:20:37 2020 (r367692) +++ head/sys/kern/kern_thread.c Sat Nov 14 19:20:58 2020 (r367693) @@ -259,6 +259,54 @@ tid_free_batch(lwpid_t *batch, int n) } /* + * Batching for thread reapping. + */ +struct tidbatch { + lwpid_t tab[16]; + int n; +}; + +static void +tidbatch_prep(struct tidbatch *tb) +{ + + tb->n = 0; +} + +static void +tidbatch_add(struct tidbatch *tb, struct thread *td) +{ + + KASSERT(tb->n < nitems(tb->tab), + ("%s: count too high %d", __func__, tb->n)); + tb->tab[tb->n] = td->td_tid; + tb->n++; +} + +static void +tidbatch_process(struct tidbatch *tb) +{ + + KASSERT(tb->n <= nitems(tb->tab), + ("%s: count too high %d", __func__, tb->n)); + if (tb->n == nitems(tb->tab)) { + tid_free_batch(tb->tab, tb->n); + tb->n = 0; + } +} + +static void +tidbatch_final(struct tidbatch *tb) +{ + + KASSERT(tb->n <= nitems(tb->tab), + ("%s: count too high %d", __func__, tb->n)); + if (tb->n != 0) { + tid_free_batch(tb->tab, tb->n); + } +} + +/* * Prepare a thread for use. */ static int @@ -487,8 +535,8 @@ void thread_reap(void) { struct thread *itd, *ntd; - lwpid_t tidbatch[16]; - int tidbatchn; + struct tidbatch tidbatch; + int tdcount; /* * Reading upfront is pessimal if followed by concurrent atomic_swap, @@ -499,24 +547,29 @@ thread_reap(void) itd = (struct thread *)atomic_swap_ptr((uintptr_t *)&thread_zombies, (uintptr_t)NULL); - tidbatchn = 0; + if (itd == NULL) + return; + + tidbatch_prep(&tidbatch); + tdcount = 0; while (itd != NULL) { ntd = itd->td_zombie; - tidbatch[tidbatchn] = itd->td_tid; - tidbatchn++; + EVENTHANDLER_DIRECT_INVOKE(thread_dtor, itd); + tidbatch_add(&tidbatch, itd); thread_cow_free(itd); thread_free_batched(itd); - if (tidbatchn == nitems(tidbatch)) { - tid_free_batch(tidbatch, tidbatchn); - thread_count_sub(tidbatchn); - tidbatchn = 0; + tidbatch_process(&tidbatch); + tdcount++; + if (tdcount == 32) { + thread_count_sub(tdcount); + tdcount = 0; } itd = ntd; } - if (tidbatchn != 0) { - tid_free_batch(tidbatch, tidbatchn); - thread_count_sub(tidbatchn); + tidbatch_final(&tidbatch); + if (tdcount != 0) { + thread_count_sub(tdcount); } } @@ -567,7 +620,6 @@ static void thread_free_batched(struct thread *td) { - EVENTHANDLER_DIRECT_INVOKE(thread_dtor, td); lock_profile_thread_exit(td); if (td->td_cpuset) cpuset_rel(td->td_cpuset); @@ -588,6 +640,7 @@ thread_free(struct thread *td) { lwpid_t tid; + EVENTHANDLER_DIRECT_INVOKE(thread_dtor, td); tid = td->td_tid; thread_free_batched(td); tid_free(tid); From owner-svn-src-all@freebsd.org Sat Nov 14 19:21:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F5F5463680; Sat, 14 Nov 2020 19:21:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYQF71rDTz3qbQ; Sat, 14 Nov 2020 19:21:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3245671BD; Sat, 14 Nov 2020 19:21:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJLlbL055912; Sat, 14 Nov 2020 19:21:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJLkAu055910; Sat, 14 Nov 2020 19:21:46 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011141921.0AEJLkAu055910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 14 Nov 2020 19:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367694 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:21:47 -0000 Author: mjg Date: Sat Nov 14 19:21:46 2020 New Revision: 367694 URL: https://svnweb.freebsd.org/changeset/base/367694 Log: thread: batch resource limit free calls Modified: head/sys/kern/kern_resource.c head/sys/kern/kern_thread.c head/sys/sys/resourcevar.h Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Sat Nov 14 19:20:58 2020 (r367693) +++ head/sys/kern/kern_resource.c Sat Nov 14 19:21:46 2020 (r367694) @@ -1236,6 +1236,14 @@ lim_free(struct plimit *limp) free((void *)limp, M_PLIMIT); } +void +lim_freen(struct plimit *limp, int n) +{ + + if (refcount_releasen(&limp->pl_refcnt, n)) + free((void *)limp, M_PLIMIT); +} + /* * Make a copy of the plimit structure. * We share these structures copy-on-write after fork. Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sat Nov 14 19:20:58 2020 (r367693) +++ head/sys/kern/kern_thread.c Sat Nov 14 19:21:46 2020 (r367694) @@ -537,6 +537,8 @@ thread_reap(void) struct thread *itd, *ntd; struct tidbatch tidbatch; int tdcount; + struct plimit *lim; + int limcount; /* * Reading upfront is pessimal if followed by concurrent atomic_swap, @@ -552,11 +554,23 @@ thread_reap(void) tidbatch_prep(&tidbatch); tdcount = 0; + lim = NULL; + limcount = 0; while (itd != NULL) { ntd = itd->td_zombie; EVENTHANDLER_DIRECT_INVOKE(thread_dtor, itd); tidbatch_add(&tidbatch, itd); - thread_cow_free(itd); + MPASS(itd->td_realucred != NULL); + crcowfree(itd); + MPASS(itd->td_limit != NULL); + if (lim != itd->td_limit) { + if (limcount != 0) { + lim_freen(lim, limcount); + limcount = 0; + } + } + lim = itd->td_limit; + limcount++; thread_free_batched(itd); tidbatch_process(&tidbatch); tdcount++; @@ -571,6 +585,8 @@ thread_reap(void) if (tdcount != 0) { thread_count_sub(tdcount); } + MPASS(limcount != 0); + lim_freen(lim, limcount); } /* Modified: head/sys/sys/resourcevar.h ============================================================================== --- head/sys/sys/resourcevar.h Sat Nov 14 19:20:58 2020 (r367693) +++ head/sys/sys/resourcevar.h Sat Nov 14 19:21:46 2020 (r367694) @@ -145,6 +145,7 @@ rlim_t lim_cur(struct thread *td, int which); rlim_t lim_cur_proc(struct proc *p, int which); void lim_fork(struct proc *p1, struct proc *p2); void lim_free(struct plimit *limp); +void lim_freen(struct plimit *limp, int n); struct plimit *lim_hold(struct plimit *limp); rlim_t lim_max(struct thread *td, int which); From owner-svn-src-all@freebsd.org Sat Nov 14 19:22:03 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 691454635BE; Sat, 14 Nov 2020 19:22:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYQFR0kBvz3qhw; Sat, 14 Nov 2020 19:22:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08A9571BF; Sat, 14 Nov 2020 19:22:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJM2be055998; Sat, 14 Nov 2020 19:22:02 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJM2ld055995; Sat, 14 Nov 2020 19:22:02 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011141922.0AEJM2ld055995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 14 Nov 2020 19:22:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367695 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:22:03 -0000 Author: mjg Date: Sat Nov 14 19:22:02 2020 New Revision: 367695 URL: https://svnweb.freebsd.org/changeset/base/367695 Log: thread: batch credential freeing Modified: head/sys/kern/kern_prot.c head/sys/kern/kern_thread.c head/sys/sys/ucred.h Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Sat Nov 14 19:21:46 2020 (r367694) +++ head/sys/kern/kern_prot.c Sat Nov 14 19:22:02 2020 (r367695) @@ -86,6 +86,7 @@ static MALLOC_DEFINE(M_CRED, "cred", "credentials"); SYSCTL_NODE(_security, OID_AUTO, bsd, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "BSD security policy"); +static void crfree_final(struct ucred *cr); static void crsetgroups_locked(struct ucred *cr, int ngrp, gid_t *groups); @@ -1902,6 +1903,31 @@ crunuse(struct thread *td) return (crold); } +static void +crunusebatch(struct ucred *cr, int users, int ref) +{ + + KASSERT(users > 0, ("%s: passed users %d not > 0 ; cred %p", + __func__, users, cr)); + mtx_lock(&cr->cr_mtx); + KASSERT(cr->cr_users >= users, ("%s: users %d not > %d on cred %p", + __func__, cr->cr_users, users, cr)); + cr->cr_users -= users; + cr->cr_ref += ref; + cr->cr_ref -= users; + if (cr->cr_users > 0) { + mtx_unlock(&cr->cr_mtx); + return; + } + KASSERT(cr->cr_ref >= 0, ("%s: ref %d not >= 0 on cred %p", + __func__, cr->cr_ref, cr)); + if (cr->cr_ref > 0) { + mtx_unlock(&cr->cr_mtx); + return; + } + crfree_final(cr); +} + void crcowfree(struct thread *td) { @@ -1935,6 +1961,44 @@ crcowsync(void) } /* + * Batching. + */ +void +credbatch_add(struct credbatch *crb, struct thread *td) +{ + struct ucred *cr; + + MPASS(td->td_realucred != NULL); + MPASS(td->td_realucred == td->td_ucred); + MPASS(td->td_state == TDS_INACTIVE); + cr = td->td_realucred; + KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", + __func__, cr->cr_users, cr)); + if (crb->cred != cr) { + if (crb->users > 0) { + MPASS(crb->cred != NULL); + crunusebatch(crb->cred, crb->users, crb->ref); + crb->users = 0; + crb->ref = 0; + } + } + crb->cred = cr; + crb->users++; + crb->ref += td->td_ucredref; + td->td_ucredref = 0; + td->td_realucred = NULL; +} + +void +credbatch_final(struct credbatch *crb) +{ + + MPASS(crb->cred != NULL); + MPASS(crb->users > 0); + crunusebatch(crb->cred, crb->users, crb->ref); +} + +/* * Allocate a zeroed cred structure. */ struct ucred * @@ -2007,6 +2071,17 @@ crfree(struct ucred *cr) mtx_unlock(&cr->cr_mtx); return; } + crfree_final(cr); +} + +static void +crfree_final(struct ucred *cr) +{ + + KASSERT(cr->cr_users == 0, ("%s: users %d not == 0 on cred %p", + __func__, cr->cr_users, cr)); + KASSERT(cr->cr_ref == 0, ("%s: ref %d not == 0 on cred %p", + __func__, cr->cr_ref, cr)); /* * Some callers of crget(), such as nfs_statfs(), allocate a temporary * credential, but don't allocate a uidinfo structure. Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sat Nov 14 19:21:46 2020 (r367694) +++ head/sys/kern/kern_thread.c Sat Nov 14 19:22:02 2020 (r367695) @@ -536,6 +536,7 @@ thread_reap(void) { struct thread *itd, *ntd; struct tidbatch tidbatch; + struct credbatch credbatch; int tdcount; struct plimit *lim; int limcount; @@ -553,6 +554,7 @@ thread_reap(void) return; tidbatch_prep(&tidbatch); + credbatch_prep(&credbatch); tdcount = 0; lim = NULL; limcount = 0; @@ -560,8 +562,7 @@ thread_reap(void) ntd = itd->td_zombie; EVENTHANDLER_DIRECT_INVOKE(thread_dtor, itd); tidbatch_add(&tidbatch, itd); - MPASS(itd->td_realucred != NULL); - crcowfree(itd); + credbatch_add(&credbatch, itd); MPASS(itd->td_limit != NULL); if (lim != itd->td_limit) { if (limcount != 0) { @@ -573,6 +574,7 @@ thread_reap(void) limcount++; thread_free_batched(itd); tidbatch_process(&tidbatch); + credbatch_process(&credbatch); tdcount++; if (tdcount == 32) { thread_count_sub(tdcount); @@ -582,6 +584,7 @@ thread_reap(void) } tidbatch_final(&tidbatch); + credbatch_final(&credbatch); if (tdcount != 0) { thread_count_sub(tdcount); } Modified: head/sys/sys/ucred.h ============================================================================== --- head/sys/sys/ucred.h Sat Nov 14 19:21:46 2020 (r367694) +++ head/sys/sys/ucred.h Sat Nov 14 19:22:02 2020 (r367695) @@ -114,6 +114,28 @@ struct xucred { struct proc; struct thread; +struct credbatch { + struct ucred *cred; + int users; + int ref; +}; + +static inline void +credbatch_prep(struct credbatch *crb) +{ + crb->cred = NULL; + crb->users = 0; + crb->ref = 0; +} +void credbatch_add(struct credbatch *crb, struct thread *td); +static inline void +credbatch_process(struct credbatch *crb) +{ + +} +void credbatch_add(struct credbatch *crb, struct thread *td); +void credbatch_final(struct credbatch *crb); + void change_egid(struct ucred *newcred, gid_t egid); void change_euid(struct ucred *newcred, struct uidinfo *euip); void change_rgid(struct ucred *newcred, gid_t rgid); From owner-svn-src-all@freebsd.org Sat Nov 14 19:23:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EB7D463949; Sat, 14 Nov 2020 19:23:08 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYQGh05blz3rB1; Sat, 14 Nov 2020 19:23:08 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA62F6FC6; Sat, 14 Nov 2020 19:23:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJN7Po056086; Sat, 14 Nov 2020 19:23:07 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJN7cR056085; Sat, 14 Nov 2020 19:23:07 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011141923.0AEJN7cR056085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 14 Nov 2020 19:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367696 - head/sys/contrib/openzfs/module/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/zfs X-SVN-Commit-Revision: 367696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:23:08 -0000 Author: mjg Date: Sat Nov 14 19:23:07 2020 New Revision: 367696 URL: https://svnweb.freebsd.org/changeset/base/367696 Log: zfs: disable periodic arc updates They are only there to provide less innacurate statistics for debuggers. However, this is quite heavy-weight and instead it would be better to teach debuggers how to obtain the necessary information. Modified: head/sys/contrib/openzfs/module/zfs/arc.c Modified: head/sys/contrib/openzfs/module/zfs/arc.c ============================================================================== --- head/sys/contrib/openzfs/module/zfs/arc.c Sat Nov 14 19:22:02 2020 (r367695) +++ head/sys/contrib/openzfs/module/zfs/arc.c Sat Nov 14 19:23:07 2020 (r367696) @@ -4791,8 +4791,10 @@ arc_evict_cb_check(void *arg, zthr_t *zthr) * arc_state_t structures can be queried directly if more * accurate information is needed. */ +#ifndef __FreeBSD__ if (arc_ksp != NULL) arc_ksp->ks_update(arc_ksp, KSTAT_READ); +#endif /* * We have to rely on arc_wait_for_eviction() to tell us when to From owner-svn-src-all@freebsd.org Sat Nov 14 19:46:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C79C464509 for ; Sat, 14 Nov 2020 19:46:49 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYQp13W4rz3sbv for ; Sat, 14 Nov 2020 19:46:49 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f47.google.com with SMTP id d12so14046370wrr.13 for ; Sat, 14 Nov 2020 11:46:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=TeNoyh/2104eFInfXfDmq5j3kbbfh06nP0nExtIvrwg=; b=n+Ll3cRvAwS8AnLcPChfxUseWP7VWm1tEKbVz7+8EOrLNptnYA1v2ezd/k4G3z4bF8 bG0D9mqUuHq/DkEeeaM2Y42eEwUazftXkLh+v3j+DuKv0DpUOolNJ2CS2FG6Ey8IikWb OTmxtR0u4Vj+7W/PEBxuRAnQNDoRVFUxzJ8cji7SWwvITZl+bDYRyaqbZ8L8R+AjbLeB 4FR73EzB9Fy6y2Rron2TKFnlnr+/NcJwAHjT0AN/NkBmdLN401dHZjB6rseyRnzebWsx PXYxPwWS+ZZJboNFK39F7tR8UFJotSXlHNCC942yLhApGPfjaS6lGgInDYfb7UDjO/aK YRbA== X-Gm-Message-State: AOAM530zLU0uB5wrs82sGX1YLLrKqLlyelAc3gVwfmd1syCRNUpClgWz htnfqiRM3xcXbNuu0bPZJTMcDg== X-Google-Smtp-Source: ABdhPJyfboKt6QBFzs88UzFxB0M0QfvSX8gFjnDjClf0gfUlhQ7e1fFYIyB9UPYKw31ART8C0wgvrQ== X-Received: by 2002:adf:bb92:: with SMTP id q18mr10667756wrg.315.1605383207848; Sat, 14 Nov 2020 11:46:47 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id q16sm15992287wrn.13.2020.11.14.11.46.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Nov 2020 11:46:46 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: svn commit: r367689 - head/lib/libutil From: Jessica Clarke In-Reply-To: <202011141904.0AEJ4bXA043999@repo.freebsd.org> Date: Sat, 14 Nov 2020 19:46:45 +0000 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <202011141904.0AEJ4bXA043999@repo.freebsd.org> To: Scott Long X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CYQp13W4rz3sbv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:46:49 -0000 On 14 Nov 2020, at 19:04, Scott Long wrote: > @@ -66,10 +67,16 @@ getlocalbase(char *path, size_t pathlen) > #endif > > tmplen = strlcpy(path, tmppath, pathlen); > - if ((tmplen < 0) || (tmplen >= (ssize_t)pathlen)) { > + if ((tmplen < 0) || (tmplen >= pathlen)) { I'd expect the LHS to give a compiler warning still. Jess From owner-svn-src-all@freebsd.org Sat Nov 14 19:56:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A05A4647E6; Sat, 14 Nov 2020 19:56:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYR0r2ZnRz3smp; Sat, 14 Nov 2020 19:56:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BD577577; Sat, 14 Nov 2020 19:56:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEJuCbA075944; Sat, 14 Nov 2020 19:56:12 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEJuCqe075943; Sat, 14 Nov 2020 19:56:12 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011141956.0AEJuCqe075943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 14 Nov 2020 19:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367697 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 367697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 19:56:12 -0000 Author: mjg Date: Sat Nov 14 19:56:11 2020 New Revision: 367697 URL: https://svnweb.freebsd.org/changeset/base/367697 Log: cred: annotate credbatch_process argument as unused Fixes libprocstat compilation as zfs defines _KERNEL. Modified: head/sys/sys/ucred.h Modified: head/sys/sys/ucred.h ============================================================================== --- head/sys/sys/ucred.h Sat Nov 14 19:23:07 2020 (r367696) +++ head/sys/sys/ucred.h Sat Nov 14 19:56:11 2020 (r367697) @@ -129,7 +129,7 @@ credbatch_prep(struct credbatch *crb) } void credbatch_add(struct credbatch *crb, struct thread *td); static inline void -credbatch_process(struct credbatch *crb) +credbatch_process(struct credbatch *crb __unused) { } From owner-svn-src-all@freebsd.org Sat Nov 14 20:44:34 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA02F465671; Sat, 14 Nov 2020 20:44:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYS4f5tVcz3vlp; Sat, 14 Nov 2020 20:44:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8655105A8; Sat, 14 Nov 2020 20:44:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEKiYpt006551; Sat, 14 Nov 2020 20:44:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEKiYoK006550; Sat, 14 Nov 2020 20:44:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011142044.0AEKiYoK006550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 20:44:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367698 - stable/12/release/packages X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/release/packages X-SVN-Commit-Revision: 367698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 20:44:35 -0000 Author: kevans Date: Sat Nov 14 20:44:34 2020 New Revision: 367698 URL: https://svnweb.freebsd.org/changeset/base/367698 Log: MFC r365883: pkgbase: use consistent annotation for object keys Everywhere else we use objects ("scripts", generally) we do specify the optional colon. Be consistent and do the same for directories. PR: 249273 Modified: stable/12/release/packages/runtime.ucl Directory Properties: stable/12/ (props changed) Modified: stable/12/release/packages/runtime.ucl ============================================================================== --- stable/12/release/packages/runtime.ucl Sat Nov 14 19:56:11 2020 (r367697) +++ stable/12/release/packages/runtime.ucl Sat Nov 14 20:44:34 2020 (r367698) @@ -30,7 +30,7 @@ deps: { version: "%VERSION%" } } -directories { +directories: { /dev = "y"; /tmp = "y"; } From owner-svn-src-all@freebsd.org Sat Nov 14 20:45:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E56794651F7; Sat, 14 Nov 2020 20:45:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYS5N682Jz3wB0; Sat, 14 Nov 2020 20:45:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5BC510559; Sat, 14 Nov 2020 20:45:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AEKjC63006660; Sat, 14 Nov 2020 20:45:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AEKjCKa006659; Sat, 14 Nov 2020 20:45:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011142045.0AEKjCKa006659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 14 Nov 2020 20:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367699 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 367699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 20:45:13 -0000 Author: kevans Date: Sat Nov 14 20:45:12 2020 New Revision: 367699 URL: https://svnweb.freebsd.org/changeset/base/367699 Log: MFC r366231: Address whitespace nits in subr_rtc.c These were separated out from a nearby patch from Andrew Gierth. Modified: stable/12/sys/kern/subr_rtc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_rtc.c ============================================================================== --- stable/12/sys/kern/subr_rtc.c Sat Nov 14 20:44:34 2020 (r367698) +++ stable/12/sys/kern/subr_rtc.c Sat Nov 14 20:45:12 2020 (r367699) @@ -164,7 +164,7 @@ clock_dbgprint_hdr(device_t dev, int rw) getnanotime(&now); device_printf(dev, "%s at ", (rw & CLOCK_DBG_READ) ? "read " : "write"); clock_print_ts(&now, 9); - printf(": "); + printf(": "); } void @@ -241,7 +241,7 @@ clock_register_flags(device_t clockdev, long resolutio } sx_xunlock(&rtc_list_lock); - device_printf(clockdev, + device_printf(clockdev, "registered as a time-of-day clock, resolution %d.%6.6ds\n", newrtc->resolution / 1000000, newrtc->resolution % 1000000); } From owner-svn-src-all@freebsd.org Sat Nov 14 20:50:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3568446545F for ; Sat, 14 Nov 2020 20:50:39 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYSCf6fSXz3wMb for ; Sat, 14 Nov 2020 20:50:38 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x832.google.com with SMTP id g15so9895746qtq.13 for ; Sat, 14 Nov 2020 12:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Kkcn/Hpq9tGhRPJZx/mASkhxRH/Q+4wQ2Ut0a7dH6TY=; b=QvJu5QFD7fTBHl1yT1gaxEERid2ElXzIO9dVYYC1ftYiXr0w2HOTI0+Vmo/kZgpPKq rppsRPf8KKWT+lpu5r9OV9Uq7sF8Sn4o1J14o6oUxMRvp/xFkqYH/ExnZmZqvopR7K6Y vuHnE+RmiSLulRyi5xusglUkc/Kz7dDMGm0/wKUDspLBWfP6VfDzXx8UO4h35wfD1ebp +5lSkFWK71eBB1073RxqiqpdXa2DlJuPN9zX8JWUrmLCL81LZuZFEqxJfn8Z5ZoxJVtc ufvRI6pHZWm5o8yOKqXkkpXwjwnhW5o+fOYGFKkHhDofbbxFlWlezgUvWVkfw5Mj+QAm HdMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Kkcn/Hpq9tGhRPJZx/mASkhxRH/Q+4wQ2Ut0a7dH6TY=; b=SPawWi/+zlx8fWrVJbP1ibHuIPuO6vWsgNTtkCqU4FaPb7tynV8Rkwa3lwDyEvgC1G Qm0SuLgAAjlGvCxTTl+8sdv5BqZfvW0QjqhCs/YD/7x703uV8S0losAniG1EJKvyHyYP 8vZVBiXA/2ldEZzJYyKRzJCNA9+HUQF275+s7jfeuDOCsluQuPx4amxkM3WBhgEI0LFw c+s/gGIgnaMLBwpMJa9tUY7LSTypVEmS+g9qe5wj6GMDE6PNVeQMUGJSUtD2nvu6a9cX mYXwaEJw5UVVJgaXhEjbg0UfkuClqlAWanwmUE151W8JDdtwKp7EyKk72XR2xLuqkXqb XESg== X-Gm-Message-State: AOAM531RO7Y3zi0SRXAUF3OexJeBUtMa7SWz6RGtwOvh24zeMkHcw4vu 5z/O8Q3N0kozvtJpxegfCjHVkw== X-Google-Smtp-Source: ABdhPJzwotN/Qllc6Prb6VsblnK0Z7pb4CtaZRL1eJnbuSHbExCkgj2xdCMk4r5xxYK9I0n38VPTWA== X-Received: by 2002:a05:622a:50:: with SMTP id y16mr7899007qtw.119.1605387037919; Sat, 14 Nov 2020 12:50:37 -0800 (PST) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id z16sm9988581qka.18.2020.11.14.12.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2020 12:50:37 -0800 (PST) Date: Sat, 14 Nov 2020 15:50:36 -0500 From: Shawn Webb To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367692 - head/sys/sys Message-ID: <20201114205036.tnxvwarsddmu4shz@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202011141920.0AEJKbpO050396@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6hglt7f3pnphonso" Content-Disposition: inline In-Reply-To: <202011141920.0AEJKbpO050396@repo.freebsd.org> X-Rspamd-Queue-Id: 4CYSCf6fSXz3wMb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 20:50:39 -0000 --6hglt7f3pnphonso Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 14, 2020 at 07:20:37PM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Sat Nov 14 19:20:37 2020 > New Revision: 367692 > URL: https://svnweb.freebsd.org/changeset/base/367692 >=20 > Log: > cred: reorder cr_audit to be closer to the lock > =20 > This makes cr_uid avoid sharing. >=20 > Modified: > head/sys/sys/ucred.h >=20 > Modified: head/sys/sys/ucred.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/ucred.h Sat Nov 14 19:19:27 2020 (r367691) > +++ head/sys/sys/ucred.h Sat Nov 14 19:20:37 2020 (r367692) > @@ -63,6 +63,7 @@ struct ucred { > struct mtx cr_mtx; > u_int cr_ref; /* (c) reference count */ > u_int cr_users; /* (c) proc + thread using this cred */ > + struct auditinfo_addr cr_audit; /* Audit properties. */ > #define cr_startcopy cr_uid > uid_t cr_uid; /* effective user id */ > uid_t cr_ruid; /* real user id */ > @@ -78,7 +79,6 @@ struct ucred { > void *cr_pspare2[2]; /* general use 2 */ > #define cr_endcopy cr_label > struct label *cr_label; /* MAC label */ > - struct auditinfo_addr cr_audit; /* Audit properties. */ > gid_t *cr_groups; /* groups */ > int cr_agroups; /* Available groups */ > gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small groups */ Hey Mateusz, Since this changes KBI, does __FreeBSD_version need bumping? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --6hglt7f3pnphonso Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl+wQxkACgkQ/y5nonf4 4fqmvw/+LqkXst4/4+Gu+hoTF4T05ao+JGmx/RG6xHteFNhIYR2Y63VSscIv+kHT 8tSus5N6WrSgdaN2nwxpv/dYxR6Z8CEM+5OjFEwoEqaWugu6rWxLAyhDrPkNkKvT bka4vAvZPiHxfQqwWuE7aMoWd+4O9LFl8WSLc7zLIe9rQsjr2E5woHldG8u/mheF tw1kle1JK8hIzy5Qfi62FUvEtIhpI4Vo60wXeUV8iXnUHUEC6L4umeY447blLkKp kqyvP7BUjMB5bgZVvNpzgKQ+Lx3zDpl1SVcJznN069OQm1xzGs+Ob5gam75eG5at BqzJRB0cD0snH5dQBqhiij3cd4L8/B5p/OK+klqEgOWfIryDVH0C1uiH0eXzZPZR 9Zawk5hIV2LevbHzuWiM/Fg98dpyOEjvRPc5bs7L1w5mqC5l7X3lzZEXOeaUa/HW ZJoje5ocYEST1wlDkrJ8JFw/rTrNxDA7Rm/5kPTZv8sBzhXNC+1ZELUf129BUktc jNcmxwdqlt/CAU2vuz49A+R0yOESEY50gy6K3GDai/gF+jKNJ0DLUlvdLsWUT4zm Zmn98N3cNVPSPkHKXJbJVxr3bamYRK23w2S/NFuxMWug1R4oYNs4oimSFxL69bXF /Y2XdCX92S7N8EiepAGG0j3QdMCJZUhKi/fXU6CdMtkzJhyMv2I= =zV3q -----END PGP SIGNATURE----- --6hglt7f3pnphonso-- From owner-svn-src-all@freebsd.org Sat Nov 14 20:51:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC02346555A; Sat, 14 Nov 2020 20:51:49 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYSF13xpzz3wTf; Sat, 14 Nov 2020 20:51:49 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x32b.google.com with SMTP id c9so19886430wml.5; Sat, 14 Nov 2020 12:51:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aGS5h+muelvCzVcowv/2gUEgz4sdzZAKtEBYcdHxDxc=; b=XKbF0t8OLHfsjTwvo/fJ6eVDdarAYJvbIOxVnT2U0oHBEgS5f2hi3ChKqhR/vExoMm iSpYAmEopGlDcsA6PC1GhmU6heM4uFrmTgRgBj3z10K4IVljUUDtHoUACM7EIl0LDocJ 6YD/MT9IeKqrlrZ9O9D4knxdyZEjee3R/ODGkzghRwt0lC0vf5QMYRHVZ6mCvnHYFlQG kcCvdke+Na8CzX41JezVxqGxIdpj3UoGZegxa9ySwJfdgiVkkoeF0tKdmJ14lADItAga 4F6oOfsuQRAFXxOpPn9voB6AT3u+UICvNTfnPlfIgN+2kqF7tLreLqfXDfBjlLm8Hugd yGqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aGS5h+muelvCzVcowv/2gUEgz4sdzZAKtEBYcdHxDxc=; b=HCvPONQmLgj4VSRlrvQ9YDGRu/i1gGhWbEXbCMCQnxLroU725XoC375yErm8yM8NCE hVScgDv7xbbkr1udka/BG5K11yu0a+Jnb5VtZYAErzkhu2eVJa2TQHaKFtPSlx+RxKxg TKdZVFQ21D6JQJAcjr+9C0rILuyyKfBgqCeM9ftmiIvS0vVaOqcYLAoLniP4W8Hsu5+n P6/Hv9Ob5XNuEyCytkeXfcr1IDCed3XhgHsJUZYfteydbVZ8O0os2adc4Raux8ol6n9d PGjsEnIWfQw63zfgduAXYDDLFHWUz8p/EeiGGW9EYWEx+IvmWiCD7TXF4jcYGebBR0Qy +N+A== X-Gm-Message-State: AOAM533h8sU0mEeFXYSblHIn26y6Cg2VoKUOV3m9TWOtuOm9JRbwbzLQ HeSufp9VH6eRjhk0LQpxeSIjVE2ycgxkbqZzEZb6TCMxC08= X-Google-Smtp-Source: ABdhPJwDpOhnmmd6YTKhSDzh7G9YHSFzqROdfKJ6zpN/yiEVn4EXmOIhyJ7olGoyCuxoSmVmMayATtgScCw/oMthZZ0= X-Received: by 2002:a05:600c:290a:: with SMTP id i10mr8274302wmd.187.1605387107840; Sat, 14 Nov 2020 12:51:47 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:dec7:0:0:0:0:0 with HTTP; Sat, 14 Nov 2020 12:51:47 -0800 (PST) In-Reply-To: <20201114205036.tnxvwarsddmu4shz@mutt-hbsd> References: <202011141920.0AEJKbpO050396@repo.freebsd.org> <20201114205036.tnxvwarsddmu4shz@mutt-hbsd> From: Mateusz Guzik Date: Sat, 14 Nov 2020 21:51:47 +0100 Message-ID: Subject: Re: svn commit: r367692 - head/sys/sys To: Shawn Webb Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CYSF13xpzz3wTf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 20:51:49 -0000 I don't think so, it does not change any APIs On 11/14/20, Shawn Webb wrote: > On Sat, Nov 14, 2020 at 07:20:37PM +0000, Mateusz Guzik wrote: >> Author: mjg >> Date: Sat Nov 14 19:20:37 2020 >> New Revision: 367692 >> URL: https://svnweb.freebsd.org/changeset/base/367692 >> >> Log: >> cred: reorder cr_audit to be closer to the lock >> >> This makes cr_uid avoid sharing. >> >> Modified: >> head/sys/sys/ucred.h >> >> Modified: head/sys/sys/ucred.h >> ============================================================================== >> --- head/sys/sys/ucred.h Sat Nov 14 19:19:27 2020 (r367691) >> +++ head/sys/sys/ucred.h Sat Nov 14 19:20:37 2020 (r367692) >> @@ -63,6 +63,7 @@ struct ucred { >> struct mtx cr_mtx; >> u_int cr_ref; /* (c) reference count */ >> u_int cr_users; /* (c) proc + thread using this cred */ >> + struct auditinfo_addr cr_audit; /* Audit properties. */ >> #define cr_startcopy cr_uid >> uid_t cr_uid; /* effective user id */ >> uid_t cr_ruid; /* real user id */ >> @@ -78,7 +79,6 @@ struct ucred { >> void *cr_pspare2[2]; /* general use 2 */ >> #define cr_endcopy cr_label >> struct label *cr_label; /* MAC label */ >> - struct auditinfo_addr cr_audit; /* Audit properties. */ >> gid_t *cr_groups; /* groups */ >> int cr_agroups; /* Available groups */ >> gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small groups */ > > Hey Mateusz, > > Since this changes KBI, does __FreeBSD_version need bumping? > > Thanks, > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > GPG Key ID: 0xFF2E67A277F8E1FA > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 > https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Sat Nov 14 20:53:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E102B4657D4 for ; Sat, 14 Nov 2020 20:53:57 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYSHT5m4Qz4R62 for ; Sat, 14 Nov 2020 20:53:57 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82e.google.com with SMTP id 3so9952069qtx.3 for ; Sat, 14 Nov 2020 12:53:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=MI3KjUtXdLjBSnhZZnvEFEiFny91tgEvL+ju4y03RQY=; b=JmIOOf4Skwx+x7oZVJ+8H0TB6049GhITcFfGDpIaN54lpFLPB3HeTuYSm57lT6OEvd 4Zl3SzH6hJu27TmqKfk8J6lGlkJKSYWNXpf4A4TPqe6e6YMYnSNB12HdksjBGBcfuLB0 NoJSRcik+JimidCYBFucubTtitREHoZQGoqVnm7vACcXrdRicwn2HOcCqiff8Q2C3ZGz 7V5WjTrnG+BUb93WZVPdM4f0Tf0D+UDP6pWyOr2A0kv8JYjeZjdTZVVF35F9puwl7KOi xw7byn7pZbA2KJr28kXWsgUNImO+cOBU6xfXNLEuYjmAnelCIIs9B3QIvvkIIRa4y63z U59Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MI3KjUtXdLjBSnhZZnvEFEiFny91tgEvL+ju4y03RQY=; b=fw0Dsz4ZdDBmRsjXlqgigyekZLFfstm4A3gv3gvY1WMIPJYxBW/xZWe7j9rzhowBzc JkE30uVbNxcqySR/mslLOb3G0RuumB2GHa8FktSIQwTT2H9kZATSCyTcOtzyRYEfNCfS /YhDe75qTskICLkdjOclFHJgaVcexFJZ9wY55wEg5DxRXsa4E5ElHkgxlMMdLK0BG7/f ml5J6JqY1YygTzGMc9ZxHNBDW2Z/dvoALt8U46AFAFTMtPBGmsPSavSyF7rgfG6S3Mlg fNt0kN4olCbHR9pCQGpsGrpYZ8FT+4eTYsJUOB90oVpo42ZO+rzFZuaelW9v4nOFTzEG LClQ== X-Gm-Message-State: AOAM532LaoveuJMw8DLtHV7PEhRD3M1IsjZptdk9mN2hB8knIYGnHDOR rTmkdBnfJTecOG4wbNAdIfPDrw== X-Google-Smtp-Source: ABdhPJxgfxmetiuOdIj4uNRoyKHR3TVSTiQ7dAahrDzACjUn484upfT3hZXku9+RxBeg94YMICFViA== X-Received: by 2002:ac8:2fa2:: with SMTP id l31mr7793082qta.86.1605387236883; Sat, 14 Nov 2020 12:53:56 -0800 (PST) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id x71sm3696108qka.71.2020.11.14.12.53.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2020 12:53:56 -0800 (PST) Date: Sat, 14 Nov 2020 15:53:55 -0500 From: Shawn Webb To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367692 - head/sys/sys Message-ID: <20201114205355.j2ejnhouipjr6yhk@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202011141920.0AEJKbpO050396@repo.freebsd.org> <20201114205036.tnxvwarsddmu4shz@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hlgimau7p42bbikt" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4CYSHT5m4Qz4R62 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 20:53:57 -0000 --hlgimau7p42bbikt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Are there any kernel modules (in base, in ports, or out-of-both-trees) that access struct ucred? On Sat, Nov 14, 2020 at 09:51:47PM +0100, Mateusz Guzik wrote: > I don't think so, it does not change any APIs >=20 > On 11/14/20, Shawn Webb wrote: > > On Sat, Nov 14, 2020 at 07:20:37PM +0000, Mateusz Guzik wrote: > >> Author: mjg > >> Date: Sat Nov 14 19:20:37 2020 > >> New Revision: 367692 > >> URL: https://svnweb.freebsd.org/changeset/base/367692 > >> > >> Log: > >> cred: reorder cr_audit to be closer to the lock > >> > >> This makes cr_uid avoid sharing. > >> > >> Modified: > >> head/sys/sys/ucred.h > >> > >> Modified: head/sys/sys/ucred.h > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > >> --- head/sys/sys/ucred.h Sat Nov 14 19:19:27 2020 (r367691) > >> +++ head/sys/sys/ucred.h Sat Nov 14 19:20:37 2020 (r367692) > >> @@ -63,6 +63,7 @@ struct ucred { > >> struct mtx cr_mtx; > >> u_int cr_ref; /* (c) reference count */ > >> u_int cr_users; /* (c) proc + thread using this cred */ > >> + struct auditinfo_addr cr_audit; /* Audit properties. */ > >> #define cr_startcopy cr_uid > >> uid_t cr_uid; /* effective user id */ > >> uid_t cr_ruid; /* real user id */ > >> @@ -78,7 +79,6 @@ struct ucred { > >> void *cr_pspare2[2]; /* general use 2 */ > >> #define cr_endcopy cr_label > >> struct label *cr_label; /* MAC label */ > >> - struct auditinfo_addr cr_audit; /* Audit properties. */ > >> gid_t *cr_groups; /* groups */ > >> int cr_agroups; /* Available groups */ > >> gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small groups */ > > > > Hey Mateusz, > > > > Since this changes KBI, does __FreeBSD_version need bumping? > > > > Thanks, > > > > -- > > Shawn Webb > > Cofounder / Security Engineer > > HardenedBSD > > > > GPG Key ID: 0xFF2E67A277F8E1FA > > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 > > https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master= /Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > > >=20 >=20 > --=20 > Mateusz Guzik --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --hlgimau7p42bbikt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl+wQ+MACgkQ/y5nonf4 4foLOA//XUBGhKNLIdGAL8WAKKSqXimkpbehN+hL9yh5GbERMvnSiCBiumb+nFvL GrAw5Fmea4soSW4eZcZc4goRy9md5vy0e6BnMEt6MjM534RlWNDDDiwmN3gMlmFh Gw8MveFNqXwDaebeV5b3PCPCqKeMGV6aRjg8Vz4TGPBP+ClcN/FW99MAEsniERGV pJ3u1aGtoOPBgB5PaRLrUqylAFU8ol5aLi+rCk2buAZlKvjxHTMFS2C2Fskq+KeD LsHJmX9cWjktWCXjK8rhpbUGAbQxcviYy7627pNIzh1gXO6sM60Tw7wNDZpAgYF7 cZxgt1om69dLWjZCu9RULhFeNqkEAK6GNNI7VvVt3WMWfvjy3wOXTegmHXnwCfx1 eESkqJ+ufH86ZPs2tWPpso8mpf3tgN0b1uWa5p3JnTH4JWg19X8NNeSJQsh56SYD 986hFsNdrBdmDonwK0oDYbJUMShS2yUtfWNTuq/NBcjHiUPAObLyeNlC0LbD64YR vcfJBtpbsf26B2vqyBpqxqX6xJ2GFVItRWFSwRAGGoMKSIe1vkn8YbYyTKOvsPI4 ygYpfyDe9K5CXwkmyXbK8DivsmYiPDYzckSipekG3l58ikAs+aZTUtVpR6/NYRUU UlQVs4NmQNXeS/72GO9o8BNcZHQ5UkUKUyyo82m2XK81aA7691s= =pcKy -----END PGP SIGNATURE----- --hlgimau7p42bbikt-- From owner-svn-src-all@freebsd.org Sat Nov 14 20:57:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DA46465AA0; Sat, 14 Nov 2020 20:57:50 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYSMy11pwz4R4d; Sat, 14 Nov 2020 20:57:49 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x42a.google.com with SMTP id s8so14153282wrw.10; Sat, 14 Nov 2020 12:57:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=EM0MlLnv8yS0eqfznu3lZlFuTOinfp7AJWw/I7B6IM4=; b=ZHcKuXSOkMuSb6L6vm/9bulOkV1ryPKrwhRFqBj5JChfDLGol3s7Itciz0xESZeU0X OYn2RIaReQVUMcZbYvJqnltw2S+4UFDWRBPZvqbjzGxCkl2tPM86WGSy+Uf9SUo9B1mE 4lOYWoV3IZRXo4Czs4M21F7wbI4rBAFbg/T66xBxZLdfNd/q79eDIgeIBcY56Ef4A1i2 Zue2SWykNtHEyidCabWtAq0aQTVkDylvvRayaQHSeu/xTs54m4TnrQT+nWbH7t7E7KeI FpFvJuonNUWg4+DV12yw55MXqvkpTFifhfHF9nlZ2Pi6HQCapWrJYJiFeS1wZIUT0TxT VMsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=EM0MlLnv8yS0eqfznu3lZlFuTOinfp7AJWw/I7B6IM4=; b=Lk4gnVMOuALTRhZ2+zMGIWixV2VW0fzdm9+ZwR3ZemT7aF6kJ2ZMhjcqjMTpIHkDvQ dNsD+JU1zCom9g38/nw03TBwScmvIk1N5viWregazAk3Shf0zJcGjTbtbcWmhRKlJGtJ +bFwCRp6vAGvAaLkSVsZWVClhDV7tSN+h7SmkiKNcNxZxjpsEIh/Ic0MCnuNi4Ax9/zW RnbtGoC92TcgKTgU6jkbaazXodke3eQ4K8CWRTwPa2Y7o4WwHl2qHKb6QKErb0Ejn8la morZP0Jz/KrtTxZzRsTQm1Anvds1AnSzmyoT249Swe7VPuO0Pw2OFwg9M5Y9mEqj4ds/ gx/A== X-Gm-Message-State: AOAM531Lq81IDLrAjq4mNhAsm7EMMvIbuCbFRx6R8I5Y3AE+5UudpR13 UTkpZJEHIGItT/46x2azeK1w/uY9BfPbsfDVa5qkxM6rnuA= X-Google-Smtp-Source: ABdhPJwAKu8XMFrirXoTP6P7QvQb9fwl15Yfdp7ffeccdj2il2cYlTqoV60pCg1tGbGjixWhnZVyuQtXG2HH5a2hHuU= X-Received: by 2002:adf:9b98:: with SMTP id d24mr10923504wrc.17.1605387468725; Sat, 14 Nov 2020 12:57:48 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:dec7:0:0:0:0:0 with HTTP; Sat, 14 Nov 2020 12:57:48 -0800 (PST) In-Reply-To: <20201114205355.j2ejnhouipjr6yhk@mutt-hbsd> References: <202011141920.0AEJKbpO050396@repo.freebsd.org> <20201114205036.tnxvwarsddmu4shz@mutt-hbsd> <20201114205355.j2ejnhouipjr6yhk@mutt-hbsd> From: Mateusz Guzik Date: Sat, 14 Nov 2020 21:57:48 +0100 Message-ID: Subject: Re: svn commit: r367692 - head/sys/sys To: Shawn Webb Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CYSMy11pwz4R4d X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 20:57:50 -0000 you are expected to recompile all your kernel modules every time you update head On 11/14/20, Shawn Webb wrote: > Are there any kernel modules (in base, in ports, or out-of-both-trees) > that access struct ucred? > > On Sat, Nov 14, 2020 at 09:51:47PM +0100, Mateusz Guzik wrote: >> I don't think so, it does not change any APIs >> >> On 11/14/20, Shawn Webb wrote: >> > On Sat, Nov 14, 2020 at 07:20:37PM +0000, Mateusz Guzik wrote: >> >> Author: mjg >> >> Date: Sat Nov 14 19:20:37 2020 >> >> New Revision: 367692 >> >> URL: https://svnweb.freebsd.org/changeset/base/367692 >> >> >> >> Log: >> >> cred: reorder cr_audit to be closer to the lock >> >> >> >> This makes cr_uid avoid sharing. >> >> >> >> Modified: >> >> head/sys/sys/ucred.h >> >> >> >> Modified: head/sys/sys/ucred.h >> >> ============================================================================== >> >> --- head/sys/sys/ucred.h Sat Nov 14 19:19:27 2020 (r367691) >> >> +++ head/sys/sys/ucred.h Sat Nov 14 19:20:37 2020 (r367692) >> >> @@ -63,6 +63,7 @@ struct ucred { >> >> struct mtx cr_mtx; >> >> u_int cr_ref; /* (c) reference count */ >> >> u_int cr_users; /* (c) proc + thread using this cred */ >> >> + struct auditinfo_addr cr_audit; /* Audit properties. */ >> >> #define cr_startcopy cr_uid >> >> uid_t cr_uid; /* effective user id */ >> >> uid_t cr_ruid; /* real user id */ >> >> @@ -78,7 +79,6 @@ struct ucred { >> >> void *cr_pspare2[2]; /* general use 2 */ >> >> #define cr_endcopy cr_label >> >> struct label *cr_label; /* MAC label */ >> >> - struct auditinfo_addr cr_audit; /* Audit properties. */ >> >> gid_t *cr_groups; /* groups */ >> >> int cr_agroups; /* Available groups */ >> >> gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small groups */ >> > >> > Hey Mateusz, >> > >> > Since this changes KBI, does __FreeBSD_version need bumping? >> > >> > Thanks, >> > >> > -- >> > Shawn Webb >> > Cofounder / Security Engineer >> > HardenedBSD >> > >> > GPG Key ID: 0xFF2E67A277F8E1FA >> > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 >> > https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc >> > >> >> >> -- >> Mateusz Guzik > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > GPG Key ID: 0xFF2E67A277F8E1FA > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 > https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Sat Nov 14 21:54:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 999E246685A for ; Sat, 14 Nov 2020 21:54:10 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYTcy3m6Qz4TP0; Sat, 14 Nov 2020 21:54:10 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p4fd3a1f5.dip0.t-ipconnect.de [79.211.161.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id D2CACFF78; Sat, 14 Nov 2020 21:54:09 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Sat, 14 Nov 2020 22:54:08 +0100 From: Gordon Bergling To: Scott Long Cc: src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r367686 - head/lib/libutil Message-ID: References: <202011141757.0AEHvo1m098201@repo.freebsd.org> <2236AF89-1624-46B1-A170-7C7B5B4BB5E6@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2236AF89-1624-46B1-A170-7C7B5B4BB5E6@samsco.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 10:49PM up 2:53, 4 users, load averages: 4.14, 4.06, 3.88 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 21:54:10 -0000 Hi Scott, after r367689 the build was fixed, but on arm64 I get the following error, when I try to 'pkg upgrade': $ doas pkg upgrade Cannot determine local path $ Is this error somehow related to this change? --Gordon On Sat, Nov 14, 2020 at 11:44:29AM -0700, Scott Long wrote: > Hi, > > Yeah, I’m working on a fix, sorry. I made a last minute change that I thought I > had tested, but apparently hadn’t. > > Scott > > > > On Nov 14, 2020, at 11:43 AM, Gordon Bergling wrote: > > > > Hi Scott, > > > > this somehow breaks the build. > > > > --------------------------------------------------------------------- > > ===> lib/msun (obj,all,install) > > /tank/nfs_public/tiny/src/lib/libutil/getlocalbase.c:69:30: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'ssize_t' (aka 'long') [-Werror,-Wsign-compare] > > if ((tmplen < 0) || (tmplen >= (ssize_t)pathlen)) { > > ~~~~~~ ^ ~~~~~~~~~~~~~~~~ > > 1 error generated. > > --- getlocalbase.o --- > > *** [getlocalbase.o] Error code 1 > > ..................................................................... > > > > Got this on arm64 with the following src.conf: > > > > WITH_MALLOC_PRODUCTION=1 > > WITH_EXTRA_TCP_STACKS=1 > > WITH_BEARSSL=1 > > WITH_PIE=1 > > WITH_RETPOLINE=1 > > > > --Gordon > > > > On Sat, Nov 14, 2020 at 05:57:50PM +0000, Scott Long wrote: > >> Author: scottl > >> Date: Sat Nov 14 17:57:50 2020 > >> New Revision: 367686 > >> URL: https://svnweb.freebsd.org/changeset/base/367686 > >> > >> Log: > >> Add the library function getlocalbase and its manual page. This helps to > >> unify the retrieval of the various ways that the local software base directory, > >> typically "/usr/local", is expressed in the system. > >> > >> Reviewed by: se > >> Differential Revision: https://reviews.freebsd.org/D27022 > >> > >> Added: > >> head/lib/libutil/getlocalbase.3 (contents, props changed) > >> head/lib/libutil/getlocalbase.c (contents, props changed) > >> Modified: > >> head/lib/libutil/Makefile > >> head/lib/libutil/libutil.h > >> > >> Modified: head/lib/libutil/Makefile > >> ============================================================================== > >> --- head/lib/libutil/Makefile Sat Nov 14 15:44:28 2020 (r367685) > >> +++ head/lib/libutil/Makefile Sat Nov 14 17:57:50 2020 (r367686) > >> @@ -12,7 +12,8 @@ PACKAGE= runtime > >> LIB= util > >> SHLIB_MAJOR= 9 > >> > >> -SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ > >> +SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c \ > >> + getlocalbase.c gr_util.c \ > >> hexdump.c humanize_number.c kinfo_getfile.c \ > >> kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c \ > >> kinfo_getvmobject.c kld.c \ > >> @@ -30,7 +31,7 @@ CFLAGS+= -DINET6 > >> > >> CFLAGS+= -I${.CURDIR} -I${SRCTOP}/lib/libc/gen/ > >> > >> -MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \ > >> +MAN+= expand_number.3 flopen.3 fparseln.3 getlocalbase.3 hexdump.3 \ > >> humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ > >> kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ > >> login_auth.3 login_cap.3 \ > >> > >> Added: head/lib/libutil/getlocalbase.3 > >> ============================================================================== > >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) > >> +++ head/lib/libutil/getlocalbase.3 Sat Nov 14 17:57:50 2020 (r367686) > >> @@ -0,0 +1,110 @@ > >> +.\" > >> +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD > >> +.\" > >> +.\" Copyright 2020 Scott Long > >> +.\" > >> +.\" Redistribution and use in source and binary forms, with or without > >> +.\" modification, are permitted provided that the following conditions > >> +.\" are met: > >> +.\" 1. Redistributions of source code must retain the above copyright > >> +.\" notice, this list of conditions and the following disclaimer. > >> +.\" 2. Redistributions in binary form must reproduce the above copyright > >> +.\" notice, this list of conditions and the following disclaimer in the > >> +.\" documentation and/or other materials provided with the distribution. > >> +.\" > >> +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > >> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > >> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > >> +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > >> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > >> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > >> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > >> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > >> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > >> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > >> +.\" SUCH DAMAGE. > >> +.\" > >> +.\" $FreeBSD$ > >> +.\" > >> +.Dd Oct 28, 2020 > >> +.Dt GETLOCALBASE 3 > >> +.Os > >> +.Sh NAME > >> +.Nm getlocalbase > >> +.Nd "return the path to the local software directory" > >> +.Sh LIBRARY > >> +.Lb libutil > >> +.Sh SYNOPSIS > >> +.In libutil.h > >> +.Ft ssize_t > >> +.Fn getlocalbase "char *path" "size_t len" > >> +.Sh DESCRIPTION > >> +The > >> +.Fn getlocalbase > >> +function returns the path to the local software base directory. > >> +Normally this is the > >> +.Pa /usr/local > >> +directory. > >> +First the > >> +.Ev LOCALBASE > >> +environment variable is checked. > >> +If that doesn't exist then the > >> +.Va user.localbase > >> +sysctl is checked. > >> +If that also doesn't exist then the value of the > >> +.Dv _PATH_LOCALBASE > >> +compile-time variable is used. > >> +If that is undefined then the default of > >> +.Pa /usr/local > >> +is used. > >> +.Pp > >> +The > >> +.Fa path > >> +argument points to a caller-supplied buffer to hold the resulting pathname. > >> +The > >> +.Fa len > >> +argument is the length of the caller-supplied buffer. > >> +.Sh IMPLEMENTATION NOTES > >> +Calls to > >> +.Fn getlocalpath > >> +will perform a setugid check on the running binary before checking the > >> +environment. > >> +.Sh RETURN VALUES > >> +If the request completes without error, the size of the string copied into the > >> +buffer, including the terminating NUL, is returned. > >> +If an error occurred or the buffer was too small to hold the string, > >> +.Fn getlocalbase > >> +returns -1 and sets > >> +.Em errno > >> +to indicate the error condition. > >> +.Sh ENVIRONMENT > >> +The > >> +.Fn getlocalbase > >> +library function retrieves the > >> +.Ev LOCALBASE > >> +environment variable. > >> +.Sh ERRORS > >> +The > >> +.Fn getlocalbase > >> +function will fail and set > >> +.Va errno > >> +for the following conditions: > >> +.Bl -tag -width Er > >> +.It Bq Er EINVAL > >> +One of the passed in parameters is NULL or zero. > >> +.It Bq Er ENOMEM > >> +There isn't enough space in the passed in buffer to hold the pathname string. > >> +.El > >> +.Sh SEE ALSO > >> +.Xr env 1 , > >> +.Xr src.conf 5 , > >> +.Xr sysctl 8 > >> +.Sh HISTORY > >> +The > >> +.Nm > >> +library function first appeared in > >> +.Fx 13.0 . > >> +.Sh AUTHORS > >> +This > >> +manual page was written by > >> +.An Scott Long Aq Mt scottl@FreeBSD.org . > >> > >> Added: head/lib/libutil/getlocalbase.c > >> ============================================================================== > >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) > >> +++ head/lib/libutil/getlocalbase.c Sat Nov 14 17:57:50 2020 (r367686) > >> @@ -0,0 +1,75 @@ > >> +/*- > >> + * SPDX-License-Identifier: BSD-2-Clause > >> + * > >> + * Copyright 2020 Scott Long > >> + * > >> + * Redistribution and use in source and binary forms, with or without > >> + * modification, are permitted provided that the following conditions > >> + * are met: > >> + * 1. Redistributions of source code must retain the above copyright > >> + * notice, this list of conditions and the following disclaimer. > >> + * 2. Redistributions in binary form must reproduce the above copyright > >> + * notice, this list of conditions and the following disclaimer in the > >> + * documentation and/or other materials provided with the distribution. > >> + * > >> + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > >> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > >> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > >> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > >> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > >> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > >> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > >> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > >> + * SUCH DAMAGE. > >> + */ > >> + > >> +#include > >> +__FBSDID("$FreeBSD$"); > >> + > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> + > >> +ssize_t > >> +getlocalbase(char *path, size_t pathlen) > >> +{ > >> + size_t tmplen; > >> + const char *tmppath; > >> + > >> + if ((pathlen == 0) || (path == NULL)) { > >> + errno = EINVAL; > >> + return (-1); > >> + } > >> + > >> + tmppath = NULL; > >> + tmplen = pathlen; > >> + if (issetugid() == 0) > >> + tmppath = getenv("LOCALBASE"); > >> + > >> + if ((tmppath == NULL) && > >> + (sysctlbyname("user.localbase", path, &tmplen, NULL, 0) == 0)) { > >> + return (tmplen); > >> + } > >> + > >> + if (tmppath == NULL) > >> +#ifdef _PATH_LOCALBASE > >> + tmppath = _PATH_LOCALBASE; > >> +#else > >> + tmppath = "/usr/local"; > >> +#endif > >> + > >> + tmplen = strlcpy(path, tmppath, pathlen); > >> + if ((tmplen < 0) || (tmplen >= (ssize_t)pathlen)) { > >> + errno = ENOMEM; > >> + tmplen = -1; > >> + } > >> + > >> + return (tmplen); > >> +} > >> > >> Modified: head/lib/libutil/libutil.h > >> ============================================================================== > >> --- head/lib/libutil/libutil.h Sat Nov 14 15:44:28 2020 (r367685) > >> +++ head/lib/libutil/libutil.h Sat Nov 14 17:57:50 2020 (r367686) > >> @@ -98,6 +98,7 @@ int flopen(const char *_path, int _flags, ...); > >> int flopenat(int _dirfd, const char *_path, int _flags, ...); > >> int forkpty(int *_amaster, char *_name, > >> struct termios *_termp, struct winsize *_winp); > >> +ssize_t getlocalbase(char *path, size_t pathlen); > >> void hexdump(const void *_ptr, int _length, const char *_hdr, int _flags); > >> int humanize_number(char *_buf, size_t _len, int64_t _number, > >> const char *_suffix, int _scale, int _flags); > >> _______________________________________________ > >> svn-src-head@freebsd.org mailing list > >> https://lists.freebsd.org/mailman/listinfo/svn-src-head > >> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > > > > -- > -- From owner-svn-src-all@freebsd.org Sat Nov 14 22:17:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 004F2467294 for ; Sat, 14 Nov 2020 22:17:38 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYV816HHFz4Vgm; Sat, 14 Nov 2020 22:17:37 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 0AD285C0099; Sat, 14 Nov 2020 17:17:37 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 14 Nov 2020 17:17:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=4 uKTEnmQdUzp2pdmcBYfA9oCy47y42NIOz3V6fLkn4A=; b=Dmqx2BbNx/kK/pmoK IC+jqczDAagNBWUdjCD6hO2L+axa3SVxl2UFTa9T8ZzPxz3nEE79qCCm/v1eGR4U NxMuohf6xiznOQV1IvBqjcWh1S/scGifnw+pCuU/nPqOj4YJvtBvJzMJWtd+DoyV 1U8yLdha0qRW6CqQBUSdKh8wnPDW+/lkJWz1OwwdQeED4+2Ju8YWemjVK+HY2OKT ebHTTt2YcHeztyslCtMQyBBnHRz8T3GhA3l2aUTXbKef/ENWYN5bpNBy66fj28jl EqTSm3DpJ06Ca41iD8okPFP2qyEWzzK6tRAMhFye0Jnilz/47tn5zWY0cBa4yiZe 5Ww5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=4uKTEnmQdUzp2pdmcBYfA9oCy47y42NIOz3V6fLkn 4A=; b=FOQd4u8ANhHHRt9mgSfylNYOKhWyVUOPJhDIHYFzJY0RrGl+RDfxJYk4r 9xICB+9czZolOU5dZFiEW+Ey/h6SLlrIE+/TJZJlJEXq2qrF0FcSlblrqryTqiiO F9dWB3//uRUc6n9Ep1hzj9K/gRY3r4YVnHY9djkiuyNwV6dtuVCJ2O/v3ogTuVzv enyB6VgcY9J8tH+Vo0ibJB3f1QQxRk1ayyAj4HFPwfFPEzAq2wP4r76z1M8AC2U5 t20q9pLsmLiB/jxzIoSOnHM96YQOayrHUSRxhcjo7xcQd5FZoED5/UePd4YHJlzR pAFqtgPvp6RF4c/4SrGQaxaxYFCLQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvjedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtdejnecuhfhrohhmpefutgho thhtucfnohhnghcuoehstghothhtlhesshgrmhhstghordhorhhgqeenucggtffrrghtth gvrhhnpeeugffgtdehudeuudetledutddtgfffgeejjeettdffgfetueeggeduffevvdet gfenucffohhmrghinhepfhhrvggvsghsugdrohhrghdpthhhvgdrphgrpdhofhdrphgrne cukfhppeekrdegiedrkeelrddvudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepshgtohhtthhlsehsrghmshgtohdrohhrgh X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id 630313064AAE; Sat, 14 Nov 2020 17:17:36 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: svn commit: r367686 - head/lib/libutil From: Scott Long In-Reply-To: Date: Sat, 14 Nov 2020 15:17:35 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <1E5A94AC-6072-462F-98EF-072B09484E3C@samsco.org> References: <202011141757.0AEHvo1m098201@repo.freebsd.org> <2236AF89-1624-46B1-A170-7C7B5B4BB5E6@samsco.org> To: Gordon Bergling X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CYV816HHFz4Vgm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 22:17:38 -0000 Another oversight on my part. I have a fix, it=E2=80=99s trivial, but = I=E2=80=99m running a few more tests to be sure this time. Scott > On Nov 14, 2020, at 2:54 PM, Gordon Bergling wrote: >=20 > Hi Scott, >=20 > after r367689 the build was fixed, but on arm64 I get the following = error, > when I try to 'pkg upgrade': >=20 > $ doas pkg upgrade > Cannot determine local path > $ >=20 > Is this error somehow related to this change? >=20 > --Gordon >=20 > On Sat, Nov 14, 2020 at 11:44:29AM -0700, Scott Long wrote: >> Hi, >>=20 >> Yeah, I=E2=80=99m working on a fix, sorry. I made a last minute = change that I thought I >> had tested, but apparently hadn=E2=80=99t. >>=20 >> Scott >>=20 >>=20 >>> On Nov 14, 2020, at 11:43 AM, Gordon Bergling = wrote: >>>=20 >>> Hi Scott, >>>=20 >>> this somehow breaks the build. >>>=20 >>> = --------------------------------------------------------------------- >>> =3D=3D=3D> lib/msun (obj,all,install) >>> /tank/nfs_public/tiny/src/lib/libutil/getlocalbase.c:69:30: error: = comparison of integers of different signs: 'size_t' (aka 'unsigned = long') and 'ssize_t' (aka 'long') [-Werror,-Wsign-compare] >>> if ((tmplen < 0) || (tmplen >=3D (ssize_t)pathlen)) { >>> ~~~~~~ ^ ~~~~~~~~~~~~~~~~ >>> 1 error generated. >>> --- getlocalbase.o --- >>> *** [getlocalbase.o] Error code 1 >>> = ..................................................................... >>>=20 >>> Got this on arm64 with the following src.conf: >>>=20 >>> WITH_MALLOC_PRODUCTION=3D1 >>> WITH_EXTRA_TCP_STACKS=3D1 >>> WITH_BEARSSL=3D1 >>> WITH_PIE=3D1 >>> WITH_RETPOLINE=3D1 >>>=20 >>> --Gordon >>>=20 >>> On Sat, Nov 14, 2020 at 05:57:50PM +0000, Scott Long wrote: >>>> Author: scottl >>>> Date: Sat Nov 14 17:57:50 2020 >>>> New Revision: 367686 >>>> URL: https://svnweb.freebsd.org/changeset/base/367686 >>>>=20 >>>> Log: >>>> Add the library function getlocalbase and its manual page. This = helps to >>>> unify the retrieval of the various ways that the local software = base directory, >>>> typically "/usr/local", is expressed in the system. >>>>=20 >>>> Reviewed by: se >>>> Differential Revision: https://reviews.freebsd.org/D27022 >>>>=20 >>>> Added: >>>> head/lib/libutil/getlocalbase.3 (contents, props changed) >>>> head/lib/libutil/getlocalbase.c (contents, props changed) >>>> Modified: >>>> head/lib/libutil/Makefile >>>> head/lib/libutil/libutil.h >>>>=20 >>>> Modified: head/lib/libutil/Makefile >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/lib/libutil/Makefile Sat Nov 14 15:44:28 2020 = (r367685) >>>> +++ head/lib/libutil/Makefile Sat Nov 14 17:57:50 2020 = (r367686) >>>> @@ -12,7 +12,8 @@ PACKAGE=3D runtime >>>> LIB=3D util >>>> SHLIB_MAJOR=3D 9 >>>>=20 >>>> -SRCS=3D _secure_path.c auth.c expand_number.c flopen.c = fparseln.c gr_util.c \ >>>> +SRCS=3D _secure_path.c auth.c expand_number.c flopen.c = fparseln.c \ >>>> + getlocalbase.c gr_util.c \ >>>> hexdump.c humanize_number.c kinfo_getfile.c \ >>>> kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c \ >>>> kinfo_getvmobject.c kld.c \ >>>> @@ -30,7 +31,7 @@ CFLAGS+=3D -DINET6 >>>>=20 >>>> CFLAGS+=3D -I${.CURDIR} -I${SRCTOP}/lib/libc/gen/ >>>>=20 >>>> -MAN+=3D expand_number.3 flopen.3 fparseln.3 hexdump.3 \ >>>> +MAN+=3D expand_number.3 flopen.3 fparseln.3 getlocalbase.3 = hexdump.3 \ >>>> humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ >>>> kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ >>>> login_auth.3 login_cap.3 \ >>>>=20 >>>> Added: head/lib/libutil/getlocalbase.3 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- /dev/null 00:00:00 1970 (empty, because file is newly = added) >>>> +++ head/lib/libutil/getlocalbase.3 Sat Nov 14 17:57:50 2020 = (r367686) >>>> @@ -0,0 +1,110 @@ >>>> +.\" >>>> +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD >>>> +.\" >>>> +.\" Copyright 2020 Scott Long >>>> +.\" >>>> +.\" Redistribution and use in source and binary forms, with or = without >>>> +.\" modification, are permitted provided that the following = conditions >>>> +.\" are met: >>>> +.\" 1. Redistributions of source code must retain the above = copyright >>>> +.\" notice, this list of conditions and the following = disclaimer. >>>> +.\" 2. Redistributions in binary form must reproduce the above = copyright >>>> +.\" notice, this list of conditions and the following = disclaimer in the >>>> +.\" documentation and/or other materials provided with the = distribution. >>>> +.\" >>>> +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS = IS'' AND >>>> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED = TO, THE >>>> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOSE >>>> +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS = BE LIABLE >>>> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL >>>> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF = SUBSTITUTE GOODS >>>> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) >>>> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT >>>> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING = IN ANY WAY >>>> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF >>>> +.\" SUCH DAMAGE. >>>> +.\" >>>> +.\" $FreeBSD$ >>>> +.\" >>>> +.Dd Oct 28, 2020 >>>> +.Dt GETLOCALBASE 3 >>>> +.Os >>>> +.Sh NAME >>>> +.Nm getlocalbase >>>> +.Nd "return the path to the local software directory" >>>> +.Sh LIBRARY >>>> +.Lb libutil >>>> +.Sh SYNOPSIS >>>> +.In libutil.h >>>> +.Ft ssize_t >>>> +.Fn getlocalbase "char *path" "size_t len" >>>> +.Sh DESCRIPTION >>>> +The >>>> +.Fn getlocalbase >>>> +function returns the path to the local software base directory. >>>> +Normally this is the >>>> +.Pa /usr/local >>>> +directory. >>>> +First the >>>> +.Ev LOCALBASE >>>> +environment variable is checked. >>>> +If that doesn't exist then the >>>> +.Va user.localbase >>>> +sysctl is checked. >>>> +If that also doesn't exist then the value of the >>>> +.Dv _PATH_LOCALBASE >>>> +compile-time variable is used. >>>> +If that is undefined then the default of >>>> +.Pa /usr/local >>>> +is used. >>>> +.Pp >>>> +The >>>> +.Fa path >>>> +argument points to a caller-supplied buffer to hold the resulting = pathname. >>>> +The >>>> +.Fa len >>>> +argument is the length of the caller-supplied buffer. >>>> +.Sh IMPLEMENTATION NOTES >>>> +Calls to >>>> +.Fn getlocalpath >>>> +will perform a setugid check on the running binary before checking = the >>>> +environment. >>>> +.Sh RETURN VALUES >>>> +If the request completes without error, the size of the string = copied into the >>>> +buffer, including the terminating NUL, is returned. >>>> +If an error occurred or the buffer was too small to hold the = string, >>>> +.Fn getlocalbase >>>> +returns -1 and sets >>>> +.Em errno >>>> +to indicate the error condition. >>>> +.Sh ENVIRONMENT >>>> +The >>>> +.Fn getlocalbase >>>> +library function retrieves the >>>> +.Ev LOCALBASE >>>> +environment variable. >>>> +.Sh ERRORS >>>> +The >>>> +.Fn getlocalbase >>>> +function will fail and set >>>> +.Va errno >>>> +for the following conditions: >>>> +.Bl -tag -width Er >>>> +.It Bq Er EINVAL >>>> +One of the passed in parameters is NULL or zero. >>>> +.It Bq Er ENOMEM >>>> +There isn't enough space in the passed in buffer to hold the = pathname string. >>>> +.El >>>> +.Sh SEE ALSO >>>> +.Xr env 1 , >>>> +.Xr src.conf 5 , >>>> +.Xr sysctl 8 >>>> +.Sh HISTORY >>>> +The >>>> +.Nm >>>> +library function first appeared in >>>> +.Fx 13.0 . >>>> +.Sh AUTHORS >>>> +This >>>> +manual page was written by >>>> +.An Scott Long Aq Mt scottl@FreeBSD.org . >>>>=20 >>>> Added: head/lib/libutil/getlocalbase.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- /dev/null 00:00:00 1970 (empty, because file is newly = added) >>>> +++ head/lib/libutil/getlocalbase.c Sat Nov 14 17:57:50 2020 = (r367686) >>>> @@ -0,0 +1,75 @@ >>>> +/*- >>>> + * SPDX-License-Identifier: BSD-2-Clause >>>> + * >>>> + * Copyright 2020 Scott Long >>>> + * >>>> + * Redistribution and use in source and binary forms, with or = without >>>> + * modification, are permitted provided that the following = conditions >>>> + * are met: >>>> + * 1. Redistributions of source code must retain the above = copyright >>>> + * notice, this list of conditions and the following = disclaimer. >>>> + * 2. Redistributions in binary form must reproduce the above = copyright >>>> + * notice, this list of conditions and the following disclaimer = in the >>>> + * documentation and/or other materials provided with the = distribution. >>>> + * >>>> + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS = IS'' AND >>>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED = TO, THE >>>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOSE >>>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS = BE LIABLE >>>> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL >>>> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF = SUBSTITUTE GOODS >>>> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) >>>> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT >>>> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING = IN ANY WAY >>>> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF >>>> + * SUCH DAMAGE. >>>> + */ >>>> + >>>> +#include >>>> +__FBSDID("$FreeBSD$"); >>>> + >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> + >>>> +ssize_t >>>> +getlocalbase(char *path, size_t pathlen) >>>> +{ >>>> + size_t tmplen; >>>> + const char *tmppath; >>>> + >>>> + if ((pathlen =3D=3D 0) || (path =3D=3D NULL)) { >>>> + errno =3D EINVAL; >>>> + return (-1); >>>> + } >>>> + >>>> + tmppath =3D NULL; >>>> + tmplen =3D pathlen; >>>> + if (issetugid() =3D=3D 0) >>>> + tmppath =3D getenv("LOCALBASE"); >>>> + >>>> + if ((tmppath =3D=3D NULL) && >>>> + (sysctlbyname("user.localbase", path, &tmplen, NULL, 0) =3D=3D= 0)) { >>>> + return (tmplen); >>>> + } >>>> + >>>> + if (tmppath =3D=3D NULL) >>>> +#ifdef _PATH_LOCALBASE >>>> + tmppath =3D _PATH_LOCALBASE; >>>> +#else >>>> + tmppath =3D "/usr/local"; >>>> +#endif >>>> + >>>> + tmplen =3D strlcpy(path, tmppath, pathlen); >>>> + if ((tmplen < 0) || (tmplen >=3D (ssize_t)pathlen)) { >>>> + errno =3D ENOMEM; >>>> + tmplen =3D -1; >>>> + } >>>> + >>>> + return (tmplen); >>>> +} >>>>=20 >>>> Modified: head/lib/libutil/libutil.h >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/lib/libutil/libutil.h Sat Nov 14 15:44:28 2020 = (r367685) >>>> +++ head/lib/libutil/libutil.h Sat Nov 14 17:57:50 2020 = (r367686) >>>> @@ -98,6 +98,7 @@ int flopen(const char *_path, int _flags, = ...); >>>> int flopenat(int _dirfd, const char *_path, int _flags, = ...); >>>> int forkpty(int *_amaster, char *_name, >>>> struct termios *_termp, struct winsize *_winp); >>>> +ssize_t getlocalbase(char *path, size_t pathlen); >>>> void hexdump(const void *_ptr, int _length, const char *_hdr, = int _flags); >>>> int humanize_number(char *_buf, size_t _len, int64_t = _number, >>>> const char *_suffix, int _scale, int _flags); >>>> _______________________________________________ >>>> svn-src-head@freebsd.org mailing list >>>> https://lists.freebsd.org/mailman/listinfo/svn-src-head >>>> To unsubscribe, send any mail to = "svn-src-head-unsubscribe@freebsd.org" >>>=20 >>> --=20 >>=20 >=20 > --=20 From owner-svn-src-all@freebsd.org Sat Nov 14 22:34:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 973784675BE for ; Sat, 14 Nov 2020 22:34:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYVWd3hY8z4VsS for ; Sat, 14 Nov 2020 22:34:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x836.google.com with SMTP id b16so9810291qtb.6 for ; Sat, 14 Nov 2020 14:34:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kFlydka7vJ9MGC2Wd/WHDVHNr6lHFmzKL9lcNfPzrec=; b=Kn1vqWd7qPiiTNpgcMaci3Hh2DFed+dK6oFISrIPDU8iBJSQTlFAUqwrnbOhFLz1yW 564v66kSDJ8tjd6NTn4YYq8dLiQCbm1gVCPHEnYyo0SuqE1jXIjTD7215EMX+sNNPOxu XmShhsJUUywlBxvacS2trR4xkkKwKLdusjlaEXFHdhDY0FlNUF4jf5ZenJt+T65SFO43 nadK7yMPjLHXXiQhqx72A9q4VwbxuuaIpgCBHiOxP2xlx3zmNM3CDO7jUFaAfNzwkzaz ++Ti1pCLUaLmq2+6ptBSjwJs+8+B3b4W0H2lGGtzDyKJctu7qRlGGjIwLyjhfu+GS3Hf 96SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kFlydka7vJ9MGC2Wd/WHDVHNr6lHFmzKL9lcNfPzrec=; b=oQbe15DNnHv1fbnAOGTCk61/MlfNOXykAneA7aZF9O/YBIih2XcAK+3Oggg0115jYo VdBnkj6CSSwZ3BrZzgLXI4SJPR1+n8QuF1jqW4Q6vt0kKIN8QOWp3DYGNWtQ2rK4xl3x ibapN88eSLNAWGfCsgU9hGv1O5Uv6eAyaqJPi73ZdbAxUrkYTKPqMmP314noxG5M3F97 hmVGYfmg0hLsJGFZBXHzsZAZc7kcMIlZbPsH/1hwFOZGYWntI7w3iuy0x7BEeQttF07m mttc0C8qky4Nm8OFlUHa/0NwshqNgOVBQHm9Rd6nxRusEDpqV+QPuRDMRiOuf4RIh57D bkVQ== X-Gm-Message-State: AOAM533tnahGRIRXMeh6TWkQ6bIzpCHpaAgAK8LZ1wVY8HMfQlyEcWFY nhTA3ti433Ag6qicEgssqhmZnzmiXNqfZbf6dBxkWg== X-Google-Smtp-Source: ABdhPJyDlfbLqHGNqiwTcY+Z0XNYKrJUkmIywp6xCEb2Uu4YSDpX5zvFPeAc1m9y6c1wo++ee2twL23X8p1DuRjTZvA= X-Received: by 2002:ac8:5351:: with SMTP id d17mr8174761qto.235.1605393276390; Sat, 14 Nov 2020 14:34:36 -0800 (PST) MIME-Version: 1.0 References: <202011141920.0AEJKbpO050396@repo.freebsd.org> <20201114205036.tnxvwarsddmu4shz@mutt-hbsd> <20201114205355.j2ejnhouipjr6yhk@mutt-hbsd> In-Reply-To: From: Warner Losh Date: Sat, 14 Nov 2020 15:34:25 -0700 Message-ID: Subject: Re: svn commit: r367692 - head/sys/sys To: Mateusz Guzik Cc: Shawn Webb , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 4CYVWd3hY8z4VsS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 22:34:37 -0000 true, but a version bump forces that and versions are cheap enough... Warner On Sat, Nov 14, 2020 at 1:58 PM Mateusz Guzik wrote: > you are expected to recompile all your kernel modules every time you > update head > > On 11/14/20, Shawn Webb wrote: > > Are there any kernel modules (in base, in ports, or out-of-both-trees) > > that access struct ucred? > > > > On Sat, Nov 14, 2020 at 09:51:47PM +0100, Mateusz Guzik wrote: > >> I don't think so, it does not change any APIs > >> > >> On 11/14/20, Shawn Webb wrote: > >> > On Sat, Nov 14, 2020 at 07:20:37PM +0000, Mateusz Guzik wrote: > >> >> Author: mjg > >> >> Date: Sat Nov 14 19:20:37 2020 > >> >> New Revision: 367692 > >> >> URL: https://svnweb.freebsd.org/changeset/base/367692 > >> >> > >> >> Log: > >> >> cred: reorder cr_audit to be closer to the lock > >> >> > >> >> This makes cr_uid avoid sharing. > >> >> > >> >> Modified: > >> >> head/sys/sys/ucred.h > >> >> > >> >> Modified: head/sys/sys/ucred.h > >> >> > ============================================================================== > >> >> --- head/sys/sys/ucred.h Sat Nov 14 19:19:27 2020 (r367691) > >> >> +++ head/sys/sys/ucred.h Sat Nov 14 19:20:37 2020 (r367692) > >> >> @@ -63,6 +63,7 @@ struct ucred { > >> >> struct mtx cr_mtx; > >> >> u_int cr_ref; /* (c) reference count */ > >> >> u_int cr_users; /* (c) proc + thread using this > cred */ > >> >> + struct auditinfo_addr cr_audit; /* Audit properties. */ > >> >> #define cr_startcopy cr_uid > >> >> uid_t cr_uid; /* effective user id */ > >> >> uid_t cr_ruid; /* real user id */ > >> >> @@ -78,7 +79,6 @@ struct ucred { > >> >> void *cr_pspare2[2]; /* general use 2 */ > >> >> #define cr_endcopy cr_label > >> >> struct label *cr_label; /* MAC label */ > >> >> - struct auditinfo_addr cr_audit; /* Audit properties. */ > >> >> gid_t *cr_groups; /* groups */ > >> >> int cr_agroups; /* Available groups */ > >> >> gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small > groups */ > >> > > >> > Hey Mateusz, > >> > > >> > Since this changes KBI, does __FreeBSD_version need bumping? > >> > > >> > Thanks, > >> > > >> > -- > >> > Shawn Webb > >> > Cofounder / Security Engineer > >> > HardenedBSD > >> > > >> > GPG Key ID: 0xFF2E67A277F8E1FA > >> > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 > 0FB2 > >> > > https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > >> > > >> > >> > >> -- > >> Mateusz Guzik > > > > -- > > Shawn Webb > > Cofounder / Security Engineer > > HardenedBSD > > > > GPG Key ID: 0xFF2E67A277F8E1FA > > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 > > > https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > > > > > -- > Mateusz Guzik > From owner-svn-src-all@freebsd.org Sat Nov 14 22:56:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69D15467C4B; Sat, 14 Nov 2020 22:56:32 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYW0w1060z4WpM; Sat, 14 Nov 2020 22:56:31 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x430.google.com with SMTP id 23so14306477wrc.8; Sat, 14 Nov 2020 14:56:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kq82tm4Cu/WFJRZAdJCWhKhYDoZC68rqP8F/eDv2CQU=; b=gnXgfsrVgoQQGW6OIfoE8OSZ+OhEuTMrXjLaHne+Esui/rrR5FOSgEYK7whAUX+4iA pGI1v/AbKuh9lIDakjKP3UhGY7G8UG5DqQG/aAX+20sTTmkKfzXF4ftTNtfMaiMsuzEG 3rERnEXV6RbkVwqS0LwGqLz+tyHos4HfwvY+IfxkCilFWcauwoAHFvMJD4q8SBuB14bw lXv3boeNyhgfkaZOCVg+pnrgeb+gWlVQk0kvlXyJ1JBi8rUmJFJ/N5TvcWGzygJDbQcY vCY2Fqovv5xuA5WGtjvUTJTkt4OBaEgbMS2qA7hDGSmS8t3ATCoMt/JoLwk1+6UMh27x Uc4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kq82tm4Cu/WFJRZAdJCWhKhYDoZC68rqP8F/eDv2CQU=; b=hao+HMiKQ1Vj0EX0mKOQyk3n/+5m9ShNEjoooB8dGDNfmSSGa8Cmik1DTlSSrZG+KI xHHQbeBqkByo0tkymYaH3NPE9iHJ9CmBO4YB/yC55506pzQG7BN/D4h/ALK9Dq2firI6 R3Wsk0ZkDZcwZ3uH03qTvgTVM3qYS5KbzYSArupNqVZGOCaPr8uYuS3yQcDUmcqM73Sk ajowR4Rm14lmA7/4cqtP17Wn5c/uzfeQ8E74WkanGr6R4CoTO9j1B7wEPG6VfEtQjV8w 5kEjzVDgS98j7Hj32kMhpkNUbfg6KTa3zt03oY/It2P0b4XVuJ2V5rEviUWdniRGRKVE 4R6w== X-Gm-Message-State: AOAM530KQ3Y0URB14It4PzOhLWXOy42WHzD/AlSvUrEUSOGxo08GHmoh K4R21Yw0fApOOe4WldoukquazhETFV+ycRvkD1lzXEeHirM= X-Google-Smtp-Source: ABdhPJwOumJVKCsVe4rax6nQT+WCOuUX/2c2b5cjP9NPtkbqtKRuhBmfLc9e4g+TNvrq8UKzkyBWLv8gKsviuDxi/hc= X-Received: by 2002:a5d:5146:: with SMTP id u6mr11921017wrt.66.1605394590776; Sat, 14 Nov 2020 14:56:30 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:dec7:0:0:0:0:0 with HTTP; Sat, 14 Nov 2020 14:56:29 -0800 (PST) In-Reply-To: References: <202011141920.0AEJKbpO050396@repo.freebsd.org> <20201114205036.tnxvwarsddmu4shz@mutt-hbsd> <20201114205355.j2ejnhouipjr6yhk@mutt-hbsd> From: Mateusz Guzik Date: Sat, 14 Nov 2020 23:56:29 +0100 Message-ID: Subject: Re: svn commit: r367692 - head/sys/sys To: Warner Losh Cc: Shawn Webb , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CYW0w1060z4WpM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 22:56:32 -0000 There are "KBI" breaking changes happening all the time and version bumps only sometimes happen. The build process already has infrastructure to rebuild all port kmods as well -- see PORTS_MODULES in make.conf(5) Perhaps it would be beneficial to add checking that the kernel is older than the to-be-loaded module and refuse otherwise. Can be overwritten by a loader.conf knob, then people who run into problems explicitly asked for it. But it's not clear to me if "older" should mean build date or revision or something else. Still, I suspect it will be mostly annoying to developers. Regardless, I have no intention to working on any of this. Maybe PORTS_MODULES is just not advertised enough. On 11/14/20, Warner Losh wrote: > true, but a version bump forces that and versions are cheap enough... > > Warner > > On Sat, Nov 14, 2020 at 1:58 PM Mateusz Guzik wrote: > >> you are expected to recompile all your kernel modules every time you >> update head >> >> On 11/14/20, Shawn Webb wrote: >> > Are there any kernel modules (in base, in ports, or out-of-both-trees) >> > that access struct ucred? >> > >> > On Sat, Nov 14, 2020 at 09:51:47PM +0100, Mateusz Guzik wrote: >> >> I don't think so, it does not change any APIs >> >> >> >> On 11/14/20, Shawn Webb wrote: >> >> > On Sat, Nov 14, 2020 at 07:20:37PM +0000, Mateusz Guzik wrote: >> >> >> Author: mjg >> >> >> Date: Sat Nov 14 19:20:37 2020 >> >> >> New Revision: 367692 >> >> >> URL: https://svnweb.freebsd.org/changeset/base/367692 >> >> >> >> >> >> Log: >> >> >> cred: reorder cr_audit to be closer to the lock >> >> >> >> >> >> This makes cr_uid avoid sharing. >> >> >> >> >> >> Modified: >> >> >> head/sys/sys/ucred.h >> >> >> >> >> >> Modified: head/sys/sys/ucred.h >> >> >> >> ============================================================================== >> >> >> --- head/sys/sys/ucred.h Sat Nov 14 19:19:27 2020 (r367691) >> >> >> +++ head/sys/sys/ucred.h Sat Nov 14 19:20:37 2020 (r367692) >> >> >> @@ -63,6 +63,7 @@ struct ucred { >> >> >> struct mtx cr_mtx; >> >> >> u_int cr_ref; /* (c) reference count */ >> >> >> u_int cr_users; /* (c) proc + thread using this >> cred */ >> >> >> + struct auditinfo_addr cr_audit; /* Audit properties. */ >> >> >> #define cr_startcopy cr_uid >> >> >> uid_t cr_uid; /* effective user id */ >> >> >> uid_t cr_ruid; /* real user id */ >> >> >> @@ -78,7 +79,6 @@ struct ucred { >> >> >> void *cr_pspare2[2]; /* general use 2 */ >> >> >> #define cr_endcopy cr_label >> >> >> struct label *cr_label; /* MAC label */ >> >> >> - struct auditinfo_addr cr_audit; /* Audit properties. */ >> >> >> gid_t *cr_groups; /* groups */ >> >> >> int cr_agroups; /* Available groups */ >> >> >> gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small >> groups */ >> >> > >> >> > Hey Mateusz, >> >> > >> >> > Since this changes KBI, does __FreeBSD_version need bumping? >> >> > >> >> > Thanks, >> >> > >> >> > -- >> >> > Shawn Webb >> >> > Cofounder / Security Engineer >> >> > HardenedBSD >> >> > >> >> > GPG Key ID: 0xFF2E67A277F8E1FA >> >> > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 >> 0FB2 >> >> > >> https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc >> >> > >> >> >> >> >> >> -- >> >> Mateusz Guzik >> > >> > -- >> > Shawn Webb >> > Cofounder / Security Engineer >> > HardenedBSD >> > >> > GPG Key ID: 0xFF2E67A277F8E1FA >> > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 >> > >> https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc >> > >> >> >> -- >> Mateusz Guzik >> > -- Mateusz Guzik