From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 08:29:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38F8D670611; Mon, 2 Aug 2021 08:29:13 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GdWPj0jBnz3HrM; Mon, 2 Aug 2021 08:29:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFD461C34E; Mon, 2 Aug 2021 08:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1728TCvm035109; Mon, 2 Aug 2021 08:29:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1728TCa1035108; Mon, 2 Aug 2021 08:29:12 GMT (envelope-from git) Date: Mon, 2 Aug 2021 08:29:12 GMT Message-Id: <202108020829.1728TCa1035108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: f5536286dbc3 - stable/13 - less: upgrade to v590. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f5536286dbc34733322ee28d97ca3c0fda9a0839 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 08:29:13 -0000 The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=f5536286dbc34733322ee28d97ca3c0fda9a0839 commit f5536286dbc34733322ee28d97ca3c0fda9a0839 Author: Xin LI AuthorDate: 2021-07-18 05:20:44 +0000 Commit: Xin LI CommitDate: 2021-08-02 08:28:42 +0000 less: upgrade to v590. (cherry picked from commit 30a1828c5196c415c8afc0d50f9131885d0c6b43) (cherry picked from commit 4bcc6d14e23d1443a275fc3a494094274a2f8382) --- contrib/less/NEWS | 30 ++- contrib/less/README | 9 +- contrib/less/ch.c | 2 +- contrib/less/cmdbuf.c | 31 ++- contrib/less/command.c | 1 + contrib/less/decode.c | 93 +++++-- contrib/less/edit.c | 4 +- contrib/less/filename.c | 57 ++-- contrib/less/funcs.h | 12 +- contrib/less/help.c | 4 +- contrib/less/less.h | 1 + contrib/less/less.hlp | 2 + contrib/less/less.nro | 102 +++++--- contrib/less/lessecho.nro | 2 +- contrib/less/lesskey.c | 607 ++++--------------------------------------- contrib/less/lesskey.h | 24 ++ contrib/less/lesskey.nro | 51 ++-- contrib/less/lesskey_parse.c | 580 +++++++++++++++++++++++++++++++++++++++++ contrib/less/line.c | 85 +++--- contrib/less/linenum.c | 23 ++ contrib/less/optfunc.c | 61 ++++- contrib/less/opttbl.c | 23 +- contrib/less/output.c | 15 +- contrib/less/screen.c | 15 +- contrib/less/tags.c | 18 +- contrib/less/version.c | 15 +- contrib/less/xbuf.c | 52 ++++ contrib/less/xbuf.h | 15 ++ usr.bin/less/Makefile | 5 +- usr.bin/less/defines.h | 6 +- usr.bin/lesskey/Makefile | 2 +- 31 files changed, 1184 insertions(+), 763 deletions(-) diff --git a/contrib/less/NEWS b/contrib/less/NEWS index bc5afd655ddc..a403c5d8a875 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -3,8 +3,7 @@ ====================================================================== - For the latest news about less, see the "less" Web page: - https://greenwoodsoftware.com/less + For the latest news about less, see https://greenwoodsoftware.com/less You can also download the latest version of less from there. Report bugs, suggestions or comments at @@ -12,7 +11,32 @@ ====================================================================== - Major changes between "less" versions 563 and 581.2 + Major changes between "less" versions 581 and 590 + +* Make less able to read lesskey source files (deprecating lesskey). + +* If XDG_CONFIG_HOME is set, find lesskey source file + in $XDG_CONFIG_HOME/lesskey rather than $HOME/.lesskey. + +* If XDG_DATA_HOME is set, find and store history file + in $XDG_DATA_HOME/lesshst rather than $HOME/.lesshst. + +* Add the --lesskey-src option. + +* Add the --file-size option. + +* With -F, if screen is resized to make file fit on one screen, don't exit. + +* Fix bug which could leave terminal in mouse-reporting mode + after exiting less. + +* Fix bug which caused failure to respond to window resize. + +* Fix backslash bug searching in tag file. + +====================================================================== + + Major changes between "less" versions 563 and 581 * Change ESC-u command to toggle, not disable, highlighting per man page. diff --git a/contrib/less/README b/contrib/less/README index 2acbd00d762a..4a5aa62a44ee 100644 --- a/contrib/less/README +++ b/contrib/less/README @@ -7,9 +7,7 @@ ************************************************************************** ************************************************************************** - Less, version 581.2 - - This is the distribution of less, version 581.2, released 28 Apr 2021. + This is the source code distribution of "less". This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -27,6 +25,11 @@ ========================================================================= +You should build from a clone of a git repository +ONLY IF you are doing development on the less source itself. +If you are merely using less as a tool, you should download a release +from http://greenwoodsoftware.com and NOT from github. + 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. diff --git a/contrib/less/ch.c b/contrib/less/ch.c index bab0692f7437..379dd84c41b8 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -860,7 +860,7 @@ ch_init(f, flags) * Allocate and initialize a new filestate. */ thisfile = (struct filestate *) - calloc(1, sizeof(struct filestate)); + ecalloc(1, sizeof(struct filestate)); thisfile->buflist.next = thisfile->buflist.prev = END_OF_CHAIN; thisfile->nbufs = 0; thisfile->flags = flags; diff --git a/contrib/less/cmdbuf.c b/contrib/less/cmdbuf.c index 9cc1f3e94977..dd135382aa11 100644 --- a/contrib/less/cmdbuf.c +++ b/contrib/less/cmdbuf.c @@ -1401,11 +1401,12 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name(VOID_PARAM) +histfile_name(must_exist) + int must_exist; { char *home; + char *xdg; char *name; - int len; /* See if filename is explicitly specified by $LESSHISTFILE. */ name = lgetenv("LESSHISTFILE"); @@ -1421,19 +1422,25 @@ histfile_name(VOID_PARAM) if (strcmp(LESSHISTFILE, "") == 0 || strcmp(LESSHISTFILE, "-") == 0) return (NULL); - /* Otherwise, file is in $HOME. */ + /* Try in $XDG_DATA_HOME first, then in $HOME. */ + xdg = lgetenv("XDG_DATA_HOME"); home = lgetenv("HOME"); - if (isnullenv(home)) - { #if OS2 + if (isnullenv(home)) home = lgetenv("INIT"); - if (isnullenv(home)) #endif - return (NULL); + name = NULL; + if (!must_exist) + { + /* If we're writing the file and the file already exists, use it. */ + name = dirfile(xdg, &LESSHISTFILE[1], 1); + if (name == NULL) + name = dirfile(home, LESSHISTFILE, 1); } - len = (int) (strlen(home) + strlen(LESSHISTFILE) + 2); - name = (char *) ecalloc(len, sizeof(char)); - SNPRINTF2(name, len, "%s/%s", home, LESSHISTFILE); + if (name == NULL) + name = dirfile(xdg, &LESSHISTFILE[1], must_exist); + if (name == NULL) + name = dirfile(home, LESSHISTFILE, must_exist); return (name); } @@ -1454,7 +1461,7 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) char *p; int *skip = NULL; - filename = histfile_name(); + filename = histfile_name(1); if (filename == NULL) return; f = fopen(filename, "r"); @@ -1700,7 +1707,7 @@ save_cmdhist(VOID_PARAM) if (!histfile_modified()) return; - histname = histfile_name(); + histname = histfile_name(0); if (histname == NULL) return; tempname = make_tempname(histname); diff --git a/contrib/less/command.c b/contrib/less/command.c index ae59181c2827..171788f2e750 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -797,6 +797,7 @@ prompt(VOID_PARAM) entire_file_displayed() && !(ch_getflags() & CH_HELPFILE) && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); + quit_if_one_screen = FALSE; /* only get one chance at this */ #if MSDOS_COMPILER==WIN32C /* diff --git a/contrib/less/decode.c b/contrib/less/decode.c index f3bfb7a8ead2..7e9b167bc786 100644 --- a/contrib/less/decode.c +++ b/contrib/less/decode.c @@ -339,21 +339,41 @@ init_cmds(VOID_PARAM) add_fcmd_table((char*)cmdtable, sizeof(cmdtable)); add_ecmd_table((char*)edittable, sizeof(edittable)); #if USERFILE +#ifdef BINDIR /* For backwards compatibility */ + /* Try to add tables in the OLD system lesskey file. */ + add_hometable(lesskey, NULL, BINDIR "/.sysless", 1); +#endif /* - * For backwards compatibility, - * try to add tables in the OLD system lesskey file. + * Try to load lesskey source file or binary file. + * If the source file succeeds, don't load binary file. + * The binary file is likely to have been generated from + * a (possibly out of date) copy of the src file, + * so loading it is at best redundant. */ -#ifdef BINDIR - add_hometable(NULL, BINDIR "/.sysless", 1); -#endif /* - * Try to add the tables in the system lesskey file. + * Try to add tables in system lesskey src file. */ - add_hometable("LESSKEY_SYSTEM", LESSKEYFILE_SYS, 1); +#if HAVE_LESSKEYSRC + if (add_hometable(lesskey_src, "LESSKEYIN_SYSTEM", LESSKEYINFILE_SYS, 1) != 0) +#endif + { + /* + * Try to add the tables in the system lesskey binary file. + */ + add_hometable(lesskey, "LESSKEY_SYSTEM", LESSKEYFILE_SYS, 1); + } /* - * Try to add the tables in the standard lesskey file "$HOME/.less". + * Try to add tables in the lesskey src file "$HOME/.lesskey". */ - add_hometable("LESSKEY", LESSKEYFILE, 0); +#if HAVE_LESSKEYSRC + if (add_hometable(lesskey_src, "LESSKEYIN", DEF_LESSKEYINFILE, 0) != 0) +#endif + { + /* + * Try to add the tables in the standard lesskey binary file "$HOME/.less". + */ + add_hometable(lesskey, "LESSKEY", LESSKEYFILE, 0); + } #endif } @@ -877,32 +897,63 @@ lesskey(filename, sysvar) return (new_lesskey(buf, (int)len, sysvar)); } +#if HAVE_LESSKEYSRC + public int +lesskey_src(filename, sysvar) + char *filename; + int sysvar; +{ + static struct lesskey_tables tables; + int r = parse_lesskey(filename, &tables); + if (r != 0) + return (r); + add_fcmd_table(tables.cmdtable.buf.data, tables.cmdtable.buf.end); + add_ecmd_table(tables.edittable.buf.data, tables.edittable.buf.end); + add_var_table(sysvar ? &list_sysvar_tables : &list_var_tables, + tables.vartable.buf.data, tables.vartable.buf.end); + return (0); +} + + void +lesskey_parse_error(s) + char *s; +{ + PARG parg; + parg.p_string = s; + error("%s", &parg); +} +#endif /* HAVE_LESSKEYSRC */ + /* - * Add the standard lesskey file "$HOME/.less" + * Add a lesskey file. */ - public void -add_hometable(envname, def_filename, sysvar) + public int +add_hometable(call_lesskey, envname, def_filename, sysvar) + int (*call_lesskey)(char *, int); char *envname; char *def_filename; int sysvar; { char *filename; - PARG parg; + int r; if (envname != NULL && (filename = lgetenv(envname)) != NULL) filename = save(filename); - else if (sysvar) + else if (sysvar) /* def_filename is full path */ filename = save(def_filename); - else - filename = homefile(def_filename); - if (filename == NULL) - return; - if (lesskey(filename, sysvar) < 0) + else /* def_filename is just basename */ { - parg.p_string = filename; - error("Cannot use lesskey file \"%s\"", &parg); + char *xdg = lgetenv("XDG_CONFIG_HOME"); + if (!isnullenv(xdg)) + filename = dirfile(xdg, def_filename+1, 1); + if (filename == NULL) + filename = homefile(def_filename); } + if (filename == NULL) + return -1; + r = (*call_lesskey)(filename, sysvar); free(filename); + return (r); } #endif diff --git a/contrib/less/edit.c b/contrib/less/edit.c index 12631dba6bac..529ed75b0afe 100644 --- a/contrib/less/edit.c +++ b/contrib/less/edit.c @@ -26,6 +26,7 @@ extern int force_open; extern int is_tty; extern int sigs; extern int hshift; +extern int want_filesize; extern IFILE curr_ifile; extern IFILE old_ifile; extern struct scrpos initial_scrpos; @@ -487,7 +488,8 @@ edit_ifile(ifile) cmd_addhist(ml_examine, qfilename, 1); free(qfilename); } - + if (want_filesize) + scan_eof(); } free(filename); return (0); diff --git a/contrib/less/filename.c b/contrib/less/filename.c index 177cb946364a..aba8d3a362e3 100644 --- a/contrib/less/filename.c +++ b/contrib/less/filename.c @@ -216,10 +216,11 @@ shell_quote(s) * Return a pathname that points to a specified file in a specified directory. * Return NULL if the file does not exist in the directory. */ - static char * -dirfile(dirname, filename) + public char * +dirfile(dirname, filename, must_exist) char *dirname; char *filename; + int must_exist; { char *pathname; int len; @@ -235,17 +236,20 @@ dirfile(dirname, filename) if (pathname == NULL) return (NULL); SNPRINTF3(pathname, len, "%s%s%s", dirname, PATHNAME_SEP, filename); - /* - * Make sure the file exists. - */ - f = open(pathname, OPEN_READ); - if (f < 0) + if (must_exist) { - free(pathname); - pathname = NULL; - } else - { - close(f); + /* + * Make sure the file exists. + */ + f = open(pathname, OPEN_READ); + if (f < 0) + { + free(pathname); + pathname = NULL; + } else + { + close(f); + } } return (pathname); } @@ -259,25 +263,19 @@ homefile(filename) { char *pathname; - /* - * Try $HOME/filename. - */ - pathname = dirfile(lgetenv("HOME"), filename); + /* Try $HOME/filename. */ + pathname = dirfile(lgetenv("HOME"), filename, 1); if (pathname != NULL) return (pathname); #if OS2 - /* - * Try $INIT/filename. - */ - pathname = dirfile(lgetenv("INIT"), filename); + /* Try $INIT/filename. */ + pathname = dirfile(lgetenv("INIT"), filename, 1); if (pathname != NULL) return (pathname); #endif #if MSDOS_COMPILER || OS2 - /* - * Look for the file anywhere on search path. - */ - pathname = (char *) calloc(_MAX_PATH, sizeof(char)); + /* Look for the file anywhere on search path. */ + pathname = (char *) ecalloc(_MAX_PATH, sizeof(char)); #if MSDOS_COMPILER==DJGPPC { char *res = searchpath(filename); @@ -517,6 +515,7 @@ seek_filesize(f) return ((POSITION) spos); } +#if HAVE_POPEN /* * Read a string from a file. * Return a pointer to the string in memory. @@ -560,10 +559,6 @@ readfd(fd) return (buf); } - - -#if HAVE_POPEN - /* * Execute a shell command. * Return a pointer to a pipe connected to the shell command's standard output. @@ -812,6 +807,7 @@ lrealpath(path) return (save(path)); } +#if HAVE_POPEN /* * Return number of %s escapes in a string. * Return a large number if there are any other % escapes besides %s. @@ -837,6 +833,7 @@ num_pct_s(lessopen) } return (num); } +#endif /* * See if we should open a "replacement file" @@ -953,10 +950,13 @@ open_altfile(filename, pf, pfd) cmd = readfd(fd); pclose(fd); if (*cmd == '\0') + { /* * Pipe is empty. This means there is no alt file. */ + free(cmd); return (NULL); + } return (cmd); #endif /* HAVE_POPEN */ } @@ -1122,4 +1122,3 @@ last_component(name) } return (name); } - diff --git a/contrib/less/funcs.h b/contrib/less/funcs.h index 12930356c938..330540ac2156 100644 --- a/contrib/less/funcs.h +++ b/contrib/less/funcs.h @@ -106,7 +106,8 @@ public int ecmd_decode LESSPARAMS ((char *cmd, char **sp)); public char * lgetenv LESSPARAMS ((char *var)); public int isnullenv LESSPARAMS ((char* s)); public int lesskey LESSPARAMS ((char *filename, int sysvar)); -public void add_hometable LESSPARAMS ((char *envname, char *def_filename, int sysvar)); +public int lesskey_src LESSPARAMS ((char *filename, int sysvar)); +public int add_hometable LESSPARAMS ((int (*call_lesskey)(char *, int), char *envname, char *def_filename, int sysvar)); public int editchar LESSPARAMS ((int c, int flags)); public void init_textlist LESSPARAMS ((struct textlist *tlist, char *str)); public char * forw_textlist LESSPARAMS ((struct textlist *tlist, char *prev)); @@ -129,6 +130,7 @@ public void use_logfile LESSPARAMS ((char *filename)); public char * shell_unquote LESSPARAMS ((char *str)); public char * get_meta_escape LESSPARAMS ((VOID_PARAM)); public char * shell_quote LESSPARAMS ((char *s)); +public char * dirfile LESSPARAMS ((char *dirname, char *filename, int must_exist)); public char * homefile LESSPARAMS ((char *filename)); public char * fexpand LESSPARAMS ((char *s)); public char * fcomplete LESSPARAMS ((char *s)); @@ -213,6 +215,7 @@ public void add_lnum LESSPARAMS ((LINENUM linenum, POSITION pos)); public LINENUM find_linenum LESSPARAMS ((POSITION pos)); public POSITION find_pos LESSPARAMS ((LINENUM linenum)); public LINENUM currline LESSPARAMS ((int where)); +public void scan_eof LESSPARAMS ((VOID_PARAM)); public void lsystem LESSPARAMS ((char *cmd, char *donemsg)); public int pipe_mark LESSPARAMS ((int c, char *cmd)); public int pipe_data LESSPARAMS ((char *cmd, POSITION spos, POSITION epos)); @@ -235,6 +238,7 @@ public void calc_jump_sline LESSPARAMS ((VOID_PARAM)); public void opt_shift LESSPARAMS ((int type, char *s)); public void calc_shift_count LESSPARAMS ((VOID_PARAM)); public void opt_k LESSPARAMS ((int type, char *s)); +public void opt_ks LESSPARAMS ((int type, char *s)); public void opt_t LESSPARAMS ((int type, char *s)); public void opt__T LESSPARAMS ((int type, char *s)); public void opt_p LESSPARAMS ((int type, char *s)); @@ -251,6 +255,7 @@ public void opt_mousecap LESSPARAMS ((int type, char *s)); public void opt_wheel_lines LESSPARAMS ((int type, char *s)); public void opt_linenum_width LESSPARAMS ((int type, char *s)); public void opt_status_col_width LESSPARAMS ((int type, char *s)); +public void opt_filesize LESSPARAMS ((int type, char *s)); public void opt_ttyin_name LESSPARAMS ((int type, char *s)); public void opt_rstat LESSPARAMS ((int type, char *s)); public int get_swindow LESSPARAMS ((VOID_PARAM)); @@ -280,6 +285,7 @@ public void put_line LESSPARAMS ((VOID_PARAM)); public void flush LESSPARAMS ((VOID_PARAM)); public void set_output LESSPARAMS ((int fd)); public int putchr LESSPARAMS ((int c)); +public void clear_bot_if_needed LESSPARAMS ((VOID_PARAM)); public void putstr LESSPARAMS ((constant char *s)); public int less_printf LESSPARAMS ((char *fmt, PARG *parg)); public void get_return LESSPARAMS ((VOID_PARAM)); @@ -342,3 +348,7 @@ public void close_getchr LESSPARAMS ((VOID_PARAM)); public int default_wheel_lines LESSPARAMS ((VOID_PARAM)); public void rstat LESSPARAMS ((char st)); public int getchr LESSPARAMS ((VOID_PARAM)); +public void xbuf_init LESSPARAMS ((struct xbuffer *xbuf)); +public void xbuf_deinit LESSPARAMS ((struct xbuffer *xbuf)); +public void xbuf_reset LESSPARAMS ((struct xbuffer *xbuf)); +public void xbuf_add LESSPARAMS ((struct xbuffer *xbuf, char ch)); diff --git a/contrib/less/help.c b/contrib/less/help.c index f5b4aa1fbf1a..9dabd43ca221 100644 --- a/contrib/less/help.c +++ b/contrib/less/help.c @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 14:59 on 2021/4/28 */ +/* This file was generated by mkhelp.pl from less.hlp at 17:45 on 2021/6/3 */ #include "less.h" constant char helpdata[] = { '\n', @@ -208,6 +208,8 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','d','i','s','p','l','a','y',' ','t','i','l','d','e','s',' ','a','f','t','e','r',' ','e','n','d',' ','o','f',' ','f','i','l','e','.','\n', ' ',' ','-','#',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','s','h','i','f','t','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','h','o','r','i','z','o','n','t','a','l',' ','s','c','r','o','l','l',' ','a','m','o','u','n','t',' ','(','0',' ','=',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',')','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','f','i','l','e','-','s','i','z','e','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','A','u','t','o','m','a','t','i','c','a','l','l','y',' ','d','e','t','e','r','m','i','n','e',' ','t','h','e',' ','s','i','z','e',' ','o','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','f','o','l','l','o','w','-','n','a','m','e','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','T','h','e',' ','F',' ','c','o','m','m','a','n','d',' ','c','h','a','n','g','e','s',' ','f','i','l','e','s',' ','i','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e',' ','i','s',' ','r','e','n','a','m','e','d','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','i','n','c','s','e','a','r','c','h','\n', diff --git a/contrib/less/less.h b/contrib/less/less.h index 4751976bac18..83e31514be3e 100644 --- a/contrib/less/less.h +++ b/contrib/less/less.h @@ -571,6 +571,7 @@ struct loption; struct hilite_tree; struct ansi_state; #include "pattern.h" +#include "xbuf.h" #include "funcs.h" /* Functions not included in funcs.h */ diff --git a/contrib/less/less.hlp b/contrib/less/less.hlp index 1e1ebf447711..333a0b576c5e 100644 --- a/contrib/less/less.hlp +++ b/contrib/less/less.hlp @@ -205,6 +205,8 @@ Don't display tildes after end of file. -# [_N] .... --shift=[_N] Set horizontal scroll amount (0 = one half screen width). + --file-size + Automatically determine the size of the input file. --follow-name The F command changes files if the input file is renamed. --incsearch diff --git a/contrib/less/less.nro b/contrib/less/less.nro index f148ccb76d98..7c8372b500c6 100644 --- a/contrib/less/less.nro +++ b/contrib/less/less.nro @@ -1,5 +1,5 @@ '\" t -.TH LESS 1 "Version 581.2: 28 Apr 2021" +.TH LESS 1 "Version 590: 03 Jun 2021" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -759,13 +759,38 @@ Causes .I less to open and interpret the named file as a .IR lesskey (1) -file. +binary 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), it is also used as a .I lesskey file. +.IP "\-\-lesskey-src=\fIfilename\fP" +Causes +.I less +to open and interpret the named file as a +.IR lesskey (1) +source file. +If the LESSKEYIN or LESSKEYIN_SYSTEM environment variable is set, or +if a lesskey source file is found in a standard place (see KEY BINDINGS), +it is also used as a +.I "lesskey source" +file. +Prior to version 582, the +.I lesskey +program needed to be run to convert a +.I "lesskey source" +file to a +.I "lesskey binary" +file for +.I less +to use. +Newer versions of +.I less +read the +.I "lesskey source" +file directly and ignore the binary file if the source file exists. .IP "\-K or \-\-quit-on-intr" Causes .I less @@ -1054,6 +1079,12 @@ If the number is specified as a fraction, the actual number of scroll positions is recalculated if the terminal window is resized, so that the actual scroll remains at the specified fraction of the screen width. +.IP "\-\-file-size" +If \-\-file-size is specified, +.I less +will determine the size of the file +immediately after opening the file. +Normally this is not done, because it can be slow if the input file is large. .IP "\-\-follow-name" Normally, if the input file is renamed while an F command is executing, .I less @@ -1222,57 +1253,61 @@ 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 -.IR lesskey (1) -to create a lesskey file. +commands by creating a lesskey source file. This file specifies a set of command keys and an action associated with each key. -You may also use -.I lesskey -to change the line-editing keys (see LINE EDITING), +You may also change the line-editing keys (see LINE EDITING), and to set environment variables. -If the environment variable LESSKEY is set, +If the environment variable LESSKEYIN is set, .I less -uses that as the name of the lesskey file. +uses that as the name of the lesskey source file. Otherwise, .I less -looks in a standard place for the lesskey file: +looks in a standard place for the lesskey source file: On Unix systems, .I less -looks for a lesskey file called "$HOME/.less". +looks for a lesskey file called "$XDG_CONFIG_HOME/lesskey" or "$HOME/.lesskey". On MS-DOS and Windows systems, .I less -looks for a lesskey file called "$HOME/_less", and if it is not found there, -then looks for a lesskey file called "_less" in any directory specified +looks for a lesskey file called "$HOME/_lesskey", and if it is not found there, +then looks for a lesskey file called "_lesskey" in any directory specified in the PATH environment variable. On OS/2 systems, .I less -looks for a lesskey file called "$HOME/less.ini", and if it is not found, -then looks for a lesskey file called "less.ini" in any directory specified +looks for a lesskey file called "$HOME/lesskey.ini", and if it is not found, +then looks for a lesskey file called "lesskey.ini" in any directory specified in the INIT environment variable, and if it not found there, -then looks for a lesskey file called "less.ini" in any directory specified +then looks for a lesskey file called "lesskey.ini" in any directory specified in the PATH environment variable. See the .I lesskey manual page for more details. -.P -A system-wide lesskey file may also be set up to provide key bindings. +.PP +A system-wide lesskey source file may also be set up to provide key bindings. If a key is defined in both a local lesskey file and in the system-wide file, key bindings in the local file take precedence over those in the system-wide file. -If the environment variable LESSKEY_SYSTEM is set, +If the environment variable LESSKEYIN_SYSTEM is set, .I less uses that as the name of the system-wide lesskey file. Otherwise, .I less looks in a standard place for the system-wide lesskey file: -On Unix systems, the system-wide lesskey file is /usr/local/etc/sysless. +On Unix systems, the system-wide lesskey file is /usr/local/etc/syslesskey. (However, if .I less was built with a different sysconf directory than /usr/local/etc, 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. +On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_syslesskey. +On OS/2 systems, the system-wide lesskey file is c:\esyslesskey.ini. +.PP +Previous versions of +.I less +(before v582) used lesskey files with a binary format, produced by the +.I lesskey +program. It is no longer necessary to use the +.I lesskey +program. . .SH "INPUT PREPROCESSOR" You may define an "input preprocessor" for @@ -1890,20 +1925,29 @@ Name of the history file used to remember search commands and shell commands between invocations of .IR less . If set to "\-" or "/dev/null", a history file is not used. -The default is "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on -DOS and Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" +The default is "$XDG_DATA_HOME/lesshst" or "$HOME/.lesshst" on Unix systems, +"$HOME/_lesshst" on DOS and Windows systems, +or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" on OS/2 systems. .IP LESSHISTSIZE The maximum number of commands to save in the history file. The default is 100. +.IP LESSKEYIN +Name of the default +.I "lesskey source" +file. .IP LESSKEY Name of the default -.IR lesskey (1) +.I "lesskey binary" +file. (Not used if "$LESSKEYIN" exists.) +.IP LESSKEYIN_SYSTEM +Name of the default system-wide +.I "lesskey source" file. .IP LESSKEY_SYSTEM Name of the default system-wide -.IR lesskey (1) -file. +.I "lesskey binary" +file. (Not used if "$LESSKEYIN_SYSTEM" exists.) .IP LESSMETACHARS List of characters which are considered "metacharacters" by the shell. .IP LESSMETAESCAPE @@ -1981,4 +2025,4 @@ Report bugs at https://github.com/gwsw/less/issues. .br For more information, see the less homepage at .br -https://greenwoodsoftware.com/less. +https://greenwoodsoftware.com/less diff --git a/contrib/less/lessecho.nro b/contrib/less/lessecho.nro index 484efa135d34..4733a93edd68 100644 --- a/contrib/less/lessecho.nro +++ b/contrib/less/lessecho.nro @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 581.2: 28 Apr 2021" +.TH LESSECHO 1 "Version 590: 03 Jun 2021" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS diff --git a/contrib/less/lesskey.c b/contrib/less/lesskey.c index de7a9bfc8311..b5130cccb8f7 100644 --- a/contrib/less/lesskey.c +++ b/contrib/less/lesskey.c @@ -80,121 +80,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "less.h" +#include +#include +#include #include "lesskey.h" #include "cmd.h" - -struct cmdname -{ - char *cn_name; - int cn_action; -}; - -struct cmdname cmdnames[] = -{ - { "back-bracket", A_B_BRACKET }, - { "back-line", A_B_LINE }, - { "back-line-force", A_BF_LINE }, - { "back-screen", A_B_SCREEN }, - { "back-scroll", A_B_SCROLL }, - { "back-search", A_B_SEARCH }, - { "back-window", A_B_WINDOW }, - { "clear-mark", A_CLRMARK }, - { "debug", A_DEBUG }, - { "digit", A_DIGIT }, - { "display-flag", A_DISP_OPTION }, - { "display-option", A_DISP_OPTION }, - { "end", A_GOEND }, - { "end-scroll", A_RRSHIFT }, - { "examine", A_EXAMINE }, - { "filter", A_FILTER }, - { "first-cmd", A_FIRSTCMD }, - { "firstcmd", A_FIRSTCMD }, - { "flush-repaint", A_FREPAINT }, - { "forw-bracket", A_F_BRACKET }, - { "forw-forever", A_F_FOREVER }, - { "forw-until-hilite", A_F_UNTIL_HILITE }, - { "forw-line", A_F_LINE }, - { "forw-line-force", A_FF_LINE }, - { "forw-screen", A_F_SCREEN }, - { "forw-screen-force", A_FF_SCREEN }, - { "forw-scroll", A_F_SCROLL }, - { "forw-search", A_F_SEARCH }, - { "forw-window", A_F_WINDOW }, - { "goto-end", A_GOEND }, - { "goto-end-buffered", A_GOEND_BUF }, - { "goto-line", A_GOLINE }, - { "goto-mark", A_GOMARK }, - { "help", A_HELP }, - { "index-file", A_INDEX_FILE }, - { "invalid", A_UINVALID }, - { "left-scroll", A_LSHIFT }, - { "next-file", A_NEXT_FILE }, - { "next-tag", A_NEXT_TAG }, - { "noaction", A_NOACTION }, - { "no-scroll", A_LLSHIFT }, - { "percent", A_PERCENT }, - { "pipe", A_PIPE }, - { "prev-file", A_PREV_FILE }, - { "prev-tag", A_PREV_TAG }, - { "quit", A_QUIT }, - { "remove-file", A_REMOVE_FILE }, - { "repaint", A_REPAINT }, - { "repaint-flush", A_FREPAINT }, - { "repeat-search", A_AGAIN_SEARCH }, - { "repeat-search-all", A_T_AGAIN_SEARCH }, - { "reverse-search", A_REVERSE_SEARCH }, - { "reverse-search-all", A_T_REVERSE_SEARCH }, - { "right-scroll", A_RSHIFT }, - { "set-mark", A_SETMARK }, - { "set-mark-bottom", A_SETMARKBOT }, - { "shell", A_SHELL }, - { "status", A_STAT }, - { "toggle-flag", A_OPT_TOGGLE }, - { "toggle-option", A_OPT_TOGGLE }, - { "undo-hilite", A_UNDO_SEARCH }, - { "clear-search", A_CLR_SEARCH }, - { "version", A_VERSION }, - { "visual", A_VISUAL }, - { NULL, 0 } -}; - -struct cmdname editnames[] = -{ - { "back-complete", EC_B_COMPLETE }, - { "backspace", EC_BACKSPACE }, - { "delete", EC_DELETE }, - { "down", EC_DOWN }, - { "end", EC_END }, - { "expand", EC_EXPAND }, - { "forw-complete", EC_F_COMPLETE }, - { "home", EC_HOME }, - { "insert", EC_INSERT }, - { "invalid", EC_UINVALID }, - { "kill-line", EC_LINEKILL }, - { "abort", EC_ABORT }, - { "left", EC_LEFT }, - { "literal", EC_LITERAL }, - { "right", EC_RIGHT }, - { "up", EC_UP }, - { "word-backspace", EC_W_BACKSPACE }, - { "word-delete", EC_W_DELETE }, - { "word-left", EC_W_LEFT }, - { "word-right", EC_W_RIGHT }, - { NULL, 0 } -}; - -struct table -{ - struct cmdname *names; - char *pbuffer; - char buffer[MAX_USERCMD]; -}; - -struct table cmdtable; -struct table edittable; -struct table vartable; -struct table *currtable = &cmdtable; +#include "defines.h" char fileheader[] = { C0_LESSKEY_MAGIC, @@ -215,26 +106,44 @@ char endsection[1] = { END_SECTION }; char *infile = NULL; char *outfile = NULL ; -int linenum; -int errors; - extern char version[]; - void -usage(VOID_PARAM) + static void +usage(void) { fprintf(stderr, "usage: lesskey [-o output] [input]\n"); exit(1); } - char * + void +lesskey_parse_error(s) + char *s; +{ + fprintf(stderr, "%s\n", s); +} + + void * +ecalloc(count, size) + int count; + unsigned int size; +{ + void *p; + + p = calloc(count, size); + if (p != NULL) + return (p); + fprintf(stderr, "lesskey: cannot allocate %d bytes of memory\n", count*size); + exit(1); +} + + static char * mkpathname(dirname, filename) char *dirname; char *filename; { char *pathname; *** 1959 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 12:18:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E883A67370D; Mon, 2 Aug 2021 12:18:47 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GdcVb5LnRz3qCk; Mon, 2 Aug 2021 12:18:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F4201F62A; Mon, 2 Aug 2021 12:18:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172CIlK5043769; Mon, 2 Aug 2021 12:18:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172CIlql043768; Mon, 2 Aug 2021 12:18:47 GMT (envelope-from git) Date: Mon, 2 Aug 2021 12:18:47 GMT Message-Id: <202108021218.172CIlql043768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: e4ee2a39ade5 - stable/13 - tcp: Add PRR cwnd reduction for non-SACK loss MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e4ee2a39ade5d6be38aed21f2fe1224c77f61af2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 12:18:48 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=e4ee2a39ade5d6be38aed21f2fe1224c77f61af2 commit e4ee2a39ade5d6be38aed21f2fe1224c77f61af2 Author: Richard Scheffenegger AuthorDate: 2021-06-19 17:06:48 +0000 Commit: Richard Scheffenegger CommitDate: 2021-08-02 11:59:23 +0000 tcp: Add PRR cwnd reduction for non-SACK loss This completes PRR cwnd reduction in all circumstances for the base TCP stack (SACK loss recovery, ECN window reduction, non-SACK loss recovery), preventing the arriving ACKs to clock out new data at the old, too high rate. This reduces the chance to induce additional losses while recovering from loss (during congested network conditions). For non-SACK loss recovery, each ACK is assumed to have one MSS delivered. In order to prevent ACK-split attacks, only one window worth of ACKs is considered to actually have delivered new data. MFC after: 6 weeks Reviewed By: rrs, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29441 (cherry picked from commit 74d7fc8753a76851db6db556ff0f09de1fbb26d5) --- sys/netinet/tcp_input.c | 56 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 6d86e43f07dd..f7ca4ce05200 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2605,8 +2605,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, cc_ack_received(tp, th, nsegs, CC_DUPACK); if (V_tcp_do_prr && - IN_FASTRECOVERY(tp->t_flags) && - (tp->t_flags & TF_SACK_PERMIT)) { + IN_FASTRECOVERY(tp->t_flags)) { tcp_do_prr_ack(tp, th, &to); } else if ((tp->t_flags & TF_SACK_PERMIT) && (to.to_flags & TOF_SACK) && @@ -2682,8 +2681,16 @@ enter_recovery: * snd_ssthresh is already updated by * cc_cong_signal. */ - tp->sackhint.prr_delivered = - tp->sackhint.sacked_bytes; + if ((tp->t_flags & TF_SACK_PERMIT) && + (to.to_flags & TOF_SACK)) { + tp->sackhint.prr_delivered = + tp->sackhint.sacked_bytes; + } else { + tp->sackhint.prr_delivered = + imin(tp->snd_max - tp->snd_una, + imin(INT_MAX / 65536, + tp->t_dupacks) * maxseg); + } tp->sackhint.recover_fs = max(1, tp->snd_nxt - tp->snd_una); } @@ -3961,11 +3968,23 @@ tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) * (del_data) and an estimate of how many bytes are in the * network. */ - del_data = tp->sackhint.delivered_data; - if (V_tcp_do_rfc6675_pipe) - pipe = tcp_compute_pipe(tp); - else - pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; + if (((tp->t_flags & TF_SACK_PERMIT) && + (to->to_flags & TOF_SACK)) || + (IN_CONGRECOVERY(tp->t_flags) && + !IN_FASTRECOVERY(tp->t_flags))) { + del_data = tp->sackhint.delivered_data; + if (V_tcp_do_rfc6675_pipe) + pipe = tcp_compute_pipe(tp); + else + pipe = (tp->snd_nxt - tp->snd_fack) + + tp->sackhint.sack_bytes_rexmit; + } else { + if (tp->sackhint.prr_delivered < (tcprexmtthresh * maxseg + + tp->snd_recover - tp->snd_una)) + del_data = maxseg; + pipe = imax(0, tp->snd_max - tp->snd_una - + imin(INT_MAX / 65536, tp->t_dupacks) * maxseg); + } tp->sackhint.prr_delivered += del_data; /* * Proportional Rate Reduction @@ -3978,9 +3997,9 @@ tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) tp->snd_ssthresh, tp->sackhint.recover_fs) - tp->sackhint.prr_out; } else { - if (V_tcp_do_prr_conservative) + if (V_tcp_do_prr_conservative || (del_data == 0)) limit = tp->sackhint.prr_delivered - - tp->sackhint.prr_out; + tp->sackhint.prr_out; else limit = imax(tp->sackhint.prr_delivered - tp->sackhint.prr_out, del_data) + @@ -3994,11 +4013,18 @@ tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) * accordingly. */ if (IN_FASTRECOVERY(tp->t_flags)) { - tp->snd_cwnd = imax(maxseg, tp->snd_nxt - tp->snd_recover + - tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg)); + if ((tp->t_flags & TF_SACK_PERMIT) && + (to->to_flags & TOF_SACK)) { + tp->snd_cwnd = tp->snd_nxt - tp->snd_recover + + tp->sackhint.sack_bytes_rexmit + + (snd_cnt * maxseg); + } else { + tp->snd_cwnd = (tp->snd_max - tp->snd_una) + + (snd_cnt * maxseg); + } } else if (IN_CONGRECOVERY(tp->t_flags)) - tp->snd_cwnd = imax(maxseg, pipe - del_data + - (snd_cnt * maxseg)); + tp->snd_cwnd = pipe - del_data + (snd_cnt * maxseg); + tp->snd_cwnd = imax(maxseg, tp->snd_cwnd); } /* From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 13:00:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 098C367401A; Mon, 2 Aug 2021 13:00:55 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GddRB6mNVz3tDp; Mon, 2 Aug 2021 13:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0B941FBDB; Mon, 2 Aug 2021 13:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172D0sE3008645; Mon, 2 Aug 2021 13:00:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172D0sIA008644; Mon, 2 Aug 2021 13:00:54 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:00:54 GMT Message-Id: <202108021300.172D0sIA008644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tom Jones Subject: git: a77a6a049e37 - stable/13 - inet6_option_space is deprecated, refer to inet6_opt_init instead MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a77a6a049e371e456b9ba6043717f814530a94ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:00:55 -0000 The branch stable/13 has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=a77a6a049e371e456b9ba6043717f814530a94ae commit a77a6a049e371e456b9ba6043717f814530a94ae Author: Tom Jones AuthorDate: 2021-07-30 13:23:39 +0000 Commit: Tom Jones CommitDate: 2021-08-02 12:58:51 +0000 inet6_option_space is deprecated, refer to inet6_opt_init instead Reviewed by: bz, hrs MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26273 (cherry picked from commit 0943200b1308bcf2e2b331f6aba514d64d74545f) --- share/man/man4/ip6.4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man4/ip6.4 b/share/man/man4/ip6.4 index 7b71aa23eae0..9c94b3def444 100644 --- a/share/man/man4/ip6.4 +++ b/share/man/man4/ip6.4 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2018 +.Dd July 30, 2021 .Dt IP6 4 .Os .Sh NAME @@ -291,7 +291,7 @@ struct ip6_hbh { .Ed .Pp The -.Fn inet6_option_space +.Fn inet6_opt_init routine and family of routines may be used to manipulate this data. .Pp This option requires superuser privileges. @@ -311,7 +311,7 @@ struct ip6_dest { .Ed .Pp The -.Fn inet6_option_space +.Fn inet6_opt_init routine and family of routines may be used to manipulate this data. .Pp This option requires superuser privileges. @@ -345,7 +345,7 @@ struct ip6_rthdr { .Ed .Pp The -.Fn inet6_option_space +.Fn inet6_opt_init routine and family of routines may be used to manipulate this data. .Pp This option requires superuser privileges. From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB5CC6759CB; Mon, 2 Aug 2021 15:04:03 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9H4y7dz4YnB; Mon, 2 Aug 2021 15:04:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 921F1219D4; Mon, 2 Aug 2021 15:04:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F43Tc071254; Mon, 2 Aug 2021 15:04:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F437h071252; Mon, 2 Aug 2021 15:04:03 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:03 GMT Message-Id: <202108021504.172F437h071252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 5f0efabf2b16 - stable/12 - tests: Enable net tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5f0efabf2b16d15ed7da25b1a8b0b24b8352b6d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:03 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5f0efabf2b16d15ed7da25b1a8b0b24b8352b6d1 commit 5f0efabf2b16d15ed7da25b1a8b0b24b8352b6d1 Author: Kristof Provost AuthorDate: 2020-02-13 14:09:09 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:02 +0000 tests: Enable net tests We have a number of tests in the net subdirectory that were not executed. List the net directory so we run those tests. (cherry picked from commit 475b483aeef96d8bf47159f06761104d92c58c8c) --- tests/sys/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 5d96c7654a28..efc4f801890f 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -19,6 +19,7 @@ TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= ${_netgraph} +TESTS_SUBDIRS+= net TESTS_SUBDIRS+= netinet TESTS_SUBDIRS+= netinet6 TESTS_SUBDIRS+= netipsec From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5906B6759CC; Mon, 2 Aug 2021 15:04:04 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9J1yQKz4YL6; Mon, 2 Aug 2021 15:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21FA621861; Mon, 2 Aug 2021 15:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F44kH071348; Mon, 2 Aug 2021 15:04:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F44Wc071347; Mon, 2 Aug 2021 15:04:04 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:04 GMT Message-Id: <202108021504.172F44Wc071347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 096cacc8115f - stable/13 - bridge tests: test linking bridges with a gif tunnel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 096cacc8115fc3c5a46747afdf7be7eaf557d39f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:04 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=096cacc8115fc3c5a46747afdf7be7eaf557d39f commit 096cacc8115fc3c5a46747afdf7be7eaf557d39f Author: Kristof Provost AuthorDate: 2021-07-21 15:32:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:50:32 +0000 bridge tests: test linking bridges with a gif tunnel Fairly basic test case for using gif(4)'s ability to tunnel Ethernet traffic between bridges. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf) --- tests/sys/net/if_bridge_test.sh | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 4703efed46b8..b029d8d60419 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -452,6 +452,71 @@ stp_validation_cleanup() vnet_cleanup } +atf_test_case "gif" "cleanup" +gif_head() +{ + atf_set descr 'gif as a bridge member' + atf_set require.user root +} + +gif_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + vnet_mkjail one ${epair}a + vnet_mkjail two ${epair}b + + jexec one sysctl net.link.gif.max_nesting=2 + jexec two sysctl net.link.gif.max_nesting=2 + + jexec one ifconfig ${epair}a 192.0.2.1/24 up + jexec two ifconfig ${epair}b 192.0.2.2/24 up + + # Tunnel + gif_one=$(jexec one ifconfig gif create) + gif_two=$(jexec two ifconfig gif create) + + jexec one ifconfig ${gif_one} tunnel 192.0.2.1 192.0.2.2 + jexec one ifconfig ${gif_one} up + jexec two ifconfig ${gif_two} tunnel 192.0.2.2 192.0.2.1 + jexec two ifconfig ${gif_two} up + + bridge_one=$(jexec one ifconfig bridge create) + bridge_two=$(jexec two ifconfig bridge create) + jexec one ifconfig ${bridge_one} 198.51.100.1/24 up + jexec one ifconfig ${bridge_one} addm ${gif_one} + jexec two ifconfig ${bridge_two} 198.51.100.2/24 up + jexec two ifconfig ${bridge_two} addm ${gif_two} + + # Sanity check + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 192.0.2.2 + + # Test tunnel + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 1200 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 2000 198.51.100.2 + + # Higher MTU on the tunnel than on the underlying interface + jexec one ifconfig ${epair}a mtu 1000 + jexec two ifconfig ${epair}b mtu 1000 + + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 1200 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 2000 198.51.100.2 +} + +gif_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -463,4 +528,5 @@ atf_init_test_cases() atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" atf_add_test_case "stp_validation" + atf_add_test_case "gif" } From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FAE66758F7; Mon, 2 Aug 2021 15:04:05 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9J6ktPz4YZ0; Mon, 2 Aug 2021 15:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC96921A69; Mon, 2 Aug 2021 15:04:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F44Ow071373; Mon, 2 Aug 2021 15:04:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F44bi071372; Mon, 2 Aug 2021 15:04:04 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:04 GMT Message-Id: <202108021504.172F44bi071372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 83dc038e594c - stable/12 - bridge tests: test linking bridges with a gif tunnel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 83dc038e594c6875ce44e79db2b8e494d53e5d5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:05 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=83dc038e594c6875ce44e79db2b8e494d53e5d5d commit 83dc038e594c6875ce44e79db2b8e494d53e5d5d Author: Kristof Provost AuthorDate: 2021-07-21 15:32:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:02 +0000 bridge tests: test linking bridges with a gif tunnel Fairly basic test case for using gif(4)'s ability to tunnel Ethernet traffic between bridges. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4b765ab4cda051a6d9ceb5fb9cac80c7f3b910bf) --- tests/sys/net/if_bridge_test.sh | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 4703efed46b8..b029d8d60419 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -452,6 +452,71 @@ stp_validation_cleanup() vnet_cleanup } +atf_test_case "gif" "cleanup" +gif_head() +{ + atf_set descr 'gif as a bridge member' + atf_set require.user root +} + +gif_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + vnet_mkjail one ${epair}a + vnet_mkjail two ${epair}b + + jexec one sysctl net.link.gif.max_nesting=2 + jexec two sysctl net.link.gif.max_nesting=2 + + jexec one ifconfig ${epair}a 192.0.2.1/24 up + jexec two ifconfig ${epair}b 192.0.2.2/24 up + + # Tunnel + gif_one=$(jexec one ifconfig gif create) + gif_two=$(jexec two ifconfig gif create) + + jexec one ifconfig ${gif_one} tunnel 192.0.2.1 192.0.2.2 + jexec one ifconfig ${gif_one} up + jexec two ifconfig ${gif_two} tunnel 192.0.2.2 192.0.2.1 + jexec two ifconfig ${gif_two} up + + bridge_one=$(jexec one ifconfig bridge create) + bridge_two=$(jexec two ifconfig bridge create) + jexec one ifconfig ${bridge_one} 198.51.100.1/24 up + jexec one ifconfig ${bridge_one} addm ${gif_one} + jexec two ifconfig ${bridge_two} 198.51.100.2/24 up + jexec two ifconfig ${bridge_two} addm ${gif_two} + + # Sanity check + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 192.0.2.2 + + # Test tunnel + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 1200 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 2000 198.51.100.2 + + # Higher MTU on the tunnel than on the underlying interface + jexec one ifconfig ${epair}a mtu 1000 + jexec two ifconfig ${epair}b mtu 1000 + + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 1200 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 -s 2000 198.51.100.2 +} + +gif_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -463,4 +528,5 @@ atf_init_test_cases() atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" atf_add_test_case "stp_validation" + atf_add_test_case "gif" } From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B527A675C67; Mon, 2 Aug 2021 15:04:05 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9K32Bbz4YnG; Mon, 2 Aug 2021 15:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38B25219D5; Mon, 2 Aug 2021 15:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F454k071397; Mon, 2 Aug 2021 15:04:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F45Ev071396; Mon, 2 Aug 2021 15:04:05 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:05 GMT Message-Id: <202108021504.172F45Ev071396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 50ecd99be523 - stable/13 - bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 50ecd99be523213b05cd1abff3d484fa9702d647 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:05 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=50ecd99be523213b05cd1abff3d484fa9702d647 commit 50ecd99be523213b05cd1abff3d484fa9702d647 Author: Luiz Otavio O Souza AuthorDate: 2021-07-21 15:41:22 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:50:32 +0000 bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf This allows the use of VLAN PCP in dhclient, which is required for certain ISPs (such as Orange.fr). Reviewed by: bcr (man page) MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31263 (cherry picked from commit 1e7fe2fbb9c0bed230d8db94d7444a90ca5ce199) --- sbin/dhclient/bpf.c | 8 ++++++++ sbin/dhclient/clparse.c | 6 ++++++ sbin/dhclient/conflex.c | 2 ++ sbin/dhclient/dhclient.conf.5 | 9 ++++++++- sbin/dhclient/dhcpd.h | 1 + sbin/dhclient/dhctoken.h | 1 + share/man/man4/bpf.4 | 4 +++- sys/net/bpf.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sys/net/bpf.h | 1 + sys/net/bpfdesc.h | 1 + 10 files changed, 74 insertions(+), 2 deletions(-) diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 4a753fd27595..a50abca62fd3 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -90,6 +90,14 @@ if_register_bpf(struct interface_info *info, int flags) error("Can't attach interface %s to bpf device %s: %m", info->name, filename); + /* Tag the packets with the proper VLAN PCP setting. */ + if (info->client->config->vlan_pcp != 0) { + if (ioctl(sock, BIOCSETVLANPCP, + &info->client->config->vlan_pcp) < 0) + error( "Can't set the VLAN PCP tag on interface %s: %m", + info->name); + } + return (sock); } diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 66695fd6b8f0..58ece525f8d1 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -76,6 +76,7 @@ read_client_conf(void) memset(&top_level_config, 0, sizeof(top_level_config)); /* Set some defaults... */ + top_level_config.vlan_pcp = 0; top_level_config.timeout = 60; top_level_config.select_interval = 0; top_level_config.reboot_timeout = 10; @@ -201,6 +202,7 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, int token; char *val; struct option *option; + time_t tmp; switch (next_token(&val, cfile)) { case SEND: @@ -260,6 +262,10 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, case REBOOT: parse_lease_time(cfile, &config->reboot_timeout); return; + case VLAN_PCP: + parse_lease_time(cfile, &tmp); + config->vlan_pcp = (u_int)tmp; + return; case BACKOFF_CUTOFF: parse_lease_time(cfile, &config->backoff_cutoff); return; diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index 66fc9e397125..c11c9189527e 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -524,6 +524,8 @@ intern(char *atom, int dfv) case 'v': if (!strcasecmp(atom + 1, "endor-class")) return (VENDOR_CLASS); + if (!strcasecmp(atom + 1, "lan-pcp")) + return (VLAN_PCP); break; case 'y': if (!strcasecmp(atom + 1, "iaddr")) diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index 2f28c5722574..14a0de4111dd 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 31, 2018 +.Dd July 21, 2021 .Dt DHCLIENT.CONF 5 .Os .Sh NAME @@ -484,6 +484,13 @@ lease database and will record the media type used to acquire the address. Whenever the client tries to renew the lease, it will use that same media type. The lease must expire before the client will go back to cycling through media types. +.It Ic vlan-pcp Ar code ; +The +.Ic vlan-pcp +statement sets the PCP (Priority Code Point) value for the VLAN header. +This requires the +.Va net.link.vlan.mtag_pcp +sysctl to be set to 1. .El .Sh EXAMPLES The following configuration file is used on a laptop diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 240a3ae23bda..b151daa90a1c 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -159,6 +159,7 @@ struct client_config { u_int8_t required_options[256]; u_int8_t requested_options[256]; int requested_option_count; + u_int vlan_pcp; time_t timeout; time_t initial_interval; time_t retry_interval; diff --git a/sbin/dhclient/dhctoken.h b/sbin/dhclient/dhctoken.h index 26c81aa734dc..c929307c7e06 100644 --- a/sbin/dhclient/dhctoken.h +++ b/sbin/dhclient/dhctoken.h @@ -133,6 +133,7 @@ #define AUTHORITATIVE 333 #define TOKEN_NOT 334 #define ALWAYS_REPLY_RFC1048 335 +#define VLAN_PCP 336 #define is_identifier(x) ((x) >= FIRST_TOKEN && \ (x) != STRING && \ diff --git a/share/man/man4/bpf.4 b/share/man/man4/bpf.4 index 200328891041..66f4ae72918b 100644 --- a/share/man/man4/bpf.4 +++ b/share/man/man4/bpf.4 @@ -49,7 +49,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 9, 2020 +.Dd July 22, 2021 .Dt BPF 4 .Os .Sh NAME @@ -659,6 +659,8 @@ therefore ownership is not assigned, the user process must check .Vt bzh_kernel_gen against .Vt bzh_user_gen . +.It Dv BIOCSETVLANPCP +Set the VLAN PCP bits to the supplied value. .El .Sh STANDARD IOCTLS .Nm diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 605e7aa39fdb..0343c8f851be 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -130,6 +131,7 @@ struct bpf_program_buffer { #if defined(DEV_BPF) || defined(NETGRAPH_BPF) #define PRINET 26 /* interruptible */ +#define BPF_PRIO_MAX 7 #define SIZEOF_BPF_HDR(type) \ (offsetof(type, bh_hdrlen) + sizeof(((type *)0)->bh_hdrlen)) @@ -969,6 +971,9 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td) callout_init_mtx(&d->bd_callout, &d->bd_lock, 0); knlist_init_mtx(&d->bd_sel.si_note, &d->bd_lock); + /* Disable VLAN pcp tagging. */ + d->bd_pcp = 0; + return (0); } @@ -1159,6 +1164,27 @@ bpf_ready(struct bpf_d *d) return (0); } +static int +bpf_setpcp(struct mbuf *m, u_int8_t prio) +{ + struct m_tag *mtag; + + KASSERT(prio <= BPF_PRIO_MAX, + ("%s with invalid pcp", __func__)); + + mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); + if (mtag == NULL) { + mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, + sizeof(uint8_t), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + m_tag_prepend(m, mtag); + } + + *(uint8_t *)(mtag + 1) = prio; + return (0); +} + static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { @@ -1259,6 +1285,9 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) ro.ro_flags = RT_HAS_HEADER; } + if (d->bd_pcp != 0) + bpf_setpcp(m, d->bd_pcp); + /* Avoid possible recursion on BPFD_LOCK(). */ NET_EPOCH_ENTER(et); BPFD_UNLOCK(d); @@ -1348,6 +1377,7 @@ reset_d(struct bpf_d *d) * BIOCROTZBUF Force rotation of zero-copy buffer * BIOCSETBUFMODE Set buffer mode. * BIOCGETBUFMODE Get current buffer mode. + * BIOCSETVLANPCP Set VLAN PCP tag. */ /* ARGSUSED */ static int @@ -1898,6 +1928,19 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, case BIOCROTZBUF: error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr); break; + + case BIOCSETVLANPCP: + { + u_int pcp; + + pcp = *(u_int *)addr; + if (pcp > BPF_PRIO_MAX || pcp < 0) { + error = EINVAL; + break; + } + d->bd_pcp = pcp; + break; + } } CURVNET_RESTORE(); return (error); diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 54bbfd23bba2..b7cd8036856c 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -153,6 +153,7 @@ struct bpf_zbuf { #define BIOCSETFNR _IOW('B', 130, struct bpf_program) #define BIOCGTSTAMP _IOR('B', 131, u_int) #define BIOCSTSTAMP _IOW('B', 132, u_int) +#define BIOCSETVLANPCP _IOW('B', 133, u_int) /* Obsolete */ #define BIOCGSEESENT BIOCGDIRECTION diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h index be978280311d..52cc5f130eb3 100644 --- a/sys/net/bpfdesc.h +++ b/sys/net/bpfdesc.h @@ -91,6 +91,7 @@ struct bpf_d { int bd_feedback; /* true to feed back sent packets */ int bd_async; /* non-zero if packet reception should generate signal */ int bd_sig; /* signal to send upon packet reception */ + int bd_pcp; /* VLAN pcp tag */ struct sigio * bd_sigio; /* information for async I/O */ struct selinfo bd_sel; /* bsd select info */ struct mtx bd_lock; /* per-descriptor lock */ From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A35F675DFC; Mon, 2 Aug 2021 15:04:07 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9L4Fgzz4YWm; Mon, 2 Aug 2021 15:04:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62B3321862; Mon, 2 Aug 2021 15:04:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F464F071445; Mon, 2 Aug 2021 15:04:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F46rT071444; Mon, 2 Aug 2021 15:04:06 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:06 GMT Message-Id: <202108021504.172F46rT071444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c9ef3984a1a7 - stable/13 - vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c9ef3984a1a73cf0d5b0922383d85b0f36ea4ee3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:08 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c9ef3984a1a73cf0d5b0922383d85b0f36ea4ee3 commit c9ef3984a1a73cf0d5b0922383d85b0f36ea4ee3 Author: Kristof Provost AuthorDate: 2021-07-22 08:35:08 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:50:32 +0000 vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() These two fuctions were identical, so move them into the common vlan_set_pcp() function, exposed in the if_vlan_var.h header. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31275 (cherry picked from commit 9ef8cd0b7906371803421aa897056b6fc0710fcb) --- sys/net/bpf.c | 23 +---------------------- sys/net/if_vlan.c | 2 +- sys/net/if_vlan_var.h | 26 ++++++++++++++++++++++++++ sys/netpfil/pf/pf.c | 25 ++----------------------- 4 files changed, 30 insertions(+), 46 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 0343c8f851be..6ae0699c949f 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1164,27 +1164,6 @@ bpf_ready(struct bpf_d *d) return (0); } -static int -bpf_setpcp(struct mbuf *m, u_int8_t prio) -{ - struct m_tag *mtag; - - KASSERT(prio <= BPF_PRIO_MAX, - ("%s with invalid pcp", __func__)); - - mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); - if (mtag == NULL) { - mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, - sizeof(uint8_t), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - m_tag_prepend(m, mtag); - } - - *(uint8_t *)(mtag + 1) = prio; - return (0); -} - static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { @@ -1286,7 +1265,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) } if (d->bd_pcp != 0) - bpf_setpcp(m, d->bd_pcp); + vlan_set_pcp(m, d->bd_pcp); /* Avoid possible recursion on BPFD_LOCK(). */ NET_EPOCH_ENTER(et); diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index bd3a5335a97f..2ff584a059e9 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -2037,7 +2037,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = priv_check(curthread, PRIV_NET_SETVLANPCP); if (error) break; - if (ifr->ifr_vlan_pcp > 7) { + if (ifr->ifr_vlan_pcp > VLAN_PCP_MAX) { error = EINVAL; break; } diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index 1b9540f18a3e..91bed40c43a6 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -32,6 +32,8 @@ #ifndef _NET_IF_VLAN_VAR_H_ #define _NET_IF_VLAN_VAR_H_ 1 +#include + /* Set the VLAN ID in an mbuf packet header non-destructively. */ #define EVL_APPLY_VLID(m, vlid) \ do { \ @@ -124,6 +126,8 @@ struct vlanreq { #define MTAG_8021Q_PCP_IN 0 /* Input priority. */ #define MTAG_8021Q_PCP_OUT 1 /* Output priority. */ +#define VLAN_PCP_MAX 7 + /* * 802.1q full tag. Proto and vid are stored in host byte order. */ @@ -168,6 +172,28 @@ typedef void (*vlan_unconfig_fn)(void *, struct ifnet *, uint16_t); EVENTHANDLER_DECLARE(vlan_config, vlan_config_fn); EVENTHANDLER_DECLARE(vlan_unconfig, vlan_unconfig_fn); +static inline int +vlan_set_pcp(struct mbuf *m, uint8_t prio) +{ + struct m_tag *mtag; + + KASSERT(prio <= VLAN_PCP_MAX, + ("%s with invalid pcp", __func__)); + + mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); + if (mtag == NULL) { + mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, + sizeof(uint8_t), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + m_tag_prepend(m, mtag); + } + + *(uint8_t *)(mtag + 1) = prio; + + return (0); +} + #endif /* _KERNEL */ #endif /* _NET_IF_VLAN_VAR_H_ */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 87912046f8d3..3f954497dc20 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -2715,27 +2715,6 @@ pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, r->return_icmp6 & 255, af, r); } -static int -pf_ieee8021q_setpcp(struct mbuf *m, u_int8_t prio) -{ - struct m_tag *mtag; - - KASSERT(prio <= PF_PRIO_MAX, - ("%s with invalid pcp", __func__)); - - mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); - if (mtag == NULL) { - mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, - sizeof(uint8_t), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - m_tag_prepend(m, mtag); - } - - *(uint8_t *)(mtag + 1) = prio; - return (0); -} - static int pf_match_ieee8021q_pcp(u_int8_t prio, struct mbuf *m) { @@ -6266,7 +6245,7 @@ done: if (r->scrub_flags & PFSTATE_SETPRIO) { if (pd.tos & IPTOS_LOWDELAY) pqid = 1; - if (pf_ieee8021q_setpcp(m, r->set_prio[pqid])) { + if (vlan_set_pcp(m, r->set_prio[pqid])) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); log = 1; @@ -6713,7 +6692,7 @@ done: if (r->scrub_flags & PFSTATE_SETPRIO) { if (pd.tos & IPTOS_LOWDELAY) pqid = 1; - if (pf_ieee8021q_setpcp(m, r->set_prio[pqid])) { + if (vlan_set_pcp(m, r->set_prio[pqid])) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); log = 1; From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2150675E1A; Mon, 2 Aug 2021 15:04:07 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9M2wmQz4YWp; Mon, 2 Aug 2021 15:04:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C03021863; Mon, 2 Aug 2021 15:04:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F46Cu071469; Mon, 2 Aug 2021 15:04:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F46kl071468; Mon, 2 Aug 2021 15:04:06 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:06 GMT Message-Id: <202108021504.172F46kl071468@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e22a6a4fbfaf - stable/12 - tests: basic VLAN test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e22a6a4fbfaf02c4a76542e1cfad76a8194c0290 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:08 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e22a6a4fbfaf02c4a76542e1cfad76a8194c0290 commit e22a6a4fbfaf02c4a76542e1cfad76a8194c0290 Author: Kristof Provost AuthorDate: 2019-10-15 04:50:08 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:02 +0000 tests: basic VLAN test Set up two jails connected by an epair. Create VLAN interfaces in both jails and check connectivity. This is a very basic test, but exposed panics during the network stack epoch work, so this is worth testing. (cherry picked from commit fcd69db27dc93796374600938e4fcf5544aa2a06) --- tests/sys/net/Makefile | 1 + tests/sys/net/if_vlan.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 77c3c833a186..0a6f2a5ea292 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -10,6 +10,7 @@ ATF_TESTS_SH+= if_bridge_test ATF_TESTS_SH+= if_clone_test ATF_TESTS_SH+= if_lagg_test ATF_TESTS_SH+= if_tun_test +ATF_TESTS_SH+= if_vlan # The tests are written to be run in parallel, but doing so leads to random # panics. I think it's because the kernel's list of interfaces isn't properly diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh new file mode 100755 index 000000000000..60b799b25675 --- /dev/null +++ b/tests/sys/net/if_vlan.sh @@ -0,0 +1,42 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "basic" "cleanup" +basic_head() +{ + atf_set descr 'Basic VLAN test' + atf_set require.user root +} + +basic_body() +{ + vnet_init + + epair_vlan=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair_vlan}a + vnet_mkjail singsing ${epair_vlan}b + + vlan0=$(jexec alcatraz ifconfig vlan create vlandev ${epair_vlan}a \ + vlan 42) + jexec alcatraz ifconfig ${epair_vlan}a up + jexec alcatraz ifconfig ${vlan0} 10.0.0.1/24 up + + vlan1=$(jexec singsing ifconfig vlan create vlandev ${epair_vlan}b \ + vlan 42) + jexec singsing ifconfig ${epair_vlan}b up + jexec singsing ifconfig ${vlan1} 10.0.0.2/24 up + + atf_check -s exit:0 -o ignore jexec singsing ping -c 1 10.0.0.1 +} + +basic_cleanup() +{ + vnet_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "basic" +} From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B1B0675E86; Mon, 2 Aug 2021 15:04:09 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9N2zBCz4YTk; Mon, 2 Aug 2021 15:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 346D121B71; Mon, 2 Aug 2021 15:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F48b6071517; Mon, 2 Aug 2021 15:04:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F483k071516; Mon, 2 Aug 2021 15:04:08 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:08 GMT Message-Id: <202108021504.172F483k071516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 40dfe99449af - stable/12 - net tests: basic test case for bpf(4)'s ability to set vlan pcp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 40dfe99449af99ad56775ac4fd144b4e1db3c72f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:09 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=40dfe99449af99ad56775ac4fd144b4e1db3c72f commit 40dfe99449af99ad56775ac4fd144b4e1db3c72f Author: Kristof Provost AuthorDate: 2021-07-22 12:50:27 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:03 +0000 net tests: basic test case for bpf(4)'s ability to set vlan pcp Use dhclient with its 'vlan-pcp' option to set a VLAN PCP value and verify that it actually gets set. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31276 (cherry picked from commit 3e87f800f01b6d2cbe49924a01038379889d8b3b) --- tests/sys/net/Makefile | 3 ++ tests/sys/net/dhclient_pcp.conf | 1 + tests/sys/net/if_vlan.sh | 47 +++++++++++++++++++++++ tests/sys/net/pcp.py | 74 +++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/common/sniffer.py | 12 ++++-- 5 files changed, 134 insertions(+), 3 deletions(-) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 0a6f2a5ea292..cccabd9fc775 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -18,8 +18,11 @@ ATF_TESTS_SH+= if_vlan TEST_METADATA+= is_exclusive=true ${PACKAGE}FILES+= \ + dhclient_pcp.conf \ + pcp.py \ stp.py +${PACKAGE}FILESMODE_pcp.py= 0555 ${PACKAGE}FILESMODE_stp.py= 0555 MAN= diff --git a/tests/sys/net/dhclient_pcp.conf b/tests/sys/net/dhclient_pcp.conf new file mode 100644 index 000000000000..fbd86e5bd0f8 --- /dev/null +++ b/tests/sys/net/dhclient_pcp.conf @@ -0,0 +1 @@ +vlan-pcp 6; diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh index 60b799b25675..2ffc82e017a3 100755 --- a/tests/sys/net/if_vlan.sh +++ b/tests/sys/net/if_vlan.sh @@ -36,7 +36,54 @@ basic_cleanup() vnet_cleanup } +atf_test_case "bpf_pcp" "cleanup" +bpf_pcp_head() +{ + atf_set descr 'Set VLAN PCP through BPF' + atf_set require.config 'allow_sysctl_side_effects' + atf_set require.user root + atf_set require.progs scapy +} + +bpf_pcp_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a up + + vnet_mkjail alcatraz ${epair}b + vlan=$(jexec alcatraz ifconfig vlan create) + jexec alcatraz ifconfig ${vlan} vlan 42 vlandev ${epair}b + jexec alcatraz ifconfig ${vlan} up + jexec alcatraz ifconfig ${epair}b up + + sysctl net.link.vlan.mtag_pcp=1 + + jexec alcatraz dhclient ${vlan} & + atf_check -s exit:1 -o ignore -e ignore $(atf_get_srcdir)/pcp.py \ + --expect-pcp 6 \ + --recvif ${epair}a + + jexec alcatraz killall dhclient + sleep 1 + + jexec alcatraz dhclient -c $(atf_get_srcdir)/dhclient_pcp.conf ${vlan} & + atf_check -s exit:0 -o ignore -e ignore $(atf_get_srcdir)/pcp.py \ + --expect-pcp 6 \ + --recvif ${epair}a +} + +bpf_pcp_cleanup() +{ + sysctl net.link.vlan.mtag_pcp=0 + jexec alcatraz killall dhclient + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" + atf_add_test_case "bpf_pcp" } diff --git a/tests/sys/net/pcp.py b/tests/sys/net/pcp.py new file mode 100644 index 000000000000..cea88faaf438 --- /dev/null +++ b/tests/sys/net/pcp.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 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. + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import scapy.all as sp +import sys +import os +curdir = os.path.dirname(os.path.realpath(__file__)) +netpfil_common = curdir + "/../netpfil/common" +sys.path.append(netpfil_common) +from sniffer import Sniffer + +def check_pcp(args, packet): + vlan = packet.getlayer(sp.Dot1Q) + + if vlan is None: + return False + + if not packet.getlayer(sp.BOOTP): + return False + + if vlan.prio == int(args.expect_pcp[0]): + return True + + return False + +def main(): + parser = argparse.ArgumentParser("pcp.py", + description="PCP test tool") + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface where to look for packets to check') + parser.add_argument('--expect-pcp', nargs=1, + help='The expected PCP value on VLAN packets') + + args = parser.parse_args() + + sniffer = Sniffer(args, check_pcp, recvif=args.recvif[0], timeout=20) + + sniffer.join() + + if sniffer.foundCorrectPacket: + sys.exit(0) + + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/common/sniffer.py b/tests/sys/netpfil/common/sniffer.py index 200ac750dd7f..a7ebfc122573 100644 --- a/tests/sys/netpfil/common/sniffer.py +++ b/tests/sys/netpfil/common/sniffer.py @@ -28,12 +28,14 @@ import threading import scapy.all as sp +import sys class Sniffer(threading.Thread): - def __init__(self, args, check_function, recvif=None): + def __init__(self, args, check_function, recvif=None, timeout=3): threading.Thread.__init__(self) self._args = args + self._timeout = timeout if recvif is not None: self._recvif = recvif else: @@ -50,5 +52,9 @@ class Sniffer(threading.Thread): return ret def run(self): - self.packets = sp.sniff(iface=self._recvif, - stop_filter=self._checkPacket, timeout=3) + self.packets = [] + try: + self.packets = sp.sniff(iface=self._recvif, + stop_filter=self._checkPacket, timeout=self._timeout) + except Exception as e: + print(e, file=sys.stderr) From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F9CE675C6B; Mon, 2 Aug 2021 15:04:07 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9L42WPz4YQh; Mon, 2 Aug 2021 15:04:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB61E217BB; Mon, 2 Aug 2021 15:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F45YC071421; Mon, 2 Aug 2021 15:04:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F45iR071420; Mon, 2 Aug 2021 15:04:05 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:05 GMT Message-Id: <202108021504.172F45iR071420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 766bd3d6b0b8 - stable/12 - bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 766bd3d6b0b82bfb37a8907aa64eea542646d8b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=766bd3d6b0b82bfb37a8907aa64eea542646d8b4 commit 766bd3d6b0b82bfb37a8907aa64eea542646d8b4 Author: Luiz Otavio O Souza AuthorDate: 2021-07-21 15:41:22 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:02 +0000 bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf This allows the use of VLAN PCP in dhclient, which is required for certain ISPs (such as Orange.fr). Reviewed by: bcr (man page) MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31263 (cherry picked from commit 1e7fe2fbb9c0bed230d8db94d7444a90ca5ce199) --- sbin/dhclient/bpf.c | 8 ++++++++ sbin/dhclient/clparse.c | 6 ++++++ sbin/dhclient/conflex.c | 2 ++ sbin/dhclient/dhclient.conf.5 | 9 ++++++++- sbin/dhclient/dhcpd.h | 1 + sbin/dhclient/dhctoken.h | 1 + share/man/man4/bpf.4 | 4 +++- sys/net/bpf.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sys/net/bpf.h | 1 + sys/net/bpfdesc.h | 1 + 10 files changed, 74 insertions(+), 2 deletions(-) diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 4a753fd27595..a50abca62fd3 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -90,6 +90,14 @@ if_register_bpf(struct interface_info *info, int flags) error("Can't attach interface %s to bpf device %s: %m", info->name, filename); + /* Tag the packets with the proper VLAN PCP setting. */ + if (info->client->config->vlan_pcp != 0) { + if (ioctl(sock, BIOCSETVLANPCP, + &info->client->config->vlan_pcp) < 0) + error( "Can't set the VLAN PCP tag on interface %s: %m", + info->name); + } + return (sock); } diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 66695fd6b8f0..58ece525f8d1 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -76,6 +76,7 @@ read_client_conf(void) memset(&top_level_config, 0, sizeof(top_level_config)); /* Set some defaults... */ + top_level_config.vlan_pcp = 0; top_level_config.timeout = 60; top_level_config.select_interval = 0; top_level_config.reboot_timeout = 10; @@ -201,6 +202,7 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, int token; char *val; struct option *option; + time_t tmp; switch (next_token(&val, cfile)) { case SEND: @@ -260,6 +262,10 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, case REBOOT: parse_lease_time(cfile, &config->reboot_timeout); return; + case VLAN_PCP: + parse_lease_time(cfile, &tmp); + config->vlan_pcp = (u_int)tmp; + return; case BACKOFF_CUTOFF: parse_lease_time(cfile, &config->backoff_cutoff); return; diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index 66fc9e397125..c11c9189527e 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -524,6 +524,8 @@ intern(char *atom, int dfv) case 'v': if (!strcasecmp(atom + 1, "endor-class")) return (VENDOR_CLASS); + if (!strcasecmp(atom + 1, "lan-pcp")) + return (VLAN_PCP); break; case 'y': if (!strcasecmp(atom + 1, "iaddr")) diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index 2f28c5722574..14a0de4111dd 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 31, 2018 +.Dd July 21, 2021 .Dt DHCLIENT.CONF 5 .Os .Sh NAME @@ -484,6 +484,13 @@ lease database and will record the media type used to acquire the address. Whenever the client tries to renew the lease, it will use that same media type. The lease must expire before the client will go back to cycling through media types. +.It Ic vlan-pcp Ar code ; +The +.Ic vlan-pcp +statement sets the PCP (Priority Code Point) value for the VLAN header. +This requires the +.Va net.link.vlan.mtag_pcp +sysctl to be set to 1. .El .Sh EXAMPLES The following configuration file is used on a laptop diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 240a3ae23bda..b151daa90a1c 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -159,6 +159,7 @@ struct client_config { u_int8_t required_options[256]; u_int8_t requested_options[256]; int requested_option_count; + u_int vlan_pcp; time_t timeout; time_t initial_interval; time_t retry_interval; diff --git a/sbin/dhclient/dhctoken.h b/sbin/dhclient/dhctoken.h index 26c81aa734dc..c929307c7e06 100644 --- a/sbin/dhclient/dhctoken.h +++ b/sbin/dhclient/dhctoken.h @@ -133,6 +133,7 @@ #define AUTHORITATIVE 333 #define TOKEN_NOT 334 #define ALWAYS_REPLY_RFC1048 335 +#define VLAN_PCP 336 #define is_identifier(x) ((x) >= FIRST_TOKEN && \ (x) != STRING && \ diff --git a/share/man/man4/bpf.4 b/share/man/man4/bpf.4 index 200328891041..66f4ae72918b 100644 --- a/share/man/man4/bpf.4 +++ b/share/man/man4/bpf.4 @@ -49,7 +49,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 9, 2020 +.Dd July 22, 2021 .Dt BPF 4 .Os .Sh NAME @@ -659,6 +659,8 @@ therefore ownership is not assigned, the user process must check .Vt bzh_kernel_gen against .Vt bzh_user_gen . +.It Dv BIOCSETVLANPCP +Set the VLAN PCP bits to the supplied value. .El .Sh STANDARD IOCTLS .Nm diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 699679369c2d..7e0af0cfebc0 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -125,6 +126,7 @@ CTASSERT(offsetof(struct bpf_if, bif_ext) == 0); #if defined(DEV_BPF) || defined(NETGRAPH_BPF) #define PRINET 26 /* interruptible */ +#define BPF_PRIO_MAX 7 #define SIZEOF_BPF_HDR(type) \ (offsetof(type, bh_hdrlen) + sizeof(((type *)0)->bh_hdrlen)) @@ -927,6 +929,9 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td) callout_init_mtx(&d->bd_callout, &d->bd_lock, 0); knlist_init_mtx(&d->bd_sel.si_note, &d->bd_lock); + /* Disable VLAN pcp tagging. */ + d->bd_pcp = 0; + return (0); } @@ -1116,6 +1121,27 @@ bpf_ready(struct bpf_d *d) return (0); } +static int +bpf_setpcp(struct mbuf *m, u_int8_t prio) +{ + struct m_tag *mtag; + + KASSERT(prio <= BPF_PRIO_MAX, + ("%s with invalid pcp", __func__)); + + mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); + if (mtag == NULL) { + mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, + sizeof(uint8_t), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + m_tag_prepend(m, mtag); + } + + *(uint8_t *)(mtag + 1) = prio; + return (0); +} + static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { @@ -1194,6 +1220,9 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) ro.ro_flags = RT_HAS_HEADER; } + if (d->bd_pcp != 0) + bpf_setpcp(m, d->bd_pcp); + error = (*ifp->if_output)(ifp, m, &dst, &ro); if (error) counter_u64_add(d->bd_wdcount, 1); @@ -1273,6 +1302,7 @@ reset_d(struct bpf_d *d) * BIOCROTZBUF Force rotation of zero-copy buffer * BIOCSETBUFMODE Set buffer mode. * BIOCGETBUFMODE Get current buffer mode. + * BIOCSETVLANPCP Set VLAN PCP tag. */ /* ARGSUSED */ static int @@ -1824,6 +1854,19 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, case BIOCROTZBUF: error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr); break; + + case BIOCSETVLANPCP: + { + u_int pcp; + + pcp = *(u_int *)addr; + if (pcp > BPF_PRIO_MAX || pcp < 0) { + error = EINVAL; + break; + } + d->bd_pcp = pcp; + break; + } } CURVNET_RESTORE(); return (error); diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 4e62ed387f23..7a81962c4b3c 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -149,6 +149,7 @@ struct bpf_zbuf { #define BIOCSETFNR _IOW('B', 130, struct bpf_program) #define BIOCGTSTAMP _IOR('B', 131, u_int) #define BIOCSTSTAMP _IOW('B', 132, u_int) +#define BIOCSETVLANPCP _IOW('B', 133, u_int) /* Obsolete */ #define BIOCGSEESENT BIOCGDIRECTION diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h index 7d23e06ec3a3..8baa759faed3 100644 --- a/sys/net/bpfdesc.h +++ b/sys/net/bpfdesc.h @@ -90,6 +90,7 @@ struct bpf_d { int bd_feedback; /* true to feed back sent packets */ int bd_async; /* non-zero if packet reception should generate signal */ int bd_sig; /* signal to send upon packet reception */ + int bd_pcp; /* VLAN pcp tag */ struct sigio * bd_sigio; /* information for async I/O */ struct selinfo bd_sel; /* bsd select info */ struct mtx bd_lock; /* per-descriptor lock */ From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B8146759D2; Mon, 2 Aug 2021 15:04:08 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9M4gMLz4YQl; Mon, 2 Aug 2021 15:04:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79F3421671; Mon, 2 Aug 2021 15:04:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F47aE071493; Mon, 2 Aug 2021 15:04:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F47h8071492; Mon, 2 Aug 2021 15:04:07 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:07 GMT Message-Id: <202108021504.172F47h8071492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 60c9798db74d - stable/13 - net tests: basic test case for bpf(4)'s ability to set vlan pcp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 60c9798db74d0b04dcbb4162d155ecd6b38c0e52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:08 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=60c9798db74d0b04dcbb4162d155ecd6b38c0e52 commit 60c9798db74d0b04dcbb4162d155ecd6b38c0e52 Author: Kristof Provost AuthorDate: 2021-07-22 12:50:27 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 14:50:32 +0000 net tests: basic test case for bpf(4)'s ability to set vlan pcp Use dhclient with its 'vlan-pcp' option to set a VLAN PCP value and verify that it actually gets set. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31276 (cherry picked from commit 3e87f800f01b6d2cbe49924a01038379889d8b3b) --- tests/sys/net/Makefile | 3 ++ tests/sys/net/dhclient_pcp.conf | 1 + tests/sys/net/if_vlan.sh | 47 +++++++++++++++++++++++ tests/sys/net/pcp.py | 74 +++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/common/sniffer.py | 12 ++++-- 5 files changed, 134 insertions(+), 3 deletions(-) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 40b3a5e5fff6..4771040816b7 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -21,8 +21,11 @@ TESTS_SUBDIRS+= routing TEST_METADATA+= is_exclusive=true ${PACKAGE}FILES+= \ + dhclient_pcp.conf \ + pcp.py \ stp.py +${PACKAGE}FILESMODE_pcp.py= 0555 ${PACKAGE}FILESMODE_stp.py= 0555 MAN= diff --git a/tests/sys/net/dhclient_pcp.conf b/tests/sys/net/dhclient_pcp.conf new file mode 100644 index 000000000000..fbd86e5bd0f8 --- /dev/null +++ b/tests/sys/net/dhclient_pcp.conf @@ -0,0 +1 @@ +vlan-pcp 6; diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh index 2edcb16eab88..517206cb55c7 100755 --- a/tests/sys/net/if_vlan.sh +++ b/tests/sys/net/if_vlan.sh @@ -210,6 +210,52 @@ qinq_dot_cleanup() vnet_cleanup } +atf_test_case "bpf_pcp" "cleanup" +bpf_pcp_head() +{ + atf_set descr 'Set VLAN PCP through BPF' + atf_set require.config 'allow_sysctl_side_effects' + atf_set require.user root + atf_set require.progs scapy +} + +bpf_pcp_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a up + + vnet_mkjail alcatraz ${epair}b + vlan=$(jexec alcatraz ifconfig vlan create) + jexec alcatraz ifconfig ${vlan} vlan 42 vlandev ${epair}b + jexec alcatraz ifconfig ${vlan} up + jexec alcatraz ifconfig ${epair}b up + + sysctl net.link.vlan.mtag_pcp=1 + + jexec alcatraz dhclient ${vlan} & + atf_check -s exit:1 -o ignore -e ignore $(atf_get_srcdir)/pcp.py \ + --expect-pcp 6 \ + --recvif ${epair}a + + jexec alcatraz killall dhclient + sleep 1 + + jexec alcatraz dhclient -c $(atf_get_srcdir)/dhclient_pcp.conf ${vlan} & + atf_check -s exit:0 -o ignore -e ignore $(atf_get_srcdir)/pcp.py \ + --expect-pcp 6 \ + --recvif ${epair}a +} + +bpf_pcp_cleanup() +{ + sysctl net.link.vlan.mtag_pcp=0 + jexec alcatraz killall dhclient + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" @@ -217,4 +263,5 @@ atf_init_test_cases() atf_add_test_case "qinq_deep" atf_add_test_case "qinq_legacy" atf_add_test_case "qinq_dot" + atf_add_test_case "bpf_pcp" } diff --git a/tests/sys/net/pcp.py b/tests/sys/net/pcp.py new file mode 100644 index 000000000000..cea88faaf438 --- /dev/null +++ b/tests/sys/net/pcp.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 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. + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import scapy.all as sp +import sys +import os +curdir = os.path.dirname(os.path.realpath(__file__)) +netpfil_common = curdir + "/../netpfil/common" +sys.path.append(netpfil_common) +from sniffer import Sniffer + +def check_pcp(args, packet): + vlan = packet.getlayer(sp.Dot1Q) + + if vlan is None: + return False + + if not packet.getlayer(sp.BOOTP): + return False + + if vlan.prio == int(args.expect_pcp[0]): + return True + + return False + +def main(): + parser = argparse.ArgumentParser("pcp.py", + description="PCP test tool") + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface where to look for packets to check') + parser.add_argument('--expect-pcp', nargs=1, + help='The expected PCP value on VLAN packets') + + args = parser.parse_args() + + sniffer = Sniffer(args, check_pcp, recvif=args.recvif[0], timeout=20) + + sniffer.join() + + if sniffer.foundCorrectPacket: + sys.exit(0) + + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/common/sniffer.py b/tests/sys/netpfil/common/sniffer.py index 200ac750dd7f..a7ebfc122573 100644 --- a/tests/sys/netpfil/common/sniffer.py +++ b/tests/sys/netpfil/common/sniffer.py @@ -28,12 +28,14 @@ import threading import scapy.all as sp +import sys class Sniffer(threading.Thread): - def __init__(self, args, check_function, recvif=None): + def __init__(self, args, check_function, recvif=None, timeout=3): threading.Thread.__init__(self) self._args = args + self._timeout = timeout if recvif is not None: self._recvif = recvif else: @@ -50,5 +52,9 @@ class Sniffer(threading.Thread): return ret def run(self): - self.packets = sp.sniff(iface=self._recvif, - stop_filter=self._checkPacket, timeout=3) + self.packets = [] + try: + self.packets = sp.sniff(iface=self._recvif, + stop_filter=self._checkPacket, timeout=self._timeout) + except Exception as e: + print(e, file=sys.stderr) From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:04:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A252F675AE5; Mon, 2 Aug 2021 15:04:10 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdh9P5bs4z4YnS; Mon, 2 Aug 2021 15:04:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59E6321672; Mon, 2 Aug 2021 15:04:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172F49km071579; Mon, 2 Aug 2021 15:04:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172F491L071578; Mon, 2 Aug 2021 15:04:09 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:04:09 GMT Message-Id: <202108021504.172F491L071578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 666a7f460270 - stable/12 - vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 666a7f4602708cb730c784c5d4a9ef34b620f721 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:04:10 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=666a7f4602708cb730c784c5d4a9ef34b620f721 commit 666a7f4602708cb730c784c5d4a9ef34b620f721 Author: Kristof Provost AuthorDate: 2021-07-22 08:35:08 +0000 Commit: Kristof Provost CommitDate: 2021-08-02 15:03:03 +0000 vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() These two fuctions were identical, so move them into the common vlan_set_pcp() function, exposed in the if_vlan_var.h header. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31275 (cherry picked from commit 9ef8cd0b7906371803421aa897056b6fc0710fcb) --- sys/net/bpf.c | 23 +---------------------- sys/net/if_vlan.c | 2 +- sys/net/if_vlan_var.h | 26 ++++++++++++++++++++++++++ sys/netpfil/pf/pf.c | 25 ++----------------------- 4 files changed, 30 insertions(+), 46 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 7e0af0cfebc0..5ca92a97f74f 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1121,27 +1121,6 @@ bpf_ready(struct bpf_d *d) return (0); } -static int -bpf_setpcp(struct mbuf *m, u_int8_t prio) -{ - struct m_tag *mtag; - - KASSERT(prio <= BPF_PRIO_MAX, - ("%s with invalid pcp", __func__)); - - mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); - if (mtag == NULL) { - mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, - sizeof(uint8_t), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - m_tag_prepend(m, mtag); - } - - *(uint8_t *)(mtag + 1) = prio; - return (0); -} - static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { @@ -1221,7 +1200,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) } if (d->bd_pcp != 0) - bpf_setpcp(m, d->bd_pcp); + vlan_set_pcp(m, d->bd_pcp); error = (*ifp->if_output)(ifp, m, &dst, &ro); if (error) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 2f1b1dec9603..a055c978c32f 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1943,7 +1943,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = priv_check(curthread, PRIV_NET_SETVLANPCP); if (error) break; - if (ifr->ifr_vlan_pcp > 7) { + if (ifr->ifr_vlan_pcp > VLAN_PCP_MAX) { error = EINVAL; break; } diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index 0b66ec0a0a1e..aaf64efe3d7f 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -32,6 +32,8 @@ #ifndef _NET_IF_VLAN_VAR_H_ #define _NET_IF_VLAN_VAR_H_ 1 +#include + /* Set the VLAN ID in an mbuf packet header non-destructively. */ #define EVL_APPLY_VLID(m, vlid) \ do { \ @@ -123,6 +125,8 @@ struct vlanreq { #define MTAG_8021Q_PCP_IN 0 /* Input priority. */ #define MTAG_8021Q_PCP_OUT 1 /* Output priority. */ +#define VLAN_PCP_MAX 7 + #define VLAN_CAPABILITIES(_ifp) do { \ if ((_ifp)->if_vlantrunk != NULL) \ (*vlan_trunk_cap_p)(_ifp); \ @@ -158,6 +162,28 @@ EVENTHANDLER_DECLARE(vlan_config, vlan_config_fn); EVENTHANDLER_DECLARE(vlan_unconfig, vlan_unconfig_fn); #endif /* _SYS_EVENTHANDLER_H_ */ +static inline int +vlan_set_pcp(struct mbuf *m, uint8_t prio) +{ + struct m_tag *mtag; + + KASSERT(prio <= VLAN_PCP_MAX, + ("%s with invalid pcp", __func__)); + + mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); + if (mtag == NULL) { + mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, + sizeof(uint8_t), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + m_tag_prepend(m, mtag); + } + + *(uint8_t *)(mtag + 1) = prio; + + return (0); +} + #endif /* _KERNEL */ #endif /* _NET_IF_VLAN_VAR_H_ */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 7b2812a952ce..caae2b92f0d6 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -2717,27 +2717,6 @@ pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, } -static int -pf_ieee8021q_setpcp(struct mbuf *m, u_int8_t prio) -{ - struct m_tag *mtag; - - KASSERT(prio <= PF_PRIO_MAX, - ("%s with invalid pcp", __func__)); - - mtag = m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL); - if (mtag == NULL) { - mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_OUT, - sizeof(uint8_t), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - m_tag_prepend(m, mtag); - } - - *(uint8_t *)(mtag + 1) = prio; - return (0); -} - static int pf_match_ieee8021q_pcp(u_int8_t prio, struct mbuf *m) { @@ -6351,7 +6330,7 @@ done: if (r->scrub_flags & PFSTATE_SETPRIO) { if (pd.tos & IPTOS_LOWDELAY) pqid = 1; - if (pf_ieee8021q_setpcp(m, r->set_prio[pqid])) { + if (vlan_set_pcp(m, r->set_prio[pqid])) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); log = 1; @@ -6803,7 +6782,7 @@ done: if (r->scrub_flags & PFSTATE_SETPRIO) { if (pd.tos & IPTOS_LOWDELAY) pqid = 1; - if (pf_ieee8021q_setpcp(m, r->set_prio[pqid])) { + if (vlan_set_pcp(m, r->set_prio[pqid])) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); log = 1; From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:56:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49A23676E12; Mon, 2 Aug 2021 15:56:16 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GdjKX1JKKz4dZ0; Mon, 2 Aug 2021 15:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1528822684; Mon, 2 Aug 2021 15:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172FuFYE037515; Mon, 2 Aug 2021 15:56:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172FuFBm037514; Mon, 2 Aug 2021 15:56:15 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:56:15 GMT Message-Id: <202108021556.172FuFBm037514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 156b889469d2 - stable/13 - mrsas(4): Report more correct maximum I/O size. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 156b889469d2f59743f1811f731040dfdc3e5e14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:56:16 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=156b889469d2f59743f1811f731040dfdc3e5e14 commit 156b889469d2f59743f1811f731040dfdc3e5e14 Author: Alexander Motin AuthorDate: 2021-07-01 19:28:55 +0000 Commit: Alexander Motin CommitDate: 2021-08-02 15:56:10 +0000 mrsas(4): Report more correct maximum I/O size. Subtract one SGE for the case of misaligned address. Also take into account maximum number of sectors reported by firmware, that gives nicer 256KB limit instead of 276KB calculated from the SGE limit. While there, remove number of I/O size checks, duplicating what is already checked by CAM and busdma(9). MFC after: 1 month Sponsored by: iXsystems, Inc. (cherry picked from commit fa3d57c256104649217b5022947de9c1c59a326e) --- sys/dev/mrsas/mrsas.c | 11 ++++++----- sys/dev/mrsas/mrsas_cam.c | 36 +----------------------------------- 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index 01173387c8d4..8814642fccd0 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -1914,15 +1914,16 @@ mrsas_alloc_mem(struct mrsas_softc *sc) /* * Allocate parent DMA tag */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create( + bus_get_dma_tag(sc->mrsas_dev), /* parent */ 1, /* alignment */ 0, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - maxphys, /* maxsize */ - sc->max_num_sge, /* nsegments */ - maxphys, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->mrsas_parent_tag /* tag */ @@ -2533,7 +2534,7 @@ mrsas_init_fw(struct mrsas_softc *sc) sc->ctrl_info->max_strips_per_io; max_sectors_2 = sc->ctrl_info->max_request_size; tmp_sectors = min(max_sectors_1, max_sectors_2); - sc->max_sectors_per_req = sc->max_num_sge * MRSAS_PAGE_SIZE / 512; + sc->max_sectors_per_req = (sc->max_num_sge - 1) * MRSAS_PAGE_SIZE / 512; if (tmp_sectors && (sc->max_sectors_per_req > tmp_sectors)) sc->max_sectors_per_req = tmp_sectors; diff --git a/sys/dev/mrsas/mrsas_cam.c b/sys/dev/mrsas/mrsas_cam.c index 3557782dae49..85dacdb9f306 100644 --- a/sys/dev/mrsas/mrsas_cam.c +++ b/sys/dev/mrsas/mrsas_cam.c @@ -369,7 +369,7 @@ mrsas_action(struct cam_sim *sim, union ccb *ccb) else ccb->cpi.max_target = MRSAS_MAX_LD_IDS - 1; #if (__FreeBSD_version > 704000) - ccb->cpi.maxio = sc->max_num_sge * MRSAS_PAGE_SIZE; + ccb->cpi.maxio = sc->max_sectors_per_req * 512; #endif ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -513,21 +513,11 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim, ccb_h->status = CAM_REQ_INVALID; goto done; case CAM_DATA_VADDR: - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; break; case CAM_DATA_BIO: - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; @@ -539,11 +529,6 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim, #else if (!(ccb_h->flags & CAM_DATA_PHYS)) { /* Virtual data address */ if (!(ccb_h->flags & CAM_SCATTER_VALID)) { - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; @@ -867,11 +852,6 @@ mrsas_build_ldio_rw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = htole32(cmd->length); if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (FAIL); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1234,11 +1214,6 @@ mrsas_build_ldio_nonrw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = cmd->length; if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (1); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1364,11 +1339,6 @@ mrsas_build_syspdio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = htole32(cmd->length); if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (1); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1714,10 +1684,6 @@ mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) if (cmd->flags & MRSAS_DIR_OUT) bus_dmamap_sync(cmd->sc->data_tag, cmd->data_dmamap, BUS_DMASYNC_PREWRITE); - if (nseg > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "SGE count is too large or 0.\n"); - return; - } /* Check for whether PRPs should be built or IEEE SGLs*/ if ((cmd->io_request->IoFlags & MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) && From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 15:59:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49911676C65; Mon, 2 Aug 2021 15:59:53 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GdjPj1VHLz4f0w; Mon, 2 Aug 2021 15:59:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15F122252B; Mon, 2 Aug 2021 15:59:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172FxqYO037852; Mon, 2 Aug 2021 15:59:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172Fxqf6037851; Mon, 2 Aug 2021 15:59:52 GMT (envelope-from git) Date: Mon, 2 Aug 2021 15:59:52 GMT Message-Id: <202108021559.172Fxqf6037851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: ef87250124b1 - stable/12 - mrsas(4): Report more correct maximum I/O size. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ef87250124b12216c4e8e608d73008ca13448cba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 15:59:53 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ef87250124b12216c4e8e608d73008ca13448cba commit ef87250124b12216c4e8e608d73008ca13448cba Author: Alexander Motin AuthorDate: 2021-07-01 19:28:55 +0000 Commit: Alexander Motin CommitDate: 2021-08-02 15:59:43 +0000 mrsas(4): Report more correct maximum I/O size. Subtract one SGE for the case of misaligned address. Also take into account maximum number of sectors reported by firmware, that gives nicer 256KB limit instead of 276KB calculated from the SGE limit. While there, remove number of I/O size checks, duplicating what is already checked by CAM and busdma(9). MFC after: 1 month Sponsored by: iXsystems, Inc. (cherry picked from commit fa3d57c256104649217b5022947de9c1c59a326e) --- sys/dev/mrsas/mrsas.c | 11 ++++++----- sys/dev/mrsas/mrsas_cam.c | 36 +----------------------------------- 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index df4fb98c53eb..ff7dc765a3b4 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -1923,15 +1923,16 @@ mrsas_alloc_mem(struct mrsas_softc *sc) /* * Allocate parent DMA tag */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create( + bus_get_dma_tag(sc->mrsas_dev), /* parent */ 1, /* alignment */ 0, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAXPHYS, /* maxsize */ - sc->max_num_sge, /* nsegments */ - MAXPHYS, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->mrsas_parent_tag /* tag */ @@ -2543,7 +2544,7 @@ mrsas_init_fw(struct mrsas_softc *sc) sc->ctrl_info->max_strips_per_io; max_sectors_2 = sc->ctrl_info->max_request_size; tmp_sectors = min(max_sectors_1, max_sectors_2); - sc->max_sectors_per_req = sc->max_num_sge * MRSAS_PAGE_SIZE / 512; + sc->max_sectors_per_req = (sc->max_num_sge - 1) * MRSAS_PAGE_SIZE / 512; if (tmp_sectors && (sc->max_sectors_per_req > tmp_sectors)) sc->max_sectors_per_req = tmp_sectors; diff --git a/sys/dev/mrsas/mrsas_cam.c b/sys/dev/mrsas/mrsas_cam.c index 0ff897a01aa8..c53fdbb4ea71 100644 --- a/sys/dev/mrsas/mrsas_cam.c +++ b/sys/dev/mrsas/mrsas_cam.c @@ -369,7 +369,7 @@ mrsas_action(struct cam_sim *sim, union ccb *ccb) else ccb->cpi.max_target = MRSAS_MAX_LD_IDS - 1; #if (__FreeBSD_version > 704000) - ccb->cpi.maxio = sc->max_num_sge * MRSAS_PAGE_SIZE; + ccb->cpi.maxio = sc->max_sectors_per_req * 512; #endif ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -513,21 +513,11 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim, ccb_h->status = CAM_REQ_INVALID; goto done; case CAM_DATA_VADDR: - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; break; case CAM_DATA_BIO: - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; @@ -539,11 +529,6 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim, #else if (!(ccb_h->flags & CAM_DATA_PHYS)) { /* Virtual data address */ if (!(ccb_h->flags & CAM_SCATTER_VALID)) { - if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) { - mrsas_release_mpt_cmd(cmd); - ccb_h->status = CAM_REQ_TOO_BIG; - goto done; - } cmd->length = csio->dxfer_len; if (cmd->length) cmd->data = csio->data_ptr; @@ -871,11 +856,6 @@ mrsas_build_ldio_rw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = cmd->length; if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (FAIL); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1239,11 +1219,6 @@ mrsas_build_ldio_nonrw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = cmd->length; if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (1); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1369,11 +1344,6 @@ mrsas_build_syspdio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, io_request->DataLength = cmd->length; if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { - if (cmd->sge_count > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" - "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); - return (1); - } if (sc->is_ventura || sc->is_aero) io_request->RaidContext.raid_context_g35.numSGE = cmd->sge_count; else { @@ -1724,10 +1694,6 @@ mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) if (cmd->flags & MRSAS_DIR_OUT) bus_dmamap_sync(cmd->sc->data_tag, cmd->data_dmamap, BUS_DMASYNC_PREWRITE); - if (nseg > sc->max_num_sge) { - device_printf(sc->mrsas_dev, "SGE count is too large or 0.\n"); - return; - } /* Check for whether PRPs should be built or IEEE SGLs*/ if ((cmd->io_request->IoFlags & MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) && From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 19:01:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11EB16792C8; Mon, 2 Aug 2021 19:01:29 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GdnRD6jR3z4qsf; Mon, 2 Aug 2021 19:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4AC1249C9; Mon, 2 Aug 2021 19:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172J1SOj088596; Mon, 2 Aug 2021 19:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172J1SI6088577; Mon, 2 Aug 2021 19:01:28 GMT (envelope-from git) Date: Mon, 2 Aug 2021 19:01:28 GMT Message-Id: <202108021901.172J1SI6088577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 225d3b0771d8 - stable/13 - libvmmapi: Fix warnings and stop overridding WARNS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 225d3b0771d895a7b101e9349cf607ed86c06f6a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 19:01:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=225d3b0771d895a7b101e9349cf607ed86c06f6a commit 225d3b0771d895a7b101e9349cf607ed86c06f6a Author: Mark Johnston AuthorDate: 2021-07-26 20:40:16 +0000 Commit: Mark Johnston CommitDate: 2021-08-02 19:01:02 +0000 libvmmapi: Fix warnings and stop overridding WARNS - Avoid shadowing the global optarg. - Sprinkle __unused. - Cast nitems() to int. - Fix sign in vm_copy_setup(). Reviewed by: grehan Sponsored by: The FreeBSD Foundation (cherry picked from commit 45cd18ec73dcd262612898bf1a263cacde17d348) --- lib/libvmmapi/Makefile | 2 -- lib/libvmmapi/vmmapi.c | 34 +++++++++++++++++----------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/libvmmapi/Makefile b/lib/libvmmapi/Makefile index bf17566a0d7d..9c410833e09c 100644 --- a/lib/libvmmapi/Makefile +++ b/lib/libvmmapi/Makefile @@ -5,8 +5,6 @@ LIB= vmmapi SRCS= vmmapi.c vmmapi_freebsd.c INCS= vmmapi.h -WARNS?= 2 - LIBADD= util CFLAGS+= -I${.CURDIR} diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 5810274c9a73..0543c92f4300 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -111,7 +111,7 @@ vm_create(const char *name) /* Try to load vmm(4) module before creating a guest. */ if (modfind("vmm") < 0) kldload("vmm"); - return (CREATE((char *)name)); + return (CREATE(name)); } struct vmctx * @@ -153,14 +153,14 @@ vm_destroy(struct vmctx *vm) } int -vm_parse_memsize(const char *optarg, size_t *ret_memsize) +vm_parse_memsize(const char *opt, size_t *ret_memsize) { char *endptr; size_t optval; int error; - optval = strtoul(optarg, &endptr, 0); - if (*optarg != '\0' && *endptr == '\0') { + optval = strtoul(opt, &endptr, 0); + if (*opt != '\0' && *endptr == '\0') { /* * For the sake of backward compatibility if the memory size * specified on the command line is less than a megabyte then @@ -171,7 +171,7 @@ vm_parse_memsize(const char *optarg, size_t *ret_memsize) *ret_memsize = optval; error = 0; } else - error = expand_number(optarg, ret_memsize); + error = expand_number(opt, ret_memsize); return (error); } @@ -729,7 +729,7 @@ vm_inject_exception(struct vmctx *ctx, int vcpu, int vector, int errcode_valid, } int -vm_apicid2vcpu(struct vmctx *ctx, int apicid) +vm_apicid2vcpu(struct vmctx *ctx __unused, int apicid) { /* * The apic id associated with the 'vcpu' has the same numerical value @@ -907,7 +907,7 @@ vm_capability_name2type(const char *capname) { int i; - for (i = 0; i < nitems(capstrmap); i++) { + for (i = 0; i < (int)nitems(capstrmap); i++) { if (strcmp(capstrmap[i], capname) == 0) return (i); } @@ -918,7 +918,7 @@ vm_capability_name2type(const char *capname) const char * vm_capability_type2name(int type) { - if (type >= 0 && type < nitems(capstrmap)) + if (type >= 0 && type < (int)nitems(capstrmap)) return (capstrmap[type]); return (NULL); @@ -1366,8 +1366,8 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, int *fault) { void *va; - uint64_t gpa; - int error, i, n, off; + uint64_t gpa, off; + int error, i, n; for (i = 0; i < iovcnt; i++) { iov[i].iov_base = 0; @@ -1381,7 +1381,7 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, return (error); off = gpa & PAGE_MASK; - n = min(len, PAGE_SIZE - off); + n = MIN(len, PAGE_SIZE - off); va = vm_map_gpa(ctx, gpa, n); if (va == NULL) @@ -1399,14 +1399,14 @@ vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, } void -vm_copy_teardown(struct vmctx *ctx, int vcpu, struct iovec *iov, int iovcnt) +vm_copy_teardown(struct vmctx *ctx __unused, int vcpu __unused, + struct iovec *iov __unused, int iovcnt __unused) { - - return; } void -vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *iov, void *vp, size_t len) +vm_copyin(struct vmctx *ctx __unused, int vcpu __unused, struct iovec *iov, + void *vp, size_t len) { const char *src; char *dst; @@ -1426,8 +1426,8 @@ vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *iov, void *vp, size_t len) } void -vm_copyout(struct vmctx *ctx, int vcpu, const void *vp, struct iovec *iov, - size_t len) +vm_copyout(struct vmctx *ctx __unused, int vcpu __unused, const void *vp, + struct iovec *iov, size_t len) { const char *src; char *dst; From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 19:01:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 148FB678DD9; Mon, 2 Aug 2021 19:01:30 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GdnRG06qLz4ql6; Mon, 2 Aug 2021 19:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1AF324BCE; Mon, 2 Aug 2021 19:01:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172J1TuJ090064; Mon, 2 Aug 2021 19:01:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172J1Tja090052; Mon, 2 Aug 2021 19:01:29 GMT (envelope-from git) Date: Mon, 2 Aug 2021 19:01:29 GMT Message-Id: <202108021901.172J1Tja090052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 668a555de619 - stable/13 - rip: Add missing minimum length validation in rip_output() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 668a555de619f0894cb233f00f70dc19973c154f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 19:01:30 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=668a555de619f0894cb233f00f70dc19973c154f commit 668a555de619f0894cb233f00f70dc19973c154f Author: Mark Johnston AuthorDate: 2021-07-26 20:39:18 +0000 Commit: Mark Johnston CommitDate: 2021-08-02 19:01:11 +0000 rip: Add missing minimum length validation in rip_output() If the socket is configured such that the sender is expected to supply the IP header, then we need to verify that it actually did so. Reported by: syzkaller+KMSAN Reviewed by: donner Sponsored by: The FreeBSD Foundation (cherry picked from commit ba21825202737a8b7e90e1ef669c7fe7e7d50325) --- sys/netinet/raw_ip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 1db73a6da68c..996440227145 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -523,8 +523,15 @@ rip_output(struct mbuf *m, struct socket *so, ...) } else { if (m->m_pkthdr.len > IP_MAXPACKET) { m_freem(m); - return(EMSGSIZE); + return (EMSGSIZE); } + if (m->m_pkthdr.len < sizeof(*ip)) { + m_freem(m); + return (EINVAL); + } + m = m_pullup(m, sizeof(*ip)); + if (m == NULL) + return (ENOMEM); ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; if (m->m_len < hlen) { From owner-dev-commits-src-branches@freebsd.org Mon Aug 2 19:02:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EDB86792F6; Mon, 2 Aug 2021 19:02:06 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GdnRy1NSpz4qtl; Mon, 2 Aug 2021 19:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1744224BF7; Mon, 2 Aug 2021 19:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172J25X8091383; Mon, 2 Aug 2021 19:02:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172J25Wb091382; Mon, 2 Aug 2021 19:02:05 GMT (envelope-from git) Date: Mon, 2 Aug 2021 19:02:05 GMT Message-Id: <202108021902.172J25Wb091382@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 14a06b083b56 - stable/12 - rip: Add missing minimum length validation in rip_output() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 14a06b083b56572868f82759f5f74d17523e8afa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 19:02:06 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=14a06b083b56572868f82759f5f74d17523e8afa commit 14a06b083b56572868f82759f5f74d17523e8afa Author: Mark Johnston AuthorDate: 2021-07-26 20:39:18 +0000 Commit: Mark Johnston CommitDate: 2021-08-02 19:01:54 +0000 rip: Add missing minimum length validation in rip_output() If the socket is configured such that the sender is expected to supply the IP header, then we need to verify that it actually did so. Reported by: syzkaller+KMSAN Reviewed by: donner Sponsored by: The FreeBSD Foundation (cherry picked from commit ba21825202737a8b7e90e1ef669c7fe7e7d50325) --- sys/netinet/raw_ip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 1fd621a068f4..f15a3bca3a90 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -508,8 +508,15 @@ rip_output(struct mbuf *m, struct socket *so, ...) } else { if (m->m_pkthdr.len > IP_MAXPACKET) { m_freem(m); - return(EMSGSIZE); + return (EMSGSIZE); } + if (m->m_pkthdr.len < sizeof(*ip)) { + m_freem(m); + return (EINVAL); + } + m = m_pullup(m, sizeof(*ip)); + if (m == NULL) + return (ENOMEM); ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; if (m->m_len < hlen) { From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 02:05:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BDBA67E180; Tue, 3 Aug 2021 02:05:45 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdyrn3hhvz4Tj5; Tue, 3 Aug 2021 02:05:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 667C02A92; Tue, 3 Aug 2021 02:05:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17325jO2052594; Tue, 3 Aug 2021 02:05:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17325jom052593; Tue, 3 Aug 2021 02:05:45 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:05:45 GMT Message-Id: <202108030205.17325jom052593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 4ccafcfc8693 - stable/13 - e1000: Clean up igb_txrx MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4ccafcfc86936e3b32bbea5a6662d0e40cdcd565 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:05:45 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4ccafcfc86936e3b32bbea5a6662d0e40cdcd565 commit 4ccafcfc86936e3b32bbea5a6662d0e40cdcd565 Author: Kevin Bowling AuthorDate: 2021-07-20 07:06:31 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:04:05 +0000 e1000: Clean up igb_txrx The intention here is to reduce differences between em, igb, igc, ixgbe. The main functional change is logical simplification in igb_rx_checksum and getting interface caps from scctx instead of the ifp. Reviewed by: gallatin, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30073 (cherry picked from commit 41f02257146d128cdd4aa2bdcfdab7f9e08a4314) --- sys/dev/e1000/igb_txrx.c | 119 +++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 60 deletions(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 9f1921bf0c7e..ac768f84f810 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2016 Matthew Macy * All rights reserved. * @@ -47,16 +49,20 @@ static int igb_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void igb_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void igb_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx); -static int igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget); +static void igb_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, + qidx_t pidx); +static int igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, + qidx_t budget); static int igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static int igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); -static int igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); +static int igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); +static int igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); -static void igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int igb_determine_rsstype(u16 pkt_info); +static void igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype); +static int igb_determine_rsstype(uint16_t pkt_info); extern void igb_if_enable_intr(if_ctx_t ctx); extern int em_intr(void *arg); @@ -79,13 +85,14 @@ struct if_txrx igb_txrx = { * **********************************************************************/ static int -igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct e1000_adv_tx_context_desc *TXD; struct adapter *adapter = txr->adapter; - u32 type_tucmd_mlhl = 0, vlan_macip_lens = 0; - u32 mss_l4len_idx = 0; - u32 paylen; + uint32_t type_tucmd_mlhl = 0, vlan_macip_lens = 0; + uint32_t mss_l4len_idx = 0; + uint32_t paylen; switch(pi->ipi_etype) { case ETHERTYPE_IPV6: @@ -143,12 +150,13 @@ igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *oli * **********************************************************************/ static int -igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct e1000_adv_tx_context_desc *TXD; - struct adapter *adapter = txr->adapter; - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 mss_l4len_idx; + struct adapter *adapter = txr->adapter; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t mss_l4len_idx; mss_l4len_idx = vlan_macip_lens = type_tucmd_mlhl = 0; /* First check if TSO is to be used */ @@ -162,7 +170,7 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * TXD = (struct e1000_adv_tx_context_desc *) &txr->tx_base[pi->ipi_pidx]; /* - ** In advanced descriptors the vlan tag must + ** In advanced descriptors the vlan tag must ** be placed into the context descriptor. Hence ** we need to make one even if not doing offloads. */ @@ -171,7 +179,7 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * } else if ((pi->ipi_csum_flags & IGB_CSUM_OFFLOAD) == 0) { return (0); } - + /* Set the ether header length */ vlan_macip_lens |= pi->ipi_ehdrlen << E1000_ADVTXD_MACLEN_SHIFT; @@ -236,7 +244,7 @@ igb_isc_txd_encap(void *arg, if_pkt_info_t pi) bus_dma_segment_t *segs = pi->ipi_segs; union e1000_adv_tx_desc *txd = NULL; int i, j, pidx_last; - u32 olinfo_status, cmd_type_len, txd_flags; + uint32_t olinfo_status, cmd_type_len, txd_flags; qidx_t ntxd; pidx_last = olinfo_status = 0; @@ -395,7 +403,7 @@ igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; union e1000_adv_rx_desc *rxd; - u32 staterr = 0; + uint32_t staterr = 0; int cnt, i; for (cnt = 0, i = idx; cnt < scctx->isc_nrxd[0] && cnt <= budget;) { @@ -426,16 +434,15 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) if_softc_ctx_t scctx = adapter->shared; struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; - struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union e1000_adv_rx_desc *rxd; - u16 pkt_info, len; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; + uint16_t pkt_info, len, vtag; + uint32_t ptype, staterr; + int i, cidx; bool eop; - int i = 0; - int cidx = ri->iri_cidx; + + staterr = i = vtag = 0; + cidx = ri->iri_cidx; do { rxd = (union e1000_adv_rx_desc *)&rxr->rx_base[cidx]; @@ -485,14 +492,15 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxr->rx_packets++; - if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0) igb_rx_checksum(staterr, ri, ptype); - if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + if ((scctx->isc_capenable & IFCAP_VLAN_HWTAGGING) != 0 && (staterr & E1000_RXD_STAT_VP) != 0) { ri->iri_vtag = vtag; ri->iri_flags |= M_VLANTAG; } + ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss); ri->iri_rsstype = igb_determine_rsstype(pkt_info); @@ -509,46 +517,37 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * *********************************************************************/ static void -igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) { - u16 status = (u16)staterr; - u8 errors = (u8) (staterr >> 24); - bool sctp = FALSE; + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); /* Ignore Checksum bit is set */ - if (status & E1000_RXD_STAT_IXSM) { - ri->iri_csum_flags = 0; + if (__predict_false(status & E1000_RXD_STAT_IXSM)) return; - } - if ((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0) - sctp = 1; - else - sctp = 0; - - if (status & E1000_RXD_STAT_IPCS) { - /* Did it pass? */ - if (!(errors & E1000_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED; - ri->iri_csum_flags |= CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } + /* If there is a layer 3 or 4 error we are done */ + if (errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE)) + return; - if (status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); - if (sctp) /* reassign */ - type = CSUM_SCTP_VALID; - /* Did it pass? */ - if (!(errors & E1000_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (sctp == 0) - ri->iri_csum_data = htons(0xffff); + /* IP Checksum Good */ + if (status & E1000_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & + (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) { + /* SCTP header present. + * XXXKB: ETQF doesn't appear to be used in igb? + */ + if (__predict_false((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0)) { + ri->iri_csum_flags |= CSUM_SCTP_VALID; + } else { + ri->iri_csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + ri->iri_csum_data = htons(0xffff); } } - return; } /******************************************************************** @@ -557,7 +556,7 @@ igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * ******************************************************************/ static int -igb_determine_rsstype(u16 pkt_info) +igb_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) { case E1000_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 02:05:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD70067E0F3; Tue, 3 Aug 2021 02:05:46 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdyrp4hgQz4Tj7; Tue, 3 Aug 2021 02:05:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8935628A2; Tue, 3 Aug 2021 02:05:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17325kU9052618; Tue, 3 Aug 2021 02:05:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17325kCF052617; Tue, 3 Aug 2021 02:05:46 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:05:46 GMT Message-Id: <202108030205.17325kCF052617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: b91bb9b07f75 - stable/13 - e1000: Add missing branch prediction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b91bb9b07f75e8f014ce26fb20617f9de56c59a1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:05:47 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b91bb9b07f75e8f014ce26fb20617f9de56c59a1 commit b91bb9b07f75e8f014ce26fb20617f9de56c59a1 Author: Kevin Bowling AuthorDate: 2021-07-20 07:21:21 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:04:31 +0000 e1000: Add missing branch prediction I missed this edit from the ixgbe review (D30074) Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30073 (cherry picked from commit 9fd0cda92d3346e1daa30eb48e185e2077ac0566) --- sys/dev/e1000/igb_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index ac768f84f810..75c5c160bf3e 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -527,7 +527,7 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) return; /* If there is a layer 3 or 4 error we are done */ - if (errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE)) + if (__predict_false(errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE))) return; /* IP Checksum Good */ From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 02:05:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 215FE67E109; Tue, 3 Aug 2021 02:05:48 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdyrq5lsdz4TQl; Tue, 3 Aug 2021 02:05:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD89922E4; Tue, 3 Aug 2021 02:05:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17325ljw052642; Tue, 3 Aug 2021 02:05:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17325loV052641; Tue, 3 Aug 2021 02:05:47 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:05:47 GMT Message-Id: <202108030205.17325loV052641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: bb048438e7e5 - stable/13 - igb: clean up igb_txrx comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bb048438e7e580169b5255711ed8e6e9e9faf59c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:05:48 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bb048438e7e580169b5255711ed8e6e9e9faf59c commit bb048438e7e580169b5255711ed8e6e9e9faf59c Author: Kevin Bowling AuthorDate: 2021-07-31 15:04:25 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:04:46 +0000 igb: clean up igb_txrx comments Reviewed by: grehan MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31227 (cherry picked from commit ff01d6343f1f0c6550e4072eddda91dabd366d09) --- sys/dev/e1000/igb_txrx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 75c5c160bf3e..2252270fa5ea 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -522,7 +522,6 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) uint16_t status = (uint16_t)staterr; uint8_t errors = (uint8_t)(staterr >> 24); - /* Ignore Checksum bit is set */ if (__predict_false(status & E1000_RXD_STAT_IXSM)) return; @@ -537,9 +536,7 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) /* Valid L4E checksum */ if (__predict_true(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) { - /* SCTP header present. - * XXXKB: ETQF doesn't appear to be used in igb? - */ + /* SCTP header present */ if (__predict_false((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0)) { ri->iri_csum_flags |= CSUM_SCTP_VALID; From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 02:11:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E39D167E5BF; Tue, 3 Aug 2021 02:11:59 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdyzz65yKz4V8r; Tue, 3 Aug 2021 02:11:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9D5F26F4; Tue, 3 Aug 2021 02:11:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1732Bx0I064574; Tue, 3 Aug 2021 02:11:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1732BxCU064573; Tue, 3 Aug 2021 02:11:59 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:11:59 GMT Message-Id: <202108030211.1732BxCU064573@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 0861c2c695a7 - stable/12 - e1000: Clean up igb_txrx MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0861c2c695a770a789bc291b85ec1311d55c37dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:12:00 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0861c2c695a770a789bc291b85ec1311d55c37dd commit 0861c2c695a770a789bc291b85ec1311d55c37dd Author: Kevin Bowling AuthorDate: 2021-07-20 07:06:31 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:09:14 +0000 e1000: Clean up igb_txrx The intention here is to reduce differences between em, igb, igc, ixgbe. The main functional change is logical simplification in igb_rx_checksum and getting interface caps from scctx instead of the ifp. Reviewed by: gallatin, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30073 (cherry picked from commit 41f02257146d128cdd4aa2bdcfdab7f9e08a4314) --- sys/dev/e1000/igb_txrx.c | 119 +++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 60 deletions(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 6c41d440c769..4430f3136446 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2016 Matthew Macy * All rights reserved. * @@ -47,16 +49,20 @@ static int igb_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void igb_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void igb_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx); -static int igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget); +static void igb_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, + qidx_t pidx); +static int igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, + qidx_t budget); static int igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static int igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); -static int igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status); +static int igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); +static int igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, + uint32_t *cmd_type_len, uint32_t *olinfo_status); -static void igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int igb_determine_rsstype(u16 pkt_info); +static void igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype); +static int igb_determine_rsstype(uint16_t pkt_info); extern void igb_if_enable_intr(if_ctx_t ctx); extern int em_intr(void *arg); @@ -81,13 +87,14 @@ extern if_shared_ctx_t em_sctx; * **********************************************************************/ static int -igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct e1000_adv_tx_context_desc *TXD; struct adapter *adapter = txr->adapter; - u32 type_tucmd_mlhl = 0, vlan_macip_lens = 0; - u32 mss_l4len_idx = 0; - u32 paylen; + uint32_t type_tucmd_mlhl = 0, vlan_macip_lens = 0; + uint32_t mss_l4len_idx = 0; + uint32_t paylen; switch(pi->ipi_etype) { case ETHERTYPE_IPV6: @@ -145,12 +152,13 @@ igb_tso_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *oli * **********************************************************************/ static int -igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 *olinfo_status) +igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, uint32_t *cmd_type_len, + uint32_t *olinfo_status) { struct e1000_adv_tx_context_desc *TXD; - struct adapter *adapter = txr->adapter; - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 mss_l4len_idx; + struct adapter *adapter = txr->adapter; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t mss_l4len_idx; mss_l4len_idx = vlan_macip_lens = type_tucmd_mlhl = 0; /* First check if TSO is to be used */ @@ -164,7 +172,7 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * TXD = (struct e1000_adv_tx_context_desc *) &txr->tx_base[pi->ipi_pidx]; /* - ** In advanced descriptors the vlan tag must + ** In advanced descriptors the vlan tag must ** be placed into the context descriptor. Hence ** we need to make one even if not doing offloads. */ @@ -173,7 +181,7 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi, u32 *cmd_type_len, u32 * } else if ((pi->ipi_csum_flags & IGB_CSUM_OFFLOAD) == 0) { return (0); } - + /* Set the ether header length */ vlan_macip_lens |= pi->ipi_ehdrlen << E1000_ADVTXD_MACLEN_SHIFT; @@ -238,7 +246,7 @@ igb_isc_txd_encap(void *arg, if_pkt_info_t pi) bus_dma_segment_t *segs = pi->ipi_segs; union e1000_adv_tx_desc *txd = NULL; int i, j, pidx_last; - u32 olinfo_status, cmd_type_len, txd_flags; + uint32_t olinfo_status, cmd_type_len, txd_flags; qidx_t ntxd; pidx_last = olinfo_status = 0; @@ -397,7 +405,7 @@ igb_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; union e1000_adv_rx_desc *rxd; - u32 staterr = 0; + uint32_t staterr = 0; int cnt, i; for (cnt = 0, i = idx; cnt < scctx->isc_nrxd[0] && cnt <= budget;) { @@ -428,16 +436,15 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) if_softc_ctx_t scctx = adapter->shared; struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; - struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union e1000_adv_rx_desc *rxd; - u16 pkt_info, len; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; + uint16_t pkt_info, len, vtag; + uint32_t ptype, staterr; + int i, cidx; bool eop; - int i = 0; - int cidx = ri->iri_cidx; + + staterr = i = vtag = 0; + cidx = ri->iri_cidx; do { rxd = (union e1000_adv_rx_desc *)&rxr->rx_base[cidx]; @@ -487,14 +494,15 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxr->rx_packets++; - if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0) igb_rx_checksum(staterr, ri, ptype); - if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + if ((scctx->isc_capenable & IFCAP_VLAN_HWTAGGING) != 0 && (staterr & E1000_RXD_STAT_VP) != 0) { ri->iri_vtag = vtag; ri->iri_flags |= M_VLANTAG; } + ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss); ri->iri_rsstype = igb_determine_rsstype(pkt_info); @@ -511,46 +519,37 @@ igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * *********************************************************************/ static void -igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) { - u16 status = (u16)staterr; - u8 errors = (u8) (staterr >> 24); - bool sctp = FALSE; + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); /* Ignore Checksum bit is set */ - if (status & E1000_RXD_STAT_IXSM) { - ri->iri_csum_flags = 0; + if (__predict_false(status & E1000_RXD_STAT_IXSM)) return; - } - if ((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0) - sctp = 1; - else - sctp = 0; - - if (status & E1000_RXD_STAT_IPCS) { - /* Did it pass? */ - if (!(errors & E1000_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED; - ri->iri_csum_flags |= CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } + /* If there is a layer 3 or 4 error we are done */ + if (errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE)) + return; - if (status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); - if (sctp) /* reassign */ - type = CSUM_SCTP_VALID; - /* Did it pass? */ - if (!(errors & E1000_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (sctp == 0) - ri->iri_csum_data = htons(0xffff); + /* IP Checksum Good */ + if (status & E1000_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & + (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) { + /* SCTP header present. + * XXXKB: ETQF doesn't appear to be used in igb? + */ + if (__predict_false((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0)) { + ri->iri_csum_flags |= CSUM_SCTP_VALID; + } else { + ri->iri_csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + ri->iri_csum_data = htons(0xffff); } } - return; } /******************************************************************** @@ -559,7 +558,7 @@ igb_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * ******************************************************************/ static int -igb_determine_rsstype(u16 pkt_info) +igb_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) { case E1000_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 02:12:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31CC167E27A; Tue, 3 Aug 2021 02:12:01 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdz010mJgz4Tyt; Tue, 3 Aug 2021 02:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEB292C0C; Tue, 3 Aug 2021 02:12:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1732C0wC064598; Tue, 3 Aug 2021 02:12:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1732C0Ts064597; Tue, 3 Aug 2021 02:12:00 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:12:00 GMT Message-Id: <202108030212.1732C0Ts064597@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: a1b9408f97d1 - stable/12 - e1000: Add missing branch prediction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a1b9408f97d194e0c5a926b1acb42f212cd0ec9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:12:01 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a1b9408f97d194e0c5a926b1acb42f212cd0ec9d commit a1b9408f97d194e0c5a926b1acb42f212cd0ec9d Author: Kevin Bowling AuthorDate: 2021-07-20 07:21:21 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:10:29 +0000 e1000: Add missing branch prediction I missed this edit from the ixgbe review (D30074) Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30073 (cherry picked from commit 9fd0cda92d3346e1daa30eb48e185e2077ac0566) --- sys/dev/e1000/igb_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 4430f3136446..24a80c1857b2 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -529,7 +529,7 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) return; /* If there is a layer 3 or 4 error we are done */ - if (errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE)) + if (__predict_false(errors & (E1000_RXD_ERR_IPE | E1000_RXD_ERR_TCPE))) return; /* IP Checksum Good */ From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 02:12:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6166C67DE78; Tue, 3 Aug 2021 02:12:02 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdz0224Dwz4Tqf; Tue, 3 Aug 2021 02:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F42C2A75; Tue, 3 Aug 2021 02:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1732C12a064622; Tue, 3 Aug 2021 02:12:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1732C1oA064621; Tue, 3 Aug 2021 02:12:01 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:12:01 GMT Message-Id: <202108030212.1732C1oA064621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 2c99e12ff176 - stable/12 - igb: clean up igb_txrx comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2c99e12ff1761ea66fe2ed183e55a7cb60cc0007 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:12:02 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2c99e12ff1761ea66fe2ed183e55a7cb60cc0007 commit 2c99e12ff1761ea66fe2ed183e55a7cb60cc0007 Author: Kevin Bowling AuthorDate: 2021-07-31 15:04:25 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 02:10:52 +0000 igb: clean up igb_txrx comments Reviewed by: grehan MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31227 (cherry picked from commit ff01d6343f1f0c6550e4072eddda91dabd366d09) --- sys/dev/e1000/igb_txrx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 24a80c1857b2..3aa13fe2a1d4 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -524,7 +524,6 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) uint16_t status = (uint16_t)staterr; uint8_t errors = (uint8_t)(staterr >> 24); - /* Ignore Checksum bit is set */ if (__predict_false(status & E1000_RXD_STAT_IXSM)) return; @@ -539,9 +538,7 @@ igb_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) /* Valid L4E checksum */ if (__predict_true(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) { - /* SCTP header present. - * XXXKB: ETQF doesn't appear to be used in igb? - */ + /* SCTP header present */ if (__predict_false((ptype & E1000_RXDADV_PKTTYPE_ETQF) == 0 && (ptype & E1000_RXDADV_PKTTYPE_SCTP) != 0)) { ri->iri_csum_flags |= CSUM_SCTP_VALID; From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 02:45:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1CD067EBD2; Tue, 3 Aug 2021 02:45:38 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gdzkp6F7kz4WlV; Tue, 3 Aug 2021 02:45:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE5552E4A; Tue, 3 Aug 2021 02:45:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1732jcXZ005451; Tue, 3 Aug 2021 02:45:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1732jcXC005450; Tue, 3 Aug 2021 02:45:38 GMT (envelope-from git) Date: Tue, 3 Aug 2021 02:45:38 GMT Message-Id: <202108030245.1732jcXC005450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 814254f51b96 - stable/13 - Remove opensolaris_atomic.S dependency. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 814254f51b9672dada372b5e7b8ec977caefa2fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 02:45:39 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=814254f51b9672dada372b5e7b8ec977caefa2fd commit 814254f51b9672dada372b5e7b8ec977caefa2fd Author: Alexander Motin AuthorDate: 2021-07-27 23:50:52 +0000 Commit: Alexander Motin CommitDate: 2021-08-03 02:45:04 +0000 Remove opensolaris_atomic.S dependency. This file is no longer there, so this broke static zfs build. (cherry picked from commit e0229c5110d2a35e1cc464a596fff2498b836b1c) --- sys/conf/files.i386 | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 4bbd584cb831..602b86a7bdf3 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -47,7 +47,6 @@ linux_vdso.so optional compat_linux \ no-implicit-rule \ clean "linux_vdso.so" # -cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S optional zfs | dtrace compile-with "${ZFS_S}" cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" compat/linprocfs/linprocfs.c optional linprocfs From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5E5A6347C5; Tue, 3 Aug 2021 09:52:44 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cc4NBKz3NRx; Tue, 3 Aug 2021 09:52:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7EF0A10E74; Tue, 3 Aug 2021 09:52:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qigV081279; Tue, 3 Aug 2021 09:52:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qiV3081278; Tue, 3 Aug 2021 09:52:44 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:44 GMT Message-Id: <202108030952.1739qiV3081278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 75e8553e7908 - stable/13 - null_bypass(): some style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 75e8553e790877b1339597bbf7f880399392d724 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:44 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=75e8553e790877b1339597bbf7f880399392d724 commit 75e8553e790877b1339597bbf7f880399392d724 Author: Konstantin Belousov AuthorDate: 2021-07-20 00:48:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:35 +0000 null_bypass(): some style (cherry picked from commit 7b7227c4a601d92a46cf625ca7ae245664a809fe) --- sys/fs/nullfs/null_vnops.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 3b4e30d8a499..29be2a34614c 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -223,13 +223,12 @@ int null_bypass(struct vop_generic_args *ap) { struct vnode **this_vp_p; - int error; struct vnode *old_vps[VDESC_MAX_VPS]; struct vnode **vps_p[VDESC_MAX_VPS]; struct vnode ***vppp; struct vnode *lvp; struct vnodeop_desc *descp = ap->a_desc; - int reles, i; + int error, i, reles; if (null_bug_bypass) printf ("null_bypass: %s\n", descp->vdesc_name); @@ -252,26 +251,28 @@ null_bypass(struct vop_generic_args *ap) for (i = 0; i < VDESC_MAX_VPS; reles >>= 1, i++) { if (descp->vdesc_vp_offsets[i] == VDESC_NO_OFFSET) break; /* bail out at end of list */ - vps_p[i] = this_vp_p = - VOPARG_OFFSETTO(struct vnode**,descp->vdesc_vp_offsets[i],ap); + vps_p[i] = this_vp_p = VOPARG_OFFSETTO(struct vnode **, + descp->vdesc_vp_offsets[i], ap); + /* * We're not guaranteed that any but the first vnode * are of our type. Check for and don't map any * that aren't. (We must always map first vp or vclean fails.) */ - if (i && (*this_vp_p == NULLVP || + if (i != 0 && (*this_vp_p == NULLVP || (*this_vp_p)->v_op != &null_vnodeops)) { old_vps[i] = NULLVP; } else { old_vps[i] = *this_vp_p; *(vps_p[i]) = NULLVPTOLOWERVP(*this_vp_p); + /* * XXX - Several operations have the side effect * of vrele'ing their vp's. We must account for * that. (This should go away in the future.) */ if (reles & VDESC_VP0_WILLRELE) - VREF(*this_vp_p); + vref(*this_vp_p); } } @@ -279,9 +280,9 @@ null_bypass(struct vop_generic_args *ap) * Call the operation on the lower layer * with the modified argument structure. */ - if (vps_p[0] && *vps_p[0]) + if (vps_p[0] != NULL && *vps_p[0] != NULL) { error = VCALL(ap); - else { + } else { printf("null_bypass: no map for %s\n", descp->vdesc_name); error = EINVAL; } @@ -295,7 +296,7 @@ null_bypass(struct vop_generic_args *ap) for (i = 0; i < VDESC_MAX_VPS; reles >>= 1, i++) { if (descp->vdesc_vp_offsets[i] == VDESC_NO_OFFSET) break; /* bail out at end of list */ - if (old_vps[i]) { + if (old_vps[i] != NULL) { lvp = *(vps_p[i]); /* @@ -328,17 +329,18 @@ null_bypass(struct vop_generic_args *ap) * (Assumes that the lower layer always returns * a VREF'ed vpp unless it gets an error.) */ - if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && !error) { + if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && error == 0) { /* * XXX - even though some ops have vpp returned vp's, * several ops actually vrele this before returning. * We must avoid these ops. * (This should go away when these ops are regularized.) */ - vppp = VOPARG_OFFSETTO(struct vnode***, - descp->vdesc_vpp_offset,ap); - if (*vppp) - error = null_nodeget(old_vps[0]->v_mount, **vppp, *vppp); + vppp = VOPARG_OFFSETTO(struct vnode ***, + descp->vdesc_vpp_offset, ap); + if (*vppp != NULL) + error = null_nodeget(old_vps[0]->v_mount, **vppp, + *vppp); } return (error); From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D478563481A; Tue, 3 Aug 2021 09:52:45 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cd5MrHz3NZ6; Tue, 3 Aug 2021 09:52:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A04A81159B; Tue, 3 Aug 2021 09:52:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qjQF081305; Tue, 3 Aug 2021 09:52:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qjhk081304; Tue, 3 Aug 2021 09:52:45 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:45 GMT Message-Id: <202108030952.1739qjhk081304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b5eaf005273b - stable/13 - nullfs: provide custom null_advlock bypass MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b5eaf005273b5e23db8e83e08b0bd32bbbbe1d53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:46 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b5eaf005273b5e23db8e83e08b0bd32bbbbe1d53 commit b5eaf005273b5e23db8e83e08b0bd32bbbbe1d53 Author: Konstantin Belousov AuthorDate: 2021-07-17 22:56:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:35 +0000 nullfs: provide custom null_advlock bypass (cherry picked from commit 161e9a97363d17caf0b47983b28a37f3f59f9978) --- sys/fs/nullfs/null_vnops.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 29be2a34614c..4dfc5efaf9ed 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -980,6 +980,28 @@ null_read_pgcache(struct vop_read_pgcache_args *ap) return (error); } +static int +null_advlock(struct vop_advlock_args *ap) +{ + struct vnode *lvp, *vp; + struct null_node *xp; + int error; + + vp = ap->a_vp; + VI_LOCK(vp); + xp = VTONULL(vp); + if (xp == NULL) { + VI_UNLOCK(vp); + return (EBADF); + } + lvp = xp->null_lowervp; + vref(lvp); + VI_UNLOCK(vp); + error = VOP_ADVLOCK(lvp, ap->a_id, ap->a_op, ap->a_fl, ap->a_flags); + vrele(lvp); + return (error); +} + /* * Avoid standard bypass, since lower dvp and vp could be no longer * valid after vput(). @@ -1035,6 +1057,7 @@ struct vop_vector null_vnodeops = { .vop_bypass = null_bypass, .vop_access = null_access, .vop_accessx = null_accessx, + .vop_advlock = null_advlock, .vop_advlockpurge = vop_stdadvlockpurge, .vop_bmap = VOP_EOPNOTSUPP, .vop_stat = null_stat, From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EBC2634A66; Tue, 3 Aug 2021 09:52:47 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cg0Pwsz3NgK; Tue, 3 Aug 2021 09:52:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3D8811607; Tue, 3 Aug 2021 09:52:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qk7Y081334; Tue, 3 Aug 2021 09:52:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qkUc081333; Tue, 3 Aug 2021 09:52:46 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:46 GMT Message-Id: <202108030952.1739qkUc081333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 0a4eb4d65c11 - stable/13 - null_bypass(): prevent loosing the only reference to the lower vnode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a4eb4d65c11dc775733dd5a0a470419e1376515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:47 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0a4eb4d65c11dc775733dd5a0a470419e1376515 commit 0a4eb4d65c11dc775733dd5a0a470419e1376515 Author: Konstantin Belousov AuthorDate: 2021-07-20 00:53:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:35 +0000 null_bypass(): prevent loosing the only reference to the lower vnode (cherry picked from commit d5b078163e0d6bb2fe36f8e49a44853908d5e2db) --- sys/fs/nullfs/null_vnops.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 4dfc5efaf9ed..03f8b0dcbf7d 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -266,6 +266,17 @@ null_bypass(struct vop_generic_args *ap) old_vps[i] = *this_vp_p; *(vps_p[i]) = NULLVPTOLOWERVP(*this_vp_p); + /* + * The upper vnode reference to the lower + * vnode is the only reference that keeps our + * pointer to the lower vnode alive. If lower + * vnode is relocked during the VOP call, + * upper vnode might become unlocked and + * reclaimed, which invalidates our reference. + * Add a transient hold around VOP call. + */ + vhold(*this_vp_p); + /* * XXX - Several operations have the side effect * of vrele'ing their vp's. We must account for @@ -300,6 +311,7 @@ null_bypass(struct vop_generic_args *ap) lvp = *(vps_p[i]); /* + * Get rid of the transient hold on lvp. * If lowervp was unlocked during VOP * operation, nullfs upper vnode could have * been reclaimed, which changes its v_vnlock @@ -307,11 +319,14 @@ null_bypass(struct vop_generic_args *ap) * must move lock ownership from lower to * upper (reclaimed) vnode. */ - if (lvp != NULLVP && - VOP_ISLOCKED(lvp) == LK_EXCLUSIVE && - old_vps[i]->v_vnlock != lvp->v_vnlock) { - VOP_UNLOCK(lvp); - VOP_LOCK(old_vps[i], LK_EXCLUSIVE | LK_RETRY); + if (lvp != NULLVP) { + if (VOP_ISLOCKED(lvp) == LK_EXCLUSIVE && + old_vps[i]->v_vnlock != lvp->v_vnlock) { + VOP_UNLOCK(lvp); + VOP_LOCK(old_vps[i], LK_EXCLUSIVE | + LK_RETRY); + } + vdrop(lvp); } *(vps_p[i]) = old_vps[i]; From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BC64634673; Tue, 3 Aug 2021 09:52:48 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Ch11hwz3NWr; Tue, 3 Aug 2021 09:52:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F09BB11681; Tue, 3 Aug 2021 09:52:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qlSv081358; Tue, 3 Aug 2021 09:52:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qln4081357; Tue, 3 Aug 2021 09:52:47 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:47 GMT Message-Id: <202108030952.1739qln4081357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a3c7e571c089 - stable/13 - null_lookup: restore dvp lock always, not only on success MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3c7e571c08944082d134f8a2b883e80e9f0321a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:48 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a3c7e571c08944082d134f8a2b883e80e9f0321a commit a3c7e571c08944082d134f8a2b883e80e9f0321a Author: Konstantin Belousov AuthorDate: 2021-07-21 13:19:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:35 +0000 null_lookup: restore dvp lock always, not only on success (cherry picked from commit 4f21442e10dbb22f1bd4c990dc0b1a2aa51231b9) --- sys/fs/nullfs/null_vnops.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 03f8b0dcbf7d..eed0d6c74138 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -436,11 +436,12 @@ null_lookup(struct vop_lookup_args *ap) * dvp to be reclaimed due to shared v_vnlock. Check for the * doomed state and return error. */ - if ((error == 0 || error == EJUSTRETURN) && - VN_IS_DOOMED(dvp)) { - error = ENOENT; - if (lvp != NULL) - vput(lvp); + if (VN_IS_DOOMED(dvp)) { + if (error == 0 || error == EJUSTRETURN) { + if (lvp != NULL) + vput(lvp); + error = ENOENT; + } /* * If vgone() did reclaimed dvp before curthread From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C30D63481F; Tue, 3 Aug 2021 09:52:49 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cj1vLVz3NrF; Tue, 3 Aug 2021 09:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18C37112D8; Tue, 3 Aug 2021 09:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qmcF081382; Tue, 3 Aug 2021 09:52:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qmDL081381; Tue, 3 Aug 2021 09:52:48 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:48 GMT Message-Id: <202108030952.1739qmDL081381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2a56a5c2c21a - stable/13 - fifofs: fifo vnode might be relocked before VOP_OPEN() is called MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2a56a5c2c21a7bf1fc321a60fffbd8d59970633b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:49 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2a56a5c2c21a7bf1fc321a60fffbd8d59970633b commit 2a56a5c2c21a7bf1fc321a60fffbd8d59970633b Author: Konstantin Belousov AuthorDate: 2021-07-22 10:27:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 fifofs: fifo vnode might be relocked before VOP_OPEN() is called (cherry picked from commit 10db1896495b744aa5b039dd4ef1973b7a339379) --- sys/fs/fifofs/fifo_vnops.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index d2a51de84fba..861f1b40a744 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -282,9 +282,21 @@ fifo_close(ap) struct pipe *cpipe; vp = ap->a_vp; + ASSERT_VOP_ELOCKED(vp, "fifo_close"); fip = vp->v_fifoinfo; + + /* + * During open, it is possible that the fifo vnode is relocked + * after the vnode is instantiated but before VOP_OPEN() is + * done. For instance, vn_open_vnode() might need to upgrade + * vnode lock, or ffs_vput_pair() needs to unlock vp to sync + * dvp. In this case, reclaim can observe us with v_fifoinfo + * equal to NULL. + */ + if (fip == NULL) + return (0); + cpipe = fip->fi_pipe; - ASSERT_VOP_ELOCKED(vp, "fifo_close"); if (ap->a_fflag & FREAD) { fip->fi_readers--; if (fip->fi_readers == 0) { From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE3BC634A7B; Tue, 3 Aug 2021 09:52:50 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Ck4yyRz3NTm; Tue, 3 Aug 2021 09:52:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B4FB10E75; Tue, 3 Aug 2021 09:52:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qotR081408; Tue, 3 Aug 2021 09:52:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qos4081407; Tue, 3 Aug 2021 09:52:50 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:50 GMT Message-Id: <202108030952.1739qos4081407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5c52335fd1cc - stable/13 - null_rename: some style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5c52335fd1ccdd640134fe7b3dec7e8755e8d42c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:51 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5c52335fd1ccdd640134fe7b3dec7e8755e8d42c commit 5c52335fd1ccdd640134fe7b3dec7e8755e8d42c Author: Konstantin Belousov AuthorDate: 2021-07-24 14:46:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 null_rename: some style (cherry picked from commit 26e72728ce12c8670894435fcef8055a0ecb6266) --- sys/fs/nullfs/null_vnops.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index eed0d6c74138..3afdf049863f 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -655,15 +655,17 @@ null_remove(struct vop_remove_args *ap) static int null_rename(struct vop_rename_args *ap) { - struct vnode *tdvp = ap->a_tdvp; - struct vnode *fvp = ap->a_fvp; - struct vnode *fdvp = ap->a_fdvp; - struct vnode *tvp = ap->a_tvp; + struct vnode *fdvp, *fvp, *tdvp, *tvp; struct null_node *tnn; + tdvp = ap->a_tdvp; + fvp = ap->a_fvp; + fdvp = ap->a_fdvp; + tvp = ap->a_tvp; + /* Check for cross-device rename. */ if ((fvp->v_mount != tdvp->v_mount) || - (tvp && (fvp->v_mount != tvp->v_mount))) { + (tvp != NULL && fvp->v_mount != tvp->v_mount)) { if (tdvp == tvp) vrele(tdvp); else From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 003F36347DD; Tue, 3 Aug 2021 09:52:51 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cl3qxbz3NTs; Tue, 3 Aug 2021 09:52:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 530FA11552; Tue, 3 Aug 2021 09:52:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qpsA081432; Tue, 3 Aug 2021 09:52:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qpV3081431; Tue, 3 Aug 2021 09:52:51 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:51 GMT Message-Id: <202108030952.1739qpV3081431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7f5a4aff9b48 - stable/13 - nullfs: provide custom null_rename bypass MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7f5a4aff9b4826c1b9852f949ef97fe7ecf3efb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:52 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f5a4aff9b4826c1b9852f949ef97fe7ecf3efb0 commit 7f5a4aff9b4826c1b9852f949ef97fe7ecf3efb0 Author: Konstantin Belousov AuthorDate: 2021-07-24 15:05:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 nullfs: provide custom null_rename bypass (cherry picked from commit 4eaf9609fe42878eccaaf5fe1873f792074a62e4) --- sys/fs/nullfs/null_vnops.c | 68 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 3afdf049863f..6a6df55a0bef 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -656,32 +656,78 @@ static int null_rename(struct vop_rename_args *ap) { struct vnode *fdvp, *fvp, *tdvp, *tvp; - struct null_node *tnn; + struct vnode *lfdvp, *lfvp, *ltdvp, *ltvp; + struct null_node *fdnn, *fnn, *tdnn, *tnn; + int error; tdvp = ap->a_tdvp; fvp = ap->a_fvp; fdvp = ap->a_fdvp; tvp = ap->a_tvp; + lfdvp = NULL; /* Check for cross-device rename. */ if ((fvp->v_mount != tdvp->v_mount) || (tvp != NULL && fvp->v_mount != tvp->v_mount)) { - if (tdvp == tvp) - vrele(tdvp); - else - vput(tdvp); - if (tvp) - vput(tvp); - vrele(fdvp); - vrele(fvp); - return (EXDEV); + error = EXDEV; + goto upper_err; + } + + VI_LOCK(fdvp); + fdnn = VTONULL(fdvp); + if (fdnn == NULL) { /* fdvp is not locked, can be doomed */ + VI_UNLOCK(fdvp); + error = ENOENT; + goto upper_err; } + lfdvp = fdnn->null_lowervp; + vref(lfdvp); + VI_UNLOCK(fdvp); + + VI_LOCK(fvp); + fnn = VTONULL(fvp); + if (fnn == NULL) { + VI_UNLOCK(fvp); + error = ENOENT; + goto upper_err; + } + lfvp = fnn->null_lowervp; + vref(lfvp); + VI_UNLOCK(fvp); + + tdnn = VTONULL(tdvp); + ltdvp = tdnn->null_lowervp; + vref(ltdvp); if (tvp != NULL) { tnn = VTONULL(tvp); + ltvp = tnn->null_lowervp; + vref(ltvp); tnn->null_flags |= NULLV_DROP; + } else { + ltvp = NULL; } - return (null_bypass((struct vop_generic_args *)ap)); + + error = VOP_RENAME(lfdvp, lfvp, ap->a_fcnp, ltdvp, ltvp, ap->a_tcnp); + vrele(fdvp); + vrele(fvp); + vrele(tdvp); + if (tvp != NULL) + vrele(tvp); + return (error); + +upper_err: + if (tdvp == tvp) + vrele(tdvp); + else + vput(tdvp); + if (tvp) + vput(tvp); + if (lfdvp != NULL) + vrele(lfdvp); + vrele(fdvp); + vrele(fvp); + return (error); } static int From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CC7E634679; Tue, 3 Aug 2021 09:52:53 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cm4lVXz3NZX; Tue, 3 Aug 2021 09:52:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7916010E76; Tue, 3 Aug 2021 09:52:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qqZ5081462; Tue, 3 Aug 2021 09:52:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qqiq081461; Tue, 3 Aug 2021 09:52:52 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:52 GMT Message-Id: <202108030952.1739qqiq081461@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2fb281fa02d3 - stable/13 - Revert most of ce42e793100b460f597e4c85ec0da12e274f9394 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2fb281fa02d34b31b25e949415cfda4549b5aa6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:53 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2fb281fa02d34b31b25e949415cfda4549b5aa6b commit 2fb281fa02d34b31b25e949415cfda4549b5aa6b Author: Konstantin Belousov AuthorDate: 2021-07-19 15:40:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 Revert most of ce42e793100b460f597e4c85ec0da12e274f9394 to restore ABI compatibility for pre-10.x binaries. It restores _umtx_lock() and _umtx_unlock() syscalls, and UMTX_OP_LOCK/ UMTX_OP_UNLOCK umtx_op(2) operations. UMUTEX_ERROR_CHECK flag is left out for now, I do not think it makes a difference. PR: 218571 Reviewed by: brooks (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31220 (cherry picked from commit 9b6b793bd79521edc082a89b264a30881cb65e22) --- sys/compat/freebsd32/syscalls.master | 6 +- sys/kern/kern_umtx.c | 446 ++++++++++++++++++++++++++++++++++- sys/kern/syscalls.master | 14 +- sys/sys/_umtx.h | 4 + sys/sys/umtx.h | 7 +- 5 files changed, 467 insertions(+), 10 deletions(-) diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index 93d5a251d8ab..aac788bf3956 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -789,8 +789,10 @@ 431 AUE_THR_EXIT NOPROTO { void thr_exit(long *state); } 432 AUE_NULL NOPROTO { int thr_self(long *id); } 433 AUE_THR_KILL NOPROTO { int thr_kill(long id, int sig); } -434 AUE_NULL UNIMPL nosys -435 AUE_NULL UNIMPL nosys +434 AUE_NULL COMPAT10 { int freebsd32_umtx_lock( \ + struct umtx *umtx); } +435 AUE_NULL COMPAT10 { int freebsd32_umtx_unlock( \ + struct umtx *umtx); } 436 AUE_JAIL_ATTACH NOPROTO { int jail_attach(int jid); } 437 AUE_EXTATTR_LIST_FD NOPROTO { ssize_t extattr_list_fd(int fd, \ int attrnamespace, void *data, \ diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index a1dca77fe991..b76d080b8e06 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -908,6 +908,369 @@ umtx_key_release(struct umtx_key *key) vm_object_deallocate(key->info.shared.object); } +#ifdef COMPAT_FREEBSD10 +/* + * Lock a umtx object. + */ +static int +do_lock_umtx(struct thread *td, struct umtx *umtx, u_long id, + const struct timespec *timeout) +{ + struct abs_timeout timo; + struct umtx_q *uq; + u_long owner; + u_long old; + int error = 0; + + uq = td->td_umtxq; + if (timeout != NULL) + abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout); + + /* + * Care must be exercised when dealing with umtx structure. It + * can fault on any access. + */ + for (;;) { + /* + * Try the uncontested case. This should be done in userland. + */ + owner = casuword(&umtx->u_owner, UMTX_UNOWNED, id); + + /* The acquire succeeded. */ + if (owner == UMTX_UNOWNED) + return (0); + + /* The address was invalid. */ + if (owner == -1) + return (EFAULT); + + /* If no one owns it but it is contested try to acquire it. */ + if (owner == UMTX_CONTESTED) { + owner = casuword(&umtx->u_owner, + UMTX_CONTESTED, id | UMTX_CONTESTED); + + if (owner == UMTX_CONTESTED) + return (0); + + /* The address was invalid. */ + if (owner == -1) + return (EFAULT); + + error = thread_check_susp(td, false); + if (error != 0) + break; + + /* If this failed the lock has changed, restart. */ + continue; + } + + /* + * If we caught a signal, we have retried and now + * exit immediately. + */ + if (error != 0) + break; + + if ((error = umtx_key_get(umtx, TYPE_SIMPLE_LOCK, + AUTO_SHARE, &uq->uq_key)) != 0) + return (error); + + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + umtxq_insert(uq); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + + /* + * Set the contested bit so that a release in user space + * knows to use the system call for unlock. If this fails + * either some one else has acquired the lock or it has been + * released. + */ + old = casuword(&umtx->u_owner, owner, owner | UMTX_CONTESTED); + + /* The address was invalid. */ + if (old == -1) { + umtxq_lock(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + + /* + * We set the contested bit, sleep. Otherwise the lock changed + * and we need to retry or we lost a race to the thread + * unlocking the umtx. + */ + umtxq_lock(&uq->uq_key); + if (old == owner) + error = umtxq_sleep(uq, "umtx", timeout == NULL ? NULL : + &timo); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + + if (error == 0) + error = thread_check_susp(td, false); + } + + if (timeout == NULL) { + /* Mutex locking is restarted if it is interrupted. */ + if (error == EINTR) + error = ERESTART; + } else { + /* Timed-locking is not restarted. */ + if (error == ERESTART) + error = EINTR; + } + return (error); +} + +/* + * Unlock a umtx object. + */ +static int +do_unlock_umtx(struct thread *td, struct umtx *umtx, u_long id) +{ + struct umtx_key key; + u_long owner; + u_long old; + int error; + int count; + + /* + * Make sure we own this mtx. + */ + owner = fuword(__DEVOLATILE(u_long *, &umtx->u_owner)); + if (owner == -1) + return (EFAULT); + + if ((owner & ~UMTX_CONTESTED) != id) + return (EPERM); + + /* This should be done in userland */ + if ((owner & UMTX_CONTESTED) == 0) { + old = casuword(&umtx->u_owner, owner, UMTX_UNOWNED); + if (old == -1) + return (EFAULT); + if (old == owner) + return (0); + owner = old; + } + + /* We should only ever be in here for contested locks */ + if ((error = umtx_key_get(umtx, TYPE_SIMPLE_LOCK, AUTO_SHARE, + &key)) != 0) + return (error); + + umtxq_lock(&key); + umtxq_busy(&key); + count = umtxq_count(&key); + umtxq_unlock(&key); + + /* + * When unlocking the umtx, it must be marked as unowned if + * there is zero or one thread only waiting for it. + * Otherwise, it must be marked as contested. + */ + old = casuword(&umtx->u_owner, owner, + count <= 1 ? UMTX_UNOWNED : UMTX_CONTESTED); + umtxq_lock(&key); + umtxq_signal(&key,1); + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + if (old == -1) + return (EFAULT); + if (old != owner) + return (EINVAL); + return (0); +} + +#ifdef COMPAT_FREEBSD32 + +/* + * Lock a umtx object. + */ +static int +do_lock_umtx32(struct thread *td, uint32_t *m, uint32_t id, + const struct timespec *timeout) +{ + struct abs_timeout timo; + struct umtx_q *uq; + uint32_t owner; + uint32_t old; + int error = 0; + + uq = td->td_umtxq; + + if (timeout != NULL) + abs_timeout_init(&timo, CLOCK_REALTIME, 0, timeout); + + /* + * Care must be exercised when dealing with umtx structure. It + * can fault on any access. + */ + for (;;) { + /* + * Try the uncontested case. This should be done in userland. + */ + owner = casuword32(m, UMUTEX_UNOWNED, id); + + /* The acquire succeeded. */ + if (owner == UMUTEX_UNOWNED) + return (0); + + /* The address was invalid. */ + if (owner == -1) + return (EFAULT); + + /* If no one owns it but it is contested try to acquire it. */ + if (owner == UMUTEX_CONTESTED) { + owner = casuword32(m, + UMUTEX_CONTESTED, id | UMUTEX_CONTESTED); + if (owner == UMUTEX_CONTESTED) + return (0); + + /* The address was invalid. */ + if (owner == -1) + return (EFAULT); + + error = thread_check_susp(td, false); + if (error != 0) + break; + + /* If this failed the lock has changed, restart. */ + continue; + } + + /* + * If we caught a signal, we have retried and now + * exit immediately. + */ + if (error != 0) + return (error); + + if ((error = umtx_key_get(m, TYPE_SIMPLE_LOCK, + AUTO_SHARE, &uq->uq_key)) != 0) + return (error); + + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + umtxq_insert(uq); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + + /* + * Set the contested bit so that a release in user space + * knows to use the system call for unlock. If this fails + * either some one else has acquired the lock or it has been + * released. + */ + old = casuword32(m, owner, owner | UMUTEX_CONTESTED); + + /* The address was invalid. */ + if (old == -1) { + umtxq_lock(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + + /* + * We set the contested bit, sleep. Otherwise the lock changed + * and we need to retry or we lost a race to the thread + * unlocking the umtx. + */ + umtxq_lock(&uq->uq_key); + if (old == owner) + error = umtxq_sleep(uq, "umtx", timeout == NULL ? + NULL : &timo); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + + if (error == 0) + error = thread_check_susp(td, false); + } + + if (timeout == NULL) { + /* Mutex locking is restarted if it is interrupted. */ + if (error == EINTR) + error = ERESTART; + } else { + /* Timed-locking is not restarted. */ + if (error == ERESTART) + error = EINTR; + } + return (error); +} + +/* + * Unlock a umtx object. + */ +static int +do_unlock_umtx32(struct thread *td, uint32_t *m, uint32_t id) +{ + struct umtx_key key; + uint32_t owner; + uint32_t old; + int error; + int count; + + /* + * Make sure we own this mtx. + */ + owner = fuword32(m); + if (owner == -1) + return (EFAULT); + + if ((owner & ~UMUTEX_CONTESTED) != id) + return (EPERM); + + /* This should be done in userland */ + if ((owner & UMUTEX_CONTESTED) == 0) { + old = casuword32(m, owner, UMUTEX_UNOWNED); + if (old == -1) + return (EFAULT); + if (old == owner) + return (0); + owner = old; + } + + /* We should only ever be in here for contested locks */ + if ((error = umtx_key_get(m, TYPE_SIMPLE_LOCK, AUTO_SHARE, + &key)) != 0) + return (error); + + umtxq_lock(&key); + umtxq_busy(&key); + count = umtxq_count(&key); + umtxq_unlock(&key); + + /* + * When unlocking the umtx, it must be marked as unowned if + * there is zero or one thread only waiting for it. + * Otherwise, it must be marked as contested. + */ + old = casuword32(m, owner, + count <= 1 ? UMUTEX_UNOWNED : UMUTEX_CONTESTED); + umtxq_lock(&key); + umtxq_signal(&key,1); + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + if (old == -1) + return (EFAULT); + if (old != owner) + return (EINVAL); + return (0); +} +#endif /* COMPAT_FREEBSD32 */ +#endif /* COMPAT_FREEBSD10 */ + /* * Fetch and compare value, sleep on the address if value is not changed. */ @@ -3397,6 +3760,21 @@ do_sem2_wake(struct thread *td, struct _usem2 *sem) return (error); } +#ifdef COMPAT_FREEBSD10 +int +freebsd10__umtx_lock(struct thread *td, struct freebsd10__umtx_lock_args *uap) +{ + return (do_lock_umtx(td, uap->umtx, td->td_tid, 0)); +} + +int +freebsd10__umtx_unlock(struct thread *td, + struct freebsd10__umtx_unlock_args *uap) +{ + return (do_unlock_umtx(td, uap->umtx, td->td_tid)); +} +#endif + inline int umtx_copyin_timeout(const void *uaddr, struct timespec *tsp) { @@ -3456,13 +3834,50 @@ umtx_copyout_timeout(void *uaddr, size_t sz, struct timespec *tsp) return (copyout(tsp, uaddr, sizeof(*tsp))); } +#ifdef COMPAT_FREEBSD10 static int -__umtx_op_unimpl(struct thread *td, struct _umtx_op_args *uap, - const struct umtx_copyops *ops __unused) +__umtx_op_lock_umtx(struct thread *td, struct _umtx_op_args *uap, + const struct umtx_copyops *ops) +{ + struct timespec *ts, timeout; + int error; + + /* Allow a null timespec (wait forever). */ + if (uap->uaddr2 == NULL) + ts = NULL; + else { + error = ops->copyin_timeout(uap->uaddr2, &timeout); + if (error != 0) + return (error); + ts = &timeout; + } +#ifdef COMPAT_FREEBSD32 + if (ops->compat32) + return (do_lock_umtx32(td, uap->obj, uap->val, ts)); +#endif + return (do_lock_umtx(td, uap->obj, uap->val, ts)); +} + +static int +__umtx_op_unlock_umtx(struct thread *td, struct _umtx_op_args *uap, + const struct umtx_copyops *ops) { +#ifdef COMPAT_FREEBSD32 + if (ops->compat32) + return (do_unlock_umtx32(td, uap->obj, uap->val)); +#endif + return (do_unlock_umtx(td, uap->obj, uap->val)); +} +#endif /* COMPAT_FREEBSD10 */ +#if !defined(COMPAT_FREEBSD10) +static int +__umtx_op_unimpl(struct thread *td __unused, struct _umtx_op_args *uap __unused, + const struct umtx_copyops *ops __unused) +{ return (EOPNOTSUPP); } +#endif /* COMPAT_FREEBSD10 */ static int __umtx_op_wait(struct thread *td, struct _umtx_op_args *uap, @@ -4358,8 +4773,13 @@ typedef int (*_umtx_op_func)(struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *umtx_ops); static const _umtx_op_func op_table[] = { - [UMTX_OP_RESERVED0] = __umtx_op_unimpl, - [UMTX_OP_RESERVED1] = __umtx_op_unimpl, +#ifdef COMPAT_FREEBSD10 + [UMTX_OP_LOCK] = __umtx_op_lock_umtx, + [UMTX_OP_UNLOCK] = __umtx_op_unlock_umtx, +#else + [UMTX_OP_LOCK] = __umtx_op_unimpl, + [UMTX_OP_UNLOCK] = __umtx_op_unimpl, +#endif [UMTX_OP_WAIT] = __umtx_op_wait, [UMTX_OP_WAKE] = __umtx_op_wake, [UMTX_OP_MUTEX_TRYLOCK] = __umtx_op_trylock_umutex, @@ -4480,6 +4900,22 @@ sys__umtx_op(struct thread *td, struct _umtx_op_args *uap) } #ifdef COMPAT_FREEBSD32 +#ifdef COMPAT_FREEBSD10 +int +freebsd10_freebsd32_umtx_lock(struct thread *td, + struct freebsd10_freebsd32_umtx_lock_args *uap) +{ + return (do_lock_umtx32(td, (uint32_t *)uap->umtx, td->td_tid, NULL)); +} + +int +freebsd10_freebsd32_umtx_unlock(struct thread *td, + struct freebsd10_freebsd32_umtx_unlock_args *uap) +{ + return (do_unlock_umtx32(td, (uint32_t *)uap->umtx, td->td_tid)); +} +#endif /* COMPAT_FREEBSD10 */ + int freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) { @@ -4487,7 +4923,7 @@ freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, uap->uaddr2, &umtx_native_ops32)); } -#endif +#endif /* COMPAT_FREEBSD32 */ void umtx_thread_init(struct thread *td) diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 5b8e8049927c..d3ec771aac6f 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -2288,7 +2288,19 @@ int sig ); } -434-435 AUE_NULL UNIMPL nosys + +434 AUE_NULL COMPAT10 { + int _umtx_lock( + _Inout_ struct umtx *umtx + ); + } + +435 AUE_NULL COMPAT10 { + int _umtx_unlock( + _Inout_ struct umtx *umtx + ); + } + 436 AUE_JAIL_ATTACH STD { int jail_attach( int jid diff --git a/sys/sys/_umtx.h b/sys/sys/_umtx.h index b9d10b756a0c..d280c7d3db19 100644 --- a/sys/sys/_umtx.h +++ b/sys/sys/_umtx.h @@ -35,6 +35,10 @@ #include #include +struct umtx { + volatile unsigned long u_owner; /* Owner of the mutex. */ +}; + struct umutex { volatile __lwpid_t m_owner; /* Owner of the mutex */ __uint32_t m_flags; /* Flags of the mutex */ diff --git a/sys/sys/umtx.h b/sys/sys/umtx.h index 6753a6217688..60e9dccdad91 100644 --- a/sys/sys/umtx.h +++ b/sys/sys/umtx.h @@ -34,6 +34,9 @@ #include +#define UMTX_UNOWNED 0x0 +#define UMTX_CONTESTED LONG_MIN + /* Common lock flags */ #define USYNC_PROCESS_SHARED 0x0001 /* Process shared sync objs */ @@ -73,8 +76,8 @@ #define USEM_COUNT(c) ((c) & USEM_MAX_COUNT) /* op code for _umtx_op */ -#define UMTX_OP_RESERVED0 0 -#define UMTX_OP_RESERVED1 1 +#define UMTX_OP_LOCK 0 /* COMPAT10 */ +#define UMTX_OP_UNLOCK 1 /* COMPAT10 */ #define UMTX_OP_WAIT 2 #define UMTX_OP_WAKE 3 #define UMTX_OP_MUTEX_TRYLOCK 4 From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69D33634C98; Tue, 3 Aug 2021 09:52:55 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cq06g3z3Nv1; Tue, 3 Aug 2021 09:52:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD62811682; Tue, 3 Aug 2021 09:52:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qsnL081510; Tue, 3 Aug 2021 09:52:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qs2F081509; Tue, 3 Aug 2021 09:52:54 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:54 GMT Message-Id: <202108030952.1739qs2F081509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: dfda6a71e7e1 - stable/13 - /dev/pci: clarify meaning of writeable file descriptor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dfda6a71e7e185eba840cc8924fe744836d6c232 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:55 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dfda6a71e7e185eba840cc8924fe744836d6c232 commit dfda6a71e7e185eba840cc8924fe744836d6c232 Author: Konstantin Belousov AuthorDate: 2021-07-27 00:22:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 /dev/pci: clarify meaning of writeable file descriptor (cherry picked from commit 85ae35ef37c07c32d4e923435b637cbf0df3e8a3) --- share/man/man4/pci.4 | 15 +++++++++++++-- sys/dev/pci/pci_user.c | 7 ++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4 index 18eaae1cd4d4..28a456d18179 100644 --- a/share/man/man4/pci.4 +++ b/share/man/man4/pci.4 @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2019 +.Dd July 27, 2021 .Dt PCI 4 .Os .Sh NAME .Nm pci -.Nd generic PCI bus driver +.Nd generic PCI/PCIe bus driver .Sh SYNOPSIS To compile the PCI bus driver into the kernel, place the following line in your @@ -53,6 +53,8 @@ The .Nm driver provides support for .Tn PCI +and +.Tn PCIe devices in the kernel and limited access to .Tn PCI devices for userland. @@ -80,6 +82,15 @@ granting access to the device. If used improperly, this driver can allow userland applications to crash a machine or cause data loss. +In particular, driver only allows operations on the opened +.Pa /dev/pci +to modify system state if the file descriptor was opened for writing. +For instance, the +.Dv PCIOCREAD +and +.Dv PCIOCBARMMAP +operations require a writeable descriptor, because reading a config register +or a BAR read access could have function-specific side-effects. .Pp The .Nm diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index c34fd715707e..640a10abfeca 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -943,7 +943,12 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t io_old = NULL; #endif - if (!(flag & FWRITE)) { + /* + * Interpret read-only opened /dev/pci as a promise that no + * operation of the file descriptor could modify system state, + * including side-effects due to reading devices registers. + */ + if ((flag & FWRITE) == 0) { switch (cmd) { case PCIOCGETCONF: #ifdef COMPAT_FREEBSD32 From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF99E634830; Tue, 3 Aug 2021 09:52:54 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cp0Q69z3NpN; Tue, 3 Aug 2021 09:52:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99B9111553; Tue, 3 Aug 2021 09:52:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qrnd081486; Tue, 3 Aug 2021 09:52:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qr9A081485; Tue, 3 Aug 2021 09:52:53 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:53 GMT Message-Id: <202108030952.1739qr9A081485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: fb29b54a91f0 - stable/13 - Regen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fb29b54a91f05c3eb2822e8cfe92b26457a9a0f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:54 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fb29b54a91f05c3eb2822e8cfe92b26457a9a0f8 commit fb29b54a91f05c3eb2822e8cfe92b26457a9a0f8 Author: Konstantin Belousov AuthorDate: 2021-07-28 10:56:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 Regen --- sys/compat/freebsd32/freebsd32_proto.h | 10 ++++++++++ sys/compat/freebsd32/freebsd32_syscall.h | 2 ++ sys/compat/freebsd32/freebsd32_syscalls.c | 4 ++-- sys/compat/freebsd32/freebsd32_sysent.c | 4 ++-- sys/kern/init_sysent.c | 4 ++-- sys/kern/syscalls.c | 4 ++-- sys/kern/systrace_args.c | 8 ++++---- sys/sys/syscall.h | 2 ++ sys/sys/syscall.mk | 2 ++ sys/sys/sysproto.h | 14 ++++++++++++-- 10 files changed, 40 insertions(+), 14 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h index 14a2fe794c94..d7d4d4fec5ff 100644 --- a/sys/compat/freebsd32/freebsd32_proto.h +++ b/sys/compat/freebsd32/freebsd32_proto.h @@ -1193,6 +1193,12 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_ #if !defined(PAD64_REQUIRED) && !defined(__amd64__) #define PAD64_REQUIRED #endif +struct freebsd10_freebsd32_umtx_lock_args { + char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; +}; +struct freebsd10_freebsd32_umtx_unlock_args { + char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; +}; #ifdef PAD64_REQUIRED #else #endif @@ -1209,6 +1215,8 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_ #else #endif int freebsd10_freebsd32_pipe(struct thread *, struct freebsd10_freebsd32_pipe_args *); +int freebsd10_freebsd32_umtx_lock(struct thread *, struct freebsd10_freebsd32_umtx_lock_args *); +int freebsd10_freebsd32_umtx_unlock(struct thread *, struct freebsd10_freebsd32_umtx_unlock_args *); #endif /* COMPAT_FREEBSD10 */ @@ -1414,6 +1422,8 @@ int freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta #define FREEBSD32_SYS_AUE_freebsd32_getcontext AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_setcontext AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_swapcontext AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd10_freebsd32_umtx_lock AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd10_freebsd32_umtx_unlock AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_ksem_timedwait AUE_SEMWAIT #define FREEBSD32_SYS_AUE_freebsd32_thr_suspend AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32__umtx_op AUE_NULL diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index eea7e2f56968..c6ca12448ad2 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -356,6 +356,8 @@ #define FREEBSD32_SYS_thr_exit 431 #define FREEBSD32_SYS_thr_self 432 #define FREEBSD32_SYS_thr_kill 433 +#define FREEBSD32_SYS_freebsd10_freebsd32_umtx_lock 434 +#define FREEBSD32_SYS_freebsd10_freebsd32_umtx_unlock 435 #define FREEBSD32_SYS_jail_attach 436 #define FREEBSD32_SYS_extattr_list_fd 437 #define FREEBSD32_SYS_extattr_list_file 438 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index 0311882f02d0..4a79f2efdaa4 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -443,8 +443,8 @@ const char *freebsd32_syscallnames[] = { "thr_exit", /* 431 = thr_exit */ "thr_self", /* 432 = thr_self */ "thr_kill", /* 433 = thr_kill */ - "#434", /* 434 = nosys */ - "#435", /* 435 = nosys */ + "compat10.freebsd32_umtx_lock", /* 434 = freebsd10 freebsd32_umtx_lock */ + "compat10.freebsd32_umtx_unlock", /* 435 = freebsd10 freebsd32_umtx_unlock */ "jail_attach", /* 436 = jail_attach */ "extattr_list_fd", /* 437 = extattr_list_fd */ "extattr_list_file", /* 438 = extattr_list_file */ diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index bf9356fc1735..98b43274e9d8 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -496,8 +496,8 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(thr_exit_args), .sy_call = (sy_call_t *)sys_thr_exit, .sy_auevent = AUE_THR_EXIT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 431 = thr_exit */ { .sy_narg = AS(thr_self_args), .sy_call = (sy_call_t *)sys_thr_self, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 432 = thr_self */ { .sy_narg = AS(thr_kill_args), .sy_call = (sy_call_t *)sys_thr_kill, .sy_auevent = AUE_THR_KILL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 433 = thr_kill */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 434 = nosys */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 435 = nosys */ + { compat10(AS(freebsd10_freebsd32_umtx_lock_args),freebsd32_umtx_lock), .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 434 = freebsd10 freebsd32_umtx_lock */ + { compat10(AS(freebsd10_freebsd32_umtx_unlock_args),freebsd32_umtx_unlock), .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 435 = freebsd10 freebsd32_umtx_unlock */ { .sy_narg = AS(jail_attach_args), .sy_call = (sy_call_t *)sys_jail_attach, .sy_auevent = AUE_JAIL_ATTACH, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 436 = jail_attach */ { .sy_narg = AS(extattr_list_fd_args), .sy_call = (sy_call_t *)sys_extattr_list_fd, .sy_auevent = AUE_EXTATTR_LIST_FD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 437 = extattr_list_fd */ { .sy_narg = AS(extattr_list_file_args), .sy_call = (sy_call_t *)sys_extattr_list_file, .sy_auevent = AUE_EXTATTR_LIST_FILE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 438 = extattr_list_file */ diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index bac6edf1cee4..b4000dac6b83 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -489,8 +489,8 @@ struct sysent sysent[] = { { .sy_narg = AS(thr_exit_args), .sy_call = (sy_call_t *)sys_thr_exit, .sy_auevent = AUE_THR_EXIT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 431 = thr_exit */ { .sy_narg = AS(thr_self_args), .sy_call = (sy_call_t *)sys_thr_self, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 432 = thr_self */ { .sy_narg = AS(thr_kill_args), .sy_call = (sy_call_t *)sys_thr_kill, .sy_auevent = AUE_THR_KILL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 433 = thr_kill */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 434 = nosys */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 435 = nosys */ + { compat10(AS(freebsd10__umtx_lock_args),_umtx_lock), .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 434 = freebsd10 _umtx_lock */ + { compat10(AS(freebsd10__umtx_unlock_args),_umtx_unlock), .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 435 = freebsd10 _umtx_unlock */ { .sy_narg = AS(jail_attach_args), .sy_call = (sy_call_t *)sys_jail_attach, .sy_auevent = AUE_JAIL_ATTACH, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 436 = jail_attach */ { .sy_narg = AS(extattr_list_fd_args), .sy_call = (sy_call_t *)sys_extattr_list_fd, .sy_auevent = AUE_EXTATTR_LIST_FD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 437 = extattr_list_fd */ { .sy_narg = AS(extattr_list_file_args), .sy_call = (sy_call_t *)sys_extattr_list_file, .sy_auevent = AUE_EXTATTR_LIST_FILE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 438 = extattr_list_file */ diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 88fa3aee980f..de891eb35967 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -440,8 +440,8 @@ const char *syscallnames[] = { "thr_exit", /* 431 = thr_exit */ "thr_self", /* 432 = thr_self */ "thr_kill", /* 433 = thr_kill */ - "#434", /* 434 = nosys */ - "#435", /* 435 = nosys */ + "compat10._umtx_lock", /* 434 = freebsd10 _umtx_lock */ + "compat10._umtx_unlock", /* 435 = freebsd10 _umtx_unlock */ "jail_attach", /* 436 = jail_attach */ "extattr_list_fd", /* 437 = extattr_list_fd */ "extattr_list_file", /* 438 = extattr_list_file */ diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 68fe1eff8769..8f8274b1cdac 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -470,7 +470,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* getgroups */ case 79: { struct getgroups_args *p = params; - uarg[0] = p->gidsetsize; /* u_int */ + iarg[0] = p->gidsetsize; /* int */ uarg[1] = (intptr_t)p->gidset; /* gid_t * */ *n_args = 2; break; @@ -478,7 +478,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* setgroups */ case 80: { struct setgroups_args *p = params; - uarg[0] = p->gidsetsize; /* u_int */ + iarg[0] = p->gidsetsize; /* int */ uarg[1] = (intptr_t)p->gidset; /* gid_t * */ *n_args = 2; break; @@ -4122,7 +4122,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 79: switch (ndx) { case 0: - p = "u_int"; + p = "int"; break; case 1: p = "userland gid_t *"; @@ -4135,7 +4135,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 80: switch (ndx) { case 0: - p = "u_int"; + p = "int"; break; case 1: p = "userland gid_t *"; diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 3d2db9563e35..950055c9559e 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -376,6 +376,8 @@ #define SYS_thr_exit 431 #define SYS_thr_self 432 #define SYS_thr_kill 433 +#define SYS_freebsd10__umtx_lock 434 +#define SYS_freebsd10__umtx_unlock 435 #define SYS_jail_attach 436 #define SYS_extattr_list_fd 437 #define SYS_extattr_list_file 438 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index 4c3e04ebd0f7..e007d2c81e61 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -286,6 +286,8 @@ MIASM = \ thr_exit.o \ thr_self.o \ thr_kill.o \ + freebsd10__umtx_lock.o \ + freebsd10__umtx_unlock.o \ jail_attach.o \ extattr_list_fd.o \ extattr_list_file.o \ diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 66060ab77f9a..f17b1951f559 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -284,11 +284,11 @@ struct mincore_args { char vec_l_[PADL_(char *)]; char * vec; char vec_r_[PADR_(char *)]; }; struct getgroups_args { - char gidsetsize_l_[PADL_(u_int)]; u_int gidsetsize; char gidsetsize_r_[PADR_(u_int)]; + char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; }; struct setgroups_args { - char gidsetsize_l_[PADL_(u_int)]; u_int gidsetsize; char gidsetsize_r_[PADR_(u_int)]; + char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; }; struct getpgrp_args { @@ -2573,7 +2573,15 @@ int freebsd7_shmctl(struct thread *, struct freebsd7_shmctl_args *); #ifdef COMPAT_FREEBSD10 +struct freebsd10__umtx_lock_args { + char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; +}; +struct freebsd10__umtx_unlock_args { + char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; +}; int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *); +int freebsd10__umtx_lock(struct thread *, struct freebsd10__umtx_lock_args *); +int freebsd10__umtx_unlock(struct thread *, struct freebsd10__umtx_unlock_args *); #endif /* COMPAT_FREEBSD10 */ @@ -3040,6 +3048,8 @@ int freebsd12_closefrom(struct thread *, struct freebsd12_closefrom_args *); #define SYS_AUE_thr_exit AUE_THR_EXIT #define SYS_AUE_thr_self AUE_NULL #define SYS_AUE_thr_kill AUE_THR_KILL +#define SYS_AUE_freebsd10__umtx_lock AUE_NULL +#define SYS_AUE_freebsd10__umtx_unlock AUE_NULL #define SYS_AUE_jail_attach AUE_JAIL_ATTACH #define SYS_AUE_extattr_list_fd AUE_EXTATTR_LIST_FD #define SYS_AUE_extattr_list_file AUE_EXTATTR_LIST_FILE From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D685F634AAF; Tue, 3 Aug 2021 09:52:56 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cr1cyyz3NV6; Tue, 3 Aug 2021 09:52:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB32D10E77; Tue, 3 Aug 2021 09:52:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qtlM081534; Tue, 3 Aug 2021 09:52:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qtcY081533; Tue, 3 Aug 2021 09:52:55 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:55 GMT Message-Id: <202108030952.1739qtcY081533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 21049f0567f2 - stable/13 - amd64: make efi_boot global MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 21049f0567f2e1a206ef21e0614bd98d37214711 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:57 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=21049f0567f2e1a206ef21e0614bd98d37214711 commit 21049f0567f2e1a206ef21e0614bd98d37214711 Author: Konstantin Belousov AuthorDate: 2021-07-22 16:22:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 amd64: make efi_boot global (cherry picked from commit 6a3821369f43bb1e8a672cbbfd7732406d9f9a4c) --- sys/amd64/amd64/machdep.c | 3 ++- sys/amd64/include/md_var.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 0098e926d0f0..93030cbe7126 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -228,6 +228,8 @@ struct mtx dt_lock; /* lock for GDT and LDT */ void (*vmm_resume_p)(void); +bool efi_boot; + static void cpu_startup(dummy) void *dummy; @@ -1613,7 +1615,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct region_descriptor r_gdt; size_t kstack0_sz; int late_console; - bool efi_boot; TSRAW(&thread0, TS_ENTER, __func__, NULL); diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 3b2454a4b441..b66e314d99b1 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -55,6 +55,8 @@ extern int la57; */ extern char kernphys[]; +extern bool efi_boot; + struct savefpu; struct sysentvec; From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63B8E634E45; Tue, 3 Aug 2021 09:52:58 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cs5WNxz3NV8; Tue, 3 Aug 2021 09:52:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05B0C1159C; Tue, 3 Aug 2021 09:52:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qucH081558; Tue, 3 Aug 2021 09:52:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739quZh081557; Tue, 3 Aug 2021 09:52:56 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:56 GMT Message-Id: <202108030952.1739quZh081557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 17332276a640 - stable/13 - amd64: do not touch low memory in AP startup unless we used legacy boot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 17332276a640ea822455089a114b74ca9eeadee4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:58 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=17332276a640ea822455089a114b74ca9eeadee4 commit 17332276a640ea822455089a114b74ca9eeadee4 Author: Konstantin Belousov AuthorDate: 2021-07-22 16:27:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 amd64: do not touch low memory in AP startup unless we used legacy boot (cherry picked from commit 48216088b1157a22b95540efea58f70057cd5c06) --- sys/amd64/amd64/mp_machdep.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index aa62c2086fa4..237710da349d 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -450,13 +450,16 @@ native_start_all_aps(void) } /* save the current value of the warm-start vector */ - mpbioswarmvec = *((u_int32_t *) WARMBOOT_OFF); + if (!efi_boot) + mpbioswarmvec = *((u_int32_t *) WARMBOOT_OFF); outb(CMOS_REG, BIOS_RESET); mpbiosreason = inb(CMOS_DATA); /* setup a vector to our boot code */ - *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; - *((volatile u_short *) WARMBOOT_SEG) = (boot_address >> 4); + if (!efi_boot) { + *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; + *((volatile u_short *)WARMBOOT_SEG) = (boot_address >> 4); + } outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07285634D63; Tue, 3 Aug 2021 09:52:59 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Ct3Zz1z3Nrn; Tue, 3 Aug 2021 09:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CC5911608; Tue, 3 Aug 2021 09:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qw7Q081588; Tue, 3 Aug 2021 09:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qwCw081587; Tue, 3 Aug 2021 09:52:58 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:58 GMT Message-Id: <202108030952.1739qwCw081587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2c7315c09a2b - stable/13 - amd64: do not touch low memory in AP startup unless we used legacy boot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2c7315c09a2b228f544c5c94b29f4d55701792f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:59 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2c7315c09a2b228f544c5c94b29f4d55701792f8 commit 2c7315c09a2b228f544c5c94b29f4d55701792f8 Author: Konstantin Belousov AuthorDate: 2021-07-29 13:18:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 amd64: do not touch low memory in AP startup unless we used legacy boot (cherry picked from commit 2572376f7f6412bc69bd6138e9ac9a6efd7642af) --- sys/amd64/amd64/mp_machdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 237710da349d..74f1af919b66 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -502,7 +502,8 @@ native_start_all_aps(void) /* attempt to start the Application Processor */ if (!start_ap(apic_id)) { /* restore the warmstart vector */ - *(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec; + if (!efi_boot) + *(u_int32_t *)WARMBOOT_OFF = mpbioswarmvec; panic("AP #%d (PHY# %d) failed!", cpu, apic_id); } @@ -510,7 +511,8 @@ native_start_all_aps(void) } /* restore the warmstart vector */ - *(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec; + if (!efi_boot) + *(u_int32_t *)WARMBOOT_OFF = mpbioswarmvec; outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, mpbiosreason); From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:53:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D622634848; Tue, 3 Aug 2021 09:53:00 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cv6Kksz3NpZ; Tue, 3 Aug 2021 09:52:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46A7F112D9; Tue, 3 Aug 2021 09:52:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qxcu081612; Tue, 3 Aug 2021 09:52:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qxIm081611; Tue, 3 Aug 2021 09:52:59 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:59 GMT Message-Id: <202108030952.1739qxIm081611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5a84640fcf27 - stable/13 - amd64 pti init: fix calculation of the kernel text start MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a84640fcf2763e1475aabc0f591384fb0d2c080 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:53:00 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5a84640fcf2763e1475aabc0f591384fb0d2c080 commit 5a84640fcf2763e1475aabc0f591384fb0d2c080 Author: Konstantin Belousov AuthorDate: 2021-07-10 19:51:16 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:37 +0000 amd64 pti init: fix calculation of the kernel text start (cherry picked from commit 34516d4ad19b83e5dfe6ec8c1db232c422d7ecff) --- sys/amd64/amd64/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 9b95343f43f3..73850cbb376f 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -10636,7 +10636,7 @@ pmap_pti_init(void) va = __pcpu[i].pc_common_tss.tss_ist4 + sizeof(struct nmi_pcpu); pmap_pti_add_kva_locked(va - DBG_STACK_SIZE, va, false); } - pmap_pti_add_kva_locked((vm_offset_t)kernphys + KERNBASE, + pmap_pti_add_kva_locked((vm_offset_t)KERNBASE + NBPDR, (vm_offset_t)etext, true); pti_finalized = true; VM_OBJECT_WUNLOCK(pti_obj); From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:53:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 575D0634AD6; Tue, 3 Aug 2021 09:53:01 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cw4Ry4z3NvJ; Tue, 3 Aug 2021 09:53:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CE091159D; Tue, 3 Aug 2021 09:53:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739r0eX081636; Tue, 3 Aug 2021 09:53:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739r0Ts081635; Tue, 3 Aug 2021 09:53:00 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:53:00 GMT Message-Id: <202108030953.1739r0Ts081635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 6ba778918946 - stable/13 - amd64: add pmap_alloc_page_below_4g() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6ba778918946fcdfd15146bf1a47fb19d3262115 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:53:01 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6ba778918946fcdfd15146bf1a47fb19d3262115 commit 6ba778918946fcdfd15146bf1a47fb19d3262115 Author: Konstantin Belousov AuthorDate: 2021-07-13 15:00:54 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:37 +0000 amd64: add pmap_alloc_page_below_4g() (cherry picked from commit c8bae074d9e1d766bcbc2e631ce0c2e9d248881c) --- sys/amd64/amd64/pmap.c | 49 +++++++++++++++++++----------------------------- sys/amd64/include/pmap.h | 1 + 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 73850cbb376f..e5d46449c275 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1997,6 +1997,19 @@ pmap_init_pat(void) load_cr4(cr4); } +vm_page_t +pmap_page_alloc_below_4g(bool zeroed) +{ + vm_page_t m; + + m = vm_page_alloc_contig(NULL, 0, (zeroed ? VM_ALLOC_ZERO : 0) | + VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ, + 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); + if (m != NULL && zeroed && (m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + return (m); +} + extern const char la57_trampoline[], la57_trampoline_gdt_desc[], la57_trampoline_gdt[], la57_trampoline_end[]; @@ -2022,42 +2035,18 @@ pmap_bootstrap_la57(void *arg __unused) r_gdt.rd_limit = NGDT * sizeof(struct user_segment_descriptor) - 1; r_gdt.rd_base = (long)__pcpu[0].pc_gdt; - m_code = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_code->flags & PG_ZERO) == 0) - pmap_zero_page(m_code); + m_code = pmap_page_alloc_below_4g(true); v_code = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_code)); - m_pml5 = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pml5->flags & PG_ZERO) == 0) - pmap_zero_page(m_pml5); + m_pml5 = pmap_page_alloc_below_4g(true); KPML5phys = VM_PAGE_TO_PHYS(m_pml5); v_pml5 = (pml5_entry_t *)PHYS_TO_DMAP(KPML5phys); - m_pml4 = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pml4->flags & PG_ZERO) == 0) - pmap_zero_page(m_pml4); + m_pml4 = pmap_page_alloc_below_4g(true); v_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pml4)); - m_pdp = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pdp->flags & PG_ZERO) == 0) - pmap_zero_page(m_pdp); + m_pdp = pmap_page_alloc_below_4g(true); v_pdp = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pdp)); - m_pd = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pd->flags & PG_ZERO) == 0) - pmap_zero_page(m_pd); + m_pd = pmap_page_alloc_below_4g(true); v_pd = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pd)); - m_pt = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if ((m_pt->flags & PG_ZERO) == 0) - pmap_zero_page(m_pt); + m_pt = pmap_page_alloc_below_4g(true); v_pt = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pt)); /* diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 8ba654cb2e7c..d06a618a08b6 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -501,6 +501,7 @@ int pmap_pkru_set(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, void pmap_thread_init_invl_gen(struct thread *td); int pmap_vmspace_copy(pmap_t dst_pmap, pmap_t src_pmap); void pmap_page_array_startup(long count); +vm_page_t pmap_page_alloc_below_4g(bool zeroed); #endif /* _KERNEL */ /* Return various clipped indexes for a given VA */ From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 10:52:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C345C6365D8; Tue, 3 Aug 2021 10:52:58 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfBY64wNwz3lS3; Tue, 3 Aug 2021 10:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90CCA121B4; Tue, 3 Aug 2021 10:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173Aqw7r063648; Tue, 3 Aug 2021 10:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173AqwHE063647; Tue, 3 Aug 2021 10:52:58 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:52:58 GMT Message-Id: <202108031052.173AqwHE063647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3a83634c0fe2 - stable/13 - Wait for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a83634c0fe255be6cfb2e6cb48187f3753216ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:52:58 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a83634c0fe255be6cfb2e6cb48187f3753216ef commit 3a83634c0fe255be6cfb2e6cb48187f3753216ef Author: Hans Petter Selasky AuthorDate: 2021-05-21 11:17:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:55:12 +0000 Wait for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI (cherry picked from commit b764a426534f2f5f86d6625288c74dafdbc94d2b) --- sys/compat/linuxkpi/common/src/linux_current.c | 35 ++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index 9bae7ee92e49..51e396081c04 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -45,6 +45,7 @@ extern u_int first_msi_irq, num_msi_irqs; static eventhandler_tag linuxkpi_thread_dtor_tag; +static atomic_t linux_current_allocs; static uma_zone_t linux_current_zone; static uma_zone_t linux_mm_zone; @@ -146,6 +147,10 @@ linux_alloc_current(struct thread *td, int flags) /* free mm_struct pointer, if any */ uma_zfree(linux_mm_zone, mm); + /* keep track of number of allocations */ + if (atomic_add_return(1, &linux_current_allocs) == INT_MAX) + panic("linux_alloc_current: Refcount too high!"); + return (0); } @@ -173,6 +178,10 @@ linux_free_current(struct task_struct *ts) { mmput(ts->mm); uma_zfree(linux_current_zone, ts); + + /* keep track of number of allocations */ + if (atomic_sub_return(1, &linux_current_allocs) < 0) + panic("linux_free_current: Negative refcount!"); } static void @@ -271,10 +280,6 @@ SYSCTL_INT(_compat_linuxkpi, OID_AUTO, task_struct_reserve, static void linux_current_init(void *arg __unused) { - lkpi_alloc_current = linux_alloc_current; - linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, - linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - TUNABLE_INT_FETCH("compat.linuxkpi.task_struct_reserve", &lkpi_task_resrv); if (lkpi_task_resrv == 0) { @@ -298,6 +303,12 @@ linux_current_init(void *arg __unused) UMA_ALIGN_PTR, 0); uma_zone_reserve(linux_mm_zone, lkpi_task_resrv); uma_prealloc(linux_mm_zone, lkpi_task_resrv); + + atomic_thread_fence_seq_cst(); + + lkpi_alloc_current = linux_alloc_current; + linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, + linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); } SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_init, NULL); @@ -309,6 +320,10 @@ linux_current_uninit(void *arg __unused) struct task_struct *ts; struct thread *td; + lkpi_alloc_current = linux_alloc_current_noop; + + atomic_thread_fence_seq_cst(); + sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); @@ -321,8 +336,18 @@ linux_current_uninit(void *arg __unused) PROC_UNLOCK(p); } sx_sunlock(&allproc_lock); + + /* + * There is a window where threads are removed from the + * process list and where the thread destructor is invoked. + * Catch that window by waiting for all task_struct + * allocations to be returned before freeing the UMA zone. + */ + while (atomic_read(&linux_current_allocs) != 0) + pause("W", 1); + EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); - lkpi_alloc_current = linux_alloc_current_noop; + uma_zdestroy(linux_current_zone); uma_zdestroy(linux_mm_zone); } From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 10:52:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E882A636276; Tue, 3 Aug 2021 10:52:59 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfBY763H9z3lGN; Tue, 3 Aug 2021 10:52:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B27F8121B5; Tue, 3 Aug 2021 10:52:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173AqxQ0063672; Tue, 3 Aug 2021 10:52:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173AqxgH063671; Tue, 3 Aug 2021 10:52:59 GMT (envelope-from git) Date: Tue, 3 Aug 2021 10:52:59 GMT Message-Id: <202108031052.173AqxgH063671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 130f41810ea7 - stable/13 - linuxkpi: remove global atomic counter of the task allocations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 130f41810ea754d4ba2da636d7804458185b7ed0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 10:53:00 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=130f41810ea754d4ba2da636d7804458185b7ed0 commit 130f41810ea754d4ba2da636d7804458185b7ed0 Author: Konstantin Belousov AuthorDate: 2021-05-20 15:28:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:56:02 +0000 linuxkpi: remove global atomic counter of the task allocations (cherry picked from commit d96f55bc7159e8d018847abe5b1782d74c8aa415) --- sys/compat/linuxkpi/common/src/linux_current.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index 51e396081c04..925d96770cc2 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -45,7 +45,6 @@ extern u_int first_msi_irq, num_msi_irqs; static eventhandler_tag linuxkpi_thread_dtor_tag; -static atomic_t linux_current_allocs; static uma_zone_t linux_current_zone; static uma_zone_t linux_mm_zone; @@ -147,10 +146,6 @@ linux_alloc_current(struct thread *td, int flags) /* free mm_struct pointer, if any */ uma_zfree(linux_mm_zone, mm); - /* keep track of number of allocations */ - if (atomic_add_return(1, &linux_current_allocs) == INT_MAX) - panic("linux_alloc_current: Refcount too high!"); - return (0); } @@ -178,10 +173,6 @@ linux_free_current(struct task_struct *ts) { mmput(ts->mm); uma_zfree(linux_current_zone, ts); - - /* keep track of number of allocations */ - if (atomic_sub_return(1, &linux_current_allocs) < 0) - panic("linux_free_current: Negative refcount!"); } static void @@ -306,9 +297,9 @@ linux_current_init(void *arg __unused) atomic_thread_fence_seq_cst(); - lkpi_alloc_current = linux_alloc_current; linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); + lkpi_alloc_current = linux_alloc_current; } SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_init, NULL); @@ -337,17 +328,10 @@ linux_current_uninit(void *arg __unused) } sx_sunlock(&allproc_lock); - /* - * There is a window where threads are removed from the - * process list and where the thread destructor is invoked. - * Catch that window by waiting for all task_struct - * allocations to be returned before freeing the UMA zone. - */ - while (atomic_read(&linux_current_allocs) != 0) - pause("W", 1); + thread_reap_barrier(); EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); - + uma_zdestroy(linux_current_zone); uma_zdestroy(linux_mm_zone); } From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 22:51:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DAFD651DE9; Tue, 3 Aug 2021 22:51:27 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfVV73Njsz4Vn6; Tue, 3 Aug 2021 22:51:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DA6E1BC1E; Tue, 3 Aug 2021 22:51:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173MpR4T030294; Tue, 3 Aug 2021 22:51:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173MpRrh030293; Tue, 3 Aug 2021 22:51:27 GMT (envelope-from git) Date: Tue, 3 Aug 2021 22:51:27 GMT Message-Id: <202108032251.173MpRrh030293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 914e70b909d0 - stable/13 - arm: Bump KSTACK_PAGES default to match i386/amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 914e70b909d0b91843264231a2c2f97c40a940f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 22:51:27 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=914e70b909d0b91843264231a2c2f97c40a940f9 commit 914e70b909d0b91843264231a2c2f97c40a940f9 Author: Kevin Bowling AuthorDate: 2021-07-21 01:35:54 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 22:51:14 +0000 arm: Bump KSTACK_PAGES default to match i386/amd64 See 3f6867ef6386 for additional context. It is also needed for OpenZFS performance and stability. Reviewed by: ian (arm), imp Differential Revision: https://reviews.freebsd.org/D31244 (cherry picked from commit b684d812fcb04b2997fd755405a92c36b9f6e30e) --- sys/arm/include/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index 807b492324fa..45dc0f270c50 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -114,7 +114,7 @@ #define MAXPAGESIZES 2 /* maximum number of supported page sizes */ #ifndef KSTACK_PAGES -#define KSTACK_PAGES 2 +#define KSTACK_PAGES 4 #endif /* !KSTACK_PAGES */ #ifndef FPCONTEXTSIZE From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 22:52:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C7A0652328; Tue, 3 Aug 2021 22:52:00 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfVVm2Df9z4VRy; Tue, 3 Aug 2021 22:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33A9F1BACF; Tue, 3 Aug 2021 22:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173Mq0ET033694; Tue, 3 Aug 2021 22:52:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173Mq01B033693; Tue, 3 Aug 2021 22:52:00 GMT (envelope-from git) Date: Tue, 3 Aug 2021 22:52:00 GMT Message-Id: <202108032252.173Mq01B033693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 19737ec0a2e4 - stable/12 - arm: Bump KSTACK_PAGES default to match i386/amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 19737ec0a2e4d234de074fcc5dacde444f599546 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 22:52:00 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=19737ec0a2e4d234de074fcc5dacde444f599546 commit 19737ec0a2e4d234de074fcc5dacde444f599546 Author: Kevin Bowling AuthorDate: 2021-07-21 01:35:54 +0000 Commit: Kevin Bowling CommitDate: 2021-08-03 22:51:52 +0000 arm: Bump KSTACK_PAGES default to match i386/amd64 See 3f6867ef6386 for additional context. It is also needed for OpenZFS performance and stability. Reviewed by: ian (arm), imp Differential Revision: https://reviews.freebsd.org/D31244 (cherry picked from commit b684d812fcb04b2997fd755405a92c36b9f6e30e) --- sys/arm/include/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index 39dcc5e341bf..8ba4963406b3 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -124,7 +124,7 @@ #define MAXPAGESIZES 2 /* maximum number of supported page sizes */ #ifndef KSTACK_PAGES -#define KSTACK_PAGES 2 +#define KSTACK_PAGES 4 #endif /* !KSTACK_PAGES */ #ifndef FPCONTEXTSIZE From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 23:49:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1C8B6528B5; Tue, 3 Aug 2021 23:49:45 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfWnP5JqPz4Yqb; Tue, 3 Aug 2021 23:49:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FC691C8B7; Tue, 3 Aug 2021 23:49:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173NnjBk001047; Tue, 3 Aug 2021 23:49:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173NnjxM001046; Tue, 3 Aug 2021 23:49:45 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:49:45 GMT Message-Id: <202108032349.173NnjxM001046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 9ec7dbf46b0a - stable/13 - nfscl: Add a Linux compatible "nconnect" mount option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9ec7dbf46b0a025b06f5d94decea4889f2793c60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:49:45 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9ec7dbf46b0a025b06f5d94decea4889f2793c60 commit 9ec7dbf46b0a025b06f5d94decea4889f2793c60 Author: Rick Macklem AuthorDate: 2021-07-09 00:39:04 +0000 Commit: Rick Macklem CommitDate: 2021-08-03 23:40:47 +0000 nfscl: Add a Linux compatible "nconnect" mount option Linux has had an "nconnect" NFS mount option for some time. It specifies that N (up to 16) TCP connections are to created for a mount, instead of just one TCP connection. A discussion on freebsd-net@ indicated that this could improve client<-->server network bandwidth, if either the client or server have one of the following: - multiple network ports aggregated to-gether with lagg/lacp. - a fast NIC that is using multiple queues It does result in using more IP port#s and might increase server peak load for a client. One difference from the Linux implementation is that this implementation uses the first TCP connection for all RPCs composed of small messages and uses the additional TCP connections for RPCs that normally have large messages (Read/Readdir/Write). The Linux implementation spreads all RPCs across all TCP connections in a round robin fashion, whereas this implementation spreads Read/Readdir/Write across the additional TCP connections in a round robin fashion. (cherry picked from commit 1e0a518d65488caafff89a4ecba9cfb2be233379) --- sys/fs/nfs/nfs_commonkrpc.c | 70 ++++++++++++++++++++++++++++++++++------ sys/fs/nfs/nfs_commonsubs.c | 5 +-- sys/fs/nfs/nfs_var.h | 4 +-- sys/fs/nfsclient/nfs_clrpcops.c | 8 ++--- sys/fs/nfsclient/nfs_clvfsops.c | 66 ++++++++++++++++++++++++++++++------- sys/fs/nfsclient/nfsmount.h | 8 +++++ sys/fs/nfsserver/nfs_nfsdstate.c | 6 ++-- 7 files changed, 134 insertions(+), 33 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 63ff02331a0e..423ddb52494f 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -167,7 +167,8 @@ static int nfsv2_procid[NFS_V3NPROCS] = { */ int newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, - struct ucred *cred, NFSPROC_T *p, int callback_retry_mult, bool dotls) + struct ucred *cred, NFSPROC_T *p, int callback_retry_mult, bool dotls, + struct __rpc_client **clipp) { int rcvreserve, sndreserve; int pktscale, pktscalesav; @@ -420,15 +421,22 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, &timo); } + /* + * *clipp is &nrp->nr_client or &nm_aconn[nmp->nm_nextaconn]. + * The latter case is for additional connections specified by the + * "nconnect" mount option. nr_mtx etc is used for these additional + * connections, as well as nr_client in the nfssockreq + * structure for the mount. + */ mtx_lock(&nrp->nr_mtx); - if (nrp->nr_client != NULL) { + if (*clipp != NULL) { mtx_unlock(&nrp->nr_mtx); /* * Someone else already connected. */ CLNT_RELEASE(client); } else { - nrp->nr_client = client; + *clipp = client; /* * Protocols that do not require connections may be optionally * left unconnected for servers that reply from a port other @@ -453,18 +461,34 @@ out: * NFS disconnect. Clean up and unlink. */ void -newnfs_disconnect(struct nfssockreq *nrp) +newnfs_disconnect(struct nfsmount *nmp, struct nfssockreq *nrp) { - CLIENT *client; + CLIENT *client, *aconn[NFS_MAXNCONN - 1]; + int i; mtx_lock(&nrp->nr_mtx); if (nrp->nr_client != NULL) { client = nrp->nr_client; nrp->nr_client = NULL; + if (nmp != NULL && nmp->nm_aconnect > 0) { + for (i = 0; i < nmp->nm_aconnect; i++) { + aconn[i] = nmp->nm_aconn[i]; + nmp->nm_aconn[i] = NULL; + } + } mtx_unlock(&nrp->nr_mtx); rpc_gss_secpurge_call(client); CLNT_CLOSE(client); CLNT_RELEASE(client); + if (nmp != NULL && nmp->nm_aconnect > 0) { + for (i = 0; i < nmp->nm_aconnect; i++) { + if (aconn[i] != NULL) { + rpc_gss_secpurge_call(aconn[i]); + CLNT_CLOSE(aconn[i]); + CLNT_RELEASE(aconn[i]); + } + } + } } else { mtx_unlock(&nrp->nr_mtx); } @@ -565,7 +589,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, int error = 0, usegssname = 0, secflavour = AUTH_SYS; int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; - u_int trylater_delay = 1; + u_int nextconn, trylater_delay = 1; struct nfs_feedback_arg nf; struct timeval timo; AUTH *auth; @@ -577,6 +601,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct ucred *authcred; struct nfsclsession *sep; uint8_t sessionid[NFSX_V4SESSIONID]; + bool nextconn_set; sep = dssep; if (xidp != NULL) @@ -602,12 +627,24 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, } /* - * XXX if not already connected call nfs_connect now. Longer - * term, change nfs_mount to call nfs_connect unconditionally - * and let clnt_reconnect_create handle reconnects. + * If not already connected call newnfs_connect now. */ if (nrp->nr_client == NULL) - newnfs_connect(nmp, nrp, cred, td, 0, false); + newnfs_connect(nmp, nrp, cred, td, 0, false, &nrp->nr_client); + + nextconn_set = false; + if (nmp != NULL && nmp->nm_aconnect > 0 && + (nd->nd_procnum == NFSPROC_READ || + nd->nd_procnum == NFSPROC_READDIR || + nd->nd_procnum == NFSPROC_READDIRPLUS || + nd->nd_procnum == NFSPROC_WRITE)) { + nextconn = atomic_fetchadd_int(&nmp->nm_nextaconn, 1); + nextconn %= nmp->nm_aconnect; + nextconn_set = true; + if (nmp->nm_aconn[nextconn] == NULL) + newnfs_connect(nmp, nrp, cred, td, 0, false, + &nmp->nm_aconn[nextconn]); + } /* * For a client side mount, nmp is != NULL and clp == NULL. For @@ -830,6 +867,19 @@ tryagain: if (clp != NULL && sep != NULL) stat = clnt_bck_call(nrp->nr_client, &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo, sep->nfsess_xprt); + else if (nextconn_set) + /* + * When there are multiple TCP connections, send the + * RPCs with large messages on the alternate TCP + * connection(s) in a round robin fashion. + * The small RPC messages are sent on the default + * TCP connection because they do not require much + * network bandwidth and separating them from the + * large RPC messages avoids them getting "log jammed" + * behind several large RPC messages. + */ + stat = CLNT_CALL_MBUF(nmp->nm_aconn[nextconn], + &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo); else stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo); diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 02416da54f01..1bdc13123aac 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -3624,7 +3624,8 @@ nfsrv_nfsuserdport(struct nfsuserd_args *nargs, NFSPROC_T *p) } rp->nr_vers = RPCNFSUSERD_VERS; if (error == 0) - error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0, false); + error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0, false, + &rp->nr_client); if (error == 0) { NFSLOCKNAMEID(); nfsrv_nfsuserd = RUNNING; @@ -3658,7 +3659,7 @@ nfsrv_nfsuserddelport(void) msleep(&nfsrv_userdupcalls, NFSNAMEIDMUTEXPTR, PVFS, "nfsupcalls", 0); NFSUNLOCKNAMEID(); - newnfs_disconnect(&nfsrv_nfsuserdsock); + newnfs_disconnect(NULL, &nfsrv_nfsuserdsock); free(nfsrv_nfsuserdsock.nr_nam, M_SONAME); NFSLOCKNAMEID(); nfsrv_nfsuserd = NOTRUNNING; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 5c474d97ad04..9cbaeae361a6 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -772,8 +772,8 @@ int newnfs_request(struct nfsrv_descript *, struct nfsmount *, struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *, struct nfsclsession *); int newnfs_connect(struct nfsmount *, struct nfssockreq *, - struct ucred *, NFSPROC_T *, int, bool); -void newnfs_disconnect(struct nfssockreq *); + struct ucred *, NFSPROC_T *, int, bool, struct __rpc_client **); +void newnfs_disconnect(struct nfsmount *, struct nfssockreq *); int newnfs_sigintr(struct nfsmount *, NFSPROC_T *); /* nfs_nfsdkrpc.c */ diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 8979a4d08243..6093f7c0adeb 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -5610,7 +5610,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, * unmount, but I did it anyhow. */ nrp->nr_cred = crhold(nmp->nm_sockreq.nr_cred); - error = newnfs_connect(nmp, nrp, NULL, p, 0, false); + error = newnfs_connect(nmp, nrp, NULL, p, 0, false, &nrp->nr_client); NFSCL_DEBUG(3, "DS connect=%d\n", error); dsp = NULL; @@ -5628,7 +5628,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, } while (error == NFSERR_MINORVERMISMATCH && firsttry++ == 0); if (error != 0) - newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); } else { dsp = malloc(sizeof(struct nfsclds), M_NFSCLDS, M_WAITOK | M_ZERO); @@ -5656,7 +5656,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, * If there is already a session for this * server, use it. */ - (void)newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); nfscl_freenfsclds(dsp); *dspp = tdsp; return (0); @@ -5688,7 +5688,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, NFSUNLOCKMNT(nmp); *dspp = dsp; } else if (dsp != NULL) { - newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); nfscl_freenfsclds(dsp); } return (error); diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 2fe30035b904..d6ec1f9a3825 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -119,7 +119,7 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, int, u_char *, int, u_char *, int, struct vnode **, struct ucred *, - struct thread *, int, int, int, uint32_t, char *); + struct thread *, int, int, int, uint32_t, char *, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -546,7 +546,7 @@ nfs_mountdiskless(char *path, nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen, NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NAMETIMEO, - NFS_DEFAULT_NEGNAMETIMEO, 0, 0, NULL)) != 0) { + NFS_DEFAULT_NEGNAMETIMEO, 0, 0, NULL, 0)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -713,14 +713,14 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, haslock = 1; } if (!error) { - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(nmp, &nmp->nm_sockreq); if (haslock) newnfs_sndunlock(&nmp->nm_sockreq.nr_lock); nmp->nm_sotype = argp->sotype; nmp->nm_soproto = argp->proto; if (nmp->nm_sotype == SOCK_DGRAM) while (newnfs_connect(nmp, &nmp->nm_sockreq, - cred, td, 0, false)) { + cred, td, 0, false, &nmp->nm_sockreq.nr_client)) { printf("newnfs_args: retrying connect\n"); (void) nfs_catnap(PSOCK, 0, "nfscon"); } @@ -748,7 +748,7 @@ static const char *nfs_opts[] = { "from", "nfs_args", "resvport", "readahead", "hostname", "timeo", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", "minorversion", "nametimeo", "negnametimeo", "nocto", "noncontigwr", - "pnfs", "wcommitsize", "oneopenown", "tls", "tlscertname", + "pnfs", "wcommitsize", "oneopenown", "tls", "tlscertname", "nconnect", NULL }; /* @@ -900,6 +900,7 @@ nfs_mount(struct mount *mp) krbnamelen, srvkrbnamelen; size_t hstlen; uint32_t newflag; + int aconn = 0; has_nfs_args_opt = 0; has_nfs_from_opt = 0; @@ -1190,6 +1191,20 @@ nfs_mount(struct mount *mp) goto out; } } + if (vfs_getopt(mp->mnt_optnew, "nconnect", (void **)&opt, NULL) == + 0) { + ret = sscanf(opt, "%d", &aconn); + if (ret != 1 || aconn < 1 || aconn > NFS_MAXNCONN) { + vfs_mount_error(mp, "illegal nconnect: %s", opt); + error = EINVAL; + goto out; + } + /* + * Setting nconnect=1 is a no-op, allowed so that + * the option can be used in a Linux compatible way. + */ + aconn--; + } if (vfs_getopt(mp->mnt_optnew, "sec", (void **) &secname, NULL) == 0) nfs_sec_name(secname, &args.flags); @@ -1357,10 +1372,25 @@ nfs_mount(struct mount *mp) } } + if (aconn > 0 && (args.sotype != SOCK_STREAM || + (args.flags & NFSMNT_NFSV4) == 0 || minvers == 0)) { + /* + * RFC 5661 requires that an NFSv4.1/4.2 server + * send an RPC reply on the same TCP connection + * as the one it received the request on. + * This property in required for "nconnect" and + * might not be the case for NFSv3 or NFSv4.0 servers. + */ + vfs_mount_error(mp, "nconnect should only be used " + "for NFSv4.1/4.2 mounts"); + error = EINVAL; + goto out; + } + args.fh = nfh; error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath, dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td, - nametimeo, negnametimeo, minvers, newflag, tlscertname); + nametimeo, negnametimeo, minvers, newflag, tlscertname, aconn); out: if (!error) { MNT_ILOCK(mp); @@ -1408,7 +1438,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen, u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp, struct ucred *cred, struct thread *td, int nametimeo, int negnametimeo, - int minvers, uint32_t newflag, char *tlscertname) + int minvers, uint32_t newflag, char *tlscertname, int aconn) { struct nfsmount *nmp; struct nfsnode *np; @@ -1575,7 +1605,8 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, else nmp->nm_sockreq.nr_vers = NFS_VER2; - if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0, false))) + if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0, false, + &nmp->nm_sockreq.nr_client))) goto bad; /* For NFSv4, get the clientid now. */ if ((argp->flags & NFSMNT_NFSV4) != 0) { @@ -1584,6 +1615,12 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, NFSCL_DEBUG(3, "aft getcl=%d\n", error); if (error != 0) goto bad; + if (aconn > 0 && nmp->nm_minorvers == 0) { + vfs_mount_error(mp, "nconnect should only be used " + "for NFSv4.1/4.2 mounts"); + error = EINVAL; + goto bad; + } } if (nmp->nm_fhsize == 0 && (nmp->nm_flag & NFSMNT_NFSV4) && @@ -1678,6 +1715,10 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, MNT_IUNLOCK(mp); } + /* Can now allow additional connections. */ + if (aconn > 0) + nmp->nm_aconnect = aconn; + /* * Lose the lock but keep the ref. */ @@ -1690,7 +1731,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, bad: if (clp != NULL) nfscl_clientrelease(clp); - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(NULL, &nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); if (nmp->nm_sockreq.nr_auth != NULL) AUTH_DESTROY(nmp->nm_sockreq.nr_auth); @@ -1705,7 +1746,7 @@ bad: TAILQ_FOREACH_SAFE(dsp, &nmp->nm_sess, nfsclds_list, tdsp) { if (dsp != TAILQ_FIRST(&nmp->nm_sess) && dsp->nfsclds_sockp != NULL) - newnfs_disconnect(dsp->nfsclds_sockp); + newnfs_disconnect(NULL, dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } free(nmp->nm_tlscertname, M_NEWNFSMNT); @@ -1791,7 +1832,7 @@ nfs_unmount(struct mount *mp, int mntflags) msleep(nmp, &nmp->nm_mtx, PVFS, "nfsfdism", 0); mtx_unlock(&nmp->nm_mtx); - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(nmp, &nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); free(nmp->nm_nam, M_SONAME); if (nmp->nm_sockreq.nr_auth != NULL) @@ -1801,7 +1842,7 @@ nfs_unmount(struct mount *mp, int mntflags) TAILQ_FOREACH_SAFE(dsp, &nmp->nm_sess, nfsclds_list, tdsp) { if (dsp != TAILQ_FIRST(&nmp->nm_sess) && dsp->nfsclds_sockp != NULL) - newnfs_disconnect(dsp->nfsclds_sockp); + newnfs_disconnect(NULL, dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } free(nmp->nm_tlscertname, M_NEWNFSMNT); @@ -2065,6 +2106,7 @@ void nfscl_retopts(struct nfsmount *nmp, char *buffer, size_t buflen) &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCONN) != 0, ",noconn", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_aconnect + 1, ",nconnect", &buf, &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) == 0, ",hard", &buf, &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) != 0, ",soft", &buf, diff --git a/sys/fs/nfsclient/nfsmount.h b/sys/fs/nfsclient/nfsmount.h index f8ea8c9a1418..a5997e474be9 100644 --- a/sys/fs/nfsclient/nfsmount.h +++ b/sys/fs/nfsclient/nfsmount.h @@ -39,6 +39,9 @@ #include +/* Maximum value for nm_nconnect. */ +#define NFS_MAXNCONN 16 + /* * Mount structure. * One allocated on every NFS mount. @@ -81,6 +84,11 @@ struct nfsmount { u_int64_t nm_clval; /* identifies which clientid */ u_int64_t nm_fsid[2]; /* NFSv4 fsid */ int nm_minorvers; /* Minor version # for NFSv4 */ + u_int nm_aconnect; /* additional TCP connections */ + u_int nm_nextaconn; /* Next nm_aconn[] to use */ + /* unclipped, wraps to 0 */ + struct __rpc_client *nm_aconn[NFS_MAXNCONN - 1]; /* Additional nconn */ + /* Locked via nm_sockreq.nr_mtx */ u_int16_t nm_krbnamelen; /* Krb5 host principal, if any */ u_int16_t nm_dirpathlen; /* and mount dirpath, for V4 */ u_int16_t nm_srvkrbnamelen; /* and the server's target name */ diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 98f5e26d49bb..01280c8e49c6 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -1368,7 +1368,7 @@ nfsrv_zapclient(struct nfsclient *clp, NFSPROC_T *p) NULL, 0, NULL, NULL, NULL, 0, p); } #endif - newnfs_disconnect(&clp->lc_req); + newnfs_disconnect(NULL, &clp->lc_req); free(clp->lc_req.nr_nam, M_SONAME); NFSFREEMUTEX(&clp->lc_req.nr_mtx); free(clp->lc_stateid, M_NFSDCLIENT); @@ -4577,10 +4577,10 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, nfsrv_freesession(sep, NULL); } else if (nd->nd_procnum == NFSV4PROC_CBNULL) error = newnfs_connect(NULL, &clp->lc_req, cred, - NULL, 1, dotls); + NULL, 1, dotls, &clp->lc_req.nr_client); else error = newnfs_connect(NULL, &clp->lc_req, cred, - NULL, 3, dotls); + NULL, 3, dotls, &clp->lc_req.nr_client); } newnfs_sndunlock(&clp->lc_req.nr_lock); NFSD_DEBUG(4, "aft sndunlock=%d\n", error); From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 23:50:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33187652FA6; Tue, 3 Aug 2021 23:50:25 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfWp90vBQz4Z5C; Tue, 3 Aug 2021 23:50:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 085EB1C2CD; Tue, 3 Aug 2021 23:50:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173NoOmk009446; Tue, 3 Aug 2021 23:50:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173NoOxe009445; Tue, 3 Aug 2021 23:50:24 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:50:24 GMT Message-Id: <202108032350.173NoOxe009445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: d2c0584257a3 - stable/13 - loader.conf(5): mention "efi" option for "console" parameter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2c0584257a344622b8b7e1581080b7a7933d818 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:50:25 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c0584257a344622b8b7e1581080b7a7933d818 commit d2c0584257a344622b8b7e1581080b7a7933d818 Author: Li-Wen Hsu AuthorDate: 2021-07-31 22:41:49 +0000 Commit: Li-Wen Hsu CommitDate: 2021-08-03 23:50:14 +0000 loader.conf(5): mention "efi" option for "console" parameter PR: 213467 Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31368 (cherry picked from commit de0c7fbe280a1e0946afb111cf7a9811364c4bd6) --- stand/defaults/loader.conf.5 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index b4109371a1cf..23a65935c95a 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd July 10, 2021 +.Dd July 31, 2021 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -270,6 +270,8 @@ serial port speed setting. selects serial console, .Dq vidconsole selects the video console, +.Dq efi +selects the EFI console, .Dq nullconsole selects a mute console (useful for systems with neither a video console nor a serial port), and From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 23:51:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89005652553; Tue, 3 Aug 2021 23:51:05 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfWpx3T1kz4Z3d; Tue, 3 Aug 2021 23:51:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60BA71C9A2; Tue, 3 Aug 2021 23:51:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173Np5vv011284; Tue, 3 Aug 2021 23:51:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173Np5mh011283; Tue, 3 Aug 2021 23:51:05 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:51:05 GMT Message-Id: <202108032351.173Np5mh011283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: b0ef42f3669d - stable/12 - loader.conf(5): mention "efi" option for "console" parameter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b0ef42f3669d0d909ffd6edf00b8b98abb12dd92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:51:05 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=b0ef42f3669d0d909ffd6edf00b8b98abb12dd92 commit b0ef42f3669d0d909ffd6edf00b8b98abb12dd92 Author: Li-Wen Hsu AuthorDate: 2021-07-31 22:41:49 +0000 Commit: Li-Wen Hsu CommitDate: 2021-08-03 23:50:45 +0000 loader.conf(5): mention "efi" option for "console" parameter PR: 213467 Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31368 (cherry picked from commit de0c7fbe280a1e0946afb111cf7a9811364c4bd6) --- stand/defaults/loader.conf.5 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 3bd83dcc5c30..730770e44cd4 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd December 31, 2020 +.Dd July 31, 2021 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -230,6 +230,8 @@ serial port speed setting. selects serial console, .Dq vidconsole selects the video console, +.Dq efi +selects the EFI console, .Dq nullconsole selects a mute console (useful for systems with neither a video console nor a serial port), and From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 23:52:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93134652FDA; Tue, 3 Aug 2021 23:52:06 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfWr63ljFz4ZW0; Tue, 3 Aug 2021 23:52:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69B331C6F5; Tue, 3 Aug 2021 23:52:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173Nq6bG013866; Tue, 3 Aug 2021 23:52:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173Nq6SX013865; Tue, 3 Aug 2021 23:52:06 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:52:06 GMT Message-Id: <202108032352.173Nq6SX013865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 46b4c26b5b01 - stable/13 - mount_nfs.8: Add information for "nconnect" to man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 46b4c26b5b01e48894d5d0979a4bfc6bc8725a4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:52:06 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=46b4c26b5b01e48894d5d0979a4bfc6bc8725a4a commit 46b4c26b5b01e48894d5d0979a4bfc6bc8725a4a Author: Rick Macklem AuthorDate: 2021-07-11 20:34:16 +0000 Commit: Rick Macklem CommitDate: 2021-08-03 23:49:28 +0000 mount_nfs.8: Add information for "nconnect" to man page Commit 1e0a518d6548 added a new NFS mount option "nconnect". This patch adds information on this option to the man page. It also adds an IMPLEMENTATION section that explains how the default I/O size is determined and that "nfsstat -m" can be used to find out what option settings are actually in use. This is a content change. (cherry picked from commit 4488c8c34ba38146aab52fd60211bb32cdc87267) --- sbin/mount_nfs/mount_nfs.8 | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index 36a3c180b1e3..648cb2128e90 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd June 26, 2021 +.Dd July 10, 2021 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -196,6 +196,25 @@ If this is set to 0 it disables positive name caching for the mount point. Override the default of NFS_DEFAULT_NEGNAMETIMEO for the timeout (in seconds) for negative name cache entries. If this is set to 0 it disables negative name caching for the mount point. +.It Cm nconnect Ns = Ns Aq Ar value +Specify the number of TCP connections (1-16) to be used +for an NFS Version 4, minor version 1 or 2 mount. +Multiple TCP connections can provide more client to server network +bandwidth for certain network configurations such as: +.Bd -literal +- Multiple network interfaces that are aggregated together. +- A fast network interface that uses multiple queues. +.Ed +.sp +The first TCP connection will be used for all RPCs that consist +entirely of small RPC messages. +The RPCs that can have large RPC messages (Read/Readdir/Write) are +distributed over the additional TCP connections in a round robin +fashion. +This option will result in more IP port#s being used. +This option requires the +.Cm nfsv4 +option. .It Cm nfsv2 Use the NFS Version 2 protocol (the default is to try version 3 first then version 2). @@ -586,9 +605,31 @@ Same as Same as .Fl o Cm nfsv4 .El +.Sh IMPLEMENTATION NOTES +When neither the +.Cm rsize +nor +.Cm wsize +options are specified, the I/O size will be set to the largest value +supported by both the NFS client and server. +The largest value supported by the NFS client is defined by +the tunable +.Cd vfs.maxbcachebuf +which can be set to a power of two up to +.Cd kern.maxphys . +.Pp +The +.Xr nfsstat 1 +command with the +.Ic -m +command line option will show what +.Nm +option settings are actually in use for the mount. .Sh SEE ALSO +.Xr nfsstat 1 , .Xr nmount 2 , .Xr unmount 2 , +.Xr lagg 4 , .Xr nfsv4 4 , .Xr fstab 5 , .Xr gssd 8 , From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 23:54:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6FD6653388; Tue, 3 Aug 2021 23:54:10 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfWtV69JVz4Zss; Tue, 3 Aug 2021 23:54:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB8341C6FC; Tue, 3 Aug 2021 23:54:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 173NsAaq014111; Tue, 3 Aug 2021 23:54:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 173NsABE014110; Tue, 3 Aug 2021 23:54:10 GMT (envelope-from git) Date: Tue, 3 Aug 2021 23:54:10 GMT Message-Id: <202108032354.173NsABE014110@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 9fb6e613373c - stable/13 - nfsd: Add sysctl to set maximum I/O size up to 1Mbyte MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9fb6e613373cf90bb25e7cf5b40a0a7f82c941f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 23:54:11 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9fb6e613373cf90bb25e7cf5b40a0a7f82c941f6 commit 9fb6e613373cf90bb25e7cf5b40a0a7f82c941f6 Author: Rick Macklem AuthorDate: 2021-07-16 22:01:03 +0000 Commit: Rick Macklem CommitDate: 2021-08-03 23:50:33 +0000 nfsd: Add sysctl to set maximum I/O size up to 1Mbyte Since MAXPHYS now allows the FreeBSD NFS client to do 1Mbyte I/O operations, add a sysctl called vfs.nfsd.srvmaxio so that the maximum NFS server I/O size can be set up to 1Mbyte. The Linux NFS client can also do 1Mbyte I/O operations. The default of 128Kbytes for the maximum I/O size has not been changed for two reasons: - kern.ipc.maxsockbuf must be increased to support 1Mbyte I/O - The limited benchmarking I can do actually shows a drop in I/O rate when the I/O size is above 256Kbytes. However, daveb@spectralogic.com reports seeing an increase in I/O rate for the 1Mbyte I/O size vs 128Kbytes using a Linux client. (cherry picked from commit ee29e6f31111ea3cd490248987f2f2ec412eb0bb) --- sys/fs/nfs/nfs.h | 2 +- sys/fs/nfs/nfs_commonport.c | 7 ++-- sys/fs/nfs/nfs_commonsubs.c | 5 ++- sys/fs/nfs/nfsproto.h | 1 - sys/fs/nfsserver/nfs_nfsdport.c | 81 ++++++++++++++++++++++++++++++++++++++++ sys/fs/nfsserver/nfs_nfsdserv.c | 12 ++++-- sys/fs/nfsserver/nfs_nfsdstate.c | 11 +++--- 7 files changed, 104 insertions(+), 15 deletions(-) diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index 272b8dbfee22..1a29a7e1d6ec 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -156,7 +156,7 @@ (t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0) #define NFS_SRVMAXDATA(n) \ (((n)->nd_flag & (ND_NFSV3 | ND_NFSV4)) ? \ - NFS_SRVMAXIO : NFS_V2MAXDATA) + nfs_srvmaxio : NFS_V2MAXDATA) #define NFS64BITSSET 0xffffffffffffffffull #define NFS64BITSMINUS1 0xfffffffffffffffeull diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c index 47038980c640..8a100749fc32 100644 --- a/sys/fs/nfs/nfs_commonport.c +++ b/sys/fs/nfs/nfs_commonport.c @@ -76,6 +76,7 @@ void (*nfsd_call_servertimer)(void) = NULL; void (*ncl_call_invalcaches)(struct vnode *) = NULL; vop_advlock_t *nfs_advlock_p = NULL; vop_reclaim_t *nfs_reclaim_p = NULL; +uint32_t nfs_srvmaxio = NFS_SRVMAXIO; int nfs_pnfsio(task_fn_t *, void *); @@ -303,11 +304,11 @@ nfsvno_getfs(struct nfsfsinfo *sip, int isdgram) if (isdgram) pref = NFS_MAXDGRAMDATA; else - pref = NFS_SRVMAXIO; - sip->fs_rtmax = NFS_SRVMAXIO; + pref = nfs_srvmaxio; + sip->fs_rtmax = nfs_srvmaxio; sip->fs_rtpref = pref; sip->fs_rtmult = NFS_FABLKSIZE; - sip->fs_wtmax = NFS_SRVMAXIO; + sip->fs_wtmax = nfs_srvmaxio; sip->fs_wtpref = pref; sip->fs_wtmult = NFS_FABLKSIZE; sip->fs_dtpref = pref; diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 1bdc13123aac..817d89284091 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -85,6 +85,7 @@ extern volatile int nfsrv_devidcnt; extern int nfscl_debuglevel; extern struct nfsdevicehead nfsrv_devidhead; extern struct nfsstatsv1 nfsstatsv1; +extern uint32_t nfs_srvmaxio; SYSCTL_DECL(_vfs_nfs); SYSCTL_INT(_vfs_nfs, OID_AUTO, enable_uidtostring, CTLFLAG_RW, @@ -2201,7 +2202,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); attrsum += NFSX_UNSIGNED; i = fxdr_unsigned(int, *tl); - if (compare && !(*retcmpp) && i != NFS_SRVMAXIO) + if (compare && !(*retcmpp) && i != nfs_srvmaxio) *retcmpp = NFSERR_NOTSAME; break; default: @@ -3012,7 +3013,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, case NFSATTRBIT_LAYOUTALIGNMENT: case NFSATTRBIT_LAYOUTBLKSIZE: NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); - *tl = txdr_unsigned(NFS_SRVMAXIO); + *tl = txdr_unsigned(nfs_srvmaxio); retnum += NFSX_UNSIGNED; break; case NFSATTRBIT_XATTRSUPPORT: diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index 62d86c3a4593..13e146154805 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -73,7 +73,6 @@ */ #define NFS_MAXPKTHDR 404 #define NFS_MAXXDR 4096 -#define NFS_MAXPACKET (NFS_SRVMAXIO + NFS_MAXXDR) #define NFS_MINPACKET 20 #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #define NFSV4_MINORVERSION 0 /* V4 Minor version */ diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 7bcbc738d61b..efe9aac7a136 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -76,6 +76,9 @@ extern struct nfsdontlisthead nfsrv_dontlisthead; extern volatile int nfsrv_dontlistlen; extern volatile int nfsrv_devidcnt; extern int nfsrv_maxpnfsmirror; +extern uint32_t nfs_srvmaxio; +extern int nfs_bufpackets; +extern u_long sb_max_adj; struct vfsoptlist nfsv4root_opt, nfsv4root_newopt; NFSDLOCKMUTEX; NFSSTATESPINLOCK; @@ -195,6 +198,84 @@ SYSCTL_PROC(_vfs_nfsd, OID_AUTO, dsdirsize, CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(nfsrv_dsdirsize), sysctl_dsdirsize, "IU", "Number of dsN subdirs on the DS servers"); +/* + * nfs_srvmaxio can only be increased and only when the nfsd threads are + * not running. The setting must be a power of 2, with the current limit of + * 1Mbyte. + */ +static int +sysctl_srvmaxio(SYSCTL_HANDLER_ARGS) +{ + int error; + u_int newsrvmaxio; + uint64_t tval; + + newsrvmaxio = nfs_srvmaxio; + error = sysctl_handle_int(oidp, &newsrvmaxio, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (newsrvmaxio == nfs_srvmaxio) + return (0); + if (newsrvmaxio < nfs_srvmaxio) { + printf("nfsd: vfs.nfsd.srvmaxio can only be increased\n"); + return (EINVAL); + } + if (newsrvmaxio > 1048576) { + printf("nfsd: vfs.nfsd.srvmaxio cannot be > 1Mbyte\n"); + return (EINVAL); + } + if ((newsrvmaxio & (newsrvmaxio - 1)) != 0) { + printf("nfsd: vfs.nfsd.srvmaxio must be a power of 2\n"); + return (EINVAL); + } + + /* + * Check that kern.ipc.maxsockbuf is large enough for + * newsrviomax, given the setting of vfs.nfs.bufpackets. + */ + if ((newsrvmaxio + NFS_MAXXDR) * nfs_bufpackets > + sb_max_adj) { + /* + * Suggest vfs.nfs.bufpackets * maximum RPC message for + * sb_max_adj. + */ + tval = (newsrvmaxio + NFS_MAXXDR) * nfs_bufpackets; + + /* + * Convert suggested sb_max_adj value to a suggested + * sb_max value, which is what is set via kern.ipc.maxsockbuf. + * Perform the inverse calculation of (from uipc_sockbuf.c): + * sb_max_adj = (u_quad_t)sb_max * MCLBYTES / + * (MSIZE + MCLBYTES); + * XXX If the calculation of sb_max_adj from sb_max changes, + * this calculation must be changed as well. + */ + tval *= (MSIZE + MCLBYTES); /* Brackets for readability. */ + tval += MCLBYTES - 1; /* Round up divide. */ + tval /= MCLBYTES; + printf("nfsd: set kern.ipc.maxsockbuf to a minimum of " + "%ju to support %ubyte NFS I/O\n", (uintmax_t)tval, + newsrvmaxio); + return (EINVAL); + } + + NFSD_LOCK(); + if (newnfs_numnfsd != 0) { + NFSD_UNLOCK(); + printf("nfsd: cannot set vfs.nfsd.srvmaxio when nfsd " + "threads are running\n"); + return (EINVAL); + } + + + nfs_srvmaxio = newsrvmaxio; + NFSD_UNLOCK(); + return (0); +} +SYSCTL_PROC(_vfs_nfsd, OID_AUTO, srvmaxio, + CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, + sysctl_srvmaxio, "IU", "Maximum I/O size in bytes"); + #define MAX_REORDERED_RPC 16 #define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index e564a6a48b79..0ba3472b4ff9 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -66,6 +66,7 @@ extern u_long sb_max_adj; extern int nfsrv_pnfsatime; extern int nfsrv_maxpnfsmirror; extern int nfs_maxcopyrange; +extern uint32_t nfs_srvmaxio; static int nfs_async = 0; SYSCTL_DECL(_vfs_nfsd); @@ -1023,7 +1024,7 @@ nfsrvd_write(struct nfsrv_descript *nd, __unused int isdgram, lop->lo_end = NFS64BITSSET; } - if (retlen > NFS_SRVMAXIO || retlen < 0) + if (retlen > nfs_srvmaxio || retlen < 0) nd->nd_repstat = EIO; if (vnode_vtype(vp) != VREG && !nd->nd_repstat) { if (nd->nd_flag & ND_NFSV3) @@ -4417,6 +4418,7 @@ nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, struct nfsdsession *sep = NULL; uint32_t rdmacnt; struct thread *p = curthread; + static bool do_printf = true; if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; @@ -4438,12 +4440,16 @@ nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, sep->sess_maxreq = fxdr_unsigned(uint32_t, *tl++); if (sep->sess_maxreq > sb_max_adj - NFS_MAXXDR) { sep->sess_maxreq = sb_max_adj - NFS_MAXXDR; - printf("Consider increasing kern.ipc.maxsockbuf\n"); + if (do_printf) + printf("Consider increasing kern.ipc.maxsockbuf\n"); + do_printf = false; } sep->sess_maxresp = fxdr_unsigned(uint32_t, *tl++); if (sep->sess_maxresp > sb_max_adj - NFS_MAXXDR) { sep->sess_maxresp = sb_max_adj - NFS_MAXXDR; - printf("Consider increasing kern.ipc.maxsockbuf\n"); + if (do_printf) + printf("Consider increasing kern.ipc.maxsockbuf\n"); + do_printf = false; } sep->sess_maxrespcached = fxdr_unsigned(uint32_t, *tl++); sep->sess_maxops = fxdr_unsigned(uint32_t, *tl++); diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 01280c8e49c6..750eda2027ec 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -42,6 +42,7 @@ struct nfsv4lock nfsv4rootfs_lock; time_t nfsdev_time = 0; int nfsrv_layouthashsize; volatile int nfsrv_layoutcnt = 0; +extern uint32_t nfs_srvmaxio; extern int newnfs_numnfsd; extern struct nfsstatsv1 nfsstatsv1; @@ -6898,7 +6899,7 @@ nfsrv_filelayout(struct nfsrv_descript *nd, int iomode, fhandle_t *fhp, tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); /* Set the stripe size to the maximum I/O size. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO & NFSFLAYUTIL_STRIPE_MASK); + *tl++ = txdr_unsigned(nfs_srvmaxio & NFSFLAYUTIL_STRIPE_MASK); *tl++ = 0; /* 1st stripe index. */ pattern_offset = 0; txdr_hyper(pattern_offset, tl); tl += 2; /* Pattern offset. */ @@ -7964,13 +7965,13 @@ nfsrv_allocdevid(struct nfsdevice *ds, char *addr, char *dnshost) *tl++ = txdr_unsigned(2); /* Two NFS Versions. */ *tl++ = txdr_unsigned(NFS_VER4); /* NFSv4. */ *tl++ = txdr_unsigned(NFSV42_MINORVERSION); /* Minor version 2. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max rsize. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max wsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max rsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max wsize. */ *tl++ = newnfs_true; /* Tightly coupled. */ *tl++ = txdr_unsigned(NFS_VER4); /* NFSv4. */ *tl++ = txdr_unsigned(NFSV41_MINORVERSION); /* Minor version 1. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max rsize. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max wsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max rsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max wsize. */ *tl = newnfs_true; /* Tightly coupled. */ ds->nfsdev_hostnamelen = strlen(dnshost); From owner-dev-commits-src-branches@freebsd.org Wed Aug 4 00:09:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92E566533BA; Wed, 4 Aug 2021 00:09:54 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfXDf3k5Wz4bvB; Wed, 4 Aug 2021 00:09:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67BA11CB2E; Wed, 4 Aug 2021 00:09:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17409sAd028352; Wed, 4 Aug 2021 00:09:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17409sCt028351; Wed, 4 Aug 2021 00:09:54 GMT (envelope-from git) Date: Wed, 4 Aug 2021 00:09:54 GMT Message-Id: <202108040009.17409sCt028351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 53d162819c20 - stable/13 - param.h: Bump __FreeBSD_version to 1300514 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 53d162819c20e5cf267cb91f7a19940e96e8bec4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 00:09:54 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=53d162819c20e5cf267cb91f7a19940e96e8bec4 commit 53d162819c20e5cf267cb91f7a19940e96e8bec4 Author: Rick Macklem AuthorDate: 2021-08-04 00:06:59 +0000 Commit: Rick Macklem CommitDate: 2021-08-04 00:06:59 +0000 param.h: Bump __FreeBSD_version to 1300514 Commits 9fb6e613373c and 9ec7dbf46b0a both changed the internal KAPI between the NFS modules. Bump __FreeBSD_version to 1300514 so that all modules are rebuilt from sources. This is a direct commit. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 497847dc1e6a..ef5eb4206706 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300513 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300514 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-branches@freebsd.org Wed Aug 4 00:15:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8537C653830; Wed, 4 Aug 2021 00:15:18 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfXLt3FZNz4c70; Wed, 4 Aug 2021 00:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 587C71CF81; Wed, 4 Aug 2021 00:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1740FIpg041724; Wed, 4 Aug 2021 00:15:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1740FIEI041723; Wed, 4 Aug 2021 00:15:18 GMT (envelope-from git) Date: Wed, 4 Aug 2021 00:15:18 GMT Message-Id: <202108040015.1740FIEI041723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 123fc95d47f2 - stable/13 - UPDATING: Add an entry for commits 9fb6e613373c and 9ec7dbf46b0a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 123fc95d47f2e1aa542c4a9960744ac964572540 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 00:15:18 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=123fc95d47f2e1aa542c4a9960744ac964572540 commit 123fc95d47f2e1aa542c4a9960744ac964572540 Author: Rick Macklem AuthorDate: 2021-08-04 00:12:22 +0000 Commit: Rick Macklem CommitDate: 2021-08-04 00:12:22 +0000 UPDATING: Add an entry for commits 9fb6e613373c and 9ec7dbf46b0a This is a direct commit. --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index b780eeb7b887..503ce0962398 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,11 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20210803: + Commits 9fb6e613373c and 9ec7dbf46b0a both changed the internal + KAPI between the NFS modules. Bump __FreeBSD_version to 1300514. + All NFS modules must be rebuilt from sources. + 20210718: Bump __FreeBSD_version to 1300512 after merging LinuxKPI, OFED, net80211, and driver changes in order to support building From owner-dev-commits-src-branches@freebsd.org Wed Aug 4 00:27:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABAF9653C49; Wed, 4 Aug 2021 00:27:11 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfXcb46LGz4cKm; Wed, 4 Aug 2021 00:27:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 717E71D140; Wed, 4 Aug 2021 00:27:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1740RBfu055020; Wed, 4 Aug 2021 00:27:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1740RB99055019; Wed, 4 Aug 2021 00:27:11 GMT (envelope-from git) Date: Wed, 4 Aug 2021 00:27:11 GMT Message-Id: <202108040027.1740RB99055019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 311759c5363d - stable/13 - RELNOTES: Add entries for commits 9fb6e613373c and 9ec7dbf46b0a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 311759c5363dbb8ee649722bf33bdba7158bbef0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 00:27:11 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=311759c5363dbb8ee649722bf33bdba7158bbef0 commit 311759c5363dbb8ee649722bf33bdba7158bbef0 Author: Rick Macklem AuthorDate: 2021-08-04 00:24:23 +0000 Commit: Rick Macklem CommitDate: 2021-08-04 00:24:23 +0000 RELNOTES: Add entries for commits 9fb6e613373c and 9ec7dbf46b0a This is a direct commit. --- RELNOTES | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/RELNOTES b/RELNOTES index 376615308ada..100e005d253a 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,29 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +9fb6e613373c: + Add a sysctl called vfs.nfsd.srvmaxio that can be used to + increase the NFS server's maximum I/O size from 128Kbytes + to any power of 2 up to 1Mbyte. It can only be set when + the nfsd threads are not running and will normally require + an increase in kern.ipc.maxsockbuf to at least the value + recommended by the console log message generated when + setting vfs.nfsd.srvmaxio is first attempted. + +9ec7dbf46b0a: + Add a new NFSv4.1/4.2 mount option "nconnect" that can + be used to specify the number of TCP connections that + will be used for the mount, up to a maximum of 16. + The first (default) TCP connection will be used for + all RPCs that consist of small RPC messages. + The RPCs that can consist of large RPC messages + (Read/Readdir/ReaddirPlus/Write) will be sent on the + additional TCP connections in a round robin fashion. + If either the NFS client or NFS server have multiple + network interfaces aggregated together or a network + interface that uses multiple queues, this can increase + NFS performance for the mount. + various: One True Awk has been updated to the latest from upstream (20210215). All the FreeBSD patches, but one, have now been From owner-dev-commits-src-branches@freebsd.org Wed Aug 4 02:13:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 315F7655597; Wed, 4 Aug 2021 02:13:42 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfZzV0tJHz4jXl; Wed, 4 Aug 2021 02:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 060EB1E8CA; Wed, 4 Aug 2021 02:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1742Df8E000876; Wed, 4 Aug 2021 02:13:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1742DfBo000875; Wed, 4 Aug 2021 02:13:41 GMT (envelope-from git) Date: Wed, 4 Aug 2021 02:13:41 GMT Message-Id: <202108040213.1742DfBo000875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: efc3ebeb6938 - stable/13 - Revert "arm: remove fslsdma from GENERIC" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: efc3ebeb69383a9b54f2670d8f705fd2410904b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 02:13:42 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=efc3ebeb69383a9b54f2670d8f705fd2410904b4 commit efc3ebeb69383a9b54f2670d8f705fd2410904b4 Author: Warner Losh AuthorDate: 2021-08-04 02:09:18 +0000 Commit: Warner Losh CommitDate: 2021-08-04 02:12:22 +0000 Revert "arm: remove fslsdma from GENERIC" The firmware was already in the tree when I did this commit, and I missed the message. The bug was obsolete. This reverts commit 9e3761d126c5c019d6c935e83989928eb1a0e76e. The commit was f219c053852d82acb9852cd735c815ba315f416d in stable/13. PR: 237466 Sponsored by: Netflix (cherry picked from commit e94f1a0a37fdd3252201aaa5a94f46da7f8e740e) --- sys/arm/conf/GENERIC | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index bc191d86dd59..165f707106f4 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -258,6 +258,7 @@ device ti_pruss device ti_mbox # DMA controller +device fslsdma device ti_sdma device a10_dmac device a31_dmac From owner-dev-commits-src-branches@freebsd.org Wed Aug 4 08:15:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E432659CD9; Wed, 4 Aug 2021 08:15:56 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gfl1R5Wthz3J6q; Wed, 4 Aug 2021 08:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5D48235C8; Wed, 4 Aug 2021 08:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1748FtUb083617; Wed, 4 Aug 2021 08:15:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1748Ftg3083616; Wed, 4 Aug 2021 08:15:55 GMT (envelope-from git) Date: Wed, 4 Aug 2021 08:15:55 GMT Message-Id: <202108040815.1748Ftg3083616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tom Jones Subject: git: 64a0116cd008 - stable/13 - Correct section reference for examples in RFC3542 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 64a0116cd0086bb5ee08a8a1ddd8267ce81b6826 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 08:15:56 -0000 The branch stable/13 has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=64a0116cd0086bb5ee08a8a1ddd8267ce81b6826 commit 64a0116cd0086bb5ee08a8a1ddd8267ce81b6826 Author: Tom Jones AuthorDate: 2021-08-01 12:52:07 +0000 Commit: Tom Jones CommitDate: 2021-08-04 08:15:27 +0000 Correct section reference for examples in RFC3542 Reviewed by: bz, network MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26272 (cherry picked from commit 44752e92e134167e9a0ecd277e32608a5595e6d1) --- lib/libc/net/inet6_opt_init.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/net/inet6_opt_init.3 b/lib/libc/net/inet6_opt_init.3 index 671346818470..484767f781fa 100644 --- a/lib/libc/net/inet6_opt_init.3 +++ b/lib/libc/net/inet6_opt_init.3 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2004 +.Dd August 1, 2021 .Dt INET6_OPT_INIT 3 .Os .\" @@ -305,7 +305,7 @@ All the functions return on an error. .\" .Sh EXAMPLES -RFC3542 gives comprehensive examples in Section 23. +RFC3542 gives comprehensive examples in Section 22. .Pp KAME also provides examples in the .Pa advapitest From owner-dev-commits-src-branches@freebsd.org Wed Aug 4 08:16:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24E12659967; Wed, 4 Aug 2021 08:16:36 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gfl2D0bP4z3JHW; Wed, 4 Aug 2021 08:16:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1A4B235C9; Wed, 4 Aug 2021 08:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1748GZZE083774; Wed, 4 Aug 2021 08:16:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1748GZeG083773; Wed, 4 Aug 2021 08:16:35 GMT (envelope-from git) Date: Wed, 4 Aug 2021 08:16:35 GMT Message-Id: <202108040816.1748GZeG083773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tom Jones Subject: git: c94af0dbb7c7 - stable/12 - Correct section reference for examples in RFC3542 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c94af0dbb7c79978433662a1d31d1e50f86e4515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 08:16:36 -0000 The branch stable/12 has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=c94af0dbb7c79978433662a1d31d1e50f86e4515 commit c94af0dbb7c79978433662a1d31d1e50f86e4515 Author: Tom Jones AuthorDate: 2021-08-01 12:52:07 +0000 Commit: Tom Jones CommitDate: 2021-08-04 08:16:15 +0000 Correct section reference for examples in RFC3542 Reviewed by: bz, network MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26272 (cherry picked from commit 44752e92e134167e9a0ecd277e32608a5595e6d1) --- lib/libc/net/inet6_opt_init.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/net/inet6_opt_init.3 b/lib/libc/net/inet6_opt_init.3 index 671346818470..484767f781fa 100644 --- a/lib/libc/net/inet6_opt_init.3 +++ b/lib/libc/net/inet6_opt_init.3 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2004 +.Dd August 1, 2021 .Dt INET6_OPT_INIT 3 .Os .\" @@ -305,7 +305,7 @@ All the functions return on an error. .\" .Sh EXAMPLES -RFC3542 gives comprehensive examples in Section 23. +RFC3542 gives comprehensive examples in Section 22. .Pp KAME also provides examples in the .Pa advapitest From owner-dev-commits-src-branches@freebsd.org Wed Aug 4 17:22:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F9A9651C6F; Wed, 4 Aug 2021 17:22:11 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gfz7l01wLz4c8F; Wed, 4 Aug 2021 17:22:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD3BB274E; Wed, 4 Aug 2021 17:22:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 174HMApX017638; Wed, 4 Aug 2021 17:22:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174HMAQP017637; Wed, 4 Aug 2021 17:22:10 GMT (envelope-from git) Date: Wed, 4 Aug 2021 17:22:10 GMT Message-Id: <202108041722.174HMAQP017637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 3f244aace29b - stable/13 - Update WITHOUT_KERNEL_SYMBOLS description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f244aace29b46d8d36e8272c9695811e2cc414f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 17:22:11 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3f244aace29b46d8d36e8272c9695811e2cc414f commit 3f244aace29b46d8d36e8272c9695811e2cc414f Author: Ed Maste AuthorDate: 2021-07-27 21:18:41 +0000 Commit: Ed Maste CommitDate: 2021-08-04 17:21:33 +0000 Update WITHOUT_KERNEL_SYMBOLS description We have installed kernel debug data under /usr/lib/debug/ for some time now, so the suggestion to set WITHOUT_KERNEL_SYMBOLS for small root partitions is no longer valid. Also call them "debug symbol files" rather than just "symbol files", since they contain much more than just symbols. The kernel also includes (some) symbols, regardless of the setting of this knob. MFC after: 1 week (cherry picked from commit 5f946c76c0cc2d1b4fa150f691764da163579d19) --- tools/build/options/WITHOUT_KERNEL_SYMBOLS | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/build/options/WITHOUT_KERNEL_SYMBOLS b/tools/build/options/WITHOUT_KERNEL_SYMBOLS index e2b3926a6e46..33fa2c4f1c97 100644 --- a/tools/build/options/WITHOUT_KERNEL_SYMBOLS +++ b/tools/build/options/WITHOUT_KERNEL_SYMBOLS @@ -1,5 +1,2 @@ .\" $FreeBSD$ -Set to not install kernel symbol files. -.Bf -symbolic -This option is recommended for those people who have small root partitions. -.Ef +Do not install kernel debug symbol files. From owner-dev-commits-src-branches@freebsd.org Wed Aug 4 17:24:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B110D652291; Wed, 4 Aug 2021 17:24:30 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GfzBQ4XxVz4cRn; Wed, 4 Aug 2021 17:24:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84105298F; Wed, 4 Aug 2021 17:24:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 174HOUDL020294; Wed, 4 Aug 2021 17:24:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 174HOUOG020293; Wed, 4 Aug 2021 17:24:30 GMT (envelope-from git) Date: Wed, 4 Aug 2021 17:24:30 GMT Message-Id: <202108041724.174HOUOG020293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 5f27244beb8a - stable/13 - src.conf.5: regen after 3f244aace29b MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5f27244beb8a1943238e64f530270679fbfa8e16 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 17:24:30 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5f27244beb8a1943238e64f530270679fbfa8e16 commit 5f27244beb8a1943238e64f530270679fbfa8e16 Author: Ed Maste AuthorDate: 2021-08-04 17:24:02 +0000 Commit: Ed Maste CommitDate: 2021-08-04 17:24:02 +0000 src.conf.5: regen after 3f244aace29b --- share/man/man5/src.conf.5 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index c083d8b91cb1..a0c1b4bb8b8a 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd July 10, 2021 +.Dd August 4, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -811,10 +811,7 @@ and Set to enable the "retpoline" mitigation for CVE-2017-5715 in the kernel build. .It Va WITHOUT_KERNEL_SYMBOLS -Set to not install kernel symbol files. -.Bf -symbolic -This option is recommended for those people who have small root partitions. -.Ef +Do not install kernel debug symbol files. .It Va WITHOUT_KVM Set to not build the .Nm libkvm From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 00:34:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC45265846D; Thu, 5 Aug 2021 00:34:02 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gg8k25cWsz3R9k; Thu, 5 Aug 2021 00:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A895210D82; Thu, 5 Aug 2021 00:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1750Y2X6095258; Thu, 5 Aug 2021 00:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1750Y2s7095257; Thu, 5 Aug 2021 00:34:02 GMT (envelope-from git) Date: Thu, 5 Aug 2021 00:34:02 GMT Message-Id: <202108050034.1750Y2s7095257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: dfe4c2024fbc - stable/13 - nfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dfe4c2024fbc0df2d73bb0be71736943533b4a9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 00:34:02 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=dfe4c2024fbc0df2d73bb0be71736943533b4a9a commit dfe4c2024fbc0df2d73bb0be71736943533b4a9a Author: Rick Macklem AuthorDate: 2021-07-20 00:35:39 +0000 Commit: Rick Macklem CommitDate: 2021-08-05 00:30:40 +0000 nfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts For NFSv4.1/4.2, the client may set the "seqid" field of the stateid to 0 in RPC requests. This indicates to the server that it should not check the "seqid" or return NFSERR_OLDSTATEID if the "seqid" value is not up to date w.r.t. Open/Lock operations on the stateid. This "seqid" is incremented by the NFSv4 server for each Open/OpenDowngrade/Lock/Locku operation done on the stateid. Since a failure return of NFSERR_OLDSTATEID is of no use to the client for I/O operations, it makes sense to set "seqid" to 0 for the stateid argument for I/O operations. This avoids server failure replies of NFSERR_OLDSTATEID, although I am not aware of any case where this failure occurs. This makes the FreeBSD NFSv4.1/4.2 client compatible with the Linux NFSv4.1/4.2 client. (cherry picked from commit 7685f8344d9a59e9498bdfebb48066f98216fecd) --- sys/fs/nfsclient/nfs_clstate.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 8ea5d77d2053..406dcc9d9b80 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -569,7 +569,11 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, !NFSBCMP(nfhp, dp->nfsdl_fh, fhlen)) { if (!(mode & NFSV4OPEN_ACCESSWRITE) || (dp->nfsdl_flags & NFSCLDL_WRITE)) { - stateidp->seqid = dp->nfsdl_stateid.seqid; + if (NFSHASNFSV4N(nmp)) + stateidp->seqid = 0; + else + stateidp->seqid = + dp->nfsdl_stateid.seqid; stateidp->other[0] = dp->nfsdl_stateid.other[0]; stateidp->other[1] = dp->nfsdl_stateid.other[1]; stateidp->other[2] = dp->nfsdl_stateid.other[2]; @@ -604,8 +608,10 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, own, own, mode, &lp, &op); if (error == 0 && lp != NULL && fords == 0) { /* Don't return a lock stateid for a DS. */ - stateidp->seqid = - lp->nfsl_stateid.seqid; + if (NFSHASNFSV4N(nmp)) + stateidp->seqid = 0; + else + stateidp->seqid = lp->nfsl_stateid.seqid; stateidp->other[0] = lp->nfsl_stateid.other[0]; stateidp->other[1] = @@ -656,7 +662,10 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, /* * No lock stateid, so return the open stateid. */ - stateidp->seqid = op->nfso_stateid.seqid; + if (NFSHASNFSV4N(nmp)) + stateidp->seqid = 0; + else + stateidp->seqid = op->nfso_stateid.seqid; stateidp->other[0] = op->nfso_stateid.other[0]; stateidp->other[1] = op->nfso_stateid.other[1]; stateidp->other[2] = op->nfso_stateid.other[2]; From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 00:34:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB7DB658D0A; Thu, 5 Aug 2021 00:34:37 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gg8kj5Sg4z3RD3; Thu, 5 Aug 2021 00:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2C6910AC5; Thu, 5 Aug 2021 00:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1750YbfW095431; Thu, 5 Aug 2021 00:34:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1750YbVK095430; Thu, 5 Aug 2021 00:34:37 GMT (envelope-from git) Date: Thu, 5 Aug 2021 00:34:37 GMT Message-Id: <202108050034.1750YbVK095430@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 7e48916d19de - stable/13 - vmci(4): Shorten interrupt descriptions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e48916d19de024ad00b308db5c39d63d6b9efb2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 00:34:37 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=7e48916d19de024ad00b308db5c39d63d6b9efb2 commit 7e48916d19de024ad00b308db5c39d63d6b9efb2 Author: Alexander Motin AuthorDate: 2021-07-22 16:58:10 +0000 Commit: Alexander Motin CommitDate: 2021-08-05 00:34:34 +0000 vmci(4): Shorten interrupt descriptions. We have no space there for such a long strings. Also it makes no sense to set description if there is only one interrupt. MFC after: 2 weeks (cherry picked from commit ab38c12b4a488c011ea85252621430ded6e87139) --- sys/dev/vmware/vmci/vmci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/vmware/vmci/vmci.c b/sys/dev/vmware/vmci/vmci.c index 91fcb39ed6ed..bbf17bbe7e41 100644 --- a/sys/dev/vmware/vmci/vmci.c +++ b/sys/dev/vmware/vmci/vmci.c @@ -845,17 +845,17 @@ vmci_setup_interrupts(struct vmci_softc *sc) vmci_interrupt, NULL, &intr->vmci_handler); if (error) return (error); - bus_describe_intr(sc->vmci_dev, intr->vmci_irq, intr->vmci_handler, - "vmci_interrupt"); if (sc->vmci_num_intr == 2) { + bus_describe_intr(sc->vmci_dev, intr->vmci_irq, + intr->vmci_handler, "dg"); intr = &sc->vmci_intrs[1]; error = bus_setup_intr(sc->vmci_dev, intr->vmci_irq, flags, NULL, vmci_interrupt_bm, NULL, &intr->vmci_handler); if (error) return (error); bus_describe_intr(sc->vmci_dev, intr->vmci_irq, - intr->vmci_handler, "vmci_interrupt_bm"); + intr->vmci_handler, "bm"); } return (0); From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 00:35:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08083658CB2; Thu, 5 Aug 2021 00:35:14 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gg8lP6rvLz3RBV; Thu, 5 Aug 2021 00:35:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3E37108B0; Thu, 5 Aug 2021 00:35:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1750ZDGf095588; Thu, 5 Aug 2021 00:35:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1750ZDmQ095587; Thu, 5 Aug 2021 00:35:13 GMT (envelope-from git) Date: Thu, 5 Aug 2021 00:35:13 GMT Message-Id: <202108050035.1750ZDmQ095587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: b3ffcbec1ccb - stable/12 - vmci(4): Shorten interrupt descriptions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b3ffcbec1ccb4832529408e4a391cf9a62ddd54d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 00:35:14 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b3ffcbec1ccb4832529408e4a391cf9a62ddd54d commit b3ffcbec1ccb4832529408e4a391cf9a62ddd54d Author: Alexander Motin AuthorDate: 2021-07-22 16:58:10 +0000 Commit: Alexander Motin CommitDate: 2021-08-05 00:35:08 +0000 vmci(4): Shorten interrupt descriptions. We have no space there for such a long strings. Also it makes no sense to set description if there is only one interrupt. MFC after: 2 weeks (cherry picked from commit ab38c12b4a488c011ea85252621430ded6e87139) --- sys/dev/vmware/vmci/vmci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/vmware/vmci/vmci.c b/sys/dev/vmware/vmci/vmci.c index 82e23daa4c71..3f195231d8e2 100644 --- a/sys/dev/vmware/vmci/vmci.c +++ b/sys/dev/vmware/vmci/vmci.c @@ -845,17 +845,17 @@ vmci_setup_interrupts(struct vmci_softc *sc) vmci_interrupt, NULL, &intr->vmci_handler); if (error) return (error); - bus_describe_intr(sc->vmci_dev, intr->vmci_irq, intr->vmci_handler, - "vmci_interrupt"); if (sc->vmci_num_intr == 2) { + bus_describe_intr(sc->vmci_dev, intr->vmci_irq, + intr->vmci_handler, "dg"); intr = &sc->vmci_intrs[1]; error = bus_setup_intr(sc->vmci_dev, intr->vmci_irq, flags, NULL, vmci_interrupt_bm, NULL, &intr->vmci_handler); if (error) return (error); bus_describe_intr(sc->vmci_dev, intr->vmci_irq, - intr->vmci_handler, "vmci_interrupt_bm"); + intr->vmci_handler, "bm"); } return (0); From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 00:57:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54FB86590DE; Thu, 5 Aug 2021 00:57:13 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gg9Dn1gTKz3hlN; Thu, 5 Aug 2021 00:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2209010D6F; Thu, 5 Aug 2021 00:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1750vDf8021739; Thu, 5 Aug 2021 00:57:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1750vDIm021738; Thu, 5 Aug 2021 00:57:13 GMT (envelope-from git) Date: Thu, 5 Aug 2021 00:57:13 GMT Message-Id: <202108050057.1750vDIm021738@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a1b07443998c - stable/13 - x86 __vdso_gettc: add O_CLOEXEC flag to open MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a1b07443998c7e214642e0aea61e0f3af180cf36 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 00:57:13 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a1b07443998c7e214642e0aea61e0f3af180cf36 commit a1b07443998c7e214642e0aea61e0f3af180cf36 Author: Konstantin Belousov AuthorDate: 2021-07-29 01:26:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-05 00:56:46 +0000 x86 __vdso_gettc: add O_CLOEXEC flag to open (cherry picked from commit cbf6f55e77a9176572830a20804cf1d005dfea73) --- lib/libc/x86/sys/__vdso_gettc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 7a64f2a0b556..ab10943c811b 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -230,7 +230,7 @@ __vdso_init_hpet(uint32_t u) * triggering trap_enocap on the device open by absolute path. */ if ((cap_getmode(&mode) == 0 && mode != 0) || - (fd = _open(devname, O_RDONLY)) == -1) { + (fd = _open(devname, O_RDONLY | O_CLOEXEC)) == -1) { /* Prevent the caller from re-entering. */ atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], (uintptr_t)old_map, (uintptr_t)MAP_FAILED); @@ -266,7 +266,7 @@ __vdso_init_hyperv_tsc(void) if (cap_getmode(&mode) == 0 && mode != 0) goto fail; - fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY); + fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY | O_CLOEXEC); if (fd < 0) goto fail; hyperv_ref_tsc = mmap(NULL, sizeof(*hyperv_ref_tsc), PROT_READ, From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D3C8660245; Thu, 5 Aug 2021 09:25:44 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWX1Vzgz4nQN; Thu, 5 Aug 2021 09:25:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 180F717B43; Thu, 5 Aug 2021 09:25:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PiZl006531; Thu, 5 Aug 2021 09:25:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PiEQ006530; Thu, 5 Aug 2021 09:25:44 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:44 GMT Message-Id: <202108050925.1759PiEQ006530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 22548a3b8070 - stable/13 - Simplify and speed up the kyua build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 22548a3b807084fe67f8ec4d9e9094fcef868e12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:44 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=22548a3b807084fe67f8ec4d9e9094fcef868e12 commit 22548a3b807084fe67f8ec4d9e9094fcef868e12 Author: Alex Richardson AuthorDate: 2021-07-02 08:21:04 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:56:47 +0000 Simplify and speed up the kyua build Instead of having multiple kyua libraries, just include the files as part of usr.bin/kyua. Previously, we would build each kyua source up to four times: once as a .o file and once as a .pieo. Additionally, the kyua libraries might be built again for compat32. As all the kyua libraries amount to 102 C++ sources the build time is significant (especially when using an assertions enabled compiler). This change ensures that we build 306 fewer .cpp source files as part of buildworld. Reviewed By: brooks MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30967 Remove lib/kyua from the build I forgot to include this line in 2eb9ad427475190e87d026de4ca7fc296947f2a0. Reported by: Jenkins CI MFC after: 1 week Fixes: 2eb9ad427475190ei ("Simplify and speed up the kyua build") Revert "Remove lib/kyua from the build" Accidentally removed it from the wrong file... This reverts commit 8ec4ba8a76aaf256942ac5996d45cc29022641ae. Remove lib/kyua from the build I forgot to include this line in 2eb9ad427475190e87d026de4ca7fc296947f2a0. Reported by: Jenkins CI MFC after: 1 week Fixes: 2eb9ad427475190ei ("Simplify and speed up the kyua build") (cherry picked from commit 2eb9ad427475190e87d026de4ca7fc296947f2a0) (cherry picked from commit 8ec4ba8a76aaf256942ac5996d45cc29022641ae) (cherry picked from commit 89da04fcaa33f100a60d06770f7424e5b7f1312f) (cherry picked from commit c951566915886330612bee880d6ece0d65bf9f5d) --- lib/Makefile | 1 - lib/kyua/Makefile | 10 --- lib/kyua/Makefile.inc | 20 ----- lib/kyua/Makefile.kyua | 11 --- lib/kyua/cli/Makefile | 29 -------- lib/kyua/drivers/Makefile | 12 --- lib/kyua/engine/Makefile | 22 ------ lib/kyua/model/Makefile | 13 ---- lib/kyua/store/Makefile | 18 ----- lib/kyua/utils/Makefile | 65 ---------------- share/mk/src.libnames.mk | 30 -------- usr.bin/kyua/Makefile | 140 +++++++++++++++++++++++++++++++++-- {lib => usr.bin}/kyua/config.h | 0 {lib => usr.bin}/kyua/utils/defs.hpp | 0 14 files changed, 135 insertions(+), 236 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 35cba77d7d06..3c218415d9ca 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -216,7 +216,6 @@ SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil SUBDIR.${MK_TELNET}+= libtelnet SUBDIR.${MK_TESTS_SUPPORT}+= atf -SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= liblutok SUBDIR.${MK_TESTS}+= tests SUBDIR.${MK_UNBOUND}+= libunbound diff --git a/lib/kyua/Makefile b/lib/kyua/Makefile deleted file mode 100644 index 1a1ea8bf5828..000000000000 --- a/lib/kyua/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -SUBDIR= cli \ - drivers \ - engine \ - model \ - store \ - utils - -.include diff --git a/lib/kyua/Makefile.inc b/lib/kyua/Makefile.inc deleted file mode 100644 index 52f19d3140b3..000000000000 --- a/lib/kyua/Makefile.inc +++ /dev/null @@ -1,20 +0,0 @@ -# $FreeBSD$ - -KYUA_LIBDIR:= ${.PARSEDIR} - -.include "${KYUA_LIBDIR}/Makefile.kyua" - -LIB_CXX= kyua_${KYUA_LIB} -INTERNALLIB= - -.PATH: ${KYUA_SRCDIR}/${KYUA_LIB} -CFLAGS+= -I${KYUA_LIBDIR} \ - -I${KYUA_SRCDIR} \ - -I${SRCTOP}/contrib/lutok/include - -CFLAGS+= -DHAVE_CONFIG_H - -# kyua uses auto_ptr -CFLAGS+= -Wno-deprecated-declarations - -.include "${.PARSEDIR}/../Makefile.inc" diff --git a/lib/kyua/Makefile.kyua b/lib/kyua/Makefile.kyua deleted file mode 100644 index 1fd30a135409..000000000000 --- a/lib/kyua/Makefile.kyua +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ - -KYUA_VERSION= 0.13 - -KYUA_CONFDIR= /etc/kyua -KYUA_DOCDIR= /usr/share/doc/kyua -KYUA_EGDIR= /usr/share/examples/kyua -KYUA_MISCDIR= /usr/share/kyua/misc -KYUA_STOREDIR= /usr/share/kyua/store - -KYUA_SRCDIR= ${SRCTOP}/contrib/kyua diff --git a/lib/kyua/cli/Makefile b/lib/kyua/cli/Makefile deleted file mode 100644 index b5de51607c12..000000000000 --- a/lib/kyua/cli/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= cli -INTERNALLIB= -LIBADD= kyua_drivers kyua_engine kyua_model kyua_store kyua_utils -CFLAGS+= -DKYUA_CONFDIR=\"${KYUA_CONFDIR}\" \ - -DKYUA_DOCDIR=\"${KYUA_DOCDIR}\" \ - -DKYUA_MISCDIR=\"${KYUA_MISCDIR}\" \ - -DPACKAGE=\"kyua\" \ - -DPACKAGE_NAME=\"Kyua\" \ - -DPACKAGE_VERSION=\"${KYUA_VERSION}\" \ - -DVERSION=\"${KYUA_VERSION}\" - -SRCS= cmd_about.cpp \ - cmd_config.cpp \ - cmd_db_exec.cpp \ - cmd_db_migrate.cpp \ - cmd_debug.cpp \ - cmd_help.cpp \ - cmd_list.cpp \ - cmd_report.cpp \ - cmd_report_html.cpp \ - cmd_report_junit.cpp \ - cmd_test.cpp \ - common.cpp \ - config.cpp \ - main.cpp - -.include diff --git a/lib/kyua/drivers/Makefile b/lib/kyua/drivers/Makefile deleted file mode 100644 index adf9c0601269..000000000000 --- a/lib/kyua/drivers/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= drivers -LIBADD= kyua_model kyua_engine kyua_store - -SRCS= debug_test.cpp \ - list_tests.cpp \ - report_junit.cpp \ - run_tests.cpp \ - scan_results.cpp - -.include diff --git a/lib/kyua/engine/Makefile b/lib/kyua/engine/Makefile deleted file mode 100644 index 4f0c9053c692..000000000000 --- a/lib/kyua/engine/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= engine -LIBADD= lutok kyua_utils -CFLAGS= -DKYUA_ARCHITECTURE=\"${MACHINE_ARCH}\" \ - -DKYUA_PLATFORM=\"${MACHINE}\" - -SRCS= atf.cpp \ - atf_list.cpp \ - atf_result.cpp \ - config.cpp \ - exceptions.cpp \ - filters.cpp \ - kyuafile.cpp \ - plain.cpp \ - requirements.cpp \ - scanner.cpp \ - tap.cpp \ - tap_parser.cpp \ - scheduler.cpp - -.include diff --git a/lib/kyua/model/Makefile b/lib/kyua/model/Makefile deleted file mode 100644 index d4a0b91587e7..000000000000 --- a/lib/kyua/model/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= model -LIBADD= lutok - -SRCS= context.cpp \ - exceptions.cpp \ - metadata.cpp \ - test_case.cpp \ - test_program.cpp \ - test_result.cpp - -.include diff --git a/lib/kyua/store/Makefile b/lib/kyua/store/Makefile deleted file mode 100644 index 39753691873e..000000000000 --- a/lib/kyua/store/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= store -LIBADD= kyua_model kyua_utils sqlite3 - -CFLAGS+= -DKYUA_STOREDIR=\"${KYUA_STOREDIR}\" - -SRCS= dbtypes.cpp \ - exceptions.cpp \ - layout.cpp \ - metadata.cpp \ - migrate.cpp \ - read_backend.cpp \ - read_transaction.cpp \ - write_backend.cpp \ - write_transaction.cpp - -.include diff --git a/lib/kyua/utils/Makefile b/lib/kyua/utils/Makefile deleted file mode 100644 index 740b395d6951..000000000000 --- a/lib/kyua/utils/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# $FreeBSD$ - -KYUA_LIB= utils -LIBADD= lutok - -CFLAGS+= -I${SRCTOP}/contrib/sqlite3 -CFLAGS+= -DGDB=\"/usr/local/bin/gdb\" - -SRCS= datetime.cpp \ - env.cpp \ - memory.cpp \ - passwd.cpp \ - sanity.cpp \ - stacktrace.cpp \ - stream.cpp \ - units.cpp \ - cmdline/base_command.cpp \ - cmdline/exceptions.cpp \ - cmdline/globals.cpp \ - cmdline/options.cpp \ - cmdline/parser.cpp \ - cmdline/ui.cpp \ - cmdline/ui_mock.cpp \ - config/exceptions.cpp \ - config/keys.cpp \ - config/lua_module.cpp \ - config/nodes.cpp \ - config/parser.cpp \ - config/tree.cpp \ - format/exceptions.cpp \ - format/formatter.cpp \ - fs/auto_cleaners.cpp \ - fs/directory.cpp \ - fs/exceptions.cpp \ - fs/lua_module.cpp \ - fs/operations.cpp \ - fs/path.cpp \ - logging/operations.cpp \ - process/child.cpp \ - process/deadline_killer.cpp \ - process/exceptions.cpp \ - process/executor.cpp \ - process/fdstream.cpp \ - process/isolation.cpp \ - process/operations.cpp \ - process/status.cpp \ - process/system.cpp \ - process/systembuf.cpp \ - signals/exceptions.cpp \ - signals/interrupts.cpp \ - signals/misc.cpp \ - signals/programmer.cpp \ - signals/timer.cpp \ - sqlite/c_gate.cpp \ - sqlite/database.cpp \ - sqlite/exceptions.cpp \ - sqlite/statement.cpp \ - sqlite/transaction.cpp \ - text/exceptions.cpp \ - text/operations.cpp \ - text/regex.cpp \ - text/table.cpp \ - text/templates.cpp \ - -.include diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 249443f1dcf2..93ae9caf1a2d 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -41,12 +41,6 @@ _INTERNALLIBS= \ fifolog \ ifconfig \ ipf \ - kyua_cli \ - kyua_drivers \ - kyua_engine \ - kyua_model \ - kyua_store \ - kyua_utils \ lpr \ lua \ lutok \ @@ -270,12 +264,6 @@ _DP_bsnmp= crypto _DP_geom= bsdxml sbuf _DP_cam= sbuf _DP_kvm= elf -_DP_kyua_cli= kyua_drivers kyua_engine kyua_model kyua_store kyua_utils -_DP_kyua_drivers= kyua_model kyua_engine kyua_store -_DP_kyua_engine= lutok kyua_utils -_DP_kyua_model= lutok -_DP_kyua_utils= lutok -_DP_kyua_store= kyua_model kyua_utils sqlite3 _DP_casper= nv _DP_cap_dns= nv _DP_cap_fileargs= nv @@ -498,24 +486,6 @@ _LIB_OBJTOP?= ${OBJTOP} LIBELFTCDIR= ${_LIB_OBJTOP}/lib/libelftc LIBELFTC?= ${LIBELFTCDIR}/libelftc${PIE_SUFFIX}.a -LIBKYUA_CLIDIR= ${_LIB_OBJTOP}/lib/kyua/cli -LIBKYUA_CLI?= ${LIBKYUA_CLIDIR}/libkyua_cli${PIE_SUFFIX}.a - -LIBKYUA_DRIVERSDIR= ${_LIB_OBJTOP}/lib/kyua/drivers -LIBKYUA_DRIVERS?= ${LIBKYUA_DRIVERSDIR}/libkyua_drivers${PIE_SUFFIX}.a - -LIBKYUA_ENGINEDIR= ${_LIB_OBJTOP}/lib/kyua/engine -LIBKYUA_ENGINE?= ${LIBKYUA_ENGINEDIR}/libkyua_engine${PIE_SUFFIX}.a - -LIBKYUA_MODELDIR= ${_LIB_OBJTOP}/lib/kyua/model -LIBKYUA_MODEL?= ${LIBKYUA_MODELDIR}/libkyua_model${PIE_SUFFIX}.a - -LIBKYUA_STOREDIR= ${_LIB_OBJTOP}/lib/kyua/store -LIBKYUA_STORE?= ${LIBKYUA_STOREDIR}/libkyua_store${PIE_SUFFIX}.a - -LIBKYUA_UTILSDIR= ${_LIB_OBJTOP}/lib/kyua/utils -LIBKYUA_UTILS?= ${LIBKYUA_UTILSDIR}/libkyua_utils${PIE_SUFFIX}.a - LIBLUADIR= ${_LIB_OBJTOP}/lib/liblua LIBLUA?= ${LIBLUADIR}/liblua${PIE_SUFFIX}.a diff --git a/usr.bin/kyua/Makefile b/usr.bin/kyua/Makefile index e27c8603f11b..966927709a06 100644 --- a/usr.bin/kyua/Makefile +++ b/usr.bin/kyua/Makefile @@ -2,14 +2,20 @@ .include -.include "${SRCTOP}/lib/kyua/Makefile.kyua" - +KYUA_CONFDIR= /etc/kyua +KYUA_DOCDIR= /usr/share/doc/kyua +KYUA_EGDIR= /usr/share/examples/kyua +KYUA_MISCDIR= /usr/share/kyua/misc +KYUA_STOREDIR= /usr/share/kyua/store +KYUA_VERSION= 0.13 + +KYUA_SRCDIR= ${SRCTOP}/contrib/kyua .PATH: ${KYUA_SRCDIR} PACKAGE= tests PROG_CXX= kyua SRCS= main.cpp -LIBADD= kyua_cli kyua_drivers kyua_engine kyua_model kyua_store +LIBADD= lutok sqlite3 MAN= kyua-about.1 \ kyua-config.1 \ @@ -26,10 +32,134 @@ MAN= kyua-about.1 \ kyua.conf.5 \ kyuafile.5 -CFLAGS+= -I${KYUA_SRCDIR} - +CFLAGS+= -I${KYUA_SRCDIR} -I${.CURDIR} +CFLAGS+= -I${SRCTOP}/contrib/lutok/include +CFLAGS+= -I${SRCTOP}/contrib/sqlite3 # kyua uses auto_ptr CFLAGS+= -Wno-deprecated-declarations +CFLAGS+= -DHAVE_CONFIG_H + +# We compile the kyua libraries as part of the main executable as this saves +# compile time and we don't install them anyway. +CFLAGS+= -DGDB=\"/usr/local/bin/gdb\" \ + -DKYUA_ARCHITECTURE=\"${MACHINE_ARCH}\" \ + -DKYUA_CONFDIR=\"${KYUA_CONFDIR}\" \ + -DKYUA_DOCDIR=\"${KYUA_DOCDIR}\" \ + -DKYUA_MISCDIR=\"${KYUA_MISCDIR}\" \ + -DKYUA_PLATFORM=\"${MACHINE}\" \ + -DKYUA_STOREDIR=\"${KYUA_STOREDIR}\" \ + -DPACKAGE=\"kyua\" \ + -DPACKAGE_NAME=\"Kyua\" \ + -DPACKAGE_VERSION=\"${KYUA_VERSION}\" \ + -DVERSION=\"${KYUA_VERSION}\" + +SRCS+= utils/datetime.cpp \ + utils/env.cpp \ + utils/memory.cpp \ + utils/passwd.cpp \ + utils/sanity.cpp \ + utils/stacktrace.cpp \ + utils/stream.cpp \ + utils/units.cpp \ + utils/cmdline/base_command.cpp \ + utils/cmdline/exceptions.cpp \ + utils/cmdline/globals.cpp \ + utils/cmdline/options.cpp \ + utils/cmdline/parser.cpp \ + utils/cmdline/ui.cpp \ + utils/cmdline/ui_mock.cpp \ + utils/config/exceptions.cpp \ + utils/config/keys.cpp \ + utils/config/lua_module.cpp \ + utils/config/nodes.cpp \ + utils/config/parser.cpp \ + utils/config/tree.cpp \ + utils/format/exceptions.cpp \ + utils/format/formatter.cpp \ + utils/fs/auto_cleaners.cpp \ + utils/fs/directory.cpp \ + utils/fs/exceptions.cpp \ + utils/fs/lua_module.cpp \ + utils/fs/operations.cpp \ + utils/fs/path.cpp \ + utils/logging/operations.cpp \ + utils/process/child.cpp \ + utils/process/deadline_killer.cpp \ + utils/process/exceptions.cpp \ + utils/process/executor.cpp \ + utils/process/fdstream.cpp \ + utils/process/isolation.cpp \ + utils/process/operations.cpp \ + utils/process/status.cpp \ + utils/process/system.cpp \ + utils/process/systembuf.cpp \ + utils/signals/exceptions.cpp \ + utils/signals/interrupts.cpp \ + utils/signals/misc.cpp \ + utils/signals/programmer.cpp \ + utils/signals/timer.cpp \ + utils/sqlite/c_gate.cpp \ + utils/sqlite/database.cpp \ + utils/sqlite/exceptions.cpp \ + utils/sqlite/statement.cpp \ + utils/sqlite/transaction.cpp \ + utils/text/exceptions.cpp \ + utils/text/operations.cpp \ + utils/text/regex.cpp \ + utils/text/table.cpp \ + utils/text/templates.cpp + +SRCS+= model/context.cpp \ + model/exceptions.cpp \ + model/metadata.cpp \ + model/test_case.cpp \ + model/test_program.cpp \ + model/test_result.cpp + +SRCS+= engine/atf.cpp \ + engine/atf_list.cpp \ + engine/atf_result.cpp \ + engine/config.cpp \ + engine/exceptions.cpp \ + engine/filters.cpp \ + engine/kyuafile.cpp \ + engine/plain.cpp \ + engine/requirements.cpp \ + engine/scanner.cpp \ + engine/tap.cpp \ + engine/tap_parser.cpp \ + engine/scheduler.cpp + +SRCS+= store/dbtypes.cpp \ + store/exceptions.cpp \ + store/layout.cpp \ + store/metadata.cpp \ + store/migrate.cpp \ + store/read_backend.cpp \ + store/read_transaction.cpp \ + store/write_backend.cpp \ + store/write_transaction.cpp + +SRCS+= drivers/debug_test.cpp \ + drivers/list_tests.cpp \ + drivers/report_junit.cpp \ + drivers/run_tests.cpp \ + drivers/scan_results.cpp + +SRCS+= cli/cmd_about.cpp \ + cli/cmd_config.cpp \ + cli/cmd_db_exec.cpp \ + cli/cmd_db_migrate.cpp \ + cli/cmd_debug.cpp \ + cli/cmd_help.cpp \ + cli/cmd_list.cpp \ + cli/cmd_report.cpp \ + cli/cmd_report_html.cpp \ + cli/cmd_report_junit.cpp \ + cli/cmd_test.cpp \ + cli/common.cpp \ + cli/config.cpp \ + cli/main.cpp FILESGROUPS= DOCS MISC STORE diff --git a/lib/kyua/config.h b/usr.bin/kyua/config.h similarity index 100% rename from lib/kyua/config.h rename to usr.bin/kyua/config.h diff --git a/lib/kyua/utils/defs.hpp b/usr.bin/kyua/utils/defs.hpp similarity index 100% rename from lib/kyua/utils/defs.hpp rename to usr.bin/kyua/utils/defs.hpp From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9612E660249; Thu, 5 Aug 2021 09:25:45 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWY2qvtz4nQR; Thu, 5 Aug 2021 09:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30D5817CB0; Thu, 5 Aug 2021 09:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PjHA006557; Thu, 5 Aug 2021 09:25:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PjrS006556; Thu, 5 Aug 2021 09:25:45 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:45 GMT Message-Id: <202108050925.1759PjrS006556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: e4c2ffe93205 - stable/13 - usr.bin/sort: Avoid UBSan errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e4c2ffe932050f42271a5e1b00b185358fb5f5cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:45 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e4c2ffe932050f42271a5e1b00b185358fb5f5cc commit e4c2ffe932050f42271a5e1b00b185358fb5f5cc Author: Alex Richardson AuthorDate: 2021-07-05 13:32:48 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:57:45 +0000 usr.bin/sort: Avoid UBSan errors UBSan complains about out-of-bounds accesses for zero-length arrays. To avoid this we can use flexible array members. However, the C standard does not allow for structures that only contain flexible array members, so we move the length parameters into that structure too. Split out from D28233. Reviewed By: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31009 (cherry picked from commit d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32) --- usr.bin/sort/Makefile | 2 +- usr.bin/sort/bwstring.c | 267 ++++++++++++++++++++++++------------------------ usr.bin/sort/bwstring.h | 31 +++--- 3 files changed, 155 insertions(+), 145 deletions(-) diff --git a/usr.bin/sort/Makefile b/usr.bin/sort/Makefile index d38e036b90c0..3f7b607a177a 100644 --- a/usr.bin/sort/Makefile +++ b/usr.bin/sort/Makefile @@ -3,8 +3,8 @@ .include PROG= sort - SRCS= bwstring.c coll.c file.c mem.c radixsort.c sort.c vsort.c +CSTD= c11 sort.1: sort.1.in sed ${MAN_SUB} ${.ALLSRC} >${.TARGET} diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index f6200c53c83e..c31cb859cb37 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -113,7 +113,7 @@ initialise_months(void) static int wide_str_coll(const wchar_t *s1, const wchar_t *s2) { - int ret = 0; + int ret; errno = 0; ret = wcscoll(s1, s2); @@ -144,41 +144,44 @@ bwsprintf(FILE *f, struct bwstring *bws, const char *prefix, const char *suffix) { if (mb_cur_max == 1) - fprintf(f, "%s%s%s", prefix, bws->data.cstr, suffix); + fprintf(f, "%s%s%s", prefix, bws->cdata.str, suffix); else - fprintf(f, "%s%S%s", prefix, bws->data.wstr, suffix); + fprintf(f, "%s%S%s", prefix, bws->wdata.str, suffix); } const void* bwsrawdata(const struct bwstring *bws) { - return (&(bws->data)); + return (&(bws->wdata)); } size_t bwsrawlen(const struct bwstring *bws) { - return ((mb_cur_max == 1) ? bws->len : SIZEOF_WCHAR_STRING(bws->len)); + return ((mb_cur_max == 1) ? bws->cdata.len : + SIZEOF_WCHAR_STRING(bws->wdata.len)); } size_t bws_memsize(const struct bwstring *bws) { - return ((mb_cur_max == 1) ? (bws->len + 2 + sizeof(struct bwstring)) : - (SIZEOF_WCHAR_STRING(bws->len + 1) + sizeof(struct bwstring))); + return ((mb_cur_max == 1) ? + (bws->cdata.len + 2 + sizeof(struct bwstring)) : + (SIZEOF_WCHAR_STRING(bws->wdata.len + 1) + sizeof(struct bwstring))); } void bws_setlen(struct bwstring *bws, size_t newlen) { - if (bws && newlen != bws->len && newlen <= bws->len) { - bws->len = newlen; - if (mb_cur_max == 1) - bws->data.cstr[newlen] = '\0'; - else - bws->data.wstr[newlen] = L'\0'; + if (mb_cur_max == 1 && bws && newlen != bws->cdata.len && + newlen <= bws->cdata.len) { + bws->cdata.len = newlen; + bws->cdata.str[newlen] = '\0'; + } else if (bws && newlen != bws->wdata.len && newlen <= bws->wdata.len) { + bws->wdata.len = newlen; + bws->wdata.str[newlen] = L'\0'; } } @@ -190,17 +193,16 @@ bwsalloc(size_t sz) { struct bwstring *ret; - if (mb_cur_max == 1) + if (mb_cur_max == 1) { ret = sort_malloc(sizeof(struct bwstring) + 1 + sz); - else - ret = sort_malloc(sizeof(struct bwstring) + - SIZEOF_WCHAR_STRING(sz + 1)); - ret->len = sz; - - if (mb_cur_max == 1) - ret->data.cstr[ret->len] = '\0'; - else - ret->data.wstr[ret->len] = L'\0'; + ret->cdata.len = sz; + ret->cdata.str[sz] = '\0'; + } else { + ret = sort_malloc( + sizeof(struct bwstring) + SIZEOF_WCHAR_STRING(sz + 1)); + ret->wdata.len = sz; + ret->wdata.str[sz] = L'\0'; + } return (ret); } @@ -216,13 +218,13 @@ bwsdup(const struct bwstring *s) if (s == NULL) return (NULL); else { - struct bwstring *ret = bwsalloc(s->len); + struct bwstring *ret = bwsalloc(BWSLEN(s)); if (mb_cur_max == 1) - memcpy(ret->data.cstr, s->data.cstr, (s->len)); + memcpy(ret->cdata.str, s->cdata.str, (s->cdata.len)); else - memcpy(ret->data.wstr, s->data.wstr, - SIZEOF_WCHAR_STRING(s->len)); + memcpy(ret->wdata.str, s->wdata.str, + SIZEOF_WCHAR_STRING(s->wdata.len)); return (ret); } @@ -244,9 +246,9 @@ bwssbdup(const wchar_t *str, size_t len) if (mb_cur_max == 1) for (size_t i = 0; i < len; ++i) - ret->data.cstr[i] = (unsigned char) str[i]; + ret->cdata.str[i] = (char)str[i]; else - memcpy(ret->data.wstr, str, SIZEOF_WCHAR_STRING(len)); + memcpy(ret->wdata.str, str, SIZEOF_WCHAR_STRING(len)); return (ret); } @@ -264,7 +266,7 @@ bwscsbdup(const unsigned char *str, size_t len) if (str) { if (mb_cur_max == 1) - memcpy(ret->data.cstr, str, len); + memcpy(ret->cdata.str, str, len); else { mbstate_t mbs; const char *s; @@ -288,12 +290,12 @@ bwscsbdup(const unsigned char *str, size_t len) case (size_t) -1: /* FALLTHROUGH */ case (size_t) -2: - ret->data.wstr[chars++] = + ret->wdata.str[chars++] = (unsigned char) s[cptr]; ++cptr; break; default: - n = mbrtowc(ret->data.wstr + (chars++), + n = mbrtowc(ret->wdata.str + (chars++), s + cptr, charlen, &mbs); if ((n == (size_t)-1) || (n == (size_t)-2)) /* NOTREACHED */ @@ -302,8 +304,8 @@ bwscsbdup(const unsigned char *str, size_t len) } } - ret->len = chars; - ret->data.wstr[ret->len] = L'\0'; + ret->wdata.len = chars; + ret->wdata.str[ret->wdata.len] = L'\0'; } } return (ret); @@ -328,19 +330,20 @@ bwsfree(const struct bwstring *s) size_t bwscpy(struct bwstring *dst, const struct bwstring *src) { - size_t nums = src->len; + size_t nums = BWSLEN(src); - if (nums > dst->len) - nums = dst->len; - dst->len = nums; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr, nums); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str, nums); + dst->cdata.len = nums; + dst->cdata.str[dst->cdata.len] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr, - SIZEOF_WCHAR_STRING(nums + 1)); - dst->data.wstr[dst->len] = L'\0'; + memcpy(dst->wdata.str, src->wdata.str, + SIZEOF_WCHAR_STRING(nums)); + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } return (nums); @@ -355,21 +358,22 @@ bwscpy(struct bwstring *dst, const struct bwstring *src) struct bwstring * bwsncpy(struct bwstring *dst, const struct bwstring *src, size_t size) { - size_t nums = src->len; + size_t nums = BWSLEN(src); - if (nums > dst->len) - nums = dst->len; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (nums > size) nums = size; - dst->len = nums; if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr, nums); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str, nums); + dst->cdata.len = nums; + dst->cdata.str[nums] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr, - SIZEOF_WCHAR_STRING(nums + 1)); - dst->data.wstr[dst->len] = L'\0'; + memcpy(dst->wdata.str, src->wdata.str, + SIZEOF_WCHAR_STRING(nums)); + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } return (dst); @@ -387,25 +391,24 @@ bwsnocpy(struct bwstring *dst, const struct bwstring *src, size_t offset, size_t size) { - if (offset >= src->len) { - dst->data.wstr[0] = 0; - dst->len = 0; + if (offset >= BWSLEN(src)) { + bws_setlen(dst, 0); } else { - size_t nums = src->len - offset; + size_t nums = BWSLEN(src) - offset; - if (nums > dst->len) - nums = dst->len; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (nums > size) nums = size; - dst->len = nums; if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr + offset, - (nums)); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str + offset, nums); + dst->cdata.len = nums; + dst->cdata.str[nums] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr + offset, + memcpy(dst->wdata.str, src->wdata.str + offset, SIZEOF_WCHAR_STRING(nums)); - dst->data.wstr[dst->len] = L'\0'; + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } } return (dst); @@ -421,16 +424,16 @@ bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended) { if (mb_cur_max == 1) { - size_t len = bws->len; + size_t len = bws->cdata.len; if (!zero_ended) { - bws->data.cstr[len] = '\n'; + bws->cdata.str[len] = '\n'; - if (fwrite(bws->data.cstr, len + 1, 1, f) < 1) + if (fwrite(bws->cdata.str, len + 1, 1, f) < 1) err(2, NULL); - bws->data.cstr[len] = '\0'; - } else if (fwrite(bws->data.cstr, len + 1, 1, f) < 1) + bws->cdata.str[len] = '\0'; + } else if (fwrite(bws->cdata.str, len + 1, 1, f) < 1) err(2, NULL); return (len + 1); @@ -442,7 +445,7 @@ bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended) eols = zero_ended ? btowc('\0') : btowc('\n'); while (printed < BWSLEN(bws)) { - const wchar_t *s = bws->data.wstr + printed; + const wchar_t *s = bws->wdata.str + printed; if (*s == L'\0') { int nums; @@ -508,7 +511,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) if (ret[*len - 1] == '\n') --(*len); } - return (bwscsbdup((unsigned char*)ret, *len)); + return (bwscsbdup((unsigned char *)ret, *len)); } else { *len = 0; @@ -548,7 +551,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) } else while (!feof(f)) { - wint_t c = 0; + wint_t c; c = fgetwc(f); @@ -581,10 +584,10 @@ bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset, size_t len) { size_t cmp_len, len1, len2; - int res = 0; + int res; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); if (len1 <= offset) { return ((len2 <= offset) ? 0 : -1); @@ -604,18 +607,18 @@ bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, cmp_len = len; if (mb_cur_max == 1) { - const unsigned char *s1, *s2; + const char *s1, *s2; - s1 = bws1->data.cstr + offset; - s2 = bws2->data.cstr + offset; + s1 = bws1->cdata.str + offset; + s2 = bws2->cdata.str + offset; res = memcmp(s1, s2, cmp_len); } else { const wchar_t *s1, *s2; - s1 = bws1->data.wstr + offset; - s2 = bws2->data.wstr + offset; + s1 = bws1->wdata.str + offset; + s2 = bws2->wdata.str + offset; res = memcmp(s1, s2, SIZEOF_WCHAR_STRING(cmp_len)); } @@ -638,8 +641,8 @@ bwscmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) size_t len1, len2, cmp_len; int res; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); len1 -= offset; len2 -= offset; @@ -665,7 +668,7 @@ int bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len) { wchar_t c1, c2; - size_t i = 0; + size_t i; for (i = 0; i < len; ++i) { c1 = bws_get_iter_value(iter1); @@ -684,8 +687,8 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) { size_t len1, len2; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); if (len1 <= offset) return ((len2 <= offset) ? 0 : -1); @@ -697,13 +700,13 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) len2 -= offset; if (mb_cur_max == 1) { - const unsigned char *s1, *s2; + const char *s1, *s2; - s1 = bws1->data.cstr + offset; - s2 = bws2->data.cstr + offset; + s1 = bws1->cdata.str + offset; + s2 = bws2->cdata.str + offset; if (byte_sort) { - int res = 0; + int res; if (len1 > len2) { res = memcmp(s1, s2, len2); @@ -719,7 +722,7 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) return (res); } else { - int res = 0; + int res; size_t i, maxlen; i = 0; @@ -780,10 +783,10 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) } else { const wchar_t *s1, *s2; size_t i, maxlen; - int res = 0; + int res; - s1 = bws1->data.wstr + offset; - s2 = bws2->data.wstr + offset; + s1 = bws1->wdata.str + offset; + s2 = bws2->wdata.str + offset; i = 0; maxlen = len1; @@ -850,14 +853,14 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) double bwstod(struct bwstring *s0, bool *empty) { - double ret = 0; + double ret; if (mb_cur_max == 1) { - unsigned char *end, *s; + char *end, *s; char *ep; - s = s0->data.cstr; - end = s + s0->len; + s = s0->cdata.str; + end = s + s0->cdata.len; ep = NULL; while (isblank(*s) && s < end) @@ -869,15 +872,15 @@ bwstod(struct bwstring *s0, bool *empty) } ret = strtod((char*)s, &ep); - if ((unsigned char*) ep == s) { + if (ep == s) { *empty = true; return (0); } } else { wchar_t *end, *ep, *s; - s = s0->data.wstr; - end = s + s0->len; + s = s0->wdata.str; + end = s + s0->wdata.len; ep = NULL; while (iswblank(*s) && s < end) @@ -910,25 +913,25 @@ bws_month_score(const struct bwstring *s0) { if (mb_cur_max == 1) { - const unsigned char *end, *s; + const char *end, *s; - s = s0->data.cstr; - end = s + s0->len; + s = s0->cdata.str; + end = s + s0->cdata.len; while (isblank(*s) && s < end) ++s; for (int i = 11; i >= 0; --i) { if (cmonths[i] && - (s == (unsigned char*)strstr((const char*)s, (char*)(cmonths[i])))) + (s == strstr(s, cmonths[i]))) return (i); } } else { const wchar_t *end, *s; - s = s0->data.wstr; - end = s + s0->len; + s = s0->wdata.str; + end = s + s0->wdata.len; while (iswblank(*s) && s < end) ++s; @@ -950,11 +953,11 @@ ignore_leading_blanks(struct bwstring *str) { if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; + char *dst, *end, *src; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end && isblank(*src)) ++src; @@ -974,9 +977,9 @@ ignore_leading_blanks(struct bwstring *str) } else { wchar_t *dst, *end, *src; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end && iswblank(*src)) ++src; @@ -1003,15 +1006,15 @@ ignore_leading_blanks(struct bwstring *str) struct bwstring * ignore_nonprinting(struct bwstring *str) { - size_t newlen = str->len; + size_t newlen = BWSLEN(str); if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; - unsigned char c; + char *dst, *end, *src; + char c; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end) { c = *src; @@ -1028,9 +1031,9 @@ ignore_nonprinting(struct bwstring *str) wchar_t *dst, *end, *src; wchar_t c; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end) { c = *src; @@ -1056,15 +1059,15 @@ ignore_nonprinting(struct bwstring *str) struct bwstring * dictionary_order(struct bwstring *str) { - size_t newlen = str->len; + size_t newlen = BWSLEN(str); if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; - unsigned char c; + char *dst, *end, *src; + char c; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end) { c = *src; @@ -1081,9 +1084,9 @@ dictionary_order(struct bwstring *str) wchar_t *dst, *end, *src; wchar_t c; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end) { c = *src; @@ -1110,10 +1113,10 @@ ignore_case(struct bwstring *str) { if (mb_cur_max == 1) { - unsigned char *end, *s; + char *end, *s; - s = str->data.cstr; - end = s + str->len; + s = str->cdata.str; + end = s + str->cdata.len; while (s < end) { *s = toupper(*s); @@ -1122,8 +1125,8 @@ ignore_case(struct bwstring *str) } else { wchar_t *end, *s; - s = str->data.wstr; - end = s + str->len; + s = str->wdata.str; + end = s + str->wdata.len; while (s < end) { *s = towupper(*s); @@ -1138,7 +1141,7 @@ bws_disorder_warnx(struct bwstring *s, const char *fn, size_t pos) { if (mb_cur_max == 1) - warnx("%s:%zu: disorder: %s", fn, pos + 1, s->data.cstr); + warnx("%s:%zu: disorder: %s", fn, pos + 1, s->cdata.str); else - warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->data.wstr); + warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->wdata.str); } diff --git a/usr.bin/sort/bwstring.h b/usr.bin/sort/bwstring.h index b63bb97ab93f..09a0dbf2fac2 100644 --- a/usr.bin/sort/bwstring.h +++ b/usr.bin/sort/bwstring.h @@ -46,17 +46,25 @@ extern bool byte_sort; /* wchar_t is of 4 bytes: */ #define SIZEOF_WCHAR_STRING(LEN) ((LEN)*sizeof(wchar_t)) +struct wstr { + size_t len; + wchar_t str[]; +}; + +struct cstr { + size_t len; + char str[]; +}; + /* * Binary "wide" string */ struct bwstring { - size_t len; - union - { - wchar_t wstr[0]; - unsigned char cstr[0]; - } data; + union { + struct wstr wdata; + struct cstr cdata; + }; }; struct reader_buffer @@ -67,8 +75,7 @@ struct reader_buffer typedef void *bwstring_iterator; -#define BWSLEN(s) ((s)->len) - +#define BWSLEN(s) ((mb_cur_max == 1) ? (s)->cdata.len : (s)->wdata.len) struct bwstring *bwsalloc(size_t sz); size_t bwsrawlen(const struct bwstring *bws); @@ -103,7 +110,7 @@ static inline bwstring_iterator bws_begin(struct bwstring *bws) { - return (bwstring_iterator) (&(bws->data)); + return ((bwstring_iterator)bws->wdata.str); } static inline bwstring_iterator @@ -111,8 +118,8 @@ bws_end(struct bwstring *bws) { return ((mb_cur_max == 1) ? - (bwstring_iterator) (bws->data.cstr + bws->len) : - (bwstring_iterator) (bws->data.wstr + bws->len)); + (bwstring_iterator) (bws->cdata.str + bws->cdata.len) : + (bwstring_iterator) (bws->wdata.str + bws->wdata.len)); } static inline bwstring_iterator @@ -138,7 +145,7 @@ bws_get_iter_value(bwstring_iterator iter) int bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len); -#define BWS_GET(bws, pos) ((mb_cur_max == 1) ? ((bws)->data.cstr[(pos)]) : (bws)->data.wstr[(pos)]) +#define BWS_GET(bws, pos) ((mb_cur_max == 1) ? (bws->cdata.str[(pos)]) : bws->wdata.str[(pos)]) void initialise_months(void); From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E47BA660251; Thu, 5 Aug 2021 09:25:46 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWZ4nMbz4nVm; Thu, 5 Aug 2021 09:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E40917E1F; Thu, 5 Aug 2021 09:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PkIE006581; Thu, 5 Aug 2021 09:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Pkmv006580; Thu, 5 Aug 2021 09:25:46 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:46 GMT Message-Id: <202108050925.1759Pkmv006580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 608cb9631239 - stable/13 - usr.bin/login: send errors to console if syslog isn't running MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 608cb96312395a755f79e5108a54f69c53557428 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:47 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=608cb96312395a755f79e5108a54f69c53557428 commit 608cb96312395a755f79e5108a54f69c53557428 Author: Alex Richardson AuthorDate: 2021-07-06 09:50:05 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:57:54 +0000 usr.bin/login: send errors to console if syslog isn't running I was debugging why login(1) wasn't working as expected on a minimal MFS_ROOT disk image. This image doesn't have syslogd running so the warnings were lost and I had to use GDB to find out why login(1) was failing (missing PAM libraries) instead of being able to see it in the console output. MFC after: 1 week Reviewed By: pfg Differential Revision: https://reviews.freebsd.org/D30892 (cherry picked from commit 4d552825ecebecd6c95a995c0b314b09936121b5) --- usr.bin/login/login.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 510712a15491..2ac0d9324c26 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -199,7 +199,7 @@ main(int argc, char *argv[]) (void)alarm(timeout); (void)setpriority(PRIO_PROCESS, 0, 0); - openlog("login", 0, LOG_AUTH); + openlog("login", LOG_CONS, LOG_AUTH); uid = getuid(); euid = geteuid(); From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B60726600DC; Thu, 5 Aug 2021 09:25:47 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWb49Rlz4nFF; Thu, 5 Aug 2021 09:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B18017DFC; Thu, 5 Aug 2021 09:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759Pl3j006607; Thu, 5 Aug 2021 09:25:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PlrS006606; Thu, 5 Aug 2021 09:25:47 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:47 GMT Message-Id: <202108050925.1759PlrS006606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 7a7324d9cebe - stable/13 - usr.bin/diff: fix UBSan error in readhash MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7a7324d9cebee6f42d77a39f3a8c657e23676cc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:47 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7a7324d9cebee6f42d77a39f3a8c657e23676cc2 commit 7a7324d9cebee6f42d77a39f3a8c657e23676cc2 Author: Alex Richardson AuthorDate: 2021-07-06 11:16:40 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:59:26 +0000 usr.bin/diff: fix UBSan error in readhash UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since that can overflow an `int`. Use `unsigned int` instead to ensure that overflow is well-defined. Reviewed By: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31075 (cherry picked from commit c78f449d85e0b292fe5d942cca99f11c1cd430fa) --- usr.bin/diff/diffreg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 1b28281024c6..651ec88df909 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1345,7 +1345,7 @@ static int readhash(FILE *f, int flags) { int i, t, space; - int sum; + unsigned sum; sum = 1; space = 0; From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30FA46605E3; Thu, 5 Aug 2021 09:25:49 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWc73kXz4nVw; Thu, 5 Aug 2021 09:25:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 985D417B44; Thu, 5 Aug 2021 09:25:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PmWb006631; Thu, 5 Aug 2021 09:25:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Pmir006630; Thu, 5 Aug 2021 09:25:48 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:48 GMT Message-Id: <202108050925.1759Pmir006630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 120f0a029e26 - stable/13 - Fix building rescue/rescue when sanitizers are enabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 120f0a029e267067325757f4269ab6b30506ddd7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:49 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=120f0a029e267067325757f4269ab6b30506ddd7 commit 120f0a029e267067325757f4269ab6b30506ddd7 Author: Alex Richardson AuthorDate: 2021-07-06 11:18:29 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:59:51 +0000 Fix building rescue/rescue when sanitizers are enabled We have to ensure that we don't link any instrumented object files into rescue as it is a static executable and static binaries can't use the sanitizer runtime. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D31044 (cherry picked from commit 2eefc1d926430dbba83128d27f8bed3c34199159) --- rescue/rescue/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index 7352828a822c..f2aa614f1dfc 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -6,7 +6,12 @@ PACKAGE=rescue MAN= MK_SSP= no +# Static-PIE is not supported so we should not be linking against _pie.a libs. +# This is also needed to avoid linking against sanitizer-instrumented libraries +# since MK_ASAN/MK_UBSAN will instrument the .pieo object files. +MK_PIE= no NO_SHARED= yes +CRUNCH_BUILDOPTS+= MK_PIE=no NO_SHARED=yes PROG= rescue BINDIR?=/rescue From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1357A660462; Thu, 5 Aug 2021 09:25:50 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWd6940z4nTH; Thu, 5 Aug 2021 09:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B694217BDC; Thu, 5 Aug 2021 09:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PnYk006659; Thu, 5 Aug 2021 09:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PnKr006658; Thu, 5 Aug 2021 09:25:49 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:49 GMT Message-Id: <202108050925.1759PnKr006658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 0869d85591db - stable/13 - bin/ps: Avoid function name conflict with libc uname() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0869d85591dbe71eff4cbd9fc93077cf5943a00c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:50 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0869d85591dbe71eff4cbd9fc93077cf5943a00c commit 0869d85591dbe71eff4cbd9fc93077cf5943a00c Author: Alex Richardson AuthorDate: 2021-07-19 14:03:38 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 08:59:59 +0000 bin/ps: Avoid function name conflict with libc uname() This prevents ps from being built with address sanitizer instrumentation. Reviewed By: trasz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31048 (cherry picked from commit 2423585b1de50dd2daea8478318e94ff80e0e6ec) --- bin/ps/extern.h | 2 +- bin/ps/keyword.c | 2 +- bin/ps/print.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ps/extern.h b/bin/ps/extern.h index 723d7fcb85dd..ea4362eeadd9 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -86,7 +86,7 @@ char *tdev(KINFO *, VARENT *); char *tdnam(KINFO *, VARENT *); char *tname(KINFO *, VARENT *); char *ucomm(KINFO *, VARENT *); -char *uname(KINFO *, VARENT *); +char *username(KINFO *, VARENT *); char *upr(KINFO *, VARENT *); char *usertime(KINFO *, VARENT *); char *vsize(KINFO *, VARENT *); diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 2a8382a2273e..e78cf984e455 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -222,7 +222,7 @@ static VAR var[] = { {"upr", "UPR", NULL, "user-priority", 0, upr, 0, CHAR, NULL, 0}, {"uprocp", "UPROCP", NULL, "process-address", 0, kvar, KOFF(ki_paddr), KPTR, "lx", 0}, - {"user", "USER", NULL, "user", LJUST, uname, 0, CHAR, NULL, 0}, + {"user", "USER", NULL, "user", LJUST, username, 0, CHAR, NULL, 0}, {"usertime", "USERTIME", NULL, "user-time", USER, usertime, 0, CHAR, NULL, 0}, {"usrpri", "", "upr", NULL, 0, NULL, 0, CHAR, NULL, 0}, diff --git a/bin/ps/print.c b/bin/ps/print.c index 3d3a543c8a5d..2b61c6b0a15a 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -311,7 +311,7 @@ upr(KINFO *k, VARENT *ve __unused) #undef scalepri char * -uname(KINFO *k, VARENT *ve __unused) +username(KINFO *k, VARENT *ve __unused) { return (strdup(user_from_uid(k->ki_p->ki_uid, 0))); From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E633E66049C; Thu, 5 Aug 2021 09:25:51 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWg1T76z4nQk; Thu, 5 Aug 2021 09:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF65A17861; Thu, 5 Aug 2021 09:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759Povx006686; Thu, 5 Aug 2021 09:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PoD2006685; Thu, 5 Aug 2021 09:25:50 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:50 GMT Message-Id: <202108050925.1759PoD2006685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: e0174face9bb - stable/13 - Allow building usr.bin/vi with MK_ASAN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e0174face9bb3fe83dbc92984c32ad4ff32e6b7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:52 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e0174face9bb3fe83dbc92984c32ad4ff32e6b7c commit e0174face9bb3fe83dbc92984c32ad4ff32e6b7c Author: Alex Richardson AuthorDate: 2021-07-19 14:04:19 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:14 +0000 Allow building usr.bin/vi with MK_ASAN We have to namespace the regex functions to avoid duplicate symbol errors. This also ensures that vi doesn't define the libc reg* functions with mismatched signatures. ld: error: duplicate symbol: regcomp >>> defined at sanitizer_common_interceptors.inc:7519 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7519) >>> asan_interceptors.o:(__interceptor_regcomp) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regcomp.c >>> .../regex/regcomp.c.o:(.text+0x0) ld: error: duplicate symbol: regerror >>> defined at sanitizer_common_interceptors.inc:7543 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7543) >>> asan_interceptors.o:(__interceptor_regerror) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regerror.c >>> .../regex/regerror.c.o:(.text+0x0) ld: error: duplicate symbol: regexec >>> defined at sanitizer_common_interceptors.inc:7530 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7530) >>> asan_interceptors.o:(__interceptor_regexec) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regexec.c >>> .../regex/regexec.c.o:(.text+0x0) ld: error: duplicate symbol: regfree >>> defined at sanitizer_common_interceptors.inc:7553 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7553) >>> asan_interceptors.o:(__interceptor_regfree) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a >>> defined at regfree.c >>> .../regex/regfree.c.o:(.text+0x0) Committed upstream as https://github.com/lichray/nvi2/pull/92 Reviewed By: bapt Differential Revision: https://reviews.freebsd.org/D31050 (cherry picked from commit 8ef98a8045d4623edd75b91ce76eedeaa4ad3f01) --- contrib/nvi/regex/regex.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contrib/nvi/regex/regex.h b/contrib/nvi/regex/regex.h index 20ea7865c0a0..7d788514a54c 100644 --- a/contrib/nvi/regex/regex.h +++ b/contrib/nvi/regex/regex.h @@ -96,6 +96,16 @@ typedef struct { #define REG_LARGE 01000 /* force large representation */ #define REG_BACKR 02000 /* force use of backref code */ +#ifdef USE_WIDECHAR +/* + * Avoid function name conflicts with the system regex functions. + * This is needed e.g. to build with AddressSanitizer. + */ +#define regcomp nvi_regcomp +#define regerror nvi_regerror +#define regexec nvi_regexec +#define regfree nvi_regfree +#endif int regcomp(regex_t *, const RCHAR_T *, int); size_t regerror(int, const regex_t *, char *, size_t); int regexec(const regex_t *, From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52D89660543; Thu, 5 Aug 2021 09:25:52 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWh14G8z4nFQ; Thu, 5 Aug 2021 09:25:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09D3C17BDD; Thu, 5 Aug 2021 09:25:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PpVc006712; Thu, 5 Aug 2021 09:25:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PpMZ006711; Thu, 5 Aug 2021 09:25:51 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:51 GMT Message-Id: <202108050925.1759PpMZ006711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: b7440d235e5d - stable/13 - Don't build lldb-tablegen if MK_LLDB=no MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b7440d235e5d5abba30d67fc59d822b190e6d267 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:52 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=b7440d235e5d5abba30d67fc59d822b190e6d267 commit b7440d235e5d5abba30d67fc59d822b190e6d267 Author: Alex Richardson AuthorDate: 2021-07-05 17:36:02 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:28 +0000 Don't build lldb-tablegen if MK_LLDB=no Split out from D31060. Reviewed by: emaste (cherry picked from commit c5d1d88a351abe869c436f4f70c85d4c29e6e98c) --- Makefile.inc1 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index a595dfbb76c9..ebc0733de857 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2325,14 +2325,17 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree # We need to build tblgen when we're building clang or lld, either as # bootstrap tools, or as the part of the normal build. .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ - ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" + ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ + ${MK_LLDB} != "no" _clang_tblgen= \ lib/clang/libllvmminimal \ - usr.bin/clang/llvm-tblgen \ - usr.bin/clang/clang-tblgen \ - usr.bin/clang/lldb-tblgen -# XXX: lldb-tblgen is not needed, if top-level MK_LLDB=no - + usr.bin/clang/llvm-tblgen +.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" +_clang_tblgen+= usr.bin/clang/clang-tblgen +.endif +.if ${MK_LLDB} != "no" +_clang_tblgen+= usr.bin/clang/lldb-tblgen +.endif ${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmminimal ${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmminimal ${_bt}-usr.bin/clang/lldb-tblgen: ${_bt}-lib/clang/libllvmminimal From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A45E5660265; Thu, 5 Aug 2021 09:25:53 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWj2JB7z4nLn; Thu, 5 Aug 2021 09:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27A4617CB1; Thu, 5 Aug 2021 09:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759Prfr006736; Thu, 5 Aug 2021 09:25:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Prwk006735; Thu, 5 Aug 2021 09:25:53 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:53 GMT Message-Id: <202108050925.1759Prwk006735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: e2e533bdcc7f - stable/13 - bsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e2e533bdcc7f033fddd9155d126b1f8ddb095e56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:53 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e2e533bdcc7f033fddd9155d126b1f8ddb095e56 commit e2e533bdcc7f033fddd9155d126b1f8ddb095e56 Author: Alex Richardson AuthorDate: 2021-07-20 15:04:56 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:36 +0000 bsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR Recent versions of homebrew's LLD are built with PACKAGE_VENDOR (since https://github.com/Homebrew/homebrew-core/commit/e7c972b6062af753e564104e58d1fa20c0d1ad7a). This means that the -v output is now `Homebrew LLD 12.0.1 (compatible with GNU linkers)` and bsd.linker.mk no longer detects it as LLD since it only checks whether the first word is LLD. This change allow me to build on macOS again and should unbreak the GitHub actions CI. Reviewed By: imp, uqs MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31224 (cherry picked from commit f8147dad44f1036160a413bb00b4e8b41f7a4a84) --- share/mk/bsd.linker.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk index 344a5b937380..7209d7f173ae 100644 --- a/share/mk/bsd.linker.mk +++ b/share/mk/bsd.linker.mk @@ -69,7 +69,9 @@ _ld_version!= (${${ld}} -v 2>&1 || echo none) | sed -n 1p ${X_}LINKER_TYPE= bfd ${X_}LINKER_FREEBSD_VERSION= 0 _v= ${_ld_version:M[1-9]*.[0-9]*:[1]} -.elif ${_ld_version:[1]} == "LLD" +.elif ${_ld_version:MLLD} +# Strip any leading PACKAGE_VENDOR string (e.g. "Homebrew") +_ld_version:=${_ld_version:[*]:C/^.* LLD /LLD /:[@]} ${X_}LINKER_TYPE= lld _v= ${_ld_version:[2]} .if ${_ld_version:[3]} == "(FreeBSD" From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9B90660703; Thu, 5 Aug 2021 09:25:54 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWk4187z4nNG; Thu, 5 Aug 2021 09:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53B3617CB2; Thu, 5 Aug 2021 09:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PsvN006762; Thu, 5 Aug 2021 09:25:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Ps4T006761; Thu, 5 Aug 2021 09:25:54 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:54 GMT Message-Id: <202108050925.1759Ps4T006761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 85c76b41178c - stable/13 - tools/build: Don't redefine open() for the linux bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 85c76b41178c69ad8262523bc19fe53d69110d92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:55 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=85c76b41178c69ad8262523bc19fe53d69110d92 commit 85c76b41178c69ad8262523bc19fe53d69110d92 Author: Alex Richardson AuthorDate: 2021-08-02 08:45:05 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:45 +0000 tools/build: Don't redefine open() for the linux bootstrap This is needed to bootstrap llvm-tblgen on Linux since LLVM calls `::open(...)` which does not work if open is a statement macro. Also stop defining O_SHLOCK/O_EXLOCK and update the only bootstrap tools user of those flags to deal with missing definitions. Reviewed By: jrtc27 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31226 (cherry picked from commit 5f6c8ce2452da2da233e37bf4c2b6fccde8594b1) --- lib/libc/db/db/db.c | 6 ++++++ tools/build/cross-build/include/linux/fcntl.h | 25 ++++--------------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c index a9a5b060da62..7158cc80e44e 100644 --- a/lib/libc/db/db/db.c +++ b/lib/libc/db/db/db.c @@ -49,6 +49,12 @@ static int __dberr(void); #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif +#ifndef O_EXLOCK +#define O_EXLOCK 0 +#endif +#ifndef O_SHLOCK +#define O_SHLOCK 0 +#endif DB * dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo) diff --git a/tools/build/cross-build/include/linux/fcntl.h b/tools/build/cross-build/include/linux/fcntl.h index 94662befddad..4fa169d4ed4c 100644 --- a/tools/build/cross-build/include/linux/fcntl.h +++ b/tools/build/cross-build/include/linux/fcntl.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018-2020 Alex Richardson + * Copyright 2018-2021 Alex Richardson * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and @@ -12,6 +12,9 @@ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * + * This work was supported by Innovate UK project 105694, "Digital Security by + * Design (DSbD) Technology Platform Prototype". + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -37,29 +40,9 @@ */ #pragma once - /* includes which contains a member __unused */ #include "__unused_workaround_start.h" #include_next #include "__unused_workaround_end.h" -#ifdef __unused_undefd -#undef __unused_undefd -#define __unused __attribute__((unused)) -#endif - #include - -#ifndef O_EXLOCK -#define O_EXLOCK (1 << 30) -#endif -#ifndef O_SHLOCK -#define O_SHLOCK (1 << 31) -#endif - -#undef open -#define open(path, flags, ...) ({ \ - int __fd = (open)(path, flags, ##__VA_ARGS__); \ - if (flags & O_EXLOCK) flock(__fd, LOCK_EX); \ - if (flags & O_SHLOCK) flock(__fd, LOCK_SH); \ - __fd; }) From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 332F066070D; Thu, 5 Aug 2021 09:25:56 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWm0Yk7z4nYV; Thu, 5 Aug 2021 09:25:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 962AB17F45; Thu, 5 Aug 2021 09:25:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PtBW006786; Thu, 5 Aug 2021 09:25:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759Pt8P006785; Thu, 5 Aug 2021 09:25:55 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:55 GMT Message-Id: <202108050925.1759Pt8P006785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 1d7c196d119d - stable/13 - Remove mkcsmapper_static and mkesdb_static from build-tools MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1d7c196d119dcb5571ec4dff91d95327d1b5c91b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:56 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=1d7c196d119dcb5571ec4dff91d95327d1b5c91b commit 1d7c196d119dcb5571ec4dff91d95327d1b5c91b Author: Alex Richardson AuthorDate: 2021-08-02 09:49:01 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:00:56 +0000 Remove mkcsmapper_static and mkesdb_static from build-tools Build them as part of the bootstrap-tools phase instead. Reviewed by: emaste (no objections) Differential Revision: https://reviews.freebsd.org/D28181 (cherry picked from commit 2de949cf85d0e0b9ff71e1ffd74153814de96175) --- Makefile.inc1 | 9 +++++++-- share/i18n/csmapper/Makefile.inc | 6 ++---- share/i18n/csmapper/Makefile.part | 2 -- share/i18n/esdb/Makefile.inc | 6 ++---- share/i18n/esdb/Makefile.part | 2 -- targets/pseudo/hosttools/Makefile.depend.host | 4 ++-- usr.bin/Makefile | 6 ------ usr.bin/mkcsmapper/Makefile | 6 ++++++ usr.bin/mkcsmapper_static/Makefile.depend | 19 ------------------- usr.bin/mkesdb/Makefile | 6 ++++++ usr.bin/mkesdb_static/Makefile.depend | 19 ------------------- 11 files changed, 25 insertions(+), 60 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index ebc0733de857..8b417eaaac05 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2346,6 +2346,11 @@ _localedef= usr.bin/localedef ${_bt}-usr.bin/localedef: ${_bt}-usr.bin/yacc ${_bt_lex_depend} .endif +.if ${MK_ICONV} != "no" +_mkesdb= usr.bin/mkesdb +_mkcsmapper= usr.bin/mkcsmapper +.endif + .if ${MK_KERBEROS} != "no" _kerberos5_bootstrap_tools= \ kerberos5/tools/make-roken \ @@ -2497,6 +2502,8 @@ bootstrap-tools: ${_bt}-links .PHONY ${_nmtree} \ ${_vtfontcvt} \ ${_localedef} \ + ${_mkcsmapper} \ + ${_mkesdb} \ ${LOCAL_BSTOOL_DIRS} ${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ @@ -2558,8 +2565,6 @@ _bt_clean= ${CLEANDIR} ${_share} \ usr.bin/awk \ ${_libmagic} \ - usr.bin/mkesdb_static \ - usr.bin/mkcsmapper_static \ usr.bin/vi/catalog build-tools_${_tool}: .PHONY ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \ diff --git a/share/i18n/csmapper/Makefile.inc b/share/i18n/csmapper/Makefile.inc index 284900c1bc05..72473764f313 100644 --- a/share/i18n/csmapper/Makefile.inc +++ b/share/i18n/csmapper/Makefile.inc @@ -3,7 +3,5 @@ .include CSMAPPERDIR?= /usr/share/i18n/csmapper -.if ${MK_STAGING} == "yes" -MKCSMAPPER= ${STAGE_HOST_OBJTOP}/usr/bin/mkcsmapper_static -.endif -MKCSMAPPER?= ${.OBJDIR:H:H:H}/usr.bin/mkcsmapper_static/mkcsmapper_static +# mkcsmapper builds as part of bootstrap-tools and can therefore be found in $PATH +MKCSMAPPER?= mkcsmapper diff --git a/share/i18n/csmapper/Makefile.part b/share/i18n/csmapper/Makefile.part index 4dbb4ff313dd..6b472f815bc6 100644 --- a/share/i18n/csmapper/Makefile.part +++ b/share/i18n/csmapper/Makefile.part @@ -1,8 +1,6 @@ # $FreeBSD$ # $NetBSD: Makefile,v 1.13 2007/03/13 16:34:37 tnozaki Exp $ -MKCSMAPPER?= ${.OBJDIR:H:H:H:H}/usr.bin/mkcsmapper_static/mkcsmapper_static - ESUBDIR?= ${CODE} PARTFILE?= ${.CURDIR}/${CODE}.part .if exists(${PARTFILE}) diff --git a/share/i18n/esdb/Makefile.inc b/share/i18n/esdb/Makefile.inc index ab61d2cee22f..096beeb96a62 100644 --- a/share/i18n/esdb/Makefile.inc +++ b/share/i18n/esdb/Makefile.inc @@ -5,7 +5,5 @@ .PATH: ${.CURDIR} ESDBDIR?= /usr/share/i18n/esdb -.if ${MK_STAGING} == "yes" -MKESDB= ${STAGE_HOST_OBJTOP}/usr/bin/mkesdb_static -.endif -MKESDB?= ${.OBJDIR:H:H:H}/usr.bin/mkesdb_static/mkesdb_static +# mkesdb builds as part of bootstrap-tools and can therefore be found in $PATH +MKESDB?= mkesdb diff --git a/share/i18n/esdb/Makefile.part b/share/i18n/esdb/Makefile.part index 703854e6e527..0378b117a5ca 100644 --- a/share/i18n/esdb/Makefile.part +++ b/share/i18n/esdb/Makefile.part @@ -1,8 +1,6 @@ # $FreeBSD$ # $NetBSD: Makefile.part,v 1.6 2008/10/25 22:35:36 apb Exp $ -MKESDB?= ${.OBJDIR:H:H:H:H}/usr.bin/mkesdb_static/mkesdb_static - PARTFILE?= ${.CURDIR}/${CODE}.part ALIASFILE?= ${.CURDIR}/${CODE}.alias .if !defined(NO_SEP) diff --git a/targets/pseudo/hosttools/Makefile.depend.host b/targets/pseudo/hosttools/Makefile.depend.host index 1def9574156b..3d6ab127eec9 100644 --- a/targets/pseudo/hosttools/Makefile.depend.host +++ b/targets/pseudo/hosttools/Makefile.depend.host @@ -12,8 +12,8 @@ DIRDEPS = \ usr.bin/clang/clang-tblgen \ usr.bin/clang/llvm-tblgen \ usr.bin/localedef \ - usr.bin/mkcsmapper_static \ - usr.bin/mkesdb_static \ + usr.bin/mkcsmapper \ + usr.bin/mkesdb \ usr.bin/xinstall \ usr.bin/yacc \ usr.sbin/config \ diff --git a/usr.bin/Makefile b/usr.bin/Makefile index fcc406d2efc5..9b38cc2512b7 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -287,12 +287,6 @@ SUBDIR.${MK_SVN}+= svn SUBDIR.${MK_SVNLITE}+= svn SUBDIR.${MK_OFED}+= ofed -# These are normally only handled for build-tools. -.if make(clean*) -SUBDIR+= mkcsmapper_static -SUBDIR+= mkesdb_static -.endif - .include SUBDIR_PARALLEL= diff --git a/usr.bin/mkcsmapper/Makefile b/usr.bin/mkcsmapper/Makefile index 5d5e8b560bbf..eda8f96bf153 100644 --- a/usr.bin/mkcsmapper/Makefile +++ b/usr.bin/mkcsmapper/Makefile @@ -3,6 +3,12 @@ .PATH: ${SRCTOP}/lib/libc/iconv PROG= mkcsmapper +.if defined(BOOTSTRAPPING) +# When bootstrapping, the host libc might not contain these expected symbols +# so compile them directly into the binary. +SRCS= citrus_bcs.c citrus_db_factory.c citrus_db_hash.c \ + citrus_lookup_factory.c citrus_pivot_factory.c +.endif LDFLAGS+= -L${SRCTOP}/lib/libc NO_WMISSING_VARIABLE_DECLARATIONS= diff --git a/usr.bin/mkcsmapper_static/Makefile.depend b/usr.bin/mkcsmapper_static/Makefile.depend deleted file mode 100644 index f2071f254a6b..000000000000 --- a/usr.bin/mkcsmapper_static/Makefile.depend +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - usr.bin/yacc.host \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/mkesdb/Makefile b/usr.bin/mkesdb/Makefile index d49ecfa88f63..3540dcc8401a 100644 --- a/usr.bin/mkesdb/Makefile +++ b/usr.bin/mkesdb/Makefile @@ -3,6 +3,12 @@ .PATH: ${SRCTOP}/lib/libc/iconv PROG= mkesdb +.if defined(BOOTSTRAPPING) +# When bootstrapping, the host libc might not contain these expected symbols +# so compile them directly into the binary. +SRCS= citrus_bcs.c citrus_db_factory.c citrus_db_hash.c \ + citrus_lookup_factory.c +.endif NO_WMISSING_VARIABLE_DECLARATIONS= diff --git a/usr.bin/mkesdb_static/Makefile.depend b/usr.bin/mkesdb_static/Makefile.depend deleted file mode 100644 index f2071f254a6b..000000000000 --- a/usr.bin/mkesdb_static/Makefile.depend +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - usr.bin/yacc.host \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 09:25:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BA3166062F; Thu, 5 Aug 2021 09:25:57 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgNWm6m4Dz4nNN; Thu, 5 Aug 2021 09:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7C2E17BDE; Thu, 5 Aug 2021 09:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1759PuNO006816; Thu, 5 Aug 2021 09:25:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1759PuZP006815; Thu, 5 Aug 2021 09:25:56 GMT (envelope-from git) Date: Thu, 5 Aug 2021 09:25:56 GMT Message-Id: <202108050925.1759PuZP006815@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: c65dab7dd245 - stable/13 - Allow bootstrapping llvm-tblgen on macOS and Linux MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c65dab7dd2454036aa60467780daa60474f01714 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 09:25:57 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c65dab7dd2454036aa60467780daa60474f01714 commit c65dab7dd2454036aa60467780daa60474f01714 Author: Alex Richardson AuthorDate: 2021-08-02 13:36:03 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 09:01:08 +0000 Allow bootstrapping llvm-tblgen on macOS and Linux This is needed in order to build various LLVM binutils (e.g. addr2line) as well as clang/lld/lldb. Co-authored-by: Jessica Clarke Test Plan: Compiles on ubuntu 18.04 and macOS 11.4 Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D31057 (cherry picked from commit 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3) --- contrib/llvm-project/lld/tools/lld/lld.cpp | 3 +- lib/clang/include/llvm/Config/config.h | 58 +++++++++++++++++++--- lib/clang/libllvm/Makefile | 3 +- lib/clang/llvm.build.mk | 12 +++++ share/mk/src.opts.mk | 8 --- .../build/cross-build/include/common/sys/sysctl.h | 6 +++ tools/build/make.py | 4 ++ usr.bin/clang/clang.prog.mk | 2 + usr.bin/clang/lld/Makefile | 2 + usr.bin/clang/llvm.prog.mk | 2 + 10 files changed, 83 insertions(+), 17 deletions(-) diff --git a/contrib/llvm-project/lld/tools/lld/lld.cpp b/contrib/llvm-project/lld/tools/lld/lld.cpp index d30362ba7826..8827a883ceb6 100644 --- a/contrib/llvm-project/lld/tools/lld/lld.cpp +++ b/contrib/llvm-project/lld/tools/lld/lld.cpp @@ -146,7 +146,8 @@ static Flavor parseFlavor(std::vector &v) { static int lldMain(int argc, const char **argv, llvm::raw_ostream &stdoutOS, llvm::raw_ostream &stderrOS, bool exitEarly = true) { std::vector args(argv, argv + argc); -#ifdef __FreeBSD__ +#if 1 + /* On FreeBSD we only build the ELF linker. */ return !elf::link(args, exitEarly, stdoutOS, stderrOS); #else switch (parseFlavor(args)) { diff --git a/lib/clang/include/llvm/Config/config.h b/lib/clang/include/llvm/Config/config.h index 0cd6dabeab17..35ce8c189d2b 100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@ -29,7 +29,11 @@ /* #undef HAVE_CRASHREPORTERCLIENT_H */ /* can use __crashreporter_info__ */ +#if defined(__APPLE__) +#define HAVE_CRASHREPORTER_INFO 1 +#else #define HAVE_CRASHREPORTER_INFO 0 +#endif /* Define to 1 if you have the declaration of `arc4random', and to 0 if you don't. */ @@ -125,28 +129,46 @@ #define HAVE_PTHREAD_SETNAME_NP 1 /* Define to 1 if you have the header file. */ +#if __has_include() #define HAVE_LINK_H 1 +#else +#define HAVE_LINK_H 0 +#endif /* Define to 1 if you have the `lseek64' function. */ -/* #undef HAVE_LSEEK64 */ +#if defined(__linux__) +#define HAVE_LSEEK64 1 +#endif /* Define to 1 if you have the header file. */ -/* #undef HAVE_MACH_MACH_H */ +#if __has_include() +#define HAVE_MACH_MACH_H 1 +#endif /* Define to 1 if you have the `mallctl' function. */ +#if defined(__FreeBSD__) #define HAVE_MALLCTL 1 +#endif /* Define to 1 if you have the `mallinfo' function. */ -/* #undef HAVE_MALLINFO */ +#if defined(__linux__) +#define HAVE_MALLINFO 1 +#endif /* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_MALLOC_H */ +#if __has_include() +#define HAVE_MALLOC_MALLOC_H 1 +#endif /* Define to 1 if you have the `malloc_zone_statistics' function. */ -/* #undef HAVE_MALLOC_ZONE_STATISTICS */ +#if defined(__APPLE__) +#define HAVE_MALLOC_ZONE_STATISTICS 1 +#endif /* Define to 1 if you have the `posix_fallocate' function. */ +#if !defined(__APPLE__) #define HAVE_POSIX_FALLOCATE 1 +#endif /* Define to 1 if you have the `posix_spawn' function. */ #define HAVE_POSIX_SPAWN 1 @@ -209,19 +231,31 @@ #define HAVE_SYS_TIME_H 1 /* Define to 1 if stat struct has st_mtimespec member .*/ +#if !defined(__linux__) #define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#endif /* Define to 1 if stat struct has st_mtim member. */ +#if !defined(__APPLE__) #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 +#endif /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define if the setupterm() function is supported this platform. */ +#if defined(__FreeBSD__) +/* + * This is only needed for terminalHasColors(). When disabled LLVM falls back + * to checking a list of TERM prefixes which is sufficient for a bootstrap tool. + */ #define LLVM_ENABLE_TERMINFO 1 +#endif /* Define if the xar_open() function is supported this platform. */ -/* #undef HAVE_LIBXAR */ +#if defined(__APPLE__) +#define HAVE_LIBXAR +#endif /* Define to 1 if you have the header file. */ #define HAVE_TERMIOS_H 1 @@ -239,7 +273,9 @@ /* #undef HAVE__CHSIZE_S */ /* Define to 1 if you have the `_Unwind_Backtrace' function. */ -/* #undef HAVE__UNWIND_BACKTRACE */ +#if !defined(__FreeBSD__) +#define HAVE__UNWIND_BACKTRACE 1 +#endif /* Have host's __alloca */ /* #undef HAVE___ALLOCA */ @@ -315,7 +351,11 @@ /* #undef LLVM_LIBXML2_ENABLED */ /* Define to the extension used for shared libraries, say, ".so". */ +#if defined(__APPLE__) +#define LTDL_SHLIB_EXT ".dylib" +#else #define LTDL_SHLIB_EXT ".so" +#endif /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "https://bugs.freebsd.org/submit/" @@ -351,6 +391,10 @@ /* #undef LLVM_GISEL_COV_PREFIX */ /* Whether Timers signpost passes in Xcode Instruments */ +#if defined(__APPLE__) +#define LLVM_SUPPORT_XCODE_SIGNPOSTS 1 +#else #define LLVM_SUPPORT_XCODE_SIGNPOSTS 0 +#endif #endif diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index 85440f467a18..09d6336c01d9 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -717,7 +717,8 @@ SRCS_EXL+= LTO/LTOModule.cpp SRCS_EXL+= LTO/SummaryBasedOptimizations.cpp SRCS_EXL+= LTO/ThinLTOCodeGenerator.cpp SRCS_MIN+= LTO/UpdateCompilerUsed.cpp -SRCS_MIN+= LineEditor/LineEditor.cpp +# Only needed for clangd/clang-query, uncomment once we build those. +# SRCS_XDW+= LineEditor/LineEditor.cpp SRCS_MIN+= Linker/IRMover.cpp SRCS_MIN+= Linker/LinkModules.cpp SRCS_MIN+= MC/ConstantPools.cpp diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index ef271e85bf3f..adb2300541f6 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -100,12 +100,24 @@ CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections +.if ${LINKER_TYPE} == "mac" +LDFLAGS+= -Wl,-dead_strip +.else LDFLAGS+= -Wl,--gc-sections +.endif CXXSTD?= c++14 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) +# Building on macOS/Linux needs the real sysctl() not the bootstrap tools stub. +CFLAGS+= -DBOOTSTRAPPING_WANT_NATIVE_SYSCTL +.else CXXFLAGS.clang+= -stdlib=libc++ +.endif +.if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux" +LIBADD+= dl +.endif .if ${MACHINE_ARCH:Mmips64} STATIC_CFLAGS+= -mxgot diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 7c64d54e39f3..77c60aef0bc4 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -358,14 +358,6 @@ __DEFAULT_YES_OPTIONS+=OPENMP __DEFAULT_NO_OPTIONS+=OPENMP .endif -.if ${.MAKE.OS} != "FreeBSD" -# Building the target compiler requires building tablegen on the host -# which is (currently) not possible on non-FreeBSD. -BROKEN_OPTIONS+=CLANG LLD LLDB -# The same also applies to the bootstrap LLVM. -BROKEN_OPTIONS+=CLANG_BOOTSTRAP LLD_BOOTSTRAP -.endif - .include # diff --git a/tools/build/cross-build/include/common/sys/sysctl.h b/tools/build/cross-build/include/common/sys/sysctl.h index 856f6be23421..6d6f5438c557 100644 --- a/tools/build/cross-build/include/common/sys/sysctl.h +++ b/tools/build/cross-build/include/common/sys/sysctl.h @@ -37,6 +37,11 @@ */ #pragma once +#ifdef BOOTSTRAPPING_WANT_NATIVE_SYSCTL +/* We need the real sysctl.h e.g. when bootstrapping the LLVM tools. */ +#include_next +#else +/* Otherwise, avoid sysctls since they might not be supported on the host. */ #include #define sysctlbyname __freebsd_sysctlbyname @@ -44,3 +49,4 @@ int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); int sysctlbyname(const char *, void *, size_t *, const void *, size_t); +#endif diff --git a/tools/build/make.py b/tools/build/make.py index 0cf831a3c966..799ea89b74b3 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -166,6 +166,9 @@ if __name__ == "__main__": "needed if CC/CPP/CXX are not set). ") parser.add_argument("--debug", action="store_true", help="Print information on inferred env vars") + parser.add_argument("--bootstrap-toolchain", action="store_true", + help="Bootstrap the toolchain instead of using an " + "external one (experimental and not recommended)") parser.add_argument("--clean", action="store_true", help="Do a clean rebuild instead of building with " "-DWITHOUT_CLEAN") @@ -195,6 +198,7 @@ if __name__ == "__main__": if "universe" not in sys.argv and "tinderbox" not in sys.argv: sys.exit("TARGET= and TARGET_ARCH= must be set explicitly " "when building on non-FreeBSD") + if not parsed_args.bootstrap_toolchain: # infer values for CC/CXX/CPP if parsed_args.host_compiler_type == "gcc": default_cc, default_cxx, default_cpp = ("gcc", "g++", "cpp") diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk index de5cceac7c6b..d0ed6b8587c5 100644 --- a/usr.bin/clang/clang.prog.mk +++ b/usr.bin/clang/clang.prog.mk @@ -17,8 +17,10 @@ LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a PACKAGE= clang +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread .include diff --git a/usr.bin/clang/lld/Makefile b/usr.bin/clang/lld/Makefile index 3593a4006ba2..8e95ccc07f04 100644 --- a/usr.bin/clang/lld/Makefile +++ b/usr.bin/clang/lld/Makefile @@ -102,8 +102,10 @@ TGHDRS+= ${INCFILE} DPSRCS+= ${TGHDRS} CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread LIBADD+= z diff --git a/usr.bin/clang/llvm.prog.mk b/usr.bin/clang/llvm.prog.mk index 58fd3eedd113..56698c4138d3 100644 --- a/usr.bin/clang/llvm.prog.mk +++ b/usr.bin/clang/llvm.prog.mk @@ -22,8 +22,10 @@ LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a PACKAGE= clang +.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) LIBADD+= execinfo LIBADD+= ncursesw +.endif LIBADD+= pthread .include From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 10:45:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 803026615D3; Thu, 5 Aug 2021 10:45:53 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgQJ12vhvz4ssb; Thu, 5 Aug 2021 10:45:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 486D118DA4; Thu, 5 Aug 2021 10:45:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 175AjrL9013267; Thu, 5 Aug 2021 10:45:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175AjrX2013266; Thu, 5 Aug 2021 10:45:53 GMT (envelope-from git) Date: Thu, 5 Aug 2021 10:45:53 GMT Message-Id: <202108051045.175AjrX2013266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 7809becb4ea6 - stable/13 - Add missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7809becb4ea614b1a978cd60e7ce7b68d459391b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 10:45:53 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7809becb4ea614b1a978cd60e7ce7b68d459391b commit 7809becb4ea614b1a978cd60e7ce7b68d459391b Author: Alex Richardson AuthorDate: 2021-08-02 15:38:39 +0000 Commit: Alex Richardson CommitDate: 2021-08-05 10:45:33 +0000 Add missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 This is needed for -DWITH_CLEAN builds since the cleandir phase does not include bsd.linker.mk from bsd.compiler.mk (cherry picked from commit 9f1db6c5557bd01734ee63afacaf07a37fb3cc60) --- lib/clang/llvm.build.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index adb2300541f6..a909cd8e2c05 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -100,6 +100,7 @@ CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections +.include "bsd.linker.mk" .if ${LINKER_TYPE} == "mac" LDFLAGS+= -Wl,-dead_strip .else From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 12:45:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2AF8662CE5; Thu, 5 Aug 2021 12:45:30 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgSy26JXJz50yQ; Thu, 5 Aug 2021 12:45:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C01521A7B2; Thu, 5 Aug 2021 12:45:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 175CjUrv072911; Thu, 5 Aug 2021 12:45:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175CjUTE072910; Thu, 5 Aug 2021 12:45:30 GMT (envelope-from git) Date: Thu, 5 Aug 2021 12:45:30 GMT Message-Id: <202108051245.175CjUTE072910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d88815784447 - stable/13 - libc/locale: Use O_CLOEXEC when opening locale tables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d88815784447d24216bafeefa973da4e0ae5db14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 12:45:31 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d88815784447d24216bafeefa973da4e0ae5db14 commit d88815784447d24216bafeefa973da4e0ae5db14 Author: Mark Johnston AuthorDate: 2021-07-29 13:14:50 +0000 Commit: Mark Johnston CommitDate: 2021-08-05 12:45:22 +0000 libc/locale: Use O_CLOEXEC when opening locale tables Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 98bfb9dac28585fb5629c5fc951ce0d83490d446) --- lib/libc/locale/collate.c | 2 +- lib/libc/locale/rune.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c index c992d2299ab7..7afb2043e6a4 100644 --- a/lib/libc/locale/collate.c +++ b/lib/libc/locale/collate.c @@ -131,7 +131,7 @@ __collate_load_tables_l(const char *encoding, struct xlocale_collate *table) if (asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding) == -1) return (_LDP_ERROR); - if ((fd = _open(buf, O_RDONLY)) < 0) { + if ((fd = _open(buf, O_RDONLY | O_CLOEXEC)) < 0) { free(buf); return (_LDP_ERROR); } diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c index b7334636f654..ce2095763eba 100644 --- a/lib/libc/locale/rune.c +++ b/lib/libc/locale/rune.c @@ -74,7 +74,7 @@ _Read_RuneMagi(const char *fname) int runetype_ext_len = 0; int fd; - if ((fd = _open(fname, O_RDONLY)) < 0) { + if ((fd = _open(fname, O_RDONLY | O_CLOEXEC)) < 0) { errno = EINVAL; return (NULL); } From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 22:24:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E231866B2DE; Thu, 5 Aug 2021 22:24:35 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgjpC5YBZz4bYS; Thu, 5 Aug 2021 22:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A765E21F56; Thu, 5 Aug 2021 22:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 175MOZvb054508; Thu, 5 Aug 2021 22:24:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175MOZSd054507; Thu, 5 Aug 2021 22:24:35 GMT (envelope-from git) Date: Thu, 5 Aug 2021 22:24:35 GMT Message-Id: <202108052224.175MOZSd054507@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 18ea5bc166c1 - stable/13 - virtio: enable VTNET_LEGACY_TX when ALTQ is enabled. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 18ea5bc166c1e908e24b8d2e13f5d1b36acc6742 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 22:24:36 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=18ea5bc166c1e908e24b8d2e13f5d1b36acc6742 commit 18ea5bc166c1e908e24b8d2e13f5d1b36acc6742 Author: Luiz Otavio O Souza AuthorDate: 2017-10-26 02:30:54 +0000 Commit: Kristof Provost CommitDate: 2021-08-05 20:04:04 +0000 virtio: enable VTNET_LEGACY_TX when ALTQ is enabled. ALTQ only works on network drivers which use if_start (rather than if_transmit). vtnet uses if_start if built with VTNET_LEGACY_TX. Default to that the kernel is built with ALTQ enabled, to reduce user surprise. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5afe81a7b23afd27289ca40e04a6a764134d6273) --- sys/dev/virtio/network/if_vtnetvar.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 55e8a7267499..3f36ff3c1ca4 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -31,6 +31,10 @@ #ifndef _IF_VTNETVAR_H #define _IF_VTNETVAR_H +#ifdef ALTQ +#define VTNET_LEGACY_TX +#endif + struct vtnet_softc; struct vtnet_statistics { From owner-dev-commits-src-branches@freebsd.org Thu Aug 5 22:24:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27D4866B7F7; Thu, 5 Aug 2021 22:24:37 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GgjpF0dhzz4bFq; Thu, 5 Aug 2021 22:24:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3229224C6; Thu, 5 Aug 2021 22:24:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 175MOaDB054625; Thu, 5 Aug 2021 22:24:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 175MOaIr054624; Thu, 5 Aug 2021 22:24:36 GMT (envelope-from git) Date: Thu, 5 Aug 2021 22:24:36 GMT Message-Id: <202108052224.175MOaIr054624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 973304077ff8 - stable/12 - virtio: enable VTNET_LEGACY_TX when ALTQ is enabled. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 973304077ff865a6ebeb55aa1d38f8d44b7dc3b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 22:24:37 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=973304077ff865a6ebeb55aa1d38f8d44b7dc3b4 commit 973304077ff865a6ebeb55aa1d38f8d44b7dc3b4 Author: Luiz Otavio O Souza AuthorDate: 2017-10-26 02:30:54 +0000 Commit: Kristof Provost CommitDate: 2021-08-05 20:05:26 +0000 virtio: enable VTNET_LEGACY_TX when ALTQ is enabled. ALTQ only works on network drivers which use if_start (rather than if_transmit). vtnet uses if_start if built with VTNET_LEGACY_TX. Default to that the kernel is built with ALTQ enabled, to reduce user surprise. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5afe81a7b23afd27289ca40e04a6a764134d6273) --- sys/dev/virtio/network/if_vtnetvar.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 4498ad534517..39f5c85d11be 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -31,6 +31,10 @@ #ifndef _IF_VTNETVAR_H #define _IF_VTNETVAR_H +#ifdef ALTQ +#define VTNET_LEGACY_TX +#endif + struct vtnet_softc; struct vtnet_statistics { From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 00:49:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D634B66D261; Fri, 6 Aug 2021 00:49:25 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggn1K5R4pz4l8F; Fri, 6 Aug 2021 00:49:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EA122448A; Fri, 6 Aug 2021 00:49:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1760nPIS041492; Fri, 6 Aug 2021 00:49:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1760nPNo041491; Fri, 6 Aug 2021 00:49:25 GMT (envelope-from git) Date: Fri, 6 Aug 2021 00:49:25 GMT Message-Id: <202108060049.1760nPNo041491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: ec2942baf536 - stable/12 - Fortuna: Clean up reseeding key material to closer match FS&K MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ec2942baf536cde8298febc1787b7bf4ff97cd27 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 00:49:25 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=ec2942baf536cde8298febc1787b7bf4ff97cd27 commit ec2942baf536cde8298febc1787b7bf4ff97cd27 Author: Conrad Meyer AuthorDate: 2018-10-20 19:44:59 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 00:27:56 +0000 Fortuna: Clean up reseeding key material to closer match FS&K When reseeding, only incorporate actual key material. Do not include e.g. the derived key schedules or other AES context. I don't think the extra material was harmful here, just not beneficial. Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16934 (cherry picked from commit 90545403e9d293efb0b843a75ad02361eadaae6d) --- sys/dev/random/fortuna.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index c20cea2f21ae..d203c2f138a1 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -285,7 +285,8 @@ random_fortuna_reseed_internal(uint32_t *entropy_data, u_int blockcount) */ randomdev_hash_init(&context); randomdev_hash_iterate(&context, zero_region, RANDOM_ZERO_BLOCKSIZE); - randomdev_hash_iterate(&context, &fortuna_state.fs_key, sizeof(fortuna_state.fs_key)); + randomdev_hash_iterate(&context, &fortuna_state.fs_key.key.keyMaterial, + fortuna_state.fs_key.key.keyLen / 8); randomdev_hash_iterate(&context, entropy_data, RANDOM_KEYSIZE*blockcount); randomdev_hash_finish(&context, hash); randomdev_hash_init(&context); From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 00:49:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D26B466D75B; Fri, 6 Aug 2021 00:49:26 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggn1L5dYlz4l8G; Fri, 6 Aug 2021 00:49:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A96F42448B; Fri, 6 Aug 2021 00:49:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1760nQoQ041518; Fri, 6 Aug 2021 00:49:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1760nQlC041517; Fri, 6 Aug 2021 00:49:26 GMT (envelope-from git) Date: Fri, 6 Aug 2021 00:49:26 GMT Message-Id: <202108060049.1760nQlC041517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 2cc41234353f - stable/12 - Fortuna: Add trivial assert to match FS&K definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2cc41234353f4fff0b55984367b60748b67481ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 00:49:26 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=2cc41234353f4fff0b55984367b60748b67481ec commit 2cc41234353f4fff0b55984367b60748b67481ec Author: Conrad Meyer AuthorDate: 2018-10-20 20:12:57 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 00:28:00 +0000 Fortuna: Add trivial assert to match FS&K definition FS&K GenerateBlocks function asserts C (counter) != 0. This should also be true in our implementation. Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16936 (cherry picked from commit 84880efae7040bb55e6f63166f53158135574e3a) --- sys/dev/random/fortuna.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index d203c2f138a1..7b4193b528d4 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -310,6 +310,8 @@ random_fortuna_genblocks(uint8_t *buf, u_int blockcount) u_int i; RANDOM_RESEED_ASSERT_LOCK_OWNED(); + KASSERT(!uint128_is_zero(fortuna_state.fs_counter), ("FS&K: C != 0")); + for (i = 0; i < blockcount; i++) { /*- * FS&K - r = r|E(K,C) From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 00:49:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 385C266D55A; Fri, 6 Aug 2021 00:49:28 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggn1M6j2rz4l1r; Fri, 6 Aug 2021 00:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD67624445; Fri, 6 Aug 2021 00:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1760nRgX041542; Fri, 6 Aug 2021 00:49:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1760nRaP041541; Fri, 6 Aug 2021 00:49:27 GMT (envelope-from git) Date: Fri, 6 Aug 2021 00:49:27 GMT Message-Id: <202108060049.1760nRaP041541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: b00de27cfc8d - stable/12 - Fortuna: trivial static variable cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b00de27cfc8da96f22c6ad3353e492e947001fa3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 00:49:28 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=b00de27cfc8da96f22c6ad3353e492e947001fa3 commit b00de27cfc8da96f22c6ad3353e492e947001fa3 Author: Conrad Meyer AuthorDate: 2018-10-20 20:15:06 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 00:28:01 +0000 Fortuna: trivial static variable cleanup Remove unnecessary use of function-local static variable. 32 bytes is small enough to live on the stack. Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16937 (cherry picked from commit 494dda455cd1dad0277a35e292735243f92ec10a) --- sys/dev/random/fortuna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 7b4193b528d4..6382d47b1415 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -333,7 +333,7 @@ random_fortuna_genblocks(uint8_t *buf, u_int blockcount) static __inline void random_fortuna_genrandom(uint8_t *buf, u_int bytecount) { - static uint8_t temp[RANDOM_BLOCKSIZE*(RANDOM_KEYS_PER_BLOCK)]; + uint8_t temp[RANDOM_BLOCKSIZE * RANDOM_KEYS_PER_BLOCK]; u_int blockcount; RANDOM_RESEED_ASSERT_LOCK_OWNED(); From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 05:13:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95A23670435; Fri, 6 Aug 2021 05:13:32 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggtt43Z3Sz3GY9; Fri, 6 Aug 2021 05:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6311C27C36; Fri, 6 Aug 2021 05:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1765DWOJ000869; Fri, 6 Aug 2021 05:13:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DW3I000868; Fri, 6 Aug 2021 05:13:32 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:32 GMT Message-Id: <202108060513.1765DW3I000868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: ba2f52819c51 - stable/12 - Fortuna: Fix a race to prevent reseed spamming MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ba2f52819c51853ce9f158878f13da736718fad2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:32 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=ba2f52819c51853ce9f158878f13da736718fad2 commit ba2f52819c51853ce9f158878f13da736718fad2 Author: Conrad Meyer AuthorDate: 2018-10-20 21:09:12 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:00 +0000 Fortuna: Fix a race to prevent reseed spamming If multiple threads enter fortuna_pre_read contemporaneously, such as via read(2) or getrandom(2), they could race to check how long it has been since the last update due to a TOCTOU problem with 'now'. Here is an example problematic execution: Thread A: Thread B: now_A = getsbinuptime(); now_B = getsbinuptime(); // now_B > now_A RANDOM_RESEED_LOCK(); if (now - fs_lasttime > SBT_1S/10) { fs_lasttime = now; ... // reseed } RANDOM_RESEED_UNLOCK(); RANDOM_RESEED_LOCK(); if (now_A - fs_lasttime > SBT_1S/10) // now_A - fs_lasttime underflows fs_lasttime = now_A; ... // reseed again, despite less than 100ms elapsing } RANDOM_RESEED_UNLOCK(); To resolve the race, simply check the current time after we win the lock race. If getsbinuptime is perceived to be expensive, another option might be to just accept the race and validate that fs_lasttime isn't "in the future." (It should be within the last ~2^31 seconds out of ~2^32 seconds representable duration.) Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16984 (cherry picked from commit 5528565a76f5caae336d4f13213108dc1fad4ae0) --- sys/dev/random/fortuna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 6382d47b1415..f9a29fd5a596 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -368,11 +368,11 @@ random_fortuna_pre_read(void) u_int i; KASSERT(fortuna_state.fs_minpoolsize > 0, ("random: Fortuna threshold must be > 0")); + RANDOM_RESEED_LOCK(); #ifdef _KERNEL /* FS&K - Use 'getsbinuptime()' to prevent reseed-spamming. */ now = getsbinuptime(); #endif - RANDOM_RESEED_LOCK(); if (fortuna_state.fs_pool[0].fsp_length >= fortuna_state.fs_minpoolsize #ifdef _KERNEL From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 05:13:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A89F96703B7; Fri, 6 Aug 2021 05:13:33 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggtt54KMvz3GbR; Fri, 6 Aug 2021 05:13:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D76927B30; Fri, 6 Aug 2021 05:13:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1765DXA2000895; Fri, 6 Aug 2021 05:13:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DXJi000894; Fri, 6 Aug 2021 05:13:33 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:33 GMT Message-Id: <202108060513.1765DXJi000894@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 8eb54646dd0e - stable/12 - Fortuna: fix a correctness issue in reseed (fortuna_pre_read) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8eb54646dd0eabd66c70f152b502412c04766fdf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:33 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=8eb54646dd0eabd66c70f152b502412c04766fdf commit 8eb54646dd0eabd66c70f152b502412c04766fdf Author: Conrad Meyer AuthorDate: 2018-10-26 20:55:01 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:05 +0000 Fortuna: fix a correctness issue in reseed (fortuna_pre_read) 'i' counts the number of pools included in the array 's'. Passing 'i+1' to reseed_internal() as the number of blocks in 's' is a bogus overrun of the initialized portion of 's' -- technically UB. I found this via code inspection, referencing §9.5.2 "Pools" of the Fortuna chapter, but I would expect Coverity to notice the same issue. Unfortunately, it doesn't appear to. Reviewed by: markm Approved by: secteam (gordon) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16985 (cherry picked from commit 9a88479843e2314018f66fd2cdad5ae0200393d0) --- sys/dev/random/fortuna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index f9a29fd5a596..0eaffa1de439 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -408,7 +408,7 @@ random_fortuna_pre_read(void) SDT_PROBE2(random, fortuna, event_processor, debug, fortuna_state.fs_reseedcount, fortuna_state.fs_pool); #endif /* FS&K */ - random_fortuna_reseed_internal(s, i < RANDOM_FORTUNA_NPOOLS ? i + 1 : RANDOM_FORTUNA_NPOOLS); + random_fortuna_reseed_internal(s, i); /* Clean up and secure */ explicit_bzero(s, sizeof(s)); explicit_bzero(temp, sizeof(temp)); From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 05:13:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12378670356; Fri, 6 Aug 2021 05:13:35 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggtt670mKz3GYD; Fri, 6 Aug 2021 05:13:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3C8127CA3; Fri, 6 Aug 2021 05:13:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1765DYTL000927; Fri, 6 Aug 2021 05:13:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DY5p000926; Fri, 6 Aug 2021 05:13:34 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:34 GMT Message-Id: <202108060513.1765DY5p000926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 1ae8bd9a7d5a - stable/12 - fortuna: Drop global lock to zero stack variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1ae8bd9a7d5ac1247db21d8f302d3d0513e08702 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:35 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=1ae8bd9a7d5ac1247db21d8f302d3d0513e08702 commit 1ae8bd9a7d5ac1247db21d8f302d3d0513e08702 Author: Conrad Meyer AuthorDate: 2018-10-26 21:00:26 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:10 +0000 fortuna: Drop global lock to zero stack variables Also drop explicit zeroing of hash context -- hash finish() operation is expected to do this. PR: 230877 Suggested by: delphij@ Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16986 (cherry picked from commit 7be4093a844e80a591221e93d03f3daf6a972be3) --- sys/dev/random/fortuna.c | 65 +++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 0eaffa1de439..866899846212 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -374,47 +374,50 @@ random_fortuna_pre_read(void) now = getsbinuptime(); #endif - if (fortuna_state.fs_pool[0].fsp_length >= fortuna_state.fs_minpoolsize + if (fortuna_state.fs_pool[0].fsp_length < fortuna_state.fs_minpoolsize #ifdef _KERNEL /* FS&K - Use 'getsbinuptime()' to prevent reseed-spamming. */ - && (now - fortuna_state.fs_lasttime > SBT_1S/10) + || (now - fortuna_state.fs_lasttime <= SBT_1S/10) #endif ) { + RANDOM_RESEED_UNLOCK(); + return; + } + #ifdef _KERNEL - fortuna_state.fs_lasttime = now; + fortuna_state.fs_lasttime = now; #endif - /* FS&K - ReseedCNT = ReseedCNT + 1 */ - fortuna_state.fs_reseedcount++; - /* s = \epsilon at start */ - for (i = 0; i < RANDOM_FORTUNA_NPOOLS; i++) { - /* FS&K - if Divides(ReseedCnt, 2^i) ... */ - if ((fortuna_state.fs_reseedcount % (1 << i)) == 0) { - /*- - * FS&K - temp = (P_i) - * - P_i = \epsilon - * - s = s|H(temp) - */ - randomdev_hash_finish(&fortuna_state.fs_pool[i].fsp_hash, temp); - randomdev_hash_init(&fortuna_state.fs_pool[i].fsp_hash); - fortuna_state.fs_pool[i].fsp_length = 0; - randomdev_hash_init(&context); - randomdev_hash_iterate(&context, temp, RANDOM_KEYSIZE); - randomdev_hash_finish(&context, s + i*RANDOM_KEYSIZE_WORDS); - } else - break; - } + /* FS&K - ReseedCNT = ReseedCNT + 1 */ + fortuna_state.fs_reseedcount++; + /* s = \epsilon at start */ + for (i = 0; i < RANDOM_FORTUNA_NPOOLS; i++) { + /* FS&K - if Divides(ReseedCnt, 2^i) ... */ + if ((fortuna_state.fs_reseedcount % (1 << i)) == 0) { + /*- + * FS&K - temp = (P_i) + * - P_i = \epsilon + * - s = s|H(temp) + */ + randomdev_hash_finish(&fortuna_state.fs_pool[i].fsp_hash, temp); + randomdev_hash_init(&fortuna_state.fs_pool[i].fsp_hash); + fortuna_state.fs_pool[i].fsp_length = 0; + randomdev_hash_init(&context); + randomdev_hash_iterate(&context, temp, RANDOM_KEYSIZE); + randomdev_hash_finish(&context, s + i*RANDOM_KEYSIZE_WORDS); + } else + break; + } #ifdef _KERNEL - SDT_PROBE2(random, fortuna, event_processor, debug, fortuna_state.fs_reseedcount, fortuna_state.fs_pool); + SDT_PROBE2(random, fortuna, event_processor, debug, fortuna_state.fs_reseedcount, fortuna_state.fs_pool); #endif - /* FS&K */ - random_fortuna_reseed_internal(s, i); - /* Clean up and secure */ - explicit_bzero(s, sizeof(s)); - explicit_bzero(temp, sizeof(temp)); - explicit_bzero(&context, sizeof(context)); - } + /* FS&K */ + random_fortuna_reseed_internal(s, i); RANDOM_RESEED_UNLOCK(); + + /* Clean up and secure */ + explicit_bzero(s, sizeof(s)); + explicit_bzero(temp, sizeof(temp)); } /*- From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 05:13:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A7F3670A00; Fri, 6 Aug 2021 05:13:36 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggtt76S0lz3GRR; Fri, 6 Aug 2021 05:13:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C27CB27CA4; Fri, 6 Aug 2021 05:13:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1765DZ6O000953; Fri, 6 Aug 2021 05:13:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DZgo000952; Fri, 6 Aug 2021 05:13:35 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:35 GMT Message-Id: <202108060513.1765DZgo000952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 17dc7d3add57 - stable/12 - Fortuna: Add failpoints to simulate initial seeding conditions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 17dc7d3add57f8aa3bf5091644fb23d06a5b9c9f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:36 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=17dc7d3add57f8aa3bf5091644fb23d06a5b9c9f commit 17dc7d3add57f8aa3bf5091644fb23d06a5b9c9f Author: Conrad Meyer AuthorDate: 2018-10-26 21:03:57 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:16 +0000 Fortuna: Add failpoints to simulate initial seeding conditions Set debug.fail_point.random_fortuna_pre_read=return(1) and debug.fail_point.random_fortuna_seeded=return(1) to return to unseeded status (sort of). See the Differential URL for more detail. The goal is to reproduce e.g. Lev's recent CURRENT report[1] about failing newfs arc4random(3) usage (fixed in r338542). No functional change when failpoints are not set. [1]: https://lists.freebsd.org/pipermail/freebsd-current/2018-September/071067.html Reported by: lev Reviewed by: delphij, markm Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D17047 (cherry picked from commit 9b8d0fe462b2f3f689cb87fe34bd42c388e23d49) --- sys/dev/random/fortuna.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 866899846212..3a46d527fa9a 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL #include +#include #include #include #include @@ -384,6 +385,18 @@ random_fortuna_pre_read(void) return; } +#ifdef _KERNEL + /* + * When set, pretend we do not have enough entropy to reseed yet. + */ + KFAIL_POINT_CODE(DEBUG_FP, random_fortuna_pre_read, { + if (RETURN_VALUE != 0) { + RANDOM_RESEED_UNLOCK(); + return; + } + }); +#endif + #ifdef _KERNEL fortuna_state.fs_lasttime = now; #endif @@ -442,5 +455,13 @@ bool random_fortuna_seeded(void) { +#ifdef _KERNEL + /* When set, act as if we are not seeded. */ + KFAIL_POINT_CODE(DEBUG_FP, random_fortuna_seeded, { + if (RETURN_VALUE != 0) + fortuna_state.fs_counter = UINT128_ZERO; + }); +#endif + return (!uint128_is_zero(fortuna_state.fs_counter)); } From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 05:13:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA3116703BD; Fri, 6 Aug 2021 05:13:37 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggtt92CQhz3Gbt; Fri, 6 Aug 2021 05:13:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD5F327668; Fri, 6 Aug 2021 05:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1765DavP000977; Fri, 6 Aug 2021 05:13:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1765DaPx000976; Fri, 6 Aug 2021 05:13:36 GMT (envelope-from git) Date: Fri, 6 Aug 2021 05:13:36 GMT Message-Id: <202108060513.1765DaPx000976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: f7c5c21f159f - stable/12 - fortuna: Deduplicate kernel vs user includes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f7c5c21f159ffd535c251a0052b5e8a2bc3b5b67 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 05:13:37 -0000 The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=f7c5c21f159ffd535c251a0052b5e8a2bc3b5b67 commit f7c5c21f159ffd535c251a0052b5e8a2bc3b5b67 Author: Conrad Meyer AuthorDate: 2019-03-01 22:51:45 +0000 Commit: David E. O'Brien CommitDate: 2021-08-06 05:12:21 +0000 fortuna: Deduplicate kernel vs user includes No functional change. Reviewed by: markj, markm Approved by: secteam (delphij), core (brooks) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D19409 (cherry picked from commit e66ccbeaa3613d022dbc07b9f7403c6bfbe40be6) --- sys/dev/random/fortuna.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 3a46d527fa9a..11879831dbbd 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -35,10 +35,10 @@ #include __FBSDID("$FreeBSD$"); +#include #include #ifdef _KERNEL -#include #include #include #include @@ -50,17 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include - -#include -#include - -#include -#include -#include -#include -#include #else /* !_KERNEL */ -#include #include #include #include @@ -69,15 +59,18 @@ __FBSDID("$FreeBSD$"); #include #include "unit_test.h" +#endif /* _KERNEL */ #include #include #include #include +#ifdef _KERNEL +#include +#endif #include #include -#endif /* _KERNEL */ /* Defined in FS&K */ #define RANDOM_FORTUNA_NPOOLS 32 /* The number of accumulation pools */ From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0BC5655D11; Fri, 6 Aug 2021 12:51:12 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh5286H4kz4Yx4; Fri, 6 Aug 2021 12:51:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0B3162FB; Fri, 6 Aug 2021 12:51:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpCsU017025; Fri, 6 Aug 2021 12:51:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpCAf017024; Fri, 6 Aug 2021 12:51:12 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:12 GMT Message-Id: <202108061251.176CpCAf017024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 52ec367e70cf - stable/13 - Use the arm virtual counter in the arm64 loader MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 52ec367e70cf55b5eab799c9887605fb58ae7016 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:13 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=52ec367e70cf55b5eab799c9887605fb58ae7016 commit 52ec367e70cf55b5eab799c9887605fb58ae7016 Author: Andrew Turner AuthorDate: 2021-05-12 07:45:09 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:15 +0000 Use the arm virtual counter in the arm64 loader It exist on all ARMv8+ CPUs, and other boot loaders rely on it being present. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D30410 (cherry picked from commit 0a0d6ce34d6be89cb356c7815648e455fabe3151) --- stand/efi/libefi/Makefile | 5 +-- stand/efi/libefi/time_arm64.c | 72 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/stand/efi/libefi/Makefile b/stand/efi/libefi/Makefile index e838a5a10ac4..88f6d3fa0826 100644 --- a/stand/efi/libefi/Makefile +++ b/stand/efi/libefi/Makefile @@ -27,9 +27,10 @@ SRCS+= teken.c .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCS+= time.c -.elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ - ${MACHINE_CPUARCH} == "riscv" +.elif ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "riscv" SRCS+= time_event.c +.elif ${MACHINE_CPUARCH} == "aarch64" +SRCS+= time_arm64.c .endif # We implement a slightly non-standard %S in that it always takes a diff --git a/stand/efi/libefi/time_arm64.c b/stand/efi/libefi/time_arm64.c new file mode 100644 index 000000000000..baa0f8bfa1ed --- /dev/null +++ b/stand/efi/libefi/time_arm64.c @@ -0,0 +1,72 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Andrew Turner + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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 + +static uint64_t timer_freq; + +void +efi_time_init(void) +{ + /* Find the timer frequency */ + timer_freq = READ_SPECIALREG(cntfrq_el0); +} + +void +efi_time_fini(void) +{ +} + +time_t +time(time_t *tloc) +{ + time_t t; + + t = READ_SPECIALREG(cntvct_el0) / timer_freq; + if (tloc != NULL) + *tloc = t; + + return (t); +} + +time_t +getsecs(void) +{ + return time(NULL); +} From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F0D9655A43; Fri, 6 Aug 2021 12:51:14 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52B0F6fz4YrK; Fri, 6 Aug 2021 12:51:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1E9562FC; Fri, 6 Aug 2021 12:51:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpDQU017053; Fri, 6 Aug 2021 12:51:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpDgh017052; Fri, 6 Aug 2021 12:51:13 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:13 GMT Message-Id: <202108061251.176CpDgh017052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: acab6815aa38 - stable/13 - Use the correct length when copying arm64 vfp registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: acab6815aa389911939fee92f7fe98f1d63b741c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:14 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=acab6815aa389911939fee92f7fe98f1d63b741c commit acab6815aa389911939fee92f7fe98f1d63b741c Author: Andrew Turner AuthorDate: 2021-06-14 11:01:46 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:15 +0000 Use the correct length when copying arm64 vfp registers We passed the wrong length into memcpy in the arm64 get_fpcontext and set_fpcontext. This caused us to copy two status registers we didn't expect to copy. These are safe as they exist in both the source and destination, although in a different order, and we copy the correct values after the memcpy. Obtained from: CheriBSD Sponsored by: Innovate UK (cherry picked from commit e7f369b1c18ca0377bb0b016b4cab3f0de2a74c5) --- sys/arm64/arm64/machdep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 5cc17d2a4612..071bf3e51ab2 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -650,7 +650,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp) KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, ("Non-userspace FPU flags set in get_fpcontext")); memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_fpustate.vfp_regs, - sizeof(mcp->mc_fpregs)); + sizeof(mcp->mc_fpregs.fp_q)); mcp->mc_fpregs.fp_cr = curpcb->pcb_fpustate.vfp_fpcr; mcp->mc_fpregs.fp_sr = curpcb->pcb_fpustate.vfp_fpsr; mcp->mc_fpregs.fp_flags = curpcb->pcb_fpflags; @@ -681,7 +681,7 @@ set_fpcontext(struct thread *td, mcontext_t *mcp) KASSERT(curpcb->pcb_fpusaved == &curpcb->pcb_fpustate, ("Called set_fpcontext while the kernel is using the VFP")); memcpy(curpcb->pcb_fpustate.vfp_regs, mcp->mc_fpregs.fp_q, - sizeof(mcp->mc_fpregs)); + sizeof(mcp->mc_fpregs.fp_q)); curpcb->pcb_fpustate.vfp_fpcr = mcp->mc_fpregs.fp_cr; curpcb->pcb_fpustate.vfp_fpsr = mcp->mc_fpregs.fp_sr; curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK; From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80937655D45; Fri, 6 Aug 2021 12:51:15 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52C2LVFz4YmL; Fri, 6 Aug 2021 12:51:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 253F95DC1; Fri, 6 Aug 2021 12:51:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpErb017077; Fri, 6 Aug 2021 12:51:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpE0L017076; Fri, 6 Aug 2021 12:51:14 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:14 GMT Message-Id: <202108061251.176CpE0L017076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 24a9a22bc7d0 - stable/13 - Add more GIC and GICv3 registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 24a9a22bc7d0f639c0e30a0c8dc9b6eecfda3714 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:15 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=24a9a22bc7d0f639c0e30a0c8dc9b6eecfda3714 commit 24a9a22bc7d0f639c0e30a0c8dc9b6eecfda3714 Author: Andrew Turner AuthorDate: 2021-06-14 12:48:53 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:16 +0000 Add more GIC and GICv3 registers These aren't used by either driver, however they will be needed by bhyve on arm64 to emulate a GICv3 interrupt controller. Sponsored by: Innovate UK (cherry picked from commit 15fa52a56494d050c4b8e1535d98e2fd416f1944) --- sys/arm/arm/gic_common.h | 4 +- sys/arm64/arm64/gic_v3.c | 1 - sys/arm64/arm64/gic_v3_reg.h | 122 +++++++++++++++++++++++++++++++++++-------- 3 files changed, 103 insertions(+), 24 deletions(-) diff --git a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h index 6643496afc38..4289146b0086 100644 --- a/sys/arm/arm/gic_common.h +++ b/sys/arm/arm/gic_common.h @@ -56,6 +56,7 @@ __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); /* Common register values */ #define GICD_CTLR 0x0000 /* v1 ICDDCR */ #define GICD_TYPER 0x0004 /* v1 ICDICTR */ +#define GICD_TYPER_ITLINESNUM_MASK 0x1f #define GICD_TYPER_I_NUM(n) ((((n) & 0x1F) + 1) * 32) #define GICD_IIDR 0x0008 /* v1 ICDIIDR */ #define GICD_IIDR_PROD_SHIFT 24 @@ -82,7 +83,8 @@ __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); #define GICD_ICENABLER(n) (0x0180 + (((n) >> 5) * 4)) /* v1 ICDICER */ #define GICD_ISPENDR(n) (0x0200 + (((n) >> 5) * 4)) /* v1 ICDISPR */ #define GICD_ICPENDR(n) (0x0280 + (((n) >> 5) * 4)) /* v1 ICDICPR */ -#define GICD_ICACTIVER(n) (0x0380 + (((n) >> 5) * 4)) /* v1 ICDABR */ +#define GICD_ISACTIVER(n) (0x0300 + (((n) >> 5) * 4)) /* v1 ICDABR */ +#define GICD_ICACTIVER(n) (0x0380 + (((n) >> 5) * 4)) #define GICD_IPRIORITYR(n) (0x0400 + (((n) >> 2) * 4)) /* v1 ICDIPR */ #define GICD_I_PER_IPRIORITYn 4 #define GICD_ITARGETSR(n) (0x0800 + (((n) >> 2) * 4)) /* v1 ICDIPTR */ diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index 954ed3cd878a..03b6490e7d61 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -1462,7 +1462,6 @@ gic_v3_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc, struct gic_v3_softc *sc = device_get_softc(dev); struct gic_v3_irqsrc *gi = (struct gic_v3_irqsrc *)isrc; -#define GICD_SETSPI_NSR 0x40 *addr = vtophys(rman_get_virtual(sc->gic_dist)) + GICD_SETSPI_NSR; *data = gi->gi_irq; diff --git a/sys/arm64/arm64/gic_v3_reg.h b/sys/arm64/arm64/gic_v3_reg.h index 34082b1bde0a..2ba35ec9dab3 100644 --- a/sys/arm64/arm64/gic_v3_reg.h +++ b/sys/arm64/arm64/gic_v3_reg.h @@ -57,13 +57,33 @@ #define GICD_CTLR_G1A (1 << 1) #define GICD_CTLR_ARE_NS (1 << 4) #define GICD_CTLR_RWP (1 << 31) + /* GICD_TYPER */ +#define GICD_TYPER_SECURITYEXTN (1 << 10) +#define GICD_TYPER_MBIS (1 << 16) +#define GICD_TYPER_LPIS (1 << 17) +#define GICD_TYPER_DVIS (1 << 18) +#define GICD_TYPER_IDBITS_SHIFT 19 #define GICD_TYPER_IDBITS(n) ((((n) >> 19) & 0x1F) + 1) /* * Registers (v3) */ +#define GICD_STATUSR 0x0010 + +#define GICD_SETSPI_NSR 0x0040 +#define GICD_CLRSPI_NSR 0x0048 +#define GICD_SETSPI_SR 0x0050 +#define GICD_CLRSPI_SR 0x0058 +#define GICD_SPI_INTID_MASK 0x3ff + #define GICD_IROUTER(n) (0x6000 + ((n) * 8)) +#define GICD_AFF3 (0xfful << 32) +#define GICD_IROUTER_IRM (1ul << 31) +#define GICD_AFF2 (0xfful << 16) +#define GICD_AFF1 (0xfful << 8) +#define GICD_AFF0 (0xfful << 0) +#define GICD_AFF (GICD_AFF0 | GICD_AFF1 | GICD_AFF1 | GICD_AFF3) #define GICD_PIDR4 0xFFD0 #define GICD_PIDR5 0xFFD4 @@ -73,6 +93,8 @@ #define GICD_PIDR1 0xFFE4 #define GICD_PIDR2 0xFFE8 +#define GICD_SIZE 0x10000 + #define GICR_PIDR2_ARCH_SHIFT 4 #define GICR_PIDR2_ARCH_MASK 0xF0 #define GICR_PIDR2_ARCH(x) \ @@ -82,27 +104,44 @@ #define GICD_PIDR3 0xFFEC -/* Redistributor registers */ -#define GICR_CTLR GICD_CTLR -#define GICR_CTLR_LPI_ENABLE (1 << 0) - -#define GICR_PIDR2 GICD_PIDR2 +/* + * Redistributor registers + */ -#define GICR_TYPER (0x0008) -#define GICR_TYPER_PLPIS (1 << 0) -#define GICR_TYPER_VLPIS (1 << 1) -#define GICR_TYPER_LAST (1 << 4) -#define GICR_TYPER_CPUNUM_SHIFT (8) -#define GICR_TYPER_CPUNUM_MASK (0xFFFUL << GICR_TYPER_CPUNUM_SHIFT) -#define GICR_TYPER_CPUNUM(x) \ +/* RD_base registers */ +#define GICR_CTLR 0x0000 +#define GICR_CTLR_LPI_ENABLE (1 << 0) +#define GICR_CTLR_RWP (1 << 3) +#define GICR_CTLR_DPG0 (1 << 24) +#define GICR_CTLR_DPG1NS (1 << 25) +#define GICR_CTLR_DPG1S (1 << 26) +#define GICR_CTLR_UWP (1 << 31) + +#define GICR_IIDR 0x0004 + +#define GICR_TYPER 0x0008 +#define GICR_TYPER_PLPIS (1 << 0) +#define GICR_TYPER_VLPIS (1 << 1) +#define GICR_TYPER_LAST (1 << 4) +#define GICR_TYPER_CPUNUM_SHIFT (8) +#define GICR_TYPER_CPUNUM_MASK (0xFFFUL << GICR_TYPER_CPUNUM_SHIFT) +#define GICR_TYPER_CPUNUM(x) \ (((x) & GICR_TYPER_CPUNUM_MASK) >> GICR_TYPER_CPUNUM_SHIFT) -#define GICR_TYPER_AFF_SHIFT (32) +#define GICR_TYPER_AFF_SHIFT 32 +#define GICR_TYPER_AFF_MASK (0xfffffffful << GICR_TYPER_AFF_SHIFT) +#define GICR_TYPER_AFF(x) \ + (((x) & GICR_TYPER_AFF_MASK) >> GICR_TYPER_AFF_SHIFT) -#define GICR_WAKER (0x0014) +#define GICR_STATUSR 0x0010 + +#define GICR_WAKER 0x0014 #define GICR_WAKER_PS (1 << 1) /* Processor sleep */ #define GICR_WAKER_CA (1 << 2) /* Children asleep */ -#define GICR_PROPBASER (0x0070) +#define GICR_SETLPIR 0x0040 +#define GICR_CLRLPIR 0x0048 + +#define GICR_PROPBASER 0x0070 #define GICR_PROPBASER_IDBITS_MASK 0x1FUL /* * Cacheability @@ -142,7 +181,11 @@ #define GICR_PROPBASER_SHARE_MASK \ (0x3UL << GICR_PROPBASER_SHARE_SHIFT) -#define GICR_PENDBASER (0x0078) +#define GICR_PROPBASER_OUTER_CACHE_SHIFT 56 +#define GICR_PROPBASER_OUTER_CACHE_MASK \ + (0x7UL << GICR_PROPBASER_OUTER_CACHE_SHIFT) + +#define GICR_PENDBASER 0x0078 /* * Cacheability * 0x0 - Device-nGnRnE @@ -181,12 +224,17 @@ #define GICR_PENDBASER_SHARE_MASK \ (0x3UL << GICR_PENDBASER_SHARE_SHIFT) -/* Re-distributor registers for SGIs and PPIs */ -#define GICR_RD_BASE_SIZE PAGE_SIZE_64K -#define GICR_SGI_BASE_SIZE PAGE_SIZE_64K -#define GICR_VLPI_BASE_SIZE PAGE_SIZE_64K -#define GICR_RESERVED_SIZE PAGE_SIZE_64K +#define GICR_PENDBASER_OUTER_CACHE_SHIFT 56 +#define GICR_PENDBASER_OUTER_CACHE_MASK \ + (0x7UL << GICR_PENDBASER_OUTER_CACHE_SHIFT) + +#define GICR_INVLPIR 0x00a0 +#define GICR_INVALLR 0x00b0 +#define GICR_SYNCR 0x00c0 + +#define GICR_PIDR2 GICD_PIDR2 +/* SGI_base registers */ #define GICR_IGROUPR0 (0x0080) #define GICR_ISENABLER0 (0x0100) #define GICR_ICENABLER0 (0x0180) @@ -195,7 +243,28 @@ #define GICR_I_PER_IPRIORITYn (GICD_I_PER_IPRIORITYn) -/* ITS registers */ +#define GICR_ISPENDR0 0x0200 +#define GICR_ICPENDR0 0x0280 +#define GICR_ISACTIVER0 0x0300 +#define GICR_ICACTIVER0 0x0380 +#define GICR_IPRIORITYR(n) (0x0400 + (((n) >> 2) * 4)) +#define GICR_ICFGR0 0x0c00 +#define GICR_ICFGR1 0x0c04 +#define GICR_IGRPMODR0 0x0d00 +#define GICR_NSACR 0x0e00 + +/* Re-distributor registers for SGIs and PPIs */ +#define GICR_RD_BASE 0 +#define GICR_RD_BASE_SIZE PAGE_SIZE_64K +#define GICR_SGI_BASE (1 * PAGE_SIZE_64K) +#define GICR_SGI_BASE_SIZE PAGE_SIZE_64K +#define GICR_VLPI_BASE (2 * PAGE_SIZE_64K) +#define GICR_VLPI_BASE_SIZE PAGE_SIZE_64K +#define GICR_RESERVED_SIZE PAGE_SIZE_64K + +/* + * ITS registers + */ #define GITS_PIDR2 GICR_PIDR2 #define GITS_PIDR2_ARCH_MASK GICR_PIDR2_ARCH_MASK #define GITS_PIDR2_ARCH_GICv3 GICR_PIDR2_ARCH_GICv3 @@ -266,9 +335,17 @@ #define GITS_CBASER_PA_SHIFT 12 #define GITS_CBASER_PA_MASK (0xFFFFFFFFFUL << GITS_CBASER_PA_SHIFT) +#define GITS_CBASER_SIZE_SHIFT 0 +#define GITS_CBASER_SIZE_MASK (0xFF << GITS_CBASER_SIZE_SHIFT) +#define GITS_CBASER_SIZE(x) \ + (4096 * (((x) & GITS_CBASER_SIZE_MASK) + 1)) #define GITS_CWRITER (0x0088) #define GITS_CREADR (0x0090) +#define GITS_CREADR_STALL 1ul + +#define GITS_CMD_OFFSET(reg) ((reg) & 0xfffe0ul) +#define GITS_CMD_SIZE 0x20 #define GITS_BASER_BASE (0x0100) #define GITS_BASER(x) (GITS_BASER_BASE + (x) * 8) @@ -342,6 +419,7 @@ #define GITS_BASER_NUM 8 #define GITS_TYPER (0x0008) +#define GITS_TYPER_HCC_SHIFT 24 #define GITS_TYPER_PTA (1UL << 19) #define GITS_TYPER_DEVB_SHIFT 13 #define GITS_TYPER_DEVB_MASK (0x1FUL << GITS_TYPER_DEVB_SHIFT) From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D975E655A45; Fri, 6 Aug 2021 12:51:16 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52D21xnz4YrS; Fri, 6 Aug 2021 12:51:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C37F6306; Fri, 6 Aug 2021 12:51:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpG4L017101; Fri, 6 Aug 2021 12:51:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpGDY017100; Fri, 6 Aug 2021 12:51:16 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:16 GMT Message-Id: <202108061251.176CpGDY017100@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 55dbd744b374 - stable/13 - Switch the order of the ID_AA64PFR1_EL1 fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 55dbd744b37410e34410b121d6c0438fcbc3df70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:17 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=55dbd744b37410e34410b121d6c0438fcbc3df70 commit 55dbd744b37410e34410b121d6c0438fcbc3df70 Author: Andrew Turner AuthorDate: 2021-07-01 00:45:39 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:17 +0000 Switch the order of the ID_AA64PFR1_EL1 fields This makes them consistent with the fields in other registers. Sponsored by: The FreeBSD Foundation (cherry picked from commit 244002b48257a8e4d3b4772872981c0d7a467923) --- sys/arm64/arm64/identcpu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 5dc3a91031b6..88d925f8162a 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -901,9 +901,10 @@ static struct mrs_field id_aa64pfr0_fields[] = { /* ID_AA64PFR1_EL1 */ -static struct mrs_field_value id_aa64pfr1_bt[] = { - MRS_FIELD_VALUE(ID_AA64PFR1_BT_NONE, ""), - MRS_FIELD_VALUE(ID_AA64PFR1_BT_IMPL, "BTI"), +static struct mrs_field_value id_aa64pfr1_mte[] = { + MRS_FIELD_VALUE(ID_AA64PFR1_MTE_NONE, ""), + MRS_FIELD_VALUE(ID_AA64PFR1_MTE_IMPL_EL0, "MTE EL0"), + MRS_FIELD_VALUE(ID_AA64PFR1_MTE_IMPL, "MTE"), MRS_FIELD_VALUE_END, }; @@ -914,17 +915,16 @@ static struct mrs_field_value id_aa64pfr1_ssbs[] = { MRS_FIELD_VALUE_END, }; -static struct mrs_field_value id_aa64pfr1_mte[] = { - MRS_FIELD_VALUE(ID_AA64PFR1_MTE_NONE, ""), - MRS_FIELD_VALUE(ID_AA64PFR1_MTE_IMPL_EL0, "MTE EL0"), - MRS_FIELD_VALUE(ID_AA64PFR1_MTE_IMPL, "MTE"), +static struct mrs_field_value id_aa64pfr1_bt[] = { + MRS_FIELD_VALUE(ID_AA64PFR1_BT_NONE, ""), + MRS_FIELD_VALUE(ID_AA64PFR1_BT_IMPL, "BTI"), MRS_FIELD_VALUE_END, }; static struct mrs_field id_aa64pfr1_fields[] = { - MRS_FIELD(ID_AA64PFR1, BT, false, MRS_EXACT, id_aa64pfr1_bt), - MRS_FIELD(ID_AA64PFR1, SSBS, false, MRS_LOWER, id_aa64pfr1_ssbs), MRS_FIELD(ID_AA64PFR1, MTE, false, MRS_EXACT, id_aa64pfr1_mte), + MRS_FIELD(ID_AA64PFR1, SSBS, false, MRS_LOWER, id_aa64pfr1_ssbs), + MRS_FIELD(ID_AA64PFR1, BT, false, MRS_EXACT, id_aa64pfr1_bt), MRS_FIELD_END, }; From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8ADBE655563; Fri, 6 Aug 2021 12:51:17 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52F3VT6z4YpM; Fri, 6 Aug 2021 12:51:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C85261A9; Fri, 6 Aug 2021 12:51:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpHR7017125; Fri, 6 Aug 2021 12:51:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpHk5017124; Fri, 6 Aug 2021 12:51:17 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:17 GMT Message-Id: <202108061251.176CpHk5017124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 7d51b5257a66 - stable/13 - Sync the arm64 special registers with the Armv8.5 XML MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7d51b5257a667476cc9e3471b5bc73b50d103e9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:17 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7d51b5257a667476cc9e3471b5bc73b50d103e9b commit 7d51b5257a667476cc9e3471b5bc73b50d103e9b Author: Andrew Turner AuthorDate: 2021-07-01 01:14:09 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:18 +0000 Sync the arm64 special registers with the Armv8.5 XML Add the missing macros and decode all the fields as described in the Arm Architecture System Registers XML corresponding to Armv8.5. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30983 (cherry picked from commit a7b05eb16c9d84e1fd59864f5da67d23897ed91c) --- sys/arm64/arm64/identcpu.c | 83 +++++++++++++++++++++++++++++++++++++++------- sys/arm64/include/armreg.h | 51 +++++++++++++++++++++++++--- 2 files changed, 117 insertions(+), 17 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 88d925f8162a..2cd5b914ddef 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -304,9 +304,22 @@ static struct mrs_field id_aa64afr1_fields[] = { /* ID_AA64DFR0_EL1 */ +static struct mrs_field_value id_aa64dfr0_tracefilt[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_TraceFilt_NONE, ""), + MRS_FIELD_VALUE(ID_AA64DFR0_TraceFilt_8_4, "Trace v8.4"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_doublelock[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_DoubleLock_IMPL, "DoubleLock"), + MRS_FIELD_VALUE(ID_AA64DFR0_DoubleLock_NONE, ""), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field_value id_aa64dfr0_pmsver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_NONE, ""), - MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_V1, "SPE"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE, "SPE"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE_8_3, "SPE v8.3"), MRS_FIELD_VALUE_END, }; @@ -328,7 +341,9 @@ static struct mrs_field_value id_aa64dfr0_brps[] = { static struct mrs_field_value id_aa64dfr0_pmuver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_NONE, ""), MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3, "PMUv3"), - MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_1, "PMUv3+16 bit evtCount"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_1, "PMUv3 v8.1"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_4, "PMUv3 v8.4"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_5, "PMUv3 v8.5"), MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_IMPL, "IMPL PMU"), MRS_FIELD_VALUE_END, }; @@ -343,10 +358,15 @@ static struct mrs_field_value id_aa64dfr0_debugver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8, "Debugv8"), MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_VHE, "Debugv8_VHE"), MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_2, "Debugv8.2"), + MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_4, "Debugv8.4"), MRS_FIELD_VALUE_END, }; static struct mrs_field id_aa64dfr0_fields[] = { + MRS_FIELD(ID_AA64DFR0, TraceFilt, false, MRS_EXACT, + id_aa64dfr0_tracefilt), + MRS_FIELD(ID_AA64DFR0, DoubleLock, false, MRS_EXACT, + id_aa64dfr0_doublelock), MRS_FIELD(ID_AA64DFR0, PMSVer, false, MRS_EXACT, id_aa64dfr0_pmsver), MRS_FIELD(ID_AA64DFR0, CTX_CMPs, false, MRS_EXACT, id_aa64dfr0_ctx_cmps), @@ -361,7 +381,7 @@ static struct mrs_field id_aa64dfr0_fields[] = { }; -/* ID_AA64DFR1 */ +/* ID_AA64DFR1_EL1 */ static struct mrs_field id_aa64dfr1_fields[] = { MRS_FIELD_END, }; @@ -524,12 +544,16 @@ static struct mrs_field_value id_aa64isar1_jscvt[] = { }; static struct mrs_field_value id_aa64isar1_api[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, API, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_PAC, "API PAC"), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_EPAC, "API EPAC"), MRS_FIELD_VALUE_END, }; static struct mrs_field_value id_aa64isar1_apa[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, APA, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_PAC, "APA PAC"), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_EPAC, "APA EPAC"), MRS_FIELD_VALUE_END, }; @@ -562,8 +586,34 @@ static struct mrs_field id_aa64isar1_fields[] = { /* ID_AA64MMFR0_EL1 */ +static struct mrs_field_value id_aa64mmfr0_exs[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, ExS, ALL, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran4_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_TGran4, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_NONE, "No S2 TGran4"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_IMPL, "S2 TGran4"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran64_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_TGran64, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_NONE, "No S2 TGran64"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_IMPL, "S2 TGran64"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran16_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_TGran16, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_NONE, "No S2 TGran16"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_IMPL, "S2 TGran16"), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field_value id_aa64mmfr0_tgran4[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran4, NONE, IMPL), + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran4,NONE, IMPL), MRS_FIELD_VALUE_END, }; @@ -577,7 +627,7 @@ static struct mrs_field_value id_aa64mmfr0_tgran16[] = { MRS_FIELD_VALUE_END, }; -static struct mrs_field_value id_aa64mmfr0_bigend_el0[] = { +static struct mrs_field_value id_aa64mmfr0_bigendel0[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, BigEndEL0, FIXED, MIXED), MRS_FIELD_VALUE_END, }; @@ -592,7 +642,7 @@ static struct mrs_field_value id_aa64mmfr0_bigend[] = { MRS_FIELD_VALUE_END, }; -static struct mrs_field_value id_aa64mmfr0_asid_bits[] = { +static struct mrs_field_value id_aa64mmfr0_asidbits[] = { MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_8, "8bit ASID"), MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_16, "16bit ASID"), MRS_FIELD_VALUE_END, @@ -610,17 +660,24 @@ static struct mrs_field_value id_aa64mmfr0_parange[] = { }; static struct mrs_field id_aa64mmfr0_fields[] = { + MRS_FIELD(ID_AA64MMFR0, ExS, false, MRS_EXACT, id_aa64mmfr0_exs), + MRS_FIELD(ID_AA64MMFR0, TGran4_2, false, MRS_EXACT, + id_aa64mmfr0_tgran4_2), + MRS_FIELD(ID_AA64MMFR0, TGran64_2, false, MRS_EXACT, + id_aa64mmfr0_tgran64_2), + MRS_FIELD(ID_AA64MMFR0, TGran16_2, false, MRS_EXACT, + id_aa64mmfr0_tgran16_2), MRS_FIELD(ID_AA64MMFR0, TGran4, false, MRS_EXACT, id_aa64mmfr0_tgran4), MRS_FIELD(ID_AA64MMFR0, TGran64, false, MRS_EXACT, id_aa64mmfr0_tgran64), MRS_FIELD(ID_AA64MMFR0, TGran16, false, MRS_EXACT, id_aa64mmfr0_tgran16), MRS_FIELD(ID_AA64MMFR0, BigEndEL0, false, MRS_EXACT, - id_aa64mmfr0_bigend_el0), + id_aa64mmfr0_bigendel0), MRS_FIELD(ID_AA64MMFR0, SNSMem, false, MRS_EXACT, id_aa64mmfr0_snsmem), MRS_FIELD(ID_AA64MMFR0, BigEnd, false, MRS_EXACT, id_aa64mmfr0_bigend), MRS_FIELD(ID_AA64MMFR0, ASIDBits, false, MRS_EXACT, - id_aa64mmfr0_asid_bits), + id_aa64mmfr0_asidbits), MRS_FIELD(ID_AA64MMFR0, PARange, false, MRS_EXACT, id_aa64mmfr0_parange), MRS_FIELD_END, @@ -735,7 +792,8 @@ static struct mrs_field_value id_aa64mmfr2_st[] = { }; static struct mrs_field_value id_aa64mmfr2_nv[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, IMPL), + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, 8_3), + MRS_FIELD_VALUE(ID_AA64MMFR2_NV_8_4, "NV v8.4"), MRS_FIELD_VALUE_END, }; @@ -835,7 +893,8 @@ static struct mrs_field_value id_aa64pfr0_sve[] = { static struct mrs_field_value id_aa64pfr0_ras[] = { MRS_FIELD_VALUE(ID_AA64PFR0_RAS_NONE, ""), - MRS_FIELD_VALUE(ID_AA64PFR0_RAS_V1, "RASv1"), + MRS_FIELD_VALUE(ID_AA64PFR0_RAS_IMPL, "RAS"), + MRS_FIELD_VALUE(ID_AA64PFR0_RAS_8_4, "RAS v8.4"), MRS_FIELD_VALUE_END, }; diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 81cea5431017..d22da16ffc42 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -266,6 +266,7 @@ #define ID_AA64DFR0_DebugVer_8 (UL(0x6) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_8_VHE (UL(0x7) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_8_2 (UL(0x8) << ID_AA64DFR0_DebugVer_SHIFT) +#define ID_AA64DFR0_DebugVer_8_4 (UL(0x9) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_TraceVer_SHIFT 4 #define ID_AA64DFR0_TraceVer_MASK (UL(0xf) << ID_AA64DFR0_TraceVer_SHIFT) #define ID_AA64DFR0_TraceVer_VAL(x) ((x) & ID_AA64DFR0_TraceVer_MASK) @@ -277,6 +278,8 @@ #define ID_AA64DFR0_PMUVer_NONE (UL(0x0) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_3 (UL(0x1) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_3_1 (UL(0x4) << ID_AA64DFR0_PMUVer_SHIFT) +#define ID_AA64DFR0_PMUVer_3_4 (UL(0x5) << ID_AA64DFR0_PMUVer_SHIFT) +#define ID_AA64DFR0_PMUVer_3_5 (UL(0x6) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_IMPL (UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_BRPs_SHIFT 12 #define ID_AA64DFR0_BRPs_MASK (UL(0xf) << ID_AA64DFR0_BRPs_SHIFT) @@ -294,7 +297,18 @@ #define ID_AA64DFR0_PMSVer_MASK (UL(0xf) << ID_AA64DFR0_PMSVer_SHIFT) #define ID_AA64DFR0_PMSVer_VAL(x) ((x) & ID_AA64DFR0_PMSVer_MASK) #define ID_AA64DFR0_PMSVer_NONE (UL(0x0) << ID_AA64DFR0_PMSVer_SHIFT) -#define ID_AA64DFR0_PMSVer_V1 (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_PMSVer_SPE (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_PMSVer_SPE_8_3 (UL(0x2) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_DoubleLock_SHIFT 36 +#define ID_AA64DFR0_DoubleLock_MASK (UL(0xf) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_DoubleLock_VAL(x) ((x) & ID_AA64DFR0_DoubleLock_MASK) +#define ID_AA64DFR0_DoubleLock_IMPL (UL(0x0) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_DoubleLock_NONE (UL(0xf) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_TraceFilt_SHIFT 40 +#define ID_AA64DFR0_TraceFilt_MASK (UL(0xf) << ID_AA64DFR0_TraceFilt_SHIFT) +#define ID_AA64DFR0_TraceFilt_VAL(x) ((x) & ID_AA64DFR0_TraceFilt_MASK) +#define ID_AA64DFR0_TraceFilt_NONE (UL(0x0) << ID_AA64DFR0_TraceFilt_SHIFT) +#define ID_AA64DFR0_TraceFilt_8_4 (UL(0x1) << ID_AA64DFR0_TraceFilt_SHIFT) /* ID_AA64ISAR0_EL1 */ #define ID_AA64ISAR0_EL1 MRS_REG(3, 0, 0, 6, 0) @@ -385,12 +399,14 @@ #define ID_AA64ISAR1_APA_MASK (UL(0xf) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_APA_VAL(x) ((x) & ID_AA64ISAR1_APA_MASK) #define ID_AA64ISAR1_APA_NONE (UL(0x0) << ID_AA64ISAR1_APA_SHIFT) -#define ID_AA64ISAR1_APA_IMPL (UL(0x1) << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_APA_PAC (UL(0x1) << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_APA_EPAC (UL(0x2) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_API_SHIFT 8 #define ID_AA64ISAR1_API_MASK (UL(0xf) << ID_AA64ISAR1_API_SHIFT) #define ID_AA64ISAR1_API_VAL(x) ((x) & ID_AA64ISAR1_API_MASK) #define ID_AA64ISAR1_API_NONE (UL(0x0) << ID_AA64ISAR1_API_SHIFT) -#define ID_AA64ISAR1_API_IMPL (UL(0x1) << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_API_PAC (UL(0x1) << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_API_EPAC (UL(0x2) << ID_AA64ISAR1_API_SHIFT) #define ID_AA64ISAR1_JSCVT_SHIFT 12 #define ID_AA64ISAR1_JSCVT_MASK (UL(0xf) << ID_AA64ISAR1_JSCVT_SHIFT) #define ID_AA64ISAR1_JSCVT_VAL(x) ((x) & ID_AA64ISAR1_JSCVT_MASK) @@ -495,6 +511,29 @@ #define ID_AA64MMFR0_TGran4_VAL(x) ((x) & ID_AA64MMFR0_TGran4_MASK) #define ID_AA64MMFR0_TGran4_IMPL (UL(0x0) << ID_AA64MMFR0_TGran4_SHIFT) #define ID_AA64MMFR0_TGran4_NONE (UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) +#define ID_AA64MMFR0_TGran16_2_SHIFT 32 +#define ID_AA64MMFR0_TGran16_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_VAL(x) ((x) & ID_AA64MMFR0_TGran16_2_MASK) +#define ID_AA64MMFR0_TGran16_2_TGran16 (UL(0x0) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_SHIFT 36 +#define ID_AA64MMFR0_TGran64_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_VAL(x) ((x) & ID_AA64MMFR0_TGran64_2_MASK) +#define ID_AA64MMFR0_TGran64_2_TGran64 (UL(0x0) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_SHIFT 40 +#define ID_AA64MMFR0_TGran4_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_VAL(x) ((x) & ID_AA64MMFR0_TGran4_2_MASK) +#define ID_AA64MMFR0_TGran4_2_TGran4 (UL(0x0) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_ExS_SHIFT 44 +#define ID_AA64MMFR0_ExS_MASK (UL(0xf) << ID_AA64MMFR0_ExS_SHIFT) +#define ID_AA64MMFR0_ExS_VAL(x) ((x) & ID_AA64MMFR0_ExS_MASK) +#define ID_AA64MMFR0_ExS_ALL (UL(0x0) << ID_AA64MMFR0_ExS_SHIFT) +#define ID_AA64MMFR0_ExS_IMPL (UL(0x1) << ID_AA64MMFR0_ExS_SHIFT) /* ID_AA64MMFR1_EL1 */ #define ID_AA64MMFR1_EL1 MRS_REG(3, 0, 0, 7, 1) @@ -578,7 +617,8 @@ #define ID_AA64MMFR2_NV_MASK (UL(0xf) << ID_AA64MMFR2_NV_SHIFT) #define ID_AA64MMFR2_NV_VAL(x) ((x) & ID_AA64MMFR2_NV_MASK) #define ID_AA64MMFR2_NV_NONE (UL(0x0) << ID_AA64MMFR2_NV_SHIFT) -#define ID_AA64MMFR2_NV_IMPL (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) +#define ID_AA64MMFR2_NV_8_3 (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) +#define ID_AA64MMFR2_NV_8_4 (UL(0x2) << ID_AA64MMFR2_NV_SHIFT) #define ID_AA64MMFR2_ST_SHIFT 28 #define ID_AA64MMFR2_ST_MASK (UL(0xf) << ID_AA64MMFR2_ST_SHIFT) #define ID_AA64MMFR2_ST_VAL(x) ((x) & ID_AA64MMFR2_ST_MASK) @@ -668,7 +708,8 @@ #define ID_AA64PFR0_RAS_MASK (UL(0xf) << ID_AA64PFR0_RAS_SHIFT) #define ID_AA64PFR0_RAS_VAL(x) ((x) & ID_AA64PFR0_RAS_MASK) #define ID_AA64PFR0_RAS_NONE (UL(0x0) << ID_AA64PFR0_RAS_SHIFT) -#define ID_AA64PFR0_RAS_V1 (UL(0x1) << ID_AA64PFR0_RAS_SHIFT) +#define ID_AA64PFR0_RAS_IMPL (UL(0x1) << ID_AA64PFR0_RAS_SHIFT) +#define ID_AA64PFR0_RAS_8_4 (UL(0x2) << ID_AA64PFR0_RAS_SHIFT) #define ID_AA64PFR0_SVE_SHIFT 32 #define ID_AA64PFR0_SVE_MASK (UL(0xf) << ID_AA64PFR0_SVE_SHIFT) #define ID_AA64PFR0_SVE_VAL(x) ((x) & ID_AA64PFR0_SVE_MASK) From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D08966559CC; Fri, 6 Aug 2021 12:51:18 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52G5KZmz4Yvd; Fri, 6 Aug 2021 12:51:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8746662FE; Fri, 6 Aug 2021 12:51:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpIgg017149; Fri, 6 Aug 2021 12:51:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpIEF017148; Fri, 6 Aug 2021 12:51:18 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:18 GMT Message-Id: <202108061251.176CpIEF017148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 41a3f6bb9d81 - stable/13 - Fix the name of the arm64 SCTLR_E0E register MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 41a3f6bb9d81d26afa8d0166840b4ae01899fba5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:18 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=41a3f6bb9d81d26afa8d0166840b4ae01899fba5 commit 41a3f6bb9d81d26afa8d0166840b4ae01899fba5 Author: Andrew Turner AuthorDate: 2021-07-07 23:12:50 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:19 +0000 Fix the name of the arm64 SCTLR_E0E register The character between the E's was the letter O, however in the Arm Documentation and XML the character is the number 0 (zero). Sponsored by: The FreeBSD Foundation (cherry picked from commit c0edde3021900b80fec4e6360d97ba9d9e50d4fd) --- sys/arm64/arm64/locore.S | 2 +- sys/arm64/include/armreg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index 48dd794116cd..50b064ab391a 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -748,7 +748,7 @@ sctlr_set: SCTLR_M | SCTLR_CP15BEN) sctlr_clear: /* Bits to clear */ - .quad (SCTLR_EE | SCTLR_EOE | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \ + .quad (SCTLR_EE | SCTLR_E0E | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \ SCTLR_ITD | SCTLR_A) LEND(start_mmu) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index d22da16ffc42..ba9345c036f9 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -830,7 +830,7 @@ #define SCTLR_IESB 0x00200000 /* ARMv8.2 */ /* Bit 22 is reserved */ #define SCTLR_SPAN 0x00800000 /* ARMv8.1 */ -#define SCTLR_EOE 0x01000000 +#define SCTLR_E0E 0x01000000 #define SCTLR_EE 0x02000000 #define SCTLR_UCI 0x04000000 #define SCTLR_EnDA 0x08000000 /* ARMv8.3 */ From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2A60655A4B; Fri, 6 Aug 2021 12:51:19 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52H5ndNz4Yvm; Fri, 6 Aug 2021 12:51:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A813960C2; Fri, 6 Aug 2021 12:51:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpJBd017179; Fri, 6 Aug 2021 12:51:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpJQF017178; Fri, 6 Aug 2021 12:51:19 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:19 GMT Message-Id: <202108061251.176CpJQF017178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 7bc993854162 - stable/13 - Support fixed size, variable location acpi resources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7bc993854162d38b37f52ce8c7dc2fce1d17a222 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:20 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7bc993854162d38b37f52ce8c7dc2fce1d17a222 commit 7bc993854162d38b37f52ce8c7dc2fce1d17a222 Author: Andrew Turner AuthorDate: 2021-07-08 15:25:38 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:20 +0000 Support fixed size, variable location acpi resources These have been found in some Arm ACPI tables generated by edk2, e.g. when describing the pl011 uart on the Arm AEMv8 model. Reviewed by: imp, jkim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31110 (cherry picked from commit 1472117a1e1c40f10b9c3a48788fbf8355588ee8) --- sys/dev/acpica/acpi_resource.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index fbd0baaa7d37..2e813276af8f 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -421,6 +421,27 @@ acpi_parse_resource(ACPI_RESOURCE *res, void *context) (uintmax_t)min, (uintmax_t)length)); set->set_ioport(dev, arc->context, min, length); } + } else if (res->Data.Address.MinAddressFixed != ACPI_ADDRESS_FIXED && + res->Data.Address.MaxAddressFixed != ACPI_ADDRESS_FIXED) { + /* Fixed size, variable location resource descriptor */ + min = roundup(min, gran + 1); + if ((min + length - 1) > max) { + device_printf(dev, + "invalid memory range: start: %jx end: %jx max: %jx\n", + (uintmax_t)min, (uintmax_t)(min + length - 1), + (uintmax_t)max); + } else { + if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, + "%s/Memory 0x%jx/%ju\n", name, (uintmax_t)min, + (uintmax_t)length)); + set->set_memory(dev, arc->context, min, length); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "%s/IO 0x%jx/%ju\n", + name, (uintmax_t)min, (uintmax_t)length)); + set->set_ioport(dev, arc->context, min, length); + } + } } else { if (res->Data.Address32.ResourceType == ACPI_MEMORY_RANGE) { ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33E12655AC4; Fri, 6 Aug 2021 12:51:21 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52J6ZT8z4Ymp; Fri, 6 Aug 2021 12:51:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C511461AB; Fri, 6 Aug 2021 12:51:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpKRo017203; Fri, 6 Aug 2021 12:51:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpKgg017202; Fri, 6 Aug 2021 12:51:20 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:20 GMT Message-Id: <202108061251.176CpKgg017202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 535a5779e2c4 - stable/13 - Update the arm64 HCR_EL2 registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 535a5779e2c43d11ce444456e8a3fffb84991835 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:21 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=535a5779e2c43d11ce444456e8a3fffb84991835 commit 535a5779e2c43d11ce444456e8a3fffb84991835 Author: Andrew Turner AuthorDate: 2021-07-07 11:51:40 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:21 +0000 Update the arm64 HCR_EL2 registers They are valid as of the ARMv8.7 XML. While here switch to use shifted values as they are easier to compare with values in the Arm Reference Manual. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31093 (cherry picked from commit 3c1bfadaf93da6ec0291a7dc7dc7690ef6611619) --- sys/arm64/include/hypervisor.h | 113 ++++++++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 47 deletions(-) diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h index eab43b29a89e..e8599cb30f3f 100644 --- a/sys/arm64/include/hypervisor.h +++ b/sys/arm64/include/hypervisor.h @@ -1,6 +1,9 @@ /*- * Copyright (c) 2013, 2014 Andrew Turner - * All rights reserved. + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,53 +52,69 @@ #define CPTR_TCPAC 0x80000000 /* HCR_EL2 - Hypervisor Config Register */ -#define HCR_VM 0x0000000000000001 -#define HCR_SWIO 0x0000000000000002 -#define HCR_PTW 0x0000000000000004 -#define HCR_FMO 0x0000000000000008 -#define HCR_IMO 0x0000000000000010 -#define HCR_AMO 0x0000000000000020 -#define HCR_VF 0x0000000000000040 -#define HCR_VI 0x0000000000000080 -#define HCR_VSE 0x0000000000000100 -#define HCR_FB 0x0000000000000200 -#define HCR_BSU_MASK 0x0000000000000c00 -#define HCR_BSU_IS 0x0000000000000400 -#define HCR_BSU_OS 0x0000000000000800 -#define HCR_BSU_FS 0x0000000000000c00 -#define HCR_DC 0x0000000000001000 -#define HCR_TWI 0x0000000000002000 -#define HCR_TWE 0x0000000000004000 -#define HCR_TID0 0x0000000000008000 -#define HCR_TID1 0x0000000000010000 -#define HCR_TID2 0x0000000000020000 -#define HCR_TID3 0x0000000000040000 -#define HCR_TSC 0x0000000000080000 -#define HCR_TIDCP 0x0000000000100000 -#define HCR_TACR 0x0000000000200000 -#define HCR_TSW 0x0000000000400000 -#define HCR_TPCP 0x0000000000800000 -#define HCR_TPU 0x0000000001000000 -#define HCR_TTLB 0x0000000002000000 -#define HCR_TVM 0x0000000004000000 -#define HCR_TGE 0x0000000008000000 -#define HCR_TDZ 0x0000000010000000 -#define HCR_HCD 0x0000000020000000 -#define HCR_TRVM 0x0000000040000000 -#define HCR_RW 0x0000000080000000 -#define HCR_CD 0x0000000100000000 -#define HCR_ID 0x0000000200000000 -#define HCR_E2H 0x0000000400000000 -#define HCR_TLOR 0x0000000800000000 -#define HCR_TERR 0x0000001000000000 -#define HCR_TEA 0x0000002000000000 -#define HCR_MIOCNCE 0x0000004000000000 +#define HCR_VM (UL(0x1) << 0) +#define HCR_SWIO (UL(0x1) << 1) +#define HCR_PTW (UL(0x1) << 2) +#define HCR_FMO (UL(0x1) << 3) +#define HCR_IMO (UL(0x1) << 4) +#define HCR_AMO (UL(0x1) << 5) +#define HCR_VF (UL(0x1) << 6) +#define HCR_VI (UL(0x1) << 7) +#define HCR_VSE (UL(0x1) << 8) +#define HCR_FB (UL(0x1) << 9) +#define HCR_BSU_MASK (UL(0x3) << 10) +#define HCR_BSU_IS (UL(0x1) << 10) +#define HCR_BSU_OS (UL(0x2) << 10) +#define HCR_BSU_FS (UL(0x3) << 10) +#define HCR_DC (UL(0x1) << 12) +#define HCR_TWI (UL(0x1) << 13) +#define HCR_TWE (UL(0x1) << 14) +#define HCR_TID0 (UL(0x1) << 15) +#define HCR_TID1 (UL(0x1) << 16) +#define HCR_TID2 (UL(0x1) << 17) +#define HCR_TID3 (UL(0x1) << 18) +#define HCR_TSC (UL(0x1) << 19) +#define HCR_TIDCP (UL(0x1) << 20) +#define HCR_TACR (UL(0x1) << 21) +#define HCR_TSW (UL(0x1) << 22) +#define HCR_TPCP (UL(0x1) << 23) +#define HCR_TPU (UL(0x1) << 24) +#define HCR_TTLB (UL(0x1) << 25) +#define HCR_TVM (UL(0x1) << 26) +#define HCR_TGE (UL(0x1) << 27) +#define HCR_TDZ (UL(0x1) << 28) +#define HCR_HCD (UL(0x1) << 29) +#define HCR_TRVM (UL(0x1) << 30) +#define HCR_RW (UL(0x1) << 31) +#define HCR_CD (UL(0x1) << 32) +#define HCR_ID (UL(0x1) << 33) +#define HCR_E2H (UL(0x1) << 34) +#define HCR_TLOR (UL(0x1) << 35) +#define HCR_TERR (UL(0x1) << 36) +#define HCR_TEA (UL(0x1) << 37) +#define HCR_MIOCNCE (UL(0x1) << 38) /* Bit 39 is reserved */ -#define HCR_APK 0x0000010000000000 -#define HCR_API 0x0000020000000000 -#define HCR_NV 0x0000040000000000 -#define HCR_NV1 0x0000080000000000 -#define HCR_AT 0x0000100000000000 +#define HCR_APK (UL(0x1) << 40) +#define HCR_API (UL(0x1) << 41) +#define HCR_NV (UL(0x1) << 42) +#define HCR_NV1 (UL(0x1) << 43) +#define HCR_AT (UL(0x1) << 44) +#define HCR_NV2 (UL(0x1) << 45) +#define HCR_FWB (UL(0x1) << 46) +#define HCR_FIEN (UL(0x1) << 47) +/* Bit 48 is reserved */ +#define HCR_TID4 (UL(0x1) << 49) +#define HCR_TICAB (UL(0x1) << 50) +#define HCR_AMVOFFEN (UL(0x1) << 51) +#define HCR_TOCU (UL(0x1) << 52) +#define HCR_EnSCXT (UL(0x1) << 53) +#define HCR_TTLBIS (UL(0x1) << 54) +#define HCR_TTLBOS (UL(0x1) << 55) +#define HCR_ATA (UL(0x1) << 56) +#define HCR_DCT (UL(0x1) << 57) +#define HCR_TID5 (UL(0x1) << 58) +#define HCR_TWEDEn (UL(0x1) << 59) +#define HCR_TWEDEL_MASK (UL(0xf) << 60) /* HPFAR_EL2 - Hypervisor IPA Fault Address Register */ #define HPFAR_EL2_FIPA_SHIFT 4 From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37B5B655C61; Fri, 6 Aug 2021 12:51:22 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52L0h7Kz4Ymx; Fri, 6 Aug 2021 12:51:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA40A620A; Fri, 6 Aug 2021 12:51:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpLpr017227; Fri, 6 Aug 2021 12:51:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpLnO017226; Fri, 6 Aug 2021 12:51:21 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:21 GMT Message-Id: <202108061251.176CpLnO017226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 59c17fae900d - stable/13 - Update the SCTLR_EL1 register definitions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 59c17fae900de697e44f7c22c5cceb6af3c1e66a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:22 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=59c17fae900de697e44f7c22c5cceb6af3c1e66a commit 59c17fae900de697e44f7c22c5cceb6af3c1e66a Author: Andrew Turner AuthorDate: 2021-07-08 12:14:56 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:21 +0000 Update the SCTLR_EL1 register definitions They are valid as of the ARMv8.7 XML. While here remove SCTLR_RES0 as it's unused and depends on which CPU the kernel is running on and switch to shifted values as they are easier to compare with the documentation. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31120 (cherry picked from commit 5484e6d9cc5801e02cba1bf4b9a03ff2e75fa587) --- sys/arm64/include/armreg.h | 87 ++++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index ba9345c036f9..9521b0826064 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -1,10 +1,9 @@ /*- * Copyright (c) 2013, 2014 Andrew Turner - * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. + * Copyright (c) 2015,2021 The FreeBSD Foundation * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -803,41 +802,55 @@ #define PAR_S_MASK (0x1 << PAR_S_SHIFT) /* SCTLR_EL1 - System Control Register */ -#define SCTLR_RES0 0xc8222440 /* Reserved ARMv8.0, write 0 */ #define SCTLR_RES1 0x30d00800 /* Reserved ARMv8.0, write 1 */ - -#define SCTLR_M 0x00000001 -#define SCTLR_A 0x00000002 -#define SCTLR_C 0x00000004 -#define SCTLR_SA 0x00000008 -#define SCTLR_SA0 0x00000010 -#define SCTLR_CP15BEN 0x00000020 -/* Bit 6 is reserved */ -#define SCTLR_ITD 0x00000080 -#define SCTLR_SED 0x00000100 -#define SCTLR_UMA 0x00000200 -/* Bit 10 is reserved */ -/* Bit 11 is reserved */ -#define SCTLR_I 0x00001000 -#define SCTLR_EnDB 0x00002000 /* ARMv8.3 */ -#define SCTLR_DZE 0x00004000 -#define SCTLR_UCT 0x00008000 -#define SCTLR_nTWI 0x00010000 +#define SCTLR_M (UL(0x1) << 0) +#define SCTLR_A (UL(0x1) << 1) +#define SCTLR_C (UL(0x1) << 2) +#define SCTLR_SA (UL(0x1) << 3) +#define SCTLR_SA0 (UL(0x1) << 4) +#define SCTLR_CP15BEN (UL(0x1) << 5) +#define SCTLR_nAA (UL(0x1) << 6) +#define SCTLR_ITD (UL(0x1) << 7) +#define SCTLR_SED (UL(0x1) << 8) +#define SCTLR_UMA (UL(0x1) << 9) +#define SCTLR_EnRCTX (UL(0x1) << 10) +#define SCTLR_EOS (UL(0x1) << 11) +#define SCTLR_I (UL(0x1) << 12) +#define SCTLR_EnDB (UL(0x1) << 13) +#define SCTLR_DZE (UL(0x1) << 14) +#define SCTLR_UCT (UL(0x1) << 15) +#define SCTLR_nTWI (UL(0x1) << 16) /* Bit 17 is reserved */ -#define SCTLR_nTWE 0x00040000 -#define SCTLR_WXN 0x00080000 -/* Bit 20 is reserved */ -#define SCTLR_IESB 0x00200000 /* ARMv8.2 */ -/* Bit 22 is reserved */ -#define SCTLR_SPAN 0x00800000 /* ARMv8.1 */ -#define SCTLR_E0E 0x01000000 -#define SCTLR_EE 0x02000000 -#define SCTLR_UCI 0x04000000 -#define SCTLR_EnDA 0x08000000 /* ARMv8.3 */ -#define SCTLR_nTLSMD 0x10000000 /* ARMv8.2 */ -#define SCTLR_LSMAOE 0x20000000 /* ARMv8.2 */ -#define SCTLR_EnIB 0x40000000 /* ARMv8.3 */ -#define SCTLR_EnIA 0x80000000 /* ARMv8.3 */ +#define SCTLR_nTWE (UL(0x1) << 18) +#define SCTLR_WXN (UL(0x1) << 19) +#define SCTLR_TSCXT (UL(0x1) << 20) +#define SCTLR_IESB (UL(0x1) << 21) +#define SCTLR_EIS (UL(0x1) << 22) +#define SCTLR_SPAN (UL(0x1) << 23) +#define SCTLR_E0E (UL(0x1) << 24) +#define SCTLR_EE (UL(0x1) << 25) +#define SCTLR_UCI (UL(0x1) << 26) +#define SCTLR_EnDA (UL(0x1) << 27) +#define SCTLR_nTLSMD (UL(0x1) << 28) +#define SCTLR_LSMAOE (UL(0x1) << 29) +#define SCTLR_EnIB (UL(0x1) << 30) +#define SCTLR_EnIA (UL(0x1) << 31) +/* Bits 34:32 are reserved */ +#define SCTLR_BT0 (UL(0x1) << 35) +#define SCTLR_BT1 (UL(0x1) << 36) +#define SCTLR_ITFSB (UL(0x1) << 37) +#define SCTLR_TCF0_MASK (UL(0x3) << 38) +#define SCTLR_TCF_MASK (UL(0x3) << 40) +#define SCTLR_ATA0 (UL(0x1) << 42) +#define SCTLR_ATA (UL(0x1) << 43) +#define SCTLR_DSSBS (UL(0x1) << 44) +#define SCTLR_TWEDEn (UL(0x1) << 45) +#define SCTLR_TWEDEL_MASK (UL(0xf) << 46) +/* Bits 53:50 are reserved */ +#define SCTLR_EnASR (UL(0x1) << 54) +#define SCTLR_EnAS0 (UL(0x1) << 55) +#define SCTLR_EnALS (UL(0x1) << 56) +#define SCTLR_EPAN (UL(0x1) << 57) /* SPSR_EL1 */ /* From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7133655D92; Fri, 6 Aug 2021 12:51:23 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52M2nHSz4Z09; Fri, 6 Aug 2021 12:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 187246149; Fri, 6 Aug 2021 12:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpMf6017251; Fri, 6 Aug 2021 12:51:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpMAm017250; Fri, 6 Aug 2021 12:51:22 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:22 GMT Message-Id: <202108061251.176CpMAm017250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 9408ee9e88ef - stable/13 - Remove the newline from arm64 trap panics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9408ee9e88ef7505312d51ea9b431bc0b0bc2b61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:24 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9408ee9e88ef7505312d51ea9b431bc0b0bc2b61 commit 9408ee9e88ef7505312d51ea9b431bc0b0bc2b61 Author: Andrew Turner AuthorDate: 2021-07-14 19:49:58 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:22 +0000 Remove the newline from arm64 trap panics The panic function will already print a newline so there is no need to add it here. Sponsored by: The FreeBSD Foundation (cherry picked from commit 2665851086795c61e799fbe57bfb37cabab3cf8c) --- sys/arm64/arm64/trap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index cdb7ae8fadae..fa33f713a4fc 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -424,7 +424,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) #ifdef KDB kdb_trap(exception, 0, frame); #else - panic("No debugger in kernel.\n"); + panic("No debugger in kernel."); #endif break; case EXCP_WATCHPT_EL1: @@ -432,7 +432,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) #ifdef KDB kdb_trap(exception, 0, frame); #else - panic("No debugger in kernel.\n"); + panic("No debugger in kernel."); #endif break; case EXCP_UNKNOWN: @@ -442,7 +442,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) default: print_registers(frame); printf(" far: %16lx\n", READ_SPECIALREG(far_el1)); - panic("Unknown kernel exception %x esr_el1 %lx\n", exception, + panic("Unknown kernel exception %x esr_el1 %lx", exception, esr); } } From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD2BA655ACA; Fri, 6 Aug 2021 12:51:24 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52N34Ygz4Z2g; Fri, 6 Aug 2021 12:51:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32ABA614A; Fri, 6 Aug 2021 12:51:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpOgO017275; Fri, 6 Aug 2021 12:51:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpOOU017274; Fri, 6 Aug 2021 12:51:24 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:24 GMT Message-Id: <202108061251.176CpOOU017274@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 90070aad0bed - stable/13 - Add virtio comments to the arm64 GENERIC config MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 90070aad0bed6fbfc86326acfdb9e9f29667209f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:24 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=90070aad0bed6fbfc86326acfdb9e9f29667209f commit 90070aad0bed6fbfc86326acfdb9e9f29667209f Author: Andrew Turner AuthorDate: 2021-07-14 20:08:29 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:23 +0000 Add virtio comments to the arm64 GENERIC config Most of these are from the amd64 GENERIC config. Sponsored by: The FreeBSD Foundation (cherry picked from commit ab9f9cfda5a77ff511d56cf183f081cb72ada79d) --- sys/arm64/conf/GENERIC | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 3ce13a49bec7..c33ff2e6351a 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -361,11 +361,11 @@ device rk_dwmmc device rk_emmcphy # VirtIO support -device virtio -device virtio_pci -device virtio_mmio -device virtio_blk -device vtnet +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI device +device virtio_mmio # VirtIO Memory Mapped IO device +device virtio_blk # VirtIO Block device +device vtnet # VirtIO Ethernet device # Chip-specific errata options THUNDERX_PASS_1_1_ERRATA From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95AE26559D3; Fri, 6 Aug 2021 12:51:25 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52P3MMBz4Yxs; Fri, 6 Aug 2021 12:51:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55E796380; Fri, 6 Aug 2021 12:51:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpPA3017305; Fri, 6 Aug 2021 12:51:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpP5h017304; Fri, 6 Aug 2021 12:51:25 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:25 GMT Message-Id: <202108061251.176CpP5h017304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 534a780edd77 - stable/13 - Add virtio_scsi to the arm64 GENERIC config MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 534a780edd77c8de62903f990dd3d061d8d01515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:25 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=534a780edd77c8de62903f990dd3d061d8d01515 commit 534a780edd77c8de62903f990dd3d061d8d01515 Author: Andrew Turner AuthorDate: 2021-07-14 20:13:10 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:24 +0000 Add virtio_scsi to the arm64 GENERIC config This is needed to boot on the Oracle Cloud VM.Standard.A1.Flex instance Sponsored by: The FreeBSD Foundation (cherry picked from commit b644d64e8a4641a6e4c53b3f4be51e08cb17f6cc) --- sys/arm64/conf/GENERIC | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index c33ff2e6351a..eea4441f096f 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -365,6 +365,7 @@ device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI device device virtio_mmio # VirtIO Memory Mapped IO device device virtio_blk # VirtIO Block device +device virtio_scsi # VirtIO SCSI device device vtnet # VirtIO Ethernet device # Chip-specific errata From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 12:51:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79943655C7E; Fri, 6 Aug 2021 12:51:27 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh52Q6ztHz4YwL; Fri, 6 Aug 2021 12:51:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75FB7620B; Fri, 6 Aug 2021 12:51:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176CpQUK017329; Fri, 6 Aug 2021 12:51:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176CpQRi017328; Fri, 6 Aug 2021 12:51:26 GMT (envelope-from git) Date: Fri, 6 Aug 2021 12:51:26 GMT Message-Id: <202108061251.176CpQRi017328@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 9757cfb9d245 - stable/13 - Hide arm64 features that don't have a HWCAP MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9757cfb9d24540ea1fa80ff54531142d5ec8c2bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:51:27 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9757cfb9d24540ea1fa80ff54531142d5ec8c2bc commit 9757cfb9d24540ea1fa80ff54531142d5ec8c2bc Author: Andrew Turner AuthorDate: 2021-07-15 23:22:07 +0000 Commit: Andrew Turner CommitDate: 2021-08-05 20:50:25 +0000 Hide arm64 features that don't have a HWCAP We should only export MSR fields if there is also a HWCAP so it doesn't matter which software uses. Sponsored by: The FreeBSD Foundation (cherry picked from commit ae47eecf87b5d8a054bd5d640da12608cc5f126a) --- sys/arm64/arm64/identcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 2cd5b914ddef..6395b3e0f08a 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -467,7 +467,7 @@ static struct mrs_field_value id_aa64isar0_aes[] = { static struct mrs_field id_aa64isar0_fields[] = { MRS_FIELD(ID_AA64ISAR0, RNDR, false, MRS_LOWER, id_aa64isar0_rndr), - MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_LOWER, id_aa64isar0_tlb), + MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_EXACT, id_aa64isar0_tlb), MRS_FIELD(ID_AA64ISAR0, TS, false, MRS_LOWER, id_aa64isar0_ts), MRS_FIELD(ID_AA64ISAR0, FHM, false, MRS_LOWER, id_aa64isar0_fhm), MRS_FIELD(ID_AA64ISAR0, DP, false, MRS_LOWER, id_aa64isar0_dp), @@ -568,7 +568,7 @@ static struct mrs_field id_aa64isar1_fields[] = { MRS_FIELD(ID_AA64ISAR1, I8MM, false, MRS_LOWER, id_aa64isar1_i8mm), MRS_FIELD(ID_AA64ISAR1, DGH, false, MRS_LOWER, id_aa64isar1_dgh), MRS_FIELD(ID_AA64ISAR1, BF16, false, MRS_LOWER, id_aa64isar1_bf16), - MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_LOWER, + MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_EXACT, id_aa64isar1_specres), MRS_FIELD(ID_AA64ISAR1, SB, false, MRS_LOWER, id_aa64isar1_sb), MRS_FIELD(ID_AA64ISAR1, FRINTTS, false, MRS_LOWER, From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 21:50:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54BCE65F7BA; Fri, 6 Aug 2021 21:50:53 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GhK0s0z4dz3hsm; Fri, 6 Aug 2021 21:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 082D0154D4; Fri, 6 Aug 2021 21:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176LoqDu039022; Fri, 6 Aug 2021 21:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176Loq4q039021; Fri, 6 Aug 2021 21:50:52 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:50:52 GMT Message-Id: <202108062150.176Loq4q039021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 987a238d6eaa - stable/12 - UPDATING: Document the removal of DIOCGETSTATESNV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 987a238d6eaaeb0d11c163135e4e1b4617153d2c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:50:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=987a238d6eaaeb0d11c163135e4e1b4617153d2c commit 987a238d6eaaeb0d11c163135e4e1b4617153d2c Author: Kristof Provost AuthorDate: 2021-07-14 13:51:36 +0000 Commit: Kristof Provost CommitDate: 2021-08-06 07:12:48 +0000 UPDATING: Document the removal of DIOCGETSTATESNV MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 3412900333e659124f61ada6389ef40dd0f3ddd4) --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index dcde1cb75903..88a610e4705c 100644 --- a/UPDATING +++ b/UPDATING @@ -17,6 +17,12 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20210730: + Commit b69019c14cd8 removes pf's DIOCGETSTATESNV ioctl. + As of be70c7a50d32 it is no longer used by userspace, but it does mean + users may not be able to enumerate pf states if they update the kernel + past c021ff986e2b without first updating userspace past be70c7a50d32. + 20210715: The 20210707 awk update brought in a change in behavior. This has been corrected as of d4d252c49976. Between these dates, if you From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 21:50:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06B4565F2FF; Fri, 6 Aug 2021 21:50:52 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GhK0q6qjXz3htM; Fri, 6 Aug 2021 21:50:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D24BE15609; Fri, 6 Aug 2021 21:50:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176Lopms038907; Fri, 6 Aug 2021 21:50:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176LopTh038906; Fri, 6 Aug 2021 21:50:51 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:50:51 GMT Message-Id: <202108062150.176LopTh038906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b701c27bf05f - stable/12 - pf: remove DIOCGETSTATESNV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b701c27bf05fc68a0f52dc10f23e28b2ec8a380c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:50:52 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b701c27bf05fc68a0f52dc10f23e28b2ec8a380c commit b701c27bf05fc68a0f52dc10f23e28b2ec8a380c Author: Kristof Provost AuthorDate: 2021-07-06 11:13:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-06 07:11:45 +0000 pf: remove DIOCGETSTATESNV While nvlists are very useful in maximising flexibility for future extensions their performance is simply unacceptably bad for the getstates feature, where we can easily want to export a million states or more. The DIOCGETSTATESNV call has been MFCd, but has not hit a release on any branch, so we can still remove it everywhere. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31099 (cherry picked from commit b69019c14cd89a5e699bc6e69941aec5b1041b1e) --- sys/net/pfvar.h | 1 - sys/netpfil/pf/pf_ioctl.c | 86 ----------------------------------------------- 2 files changed, 87 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 35e2f0f717ba..52fd015ba54e 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1441,7 +1441,6 @@ struct pfioc_iface { #define DIOCNATLOOK _IOWR('D', 23, struct pfioc_natlook) #define DIOCSETDEBUG _IOWR('D', 24, u_int32_t) #define DIOCGETSTATES _IOWR('D', 25, struct pfioc_states) -#define DIOCGETSTATESNV _IOWR('D', 25, struct pfioc_nv) #define DIOCCHANGERULE _IOWR('D', 26, struct pfioc_rule) /* XXX cut 26 - 28 */ #define DIOCSETTIMEOUT _IOWR('D', 29, struct pfioc_tm) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index a3026d394bde..8a6286b5c21a 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -209,7 +209,6 @@ static int pf_killstates_row(struct pf_kstate_kill *, static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); static int pf_getstate(struct pfioc_nv *); -static int pf_getstates(struct pfioc_nv *); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); @@ -2120,7 +2119,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCSETDEBUG: case DIOCGETSTATES: case DIOCGETSTATESV2: - case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: case DIOCGETLIMIT: @@ -2175,7 +2173,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATUS: case DIOCGETSTATES: case DIOCGETSTATESV2: - case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: case DIOCGETALTQSV0: @@ -2976,11 +2973,6 @@ DIOCGETSTATESV2_full: break; } - case DIOCGETSTATESNV: { - error = pf_getstates((struct pfioc_nv *)addr); - break; - } - case DIOCGETSTATUS: { struct pf_status *s = (struct pf_status *)addr; @@ -5270,84 +5262,6 @@ errout: return (error); } -static int -pf_getstates(struct pfioc_nv *nv) -{ - nvlist_t *nvl = NULL, *nvls; - void *nvlpacked = NULL; - struct pf_kstate *s = NULL; - int error = 0; - uint64_t count = 0; - -#define ERROUT(x) ERROUT_FUNCTION(errout, x) - - nvl = nvlist_create(0); - if (nvl == NULL) - ERROUT(ENOMEM); - - nvlist_add_number(nvl, "count", uma_zone_get_cur(V_pf_state_z)); - - for (int i = 0; i < pf_hashmask; i++) { - struct pf_idhash *ih = &V_pf_idhash[i]; - - /* Avoid taking the lock if there are no states in the row. */ - if (LIST_EMPTY(&ih->states)) - continue; - - PF_HASHROW_LOCK(ih); - LIST_FOREACH(s, &ih->states, entry) { - if (s->timeout == PFTM_UNLINKED) - continue; - - if (SIGPENDING(curthread)) { - PF_HASHROW_UNLOCK(ih); - ERROUT(EINTR); - } - - nvls = pf_state_to_nvstate(s); - if (nvls == NULL) { - PF_HASHROW_UNLOCK(ih); - ERROUT(ENOMEM); - } - if ((nvlist_size(nvl) + nvlist_size(nvls)) > nv->size) { - /* We've run out of room for more states. */ - nvlist_destroy(nvls); - PF_HASHROW_UNLOCK(ih); - goto DIOCGETSTATESNV_full; - } - nvlist_append_nvlist_array(nvl, "states", nvls); - nvlist_destroy(nvls); - count++; - } - PF_HASHROW_UNLOCK(ih); - } - - /* We've managed to put them all the available space. Let's make sure - * 'count' matches our array (that's racy, because we don't hold a lock - * over all states, only over each row individually. */ - (void)nvlist_take_number(nvl, "count"); - nvlist_add_number(nvl, "count", count); - -DIOCGETSTATESNV_full: - - nvlpacked = nvlist_pack(nvl, &nv->len); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - - if (nv->size == 0) - ERROUT(0); - else if (nv->size < nv->len) - ERROUT(ENOSPC); - - error = copyout(nvlpacked, nv->data, nv->len); - -#undef ERROUT -errout: - free(nvlpacked, M_NVLIST); - nvlist_destroy(nvl); - return (error); -} - /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 21:50:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1C7065F9A4; Fri, 6 Aug 2021 21:50:53 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GhK0s5Dn8z3hhk; Fri, 6 Aug 2021 21:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98DD71560A; Fri, 6 Aug 2021 21:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176LorKD039046; Fri, 6 Aug 2021 21:50:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176LorDn039045; Fri, 6 Aug 2021 21:50:53 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:50:53 GMT Message-Id: <202108062150.176LorDn039045@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 10ea921d32d6 - stable/13 - UPDATING: Document the removal of DIOCGETSTATESNV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 10ea921d32d67c8c145e9bbe0bdb1e8f3bed55a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:50:53 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=10ea921d32d67c8c145e9bbe0bdb1e8f3bed55a2 commit 10ea921d32d67c8c145e9bbe0bdb1e8f3bed55a2 Author: Kristof Provost AuthorDate: 2021-07-14 13:51:36 +0000 Commit: Kristof Provost CommitDate: 2021-08-06 21:49:48 +0000 UPDATING: Document the removal of DIOCGETSTATESNV MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 3412900333e659124f61ada6389ef40dd0f3ddd4) --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index 503ce0962398..6ad89bbf6602 100644 --- a/UPDATING +++ b/UPDATING @@ -17,6 +17,12 @@ and/or ports. KAPI between the NFS modules. Bump __FreeBSD_version to 1300514. All NFS modules must be rebuilt from sources. +20210730: + Commit b69019c14cd8 removes pf's DIOCGETSTATESNV ioctl. + As of be70c7a50d32 it is no longer used by userspace, but it does mean + users may not be able to enumerate pf states if they update the kernel + past c021ff986e2b without first updating userspace past be70c7a50d32. + 20210718: Bump __FreeBSD_version to 1300512 after merging LinuxKPI, OFED, net80211, and driver changes in order to support building From owner-dev-commits-src-branches@freebsd.org Fri Aug 6 21:50:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB7DF65FB8F; Fri, 6 Aug 2021 21:50:52 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GhK0r4Lntz3hhj; Fri, 6 Aug 2021 21:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DA9E154D2; Fri, 6 Aug 2021 21:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 176Loqdg038994; Fri, 6 Aug 2021 21:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 176LoqjG038993; Fri, 6 Aug 2021 21:50:52 GMT (envelope-from git) Date: Fri, 6 Aug 2021 21:50:52 GMT Message-Id: <202108062150.176LoqjG038993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 830afa2979ab - stable/13 - pf: remove DIOCGETSTATESNV MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 830afa2979ab5e20692e2fb9d0fe54eb6155b3af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 21:50:52 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=830afa2979ab5e20692e2fb9d0fe54eb6155b3af commit 830afa2979ab5e20692e2fb9d0fe54eb6155b3af Author: Kristof Provost AuthorDate: 2021-07-06 11:13:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-06 21:49:48 +0000 pf: remove DIOCGETSTATESNV While nvlists are very useful in maximising flexibility for future extensions their performance is simply unacceptably bad for the getstates feature, where we can easily want to export a million states or more. The DIOCGETSTATESNV call has been MFCd, but has not hit a release on any branch, so we can still remove it everywhere. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31099 (cherry picked from commit b69019c14cd89a5e699bc6e69941aec5b1041b1e) --- sys/net/pfvar.h | 1 - sys/netpfil/pf/pf_ioctl.c | 86 ----------------------------------------------- 2 files changed, 87 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 7a244ac13d72..e037947a5375 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1440,7 +1440,6 @@ struct pfioc_iface { #define DIOCNATLOOK _IOWR('D', 23, struct pfioc_natlook) #define DIOCSETDEBUG _IOWR('D', 24, u_int32_t) #define DIOCGETSTATES _IOWR('D', 25, struct pfioc_states) -#define DIOCGETSTATESNV _IOWR('D', 25, struct pfioc_nv) #define DIOCCHANGERULE _IOWR('D', 26, struct pfioc_rule) /* XXX cut 26 - 28 */ #define DIOCSETTIMEOUT _IOWR('D', 29, struct pfioc_tm) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 01601db07ea0..5fd711d1c574 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -209,7 +209,6 @@ static int pf_killstates_row(struct pf_kstate_kill *, static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); static int pf_getstate(struct pfioc_nv *); -static int pf_getstates(struct pfioc_nv *); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); @@ -2119,7 +2118,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCSETDEBUG: case DIOCGETSTATES: case DIOCGETSTATESV2: - case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: case DIOCGETLIMIT: @@ -2174,7 +2172,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATUS: case DIOCGETSTATES: case DIOCGETSTATESV2: - case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: case DIOCGETALTQSV0: @@ -2963,11 +2960,6 @@ DIOCGETSTATESV2_full: break; } - case DIOCGETSTATESNV: { - error = pf_getstates((struct pfioc_nv *)addr); - break; - } - case DIOCGETSTATUS: { struct pf_status *s = (struct pf_status *)addr; @@ -5203,84 +5195,6 @@ errout: return (error); } -static int -pf_getstates(struct pfioc_nv *nv) -{ - nvlist_t *nvl = NULL, *nvls; - void *nvlpacked = NULL; - struct pf_kstate *s = NULL; - int error = 0; - uint64_t count = 0; - -#define ERROUT(x) ERROUT_FUNCTION(errout, x) - - nvl = nvlist_create(0); - if (nvl == NULL) - ERROUT(ENOMEM); - - nvlist_add_number(nvl, "count", uma_zone_get_cur(V_pf_state_z)); - - for (int i = 0; i < pf_hashmask; i++) { - struct pf_idhash *ih = &V_pf_idhash[i]; - - /* Avoid taking the lock if there are no states in the row. */ - if (LIST_EMPTY(&ih->states)) - continue; - - PF_HASHROW_LOCK(ih); - LIST_FOREACH(s, &ih->states, entry) { - if (s->timeout == PFTM_UNLINKED) - continue; - - if (SIGPENDING(curthread)) { - PF_HASHROW_UNLOCK(ih); - ERROUT(EINTR); - } - - nvls = pf_state_to_nvstate(s); - if (nvls == NULL) { - PF_HASHROW_UNLOCK(ih); - ERROUT(ENOMEM); - } - if ((nvlist_size(nvl) + nvlist_size(nvls)) > nv->size) { - /* We've run out of room for more states. */ - nvlist_destroy(nvls); - PF_HASHROW_UNLOCK(ih); - goto DIOCGETSTATESNV_full; - } - nvlist_append_nvlist_array(nvl, "states", nvls); - nvlist_destroy(nvls); - count++; - } - PF_HASHROW_UNLOCK(ih); - } - - /* We've managed to put them all the available space. Let's make sure - * 'count' matches our array (that's racy, because we don't hold a lock - * over all states, only over each row individually. */ - (void)nvlist_take_number(nvl, "count"); - nvlist_add_number(nvl, "count", count); - -DIOCGETSTATESNV_full: - - nvlpacked = nvlist_pack(nvl, &nv->len); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - - if (nv->size == 0) - ERROUT(0); - else if (nv->size < nv->len) - ERROUT(ENOSPC); - - error = copyout(nvlpacked, nv->data, nv->len); - -#undef ERROUT -errout: - free(nvlpacked, M_NVLIST); - nvlist_destroy(nvl); - return (error); -} - /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-branches@freebsd.org Sat Aug 7 16:30:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA2D266DB9D; Sat, 7 Aug 2021 16:30:03 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GhnrC4gLrz3wKv; Sat, 7 Aug 2021 16:30:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83FC0243EC; Sat, 7 Aug 2021 16:30:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 177GU3gc024540; Sat, 7 Aug 2021 16:30:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177GU3mA024537; Sat, 7 Aug 2021 16:30:03 GMT (envelope-from git) Date: Sat, 7 Aug 2021 16:30:03 GMT Message-Id: <202108071630.177GU3mA024537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e650ef36ba9e - stable/13 - pf: locally originating connections with 'route-to' fail MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e650ef36ba9ef7ec994d3e7048a56fea761f9c7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:30:03 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e650ef36ba9ef7ec994d3e7048a56fea761f9c7e commit e650ef36ba9ef7ec994d3e7048a56fea761f9c7e Author: Kristof Provost AuthorDate: 2021-07-14 10:17:03 +0000 Commit: Kristof Provost CommitDate: 2021-08-07 07:08:09 +0000 pf: locally originating connections with 'route-to' fail Similar to the REPLY_TO shortcut (6d786845cf) we also can't shortcut ROUTE_TO. If we do we will fail to apply transformations or update the state, which can lead to premature termination of the connections. PR: 257106 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31177 (cherry picked from commit 2c0d115bbc8f8ee3f011a5c4a69bcbf58c4b721f) --- sys/netpfil/pf/pf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3f954497dc20..0db9eaed1ac4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -337,12 +337,6 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); return (PF_DROP); \ if (PACKET_LOOPED(pd)) \ return (PF_PASS); \ - if ((d) == PF_OUT && \ - (s)->rule.ptr->rt == PF_ROUTETO && \ - (s)->rule.ptr->direction == PF_OUT && \ - (s)->rt_kif != NULL && \ - (s)->rt_kif != (i)) \ - return (PF_PASS); \ } while (0) #define BOUND_IFACE(r, k) \ From owner-dev-commits-src-branches@freebsd.org Sat Aug 7 16:30:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7808266DB9E; Sat, 7 Aug 2021 16:30:04 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GhnrD2fdfz3wCC; Sat, 7 Aug 2021 16:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 439CB243ED; Sat, 7 Aug 2021 16:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 177GU4LA024754; Sat, 7 Aug 2021 16:30:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177GU4ME024751; Sat, 7 Aug 2021 16:30:04 GMT (envelope-from git) Date: Sat, 7 Aug 2021 16:30:04 GMT Message-Id: <202108071630.177GU4ME024751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 44c47bc6d61e - stable/12 - pf: locally originating connections with 'route-to' fail MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 44c47bc6d61ea295c6bb955a40f32c93a589f3ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:30:04 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=44c47bc6d61ea295c6bb955a40f32c93a589f3ea commit 44c47bc6d61ea295c6bb955a40f32c93a589f3ea Author: Kristof Provost AuthorDate: 2021-07-14 10:17:03 +0000 Commit: Kristof Provost CommitDate: 2021-08-07 07:09:35 +0000 pf: locally originating connections with 'route-to' fail Similar to the REPLY_TO shortcut (6d786845cf) we also can't shortcut ROUTE_TO. If we do we will fail to apply transformations or update the state, which can lead to premature termination of the connections. PR: 257106 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31177 (cherry picked from commit 2c0d115bbc8f8ee3f011a5c4a69bcbf58c4b721f) --- sys/netpfil/pf/pf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index caae2b92f0d6..a7b429120c9e 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -338,12 +338,6 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); return (PF_DROP); \ if (PACKET_LOOPED(pd)) \ return (PF_PASS); \ - if ((d) == PF_OUT && \ - (s)->rule.ptr->rt == PF_ROUTETO && \ - (s)->rule.ptr->direction == PF_OUT && \ - (s)->rt_kif != NULL && \ - (s)->rt_kif != (i)) \ - return (PF_PASS); \ } while (0) #define BOUND_IFACE(r, k) \ From owner-dev-commits-src-branches@freebsd.org Sat Aug 7 16:30:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC24D66D7C0; Sat, 7 Aug 2021 16:30:04 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GhnrD4tGZz3w2r; Sat, 7 Aug 2021 16:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F86F23EF9; Sat, 7 Aug 2021 16:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 177GU4Ce024832; Sat, 7 Aug 2021 16:30:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177GU4Ok024829; Sat, 7 Aug 2021 16:30:04 GMT (envelope-from git) Date: Sat, 7 Aug 2021 16:30:04 GMT Message-Id: <202108071630.177GU4Ok024829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3bedd8a3b6d7 - stable/13 - pf tests: test locally originated connections with route-to MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3bedd8a3b6d7816341cf6eebc3f91633a175320d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:30:04 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3bedd8a3b6d7816341cf6eebc3f91633a175320d commit 3bedd8a3b6d7816341cf6eebc3f91633a175320d Author: Kristof Provost AuthorDate: 2021-07-14 10:33:37 +0000 Commit: Kristof Provost CommitDate: 2021-08-07 07:08:19 +0000 pf tests: test locally originated connections with route-to PR: 257106 Submitted by: Mark Cammidge MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D31178 (cherry picked from commit f808bb9b7e5ee2243e5a2aaad2275a78cdbe981b) --- tests/sys/netpfil/pf/route_to.sh | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 59b16e35ee6f..957317eb462e 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -181,9 +181,79 @@ multiwan_cleanup() pft_cleanup } +atf_test_case "multiwanlocal" "cleanup" +multiwanlocal_head() +{ + atf_set descr 'Multi-WAN local origin source-based redirection / route-to test' + atf_set require.user root +} + +multiwanlocal_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_cl_one=$(vnet_mkepair) + epair_cl_two=$(vnet_mkepair) + + vnet_mkjail srv1 ${epair_one}b + vnet_mkjail srv2 ${epair_two}b + vnet_mkjail wan_one ${epair_one}a ${epair_cl_one}b + vnet_mkjail wan_two ${epair_two}a ${epair_cl_two}b + vnet_mkjail client ${epair_cl_one}a ${epair_cl_two}a + + jexec client ifconfig ${epair_cl_one}a 203.0.113.1/25 + jexec wan_one ifconfig ${epair_cl_one}b 203.0.113.2/25 + jexec wan_one ifconfig ${epair_one}a 192.0.2.1/24 up + jexec wan_one sysctl net.inet.ip.forwarding=1 + jexec srv1 ifconfig ${epair_one}b 192.0.2.2/24 up + + jexec client ifconfig ${epair_cl_two}a 203.0.113.128/25 + jexec wan_two ifconfig ${epair_cl_two}b 203.0.113.129/25 + jexec wan_two ifconfig ${epair_two}a 198.51.100.1/24 up + jexec wan_two sysctl net.inet.ip.forwarding=1 + jexec srv2 ifconfig ${epair_two}b 198.51.100.2/24 up + + jexec client route add default 203.0.113.2 + jexec srv1 route add default 192.0.2.1 + jexec srv2 route add default 198.51.100.1 + + # Run data source in srv1 and srv2 + jexec srv1 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + jexec srv2 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + + jexec client pfctl -e + pft_set_rules client \ + "block in" \ + "block out" \ + "pass out quick route-to (${epair_cl_two}a 203.0.113.129) inet proto tcp from 203.0.113.128 to any port 7" \ + "pass out on ${epair_cl_one}a inet proto tcp from any to any port 7" + + # This should work + result=$(jexec client nc -N -w 1 192.0.2.2 7 | wc -c) + if [ ${result} -ne 102400 ]; then + jexec client pfctl -ss + atf_fail "Redirect from client on one failed: ${result}" + fi + + # This should trigger the issue + result=$(jexec client nc -N -w 1 -s 203.0.113.128 198.51.100.2 7 | wc -c) + jexec client pfctl -ss + if [ ${result} -ne 102400 ]; then + atf_fail "Redirect from client on two failed: ${result}" + fi +} + +multiwanlocal_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "multiwan" + atf_add_test_case "multiwanlocal" } From owner-dev-commits-src-branches@freebsd.org Sat Aug 7 16:30:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B962866D8D9; Sat, 7 Aug 2021 16:30:05 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GhnrF3pp2z3wKw; Sat, 7 Aug 2021 16:30:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D47824360; Sat, 7 Aug 2021 16:30:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 177GU5BO024990; Sat, 7 Aug 2021 16:30:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 177GU5bc024988; Sat, 7 Aug 2021 16:30:05 GMT (envelope-from git) Date: Sat, 7 Aug 2021 16:30:05 GMT Message-Id: <202108071630.177GU5bc024988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: bd28b2d73223 - stable/12 - pf tests: test locally originated connections with route-to MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bd28b2d73223b898169986eb5f04ee6045929612 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:30:05 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bd28b2d73223b898169986eb5f04ee6045929612 commit bd28b2d73223b898169986eb5f04ee6045929612 Author: Kristof Provost AuthorDate: 2021-07-14 10:33:37 +0000 Commit: Kristof Provost CommitDate: 2021-08-07 07:11:28 +0000 pf tests: test locally originated connections with route-to PR: 257106 Submitted by: Mark Cammidge MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D31178 (cherry picked from commit f808bb9b7e5ee2243e5a2aaad2275a78cdbe981b) --- tests/sys/netpfil/pf/route_to.sh | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 59b16e35ee6f..957317eb462e 100755 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -181,9 +181,79 @@ multiwan_cleanup() pft_cleanup } +atf_test_case "multiwanlocal" "cleanup" +multiwanlocal_head() +{ + atf_set descr 'Multi-WAN local origin source-based redirection / route-to test' + atf_set require.user root +} + +multiwanlocal_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_cl_one=$(vnet_mkepair) + epair_cl_two=$(vnet_mkepair) + + vnet_mkjail srv1 ${epair_one}b + vnet_mkjail srv2 ${epair_two}b + vnet_mkjail wan_one ${epair_one}a ${epair_cl_one}b + vnet_mkjail wan_two ${epair_two}a ${epair_cl_two}b + vnet_mkjail client ${epair_cl_one}a ${epair_cl_two}a + + jexec client ifconfig ${epair_cl_one}a 203.0.113.1/25 + jexec wan_one ifconfig ${epair_cl_one}b 203.0.113.2/25 + jexec wan_one ifconfig ${epair_one}a 192.0.2.1/24 up + jexec wan_one sysctl net.inet.ip.forwarding=1 + jexec srv1 ifconfig ${epair_one}b 192.0.2.2/24 up + + jexec client ifconfig ${epair_cl_two}a 203.0.113.128/25 + jexec wan_two ifconfig ${epair_cl_two}b 203.0.113.129/25 + jexec wan_two ifconfig ${epair_two}a 198.51.100.1/24 up + jexec wan_two sysctl net.inet.ip.forwarding=1 + jexec srv2 ifconfig ${epair_two}b 198.51.100.2/24 up + + jexec client route add default 203.0.113.2 + jexec srv1 route add default 192.0.2.1 + jexec srv2 route add default 198.51.100.1 + + # Run data source in srv1 and srv2 + jexec srv1 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + jexec srv2 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + + jexec client pfctl -e + pft_set_rules client \ + "block in" \ + "block out" \ + "pass out quick route-to (${epair_cl_two}a 203.0.113.129) inet proto tcp from 203.0.113.128 to any port 7" \ + "pass out on ${epair_cl_one}a inet proto tcp from any to any port 7" + + # This should work + result=$(jexec client nc -N -w 1 192.0.2.2 7 | wc -c) + if [ ${result} -ne 102400 ]; then + jexec client pfctl -ss + atf_fail "Redirect from client on one failed: ${result}" + fi + + # This should trigger the issue + result=$(jexec client nc -N -w 1 -s 203.0.113.128 198.51.100.2 7 | wc -c) + jexec client pfctl -ss + if [ ${result} -ne 102400 ]; then + atf_fail "Redirect from client on two failed: ${result}" + fi +} + +multiwanlocal_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "multiwan" + atf_add_test_case "multiwanlocal" }