From owner-svn-src-stable@freebsd.org Sun Nov 29 00:54:13 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D683E470BE9; Sun, 29 Nov 2020 00:54:13 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck8yF5j3qz3FP8; Sun, 29 Nov 2020 00:54:13 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6BD3A71; Sun, 29 Nov 2020 00:54:13 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT0sDYA081027; Sun, 29 Nov 2020 00:54:13 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT0sDvT081026; Sun, 29 Nov 2020 00:54:13 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <202011290054.0AT0sDvT081026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Sun, 29 Nov 2020 00:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368135 - stable/12/sys/amd64/vmm/amd X-SVN-Group: stable-12 X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: stable/12/sys/amd64/vmm/amd X-SVN-Commit-Revision: 368135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 00:54:13 -0000 Author: grehan Date: Sun Nov 29 00:54:13 2020 New Revision: 368135 URL: https://svnweb.freebsd.org/changeset/base/368135 Log: MFC r368047 Remove manual instruction encodings for VMLOAD, VMRUN, and VMSAVE. Modified: stable/12/sys/amd64/vmm/amd/svm_support.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/vmm/amd/svm_support.S ============================================================================== --- stable/12/sys/amd64/vmm/amd/svm_support.S Sun Nov 29 00:49:14 2020 (r368134) +++ stable/12/sys/amd64/vmm/amd/svm_support.S Sun Nov 29 00:54:13 2020 (r368135) @@ -39,10 +39,6 @@ #define VENTER push %rbp ; mov %rsp,%rbp #define VLEAVE pop %rbp -#define VMLOAD .byte 0x0f, 0x01, 0xda -#define VMRUN .byte 0x0f, 0x01, 0xd8 -#define VMSAVE .byte 0x0f, 0x01, 0xdb - /* * svm_launch(uint64_t vmcb, struct svm_regctx *gctx, struct pcpu *pcpu) * %rdi: physical address of VMCB @@ -91,9 +87,9 @@ ENTRY(svm_launch) movq SCTX_RDI(%rsi), %rdi movq SCTX_RSI(%rsi), %rsi /* %rsi must be restored last */ - VMLOAD - VMRUN - VMSAVE + vmload %rax + vmrun %rax + vmsave %rax pop %rax /* pop guest context pointer from the stack */ From owner-svn-src-stable@freebsd.org Sun Nov 29 01:22:30 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1F354718E1; Sun, 29 Nov 2020 01:22:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck9Zt49y3z3H8B; Sun, 29 Nov 2020 01:22:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82204CCA; Sun, 29 Nov 2020 01:22:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT1MUro099629; Sun, 29 Nov 2020 01:22:30 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT1MUjb099628; Sun, 29 Nov 2020 01:22:30 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202011290122.0AT1MUjb099628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 29 Nov 2020 01:22:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368137 - stable/12/usr.sbin/mountd X-SVN-Group: stable-12 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/12/usr.sbin/mountd X-SVN-Commit-Revision: 368137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 01:22:30 -0000 Author: rmacklem Date: Sun Nov 29 01:22:30 2020 New Revision: 368137 URL: https://svnweb.freebsd.org/changeset/base/368137 Log: MFC: r367026 Add "-R" option to tell mountd to not register with rpcbind. rpcbind is now considered a security risk for some sites. Since an NFSv4 only NFS server does not need rpcbind, it makes sense to have an option that implements this. This patch adds a "-R" option that disables the Mount protocol (not used by NFSv4) and does not register with rpcbind. Changes are required to /etc/rc.d/mountd and /etc/rc.d/nfsd. Those will be in a separate commit. Modified: stable/12/usr.sbin/mountd/mountd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mountd/mountd.c ============================================================================== --- stable/12/usr.sbin/mountd/mountd.c Sun Nov 29 00:57:19 2020 (r368136) +++ stable/12/usr.sbin/mountd/mountd.c Sun Nov 29 01:22:30 2020 (r368137) @@ -419,8 +419,10 @@ main(int argc, char **argv) uint64_t curtime, nexttime; struct timeval tv; struct timespec tp; - sigset_t sighup_mask; + sigset_t sig_mask, sighup_mask; + int enable_rpcbind; + enable_rpcbind = 1; /* Check that another mountd isn't already running. */ pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &otherpid); if (pfh == NULL) { @@ -435,7 +437,7 @@ main(int argc, char **argv) else close(s); - while ((c = getopt(argc, argv, "2deh:lnp:rS")) != -1) + while ((c = getopt(argc, argv, "2deh:lnp:RrS")) != -1) switch (c) { case '2': force_v2 = 1; @@ -446,6 +448,10 @@ main(int argc, char **argv) case 'n': resvport_only = 0; break; + case 'R': + /* Do not support Mount protocol */ + enable_rpcbind = 0; + break; case 'r': dir_only = 0; break; @@ -490,6 +496,21 @@ main(int argc, char **argv) default: usage(); } + if (enable_rpcbind == 0) { + if (svcport_str != NULL) { + warnx("-p option not compatible with -R, ignored"); + free(svcport_str); + svcport_str = NULL; + } + if (nhosts > 0) { + warnx("-h option not compatible with -R, ignored"); + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + hosts = NULL; + nhosts = 0; + } + } if (modfind("nfsd") < 0) { /* Not present in kernel, try loading it */ @@ -523,58 +544,61 @@ main(int argc, char **argv) pidfile_write(pfh); - rpcb_unset(MOUNTPROG, MOUNTVERS, NULL); - rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL); - rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); + if (enable_rpcbind != 0) { + rpcb_unset(MOUNTPROG, MOUNTVERS, NULL); + rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL); + rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); - if (!resvport_only) { - if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL, - &resvport_only, sizeof(resvport_only)) != 0 && - errno != ENOENT) { - syslog(LOG_ERR, "sysctl: %m"); - exit(1); + if (!resvport_only) { + if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL, + &resvport_only, sizeof(resvport_only)) != 0 && + errno != ENOENT) { + syslog(LOG_ERR, "sysctl: %m"); + exit(1); + } } - } - /* - * If no hosts were specified, add a wildcard entry to bind to - * INADDR_ANY. Otherwise make sure 127.0.0.1 and ::1 are added to the - * list. - */ - if (nhosts == 0) { - hosts = malloc(sizeof(char *)); - if (hosts == NULL) - out_of_mem(); - hosts[0] = "*"; - nhosts = 1; - } else { - hosts_bak = hosts; - if (have_v6) { - hosts_bak = realloc(hosts, (nhosts + 2) * - sizeof(char *)); - if (hosts_bak == NULL) { - for (k = 0; k < nhosts; k++) - free(hosts[k]); - free(hosts); - out_of_mem(); - } else - hosts = hosts_bak; - nhosts += 2; - hosts[nhosts - 2] = "::1"; - } else { - hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *)); - if (hosts_bak == NULL) { - for (k = 0; k < nhosts; k++) - free(hosts[k]); - free(hosts); + /* + * If no hosts were specified, add a wildcard entry to bind to + * INADDR_ANY. Otherwise make sure 127.0.0.1 and ::1 are added + * to the list. + */ + if (nhosts == 0) { + hosts = malloc(sizeof(char *)); + if (hosts == NULL) out_of_mem(); + hosts[0] = "*"; + nhosts = 1; + } else { + hosts_bak = hosts; + if (have_v6) { + hosts_bak = realloc(hosts, (nhosts + 2) * + sizeof(char *)); + if (hosts_bak == NULL) { + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + out_of_mem(); + } else + hosts = hosts_bak; + nhosts += 2; + hosts[nhosts - 2] = "::1"; } else { - nhosts += 1; - hosts = hosts_bak; + hosts_bak = realloc(hosts, (nhosts + 1) * + sizeof(char *)); + if (hosts_bak == NULL) { + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + out_of_mem(); + } else { + nhosts += 1; + hosts = hosts_bak; + } } - } - hosts[nhosts - 1] = "127.0.0.1"; + hosts[nhosts - 1] = "127.0.0.1"; + } } attempt_cnt = 1; @@ -582,96 +606,109 @@ main(int argc, char **argv) sock_fd = NULL; port_list = NULL; port_len = 0; - nc_handle = setnetconfig(); - while ((nconf = getnetconfig(nc_handle))) { - if (nconf->nc_flag & NC_VISIBLE) { - if (have_v6 == 0 && strcmp(nconf->nc_protofmly, - "inet6") == 0) { - /* DO NOTHING */ - } else { - ret = create_service(nconf); - if (ret == 1) - /* Ignore this call */ - continue; - if (ret < 0) { - /* - * Failed to bind port, so close off - * all sockets created and try again - * if the port# was dynamically - * assigned via bind(2). - */ - clearout_service(); - if (mallocd_svcport != 0 && - attempt_cnt < GETPORT_MAXTRY) { - free(svcport_str); + if (enable_rpcbind != 0) { + nc_handle = setnetconfig(); + while ((nconf = getnetconfig(nc_handle))) { + if (nconf->nc_flag & NC_VISIBLE) { + if (have_v6 == 0 && strcmp(nconf->nc_protofmly, + "inet6") == 0) { + /* DO NOTHING */ + } else { + ret = create_service(nconf); + if (ret == 1) + /* Ignore this call */ + continue; + if (ret < 0) { + /* + * Failed to bind port, so close + * off all sockets created and + * try again if the port# was + * dynamically assigned via + * bind(2). + */ + clearout_service(); + if (mallocd_svcport != 0 && + attempt_cnt < + GETPORT_MAXTRY) { + free(svcport_str); + svcport_str = NULL; + mallocd_svcport = 0; + } else { + errno = EADDRINUSE; + syslog(LOG_ERR, + "bindresvport_sa:" + " %m"); + exit(1); + } + + /* + * Start over at the first + * service. + */ + free(sock_fd); + sock_fdcnt = 0; + sock_fd = NULL; + nc_handle = setnetconfig(); + attempt_cnt++; + } else if (mallocd_svcport != 0 && + attempt_cnt == GETPORT_MAXTRY) { + /* + * For the last attempt, allow + * different port #s for each + * nconf by saving the + * svcport_str setting it back + * to NULL. + */ + port_list = realloc(port_list, + (port_len + 1) * + sizeof(char *)); + if (port_list == NULL) + out_of_mem(); + port_list[port_len++] = + svcport_str; svcport_str = NULL; mallocd_svcport = 0; - } else { - errno = EADDRINUSE; - syslog(LOG_ERR, - "bindresvport_sa: %m"); - exit(1); } - - /* Start over at the first service. */ - free(sock_fd); - sock_fdcnt = 0; - sock_fd = NULL; - nc_handle = setnetconfig(); - attempt_cnt++; - } else if (mallocd_svcport != 0 && - attempt_cnt == GETPORT_MAXTRY) { - /* - * For the last attempt, allow - * different port #s for each nconf - * by saving the svcport_str and - * setting it back to NULL. - */ - port_list = realloc(port_list, - (port_len + 1) * sizeof(char *)); - if (port_list == NULL) - out_of_mem(); - port_list[port_len++] = svcport_str; - svcport_str = NULL; - mallocd_svcport = 0; } } } - } - /* - * Successfully bound the ports, so call complete_service() to - * do the rest of the setup on the service(s). - */ - sock_fdpos = 0; - port_pos = 0; - nc_handle = setnetconfig(); - while ((nconf = getnetconfig(nc_handle))) { - if (nconf->nc_flag & NC_VISIBLE) { - if (have_v6 == 0 && strcmp(nconf->nc_protofmly, - "inet6") == 0) { - /* DO NOTHING */ - } else if (port_list != NULL) { - if (port_pos >= port_len) { - syslog(LOG_ERR, "too many port#s"); - exit(1); - } - complete_service(nconf, port_list[port_pos++]); - } else - complete_service(nconf, svcport_str); + /* + * Successfully bound the ports, so call complete_service() to + * do the rest of the setup on the service(s). + */ + sock_fdpos = 0; + port_pos = 0; + nc_handle = setnetconfig(); + while ((nconf = getnetconfig(nc_handle))) { + if (nconf->nc_flag & NC_VISIBLE) { + if (have_v6 == 0 && strcmp(nconf->nc_protofmly, + "inet6") == 0) { + /* DO NOTHING */ + } else if (port_list != NULL) { + if (port_pos >= port_len) { + syslog(LOG_ERR, "too many" + " port#s"); + exit(1); + } + complete_service(nconf, + port_list[port_pos++]); + } else + complete_service(nconf, svcport_str); + } } - } - endnetconfig(nc_handle); - free(sock_fd); - if (port_list != NULL) { - for (port_pos = 0; port_pos < port_len; port_pos++) - free(port_list[port_pos]); - free(port_list); - } + endnetconfig(nc_handle); + free(sock_fd); + if (port_list != NULL) { + for (port_pos = 0; port_pos < port_len; port_pos++) + free(port_list[port_pos]); + free(port_list); + } - if (xcreated == 0) { - syslog(LOG_ERR, "could not create any services"); - exit(1); + if (xcreated == 0) { + syslog(LOG_ERR, "could not create any services"); + exit(1); + } } /* Expand svc_run() here so that we can call get_exportlist(). */ @@ -682,7 +719,7 @@ main(int argc, char **argv) clock_gettime(CLOCK_MONOTONIC, &tp); curtime = tp.tv_sec; curtime = curtime * 1000000 + tp.tv_nsec / 1000; - sigprocmask(SIG_BLOCK, &sighup_mask, NULL); + sigprocmask(SIG_BLOCK, &sighup_mask, &sig_mask); if (got_sighup && curtime >= nexttime) { got_sighup = 0; sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL); @@ -705,22 +742,28 @@ main(int argc, char **argv) tv.tv_usec = 0; else tv.tv_usec = RELOADDELAY; - readfds = svc_fdset; - switch (select(svc_maxfd + 1, &readfds, NULL, NULL, &tv)) { - case -1: - if (errno == EINTR) { + if (enable_rpcbind != 0) { + readfds = svc_fdset; + switch (select(svc_maxfd + 1, &readfds, NULL, NULL, + &tv)) { + case -1: + if (errno == EINTR) { + /* Allow a reload now. */ + nexttime = 0; + continue; + } + syslog(LOG_ERR, "mountd died: select: %m"); + exit(1); + case 0: /* Allow a reload now. */ nexttime = 0; continue; + default: + svc_getreqset(&readfds); } - syslog(LOG_ERR, "mountd died: select: %m"); - exit(1); - case 0: - /* Allow a reload now. */ - nexttime = 0; - continue; - default: - svc_getreqset(&readfds); + } else { + /* Simply wait for a signal. */ + sigsuspend(&sig_mask); } } } From owner-svn-src-stable@freebsd.org Sun Nov 29 01:32:54 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F87D471EC6; Sun, 29 Nov 2020 01:32:54 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck9pt2B04z3Hmr; Sun, 29 Nov 2020 01:32:54 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DC80DD0; Sun, 29 Nov 2020 01:32:54 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT1Wsdt006257; Sun, 29 Nov 2020 01:32:54 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT1WsGB006256; Sun, 29 Nov 2020 01:32:54 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202011290132.0AT1WsGB006256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 29 Nov 2020 01:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368139 - stable/12/usr.sbin/mountd X-SVN-Group: stable-12 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/12/usr.sbin/mountd X-SVN-Commit-Revision: 368139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 01:32:54 -0000 Author: rmacklem Date: Sun Nov 29 01:32:53 2020 New Revision: 368139 URL: https://svnweb.freebsd.org/changeset/base/368139 Log: MFC: r367027 Update man page for -R option added by r376026. This is a content change. Modified: stable/12/usr.sbin/mountd/mountd.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mountd/mountd.8 ============================================================================== --- stable/12/usr.sbin/mountd/mountd.8 Sun Nov 29 01:30:17 2020 (r368138) +++ stable/12/usr.sbin/mountd/mountd.8 Sun Nov 29 01:32:53 2020 (r368139) @@ -28,7 +28,7 @@ .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd August 1, 2019 +.Dd October 11, 2020 .Dt MOUNTD 8 .Os .Sh NAME @@ -38,7 +38,7 @@ mount requests .Sh SYNOPSIS .Nm -.Op Fl 2delnrS +.Op Fl 2delnRrS .Op Fl h Ar bindip .Op Fl p Ar port .Op Ar exportsfile ... @@ -112,6 +112,17 @@ If .Nm cannot bind to this port, an appropriate error will be recorded in the system log, and the daemon will then exit. +.It Fl R +Do not support the Mount protocol and do not register with +.Xr rpcbind 8 . +This can be done for NFSv4 only servers, since the Mount protocol is not +used by NFSv4. +Useful for NFSv4 only servers that do not wish to run +.Xr rpcbind 8 . +.Xr showmount 8 +will not work, however since NFSv4 mounts are not shown by +.Xr showmount 8 , +this should not be an issue for an NFSv4 only server. .It Fl r Allow mount RPCs requests for regular files to be served. Although this seems to violate the mount protocol specification, From owner-svn-src-stable@freebsd.org Sun Nov 29 10:34:49 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D594947D551; Sun, 29 Nov 2020 10:34:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkPr95nHXz4SGc; Sun, 29 Nov 2020 10:34:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B506A7F0D; Sun, 29 Nov 2020 10:34:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATAYnaN041854; Sun, 29 Nov 2020 10:34:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATAYnlD041853; Sun, 29 Nov 2020 10:34:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011291034.0ATAYnlD041853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 29 Nov 2020 10:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368144 - stable/12/lib/libthr/thread X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libthr/thread X-SVN-Commit-Revision: 368144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 10:34:49 -0000 Author: kib Date: Sun Nov 29 10:34:49 2020 New Revision: 368144 URL: https://svnweb.freebsd.org/changeset/base/368144 Log: MFC r368082: Style. Modified: stable/12/lib/libthr/thread/thr_attr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libthr/thread/thr_attr.c ============================================================================== --- stable/12/lib/libthr/thread/thr_attr.c Sun Nov 29 10:32:38 2020 (r368143) +++ stable/12/lib/libthr/thread/thr_attr.c Sun Nov 29 10:34:49 2020 (r368144) @@ -134,7 +134,7 @@ _thr_attr_destroy(pthread_attr_t *attr) *attr = NULL; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_get_np, pthread_attr_get_np); @@ -196,7 +196,7 @@ _thr_attr_getdetachstate(const pthread_attr_t *attr, i *detachstate = PTHREAD_CREATE_JOINABLE; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_getguardsize, pthread_attr_getguardsize); @@ -216,7 +216,7 @@ _thr_attr_getguardsize(const pthread_attr_t * __restri *guardsize = (*attr)->guardsize_attr; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_getinheritsched, pthread_attr_getinheritsched); @@ -233,7 +233,7 @@ _thr_attr_getinheritsched(const pthread_attr_t * __res else *sched_inherit = (*attr)->sched_inherit; - return(ret); + return (ret); } __weak_reference(_thr_attr_getschedparam, pthread_attr_getschedparam); @@ -250,7 +250,7 @@ _thr_attr_getschedparam(const pthread_attr_t * __restr else param->sched_priority = (*attr)->prio; - return(ret); + return (ret); } __weak_reference(_thr_attr_getschedpolicy, pthread_attr_getschedpolicy); @@ -267,7 +267,7 @@ _thr_attr_getschedpolicy(const pthread_attr_t * __rest else *policy = (*attr)->sched_policy; - return(ret); + return (ret); } __weak_reference(_thr_attr_getscope, pthread_attr_getscope); @@ -287,7 +287,7 @@ _thr_attr_getscope(const pthread_attr_t * __restrict a *contentionscope = (*attr)->flags & PTHREAD_SCOPE_SYSTEM ? PTHREAD_SCOPE_SYSTEM : PTHREAD_SCOPE_PROCESS; - return(ret); + return (ret); } __weak_reference(_pthread_attr_getstack, pthread_attr_getstack); @@ -308,7 +308,7 @@ _pthread_attr_getstack(const pthread_attr_t * __restri *stacksize = (*attr)->stacksize_attr; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_getstackaddr, pthread_attr_getstackaddr); @@ -327,7 +327,7 @@ _thr_attr_getstackaddr(const pthread_attr_t *attr, voi *stackaddr = (*attr)->stackaddr_attr; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_getstacksize, pthread_attr_getstacksize); @@ -347,7 +347,7 @@ _thr_attr_getstacksize(const pthread_attr_t * __restri *stacksize = (*attr)->stacksize_attr; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_init, pthread_attr_init); @@ -373,7 +373,7 @@ _thr_attr_init(pthread_attr_t *attr) *attr = pattr; ret = 0; } - return(ret); + return (ret); } __weak_reference(_pthread_attr_setcreatesuspend_np, pthread_attr_setcreatesuspend_np); @@ -389,7 +389,7 @@ _pthread_attr_setcreatesuspend_np(pthread_attr_t *attr (*attr)->suspend = THR_CREATE_SUSPENDED; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_setdetachstate, pthread_attr_setdetachstate); @@ -415,7 +415,7 @@ _thr_attr_setdetachstate(pthread_attr_t *attr, int det (*attr)->flags &= ~PTHREAD_DETACHED; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_setguardsize, pthread_attr_setguardsize); @@ -434,7 +434,7 @@ _thr_attr_setguardsize(pthread_attr_t *attr, size_t gu (*attr)->guardsize_attr = guardsize; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_setinheritsched, pthread_attr_setinheritsched); @@ -453,7 +453,7 @@ _thr_attr_setinheritsched(pthread_attr_t *attr, int sc else (*attr)->sched_inherit = sched_inherit; - return(ret); + return (ret); } __weak_reference(_thr_attr_setschedparam, pthread_attr_setschedparam); @@ -506,7 +506,7 @@ _thr_attr_setschedpolicy(pthread_attr_t *attr, int pol (*attr)->sched_policy = policy; (*attr)->prio = _thr_priorities[policy-1].pri_default; } - return(ret); + return (ret); } __weak_reference(_thr_attr_setscope, pthread_attr_setscope); @@ -549,7 +549,7 @@ _pthread_attr_setstack(pthread_attr_t *attr, void *sta (*attr)->stacksize_attr = stacksize; ret = 0; } - return(ret); + return (ret); } __weak_reference(_thr_attr_setstackaddr, pthread_attr_setstackaddr); @@ -587,7 +587,7 @@ _thr_attr_setstacksize(pthread_attr_t *attr, size_t st (*attr)->stacksize_attr = stacksize; ret = 0; } - return(ret); + return (ret); } static size_t From owner-svn-src-stable@freebsd.org Sun Nov 29 10:36:56 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A67E247D7FF; Sun, 29 Nov 2020 10:36:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkPtc4KZmz4SfB; Sun, 29 Nov 2020 10:36:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 877707B40; Sun, 29 Nov 2020 10:36:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATAauP4042011; Sun, 29 Nov 2020 10:36:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATAau3g042010; Sun, 29 Nov 2020 10:36:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011291036.0ATAau3g042010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 29 Nov 2020 10:36:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368145 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 368145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 10:36:56 -0000 Author: kib Date: Sun Nov 29 10:36:56 2020 New Revision: 368145 URL: https://svnweb.freebsd.org/changeset/base/368145 Log: MFC r368083: Remove stray semicolumn. Modified: stable/12/lib/libc/gen/_pthread_stubs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/_pthread_stubs.c ============================================================================== --- stable/12/lib/libc/gen/_pthread_stubs.c Sun Nov 29 10:34:49 2020 (r368144) +++ stable/12/lib/libc/gen/_pthread_stubs.c Sun Nov 29 10:36:56 2020 (r368145) @@ -285,7 +285,7 @@ STUB_FUNC2(pthread_setcanceltype, PJT_SETCANCELTYPE, i STUB_FUNC(pthread_testcancel, PJT_TESTCANCEL, void) STUB_FUNC1(__pthread_cleanup_pop_imp, PJT_CLEANUP_POP_IMP, void, int) STUB_FUNC3(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, void *, - void *, void *); + void *, void *) STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, void, int) STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, void, int) From owner-svn-src-stable@freebsd.org Sun Nov 29 14:20:43 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10D674A3A46; Sun, 29 Nov 2020 14:20:43 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkVrp4hH6z4gsd; Sun, 29 Nov 2020 14:20:42 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 925C512B26; Sun, 29 Nov 2020 14:20:42 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATEKgnk080362; Sun, 29 Nov 2020 14:20:42 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATEKgrp080361; Sun, 29 Nov 2020 14:20:42 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011291420.0ATEKgrp080361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Sun, 29 Nov 2020 14:20:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368151 - stable/12/lib/libprocstat X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/lib/libprocstat X-SVN-Commit-Revision: 368151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 14:20:43 -0000 Author: 0mp (doc,ports committer) Date: Sun Nov 29 14:20:42 2020 New Revision: 368151 URL: https://svnweb.freebsd.org/changeset/base/368151 Log: MFC r368084: libprocstat.3: Correct two occurrences of kvm_getprocs to procstat_getprocs Submitted by: otis_sk.freebsd.org Reviewed by: markj Modified: stable/12/lib/libprocstat/libprocstat.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libprocstat/libprocstat.3 ============================================================================== --- stable/12/lib/libprocstat/libprocstat.3 Sun Nov 29 13:54:49 2020 (r368150) +++ stable/12/lib/libprocstat/libprocstat.3 Sun Nov 29 14:20:42 2020 (r368151) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2017 +.Dd November 26, 2020 .Dt LIBPROCSTAT 3 .Os .Sh NAME @@ -345,7 +345,7 @@ structure from one of the functions, a pointer to .Vt kinfo_proc structure from the array obtained from the -.Fn kvm_getprocs +.Fn procstat_getprocs function, and returns a null-terminated argument vector that corresponds to the command line arguments passed to the process. The @@ -402,7 +402,7 @@ structure initialized with one of the functions, a pointer to .Vt kinfo_proc structure from the array obtained from the -.Fn kvm_getprocs +.Fn procstat_getprocs function, and returns a dynamically allocated linked list of filled in .Vt filestat_list structures using the STAILQ macros defined in From owner-svn-src-stable@freebsd.org Sun Nov 29 14:21:16 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B62824A3A71; Sun, 29 Nov 2020 14:21:16 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkVsS4s2Pz4hFY; Sun, 29 Nov 2020 14:21:16 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9962E12E32; Sun, 29 Nov 2020 14:21:16 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATELGfn081198; Sun, 29 Nov 2020 14:21:16 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATELGMx081197; Sun, 29 Nov 2020 14:21:16 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011291421.0ATELGMx081197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Sun, 29 Nov 2020 14:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368152 - stable/11/lib/libprocstat X-SVN-Group: stable-11 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/11/lib/libprocstat X-SVN-Commit-Revision: 368152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 14:21:16 -0000 Author: 0mp (doc,ports committer) Date: Sun Nov 29 14:21:16 2020 New Revision: 368152 URL: https://svnweb.freebsd.org/changeset/base/368152 Log: MFC r368084: libprocstat.3: Correct two occurrences of kvm_getprocs to procstat_getprocs Submitted by: otis_sk.freebsd.org Reviewed by: markj Modified: stable/11/lib/libprocstat/libprocstat.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libprocstat/libprocstat.3 ============================================================================== --- stable/11/lib/libprocstat/libprocstat.3 Sun Nov 29 14:20:42 2020 (r368151) +++ stable/11/lib/libprocstat/libprocstat.3 Sun Nov 29 14:21:16 2020 (r368152) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2017 +.Dd November 26, 2020 .Dt LIBPROCSTAT 3 .Os .Sh NAME @@ -319,7 +319,7 @@ structure from one of the functions, a pointer to .Vt kinfo_proc structure from the array obtained from the -.Fn kvm_getprocs +.Fn procstat_getprocs function, and returns a null-terminated argument vector that corresponds to the command line arguments passed to the process. The @@ -376,7 +376,7 @@ structure initialized with one of the functions, a pointer to .Vt kinfo_proc structure from the array obtained from the -.Fn kvm_getprocs +.Fn procstat_getprocs function, and returns a dynamically allocated linked list of filled in .Vt filestat_list structures using the STAILQ macros defined in From owner-svn-src-stable@freebsd.org Sun Nov 29 23:23:09 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50B174AFFD4; Sun, 29 Nov 2020 23:23:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckktj1tHHz3nHq; Sun, 29 Nov 2020 23:23:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3336E19ABF; Sun, 29 Nov 2020 23:23:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATNN97M022784; Sun, 29 Nov 2020 23:23:09 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATNN8xi022781; Sun, 29 Nov 2020 23:23:08 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202011292323.0ATNN8xi022781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 29 Nov 2020 23:23:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368165 - in stable/12/libexec/rc: . rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/12/libexec/rc: . rc.d X-SVN-Commit-Revision: 368165 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 23:23:09 -0000 Author: rmacklem Date: Sun Nov 29 23:23:08 2020 New Revision: 368165 URL: https://svnweb.freebsd.org/changeset/base/368165 Log: MFC: r367423 Add support for the new mountd -R option. r376026 added a new "-R" option to mountd, which tells it to not support the Mount protocol (not used by NFSv4) and not register with rpcbind. Rpcbind is considered a security issue by some sites now. This patch adds a new yes/no variable called nfsv4_server_only. When that is set, make vfs.nfsd.server_min_vers=4 and set "=R" for mountd. Setting vfs.nfsd.server_min_vers=4 tells nfsd to not register with rpcbind. While here, add a check for "load_kld nfsd" failing to nfsd. Modified: stable/12/libexec/rc/rc.conf stable/12/libexec/rc/rc.d/mountd stable/12/libexec/rc/rc.d/nfsd Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.conf ============================================================================== --- stable/12/libexec/rc/rc.conf Sun Nov 29 19:43:33 2020 (r368164) +++ stable/12/libexec/rc/rc.conf Sun Nov 29 23:23:08 2020 (r368165) @@ -375,6 +375,7 @@ rpc_ypupdated_enable="NO" # Run if NIS master and Secu keyserv_enable="NO" # Run the SecureRPC keyserver (or NO). keyserv_flags="" # Flags to keyserv (if enabled). nfsv4_server_enable="NO" # Enable support for NFSv4 +nfsv4_server_only="NO" # Set NFS server to NFSv4 only nfscbd_enable="NO" # NFSv4 client side callback daemon nfscbd_flags="" # Flags for nfscbd nfsuserd_enable="NO" # NFSv4 user/group name mapping daemon Modified: stable/12/libexec/rc/rc.d/mountd ============================================================================== --- stable/12/libexec/rc/rc.d/mountd Sun Nov 29 19:43:33 2020 (r368164) +++ stable/12/libexec/rc/rc.d/mountd Sun Nov 29 23:23:08 2020 (r368165) @@ -20,13 +20,33 @@ extra_commands="reload" mountd_precmd() { - force_depend rpcbind || return 1 + # Load the modules now, so that the vfs.nfsd sysctl + # oids are available. + load_kld nfsd || return 1 + + # Do not force rpcbind to be running for an NFSv4 only server. + # + if checkyesno nfsv4_server_only; then + echo 'NFSv4 only server' + sysctl vfs.nfsd.server_min_nfsvers=4 > /dev/null + sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null + rc_flags="${rc_flags} -R" + else + force_depend rpcbind || return 1 + fi + # mountd flags will differ depending on rc.conf settings # - if checkyesno nfs_server_enable ; then + if checkyesno nfs_server_enable || checkyesno nfsv4_server_only; then if checkyesno weak_mountd_authentication; then - rc_flags="${mountd_flags} -n" + if checkyesno nfsv4_server_only; then + echo -n 'weak_mountd_authentication ' + echo -n 'incompatible with nfsv4_server_only, ' + echo 'ignored' + else + rc_flags="${rc_flags} -n" + fi fi else if checkyesno mountd_enable; then Modified: stable/12/libexec/rc/rc.d/nfsd ============================================================================== --- stable/12/libexec/rc/rc.d/nfsd Sun Nov 29 19:43:33 2020 (r368164) +++ stable/12/libexec/rc/rc.d/nfsd Sun Nov 29 23:23:08 2020 (r368165) @@ -26,7 +26,7 @@ nfsd_precmd() # Load the modules now, so that the vfs.nfsd sysctl # oids are available. - load_kld nfsd + load_kld nfsd || return 1 if checkyesno nfs_reserved_port_only; then echo 'NFS on reserved port only=YES' @@ -41,12 +41,15 @@ nfsd_precmd() if checkyesno nfsv4_server_enable; then sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null - else + elif ! checkyesno nfsv4_server_only; then echo 'NFSv4 is disabled' sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null fi - force_depend rpcbind || return 1 + if ! checkyesno nfsv4_server_only; then + force_depend rpcbind || return 1 + fi + force_depend mountd || return 1 if [ -n "${nfs_server_vhost}" ]; then command_args="-V \"${nfs_server_vhost}\"" From owner-svn-src-stable@freebsd.org Sun Nov 29 23:37:19 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72A72468606; Sun, 29 Nov 2020 23:37:19 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CklC32gvdz3nj2; Sun, 29 Nov 2020 23:37:19 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A3F819F0C; Sun, 29 Nov 2020 23:37:19 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATNbJ9n029258; Sun, 29 Nov 2020 23:37:19 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATNbJeC029257; Sun, 29 Nov 2020 23:37:19 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202011292337.0ATNbJeC029257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 29 Nov 2020 23:37:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368166 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 368166 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 23:37:19 -0000 Author: rmacklem Date: Sun Nov 29 23:37:18 2020 New Revision: 368166 URL: https://svnweb.freebsd.org/changeset/base/368166 Log: Fix startup of gssd when /usr is a separately mounted local file system. meowthink@gmail.com reported that the gssd daemon was not starting, because /etc/rc.d/gssd was executed before his local /usr file system was mounted. He fixed the problem by adding mountcritlocal to the REQUIRED line. This fix seems safe and works for a separately mounted /usr file system on a local disk. The case of a separately mounted remote /usr file system (such as NFS) is still broken, but there is no obvious solution for that. Adding mountcritremote would fix the problem, but it would cause a POLA violation, because all kerberized NFS mounts in /etc/fstab would need the "late" option specified to work. Modified: stable/12/libexec/rc/rc.d/gssd Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/gssd ============================================================================== --- stable/12/libexec/rc/rc.d/gssd Sun Nov 29 23:23:08 2020 (r368165) +++ stable/12/libexec/rc/rc.d/gssd Sun Nov 29 23:37:18 2020 (r368166) @@ -4,7 +4,7 @@ # # PROVIDE: gssd -# REQUIRE: root +# REQUIRE: root mountcritlocal # KEYWORD: nojail shutdown . /etc/rc.subr From owner-svn-src-stable@freebsd.org Mon Nov 30 09:07:22 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7770474603; Mon, 30 Nov 2020 09:07:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckzrp4bK6z4mHH; Mon, 30 Nov 2020 09:07:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C09420DA3; Mon, 30 Nov 2020 09:07:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU97Mpn083789; Mon, 30 Nov 2020 09:07:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU97M3O083788; Mon, 30 Nov 2020 09:07:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300907.0AU97M3O083788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:07:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368170 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:07:22 -0000 Author: tuexen Date: Mon Nov 30 09:07:21 2020 New Revision: 368170 URL: https://svnweb.freebsd.org/changeset/base/368170 Log: MFC r366425: Cleanup, no functional change intended. Modified: stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Nov 30 08:31:41 2020 (r368169) +++ stable/12/sys/netinet/sctp_indata.c Mon Nov 30 09:07:21 2020 (r368170) @@ -289,17 +289,15 @@ sctp_build_ctl_nchunk(struct sctp_inpcb *inp, struct s static void sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn) { - uint32_t gap, i, cumackp1; - int fnd = 0; - int in_r = 0, in_nr = 0; + uint32_t gap, i; + int in_r, in_nr; if (SCTP_BASE_SYSCTL(sctp_do_drain) == 0) { return; } - cumackp1 = asoc->cumulative_tsn + 1; - if (SCTP_TSN_GT(cumackp1, tsn)) { + if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) { /* - * this tsn is behind the cum ack and thus we don't need to + * This tsn is behind the cum ack and thus we don't need to * worry about it being moved from one to the other. */ return; @@ -307,33 +305,27 @@ sctp_mark_non_revokable(struct sctp_association *asoc, SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn); in_r = SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap); in_nr = SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap); - if ((in_r == 0) && (in_nr == 0)) { -#ifdef INVARIANTS - panic("Things are really messed up now"); -#else - SCTP_PRINTF("gap:%x tsn:%x\n", gap, tsn); - sctp_print_mapping_array(asoc); -#endif - } - if (in_nr == 0) + KASSERT(in_r || in_nr, ("%s: Things are really messed up now", __FUNCTION__)); + if (!in_nr) { SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); - if (in_r) - SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); - if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { - asoc->highest_tsn_inside_nr_map = tsn; + if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { + asoc->highest_tsn_inside_nr_map = tsn; + } } - if (tsn == asoc->highest_tsn_inside_map) { - /* We must back down to see what the new highest is */ - for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) { - SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn); - if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) { - asoc->highest_tsn_inside_map = i; - fnd = 1; - break; + if (in_r) { + SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); + if (tsn == asoc->highest_tsn_inside_map) { + /* We must back down to see what the new highest is. */ + for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) { + SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn); + if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) { + asoc->highest_tsn_inside_map = i; + break; + } } - } - if (!fnd) { - asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1; + if (!SCTP_TSN_GE(i, asoc->mapping_array_base_tsn)) { + asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1; + } } } } From owner-svn-src-stable@freebsd.org Mon Nov 30 09:08:52 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 029E74744A0; Mon, 30 Nov 2020 09:08:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkztW6fwQz4mLd; Mon, 30 Nov 2020 09:08:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D76AC21008; Mon, 30 Nov 2020 09:08:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU98pZY083912; Mon, 30 Nov 2020 09:08:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU98pTa083910; Mon, 30 Nov 2020 09:08:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300908.0AU98pTa083910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368171 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:08:52 -0000 Author: tuexen Date: Mon Nov 30 09:08:51 2020 New Revision: 368171 URL: https://svnweb.freebsd.org/changeset/base/368171 Log: MFC r366426: Use __func__ instead of __FUNCTION__ for consistency. Modified: stable/12/sys/netinet/sctp_bsd_addr.c stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/12/sys/netinet/sctp_bsd_addr.c Mon Nov 30 09:07:21 2020 (r368170) +++ stable/12/sys/netinet/sctp_bsd_addr.c Mon Nov 30 09:08:51 2020 (r368171) @@ -378,7 +378,7 @@ sctp_get_mbuf_for_msg(unsigned int space_needed, int w m_freem(m); return (NULL); } - KASSERT(SCTP_BUF_NEXT(m) == NULL, ("%s: no chain allowed", __FUNCTION__)); + KASSERT(SCTP_BUF_NEXT(m) == NULL, ("%s: no chain allowed", __func__)); } #ifdef SCTP_MBUF_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Nov 30 09:07:21 2020 (r368170) +++ stable/12/sys/netinet/sctp_indata.c Mon Nov 30 09:08:51 2020 (r368171) @@ -305,7 +305,7 @@ sctp_mark_non_revokable(struct sctp_association *asoc, SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn); in_r = SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap); in_nr = SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap); - KASSERT(in_r || in_nr, ("%s: Things are really messed up now", __FUNCTION__)); + KASSERT(in_r || in_nr, ("%s: Things are really messed up now", __func__)); if (!in_nr) { SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { From owner-svn-src-stable@freebsd.org Mon Nov 30 09:10:05 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFEA147452E; Mon, 30 Nov 2020 09:10:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckzvx62ryz4mcQ; Mon, 30 Nov 2020 09:10:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C266A21009; Mon, 30 Nov 2020 09:10:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9A5uQ084066; Mon, 30 Nov 2020 09:10:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9A5w8084065; Mon, 30 Nov 2020 09:10:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300910.0AU9A5w8084065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368172 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:10:05 -0000 Author: tuexen Date: Mon Nov 30 09:10:05 2020 New Revision: 368172 URL: https://svnweb.freebsd.org/changeset/base/368172 Log: MFC 366474: Whitespace changes. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:08:51 2020 (r368171) +++ stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:10:05 2020 (r368172) @@ -1515,7 +1515,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle * ----INIT-ACK(tag=t)--> * ----INIT(tag=t)------> *1 * <---INIT-ACK(tag=a)--- - * <----CE(tag=t)------------- *2 + * <----CE(tag=t)------------- *2 * * At point *1 we should be generating a different * tag t'. Which means we would throw away the CE and send @@ -1748,8 +1748,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && (!SCTP_IS_LISTENING(inp))) { - stcb->sctp_ep->sctp_flags |= - SCTP_PCB_FLAGS_CONNECTED; + stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; soisconnected(stcb->sctp_socket); } if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) From owner-svn-src-stable@freebsd.org Mon Nov 30 09:11:25 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 039E147459F; Mon, 30 Nov 2020 09:11:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkzxS6mWbz4mgf; Mon, 30 Nov 2020 09:11:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB9DF20DA5; Mon, 30 Nov 2020 09:11:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9BOYd087304; Mon, 30 Nov 2020 09:11:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9BOgF087303; Mon, 30 Nov 2020 09:11:24 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300911.0AU9BOgF087303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368173 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368173 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:11:25 -0000 Author: tuexen Date: Mon Nov 30 09:11:24 2020 New Revision: 368173 URL: https://svnweb.freebsd.org/changeset/base/368173 Log: MFC r366480: Cleanup, no functional change intended. Modified: stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Mon Nov 30 09:10:05 2020 (r368172) +++ stable/12/sys/netinet/sctp_usrreq.c Mon Nov 30 09:11:24 2020 (r368173) @@ -3067,43 +3067,27 @@ flags_out: break; } case SCTP_RECVRCVINFO: - { - int onoff; - - if (*optsize < sizeof(int)) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - error = EINVAL; - } else { - SCTP_INP_RLOCK(inp); - onoff = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVRCVINFO); - SCTP_INP_RUNLOCK(inp); - } - if (error == 0) { - /* return the option value */ - *(int *)optval = onoff; - *optsize = sizeof(int); - } - break; + if (*optsize < sizeof(int)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } else { + SCTP_INP_RLOCK(inp); + *(int *)optval = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVRCVINFO); + SCTP_INP_RUNLOCK(inp); + *optsize = sizeof(int); } + break; case SCTP_RECVNXTINFO: - { - int onoff; - - if (*optsize < sizeof(int)) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - error = EINVAL; - } else { - SCTP_INP_RLOCK(inp); - onoff = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVNXTINFO); - SCTP_INP_RUNLOCK(inp); - } - if (error == 0) { - /* return the option value */ - *(int *)optval = onoff; - *optsize = sizeof(int); - } - break; + if (*optsize < sizeof(int)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } else { + SCTP_INP_RLOCK(inp); + *(int *)optval = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVNXTINFO); + SCTP_INP_RUNLOCK(inp); + *optsize = sizeof(int); } + break; case SCTP_DEFAULT_SNDINFO: { struct sctp_sndinfo *info; From owner-svn-src-stable@freebsd.org Mon Nov 30 09:12:46 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6DBE474751; Mon, 30 Nov 2020 09:12:46 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckzz250Gsz4n19; Mon, 30 Nov 2020 09:12:46 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DB7A20D66; Mon, 30 Nov 2020 09:12:46 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9CknQ089779; Mon, 30 Nov 2020 09:12:46 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9CjnZ089775; Mon, 30 Nov 2020 09:12:45 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300912.0AU9CjnZ089775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368174 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:12:46 -0000 Author: tuexen Date: Mon Nov 30 09:12:45 2020 New Revision: 368174 URL: https://svnweb.freebsd.org/changeset/base/368174 Log: MFC r366482: Remove dead stores reported by clang static code analysis Modified: stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:11:24 2020 (r368173) +++ stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:12:45 2020 (r368174) @@ -4131,7 +4131,6 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk * struct sctp_idata_chunk *idata_chunk; uint32_t bottle_bw, on_queue; uint32_t offset, chk_len; - uint16_t trunc_len; uint16_t pktdrp_len; uint8_t pktdrp_flags; @@ -4141,13 +4140,10 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk * pktdrp_len = ntohs(cp->ch.chunk_length); KASSERT(limit <= pktdrp_len, ("Inconsistent limit")); if (pktdrp_flags & SCTP_PACKET_TRUNCATED) { - trunc_len = ntohs(cp->trunc_len); - if (trunc_len <= pktdrp_len - sizeof(struct sctp_pktdrop_chunk)) { + if (ntohs(cp->trunc_len) <= pktdrp_len - sizeof(struct sctp_pktdrop_chunk)) { /* The peer plays games with us. */ return; } - } else { - trunc_len = 0; } limit -= sizeof(struct sctp_pktdrop_chunk); offset = 0; Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Mon Nov 30 09:11:24 2020 (r368173) +++ stable/12/sys/netinet/sctp_output.c Mon Nov 30 09:12:45 2020 (r368174) @@ -8822,7 +8822,7 @@ no_data_fill: * the top of the for, but just to make sure * I will reset these again here. */ - ctl_cnt = bundle_at = 0; + ctl_cnt = 0; continue; /* This takes us back to the * for() for the nets. */ } else { @@ -9423,7 +9423,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, uint32_t dmtu = 0; SCTP_TCB_LOCK_ASSERT(stcb); - tmr_started = ctl_cnt = bundle_at = error = 0; + tmr_started = ctl_cnt = 0; no_fragmentflg = 1; fwd_tsn = 0; *cnt_out = 0; Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Nov 30 09:11:24 2020 (r368173) +++ stable/12/sys/netinet/sctp_pcb.c Mon Nov 30 09:12:45 2020 (r368174) @@ -4394,7 +4394,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd LIST_INSERT_HEAD(head, stcb, sctp_asocs); SCTP_INP_INFO_WUNLOCK(); - if ((err = sctp_add_remote_addr(stcb, firstaddr, NULL, port, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) { + if (sctp_add_remote_addr(stcb, firstaddr, NULL, port, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC)) { /* failure.. memory error? */ if (asoc->strmout) { SCTP_FREE(asoc->strmout, SCTP_M_STRMO); Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Nov 30 09:11:24 2020 (r368173) +++ stable/12/sys/netinet/sctputil.c Mon Nov 30 09:12:45 2020 (r368174) @@ -1723,7 +1723,6 @@ sctp_timeout_handler(void *t) stcb = (struct sctp_tcb *)tmr->tcb; net = (struct sctp_nets *)tmr->net; CURVNET_SET((struct vnet *)tmr->vnet); - did_output = 1; released_asoc_reference = false; #ifdef SCTP_AUDITING_ENABLED @@ -1992,7 +1991,6 @@ sctp_timeout_handler(void *t) op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Shutdown guard timer expired"); sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); - did_output = true; /* no need to unlock on tcb its gone */ goto out_decr; @@ -2070,7 +2068,6 @@ sctp_timeout_handler(void *t) #ifdef INVARIANTS panic("Unknown timer type %d", type); #else - did_output = false; goto out; #endif } @@ -2153,7 +2150,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s ("sctp_timer_start of type %d: inp = %p, stcb->sctp_ep %p", t_type, stcb, stcb->sctp_ep)); tmr = NULL; - to_ticks = 0; if (stcb != NULL) { SCTP_TCB_LOCK_ASSERT(stcb); } else if (inp != NULL) { From owner-svn-src-stable@freebsd.org Mon Nov 30 09:14:02 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6532B474836; Mon, 30 Nov 2020 09:14:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl00V2T2dz4nMx; Mon, 30 Nov 2020 09:14:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47D6A20F18; Mon, 30 Nov 2020 09:14:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9E2of089895; Mon, 30 Nov 2020 09:14:02 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9E17c089894; Mon, 30 Nov 2020 09:14:01 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300914.0AU9E17c089894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368175 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:14:02 -0000 Author: tuexen Date: Mon Nov 30 09:14:01 2020 New Revision: 368175 URL: https://svnweb.freebsd.org/changeset/base/368175 Log: MFC r366483: Ensure variables are initialized before used. Modified: stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:12:45 2020 (r368174) +++ stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:14:01 2020 (r368175) @@ -5570,7 +5570,9 @@ sctp_common_input_processing(struct mbuf **mm, int iph stcb = NULL; goto out; } - data_processed = 1; + if (retval == 0) { + data_processed = 1; + } /* * Anything important needs to have been m_copy'ed in * process_data Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Nov 30 09:12:45 2020 (r368174) +++ stable/12/sys/netinet/sctp_pcb.c Mon Nov 30 09:14:01 2020 (r368175) @@ -6113,6 +6113,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, s peer_supports_prsctp = 0; peer_supports_auth = 0; peer_supports_asconf = 0; + peer_supports_asconf_ack = 0; peer_supports_reconfig = 0; peer_supports_nrsack = 0; peer_supports_pktdrop = 0; From owner-svn-src-stable@freebsd.org Mon Nov 30 09:15:31 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07852474850; Mon, 30 Nov 2020 09:15:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl02B6tQ7z4nbs; Mon, 30 Nov 2020 09:15:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE1BE20D67; Mon, 30 Nov 2020 09:15:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9FUNx090024; Mon, 30 Nov 2020 09:15:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9FUJK090023; Mon, 30 Nov 2020 09:15:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300915.0AU9FUJK090023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368176 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368176 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:15:31 -0000 Author: tuexen Date: Mon Nov 30 09:15:30 2020 New Revision: 368176 URL: https://svnweb.freebsd.org/changeset/base/368176 Log: MFC r366489: Reset delayed SACK state when restarting an SCTP association. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:14:01 2020 (r368175) +++ stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:15:30 2020 (r368176) @@ -1837,17 +1837,14 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle /* move to OPEN state, if not in SHUTDOWN_SENT */ SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); } - asoc->pre_open_streams = - ntohs(initack_cp->init.num_outbound_streams); + asoc->pre_open_streams = ntohs(initack_cp->init.num_outbound_streams); asoc->init_seq_number = ntohl(initack_cp->init.initial_tsn); asoc->sending_seq = asoc->asconf_seq_out = asoc->str_reset_seq_out = asoc->init_seq_number; asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1; - asoc->asconf_seq_in = asoc->last_acked_seq = asoc->init_seq_number - 1; - asoc->str_reset_seq_in = asoc->init_seq_number; - asoc->advanced_peer_ack_point = asoc->last_acked_seq; + asoc->send_sack = 1; if (asoc->mapping_array) { memset(asoc->mapping_array, 0, asoc->mapping_array_size); From owner-svn-src-stable@freebsd.org Mon Nov 30 09:16:52 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9150F474A8F; Mon, 30 Nov 2020 09:16:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl03m3j7Cz4nlh; Mon, 30 Nov 2020 09:16:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7221A2108C; Mon, 30 Nov 2020 09:16:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9GqNf090140; Mon, 30 Nov 2020 09:16:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9GqEQ090139; Mon, 30 Nov 2020 09:16:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300916.0AU9GqEQ090139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368177 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:16:52 -0000 Author: tuexen Date: Mon Nov 30 09:16:51 2020 New Revision: 368177 URL: https://svnweb.freebsd.org/changeset/base/368177 Log: MFC r366517: Minor cleanups. Modified: stable/12/sys/netinet/sctp_cc_functions.c stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/12/sys/netinet/sctp_cc_functions.c Mon Nov 30 09:15:30 2020 (r368176) +++ stable/12/sys/netinet/sctp_cc_functions.c Mon Nov 30 09:16:51 2020 (r368177) @@ -2002,12 +2002,12 @@ htcp_alpha_update(struct htcp *ca) scale = min(max(scale, 1U << 2), 10U << 3); /* clamping ratio to * interval [0.5,10]<<3 */ factor = (factor << 3) / scale; - if (!factor) + if (factor != 0) factor = 1; } ca->alpha = 2 * factor * ((1 << 7) - ca->beta); - if (!ca->alpha) + if (ca->alpha != 0) ca->alpha = ALPHA_BASE; } Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Mon Nov 30 09:15:30 2020 (r368176) +++ stable/12/sys/netinet/sctp_output.c Mon Nov 30 09:16:51 2020 (r368177) @@ -2783,8 +2783,7 @@ sctp_select_nth_preferred_addr_from_ifn_boundall(struc uint8_t dest_is_priv, int addr_wanted, sa_family_t fam, - sctp_route_t *ro -) + sctp_route_t *ro) { struct sctp_ifa *ifa, *sifa; int num_eligible_addr = 0; From owner-svn-src-stable@freebsd.org Mon Nov 30 09:18:14 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 702FA4745F8; Mon, 30 Nov 2020 09:18:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl05L2lxCz4njt; Mon, 30 Nov 2020 09:18:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5136F21111; Mon, 30 Nov 2020 09:18:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9IEq1090256; Mon, 30 Nov 2020 09:18:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9IDcJ090251; Mon, 30 Nov 2020 09:18:13 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300918.0AU9IDcJ090251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368178 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:18:14 -0000 Author: tuexen Date: Mon Nov 30 09:18:13 2020 New Revision: 368178 URL: https://svnweb.freebsd.org/changeset/base/368178 Log: MFC r366750: Improve the handling of cookie life times. The staleness reported in an error cause is in us, not ms. Enforce limits on the life time via sysct; and socket options consistently. Update the description of the sysctl variable to use the right unit. Also do some minor cleanups. This also fixes an interger overflow issue if the peer can modify the cookie. This was reported by Felix Weinrank by fuzz testing the userland stack and in https://oss-fuzz.com/testcase-detail/4800394024452096 Modified: stable/12/sys/netinet/sctp.h stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_sysctl.h stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp.h ============================================================================== --- stable/12/sys/netinet/sctp.h Mon Nov 30 09:16:51 2020 (r368177) +++ stable/12/sys/netinet/sctp.h Mon Nov 30 09:18:13 2020 (r368178) @@ -605,6 +605,7 @@ struct sctp_error_auth_invalid_hmac { */ #define SCTP_MAX_SACK_DELAY 500 /* per RFC4960 */ #define SCTP_MAX_HB_INTERVAL 14400000 /* 4 hours in ms */ +#define SCTP_MIN_COOKIE_LIFE 1000 /* 1 second in ms */ #define SCTP_MAX_COOKIE_LIFE 3600000 /* 1 hour in ms */ Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:16:51 2020 (r368177) +++ stable/12/sys/netinet/sctp_input.c Mon Nov 30 09:18:13 2020 (r368178) @@ -1168,13 +1168,10 @@ sctp_handle_error(struct sctp_chunkhdr *ch, struct sctp_error_stale_cookie *stale_cookie; stale_cookie = (struct sctp_error_stale_cookie *)cause; - asoc->cookie_preserve_req = ntohl(stale_cookie->stale_time); - /* Double it to be more robust on RTX */ - if (asoc->cookie_preserve_req <= UINT32_MAX / 2) { - asoc->cookie_preserve_req *= 2; - } else { - asoc->cookie_preserve_req = UINT32_MAX; - } + /* stable_time is in usec, convert to msec. */ + asoc->cookie_preserve_req = ntohl(stale_cookie->stale_time) / 1000; + /* Double it to be more robust on RTX. */ + asoc->cookie_preserve_req *= 2; asoc->stale_cookie_count++; if (asoc->stale_cookie_count > asoc->max_init_times) { @@ -2263,7 +2260,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in unsigned int sig_offset, cookie_offset; unsigned int cookie_len; struct timeval now; - struct timeval time_expires; + struct timeval time_entered, time_expires; int notification = 0; struct sctp_nets *netl; int had_a_existing_tcb = 0; @@ -2391,13 +2388,30 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in return (NULL); } + if (sctp_ticks_to_msecs(cookie->cookie_life) > SCTP_MAX_COOKIE_LIFE) { + SCTPDBG(SCTP_DEBUG_INPUT2, "handle_cookie_echo: Invalid cookie lifetime\n"); + return (NULL); + } + time_entered.tv_sec = cookie->time_entered.tv_sec; + time_entered.tv_usec = cookie->time_entered.tv_usec; + if ((time_entered.tv_sec < 0) || + (time_entered.tv_usec < 0) || + (time_entered.tv_usec >= 1000000)) { + /* Invalid time stamp. Cookie must have been modified. */ + SCTPDBG(SCTP_DEBUG_INPUT2, "handle_cookie_echo: Invalid time stamp\n"); + return (NULL); + } + (void)SCTP_GETTIME_TIMEVAL(&now); + if (timevalcmp(&now, &time_entered, <)) { + SCTPDBG(SCTP_DEBUG_INPUT2, "handle_cookie_echo: cookie generated in the future!\n"); + return (NULL); + } /* - * check the cookie timestamps to be sure it's not stale + * Check the cookie timestamps to be sure it's not stale. + * cookie_life is in ticks, so we convert to seconds. */ - (void)SCTP_GETTIME_TIMEVAL(&now); - /* Expire time is in Ticks, so we convert to seconds */ - time_expires.tv_sec = cookie->time_entered.tv_sec + sctp_ticks_to_secs(cookie->cookie_life); - time_expires.tv_usec = cookie->time_entered.tv_usec; + time_expires.tv_sec = time_entered.tv_sec + sctp_ticks_to_secs(cookie->cookie_life); + time_expires.tv_usec = time_entered.tv_usec; if (timevalcmp(&now, &time_expires, >)) { /* cookie is stale! */ struct mbuf *op_err; @@ -2415,8 +2429,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_stale_cookie); cause = mtod(op_err, struct sctp_error_stale_cookie *); cause->cause.code = htons(SCTP_CAUSE_STALE_COOKIE); - cause->cause.length = htons((sizeof(struct sctp_paramhdr) + - (sizeof(uint32_t)))); + cause->cause.length = htons(sizeof(struct sctp_error_stale_cookie)); diff = now; timevalsub(&diff, &time_expires); if ((uint32_t)diff.tv_sec > UINT32_MAX / 1000000) { Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Mon Nov 30 09:16:51 2020 (r368177) +++ stable/12/sys/netinet/sctp_output.c Mon Nov 30 09:18:13 2020 (r368178) @@ -4833,7 +4833,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp } /* now any cookie time extensions */ - if (stcb->asoc.cookie_preserve_req) { + if (stcb->asoc.cookie_preserve_req > 0) { struct sctp_cookie_perserve_param *cookie_preserve; if (padding_len > 0) { Modified: stable/12/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/12/sys/netinet/sctp_sysctl.h Mon Nov 30 09:16:51 2020 (r368177) +++ stable/12/sys/netinet/sctp_sysctl.h Mon Nov 30 09:18:13 2020 (r368178) @@ -318,10 +318,10 @@ struct sctp_sysctl { #define SCTPCTL_INIT_RTO_MAX_MAX 0xFFFFFFFF #define SCTPCTL_INIT_RTO_MAX_DEFAULT SCTP_RTO_UPPER_BOUND -/* valid_cookie_life: Default cookie lifetime in sec */ -#define SCTPCTL_VALID_COOKIE_LIFE_DESC "Default cookie lifetime in seconds" -#define SCTPCTL_VALID_COOKIE_LIFE_MIN 0 -#define SCTPCTL_VALID_COOKIE_LIFE_MAX 0xFFFFFFFF +/* valid_cookie_life: Default cookie lifetime in ms */ +#define SCTPCTL_VALID_COOKIE_LIFE_DESC "Default cookie lifetime in ms" +#define SCTPCTL_VALID_COOKIE_LIFE_MIN SCTP_MIN_COOKIE_LIFE +#define SCTPCTL_VALID_COOKIE_LIFE_MAX SCTP_MAX_COOKIE_LIFE #define SCTPCTL_VALID_COOKIE_LIFE_DEFAULT SCTP_DEFAULT_COOKIE_LIFE /* init_rtx_max: Default maximum number of retransmission for INIT chunks */ Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Mon Nov 30 09:16:51 2020 (r368177) +++ stable/12/sys/netinet/sctp_usrreq.c Mon Nov 30 09:18:13 2020 (r368178) @@ -5691,18 +5691,20 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_CHECK_AND_CAST(sasoc, optval, struct sctp_assocparams, optsize); SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id); - if (sasoc->sasoc_cookie_life) { + if (sasoc->sasoc_cookie_life > 0) { /* boundary check the cookie life */ - if (sasoc->sasoc_cookie_life < 1000) - sasoc->sasoc_cookie_life = 1000; + if (sasoc->sasoc_cookie_life < SCTP_MIN_COOKIE_LIFE) { + sasoc->sasoc_cookie_life = SCTP_MIN_COOKIE_LIFE; + } if (sasoc->sasoc_cookie_life > SCTP_MAX_COOKIE_LIFE) { sasoc->sasoc_cookie_life = SCTP_MAX_COOKIE_LIFE; } } if (stcb) { - if (sasoc->sasoc_asocmaxrxt) + if (sasoc->sasoc_asocmaxrxt > 0) { stcb->asoc.max_send_times = sasoc->sasoc_asocmaxrxt; - if (sasoc->sasoc_cookie_life) { + } + if (sasoc->sasoc_cookie_life > 0) { stcb->asoc.cookie_life = sctp_msecs_to_ticks(sasoc->sasoc_cookie_life); } SCTP_TCB_UNLOCK(stcb); @@ -5712,9 +5714,10 @@ sctp_setopt(struct socket *so, int optname, void *optv ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) && (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC))) { SCTP_INP_WLOCK(inp); - if (sasoc->sasoc_asocmaxrxt) + if (sasoc->sasoc_asocmaxrxt > 0) { inp->sctp_ep.max_send_times = sasoc->sasoc_asocmaxrxt; - if (sasoc->sasoc_cookie_life) { + } + if (sasoc->sasoc_cookie_life > 0) { inp->sctp_ep.def_cookie_life = sctp_msecs_to_ticks(sasoc->sasoc_cookie_life); } SCTP_INP_WUNLOCK(inp); From owner-svn-src-stable@freebsd.org Mon Nov 30 09:21:02 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64A4E474D02; Mon, 30 Nov 2020 09:21:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl08Z2PKPz4nqw; Mon, 30 Nov 2020 09:21:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AC0921048; Mon, 30 Nov 2020 09:21:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9L2PP091166; Mon, 30 Nov 2020 09:21:02 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9L27g091165; Mon, 30 Nov 2020 09:21:02 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300921.0AU9L27g091165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368179 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 368179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:21:02 -0000 Author: tuexen Date: Mon Nov 30 09:21:01 2020 New Revision: 368179 URL: https://svnweb.freebsd.org/changeset/base/368179 Log: MFC r367464: The ioctl() calls using FIONREAD, FIONWRITE, FIONSPACE, and SIOCATMARK access the socket send or receive buffer. This is not possible for listening sockets since r319722. Because send()/recv() calls fail on listening sockets, fail also ioctl() indicating EINVAL. PR: 250366 Reported by: Yong-Hao Zou Reviewed by: glebius, rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D26897 Modified: stable/12/sys/kern/sys_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_socket.c ============================================================================== --- stable/12/sys/kern/sys_socket.c Mon Nov 30 09:18:13 2020 (r368178) +++ stable/12/sys/kern/sys_socket.c Mon Nov 30 09:21:01 2020 (r368179) @@ -207,21 +207,34 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, str case FIONREAD: /* Unlocked read. */ - *(int *)data = sbavail(&so->so_rcv); + if (SOLISTENING(so)) { + error = EINVAL; + } else { + *(int *)data = sbavail(&so->so_rcv); + } break; case FIONWRITE: /* Unlocked read. */ - *(int *)data = sbavail(&so->so_snd); + if (SOLISTENING(so)) { + error = EINVAL; + } else { + *(int *)data = sbavail(&so->so_snd); + } break; case FIONSPACE: /* Unlocked read. */ - if ((so->so_snd.sb_hiwat < sbused(&so->so_snd)) || - (so->so_snd.sb_mbmax < so->so_snd.sb_mbcnt)) - *(int *)data = 0; - else - *(int *)data = sbspace(&so->so_snd); + if (SOLISTENING(so)) { + error = EINVAL; + } else { + if ((so->so_snd.sb_hiwat < sbused(&so->so_snd)) || + (so->so_snd.sb_mbmax < so->so_snd.sb_mbcnt)) { + *(int *)data = 0; + } else { + *(int *)data = sbspace(&so->so_snd); + } + } break; case FIOSETOWN: @@ -242,7 +255,11 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, str case SIOCATMARK: /* Unlocked read. */ - *(int *)data = (so->so_rcv.sb_state & SBS_RCVATMARK) != 0; + if (SOLISTENING(so)) { + error = EINVAL; + } else { + *(int *)data = (so->so_rcv.sb_state & SBS_RCVATMARK) != 0; + } break; default: /* From owner-svn-src-stable@freebsd.org Mon Nov 30 09:22:34 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C847474C3C; Mon, 30 Nov 2020 09:22:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl0BK71Bsz4pB6; Mon, 30 Nov 2020 09:22:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3A1720FAB; Mon, 30 Nov 2020 09:22:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9MXpL096574; Mon, 30 Nov 2020 09:22:33 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9MXOf096573; Mon, 30 Nov 2020 09:22:33 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300922.0AU9MXOf096573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368180 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:22:34 -0000 Author: tuexen Date: Mon Nov 30 09:22:33 2020 New Revision: 368180 URL: https://svnweb.freebsd.org/changeset/base/368180 Log: MFC r367520: Fix a potential use-after-free bug introduced in https://svnweb.freebsd.org/changeset/base/363046 Thanks to Taylor Brandstetter for finding this issue using fuzz testing and reporting it in https://github.com/sctplab/usrsctp/issues/547 Modified: stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Nov 30 09:21:01 2020 (r368179) +++ stable/12/sys/netinet/sctp_indata.c Mon Nov 30 09:22:33 2020 (r368180) @@ -5521,7 +5521,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, unsigned int i, fwd_sz, m_size; uint32_t str_seq; struct sctp_stream_in *strm; - struct sctp_queued_to_read *control, *sv; + struct sctp_queued_to_read *control, *ncontrol, *sv; asoc = &stcb->asoc; if ((fwd_sz = ntohs(fwd->ch.chunk_length)) < sizeof(struct sctp_forward_tsn_chunk)) { @@ -5681,14 +5681,14 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, } strm = &asoc->strmin[sid]; if (ordered) { - TAILQ_FOREACH(control, &strm->inqueue, next_instrm) { + TAILQ_FOREACH_SAFE(control, &strm->inqueue, next_instrm, ncontrol) { if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn); } } } else { if (asoc->idata_supported) { - TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { + TAILQ_FOREACH_SAFE(control, &strm->uno_inqueue, next_instrm, ncontrol) { if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn); } From owner-svn-src-stable@freebsd.org Mon Nov 30 09:45:45 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED72F4750EE; Mon, 30 Nov 2020 09:45:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl0j56M0Sz4qY7; Mon, 30 Nov 2020 09:45:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8A3821260; Mon, 30 Nov 2020 09:45:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9jjVk008964; Mon, 30 Nov 2020 09:45:45 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9jilR008960; Mon, 30 Nov 2020 09:45:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300945.0AU9jilR008960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368181 - in stable/12/sys/netinet: . tcp_stacks X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 368181 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:45:46 -0000 Author: tuexen Date: Mon Nov 30 09:45:44 2020 New Revision: 368181 URL: https://svnweb.freebsd.org/changeset/base/368181 Log: MFC r367530: RFC 7323 specifies that: * TCP segments without timestamps should be dropped when support for the timestamp option has been negotiated. * TCP segments with timestamps should be processed normally if support for the timestamp option has not been negotiated. This patch enforces the above. Manually resolved merge conflicts. MFC 367891: Fix an issue I introuced in r367530: tcp_twcheck() can be called with to == NULL for SYN segments. So don't assume tp != NULL. Thanks to jhb@ for reporting and suggesting a fix. MFC r367946: Fix two occurences of a typo in a comment introduced in r367530. Thanks to lstewart@ for reporting them. PR: 250499 Reviewed by: gnn, rrs Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D27148 Modified: stable/12/sys/netinet/tcp_input.c stable/12/sys/netinet/tcp_stacks/rack.c stable/12/sys/netinet/tcp_syncache.c stable/12/sys/netinet/tcp_timewait.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_input.c ============================================================================== --- stable/12/sys/netinet/tcp_input.c Mon Nov 30 09:22:33 2020 (r368180) +++ stable/12/sys/netinet/tcp_input.c Mon Nov 30 09:45:44 2020 (r368181) @@ -975,8 +975,8 @@ findpcb: } INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - if (thflags & TH_SYN) - tcp_dooptions(&to, optp, optlen, TO_SYN); + tcp_dooptions(&to, optp, optlen, + (thflags & TH_SYN) ? TO_SYN : 0); /* * NB: tcp_twcheck unlocks the INP and frees the mbuf. */ @@ -1706,20 +1706,29 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru } /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session and vice versa. + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. */ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); + "segment silently dropped\n", s, __func__); free(s, M_TCPLOG); } + goto drop; } + /* + * If timestamps were not negotiated during SYN/ACK and a + * segment with a timestamp is received, ignore the + * timestamp and process the packet normally. + * See section 3.2 of RFC 7323. + */ if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "no action\n", s, __func__); + "segment processed normally\n", s, __func__); free(s, M_TCPLOG); } } Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Mon Nov 30 09:22:33 2020 (r368180) +++ stable/12/sys/netinet/tcp_stacks/rack.c Mon Nov 30 09:45:44 2020 (r368181) @@ -6708,7 +6708,27 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, tlen, &log, true); } + /* + * Parse options on any incoming segment. + */ + tcp_dooptions(&to, (u_char *)(th + 1), + (th->th_off << 2) - sizeof(struct tcphdr), + (thflags & TH_SYN) ? TO_SYN : 0); + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + way_out = 5; + retval = 0; + goto done_with_input; + } + + /* * Segment received on connection. Reset idle time and keep-alive * timer. XXX: This should be done after segment validation to * ignore broken/spoofed segs. @@ -6761,12 +6781,6 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th rack_cong_signal(tp, th, CC_ECN); } } - /* - * Parse options on any incoming segment. - */ - tcp_dooptions(&to, (u_char *)(th + 1), - (th->th_off << 2) - sizeof(struct tcphdr), - (thflags & TH_SYN) ? TO_SYN : 0); /* * If echoed timestamp is later than the current time, fall back to @@ -6898,6 +6912,7 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th rack_timer_audit(tp, rack, &so->so_snd); way_out = 2; } + done_with_input: rack_log_doseg_done(rack, cts, nxt_pkt, did_out, way_out); if (did_out) rack->r_wanted_output = 0; Modified: stable/12/sys/netinet/tcp_syncache.c ============================================================================== --- stable/12/sys/netinet/tcp_syncache.c Mon Nov 30 09:22:33 2020 (r368180) +++ stable/12/sys/netinet/tcp_syncache.c Mon Nov 30 09:45:44 2020 (r368181) @@ -1142,6 +1142,40 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt } /* + * If timestamps were not negotiated during SYN/ACK and a + * segment with a timestamp is received, ignore the + * timestamp and process the packet normally. + * See section 3.2 of RFC 7323. + */ + if (!(sc->sc_flags & SCF_TIMESTAMP) && + (to->to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp not " + "expected, segment processed normally\n", + s, __func__); + free(s, M_TCPLOG); + s = NULL; + } + } + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if ((sc->sc_flags & SCF_TIMESTAMP) && + !(to->to_flags & TOF_TS)) { + SCH_UNLOCK(sch); + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "segment silently dropped\n", s, __func__); + free(s, M_TCPLOG); + } + return (-1); /* Do not send RST */ + } + + /* * Pull out the entry to unlock the bucket row. * * NOTE: We must decrease TCPS_SYN_RECEIVED count here, not @@ -1184,32 +1218,6 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt log(LOG_DEBUG, "%s; %s: SEQ %u != IRS+1 %u, segment " "rejected\n", s, __func__, th->th_seq, sc->sc_irs); goto failed; - } - - /* - * If timestamps were not negotiated during SYN/ACK they - * must not appear on any segment during this session. - */ - if (!(sc->sc_flags & SCF_TIMESTAMP) && (to->to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) - log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "segment rejected\n", s, __func__); - goto failed; - } - - /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session. - * XXXAO: This is only informal as there have been unverified - * reports of non-compliants stacks. - */ - if ((sc->sc_flags & SCF_TIMESTAMP) && !(to->to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - s = NULL; - } } *lsop = syncache_socket(sc, *lsop, m); Modified: stable/12/sys/netinet/tcp_timewait.c ============================================================================== --- stable/12/sys/netinet/tcp_timewait.c Mon Nov 30 09:22:33 2020 (r368180) +++ stable/12/sys/netinet/tcp_timewait.c Mon Nov 30 09:45:44 2020 (r368181) @@ -373,9 +373,10 @@ tcp_twstart(struct tcpcb *tp) /* * Returns 1 if the TIME_WAIT state was killed and we should start over, * looking for a pcb in the listen state. Returns 0 otherwise. + * It be called with to == NULL only for pure SYN-segments. */ int -tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr *th, +tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, struct mbuf *m, int tlen) { struct tcptw *tw; @@ -396,6 +397,8 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu goto drop; thflags = th->th_flags; + KASSERT(to != NULL || (thflags & (TH_SYN | TH_ACK)) == TH_SYN, + ("tcp_twcheck: called without options on a non-SYN segment")); /* * NOTE: for FIN_WAIT_2 (to be added later), @@ -443,6 +446,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu */ if ((thflags & TH_ACK) == 0) goto drop; + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) { + goto drop; + } /* * Reset the 2MSL timer if this is a duplicate FIN. From owner-svn-src-stable@freebsd.org Mon Nov 30 10:58:07 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D07B54773E7; Mon, 30 Nov 2020 10:58:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl2Jb5bCKz4vVN; Mon, 30 Nov 2020 10:58:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2D4B222BD; Mon, 30 Nov 2020 10:58:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUAw7jB052451; Mon, 30 Nov 2020 10:58:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUAw7j2052448; Mon, 30 Nov 2020 10:58:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011301058.0AUAw7j2052448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 10:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368183 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 368183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 10:58:07 -0000 Author: tuexen Date: Mon Nov 30 10:58:06 2020 New Revision: 368183 URL: https://svnweb.freebsd.org/changeset/base/368183 Log: MFC r367530: RFC 7323 specifies that: * TCP segments without timestamps should be dropped when support for the timestamp option has been negotiated. * TCP segments with timestamps should be processed normally if support for the timestamp option has not been negotiated. This patch enforces the above. Manually resolved merge conflicts. MFC 367891: Fix an issue I introuced in r367530: tcp_twcheck() can be called with to == NULL for SYN segments. So don't assume tp != NULL. Thanks to jhb@ for reporting and suggesting a fix. MFC r367946: Fix two occurences of a typo in a comment introduced in r367530. Thanks to lstewart@ for reporting them. PR: 250499 Reviewed by: gnn, rrs Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D27148 Modified: stable/11/sys/netinet/tcp_input.c stable/11/sys/netinet/tcp_syncache.c stable/11/sys/netinet/tcp_timewait.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Mon Nov 30 09:47:53 2020 (r368182) +++ stable/11/sys/netinet/tcp_input.c Mon Nov 30 10:58:06 2020 (r368183) @@ -992,8 +992,8 @@ relocked: } INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - if (thflags & TH_SYN) - tcp_dooptions(&to, optp, optlen, TO_SYN); + tcp_dooptions(&to, optp, optlen, + (thflags & TH_SYN) ? TO_SYN : 0); /* * NB: tcp_twcheck unlocks the INP and frees the mbuf. */ @@ -1729,20 +1729,29 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru } /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session and vice versa. + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. */ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); + "segment silently dropped\n", s, __func__); free(s, M_TCPLOG); } + goto drop; } + /* + * If timestamps were not negotiated during SYN/ACK and a + * segment with a timestamp is received, ignore the + * timestamp and process the packet normally. + * See section 3.2 of RFC 7323. + */ if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "no action\n", s, __func__); + "segment processed normally\n", s, __func__); free(s, M_TCPLOG); } } Modified: stable/11/sys/netinet/tcp_syncache.c ============================================================================== --- stable/11/sys/netinet/tcp_syncache.c Mon Nov 30 09:47:53 2020 (r368182) +++ stable/11/sys/netinet/tcp_syncache.c Mon Nov 30 10:58:06 2020 (r368183) @@ -1111,6 +1111,40 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt } /* + * If timestamps were not negotiated during SYN/ACK and a + * segment with a timestamp is received, ignore the + * timestamp and process the packet normally. + * See section 3.2 of RFC 7323. + */ + if (!(sc->sc_flags & SCF_TIMESTAMP) && + (to->to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp not " + "expected, segment processed normally\n", + s, __func__); + free(s, M_TCPLOG); + s = NULL; + } + } + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if ((sc->sc_flags & SCF_TIMESTAMP) && + !(to->to_flags & TOF_TS)) { + SCH_UNLOCK(sch); + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "segment silently dropped\n", s, __func__); + free(s, M_TCPLOG); + } + return (-1); /* Do not send RST */ + } + + /* * Pull out the entry to unlock the bucket row. * * NOTE: We must decrease TCPS_SYN_RECEIVED count here, not @@ -1153,32 +1187,6 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt log(LOG_DEBUG, "%s; %s: SEQ %u != IRS+1 %u, segment " "rejected\n", s, __func__, th->th_seq, sc->sc_irs); goto failed; - } - - /* - * If timestamps were not negotiated during SYN/ACK they - * must not appear on any segment during this session. - */ - if (!(sc->sc_flags & SCF_TIMESTAMP) && (to->to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) - log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "segment rejected\n", s, __func__); - goto failed; - } - - /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session. - * XXXAO: This is only informal as there have been unverified - * reports of non-compliants stacks. - */ - if ((sc->sc_flags & SCF_TIMESTAMP) && !(to->to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - s = NULL; - } } *lsop = syncache_socket(sc, *lsop, m); Modified: stable/11/sys/netinet/tcp_timewait.c ============================================================================== --- stable/11/sys/netinet/tcp_timewait.c Mon Nov 30 09:47:53 2020 (r368182) +++ stable/11/sys/netinet/tcp_timewait.c Mon Nov 30 10:58:06 2020 (r368183) @@ -373,9 +373,10 @@ tcp_twstart(struct tcpcb *tp) /* * Returns 1 if the TIME_WAIT state was killed and we should start over, * looking for a pcb in the listen state. Returns 0 otherwise. + * It be called with to == NULL only for pure SYN-segments. */ int -tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr *th, +tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, struct mbuf *m, int tlen) { struct tcptw *tw; @@ -396,6 +397,8 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu goto drop; thflags = th->th_flags; + KASSERT(to != NULL || (thflags & (TH_SYN | TH_ACK)) == TH_SYN, + ("tcp_twcheck: called without options on a non-SYN segment")); /* * NOTE: for FIN_WAIT_2 (to be added later), @@ -443,6 +446,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu */ if ((thflags & TH_ACK) == 0) goto drop; + + /* + * If timestamps were negotiated during SYN/ACK and a + * segment without a timestamp is received, silently drop + * the segment. + * See section 3.2 of RFC 7323. + */ + if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) { + goto drop; + } /* * Reset the 2MSL timer if this is a duplicate FIN. From owner-svn-src-stable@freebsd.org Mon Nov 30 22:35:31 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80F184AA2D1; Mon, 30 Nov 2020 22:35:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClKnH3Gj0z4pjX; Mon, 30 Nov 2020 22:35:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 638642977; Mon, 30 Nov 2020 22:35:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUMZVCS091972; Mon, 30 Nov 2020 22:35:31 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUMZVmM091971; Mon, 30 Nov 2020 22:35:31 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202011302235.0AUMZVmM091971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 30 Nov 2020 22:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368201 - in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib X-SVN-Commit-Revision: 368201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 22:35:31 -0000 Author: cy Date: Mon Nov 30 22:35:30 2020 New Revision: 368201 URL: https://svnweb.freebsd.org/changeset/base/368201 Log: MFC r366285: Resurrect ipfilter's getifname, replacing the stub with the real function. Modified: stable/12/contrib/ipfilter/lib/getifname.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/lib/getifname.c Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/ipfilter/lib/getifname.c ============================================================================== --- stable/12/contrib/ipfilter/lib/getifname.c Mon Nov 30 22:16:11 2020 (r368200) +++ stable/12/contrib/ipfilter/lib/getifname.c Mon Nov 30 22:35:30 2020 (r368201) @@ -16,7 +16,6 @@ * Given a pointer to an interface in the kernel, return a pointer to a * string which is the interface name. */ -#if 0 char *getifname(ptr) struct ifnet *ptr; { @@ -80,13 +79,3 @@ char *getifname(ptr) # endif #endif } -#else -char *getifname(ptr) - struct ifnet *ptr; -{ -#if 0 - ptr = ptr; -#endif - return "X"; -} -#endif From owner-svn-src-stable@freebsd.org Mon Nov 30 22:35:31 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4199D4AA40C; Mon, 30 Nov 2020 22:35:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClKnH0z3bz4plb; Mon, 30 Nov 2020 22:35:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 140F92976; Mon, 30 Nov 2020 22:35:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUMZUPG091966; Mon, 30 Nov 2020 22:35:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUMZUFi091965; Mon, 30 Nov 2020 22:35:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202011302235.0AUMZUFi091965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 30 Nov 2020 22:35:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368201 - in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib X-SVN-Commit-Revision: 368201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 22:35:31 -0000 Author: cy Date: Mon Nov 30 22:35:30 2020 New Revision: 368201 URL: https://svnweb.freebsd.org/changeset/base/368201 Log: MFC r366285: Resurrect ipfilter's getifname, replacing the stub with the real function. Modified: stable/11/contrib/ipfilter/lib/getifname.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/ipfilter/lib/getifname.c Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/ipfilter/lib/getifname.c ============================================================================== --- stable/11/contrib/ipfilter/lib/getifname.c Mon Nov 30 22:16:11 2020 (r368200) +++ stable/11/contrib/ipfilter/lib/getifname.c Mon Nov 30 22:35:30 2020 (r368201) @@ -16,7 +16,6 @@ * Given a pointer to an interface in the kernel, return a pointer to a * string which is the interface name. */ -#if 0 char *getifname(ptr) struct ifnet *ptr; { @@ -80,13 +79,3 @@ char *getifname(ptr) # endif #endif } -#else -char *getifname(ptr) - struct ifnet *ptr; -{ -#if 0 - ptr = ptr; -#endif - return "X"; -} -#endif From owner-svn-src-stable@freebsd.org Tue Dec 1 03:07:27 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15A11469F44; Tue, 1 Dec 2020 03:07:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClRq308V1z3PY8; Tue, 1 Dec 2020 03:07:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC4DD6AA1; Tue, 1 Dec 2020 03:07:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B137Qhj068956; Tue, 1 Dec 2020 03:07:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B137Q4m068955; Tue, 1 Dec 2020 03:07:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012010307.0B137Q4m068955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Dec 2020 03:07:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368202 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 368202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 03:07:27 -0000 Author: markj Date: Tue Dec 1 03:07:26 2020 New Revision: 368202 URL: https://svnweb.freebsd.org/changeset/base/368202 Log: MFC r367114 (by melifaro): Fix use-after-free in icmp6_notify_error(). Modified: stable/11/sys/netinet6/icmp6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/icmp6.c ============================================================================== --- stable/11/sys/netinet6/icmp6.c Mon Nov 30 22:35:30 2020 (r368201) +++ stable/11/sys/netinet6/icmp6.c Tue Dec 1 03:07:26 2020 (r368202) @@ -903,6 +903,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp } #endif eip6 = (struct ip6_hdr *)(icmp6 + 1); + bzero(&icmp6dst, sizeof(icmp6dst)); /* Detect the upper level protocol */ { @@ -911,7 +912,6 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp int eoff = off + sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr); struct ip6ctlparam ip6cp; - struct in6_addr *finaldst = NULL; int icmp6type = icmp6->icmp6_type; struct ip6_frag *fh; struct ip6_rthdr *rth; @@ -994,7 +994,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp /* just ignore a bogus header */ if ((rth0->ip6r0_len % 2) == 0 && (hops = rth0->ip6r0_len/2)) - finaldst = (struct in6_addr *)(rth0 + 1) + (hops - 1); + icmp6dst.sin6_addr = *((struct in6_addr *)(rth0 + 1) + (hops - 1)); } eoff += rthlen; nxt = rth->ip6r_nxt; @@ -1059,13 +1059,10 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp */ eip6 = (struct ip6_hdr *)(icmp6 + 1); - bzero(&icmp6dst, sizeof(icmp6dst)); icmp6dst.sin6_len = sizeof(struct sockaddr_in6); icmp6dst.sin6_family = AF_INET6; - if (finaldst == NULL) + if (IN6_IS_ADDR_UNSPECIFIED(&icmp6dst.sin6_addr)) icmp6dst.sin6_addr = eip6->ip6_dst; - else - icmp6dst.sin6_addr = *finaldst; if (in6_setscope(&icmp6dst.sin6_addr, m->m_pkthdr.rcvif, NULL)) goto freeit; bzero(&icmp6src, sizeof(icmp6src)); @@ -1077,13 +1074,11 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp icmp6src.sin6_flowinfo = (eip6->ip6_flow & IPV6_FLOWLABEL_MASK); - if (finaldst == NULL) - finaldst = &eip6->ip6_dst; ip6cp.ip6c_m = m; ip6cp.ip6c_icmp6 = icmp6; ip6cp.ip6c_ip6 = (struct ip6_hdr *)(icmp6 + 1); ip6cp.ip6c_off = eoff; - ip6cp.ip6c_finaldst = finaldst; + ip6cp.ip6c_finaldst = &icmp6dst.sin6_addr; ip6cp.ip6c_src = &icmp6src; ip6cp.ip6c_nxt = nxt; From owner-svn-src-stable@freebsd.org Tue Dec 1 09:24:16 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1494D4A32D5; Tue, 1 Dec 2020 09:24:16 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clc9q71M4z3Fpv; Tue, 1 Dec 2020 09:24:15 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF873134EE; Tue, 1 Dec 2020 09:24:15 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B19OF5W017779; Tue, 1 Dec 2020 09:24:15 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B19OFJT017778; Tue, 1 Dec 2020 09:24:15 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202012010924.0B19OFJT017778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 1 Dec 2020 09:24:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368205 - stable/12/usr.bin/chpass X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/usr.bin/chpass X-SVN-Commit-Revision: 368205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 09:24:16 -0000 Author: 0mp (doc,ports committer) Date: Tue Dec 1 09:24:15 2020 New Revision: 368205 URL: https://svnweb.freebsd.org/changeset/base/368205 Log: MFC r367757, r367756, r367759, r367769: Improve readability of the lists of options - Sort options alphabetically - Add missing arguments (e.g., "list" to -a) - Adjust the width of Bl Clean up the synopsis section & fix mandoc warnings The synopsis section had two very similar entries. The flags documented by the first one were a strict subset of the second one. Let's just keep only the second entry for simplicity. Add an example for the -s flag Partially revert r367756 (chpass(1) synopsis changes) Let's have two entries in the synopsis: - chpass now lists options which can be used for non-NIS-specific functionalities. - ypchpass additionally lists the NIS-specific flags. Technically, it is an artificial distinction, as chpass and ypchpass behave identically. Nevertheless, it might help navigating the synopsis section. Reviewed by: imp Modified: stable/12/usr.bin/chpass/chpass.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/chpass/chpass.1 ============================================================================== --- stable/12/usr.bin/chpass/chpass.1 Tue Dec 1 09:18:18 2020 (r368204) +++ stable/12/usr.bin/chpass/chpass.1 Tue Dec 1 09:24:15 2020 (r368205) @@ -28,7 +28,7 @@ .\" @(#)chpass.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd December 30, 1993 +.Dd November 17, 2020 .Dt CHPASS 1 .Os .Sh NAME @@ -40,20 +40,20 @@ .Nm ypchsh .Nd add or change user database information .Sh SYNOPSIS -.Nm +.Nm chpass .Op Fl a Ar list -.Op Fl p Ar encpass .Op Fl e Ar expiretime +.Op Fl p Ar encpass .Op Fl s Ar newshell .Op user -.Nm -.Op Fl oly +.Nm ypchpass +.Op Fl loy .Op Fl a Ar list -.Op Fl p Ar encpass -.Op Fl e Ar expiretime -.Op Fl s Ar newshell .Op Fl d Ar domain +.Op Fl e Ar expiretime .Op Fl h Ar host +.Op Fl p Ar encpass +.Op Fl s Ar newshell .Op user .Sh DESCRIPTION The @@ -80,8 +80,8 @@ The information is formatted and supplied to an editor Only the information that the user is allowed to change is displayed. .Pp The options are as follows: -.Bl -tag -width indent -.It Fl a +.Bl -tag -width "-e expiretime" +.It Fl a Ar list The super-user is allowed to directly supply a user database entry, in the format specified by .Xr passwd 5 , @@ -90,15 +90,15 @@ This argument must be a colon .Pq Dq \&: separated list of all the user database fields, although they may be empty. -.It Fl p -The super-user is allowed to directly supply an encrypted password field, -in the format used by -.Xr crypt 3 , -as an argument. .It Fl e Ar expiretime Change the account expire time. This option is used to set the expire time from a script as if it was done in the interactive editor. +.It Fl p Ar encpass +The super-user is allowed to directly supply an encrypted password field, +in the format used by +.Xr crypt 3 , +as an argument. .It Fl s Ar newshell Attempt to change the user's shell to .Ar newshell . @@ -216,7 +216,7 @@ Note that .Xr finger 1 will display the office location and office phone together under the heading -.Ar Office: . +.Ar Office\&: . .Pp The user's .Ar home directory @@ -313,7 +313,7 @@ changing other fields could be added, this would lead compatibility problems with other NIS-capable systems. Even though the super-user may supply data for other fields while editing an entry, the extra information (other than the -password -- see below) will be silently discarded. +password \(em see below) will be silently discarded. .Pp Exception: the super-user on the NIS master server is permitted to change any field. @@ -382,19 +382,7 @@ change a user's NIS password with There are also a few extra option flags that are available when .Nm is compiled with NIS support: -.Bl -tag -width indent -.It Fl l -Force -.Nm -to modify the local copy of a user's password -information in the event that a user exists in both -the local and NIS databases. -.It Fl y -Opposite effect of -.Fl l . -This flag is largely redundant since -.Nm -operates on NIS entries by default if NIS is enabled. +.Bl -tag -width "-d domain" .It Fl d Ar domain Specify a particular NIS domain. The @@ -432,6 +420,12 @@ option can be used in conjunction with the .Fl d option, in which case the user-specified hostname will override the default. +.It Fl l +Force +.Nm +to modify the local copy of a user's password +information in the event that a user exists in both +the local and NIS databases. .It Fl o Force the use of RPC-based updates when communicating with .Xr rpc.yppasswdd 8 @@ -449,6 +443,12 @@ flag can be used to force to use the standard update mechanism instead. This option is provided mainly for testing purposes. +.It Fl y +Opposite effect of +.Fl l . +This flag is largely redundant since +.Nm +operates on NIS entries by default if NIS is enabled. .El .Sh FILES .Bl -tag -width /etc/master.passwd -compact @@ -461,6 +461,12 @@ temporary copy of the password file .It Pa /etc/shells the list of approved shells .El +.Sh EXAMPLES +Change the shell of the current user to +.Ql /usr/local/bin/zsh : +.Bd -literal -offset indent +chsh -s /usr/local/bin/zsh +.Ed .Sh SEE ALSO .Xr finger 1 , .Xr login 1 , From owner-svn-src-stable@freebsd.org Tue Dec 1 09:55:29 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3511D4A4310; Tue, 1 Dec 2020 09:55:29 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clcss123Gz3HDG; Tue, 1 Dec 2020 09:55:29 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 121B413E59; Tue, 1 Dec 2020 09:55:29 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B19tSUG036454; Tue, 1 Dec 2020 09:55:28 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B19tS53036453; Tue, 1 Dec 2020 09:55:28 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202012010955.0B19tS53036453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Tue, 1 Dec 2020 09:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368206 - stable/11/usr.bin/chpass X-SVN-Group: stable-11 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/11/usr.bin/chpass X-SVN-Commit-Revision: 368206 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 09:55:29 -0000 Author: 0mp (doc,ports committer) Date: Tue Dec 1 09:55:28 2020 New Revision: 368206 URL: https://svnweb.freebsd.org/changeset/base/368206 Log: MFC r367757, r367756, r367759, r367769: Improve readability of the lists of options - Sort options alphabetically - Add missing arguments (e.g., "list" to -a) - Adjust the width of Bl Clean up the synopsis section & fix mandoc warnings The synopsis section had two very similar entries. The flags documented by the first one were a strict subset of the second one. Let's just keep only the second entry for simplicity. Add an example for the -s flag Partially revert r367756 (chpass(1) synopsis changes) Let's have two entries in the synopsis: - chpass now lists options which can be used for non-NIS-specific functionalities. - ypchpass additionally lists the NIS-specific flags. Technically, it is an artificial distinction, as chpass and ypchpass behave identically. Nevertheless, it might help navigating the synopsis section. Reviewed by: imp Modified: stable/11/usr.bin/chpass/chpass.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/chpass/chpass.1 ============================================================================== --- stable/11/usr.bin/chpass/chpass.1 Tue Dec 1 09:24:15 2020 (r368205) +++ stable/11/usr.bin/chpass/chpass.1 Tue Dec 1 09:55:28 2020 (r368206) @@ -28,7 +28,7 @@ .\" @(#)chpass.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd December 30, 1993 +.Dd November 17, 2020 .Dt CHPASS 1 .Os .Sh NAME @@ -40,20 +40,20 @@ .Nm ypchsh .Nd add or change user database information .Sh SYNOPSIS -.Nm +.Nm chpass .Op Fl a Ar list -.Op Fl p Ar encpass .Op Fl e Ar expiretime +.Op Fl p Ar encpass .Op Fl s Ar newshell .Op user -.Nm -.Op Fl oly +.Nm ypchpass +.Op Fl loy .Op Fl a Ar list -.Op Fl p Ar encpass -.Op Fl e Ar expiretime -.Op Fl s Ar newshell .Op Fl d Ar domain +.Op Fl e Ar expiretime .Op Fl h Ar host +.Op Fl p Ar encpass +.Op Fl s Ar newshell .Op user .Sh DESCRIPTION The @@ -80,8 +80,8 @@ The information is formatted and supplied to an editor Only the information that the user is allowed to change is displayed. .Pp The options are as follows: -.Bl -tag -width indent -.It Fl a +.Bl -tag -width "-e expiretime" +.It Fl a Ar list The super-user is allowed to directly supply a user database entry, in the format specified by .Xr passwd 5 , @@ -90,15 +90,15 @@ This argument must be a colon .Pq Dq \&: separated list of all the user database fields, although they may be empty. -.It Fl p -The super-user is allowed to directly supply an encrypted password field, -in the format used by -.Xr crypt 3 , -as an argument. .It Fl e Ar expiretime Change the account expire time. This option is used to set the expire time from a script as if it was done in the interactive editor. +.It Fl p Ar encpass +The super-user is allowed to directly supply an encrypted password field, +in the format used by +.Xr crypt 3 , +as an argument. .It Fl s Ar newshell Attempt to change the user's shell to .Ar newshell . @@ -216,7 +216,7 @@ Note that .Xr finger 1 will display the office location and office phone together under the heading -.Ar Office: . +.Ar Office\&: . .Pp The user's .Ar home directory @@ -313,7 +313,7 @@ changing other fields could be added, this would lead compatibility problems with other NIS-capable systems. Even though the super-user may supply data for other fields while editing an entry, the extra information (other than the -password -- see below) will be silently discarded. +password \(em see below) will be silently discarded. .Pp Exception: the super-user on the NIS master server is permitted to change any field. @@ -382,19 +382,7 @@ change a user's NIS password with There are also a few extra option flags that are available when .Nm is compiled with NIS support: -.Bl -tag -width indent -.It Fl l -Force -.Nm -to modify the local copy of a user's password -information in the event that a user exists in both -the local and NIS databases. -.It Fl y -Opposite effect of -.Fl l . -This flag is largely redundant since -.Nm -operates on NIS entries by default if NIS is enabled. +.Bl -tag -width "-d domain" .It Fl d Ar domain Specify a particular NIS domain. The @@ -432,6 +420,12 @@ option can be used in conjunction with the .Fl d option, in which case the user-specified hostname will override the default. +.It Fl l +Force +.Nm +to modify the local copy of a user's password +information in the event that a user exists in both +the local and NIS databases. .It Fl o Force the use of RPC-based updates when communicating with .Xr rpc.yppasswdd 8 @@ -449,6 +443,12 @@ flag can be used to force to use the standard update mechanism instead. This option is provided mainly for testing purposes. +.It Fl y +Opposite effect of +.Fl l . +This flag is largely redundant since +.Nm +operates on NIS entries by default if NIS is enabled. .El .Sh FILES .Bl -tag -width /etc/master.passwd -compact @@ -461,6 +461,12 @@ temporary copy of the password file .It Pa /etc/shells the list of approved shells .El +.Sh EXAMPLES +Change the shell of the current user to +.Ql /usr/local/bin/zsh : +.Bd -literal -offset indent +chsh -s /usr/local/bin/zsh +.Ed .Sh SEE ALSO .Xr finger 1 , .Xr login 1 , From owner-svn-src-stable@freebsd.org Tue Dec 1 12:32:36 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42EFA4A7F3D; Tue, 1 Dec 2020 12:32:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhM81Qnlz3h0c; Tue, 1 Dec 2020 12:32:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23EE015D92; Tue, 1 Dec 2020 12:32:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CWagE035455; Tue, 1 Dec 2020 12:32:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CWaZa035454; Tue, 1 Dec 2020 12:32:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011232.0B1CWaZa035454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368209 - stable/12/sys/dev/usb/controller X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/usb/controller X-SVN-Commit-Revision: 368209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:32:36 -0000 Author: hselasky Date: Tue Dec 1 12:32:35 2020 New Revision: 368209 URL: https://svnweb.freebsd.org/changeset/base/368209 Log: MFC r367614: When doing a USB alternate setting on an USB interface we need to re-configure the XHCI endpoint context. Differential Revision: https://reviews.freebsd.org/D27174 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/usb/controller/xhci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/12/sys/dev/usb/controller/xhci.c Tue Dec 1 10:39:42 2020 (r368208) +++ stable/12/sys/dev/usb/controller/xhci.c Tue Dec 1 12:32:35 2020 (r368209) @@ -4049,6 +4049,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo struct usb_endpoint *ep) { struct xhci_endpoint_ext *pepext; + struct xhci_softc *sc; + uint8_t index; + uint8_t epno; DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n", ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode); @@ -4065,6 +4068,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo USB_BUS_LOCK(udev->bus); pepext->trb_halted = 1; pepext->trb_running = 0; + + /* + * When doing an alternate setting, except for control + * endpoints, we need to re-configure the XHCI endpoint + * context: + */ + if ((edesc->bEndpointAddress & UE_ADDR) != 0) { + sc = XHCI_BUS2SC(udev->bus); + index = udev->controller_slot_id; + epno = XHCI_EPNO2EPID(edesc->bEndpointAddress); + sc->sc_hw.devs[index].ep_configured &= ~(1U << epno); + } USB_BUS_UNLOCK(udev->bus); } From owner-svn-src-stable@freebsd.org Tue Dec 1 12:33:39 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3C804A81BA; Tue, 1 Dec 2020 12:33:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhNM5fdpz3hbK; Tue, 1 Dec 2020 12:33:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4E0B15C34; Tue, 1 Dec 2020 12:33:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CXdIb035596; Tue, 1 Dec 2020 12:33:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CXd74035595; Tue, 1 Dec 2020 12:33:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011233.0B1CXd74035595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368210 - stable/11/sys/dev/usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/usb/controller X-SVN-Commit-Revision: 368210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:33:39 -0000 Author: hselasky Date: Tue Dec 1 12:33:39 2020 New Revision: 368210 URL: https://svnweb.freebsd.org/changeset/base/368210 Log: MFC r367614: When doing a USB alternate setting on an USB interface we need to re-configure the XHCI endpoint context. Differential Revision: https://reviews.freebsd.org/D27174 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/usb/controller/xhci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/11/sys/dev/usb/controller/xhci.c Tue Dec 1 12:32:35 2020 (r368209) +++ stable/11/sys/dev/usb/controller/xhci.c Tue Dec 1 12:33:39 2020 (r368210) @@ -4049,6 +4049,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo struct usb_endpoint *ep) { struct xhci_endpoint_ext *pepext; + struct xhci_softc *sc; + uint8_t index; + uint8_t epno; DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n", ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode); @@ -4065,6 +4068,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo USB_BUS_LOCK(udev->bus); pepext->trb_halted = 1; pepext->trb_running = 0; + + /* + * When doing an alternate setting, except for control + * endpoints, we need to re-configure the XHCI endpoint + * context: + */ + if ((edesc->bEndpointAddress & UE_ADDR) != 0) { + sc = XHCI_BUS2SC(udev->bus); + index = udev->controller_slot_id; + epno = XHCI_EPNO2EPID(edesc->bEndpointAddress); + sc->sc_hw.devs[index].ep_configured &= ~(1U << epno); + } USB_BUS_UNLOCK(udev->bus); } From owner-svn-src-stable@freebsd.org Tue Dec 1 12:36:21 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6DB74A834F; Tue, 1 Dec 2020 12:36:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhRT6BkGz3hlX; Tue, 1 Dec 2020 12:36:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7DE415D65; Tue, 1 Dec 2020 12:36:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CaLK0035919; Tue, 1 Dec 2020 12:36:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CaLZn035918; Tue, 1 Dec 2020 12:36:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011236.0B1CaLZn035918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368211 - stable/12/sys/dev/sound/usb X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/sound/usb X-SVN-Commit-Revision: 368211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:36:22 -0000 Author: hselasky Date: Tue Dec 1 12:36:21 2020 New Revision: 368211 URL: https://svnweb.freebsd.org/changeset/base/368211 Log: MFC r367615: Add a tunable sysctl, hw.usb.uaudio.handle_hid, to allow disabling the the HID volume keys support in the USB audio driver. While at it re-organize the USB audio sysctls a bit. Differential Revision: https://reviews.freebsd.org/D27180 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/sound/usb/uaudio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/12/sys/dev/sound/usb/uaudio.c Tue Dec 1 12:33:39 2020 (r368210) +++ stable/12/sys/dev/sound/usb/uaudio.c Tue Dec 1 12:36:21 2020 (r368211) @@ -98,14 +98,11 @@ static int uaudio_default_rate = 0; /* use rate list static int uaudio_default_bits = 32; static int uaudio_default_channels = 0; /* use default */ static int uaudio_buffer_ms = 8; +static bool uaudio_handle_hid = true; -#ifdef USB_DEBUG -static int uaudio_debug; - static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio"); - -SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN, - &uaudio_debug, 0, "uaudio debug level"); +SYSCTL_BOOL(_hw_usb_uaudio, OID_AUTO, handle_hid, CTLFLAG_RWTUN, + &uaudio_handle_hid, 0, "uaudio handles any HID volume/mute keys, if set"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RWTUN, &uaudio_default_rate, 0, "uaudio default sample rate"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RWTUN, @@ -136,6 +133,12 @@ uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN, 0, sizeof(int), uaudio_buffer_ms_sysctl, "I", "uaudio buffering delay from 2ms to 8ms"); + +#ifdef USB_DEBUG +static int uaudio_debug; + +SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN, + &uaudio_debug, 0, "uaudio debug level"); #else #define uaudio_debug 0 #endif @@ -1120,10 +1123,12 @@ uaudio_attach(device_t dev) goto detach; } - if (uaudio_hid_probe(sc, uaa) == 0) { - device_printf(dev, "HID volume keys found.\n"); - } else { - device_printf(dev, "No HID volume keys found.\n"); + if (uaudio_handle_hid) { + if (uaudio_hid_probe(sc, uaa) == 0) { + device_printf(dev, "HID volume keys found.\n"); + } else { + device_printf(dev, "No HID volume keys found.\n"); + } } /* reload all mixer settings */ From owner-svn-src-stable@freebsd.org Tue Dec 1 12:37:12 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70E7E4A8405; Tue, 1 Dec 2020 12:37:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhSS2mF5z3hkN; Tue, 1 Dec 2020 12:37:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 521ED15D93; Tue, 1 Dec 2020 12:37:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CbCvv036097; Tue, 1 Dec 2020 12:37:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CbCAe036096; Tue, 1 Dec 2020 12:37:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011237.0B1CbCAe036096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368212 - stable/11/sys/dev/sound/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/usb X-SVN-Commit-Revision: 368212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:37:12 -0000 Author: hselasky Date: Tue Dec 1 12:37:11 2020 New Revision: 368212 URL: https://svnweb.freebsd.org/changeset/base/368212 Log: MFC r367615: Add a tunable sysctl, hw.usb.uaudio.handle_hid, to allow disabling the the HID volume keys support in the USB audio driver. While at it re-organize the USB audio sysctls a bit. Differential Revision: https://reviews.freebsd.org/D27180 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/sound/usb/uaudio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Tue Dec 1 12:36:21 2020 (r368211) +++ stable/11/sys/dev/sound/usb/uaudio.c Tue Dec 1 12:37:11 2020 (r368212) @@ -96,14 +96,11 @@ static int uaudio_default_rate = 0; /* use rate list static int uaudio_default_bits = 32; static int uaudio_default_channels = 0; /* use default */ static int uaudio_buffer_ms = 8; +static bool uaudio_handle_hid = true; -#ifdef USB_DEBUG -static int uaudio_debug; - static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio"); - -SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN, - &uaudio_debug, 0, "uaudio debug level"); +SYSCTL_BOOL(_hw_usb_uaudio, OID_AUTO, handle_hid, CTLFLAG_RWTUN, + &uaudio_handle_hid, 0, "uaudio handles any HID volume/mute keys, if set"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RWTUN, &uaudio_default_rate, 0, "uaudio default sample rate"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RWTUN, @@ -134,6 +131,12 @@ uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN, 0, sizeof(int), uaudio_buffer_ms_sysctl, "I", "uaudio buffering delay from 2ms to 8ms"); + +#ifdef USB_DEBUG +static int uaudio_debug; + +SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN, + &uaudio_debug, 0, "uaudio debug level"); #else #define uaudio_debug 0 #endif @@ -1118,10 +1121,12 @@ uaudio_attach(device_t dev) goto detach; } - if (uaudio_hid_probe(sc, uaa) == 0) { - device_printf(dev, "HID volume keys found.\n"); - } else { - device_printf(dev, "No HID volume keys found.\n"); + if (uaudio_handle_hid) { + if (uaudio_hid_probe(sc, uaa) == 0) { + device_printf(dev, "HID volume keys found.\n"); + } else { + device_printf(dev, "No HID volume keys found.\n"); + } } /* reload all mixer settings */ From owner-svn-src-stable@freebsd.org Tue Dec 1 12:38:29 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 926EC4A848D; Tue, 1 Dec 2020 12:38:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhTx3kdSz3j83; Tue, 1 Dec 2020 12:38:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7284615D66; Tue, 1 Dec 2020 12:38:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CcTER036255; Tue, 1 Dec 2020 12:38:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CcSF1036252; Tue, 1 Dec 2020 12:38:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011238.0B1CcSF1036252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:38:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368213 - in stable/12/sys/dev/usb: . quirk X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/usb: . quirk X-SVN-Commit-Revision: 368213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:38:29 -0000 Author: hselasky Date: Tue Dec 1 12:38:28 2020 New Revision: 368213 URL: https://svnweb.freebsd.org/changeset/base/368213 Log: MFC r367622: Add more USB quirks. PR: 230038 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c stable/12/sys/dev/usb/usbdevs Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/12/sys/dev/usb/quirk/usb_quirk.c Tue Dec 1 12:37:11 2020 (r368212) +++ stable/12/sys/dev/usb/quirk/usb_quirk.c Tue Dec 1 12:38:28 2020 (r368213) @@ -237,7 +237,9 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(GARMIN, DAKOTA20, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GARMIN, FORERUNNER230, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), + USB_QUIRK(GARMIN, GPSMAP62S, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), Modified: stable/12/sys/dev/usb/usbdevs ============================================================================== --- stable/12/sys/dev/usb/usbdevs Tue Dec 1 12:37:11 2020 (r368212) +++ stable/12/sys/dev/usb/usbdevs Tue Dec 1 12:38:28 2020 (r368213) @@ -2254,7 +2254,9 @@ product FUJITSU AH_F401U 0x105b AH-F401U Air H device product FUJITSUSIEMENS SCR 0x0009 Fujitsu-Siemens SCR USB Reader /* Garmin products */ +product GARMIN DAKOTA20 0x23c0 Dakota 20 product GARMIN FORERUNNER230 0x086d ForeRunner 230 +product GARMIN GPSMAP62S 0x2459 GPSMAP 62s product GARMIN IQUE_3600 0x0004 iQue 3600 /* Gemalto products */ From owner-svn-src-stable@freebsd.org Tue Dec 1 12:39:16 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D70E14A8439; Tue, 1 Dec 2020 12:39:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhVr5lRGz3j7F; Tue, 1 Dec 2020 12:39:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B81F1157FD; Tue, 1 Dec 2020 12:39:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CdGN1036366; Tue, 1 Dec 2020 12:39:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CdGOs036364; Tue, 1 Dec 2020 12:39:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011239.0B1CdGOs036364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368214 - in stable/11/sys/dev/usb: . quirk X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/usb: . quirk X-SVN-Commit-Revision: 368214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:39:16 -0000 Author: hselasky Date: Tue Dec 1 12:39:16 2020 New Revision: 368214 URL: https://svnweb.freebsd.org/changeset/base/368214 Log: MFC r367622: Add more USB quirks. PR: 230038 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/usb/quirk/usb_quirk.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/11/sys/dev/usb/quirk/usb_quirk.c Tue Dec 1 12:38:28 2020 (r368213) +++ stable/11/sys/dev/usb/quirk/usb_quirk.c Tue Dec 1 12:39:16 2020 (r368214) @@ -207,7 +207,9 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(GARMIN, DAKOTA20, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GARMIN, FORERUNNER230, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), + USB_QUIRK(GARMIN, GPSMAP62S, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Tue Dec 1 12:38:28 2020 (r368213) +++ stable/11/sys/dev/usb/usbdevs Tue Dec 1 12:39:16 2020 (r368214) @@ -2180,7 +2180,9 @@ product FUJITSU AH_F401U 0x105b AH-F401U Air H device product FUJITSUSIEMENS SCR 0x0009 Fujitsu-Siemens SCR USB Reader /* Garmin products */ +product GARMIN DAKOTA20 0x23c0 Dakota 20 product GARMIN FORERUNNER230 0x086d ForeRunner 230 +product GARMIN GPSMAP62S 0x2459 GPSMAP 62s product GARMIN IQUE_3600 0x0004 iQue 3600 /* Gemalto products */ From owner-svn-src-stable@freebsd.org Tue Dec 1 12:41:26 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EEFB4A8807; Tue, 1 Dec 2020 12:41:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhYL0vNPz3jLr; Tue, 1 Dec 2020 12:41:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11E9E15F87; Tue, 1 Dec 2020 12:41:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CfPdC037317; Tue, 1 Dec 2020 12:41:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CfPci037316; Tue, 1 Dec 2020 12:41:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011241.0B1CfPci037316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:41:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368215 - stable/12/sys/dev/mlx4/mlx4_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx4/mlx4_ib X-SVN-Commit-Revision: 368215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:41:26 -0000 Author: hselasky Date: Tue Dec 1 12:41:25 2020 New Revision: 368215 URL: https://svnweb.freebsd.org/changeset/base/368215 Log: MFC r367555: Include GID type when deleting GIDs from HW table under RoCE in mlx4ib. Refer to the Linux commit mentioned below for a more detailed description. Linux commit: a18177925c252da7801149abe217c05b80884798 Requested by: Isilon Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Tue Dec 1 12:39:16 2020 (r368214) +++ stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Tue Dec 1 12:41:25 2020 (r368215) @@ -371,8 +371,13 @@ static int mlx4_ib_del_gid(struct ib_device *device, if (!gids) { ret = -ENOMEM; } else { - for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) - memcpy(&gids[i].gid, &port_gid_table->gids[i].gid, sizeof(union ib_gid)); + for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) { + memcpy(&gids[i].gid, + &port_gid_table->gids[i].gid, + sizeof(union ib_gid)); + gids[i].gid_type = + port_gid_table->gids[i].gid_type; + } } } spin_unlock_bh(&iboe->lock); From owner-svn-src-stable@freebsd.org Tue Dec 1 12:42:24 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A5AD4A8635; Tue, 1 Dec 2020 12:42:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhZR6xXbz3jbp; Tue, 1 Dec 2020 12:42:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E11D315BBB; Tue, 1 Dec 2020 12:42:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CgNZ5042106; Tue, 1 Dec 2020 12:42:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CgNoY042105; Tue, 1 Dec 2020 12:42:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011242.0B1CgNoY042105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368216 - stable/11/sys/dev/mlx4/mlx4_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx4/mlx4_ib X-SVN-Commit-Revision: 368216 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:42:24 -0000 Author: hselasky Date: Tue Dec 1 12:42:23 2020 New Revision: 368216 URL: https://svnweb.freebsd.org/changeset/base/368216 Log: MFC r367555: Include GID type when deleting GIDs from HW table under RoCE in mlx4ib. Refer to the Linux commit mentioned below for a more detailed description. Linux commit: a18177925c252da7801149abe217c05b80884798 Requested by: Isilon Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Tue Dec 1 12:41:25 2020 (r368215) +++ stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Tue Dec 1 12:42:23 2020 (r368216) @@ -371,8 +371,13 @@ static int mlx4_ib_del_gid(struct ib_device *device, if (!gids) { ret = -ENOMEM; } else { - for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) - memcpy(&gids[i].gid, &port_gid_table->gids[i].gid, sizeof(union ib_gid)); + for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) { + memcpy(&gids[i].gid, + &port_gid_table->gids[i].gid, + sizeof(union ib_gid)); + gids[i].gid_type = + port_gid_table->gids[i].gid_type; + } } } spin_unlock_bh(&iboe->lock); From owner-svn-src-stable@freebsd.org Tue Dec 1 12:43:23 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09EC94A865D; Tue, 1 Dec 2020 12:43:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhbZ6n01z3jlx; Tue, 1 Dec 2020 12:43:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB7EE15C59; Tue, 1 Dec 2020 12:43:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1ChM41042213; Tue, 1 Dec 2020 12:43:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1ChMTQ042212; Tue, 1 Dec 2020 12:43:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011243.0B1ChMTQ042212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:43:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368217 - stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 368217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:43:23 -0000 Author: hselasky Date: Tue Dec 1 12:43:22 2020 New Revision: 368217 URL: https://svnweb.freebsd.org/changeset/base/368217 Log: MFC r367715: Fix error handling order in create_kernel_qp in mlx5ib. Make sure order of cleanup is exactly the opposite of initialization. Linux commit: f4044dac63e952ac1137b6df02b233d37696e2f5 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Dec 1 12:42:23 2020 (r368216) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Dec 1 12:43:22 2020 (r368217) @@ -987,12 +987,12 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, return 0; err_wrid: - mlx5_db_free(dev->mdev, &qp->db); kfree(qp->sq.wqe_head); kfree(qp->sq.w_list); kfree(qp->sq.wrid); kfree(qp->sq.wr_data); kfree(qp->rq.wrid); + mlx5_db_free(dev->mdev, &qp->db); err_free: kvfree(*in); @@ -1007,12 +1007,12 @@ err_uuar: static void destroy_qp_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp) { - mlx5_db_free(dev->mdev, &qp->db); kfree(qp->sq.wqe_head); kfree(qp->sq.w_list); kfree(qp->sq.wrid); kfree(qp->sq.wr_data); kfree(qp->rq.wrid); + mlx5_db_free(dev->mdev, &qp->db); mlx5_buf_free(dev->mdev, &qp->buf); free_uuar(&dev->mdev->priv.uuari, qp->bf->uuarn); } From owner-svn-src-stable@freebsd.org Tue Dec 1 12:43:56 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECF7B4A8835; Tue, 1 Dec 2020 12:43:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhcD6Lvlz3k7H; Tue, 1 Dec 2020 12:43:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCFCB15C5A; Tue, 1 Dec 2020 12:43:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1Chuj4042297; Tue, 1 Dec 2020 12:43:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1Chufk042296; Tue, 1 Dec 2020 12:43:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011243.0B1Chufk042296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:43:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368218 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 368218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:43:57 -0000 Author: hselasky Date: Tue Dec 1 12:43:56 2020 New Revision: 368218 URL: https://svnweb.freebsd.org/changeset/base/368218 Log: MFC r367715: Fix error handling order in create_kernel_qp in mlx5ib. Make sure order of cleanup is exactly the opposite of initialization. Linux commit: f4044dac63e952ac1137b6df02b233d37696e2f5 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Dec 1 12:43:22 2020 (r368217) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Dec 1 12:43:56 2020 (r368218) @@ -987,12 +987,12 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, return 0; err_wrid: - mlx5_db_free(dev->mdev, &qp->db); kfree(qp->sq.wqe_head); kfree(qp->sq.w_list); kfree(qp->sq.wrid); kfree(qp->sq.wr_data); kfree(qp->rq.wrid); + mlx5_db_free(dev->mdev, &qp->db); err_free: kvfree(*in); @@ -1007,12 +1007,12 @@ err_uuar: static void destroy_qp_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp) { - mlx5_db_free(dev->mdev, &qp->db); kfree(qp->sq.wqe_head); kfree(qp->sq.w_list); kfree(qp->sq.wrid); kfree(qp->sq.wr_data); kfree(qp->rq.wrid); + mlx5_db_free(dev->mdev, &qp->db); mlx5_buf_free(dev->mdev, &qp->buf); free_uuar(&dev->mdev->priv.uuari, qp->bf->uuarn); } From owner-svn-src-stable@freebsd.org Tue Dec 1 12:45:08 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B286F4A86D9; Tue, 1 Dec 2020 12:45:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clhdc4f1xz3jxy; Tue, 1 Dec 2020 12:45:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87A8A15F9D; Tue, 1 Dec 2020 12:45:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1Cj8Bp042442; Tue, 1 Dec 2020 12:45:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1Cj8I7042441; Tue, 1 Dec 2020 12:45:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011245.0B1Cj8I7042441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368219 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 368219 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:45:08 -0000 Author: hselasky Date: Tue Dec 1 12:45:07 2020 New Revision: 368219 URL: https://svnweb.freebsd.org/changeset/base/368219 Log: MFC r367716: Use mlx5core to create/destroy all Dynamically Connected Targets, DCTs. To prevent a hardware memory leak when a DEVX DCT object is destroyed without calling drain DCT before, (e.g. under cleanup flow), need to manage its creation and destruction via mlx5 core. Linux commit: c5ae1954c47d3fd8815bd5a592aba18702c93f33 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_qp.c stable/12/sys/dev/mlx5/qp.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_qp.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_qp.c Tue Dec 1 12:43:56 2020 (r368218) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_qp.c Tue Dec 1 12:45:07 2020 (r368219) @@ -349,19 +349,18 @@ EXPORT_SYMBOL_GPL(mlx5_core_xrcd_dealloc); int mlx5_core_create_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct, - u32 *in) + u32 *in, int inlen, + u32 *out, int outlen) { struct mlx5_qp_table *table = &dev->priv.qp_table; - u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {0}; u32 dout[MLX5_ST_SZ_DW(destroy_dct_out)] = {0}; u32 din[MLX5_ST_SZ_DW(destroy_dct_in)] = {0}; - int inlen = MLX5_ST_SZ_BYTES(create_dct_in); int err; init_completion(&dct->drained); MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT); - err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); + err = mlx5_cmd_exec(dev, in, inlen, out, outlen); if (err) { mlx5_core_warn(dev, "create DCT failed, ret %d", err); return err; @@ -387,7 +386,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, err_cmd: MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT); MLX5_SET(destroy_dct_in, din, dctn, dct->dctn); - mlx5_cmd_exec(dev, &din, sizeof(din), &out, sizeof(dout)); + mlx5_cmd_exec(dev, &din, sizeof(din), dout, sizeof(dout)); return err; } Modified: stable/12/sys/dev/mlx5/qp.h ============================================================================== --- stable/12/sys/dev/mlx5/qp.h Tue Dec 1 12:43:56 2020 (r368218) +++ stable/12/sys/dev/mlx5/qp.h Tue Dec 1 12:45:07 2020 (r368219) @@ -586,7 +586,8 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u3 int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn); int mlx5_core_create_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct, - u32 *in); + u32 *in, int inlen, + u32 *out, int outlen); int mlx5_core_destroy_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct); int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, From owner-svn-src-stable@freebsd.org Tue Dec 1 12:45:48 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7360A4A8B1C; Tue, 1 Dec 2020 12:45:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClhfN2pc3z3kMd; Tue, 1 Dec 2020 12:45:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48D6C15F9E; Tue, 1 Dec 2020 12:45:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CjmjD042533; Tue, 1 Dec 2020 12:45:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1Cjljw042531; Tue, 1 Dec 2020 12:45:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011245.0B1Cjljw042531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:45:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368220 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 368220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:45:48 -0000 Author: hselasky Date: Tue Dec 1 12:45:47 2020 New Revision: 368220 URL: https://svnweb.freebsd.org/changeset/base/368220 Log: MFC r367716: Use mlx5core to create/destroy all Dynamically Connected Targets, DCTs. To prevent a hardware memory leak when a DEVX DCT object is destroyed without calling drain DCT before, (e.g. under cleanup flow), need to manage its creation and destruction via mlx5 core. Linux commit: c5ae1954c47d3fd8815bd5a592aba18702c93f33 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c stable/11/sys/dev/mlx5/qp.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c Tue Dec 1 12:45:07 2020 (r368219) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c Tue Dec 1 12:45:47 2020 (r368220) @@ -349,19 +349,18 @@ EXPORT_SYMBOL_GPL(mlx5_core_xrcd_dealloc); int mlx5_core_create_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct, - u32 *in) + u32 *in, int inlen, + u32 *out, int outlen) { struct mlx5_qp_table *table = &dev->priv.qp_table; - u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {0}; u32 dout[MLX5_ST_SZ_DW(destroy_dct_out)] = {0}; u32 din[MLX5_ST_SZ_DW(destroy_dct_in)] = {0}; - int inlen = MLX5_ST_SZ_BYTES(create_dct_in); int err; init_completion(&dct->drained); MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT); - err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); + err = mlx5_cmd_exec(dev, in, inlen, out, outlen); if (err) { mlx5_core_warn(dev, "create DCT failed, ret %d", err); return err; @@ -387,7 +386,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, err_cmd: MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT); MLX5_SET(destroy_dct_in, din, dctn, dct->dctn); - mlx5_cmd_exec(dev, &din, sizeof(din), &out, sizeof(dout)); + mlx5_cmd_exec(dev, &din, sizeof(din), dout, sizeof(dout)); return err; } Modified: stable/11/sys/dev/mlx5/qp.h ============================================================================== --- stable/11/sys/dev/mlx5/qp.h Tue Dec 1 12:45:07 2020 (r368219) +++ stable/11/sys/dev/mlx5/qp.h Tue Dec 1 12:45:47 2020 (r368220) @@ -586,7 +586,8 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u3 int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn); int mlx5_core_create_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct, - u32 *in); + u32 *in, int inlen, + u32 *out, int outlen); int mlx5_core_destroy_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct); int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, From owner-svn-src-stable@freebsd.org Tue Dec 1 12:51:37 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2825E4A89BD; Tue, 1 Dec 2020 12:51:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clhn50VM6z3kNp; Tue, 1 Dec 2020 12:51:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03FA115A4F; Tue, 1 Dec 2020 12:51:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1Cpa0I047533; Tue, 1 Dec 2020 12:51:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CpaDb047529; Tue, 1 Dec 2020 12:51:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011251.0B1CpaDb047529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:51:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368221 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Commit-Revision: 368221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:51:37 -0000 Author: hselasky Date: Tue Dec 1 12:51:35 2020 New Revision: 368221 URL: https://svnweb.freebsd.org/changeset/base/368221 Log: MFC r367717: Enhance the mlx5_core_create_cq() function in mlx5core. Enhance mlx5_core_create_cq() to get the command out buffer from the callers to let them use the output. Linux commit: 38164b771947be9baf06e78ffdfb650f8f3e908e Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/mlx5/cq.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/cq.h ============================================================================== --- stable/12/sys/dev/mlx5/cq.h Tue Dec 1 12:45:47 2020 (r368220) +++ stable/12/sys/dev/mlx5/cq.h Tue Dec 1 12:51:35 2020 (r368221) @@ -157,7 +157,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq int mlx5_init_cq_table(struct mlx5_core_dev *dev); void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev); int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, - u32 *in, int inlen); + u32 *in, int inlen, u32 *out, int outlen); int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, u32 *out, int outlen); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c Tue Dec 1 12:45:47 2020 (r368220) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c Tue Dec 1 12:51:35 2020 (r368221) @@ -100,16 +100,16 @@ void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, - u32 *in, int inlen) + u32 *in, int inlen, u32 *out, int outlen) { struct mlx5_cq_table *table = &dev->priv.cq_table; - u32 out[MLX5_ST_SZ_DW(create_cq_out)] = {0}; u32 din[MLX5_ST_SZ_DW(destroy_cq_in)] = {0}; u32 dout[MLX5_ST_SZ_DW(destroy_cq_out)] = {0}; int err; + memset(out, 0, outlen); MLX5_SET(create_cq_in, in, opcode, MLX5_CMD_OP_CREATE_CQ); - err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); + err = mlx5_cmd_exec(dev, in, inlen, out, outlen); if (err) return err; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Dec 1 12:45:47 2020 (r368220) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Dec 1 12:51:35 2020 (r368221) @@ -1978,6 +1978,7 @@ static int mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param, int eq_ix) { struct mlx5_core_cq *mcq = &cq->mcq; + u32 out[MLX5_ST_SZ_DW(create_cq_out)]; void *in; void *cqc; int inlen; @@ -2006,7 +2007,7 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_p PAGE_SHIFT); MLX5_SET64(cqc, cqc, dbr_addr, cq->wq_ctrl.db.dma); - err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen); + err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen, out, sizeof(out)); kvfree(in); Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec 1 12:45:47 2020 (r368220) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec 1 12:51:35 2020 (r368221) @@ -905,6 +905,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde int entries = attr->cqe; int vector = attr->comp_vector; struct mlx5_ib_dev *dev = to_mdev(ibdev); + u32 out[MLX5_ST_SZ_DW(create_cq_out)]; struct mlx5_ib_cq *cq; int uninitialized_var(index); int uninitialized_var(inlen); @@ -969,7 +970,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde if (cq->create_flags & IB_CQ_FLAGS_IGNORE_OVERRUN) MLX5_SET(cqc, cqc, oi, 1); - err = mlx5_core_create_cq(dev->mdev, &cq->mcq, cqb, inlen); + err = mlx5_core_create_cq(dev->mdev, &cq->mcq, cqb, inlen, out, sizeof(out)); if (err) goto err_cqb; From owner-svn-src-stable@freebsd.org Tue Dec 1 12:52:17 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 258374A8D92; Tue, 1 Dec 2020 12:52:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clhns0bk0z3kPp; Tue, 1 Dec 2020 12:52:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0766915DD6; Tue, 1 Dec 2020 12:52:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1CqGO1048379; Tue, 1 Dec 2020 12:52:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1CqG2O048376; Tue, 1 Dec 2020 12:52:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011252.0B1CqG2O048376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 12:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368222 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Commit-Revision: 368222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 12:52:17 -0000 Author: hselasky Date: Tue Dec 1 12:52:15 2020 New Revision: 368222 URL: https://svnweb.freebsd.org/changeset/base/368222 Log: MFC r367717: Enhance the mlx5_core_create_cq() function in mlx5core. Enhance mlx5_core_create_cq() to get the command out buffer from the callers to let them use the output. Linux commit: 38164b771947be9baf06e78ffdfb650f8f3e908e Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/mlx5/cq.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/cq.h ============================================================================== --- stable/11/sys/dev/mlx5/cq.h Tue Dec 1 12:51:35 2020 (r368221) +++ stable/11/sys/dev/mlx5/cq.h Tue Dec 1 12:52:15 2020 (r368222) @@ -157,7 +157,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq int mlx5_init_cq_table(struct mlx5_core_dev *dev); void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev); int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, - u32 *in, int inlen); + u32 *in, int inlen, u32 *out, int outlen); int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, u32 *out, int outlen); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c Tue Dec 1 12:51:35 2020 (r368221) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c Tue Dec 1 12:52:15 2020 (r368222) @@ -100,16 +100,16 @@ void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, - u32 *in, int inlen) + u32 *in, int inlen, u32 *out, int outlen) { struct mlx5_cq_table *table = &dev->priv.cq_table; - u32 out[MLX5_ST_SZ_DW(create_cq_out)] = {0}; u32 din[MLX5_ST_SZ_DW(destroy_cq_in)] = {0}; u32 dout[MLX5_ST_SZ_DW(destroy_cq_out)] = {0}; int err; + memset(out, 0, outlen); MLX5_SET(create_cq_in, in, opcode, MLX5_CMD_OP_CREATE_CQ); - err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); + err = mlx5_cmd_exec(dev, in, inlen, out, outlen); if (err) return err; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Dec 1 12:51:35 2020 (r368221) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Dec 1 12:52:15 2020 (r368222) @@ -1863,6 +1863,7 @@ static int mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param, int eq_ix) { struct mlx5_core_cq *mcq = &cq->mcq; + u32 out[MLX5_ST_SZ_DW(create_cq_out)]; void *in; void *cqc; int inlen; @@ -1891,7 +1892,7 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_p PAGE_SHIFT); MLX5_SET64(cqc, cqc, dbr_addr, cq->wq_ctrl.db.dma); - err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen); + err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen, out, sizeof(out)); kvfree(in); Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec 1 12:51:35 2020 (r368221) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec 1 12:52:15 2020 (r368222) @@ -905,6 +905,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde int entries = attr->cqe; int vector = attr->comp_vector; struct mlx5_ib_dev *dev = to_mdev(ibdev); + u32 out[MLX5_ST_SZ_DW(create_cq_out)]; struct mlx5_ib_cq *cq; int uninitialized_var(index); int uninitialized_var(inlen); @@ -969,7 +970,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde if (cq->create_flags & IB_CQ_FLAGS_IGNORE_OVERRUN) MLX5_SET(cqc, cqc, oi, 1); - err = mlx5_core_create_cq(dev->mdev, &cq->mcq, cqb, inlen); + err = mlx5_core_create_cq(dev->mdev, &cq->mcq, cqb, inlen, out, sizeof(out)); if (err) goto err_cqb; From owner-svn-src-stable@freebsd.org Tue Dec 1 13:03:11 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 131624A9129; Tue, 1 Dec 2020 13:03:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clj2R00r9z3lPp; Tue, 1 Dec 2020 13:03:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E735115DFC; Tue, 1 Dec 2020 13:03:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1D3A2v054947; Tue, 1 Dec 2020 13:03:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1D3ARj054944; Tue, 1 Dec 2020 13:03:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011303.0B1D3ARj054944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 13:03:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368223 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 368223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:03:11 -0000 Author: hselasky Date: Tue Dec 1 13:03:09 2020 New Revision: 368223 URL: https://svnweb.freebsd.org/changeset/base/368223 Log: MFC r357294: Widen EPOCH(9) usage in mlx5en(4). Make completion event path mostly lockless using EPOCH(9). Implement a mechanism using EPOCH(9) which allows us to make the callback path for completion events mostly lockless. Simplify draining callback events using epoch_wait(). While at it make sure all receive completion callbacks are covered by the network EPOCH(9), because this is required when calling if_input() and ether_input() after r357012. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/cq.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/cq.h ============================================================================== --- stable/12/sys/dev/mlx5/cq.h Tue Dec 1 12:52:15 2020 (r368222) +++ stable/12/sys/dev/mlx5/cq.h Tue Dec 1 13:03:09 2020 (r368223) @@ -38,8 +38,6 @@ struct mlx5_core_cq { int cqe_sz; __be32 *set_ci_db; __be32 *arm_db; - atomic_t refcount; - struct completion free; unsigned vector; int irqn; void (*comp) (struct mlx5_core_cq *); Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Tue Dec 1 12:52:15 2020 (r368222) +++ stable/12/sys/dev/mlx5/driver.h Tue Dec 1 13:03:09 2020 (r368223) @@ -515,21 +515,17 @@ struct mlx5_core_health { struct workqueue_struct *wq_cmd; }; -#ifdef RATELIMIT -#define MLX5_CQ_LINEAR_ARRAY_SIZE (128 * 1024) -#else #define MLX5_CQ_LINEAR_ARRAY_SIZE 1024 -#endif struct mlx5_cq_linear_array_entry { - spinlock_t lock; struct mlx5_core_cq * volatile cq; }; struct mlx5_cq_table { /* protect radix tree */ - spinlock_t lock; + spinlock_t writerlock; + atomic_t writercount; struct radix_tree_root tree; struct mlx5_cq_linear_array_entry linear_array[MLX5_CQ_LINEAR_ARRAY_SIZE]; }; Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c Tue Dec 1 12:52:15 2020 (r368222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c Tue Dec 1 13:03:09 2020 (r368223) @@ -33,72 +33,92 @@ #include #include "mlx5_core.h" +#include +#include + +static void +mlx5_cq_table_write_lock(struct mlx5_cq_table *table) +{ + + atomic_inc(&table->writercount); + /* make sure all see the updated writercount */ + NET_EPOCH_WAIT(); + spin_lock(&table->writerlock); +} + +static void +mlx5_cq_table_write_unlock(struct mlx5_cq_table *table) +{ + + spin_unlock(&table->writerlock); + atomic_dec(&table->writercount); + /* drain all pending CQ callers */ + NET_EPOCH_WAIT(); +} + void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn) { - struct mlx5_core_cq *cq; struct mlx5_cq_table *table = &dev->priv.cq_table; + struct mlx5_core_cq *cq; + struct epoch_tracker et; + bool do_lock; - if (cqn < MLX5_CQ_LINEAR_ARRAY_SIZE) { - struct mlx5_cq_linear_array_entry *entry; + NET_EPOCH_ENTER_ET(et); - entry = &table->linear_array[cqn]; - spin_lock(&entry->lock); - cq = entry->cq; - if (cq == NULL) { - mlx5_core_warn(dev, - "Completion event for bogus CQ 0x%x\n", cqn); - } else { - ++cq->arm_sn; - cq->comp(cq); - } - spin_unlock(&entry->lock); - return; - } + do_lock = atomic_read(&table->writercount) != 0; + if (unlikely(do_lock)) + spin_lock(&table->writerlock); - spin_lock(&table->lock); - cq = radix_tree_lookup(&table->tree, cqn); - if (likely(cq)) - atomic_inc(&cq->refcount); - spin_unlock(&table->lock); + if (likely(cqn < MLX5_CQ_LINEAR_ARRAY_SIZE)) + cq = table->linear_array[cqn].cq; + else + cq = radix_tree_lookup(&table->tree, cqn); - if (!cq) { - mlx5_core_warn(dev, "Completion event for bogus CQ 0x%x\n", cqn); - return; + if (unlikely(do_lock)) + spin_unlock(&table->writerlock); + + if (likely(cq != NULL)) { + ++cq->arm_sn; + cq->comp(cq); + } else { + mlx5_core_warn(dev, + "Completion event for bogus CQ 0x%x\n", cqn); } - ++cq->arm_sn; - - cq->comp(cq); - - if (atomic_dec_and_test(&cq->refcount)) - complete(&cq->free); + NET_EPOCH_EXIT_ET(et); } void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type) { struct mlx5_cq_table *table = &dev->priv.cq_table; struct mlx5_core_cq *cq; + struct epoch_tracker et; + bool do_lock; - spin_lock(&table->lock); + NET_EPOCH_ENTER_ET(et); - cq = radix_tree_lookup(&table->tree, cqn); - if (cq) - atomic_inc(&cq->refcount); + do_lock = atomic_read(&table->writercount) != 0; + if (unlikely(do_lock)) + spin_lock(&table->writerlock); - spin_unlock(&table->lock); + if (likely(cqn < MLX5_CQ_LINEAR_ARRAY_SIZE)) + cq = table->linear_array[cqn].cq; + else + cq = radix_tree_lookup(&table->tree, cqn); - if (!cq) { - mlx5_core_warn(dev, "Async event for bogus CQ 0x%x\n", cqn); - return; + if (unlikely(do_lock)) + spin_unlock(&table->writerlock); + + if (likely(cq != NULL)) { + cq->event(cq, event_type); + } else { + mlx5_core_warn(dev, + "Asynchronous event for bogus CQ 0x%x\n", cqn); } - cq->event(cq, event_type); - - if (atomic_dec_and_test(&cq->refcount)) - complete(&cq->free); + NET_EPOCH_EXIT_ET(et); } - int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, u32 *in, int inlen, u32 *out, int outlen) { @@ -116,24 +136,16 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, str cq->cqn = MLX5_GET(create_cq_out, out, cqn); cq->cons_index = 0; cq->arm_sn = 0; - atomic_set(&cq->refcount, 1); - init_completion(&cq->free); - spin_lock_irq(&table->lock); + mlx5_cq_table_write_lock(table); err = radix_tree_insert(&table->tree, cq->cqn, cq); - spin_unlock_irq(&table->lock); + if (likely(err == 0 && cq->cqn < MLX5_CQ_LINEAR_ARRAY_SIZE)) + table->linear_array[cq->cqn].cq = cq; + mlx5_cq_table_write_unlock(table); + if (err) goto err_cmd; - if (cq->cqn < MLX5_CQ_LINEAR_ARRAY_SIZE) { - struct mlx5_cq_linear_array_entry *entry; - - entry = &table->linear_array[cq->cqn]; - spin_lock_irq(&entry->lock); - entry->cq = cq; - spin_unlock_irq(&entry->lock); - } - cq->pid = curthread->td_proc->p_pid; return 0; @@ -152,44 +164,24 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, st u32 out[MLX5_ST_SZ_DW(destroy_cq_out)] = {0}; u32 in[MLX5_ST_SZ_DW(destroy_cq_in)] = {0}; struct mlx5_core_cq *tmp; - int err; - if (cq->cqn < MLX5_CQ_LINEAR_ARRAY_SIZE) { - struct mlx5_cq_linear_array_entry *entry; - - entry = &table->linear_array[cq->cqn]; - spin_lock_irq(&entry->lock); - entry->cq = NULL; - spin_unlock_irq(&entry->lock); - } - - spin_lock_irq(&table->lock); + mlx5_cq_table_write_lock(table); + if (likely(cq->cqn < MLX5_CQ_LINEAR_ARRAY_SIZE)) + table->linear_array[cq->cqn].cq = NULL; tmp = radix_tree_delete(&table->tree, cq->cqn); - spin_unlock_irq(&table->lock); - if (!tmp) { + mlx5_cq_table_write_unlock(table); + + if (unlikely(tmp == NULL)) { mlx5_core_warn(dev, "cq 0x%x not found in tree\n", cq->cqn); return -EINVAL; - } - if (tmp != cq) { - mlx5_core_warn(dev, "corruption on srqn 0x%x\n", cq->cqn); + } else if (unlikely(tmp != cq)) { + mlx5_core_warn(dev, "corrupted cqn 0x%x\n", cq->cqn); return -EINVAL; } MLX5_SET(destroy_cq_in, in, opcode, MLX5_CMD_OP_DESTROY_CQ); MLX5_SET(destroy_cq_in, in, cqn, cq->cqn); - err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); - if (err) - goto out; - - synchronize_irq(cq->irqn); - - if (atomic_dec_and_test(&cq->refcount)) - complete(&cq->free); - wait_for_completion(&cq->free); - -out: - - return err; + return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); } EXPORT_SYMBOL(mlx5_core_destroy_cq); @@ -259,17 +251,12 @@ int mlx5_core_modify_cq_moderation_mode(struct mlx5_co int mlx5_init_cq_table(struct mlx5_core_dev *dev) { struct mlx5_cq_table *table = &dev->priv.cq_table; - int err; - int x; memset(table, 0, sizeof(*table)); - spin_lock_init(&table->lock); - for (x = 0; x != MLX5_CQ_LINEAR_ARRAY_SIZE; x++) - spin_lock_init(&table->linear_array[x].lock); + spin_lock_init(&table->writerlock); INIT_RADIX_TREE(&table->tree, GFP_ATOMIC); - err = 0; - return err; + return 0; } void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Dec 1 12:52:15 2020 (r368222) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Dec 1 13:03:09 2020 (r368223) @@ -2171,6 +2171,7 @@ mlx5e_open_channel(struct mlx5e_priv *priv, struct mlx5e_channel_param *cparam, struct mlx5e_channel *c) { + struct epoch_tracker et; int i, err; /* zero non-persistant data */ @@ -2198,7 +2199,9 @@ mlx5e_open_channel(struct mlx5e_priv *priv, goto err_close_sqs; /* poll receive queue initially */ + NET_EPOCH_ENTER_ET(et); c->rq.cq.mcq.comp(&c->rq.cq.mcq); + NET_EPOCH_EXIT_ET(et); return (0); @@ -3740,6 +3743,7 @@ static void mlx5e_disable_rx_dma(struct mlx5e_channel *ch) { struct mlx5e_rq *rq = &ch->rq; + struct epoch_tracker et; int err; mtx_lock(&rq->mtx); @@ -3755,7 +3759,9 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch) while (!mlx5_wq_ll_is_empty(&rq->wq)) { msleep(1); + NET_EPOCH_ENTER_ET(et); rq->cq.mcq.comp(&rq->cq.mcq); + NET_EPOCH_EXIT_ET(et); } /* @@ -3773,6 +3779,7 @@ static void mlx5e_enable_rx_dma(struct mlx5e_channel *ch) { struct mlx5e_rq *rq = &ch->rq; + struct epoch_tracker et; int err; rq->wq.wqe_ctr = 0; @@ -3785,7 +3792,9 @@ mlx5e_enable_rx_dma(struct mlx5e_channel *ch) rq->enabled = 1; + NET_EPOCH_ENTER_ET(et); rq->cq.mcq.comp(&rq->cq.mcq); + NET_EPOCH_EXIT_ET(et); } void From owner-svn-src-stable@freebsd.org Tue Dec 1 13:06:29 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39B2B4A8CF5; Tue, 1 Dec 2020 13:06:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clj6F15Ntz3lWG; Tue, 1 Dec 2020 13:06:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FF781633D; Tue, 1 Dec 2020 13:06:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1D6Sqv055179; Tue, 1 Dec 2020 13:06:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1D6QHF055167; Tue, 1 Dec 2020 13:06:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011306.0B1D6QHF055167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 13:06:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368224 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib X-SVN-Commit-Revision: 368224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:06:29 -0000 Author: hselasky Date: Tue Dec 1 13:06:26 2020 New Revision: 368224 URL: https://svnweb.freebsd.org/changeset/base/368224 Log: MFC r367718: Report EQE data upon CQ completion in mlx5core. Report EQE data upon CQ completion to let upper layers use this data. Linux commit: 4e0e2ea1886afe8c001971ff767f6670312a9b04 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/mlx5/cq.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/cq.h ============================================================================== --- stable/12/sys/dev/mlx5/cq.h Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/cq.h Tue Dec 1 13:06:26 2020 (r368224) @@ -32,7 +32,7 @@ #include #include - +struct mlx5_eqe; struct mlx5_core_cq { u32 cqn; int cqe_sz; @@ -40,7 +40,7 @@ struct mlx5_core_cq { __be32 *arm_db; unsigned vector; int irqn; - void (*comp) (struct mlx5_core_cq *); + void (*comp) (struct mlx5_core_cq *, struct mlx5_eqe *); void (*event) (struct mlx5_core_cq *, int); struct mlx5_uar *uar; u32 cons_index; Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/driver.h Tue Dec 1 13:06:26 2020 (r368224) @@ -1021,7 +1021,7 @@ void mlx5_unregister_debugfs(void); int mlx5_eq_init(struct mlx5_core_dev *dev); void mlx5_eq_cleanup(struct mlx5_core_dev *dev); void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas); -void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn); +void mlx5_cq_completion(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe); void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c Tue Dec 1 13:06:26 2020 (r368224) @@ -56,13 +56,16 @@ mlx5_cq_table_write_unlock(struct mlx5_cq_table *table NET_EPOCH_WAIT(); } -void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn) +void mlx5_cq_completion(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe) { struct mlx5_cq_table *table = &dev->priv.cq_table; struct mlx5_core_cq *cq; struct epoch_tracker et; + u32 cqn; bool do_lock; + cqn = be32_to_cpu(eqe->data.comp.cqn) & 0xffffff; + NET_EPOCH_ENTER_ET(et); do_lock = atomic_read(&table->writercount) != 0; @@ -79,7 +82,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 if (likely(cq != NULL)) { ++cq->arm_sn; - cq->comp(cq); + cq->comp(cq, eqe); } else { mlx5_core_warn(dev, "Completion event for bogus CQ 0x%x\n", cqn); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Tue Dec 1 13:06:26 2020 (r368224) @@ -246,8 +246,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru eq->eqn, eqe_type_str(eqe->type)); switch (eqe->type) { case MLX5_EVENT_TYPE_COMP: - cqn = be32_to_cpu(eqe->data.comp.cqn) & 0xffffff; - mlx5_cq_completion(dev, cqn); + mlx5_cq_completion(dev, eqe); break; case MLX5_EVENT_TYPE_PATH_MIG: Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Tue Dec 1 13:06:26 2020 (r368224) @@ -147,7 +147,7 @@ MALLOC_DECLARE(M_MLX5EN); struct mlx5_core_dev; struct mlx5e_cq; -typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); +typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *, struct mlx5_eqe *); #define mlx5_en_err(_dev, format, ...) \ if_printf(_dev, "ERR: ""%s:%d:(pid %d): " format, \ @@ -1087,8 +1087,8 @@ int mlx5e_open_locked(struct ifnet *); int mlx5e_close_locked(struct ifnet *); void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, int event); -void mlx5e_rx_cq_comp(struct mlx5_core_cq *); -void mlx5e_tx_cq_comp(struct mlx5_core_cq *); +mlx5e_cq_comp_t mlx5e_rx_cq_comp; +mlx5e_cq_comp_t mlx5e_tx_cq_comp; struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); void mlx5e_dim_work(struct work_struct *); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Dec 1 13:06:26 2020 (r368224) @@ -1887,7 +1887,7 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { mtx_unlock(&sq->lock); msleep(1); - sq->cq.mcq.comp(&sq->cq.mcq); + sq->cq.mcq.comp(&sq->cq.mcq, NULL); mtx_lock(&sq->lock); } mtx_unlock(&sq->lock); @@ -1905,7 +1905,7 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { mtx_unlock(&sq->lock); msleep(1); - sq->cq.mcq.comp(&sq->cq.mcq); + sq->cq.mcq.comp(&sq->cq.mcq, NULL); mtx_lock(&sq->lock); } mtx_unlock(&sq->lock); @@ -2200,7 +2200,7 @@ mlx5e_open_channel(struct mlx5e_priv *priv, /* poll receive queue initially */ NET_EPOCH_ENTER_ET(et); - c->rq.cq.mcq.comp(&c->rq.cq.mcq); + c->rq.cq.mcq.comp(&c->rq.cq.mcq, NULL); NET_EPOCH_EXIT_ET(et); return (0); @@ -3760,7 +3760,7 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch) while (!mlx5_wq_ll_is_empty(&rq->wq)) { msleep(1); NET_EPOCH_ENTER_ET(et); - rq->cq.mcq.comp(&rq->cq.mcq); + rq->cq.mcq.comp(&rq->cq.mcq, NULL); NET_EPOCH_EXIT_ET(et); } @@ -3793,7 +3793,7 @@ mlx5e_enable_rx_dma(struct mlx5e_channel *ch) rq->enabled = 1; NET_EPOCH_ENTER_ET(et); - rq->cq.mcq.comp(&rq->cq.mcq); + rq->cq.mcq.comp(&rq->cq.mcq, NULL); NET_EPOCH_EXIT_ET(et); } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Tue Dec 1 13:06:26 2020 (r368224) @@ -232,7 +232,7 @@ mlx5e_rl_open_channel(struct mlx5e_rl_worker *rlw, int *ppsq = sq; /* poll TX queue initially */ - sq->cq.mcq.comp(&sq->cq.mcq); + sq->cq.mcq.comp(&sq->cq.mcq, NULL); return (0); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Dec 1 13:06:26 2020 (r368224) @@ -497,7 +497,7 @@ wq_ll_pop: } void -mlx5e_rx_cq_comp(struct mlx5_core_cq *mcq) +mlx5e_rx_cq_comp(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe __unused) { struct mlx5e_rq *rq = container_of(mcq, struct mlx5e_rq, cq.mcq); int i = 0; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Tue Dec 1 13:06:26 2020 (r368224) @@ -673,7 +673,7 @@ select_queue: } void -mlx5e_tx_cq_comp(struct mlx5_core_cq *mcq) +mlx5e_tx_cq_comp(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe __unused) { struct mlx5e_sq *sq = container_of(mcq, struct mlx5e_sq, cq.mcq); Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec 1 13:06:26 2020 (r368224) @@ -31,7 +31,7 @@ #include #include "mlx5_ib.h" -static void mlx5_ib_cq_comp(struct mlx5_core_cq *cq) +static void mlx5_ib_cq_comp(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe __unused) { struct ib_cq *ibcq = &to_mibcq(cq)->ibcq; Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Tue Dec 1 13:03:09 2020 (r368223) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Tue Dec 1 13:06:26 2020 (r368224) @@ -2459,7 +2459,7 @@ static void mlx5_ib_handle_internal_error(struct mlx5_ * lock/unlock above locks Now need to arm all involved CQs. */ list_for_each_entry(mcq, &cq_armed_list, reset_notify) { - mcq->comp(mcq); + mcq->comp(mcq, NULL); } spin_unlock_irqrestore(&ibdev->reset_flow_resource_lock, flags); } From owner-svn-src-stable@freebsd.org Tue Dec 1 13:09:06 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 299114A950A; Tue, 1 Dec 2020 13:09:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clj9F6X9Bz3lvp; Tue, 1 Dec 2020 13:09:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D36CC16380; Tue, 1 Dec 2020 13:09:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1D95QE055489; Tue, 1 Dec 2020 13:09:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1D94Tv055485; Tue, 1 Dec 2020 13:09:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011309.0B1D94Tv055485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 13:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368225 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_ib X-SVN-Commit-Revision: 368225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:09:06 -0000 Author: hselasky Date: Tue Dec 1 13:09:04 2020 New Revision: 368225 URL: https://svnweb.freebsd.org/changeset/base/368225 Log: MFC r367719: Make mlx5_cmd_exec_cb() a safe API in mlx5core. APIs that have deferred callbacks should have some kind of cleanup function that callers can use to fence the callbacks. Otherwise things like module unloading can lead to dangling function pointers, or worse. The IB MR code is the only place that calls this function and had a really poor attempt at creating this fence. Provide a good version in the core code as future patches will add more places that need this fence. Linux commit: e355477ed9e4f401e3931043df97325d38552d54 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Tue Dec 1 13:06:26 2020 (r368224) +++ stable/12/sys/dev/mlx5/driver.h Tue Dec 1 13:09:04 2020 (r368225) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -947,11 +948,30 @@ void mlx5_cmd_use_events(struct mlx5_core_dev *dev); void mlx5_cmd_use_polling(struct mlx5_core_dev *dev); void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome); int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type); + +struct mlx5_async_ctx { + struct mlx5_core_dev *dev; + atomic_t num_inflight; + struct wait_queue_head wait; +}; + +struct mlx5_async_work; + +typedef void (*mlx5_async_cbk_t)(int status, struct mlx5_async_work *context); + +struct mlx5_async_work { + struct mlx5_async_ctx *ctx; + mlx5_async_cbk_t user_callback; +}; + +void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev, + struct mlx5_async_ctx *ctx); +void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx); +int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size, + void *out, int out_size, mlx5_async_cbk_t callback, + struct mlx5_async_work *work); int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size); -int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, - void *out, int out_size, mlx5_cmd_cbk_t callback, - void *context); int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size); int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); @@ -986,9 +1006,10 @@ void mlx5_init_mr_table(struct mlx5_core_dev *dev); void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev); int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, struct mlx5_core_mr *mkey, - u32 *in, int inlen, - u32 *out, int outlen, - mlx5_cmd_cbk_t callback, void *context); + struct mlx5_async_ctx *async_ctx, u32 *in, + int inlen, u32 *out, int outlen, + mlx5_async_cbk_t callback, + struct mlx5_async_work *context); int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, u32 *in, int inlen); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Tue Dec 1 13:06:26 2020 (r368224) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Tue Dec 1 13:09:04 2020 (r368225) @@ -1345,11 +1345,57 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, } EXPORT_SYMBOL(mlx5_cmd_exec); -int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, - void *out, int out_size, mlx5_cmd_cbk_t callback, - void *context) +void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev, + struct mlx5_async_ctx *ctx) { - return cmd_exec_helper(dev, in, in_size, out, out_size, callback, context, false); + ctx->dev = dev; + /* Starts at 1 to avoid doing wake_up if we are not cleaning up */ + atomic_set(&ctx->num_inflight, 1); + init_waitqueue_head(&ctx->wait); +} +EXPORT_SYMBOL(mlx5_cmd_init_async_ctx); + +/** + * mlx5_cmd_cleanup_async_ctx - Clean up an async_ctx + * @ctx: The ctx to clean + * + * Upon return all callbacks given to mlx5_cmd_exec_cb() have been called. The + * caller must ensure that mlx5_cmd_exec_cb() is not called during or after + * the call mlx5_cleanup_async_ctx(). + */ +void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx) +{ + atomic_dec(&ctx->num_inflight); + wait_event(ctx->wait, atomic_read(&ctx->num_inflight) == 0); +} +EXPORT_SYMBOL(mlx5_cmd_cleanup_async_ctx); + +static void mlx5_cmd_exec_cb_handler(int status, void *_work) +{ + struct mlx5_async_work *work = _work; + struct mlx5_async_ctx *ctx = work->ctx; + + work->user_callback(status, work); + if (atomic_dec_and_test(&ctx->num_inflight)) + wake_up(&ctx->wait); +} + +int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size, + void *out, int out_size, mlx5_async_cbk_t callback, + struct mlx5_async_work *work) +{ + int ret; + + work->ctx = ctx; + work->user_callback = callback; + if (WARN_ON(!atomic_inc_not_zero(&ctx->num_inflight))) + return -EIO; + ret = cmd_exec_helper(ctx->dev, in, in_size, out, out_size, + mlx5_cmd_exec_cb_handler, work, false); + if (ret && atomic_dec_and_test(&ctx->num_inflight)) + wake_up(&ctx->wait); + + return ret; } EXPORT_SYMBOL(mlx5_cmd_exec_cb); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c Tue Dec 1 13:06:26 2020 (r368224) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c Tue Dec 1 13:09:04 2020 (r368225) @@ -50,9 +50,10 @@ void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev) int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, struct mlx5_core_mr *mkey, - u32 *in, int inlen, - u32 *out, int outlen, - mlx5_cmd_cbk_t callback, void *context) + struct mlx5_async_ctx *async_ctx, u32 *in, + int inlen, u32 *out, int outlen, + mlx5_async_cbk_t callback, + struct mlx5_async_work *context) { struct mlx5_mr_table *table = &dev->priv.mr_table; u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {0}; @@ -77,7 +78,7 @@ int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev } if (callback) - return mlx5_cmd_exec_cb(dev, in, inlen, out, outlen, + return mlx5_cmd_exec_cb(async_ctx, in, inlen, out, outlen, callback, context); err = mlx5_cmd_exec(dev, in, inlen, lout, sizeof(lout)); @@ -113,7 +114,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mkey, u32 *in, int inlen) { - return mlx5_core_create_mkey_cb(dev, mkey, in, inlen, + return mlx5_core_create_mkey_cb(dev, mkey, NULL, in, inlen, NULL, 0, NULL, NULL); } EXPORT_SYMBOL(mlx5_core_create_mkey); Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Tue Dec 1 13:06:26 2020 (r368224) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Tue Dec 1 13:09:04 2020 (r368225) @@ -509,6 +509,7 @@ struct mlx5_ib_mr { int live; void *descs_alloc; int access_flags; /* Needed for rereg MR */ + struct mlx5_async_work cb_work; }; struct mlx5_ib_mw { @@ -693,6 +694,8 @@ struct mlx5_ib_dev { /* Array with num_ports elements */ struct mlx5_ib_port *port; struct mlx5_ib_congestion congestion; + + struct mlx5_async_ctx async_ctx; }; static inline struct mlx5_ib_cq *to_mibcq(struct mlx5_core_cq *mcq) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c Tue Dec 1 13:06:26 2020 (r368224) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c Tue Dec 1 13:09:04 2020 (r368225) @@ -104,9 +104,10 @@ static void update_odp_mr(struct mlx5_ib_mr *mr) } #endif -static void reg_mr_callback(int status, void *context) +static void reg_mr_callback(int status, struct mlx5_async_work *context) { - struct mlx5_ib_mr *mr = context; + struct mlx5_ib_mr *mr = + container_of(context, struct mlx5_ib_mr, cb_work); struct mlx5_ib_dev *dev = mr->dev; struct mlx5_mr_cache *cache = &dev->cache; int c = order2idx(dev, mr->order); @@ -192,9 +193,9 @@ static int add_keys(struct mlx5_ib_dev *dev, int c, in ent->pending++; spin_unlock_irq(&ent->lock); err = mlx5_core_create_mkey_cb(dev->mdev, &mr->mmkey, - in, inlen, + &dev->async_ctx, in, inlen, mr->out, sizeof(mr->out), - reg_mr_callback, mr); + reg_mr_callback, &mr->cb_work); if (err) { spin_lock_irq(&ent->lock); ent->pending--; @@ -429,6 +430,7 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev) return -ENOMEM; } + mlx5_cmd_init_async_ctx(dev->mdev, &dev->async_ctx); setup_timer(&dev->delay_timer, delay_time_func, (unsigned long)dev); for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) { INIT_LIST_HEAD(&cache->ent[i].head); @@ -460,6 +462,7 @@ int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev) dev->cache.stopped = 1; flush_workqueue(dev->cache.wq); + mlx5_cmd_cleanup_async_ctx(&dev->async_ctx); for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) clean_keys(dev, i); From owner-svn-src-stable@freebsd.org Tue Dec 1 13:10:27 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AE354A9517; Tue, 1 Dec 2020 13:10:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CljBq1yF1z3m5Y; Tue, 1 Dec 2020 13:10:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35C0716223; Tue, 1 Dec 2020 13:10:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1DARKY055649; Tue, 1 Dec 2020 13:10:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1DAQRB055645; Tue, 1 Dec 2020 13:10:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011310.0B1DAQRB055645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 13:10:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368226 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_ib X-SVN-Commit-Revision: 368226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:10:27 -0000 Author: hselasky Date: Tue Dec 1 13:10:25 2020 New Revision: 368226 URL: https://svnweb.freebsd.org/changeset/base/368226 Log: MFC r367719: Make mlx5_cmd_exec_cb() a safe API in mlx5core. APIs that have deferred callbacks should have some kind of cleanup function that callers can use to fence the callbacks. Otherwise things like module unloading can lead to dangling function pointers, or worse. The IB MR code is the only place that calls this function and had a really poor attempt at creating this fence. Provide a good version in the core code as future patches will add more places that need this fence. Linux commit: e355477ed9e4f401e3931043df97325d38552d54 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Tue Dec 1 13:09:04 2020 (r368225) +++ stable/11/sys/dev/mlx5/driver.h Tue Dec 1 13:10:25 2020 (r368226) @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -925,11 +926,30 @@ void mlx5_cmd_use_events(struct mlx5_core_dev *dev); void mlx5_cmd_use_polling(struct mlx5_core_dev *dev); void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome); int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type); + +struct mlx5_async_ctx { + struct mlx5_core_dev *dev; + atomic_t num_inflight; + struct wait_queue_head wait; +}; + +struct mlx5_async_work; + +typedef void (*mlx5_async_cbk_t)(int status, struct mlx5_async_work *context); + +struct mlx5_async_work { + struct mlx5_async_ctx *ctx; + mlx5_async_cbk_t user_callback; +}; + +void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev, + struct mlx5_async_ctx *ctx); +void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx); +int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size, + void *out, int out_size, mlx5_async_cbk_t callback, + struct mlx5_async_work *work); int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size); -int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, - void *out, int out_size, mlx5_cmd_cbk_t callback, - void *context); int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size); int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); @@ -964,9 +984,10 @@ void mlx5_init_mr_table(struct mlx5_core_dev *dev); void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev); int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, struct mlx5_core_mr *mkey, - u32 *in, int inlen, - u32 *out, int outlen, - mlx5_cmd_cbk_t callback, void *context); + struct mlx5_async_ctx *async_ctx, u32 *in, + int inlen, u32 *out, int outlen, + mlx5_async_cbk_t callback, + struct mlx5_async_work *context); int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, u32 *in, int inlen); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Tue Dec 1 13:09:04 2020 (r368225) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Tue Dec 1 13:10:25 2020 (r368226) @@ -1345,11 +1345,57 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, } EXPORT_SYMBOL(mlx5_cmd_exec); -int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, - void *out, int out_size, mlx5_cmd_cbk_t callback, - void *context) +void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev, + struct mlx5_async_ctx *ctx) { - return cmd_exec_helper(dev, in, in_size, out, out_size, callback, context, false); + ctx->dev = dev; + /* Starts at 1 to avoid doing wake_up if we are not cleaning up */ + atomic_set(&ctx->num_inflight, 1); + init_waitqueue_head(&ctx->wait); +} +EXPORT_SYMBOL(mlx5_cmd_init_async_ctx); + +/** + * mlx5_cmd_cleanup_async_ctx - Clean up an async_ctx + * @ctx: The ctx to clean + * + * Upon return all callbacks given to mlx5_cmd_exec_cb() have been called. The + * caller must ensure that mlx5_cmd_exec_cb() is not called during or after + * the call mlx5_cleanup_async_ctx(). + */ +void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx) +{ + atomic_dec(&ctx->num_inflight); + wait_event(ctx->wait, atomic_read(&ctx->num_inflight) == 0); +} +EXPORT_SYMBOL(mlx5_cmd_cleanup_async_ctx); + +static void mlx5_cmd_exec_cb_handler(int status, void *_work) +{ + struct mlx5_async_work *work = _work; + struct mlx5_async_ctx *ctx = work->ctx; + + work->user_callback(status, work); + if (atomic_dec_and_test(&ctx->num_inflight)) + wake_up(&ctx->wait); +} + +int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size, + void *out, int out_size, mlx5_async_cbk_t callback, + struct mlx5_async_work *work) +{ + int ret; + + work->ctx = ctx; + work->user_callback = callback; + if (WARN_ON(!atomic_inc_not_zero(&ctx->num_inflight))) + return -EIO; + ret = cmd_exec_helper(ctx->dev, in, in_size, out, out_size, + mlx5_cmd_exec_cb_handler, work, false); + if (ret && atomic_dec_and_test(&ctx->num_inflight)) + wake_up(&ctx->wait); + + return ret; } EXPORT_SYMBOL(mlx5_cmd_exec_cb); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c Tue Dec 1 13:09:04 2020 (r368225) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c Tue Dec 1 13:10:25 2020 (r368226) @@ -50,9 +50,10 @@ void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev) int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, struct mlx5_core_mr *mkey, - u32 *in, int inlen, - u32 *out, int outlen, - mlx5_cmd_cbk_t callback, void *context) + struct mlx5_async_ctx *async_ctx, u32 *in, + int inlen, u32 *out, int outlen, + mlx5_async_cbk_t callback, + struct mlx5_async_work *context) { struct mlx5_mr_table *table = &dev->priv.mr_table; u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {0}; @@ -77,7 +78,7 @@ int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev } if (callback) - return mlx5_cmd_exec_cb(dev, in, inlen, out, outlen, + return mlx5_cmd_exec_cb(async_ctx, in, inlen, out, outlen, callback, context); err = mlx5_cmd_exec(dev, in, inlen, lout, sizeof(lout)); @@ -113,7 +114,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mkey, u32 *in, int inlen) { - return mlx5_core_create_mkey_cb(dev, mkey, in, inlen, + return mlx5_core_create_mkey_cb(dev, mkey, NULL, in, inlen, NULL, 0, NULL, NULL); } EXPORT_SYMBOL(mlx5_core_create_mkey); Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Tue Dec 1 13:09:04 2020 (r368225) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Tue Dec 1 13:10:25 2020 (r368226) @@ -509,6 +509,7 @@ struct mlx5_ib_mr { int live; void *descs_alloc; int access_flags; /* Needed for rereg MR */ + struct mlx5_async_work cb_work; }; struct mlx5_ib_mw { @@ -693,6 +694,8 @@ struct mlx5_ib_dev { /* Array with num_ports elements */ struct mlx5_ib_port *port; struct mlx5_ib_congestion congestion; + + struct mlx5_async_ctx async_ctx; }; static inline struct mlx5_ib_cq *to_mibcq(struct mlx5_core_cq *mcq) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c Tue Dec 1 13:09:04 2020 (r368225) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c Tue Dec 1 13:10:25 2020 (r368226) @@ -104,9 +104,10 @@ static void update_odp_mr(struct mlx5_ib_mr *mr) } #endif -static void reg_mr_callback(int status, void *context) +static void reg_mr_callback(int status, struct mlx5_async_work *context) { - struct mlx5_ib_mr *mr = context; + struct mlx5_ib_mr *mr = + container_of(context, struct mlx5_ib_mr, cb_work); struct mlx5_ib_dev *dev = mr->dev; struct mlx5_mr_cache *cache = &dev->cache; int c = order2idx(dev, mr->order); @@ -192,9 +193,9 @@ static int add_keys(struct mlx5_ib_dev *dev, int c, in ent->pending++; spin_unlock_irq(&ent->lock); err = mlx5_core_create_mkey_cb(dev->mdev, &mr->mmkey, - in, inlen, + &dev->async_ctx, in, inlen, mr->out, sizeof(mr->out), - reg_mr_callback, mr); + reg_mr_callback, &mr->cb_work); if (err) { spin_lock_irq(&ent->lock); ent->pending--; @@ -429,6 +430,7 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev) return -ENOMEM; } + mlx5_cmd_init_async_ctx(dev->mdev, &dev->async_ctx); setup_timer(&dev->delay_timer, delay_time_func, (unsigned long)dev); for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) { INIT_LIST_HEAD(&cache->ent[i].head); @@ -460,6 +462,7 @@ int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev) dev->cache.stopped = 1; flush_workqueue(dev->cache.wq); + mlx5_cmd_cleanup_async_ctx(&dev->async_ctx); for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) clean_keys(dev, i); From owner-svn-src-stable@freebsd.org Tue Dec 1 13:44:35 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECC974AA233; Tue, 1 Dec 2020 13:44:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CljyC6KBJz3p5y; Tue, 1 Dec 2020 13:44:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CBBA6168AD; Tue, 1 Dec 2020 13:44:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1DiZVR080670; Tue, 1 Dec 2020 13:44:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1DiXJk080661; Tue, 1 Dec 2020 13:44:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011344.0B1DiXJk080661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 13:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368227 - in stable/12/sys: conf modules modules/if_infiniband net ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: conf modules modules/if_infiniband net ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 368227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:44:36 -0000 Author: hselasky Date: Tue Dec 1 13:44:33 2020 New Revision: 368227 URL: https://svnweb.freebsd.org/changeset/base/368227 Log: MFC r366930, r366936, r366993 and r366994: Factor out generic IP over infiniband, IPoIB, definitions and code into net/if_infiniband.c and net/infiniband.h . No functional change intended. Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ Sponsored by: Mellanox Technologies // NVIDIA Networking Added: stable/12/sys/modules/if_infiniband/ - copied from r366930, head/sys/modules/if_infiniband/ stable/12/sys/net/if_infiniband.c - copied, changed from r366930, head/sys/net/if_infiniband.c stable/12/sys/net/infiniband.h - copied, changed from r366930, head/sys/net/infiniband.h Modified: stable/12/sys/conf/files stable/12/sys/modules/Makefile stable/12/sys/modules/if_infiniband/Makefile stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Tue Dec 1 13:10:25 2020 (r368226) +++ stable/12/sys/conf/files Tue Dec 1 13:44:33 2020 (r368227) @@ -4578,6 +4578,7 @@ compat/lindebugfs/lindebugfs.c optional lindebugfs \ compile-with "${LINUXKPI_C}" # OpenFabrics Enterprise Distribution (Infiniband) +net/if_infiniband.c optional ofed ofed/drivers/infiniband/core/ib_addr.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_agent.c optional ofed \ Modified: stable/12/sys/modules/Makefile ============================================================================== --- stable/12/sys/modules/Makefile Tue Dec 1 13:10:25 2020 (r368226) +++ stable/12/sys/modules/Makefile Tue Dec 1 13:44:33 2020 (r368227) @@ -171,6 +171,7 @@ SUBDIR= \ ${_if_gif} \ ${_if_gre} \ ${_if_me} \ + if_infiniband \ if_lagg \ ${_if_ndis} \ ${_if_stf} \ Modified: stable/12/sys/modules/if_infiniband/Makefile ============================================================================== --- head/sys/modules/if_infiniband/Makefile Thu Oct 22 09:09:53 2020 (r366930) +++ stable/12/sys/modules/if_infiniband/Makefile Tue Dec 1 13:44:33 2020 (r368227) @@ -4,6 +4,8 @@ KMOD= if_infiniband SRCS= if_infiniband.c \ + device_if.h \ + bus_if.h \ opt_inet.h \ opt_inet6.h Copied and modified: stable/12/sys/net/if_infiniband.c (from r366930, head/sys/net/if_infiniband.c) ============================================================================== --- head/sys/net/if_infiniband.c Thu Oct 22 09:09:53 2020 (r366930, copy source) +++ stable/12/sys/net/if_infiniband.c Tue Dec 1 13:44:33 2020 (r368227) @@ -29,30 +29,30 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include +#include #include +#include +#include +#include #include #include -#include -#include -#include -#include -#include +#include #include #include -#include -#include -#include +#include +#include #include -#include #include - -#include +#include +#include +#include +#include #include +#include #include - #include #include @@ -60,8 +60,8 @@ __FBSDID("$FreeBSD$"); #ifdef INET static inline void -infiniband_ipv4_multicast_map(uint32_t addr, - const uint8_t *broadcast, uint8_t *buf) +infiniband_ipv4_multicast_map( + uint32_t addr, const uint8_t *broadcast, uint8_t *buf) { uint8_t scope; @@ -93,8 +93,8 @@ infiniband_ipv4_multicast_map(uint32_t addr, #ifdef INET6 static inline void -infiniband_ipv6_multicast_map(const struct in6_addr *addr, - const uint8_t *broadcast, uint8_t *buf) +infiniband_ipv6_multicast_map( + const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) { uint8_t scope; @@ -122,7 +122,7 @@ infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb { struct infiniband_header *ibh; struct ether_header eh; - + if (mb->m_len < sizeof(*ibh)) return; @@ -155,8 +155,6 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c uint16_t type; bool is_gw; - NET_EPOCH_ASSERT(); - is_gw = ((ro != NULL) && (ro->ro_flags & RT_HAS_GW) != 0); #ifdef MAC @@ -192,7 +190,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c if (error) { if (error == EWOULDBLOCK) error = 0; - m = NULL; /* mbuf is consumed by resolver */ + m = NULL; /* mbuf is consumed by resolver */ goto bad; } } @@ -259,7 +257,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c if (error) { if (error == EWOULDBLOCK) error = 0; - m = NULL; /* mbuf is consumed by resolver */ + m = NULL; /* mbuf is consumed by resolver */ goto bad; } } @@ -386,16 +384,16 @@ infiniband_input(struct ifnet *ifp, struct mbuf *m) mac_ifnet_create_mbuf(ifp, m); #endif /* Allow monitor mode to claim this frame, after stats are updated. */ - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); netisr_dispatch(isr, m); - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); done: CURVNET_RESTORE(); } static int -infiniband_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, - struct sockaddr *sa) +infiniband_resolvemulti( + struct ifnet *ifp, struct sockaddr **llsa, struct sockaddr *sa) { struct sockaddr_dl *sdl; #ifdef INET @@ -426,8 +424,8 @@ infiniband_resolvemulti(struct ifnet *ifp, struct sock sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); sdl->sdl_alen = INFINIBAND_ADDR_LEN; e_addr = LLADDR(sdl); - infiniband_ipv4_multicast_map(sin->sin_addr.s_addr, ifp->if_broadcastaddr, - e_addr); + infiniband_ipv4_multicast_map( + sin->sin_addr.s_addr, ifp->if_broadcastaddr, e_addr); *llsa = (struct sockaddr *)sdl; return (0); #endif @@ -446,7 +444,8 @@ infiniband_resolvemulti(struct ifnet *ifp, struct sock sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); sdl->sdl_alen = INFINIBAND_ADDR_LEN; e_addr = LLADDR(sdl); - infiniband_ipv6_multicast_map(&sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); + infiniband_ipv6_multicast_map( + &sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); *llsa = (struct sockaddr *)sdl; return (0); #endif @@ -471,7 +470,7 @@ infiniband_ifattach(struct ifnet *ifp, const uint8_t * ifp->if_resolvemulti = infiniband_resolvemulti; if (ifp->if_baudrate == 0) - ifp->if_baudrate = IF_Gbps(10); /* default value */ + ifp->if_baudrate = IF_Gbps(10); /* default value */ if (llb != NULL) ifp->if_broadcastaddr = llb; Copied and modified: stable/12/sys/net/infiniband.h (from r366930, head/sys/net/infiniband.h) ============================================================================== --- head/sys/net/infiniband.h Thu Oct 22 09:09:53 2020 (r366930, copy source) +++ stable/12/sys/net/infiniband.h Tue Dec 1 13:44:33 2020 (r368227) @@ -61,8 +61,6 @@ struct infiniband_address { #ifdef _KERNEL -#include - struct ifnet; struct mbuf; @@ -70,10 +68,12 @@ extern void infiniband_ifattach(struct ifnet *, const extern void infiniband_ifdetach(struct ifnet *); extern void infiniband_bpf_mtap(struct ifnet *, struct mbuf *); +#ifdef _SYS_EVENTHANDLER_H_ /* new infiniband interface attached event */ typedef void (*infiniband_ifattach_event_handler_t)(void *, struct ifnet *); EVENTHANDLER_DECLARE(infiniband_ifattach_event, infiniband_ifattach_event_handler_t); +#endif #endif Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Tue Dec 1 13:10:25 2020 (r368226) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Tue Dec 1 13:44:33 2020 (r368227) @@ -438,16 +438,7 @@ struct ipoib_path { extern struct workqueue_struct *ipoib_workqueue; -#define IPOIB_MTAP_PROTO(_ifp, _m, _proto) \ -do { \ - if (bpf_peers_present((_ifp)->if_bpf)) { \ - M_ASSERTVALID(_m); \ - ipoib_mtap_proto((_ifp), (_m), (_proto)); \ - } \ -} while (0) - /* functions */ -void ipoib_mtap_proto(struct ifnet *ifp, struct mbuf *mb, uint16_t proto); void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr); void ipoib_send_comp_handler(struct ib_cq *cq, void *dev_ptr); @@ -463,8 +454,6 @@ int ipoib_open(struct ipoib_dev_priv *priv); int ipoib_add_pkey_attr(struct ipoib_dev_priv *priv); int ipoib_add_umcast_attr(struct ipoib_dev_priv *priv); -void ipoib_demux(struct ifnet *ifp, struct mbuf *m, u_short proto); - void ipoib_send(struct ipoib_dev_priv *priv, struct mbuf *mb, struct ipoib_ah *address, u32 qpn); void ipoib_reap_ah(struct work_struct *work); @@ -540,7 +529,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size); void ipoib_set_ethtool_ops(struct ifnet *dev); Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Tue Dec 1 13:10:25 2020 (r368226) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Tue Dec 1 13:44:33 2020 (r368227) @@ -153,7 +153,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - priv->cm.max_cm_mtu); + sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, @@ -484,10 +484,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv struct mbuf *mb, *newmb; struct ipoib_cm_rx *p; int has_srq; - u_short proto; - CURVNET_SET_QUIET(dev->if_vnet); - ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n", wr_id, wc->status); @@ -561,16 +558,24 @@ void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv ipoib_dma_mb(priv, mb, wc->byte_len); - if_inc_counter(dev, IFCOUNTER_IPACKETS, 1); - if_inc_counter(dev, IFCOUNTER_IBYTES, mb->m_pkthdr.len); - mb->m_pkthdr.rcvif = dev; - proto = *mtod(mb, uint16_t *); - m_adj(mb, IPOIB_ENCAP_LEN); - IPOIB_MTAP_PROTO(dev, mb, proto); - ipoib_demux(dev, mb, ntohs(proto)); + M_PREPEND(mb, sizeof(struct ipoib_pseudoheader), M_NOWAIT); + if (likely(mb != NULL)) { + struct ipoib_header *ibh; + if_inc_counter(dev, IFCOUNTER_IPACKETS, 1); + if_inc_counter(dev, IFCOUNTER_IBYTES, mb->m_pkthdr.len); + + /* fixup destination infiniband address */ + ibh = mtod(mb, struct ipoib_header *); + memset(ibh->hwaddr, 0, 4); + memcpy(ibh->hwaddr + 4, priv->local_gid.raw, sizeof(union ib_gid)); + + dev->if_input(dev, mb); + } else { + if_inc_counter(dev, IFCOUNTER_IERRORS, 1); + } repost: if (has_srq) { if (unlikely(ipoib_cm_post_receive_srq(priv, wr_id))) @@ -587,7 +592,6 @@ repost: } } done: - CURVNET_RESTORE(); return; } Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Tue Dec 1 13:10:25 2020 (r368226) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Tue Dec 1 13:44:33 2020 (r368227) @@ -112,17 +112,19 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int size) + int align, int size) { struct mbuf *mb, *m; int i, j; rx_req->mb = NULL; - mb = m_getm2(NULL, size, M_NOWAIT, MT_DATA, M_PKTHDR); + mb = m_getm2(NULL, align + size, M_NOWAIT, MT_DATA, M_PKTHDR); if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { - m->m_len = M_SIZE(m); + m->m_len = M_SIZE(m) - align; + m->m_data += align; + align = 0; mb->m_pkthdr.len += m->m_len; rx_req->mapping[i] = ib_dma_map_single(priv->ca, mtod(m, void *), m->m_len, DMA_FROM_DEVICE); @@ -174,7 +176,7 @@ ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - priv->max_ib_mtu + IB_GRH_BYTES); + 0, priv->max_ib_mtu + IB_GRH_BYTES); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Dec 1 13:10:25 2020 (r368226) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Dec 1 13:44:33 2020 (r368227) @@ -39,21 +39,16 @@ __FBSDID("$FreeBSD$"); #include "ipoib.h" -static int ipoib_resolvemulti(struct ifnet *, struct sockaddr **, - struct sockaddr *); - - #include #include #include #include -#include /* For ARPHRD_xxx */ #include -#include -#include +#include + #include MODULE_AUTHOR("Roland Dreier"); @@ -97,19 +92,8 @@ static struct net_device *ipoib_get_net_dev_by_params( const union ib_gid *gid, const struct sockaddr *addr, void *client_data); static void ipoib_start(struct ifnet *dev); -static int ipoib_output(struct ifnet *ifp, struct mbuf *m, - const struct sockaddr *dst, struct route *ro); static int ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data); -static void ipoib_input(struct ifnet *ifp, struct mbuf *m); -#define IPOIB_MTAP(_ifp, _m) \ -do { \ - if (bpf_peers_present((_ifp)->if_bpf)) { \ - M_ASSERTVALID(_m); \ - ipoib_mtap_mb((_ifp), (_m)); \ - } \ -} while (0) - static struct unrhdr *ipoib_unrhdr; static void @@ -135,37 +119,6 @@ ipoib_unrhdr_uninit(void *arg) } SYSUNINIT(ipoib_unrhdr_uninit, SI_SUB_KLD - 1, SI_ORDER_ANY, ipoib_unrhdr_uninit, NULL); -/* - * This is for clients that have an ipoib_header in the mbuf. - */ -static void -ipoib_mtap_mb(struct ifnet *ifp, struct mbuf *mb) -{ - struct ipoib_header *ih; - struct ether_header eh; - - ih = mtod(mb, struct ipoib_header *); - eh.ether_type = ih->proto; - bcopy(ih->hwaddr, &eh.ether_dhost, ETHER_ADDR_LEN); - bzero(&eh.ether_shost, ETHER_ADDR_LEN); - mb->m_data += sizeof(struct ipoib_header); - mb->m_len -= sizeof(struct ipoib_header); - bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb); - mb->m_data -= sizeof(struct ipoib_header); - mb->m_len += sizeof(struct ipoib_header); -} - -void -ipoib_mtap_proto(struct ifnet *ifp, struct mbuf *mb, uint16_t proto) -{ - struct ether_header eh; - - eh.ether_type = proto; - bzero(&eh.ether_shost, ETHER_ADDR_LEN); - bzero(&eh.ether_dhost, ETHER_ADDR_LEN); - bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb); -} - static struct ib_client ipoib_client = { .name = "ipoib", .add = ipoib_add_one, @@ -783,7 +736,7 @@ ipoib_start_locked(struct ifnet *dev, struct ipoib_dev IFQ_DRV_DEQUEUE(&dev->if_snd, mb); if (mb == NULL) break; - IPOIB_MTAP(dev, mb); + INFINIBAND_BPF_MTAP(dev, mb); ipoib_send_one(priv, mb); } } @@ -871,8 +824,7 @@ ipoib_detach(struct ipoib_dev_priv *priv) dev = priv->dev; if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { priv->gone = 1; - bpfdetach(dev); - if_detach(dev); + infiniband_ifdetach(dev); if_free(dev); free_unr(ipoib_unrhdr, priv->unit); } else @@ -931,7 +883,6 @@ struct ipoib_dev_priv * ipoib_intf_alloc(const char *name) { struct ipoib_dev_priv *priv; - struct sockaddr_dl *sdl; struct ifnet *dev; priv = ipoib_priv_alloc(); @@ -949,24 +900,17 @@ ipoib_intf_alloc(const char *name) } if_initname(dev, name, priv->unit); dev->if_flags = IFF_BROADCAST | IFF_MULTICAST; - dev->if_addrlen = INFINIBAND_ALEN; - dev->if_hdrlen = IPOIB_HEADER_LEN; - if_attach(dev); + + infiniband_ifattach(dev, NULL, priv->broadcastaddr); + dev->if_init = ipoib_init; dev->if_ioctl = ipoib_ioctl; dev->if_start = ipoib_start; - dev->if_output = ipoib_output; - dev->if_input = ipoib_input; - dev->if_resolvemulti = ipoib_resolvemulti; - dev->if_baudrate = IF_Gbps(10); - dev->if_broadcastaddr = priv->broadcastaddr; + dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2; - sdl = (struct sockaddr_dl *)dev->if_addr->ifa_addr; - sdl->sdl_type = IFT_INFINIBAND; - sdl->sdl_alen = dev->if_addrlen; + priv->dev = dev; if_link_state_change(dev, LINK_STATE_DOWN); - bpfattach(dev, DLT_EN10MB, ETHER_HDR_LEN); return dev->if_softc; } @@ -1160,7 +1104,6 @@ ipoib_match_dev_addr(const struct sockaddr *addr, stru struct ifaddr *ifa; int retval = 0; - CURVNET_SET(dev->if_vnet); IF_ADDR_RLOCK(dev); CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL || @@ -1174,7 +1117,6 @@ ipoib_match_dev_addr(const struct sockaddr *addr, stru } } IF_ADDR_RUNLOCK(dev); - CURVNET_RESTORE(); return (retval); } @@ -1464,281 +1406,6 @@ ipoib_cleanup_module(void) ib_sa_unregister_client(&ipoib_sa_client); destroy_workqueue(ipoib_workqueue); } - -/* - * Infiniband output routine. - */ -static int -ipoib_output(struct ifnet *ifp, struct mbuf *m, - const struct sockaddr *dst, struct route *ro) -{ - u_char edst[INFINIBAND_ALEN]; -#if defined(INET) || defined(INET6) - struct llentry *lle = NULL; -#endif - struct ipoib_header *eh; - int error = 0, is_gw = 0; - short type; - - if (ro != NULL) - is_gw = (ro->ro_flags & RT_HAS_GW) != 0; -#ifdef MAC - error = mac_ifnet_check_transmit(ifp, m); - if (error) - goto bad; -#endif - - M_PROFILE(m); - if (ifp->if_flags & IFF_MONITOR) { - error = ENETDOWN; - goto bad; - } - if (!((ifp->if_flags & IFF_UP) && - (ifp->if_drv_flags & IFF_DRV_RUNNING))) { - error = ENETDOWN; - goto bad; - } - - switch (dst->sa_family) { -#ifdef INET - case AF_INET: - if (lle != NULL && (lle->la_flags & LLE_VALID)) - memcpy(edst, lle->ll_addr, sizeof(edst)); - else if (m->m_flags & M_MCAST) - ip_ib_mc_map(((struct sockaddr_in *)dst)->sin_addr.s_addr, ifp->if_broadcastaddr, edst); - else - error = arpresolve(ifp, is_gw, m, dst, edst, NULL, NULL); - if (error) - return (error == EWOULDBLOCK ? 0 : error); - type = htons(ETHERTYPE_IP); - break; - case AF_ARP: - { - struct arphdr *ah; - ah = mtod(m, struct arphdr *); - ah->ar_hrd = htons(ARPHRD_INFINIBAND); - - switch(ntohs(ah->ar_op)) { - case ARPOP_REVREQUEST: - case ARPOP_REVREPLY: - type = htons(ETHERTYPE_REVARP); - break; - case ARPOP_REQUEST: - case ARPOP_REPLY: - default: - type = htons(ETHERTYPE_ARP); - break; - } - - if (m->m_flags & M_BCAST) - bcopy(ifp->if_broadcastaddr, edst, INFINIBAND_ALEN); - else - bcopy(ar_tha(ah), edst, INFINIBAND_ALEN); - - } - break; -#endif -#ifdef INET6 - case AF_INET6: - if (lle != NULL && (lle->la_flags & LLE_VALID)) - memcpy(edst, lle->ll_addr, sizeof(edst)); - else if (m->m_flags & M_MCAST) - ipv6_ib_mc_map(&((struct sockaddr_in6 *)dst)->sin6_addr, ifp->if_broadcastaddr, edst); - else - error = nd6_resolve(ifp, is_gw, m, dst, edst, NULL, NULL); - if (error) - return error; - type = htons(ETHERTYPE_IPV6); - break; -#endif - - default: - if_printf(ifp, "can't handle af%d\n", dst->sa_family); - error = EAFNOSUPPORT; - goto bad; - } - - /* - * Add local net header. If no space in first mbuf, - * allocate another. - */ - M_PREPEND(m, IPOIB_HEADER_LEN, M_NOWAIT); - if (m == NULL) { - error = ENOBUFS; - goto bad; - } - eh = mtod(m, struct ipoib_header *); - (void)memcpy(&eh->proto, &type, sizeof(eh->proto)); - (void)memcpy(&eh->hwaddr, edst, sizeof (edst)); - - /* - * Queue message on interface, update output statistics if - * successful, and start output if interface not yet active. - */ - return ((ifp->if_transmit)(ifp, m)); -bad: - if (m != NULL) - m_freem(m); - return (error); -} - -/* - * Upper layer processing for a received Infiniband packet. - */ -void -ipoib_demux(struct ifnet *ifp, struct mbuf *m, u_short proto) -{ - int isr; - -#ifdef MAC - /* - * Tag the mbuf with an appropriate MAC label before any other - * consumers can get to it. - */ - mac_ifnet_create_mbuf(ifp, m); -#endif - /* Allow monitor mode to claim this frame, after stats are updated. */ - if (ifp->if_flags & IFF_MONITOR) { - if_printf(ifp, "discard frame at IFF_MONITOR\n"); - m_freem(m); - return; - } - /* Direct packet to correct FIB based on interface config */ - M_SETFIB(m, ifp->if_fib); - /* - * Dispatch frame to upper layer. - */ - switch (proto) { -#ifdef INET - case ETHERTYPE_IP: - isr = NETISR_IP; - break; - - case ETHERTYPE_ARP: - if (ifp->if_flags & IFF_NOARP) { - /* Discard packet if ARP is disabled on interface */ - m_freem(m); - return; - } - isr = NETISR_ARP; - break; -#endif -#ifdef INET6 - case ETHERTYPE_IPV6: - isr = NETISR_IPV6; - break; -#endif - default: - goto discard; - } - netisr_dispatch(isr, m); - return; - -discard: - m_freem(m); -} - -/* - * Process a received Infiniband packet. - */ -static void -ipoib_input(struct ifnet *ifp, struct mbuf *m) -{ - struct ipoib_header *eh; - - if ((ifp->if_flags & IFF_UP) == 0) { - m_freem(m); - return; - } - CURVNET_SET_QUIET(ifp->if_vnet); - - /* Let BPF have it before we strip the header. */ - IPOIB_MTAP(ifp, m); - eh = mtod(m, struct ipoib_header *); - /* - * Reset layer specific mbuf flags to avoid confusing upper layers. - * Strip off Infiniband header. - */ - m->m_flags &= ~M_VLANTAG; - m_clrprotoflags(m); - m_adj(m, IPOIB_HEADER_LEN); - - if (IPOIB_IS_MULTICAST(eh->hwaddr)) { - if (memcmp(eh->hwaddr, ifp->if_broadcastaddr, - ifp->if_addrlen) == 0) - m->m_flags |= M_BCAST; - else - m->m_flags |= M_MCAST; - if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1); - } - - ipoib_demux(ifp, m, ntohs(eh->proto)); - CURVNET_RESTORE(); -} - -static int -ipoib_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, - struct sockaddr *sa) -{ - struct sockaddr_dl *sdl; -#ifdef INET - struct sockaddr_in *sin; -#endif -#ifdef INET6 - struct sockaddr_in6 *sin6; -#endif - u_char *e_addr; - - switch(sa->sa_family) { - case AF_LINK: - /* - * No mapping needed. Just check that it's a valid MC address. - */ - sdl = (struct sockaddr_dl *)sa; - e_addr = LLADDR(sdl); - if (!IPOIB_IS_MULTICAST(e_addr)) - return EADDRNOTAVAIL; - *llsa = NULL; - return 0; - -#ifdef INET - case AF_INET: - sin = (struct sockaddr_in *)sa; - if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) - return EADDRNOTAVAIL; - sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); - sdl->sdl_alen = INFINIBAND_ALEN; - e_addr = LLADDR(sdl); - ip_ib_mc_map(sin->sin_addr.s_addr, ifp->if_broadcastaddr, - e_addr); - *llsa = (struct sockaddr *)sdl; - return 0; -#endif -#ifdef INET6 - case AF_INET6: - sin6 = (struct sockaddr_in6 *)sa; - /* - * An IP6 address of 0 means listen to all - * of the multicast address used for IP6. - * This has no meaning in ipoib. - */ - if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) - return EADDRNOTAVAIL; - if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) - return EADDRNOTAVAIL; - sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); - sdl->sdl_alen = INFINIBAND_ALEN; - e_addr = LLADDR(sdl); - ipv6_ib_mc_map(&sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); - *llsa = (struct sockaddr *)sdl; - return 0; -#endif - - default: - return EAFNOSUPPORT; - } -} - module_init_order(ipoib_init_module, SI_ORDER_FIFTH); module_exit_order(ipoib_cleanup_module, SI_ORDER_FIFTH); @@ -1755,4 +1422,5 @@ static moduledata_t ipoib_mod = { DECLARE_MODULE(ipoib, ipoib_mod, SI_SUB_LAST, SI_ORDER_ANY); MODULE_DEPEND(ipoib, ibcore, 1, 1, 1); +MODULE_DEPEND(ipoib, if_infiniband, 1, 1, 1); MODULE_DEPEND(ipoib, linuxkpi, 1, 1, 1); From owner-svn-src-stable@freebsd.org Tue Dec 1 13:47:17 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8126D4AA599; Tue, 1 Dec 2020 13:47:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clk1K3Gnbz3pbt; Tue, 1 Dec 2020 13:47:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5ED9016C00; Tue, 1 Dec 2020 13:47:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1DlHOE080862; Tue, 1 Dec 2020 13:47:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1DlGI7080860; Tue, 1 Dec 2020 13:47:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011347.0B1DlGI7080860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 13:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368228 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 368228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:47:17 -0000 Author: hselasky Date: Tue Dec 1 13:47:16 2020 New Revision: 368228 URL: https://svnweb.freebsd.org/changeset/base/368228 Log: MFC r366931: Implement mbuf hashing routines for IP over infiniband, IPoIB. No functional change intended. Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sys/kern/uipc_mbufhash.c stable/12/sys/sys/mbuf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/uipc_mbufhash.c ============================================================================== --- stable/12/sys/kern/uipc_mbufhash.c Tue Dec 1 13:44:33 2020 (r368227) +++ stable/12/sys/kern/uipc_mbufhash.c Tue Dec 1 13:47:16 2020 (r368228) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #if defined(INET) || defined(INET6) #include @@ -42,7 +43,7 @@ __FBSDID("$FreeBSD$"); #endif static const void * -m_ether_tcpip_hash_gethdr(const struct mbuf *m, const u_int off, +m_common_hash_gethdr(const struct mbuf *m, const u_int off, const u_int len, void *buf) { @@ -65,9 +66,19 @@ m_ether_tcpip_hash_init(void) } uint32_t -m_ether_tcpip_hash(const uint32_t flags, const struct mbuf *m, - const uint32_t key) +m_infiniband_tcpip_hash_init(void) { + uint32_t seed; + + seed = arc4random(); + return (fnv_32_buf(&seed, sizeof(seed), FNV1_32_INIT)); +} + +static inline uint32_t +m_tcpip_hash(const uint32_t flags, const struct mbuf *m, + uint32_t p, int off, const uint16_t etype) +{ +#if defined(INET) || defined(INET6) union { #ifdef INET struct ip ip; @@ -75,49 +86,19 @@ m_ether_tcpip_hash(const uint32_t flags, const struct #ifdef INET6 struct ip6_hdr ip6; #endif - struct ether_vlan_header vlan; uint32_t port; } buf; - const struct ether_header *eh; - const struct ether_vlan_header *vlan; #ifdef INET const struct ip *ip; #endif #ifdef INET6 const struct ip6_hdr *ip6; #endif - uint32_t p; - int off; - uint16_t etype; - - p = key; - off = sizeof(*eh); - if (m->m_len < off) - goto done; - eh = mtod(m, struct ether_header *); - etype = ntohs(eh->ether_type); - if (flags & MBUF_HASHFLAG_L2) { - p = fnv_32_buf(&eh->ether_shost, ETHER_ADDR_LEN, p); - p = fnv_32_buf(&eh->ether_dhost, ETHER_ADDR_LEN, p); - } - /* Special handling for encapsulating VLAN frames */ - if ((m->m_flags & M_VLANTAG) && (flags & MBUF_HASHFLAG_L2)) { - p = fnv_32_buf(&m->m_pkthdr.ether_vtag, - sizeof(m->m_pkthdr.ether_vtag), p); - } else if (etype == ETHERTYPE_VLAN) { - vlan = m_ether_tcpip_hash_gethdr(m, off, sizeof(*vlan), &buf); - if (vlan == NULL) - goto done; - - if (flags & MBUF_HASHFLAG_L2) - p = fnv_32_buf(&vlan->evl_tag, sizeof(vlan->evl_tag), p); - etype = ntohs(vlan->evl_proto); - off += sizeof(*vlan) - sizeof(*eh); - } +#endif switch (etype) { #ifdef INET case ETHERTYPE_IP: - ip = m_ether_tcpip_hash_gethdr(m, off, sizeof(*ip), &buf); + ip = m_common_hash_gethdr(m, off, sizeof(*ip), &buf); if (ip == NULL) break; if (flags & MBUF_HASHFLAG_L3) { @@ -136,7 +117,7 @@ m_ether_tcpip_hash(const uint32_t flags, const struct if (iphlen < sizeof(*ip)) break; off += iphlen; - ports = m_ether_tcpip_hash_gethdr(m, + ports = m_common_hash_gethdr(m, off, sizeof(*ports), &buf); if (ports == NULL) break; @@ -150,7 +131,7 @@ m_ether_tcpip_hash(const uint32_t flags, const struct #endif #ifdef INET6 case ETHERTYPE_IPV6: - ip6 = m_ether_tcpip_hash_gethdr(m, off, sizeof(*ip6), &buf); + ip6 = m_common_hash_gethdr(m, off, sizeof(*ip6), &buf); if (ip6 == NULL) break; if (flags & MBUF_HASHFLAG_L3) { @@ -169,6 +150,62 @@ m_ether_tcpip_hash(const uint32_t flags, const struct default: break; } -done: return (p); +} + +uint32_t +m_ether_tcpip_hash(const uint32_t flags, const struct mbuf *m, + uint32_t p) +{ + union { + struct ether_vlan_header vlan; + } buf; + const struct ether_header *eh; + const struct ether_vlan_header *vlan; + int off; + uint16_t etype; + + off = sizeof(*eh); + if (m->m_len < off) + return (p); + eh = mtod(m, struct ether_header *); + etype = ntohs(eh->ether_type); + if (flags & MBUF_HASHFLAG_L2) { + p = fnv_32_buf(&eh->ether_shost, ETHER_ADDR_LEN, p); + p = fnv_32_buf(&eh->ether_dhost, ETHER_ADDR_LEN, p); + } + /* Special handling for encapsulating VLAN frames */ + if ((m->m_flags & M_VLANTAG) && (flags & MBUF_HASHFLAG_L2)) { + p = fnv_32_buf(&m->m_pkthdr.ether_vtag, + sizeof(m->m_pkthdr.ether_vtag), p); + } else if (etype == ETHERTYPE_VLAN) { + vlan = m_common_hash_gethdr(m, off, sizeof(*vlan), &buf); + if (vlan == NULL) + return (p); + + if (flags & MBUF_HASHFLAG_L2) + p = fnv_32_buf(&vlan->evl_tag, sizeof(vlan->evl_tag), p); + etype = ntohs(vlan->evl_proto); + off += sizeof(*vlan) - sizeof(*eh); + } + return (m_tcpip_hash(flags, m, p, off, etype)); +} + +uint32_t +m_infiniband_tcpip_hash(const uint32_t flags, const struct mbuf *m, + uint32_t p) +{ + const struct infiniband_header *ibh; + int off; + uint16_t etype; + + off = sizeof(*ibh); + if (m->m_len < off) + return (p); + ibh = mtod(m, struct infiniband_header *); + etype = ntohs(ibh->ib_protocol); + if (flags & MBUF_HASHFLAG_L2) + p = fnv_32_buf(&ibh->ib_hwaddr, INFINIBAND_ADDR_LEN, p); + + return (m_tcpip_hash(flags, m, p, off, etype)); } Modified: stable/12/sys/sys/mbuf.h ============================================================================== --- stable/12/sys/sys/mbuf.h Tue Dec 1 13:44:33 2020 (r368227) +++ stable/12/sys/sys/mbuf.h Tue Dec 1 13:47:16 2020 (r368228) @@ -1283,14 +1283,16 @@ rt_m_getfib(struct mbuf *m) ((_m)->m_pkthdr.fibnum) = (_fib); \ } while (0) -/* flags passed as first argument for "m_ether_tcpip_hash()" */ +/* flags passed as first argument for "m_xxx_tcpip_hash()" */ #define MBUF_HASHFLAG_L2 (1 << 2) #define MBUF_HASHFLAG_L3 (1 << 3) #define MBUF_HASHFLAG_L4 (1 << 4) /* mbuf hashing helper routines */ uint32_t m_ether_tcpip_hash_init(void); -uint32_t m_ether_tcpip_hash(const uint32_t, const struct mbuf *, const uint32_t); +uint32_t m_ether_tcpip_hash(const uint32_t, const struct mbuf *, uint32_t); +uint32_t m_infiniband_tcpip_hash_init(void); +uint32_t m_infiniband_tcpip_hash(const uint32_t, const struct mbuf *, uint32_t); #ifdef MBUF_PROFILING void m_profile(struct mbuf *m); From owner-svn-src-stable@freebsd.org Tue Dec 1 13:58:17 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F4D14AA1DA; Tue, 1 Dec 2020 13:58:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClkG12hbbz3q8f; Tue, 1 Dec 2020 13:58:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E5D416A28; Tue, 1 Dec 2020 13:58:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1DwHjB087310; Tue, 1 Dec 2020 13:58:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1DwF18087300; Tue, 1 Dec 2020 13:58:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012011358.0B1DwF18087300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 1 Dec 2020 13:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368229 - in stable/12: sbin/ifconfig share/man/man4 sys/conf sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12: sbin/ifconfig share/man/man4 sys/conf sys/net X-SVN-Commit-Revision: 368229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:58:17 -0000 Author: hselasky Date: Tue Dec 1 13:58:14 2020 New Revision: 368229 URL: https://svnweb.freebsd.org/changeset/base/368229 Log: MFC r366933 and r366934: Add support for IP over infiniband, IPoIB, to lagg(4). Currently only the failover protocol is supported due to limitations in the IPoIB architecture. Refer to the lagg(4) manual page for how to configure and use this new feature. A new network interface type, IFT_INFINIBANDLAG, has been added, similar to the existing IFT_IEEE8023ADLAG . ifconfig(8) has been updated to accept a new laggtype argument when creating lagg(4) network interfaces. This new argument is used to distinguish between ethernet and infiniband type of lagg(4) network interface. The laggtype argument is optional and defaults to ethernet. The lagg(4) command line syntax is backwards compatible. Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sbin/ifconfig/ifconfig.8 stable/12/sbin/ifconfig/iflagg.c stable/12/share/man/man4/lagg.4 stable/12/sys/conf/files stable/12/sys/net/ieee8023ad_lacp.c stable/12/sys/net/if_ethersubr.c stable/12/sys/net/if_infiniband.c stable/12/sys/net/if_lagg.c stable/12/sys/net/if_lagg.h stable/12/sys/net/if_types.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/12/sbin/ifconfig/ifconfig.8 Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sbin/ifconfig/ifconfig.8 Tue Dec 1 13:58:14 2020 (r368229) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd November 1, 2020 +.Dd December 1, 2020 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2429,6 +2429,12 @@ Set to 0 to disable. .Pp The following parameters are specific to lagg interfaces: .Bl -tag -width indent +.It Cm laggtype Ar type +When creating a lagg interface the type can be specified as either +.Cm ethernet +or +.Cm infiniband . +If not specified ethernet is the default lagg type. .It Cm laggport Ar interface Add the interface named by .Ar interface Modified: stable/12/sbin/ifconfig/iflagg.c ============================================================================== --- stable/12/sbin/ifconfig/iflagg.c Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sbin/ifconfig/iflagg.c Tue Dec 1 13:58:14 2020 (r368229) @@ -30,8 +30,12 @@ static const char rcsid[] = #include "ifconfig.h" -char lacpbuf[120]; /* LACP peer '[(a,a,a),(p,p,p)]' */ +static struct iflaggparam params = { + .lagg_type = LAGG_TYPE_DEFAULT, +}; +static char lacpbuf[120]; /* LACP peer '[(a,a,a),(p,p,p)]' */ + static void setlaggport(const char *val, int d, int s, const struct afswtch *afp) { @@ -299,7 +303,31 @@ lagg_status(int s) } } +static +DECL_CMD_FUNC(setlaggtype, arg, d) +{ + static const struct lagg_types lt[] = LAGG_TYPES; + int i; + + for (i = 0; i < nitems(lt); i++) { + if (strcmp(arg, lt[i].lt_name) == 0) { + params.lagg_type = lt[i].lt_value; + return; + } + } + errx(1, "invalid lagg type: %s", arg); +} + +static void +lagg_create(int s, struct ifreq *ifr) +{ + ifr->ifr_data = (caddr_t) ¶ms; + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) + err(1, "SIOCIFCREATE2"); +} + static struct cmd lagg_cmds[] = { + DEF_CLONE_CMD_ARG("laggtype", setlaggtype), DEF_CMD_ARG("laggport", setlaggport), DEF_CMD_ARG("-laggport", unsetlaggport), DEF_CMD_ARG("laggproto", setlaggproto), @@ -331,4 +359,5 @@ lagg_ctor(void) for (i = 0; i < nitems(lagg_cmds); i++) cmd_register(&lagg_cmds[i]); af_register(&af_lagg); + clone_setdefcallback("lagg", lagg_create); } Modified: stable/12/share/man/man4/lagg.4 ============================================================================== --- stable/12/share/man/man4/lagg.4 Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/share/man/man4/lagg.4 Tue Dec 1 13:58:14 2020 (r368229) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 18, 2017 +.Dd October 21, 2020 .Dt LAGG 4 .Os .Sh NAME @@ -192,6 +192,15 @@ device will be used: .Pp (Note the mac address of the wireless device is forced to match the wired device as a workaround.) +.Pp +The following example shows how to create an infiniband failover interface. +.Bd -literal -offset indent +# ifconfig ib0 up +# ifconfig ib1 up +# ifconfig lagg0 create laggtype infiniband +# ifconfig lagg0 laggproto failover laggport ib0 laggport ib1 \e + 1.1.1.1 netmask 255.255.255.0 +.Ed .Sh SEE ALSO .Xr ng_one2many 4 , .Xr ifconfig 8 , Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sys/conf/files Tue Dec 1 13:58:14 2020 (r368229) @@ -4578,7 +4578,7 @@ compat/lindebugfs/lindebugfs.c optional lindebugfs \ compile-with "${LINUXKPI_C}" # OpenFabrics Enterprise Distribution (Infiniband) -net/if_infiniband.c optional ofed +net/if_infiniband.c optional ofed | lagg ofed/drivers/infiniband/core/ib_addr.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_agent.c optional ofed \ Modified: stable/12/sys/net/ieee8023ad_lacp.c ============================================================================== --- stable/12/sys/net/ieee8023ad_lacp.c Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sys/net/ieee8023ad_lacp.c Tue Dec 1 13:58:14 2020 (r368229) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/12/sys/net/if_ethersubr.c ============================================================================== --- stable/12/sys/net/if_ethersubr.c Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sys/net/if_ethersubr.c Tue Dec 1 13:58:14 2020 (r368229) @@ -110,7 +110,7 @@ void (*vlan_input_p)(struct ifnet *, struct mbuf *); void (*bridge_dn_p)(struct mbuf *, struct ifnet *); /* if_lagg(4) support */ -struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *); +struct mbuf *(*lagg_input_ethernet_p)(struct ifnet *, struct mbuf *); static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -566,9 +566,9 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m /* Handle input from a lagg(4) port */ if (ifp->if_type == IFT_IEEE8023ADLAG) { - KASSERT(lagg_input_p != NULL, + KASSERT(lagg_input_ethernet_p != NULL, ("%s: if_lagg not loaded!", __func__)); - m = (*lagg_input_p)(ifp, m); + m = (*lagg_input_ethernet_p)(ifp, m); if (m != NULL) ifp = m->m_pkthdr.rcvif; else { Modified: stable/12/sys/net/if_infiniband.c ============================================================================== --- stable/12/sys/net/if_infiniband.c Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sys/net/if_infiniband.c Tue Dec 1 13:58:14 2020 (r368229) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -58,10 +59,13 @@ __FBSDID("$FreeBSD$"); #include +/* if_lagg(4) support */ +struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); + #ifdef INET static inline void -infiniband_ipv4_multicast_map( - uint32_t addr, const uint8_t *broadcast, uint8_t *buf) +infiniband_ipv4_multicast_map(uint32_t addr, + const uint8_t *broadcast, uint8_t *buf) { uint8_t scope; @@ -93,8 +97,8 @@ infiniband_ipv4_multicast_map( #ifdef INET6 static inline void -infiniband_ipv6_multicast_map( - const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) +infiniband_ipv6_multicast_map(const struct in6_addr *addr, + const uint8_t *broadcast, uint8_t *buf) { uint8_t scope; @@ -344,6 +348,16 @@ infiniband_input(struct ifnet *ifp, struct mbuf *m) /* Direct packet to correct FIB based on interface config. */ M_SETFIB(m, ifp->if_fib); + /* Handle input from a lagg port */ + if (ifp->if_type == IFT_INFINIBANDLAG) { + KASSERT(lagg_input_infiniband_p != NULL, + ("%s: if_lagg not loaded!", __func__)); + m = (*lagg_input_infiniband_p)(ifp, m); + if (__predict_false(m == NULL)) + goto done; + ifp = m->m_pkthdr.rcvif; + } + /* * Dispatch frame to upper layer. */ @@ -392,8 +406,8 @@ done: } static int -infiniband_resolvemulti( - struct ifnet *ifp, struct sockaddr **llsa, struct sockaddr *sa) +infiniband_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, + struct sockaddr *sa) { struct sockaddr_dl *sdl; #ifdef INET Modified: stable/12/sys/net/if_lagg.c ============================================================================== --- stable/12/sys/net/if_lagg.c Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sys/net/if_lagg.c Tue Dec 1 13:58:14 2020 (r368229) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(INET) || defined(INET6) #include @@ -125,7 +126,8 @@ static MALLOC_DEFINE(M_LAGG, laggname, "802.3AD Link A static void lagg_capabilities(struct lagg_softc *); static int lagg_port_create(struct lagg_softc *, struct ifnet *); static int lagg_port_destroy(struct lagg_port *, int); -static struct mbuf *lagg_input(struct ifnet *, struct mbuf *); +static struct mbuf *lagg_input_ethernet(struct ifnet *, struct mbuf *); +static struct mbuf *lagg_input_infiniband(struct ifnet *, struct mbuf *); static void lagg_linkstate(struct lagg_softc *); static void lagg_port_state(struct ifnet *, int); static int lagg_port_ioctl(struct ifnet *, u_long, caddr_t); @@ -151,7 +153,8 @@ static int lagg_setflag(struct lagg_port *, int, int, int (*func)(struct ifnet *, int)); static int lagg_setflags(struct lagg_port *, int status); static uint64_t lagg_get_counter(struct ifnet *ifp, ift_counter cnt); -static int lagg_transmit(struct ifnet *, struct mbuf *); +static int lagg_transmit_ethernet(struct ifnet *, struct mbuf *); +static int lagg_transmit_infiniband(struct ifnet *, struct mbuf *); static void lagg_qflush(struct ifnet *); static int lagg_media_change(struct ifnet *); static void lagg_media_status(struct ifnet *, struct ifmediareq *); @@ -307,7 +310,8 @@ lagg_modevent(module_t mod, int type, void *data) switch (type) { case MOD_LOAD: - lagg_input_p = lagg_input; + lagg_input_ethernet_p = lagg_input_ethernet; + lagg_input_infiniband_p = lagg_input_infiniband; lagg_linkstate_p = lagg_port_state; lagg_detach_cookie = EVENTHANDLER_REGISTER( ifnet_departure_event, lagg_port_ifdetach, NULL, @@ -316,7 +320,8 @@ lagg_modevent(module_t mod, int type, void *data) case MOD_UNLOAD: EVENTHANDLER_DEREGISTER(ifnet_departure_event, lagg_detach_cookie); - lagg_input_p = NULL; + lagg_input_ethernet_p = NULL; + lagg_input_infiniband_p = NULL; lagg_linkstate_p = NULL; break; default: @@ -333,6 +338,7 @@ static moduledata_t lagg_mod = { DECLARE_MODULE(if_lagg, lagg_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_lagg, 1); +MODULE_DEPEND(if_lagg, if_infiniband, 1, 1, 1); static void lagg_proto_attach(struct lagg_softc *sc, lagg_proto pr) @@ -484,18 +490,48 @@ lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_i static int lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params) { + struct iflaggparam iflp; struct lagg_softc *sc; struct ifnet *ifp; - static const u_char eaddr[6]; /* 00:00:00:00:00:00 */ + int if_type; + int error; + static const uint8_t eaddr[LAGG_ADDR_LEN]; + static const uint8_t ib_bcast_addr[INFINIBAND_ADDR_LEN] = { + 0x00, 0xff, 0xff, 0xff, + 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff + }; + if (params != NULL) { + error = copyin(params, &iflp, sizeof(iflp)); + if (error) + return (error); + + switch (iflp.lagg_type) { + case LAGG_TYPE_ETHERNET: + if_type = IFT_ETHER; + break; + case LAGG_TYPE_INFINIBAND: + if_type = IFT_INFINIBAND; + break; + default: + return (EINVAL); + } + } else { + if_type = IFT_ETHER; + } + sc = malloc(sizeof(*sc), M_LAGG, M_WAITOK|M_ZERO); - ifp = sc->sc_ifp = if_alloc(IFT_ETHER); + ifp = sc->sc_ifp = if_alloc(if_type); if (ifp == NULL) { free(sc, M_LAGG); return (ENOSPC); } LAGG_SX_INIT(sc); + mtx_init(&sc->sc_mtx, "lagg-mtx", NULL, MTX_DEF); + callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); + LAGG_XLOCK(sc); if (V_def_use_flowid) sc->sc_opts |= LAGG_OPT_USE_FLOWID; @@ -508,15 +544,25 @@ lagg_clone_create(struct if_clone *ifc, int unit, cadd CK_SLIST_INIT(&sc->sc_ports); - /* Initialise pseudo media types */ - ifmedia_init(&sc->sc_media, 0, lagg_media_change, - lagg_media_status); - ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); + switch (if_type) { + case IFT_ETHER: + /* Initialise pseudo media types */ + ifmedia_init(&sc->sc_media, 0, lagg_media_change, + lagg_media_status); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); - if_initname(ifp, laggname, unit); + if_initname(ifp, laggname, unit); + ifp->if_transmit = lagg_transmit_ethernet; + break; + case IFT_INFINIBAND: + if_initname(ifp, laggname, unit); + ifp->if_transmit = lagg_transmit_infiniband; + break; + default: + break; + } ifp->if_softc = sc; - ifp->if_transmit = lagg_transmit; ifp->if_qflush = lagg_qflush; ifp->if_init = lagg_init; ifp->if_ioctl = lagg_ioctl; @@ -529,9 +575,18 @@ lagg_clone_create(struct if_clone *ifc, int unit, cadd /* * Attach as an ordinary ethernet device, children will be attached - * as special device IFT_IEEE8023ADLAG. + * as special device IFT_IEEE8023ADLAG or IFT_INFINIBANDLAG. */ - ether_ifattach(ifp, eaddr); + switch (if_type) { + case IFT_ETHER: + ether_ifattach(ifp, eaddr); + break; + case IFT_INFINIBAND: + infiniband_ifattach(ifp, eaddr, ib_bcast_addr); + break; + default: + break; + } sc->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, lagg_register_vlan, sc, EVENTHANDLER_PRI_FIRST); @@ -569,14 +624,24 @@ lagg_clone_destroy(struct ifnet *ifp) lagg_proto_detach(sc); LAGG_XUNLOCK(sc); - ifmedia_removeall(&sc->sc_media); - ether_ifdetach(ifp); + switch (ifp->if_type) { + case IFT_ETHER: + ifmedia_removeall(&sc->sc_media); + ether_ifdetach(ifp); + break; + case IFT_INFINIBAND: + infiniband_ifdetach(ifp); + break; + default: + break; + } if_free(ifp); LAGG_LIST_LOCK(); SLIST_REMOVE(&V_lagg_list, sc, lagg_softc, sc_entries); LAGG_LIST_UNLOCK(); + mtx_destroy(&sc->sc_mtx); LAGG_SX_DESTROY(sc); free(sc, M_LAGG); } @@ -643,6 +708,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * struct lagg_port *lp, *tlp; struct ifreq ifr; int error, i, oldmtu; + int if_type; uint64_t *pval; LAGG_XLOCK_ASSERT(sc); @@ -666,9 +732,22 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * return (EBUSY); } - /* XXX Disallow non-ethernet interfaces (this should be any of 802) */ - if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) - return (EPROTONOSUPPORT); + switch (sc->sc_ifp->if_type) { + case IFT_ETHER: + /* XXX Disallow non-ethernet interfaces (this should be any of 802) */ + if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) + return (EPROTONOSUPPORT); + if_type = IFT_IEEE8023ADLAG; + break; + case IFT_INFINIBAND: + /* XXX Disallow non-infiniband interfaces */ + if (ifp->if_type != IFT_INFINIBAND) + return (EPROTONOSUPPORT); + if_type = IFT_INFINIBANDLAG; + break; + default: + break; + } /* Allow the first Ethernet member to define the MTU */ oldmtu = -1; @@ -725,14 +804,14 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * if_ref(ifp); lp->lp_ifp = ifp; - bcopy(IF_LLADDR(ifp), lp->lp_lladdr, ETHER_ADDR_LEN); + bcopy(IF_LLADDR(ifp), lp->lp_lladdr, ifp->if_addrlen); lp->lp_ifcapenable = ifp->if_capenable; if (CK_SLIST_EMPTY(&sc->sc_ports)) { - bcopy(IF_LLADDR(ifp), IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + bcopy(IF_LLADDR(ifp), IF_LLADDR(sc->sc_ifp), ifp->if_addrlen); lagg_proto_lladdr(sc); EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); } else { - if_setlladdr(ifp, IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + if_setlladdr(ifp, IF_LLADDR(sc->sc_ifp), ifp->if_addrlen); } lagg_setflags(lp, 1); @@ -741,7 +820,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * /* Change the interface type */ lp->lp_iftype = ifp->if_type; - ifp->if_type = IFT_IEEE8023ADLAG; + ifp->if_type = if_type; ifp->if_lagg = lp; lp->lp_ioctl = ifp->if_ioctl; ifp->if_ioctl = lagg_port_ioctl; @@ -859,15 +938,15 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport /* Update the primary interface */ if (lp == sc->sc_primary) { - uint8_t lladdr[ETHER_ADDR_LEN]; + uint8_t lladdr[LAGG_ADDR_LEN]; if ((lp0 = CK_SLIST_FIRST(&sc->sc_ports)) == NULL) - bzero(&lladdr, ETHER_ADDR_LEN); + bzero(&lladdr, LAGG_ADDR_LEN); else - bcopy(lp0->lp_lladdr, lladdr, ETHER_ADDR_LEN); + bcopy(lp0->lp_lladdr, lladdr, LAGG_ADDR_LEN); sc->sc_primary = lp0; if (sc->sc_destroying == 0) { - bcopy(lladdr, IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + bcopy(lladdr, IF_LLADDR(sc->sc_ifp), sc->sc_ifp->if_addrlen); lagg_proto_lladdr(sc); EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); } @@ -877,7 +956,7 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport * as well, to switch from old lladdr to its 'real' one) */ CK_SLIST_FOREACH(lp_ptr, &sc->sc_ports, lp_entries) - if_setlladdr(lp_ptr->lp_ifp, lladdr, ETHER_ADDR_LEN); + if_setlladdr(lp_ptr->lp_ifp, lladdr, lp_ptr->lp_ifp->if_addrlen); } if (lp->lp_ifflags) @@ -886,7 +965,7 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport if (lp->lp_detaching == 0) { lagg_setflags(lp, 0); lagg_setcaps(lp, lp->lp_ifcapenable); - if_setlladdr(ifp, lp->lp_lladdr, ETHER_ADDR_LEN); + if_setlladdr(ifp, lp->lp_lladdr, ifp->if_addrlen); } /* @@ -910,9 +989,15 @@ lagg_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t int error = 0; /* Should be checked by the caller */ - if (ifp->if_type != IFT_IEEE8023ADLAG || - (lp = ifp->if_lagg) == NULL || (sc = lp->lp_softc) == NULL) + switch (ifp->if_type) { + case IFT_IEEE8023ADLAG: + case IFT_INFINIBANDLAG: + if ((lp = ifp->if_lagg) == NULL || (sc = lp->lp_softc) == NULL) + goto fallback; + break; + default: goto fallback; + } switch (cmd) { case SIOCGLAGGPORT: @@ -1104,6 +1189,44 @@ lagg_port2req(struct lagg_port *lp, struct lagg_reqpor } static void +lagg_watchdog_infiniband(void *arg) +{ + struct lagg_softc *sc; + struct lagg_port *lp; + struct ifnet *ifp; + struct ifnet *lp_ifp; + + sc = arg; + + /* + * Because infiniband nodes have a fixed MAC address, which is + * generated by the so-called GID, we need to regularly update + * the link level address of the parent lagg device when + * the active port changes. Possibly we could piggy-back on + * link up/down events aswell, but using a timer also provides + * a guarantee against too frequent events. This operation + * does not have to be atomic. + */ + LAGG_RLOCK(); + lp = lagg_link_active(sc, sc->sc_primary); + if (lp != NULL) { + ifp = sc->sc_ifp; + lp_ifp = lp->lp_ifp; + + if (ifp != NULL && lp_ifp != NULL && + memcmp(IF_LLADDR(ifp), IF_LLADDR(lp_ifp), ifp->if_addrlen) != 0) { + memcpy(IF_LLADDR(ifp), IF_LLADDR(lp_ifp), ifp->if_addrlen); + CURVNET_SET(ifp->if_vnet); + EVENTHANDLER_INVOKE(iflladdr_event, ifp); + CURVNET_RESTORE(); + } + } + LAGG_RUNLOCK(); + + callout_reset(&sc->sc_watchdog, hz, &lagg_watchdog_infiniband, arg); +} + +static void lagg_init(void *xsc) { struct lagg_softc *sc = (struct lagg_softc *)xsc; @@ -1125,12 +1248,18 @@ lagg_init(void *xsc) */ CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { if (memcmp(IF_LLADDR(ifp), IF_LLADDR(lp->lp_ifp), - ETHER_ADDR_LEN) != 0) - if_setlladdr(lp->lp_ifp, IF_LLADDR(ifp), ETHER_ADDR_LEN); + ifp->if_addrlen) != 0) + if_setlladdr(lp->lp_ifp, IF_LLADDR(ifp), ifp->if_addrlen); } lagg_proto_init(sc); + if (ifp->if_type == IFT_INFINIBAND) { + mtx_lock(&sc->sc_mtx); + lagg_watchdog_infiniband(sc); + mtx_unlock(&sc->sc_mtx); + } + LAGG_XUNLOCK(sc); } @@ -1147,6 +1276,12 @@ lagg_stop(struct lagg_softc *sc) ifp->if_drv_flags &= ~IFF_DRV_RUNNING; lagg_proto_stop(sc); + + mtx_lock(&sc->sc_mtx); + callout_stop(&sc->sc_watchdog); + mtx_unlock(&sc->sc_mtx); + + callout_drain(&sc->sc_watchdog); } static int @@ -1200,7 +1335,12 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data error = EPROTONOSUPPORT; break; } - + /* Infiniband only supports the failover protocol. */ + if (ra->ra_proto != LAGG_PROTO_FAILOVER && + ifp->if_type == IFT_INFINIBAND) { + error = EPROTONOSUPPORT; + break; + } LAGG_XLOCK(sc); lagg_proto_detach(sc); LAGG_UNLOCK_ASSERT(); @@ -1516,7 +1656,10 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); + if (ifp->if_type == IFT_INFINIBAND) + error = EINVAL; + else + error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; case SIOCSIFCAP: @@ -1738,7 +1881,7 @@ lagg_setflags(struct lagg_port *lp, int status) } static int -lagg_transmit(struct ifnet *ifp, struct mbuf *m) +lagg_transmit_ethernet(struct ifnet *ifp, struct mbuf *m) { struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc; int error; @@ -1763,6 +1906,32 @@ lagg_transmit(struct ifnet *ifp, struct mbuf *m) return (error); } +static int +lagg_transmit_infiniband(struct ifnet *ifp, struct mbuf *m) +{ + struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc; + int error; + +#if defined(KERN_TLS) || defined(RATELIMIT) + if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) + MPASS(m->m_pkthdr.snd_tag->ifp == ifp); +#endif + LAGG_RLOCK(); + /* We need a Tx algorithm and at least one port */ + if (sc->sc_proto == LAGG_PROTO_NONE || sc->sc_count == 0) { + LAGG_RUNLOCK(); + m_freem(m); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + return (ENXIO); + } + + INFINIBAND_BPF_MTAP(ifp, m); + + error = lagg_proto_start(sc, m); + LAGG_RUNLOCK(); + return (error); +} + /* * The ifp->if_qflush entry point for lagg(4) is no-op. */ @@ -1772,7 +1941,7 @@ lagg_qflush(struct ifnet *ifp __unused) } static struct mbuf * -lagg_input(struct ifnet *ifp, struct mbuf *m) +lagg_input_ethernet(struct ifnet *ifp, struct mbuf *m) { struct lagg_port *lp = ifp->if_lagg; struct lagg_softc *sc = lp->lp_softc; @@ -1788,6 +1957,34 @@ lagg_input(struct ifnet *ifp, struct mbuf *m) } ETHER_BPF_MTAP(scifp, m); + + m = lagg_proto_input(sc, lp, m); + if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) { + m_freem(m); + m = NULL; + } + + LAGG_RUNLOCK(); + return (m); +} + +static struct mbuf * +lagg_input_infiniband(struct ifnet *ifp, struct mbuf *m) +{ + struct lagg_port *lp = ifp->if_lagg; + struct lagg_softc *sc = lp->lp_softc; + struct ifnet *scifp = sc->sc_ifp; + + LAGG_RLOCK(); + if ((scifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + lp->lp_detaching != 0 || + sc->sc_proto == LAGG_PROTO_NONE) { + LAGG_RUNLOCK(); + m_freem(m); + return (NULL); + } + + INFINIBAND_BPF_MTAP(scifp, m); m = lagg_proto_input(sc, lp, m); if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) { Modified: stable/12/sys/net/if_lagg.h ============================================================================== --- stable/12/sys/net/if_lagg.h Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sys/net/if_lagg.h Tue Dec 1 13:58:14 2020 (r368229) @@ -72,7 +72,34 @@ struct lagg_protos { { "default", LAGG_PROTO_DEFAULT } \ } +/* Supported lagg TYPEs */ +typedef enum { + LAGG_TYPE_ETHERNET = 0, /* ethernet (default) */ + LAGG_TYPE_INFINIBAND, /* infiniband */ + LAGG_TYPE_MAX, +} lagg_type; + +struct lagg_types { + const char *lt_name; + lagg_type lt_value; +}; + +#define LAGG_TYPE_DEFAULT LAGG_TYPE_ETHERNET +#define LAGG_TYPES { \ + { "ethernet", LAGG_TYPE_ETHERNET }, \ + { "infiniband", LAGG_TYPE_INFINIBAND }, \ +} + /* + * lagg create clone params + */ +struct iflaggparam { + uint8_t lagg_type; /* see LAGG_TYPE_XXX */ + uint8_t reserved_8[3]; + uint32_t reserved_32[3]; +}; + +/* * lagg ioctls. */ @@ -205,7 +232,7 @@ struct lagg_counters { struct lagg_softc { struct ifnet *sc_ifp; /* virtual interface */ - struct rmlock sc_mtx; + struct mtx sc_mtx; /* watchdog mutex */ struct sx sc_sx; int sc_proto; /* lagg protocol */ u_int sc_count; /* number of ports */ @@ -229,12 +256,15 @@ struct lagg_softc { u_int sc_opts; int flowid_shift; /* shift the flowid */ struct lagg_counters detached_counters; /* detached ports sum */ + struct callout sc_watchdog; /* watchdog timer */ }; struct lagg_port { struct ifnet *lp_ifp; /* physical interface */ struct lagg_softc *lp_softc; /* parent lagg */ - uint8_t lp_lladdr[ETHER_ADDR_LEN]; +#define LAGG_ADDR_LEN \ + MAX(INFINIBAND_ADDR_LEN, ETHER_ADDR_LEN) + uint8_t lp_lladdr[LAGG_ADDR_LEN]; u_char lp_iftype; /* interface type */ uint32_t lp_prio; /* port priority */ @@ -256,7 +286,8 @@ struct lagg_port { struct epoch_context lp_epoch_ctx; }; -extern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *); +extern struct mbuf *(*lagg_input_ethernet_p)(struct ifnet *, struct mbuf *); +extern struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); extern void (*lagg_linkstate_p)(struct ifnet *, int ); int lagg_enqueue(struct ifnet *, struct mbuf *); Modified: stable/12/sys/net/if_types.h ============================================================================== --- stable/12/sys/net/if_types.h Tue Dec 1 13:47:16 2020 (r368228) +++ stable/12/sys/net/if_types.h Tue Dec 1 13:58:14 2020 (r368229) @@ -242,6 +242,7 @@ typedef enum { IFT_OPTICALCHANNEL = 0xc3, /* Optical Channel */ IFT_OPTICALTRANSPORT = 0xc4, /* Optical Transport */ IFT_INFINIBAND = 0xc7, /* Infiniband */ + IFT_INFINIBANDLAG = 0xc8, /* Infiniband Link Aggregate */ IFT_BRIDGE = 0xd1, /* Transparent bridge interface */ IFT_STF = 0xd7, /* 6to4 interface */ From owner-svn-src-stable@freebsd.org Tue Dec 1 15:01:11 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77EB74AB827; Tue, 1 Dec 2020 15:01:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cllfb30ldz3tdC; Tue, 1 Dec 2020 15:01:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A1D8176BB; Tue, 1 Dec 2020 15:01:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1F1B2X025857; Tue, 1 Dec 2020 15:01:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1F1Bdv025856; Tue, 1 Dec 2020 15:01:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012011501.0B1F1Bdv025856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Dec 2020 15:01:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368230 - stable/12/sys/dev/ata X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/ata X-SVN-Commit-Revision: 368230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 15:01:11 -0000 Author: markj Date: Tue Dec 1 15:01:10 2020 New Revision: 368230 URL: https://svnweb.freebsd.org/changeset/base/368230 Log: MFC r367989: ata(4): Release the ioport resource if device initialization fails PR: 251346 Modified: stable/12/sys/dev/ata/ata-pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ata/ata-pci.c ============================================================================== --- stable/12/sys/dev/ata/ata-pci.c Tue Dec 1 13:58:14 2020 (r368229) +++ stable/12/sys/dev/ata/ata-pci.c Tue Dec 1 15:01:10 2020 (r368230) @@ -111,8 +111,12 @@ ata_pci_attach(device_t dev) RF_ACTIVE); } - if (ctlr->chipinit(dev)) + if (ctlr->chipinit(dev)) { + if (ctlr->r_res1) + bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, + ctlr->r_res1); return ENXIO; + } /* attach all channels on this controller */ for (unit = 0; unit < ctlr->channels; unit++) { From owner-svn-src-stable@freebsd.org Tue Dec 1 15:09:03 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61FDE4AB64F; Tue, 1 Dec 2020 15:09:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cllqg20Dwz3vFl; Tue, 1 Dec 2020 15:09:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3756817A16; Tue, 1 Dec 2020 15:09:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1F93Ce032230; Tue, 1 Dec 2020 15:09:03 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1F93wG032229; Tue, 1 Dec 2020 15:09:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012011509.0B1F93wG032229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Dec 2020 15:09:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368231 - stable/12/sbin/ping X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sbin/ping X-SVN-Commit-Revision: 368231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 15:09:03 -0000 Author: markj Date: Tue Dec 1 15:09:02 2020 New Revision: 368231 URL: https://svnweb.freebsd.org/changeset/base/368231 Log: MFC r367988: ping(8): Improve parameter validation PR: 239974, 239977, 239978 Modified: stable/12/sbin/ping/ping.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ping/ping.c ============================================================================== --- stable/12/sbin/ping/ping.c Tue Dec 1 15:01:10 2020 (r368230) +++ stable/12/sbin/ping/ping.c Tue Dec 1 15:09:02 2020 (r368231) @@ -236,6 +236,7 @@ main(int argc, char *const *argv) struct sigaction si_sa; size_t sz; u_char *datap, packet[IP_MAXPACKET] __aligned(4); + const char *errstr; char *ep, *source, *target, *payload; struct hostent *hp; #ifdef IPSEC_POLICY_IPSEC @@ -244,7 +245,7 @@ main(int argc, char *const *argv) struct sockaddr_in *to; double t; u_long alarmtimeout; - long ltmp; + long long ltmp; int almost_done, ch, df, hold, i, icmp_len, mib[4], preload; int ssend_errno, srecv_errno, tos, ttl; char ctrl[CMSG_SPACE(sizeof(struct timespec))]; @@ -315,12 +316,12 @@ main(int argc, char *const *argv) options |= F_AUDIBLE; break; case 'c': - ltmp = strtol(optarg, &ep, 0); - if (*ep || ep == optarg || ltmp <= 0) + ltmp = strtonum(optarg, 1, LONG_MAX, &errstr); + if (errstr != NULL) errx(EX_USAGE, "invalid count of packets to transmit: `%s'", optarg); - npackets = ltmp; + npackets = (long)ltmp; break; case 'D': options |= F_HDRINCL; @@ -338,46 +339,46 @@ main(int argc, char *const *argv) setbuf(stdout, (char *)NULL); break; case 'G': /* Maximum packet size for ping sweep */ - ltmp = strtol(optarg, &ep, 0); - if (*ep || ep == optarg || ltmp <= 0) + ltmp = strtonum(optarg, 1, INT_MAX, &errstr); + if (errstr != NULL) { errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ltmp > DEFDATALEN) { - errno = EPERM; - err(EX_NOPERM, - "packet size too large: %ld > %u", - ltmp, DEFDATALEN); } + sweepmax = (int)ltmp; + if (uid != 0 && sweepmax > DEFDATALEN) { + errc(EX_NOPERM, EPERM, + "packet size too large: %d > %u", + sweepmax, DEFDATALEN); + } options |= F_SWEEP; - sweepmax = ltmp; break; case 'g': /* Minimum packet size for ping sweep */ - ltmp = strtol(optarg, &ep, 0); - if (*ep || ep == optarg || ltmp <= 0) + ltmp = strtonum(optarg, 1, INT_MAX, &errstr); + if (errstr != NULL) { errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ltmp > DEFDATALEN) { - errno = EPERM; - err(EX_NOPERM, - "packet size too large: %ld > %u", - ltmp, DEFDATALEN); } + sweepmin = (int)ltmp; + if (uid != 0 && sweepmin > DEFDATALEN) { + errc(EX_NOPERM, EPERM, + "packet size too large: %d > %u", + sweepmin, DEFDATALEN); + } options |= F_SWEEP; - sweepmin = ltmp; break; case 'h': /* Packet size increment for ping sweep */ - ltmp = strtol(optarg, &ep, 0); - if (*ep || ep == optarg || ltmp < 1) - errx(EX_USAGE, "invalid increment size: `%s'", + ltmp = strtonum(optarg, 1, INT_MAX, &errstr); + if (errstr != NULL) { + errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ltmp > DEFDATALEN) { - errno = EPERM; - err(EX_NOPERM, - "packet size too large: %ld > %u", - ltmp, DEFDATALEN); } + sweepincr = (int)ltmp; + if (uid != 0 && sweepincr > DEFDATALEN) { + errc(EX_NOPERM, EPERM, + "packet size too large: %d > %u", + sweepincr, DEFDATALEN); + } options |= F_SWEEP; - sweepincr = ltmp; break; case 'I': /* multicast interface */ if (inet_aton(optarg, &ifaddr) == 0) @@ -403,15 +404,15 @@ main(int argc, char *const *argv) loop = 0; break; case 'l': - ltmp = strtol(optarg, &ep, 0); - if (*ep || ep == optarg || ltmp > INT_MAX || ltmp < 0) + ltmp = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr != NULL) errx(EX_USAGE, "invalid preload value: `%s'", optarg); if (uid) { errno = EPERM; err(EX_NOPERM, "-l flag"); } - preload = ltmp; + preload = (int)ltmp; break; case 'M': switch(optarg[0]) { @@ -429,10 +430,10 @@ main(int argc, char *const *argv) } break; case 'm': /* TTL */ - ltmp = strtol(optarg, &ep, 0); - if (*ep || ep == optarg || ltmp > MAXTTL || ltmp < 0) + ltmp = strtonum(optarg, 0, MAXTTL, &errstr); + if (errstr != NULL) errx(EX_USAGE, "invalid TTL: `%s'", optarg); - ttl = ltmp; + ttl = (int)ltmp; options |= F_TTL; break; case 'n': @@ -474,24 +475,24 @@ main(int argc, char *const *argv) source = optarg; break; case 's': /* size of packet to send */ - ltmp = strtol(optarg, &ep, 0); - if (*ep || ep == optarg || ltmp > INT_MAX || ltmp < 0) + ltmp = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr != NULL) errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ltmp > DEFDATALEN) { + datalen = (int)ltmp; + if (uid != 0 && datalen > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %ld > %u", - ltmp, DEFDATALEN); + "packet size too large: %d > %u", + datalen, DEFDATALEN); } - datalen = ltmp; break; case 'T': /* multicast TTL */ - ltmp = strtol(optarg, &ep, 0); - if (*ep || ep == optarg || ltmp > MAXTTL || ltmp < 0) + ltmp = strtonum(optarg, 0, MAXTTL, &errstr); + if (errstr != NULL) errx(EX_USAGE, "invalid multicast TTL: `%s'", optarg); - mttl = ltmp; + mttl = (unsigned char)ltmp; options |= F_MTTL; break; case 't': @@ -645,7 +646,7 @@ main(int argc, char *const *argv) if (datalen >= TIMEVAL_LEN) /* can we time transfer */ timing = 1; - if (!(options & F_PINGFILLED)) + if ((options & (F_PINGFILLED | F_SWEEP)) == 0) for (i = TIMEVAL_LEN; i < datalen; ++i) *datap++ = i; @@ -794,10 +795,15 @@ main(int argc, char *const *argv) #endif if (sweepmax) { if (sweepmin > sweepmax) - errx(EX_USAGE, "Maximum packet size must be no less than the minimum packet size"); + errx(EX_USAGE, + "Maximum packet size must be no less than the minimum packet size"); + if (sweepmax > maxpayload - TIMEVAL_LEN) + errx(EX_USAGE, "Invalid sweep maximum"); + if (datalen != DEFDATALEN) - errx(EX_USAGE, "Packet size and ping sweep are mutually exclusive"); + errx(EX_USAGE, + "Packet size and ping sweep are mutually exclusive"); if (npackets > 0) { snpackets = npackets; @@ -962,11 +968,11 @@ main(int argc, char *const *argv) } if (n == 0 || options & F_FLOOD) { if (sweepmax && sntransmitted == snpackets) { - for (i = 0; i < sweepincr ; ++i) + if (datalen + sweepincr > sweepmax) + break; + for (i = 0; i < sweepincr; i++) *datap++ = i; datalen += sweepincr; - if (datalen > sweepmax) - break; send_len = icmp_len + datalen; sntransmitted = 0; } From owner-svn-src-stable@freebsd.org Tue Dec 1 15:11:17 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BA084ABC47; Tue, 1 Dec 2020 15:11:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClltF44JNz3vXr; Tue, 1 Dec 2020 15:11:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E36A17669; Tue, 1 Dec 2020 15:11:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1FBHQM034020; Tue, 1 Dec 2020 15:11:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1FBHZM034019; Tue, 1 Dec 2020 15:11:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012011511.0B1FBHZM034019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Dec 2020 15:11:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368232 - stable/12/sys/netpfil/pf X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/netpfil/pf X-SVN-Commit-Revision: 368232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 15:11:17 -0000 Author: markj Date: Tue Dec 1 15:11:16 2020 New Revision: 368232 URL: https://svnweb.freebsd.org/changeset/base/368232 Log: MFC r367987: pf: Make tag hashing more robust Modified: stable/12/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/12/sys/netpfil/pf/pf_ioctl.c Tue Dec 1 15:09:02 2020 (r368231) +++ stable/12/sys/netpfil/pf/pf_ioctl.c Tue Dec 1 15:11:16 2020 (r368232) @@ -513,8 +513,10 @@ pf_cleanup_tagset(struct pf_tagset *ts) static uint16_t tagname2hashindex(const struct pf_tagset *ts, const char *tagname) { + size_t len; - return (murmur3_32_hash(tagname, strlen(tagname), ts->seed) & ts->mask); + len = strnlen(tagname, PF_TAG_NAME_SIZE - 1); + return (murmur3_32_hash(tagname, len, ts->seed) & ts->mask); } static uint16_t From owner-svn-src-stable@freebsd.org Tue Dec 1 15:15:19 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE1BF4ABCF7; Tue, 1 Dec 2020 15:15:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cllyv4vwxz3vnl; Tue, 1 Dec 2020 15:15:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96F9D17A4F; Tue, 1 Dec 2020 15:15:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1FFJss038070; Tue, 1 Dec 2020 15:15:19 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1FFJnC038068; Tue, 1 Dec 2020 15:15:19 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202012011515.0B1FFJnC038068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 1 Dec 2020 15:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368233 - in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Commit-Revision: 368233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 15:15:19 -0000 Author: asomers Date: Tue Dec 1 15:15:18 2020 New Revision: 368233 URL: https://svnweb.freebsd.org/changeset/base/368233 Log: Fix error merging r354116 from OpenZFS When we merged 4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 from OpenZFS (svn r354116), there were some merge conflicts. One of those was resolved incorrectly, causing "zfs receive" to fail to delete snapshots that a "zfs send -R" stream has deleted. This change corrects that merge conflict, and also reduces some harmless diffs vis-a-vis OpenZFS that were also introduced by the same revision. Direct commit to stable/12 because head has moved on to OpenZFS. PR: 249438 Reported by: Dmitry Wagin Reviewed by: mmacy Sponsored by: Axcient Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Dec 1 15:11:16 2020 (r368232) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Dec 1 15:15:18 2020 (r368233) @@ -613,8 +613,8 @@ typedef struct send_data { const char *fromsnap; const char *tosnap; boolean_t recursive; - boolean_t verbose; boolean_t replicate; + boolean_t verbose; /* * The header nvlist is of the following format: @@ -848,36 +848,36 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) rv = -1; goto out; } - VERIFY(0 == nvlist_add_uint64(nvfs, "origin", - origin->zfs_dmustats.dds_guid)); + fnvlist_add_uint64(nvfs, "origin", + origin->zfs_dmustats.dds_guid); } /* iterate over props */ - VERIFY(0 == nvlist_alloc(&nv, NV_UNIQUE_NAME, 0)); + nv = fnvlist_alloc(); send_iterate_prop(zhp, nv); - VERIFY(0 == nvlist_add_nvlist(nvfs, "props", nv)); - nvlist_free(nv); + fnvlist_add_nvlist(nvfs, "props", nv); + fnvlist_free(nv); /* iterate over snaps, and set sd->parent_fromsnap_guid */ + sd->parent_fromsnap_guid = 0; + sd->parent_snaps = fnvlist_alloc(); + sd->snapprops = fnvlist_alloc(); if (!sd->replicate && fromsnap_txg != 0) min_txg = fromsnap_txg; if (!sd->replicate && tosnap_txg != 0) max_txg = tosnap_txg; - sd->parent_fromsnap_guid = 0; - VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); - VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd, min_txg, max_txg); - VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); - VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); + fnvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps); + fnvlist_add_nvlist(nvfs, "snapprops", sd->snapprops); fnvlist_free(sd->parent_snaps); fnvlist_free(sd->snapprops); /* add this fs to nvlist */ (void) snprintf(guidstring, sizeof (guidstring), "0x%llx", (longlong_t)guid); - VERIFY(0 == nvlist_add_nvlist(sd->fss, guidstring, nvfs)); - nvlist_free(nvfs); + fnvlist_add_nvlist(sd->fss, guidstring, nvfs); + fnvlist_free(nvfs); /* iterate over children */ if (sd->recursive) @@ -894,13 +894,12 @@ out: static int gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, - const char *tosnap, boolean_t recursive, boolean_t verbose, - boolean_t replicate, nvlist_t **nvlp, avl_tree_t **avlp) + const char *tosnap, boolean_t recursive, boolean_t replicate, + boolean_t verbose, nvlist_t **nvlp, avl_tree_t **avlp) { zfs_handle_t *zhp; - int error; - uint64_t min_txg = 0, max_txg = 0; send_data_t sd = { 0 }; + int error; zhp = zfs_open(hdl, fsname, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); if (zhp == NULL) @@ -911,8 +910,8 @@ gather_nvlist(libzfs_handle_t *hdl, const char *fsname sd.fromsnap = fromsnap; sd.tosnap = tosnap; sd.recursive = recursive; - sd.verbose = verbose; sd.replicate = replicate; + sd.verbose = verbose; if ((error = send_iterate_fs(zhp, &sd)) != 0) { nvlist_free(sd.fss); @@ -1349,10 +1348,10 @@ static int dump_filesystem(zfs_handle_t *zhp, void *arg) { int rv = 0; - uint64_t min_txg = 0, max_txg = 0; send_dump_data_t *sdd = arg; boolean_t missingfrom = B_FALSE; zfs_cmd_t zc = { 0 }; + uint64_t min_txg = 0, max_txg = 0; (void) snprintf(zc.zc_name, sizeof (zc.zc_name), "%s@%s", zhp->zfs_name, sdd->tosnap); @@ -1853,8 +1852,8 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons } err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, - fromsnap, tosnap, flags->replicate, flags->verbose, - flags->replicate, &fss, &fsavl); + fromsnap, tosnap, flags->replicate, + flags->replicate, flags->verbose, &fss, &fsavl); if (err) goto err_out; VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); @@ -2497,7 +2496,7 @@ again: VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, - recursive, B_FALSE, B_FALSE, &local_nv, &local_avl)) != 0) + recursive, recursive, B_FALSE, &local_nv, &local_avl)) != 0) return (error); /* Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Tue Dec 1 15:11:16 2020 (r368232) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Tue Dec 1 15:15:18 2020 (r368233) @@ -882,6 +882,13 @@ typedef enum { } vdev_initializing_state_t; /* + * nvlist name constants. Facilitate restricting snapshot iteration range for + * the "list next snapshot" ioctl + */ +#define SNAP_ITER_MIN_TXG "snap_iter_min_txg" +#define SNAP_ITER_MAX_TXG "snap_iter_max_txg" + +/* * Vdev statistics. Note: all fields should be 64-bit because this * is passed between kernel and userland as an nvlist uint64 array. */ @@ -1156,13 +1163,6 @@ typedef enum { #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) - -/* - * nvlist name constants. Facilitate restricting snapshot iteration range for - * the "list next snapshot" ioctl - */ -#define SNAP_ITER_MIN_TXG "snap_iter_min_txg" -#define SNAP_ITER_MAX_TXG "snap_iter_max_txg" /* * Sysevent payload members. ZFS will generate the following sysevents with the From owner-svn-src-stable@freebsd.org Tue Dec 1 16:02:53 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DC294AD056; Tue, 1 Dec 2020 16:02:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cln1n2kYKz4T40; Tue, 1 Dec 2020 16:02:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50AF918359; Tue, 1 Dec 2020 16:02:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1G2r9U069140; Tue, 1 Dec 2020 16:02:53 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1G2rbr069139; Tue, 1 Dec 2020 16:02:53 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202012011602.0B1G2rbr069139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 1 Dec 2020 16:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368235 - stable/12/tests/sys/netpfil/pf/ioctl X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/tests/sys/netpfil/pf/ioctl X-SVN-Commit-Revision: 368235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 16:02:53 -0000 Author: kp Date: Tue Dec 1 16:02:52 2020 New Revision: 368235 URL: https://svnweb.freebsd.org/changeset/base/368235 Log: MFC r367990: pf tests: provoke tag hashing panic Attempt to provoke the panic fixed in r367987. Modified: stable/12/tests/sys/netpfil/pf/ioctl/validation.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/netpfil/pf/ioctl/validation.c ============================================================================== --- stable/12/tests/sys/netpfil/pf/ioctl/validation.c Tue Dec 1 15:53:12 2020 (r368234) +++ stable/12/tests/sys/netpfil/pf/ioctl/validation.c Tue Dec 1 16:02:52 2020 (r368235) @@ -790,6 +790,43 @@ ATF_TC_CLEANUP(getsrcnodes, tc) COMMON_CLEANUP(); } +ATF_TC_WITH_CLEANUP(tag); +ATF_TC_HEAD(tag, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(tag, tc) +{ + struct pfioc_rule rule; + + COMMON_HEAD(); + + memset(&rule, 0x42, sizeof(rule)); + + rule.ticket = 0; + rule.pool_ticket = 0; + rule.anchor[0] = 0; + + rule.rule.return_icmp = 0; + bzero(&rule.rule.src, sizeof(rule.rule.src)); + bzero(&rule.rule.dst, sizeof(rule.rule.dst)); + + rule.rule.ifname[0] = 0; + rule.rule.action = 0; + rule.rule.rtableid = 0; + + rule.rule.tagname[0] = 0; + + for (int i = 0; i < 10; i++) + ioctl(dev, DIOCADDRULE, &rule); +} + +ATF_TC_CLEANUP(tag, tc) +{ + COMMON_CLEANUP(); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, addtables); @@ -811,6 +848,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, cxrollback); ATF_TP_ADD_TC(tp, commit); ATF_TP_ADD_TC(tp, getsrcnodes); + ATF_TP_ADD_TC(tp, tag); return (atf_no_error()); } From owner-svn-src-stable@freebsd.org Tue Dec 1 18:12:25 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D90444B0790; Tue, 1 Dec 2020 18:12:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClqvF5rFhz4fJb; Tue, 1 Dec 2020 18:12:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBD0D19EA0; Tue, 1 Dec 2020 18:12:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1ICP22053124; Tue, 1 Dec 2020 18:12:25 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1ICPGN053123; Tue, 1 Dec 2020 18:12:25 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202012011812.0B1ICPGN053123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Tue, 1 Dec 2020 18:12:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368243 - stable/11/usr.bin/iconv X-SVN-Group: stable-11 X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: stable/11/usr.bin/iconv X-SVN-Commit-Revision: 368243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 18:12:25 -0000 Author: fernape (ports committer) Date: Tue Dec 1 18:12:25 2020 New Revision: 368243 URL: https://svnweb.freebsd.org/changeset/base/368243 Log: iconv(1): Add EXAMPLE Just a small example to show simple usage. Approved by: manpages (0mp@) Differential Revision: https://reviews.freebsd.org/D27385 Modified: stable/11/usr.bin/iconv/iconv.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/iconv/iconv.1 ============================================================================== --- stable/11/usr.bin/iconv/iconv.1 Tue Dec 1 18:08:22 2020 (r368242) +++ stable/11/usr.bin/iconv/iconv.1 Tue Dec 1 18:12:25 2020 (r368243) @@ -104,6 +104,13 @@ Specifies the destination codeset name as .El .Sh EXIT STATUS .Ex -std iconv +.Sh EXAMPLES +Convert +.Pa file.txt +from IBM273 to UTF-8 and save the result to +.Pa converted.txt : +.Pp +.Dl iconv -f IBM273 -t UTF-8 file.txt > converted.txt .Sh SEE ALSO .Xr mkcsmapper 1 , .Xr mkesdb 1 , From owner-svn-src-stable@freebsd.org Tue Dec 1 18:13:57 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F21464B04F7; Tue, 1 Dec 2020 18:13:57 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clqx16Vm0z4fhD; Tue, 1 Dec 2020 18:13:57 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D233019EA2; Tue, 1 Dec 2020 18:13:57 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1IDvba053259; Tue, 1 Dec 2020 18:13:57 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1IDvE2053258; Tue, 1 Dec 2020 18:13:57 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202012011813.0B1IDvE2053258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Tue, 1 Dec 2020 18:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368244 - stable/12/usr.bin/iconv X-SVN-Group: stable-12 X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: stable/12/usr.bin/iconv X-SVN-Commit-Revision: 368244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 18:13:58 -0000 Author: fernape (ports committer) Date: Tue Dec 1 18:13:57 2020 New Revision: 368244 URL: https://svnweb.freebsd.org/changeset/base/368244 Log: iconv(1): Add EXAMPLE Just a small example to show simple usage. Approved by: manpages (0mp@) Differential Revision: https://reviews.freebsd.org/D27385 Modified: stable/12/usr.bin/iconv/iconv.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/iconv/iconv.1 ============================================================================== --- stable/12/usr.bin/iconv/iconv.1 Tue Dec 1 18:12:25 2020 (r368243) +++ stable/12/usr.bin/iconv/iconv.1 Tue Dec 1 18:13:57 2020 (r368244) @@ -104,6 +104,13 @@ Specifies the destination codeset name as .El .Sh EXIT STATUS .Ex -std iconv +.Sh EXAMPLES +Convert +.Pa file.txt +from IBM273 to UTF-8 and save the result to +.Pa converted.txt : +.Pp +.Dl iconv -f IBM273 -t UTF-8 file.txt > converted.txt .Sh SEE ALSO .Xr mkcsmapper 1 , .Xr mkesdb 1 , From owner-svn-src-stable@freebsd.org Tue Dec 1 19:35:48 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF7474B22D9; Tue, 1 Dec 2020 19:35:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClslS5Vvjz4lK3; Tue, 1 Dec 2020 19:35:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFAAF1AF2A; Tue, 1 Dec 2020 19:35:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1JZmRc003951; Tue, 1 Dec 2020 19:35:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1JZmt9003950; Tue, 1 Dec 2020 19:35:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012011935.0B1JZmt9003950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Dec 2020 19:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368250 - stable/12/usr.sbin/rtsold X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.sbin/rtsold X-SVN-Commit-Revision: 368250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 19:35:48 -0000 Author: markj Date: Tue Dec 1 19:35:48 2020 New Revision: 368250 URL: https://svnweb.freebsd.org/changeset/base/368250 Log: MFC r368248: rtsold: Fix multiple buffer overflows Approved by: so Security: CVE-2020-25577 Modified: stable/12/usr.sbin/rtsold/rtsol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/rtsold/rtsol.c ============================================================================== --- stable/12/usr.sbin/rtsold/rtsol.c Tue Dec 1 19:34:45 2020 (r368249) +++ stable/12/usr.sbin/rtsold/rtsol.c Tue Dec 1 19:35:48 2020 (r368250) @@ -337,8 +337,8 @@ rtsol_input(int sock) newent_rai = 1; } -#define RA_OPT_NEXT_HDR(x) (struct nd_opt_hdr *)((char *)x + \ - (((struct nd_opt_hdr *)x)->nd_opt_len * 8)) +#define RA_OPT_NEXT_HDR(x) (struct nd_opt_hdr *)((char *)(x) + \ + (((struct nd_opt_hdr *)(x))->nd_opt_len * 8)) /* Process RA options. */ warnmsg(LOG_DEBUG, __func__, "Processing RA"); raoptp = (char *)icp + sizeof(struct nd_router_advert); @@ -350,6 +350,15 @@ rtsol_input(int sock) warnmsg(LOG_DEBUG, __func__, "ndo->nd_opt_len = %d", ndo->nd_opt_len); + if (ndo->nd_opt_len == 0) { + warnmsg(LOG_INFO, __func__, "invalid option length 0."); + break; + } + if ((char *)RA_OPT_NEXT_HDR(raoptp) > (char *)icp + msglen) { + warnmsg(LOG_INFO, __func__, "option length overflow."); + break; + } + switch (ndo->nd_opt_type) { case ND_OPT_RDNSS: rdnss = (struct nd_opt_rdnss *)raoptp; @@ -760,15 +769,18 @@ dname_labeldec(char *dst, size_t dlen, const char *src src_last = strchr(src, '\0'); dst_origin = dst; memset(dst, '\0', dlen); - while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last && - (dst - dst_origin < (ssize_t)dlen)) { - if (dst != dst_origin) + while ((len = (*src++) & 0x3f) && + src + len <= src_last && + len + (dst == dst_origin ? 0 : 1) < dlen) { + if (dst != dst_origin) { *dst++ = '.'; + dlen--; + } warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); memcpy(dst, src, len); src += len; dst += len; + dlen -= len; } *dst = '\0'; From owner-svn-src-stable@freebsd.org Tue Dec 1 19:36:37 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3B684B250F; Tue, 1 Dec 2020 19:36:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClsmP597gz4lmc; Tue, 1 Dec 2020 19:36:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A42A41A9D9; Tue, 1 Dec 2020 19:36:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1Jabnh004094; Tue, 1 Dec 2020 19:36:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1JabkQ004093; Tue, 1 Dec 2020 19:36:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012011936.0B1JabkQ004093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Dec 2020 19:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368253 - stable/11/usr.sbin/rtsold X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/usr.sbin/rtsold X-SVN-Commit-Revision: 368253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 19:36:37 -0000 Author: markj Date: Tue Dec 1 19:36:37 2020 New Revision: 368253 URL: https://svnweb.freebsd.org/changeset/base/368253 Log: MFC r368248: rtsold: Fix multiple buffer overflows Approved by: so Security: CVE-2020-25577 Modified: stable/11/usr.sbin/rtsold/rtsol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/rtsold/rtsol.c ============================================================================== --- stable/11/usr.sbin/rtsold/rtsol.c Tue Dec 1 19:36:36 2020 (r368252) +++ stable/11/usr.sbin/rtsold/rtsol.c Tue Dec 1 19:36:37 2020 (r368253) @@ -390,8 +390,8 @@ rtsol_input(int s) newent_rai = 1; } -#define RA_OPT_NEXT_HDR(x) (struct nd_opt_hdr *)((char *)x + \ - (((struct nd_opt_hdr *)x)->nd_opt_len * 8)) +#define RA_OPT_NEXT_HDR(x) (struct nd_opt_hdr *)((char *)(x) + \ + (((struct nd_opt_hdr *)(x))->nd_opt_len * 8)) /* Process RA options. */ warnmsg(LOG_DEBUG, __func__, "Processing RA"); raoptp = (char *)icp + sizeof(struct nd_router_advert); @@ -403,6 +403,15 @@ rtsol_input(int s) warnmsg(LOG_DEBUG, __func__, "ndo->nd_opt_len = %d", ndo->nd_opt_len); + if (ndo->nd_opt_len == 0) { + warnmsg(LOG_INFO, __func__, "invalid option length 0."); + break; + } + if ((char *)RA_OPT_NEXT_HDR(raoptp) > (char *)icp + msglen) { + warnmsg(LOG_INFO, __func__, "option length overflow."); + break; + } + switch (ndo->nd_opt_type) { case ND_OPT_RDNSS: rdnss = (struct nd_opt_rdnss *)raoptp; @@ -932,15 +941,18 @@ dname_labeldec(char *dst, size_t dlen, const char *src src_last = strchr(src, '\0'); dst_origin = dst; memset(dst, '\0', dlen); - while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last && - (dst - dst_origin < (ssize_t)dlen)) { - if (dst != dst_origin) + while ((len = (*src++) & 0x3f) && + src + len <= src_last && + len + (dst == dst_origin ? 0 : 1) < dlen) { + if (dst != dst_origin) { *dst++ = '.'; + dlen--; + } warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); memcpy(dst, src, len); src += len; dst += len; + dlen -= len; } *dst = '\0'; From owner-svn-src-stable@freebsd.org Wed Dec 2 00:45:36 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92D0D46BE2D; Wed, 2 Dec 2020 00:45:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cm0cw3mvLz3hGj; Wed, 2 Dec 2020 00:45:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FA951E5EF; Wed, 2 Dec 2020 00:45:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B20jaF8098412; Wed, 2 Dec 2020 00:45:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B20javb098411; Wed, 2 Dec 2020 00:45:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012020045.0B20javb098411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 2 Dec 2020 00:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368270 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 368270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 00:45:36 -0000 Author: kib Date: Wed Dec 2 00:45:35 2020 New Revision: 368270 URL: https://svnweb.freebsd.org/changeset/base/368270 Log: MFC r368023: Use designated initializers for libc pthread stubs' jump table. Modified: stable/12/lib/libc/gen/_pthread_stubs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/_pthread_stubs.c ============================================================================== --- stable/12/lib/libc/gen/_pthread_stubs.c Tue Dec 1 23:51:48 2020 (r368269) +++ stable/12/lib/libc/gen/_pthread_stubs.c Wed Dec 2 00:45:35 2020 (r368270) @@ -64,73 +64,73 @@ static void stub_exit(void); (pthread_func_t)entry, (pthread_func_t)entry pthread_func_entry_t __thr_jtable[PJT_MAX] = { - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATFORK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_DESTROY */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETDETACHSTATE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETGUARDSIZE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETINHERITSCHED */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSCHEDPARAM */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSCHEDPOLICY */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSCOPE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSTACKADDR */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_GETSTACKSIZE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_INIT */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETDETACHSTATE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETGUARDSIZE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETINHERITSCHED */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSCHEDPARAM */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSCHEDPOLICY */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSCOPE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSTACKADDR */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ATTR_SETSTACKSIZE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CANCEL */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CLEANUP_POP */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CLEANUP_PUSH */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_BROADCAST */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_DESTROY */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_INIT */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_SIGNAL */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_TIMEDWAIT */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_COND_WAIT */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_DETACH */ - {PJT_DUAL_ENTRY(stub_true)}, /* PJT_EQUAL */ - {PJT_DUAL_ENTRY(stub_exit)}, /* PJT_EXIT */ - {PJT_DUAL_ENTRY(stub_null)}, /* PJT_GETSPECIFIC */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_JOIN */ - {PJT_DUAL_ENTRY(stub_fail)}, /* PJT_KEY_CREATE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_DELETE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KILL */ - {PJT_DUAL_ENTRY(stub_main)}, /* PJT_MAIN_NP */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_DESTROY */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_INIT */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_SETTYPE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_DESTROY */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_INIT */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_LOCK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_TRYLOCK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_UNLOCK */ - {PJT_DUAL_ENTRY(stub_fail)}, /* PJT_ONCE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_DESTROY */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_INIT */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_RDLOCK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_TRYRDLOCK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_TRYWRLOCK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_UNLOCK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_WRLOCK */ - {PJT_DUAL_ENTRY(stub_self)}, /* PJT_SELF */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SETCANCELSTATE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SETCANCELTYPE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SETSPECIFIC */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_SIGMASK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_TESTCANCEL */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CLEANUP_POP_IMP */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CLEANUP_PUSH_IMP */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CANCEL_ENTER */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CANCEL_LEAVE */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_CONSISTENT */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_GETROBUST */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_SETROBUST */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_GETTHREADID_NP */ + [PJT_ATFORK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_DESTROY] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GETDETACHSTATE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GETGUARDSIZE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GETINHERITSCHED] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GETSCHEDPARAM] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GETSCHEDPOLICY] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GETSCOPE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GETSTACKADDR] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GETSTACKSIZE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_INIT] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_SETDETACHSTATE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_SETGUARDSIZE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_SETINHERITSCHED] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_SETSCHEDPARAM] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_SETSCHEDPOLICY] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_SETSCOPE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_SETSTACKADDR] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_SETSTACKSIZE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_CANCEL] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_CLEANUP_POP] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_CLEANUP_PUSH] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_COND_BROADCAST] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_COND_DESTROY] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_COND_INIT] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_COND_SIGNAL] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_COND_TIMEDWAIT] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_COND_WAIT] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_DETACH] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_EQUAL] = {PJT_DUAL_ENTRY(stub_true)}, + [PJT_EXIT] = {PJT_DUAL_ENTRY(stub_exit)}, + [PJT_GETSPECIFIC] = {PJT_DUAL_ENTRY(stub_null)}, + [PJT_JOIN] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_KEY_CREATE] = {PJT_DUAL_ENTRY(stub_fail)}, + [PJT_KEY_DELETE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_KILL] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MAIN_NP] = {PJT_DUAL_ENTRY(stub_main)}, + [PJT_MUTEXATTR_DESTROY] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEXATTR_INIT] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEXATTR_SETTYPE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEX_DESTROY] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEX_INIT] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEX_LOCK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEX_TRYLOCK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEX_UNLOCK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ONCE] = {PJT_DUAL_ENTRY(stub_fail)}, + [PJT_RWLOCK_DESTROY] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_RWLOCK_INIT] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_RWLOCK_RDLOCK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_RWLOCK_TRYRDLOCK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_RWLOCK_TRYWRLOCK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_RWLOCK_UNLOCK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_RWLOCK_WRLOCK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_SELF] = {PJT_DUAL_ENTRY(stub_self)}, + [PJT_SETCANCELSTATE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_SETCANCELTYPE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_SETSPECIFIC] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_SIGMASK] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_TESTCANCEL] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_CLEANUP_POP_IMP] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_CLEANUP_PUSH_IMP] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_CANCEL_ENTER] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_CANCEL_LEAVE] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEX_CONSISTENT] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEXATTR_GETROBUST] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_MUTEXATTR_SETROBUST] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_GETTHREADID_NP] = {PJT_DUAL_ENTRY(stub_zero)}, }; /* From owner-svn-src-stable@freebsd.org Wed Dec 2 20:53:05 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 134B74A5D61 for ; Wed, 2 Dec 2020 20:53:05 +0000 (UTC) (envelope-from cglogic@protonmail.com) Received: from mail-40130.protonmail.ch (mail-40130.protonmail.ch [185.70.40.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "SwissSign Server Gold CA 2014 - G22" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmWQ81kyQz3mvq for ; Wed, 2 Dec 2020 20:53:03 +0000 (UTC) (envelope-from cglogic@protonmail.com) Date: Wed, 02 Dec 2020 20:52:45 +0000 To: Mateusz Piotrowski <0mp@FreeBSD.org> From: cglogic Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-12@freebsd.org" Reply-To: cglogic Subject: Re: svn commit: r367546 - stable/12/libexec/rc/rc.d Message-ID: In-Reply-To: <202011100747.0AA7lOEh032507@repo.freebsd.org> References: <202011100747.0AA7lOEh032507@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch X-Rspamd-Queue-Id: 4CmWQ81kyQz3mvq X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.88 / 15.00]; HAS_REPLYTO(0.00)[cglogic@protonmail.com]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:185.70.40.0/24:c]; FREEMAIL_FROM(0.00)[protonmail.com]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[protonmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[protonmail.com,quarantine]; NEURAL_HAM_SHORT(-0.88)[-0.883]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[185.70.40.130:from]; FREEMAIL_ENVFROM(0.00)[protonmail.com]; ASN(0.00)[asn:62371, ipnet:185.70.40.0/24, country:CH]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[protonmail.com:s=protonmail]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_REPLYTO(0.00)[protonmail.com]; SPAMHAUS_ZRD(0.00)[185.70.40.130:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[185.70.40.130:from]; MAILMAN_DEST(0.00)[svn-src-stable] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 20:53:05 -0000 On Tuesday, November 10, 2020 9:47 AM, Mateusz Piotrowski <0mp@FreeBSD.org>= wrote: > Author: 0mp (doc,ports committer) > Date: Tue Nov 10 07:47:24 2020 > New Revision: 367546 > URL: https://svnweb.freebsd.org/changeset/base/367546 > > Log: > MFC r367291: > > rc.d/zfs: Add shutdown to KEYWORDS > > The problem is that without walling /etc/rc.d/zfs on shutdown, resources > associated with ZFS mounts are not freed and the jails will remain in dyi= ng > state. In addition, the dataset is now in a dangling state, as the jail i= t > is attached to is dying. > > A known workaround for jails was to add the following lines > to /etc/jail.conf, to make sure that "service zfs stop" is run > when the jail is stopped: > > exec.stop =3D "/bin/sh /etc/rc.shutdown"; > exec.stop +=3D "/usr/sbin/service zfs stop || /usr/bin/true"; > > While the workaround seems to be okay-ish for the jail situation, it is > still unclean. However, for physical hosts this may wreak havoc with the > pool if shared spares are used, as "zfs unshare" is never invoked on > shutdown. > > PR: 147444 > Submitted by: Markus Stoff > Reported by: Mykah > > Reviewed by: cy > Approved by: cy (src) > Relnotes: yes > > Modified: > stable/12/libexec/rc/rc.d/zfs > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/libexec/rc/rc.d/zfs > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- stable/12/libexec/rc/rc.d/zfs Tue Nov 10 02:26:44 2020 (r367545) > +++ stable/12/libexec/rc/rc.d/zfs Tue Nov 10 07:47:24 2020 (r367546) > @@ -6,6 +6,7 @@ > > PROVIDE: zfs > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > REQUIRE: zfsbe > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > BEFORE: FILESYSTEMS var > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > +# KEYWORD: shutdown > > . /etc/rc.subr This caused Dec 2 22:47:16 hostname kernel: cannot unmount '/var/run': Device busy Dec 2 22:47:16 hostname kernel: cannot unmount '/var/log': Device busy Dec 2 22:47:16 hostname kernel: cannot unmount '/var/db': Device busy Dec 2 22:47:16 hostname kernel: cannot unmount '/var': Device busy Dec 2 22:47:16 hostname kernel: cannot unmount '/usr': Device busy Dec 2 22:47:16 hostname kernel: cannot unmount '/home/user': Device busy Dec 2 22:47:16 hostname kernel: cannot unmount '/home': Device busy Dec 2 22:47:16 hostname kernel: cannot unmount '/': Invalid argument on every shutdown. From owner-svn-src-stable@freebsd.org Wed Dec 2 21:39:56 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBEF04A70CB; Wed, 2 Dec 2020 21:39:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmXSD6J36z3r0y; Wed, 2 Dec 2020 21:39:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C68A463B9; Wed, 2 Dec 2020 21:39:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2Lduf9082037; Wed, 2 Dec 2020 21:39:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2LdtOS082029; Wed, 2 Dec 2020 21:39:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202012022139.0B2LdtOS082029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 2 Dec 2020 21:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368285 - in stable: 11/share/man/man5 11/share/mk 11/tools/build/mk 11/tools/build/options 11/usr.bin 11/usr.bin/clang 11/usr.bin/clang/llvm-cxxfilt 12/share/man/man5 12/share/mk 12/to... X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/share/man/man5 11/share/mk 11/tools/build/mk 11/tools/build/options 11/usr.bin 11/usr.bin/clang 11/usr.bin/clang/llvm-cxxfilt 12/share/man/man5 12/share/mk 12/tools/build/mk 12/tools/bui... X-SVN-Commit-Revision: 368285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 21:39:57 -0000 Author: dim Date: Wed Dec 2 21:39:54 2020 New Revision: 368285 URL: https://svnweb.freebsd.org/changeset/base/368285 Log: MFC r367304: Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt Since elftoolchain's cxxfilt is rather far behind on features, and we ran into several bugs, add an option to use llvm-cxxfilt as an drop-in replacement. It supports the same options as elftoolchain cxxfilt, though it doesn't have support for old ARM (C++ Annotated Reference Manual, not the CPU) and GNU v2 manglings. But these are irrelevant in 2020. Note: as we already compile the required libraries as part of libllvm, this will not add any significant build time either. PR: 250702 Reviewed by: emaste, yuri Differential Revision: https://reviews.freebsd.org/D27071 MFC r367712: Ensure make delete-old does not unlink the llvm-cxxfilt and its manpage, after r367304 and r367324, when WITH_LLVM_CXXFILT is enabled. Noticed by: "Herbert J. Skuhra" Added: stable/12/tools/build/options/WITHOUT_LLVM_CXXFILT - copied unchanged from r367304, head/tools/build/options/WITHOUT_LLVM_CXXFILT stable/12/tools/build/options/WITH_LLVM_CXXFILT - copied unchanged from r367304, head/tools/build/options/WITH_LLVM_CXXFILT Modified: stable/12/share/man/man5/src.conf.5 stable/12/share/mk/src.opts.mk stable/12/tools/build/mk/OptionalObsoleteFiles.inc stable/12/usr.bin/Makefile stable/12/usr.bin/clang/Makefile stable/12/usr.bin/clang/llvm-cxxfilt/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Added: stable/11/tools/build/options/WITHOUT_LLVM_CXXFILT - copied unchanged from r367304, head/tools/build/options/WITHOUT_LLVM_CXXFILT stable/11/tools/build/options/WITH_LLVM_CXXFILT - copied unchanged from r367304, head/tools/build/options/WITH_LLVM_CXXFILT Modified: stable/11/share/man/man5/src.conf.5 stable/11/share/mk/src.opts.mk stable/11/tools/build/mk/OptionalObsoleteFiles.inc stable/11/usr.bin/Makefile stable/11/usr.bin/clang/Makefile stable/11/usr.bin/clang/llvm-cxxfilt/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/share/man/man5/src.conf.5 ============================================================================== --- stable/12/share/man/man5/src.conf.5 Wed Dec 2 21:01:52 2020 (r368284) +++ stable/12/share/man/man5/src.conf.5 Wed Dec 2 21:39:54 2020 (r368285) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd September 28, 2020 +.Dd December 2, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -464,6 +464,8 @@ When set, it enforces these options: .It .Va WITHOUT_KERBEROS .It +.Va WITHOUT_KERBEROS_SUPPORT +.It .Va WITHOUT_LDNS .It .Va WITHOUT_LDNS_UTILS @@ -701,6 +703,12 @@ This includes the device tree compiler (dtc) and libfd Set to not build .Xr file 1 and related programs. +When set, it enforces these options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_SVNLITE +.El .It Va WITHOUT_FINGER Set to not build or install .Xr finger 1 @@ -1090,6 +1098,8 @@ tool. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and riscv/riscv64sf. +.It Va WITH_LLVM_CXXFILT +Install LLVM's llvm-cxxfilt as c++filt, instead of ELF Tool Chain's cxxfilt. .It Va WITHOUT_LLVM_LIBUNWIND Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp @@ -1243,8 +1253,8 @@ Enable building with support for verification based on certificates obtained from UEFI. .Pp .It Va WITH_LOADER_FIREWIRE -Enable firewire support in /boot/loader on x86. This option is a nop -on all other platforms. +Enable firewire support in /boot/loader on x86. +This option is a nop on all other platforms. .It Va WITH_LOADER_FORCE_LE Set to force the powerpc boot loader to launch the kernel in little endian mode. @@ -1531,7 +1541,6 @@ This is a default setting on arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_NVME Set to build nvme related tools and kernel modules. - .Pp This is a default setting on amd64/amd64, i386/i386 and powerpc/powerpc64. @@ -1566,6 +1575,8 @@ When set, it enforces these options: .Va WITHOUT_DMAGENT .It .Va WITHOUT_KERBEROS +.It +.Va WITHOUT_KERBEROS_SUPPORT .It .Va WITHOUT_LDNS .It Modified: stable/12/share/mk/src.opts.mk ============================================================================== --- stable/12/share/mk/src.opts.mk Wed Dec 2 21:01:52 2020 (r368284) +++ stable/12/share/mk/src.opts.mk Wed Dec 2 21:39:54 2020 (r368285) @@ -206,6 +206,7 @@ __DEFAULT_NO_OPTIONS = \ HESIOD \ LIBSOFT \ LLVM_ASSERTIONS \ + LLVM_CXXFILT \ LOADER_FIREWIRE \ LOADER_FORCE_LE \ LOADER_VERIEXEC_PASS_MANIFEST \ Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 2 21:01:52 2020 (r368284) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 2 21:39:54 2020 (r368285) @@ -1746,7 +1746,6 @@ OLD_FILES+=usr/bin/lli OLD_FILES+=usr/bin/llvm-as OLD_FILES+=usr/bin/llvm-bcanalyzer OLD_FILES+=usr/bin/llvm-cxxdump -OLD_FILES+=usr/bin/llvm-cxxfilt OLD_FILES+=usr/bin/llvm-diff OLD_FILES+=usr/bin/llvm-dis OLD_FILES+=usr/bin/llvm-dwarfdump @@ -1770,7 +1769,6 @@ OLD_FILES+=usr/share/man/man1/llc.1.gz OLD_FILES+=usr/share/man/man1/lli.1.gz OLD_FILES+=usr/share/man/man1/llvm-as.1.gz OLD_FILES+=usr/share/man/man1/llvm-bcanalyzer.1.gz -OLD_FILES+=usr/share/man/man1/llvm-cxxfilt.1.gz OLD_FILES+=usr/share/man/man1/llvm-diff.1.gz OLD_FILES+=usr/share/man/man1/llvm-dis.1.gz OLD_FILES+=usr/share/man/man1/llvm-dwarfdump.1 @@ -1785,6 +1783,11 @@ OLD_FILES+=usr/share/man/man1/opt.1.gz .if ${MK_CLANG_EXTRAS} == no && ${MK_CLANG_FORMAT} == no OLD_FILES+=usr/bin/clang-format +.endif + +.if ${MK_CLANG_EXTRAS} == no && ${MK_LLVM_CXXFILT} == no +OLD_FILES+=usr/bin/llvm-cxxfilt +OLD_FILES+=usr/share/man/man1/llvm-cxxfilt.1.gz .endif .if ${MK_CPP} == no Copied: stable/12/tools/build/options/WITHOUT_LLVM_CXXFILT (from r367304, head/tools/build/options/WITHOUT_LLVM_CXXFILT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITHOUT_LLVM_CXXFILT Wed Dec 2 21:39:54 2020 (r368285, copy of r367304, head/tools/build/options/WITHOUT_LLVM_CXXFILT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Install ELF Tool Chain's cxxfilt as c++filt, instead of LLVM's llvm-cxxfilt. Copied: stable/12/tools/build/options/WITH_LLVM_CXXFILT (from r367304, head/tools/build/options/WITH_LLVM_CXXFILT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_LLVM_CXXFILT Wed Dec 2 21:39:54 2020 (r368285, copy of r367304, head/tools/build/options/WITH_LLVM_CXXFILT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Install LLVM's llvm-cxxfilt as c++filt, instead of ELF Tool Chain's cxxfilt. Modified: stable/12/usr.bin/Makefile ============================================================================== --- stable/12/usr.bin/Makefile Wed Dec 2 21:01:52 2020 (r368284) +++ stable/12/usr.bin/Makefile Wed Dec 2 21:39:54 2020 (r368285) @@ -262,7 +262,9 @@ SUBDIR.${MK_TOOLCHAIN}+= ar SUBDIR.${MK_TOOLCHAIN}+= c89 SUBDIR.${MK_TOOLCHAIN}+= c99 SUBDIR.${MK_TOOLCHAIN}+= ctags +.if ${MK_LLVM_CXXFILT} == "no" SUBDIR.${MK_TOOLCHAIN}+= cxxfilt +.endif SUBDIR.${MK_TOOLCHAIN}+= objcopy SUBDIR.${MK_TOOLCHAIN}+= file2c # ARM64TODO gprof does not build Modified: stable/12/usr.bin/clang/Makefile ============================================================================== --- stable/12/usr.bin/clang/Makefile Wed Dec 2 21:01:52 2020 (r368284) +++ stable/12/usr.bin/clang/Makefile Wed Dec 2 21:39:54 2020 (r368285) @@ -16,6 +16,10 @@ SUBDIR+= llvm-nm SUBDIR+= llvm-objdump SUBDIR+= llvm-symbolizer +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLVM_CXXFILT} != "no" +SUBDIR+= llvm-cxxfilt +.endif + .if ${MK_CLANG_EXTRAS} != "no" SUBDIR+= bugpoint SUBDIR+= llc @@ -23,7 +27,6 @@ SUBDIR+= lli SUBDIR+= llvm-as SUBDIR+= llvm-bcanalyzer SUBDIR+= llvm-cxxdump -SUBDIR+= llvm-cxxfilt SUBDIR+= llvm-diff SUBDIR+= llvm-dis SUBDIR+= llvm-dwarfdump Modified: stable/12/usr.bin/clang/llvm-cxxfilt/Makefile ============================================================================== --- stable/12/usr.bin/clang/llvm-cxxfilt/Makefile Wed Dec 2 21:01:52 2020 (r368284) +++ stable/12/usr.bin/clang/llvm-cxxfilt/Makefile Wed Dec 2 21:39:54 2020 (r368285) @@ -1,8 +1,15 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-cxxfilt SRCDIR= llvm/tools/llvm-cxxfilt SRCS+= llvm-cxxfilt.cpp + +.if ${MK_LLVM_CXXFILT} != "no" +LINKS= ${BINDIR}/llvm-cxxfilt ${BINDIR}/c++filt +MLINKS= llvm-cxxfilt.1 c++filt.1 +.endif .include "../llvm.prog.mk" From owner-svn-src-stable@freebsd.org Wed Dec 2 21:39:58 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E93BF4A7222; Wed, 2 Dec 2020 21:39:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmXSG5VgDz3qjv; Wed, 2 Dec 2020 21:39:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A46E64AB; Wed, 2 Dec 2020 21:39:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2Ldwph082050; Wed, 2 Dec 2020 21:39:58 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2LduWg082042; Wed, 2 Dec 2020 21:39:56 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202012022139.0B2LduWg082042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 2 Dec 2020 21:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368285 - in stable: 11/share/man/man5 11/share/mk 11/tools/build/mk 11/tools/build/options 11/usr.bin 11/usr.bin/clang 11/usr.bin/clang/llvm-cxxfilt 12/share/man/man5 12/share/mk 12/to... X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/share/man/man5 11/share/mk 11/tools/build/mk 11/tools/build/options 11/usr.bin 11/usr.bin/clang 11/usr.bin/clang/llvm-cxxfilt 12/share/man/man5 12/share/mk 12/tools/build/mk 12/tools/bui... X-SVN-Commit-Revision: 368285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 21:39:59 -0000 Author: dim Date: Wed Dec 2 21:39:54 2020 New Revision: 368285 URL: https://svnweb.freebsd.org/changeset/base/368285 Log: MFC r367304: Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt Since elftoolchain's cxxfilt is rather far behind on features, and we ran into several bugs, add an option to use llvm-cxxfilt as an drop-in replacement. It supports the same options as elftoolchain cxxfilt, though it doesn't have support for old ARM (C++ Annotated Reference Manual, not the CPU) and GNU v2 manglings. But these are irrelevant in 2020. Note: as we already compile the required libraries as part of libllvm, this will not add any significant build time either. PR: 250702 Reviewed by: emaste, yuri Differential Revision: https://reviews.freebsd.org/D27071 MFC r367712: Ensure make delete-old does not unlink the llvm-cxxfilt and its manpage, after r367304 and r367324, when WITH_LLVM_CXXFILT is enabled. Noticed by: "Herbert J. Skuhra" Added: stable/11/tools/build/options/WITHOUT_LLVM_CXXFILT - copied unchanged from r367304, head/tools/build/options/WITHOUT_LLVM_CXXFILT stable/11/tools/build/options/WITH_LLVM_CXXFILT - copied unchanged from r367304, head/tools/build/options/WITH_LLVM_CXXFILT Modified: stable/11/share/man/man5/src.conf.5 stable/11/share/mk/src.opts.mk stable/11/tools/build/mk/OptionalObsoleteFiles.inc stable/11/usr.bin/Makefile stable/11/usr.bin/clang/Makefile stable/11/usr.bin/clang/llvm-cxxfilt/Makefile Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/12/tools/build/options/WITHOUT_LLVM_CXXFILT - copied unchanged from r367304, head/tools/build/options/WITHOUT_LLVM_CXXFILT stable/12/tools/build/options/WITH_LLVM_CXXFILT - copied unchanged from r367304, head/tools/build/options/WITH_LLVM_CXXFILT Modified: stable/12/share/man/man5/src.conf.5 stable/12/share/mk/src.opts.mk stable/12/tools/build/mk/OptionalObsoleteFiles.inc stable/12/usr.bin/Makefile stable/12/usr.bin/clang/Makefile stable/12/usr.bin/clang/llvm-cxxfilt/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Wed Dec 2 21:01:52 2020 (r368284) +++ stable/11/share/man/man5/src.conf.5 Wed Dec 2 21:39:54 2020 (r368285) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd September 12, 2020 +.Dd December 2, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1013,6 +1013,8 @@ tool. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc and powerpc/powerpc64. +.It Va WITH_LLVM_CXXFILT +Install LLVM's llvm-cxxfilt as c++filt, instead of ELF Tool Chain's cxxfilt. .It Va WITHOUT_LLVM_LIBUNWIND Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Wed Dec 2 21:01:52 2020 (r368284) +++ stable/11/share/mk/src.opts.mk Wed Dec 2 21:39:54 2020 (r368285) @@ -200,6 +200,7 @@ __DEFAULT_NO_OPTIONS = \ LIBSOFT \ LINT \ LLVM_ASSERTIONS \ + LLVM_CXXFILT \ LOADER_FIREWIRE \ LOADER_FORCE_LE \ LOADER_VERBOSE \ Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 2 21:01:52 2020 (r368284) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 2 21:39:54 2020 (r368285) @@ -1728,7 +1728,6 @@ OLD_FILES+=usr/bin/lli OLD_FILES+=usr/bin/llvm-as OLD_FILES+=usr/bin/llvm-bcanalyzer OLD_FILES+=usr/bin/llvm-cxxdump -OLD_FILES+=usr/bin/llvm-cxxfilt OLD_FILES+=usr/bin/llvm-diff OLD_FILES+=usr/bin/llvm-dis OLD_FILES+=usr/bin/llvm-dwarfdump @@ -1752,7 +1751,6 @@ OLD_FILES+=usr/share/man/man1/llc.1.gz OLD_FILES+=usr/share/man/man1/lli.1.gz OLD_FILES+=usr/share/man/man1/llvm-as.1.gz OLD_FILES+=usr/share/man/man1/llvm-bcanalyzer.1.gz -OLD_FILES+=usr/share/man/man1/llvm-cxxfilt.1.gz OLD_FILES+=usr/share/man/man1/llvm-diff.1.gz OLD_FILES+=usr/share/man/man1/llvm-dis.1.gz OLD_FILES+=usr/share/man/man1/llvm-dwarfdump.1 @@ -1767,6 +1765,11 @@ OLD_FILES+=usr/share/man/man1/opt.1.gz .if ${MK_CLANG_EXTRAS} == no && ${MK_CLANG_FORMAT} == no OLD_FILES+=usr/bin/clang-format +.endif + +.if ${MK_CLANG_EXTRAS} == no && ${MK_LLVM_CXXFILT} == no +OLD_FILES+=usr/bin/llvm-cxxfilt +OLD_FILES+=usr/share/man/man1/llvm-cxxfilt.1.gz .endif .if ${MK_CPP} == no Copied: stable/11/tools/build/options/WITHOUT_LLVM_CXXFILT (from r367304, head/tools/build/options/WITHOUT_LLVM_CXXFILT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LLVM_CXXFILT Wed Dec 2 21:39:54 2020 (r368285, copy of r367304, head/tools/build/options/WITHOUT_LLVM_CXXFILT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Install ELF Tool Chain's cxxfilt as c++filt, instead of LLVM's llvm-cxxfilt. Copied: stable/11/tools/build/options/WITH_LLVM_CXXFILT (from r367304, head/tools/build/options/WITH_LLVM_CXXFILT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LLVM_CXXFILT Wed Dec 2 21:39:54 2020 (r368285, copy of r367304, head/tools/build/options/WITH_LLVM_CXXFILT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Install LLVM's llvm-cxxfilt as c++filt, instead of ELF Tool Chain's cxxfilt. Modified: stable/11/usr.bin/Makefile ============================================================================== --- stable/11/usr.bin/Makefile Wed Dec 2 21:01:52 2020 (r368284) +++ stable/11/usr.bin/Makefile Wed Dec 2 21:39:54 2020 (r368285) @@ -274,7 +274,9 @@ SUBDIR.${MK_TOOLCHAIN}+= ar SUBDIR.${MK_TOOLCHAIN}+= c89 SUBDIR.${MK_TOOLCHAIN}+= c99 SUBDIR.${MK_TOOLCHAIN}+= ctags +.if ${MK_LLVM_CXXFILT} == "no" SUBDIR.${MK_TOOLCHAIN}+= cxxfilt +.endif SUBDIR.${MK_TOOLCHAIN}+= elfcopy SUBDIR.${MK_TOOLCHAIN}+= file2c # ARM64TODO gprof does not build Modified: stable/11/usr.bin/clang/Makefile ============================================================================== --- stable/11/usr.bin/clang/Makefile Wed Dec 2 21:01:52 2020 (r368284) +++ stable/11/usr.bin/clang/Makefile Wed Dec 2 21:39:54 2020 (r368285) @@ -16,6 +16,10 @@ SUBDIR+= llvm-nm SUBDIR+= llvm-objdump SUBDIR+= llvm-symbolizer +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLVM_CXXFILT} != "no" +SUBDIR+= llvm-cxxfilt +.endif + .if ${MK_CLANG_EXTRAS} != "no" SUBDIR+= bugpoint SUBDIR+= llc @@ -23,7 +27,6 @@ SUBDIR+= lli SUBDIR+= llvm-as SUBDIR+= llvm-bcanalyzer SUBDIR+= llvm-cxxdump -SUBDIR+= llvm-cxxfilt SUBDIR+= llvm-diff SUBDIR+= llvm-dis SUBDIR+= llvm-dwarfdump Modified: stable/11/usr.bin/clang/llvm-cxxfilt/Makefile ============================================================================== --- stable/11/usr.bin/clang/llvm-cxxfilt/Makefile Wed Dec 2 21:01:52 2020 (r368284) +++ stable/11/usr.bin/clang/llvm-cxxfilt/Makefile Wed Dec 2 21:39:54 2020 (r368285) @@ -1,8 +1,15 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-cxxfilt SRCDIR= llvm/tools/llvm-cxxfilt SRCS+= llvm-cxxfilt.cpp + +.if ${MK_LLVM_CXXFILT} != "no" +LINKS= ${BINDIR}/llvm-cxxfilt ${BINDIR}/c++filt +MLINKS= llvm-cxxfilt.1 c++filt.1 +.endif .include "../llvm.prog.mk" From owner-svn-src-stable@freebsd.org Wed Dec 2 21:44:42 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDCD24A73B6; Wed, 2 Dec 2020 21:44:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmXYk3M1Dz3rR1; Wed, 2 Dec 2020 21:44:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 656F363DC; Wed, 2 Dec 2020 21:44:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2LigXM088072; Wed, 2 Dec 2020 21:44:42 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2LifAk088069; Wed, 2 Dec 2020 21:44:41 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202012022144.0B2LifAk088069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 2 Dec 2020 21:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368286 - in stable: 11/contrib/elftoolchain/elfcopy 12/contrib/elftoolchain/elfcopy X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/elftoolchain/elfcopy 12/contrib/elftoolchain/elfcopy X-SVN-Commit-Revision: 368286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 21:44:42 -0000 Author: dim Date: Wed Dec 2 21:44:41 2020 New Revision: 368286 URL: https://svnweb.freebsd.org/changeset/base/368286 Log: MFC r367809: When elftoolchain's objcopy (or strip) is rewriting a file in-place, make it create the temporary file in the same directory as the source file by default, instead of always using $TMPDIR or /tmp. If creating that file fails because the directory is not writable, also fallback to $TMPDIR or /tmp. This has also been submitted upstream as: https://sourceforge.net/p/elftoolchain/tickets/597/ Reported by: cem PR: 250872 Modified: stable/12/contrib/elftoolchain/elfcopy/archive.c stable/12/contrib/elftoolchain/elfcopy/elfcopy.h stable/12/contrib/elftoolchain/elfcopy/main.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/elftoolchain/elfcopy/archive.c stable/11/contrib/elftoolchain/elfcopy/elfcopy.h stable/11/contrib/elftoolchain/elfcopy/main.c Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/elftoolchain/elfcopy/archive.c ============================================================================== --- stable/12/contrib/elftoolchain/elfcopy/archive.c Wed Dec 2 21:39:54 2020 (r368285) +++ stable/12/contrib/elftoolchain/elfcopy/archive.c Wed Dec 2 21:44:41 2020 (r368286) @@ -68,7 +68,7 @@ process_ar_obj(struct elfcopy *ecp, struct ar_obj *obj int fd; /* Output to a temporary file. */ - create_tempfile(&tempfile, &fd); + create_tempfile(NULL, &tempfile, &fd); if ((ecp->eout = elf_begin(fd, ELF_C_WRITE, NULL)) == NULL) errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); Modified: stable/12/contrib/elftoolchain/elfcopy/elfcopy.h ============================================================================== --- stable/12/contrib/elftoolchain/elfcopy/elfcopy.h Wed Dec 2 21:39:54 2020 (r368285) +++ stable/12/contrib/elftoolchain/elfcopy/elfcopy.h Wed Dec 2 21:44:41 2020 (r368286) @@ -298,7 +298,7 @@ void create_scn(struct elfcopy *_ecp); void create_srec(struct elfcopy *_ecp, int _ifd, int _ofd, const char *_ofn); void create_symtab(struct elfcopy *_ecp); void create_symtab_data(struct elfcopy *_ecp); -void create_tempfile(char **_fn, int *_fd); +void create_tempfile(const char *_src, char **_fn, int *_fd); void finalize_external_symtab(struct elfcopy *_ecp); void free_elf(struct elfcopy *_ecp); void free_sec_act(struct elfcopy *_ecp); Modified: stable/12/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- stable/12/contrib/elftoolchain/elfcopy/main.c Wed Dec 2 21:39:54 2020 (r368285) +++ stable/12/contrib/elftoolchain/elfcopy/main.c Wed Dec 2 21:44:41 2020 (r368286) @@ -512,44 +512,57 @@ free_elf(struct elfcopy *ecp) /* Create a temporary file. */ void -create_tempfile(char **fn, int *fd) +create_tempfile(const char *src, char **fn, int *fd) { + static const char _TEMPDIR[] = "/tmp/"; + static const char _TEMPFILE[] = "ecp.XXXXXXXX"; const char *tmpdir; - char *cp, *tmpf; - size_t tlen, plen; + char *tmpf; + size_t tlen, slen, plen; -#define _TEMPFILE "ecp.XXXXXXXX" -#define _TEMPFILEPATH "/tmp/ecp.XXXXXXXX" - if (fn == NULL || fd == NULL) return; - /* Repect TMPDIR environment variable. */ - tmpdir = getenv("TMPDIR"); - if (tmpdir != NULL && *tmpdir != '\0') { - tlen = strlen(tmpdir); - plen = strlen(_TEMPFILE); - tmpf = malloc(tlen + plen + 2); + for (;;) { + if (src == NULL) { + /* Respect TMPDIR environment variable. */ + tmpdir = getenv("TMPDIR"); + if (tmpdir == NULL || *tmpdir == '\0') + tmpdir = _TEMPDIR; + tlen = strlen(tmpdir); + slen = tmpdir[tlen - 1] == '/' ? 0 : 1; + } else { + /* Create temporary file relative to source file. */ + if ((tmpdir = strrchr(src, '/')) == NULL) { + /* No path, only use a template filename. */ + tlen = 0; + } else { + /* Append the template after the slash. */ + tlen = ++tmpdir - src; + tmpdir = src; + } + slen = 0; + } + plen = strlen(_TEMPFILE) + 1; + tmpf = malloc(tlen + slen + plen); if (tmpf == NULL) err(EXIT_FAILURE, "malloc failed"); - strncpy(tmpf, tmpdir, tlen); - cp = &tmpf[tlen - 1]; - if (*cp++ != '/') - *cp++ = '/'; - strncpy(cp, _TEMPFILE, plen); - cp[plen] = '\0'; - } else { - tmpf = strdup(_TEMPFILEPATH); - if (tmpf == NULL) - err(EXIT_FAILURE, "strdup failed"); + if (tlen > 0) + memcpy(tmpf, tmpdir, tlen); + if (slen > 0) + tmpf[tlen] = '/'; + /* Copy template filename including NUL terminator. */ + memcpy(tmpf + tlen + slen, _TEMPFILE, plen); + if ((*fd = mkstemp(tmpf)) != -1) + break; + if (errno != EACCES || src == NULL) + err(EXIT_FAILURE, "mkstemp %s failed", tmpf); + /* Permission denied, try again using TMPDIR or /tmp. */ + free(tmpf); + src = NULL; } - if ((*fd = mkstemp(tmpf)) == -1) - err(EXIT_FAILURE, "mkstemp %s failed", tmpf); if (fchmod(*fd, 0644) == -1) err(EXIT_FAILURE, "fchmod %s failed", tmpf); *fn = tmpf; - -#undef _TEMPFILE -#undef _TEMPFILEPATH } /* @@ -571,16 +584,16 @@ copy_from_tempfile(const char *src, const char *dst, i if (rename(src, dst) >= 0) { *outfd = infd; return (0); - } else if (errno != EXDEV) + } else if (errno != EXDEV && errno != EACCES) return (-1); - + /* * If the rename() failed due to 'src' and 'dst' residing in * two different file systems, invoke a helper function in * libelftc to do the copy. */ - if (unlink(dst) < 0) + if (errno != EACCES && unlink(dst) < 0) return (-1); } @@ -630,7 +643,7 @@ create_file(struct elfcopy *ecp, const char *src, cons err(EXIT_FAILURE, "fstat %s failed", src); if (dst == NULL) - create_tempfile(&tempfile, &ofd); + create_tempfile(src, &tempfile, &ofd); else if ((ofd = open(dst, O_RDWR|O_CREAT, 0755)) == -1) err(EXIT_FAILURE, "open %s failed", dst); @@ -663,7 +676,7 @@ create_file(struct elfcopy *ecp, const char *src, cons if (ecp->oed == ELFDATANONE) ecp->oed = ELFDATA2LSB; } - create_tempfile(&elftemp, &efd); + create_tempfile(src, &elftemp, &efd); if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL) errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); @@ -723,7 +736,7 @@ create_file(struct elfcopy *ecp, const char *src, cons tempfile); free(tempfile); } - create_tempfile(&tempfile, &ofd0); + create_tempfile(src, &tempfile, &ofd0); /* From owner-svn-src-stable@freebsd.org Wed Dec 2 21:44:43 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D20624A758A; Wed, 2 Dec 2020 21:44:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmXYl3MlHz3rdF; Wed, 2 Dec 2020 21:44:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3185A6549; Wed, 2 Dec 2020 21:44:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2LihIk088080; Wed, 2 Dec 2020 21:44:43 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2Lig65088077; Wed, 2 Dec 2020 21:44:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202012022144.0B2Lig65088077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 2 Dec 2020 21:44:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368286 - in stable: 11/contrib/elftoolchain/elfcopy 12/contrib/elftoolchain/elfcopy X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/elftoolchain/elfcopy 12/contrib/elftoolchain/elfcopy X-SVN-Commit-Revision: 368286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 21:44:43 -0000 Author: dim Date: Wed Dec 2 21:44:41 2020 New Revision: 368286 URL: https://svnweb.freebsd.org/changeset/base/368286 Log: MFC r367809: When elftoolchain's objcopy (or strip) is rewriting a file in-place, make it create the temporary file in the same directory as the source file by default, instead of always using $TMPDIR or /tmp. If creating that file fails because the directory is not writable, also fallback to $TMPDIR or /tmp. This has also been submitted upstream as: https://sourceforge.net/p/elftoolchain/tickets/597/ Reported by: cem PR: 250872 Modified: stable/11/contrib/elftoolchain/elfcopy/archive.c stable/11/contrib/elftoolchain/elfcopy/elfcopy.h stable/11/contrib/elftoolchain/elfcopy/main.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/elftoolchain/elfcopy/archive.c stable/12/contrib/elftoolchain/elfcopy/elfcopy.h stable/12/contrib/elftoolchain/elfcopy/main.c Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/elftoolchain/elfcopy/archive.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/archive.c Wed Dec 2 21:39:54 2020 (r368285) +++ stable/11/contrib/elftoolchain/elfcopy/archive.c Wed Dec 2 21:44:41 2020 (r368286) @@ -68,7 +68,7 @@ process_ar_obj(struct elfcopy *ecp, struct ar_obj *obj int fd; /* Output to a temporary file. */ - create_tempfile(&tempfile, &fd); + create_tempfile(NULL, &tempfile, &fd); if ((ecp->eout = elf_begin(fd, ELF_C_WRITE, NULL)) == NULL) errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); Modified: stable/11/contrib/elftoolchain/elfcopy/elfcopy.h ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/elfcopy.h Wed Dec 2 21:39:54 2020 (r368285) +++ stable/11/contrib/elftoolchain/elfcopy/elfcopy.h Wed Dec 2 21:44:41 2020 (r368286) @@ -298,7 +298,7 @@ void create_scn(struct elfcopy *_ecp); void create_srec(struct elfcopy *_ecp, int _ifd, int _ofd, const char *_ofn); void create_symtab(struct elfcopy *_ecp); void create_symtab_data(struct elfcopy *_ecp); -void create_tempfile(char **_fn, int *_fd); +void create_tempfile(const char *_src, char **_fn, int *_fd); void finalize_external_symtab(struct elfcopy *_ecp); void free_elf(struct elfcopy *_ecp); void free_sec_act(struct elfcopy *_ecp); Modified: stable/11/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/main.c Wed Dec 2 21:39:54 2020 (r368285) +++ stable/11/contrib/elftoolchain/elfcopy/main.c Wed Dec 2 21:44:41 2020 (r368286) @@ -512,44 +512,57 @@ free_elf(struct elfcopy *ecp) /* Create a temporary file. */ void -create_tempfile(char **fn, int *fd) +create_tempfile(const char *src, char **fn, int *fd) { + static const char _TEMPDIR[] = "/tmp/"; + static const char _TEMPFILE[] = "ecp.XXXXXXXX"; const char *tmpdir; - char *cp, *tmpf; - size_t tlen, plen; + char *tmpf; + size_t tlen, slen, plen; -#define _TEMPFILE "ecp.XXXXXXXX" -#define _TEMPFILEPATH "/tmp/ecp.XXXXXXXX" - if (fn == NULL || fd == NULL) return; - /* Repect TMPDIR environment variable. */ - tmpdir = getenv("TMPDIR"); - if (tmpdir != NULL && *tmpdir != '\0') { - tlen = strlen(tmpdir); - plen = strlen(_TEMPFILE); - tmpf = malloc(tlen + plen + 2); + for (;;) { + if (src == NULL) { + /* Respect TMPDIR environment variable. */ + tmpdir = getenv("TMPDIR"); + if (tmpdir == NULL || *tmpdir == '\0') + tmpdir = _TEMPDIR; + tlen = strlen(tmpdir); + slen = tmpdir[tlen - 1] == '/' ? 0 : 1; + } else { + /* Create temporary file relative to source file. */ + if ((tmpdir = strrchr(src, '/')) == NULL) { + /* No path, only use a template filename. */ + tlen = 0; + } else { + /* Append the template after the slash. */ + tlen = ++tmpdir - src; + tmpdir = src; + } + slen = 0; + } + plen = strlen(_TEMPFILE) + 1; + tmpf = malloc(tlen + slen + plen); if (tmpf == NULL) err(EXIT_FAILURE, "malloc failed"); - strncpy(tmpf, tmpdir, tlen); - cp = &tmpf[tlen - 1]; - if (*cp++ != '/') - *cp++ = '/'; - strncpy(cp, _TEMPFILE, plen); - cp[plen] = '\0'; - } else { - tmpf = strdup(_TEMPFILEPATH); - if (tmpf == NULL) - err(EXIT_FAILURE, "strdup failed"); + if (tlen > 0) + memcpy(tmpf, tmpdir, tlen); + if (slen > 0) + tmpf[tlen] = '/'; + /* Copy template filename including NUL terminator. */ + memcpy(tmpf + tlen + slen, _TEMPFILE, plen); + if ((*fd = mkstemp(tmpf)) != -1) + break; + if (errno != EACCES || src == NULL) + err(EXIT_FAILURE, "mkstemp %s failed", tmpf); + /* Permission denied, try again using TMPDIR or /tmp. */ + free(tmpf); + src = NULL; } - if ((*fd = mkstemp(tmpf)) == -1) - err(EXIT_FAILURE, "mkstemp %s failed", tmpf); if (fchmod(*fd, 0644) == -1) err(EXIT_FAILURE, "fchmod %s failed", tmpf); *fn = tmpf; - -#undef _TEMPFILE -#undef _TEMPFILEPATH } /* @@ -571,16 +584,16 @@ copy_from_tempfile(const char *src, const char *dst, i if (rename(src, dst) >= 0) { *outfd = infd; return (0); - } else if (errno != EXDEV) + } else if (errno != EXDEV && errno != EACCES) return (-1); - + /* * If the rename() failed due to 'src' and 'dst' residing in * two different file systems, invoke a helper function in * libelftc to do the copy. */ - if (unlink(dst) < 0) + if (errno != EACCES && unlink(dst) < 0) return (-1); } @@ -630,7 +643,7 @@ create_file(struct elfcopy *ecp, const char *src, cons err(EXIT_FAILURE, "fstat %s failed", src); if (dst == NULL) - create_tempfile(&tempfile, &ofd); + create_tempfile(src, &tempfile, &ofd); else if ((ofd = open(dst, O_RDWR|O_CREAT, 0755)) == -1) err(EXIT_FAILURE, "open %s failed", dst); @@ -663,7 +676,7 @@ create_file(struct elfcopy *ecp, const char *src, cons if (ecp->oed == ELFDATANONE) ecp->oed = ELFDATA2LSB; } - create_tempfile(&elftemp, &efd); + create_tempfile(src, &elftemp, &efd); if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL) errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); @@ -723,7 +736,7 @@ create_file(struct elfcopy *ecp, const char *src, cons tempfile); free(tempfile); } - create_tempfile(&tempfile, &ofd0); + create_tempfile(src, &tempfile, &ofd0); /* From owner-svn-src-stable@freebsd.org Wed Dec 2 22:44:42 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9374C470B83; Wed, 2 Dec 2020 22:44:42 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmYtx5jndz3vSb; Wed, 2 Dec 2020 22:44:41 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B5D77199; Wed, 2 Dec 2020 22:44:41 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2Mifhh025442; Wed, 2 Dec 2020 22:44:41 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2Mif4t025441; Wed, 2 Dec 2020 22:44:41 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202012022244.0B2Mif4t025441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Wed, 2 Dec 2020 22:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368288 - in stable/12: share/ctypedef tools/tools/locale/tools X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in stable/12: share/ctypedef tools/tools/locale/tools X-SVN-Commit-Revision: 368288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 22:44:42 -0000 Author: yuripv Date: Wed Dec 2 22:44:40 2020 New Revision: 368288 URL: https://svnweb.freebsd.org/changeset/base/368288 Log: MFC r353130: Mark "private use area" characters as printable. At least some of the characters in E000-F8FF range are used by Powerline fonts, and having no attributes for these ranges in UnicodeData.txt other than "Other, Private Use" it should be safe to mark all of them as printable. Some actually were before r340491, so this fixes the regression introduced there as well. PR: 240911 Reviewed by: bapt Tested by: Daniel Ponte Differential Revision: https://reviews.freebsd.org/D21850 Modified: stable/12/share/ctypedef/C.UTF-8.src stable/12/tools/tools/locale/tools/utf8-rollup.pl Directory Properties: stable/12/ (props changed) Modified: stable/12/share/ctypedef/C.UTF-8.src ============================================================================== --- stable/12/share/ctypedef/C.UTF-8.src Wed Dec 2 21:53:28 2020 (r368287) +++ stable/12/share/ctypedef/C.UTF-8.src Wed Dec 2 22:44:40 2020 (r368288) @@ -16434,7 +16434,6 @@ cntrl ;/ ;/ ;/ ;/ - ;...;;/ ;/ ;/ ;/ @@ -16549,9 +16548,7 @@ cntrl ;/ ;/ ;/ ;/ - ;/ - ;...;;/ - ;...; + digit ;/ ;/ ;/ @@ -22555,6 +22552,7 @@ graph ;/ ;/ ;/ ;/ + ;...;;/ ;/ ;/ ;/ @@ -27547,7 +27545,9 @@ graph ;/ ;/ ;/ ;/ - + ;/ + ;...;;/ + ;...; lower ;/ ;/ ;/ Modified: stable/12/tools/tools/locale/tools/utf8-rollup.pl ============================================================================== --- stable/12/tools/tools/locale/tools/utf8-rollup.pl Wed Dec 2 21:53:28 2020 (r368287) +++ stable/12/tools/tools/locale/tools/utf8-rollup.pl Wed Dec 2 22:44:40 2020 (r368288) @@ -161,7 +161,8 @@ sub parse_unidata { $cat = "alpha"; } elsif ($d[2] =~ /^P/) { $cat = "punct"; - } elsif ($d[2] =~ /^M/ || $d[2] =~ /^N/ || $d[2] =~ /^S/) { + } elsif ($d[2] =~ /^Co/ || $d[2] =~ /^M/ || $d[2] =~ /^N/ || + $d[2] =~ /^S/) { $cat = "graph"; } elsif ($d[2] =~ /^C/) { $cat = "cntrl"; From owner-svn-src-stable@freebsd.org Wed Dec 2 23:16:25 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A878447131C; Wed, 2 Dec 2020 23:16:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmZbY4QN0z4RRY; Wed, 2 Dec 2020 23:16:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85E2478B7; Wed, 2 Dec 2020 23:16:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2NGPMi044348; Wed, 2 Dec 2020 23:16:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2NGPYI044347; Wed, 2 Dec 2020 23:16:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012022316.0B2NGPYI044347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 2 Dec 2020 23:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368289 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 368289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 23:16:25 -0000 Author: jhb Date: Wed Dec 2 23:16:24 2020 New Revision: 368289 URL: https://svnweb.freebsd.org/changeset/base/368289 Log: MFC 355686: Fix a mismerge in r355683 and remove the local gdb_port from main. PR: 251501 Reported by: Yuichiro NAITO Modified: stable/12/usr.sbin/bhyve/bhyverun.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/12/usr.sbin/bhyve/bhyverun.c Wed Dec 2 22:44:40 2020 (r368288) +++ stable/12/usr.sbin/bhyve/bhyverun.c Wed Dec 2 23:16:24 2020 (r368289) @@ -1003,7 +1003,7 @@ do_open(const char *vmname) int main(int argc, char *argv[]) { - int c, error, dbg_port, gdb_port, err, bvmcons; + int c, error, dbg_port, err, bvmcons; int max_vcpus, mptgen, memflags; int rtc_localtime; bool gdb_stop; @@ -1015,7 +1015,6 @@ main(int argc, char *argv[]) bvmcons = 0; progname = basename(argv[0]); dbg_port = 0; - gdb_port = 0; gdb_stop = false; guest_ncpus = 1; sockets = cores = threads = 1; From owner-svn-src-stable@freebsd.org Thu Dec 3 02:21:48 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2404476680; Thu, 3 Dec 2020 02:21:48 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmfjS4Fqrz4fGh; Thu, 3 Dec 2020 02:21:48 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8532011FA8; Thu, 3 Dec 2020 02:21:48 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B32LmTH062705; Thu, 3 Dec 2020 02:21:48 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B32Lma9062704; Thu, 3 Dec 2020 02:21:48 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202012030221.0B32Lma9062704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 3 Dec 2020 02:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368291 - stable/12/sys/dev/usb/net X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/sys/dev/usb/net X-SVN-Commit-Revision: 368291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 02:21:48 -0000 Author: lwhsu Date: Thu Dec 3 02:21:48 2020 New Revision: 368291 URL: https://svnweb.freebsd.org/changeset/base/368291 Log: MFC r367812: ipheth(4): Fix for iOS 14 Fix USB tethering for iOS 14. Inspired by: https://github.com/libimobiledevice/libimobiledevice/issues/1038 PR: 249979 Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D27250 Modified: stable/12/sys/dev/usb/net/if_iphethvar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/net/if_iphethvar.h ============================================================================== --- stable/12/sys/dev/usb/net/if_iphethvar.h Thu Dec 3 01:39:59 2020 (r368290) +++ stable/12/sys/dev/usb/net/if_iphethvar.h Thu Dec 3 02:21:48 2020 (r368291) @@ -39,7 +39,7 @@ #define IPHETH_USBINTF_SUBCLASS 253 #define IPHETH_USBINTF_PROTO 1 -#define IPHETH_BUF_SIZE 1516 +#define IPHETH_BUF_SIZE 1514 #define IPHETH_TX_TIMEOUT 5000 /* ms */ #define IPHETH_RX_FRAMES_MAX 1 From owner-svn-src-stable@freebsd.org Thu Dec 3 02:22:06 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 436764762BA; Thu, 3 Dec 2020 02:22:06 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cmfjp1VM3z4fMt; Thu, 3 Dec 2020 02:22:06 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25E9A11DCE; Thu, 3 Dec 2020 02:22:06 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B32M6pZ063559; Thu, 3 Dec 2020 02:22:06 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B32M6QF063558; Thu, 3 Dec 2020 02:22:06 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202012030222.0B32M6QF063558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 3 Dec 2020 02:22:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368292 - stable/11/sys/dev/usb/net X-SVN-Group: stable-11 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/11/sys/dev/usb/net X-SVN-Commit-Revision: 368292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 02:22:06 -0000 Author: lwhsu Date: Thu Dec 3 02:22:05 2020 New Revision: 368292 URL: https://svnweb.freebsd.org/changeset/base/368292 Log: MFC r367812: ipheth(4): Fix for iOS 14 Fix USB tethering for iOS 14. Inspired by: https://github.com/libimobiledevice/libimobiledevice/issues/1038 PR: 249979 Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D27250 Modified: stable/11/sys/dev/usb/net/if_iphethvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_iphethvar.h ============================================================================== --- stable/11/sys/dev/usb/net/if_iphethvar.h Thu Dec 3 02:21:48 2020 (r368291) +++ stable/11/sys/dev/usb/net/if_iphethvar.h Thu Dec 3 02:22:05 2020 (r368292) @@ -37,7 +37,7 @@ #define IPHETH_USBINTF_SUBCLASS 253 #define IPHETH_USBINTF_PROTO 1 -#define IPHETH_BUF_SIZE 1516 +#define IPHETH_BUF_SIZE 1514 #define IPHETH_TX_TIMEOUT 5000 /* ms */ #define IPHETH_RX_FRAMES_MAX 1 From owner-svn-src-stable@freebsd.org Thu Dec 3 05:56:43 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6389947B05B; Thu, 3 Dec 2020 05:56:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmlTR2MdBz4qBQ; Thu, 3 Dec 2020 05:56:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4423814A99; Thu, 3 Dec 2020 05:56:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B35uhlw094437; Thu, 3 Dec 2020 05:56:43 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B35uhig094436; Thu, 3 Dec 2020 05:56:43 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202012030556.0B35uhig094436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 3 Dec 2020 05:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368295 - in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib X-SVN-Commit-Revision: 368295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 05:56:43 -0000 Author: cy Date: Thu Dec 3 05:56:42 2020 New Revision: 368295 URL: https://svnweb.freebsd.org/changeset/base/368295 Log: MFC r366286: ipfilter getifname ifdef cleanup. Modified: stable/12/contrib/ipfilter/lib/getifname.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/lib/getifname.c Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/ipfilter/lib/getifname.c ============================================================================== --- stable/12/contrib/ipfilter/lib/getifname.c Thu Dec 3 05:49:59 2020 (r368294) +++ stable/12/contrib/ipfilter/lib/getifname.c Thu Dec 3 05:56:42 2020 (r368295) @@ -19,11 +19,9 @@ char *getifname(ptr) struct ifnet *ptr; { -#if SOLARIS || defined(__hpux) -# if SOLARIS +#if SOLARIS # include # include -# endif # include "../pfil/qif.h" char *ifname; qif_t qif; @@ -42,13 +40,6 @@ char *getifname(ptr) } return ifname; #else -# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \ - defined(__OpenBSD__) || \ - (defined(__FreeBSD__) && (__FreeBSD_version >= 501113)) -#else - char buf[LIFNAMSIZ]; - int len; -# endif struct ifnet netif; if ((void *)ptr == (void *)-1) @@ -58,24 +49,6 @@ char *getifname(ptr) if (kmemcpy((char *)&netif, (u_long)ptr, sizeof(netif)) == -1) return "X"; -# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \ - defined(__OpenBSD__) || defined(linux) || \ - (defined(__FreeBSD__) && (__FreeBSD_version >= 501113)) return strdup(netif.if_xname); -# else - if (kstrncpy(buf, (u_long)netif.if_name, sizeof(buf)) == -1) - return "X"; - if (netif.if_unit < 10) - len = 2; - else if (netif.if_unit < 1000) - len = 3; - else if (netif.if_unit < 10000) - len = 4; - else - len = 5; - buf[sizeof(buf) - len] = '\0'; - sprintf(buf + strlen(buf), "%d", netif.if_unit % 10000); - return strdup(buf); -# endif #endif } From owner-svn-src-stable@freebsd.org Thu Dec 3 05:56:43 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2910647B05A; Thu, 3 Dec 2020 05:56:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmlTR0RSPz4qBP; Thu, 3 Dec 2020 05:56:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1B7614C80; Thu, 3 Dec 2020 05:56:42 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B35ug5V094431; Thu, 3 Dec 2020 05:56:42 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B35ughQ094430; Thu, 3 Dec 2020 05:56:42 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202012030556.0B35ughQ094430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 3 Dec 2020 05:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368295 - in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib X-SVN-Commit-Revision: 368295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 05:56:43 -0000 Author: cy Date: Thu Dec 3 05:56:42 2020 New Revision: 368295 URL: https://svnweb.freebsd.org/changeset/base/368295 Log: MFC r366286: ipfilter getifname ifdef cleanup. Modified: stable/11/contrib/ipfilter/lib/getifname.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/ipfilter/lib/getifname.c Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/ipfilter/lib/getifname.c ============================================================================== --- stable/11/contrib/ipfilter/lib/getifname.c Thu Dec 3 05:49:59 2020 (r368294) +++ stable/11/contrib/ipfilter/lib/getifname.c Thu Dec 3 05:56:42 2020 (r368295) @@ -19,11 +19,9 @@ char *getifname(ptr) struct ifnet *ptr; { -#if SOLARIS || defined(__hpux) -# if SOLARIS +#if SOLARIS # include # include -# endif # include "../pfil/qif.h" char *ifname; qif_t qif; @@ -42,13 +40,6 @@ char *getifname(ptr) } return ifname; #else -# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \ - defined(__OpenBSD__) || \ - (defined(__FreeBSD__) && (__FreeBSD_version >= 501113)) -#else - char buf[LIFNAMSIZ]; - int len; -# endif struct ifnet netif; if ((void *)ptr == (void *)-1) @@ -58,24 +49,6 @@ char *getifname(ptr) if (kmemcpy((char *)&netif, (u_long)ptr, sizeof(netif)) == -1) return "X"; -# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \ - defined(__OpenBSD__) || defined(linux) || \ - (defined(__FreeBSD__) && (__FreeBSD_version >= 501113)) return strdup(netif.if_xname); -# else - if (kstrncpy(buf, (u_long)netif.if_name, sizeof(buf)) == -1) - return "X"; - if (netif.if_unit < 10) - len = 2; - else if (netif.if_unit < 1000) - len = 3; - else if (netif.if_unit < 10000) - len = 4; - else - len = 5; - buf[sizeof(buf) - len] = '\0'; - sprintf(buf + strlen(buf), "%d", netif.if_unit % 10000); - return strdup(buf); -# endif #endif } From owner-svn-src-stable@freebsd.org Thu Dec 3 10:32:56 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 293C04A268C; Thu, 3 Dec 2020 10:32:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cmsc80jNkz3MfW; Thu, 3 Dec 2020 10:32:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF5417CD8; Thu, 3 Dec 2020 10:32:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3AWtXE066910; Thu, 3 Dec 2020 10:32:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3AWs0J066903; Thu, 3 Dec 2020 10:32:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012031032.0B3AWs0J066903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Dec 2020 10:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368297 - stable/12/sbin/ifconfig X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sbin/ifconfig X-SVN-Commit-Revision: 368297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 10:32:56 -0000 Author: hselasky Date: Thu Dec 3 10:32:54 2020 New Revision: 368297 URL: https://svnweb.freebsd.org/changeset/base/368297 Log: MFC r368058: Ensure consistent error messages from ifconfig(8). If multiple threads are invoking "ifconfig XXX create" a race may occur which can lead to two different error messages for the same error. a) ifconfig: SIOCIFCREATE2: File exists b) ifconfig: interface XXX already exists This patch ensures ifconfig prints the same error code for the same case. Reviewed by: imp@ and kib@ Differential Revision: https://reviews.freebsd.org/D27380 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/12/sbin/ifconfig/ifclone.c stable/12/sbin/ifconfig/ifconfig.c stable/12/sbin/ifconfig/ifconfig.h stable/12/sbin/ifconfig/ifieee80211.c stable/12/sbin/ifconfig/iflagg.c stable/12/sbin/ifconfig/ifvlan.c stable/12/sbin/ifconfig/ifvxlan.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ifconfig/ifclone.c ============================================================================== --- stable/12/sbin/ifconfig/ifclone.c Thu Dec 3 08:30:29 2020 (r368296) +++ stable/12/sbin/ifconfig/ifclone.c Thu Dec 3 10:32:54 2020 (r368297) @@ -140,8 +140,7 @@ ifclonecreate(int s, void *arg) } if (clone_cb == NULL) { /* NB: no parameters */ - if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, &ifr); } else { clone_cb(s, &ifr); } Modified: stable/12/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/12/sbin/ifconfig/ifconfig.c Thu Dec 3 08:30:29 2020 (r368296) +++ stable/12/sbin/ifconfig/ifconfig.c Thu Dec 3 10:32:54 2020 (r368297) @@ -198,6 +198,19 @@ usage(void) exit(1); } +void +ioctl_ifcreate(int s, struct ifreq *ifr) +{ + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) { + switch (errno) { + case EEXIST: + errx(1, "interface %s already exists", ifr->ifr_name); + default: + err(1, "SIOCIFCREATE2"); + } + } +} + #define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0]) static int Modified: stable/12/sbin/ifconfig/ifconfig.h ============================================================================== --- stable/12/sbin/ifconfig/ifconfig.h Thu Dec 3 08:30:29 2020 (r368296) +++ stable/12/sbin/ifconfig/ifconfig.h Thu Dec 3 10:32:54 2020 (r368297) @@ -158,3 +158,4 @@ struct ifmediareq *ifmedia_getstate(int s); void print_vhid(const struct ifaddrs *, const char *); +void ioctl_ifcreate(int s, struct ifreq *); Modified: stable/12/sbin/ifconfig/ifieee80211.c ============================================================================== --- stable/12/sbin/ifconfig/ifieee80211.c Thu Dec 3 08:30:29 2020 (r368296) +++ stable/12/sbin/ifconfig/ifieee80211.c Thu Dec 3 10:32:54 2020 (r368297) @@ -5758,8 +5758,7 @@ wlan_create(int s, struct ifreq *ifr) memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0) errx(1, "no bssid specified for WDS (use wlanbssid)"); ifr->ifr_data = (caddr_t) ¶ms; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, ifr); /* XXX preserve original name for ifclonecreate(). */ strlcpy(orig_name, name, sizeof(orig_name)); Modified: stable/12/sbin/ifconfig/iflagg.c ============================================================================== --- stable/12/sbin/ifconfig/iflagg.c Thu Dec 3 08:30:29 2020 (r368296) +++ stable/12/sbin/ifconfig/iflagg.c Thu Dec 3 10:32:54 2020 (r368297) @@ -322,8 +322,7 @@ static void lagg_create(int s, struct ifreq *ifr) { ifr->ifr_data = (caddr_t) ¶ms; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, ifr); } static struct cmd lagg_cmds[] = { Modified: stable/12/sbin/ifconfig/ifvlan.c ============================================================================== --- stable/12/sbin/ifconfig/ifvlan.c Thu Dec 3 08:30:29 2020 (r368296) +++ stable/12/sbin/ifconfig/ifvlan.c Thu Dec 3 10:32:54 2020 (r368297) @@ -107,8 +107,7 @@ vlan_create(int s, struct ifreq *ifr) errx(1, "must specify a parent device for vlan create"); ifr->ifr_data = (caddr_t) ¶ms; } - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, ifr); } static void Modified: stable/12/sbin/ifconfig/ifvxlan.c ============================================================================== --- stable/12/sbin/ifconfig/ifvxlan.c Thu Dec 3 08:30:29 2020 (r368296) +++ stable/12/sbin/ifconfig/ifvxlan.c Thu Dec 3 10:32:54 2020 (r368297) @@ -191,8 +191,7 @@ vxlan_create(int s, struct ifreq *ifr) vxlan_check_params(); ifr->ifr_data = (caddr_t) ¶ms; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, ifr); } static From owner-svn-src-stable@freebsd.org Thu Dec 3 10:41:07 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C93A44A2903; Thu, 3 Dec 2020 10:41:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cmsnb5PS9z3N3R; Thu, 3 Dec 2020 10:41:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC70317ADC; Thu, 3 Dec 2020 10:41:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3Af7nq068186; Thu, 3 Dec 2020 10:41:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3Af67D068181; Thu, 3 Dec 2020 10:41:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012031041.0B3Af67D068181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Dec 2020 10:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r368298 - stable/11/sbin/ifconfig X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sbin/ifconfig X-SVN-Commit-Revision: 368298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 10:41:07 -0000 Author: hselasky Date: Thu Dec 3 10:41:06 2020 New Revision: 368298 URL: https://svnweb.freebsd.org/changeset/base/368298 Log: MFC r368058: Ensure consistent error messages from ifconfig(8). If multiple threads are invoking "ifconfig XXX create" a race may occur which can lead to two different error messages for the same error. a) ifconfig: SIOCIFCREATE2: File exists b) ifconfig: interface XXX already exists This patch ensures ifconfig prints the same error code for the same case. Reviewed by: imp@ and kib@ Differential Revision: https://reviews.freebsd.org/D27380 Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sbin/ifconfig/ifclone.c stable/11/sbin/ifconfig/ifconfig.c stable/11/sbin/ifconfig/ifconfig.h stable/11/sbin/ifconfig/ifieee80211.c stable/11/sbin/ifconfig/ifvlan.c stable/11/sbin/ifconfig/ifvxlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifclone.c ============================================================================== --- stable/11/sbin/ifconfig/ifclone.c Thu Dec 3 10:32:54 2020 (r368297) +++ stable/11/sbin/ifconfig/ifclone.c Thu Dec 3 10:41:06 2020 (r368298) @@ -138,8 +138,7 @@ ifclonecreate(int s, void *arg) } if (clone_cb == NULL) { /* NB: no parameters */ - if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, &ifr); } else { clone_cb(s, &ifr); } Modified: stable/11/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/11/sbin/ifconfig/ifconfig.c Thu Dec 3 10:32:54 2020 (r368297) +++ stable/11/sbin/ifconfig/ifconfig.c Thu Dec 3 10:41:06 2020 (r368298) @@ -185,6 +185,19 @@ usage(void) exit(1); } +void +ioctl_ifcreate(int s, struct ifreq *ifr) +{ + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) { + switch (errno) { + case EEXIST: + errx(1, "interface %s already exists", ifr->ifr_name); + default: + err(1, "SIOCIFCREATE2"); + } + } +} + #define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0]) static int Modified: stable/11/sbin/ifconfig/ifconfig.h ============================================================================== --- stable/11/sbin/ifconfig/ifconfig.h Thu Dec 3 10:32:54 2020 (r368297) +++ stable/11/sbin/ifconfig/ifconfig.h Thu Dec 3 10:41:06 2020 (r368298) @@ -157,3 +157,4 @@ struct ifmediareq *ifmedia_getstate(int s); void print_vhid(const struct ifaddrs *, const char *); +void ioctl_ifcreate(int s, struct ifreq *); Modified: stable/11/sbin/ifconfig/ifieee80211.c ============================================================================== --- stable/11/sbin/ifconfig/ifieee80211.c Thu Dec 3 10:32:54 2020 (r368297) +++ stable/11/sbin/ifconfig/ifieee80211.c Thu Dec 3 10:41:06 2020 (r368298) @@ -5233,8 +5233,7 @@ wlan_create(int s, struct ifreq *ifr) memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0) errx(1, "no bssid specified for WDS (use wlanbssid)"); ifr->ifr_data = (caddr_t) ¶ms; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, ifr); /* XXX preserve original name for ifclonecreate(). */ strlcpy(orig_name, name, sizeof(orig_name)); Modified: stable/11/sbin/ifconfig/ifvlan.c ============================================================================== --- stable/11/sbin/ifconfig/ifvlan.c Thu Dec 3 10:32:54 2020 (r368297) +++ stable/11/sbin/ifconfig/ifvlan.c Thu Dec 3 10:41:06 2020 (r368298) @@ -105,8 +105,7 @@ vlan_create(int s, struct ifreq *ifr) errx(1, "must specify a parent device for vlan create"); ifr->ifr_data = (caddr_t) ¶ms; } - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, ifr); } static void Modified: stable/11/sbin/ifconfig/ifvxlan.c ============================================================================== --- stable/11/sbin/ifconfig/ifvxlan.c Thu Dec 3 10:32:54 2020 (r368297) +++ stable/11/sbin/ifconfig/ifvxlan.c Thu Dec 3 10:41:06 2020 (r368298) @@ -191,8 +191,7 @@ vxlan_create(int s, struct ifreq *ifr) vxlan_check_params(); ifr->ifr_data = (caddr_t) ¶ms; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, ifr); } static From owner-svn-src-stable@freebsd.org Thu Dec 3 14:04:43 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DC2F4A7724; Thu, 3 Dec 2020 14:04:43 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmyJW1mSkz3pFb; Thu, 3 Dec 2020 14:04:43 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F6521A666; Thu, 3 Dec 2020 14:04:43 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3E4hOw096675; Thu, 3 Dec 2020 14:04:43 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3E4hm7096674; Thu, 3 Dec 2020 14:04:43 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202012031404.0B3E4hm7096674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Thu, 3 Dec 2020 14:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368301 - stable/12/usr.bin/bsdiff/bsdiff X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/usr.bin/bsdiff/bsdiff X-SVN-Commit-Revision: 368301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 14:04:43 -0000 Author: mhorne Date: Thu Dec 3 14:04:42 2020 New Revision: 368301 URL: https://svnweb.freebsd.org/changeset/base/368301 Log: MFC r367734: bsdiff: fix off-by-one error Modified: stable/12/usr.bin/bsdiff/bsdiff/bsdiff.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/bsdiff/bsdiff/bsdiff.c ============================================================================== --- stable/12/usr.bin/bsdiff/bsdiff/bsdiff.c Thu Dec 3 11:59:40 2020 (r368300) +++ stable/12/usr.bin/bsdiff/bsdiff/bsdiff.c Thu Dec 3 14:04:42 2020 (r368301) @@ -212,7 +212,7 @@ int main(int argc,char *argv[]) for(scsc=scan+=len;scan Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 805AF4A97BF; Thu, 3 Dec 2020 15:54:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn0lQ3D6Sz3vmw; Thu, 3 Dec 2020 15:54:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D1C71BEA1; Thu, 3 Dec 2020 15:54:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3FsgHt065044; Thu, 3 Dec 2020 15:54:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3FsgqD065043; Thu, 3 Dec 2020 15:54:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012031554.0B3FsgqD065043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 3 Dec 2020 15:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368303 - stable/12/sys/dev/qat X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/qat X-SVN-Commit-Revision: 368303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 15:54:42 -0000 Author: markj Date: Thu Dec 3 15:54:41 2020 New Revision: 368303 URL: https://svnweb.freebsd.org/changeset/base/368303 Log: MFC r368194: qat: Initialize the crypto device ID to -1 instead of 0 Modified: stable/12/sys/dev/qat/qat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/qat/qat.c ============================================================================== --- stable/12/sys/dev/qat/qat.c Thu Dec 3 14:41:11 2020 (r368302) +++ stable/12/sys/dev/qat/qat.c Thu Dec 3 15:54:41 2020 (r368303) @@ -357,6 +357,7 @@ qat_attach(device_t dev) sc->sc_dev = dev; sc->sc_rev = pci_get_revid(dev); + sc->sc_crypto.qcy_cid = -1; qatp = qat_lookup(dev); memcpy(&sc->sc_hw, qatp->qatp_hw, sizeof(struct qat_hw)); From owner-svn-src-stable@freebsd.org Thu Dec 3 15:55:10 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BAD34A980C; Thu, 3 Dec 2020 15:55:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn0lx5QPBz3w4p; Thu, 3 Dec 2020 15:55:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACCDA1BEA2; Thu, 3 Dec 2020 15:55:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3Ft9o2065156; Thu, 3 Dec 2020 15:55:09 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3Ft7He065145; Thu, 3 Dec 2020 15:55:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012031555.0B3Ft7He065145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 3 Dec 2020 15:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368304 - in stable/12/sys: dev/qat modules/qatfw/qat_c2xxx modules/qatfw/qat_c3xxx modules/qatfw/qat_c62x modules/qatfw/qat_d15xx modules/qatfw/qat_dh895xcc X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: dev/qat modules/qatfw/qat_c2xxx modules/qatfw/qat_c3xxx modules/qatfw/qat_c62x modules/qatfw/qat_d15xx modules/qatfw/qat_dh895xcc X-SVN-Commit-Revision: 368304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 15:55:10 -0000 Author: markj Date: Thu Dec 3 15:55:07 2020 New Revision: 368304 URL: https://svnweb.freebsd.org/changeset/base/368304 Log: MFC r368193: qat: Fix firmware module autoloading Modified: stable/12/sys/dev/qat/qat_c2xxxreg.h stable/12/sys/dev/qat/qat_c3xxxreg.h stable/12/sys/dev/qat/qat_c62xreg.h stable/12/sys/dev/qat/qat_d15xxreg.h stable/12/sys/dev/qat/qat_dh895xccreg.h stable/12/sys/modules/qatfw/qat_c2xxx/Makefile stable/12/sys/modules/qatfw/qat_c3xxx/Makefile stable/12/sys/modules/qatfw/qat_c62x/Makefile stable/12/sys/modules/qatfw/qat_d15xx/Makefile stable/12/sys/modules/qatfw/qat_dh895xcc/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/qat/qat_c2xxxreg.h ============================================================================== --- stable/12/sys/dev/qat/qat_c2xxxreg.h Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/dev/qat/qat_c2xxxreg.h Thu Dec 3 15:55:07 2020 (r368304) @@ -169,7 +169,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_C2XXX 0x00800000 -#define AE_FW_MOF_NAME_C2XXX "mof_firmware_c2xxx" +#define AE_FW_MOF_NAME_C2XXX "qat_c2xxxfw" #define AE_FW_MMP_NAME_C2XXX "mmp_firmware_c2xxx" #define AE_FW_UOF_NAME_C2XXX_A0 "icp_qat_nae.uof" #define AE_FW_UOF_NAME_C2XXX_B0 "icp_qat_nae_b0.uof" Modified: stable/12/sys/dev/qat/qat_c3xxxreg.h ============================================================================== --- stable/12/sys/dev/qat/qat_c3xxxreg.h Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/dev/qat/qat_c3xxxreg.h Thu Dec 3 15:55:07 2020 (r368304) @@ -168,7 +168,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_C3XXX 0x02000000 -#define AE_FW_MOF_NAME_C3XXX "qat_c3xxx" +#define AE_FW_MOF_NAME_C3XXX "qat_c3xxxfw" #define AE_FW_MMP_NAME_C3XXX "qat_c3xxx_mmp" #define AE_FW_UOF_NAME_C3XXX "icp_qat_ae.suof" Modified: stable/12/sys/dev/qat/qat_c62xreg.h ============================================================================== --- stable/12/sys/dev/qat/qat_c62xreg.h Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/dev/qat/qat_c62xreg.h Thu Dec 3 15:55:07 2020 (r368304) @@ -191,7 +191,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_C62X 0x01000000 -#define AE_FW_MOF_NAME_C62X "qat_c62x" +#define AE_FW_MOF_NAME_C62X "qat_c62xfw" #define AE_FW_MMP_NAME_C62X "qat_c62x_mmp" #define AE_FW_UOF_NAME_C62X "icp_qat_ae.suof" Modified: stable/12/sys/dev/qat/qat_d15xxreg.h ============================================================================== --- stable/12/sys/dev/qat/qat_d15xxreg.h Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/dev/qat/qat_d15xxreg.h Thu Dec 3 15:55:07 2020 (r368304) @@ -191,7 +191,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_D15XX 0x01000000 -#define AE_FW_MOF_NAME_D15XX "qat_d15xx" +#define AE_FW_MOF_NAME_D15XX "qat_d15xxfw" #define AE_FW_MMP_NAME_D15XX "qat_d15xx_mmp" #define AE_FW_UOF_NAME_D15XX "icp_qat_ae.suof" Modified: stable/12/sys/dev/qat/qat_dh895xccreg.h ============================================================================== --- stable/12/sys/dev/qat/qat_dh895xccreg.h Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/dev/qat/qat_dh895xccreg.h Thu Dec 3 15:55:07 2020 (r368304) @@ -109,7 +109,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_DH895XCC 0x00400000 -#define AE_FW_MOF_NAME_DH895XCC "qat_895xcc" +#define AE_FW_MOF_NAME_DH895XCC "qat_895xccfw" #define AE_FW_MMP_NAME_DH895XCC "qat_895xcc_mmp" #define AE_FW_UOF_NAME_DH895XCC "icp_qat_ae.uof" Modified: stable/12/sys/modules/qatfw/qat_c2xxx/Makefile ============================================================================== --- stable/12/sys/modules/qatfw/qat_c2xxx/Makefile Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/modules/qatfw/qat_c2xxx/Makefile Thu Dec 3 15:55:07 2020 (r368304) @@ -6,6 +6,6 @@ KMOD= qat_c2xxxfw IMG1= mmp_firmware_c2xxx IMG2= mof_firmware_c2xxx -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include Modified: stable/12/sys/modules/qatfw/qat_c3xxx/Makefile ============================================================================== --- stable/12/sys/modules/qatfw/qat_c3xxx/Makefile Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/modules/qatfw/qat_c3xxx/Makefile Thu Dec 3 15:55:07 2020 (r368304) @@ -6,6 +6,6 @@ KMOD= qat_c3xxxfw IMG1= qat_c3xxx IMG2= qat_c3xxx_mmp -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include Modified: stable/12/sys/modules/qatfw/qat_c62x/Makefile ============================================================================== --- stable/12/sys/modules/qatfw/qat_c62x/Makefile Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/modules/qatfw/qat_c62x/Makefile Thu Dec 3 15:55:07 2020 (r368304) @@ -6,6 +6,6 @@ KMOD= qat_c62xfw IMG1= qat_c62x IMG2= qat_c62x_mmp -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include Modified: stable/12/sys/modules/qatfw/qat_d15xx/Makefile ============================================================================== --- stable/12/sys/modules/qatfw/qat_d15xx/Makefile Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/modules/qatfw/qat_d15xx/Makefile Thu Dec 3 15:55:07 2020 (r368304) @@ -6,6 +6,6 @@ KMOD= qat_d15xxfw IMG1= qat_d15xx IMG2= qat_d15xx_mmp -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include Modified: stable/12/sys/modules/qatfw/qat_dh895xcc/Makefile ============================================================================== --- stable/12/sys/modules/qatfw/qat_dh895xcc/Makefile Thu Dec 3 15:54:41 2020 (r368303) +++ stable/12/sys/modules/qatfw/qat_dh895xcc/Makefile Thu Dec 3 15:55:07 2020 (r368304) @@ -6,6 +6,6 @@ KMOD= qat_dh895xccfw IMG1= qat_895xcc IMG2= qat_895xcc_mmp -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include From owner-svn-src-stable@freebsd.org Fri Dec 4 00:48:12 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F88C4B5AB4; Fri, 4 Dec 2020 00:48:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnDb01qC8z3HZy; Fri, 4 Dec 2020 00:48:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CC532276C; Fri, 4 Dec 2020 00:48:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B40mCq8098523; Fri, 4 Dec 2020 00:48:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B40mBnC098522; Fri, 4 Dec 2020 00:48:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012040048.0B40mBnC098522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Dec 2020 00:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368318 - stable/12/sys/fs/msdosfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/msdosfs X-SVN-Commit-Revision: 368318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 00:48:12 -0000 Author: kib Date: Fri Dec 4 00:48:11 2020 New Revision: 368318 URL: https://svnweb.freebsd.org/changeset/base/368318 Log: MFC r367895: msdosfs: suspend around unmount or remount rw->ro. Modified: stable/12/sys/fs/msdosfs/msdosfs_vfsops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/12/sys/fs/msdosfs/msdosfs_vfsops.c Thu Dec 3 22:23:57 2020 (r368317) +++ stable/12/sys/fs/msdosfs/msdosfs_vfsops.c Fri Dec 4 00:48:11 2020 (r368318) @@ -250,22 +250,28 @@ msdosfs_mount(struct mount *mp) pmp = VFSTOMSDOSFS(mp); if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { - error = VFS_SYNC(mp, MNT_WAIT); - if (error) + if ((error = vn_start_write(NULL, &mp, V_WAIT)) != 0) return (error); + error = vfs_write_suspend_umnt(mp); + if (error != 0) + return (error); + flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; error = vflush(mp, 0, flags, td); - if (error) + if (error != 0) { + vfs_write_resume(mp, 0); return (error); + } /* * Now the volume is clean. Mark it so while the * device is still rw. */ error = markvoldirty(pmp, 0); - if (error) { + if (error != 0) { + vfs_write_resume(mp, 0); (void)markvoldirty(pmp, 1); return (error); } @@ -275,6 +281,7 @@ msdosfs_mount(struct mount *mp) error = g_access(pmp->pm_cp, 0, -1, 0); g_topology_unlock(); if (error) { + vfs_write_resume(mp, 0); (void)markvoldirty(pmp, 1); return (error); } @@ -288,6 +295,7 @@ msdosfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_RDONLY; MNT_IUNLOCK(mp); + vfs_write_resume(mp, 0); } else if ((pmp->pm_flags & MSDOSFSMNT_RONLY) && !vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { /* @@ -741,21 +749,31 @@ msdosfs_unmount(struct mount *mp, int mntflags) { struct msdosfsmount *pmp; int error, flags; + bool susp; error = flags = 0; pmp = VFSTOMSDOSFS(mp); - if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) - error = msdosfs_sync(mp, MNT_WAIT); + susp = (pmp->pm_flags & MSDOSFSMNT_RONLY) == 0; + + if (susp) { + error = vfs_write_suspend_umnt(mp); + if (error != 0) + return (error); + } + if ((mntflags & MNT_FORCE) != 0) flags |= FORCECLOSE; - else if (error != 0) - return (error); error = vflush(mp, 0, flags, curthread); - if (error != 0 && error != ENXIO) + if (error != 0 && error != ENXIO) { + if (susp) + vfs_write_resume(mp, VR_START_WRITE); return (error); - if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) { + } + if (susp) { error = markvoldirty(pmp, 0); - if (error && error != ENXIO) { + if (error != 0 && error != ENXIO) { + if (susp) + vfs_write_resume(mp, VR_START_WRITE); (void)markvoldirty(pmp, 1); return (error); } @@ -792,6 +810,9 @@ msdosfs_unmount(struct mount *mp, int mntflags) BO_UNLOCK(bo); } #endif + if (susp) + vfs_write_resume(mp, VR_START_WRITE); + g_topology_lock(); g_vfs_close(pmp->pm_cp); g_topology_unlock(); From owner-svn-src-stable@freebsd.org Fri Dec 4 01:09:53 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BF974B5EC4; Fri, 4 Dec 2020 01:09:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnF410GK8z3J9W; Fri, 4 Dec 2020 01:09:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB56022F6B; Fri, 4 Dec 2020 01:09:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B419qmk011349; Fri, 4 Dec 2020 01:09:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B419qk6011346; Fri, 4 Dec 2020 01:09:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012040109.0B419qk6011346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Dec 2020 01:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368319 - in stable/12: share/man/man4 sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/opencrypto X-SVN-Commit-Revision: 368319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 01:09:53 -0000 Author: jhb Date: Fri Dec 4 01:09:51 2020 New Revision: 368319 URL: https://svnweb.freebsd.org/changeset/base/368319 Log: MFC 366844: Mark asymmetric cryptography via OCF deprecated for 14.0. Only one MIPS-specific driver implements support for one of the asymmetric operations. There are no in-kernel users besides /dev/crypto. The only known user of the /dev/crypto interface was the engine in OpenSSL releases before 1.1.0. 1.1.0 includes a rewritten engine that does not use the asymmetric operations due to lack of documentation. Modified: stable/12/share/man/man4/crypto.4 stable/12/sys/opencrypto/crypto.c stable/12/sys/opencrypto/cryptodev.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/crypto.4 ============================================================================== --- stable/12/share/man/man4/crypto.4 Fri Dec 4 00:48:11 2020 (r368318) +++ stable/12/share/man/man4/crypto.4 Fri Dec 4 01:09:51 2020 (r368319) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2019 +.Dd October 19, 2020 .Dt CRYPTO 4 .Os .Sh NAME @@ -108,6 +108,11 @@ both asymmetric-key (public-key/private-key) requests modular arithmetic (for Diffie-Hellman key exchange and other cryptographic protocols). The two modes are described separately below. +.Sh DEPRECATION NOTICE +The asymmetric-key operations supported by this interface will not be +present in +.Fx 14.0 +and later. .Sh THEORY OF OPERATION Regardless of whether symmetric-key or asymmetric-key operations are to be performed, use of the device requires a basic series of steps: Modified: stable/12/sys/opencrypto/crypto.c ============================================================================== --- stable/12/sys/opencrypto/crypto.c Fri Dec 4 00:48:11 2020 (r368318) +++ stable/12/sys/opencrypto/crypto.c Fri Dec 4 01:09:51 2020 (r368319) @@ -841,6 +841,7 @@ crypto_kregister(u_int32_t driverid, int kalg, u_int32 , kalg , flags ); + gone_in_dev(cap->cc_dev, 14, "asymmetric crypto"); err = 0; } else err = EINVAL; Modified: stable/12/sys/opencrypto/cryptodev.c ============================================================================== --- stable/12/sys/opencrypto/cryptodev.c Fri Dec 4 00:48:11 2020 (r368318) +++ stable/12/sys/opencrypto/cryptodev.c Fri Dec 4 01:09:51 2020 (r368319) @@ -374,6 +374,7 @@ cryptof_ioctl( struct ucred *active_cred, struct thread *td) { + static struct timeval keywarn, featwarn; #define SES2(p) ((struct session2_op *)p) struct cryptoini cria, crie; struct fcrypt *fcr = fp->f_data; @@ -701,6 +702,10 @@ bail: case CIOCKEY32: case CIOCKEY232: #endif + if (ratecheck(&keywarn, &warninterval)) + gone_in(14, + "Asymmetric crypto operations via /dev/crypto"); + if (!crypto_userasymcrypto) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EPERM); /* XXX compat? */ @@ -730,6 +735,10 @@ bail: #endif break; case CIOCASYMFEAT: + if (ratecheck(&featwarn, &warninterval)) + gone_in(14, + "Asymmetric crypto features via /dev/crypto"); + if (!crypto_userasymcrypto) { /* * NB: if user asym crypto operations are From owner-svn-src-stable@freebsd.org Fri Dec 4 01:11:10 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B6444B5F73; Fri, 4 Dec 2020 01:11:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnF5V0KmSz3Jm9; Fri, 4 Dec 2020 01:11:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F247522F81; Fri, 4 Dec 2020 01:11:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B41B9Vq012993; Fri, 4 Dec 2020 01:11:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B41B950012992; Fri, 4 Dec 2020 01:11:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012040111.0B41B950012992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Dec 2020 01:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368320 - stable/12/tools/tools/crypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/tools/tools/crypto X-SVN-Commit-Revision: 368320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 01:11:10 -0000 Author: jhb Date: Fri Dec 4 01:11:09 2020 New Revision: 368320 URL: https://svnweb.freebsd.org/changeset/base/368320 Log: MFC 350813: tools/tools/crypto: cryptokeytest: Fix build with newer OpenSSL Also, drag into this decade. Modified: stable/12/tools/tools/crypto/cryptokeytest.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tools/tools/crypto/cryptokeytest.c ============================================================================== --- stable/12/tools/tools/crypto/cryptokeytest.c Fri Dec 4 01:09:51 2020 (r368319) +++ stable/12/tools/tools/crypto/cryptokeytest.c Fri Dec 4 01:11:09 2020 (r368320) @@ -7,19 +7,21 @@ * --Jason L. Wright */ #include +#include #include -#include #include #include -#include -#include -#include #include +#include +#include +#include #include #include -#include +#include +#include + int crid = CRYPTO_FLAG_HARDWARE; int verbose = 0; @@ -63,80 +65,64 @@ crfind(int crid) } /* - * Convert a little endian byte string in 'p' that - * is 'plen' bytes long to a BIGNUM. If 'dst' is NULL, - * a new BIGNUM is allocated. Returns NULL on failure. - * - * XXX there has got to be a more efficient way to do - * this, but I haven't figured out enough of the OpenSSL - * magic. + * Convert a little endian byte string in 'p' that is 'plen' bytes long to a + * BIGNUM. A new BIGNUM is allocated. Returns NULL on failure. */ -BIGNUM * -le_to_bignum(BIGNUM *dst, u_int8_t *p, int plen) +static BIGNUM * +le_to_bignum(BIGNUM *res, const void *p, int plen) { - u_int8_t *pd; - int i; - if (plen == 0) - return (NULL); + res = BN_lebin2bn(p, plen, res); + if (res == NULL) + ERR_print_errors_fp(stderr); - if ((pd = (u_int8_t *)malloc(plen)) == NULL) - return (NULL); - - for (i = 0; i < plen; i++) - pd[i] = p[plen - i - 1]; - - dst = BN_bin2bn(pd, plen, dst); - free(pd); - return (dst); + return (res); } /* - * Convert a BIGNUM to a little endian byte string. - * If 'rd' is NULL, allocate space for it, otherwise - * 'rd' is assumed to have room for BN_num_bytes(n) - * bytes. Returns NULL on failure. + * Convert a BIGNUM to a little endian byte string. Space for BN_num_bytes(n) + * is allocated. + * Returns NULL on failure. */ -u_int8_t * -bignum_to_le(BIGNUM *n, u_int8_t *rd) +static void * +bignum_to_le(const BIGNUM *n) { - int i, j, k; - int blen = BN_num_bytes(n); + int blen, error; + void *rd; + blen = BN_num_bytes(n); if (blen == 0) return (NULL); + + rd = malloc(blen); if (rd == NULL) - rd = (u_int8_t *)malloc(blen); - if (rd == NULL) return (NULL); - for (i = 0, j = 0; i < n->top; i++) { - for (k = 0; k < BN_BITS2 / 8; k++) { - if ((j + k) >= blen) - goto out; - rd[j + k] = n->d[i] >> (k * 8); - } - j += BN_BITS2 / 8; + error = BN_bn2lebinpad(n, rd, blen); + if (error < 0) { + ERR_print_errors_fp(stderr); + free(rd); + return (NULL); } -out: + return (rd); } -int -UB_mod_exp(BIGNUM *res, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx) +static int +UB_mod_exp(BIGNUM *res, const BIGNUM *a, const BIGNUM *b, const BIGNUM *c) { struct crypt_kop kop; - u_int8_t *ale, *ble, *cle; + void *ale, *ble, *cle; static int crypto_fd = -1; if (crypto_fd == -1 && ioctl(devcrypto(), CRIOGET, &crypto_fd) == -1) err(1, "CRIOGET"); - if ((ale = bignum_to_le(a, NULL)) == NULL) + if ((ale = bignum_to_le(a)) == NULL) err(1, "bignum_to_le, a"); - if ((ble = bignum_to_le(b, NULL)) == NULL) + if ((ble = bignum_to_le(b)) == NULL) err(1, "bignum_to_le, b"); - if ((cle = bignum_to_le(c, NULL)) == NULL) + if ((cle = bignum_to_le(c)) == NULL) err(1, "bignum_to_le, c"); bzero(&kop, sizeof(kop)); @@ -158,19 +144,19 @@ UB_mod_exp(BIGNUM *res, BIGNUM *a, BIGNUM *b, BIGNUM * if (verbose) printf("device = %s\n", crfind(kop.crk_crid)); - bzero(ale, BN_num_bytes(a)); + explicit_bzero(ale, BN_num_bytes(a)); free(ale); - bzero(ble, BN_num_bytes(b)); + explicit_bzero(ble, BN_num_bytes(b)); free(ble); if (kop.crk_status != 0) { printf("error %d\n", kop.crk_status); - bzero(cle, BN_num_bytes(c)); + explicit_bzero(cle, BN_num_bytes(c)); free(cle); return (-1); } else { res = le_to_bignum(res, cle, BN_num_bytes(c)); - bzero(cle, BN_num_bytes(c)); + explicit_bzero(cle, BN_num_bytes(c)); free(cle); if (res == NULL) err(1, "le_to_bignum"); @@ -179,9 +165,9 @@ UB_mod_exp(BIGNUM *res, BIGNUM *a, BIGNUM *b, BIGNUM * return (0); } -void -show_result(a, b, c, sw, hw) -BIGNUM *a, *b, *c, *sw, *hw; +static void +show_result(const BIGNUM *a, const BIGNUM *b, const BIGNUM *c, + const BIGNUM *sw, const BIGNUM *hw) { printf("\n"); @@ -208,7 +194,7 @@ BIGNUM *a, *b, *c, *sw, *hw; printf("\n"); } -void +static void testit(void) { BIGNUM *a, *b, *c, *r1, *r2; @@ -230,10 +216,10 @@ testit(void) BIGNUM *rem = BN_new(); BN_mod(rem, a, c, ctx); - UB_mod_exp(r2, rem, b, c, ctx); + UB_mod_exp(r2, rem, b, c); BN_free(rem); } else { - UB_mod_exp(r2, a, b, c, ctx); + UB_mod_exp(r2, a, b, c); } BN_mod_exp(r1, a, b, c, ctx); From owner-svn-src-stable@freebsd.org Fri Dec 4 02:18:40 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B36DF4B78F1; Fri, 4 Dec 2020 02:18:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnGbN4fbJz3Mh7; Fri, 4 Dec 2020 02:18:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E56823ABD; Fri, 4 Dec 2020 02:18:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B42Iebp054935; Fri, 4 Dec 2020 02:18:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B42Ietn054934; Fri, 4 Dec 2020 02:18:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012040218.0B42Ietn054934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 4 Dec 2020 02:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368321 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 368321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 02:18:40 -0000 Author: kevans Date: Fri Dec 4 02:18:40 2020 New Revision: 368321 URL: https://svnweb.freebsd.org/changeset/base/368321 Log: MFC r368116: kern: cpuset: drop the lock to allocate domainsets Restructure the loop a little bit to make it a little more clear how it really operates: we never allocate any domains at the beginning of the first iteration, and it will run until we've satisfied the amount we need or we encounter an error. The lock is now taken outside of the loop to make stuff inside the loop easier to evaluate w.r.t. locking. This fixes it to not try and allocate any domains for the freelist under the spinlock, which would have happened before if we needed any new domains. Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c ============================================================================== --- stable/12/sys/kern/kern_cpuset.c Fri Dec 4 01:11:09 2020 (r368320) +++ stable/12/sys/kern/kern_cpuset.c Fri Dec 4 02:18:40 2020 (r368321) @@ -784,14 +784,11 @@ cpuset_modify_domain(struct cpuset *set, struct domain return (EPERM); domainset_freelist_init(&domains, 0); domain = domainset_create(domain); - ndomains = needed = 0; - do { - if (ndomains < needed) { - domainset_freelist_add(&domains, needed - ndomains); - ndomains = needed; - } + ndomains = 0; + + mtx_lock_spin(&cpuset_lock); + for (;;) { root = cpuset_getroot(set); - mtx_lock_spin(&cpuset_lock); dset = root->cs_domain; /* * Verify that we have access to this set of domains. @@ -816,7 +813,15 @@ cpuset_modify_domain(struct cpuset *set, struct domain &needed, 0); if (error) goto out; - } while (ndomains < needed); + if (ndomains >= needed) + break; + + /* Dropping the lock; we'll need to re-evaluate again. */ + mtx_unlock_spin(&cpuset_lock); + domainset_freelist_add(&domains, needed - ndomains); + ndomains = needed; + mtx_lock_spin(&cpuset_lock); + } dset = set->cs_domain; cpuset_update_domain(set, domain, dset, &domains); out: From owner-svn-src-stable@freebsd.org Fri Dec 4 02:19:46 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92B9E4B7771; Fri, 4 Dec 2020 02:19:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnGcf3khfz3N2R; Fri, 4 Dec 2020 02:19:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72E3A238BB; Fri, 4 Dec 2020 02:19:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B42JkmA055043; Fri, 4 Dec 2020 02:19:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B42JkPX055042; Fri, 4 Dec 2020 02:19:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012040219.0B42JkPX055042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 4 Dec 2020 02:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368322 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 368322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 02:19:46 -0000 Author: kevans Date: Fri Dec 4 02:19:45 2020 New Revision: 368322 URL: https://svnweb.freebsd.org/changeset/base/368322 Log: MFC r367944: cpuset_setproc: use the appropriate parent for new anon. sets As far as I can tell, this has been the case since initially committed in 2008. cpuset_setproc is the executor of cpuset reassignment; note this excerpt from the description: * 1) Set is non-null. This reparents all anonymous sets to the provided * set and replaces all non-anonymous td_cpusets with the provided set. However, reviewing cpuset_setproc_setthread() for some jail related work unearthed the error: if tdset was not anonymous, we were replacing it with `set`. If it was anonymous, then we'd rebase it onto `set` (i.e. copy the thread's mask over and AND it with `set`) but give the new anonymous set the original tdset as the parent (i.e. the base of the set we're supposed to be leaving behind). The primary visible consequences were that: 1.) cpuset_getid() following such assignment returns the wrong result, the setid that we left behind rather than the one we joined. 2.) When a process attached to the jail, the base set of any anonymous threads was a set outside of the jail. This was initially bundled in D27298, but it's a minor fix that's fairly easy to verify the correctness of. A test is included in D27307 ("badparent"), which demonstrates the issue with, effectively: osetid = cpuset_getid() newsetid = cpuset() cpuset_setaffinity(thread) cpuset_setid(osetid) cpuset_getid(thread) -> observe that it matches newsetid instead of osetid. Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c ============================================================================== --- stable/12/sys/kern/kern_cpuset.c Fri Dec 4 02:18:40 2020 (r368321) +++ stable/12/sys/kern/kern_cpuset.c Fri Dec 4 02:19:45 2020 (r368322) @@ -1095,7 +1095,7 @@ cpuset_setproc_setthread(struct cpuset *tdset, struct if (error) return (error); - return cpuset_shadow(tdset, nsetp, &mask, &domain, freelist, + return cpuset_shadow(set, nsetp, &mask, &domain, freelist, domainlist); } From owner-svn-src-stable@freebsd.org Fri Dec 4 02:20:42 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DC004B7C8C; Fri, 4 Dec 2020 02:20:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnGdk1lhKz3N0b; Fri, 4 Dec 2020 02:20:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F54523ECB; Fri, 4 Dec 2020 02:20:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B42KgSd055960; Fri, 4 Dec 2020 02:20:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B42KgET055959; Fri, 4 Dec 2020 02:20:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012040220.0B42KgET055959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 4 Dec 2020 02:20:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368323 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 368323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 02:20:42 -0000 Author: kevans Date: Fri Dec 4 02:20:41 2020 New Revision: 368323 URL: https://svnweb.freebsd.org/changeset/base/368323 Log: MFC r368006: kern: never restart syscalls calling closefp(), e.g. close(2) All paths leading into closefp() will either replace or remove the fd from the filedesc table, and closefp() will call fo_close methods that can and do currently sleep without regard for the possibility of an ERESTART. This can be dangerous in multithreaded applications as another thread could have opened another file in its place that is subsequently operated on upon restart. The following are seemingly the only ones that will pass back ERESTART in-tree: - sockets (SO_LINGER) - fusefs - nfsclient Modified: stable/12/sys/kern/kern_descrip.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_descrip.c ============================================================================== --- stable/12/sys/kern/kern_descrip.c Fri Dec 4 02:19:45 2020 (r368322) +++ stable/12/sys/kern/kern_descrip.c Fri Dec 4 02:20:41 2020 (r368323) @@ -1223,6 +1223,15 @@ closefp(struct filedesc *fdp, int fd, struct file *fp, FILEDESC_XUNLOCK(fdp); error = closef(fp, td); + + /* + * All paths leading up to closefp() will have already removed or + * replaced the fd in the filedesc table, so a restart would not + * operate on the same file. + */ + if (error == ERESTART) + error = EINTR; + if (holdleaders) { FILEDESC_XLOCK(fdp); fdp->fd_holdleaderscount--; From owner-svn-src-stable@freebsd.org Fri Dec 4 02:28:46 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3792A4B7FB9; Fri, 4 Dec 2020 02:28:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnGq214NSz3NpV; Fri, 4 Dec 2020 02:28:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1316123EF0; Fri, 4 Dec 2020 02:28:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B42Sjtx061726; Fri, 4 Dec 2020 02:28:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B42SjqO061725; Fri, 4 Dec 2020 02:28:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012040228.0B42SjqO061725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 4 Dec 2020 02:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368324 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 368324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 02:28:46 -0000 Author: kevans Date: Fri Dec 4 02:28:45 2020 New Revision: 368324 URL: https://svnweb.freebsd.org/changeset/base/368324 Log: MFC r368009-r368010: kern: cpuset: minor improvements r368009: kern: cpuset: allow cpuset_create() to take an allocated *setp Currently, it must always allocate a new set to be used for passing to _cpuset_create, but it doesn't have to. This is purely kern_cpuset.c internal and it's sparsely used, so just change it to use *setp if it's not-NULL and modify the two consumers to pass in the address of a NULL cpuset. This paves the way for consumers that want the unr allocation without the possibility of sleeping as long as they've done their due diligence to ensure that the mask will properly apply atop the supplied parent (i.e. avoiding the free_unr() in the last failure path). r368010: kern: cpuset: rename _cpuset_create() to cpuset_init() cpuset_init() is better descriptor for what the function actually does. The name was previously taken by a sysinit that setup cpuset_zero's mask from all_cpus, it was removed in r331698 before stable/12 branched. A comment referencing the removed sysinit has now also been removed, since the setup previously done was moved into cpuset_thread0(). Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c ============================================================================== --- stable/12/sys/kern/kern_cpuset.c Fri Dec 4 02:20:41 2020 (r368323) +++ stable/12/sys/kern/kern_cpuset.c Fri Dec 4 02:28:45 2020 (r368324) @@ -287,12 +287,12 @@ cpuset_lookup(cpusetid_t setid, struct thread *td) } /* - * Create a set in the space provided in 'set' with the provided parameters. + * Initialize a set in the space provided in 'set' with the provided parameters. * The set is returned with a single ref. May return EDEADLK if the set * will have no valid cpu based on restrictions from the parent. */ static int -_cpuset_create(struct cpuset *set, struct cpuset *parent, +cpuset_init(struct cpuset *set, struct cpuset *parent, const cpuset_t *mask, struct domainset *domain, cpusetid_t id) { @@ -326,6 +326,10 @@ _cpuset_create(struct cpuset *set, struct cpuset *pare * Create a new non-anonymous set with the requested parent and mask. May * return failures if the mask is invalid or a new number can not be * allocated. + * + * If *setp is not NULL, then it will be used as-is. The caller must take + * into account that *setp will be inserted at the head of cpuset_ids and + * plan any potentially conflicting cs_link usage accordingly. */ static int cpuset_create(struct cpuset **setp, struct cpuset *parent, const cpuset_t *mask) @@ -333,16 +337,22 @@ cpuset_create(struct cpuset **setp, struct cpuset *par struct cpuset *set; cpusetid_t id; int error; + bool dofree; id = alloc_unr(cpuset_unr); if (id == -1) return (ENFILE); - *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - error = _cpuset_create(set, parent, mask, NULL, id); + dofree = (*setp == NULL); + if (*setp != NULL) + set = *setp; + else + *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); + error = cpuset_init(set, parent, mask, NULL, id); if (error == 0) return (0); free_unr(cpuset_unr, id); - uma_zfree(cpuset_zone, set); + if (dofree) + uma_zfree(cpuset_zone, set); return (error); } @@ -978,7 +988,7 @@ cpuset_shadow(struct cpuset *set, struct cpuset **nset else d = set->cs_domain; nset = LIST_FIRST(cpusets); - error = _cpuset_create(nset, parent, mask, d, CPUSET_INVALID); + error = cpuset_init(nset, parent, mask, d, CPUSET_INVALID); if (error == 0) { LIST_REMOVE(nset, cs_link); *nsetp = nset; @@ -1458,9 +1468,7 @@ domainset_zero(void) * sets: * * 0 - The root set which should represent all valid processors in the - * system. It is initially created with a mask of all processors - * because we don't know what processors are valid until cpuset_init() - * runs. This set is immutable. + * system. This set is immutable. * 1 - The default set which all processes are a member of until changed. * This allows an administrator to move all threads off of given cpus to * dedicate them to high priority tasks or save power etc. @@ -1497,14 +1505,14 @@ cpuset_thread0(void) * Now derive a default (1), modifiable set from that to give out. */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - error = _cpuset_create(set, cpuset_zero, NULL, NULL, 1); + error = cpuset_init(set, cpuset_zero, NULL, NULL, 1); KASSERT(error == 0, ("Error creating default set: %d\n", error)); cpuset_default = set; /* * Create the kernel set (2). */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - error = _cpuset_create(set, cpuset_zero, NULL, NULL, 2); + error = cpuset_init(set, cpuset_zero, NULL, NULL, 2); KASSERT(error == 0, ("Error creating kernel set: %d\n", error)); set->cs_domain = &domainset2; cpuset_kernel = set; @@ -1557,16 +1565,17 @@ cpuset_create_root(struct prison *pr, struct cpuset ** KASSERT(pr != NULL, ("[%s:%d] invalid pr", __func__, __LINE__)); KASSERT(setp != NULL, ("[%s:%d] invalid setp", __func__, __LINE__)); - error = cpuset_create(setp, pr->pr_cpuset, &pr->pr_cpuset->cs_mask); + set = NULL; + error = cpuset_create(&set, pr->pr_cpuset, &pr->pr_cpuset->cs_mask); if (error) return (error); - KASSERT(*setp != NULL, ("[%s:%d] cpuset_create returned invalid data", + KASSERT(set != NULL, ("[%s:%d] cpuset_create returned invalid data", __func__, __LINE__)); /* Mark the set as root. */ - set = *setp; set->cs_flags |= CPU_SET_ROOT; + *setp = set; return (0); } @@ -1623,6 +1632,7 @@ sys_cpuset(struct thread *td, struct cpuset_args *uap) thread_lock(td); root = cpuset_refroot(td->td_cpuset); thread_unlock(td); + set = NULL; error = cpuset_create(&set, root, &root->cs_mask); cpuset_rel(root); if (error) From owner-svn-src-stable@freebsd.org Fri Dec 4 02:37:34 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 855994B7FEE; Fri, 4 Dec 2020 02:37:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnH1B3KzKz3PD8; Fri, 4 Dec 2020 02:37:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6521523BEC; Fri, 4 Dec 2020 02:37:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B42bYpc067917; Fri, 4 Dec 2020 02:37:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B42bXia067914; Fri, 4 Dec 2020 02:37:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012040237.0B42bXia067914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 4 Dec 2020 02:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368325 - in stable/12: lib/libc/sys lib/libthr/tests sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: lib/libc/sys lib/libthr/tests sys/kern X-SVN-Commit-Revision: 368325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 02:37:34 -0000 Author: kevans Date: Fri Dec 4 02:37:33 2020 New Revision: 368325 URL: https://svnweb.freebsd.org/changeset/base/368325 Log: MFC r367742-r367743: _umtx_op: documentation and compat32 fix r367742: _umtx_op: document UMTX_OP_SEM2_WAIT copyout behavior This clever technique to get a time remaining back was added to support sem_clockwait_np. Reviewed by: kib, vangyzen Differential Revision: https://reviews.freebsd.org/D27160 r367743: _umtx_op: fix a compat32 bug in UMTX_OP_NWAKE_PRIVATE Specifically, if we're waking up some value n > BATCH_SIZE, then the copyin(9) is wrong on the second iteration due to upp being the wrong type. upp is currently a uint32_t**, so upp + pos advances it by twice as many elements as it should (host pointer size vs. compat32 pointer size). Fix it by just making upp a uint32_t*; it's still technically a double pointer, but the distinction doesn't matter all that much here since we're just doing arithmetic on it. Add a test case that demonstrates the problem, placed with the libthr tests since one messing with _umtx_op should be running these tests. Running under compat32, the new test case will hang as threads after the first 128 get missed in the wake. it's not immediately clear how to hit it in practice, since pthread_cond_broadcast() uses a smaller (sleepq batch?) size observed to be around ~50 -- I did not spend much time digging into it. The uintptr_t change makes no functional difference, but i've tossed it in since it's more accurate (semantically). Added: stable/12/lib/libthr/tests/umtx_op_test.c - copied unchanged from r367743, head/lib/libthr/tests/umtx_op_test.c Modified: stable/12/lib/libc/sys/_umtx_op.2 stable/12/lib/libthr/tests/Makefile stable/12/sys/kern/kern_umtx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/_umtx_op.2 ============================================================================== --- stable/12/lib/libc/sys/_umtx_op.2 Fri Dec 4 02:28:45 2020 (r368324) +++ stable/12/lib/libc/sys/_umtx_op.2 Fri Dec 4 02:37:33 2020 (r368325) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2017 +.Dd November 16, 2020 .Dt _UMTX_OP 2 .Os .Sh NAME @@ -1101,6 +1101,15 @@ The arguments to the request are: .It Fa obj Pointer to the semaphore (of type .Vt struct _usem2 ) . +.It Fa uaddr +Size of the memory passed in via the +.Fa uaddr2 +argument. +.It Fa uaddr2 +Optional pointer to a structure of type +.Vt struct _umtx_time , +which may be followed by a structure of type +.Vt struct timespec . .El .Pp Put the requesting thread onto a sleep queue if the semaphore counter @@ -1124,6 +1133,18 @@ An unblocked signal delivered during such wait results interruption and .Er EINTR error. +.Pp +If +.Dv UMTX_ABSTIME +was not set, and the operation was interrupted and the caller passed in a +.Fa uaddr2 +large enough to hold a +.Vt struct timespec +following the initial +.Vt struct _umtx_time , +then the +.Vt struct timespec +is updated to contain the unslept amount. .It Dv UMTX_OP_SEM2_WAKE Wake up waiters on semaphore lock. The arguments to the request are: Modified: stable/12/lib/libthr/tests/Makefile ============================================================================== --- stable/12/lib/libthr/tests/Makefile Fri Dec 4 02:28:45 2020 (r368324) +++ stable/12/lib/libthr/tests/Makefile Fri Dec 4 02:37:33 2020 (r368325) @@ -33,6 +33,8 @@ NETBSD_ATF_TESTS_SH+= cancel_test NETBSD_ATF_TESTS_SH+= exit_test NETBSD_ATF_TESTS_SH+= resolv_test +ATF_TESTS_C+= umtx_op_test + LIBADD+= pthread LIBADD.fpu_test+= m LIBADD.sem_test+= rt Copied: stable/12/lib/libthr/tests/umtx_op_test.c (from r367743, head/lib/libthr/tests/umtx_op_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/libthr/tests/umtx_op_test.c Fri Dec 4 02:37:33 2020 (r368325, copy of r367743, head/lib/libthr/tests/umtx_op_test.c) @@ -0,0 +1,108 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Kyle Evans + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +#include + +/* + * This is an implementation detail of _umtx_op(2), pulled from + * sys/kern/kern_umtx.c. The relevant bug observed that requests above the + * batch side would not function as intended, so it's important that this + * reflects the BATCH_SIZE configured there. + */ +#define UMTX_OP_BATCH_SIZE 128 +#define THREAD_COUNT ((UMTX_OP_BATCH_SIZE * 3) / 2) + +static pthread_mutex_t static_mutex = PTHREAD_MUTEX_INITIALIZER; + +static int batched_waiting; + +static void * +batching_threadfunc(void *arg) +{ + + pthread_mutex_lock(&static_mutex); + ++batched_waiting; + pthread_mutex_unlock(&static_mutex); + _umtx_op(arg, UMTX_OP_WAIT_UINT_PRIVATE, 0, NULL, NULL); + + return (NULL); +} + +ATF_TC(batching); +ATF_TC_HEAD(batching, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Checks batching of UMTX_OP_NWAKE_PRIVATE"); +} +ATF_TC_BODY(batching, tc) +{ + uintptr_t addrs[THREAD_COUNT]; + uint32_t vals[THREAD_COUNT]; + pthread_t threads[THREAD_COUNT]; + + for (int i = 0; i < THREAD_COUNT; i++) { + addrs[i] = (uintptr_t)&vals[i]; + vals[i] = 0; + pthread_create(&threads[i], NULL, batching_threadfunc, + &vals[i]); + } + + pthread_mutex_lock(&static_mutex); + while (batched_waiting != THREAD_COUNT) { + pthread_mutex_unlock(&static_mutex); + pthread_yield(); + pthread_mutex_lock(&static_mutex); + } + + /* + * Spin for another .50 seconds to make sure they're all safely in the + * kernel. + */ + usleep(500000); + + pthread_mutex_unlock(&static_mutex); + _umtx_op(addrs, UMTX_OP_NWAKE_PRIVATE, THREAD_COUNT, NULL, NULL); + + for (int i = 0; i < THREAD_COUNT; i++) { + ATF_REQUIRE_EQ(0, pthread_join(threads[i], NULL)); + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, batching); + return (atf_no_error()); +} Modified: stable/12/sys/kern/kern_umtx.c ============================================================================== --- stable/12/sys/kern/kern_umtx.c Fri Dec 4 02:28:45 2020 (r368324) +++ stable/12/sys/kern/kern_umtx.c Fri Dec 4 02:37:33 2020 (r368325) @@ -4360,10 +4360,10 @@ __umtx_op_sem2_wait_compat32(struct thread *td, struct static int __umtx_op_nwake_private32(struct thread *td, struct _umtx_op_args *uap) { - uint32_t uaddrs[BATCH_SIZE], **upp; + uint32_t uaddrs[BATCH_SIZE], *upp; int count, error, i, pos, tocopy; - upp = (uint32_t **)uap->obj; + upp = (uint32_t *)uap->obj; error = 0; for (count = uap->val, pos = 0; count > 0; count -= tocopy, pos += tocopy) { @@ -4372,7 +4372,7 @@ __umtx_op_nwake_private32(struct thread *td, struct _u if (error != 0) break; for (i = 0; i < tocopy; ++i) - kern_umtx_wake(td, (void *)(intptr_t)uaddrs[i], + kern_umtx_wake(td, (void *)(uintptr_t)uaddrs[i], INT_MAX, 1); maybe_yield(); } From owner-svn-src-stable@freebsd.org Fri Dec 4 14:09:12 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E99644A13F9; Fri, 4 Dec 2020 14:09:12 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnZMD6JXRz4lcm; Fri, 4 Dec 2020 14:09:12 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB2884ACC; Fri, 4 Dec 2020 14:09:12 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4E9C2B097936; Fri, 4 Dec 2020 14:09:12 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4E9CvC097935; Fri, 4 Dec 2020 14:09:12 GMT (envelope-from ume@FreeBSD.org) Message-Id: <202012041409.0B4E9CvC097935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Fri, 4 Dec 2020 14:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368328 - stable/12/usr.sbin/rtsold X-SVN-Group: stable-12 X-SVN-Commit-Author: ume X-SVN-Commit-Paths: stable/12/usr.sbin/rtsold X-SVN-Commit-Revision: 368328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 14:09:13 -0000 Author: ume Date: Fri Dec 4 14:09:12 2020 New Revision: 368328 URL: https://svnweb.freebsd.org/changeset/base/368328 Log: MFC r368111: fix casper initialization for setting scripts. Modified: stable/12/usr.sbin/rtsold/rtsold.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/rtsold/rtsold.c ============================================================================== --- stable/12/usr.sbin/rtsold/rtsold.c Fri Dec 4 11:29:27 2020 (r368327) +++ stable/12/usr.sbin/rtsold/rtsold.c Fri Dec 4 14:09:12 2020 (r368328) @@ -333,6 +333,7 @@ init_capabilities(void) #ifdef WITH_CASPER const char *const scripts[] = { resolvconf_script, managedconf_script, otherconf_script }; + const char *scripts_set[nitems(scripts)]; cap_channel_t *capcasper; nvlist_t *limits; int count; @@ -351,9 +352,9 @@ init_capabilities(void) count = 0; for (size_t i = 0; i < nitems(scripts); i++) if (scripts[i] != NULL) - count++; + scripts_set[count++] = scripts[i]; limits = nvlist_create(0); - nvlist_add_string_array(limits, "scripts", scripts, count); + nvlist_add_string_array(limits, "scripts", scripts_set, count); if (cap_limit_set(capscript, limits) != 0) return (-1); From owner-svn-src-stable@freebsd.org Fri Dec 4 16:05:32 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C3314A484E; Fri, 4 Dec 2020 16:05:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CncxS0qtqz4tsm; Fri, 4 Dec 2020 16:05:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F8846689; Fri, 4 Dec 2020 16:05:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4G5V06072520; Fri, 4 Dec 2020 16:05:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4G5VWQ072519; Fri, 4 Dec 2020 16:05:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012041605.0B4G5VWQ072519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Dec 2020 16:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368339 - stable/12/sys/fs/msdosfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/msdosfs X-SVN-Commit-Revision: 368339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 16:05:32 -0000 Author: kib Date: Fri Dec 4 16:05:31 2020 New Revision: 368339 URL: https://svnweb.freebsd.org/changeset/base/368339 Log: Fix msdosfs suspension. Unlike HEAD, stable/12 still uses the check for vfs_susp_clean != NULL as indicator that fs supports suspension. Satisfy the requirement by providing dummy msdosfs_susp_clean method implementation. This is direct commit to stable/12. Reported by: Özkan KIRIK Modified: stable/12/sys/fs/msdosfs/msdosfs_vfsops.c Modified: stable/12/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/12/sys/fs/msdosfs/msdosfs_vfsops.c Fri Dec 4 15:53:44 2020 (r368338) +++ stable/12/sys/fs/msdosfs/msdosfs_vfsops.c Fri Dec 4 16:05:31 2020 (r368339) @@ -989,6 +989,11 @@ msdosfs_fhtovp(struct mount *mp, struct fid *fhp, int return (0); } +static void +msdosfs_susp_clean(struct mount *mp __unused) +{ +} + static struct vfsops msdosfs_vfsops = { .vfs_fhtovp = msdosfs_fhtovp, .vfs_mount = msdosfs_mount, @@ -997,6 +1002,7 @@ static struct vfsops msdosfs_vfsops = { .vfs_statfs = msdosfs_statfs, .vfs_sync = msdosfs_sync, .vfs_unmount = msdosfs_unmount, + .vfs_susp_clean = msdosfs_susp_clean, }; VFS_SET(msdosfs_vfsops, msdosfs, 0); From owner-svn-src-stable@freebsd.org Fri Dec 4 19:35:44 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 051224AA311; Fri, 4 Dec 2020 19:35:44 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cnjbz6nbSz3h54; Fri, 4 Dec 2020 19:35:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBD13112A5; Fri, 4 Dec 2020 19:35:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4JZhet006193; Fri, 4 Dec 2020 19:35:43 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4JZhig006192; Fri, 4 Dec 2020 19:35:43 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202012041935.0B4JZhig006192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 4 Dec 2020 19:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368346 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 368346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 19:35:44 -0000 Author: cy Date: Fri Dec 4 19:35:43 2020 New Revision: 368346 URL: https://svnweb.freebsd.org/changeset/base/368346 Log: Revert r366857. r366857 created a number of problems, tearing down interfaces too early in shutdown. This resulted in: - hung ssh sessions when shutting down or rebooting remotely using shutdown (I've used exec shutdown, for years, as apposed to simply shutdown). - NFS mounted filesystems "disappear" prior to unmount. - dhclient attached to a VLAN on an interface who's parent interface has already shut down prints errors. The path forward is to teach lagg(4) and vlan(4) about WOL. PR: 251531, 251540 PR: 158734, 109980 are broken again Reported by: jhb, emaste, jtl, Helge Oldach Martin Birgmeier Discussion at: https://reviews.freebsd.org/D27459 Modified: stable/12/libexec/rc/rc.d/netif Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/netif ============================================================================== --- stable/12/libexec/rc/rc.d/netif Fri Dec 4 19:31:16 2020 (r368345) +++ stable/12/libexec/rc/rc.d/netif Fri Dec 4 19:35:43 2020 (r368346) @@ -28,7 +28,7 @@ # PROVIDE: netif # REQUIRE: FILESYSTEMS iovctl serial sppp sysctl # REQUIRE: hostid ipfs -# KEYWORD: nojailvnet shutdown +# KEYWORD: nojailvnet . /etc/rc.subr . /etc/network.subr From owner-svn-src-stable@freebsd.org Sat Dec 5 09:08:28 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C208473F6B; Sat, 5 Dec 2020 09:08:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp3dm10Ztz3Cjb; Sat, 5 Dec 2020 09:08:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10E611B5C6; Sat, 5 Dec 2020 09:08:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B598Rb6010701; Sat, 5 Dec 2020 09:08:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B598RxB010698; Sat, 5 Dec 2020 09:08:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012050908.0B598RxB010698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 5 Dec 2020 09:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368361 - in stable/12/lib: libc/gen libc/include libthr/thread X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/lib: libc/gen libc/include libthr/thread X-SVN-Commit-Revision: 368361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 09:08:28 -0000 Author: kib Date: Sat Dec 5 09:08:26 2020 New Revision: 368361 URL: https://svnweb.freebsd.org/changeset/base/368361 Log: MFC r368125: libc: Add pthread_attr_get_np(3) stub, reporting ESRCH. PR: 251112 Modified: stable/12/lib/libc/gen/Symbol.map stable/12/lib/libc/gen/_pthread_stubs.c stable/12/lib/libc/include/libc_private.h stable/12/lib/libthr/thread/thr_init.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/Symbol.map ============================================================================== --- stable/12/lib/libc/gen/Symbol.map Sat Dec 5 05:56:23 2020 (r368360) +++ stable/12/lib/libc/gen/Symbol.map Sat Dec 5 09:08:26 2020 (r368361) @@ -6,6 +6,7 @@ FBSD_1.0 { __xuname; pthread_atfork; pthread_attr_destroy; + pthread_attr_get_np; pthread_attr_getdetachstate; pthread_attr_getguardsize; pthread_attr_getinheritsched; Modified: stable/12/lib/libc/gen/_pthread_stubs.c ============================================================================== --- stable/12/lib/libc/gen/_pthread_stubs.c Sat Dec 5 05:56:23 2020 (r368360) +++ stable/12/lib/libc/gen/_pthread_stubs.c Sat Dec 5 09:08:26 2020 (r368361) @@ -59,6 +59,7 @@ static int stub_zero(void); static int stub_fail(void); static int stub_true(void); static void stub_exit(void); +static int stub_esrch(void); #define PJT_DUAL_ENTRY(entry) \ (pthread_func_t)entry, (pthread_func_t)entry @@ -131,6 +132,7 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = { [PJT_MUTEXATTR_GETROBUST] = {PJT_DUAL_ENTRY(stub_zero)}, [PJT_MUTEXATTR_SETROBUST] = {PJT_DUAL_ENTRY(stub_zero)}, [PJT_GETTHREADID_NP] = {PJT_DUAL_ENTRY(stub_zero)}, + [PJT_ATTR_GET_NP] = {PJT_DUAL_ENTRY(stub_esrch)}, }; /* @@ -288,6 +290,7 @@ STUB_FUNC3(__pthread_cleanup_push_imp, PJT_CLEANUP_PUS void *, void *) STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, void, int) STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, void, int) +STUB_FUNC2(pthread_attr_get_np, PJT_ATTR_GET_NP, int, pthread_t, pthread_attr_t *) static int stub_zero(void) @@ -329,4 +332,10 @@ static void stub_exit(void) { exit(0); +} + +static int +stub_esrch(void) +{ + return (ESRCH); } Modified: stable/12/lib/libc/include/libc_private.h ============================================================================== --- stable/12/lib/libc/include/libc_private.h Sat Dec 5 05:56:23 2020 (r368360) +++ stable/12/lib/libc/include/libc_private.h Sat Dec 5 09:08:26 2020 (r368361) @@ -177,6 +177,7 @@ typedef enum { PJT_MUTEXATTR_GETROBUST, PJT_MUTEXATTR_SETROBUST, PJT_GETTHREADID_NP, + PJT_ATTR_GET_NP, PJT_MAX } pjt_index_t; Modified: stable/12/lib/libthr/thread/thr_init.c ============================================================================== --- stable/12/lib/libthr/thread/thr_init.c Sat Dec 5 05:56:23 2020 (r368360) +++ stable/12/lib/libthr/thread/thr_init.c Sat Dec 5 09:08:26 2020 (r368361) @@ -271,6 +271,7 @@ static pthread_func_t jmp_table[][2] = { [PJT_MUTEXATTR_GETROBUST] = {DUAL_ENTRY(_thr_mutexattr_getrobust)}, [PJT_MUTEXATTR_SETROBUST] = {DUAL_ENTRY(_thr_mutexattr_setrobust)}, [PJT_GETTHREADID_NP] = {DUAL_ENTRY(_thr_getthreadid_np)}, + [PJT_ATTR_GET_NP] = {DUAL_ENTRY(_thr_attr_get_np)}, }; static int init_once = 0;