From owner-dev-commits-src-main@freebsd.org Mon Mar 15 04:53:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6971A56F158; Mon, 15 Mar 2021 04:53:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzPDr2NbLz3n1m; Mon, 15 Mar 2021 04:53:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4461C2985; Mon, 15 Mar 2021 04:53:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F4r02r047369; Mon, 15 Mar 2021 04:53:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F4qxjV047368; Mon, 15 Mar 2021 04:52:59 GMT (envelope-from git) Date: Mon, 15 Mar 2021 04:52:59 GMT Message-Id: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74ae3f3e33b810248da19004c58b3581cd367843 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 04:53:00 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 commit 74ae3f3e33b810248da19004c58b3581cd367843 Author: Kyle Evans AuthorDate: 2021-03-15 02:25:40 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 04:52:04 +0000 if_wg: import latest fixup work from the wireguard-freebsd project This is the culmination of about a week of work from three developers to fix a number of functional and security issues. This patch consists of work done by the following folks: - Jason A. Donenfeld - Matt Dunwoodie - Kyle Evans Notable changes include: - Packets are now correctly staged for processing once the handshake has completed, resulting in less packet loss in the interim. - Various race conditions have been resolved, particularly w.r.t. socket and packet lifetime (panics) - Various tests have been added to assure correct functionality and tooling conformance - Many security issues have been addressed - if_wg now maintains jail-friendly semantics: sockets are created in the interface's home vnet so that it can act as the sole network connection for a jail - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 - if_wg now exports via ioctl a format that is future proof and complete. It is additionally supported by the upstream wireguard-tools (which we plan to merge in to base soon) - if_wg now conforms to the WireGuard protocol and is more closely aligned with security auditing guidelines Note that the driver has been rebased away from using iflib. iflib poses a number of challenges for a cloned device trying to operate in a vnet that are non-trivial to solve and adds complexity to the implementation for little gain. The crypto implementation that was previously added to the tree was a super complex integration of what previously appeared in an old out of tree Linux module, which has been reduced to crypto.c containing simple boring reference implementations. This is part of a near-to-mid term goal to work with FreeBSD kernel crypto folks and take advantage of or improve accelerated crypto already offered elsewhere. There's additional test suite effort underway out-of-tree taking advantage of the aforementioned jail-friendly semantics to test a number of real-world topologies, based on netns.sh. Also note that this is still a work in progress; work going further will be much smaller in nature. MFC after: 1 month (maybe) --- etc/mtree/BSD.include.dist | 2 + include/Makefile | 9 +- sbin/ifconfig/ifwg.c | 395 +- share/man/man4/wg.4 | 26 +- sys/dev/if_wg/crypto.c | 1705 ++++ sys/dev/if_wg/crypto.h | 114 + sys/dev/if_wg/if_wg.c | 3454 ++++++++ sys/dev/if_wg/if_wg.h | 36 + sys/dev/if_wg/include/crypto/blake2s.h | 56 - sys/dev/if_wg/include/crypto/curve25519.h | 74 - sys/dev/if_wg/include/crypto/zinc.h | 15 - sys/dev/if_wg/include/sys/if_wg_session.h | 89 - sys/dev/if_wg/include/sys/if_wg_session_vars.h | 319 - sys/dev/if_wg/include/sys/simd-x86_64.h | 74 - sys/dev/if_wg/include/sys/support.h | 342 - sys/dev/if_wg/include/sys/wg_module.h | 121 - sys/dev/if_wg/include/sys/wg_noise.h | 286 - sys/dev/if_wg/include/zinc/blake2s.h | 50 - sys/dev/if_wg/include/zinc/chacha20.h | 68 - sys/dev/if_wg/include/zinc/chacha20poly1305.h | 48 - sys/dev/if_wg/include/zinc/curve25519.h | 28 - sys/dev/if_wg/include/zinc/poly1305.h | 29 - sys/dev/if_wg/module/blake2s.c | 256 - sys/dev/if_wg/module/blake2s.h | 58 - sys/dev/if_wg/module/chacha20-x86_64.S | 2834 ------- .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 - .../module/crypto/zinc/chacha20/chacha20-arm.pl | 1227 --- .../module/crypto/zinc/chacha20/chacha20-arm64.pl | 1163 --- .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 - .../module/crypto/zinc/chacha20/chacha20-mips.S | 424 - .../crypto/zinc/chacha20/chacha20-x86_64-glue.c | 132 - .../module/crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ---------- .../if_wg/module/crypto/zinc/chacha20/chacha20.c | 238 - .../if_wg/module/crypto/zinc/chacha20poly1305.c | 196 - .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 - .../module/crypto/zinc/poly1305/poly1305-arm.pl | 1276 --- .../module/crypto/zinc/poly1305/poly1305-arm64.pl | 974 --- .../module/crypto/zinc/poly1305/poly1305-donna32.c | 205 - .../module/crypto/zinc/poly1305/poly1305-donna64.c | 182 - .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 - .../module/crypto/zinc/poly1305/poly1305-mips.S | 407 - .../module/crypto/zinc/poly1305/poly1305-mips64.pl | 467 -- .../crypto/zinc/poly1305/poly1305-x86_64-glue.c | 171 - .../module/crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ---------- .../if_wg/module/crypto/zinc/poly1305/poly1305.c | 163 - .../if_wg/module/crypto/zinc/selftest/blake2s.c | 2090 ----- .../if_wg/module/crypto/zinc/selftest/chacha20.c | 2703 ------- .../module/crypto/zinc/selftest/chacha20poly1305.c | 8443 -------------------- .../if_wg/module/crypto/zinc/selftest/curve25519.c | 1315 --- .../if_wg/module/crypto/zinc/selftest/poly1305.c | 1110 --- sys/dev/if_wg/module/crypto/zinc/selftest/run.h | 43 - sys/dev/if_wg/module/curve25519.c | 867 -- sys/dev/if_wg/module/if_wg_session.c | 1984 ----- sys/dev/if_wg/module/module.c | 954 --- sys/dev/if_wg/module/poly1305-x86_64.S | 3021 ------- sys/dev/if_wg/support.h | 56 + sys/dev/if_wg/{module => }/wg_cookie.c | 105 +- sys/dev/if_wg/{include/sys => }/wg_cookie.h | 81 +- sys/dev/if_wg/{module => }/wg_noise.c | 409 +- sys/dev/if_wg/wg_noise.h | 191 + sys/kern/kern_jail.c | 1 + sys/kern/uipc_socket.c | 11 + sys/kern/uipc_syscalls.c | 4 +- sys/modules/if_wg/Makefile | 30 +- sys/net/if_types.h | 1 + sys/netinet6/nd6.c | 4 +- sys/sys/priv.h | 1 + sys/sys/socketvar.h | 1 + tests/sys/netinet/Makefile | 10 +- tests/sys/netinet/if_wg_test.sh | 188 + 70 files changed, 6333 insertions(+), 43677 deletions(-) diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index e7784cbb0a47..0f85798815d5 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -64,6 +64,8 @@ .. iicbus .. + if_wg + .. io .. mfi diff --git a/include/Makefile b/include/Makefile index 3a34ddb8aa18..31e207f6b199 100644 --- a/include/Makefile +++ b/include/Makefile @@ -44,7 +44,7 @@ LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ - dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ @@ -170,6 +170,10 @@ NVPAIRDIR= ${INCLUDEDIR}/sys MLX5= mlx5io.h MLX5DIR= ${INCLUDEDIR}/dev/mlx5 +.PATH: ${SRCTOP}/sys/dev/if_wg +WG= if_wg.h +WGDIR= ${INCLUDEDIR}/dev/if_wg + INCSGROUPS= INCS \ ACPICA \ AGP \ @@ -182,7 +186,8 @@ INCSGROUPS= INCS \ PCI \ RPC \ TEKEN \ - VERIEXEC + VERIEXEC \ + WG .if ${MK_IPFILTER} != "no" INCSGROUPS+= IPFILTER diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c index 86bacc59f50d..a102f392cf80 100644 --- a/sbin/ifconfig/ifwg.c +++ b/sbin/ifconfig/ifwg.c @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -65,40 +67,60 @@ __FBSDID("$FreeBSD$"); #include "ifconfig.h" -typedef enum { - WGC_GET = 0x5, - WGC_SET = 0x6, -} wg_cmd_t; +static void wgfinish(int s, void *arg); + +static bool wgfinish_registered; -static nvlist_t *nvl_params; -static bool do_peer; static int allowed_ips_count; static int allowed_ips_max; -struct allowedip { - struct sockaddr_storage a_addr; - struct sockaddr_storage a_mask; -}; -struct allowedip *allowed_ips; +static nvlist_t **allowed_ips, *nvl_peer; #define ALLOWEDIPS_START 16 -#define WG_KEY_LEN 32 -#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) -#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) +#define WG_KEY_SIZE_BASE64 ((((WG_KEY_SIZE) + 2) / 3) * 4 + 1) +#define WG_KEY_SIZE_HEX (WG_KEY_SIZE * 2 + 1) #define WG_MAX_STRLEN 64 +struct allowedip { + union { + struct in_addr ip4; + struct in6_addr ip6; + }; +}; + +static void +register_wgfinish(void) +{ + + if (wgfinish_registered) + return; + callback_register(wgfinish, NULL); + wgfinish_registered = true; +} + +static nvlist_t * +nvl_device(void) +{ + static nvlist_t *_nvl_device; + + if (_nvl_device == NULL) + _nvl_device = nvlist_create(0); + register_wgfinish(); + return (_nvl_device); +} + static bool -key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) +key_from_base64(uint8_t key[static WG_KEY_SIZE], const char *base64) { - if (strlen(base64) != WG_KEY_LEN_BASE64 - 1) { - warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - 1, strlen(base64)); + if (strlen(base64) != WG_KEY_SIZE_BASE64 - 1) { + warnx("bad key len - need %d got %zu\n", WG_KEY_SIZE_BASE64 - 1, strlen(base64)); return false; } - if (base64[WG_KEY_LEN_BASE64 - 2] != '=') { - warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_LEN_BASE64 - 2]); + if (base64[WG_KEY_SIZE_BASE64 - 2] != '=') { + warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_SIZE_BASE64 - 2]); return false; } - return (b64_pton(base64, key, WG_KEY_LEN)); + return (b64_pton(base64, key, WG_KEY_SIZE)); } static void @@ -128,7 +150,7 @@ parse_endpoint(const char *endpoint_) err = getaddrinfo(endpoint, port, &hints, &res); if (err) errx(1, "%s", gai_strerror(err)); - nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, res->ai_addrlen); + nvlist_add_binary(nvl_peer, "endpoint", res->ai_addr, res->ai_addrlen); freeaddrinfo(res); free(base); } @@ -227,12 +249,14 @@ in6_mask2len(struct in6_addr *mask, u_char *lim0) } static bool -parse_ip(struct allowedip *aip, const char *value) +parse_ip(struct allowedip *aip, uint16_t *family, const char *value) { struct addrinfo hints, *res; int err; + bool ret; - bzero(&aip->a_addr, sizeof(aip->a_addr)); + ret = true; + bzero(aip, sizeof(*aip)); bzero(&hints, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_flags = AI_NUMERICHOST; @@ -240,10 +264,21 @@ parse_ip(struct allowedip *aip, const char *value) if (err) errx(1, "%s", gai_strerror(err)); - memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); + *family = res->ai_family; + if (res->ai_family == AF_INET) { + struct sockaddr_in *sin = (struct sockaddr_in *)res->ai_addr; + + aip->ip4 = sin->sin_addr; + } else if (res->ai_family == AF_INET6) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)res->ai_addr; + + aip->ip6 = sin6->sin6_addr; + } else { + ret = false; + } freeaddrinfo(res); - return (true); + return (ret); } static void @@ -271,61 +306,84 @@ sa_ntop(const struct sockaddr *sa, char *buf, int *port) } static void -dump_peer(const nvlist_t *nvl_peer) +dump_peer(const nvlist_t *nvl_peer_cfg) { const void *key; - const struct allowedip *aips; const struct sockaddr *endpoint; char outbuf[WG_MAX_STRLEN]; char addr_buf[INET6_ADDRSTRLEN]; - size_t size; - int count, port; + size_t aip_count, size; + int port; uint16_t persistent_keepalive; + const nvlist_t * const *nvl_aips; printf("[Peer]\n"); - if (nvlist_exists_binary(nvl_peer, "public-key")) { - key = nvlist_get_binary(nvl_peer, "public-key", &size); + if (nvlist_exists_binary(nvl_peer_cfg, "public-key")) { + key = nvlist_get_binary(nvl_peer_cfg, "public-key", &size); b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); printf("PublicKey = %s\n", outbuf); } - if (nvlist_exists_binary(nvl_peer, "endpoint")) { - endpoint = nvlist_get_binary(nvl_peer, "endpoint", &size); + if (nvlist_exists_binary(nvl_peer_cfg, "preshared-key")) { + key = nvlist_get_binary(nvl_peer_cfg, "preshared-key", &size); + b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); + printf("PresharedKey = %s\n", outbuf); + } + if (nvlist_exists_binary(nvl_peer_cfg, "endpoint")) { + endpoint = nvlist_get_binary(nvl_peer_cfg, "endpoint", &size); sa_ntop(endpoint, addr_buf, &port); printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); } - if (nvlist_exists_number(nvl_peer, "persistent-keepalive-interval")) { - persistent_keepalive = nvlist_get_number(nvl_peer, + if (nvlist_exists_number(nvl_peer_cfg, + "persistent-keepalive-interval")) { + persistent_keepalive = nvlist_get_number(nvl_peer_cfg, "persistent-keepalive-interval"); printf("PersistentKeepalive = %d\n", persistent_keepalive); } - if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) + if (!nvlist_exists_nvlist_array(nvl_peer_cfg, "allowed-ips")) return; - aips = nvlist_get_binary(nvl_peer, "allowed-ips", &size); - if (size == 0 || size % sizeof(struct allowedip) != 0) { - errx(1, "size %zu not integer multiple of allowedip", size); - } + + nvl_aips = nvlist_get_nvlist_array(nvl_peer_cfg, "allowed-ips", &aip_count); + if (nvl_aips == NULL || aip_count == 0) + return; + printf("AllowedIPs = "); - count = size / sizeof(struct allowedip); - for (int i = 0; i < count; i++) { - int mask; + for (size_t i = 0; i < aip_count; i++) { + uint8_t cidr; + struct sockaddr_storage ss; sa_family_t family; - void *bitmask; - struct sockaddr *sa; - - sa = __DECONST(void *, &aips[i].a_addr); - bitmask = __DECONST(void *, - ((const struct sockaddr *)&(&aips[i])->a_mask)->sa_data); - family = aips[i].a_addr.ss_family; - getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, - 0, NI_NUMERICHOST); - if (family == AF_INET) - mask = in_mask2len(bitmask); - else if (family == AF_INET6) - mask = in6_mask2len(bitmask, NULL); - else - errx(1, "bad family in peer %d\n", family); - printf("%s/%d", addr_buf, mask); - if (i < count -1) + + if (!nvlist_exists_number(nvl_aips[i], "cidr")) + continue; + cidr = nvlist_get_number(nvl_aips[i], "cidr"); + if (nvlist_exists_binary(nvl_aips[i], "ipv4")) { + struct sockaddr_in *sin = (struct sockaddr_in *)&ss; + const struct in_addr *ip4; + + ip4 = nvlist_get_binary(nvl_aips[i], "ipv4", &size); + if (ip4 == NULL || cidr > 32) + continue; + sin->sin_len = sizeof(*sin); + sin->sin_family = AF_INET; + sin->sin_addr = *ip4; + } else if (nvlist_exists_binary(nvl_aips[i], "ipv6")) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&ss; + const struct in6_addr *ip6; + + ip6 = nvlist_get_binary(nvl_aips[i], "ipv6", &size); + if (ip6 == NULL || cidr > 128) + continue; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_family = AF_INET6; + sin6->sin6_addr = *ip6; + } else { + continue; + } + + family = ss.ss_family; + getnameinfo((struct sockaddr *)&ss, ss.ss_len, addr_buf, + INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); + printf("%s/%d", addr_buf, cidr); + if (i < aip_count - 1) printf(", "); } printf("\n"); @@ -334,36 +392,34 @@ dump_peer(const nvlist_t *nvl_peer) static int get_nvl_out_size(int sock, u_long op, size_t *size) { - struct ifdrv ifd; + struct wg_data_io wgd; int err; - memset(&ifd, 0, sizeof(ifd)); + memset(&wgd, 0, sizeof(wgd)); - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); - ifd.ifd_cmd = op; - ifd.ifd_len = 0; - ifd.ifd_data = NULL; + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); + wgd.wgd_size = 0; + wgd.wgd_data = NULL; - err = ioctl(sock, SIOCGDRVSPEC, &ifd); + err = ioctl(sock, op, &wgd); if (err) return (err); - *size = ifd.ifd_len; + *size = wgd.wgd_size; return (0); } static int do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) { - struct ifdrv ifd; + struct wg_data_io wgd; - memset(&ifd, 0, sizeof(ifd)); + memset(&wgd, 0, sizeof(wgd)); - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); - ifd.ifd_cmd = op; - ifd.ifd_len = argsize; - ifd.ifd_data = arg; + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); + wgd.wgd_size = argsize; + wgd.wgd_data = arg; - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); + return (ioctl(sock, op, &wgd)); } static @@ -371,62 +427,83 @@ DECL_CMD_FUNC(peerlist, val, d) { size_t size, peercount; void *packed; - const nvlist_t *nvl, *nvl_peer; + const nvlist_t *nvl; const nvlist_t *const *nvl_peerlist; - if (get_nvl_out_size(s, WGC_GET, &size)) + if (get_nvl_out_size(s, SIOCGWG, &size)) errx(1, "can't get peer list size"); if ((packed = malloc(size)) == NULL) errx(1, "malloc failed for peer list"); - if (do_cmd(s, WGC_GET, packed, size, 0)) + if (do_cmd(s, SIOCGWG, packed, size, 0)) errx(1, "failed to obtain peer list"); nvl = nvlist_unpack(packed, size, 0); - if (!nvlist_exists_nvlist_array(nvl, "peer-list")) + if (!nvlist_exists_nvlist_array(nvl, "peers")) return; - nvl_peerlist = nvlist_get_nvlist_array(nvl, "peer-list", &peercount); + nvl_peerlist = nvlist_get_nvlist_array(nvl, "peers", &peercount); for (int i = 0; i < peercount; i++, nvl_peerlist++) { - nvl_peer = *nvl_peerlist; - dump_peer(nvl_peer); + dump_peer(*nvl_peerlist); } } static void -peerfinish(int s, void *arg) +wgfinish(int s, void *arg) { - nvlist_t *nvl, **nvl_array; void *packed; size_t size; + static nvlist_t *nvl_dev; + + nvl_dev = nvl_device(); + if (nvl_peer != NULL) { + if (!nvlist_exists_binary(nvl_peer, "public-key")) + errx(1, "must specify a public-key for adding peer"); + if (allowed_ips_count != 0) { + nvlist_add_nvlist_array(nvl_peer, "allowed-ips", + (const nvlist_t * const *)allowed_ips, + allowed_ips_count); + for (size_t i = 0; i < allowed_ips_count; i++) { + nvlist_destroy(allowed_ips[i]); + } + + free(allowed_ips); + } + + nvlist_add_nvlist_array(nvl_dev, "peers", + (const nvlist_t * const *)&nvl_peer, 1); + } + + packed = nvlist_pack(nvl_dev, &size); - if ((nvl = nvlist_create(0)) == NULL) - errx(1, "failed to allocate nvlist"); - if ((nvl_array = calloc(sizeof(void *), 1)) == NULL) - errx(1, "failed to allocate nvl_array"); - if (!nvlist_exists_binary(nvl_params, "public-key")) - errx(1, "must specify a public-key for adding peer"); - if (allowed_ips_count == 0) - errx(1, "must specify at least one range of allowed-ips to add a peer"); - - nvl_array[0] = nvl_params; - nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const *)nvl_array, 1); - packed = nvlist_pack(nvl, &size); - - if (do_cmd(s, WGC_SET, packed, size, true)) - errx(1, "failed to install peer"); + if (do_cmd(s, SIOCSWG, packed, size, true)) + errx(1, "failed to configure"); } static DECL_CMD_FUNC(peerstart, val, d) { - do_peer = true; - callback_register(peerfinish, NULL); - allowed_ips = malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); + + if (nvl_peer != NULL) + errx(1, "cannot both add and remove a peer"); + register_wgfinish(); + nvl_peer = nvlist_create(0); + allowed_ips = calloc(ALLOWEDIPS_START, sizeof(*allowed_ips)); allowed_ips_max = ALLOWEDIPS_START; if (allowed_ips == NULL) errx(1, "failed to allocate array for allowedips"); } +static +DECL_CMD_FUNC(peerdel, val, d) +{ + + if (nvl_peer != NULL) + errx(1, "cannot both add and remove a peer"); + register_wgfinish(); + nvl_peer = nvlist_create(0); + nvlist_add_bool(nvl_peer, "remove", true); +} + static DECL_CMD_FUNC(setwglistenport, val, d) { @@ -454,39 +531,53 @@ DECL_CMD_FUNC(setwglistenport, val, d) errx(1, "unknown family"); } ul = ntohs((u_short)ul); - nvlist_add_number(nvl_params, "listen-port", ul); + nvlist_add_number(nvl_device(), "listen-port", ul); } static DECL_CMD_FUNC(setwgprivkey, val, d) { - uint8_t key[WG_KEY_LEN]; + uint8_t key[WG_KEY_SIZE]; if (!key_from_base64(key, val)) errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); + nvlist_add_binary(nvl_device(), "private-key", key, WG_KEY_SIZE); } static DECL_CMD_FUNC(setwgpubkey, val, d) { - uint8_t key[WG_KEY_LEN]; + uint8_t key[WG_KEY_SIZE]; - if (!do_peer) + if (nvl_peer == NULL) errx(1, "setting public key only valid when adding peer"); if (!key_from_base64(key, val)) errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); + nvlist_add_binary(nvl_peer, "public-key", key, WG_KEY_SIZE); } +static +DECL_CMD_FUNC(setwgpresharedkey, val, d) +{ + uint8_t key[WG_KEY_SIZE]; + + if (nvl_peer == NULL) + errx(1, "setting preshared-key only valid when adding peer"); + + if (!key_from_base64(key, val)) + errx(1, "invalid key %s", val); + nvlist_add_binary(nvl_peer, "preshared-key", key, WG_KEY_SIZE); +} + + static DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) { unsigned long persistent_keepalive; char *endp; - if (!do_peer) + if (nvl_peer == NULL) errx(1, "setting persistent keepalive only valid when adding peer"); errno = 0; @@ -496,7 +587,7 @@ DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) if (persistent_keepalive > USHRT_MAX) errx(1, "persistent-keepalive '%lu' too large", persistent_keepalive); - nvlist_add_number(nvl_params, "persistent-keepalive-interval", + nvlist_add_number(nvl_peer, "persistent-keepalive-interval", persistent_keepalive); } @@ -506,45 +597,57 @@ DECL_CMD_FUNC(setallowedips, val, d) char *base, *allowedip, *mask; u_long ul; char *endp; - struct allowedip *aip; + struct allowedip aip; + nvlist_t *nvl_aip; + uint16_t family; - if (!do_peer) + if (nvl_peer == NULL) errx(1, "setting allowed ip only valid when adding peer"); if (allowed_ips_count == allowed_ips_max) { - /* XXX grow array */ + allowed_ips_max *= 2; + allowed_ips = reallocarray(allowed_ips, allowed_ips_max, + sizeof(*allowed_ips)); + if (allowed_ips == NULL) + errx(1, "failed to grow allowed ip array"); } - aip = &allowed_ips[allowed_ips_count]; + + allowed_ips[allowed_ips_count] = nvl_aip = nvlist_create(0); + if (nvl_aip == NULL) + errx(1, "failed to create new allowedip nvlist"); + base = allowedip = strdup(val); mask = index(allowedip, '/'); if (mask == NULL) errx(1, "mask separator not found in allowedip %s", val); *mask = '\0'; mask++; - parse_ip(aip, allowedip); + + parse_ip(&aip, &family, allowedip); ul = strtoul(mask, &endp, 0); if (*endp != '\0') errx(1, "invalid value for allowedip mask"); - bzero(&aip->a_mask, sizeof(aip->a_mask)); - if (aip->a_addr.ss_family == AF_INET) - in_len2mask((struct in_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); - else if (aip->a_addr.ss_family == AF_INET6) - in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); - else - errx(1, "invalid address family %d\n", aip->a_addr.ss_family); + + nvlist_add_number(nvl_aip, "cidr", ul); + if (family == AF_INET) { + nvlist_add_binary(nvl_aip, "ipv4", &aip.ip4, sizeof(aip.ip4)); + } else if (family == AF_INET6) { + nvlist_add_binary(nvl_aip, "ipv6", &aip.ip6, sizeof(aip.ip6)); + } else { + /* Shouldn't happen */ + nvlist_destroy(nvl_aip); + goto out; + } + allowed_ips_count++; - if (allowed_ips_count > 1) - nvlist_free_binary(nvl_params, "allowed-ips"); - nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, - allowed_ips_count*sizeof(*aip)); - dump_peer(nvl_params); +out: free(base); } static DECL_CMD_FUNC(setendpoint, val, d) { - if (!do_peer) + if (nvl_peer == NULL) errx(1, "setting endpoint only valid when adding peer"); parse_endpoint(val); } @@ -555,15 +658,15 @@ wireguard_status(int s) size_t size; void *packed; nvlist_t *nvl; - char buf[WG_KEY_LEN_BASE64]; + char buf[WG_KEY_SIZE_BASE64]; const void *key; uint16_t listen_port; - if (get_nvl_out_size(s, WGC_GET, &size)) + if (get_nvl_out_size(s, SIOCGWG, &size)) return; if ((packed = malloc(size)) == NULL) return; - if (do_cmd(s, WGC_GET, packed, size, 0)) + if (do_cmd(s, SIOCGWG, packed, size, 0)) return; nvl = nvlist_unpack(packed, size, 0); if (nvlist_exists_number(nvl, "listen-port")) { @@ -583,10 +686,14 @@ wireguard_status(int s) } static struct cmd wireguard_cmds[] = { - DEF_CLONE_CMD_ARG("listen-port", setwglistenport), - DEF_CLONE_CMD_ARG("private-key", setwgprivkey), + DEF_CMD_ARG("listen-port", setwglistenport), + DEF_CMD_ARG("private-key", setwgprivkey), + /* XXX peer-list is deprecated. */ DEF_CMD("peer-list", 0, peerlist), + DEF_CMD("peers", 0, peerlist), DEF_CMD("peer", 0, peerstart), + DEF_CMD("-peer", 0, peerdel), + DEF_CMD_ARG("preshared-key", setwgpresharedkey), DEF_CMD_ARG("public-key", setwgpubkey), DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), DEF_CMD_ARG("allowed-ips", setallowedips), @@ -602,27 +709,10 @@ static struct afswtch af_wireguard = { static void wg_create(int s, struct ifreq *ifr) { - struct iovec iov; - void *packed; - size_t size; setproctitle("ifconfig %s create ...\n", name); - if (!nvlist_exists_number(nvl_params, "listen-port")) - goto legacy; - if (!nvlist_exists_binary(nvl_params, "private-key")) - goto legacy; - - packed = nvlist_pack(nvl_params, &size); - if (packed == NULL) - errx(1, "failed to setup create request"); - iov.iov_len = size; - iov.iov_base = packed; - ifr->ifr_data = (caddr_t)&iov; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); - return; -legacy: - ifr->ifr_data == NULL; + + ifr->ifr_data = NULL; if (ioctl(s, SIOCIFCREATE, ifr) < 0) err(1, "SIOCIFCREATE"); } @@ -632,7 +722,6 @@ wireguard_ctor(void) { int i; - nvl_params = nvlist_create(0); for (i = 0; i < nitems(wireguard_cmds); i++) cmd_register(&wireguard_cmds[i]); af_register(&af_wireguard); diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 index 335d3e70b64a..29215bd438ff 100644 --- a/share/man/man4/wg.4 +++ b/share/man/man4/wg.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2021 +.Dd March 12, 2021 .Dt WG 4 .Os .Sh NAME @@ -68,7 +68,7 @@ interface. The private key of the .Nm interface. -.It Cm pre-shared-key +.It Cm preshared-key Defines a pre-shared key for the .Nm interface. @@ -76,9 +76,9 @@ interface. A list of allowed IP addresses. .It Cm endpoint The IP address of the WiredGuard to connect to. -.It Cm peer-list +.It Cm peers A list of peering IP addresses to connect to. -.It Cm persistent-keepalive +.It Cm persistent-keepalive-interval Interval, in seconds, at which to send persistent keepalive packets. .El .Pp @@ -188,6 +188,11 @@ Connect to a specific endpoint using its public-key and set the allowed IP addre .Bd -literal -offset indent # ifconfig wg0 peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100:54321 allowed-ips 192.168.2.100/32 .Ed +.Pp +Remove a peer +.Bd -literal -offset indent +# ifconfig wg0 -peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' +.Ed .Sh DIAGNOSTICS The .Nm @@ -240,14 +245,11 @@ device driver first appeared in .Sh AUTHORS The .Nm -device driver was originally written for -.Ox -by -.An Matt Dunwoodie Aq Mt ncon@nconroy.net -and ported to -.Fx -by -.An Matt Macy Aq Mt mmacy@FreeBSD.org . +device driver written by +.An Jason A. Donenfeld Aq Mt Jason@zx2c4.com , +.An Matt Dunwoodie Aq Mt ncon@nconroy.net , +and +.An Kyle Evans Aq Mt kevans@FreeBSD.org . .Pp This manual page was written by .An Gordon Bergling Aq Mt gbe@FreeBSD.org diff --git a/sys/dev/if_wg/crypto.c b/sys/dev/if_wg/crypto.c new file mode 100644 index 000000000000..f28585429272 --- /dev/null +++ b/sys/dev/if_wg/crypto.c @@ -0,0 +1,1705 @@ +/* + * Copyright (C) 2015-2021 Jason A. Donenfeld . All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include + +#include "crypto.h" + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif +#ifndef noinline +#define noinline __attribute__((noinline)) +#endif +#ifndef __aligned +#define __aligned(x) __attribute__((aligned(x))) +#endif +#ifndef DIV_ROUND_UP +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) +#endif + +#define le32_to_cpup(a) le32toh(*(a)) +#define le64_to_cpup(a) le64toh(*(a)) +#define cpu_to_le32(a) htole32(a) +#define cpu_to_le64(a) htole64(a) + +static inline uint32_t get_unaligned_le32(const uint8_t *a) +{ + uint32_t l; + __builtin_memcpy(&l, a, sizeof(l)); + return le32_to_cpup(&l); +} +static inline uint64_t get_unaligned_le64(const uint8_t *a) +{ + uint64_t l; + __builtin_memcpy(&l, a, sizeof(l)); + return le64_to_cpup(&l); +} +static inline void put_unaligned_le32(uint32_t s, uint8_t *d) +{ + uint32_t l = cpu_to_le32(s); + __builtin_memcpy(d, &l, sizeof(l)); +} +static inline void cpu_to_le32_array(uint32_t *buf, unsigned int words) +{ + while (words--) { + *buf = cpu_to_le32(*buf); + ++buf; + } +} +static inline void le32_to_cpu_array(uint32_t *buf, unsigned int words) +{ + while (words--) { + *buf = le32_to_cpup(buf); + ++buf; + } +} + +static inline uint32_t rol32(uint32_t word, unsigned int shift) +{ + return (word << (shift & 31)) | (word >> ((-shift) & 31)); +} +static inline uint32_t ror32(uint32_t word, unsigned int shift) +{ + return (word >> (shift & 31)) | (word << ((-shift) & 31)); +} + +static void xor_cpy(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, + size_t len) +{ + size_t i; + + for (i = 0; i < len; ++i) + dst[i] = src1[i] ^ src2[i]; +} + +#define QUARTER_ROUND(x, a, b, c, d) ( \ + x[a] += x[b], \ *** 50620 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Mon Mar 15 05:40:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72AFE570C9B; Mon, 15 Mar 2021 05:40:52 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzQJ42ZdWz3r23; Mon, 15 Mar 2021 05:40:52 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pl1-x62b.google.com with SMTP id j6so14720141plx.6; Sun, 14 Mar 2021 22:40:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:message-id:date:mime-version:user-agent:reply-to:subject :content-language:to:references:cc:from:in-reply-to :content-transfer-encoding; bh=LNXi0dWG7+Pj5YkfSA1R0xyRk3hay5DKIgrfW7xexbo=; b=QFXVI14QjtsA39EmRnY+r8noSB/uvas7C4bU1/fAHMtxao7RB1988Hz675aVTl7OZu qC+YIQWKBMklfCcRCYbY5w2AFCXeQJBigN5ZXULxrml6TuBczSb5QuEUrxSBOHKob6zN sOXKNpMeBLIQaItIOcejBzcbZGMSNrjNI8NuxsZ6OrPicNnBHVlGn72zOXKqQoCJsuG+ K+5KyJrpYDsscGRXDQfZR9Dwqab1bL9RX2u5+w8noGJ+nRhNjG8Xs0oJ/Nf3lgW33E0L GtdxZXRrI7DJ6Ys3ClF9SzNjdnq1OO9kyvkP+96RiYC9G14we1Y4JfDPM09DpjCw0NGY P1qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :reply-to:subject:content-language:to:references:cc:from:in-reply-to :content-transfer-encoding; bh=LNXi0dWG7+Pj5YkfSA1R0xyRk3hay5DKIgrfW7xexbo=; b=RkxIqFO1HAmiPdxgxmgvPnavcvhr63McTvpqxB9HYxGOmxXzzwbtaMDEiYkFLynVhj uZlmVdNPQURW9S8CQ4agpVP1LHX8BkDvRXaVm62d4nHCngY0Quy6kqAhqtqBOZZH3GZ5 26wONc1ZUPvDtHQsdD3ef6JWfGNZXB5vEdaXAEwD/cZAA+rclJu5iPhGGxnDxlJhII04 sCHhMq3UWhftWukpuoWSB3aUoomEDTd8IvgraZlQiU5sncqsGz3NBbcWADqwvOGQvhoM newAiitIJSCxlRUkYPmmjlXwl1202xGvo3xw9zW/Yg8Yc7fvqHIQODCReq1qa3mzsZQa Uwww== X-Gm-Message-State: AOAM531rLCw5pAZh0S50KtMd9zCRM5sWoyAuhQqjfBBHIn1POiZF4ScR ThLn6MJ46XeEBUBk+at1MvW+qaGJHpg= X-Google-Smtp-Source: ABdhPJwr+EhfhZ/XJNpiOTOoR1yuPCkMHro55hi6buBbbIMMXkk1Jo16ocb7NgcVyVNq/miDN1AbfQ== X-Received: by 2002:a17:90a:1049:: with SMTP id y9mr10948275pjd.173.1615786850809; Sun, 14 Mar 2021 22:40:50 -0700 (PDT) Received: from localhost (167-179-159-58.a7b39f.syd.nbn.aussiebb.net. [167.179.159.58]) by smtp.gmail.com with UTF8SMTPSA id bk8sm9312647pjb.13.2021.03.14.22.40.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Mar 2021 22:40:50 -0700 (PDT) Sender: Kubilay Kocak Message-ID: <933ecb8e-9c89-2c6f-9442-c9326b12f111@FreeBSD.org> Date: Mon, 15 Mar 2021 16:40:45 +1100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Thunderbird/88.0a1 Reply-To: koobs@FreeBSD.org Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project Content-Language: en-US To: Kyle Evans References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kubilay Kocak In-Reply-To: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DzQJ42ZdWz3r23 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:40:52 -0000 On 15/03/2021 3:52 pm, Kyle Evans wrote: > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > Author: Kyle Evans > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-15 04:52:04 +0000 > > if_wg: import latest fixup work from the wireguard-freebsd project > > This is the culmination of about a week of work from three developers to > fix a number of functional and security issues. This patch consists of > - Many security issues have been addressed > MFC after: 1 month (maybe) Does 'maybe' refer to the MFC period (potentially less or more time), or that it may not be MFC'd? From owner-dev-commits-src-main@freebsd.org Mon Mar 15 05:42:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3945570E30; Mon, 15 Mar 2021 05:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzQKN4kThz3rMS; Mon, 15 Mar 2021 05:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95C5932A5; Mon, 15 Mar 2021 05:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F5g0RD010336; Mon, 15 Mar 2021 05:42:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F5g0qV010335; Mon, 15 Mar 2021 05:42:00 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:42:00 GMT Message-Id: <202103150542.12F5g0qV010335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: e277a507d8f9 - main - tests: netinet: add missing up from local change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e277a507d8f935e2ca6d1022dd1e86a73bcf1982 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:42:00 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e277a507d8f935e2ca6d1022dd1e86a73bcf1982 commit e277a507d8f935e2ca6d1022dd1e86a73bcf1982 Author: Kyle Evans AuthorDate: 2021-03-15 05:24:54 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 05:24:54 +0000 tests: netinet: add missing up from local change --- tests/sys/netinet/if_wg_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/netinet/if_wg_test.sh b/tests/sys/netinet/if_wg_test.sh index 3cf69b035f97..b0ab70108cf4 100644 --- a/tests/sys/netinet/if_wg_test.sh +++ b/tests/sys/netinet/if_wg_test.sh @@ -75,13 +75,13 @@ wg_basic_body() jexec wgtest1 ifconfig $wg1 peer public-key "$pub2" \ endpoint ${endpoint2}:12345 allowed-ips ${tunnel2}/32 atf_check -s exit:0 \ - jexec wgtest1 ifconfig $wg1 inet $tunnel1 + jexec wgtest1 ifconfig $wg1 inet $tunnel1 up atf_check -s exit:0 -o ignore \ jexec wgtest2 ifconfig $wg2 peer public-key "$pub1" \ endpoint ${endpoint1}:12345 allowed-ips ${tunnel1}/32 atf_check -s exit:0 \ - jexec wgtest2 ifconfig $wg2 inet $tunnel2 + jexec wgtest2 ifconfig $wg2 inet $tunnel2 up # Generous timeout since the handshake takes some time. atf_check -s exit:0 -o ignore jexec wgtest1 ping -o -t 5 -i 0.25 $tunnel2 From owner-dev-commits-src-main@freebsd.org Mon Mar 15 05:42:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29ADE570C59; Mon, 15 Mar 2021 05:42:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzQKP6JzJz3rMW; Mon, 15 Mar 2021 05:42:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC1AE2BFA; Mon, 15 Mar 2021 05:42:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F5g1u9010357; Mon, 15 Mar 2021 05:42:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F5g1A8010356; Mon, 15 Mar 2021 05:42:01 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:42:01 GMT Message-Id: <202103150542.12F5g1A8010356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 11704859477c - main - if_wg: fix the !INET6 support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11704859477cdb75a077807f53132be4d518e7f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:42:02 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=11704859477cdb75a077807f53132be4d518e7f5 commit 11704859477cdb75a077807f53132be4d518e7f5 Author: Kyle Evans AuthorDate: 2021-03-15 05:38:22 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 05:41:38 +0000 if_wg: fix the !INET6 support INET is still required, so formally don't build it in !INET configurations. --- sys/dev/if_wg/if_wg.c | 6 ++++++ sys/modules/Makefile | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/if_wg/if_wg.c b/sys/dev/if_wg/if_wg.c index ba2eb3221fac..c0b3ecdaa002 100644 --- a/sys/dev/if_wg/if_wg.c +++ b/sys/dev/if_wg/if_wg.c @@ -1102,11 +1102,13 @@ wg_send(struct wg_softc *sc, struct wg_endpoint *e, struct mbuf *m) control = sbcreatecontrol((caddr_t)&e->e_local.l_in, sizeof(struct in_addr), IP_SENDSRCADDR, IPPROTO_IP); +#ifdef INET6 } else if (e->e_remote.r_sa.sa_family == AF_INET6) { if (!IN6_IS_ADDR_UNSPECIFIED(&e->e_local.l_in6)) control = sbcreatecontrol((caddr_t)&e->e_local.l_pktinfo6, sizeof(struct in6_pktinfo), IPV6_PKTINFO, IPPROTO_IPV6); +#endif } else { m_freem(m); return (EAFNOSUPPORT); @@ -2296,7 +2298,9 @@ wg_update_endpoint_addrs(struct wg_endpoint *e, const struct sockaddr *srcsa, struct ifnet *rcvif) { const struct sockaddr_in *sa4; +#ifdef INET6 const struct sockaddr_in6 *sa6; +#endif int ret = 0; /* @@ -2307,10 +2311,12 @@ wg_update_endpoint_addrs(struct wg_endpoint *e, const struct sockaddr *srcsa, sa4 = (const struct sockaddr_in *)srcsa; e->e_remote.r_sin = sa4[0]; e->e_local.l_in = sa4[1].sin_addr; +#ifdef INET6 } else if (srcsa->sa_family == AF_INET6) { sa6 = (const struct sockaddr_in6 *)srcsa; e->e_remote.r_sin6 = sa6[0]; e->e_local.l_in6 = sa6[1].sin6_addr; +#endif } else { ret = EAFNOSUPPORT; } diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 781495110cb9..32919674901b 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -163,7 +163,7 @@ SUBDIR= \ if_tuntap \ if_vlan \ if_vxlan \ - if_wg \ + ${_if_wg} \ iflib \ ${_iir} \ imgact_binmisc \ @@ -456,6 +456,10 @@ _sctp= sctp _if_stf= if_stf .endif +.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) +_if_wg= if_wg +.endif + .if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) _if_me= if_me _ipdivert= ipdivert From owner-dev-commits-src-main@freebsd.org Mon Mar 15 05:47:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49681570F5A; Mon, 15 Mar 2021 05:47:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzQRC1WdTz3rlG; Mon, 15 Mar 2021 05:47:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 209BF263FB; Mon, 15 Mar 2021 05:47:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f180.google.com with SMTP id 73so8341326qtg.13; Sun, 14 Mar 2021 22:47:03 -0700 (PDT) X-Gm-Message-State: AOAM530zyGDI6eo3IQB43nbWzZr17tUSJApM4siO0AllTZzZrVkLZN87 469rno0BubsYYR2n1ngfX+kujmquO4o2Wdp2lWw= X-Google-Smtp-Source: ABdhPJz7JJIvJq+6R2ikf92ztmWukYa77bHUSp+wWDKWsbmRy3LmZXCpIlnfsQ4HZc6TLHp9QzUbBB9LsGPNLBVIvLI= X-Received: by 2002:ac8:7a69:: with SMTP id w9mr10894242qtt.60.1615787222656; Sun, 14 Mar 2021 22:47:02 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <933ecb8e-9c89-2c6f-9442-c9326b12f111@FreeBSD.org> In-Reply-To: <933ecb8e-9c89-2c6f-9442-c9326b12f111@FreeBSD.org> From: Kyle Evans Date: Sun, 14 Mar 2021 22:46:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Kubilay Kocak Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:47:03 -0000 On Sun, Mar 14, 2021 at 10:40 PM Kubilay Kocak wrote: > > On 15/03/2021 3:52 pm, Kyle Evans wrote: > > The branch main has been updated by kevans: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 > > > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > > Author: Kyle Evans > > AuthorDate: 2021-03-15 02:25:40 +0000 > > Commit: Kyle Evans > > CommitDate: 2021-03-15 04:52:04 +0000 > > > > if_wg: import latest fixup work from the wireguard-freebsd project > > > > This is the culmination of about a week of work from three developers to > > fix a number of functional and security issues. This patch consists of > > > > > - Many security issues have been addressed > > > > > MFC after: 1 month (maybe) > > Does 'maybe' refer to the MFC period (potentially less or more time), or > that it may not be MFC'd? > Hi, The time here is the variable. It will get merged back because it needs to be, but it won't be happening this week and probably not next week either to give it ample bake time. Thank, Kyle Evans From owner-dev-commits-src-main@freebsd.org Mon Mar 15 06:28:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA35F571A7C; Mon, 15 Mar 2021 06:28:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzRMN5MrJz3tw2; Mon, 15 Mar 2021 06:28:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB50B394A; Mon, 15 Mar 2021 06:28:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F6SmSY067510; Mon, 15 Mar 2021 06:28:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F6SmTr067509; Mon, 15 Mar 2021 06:28:48 GMT (envelope-from git) Date: Mon, 15 Mar 2021 06:28:48 GMT Message-Id: <202103150628.12F6SmTr067509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 99158c7fbd56 - main - if_wg: stop holding creds in wg_socket_init() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99158c7fbd565e0898ee31f47bbdf091e0c853d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 06:28:48 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=99158c7fbd565e0898ee31f47bbdf091e0c853d8 commit 99158c7fbd565e0898ee31f47bbdf091e0c853d8 Author: Kyle Evans AuthorDate: 2021-03-15 06:21:25 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 06:21:25 +0000 if_wg: stop holding creds in wg_socket_init() We're now xlocked when we create sockets, so we're now guaranteed that the creds won't be released out from underneath us over in wg_prison_remove(). --- sys/dev/if_wg/if_wg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/dev/if_wg/if_wg.c b/sys/dev/if_wg/if_wg.c index c0b3ecdaa002..4d5c66133a8f 100644 --- a/sys/dev/if_wg/if_wg.c +++ b/sys/dev/if_wg/if_wg.c @@ -953,9 +953,8 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) sx_assert(&sc->sc_lock, SX_XLOCKED); td = curthread; - if (sc->sc_ucred == NULL) + if ((cred = sc->sc_ucred) == NULL) return (EBUSY); - cred = crhold(sc->sc_ucred); /* * For socket creation, we use the creds of the thread that created the @@ -993,7 +992,6 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) wg_socket_set(sc, so4, so6); } out: - crfree(cred); return (rc); } From owner-dev-commits-src-main@freebsd.org Mon Mar 15 06:28:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA332571CD3; Mon, 15 Mar 2021 06:28:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzRMP5twMz3tyn; Mon, 15 Mar 2021 06:28:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCCB1394B; Mon, 15 Mar 2021 06:28:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F6SntS067533; Mon, 15 Mar 2021 06:28:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F6SnTP067532; Mon, 15 Mar 2021 06:28:49 GMT (envelope-from git) Date: Mon, 15 Mar 2021 06:28:49 GMT Message-Id: <202103150628.12F6SnTP067532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 25529f11cff8 - main - if_wg: close the sockets if wg_socket_bind() failed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25529f11cff891139bbddb257f54fcd67c1b3ef7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 06:28:49 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=25529f11cff891139bbddb257f54fcd67c1b3ef7 commit 25529f11cff891139bbddb257f54fcd67c1b3ef7 Author: Kyle Evans AuthorDate: 2021-03-15 06:23:56 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 06:23:56 +0000 if_wg: close the sockets if wg_socket_bind() failed This fixes the remaining cred leak that prevented jails from fully dying in some error cases. --- sys/dev/if_wg/if_wg.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/dev/if_wg/if_wg.c b/sys/dev/if_wg/if_wg.c index 4d5c66133a8f..8c11cc58a3bb 100644 --- a/sys/dev/if_wg/if_wg.c +++ b/sys/dev/if_wg/if_wg.c @@ -952,6 +952,7 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) sx_assert(&sc->sc_lock, SX_XLOCKED); + so4 = so6 = NULL; td = curthread; if ((cred = sc->sc_ucred) == NULL) return (EBUSY); @@ -965,7 +966,7 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) * to the network. */ rc = socreate(AF_INET, &so4, SOCK_DGRAM, IPPROTO_UDP, cred, td); - if (rc) + if (rc != 0) goto out; rc = udp_set_kernel_tunneling(so4, wg_input, NULL, sc); @@ -976,11 +977,8 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) MPASS(rc == 0); rc = socreate(AF_INET6, &so6, SOCK_DGRAM, IPPROTO_UDP, cred, td); - if (rc) { - SOCK_LOCK(so4); - sofree(so4); + if (rc != 0) goto out; - } rc = udp_set_kernel_tunneling(so6, wg_input, NULL, sc); MPASS(rc == 0); @@ -992,6 +990,12 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) wg_socket_set(sc, so4, so6); } out: + if (rc != 0) { + if (so4 != NULL) + soclose(so4); + if (so6 != NULL) + soclose(so6); + } return (rc); } From owner-dev-commits-src-main@freebsd.org Mon Mar 15 09:10:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EED9D5759DD; Mon, 15 Mar 2021 09:10:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzVyV6SNYz4Y2n; Mon, 15 Mar 2021 09:10:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1108600D; Mon, 15 Mar 2021 09:10:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F9Aw2T086677; Mon, 15 Mar 2021 09:10:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F9AwU7086676; Mon, 15 Mar 2021 09:10:58 GMT (envelope-from git) Date: Mon, 15 Mar 2021 09:10:58 GMT Message-Id: <202103150910.12F9AwU7086676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: 16b2290447de - main - wlandebug.8: remove Xref for missing manpages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16b2290447de6af652f8eee1f585be8f94b30082 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 09:10:59 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=16b2290447de6af652f8eee1f585be8f94b30082 commit 16b2290447de6af652f8eee1f585be8f94b30082 Author: Fernando Apesteguía AuthorDate: 2021-03-03 06:48:11 +0000 Commit: Fernando Apesteguía CommitDate: 2021-03-15 09:04:13 +0000 wlandebug.8: remove Xref for missing manpages Remove references for: athdebug(8), athstats(8) and wlanstats(8) Those are tools in the tools/ directory that are not built as part of the base system. According to the toolds/README file: "...these tools are not meant to be built as part of the standard system..." Even more, the tools/tools/README is not udpated and wlanstats does not even built on current: error: cast from 'struct sockaddr *' to 'const struct sockaddr_dl *' increases required alignment from 1 to 2 [-Werror,-Wcast-align] PR: 227174 Reported by: freebsd.org@alexandrews.me.uk Reviewed by: gbe@ adrian@ Approved by: gbe@ (mentor) adrian@ Differential Revision: https://reviews.freebsd.org/D29033 --- usr.sbin/wlandebug/wlandebug.8 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.sbin/wlandebug/wlandebug.8 b/usr.sbin/wlandebug/wlandebug.8 index 0640eff01b20..28fb904306e9 100644 --- a/usr.sbin/wlandebug/wlandebug.8 +++ b/usr.sbin/wlandebug/wlandebug.8 @@ -153,10 +153,12 @@ The following might be used to debug basic station mode operation: it enables debug messages while scanning, authenticating to an access point, and associating to an access point. .Sh SEE ALSO -.Xr athdebug 8 , -.Xr athstats 8 , -.Xr ifconfig 8 , -.Xr wlanstats 8 +.Xr ifconfig 8 +.Pp +The +.Pa /usr/src/tools +directory contains some utilities that might be relevant to debug wireless +issues. .Sh NOTES Different wireless drivers support different debugging messages. Drivers such as From owner-dev-commits-src-main@freebsd.org Mon Mar 15 10:34:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 400DE5777BE; Mon, 15 Mar 2021 10:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzXpm18w9z4dZt; Mon, 15 Mar 2021 10:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1688F6C64; Mon, 15 Mar 2021 10:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FAYNw6097450; Mon, 15 Mar 2021 10:34:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FAYNl0097449; Mon, 15 Mar 2021 10:34:23 GMT (envelope-from git) Date: Mon, 15 Mar 2021 10:34:23 GMT Message-Id: <202103151034.12FAYNl0097449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 805dbff6c36a - main - Hyper-V: hn: Initialize the internal field of per packet info on tx path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 805dbff6c36a6cd84491aa53a02315fa025734cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 10:34:24 -0000 The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=805dbff6c36a6cd84491aa53a02315fa025734cc commit 805dbff6c36a6cd84491aa53a02315fa025734cc Author: Wei Hu AuthorDate: 2021-03-15 10:20:52 +0000 Commit: Wei Hu CommitDate: 2021-03-15 10:33:29 +0000 Hyper-V: hn: Initialize the internal field of per packet info on tx path The RSC support feature introduced a bit field "rm_internal" in struct rndis_pktinfo with total size unchanged. The guest does not use this field in the tx path. However we need to initialize it to zero in case older hosts which are not aware of this field. Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support") MFC after: 2 weeks Sponsored by: Microsoft --- sys/dev/hyperv/netvsc/if_hn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index f4bdbb1ee788..cd0b5a5fa8b9 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -2932,6 +2932,7 @@ hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, pi->rm_size = pi_size; pi->rm_type = pi_type; + pi->rm_internal = 0; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; return (pi->rm_data); From owner-dev-commits-src-main@freebsd.org Mon Mar 15 11:02:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30AB25784D2; Mon, 15 Mar 2021 11:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzYQn0y4Cz4gCy; Mon, 15 Mar 2021 11:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1403F74C8; Mon, 15 Mar 2021 11:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FB29Hb037446; Mon, 15 Mar 2021 11:02:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FB299J037445; Mon, 15 Mar 2021 11:02:09 GMT (envelope-from git) Date: Mon, 15 Mar 2021 11:02:09 GMT Message-Id: <202103151102.12FB299J037445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: f619b21d0f42 - main - stress2: Fix usage of unitializer data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f619b21d0f42dfef1c82f4d4f0187ed5b563d69e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 11:02:09 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=f619b21d0f42dfef1c82f4d4f0187ed5b563d69e commit f619b21d0f42dfef1c82f4d4f0187ed5b563d69e Author: Peter Holm AuthorDate: 2021-03-15 11:00:01 +0000 Commit: Peter Holm CommitDate: 2021-03-15 11:00:01 +0000 stress2: Fix usage of unitializer data --- tools/test/stress2/misc/setuid.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/test/stress2/misc/setuid.sh b/tools/test/stress2/misc/setuid.sh index 4703ffe68e77..770c20366f7d 100755 --- a/tools/test/stress2/misc/setuid.sh +++ b/tools/test/stress2/misc/setuid.sh @@ -86,7 +86,7 @@ EOF int main(int argc, char **argv) { - char *av[4]; + char *av[2]; int fd; if (argc == 1) @@ -112,9 +112,8 @@ main(int argc, char **argv) if (chdir("/") != 0) err(1, "chdir"); - av[0] = "nop"; - av[1] = "nop"; - av[3] = 0; + av[0] = "/nop"; + av[1] = 0; if (execve(av[0], av, NULL) == -1) err(1, "execve"); From owner-dev-commits-src-main@freebsd.org Mon Mar 15 11:17:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8458578965; Mon, 15 Mar 2021 11:17:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzYmX5Rn0z4h1D; Mon, 15 Mar 2021 11:17:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8D5E7636; Mon, 15 Mar 2021 11:17:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FBHWgK051428; Mon, 15 Mar 2021 11:17:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FBHW4W051427; Mon, 15 Mar 2021 11:17:32 GMT (envelope-from git) Date: Mon, 15 Mar 2021 11:17:32 GMT Message-Id: <202103151117.12FBHW4W051427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: cefb959e18ef - main - stress2: Update expetced errno MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cefb959e18efd7da76724fdacdfb7031ec06fa94 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 11:17:33 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=cefb959e18efd7da76724fdacdfb7031ec06fa94 commit cefb959e18efd7da76724fdacdfb7031ec06fa94 Author: Peter Holm AuthorDate: 2021-03-15 11:16:52 +0000 Commit: Peter Holm CommitDate: 2021-03-15 11:16:52 +0000 stress2: Update expetced errno --- tools/test/stress2/misc/beneath4.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test/stress2/misc/beneath4.sh b/tools/test/stress2/misc/beneath4.sh index f1a5c8817662..0f51980cb75a 100755 --- a/tools/test/stress2/misc/beneath4.sh +++ b/tools/test/stress2/misc/beneath4.sh @@ -124,8 +124,8 @@ $dir/beneath4 $top c 0x2000 0 || s=1 $dir/beneath4 $top d 0x2000 93 || s=1 $dir/beneath4 $top e 0x2000 93 || s=1 $dir/beneath4 $top fifo 0x2000 0 || s=1 -$dir/beneath4 $top $top/../../beneath4.d/a/a 0x2000 22 || s=1 -$dir/beneath4 $top $top/.. 0x2000 22 || s=1 +$dir/beneath4 $top $top/../../beneath4.d/a/a 0x2000 93 || s=1 +$dir/beneath4 $top $top/.. 0x2000 93 || s=1 $dir/beneath4 $top ../a 0x2000 93 || s=1 printf "\nNo flag\n" $dir/beneath4 $top ../a 0x0000 0 || s=1 From owner-dev-commits-src-main@freebsd.org Mon Mar 15 12:36:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 090DD57AD4E; Mon, 15 Mar 2021 12:36:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzbWL6nzpz4mCC; Mon, 15 Mar 2021 12:36:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D77A110B23; Mon, 15 Mar 2021 12:36:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FCaENg057612; Mon, 15 Mar 2021 12:36:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FCaE8X057611; Mon, 15 Mar 2021 12:36:14 GMT (envelope-from git) Date: Mon, 15 Mar 2021 12:36:14 GMT Message-Id: <202103151236.12FCaE8X057611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: ff92a03616c5 - main - if_wg: fix build with DIAGNOSTICS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff92a03616c5caec5ce0c42dd76722e1b6dc9e51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 12:36:15 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ff92a03616c5caec5ce0c42dd76722e1b6dc9e51 commit ff92a03616c5caec5ce0c42dd76722e1b6dc9e51 Author: Kyle Evans AuthorDate: 2021-03-15 12:31:09 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 12:36:02 +0000 if_wg: fix build with DIAGNOSTICS This file got resynced with OpenBSD to pick up fixes that had taken place after the version initially ported to FreeBSD. KASSERT there is more like MPASS here. Reported by: David Wolfskill --- sys/dev/if_wg/wg_noise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/if_wg/wg_noise.c b/sys/dev/if_wg/wg_noise.c index 373a8578a9f3..ae527eb99bde 100644 --- a/sys/dev/if_wg/wg_noise.c +++ b/sys/dev/if_wg/wg_noise.c @@ -784,10 +784,10 @@ noise_kdf(uint8_t *a, uint8_t *b, uint8_t *c, const uint8_t *x, uint8_t sec[BLAKE2S_HASH_SIZE]; #ifdef DIAGNOSTIC - KASSERT(a_len <= BLAKE2S_HASH_SIZE && b_len <= BLAKE2S_HASH_SIZE && + MPASS(a_len <= BLAKE2S_HASH_SIZE && b_len <= BLAKE2S_HASH_SIZE && c_len <= BLAKE2S_HASH_SIZE); - KASSERT(!(b || b_len || c || c_len) || (a && a_len)); - KASSERT(!(c || c_len) || (b && b_len)); + MPASS(!(b || b_len || c || c_len) || (a && a_len)); + MPASS(!(c || c_len) || (b && b_len)); #endif /* Extract entropy from "x" into sec */ From owner-dev-commits-src-main@freebsd.org Mon Mar 15 13:20:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F245B57BC56; Mon, 15 Mar 2021 13:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzcVN6c1Gz4p9w; Mon, 15 Mar 2021 13:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D566D11235; Mon, 15 Mar 2021 13:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FDKSHN021943; Mon, 15 Mar 2021 13:20:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FDKS9b021942; Mon, 15 Mar 2021 13:20:28 GMT (envelope-from git) Date: Mon, 15 Mar 2021 13:20:28 GMT Message-Id: <202103151320.12FDKS9b021942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: ff5272ca7149 - main - xen/xenusb: always include xen/xen-os.h rather than machine/xen/xen-os.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff5272ca714906c99df5502781d261c688f003ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 13:20:29 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=ff5272ca714906c99df5502781d261c688f003ac commit ff5272ca714906c99df5502781d261c688f003ac Author: Julien Grall AuthorDate: 2021-03-15 11:15:47 +0000 Commit: Roger Pau Monné CommitDate: 2021-03-15 13:20:21 +0000 xen/xenusb: always include xen/xen-os.h rather than machine/xen/xen-os.h Fix compilation since machine/xen/xen-os.h is requiring definition existing in xen/xen-os.h. In general machine/xen/xen-os.h should never be included Submitted by: Elliott Mitchell Reviewed by: royger Differential revision: https://reviews.freebsd.org/D29043 --- sys/xen/xenbus/xenbusb.c | 2 +- sys/xen/xenbus/xenbusb_back.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/xen/xenbus/xenbusb.c b/sys/xen/xenbus/xenbusb.c index 3e49dfd9424c..74e095f6cda2 100644 --- a/sys/xen/xenbus/xenbusb.c +++ b/sys/xen/xenbus/xenbusb.c @@ -67,9 +67,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include diff --git a/sys/xen/xenbus/xenbusb_back.c b/sys/xen/xenbus/xenbusb_back.c index 9beb1f6cdae1..e81d326e7a26 100644 --- a/sys/xen/xenbus/xenbusb_back.c +++ b/sys/xen/xenbus/xenbusb_back.c @@ -51,9 +51,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include From owner-dev-commits-src-main@freebsd.org Mon Mar 15 13:20:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4146657BBE9; Mon, 15 Mar 2021 13:20:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzcVQ0K7Dz4p9y; Mon, 15 Mar 2021 13:20:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F152411591; Mon, 15 Mar 2021 13:20:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FDKTfj021964; Mon, 15 Mar 2021 13:20:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FDKT9h021963; Mon, 15 Mar 2021 13:20:29 GMT (envelope-from git) Date: Mon, 15 Mar 2021 13:20:29 GMT Message-Id: <202103151320.12FDKT9h021963@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: b55c0d5f56bd - main - xen: move x86-specific xen_vector_callback_enabled to sys/x86 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b55c0d5f56bde414b2c9842c23deaa30ab17e474 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 13:20:30 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=b55c0d5f56bde414b2c9842c23deaa30ab17e474 commit b55c0d5f56bde414b2c9842c23deaa30ab17e474 Author: Julien Grall AuthorDate: 2021-03-15 11:27:36 +0000 Commit: Roger Pau Monné CommitDate: 2021-03-15 13:20:21 +0000 xen: move x86-specific xen_vector_callback_enabled to sys/x86 This is x86-only and so should not be in the common area. Submitted by: Elliott Mitchell Reviewed by: royger Differential revision: https://reviews.freebsd.org/D29040 --- sys/x86/include/xen/xen-os.h | 3 +++ sys/xen/xen_intr.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 115310520af0..86bacadc8521 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -33,6 +33,9 @@ /* Everything below this point is not included by assembler (.S) files. */ #ifndef __ASSEMBLY__ +/* If non-zero, the hypervisor has been configured to use a direct vector */ +extern int xen_vector_callback_enabled; + #endif /* !__ASSEMBLY__ */ #endif /* _MACHINE_X86_XEN_XEN_OS_H_ */ diff --git a/sys/xen/xen_intr.h b/sys/xen/xen_intr.h index 4aa4a9a8b8ea..74570267364d 100644 --- a/sys/xen/xen_intr.h +++ b/sys/xen/xen_intr.h @@ -38,9 +38,6 @@ /** Registered Xen interrupt callback handle. */ typedef void * xen_intr_handle_t; -/** If non-zero, the hypervisor has been configured to use a direct vector */ -extern int xen_vector_callback_enabled; - void xen_intr_handle_upcall(struct trapframe *trap_frame); /** From owner-dev-commits-src-main@freebsd.org Mon Mar 15 14:56:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A76657E1A5; Mon, 15 Mar 2021 14:56:59 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dzfdk6Tk5z3CXZ; Mon, 15 Mar 2021 14:56:58 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 937A55C00E3; Mon, 15 Mar 2021 10:56:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 Mar 2021 10:56:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm2; bh=I z/HfmDmhCXGIeQ+wCMMBJ9kvEl89sfJq0HJT8Mfycc=; b=ffRZGX2Jg/6EEFceu OOQddJftEJ1Gqzo/GM0haopDh8lpb7EKrefmsnw1OsdoDn9VCz+ct6jgYl6newAo 9WFF8YOaoxJ9ToZCQNWsx0F44GtyGS8VeLcvf4idx1vY74vBHcL9tZMM3Km/0XNv 1u5e32DK7CpTdiZrwn3id5VG4LeODHnjwUIyHjpm7c5ZKq8D03Ny819VJ3m4Q7he 53uA1yRqmaEuITulxGoGgvjsbNEm6R7NMuuFDF8bzMzEkSnUUrHYC5BG/XjhcYYj J3LV4fJVo3h/26C8RLQt5KNDvl0zE/QhGjTILORmk+PNR9y4FPfMqbwR8N6XH1+2 D7jwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Iz/HfmDmhCXGIeQ+wCMMBJ9kvEl89sfJq0HJT8Mfy cc=; b=CnwLLndov35yrxY+Vjs7BPh6819fvhlXxyTuxLbVb6FOeCyEZtAMYAc+9 Aefusbdtpn9XY6sURDLBcdf+r3OViWZBpbm7gWjDmYKGWSKbOciWTHmoq2+Y0k0v rrdC2Och9J7/Nh7dppigWPAVYogc0oM6V8ymNqn/nPq5iFeurRjVJdWPOSi5JHxb gOYSxLsD3xI16t+yeT23B7lyUQoZ+YvPfq2FfORiVkN9ZadX2VxPeeaHl596/FGL XEbkSWVws4j0s67vNzsC1r29tTkOxmMoyoWX1Rak/tOeHnDZmNs4MnYxZz3flfgP 33ddpN99X83hreNvpSwzrVC/kVI9w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddvledgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecuggftrfgrthhtvg hrnhepudduveekheehiedukeekleelvedufeevfeetudfgtdffteffleehheffueffgfeh necuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrdegiedrkeelrddvud efnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgt ohhtthhlsehsrghmshgtohdrohhrgh X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id C11CC24005C; Mon, 15 Mar 2021 10:56:56 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project From: Scott Long In-Reply-To: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> Date: Mon, 15 Mar 2021 08:56:56 -0600 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> To: Kyle Evans X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4Dzfdk6Tk5z3CXZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 14:56:59 -0000 Here is the response I sent to you and Donenfeld in private. I won=E2=80=99= t include my direct conversation with you from Slack/IRC, but I made my concerns and objections pretty clear. This commit is quite disappointing. See = below: The good: - I=E2=80=99m happy that the community is taking a strong interest in = wireguard in FreeBSD. More hands make light work, and all that, and it=E2=80=99s = why we participate in open source. - I was excited that some of the issues that people have complained about were getting addressed, like packet queueing during re-keying. I know that vnet/jail was a sore spot, and while it=E2=80=99s not = something that Netgate depends on, I knew that it=E2=80=99s important to the community. - I was happy to hear that there=E2=80=99s going to be a new = wireguard-tools with =E2=80=9Cofficial=E2=80=9D FreebSD support. Again, growing = ecosystem, community interest, collaborative work. - I was happy to learn about the test code being ported to FreeBSD. We=E2=80=99re ramping up major resources into testing, and I want to get = my hands on anything and everything that will improve quality and drive better development. The bad: - I want to be pragmatic about code APIs. Maybe iflib isn=E2=80=99t = ready for pseudo interfaces yet, and fixing it is non-trivial and out of scope. Going back to ifnet puts it back in line with openbsd and likely does fix the vnet problems. However, it=E2=80=99s a radical change to the = driver, and not something that I can support as a last-minute action for FreeBSD 13.0 or for pfSense. Therefore, I=E2=80=99m advising against its = immediate inclusion. The final choice is not mine to make for FreeBSD, but that=E2=80=99s my recommendation. For pfSense, I=E2=80=99ll be = discussing this with the rest of the engineering staff on Monday. - The LKML wouldn=E2=80=99t accept this kind of submission, they=E2=80=99d= insist that it be broken down into consumable pieces, and that bug fixes be considered and provided that don=E2=80=99t rely on massive re-writes. = I=E2=80=99ve been dealing with linux for 20+ years and BSD for almost 30 years, and I=E2=80=99ve got to say that despite my distaste for how the LKML is = run, they get results. Does fixing a segfault or packet drop/reorder require the removal of iflib? The Ugly: - An accusation was made, tonight, to me, that the code Netgate=20 sponsored was not reviewed and was shoved into the tree at the last minute. This grossly ignores the actual history to the point of weakening my tolerance for this entire discussion. It shows a pretty irrational bias against mmacy and Netgate and a gross ignorance of the history and provenience of the work. - The Netgate copyright was unilaterally removed. Yes, it was re- instated a few minutes ago, and with good reason. Please don=E2=80=99t do that again. - The removal of the ASM crypto bits really confuses me. An accusation was made, again tonight, that Netgate merely paid to benchmark the code, that we contributed nothing to it, and that it=E2=80=99= s bad code that can=E2=80=99t be audited. What I see is that the meat of = the implementation is copyrighted by Jason and others. There=E2=80=99s a modest but non-trivial amount of glue code that has (or had) the Netgate copyright. I=E2=80=99m not going to touch the audit nonsense. I need data here, and I=E2=80=99m not seeing it. There seems to be a lot of bad blood, poor understanding, and misinformation going on. I need all of this bullshit to stop. This is 5000-ish lines of a nice way to get a point-to-point VPN going without the hassle of IPSec or the performance problems of OpenVPN. It=E2=80=99s consuming way more time and energy than it=E2=80=99= s worth to me, and I=E2=80=99d much rather spend time and money to implement OpenVPN DCO and work on profiling and optimizing IPSec. Wireguard is important to Netgate because we recognize that it=E2=80=99s a feature that customers want, we=E2=80=99re committed = to making security accessible, and we strongly believe in open source and FreeBSD. It=E2=80=99s not perfect code, not by a long shot, but I expect better collaboration and communication than what I=E2=80=99m seeing = here. Scott > On Mar 14, 2021, at 10:52 PM, Kyle Evans wrote: >=20 > The branch main has been updated by kevans: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D74ae3f3e33b810248da19004c58b3581= cd367843 >=20 > commit 74ae3f3e33b810248da19004c58b3581cd367843 > Author: Kyle Evans > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-15 04:52:04 +0000 >=20 > if_wg: import latest fixup work from the wireguard-freebsd project >=20 > This is the culmination of about a week of work from three = developers to > fix a number of functional and security issues. This patch = consists of > work done by the following folks: >=20 > - Jason A. Donenfeld > - Matt Dunwoodie > - Kyle Evans >=20 > Notable changes include: > - Packets are now correctly staged for processing once the = handshake has > completed, resulting in less packet loss in the interim. > - Various race conditions have been resolved, particularly w.r.t. = socket > and packet lifetime (panics) > - Various tests have been added to assure correct functionality and > tooling conformance > - Many security issues have been addressed > - if_wg now maintains jail-friendly semantics: sockets are created = in > the interface's home vnet so that it can act as the sole network > connection for a jail > - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 > - if_wg now exports via ioctl a format that is future proof and > complete. It is additionally supported by the upstream > wireguard-tools (which we plan to merge in to base soon) > - if_wg now conforms to the WireGuard protocol and is more closely > aligned with security auditing guidelines >=20 > Note that the driver has been rebased away from using iflib. iflib > poses a number of challenges for a cloned device trying to operate = in a > vnet that are non-trivial to solve and adds complexity to the > implementation for little gain. >=20 > The crypto implementation that was previously added to the tree was = a > super complex integration of what previously appeared in an old out = of > tree Linux module, which has been reduced to crypto.c containing = simple > boring reference implementations. This is part of a near-to-mid = term > goal to work with FreeBSD kernel crypto folks and take advantage of = or > improve accelerated crypto already offered elsewhere. >=20 > There's additional test suite effort underway out-of-tree taking > advantage of the aforementioned jail-friendly semantics to test a = number > of real-world topologies, based on netns.sh. >=20 > Also note that this is still a work in progress; work going further = will > be much smaller in nature. >=20 > MFC after: 1 month (maybe) > --- > etc/mtree/BSD.include.dist | 2 + > include/Makefile | 9 +- > sbin/ifconfig/ifwg.c | 395 +- > share/man/man4/wg.4 | 26 +- > sys/dev/if_wg/crypto.c | 1705 ++++ > sys/dev/if_wg/crypto.h | 114 + > sys/dev/if_wg/if_wg.c | 3454 ++++++++ > sys/dev/if_wg/if_wg.h | 36 + > sys/dev/if_wg/include/crypto/blake2s.h | 56 - > sys/dev/if_wg/include/crypto/curve25519.h | 74 - > sys/dev/if_wg/include/crypto/zinc.h | 15 - > sys/dev/if_wg/include/sys/if_wg_session.h | 89 - > sys/dev/if_wg/include/sys/if_wg_session_vars.h | 319 - > sys/dev/if_wg/include/sys/simd-x86_64.h | 74 - > sys/dev/if_wg/include/sys/support.h | 342 - > sys/dev/if_wg/include/sys/wg_module.h | 121 - > sys/dev/if_wg/include/sys/wg_noise.h | 286 - > sys/dev/if_wg/include/zinc/blake2s.h | 50 - > sys/dev/if_wg/include/zinc/chacha20.h | 68 - > sys/dev/if_wg/include/zinc/chacha20poly1305.h | 48 - > sys/dev/if_wg/include/zinc/curve25519.h | 28 - > sys/dev/if_wg/include/zinc/poly1305.h | 29 - > sys/dev/if_wg/module/blake2s.c | 256 - > sys/dev/if_wg/module/blake2s.h | 58 - > sys/dev/if_wg/module/chacha20-x86_64.S | 2834 ------- > .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 - > .../module/crypto/zinc/chacha20/chacha20-arm.pl | 1227 --- > .../module/crypto/zinc/chacha20/chacha20-arm64.pl | 1163 --- > .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 - > .../module/crypto/zinc/chacha20/chacha20-mips.S | 424 - > .../crypto/zinc/chacha20/chacha20-x86_64-glue.c | 132 - > .../module/crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ---------- > .../if_wg/module/crypto/zinc/chacha20/chacha20.c | 238 - > .../if_wg/module/crypto/zinc/chacha20poly1305.c | 196 - > .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 - > .../module/crypto/zinc/poly1305/poly1305-arm.pl | 1276 --- > .../module/crypto/zinc/poly1305/poly1305-arm64.pl | 974 --- > .../module/crypto/zinc/poly1305/poly1305-donna32.c | 205 - > .../module/crypto/zinc/poly1305/poly1305-donna64.c | 182 - > .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 - > .../module/crypto/zinc/poly1305/poly1305-mips.S | 407 - > .../module/crypto/zinc/poly1305/poly1305-mips64.pl | 467 -- > .../crypto/zinc/poly1305/poly1305-x86_64-glue.c | 171 - > .../module/crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ---------- > .../if_wg/module/crypto/zinc/poly1305/poly1305.c | 163 - > .../if_wg/module/crypto/zinc/selftest/blake2s.c | 2090 ----- > .../if_wg/module/crypto/zinc/selftest/chacha20.c | 2703 ------- > .../module/crypto/zinc/selftest/chacha20poly1305.c | 8443 = -------------------- > .../if_wg/module/crypto/zinc/selftest/curve25519.c | 1315 --- > .../if_wg/module/crypto/zinc/selftest/poly1305.c | 1110 --- > sys/dev/if_wg/module/crypto/zinc/selftest/run.h | 43 - > sys/dev/if_wg/module/curve25519.c | 867 -- > sys/dev/if_wg/module/if_wg_session.c | 1984 ----- > sys/dev/if_wg/module/module.c | 954 --- > sys/dev/if_wg/module/poly1305-x86_64.S | 3021 ------- > sys/dev/if_wg/support.h | 56 + > sys/dev/if_wg/{module =3D> }/wg_cookie.c | 105 +- > sys/dev/if_wg/{include/sys =3D> }/wg_cookie.h | 81 +- > sys/dev/if_wg/{module =3D> }/wg_noise.c | 409 +- > sys/dev/if_wg/wg_noise.h | 191 + > sys/kern/kern_jail.c | 1 + > sys/kern/uipc_socket.c | 11 + > sys/kern/uipc_syscalls.c | 4 +- > sys/modules/if_wg/Makefile | 30 +- > sys/net/if_types.h | 1 + > sys/netinet6/nd6.c | 4 +- > sys/sys/priv.h | 1 + > sys/sys/socketvar.h | 1 + > tests/sys/netinet/Makefile | 10 +- > tests/sys/netinet/if_wg_test.sh | 188 + > 70 files changed, 6333 insertions(+), 43677 deletions(-) >=20 > diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist > index e7784cbb0a47..0f85798815d5 100644 > --- a/etc/mtree/BSD.include.dist > +++ b/etc/mtree/BSD.include.dist > @@ -64,6 +64,8 @@ > .. > iicbus > .. > + if_wg > + .. > io > .. > mfi > diff --git a/include/Makefile b/include/Makefile > index 3a34ddb8aa18..31e207f6b199 100644 > --- a/include/Makefile > +++ b/include/Makefile > @@ -44,7 +44,7 @@ LDIRS=3D bsm cam geom net net80211 netgraph = netinet netinet6 \ > LSUBDIRS=3D cam/ata cam/mmc cam/nvme cam/scsi \ > dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ > dev/hwpmc dev/hyperv \ > - dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ > + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus = dev/pwm \ > dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ > fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ > @@ -170,6 +170,10 @@ NVPAIRDIR=3D ${INCLUDEDIR}/sys > MLX5=3D mlx5io.h > MLX5DIR=3D ${INCLUDEDIR}/dev/mlx5 >=20 > +.PATH: ${SRCTOP}/sys/dev/if_wg > +WG=3D if_wg.h > +WGDIR=3D ${INCLUDEDIR}/dev/if_wg > + > INCSGROUPS=3D INCS \ > ACPICA \ > AGP \ > @@ -182,7 +186,8 @@ INCSGROUPS=3D INCS \ > PCI \ > RPC \ > TEKEN \ > - VERIEXEC > + VERIEXEC \ > + WG >=20 > .if ${MK_IPFILTER} !=3D "no" > INCSGROUPS+=3D IPFILTER > diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c > index 86bacc59f50d..a102f392cf80 100644 > --- a/sbin/ifconfig/ifwg.c > +++ b/sbin/ifconfig/ifwg.c > @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); > #include > #include >=20 > +#include > + > #include > #include > #include > @@ -65,40 +67,60 @@ __FBSDID("$FreeBSD$"); >=20 > #include "ifconfig.h" >=20 > -typedef enum { > - WGC_GET =3D 0x5, > - WGC_SET =3D 0x6, > -} wg_cmd_t; > +static void wgfinish(int s, void *arg); > + > +static bool wgfinish_registered; >=20 > -static nvlist_t *nvl_params; > -static bool do_peer; > static int allowed_ips_count; > static int allowed_ips_max; > -struct allowedip { > - struct sockaddr_storage a_addr; > - struct sockaddr_storage a_mask; > -}; > -struct allowedip *allowed_ips; > +static nvlist_t **allowed_ips, *nvl_peer; >=20 > #define ALLOWEDIPS_START 16 > -#define WG_KEY_LEN 32 > -#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) > -#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) > +#define WG_KEY_SIZE_BASE64 ((((WG_KEY_SIZE) + 2) / 3) * 4 + 1) > +#define WG_KEY_SIZE_HEX (WG_KEY_SIZE * 2 + 1) > #define WG_MAX_STRLEN 64 >=20 > +struct allowedip { > + union { > + struct in_addr ip4; > + struct in6_addr ip6; > + }; > +}; > + > +static void > +register_wgfinish(void) > +{ > + > + if (wgfinish_registered) > + return; > + callback_register(wgfinish, NULL); > + wgfinish_registered =3D true; > +} > + > +static nvlist_t * > +nvl_device(void) > +{ > + static nvlist_t *_nvl_device; > + > + if (_nvl_device =3D=3D NULL) > + _nvl_device =3D nvlist_create(0); > + register_wgfinish(); > + return (_nvl_device); > +} > + > static bool > -key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) > +key_from_base64(uint8_t key[static WG_KEY_SIZE], const char *base64) > { >=20 > - if (strlen(base64) !=3D WG_KEY_LEN_BASE64 - 1) { > - warnx("bad key len - need %d got %zu\n", = WG_KEY_LEN_BASE64 - 1, strlen(base64)); > + if (strlen(base64) !=3D WG_KEY_SIZE_BASE64 - 1) { > + warnx("bad key len - need %d got %zu\n", = WG_KEY_SIZE_BASE64 - 1, strlen(base64)); > return false; > } > - if (base64[WG_KEY_LEN_BASE64 - 2] !=3D '=3D') { > - warnx("bad key terminator, expected '=3D' got '%c'", = base64[WG_KEY_LEN_BASE64 - 2]); > + if (base64[WG_KEY_SIZE_BASE64 - 2] !=3D '=3D') { > + warnx("bad key terminator, expected '=3D' got '%c'", = base64[WG_KEY_SIZE_BASE64 - 2]); > return false; > } > - return (b64_pton(base64, key, WG_KEY_LEN)); > + return (b64_pton(base64, key, WG_KEY_SIZE)); > } >=20 > static void > @@ -128,7 +150,7 @@ parse_endpoint(const char *endpoint_) > err =3D getaddrinfo(endpoint, port, &hints, &res); > if (err) > errx(1, "%s", gai_strerror(err)); > - nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, = res->ai_addrlen); > + nvlist_add_binary(nvl_peer, "endpoint", res->ai_addr, = res->ai_addrlen); > freeaddrinfo(res); > free(base); > } > @@ -227,12 +249,14 @@ in6_mask2len(struct in6_addr *mask, u_char = *lim0) > } >=20 > static bool > -parse_ip(struct allowedip *aip, const char *value) > +parse_ip(struct allowedip *aip, uint16_t *family, const char *value) > { > struct addrinfo hints, *res; > int err; > + bool ret; >=20 > - bzero(&aip->a_addr, sizeof(aip->a_addr)); > + ret =3D true; > + bzero(aip, sizeof(*aip)); > bzero(&hints, sizeof(hints)); > hints.ai_family =3D AF_UNSPEC; > hints.ai_flags =3D AI_NUMERICHOST; > @@ -240,10 +264,21 @@ parse_ip(struct allowedip *aip, const char = *value) > if (err) > errx(1, "%s", gai_strerror(err)); >=20 > - memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); > + *family =3D res->ai_family; > + if (res->ai_family =3D=3D AF_INET) { > + struct sockaddr_in *sin =3D (struct sockaddr_in = *)res->ai_addr; > + > + aip->ip4 =3D sin->sin_addr; > + } else if (res->ai_family =3D=3D AF_INET6) { > + struct sockaddr_in6 *sin6 =3D (struct sockaddr_in6 = *)res->ai_addr; > + > + aip->ip6 =3D sin6->sin6_addr; > + } else { > + ret =3D false; > + } >=20 > freeaddrinfo(res); > - return (true); > + return (ret); > } >=20 > static void > @@ -271,61 +306,84 @@ sa_ntop(const struct sockaddr *sa, char *buf, = int *port) > } >=20 > static void > -dump_peer(const nvlist_t *nvl_peer) > +dump_peer(const nvlist_t *nvl_peer_cfg) > { > const void *key; > - const struct allowedip *aips; > const struct sockaddr *endpoint; > char outbuf[WG_MAX_STRLEN]; > char addr_buf[INET6_ADDRSTRLEN]; > - size_t size; > - int count, port; > + size_t aip_count, size; > + int port; > uint16_t persistent_keepalive; > + const nvlist_t * const *nvl_aips; >=20 > printf("[Peer]\n"); > - if (nvlist_exists_binary(nvl_peer, "public-key")) { > - key =3D nvlist_get_binary(nvl_peer, "public-key", = &size); > + if (nvlist_exists_binary(nvl_peer_cfg, "public-key")) { > + key =3D nvlist_get_binary(nvl_peer_cfg, "public-key", = &size); > b64_ntop((const uint8_t *)key, size, outbuf, = WG_MAX_STRLEN); > printf("PublicKey =3D %s\n", outbuf); > } > - if (nvlist_exists_binary(nvl_peer, "endpoint")) { > - endpoint =3D nvlist_get_binary(nvl_peer, "endpoint", = &size); > + if (nvlist_exists_binary(nvl_peer_cfg, "preshared-key")) { > + key =3D nvlist_get_binary(nvl_peer_cfg, "preshared-key", = &size); > + b64_ntop((const uint8_t *)key, size, outbuf, = WG_MAX_STRLEN); > + printf("PresharedKey =3D %s\n", outbuf); > + } > + if (nvlist_exists_binary(nvl_peer_cfg, "endpoint")) { > + endpoint =3D nvlist_get_binary(nvl_peer_cfg, "endpoint", = &size); > sa_ntop(endpoint, addr_buf, &port); > printf("Endpoint =3D %s:%d\n", addr_buf, ntohs(port)); > } > - if (nvlist_exists_number(nvl_peer, = "persistent-keepalive-interval")) { > - persistent_keepalive =3D nvlist_get_number(nvl_peer, > + if (nvlist_exists_number(nvl_peer_cfg, > + "persistent-keepalive-interval")) { > + persistent_keepalive =3D nvlist_get_number(nvl_peer_cfg, > "persistent-keepalive-interval"); > printf("PersistentKeepalive =3D %d\n", = persistent_keepalive); > } > - if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) > + if (!nvlist_exists_nvlist_array(nvl_peer_cfg, "allowed-ips")) > return; > - aips =3D nvlist_get_binary(nvl_peer, "allowed-ips", &size); > - if (size =3D=3D 0 || size % sizeof(struct allowedip) !=3D 0) { > - errx(1, "size %zu not integer multiple of allowedip", = size); > - } > + > + nvl_aips =3D nvlist_get_nvlist_array(nvl_peer_cfg, = "allowed-ips", &aip_count); > + if (nvl_aips =3D=3D NULL || aip_count =3D=3D 0) > + return; > + > printf("AllowedIPs =3D "); > - count =3D size / sizeof(struct allowedip); > - for (int i =3D 0; i < count; i++) { > - int mask; > + for (size_t i =3D 0; i < aip_count; i++) { > + uint8_t cidr; > + struct sockaddr_storage ss; > sa_family_t family; > - void *bitmask; > - struct sockaddr *sa; > - > - sa =3D __DECONST(void *, &aips[i].a_addr); > - bitmask =3D __DECONST(void *, > - ((const struct sockaddr = *)&(&aips[i])->a_mask)->sa_data); > - family =3D aips[i].a_addr.ss_family; > - getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, = NULL, > - 0, NI_NUMERICHOST); > - if (family =3D=3D AF_INET) > - mask =3D in_mask2len(bitmask); > - else if (family =3D=3D AF_INET6) > - mask =3D in6_mask2len(bitmask, NULL); > - else > - errx(1, "bad family in peer %d\n", family); > - printf("%s/%d", addr_buf, mask); > - if (i < count -1) > + > + if (!nvlist_exists_number(nvl_aips[i], "cidr")) > + continue; > + cidr =3D nvlist_get_number(nvl_aips[i], "cidr"); > + if (nvlist_exists_binary(nvl_aips[i], "ipv4")) { > + struct sockaddr_in *sin =3D (struct sockaddr_in = *)&ss; > + const struct in_addr *ip4; > + > + ip4 =3D nvlist_get_binary(nvl_aips[i], "ipv4", = &size); > + if (ip4 =3D=3D NULL || cidr > 32) > + continue; > + sin->sin_len =3D sizeof(*sin); > + sin->sin_family =3D AF_INET; > + sin->sin_addr =3D *ip4; > + } else if (nvlist_exists_binary(nvl_aips[i], "ipv6")) { > + struct sockaddr_in6 *sin6 =3D (struct = sockaddr_in6 *)&ss; > + const struct in6_addr *ip6; > + > + ip6 =3D nvlist_get_binary(nvl_aips[i], "ipv6", = &size); > + if (ip6 =3D=3D NULL || cidr > 128) > + continue; > + sin6->sin6_len =3D sizeof(*sin6); > + sin6->sin6_family =3D AF_INET6; > + sin6->sin6_addr =3D *ip6; > + } else { > + continue; > + } > + > + family =3D ss.ss_family; > + getnameinfo((struct sockaddr *)&ss, ss.ss_len, addr_buf, > + INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); > + printf("%s/%d", addr_buf, cidr); > + if (i < aip_count - 1) > printf(", "); > } > printf("\n"); > @@ -334,36 +392,34 @@ dump_peer(const nvlist_t *nvl_peer) > static int > get_nvl_out_size(int sock, u_long op, size_t *size) > { > - struct ifdrv ifd; > + struct wg_data_io wgd; > int err; >=20 > - memset(&ifd, 0, sizeof(ifd)); > + memset(&wgd, 0, sizeof(wgd)); >=20 > - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > - ifd.ifd_cmd =3D op; > - ifd.ifd_len =3D 0; > - ifd.ifd_data =3D NULL; > + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); > + wgd.wgd_size =3D 0; > + wgd.wgd_data =3D NULL; >=20 > - err =3D ioctl(sock, SIOCGDRVSPEC, &ifd); > + err =3D ioctl(sock, op, &wgd); > if (err) > return (err); > - *size =3D ifd.ifd_len; > + *size =3D wgd.wgd_size; > return (0); > } >=20 > static int > do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) > { > - struct ifdrv ifd; > + struct wg_data_io wgd; >=20 > - memset(&ifd, 0, sizeof(ifd)); > + memset(&wgd, 0, sizeof(wgd)); >=20 > - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > - ifd.ifd_cmd =3D op; > - ifd.ifd_len =3D argsize; > - ifd.ifd_data =3D arg; > + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); > + wgd.wgd_size =3D argsize; > + wgd.wgd_data =3D arg; >=20 > - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); > + return (ioctl(sock, op, &wgd)); > } >=20 > static > @@ -371,62 +427,83 @@ DECL_CMD_FUNC(peerlist, val, d) > { > size_t size, peercount; > void *packed; > - const nvlist_t *nvl, *nvl_peer; > + const nvlist_t *nvl; > const nvlist_t *const *nvl_peerlist; >=20 > - if (get_nvl_out_size(s, WGC_GET, &size)) > + if (get_nvl_out_size(s, SIOCGWG, &size)) > errx(1, "can't get peer list size"); > if ((packed =3D malloc(size)) =3D=3D NULL) > errx(1, "malloc failed for peer list"); > - if (do_cmd(s, WGC_GET, packed, size, 0)) > + if (do_cmd(s, SIOCGWG, packed, size, 0)) > errx(1, "failed to obtain peer list"); >=20 > nvl =3D nvlist_unpack(packed, size, 0); > - if (!nvlist_exists_nvlist_array(nvl, "peer-list")) > + if (!nvlist_exists_nvlist_array(nvl, "peers")) > return; > - nvl_peerlist =3D nvlist_get_nvlist_array(nvl, "peer-list", = &peercount); > + nvl_peerlist =3D nvlist_get_nvlist_array(nvl, "peers", = &peercount); >=20 > for (int i =3D 0; i < peercount; i++, nvl_peerlist++) { > - nvl_peer =3D *nvl_peerlist; > - dump_peer(nvl_peer); > + dump_peer(*nvl_peerlist); > } > } >=20 > static void > -peerfinish(int s, void *arg) > +wgfinish(int s, void *arg) > { > - nvlist_t *nvl, **nvl_array; > void *packed; > size_t size; > + static nvlist_t *nvl_dev; > + > + nvl_dev =3D nvl_device(); > + if (nvl_peer !=3D NULL) { > + if (!nvlist_exists_binary(nvl_peer, "public-key")) > + errx(1, "must specify a public-key for adding = peer"); > + if (allowed_ips_count !=3D 0) { > + nvlist_add_nvlist_array(nvl_peer, "allowed-ips", > + (const nvlist_t * const *)allowed_ips, > + allowed_ips_count); > + for (size_t i =3D 0; i < allowed_ips_count; i++) = { > + nvlist_destroy(allowed_ips[i]); > + } > + > + free(allowed_ips); > + } > + > + nvlist_add_nvlist_array(nvl_dev, "peers", > + (const nvlist_t * const *)&nvl_peer, 1); > + } > + > + packed =3D nvlist_pack(nvl_dev, &size); >=20 > - if ((nvl =3D nvlist_create(0)) =3D=3D NULL) > - errx(1, "failed to allocate nvlist"); > - if ((nvl_array =3D calloc(sizeof(void *), 1)) =3D=3D NULL) > - errx(1, "failed to allocate nvl_array"); > - if (!nvlist_exists_binary(nvl_params, "public-key")) > - errx(1, "must specify a public-key for adding peer"); > - if (allowed_ips_count =3D=3D 0) > - errx(1, "must specify at least one range of allowed-ips = to add a peer"); > - > - nvl_array[0] =3D nvl_params; > - nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * = const *)nvl_array, 1); > - packed =3D nvlist_pack(nvl, &size); > - > - if (do_cmd(s, WGC_SET, packed, size, true)) > - errx(1, "failed to install peer"); > + if (do_cmd(s, SIOCSWG, packed, size, true)) > + errx(1, "failed to configure"); > } >=20 > static > DECL_CMD_FUNC(peerstart, val, d) > { > - do_peer =3D true; > - callback_register(peerfinish, NULL); > - allowed_ips =3D malloc(ALLOWEDIPS_START * sizeof(struct = allowedip)); > + > + if (nvl_peer !=3D NULL) > + errx(1, "cannot both add and remove a peer"); > + register_wgfinish(); > + nvl_peer =3D nvlist_create(0); > + allowed_ips =3D calloc(ALLOWEDIPS_START, sizeof(*allowed_ips)); > allowed_ips_max =3D ALLOWEDIPS_START; > if (allowed_ips =3D=3D NULL) > errx(1, "failed to allocate array for allowedips"); > } >=20 > +static > +DECL_CMD_FUNC(peerdel, val, d) > +{ > + > + if (nvl_peer !=3D NULL) > + errx(1, "cannot both add and remove a peer"); > + register_wgfinish(); > + nvl_peer =3D nvlist_create(0); > + nvlist_add_bool(nvl_peer, "remove", true); > +} > + > static > DECL_CMD_FUNC(setwglistenport, val, d) > { > @@ -454,39 +531,53 @@ DECL_CMD_FUNC(setwglistenport, val, d) > errx(1, "unknown family"); > } > ul =3D ntohs((u_short)ul); > - nvlist_add_number(nvl_params, "listen-port", ul); > + nvlist_add_number(nvl_device(), "listen-port", ul); > } >=20 > static > DECL_CMD_FUNC(setwgprivkey, val, d) > { > - uint8_t key[WG_KEY_LEN]; > + uint8_t key[WG_KEY_SIZE]; >=20 > if (!key_from_base64(key, val)) > errx(1, "invalid key %s", val); > - nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); > + nvlist_add_binary(nvl_device(), "private-key", key, = WG_KEY_SIZE); > } >=20 > static > DECL_CMD_FUNC(setwgpubkey, val, d) > { > - uint8_t key[WG_KEY_LEN]; > + uint8_t key[WG_KEY_SIZE]; >=20 > - if (!do_peer) > + if (nvl_peer =3D=3D NULL) > errx(1, "setting public key only valid when adding = peer"); >=20 > if (!key_from_base64(key, val)) > errx(1, "invalid key %s", val); > - nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); > + nvlist_add_binary(nvl_peer, "public-key", key, WG_KEY_SIZE); > } >=20 > +static > +DECL_CMD_FUNC(setwgpresharedkey, val, d) > +{ > + uint8_t key[WG_KEY_SIZE]; > + > + if (nvl_peer =3D=3D NULL) > + errx(1, "setting preshared-key only valid when adding = peer"); > + > + if (!key_from_base64(key, val)) > + errx(1, "invalid key %s", val); > + nvlist_add_binary(nvl_peer, "preshared-key", key, WG_KEY_SIZE); > +} > + > + > static > DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) > { > unsigned long persistent_keepalive; > char *endp; >=20 > - if (!do_peer) > + if (nvl_peer =3D=3D NULL) > errx(1, "setting persistent keepalive only valid when = adding peer"); >=20 > errno =3D 0; > @@ -496,7 +587,7 @@ DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) > if (persistent_keepalive > USHRT_MAX) > errx(1, "persistent-keepalive '%lu' too large", > persistent_keepalive); > - nvlist_add_number(nvl_params, "persistent-keepalive-interval", > + nvlist_add_number(nvl_peer, "persistent-keepalive-interval", > persistent_keepalive); > } >=20 > @@ -506,45 +597,57 @@ DECL_CMD_FUNC(setallowedips, val, d) > char *base, *allowedip, *mask; > u_long ul; > char *endp; > - struct allowedip *aip; > + struct allowedip aip; > + nvlist_t *nvl_aip; > + uint16_t family; >=20 > - if (!do_peer) > + if (nvl_peer =3D=3D NULL) > errx(1, "setting allowed ip only valid when adding = peer"); > if (allowed_ips_count =3D=3D allowed_ips_max) { > - /* XXX grow array */ > + allowed_ips_max *=3D 2; > + allowed_ips =3D reallocarray(allowed_ips, = allowed_ips_max, > + sizeof(*allowed_ips)); > + if (allowed_ips =3D=3D NULL) > + errx(1, "failed to grow allowed ip array"); > } > - aip =3D &allowed_ips[allowed_ips_count]; > + > + allowed_ips[allowed_ips_count] =3D nvl_aip =3D nvlist_create(0); > + if (nvl_aip =3D=3D NULL) > + errx(1, "failed to create new allowedip nvlist"); > + > base =3D allowedip =3D strdup(val); > mask =3D index(allowedip, '/'); > if (mask =3D=3D NULL) > errx(1, "mask separator not found in allowedip %s", = val); > *mask =3D '\0'; > mask++; > - parse_ip(aip, allowedip); > + > + parse_ip(&aip, &family, allowedip); > ul =3D strtoul(mask, &endp, 0); > if (*endp !=3D '\0') > errx(1, "invalid value for allowedip mask"); > - bzero(&aip->a_mask, sizeof(aip->a_mask)); > - if (aip->a_addr.ss_family =3D=3D AF_INET) > - in_len2mask((struct in_addr *)&((struct sockaddr = *)&aip->a_mask)->sa_data, ul); > - else if (aip->a_addr.ss_family =3D=3D AF_INET6) > - in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr = *)&aip->a_mask)->sa_data, ul); > - else > - errx(1, "invalid address family %d\n", = aip->a_addr.ss_family); > + > + nvlist_add_number(nvl_aip, "cidr", ul); > + if (family =3D=3D AF_INET) { > + nvlist_add_binary(nvl_aip, "ipv4", &aip.ip4, = sizeof(aip.ip4)); > + } else if (family =3D=3D AF_INET6) { > + nvlist_add_binary(nvl_aip, "ipv6", &aip.ip6, = sizeof(aip.ip6)); > + } else { > + /* Shouldn't happen */ > + nvlist_destroy(nvl_aip); > + goto out; > + } > + > allowed_ips_count++; > - if (allowed_ips_count > 1) > - nvlist_free_binary(nvl_params, "allowed-ips"); > - nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, > - = allowed_ips_count*sizeof(*aip)); >=20 > - dump_peer(nvl_params); > +out: > free(base); > } >=20 > static > DECL_CMD_FUNC(setendpoint, val, d) > { > - if (!do_peer) > + if (nvl_peer =3D=3D NULL) > errx(1, "setting endpoint only valid when adding peer"); > parse_endpoint(val); > } > @@ -555,15 +658,15 @@ wireguard_status(int s) > size_t size; > void *packed; > nvlist_t *nvl; > - char buf[WG_KEY_LEN_BASE64]; > + char buf[WG_KEY_SIZE_BASE64]; > const void *key; > uint16_t listen_port; >=20 > - if (get_nvl_out_size(s, WGC_GET, &size)) > + if (get_nvl_out_size(s, SIOCGWG, &size)) > return; > if ((packed =3D malloc(size)) =3D=3D NULL) > return; > - if (do_cmd(s, WGC_GET, packed, size, 0)) > + if (do_cmd(s, SIOCGWG, packed, size, 0)) > return; > nvl =3D nvlist_unpack(packed, size, 0); > if (nvlist_exists_number(nvl, "listen-port")) { > @@ -583,10 +686,14 @@ wireguard_status(int s) > } >=20 > static struct cmd wireguard_cmds[] =3D { > - DEF_CLONE_CMD_ARG("listen-port", setwglistenport), > - DEF_CLONE_CMD_ARG("private-key", setwgprivkey), > + DEF_CMD_ARG("listen-port", setwglistenport), > + DEF_CMD_ARG("private-key", setwgprivkey), > + /* XXX peer-list is deprecated. */ > DEF_CMD("peer-list", 0, peerlist), > + DEF_CMD("peers", 0, peerlist), > DEF_CMD("peer", 0, peerstart), > + DEF_CMD("-peer", 0, peerdel), > + DEF_CMD_ARG("preshared-key", setwgpresharedkey), > DEF_CMD_ARG("public-key", setwgpubkey), > DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), > DEF_CMD_ARG("allowed-ips", setallowedips), > @@ -602,27 +709,10 @@ static struct afswtch af_wireguard =3D { > static void > wg_create(int s, struct ifreq *ifr) > { > - struct iovec iov; > - void *packed; > - size_t size; >=20 > setproctitle("ifconfig %s create ...\n", name); > - if (!nvlist_exists_number(nvl_params, "listen-port")) > - goto legacy; > - if (!nvlist_exists_binary(nvl_params, "private-key")) > - goto legacy; > - > - packed =3D nvlist_pack(nvl_params, &size); > - if (packed =3D=3D NULL) > - errx(1, "failed to setup create request"); > - iov.iov_len =3D size; > - iov.iov_base =3D packed; > - ifr->ifr_data =3D (caddr_t)&iov; > - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) > - err(1, "SIOCIFCREATE2"); > - return; > -legacy: > - ifr->ifr_data =3D=3D NULL; > + > + ifr->ifr_data =3D NULL; > if (ioctl(s, SIOCIFCREATE, ifr) < 0) > err(1, "SIOCIFCREATE"); > } > @@ -632,7 +722,6 @@ wireguard_ctor(void) > { > int i; >=20 > - nvl_params =3D nvlist_create(0); > for (i =3D 0; i < nitems(wireguard_cmds); i++) > cmd_register(&wireguard_cmds[i]); > af_register(&af_wireguard); > diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 > index 335d3e70b64a..29215bd438ff 100644 > --- a/share/man/man4/wg.4 > +++ b/share/man/man4/wg.4 > @@ -23,7 +23,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd March 9, 2021 > +.Dd March 12, 2021 > .Dt WG 4 > .Os > .Sh NAME > @@ -68,7 +68,7 @@ interface. > The private key of the > .Nm > interface. > -.It Cm pre-shared-key > +.It Cm preshared-key > Defines a pre-shared key for the > .Nm > interface. > @@ -76,9 +76,9 @@ interface. > A list of allowed IP addresses. > .It Cm endpoint > The IP address of the WiredGuard to connect to. > -.It Cm peer-list > +.It Cm peers > A list of peering IP addresses to connect to. > -.It Cm persistent-keepalive > +.It Cm persistent-keepalive-interval > Interval, in seconds, at which to send persistent keepalive packets. > .El > .Pp > @@ -188,6 +188,11 @@ Connect to a specific endpoint using its = public-key and set the allowed IP addre > .Bd -literal -offset indent > # ifconfig wg0 peer public-key = '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=3D' endpoint = 10.0.1.100:54321 allowed-ips 192.168.2.100/32 > .Ed > +.Pp > +Remove a peer > +.Bd -literal -offset indent > +# ifconfig wg0 -peer public-key = '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=3D' > +.Ed > .Sh DIAGNOSTICS > The > .Nm > @@ -240,14 +245,11 @@ device driver first appeared in > .Sh AUTHORS > The > .Nm > -device driver was originally written for > -.Ox > -by > -.An Matt Dunwoodie Aq Mt ncon@nconroy.net > -and ported to > -.Fx > -by > -.An Matt Macy Aq Mt mmacy@FreeBSD.org . > +device driver written by > +.An Jason A. Donenfeld Aq Mt Jason@zx2c4.com , > +.An Matt Dunwoodie Aq Mt ncon@nconroy.net , > +and > +.An Kyle Evans Aq Mt kevans@FreeBSD.org . > .Pp > This manual page was written by > .An Gordon Bergling Aq Mt gbe@FreeBSD.org > diff --git a/sys/dev/if_wg/crypto.c b/sys/dev/if_wg/crypto.c > new file mode 100644 > index 000000000000..f28585429272 > --- /dev/null > +++ b/sys/dev/if_wg/crypto.c > @@ -0,0 +1,1705 @@ > +/* > + * Copyright (C) 2015-2021 Jason A. Donenfeld . All = Rights Reserved. > + * > + * Permission to use, copy, modify, and distribute this software for = any > + * purpose with or without fee is hereby granted, provided that the = above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL = WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE = LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY = DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN = AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING = OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +#include > +#include > +#include > + > +#include "crypto.h" > + > +#ifndef ARRAY_SIZE > +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) > +#endif > +#ifndef noinline > +#define noinline __attribute__((noinline)) > +#endif > +#ifndef __aligned > +#define __aligned(x) __attribute__((aligned(x))) > +#endif > +#ifndef DIV_ROUND_UP > +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) > +#endif > + > +#define le32_to_cpup(a) le32toh(*(a)) > +#define le64_to_cpup(a) le64toh(*(a)) > +#define cpu_to_le32(a) htole32(a) > +#define cpu_to_le64(a) htole64(a) > + > +static inline uint32_t get_unaligned_le32(const uint8_t *a) > +{ > + uint32_t l; > + __builtin_memcpy(&l, a, sizeof(l)); > + return le32_to_cpup(&l); > +} > +static inline uint64_t get_unaligned_le64(const uint8_t *a) > +{ > + uint64_t l; > + __builtin_memcpy(&l, a, sizeof(l)); > + return le64_to_cpup(&l); > +} > +static inline void put_unaligned_le32(uint32_t s, uint8_t *d) > +{ > + uint32_t l =3D cpu_to_le32(s); > + __builtin_memcpy(d, &l, sizeof(l)); > +} > +static inline void cpu_to_le32_array(uint32_t *buf, unsigned int = words) > +{ > + while (words--) { > + *buf =3D cpu_to_le32(*buf); > + ++buf; > + } > +} > +static inline void le32_to_cpu_array(uint32_t *buf, unsigned int = words) > +{ > + while (words--) { > + *buf =3D le32_to_cpup(buf); > + ++buf; > + } > +} > + > +static inline uint32_t rol32(uint32_t word, unsigned int shift) > +{ > + return (word << (shift & 31)) | (word >> ((-shift) & 31)); > +} > +static inline uint32_t ror32(uint32_t word, unsigned int shift) > +{ > + return (word >> (shift & 31)) | (word << ((-shift) & 31)); > +} > + > +static void xor_cpy(uint8_t *dst, const uint8_t *src1, const uint8_t = *src2, > + size_t len) > +{ > + size_t i; > + > + for (i =3D 0; i < len; ++i) > + dst[i] =3D src1[i] ^ src2[i]; > +} > + > +#define QUARTER_ROUND(x, a, b, c, d) ( \ > + x[a] +=3D x[b], \ > *** 50620 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Mon Mar 15 15:27:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AD4B57E898; Mon, 15 Mar 2021 15:27:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzgKS2rhbz3DmN; Mon, 15 Mar 2021 15:27:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 4F91A2B3FD; Mon, 15 Mar 2021 15:27:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f44.google.com with SMTP id g8so7939334qvx.1; Mon, 15 Mar 2021 08:27:56 -0700 (PDT) X-Gm-Message-State: AOAM533IG9KBHBQYWbXNOQj6JPH4gs/I2xCzHyrl9feCHNOk9fm4oGn9 j7ALak4HzceYGgx4jI7zr1sImg+LtR0EFclYh48= X-Google-Smtp-Source: ABdhPJwTRLUDgpJmU1e+9CtUO6N6Soe/6S3sdmlDaRCGp8u2IsbzrylLtqjP9HCVSwhBBKZprmT1xjvVkZ6pZCNJp9Q= X-Received: by 2002:ad4:58cf:: with SMTP id dh15mr11108728qvb.26.1615822075775; Mon, 15 Mar 2021 08:27:55 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> In-Reply-To: <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> From: Kyle Evans Date: Mon, 15 Mar 2021 10:27:42 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:27:56 -0000 On Mon, Mar 15, 2021 at 9:57 AM Scott Long wrote: > > Here is the response I sent to you and Donenfeld in private. I won=E2=80= =99t include > my direct conversation with you from Slack/IRC, but I made my concerns > and objections pretty clear. This commit is quite disappointing. See be= low: > I'm sorry that you feel that way, but I've been pretty vocal about my intentions to merge this work as soon as we were done with internal review due to the pre-existing state of the driver. > The good: > [... snip ...] > > The bad: > - I want to be pragmatic about code APIs. Maybe iflib isn=E2=80=99t read= y for > pseudo interfaces yet, and fixing it is non-trivial and out of scope. > Going back to ifnet puts it back in line with openbsd and likely does > fix the vnet problems. However, it=E2=80=99s a radical change to the dri= ver, and > not something that I can support as a last-minute action for FreeBSD > 13.0 or for pfSense. Therefore, I=E2=80=99m advising against its immedia= te > inclusion. The final choice is not mine to make for FreeBSD, but > that=E2=80=99s my recommendation. For pfSense, I=E2=80=99ll be discussin= g this with > the rest of the engineering staff on Monday. > iflib is definitely not ready for pseudo interfaces, and I'd like to see the technical justification for using iflib here in the first place. if_wg used exactly 0 of its real features because the queueing system was bypassed by setting if_transmit in its IFDI_ATTACH_POST implementation. In other words, we gained all of its complexity and pseudo interfaces immaturity without any benefit that we found while exploring the possibilities. > - The LKML wouldn=E2=80=99t accept this kind of submission, they=E2=80=99= d insist that > it be broken down into consumable pieces, and that bug fixes be > considered and provided that don=E2=80=99t rely on massive re-writes. I= =E2=80=99ve > been dealing with linux for 20+ years and BSD for almost 30 years, > and I=E2=80=99ve got to say that despite my distaste for how the LKML is = run, > they get results. Does fixing a segfault or packet drop/reorder > require the removal of iflib? > The review process on FreeBSD breaks down, as you yourself have noted. mmacy has not been involved in if_wg since dropping it in the tree AFAICT, and grehan claimed to only be involved because it was passed to him at Netgate and that he didn't mind where it goes. Thus, I used developer discretion and sought review from the person that wrote the OpenBSD implementation and the person that designed the protocol. We iterated on this for days to fix the numerous issues we were presented with. > The Ugly: > - An accusation was made, tonight, to me, that the code Netgate > sponsored was not reviewed and was shoved into the tree at the last > minute. This grossly ignores the actual history to the point of > weakening my tolerance for this entire discussion. It shows a pretty > irrational bias against mmacy and Netgate and a gross ignorance of > the history and provenience of the work. > I'm sorry that I got heated here, your tone was immediately aggressive after I just spent five days cleaning up the mess that was left behind. At least one of the security issues I found was a small configuration tweak and near-immediate destruction of the system when applying any real load to the driver. > - The Netgate copyright was unilaterally removed. Yes, it was re- > instated a few minutes ago, and with good reason. Please don=E2=80=99t > do that again. > I won't touch on this, other than "ack". > - The removal of the ASM crypto bits really confuses me. An > accusation was made, again tonight, that Netgate merely paid to > benchmark the code, that we contributed nothing to it, and that it=E2=80= =99s > bad code that can=E2=80=99t be audited. What I see is that the meat of t= he > implementation is copyrighted by Jason and others. There=E2=80=99s a > modest but non-trivial amount of glue code that has (or had) the > Netgate copyright. I=E2=80=99m not going to touch the audit nonsense. > I need data here, and I=E2=80=99m not seeing it. > I would have appreciated a pointer to the copyrighted 63 lines in include/, because this was obviously ignorance on my part. You suggested functional testing and bug fixing, the former of which I inherently include in 'benchmarking' since you can't benchmark something that isn't functional, and received no pointer of the latter. > There seems to be a lot of bad blood, poor understanding, and > misinformation going on. I need all of this bullshit to stop. This > is 5000-ish lines of a nice way to get a point-to-point VPN going > without the hassle of IPSec or the performance problems of > OpenVPN. It=E2=80=99s consuming way more time and energy than it=E2=80= =99s > worth to me, and I=E2=80=99d much rather spend time and money to > implement OpenVPN DCO and work on profiling and optimizing > IPSec. Wireguard is important to Netgate because we recognize > that it=E2=80=99s a feature that customers want, we=E2=80=99re committed = to making > security accessible, and we strongly believe in open source and > FreeBSD. It=E2=80=99s not perfect code, not by a long shot, but I expect > better collaboration and communication than what I=E2=80=99m seeing here. > It's important to me that we do what's right for the community, and the if_wg module that was in-tree was not right for the community. I just want something secure and usable in the tree, the latter point being the packet loss complaints from the Netgate support forum that I pointed you at as well as the kernel not handling allowed-ips conflicts that I had mentioned, among various protocol violations and other things the module did not handle w.r.t. configuration. The former point being at least the buffer overflow I mentioned, but there are more. Thanks, Kyle Evans > Scott > > > > On Mar 14, 2021, at 10:52 PM, Kyle Evans wrote: > > > > The branch main has been updated by kevans: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D74ae3f3e33b810248da19004= c58b3581cd367843 > > > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > > Author: Kyle Evans > > AuthorDate: 2021-03-15 02:25:40 +0000 > > Commit: Kyle Evans > > CommitDate: 2021-03-15 04:52:04 +0000 > > > > if_wg: import latest fixup work from the wireguard-freebsd project > > > > This is the culmination of about a week of work from three developer= s to > > fix a number of functional and security issues. This patch consists= of > > work done by the following folks: > > > > - Jason A. Donenfeld > > - Matt Dunwoodie > > - Kyle Evans > > > > Notable changes include: > > - Packets are now correctly staged for processing once the handshake= has > > completed, resulting in less packet loss in the interim. > > - Various race conditions have been resolved, particularly w.r.t. so= cket > > and packet lifetime (panics) > > - Various tests have been added to assure correct functionality and > > tooling conformance > > - Many security issues have been addressed > > - if_wg now maintains jail-friendly semantics: sockets are created i= n > > the interface's home vnet so that it can act as the sole network > > connection for a jail > > - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 > > - if_wg now exports via ioctl a format that is future proof and > > complete. It is additionally supported by the upstream > > wireguard-tools (which we plan to merge in to base soon) > > - if_wg now conforms to the WireGuard protocol and is more closely > > aligned with security auditing guidelines > > > > Note that the driver has been rebased away from using iflib. iflib > > poses a number of challenges for a cloned device trying to operate i= n a > > vnet that are non-trivial to solve and adds complexity to the > > implementation for little gain. > > > > The crypto implementation that was previously added to the tree was = a > > super complex integration of what previously appeared in an old out = of > > tree Linux module, which has been reduced to crypto.c containing sim= ple > > boring reference implementations. This is part of a near-to-mid ter= m > > goal to work with FreeBSD kernel crypto folks and take advantage of = or > > improve accelerated crypto already offered elsewhere. > > > > There's additional test suite effort underway out-of-tree taking > > advantage of the aforementioned jail-friendly semantics to test a nu= mber > > of real-world topologies, based on netns.sh. > > > > Also note that this is still a work in progress; work going further = will > > be much smaller in nature From owner-dev-commits-src-main@freebsd.org Mon Mar 15 15:46:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5364657F40F; Mon, 15 Mar 2021 15:46:54 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzglL1VCzz3H6R; Mon, 15 Mar 2021 15:46:53 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id DA6835C00F9; Mon, 15 Mar 2021 11:46:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 Mar 2021 11:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm2; bh=v Z+SJYcYgRZdIRcmE8tdrtpaBJDOgwlbyfGElBDX8cQ=; b=MbPAEOKycrDF3FQf7 k/iCip0muRxZ6X+ZvGacSF6r/5TB6OWQLCQ2IAduriTlF2B30v9cweI29hgyXoDm RDLo73KTEPq/YIKmqCxSS9ffIMZnfCo+lVIDOCX7v6jhZUnyxRwzXRWWv/pX8unN kFdCW+/EsIZaTIt0a+WqnH2Ck4tzm3kk5E1fgWivPJ3C6YKNOzm/rs9UAPKGEQhs iF2WmArO45gkuWa56VXli90X+UQ8uwMQIHAo4N79fSOUCl0XGd+g0OBEFE+qzbvj hEwzkWdwbd2j7slNAXyKAPDHnbK1hkMuFn/FtF6dER4SqXw99WvG/aL5B7Yttlai hMdjg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=vZ+SJYcYgRZdIRcmE8tdrtpaBJDOgwlbyfGElBDX8 cQ=; b=DfQy7dj243dQdxknJVMIo4QOdAivqMBmcCPRAeYE4hXDocqQAJqndaQra eluX3bKTg0LfzXCeHvycne6eI0CiiuIn01ngUxzTTQUnBZ16EBTxFlRovokpW7Te Mbg0OGFA8mvy7bcXKElkM5P1bW5I+68M1UKhwVCNhdyfKxPbU/Rfj8aSl6hbbh3Z DPZ/hEOUjdh2G8rnBF1lpMzuW2V7dWE+PU1yRRUXGEAsaIeaL/OYudsu9nJH18Y2 Zlk+AhHhvlXXg6tvb2K88I+NXyPL6+7k7z3DOXXzn/ssG9yLQW2SW1fzWNBzl00C KMOzf7fA8bTSdgyL6yow3fouJt66Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddvledgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecuggftrfgrthhtvg hrnhepudduveekheehiedukeekleelvedufeevfeetudfgtdffteffleehheffueffgfeh necuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrdegiedrkeelrddvud efnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgt ohhtthhlsehsrghmshgtohdrohhrgh X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id 2DEC6240057; Mon, 15 Mar 2021 11:46:53 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project From: Scott Long In-Reply-To: Date: Mon, 15 Mar 2021 09:46:52 -0600 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <1D0606F6-73C2-42B9-9CF5-E3EBE01CE4EE@samsco.org> References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> To: Kyle Evans X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4DzglL1VCzz3H6R X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:46:54 -0000 I=E2=80=99m sorry that you feel that I was =E2=80=9Cimmediately = aggressive=E2=80=9D. I have the IRC logs to back up my statement that I was supportive but concerned, and what I objected to. If you feel that I was immediately aggressive or = that I deserved the scorn you hurled, then I really have nothing more to add to this conversation, other than I=E2=80=99ll be looking for other ways for = Netgate to operate that don=E2=80=99t overlap with Wireguard. Scott > On Mar 15, 2021, at 9:27 AM, Kyle Evans wrote: >=20 > On Mon, Mar 15, 2021 at 9:57 AM Scott Long wrote: >>=20 >> Here is the response I sent to you and Donenfeld in private. I = won=E2=80=99t include >> my direct conversation with you from Slack/IRC, but I made my = concerns >> and objections pretty clear. This commit is quite disappointing. = See below: >>=20 >=20 > I'm sorry that you feel that way, but I've been pretty vocal about my > intentions to merge this work as soon as we were done with internal > review due to the pre-existing state of the driver. >=20 >> The good: >> [... snip ...] >>=20 >> The bad: >> - I want to be pragmatic about code APIs. Maybe iflib isn=E2=80=99t = ready for >> pseudo interfaces yet, and fixing it is non-trivial and out of scope. >> Going back to ifnet puts it back in line with openbsd and likely does >> fix the vnet problems. However, it=E2=80=99s a radical change to the = driver, and >> not something that I can support as a last-minute action for FreeBSD >> 13.0 or for pfSense. Therefore, I=E2=80=99m advising against its = immediate >> inclusion. The final choice is not mine to make for FreeBSD, but >> that=E2=80=99s my recommendation. For pfSense, I=E2=80=99ll be = discussing this with >> the rest of the engineering staff on Monday. >>=20 >=20 > iflib is definitely not ready for pseudo interfaces, and I'd like to > see the technical justification for using iflib here in the first > place. if_wg used exactly 0 of its real features because the queueing > system was bypassed by setting if_transmit in its IFDI_ATTACH_POST > implementation. In other words, we gained all of its complexity and > pseudo interfaces immaturity without any benefit that we found while > exploring the possibilities. >=20 >> - The LKML wouldn=E2=80=99t accept this kind of submission, they=E2=80=99= d insist that >> it be broken down into consumable pieces, and that bug fixes be >> considered and provided that don=E2=80=99t rely on massive re-writes. = I=E2=80=99ve >> been dealing with linux for 20+ years and BSD for almost 30 years, >> and I=E2=80=99ve got to say that despite my distaste for how the LKML = is run, >> they get results. Does fixing a segfault or packet drop/reorder >> require the removal of iflib? >>=20 >=20 > The review process on FreeBSD breaks down, as you yourself have noted. > mmacy has not been involved in if_wg since dropping it in the tree > AFAICT, and grehan claimed to only be involved because it was passed > to him at Netgate and that he didn't mind where it goes. Thus, I used > developer discretion and sought review from the person that wrote the > OpenBSD implementation and the person that designed the protocol. We > iterated on this for days to fix the numerous issues we were presented > with. >=20 >> The Ugly: >> - An accusation was made, tonight, to me, that the code Netgate >> sponsored was not reviewed and was shoved into the tree at the last >> minute. This grossly ignores the actual history to the point of >> weakening my tolerance for this entire discussion. It shows a pretty >> irrational bias against mmacy and Netgate and a gross ignorance of >> the history and provenience of the work. >>=20 >=20 > I'm sorry that I got heated here, your tone was immediately aggressive > after I just spent five days cleaning up the mess that was left > behind. At least one of the security issues I found was a small > configuration tweak and near-immediate destruction of the system when > applying any real load to the driver. >=20 >> - The Netgate copyright was unilaterally removed. Yes, it was re- >> instated a few minutes ago, and with good reason. Please don=E2=80=99t= >> do that again. >>=20 >=20 > I won't touch on this, other than "ack". >=20 >> - The removal of the ASM crypto bits really confuses me. An >> accusation was made, again tonight, that Netgate merely paid to >> benchmark the code, that we contributed nothing to it, and that = it=E2=80=99s >> bad code that can=E2=80=99t be audited. What I see is that the meat = of the >> implementation is copyrighted by Jason and others. There=E2=80=99s a >> modest but non-trivial amount of glue code that has (or had) the >> Netgate copyright. I=E2=80=99m not going to touch the audit nonsense. >> I need data here, and I=E2=80=99m not seeing it. >>=20 >=20 > I would have appreciated a pointer to the copyrighted 63 lines in > include/, because this was obviously ignorance on my part. You > suggested functional testing and bug fixing, the former of which I > inherently include in 'benchmarking' since you can't benchmark > something that isn't functional, and received no pointer of the > latter. >=20 >> There seems to be a lot of bad blood, poor understanding, and >> misinformation going on. I need all of this bullshit to stop. This >> is 5000-ish lines of a nice way to get a point-to-point VPN going >> without the hassle of IPSec or the performance problems of >> OpenVPN. It=E2=80=99s consuming way more time and energy than it=E2=80= =99s >> worth to me, and I=E2=80=99d much rather spend time and money to >> implement OpenVPN DCO and work on profiling and optimizing >> IPSec. Wireguard is important to Netgate because we recognize >> that it=E2=80=99s a feature that customers want, we=E2=80=99re = committed to making >> security accessible, and we strongly believe in open source and >> FreeBSD. It=E2=80=99s not perfect code, not by a long shot, but I = expect >> better collaboration and communication than what I=E2=80=99m seeing = here. >>=20 >=20 > It's important to me that we do what's right for the community, and > the if_wg module that was in-tree was not right for the community. I > just want something secure and usable in the tree, the latter point > being the packet loss complaints from the Netgate support forum that I > pointed you at as well as the kernel not handling allowed-ips > conflicts that I had mentioned, among various protocol violations and > other things the module did not handle w.r.t. configuration. The > former point being at least the buffer overflow I mentioned, but there > are more. >=20 > Thanks, >=20 > Kyle Evans >=20 >> Scott >>=20 >>=20 >>> On Mar 14, 2021, at 10:52 PM, Kyle Evans wrote: >>>=20 >>> The branch main has been updated by kevans: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D74ae3f3e33b810248da19004c58b3581= cd367843 >>>=20 >>> commit 74ae3f3e33b810248da19004c58b3581cd367843 >>> Author: Kyle Evans >>> AuthorDate: 2021-03-15 02:25:40 +0000 >>> Commit: Kyle Evans >>> CommitDate: 2021-03-15 04:52:04 +0000 >>>=20 >>> if_wg: import latest fixup work from the wireguard-freebsd project >>>=20 >>> This is the culmination of about a week of work from three = developers to >>> fix a number of functional and security issues. This patch = consists of >>> work done by the following folks: >>>=20 >>> - Jason A. Donenfeld >>> - Matt Dunwoodie >>> - Kyle Evans >>>=20 >>> Notable changes include: >>> - Packets are now correctly staged for processing once the = handshake has >>> completed, resulting in less packet loss in the interim. >>> - Various race conditions have been resolved, particularly w.r.t. = socket >>> and packet lifetime (panics) >>> - Various tests have been added to assure correct functionality = and >>> tooling conformance >>> - Many security issues have been addressed >>> - if_wg now maintains jail-friendly semantics: sockets are created = in >>> the interface's home vnet so that it can act as the sole network >>> connection for a jail >>> - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 >>> - if_wg now exports via ioctl a format that is future proof and >>> complete. It is additionally supported by the upstream >>> wireguard-tools (which we plan to merge in to base soon) >>> - if_wg now conforms to the WireGuard protocol and is more closely >>> aligned with security auditing guidelines >>>=20 >>> Note that the driver has been rebased away from using iflib. = iflib >>> poses a number of challenges for a cloned device trying to operate = in a >>> vnet that are non-trivial to solve and adds complexity to the >>> implementation for little gain. >>>=20 >>> The crypto implementation that was previously added to the tree = was a >>> super complex integration of what previously appeared in an old = out of >>> tree Linux module, which has been reduced to crypto.c containing = simple >>> boring reference implementations. This is part of a near-to-mid = term >>> goal to work with FreeBSD kernel crypto folks and take advantage = of or >>> improve accelerated crypto already offered elsewhere. >>>=20 >>> There's additional test suite effort underway out-of-tree taking >>> advantage of the aforementioned jail-friendly semantics to test a = number >>> of real-world topologies, based on netns.sh. >>>=20 >>> Also note that this is still a work in progress; work going = further will >>> be much smaller in nature From owner-dev-commits-src-main@freebsd.org Mon Mar 15 15:52:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0151757F8C9; Mon, 15 Mar 2021 15:52:16 +0000 (UTC) (envelope-from Jason@zx2c4.com) Received: from mail.zx2c4.com (mail.zx2c4.com [104.131.123.232]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.zx2c4.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzgsW6SQnz3HfJ; Mon, 15 Mar 2021 15:52:15 +0000 (UTC) (envelope-from Jason@zx2c4.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1615823531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Lwq3nWSEELjAghtBF26qH8ZL1uGweuc33zcHVxgvanU=; b=ATmpSS8AIs2QLwmETm7JNmxxO1Jods35IjfMzKvbgA2jTvERfPKa1FcJIK7NfVdRbszjhG n7mhXGCsxNe1K3WHP1cY+HMcm2nZA4ABFwuaKV29XnmGdj17+xfK08FZgB6NM3ki59YYjH UkpaFRDZwRSSwdeuZ0xtKeYMKxdiNg8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id da5399a8 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 15 Mar 2021 15:52:11 +0000 (UTC) Received: by mail-yb1-f174.google.com with SMTP id x19so33730750ybe.0; Mon, 15 Mar 2021 08:52:11 -0700 (PDT) X-Gm-Message-State: AOAM533SKhylQWTYRVJ/26+1V0km7OAhApyQA0apTIrN8bB89ijXNJzg q8UoSTtkmpAAByrO8gSwVSud3H3kOiVyfTUxDg8= X-Google-Smtp-Source: ABdhPJxr4UUciU/BbluJwgS/KefL/42g4BE/jgtroQVLJIzRZQTSJa0vONHVT+JrRAPf7TuZIOGka6WO4S0zOWVD/QI= X-Received: by 2002:a25:8c2:: with SMTP id 185mr578178ybi.20.1615823531126; Mon, 15 Mar 2021 08:52:11 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> In-Reply-To: <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> From: "Jason A. Donenfeld" Date: Mon, 15 Mar 2021 09:52:00 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long Cc: Kyle Evans , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4DzgsW6SQnz3HfJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:52:16 -0000 Hi Scott, I had hoped to talk about this with you in person, but I guess you wanted it drawn out publicly. So I'll try to respond point by point. I hope we can still talk about this face to face though, as I'd like to calm the intensity a bit. > - I want to be pragmatic about code APIs. Maybe iflib isn=E2=80=99t read= y for > pseudo interfaces yet, and fixing it is non-trivial and out of scope. > Going back to ifnet puts it back in line with openbsd and likely does > fix the vnet problems. However, it=E2=80=99s a radical change to the dri= ver, and > not something that I can support as a last-minute action for FreeBSD > 13.0 or for pfSense. Therefore, I=E2=80=99m advising against its immedia= te > inclusion. The final choice is not mine to make for FreeBSD, but > that=E2=80=99s my recommendation. For pfSense, I=E2=80=99ll be discussin= g this with > the rest of the engineering staff on Monday. I don't have much to say about iflib particulars as I don't really have enough knowledge about the FreeBSD network stack to form strong preferences, but I did notice there was lots of boilerplate that made usage rather weird and confusing, and it made it harder to integrate with vnets and jails. I trust Kyle's judgement about this, and seeing that he's basically the main developer now of this code, I trust his technical judgement there. As far as I can see, getting rid of iflib made things a lot cleaner and simpler, though. > - The LKML wouldn=E2=80=99t accept this kind of submission, they=E2=80=99= d insist that > it be broken down into consumable pieces, and that bug fixes be > considered and provided that don=E2=80=99t rely on massive re-writes. I= =E2=80=99ve > been dealing with linux for 20+ years and BSD for almost 30 years, > and I=E2=80=99ve got to say that despite my distaste for how the LKML is = run, > they get results. I don't think you're right about LKML. The original WireGuard submission there was quite big: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/?id= =3De7096c131e5161fa3b8e52a650d7719d2857adfd But regardless, I generally agree with you that smaller commits are better -- we actually worked in smaller commits in our staging repo -- but given that this wound up being a rewrite, and the crazy rapid fire of the work we were doing, it was a lot more clear in the end to just squash this rather than having all our intermediate work, which sometimes was a bit incoherent. Moving forward, we'll certainly have smaller commits. You can already see the incremental followup commits Kyle has made. The rest of us will be working on more things too in the coming weeks and you can expect for incremental progress as such. > The Ugly: > - An accusation was made, tonight, to me, that the code Netgate > sponsored was not reviewed and was shoved into the tree at the last > minute. This grossly ignores the actual history to the point of > weakening my tolerance for this entire discussion. It shows a pretty > irrational bias against mmacy and Netgate and a gross ignorance of > the history and provenience of the work. I don't have much to say about this accusation. I don't know anything about Netgate's processes. The code certainly appeared rushed and incomplete, full of problems, but that doesn't really address the accusation. I don't know who made that but it wasn't me. If anything, I'm biased in favor of Netgate. You guys are shipping WireGuard and that's super cool! So whatever parts of my biases are irrational I think mostly serve to make me enthusiastic about what you guys are up to. > - The Netgate copyright was unilaterally removed. Yes, it was re- > instated a few minutes ago, and with good reason. Please don=E2=80=99t > do that again. There was tons of churn and cruft in our staging repo as we pushed commits rapid fire. Of course the copyright line was fixed before we pushed it to freebsd-src. I mean, gosh, this whole awesome FreeBSD wireguard project wouldn't have even existed without you guys starting it. The tone of your email sounds like you've got a very different impression, so I should really stress that I'm _incredibly grateful_ that Netgate got things rolling. > - The removal of the ASM crypto bits really confuses me. An > accusation was made, again tonight, that Netgate merely paid to > benchmark the code, that we contributed nothing to it, and that it=E2=80= =99s > bad code that can=E2=80=99t be audited. What I see is that the meat of t= he > implementation is copyrighted by Jason and others. There=E2=80=99s a > modest but non-trivial amount of glue code that has (or had) the > Netgate copyright. I=E2=80=99m not going to touch the audit nonsense. > I need data here, and I=E2=80=99m not seeing it. Again, I have no idea at *all* where that accusation is coming from. All I can comment on is the code as I found it, and it was a total mess. I'm confident we'll be able to wire up the nice AVX code properly, though. It looks like FreeBSD already has lots of this sort of thing working in opencrypto/ using code from OpenSSL (similarly to the code previously imported from the old crusty compat linux module). So let's do that properly. I wrote about it here: https://lists.freebsd.org/pipermail/freebsd-hackers/2021-March/057076.html > There seems to be a lot of bad blood, poor understanding, and > misinformation going on. I need all of this bullshit to stop Jeeze louise, I really couldn't agree more with you here. I'm really wayyyy more aligned with your perspectives and goals than the tone of your email seems to suggest. We both want freebsd's wireguard implementation to be awesome -- awesome security, awesome performance, awesome stability, awesome community support, and so on. My goal is to both write code myself and help others write code to make that happen. I've really enjoyed working with Kyle and MattD on that in the last week. And I'm happy to work on that with you and anyone else who wants to help too. I'm especially excited about potentially collaborating with the FreeBSD crypto maintainers. I hope we get a chance to talk later today. Regards, Jason From owner-dev-commits-src-main@freebsd.org Mon Mar 15 16:01:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1AD6157FA65; Mon, 15 Mar 2021 16:01:05 +0000 (UTC) (envelope-from Jason@zx2c4.com) Received: from mail.zx2c4.com (mail.zx2c4.com [104.131.123.232]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.zx2c4.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dzh3j02p8z3J9k; Mon, 15 Mar 2021 16:01:04 +0000 (UTC) (envelope-from Jason@zx2c4.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1615824062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fZZL6yvBGSr6poBEvMSUVjMx0BdrKLVWyc4NWAikSjc=; b=TSTYoLe77Koz4Z3VyA7iNFVRO3oVtgUi4qtcDXEZHVoYqHp/Yh9pWH3z1UEIk+lqwCi0cY GR3g9+t49lR0dQ9DevKhGCC23RpR31Iffl1lXoLcH1d8Slnvu7jQQ5W1l0kXw8n2BFMQsO lbEbdQF0fegIaMX8Tvy46cggULnc3Bs= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id a517e678 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 15 Mar 2021 16:01:02 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id m9so33739822ybk.8; Mon, 15 Mar 2021 09:01:01 -0700 (PDT) X-Gm-Message-State: AOAM531i/mQxJKyWyt/KAr2JL6zY2rgJVmtAsqwDYrMgLplTgLuN87uw aJb6okatUeBnecw8hgiR79lZuC6O0eEzMJvqw3Y= X-Google-Smtp-Source: ABdhPJzwdohqjGBsM1ed2ytkESDFrrJKiRJry23kzGdWa7JzMO89/WevMYU+j1jNwEsinOu64AquKVs7j7Y/5wXhI7U= X-Received: by 2002:a25:2d1f:: with SMTP id t31mr540925ybt.239.1615824061556; Mon, 15 Mar 2021 09:01:01 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> <1D0606F6-73C2-42B9-9CF5-E3EBE01CE4EE@samsco.org> In-Reply-To: <1D0606F6-73C2-42B9-9CF5-E3EBE01CE4EE@samsco.org> From: "Jason A. Donenfeld" Date: Mon, 15 Mar 2021 10:00:50 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long Cc: Kyle Evans , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Dzh3j02p8z3J9k X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 16:01:05 -0000 On Mon, Mar 15, 2021 at 9:46 AM Scott Long wrote: > I=E2=80=99ll be looking for other ways for Netgate to > operate that don=E2=80=99t overlap with Wireguard. Just want to point out here that Kyle doesn't necessarily speak for me or on behalf of the WireGuard project, and that I don't really have super antagonistic or aggressive views about this conversation. At least from my perspective, I can't so easily see why we would be at odds. You've got a cool project at Netgate. I've got a cool project at WireGuard. We're both writing code for FreeBSD there, and even though there are technical challenges, it's lots of fun, and we're making cool stuff. From owner-dev-commits-src-main@freebsd.org Mon Mar 15 16:57:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C96515A8CAD; Mon, 15 Mar 2021 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzjJj5LTqz3MQT; Mon, 15 Mar 2021 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAB5E13F4C; Mon, 15 Mar 2021 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FGvPm1003594; Mon, 15 Mar 2021 16:57:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FGvPPj003593; Mon, 15 Mar 2021 16:57:25 GMT (envelope-from git) Date: Mon, 15 Mar 2021 16:57:25 GMT Message-Id: <202103151657.12FGvPPj003593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: a2aac2f5e564 - main - pkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2aac2f5e5642740507a3cadb98046f3dd434ce4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 16:57:25 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=a2aac2f5e5642740507a3cadb98046f3dd434ce4 commit a2aac2f5e5642740507a3cadb98046f3dd434ce4 Author: Baptiste Daroussin AuthorDate: 2021-03-12 17:36:30 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-15 16:52:22 +0000 pkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz The package extension is going to be changed to .bsd to be among other things resilient to the change of compression format used and reduce the impact of all third party tool of that change. Ensure the bootstrap knows about it Reviewed by: manu Differential revision: https://reviews.freebsd.org/D29232 --- usr.sbin/pkg/pkg.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 1f787e3dd246..48b92049b869 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -84,6 +84,12 @@ struct fingerprint { STAILQ_ENTRY(fingerprint) next; }; +static const char *bootstrap_names [] = { + "pkg.bsd", + "pkg.txz", + NULL +}; + STAILQ_HEAD(fingerprint_list, fingerprint); static int @@ -836,6 +842,7 @@ bootstrap_pkg(bool force, const char *fetchOpts) const char *packagesite; const char *signature_type; char pkgstatic[MAXPATHLEN]; + const char *bootstrap_name; fd_sig = -1; ret = -1; @@ -858,22 +865,29 @@ bootstrap_pkg(bool force, const char *fetchOpts) if (strncmp(URL_SCHEME_PREFIX, packagesite, strlen(URL_SCHEME_PREFIX)) == 0) packagesite += strlen(URL_SCHEME_PREFIX); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite); - - snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - - if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) == -1) + for (int j = 0; bootstrap_names[j] != NULL; j++) { + bootstrap_name = bootstrap_names[j]; + + snprintf(url, MAXPATHLEN, "%s/Latest/%s", packagesite, bootstrap_name); + snprintf(tmppkg, MAXPATHLEN, "%s/%s.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) != -1) + break; + bootstrap_name = NULL; + } + if (bootstrap_name == NULL) goto fetchfail; if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { - snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", - packagesite); + snprintf(tmpsig, MAXPATHLEN, "%s/%s.sig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.sig", + packagesite, bootstrap_name); if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " @@ -886,10 +900,11 @@ bootstrap_pkg(bool force, const char *fetchOpts) } else if (strcasecmp(signature_type, "PUBKEY") == 0) { snprintf(tmpsig, MAXPATHLEN, - "%s/pkg.txz.pubkeysig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", - packagesite); + "%s/%s.pubkeysig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.pubkeysig", + packagesite, bootstrap_name); if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " From owner-dev-commits-src-main@freebsd.org Mon Mar 15 17:48:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EB2E5AA99F; Mon, 15 Mar 2021 17:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzkRQ2jZ5z3RFR; Mon, 15 Mar 2021 17:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BFC314AF4; Mon, 15 Mar 2021 17:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FHmIWP069989; Mon, 15 Mar 2021 17:48:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FHmI62069988; Mon, 15 Mar 2021 17:48:18 GMT (envelope-from git) Date: Mon, 15 Mar 2021 17:48:18 GMT Message-Id: <202103151748.12FHmI62069988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 0ab5902e8ad9 - main - netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ab5902e8ad93d0a9341dcce386b6c571ee02173 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 17:48:18 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=0ab5902e8ad93d0a9341dcce386b6c571ee02173 commit 0ab5902e8ad93d0a9341dcce386b6c571ee02173 Author: Vincenzo Maffione AuthorDate: 2021-03-15 17:39:18 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-15 17:39:18 +0000 netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET The netmap_ioctl() function has a reference counting bug in case of NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`, the function does not decrease the refcount of "nmd", which is increased by netmap_mem_find(), causing a refcount leak. Reported by: Xiyu Yang Submitted by: Carl Smith MFC after: 3 days PR: 254311 --- sys/dev/netmap/netmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index f37900712046..f9698096b47a 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2646,6 +2646,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, case NETMAP_REQ_PORT_INFO_GET: { struct nmreq_port_info_get *req = (struct nmreq_port_info_get *)(uintptr_t)hdr->nr_body; + int nmd_ref = 0; NMG_LOCK(); do { @@ -2687,6 +2688,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, error = EINVAL; break; } + nmd_ref = 1; } error = netmap_mem_get_info(nmd, &req->nr_memsize, &memflags, @@ -2704,6 +2706,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, req->nr_host_rx_rings = na->num_host_rx_rings; } while (0); netmap_unget_na(na, ifp); + if (nmd_ref) + netmap_mem_put(nmd); NMG_UNLOCK(); break; } From owner-dev-commits-src-main@freebsd.org Mon Mar 15 17:49:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06AB55AA664 for ; Mon, 15 Mar 2021 17:49:05 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzkSJ6dxBz3hG0 for ; Mon, 15 Mar 2021 17:49:04 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb36.google.com with SMTP id h82so34021062ybc.13 for ; Mon, 15 Mar 2021 10:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j1yZtFDilpEOYFvFPkbXn0jho7GSu1sLkKMxw1V1zw4=; b=AmY7RDQCpMdEifdMxPQLYAs3rCg4U7p9yKG0AYlwwtvq8iXqlbHyhIkHNTuFK1gAt1 VOnsypt8GEMLbHcmgsKYU0VRdegMoSbj5yf7ZYCeT09+d+qNq4inzlmv1/ejK+cJD+rf P5tgXRJtzjaF7hoKXeiy+YpHmUqVtYVmdUcEA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j1yZtFDilpEOYFvFPkbXn0jho7GSu1sLkKMxw1V1zw4=; b=JUqIsAp1jkN7kHXE/QZMHFuhjEfJ3Sjuj2PiJaHmYlXNRA6zCCFz3GwXS7bSUYAsYl l1KdKledL3mDzVIMVmgJe5YdAFX7aHHKYX5brnDMfhnRpZOgpSUbtXuXlcoO++sh05SS dCprJJhR7EA73ZhtQnpeoZTurZcnFIw+npbUC7RMn0PY6UfSHYpWb4Z+wO3w/MwDPXeY 3M7JXeIYALj57v6eIAmvN866aB1ywJFpSrAWHLKjOBj3Pf4KrLMHH6eAfKLlzz07ha4W 11HrwGT7nEurde5RPf+4+bUOhYNuGPEijlV/rJjfJK15PQ64RzfbxXrgS6awylEoe6jT gmBQ== X-Gm-Message-State: AOAM533QjmMLnkWvjfkZIzUPGk/E860edPK/cnz7YiD3umwPoSw8JwG/ FMIna9uQAT4fO15ztV6lQyIR5p20bGkE+Pz7k8C3MK1B3ic= X-Google-Smtp-Source: ABdhPJy1maqABrk5T+2OW9dn6zWZkXduRQkEOxLBpIMTeoG8pAZ/tgPOUmQNxsv7V3nuyvWRKVKdcpeD14Egx++oM+E= X-Received: by 2002:a25:3bc2:: with SMTP id i185mr1143897yba.87.1615830543356; Mon, 15 Mar 2021 10:49:03 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> In-Reply-To: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> From: Kevin Bowling Date: Mon, 15 Mar 2021 10:48:52 -0700 Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Kyle Evans Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DzkSJ6dxBz3hG0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 17:49:05 -0000 Isn't this the quintessential candidate for Phabricator? By your own commit message this is code with lots of security implications. It also has (had? depending on how this goes) corporate stewardship that should be given some chance to participate. If it isn't going to re@ in time for 13.0 anyway, it does feel like an awful lot of theatrics to get in some unnecessary passive aggressiveness. You're going about it in a strange way to first accuse the original of being a rush job and unfit, to immediately heroing it without review like this and expecting assumptions of good faith. My 2c based on recent reviews discussion. On Sun, Mar 14, 2021 at 9:53 PM Kyle Evans wrote: > > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > Author: Kyle Evans > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-15 04:52:04 +0000 > > if_wg: import latest fixup work from the wireguard-freebsd project > > This is the culmination of about a week of work from three developers to > fix a number of functional and security issues. This patch consists of > work done by the following folks: > > - Jason A. Donenfeld > - Matt Dunwoodie > - Kyle Evans > > Notable changes include: > - Packets are now correctly staged for processing once the handshake has > completed, resulting in less packet loss in the interim. > - Various race conditions have been resolved, particularly w.r.t. socket > and packet lifetime (panics) > - Various tests have been added to assure correct functionality and > tooling conformance > - Many security issues have been addressed > - if_wg now maintains jail-friendly semantics: sockets are created in > the interface's home vnet so that it can act as the sole network > connection for a jail > - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 > - if_wg now exports via ioctl a format that is future proof and > complete. It is additionally supported by the upstream > wireguard-tools (which we plan to merge in to base soon) > - if_wg now conforms to the WireGuard protocol and is more closely > aligned with security auditing guidelines > > Note that the driver has been rebased away from using iflib. iflib > poses a number of challenges for a cloned device trying to operate in a > vnet that are non-trivial to solve and adds complexity to the > implementation for little gain. > > The crypto implementation that was previously added to the tree was a > super complex integration of what previously appeared in an old out of > tree Linux module, which has been reduced to crypto.c containing simple > boring reference implementations. This is part of a near-to-mid term > goal to work with FreeBSD kernel crypto folks and take advantage of or > improve accelerated crypto already offered elsewhere. > > There's additional test suite effort underway out-of-tree taking > advantage of the aforementioned jail-friendly semantics to test a number > of real-world topologies, based on netns.sh. > > Also note that this is still a work in progress; work going further will > be much smaller in nature. > > MFC after: 1 month (maybe) > --- > etc/mtree/BSD.include.dist | 2 + > include/Makefile | 9 +- > sbin/ifconfig/ifwg.c | 395 +- > share/man/man4/wg.4 | 26 +- > sys/dev/if_wg/crypto.c | 1705 ++++ > sys/dev/if_wg/crypto.h | 114 + > sys/dev/if_wg/if_wg.c | 3454 ++++++++ > sys/dev/if_wg/if_wg.h | 36 + > sys/dev/if_wg/include/crypto/blake2s.h | 56 - > sys/dev/if_wg/include/crypto/curve25519.h | 74 - > sys/dev/if_wg/include/crypto/zinc.h | 15 - > sys/dev/if_wg/include/sys/if_wg_session.h | 89 - > sys/dev/if_wg/include/sys/if_wg_session_vars.h | 319 - > sys/dev/if_wg/include/sys/simd-x86_64.h | 74 - > sys/dev/if_wg/include/sys/support.h | 342 - > sys/dev/if_wg/include/sys/wg_module.h | 121 - > sys/dev/if_wg/include/sys/wg_noise.h | 286 - > sys/dev/if_wg/include/zinc/blake2s.h | 50 - > sys/dev/if_wg/include/zinc/chacha20.h | 68 - > sys/dev/if_wg/include/zinc/chacha20poly1305.h | 48 - > sys/dev/if_wg/include/zinc/curve25519.h | 28 - > sys/dev/if_wg/include/zinc/poly1305.h | 29 - > sys/dev/if_wg/module/blake2s.c | 256 - > sys/dev/if_wg/module/blake2s.h | 58 - > sys/dev/if_wg/module/chacha20-x86_64.S | 2834 ------- > .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 - > .../module/crypto/zinc/chacha20/chacha20-arm.pl | 1227 --- > .../module/crypto/zinc/chacha20/chacha20-arm64.pl | 1163 --- > .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 - > .../module/crypto/zinc/chacha20/chacha20-mips.S | 424 - > .../crypto/zinc/chacha20/chacha20-x86_64-glue.c | 132 - > .../module/crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ---------- > .../if_wg/module/crypto/zinc/chacha20/chacha20.c | 238 - > .../if_wg/module/crypto/zinc/chacha20poly1305.c | 196 - > .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 - > .../module/crypto/zinc/poly1305/poly1305-arm.pl | 1276 --- > .../module/crypto/zinc/poly1305/poly1305-arm64.pl | 974 --- > .../module/crypto/zinc/poly1305/poly1305-donna32.c | 205 - > .../module/crypto/zinc/poly1305/poly1305-donna64.c | 182 - > .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 - > .../module/crypto/zinc/poly1305/poly1305-mips.S | 407 - > .../module/crypto/zinc/poly1305/poly1305-mips64.pl | 467 -- > .../crypto/zinc/poly1305/poly1305-x86_64-glue.c | 171 - > .../module/crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ---------- > .../if_wg/module/crypto/zinc/poly1305/poly1305.c | 163 - > .../if_wg/module/crypto/zinc/selftest/blake2s.c | 2090 ----- > .../if_wg/module/crypto/zinc/selftest/chacha20.c | 2703 ------- > .../module/crypto/zinc/selftest/chacha20poly1305.c | 8443 -------------------- > .../if_wg/module/crypto/zinc/selftest/curve25519.c | 1315 --- > .../if_wg/module/crypto/zinc/selftest/poly1305.c | 1110 --- > sys/dev/if_wg/module/crypto/zinc/selftest/run.h | 43 - > sys/dev/if_wg/module/curve25519.c | 867 -- > sys/dev/if_wg/module/if_wg_session.c | 1984 ----- > sys/dev/if_wg/module/module.c | 954 --- > sys/dev/if_wg/module/poly1305-x86_64.S | 3021 ------- > sys/dev/if_wg/support.h | 56 + > sys/dev/if_wg/{module => }/wg_cookie.c | 105 +- > sys/dev/if_wg/{include/sys => }/wg_cookie.h | 81 +- > sys/dev/if_wg/{module => }/wg_noise.c | 409 +- > sys/dev/if_wg/wg_noise.h | 191 + > sys/kern/kern_jail.c | 1 + > sys/kern/uipc_socket.c | 11 + > sys/kern/uipc_syscalls.c | 4 +- > sys/modules/if_wg/Makefile | 30 +- > sys/net/if_types.h | 1 + > sys/netinet6/nd6.c | 4 +- > sys/sys/priv.h | 1 + > sys/sys/socketvar.h | 1 + > tests/sys/netinet/Makefile | 10 +- > tests/sys/netinet/if_wg_test.sh | 188 + > 70 files changed, 6333 insertions(+), 43677 deletions(-) > > diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist > index e7784cbb0a47..0f85798815d5 100644 > --- a/etc/mtree/BSD.include.dist > +++ b/etc/mtree/BSD.include.dist > @@ -64,6 +64,8 @@ > .. > iicbus > .. > + if_wg > + .. > io > .. > mfi > diff --git a/include/Makefile b/include/Makefile > index 3a34ddb8aa18..31e207f6b199 100644 > --- a/include/Makefile > +++ b/include/Makefile > @@ -44,7 +44,7 @@ LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ > LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ > dev/hwpmc dev/hyperv \ > - dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ > + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ > fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ > @@ -170,6 +170,10 @@ NVPAIRDIR= ${INCLUDEDIR}/sys > MLX5= mlx5io.h > MLX5DIR= ${INCLUDEDIR}/dev/mlx5 > > +.PATH: ${SRCTOP}/sys/dev/if_wg > +WG= if_wg.h > +WGDIR= ${INCLUDEDIR}/dev/if_wg > + > INCSGROUPS= INCS \ > ACPICA \ > AGP \ > @@ -182,7 +186,8 @@ INCSGROUPS= INCS \ > PCI \ > RPC \ > TEKEN \ > - VERIEXEC > + VERIEXEC \ > + WG > > .if ${MK_IPFILTER} != "no" > INCSGROUPS+= IPFILTER > diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c > index 86bacc59f50d..a102f392cf80 100644 > --- a/sbin/ifconfig/ifwg.c > +++ b/sbin/ifconfig/ifwg.c > @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > + > #include > #include > #include > @@ -65,40 +67,60 @@ __FBSDID("$FreeBSD$"); > > #include "ifconfig.h" > > -typedef enum { > - WGC_GET = 0x5, > - WGC_SET = 0x6, > -} wg_cmd_t; > +static void wgfinish(int s, void *arg); > + > +static bool wgfinish_registered; > > -static nvlist_t *nvl_params; > -static bool do_peer; > static int allowed_ips_count; > static int allowed_ips_max; > -struct allowedip { > - struct sockaddr_storage a_addr; > - struct sockaddr_storage a_mask; > -}; > -struct allowedip *allowed_ips; > +static nvlist_t **allowed_ips, *nvl_peer; > > #define ALLOWEDIPS_START 16 > -#define WG_KEY_LEN 32 > -#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) > -#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) > +#define WG_KEY_SIZE_BASE64 ((((WG_KEY_SIZE) + 2) / 3) * 4 + 1) > +#define WG_KEY_SIZE_HEX (WG_KEY_SIZE * 2 + 1) > #define WG_MAX_STRLEN 64 > > +struct allowedip { > + union { > + struct in_addr ip4; > + struct in6_addr ip6; > + }; > +}; > + > +static void > +register_wgfinish(void) > +{ > + > + if (wgfinish_registered) > + return; > + callback_register(wgfinish, NULL); > + wgfinish_registered = true; > +} > + > +static nvlist_t * > +nvl_device(void) > +{ > + static nvlist_t *_nvl_device; > + > + if (_nvl_device == NULL) > + _nvl_device = nvlist_create(0); > + register_wgfinish(); > + return (_nvl_device); > +} > + > static bool > -key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) > +key_from_base64(uint8_t key[static WG_KEY_SIZE], const char *base64) > { > > - if (strlen(base64) != WG_KEY_LEN_BASE64 - 1) { > - warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - 1, strlen(base64)); > + if (strlen(base64) != WG_KEY_SIZE_BASE64 - 1) { > + warnx("bad key len - need %d got %zu\n", WG_KEY_SIZE_BASE64 - 1, strlen(base64)); > return false; > } > - if (base64[WG_KEY_LEN_BASE64 - 2] != '=') { > - warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_LEN_BASE64 - 2]); > + if (base64[WG_KEY_SIZE_BASE64 - 2] != '=') { > + warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_SIZE_BASE64 - 2]); > return false; > } > - return (b64_pton(base64, key, WG_KEY_LEN)); > + return (b64_pton(base64, key, WG_KEY_SIZE)); > } > > static void > @@ -128,7 +150,7 @@ parse_endpoint(const char *endpoint_) > err = getaddrinfo(endpoint, port, &hints, &res); > if (err) > errx(1, "%s", gai_strerror(err)); > - nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, res->ai_addrlen); > + nvlist_add_binary(nvl_peer, "endpoint", res->ai_addr, res->ai_addrlen); > freeaddrinfo(res); > free(base); > } > @@ -227,12 +249,14 @@ in6_mask2len(struct in6_addr *mask, u_char *lim0) > } > > static bool > -parse_ip(struct allowedip *aip, const char *value) > +parse_ip(struct allowedip *aip, uint16_t *family, const char *value) > { > struct addrinfo hints, *res; > int err; > + bool ret; > > - bzero(&aip->a_addr, sizeof(aip->a_addr)); > + ret = true; > + bzero(aip, sizeof(*aip)); > bzero(&hints, sizeof(hints)); > hints.ai_family = AF_UNSPEC; > hints.ai_flags = AI_NUMERICHOST; > @@ -240,10 +264,21 @@ parse_ip(struct allowedip *aip, const char *value) > if (err) > errx(1, "%s", gai_strerror(err)); > > - memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); > + *family = res->ai_family; > + if (res->ai_family == AF_INET) { > + struct sockaddr_in *sin = (struct sockaddr_in *)res->ai_addr; > + > + aip->ip4 = sin->sin_addr; > + } else if (res->ai_family == AF_INET6) { > + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)res->ai_addr; > + > + aip->ip6 = sin6->sin6_addr; > + } else { > + ret = false; > + } > > freeaddrinfo(res); > - return (true); > + return (ret); > } > > static void > @@ -271,61 +306,84 @@ sa_ntop(const struct sockaddr *sa, char *buf, int *port) > } > > static void > -dump_peer(const nvlist_t *nvl_peer) > +dump_peer(const nvlist_t *nvl_peer_cfg) > { > const void *key; > - const struct allowedip *aips; > const struct sockaddr *endpoint; > char outbuf[WG_MAX_STRLEN]; > char addr_buf[INET6_ADDRSTRLEN]; > - size_t size; > - int count, port; > + size_t aip_count, size; > + int port; > uint16_t persistent_keepalive; > + const nvlist_t * const *nvl_aips; > > printf("[Peer]\n"); > - if (nvlist_exists_binary(nvl_peer, "public-key")) { > - key = nvlist_get_binary(nvl_peer, "public-key", &size); > + if (nvlist_exists_binary(nvl_peer_cfg, "public-key")) { > + key = nvlist_get_binary(nvl_peer_cfg, "public-key", &size); > b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); > printf("PublicKey = %s\n", outbuf); > } > - if (nvlist_exists_binary(nvl_peer, "endpoint")) { > - endpoint = nvlist_get_binary(nvl_peer, "endpoint", &size); > + if (nvlist_exists_binary(nvl_peer_cfg, "preshared-key")) { > + key = nvlist_get_binary(nvl_peer_cfg, "preshared-key", &size); > + b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); > + printf("PresharedKey = %s\n", outbuf); > + } > + if (nvlist_exists_binary(nvl_peer_cfg, "endpoint")) { > + endpoint = nvlist_get_binary(nvl_peer_cfg, "endpoint", &size); > sa_ntop(endpoint, addr_buf, &port); > printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); > } > - if (nvlist_exists_number(nvl_peer, "persistent-keepalive-interval")) { > - persistent_keepalive = nvlist_get_number(nvl_peer, > + if (nvlist_exists_number(nvl_peer_cfg, > + "persistent-keepalive-interval")) { > + persistent_keepalive = nvlist_get_number(nvl_peer_cfg, > "persistent-keepalive-interval"); > printf("PersistentKeepalive = %d\n", persistent_keepalive); > } > - if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) > + if (!nvlist_exists_nvlist_array(nvl_peer_cfg, "allowed-ips")) > return; > - aips = nvlist_get_binary(nvl_peer, "allowed-ips", &size); > - if (size == 0 || size % sizeof(struct allowedip) != 0) { > - errx(1, "size %zu not integer multiple of allowedip", size); > - } > + > + nvl_aips = nvlist_get_nvlist_array(nvl_peer_cfg, "allowed-ips", &aip_count); > + if (nvl_aips == NULL || aip_count == 0) > + return; > + > printf("AllowedIPs = "); > - count = size / sizeof(struct allowedip); > - for (int i = 0; i < count; i++) { > - int mask; > + for (size_t i = 0; i < aip_count; i++) { > + uint8_t cidr; > + struct sockaddr_storage ss; > sa_family_t family; > - void *bitmask; > - struct sockaddr *sa; > - > - sa = __DECONST(void *, &aips[i].a_addr); > - bitmask = __DECONST(void *, > - ((const struct sockaddr *)&(&aips[i])->a_mask)->sa_data); > - family = aips[i].a_addr.ss_family; > - getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, > - 0, NI_NUMERICHOST); > - if (family == AF_INET) > - mask = in_mask2len(bitmask); > - else if (family == AF_INET6) > - mask = in6_mask2len(bitmask, NULL); > - else > - errx(1, "bad family in peer %d\n", family); > - printf("%s/%d", addr_buf, mask); > - if (i < count -1) > + > + if (!nvlist_exists_number(nvl_aips[i], "cidr")) > + continue; > + cidr = nvlist_get_number(nvl_aips[i], "cidr"); > + if (nvlist_exists_binary(nvl_aips[i], "ipv4")) { > + struct sockaddr_in *sin = (struct sockaddr_in *)&ss; > + const struct in_addr *ip4; > + > + ip4 = nvlist_get_binary(nvl_aips[i], "ipv4", &size); > + if (ip4 == NULL || cidr > 32) > + continue; > + sin->sin_len = sizeof(*sin); > + sin->sin_family = AF_INET; > + sin->sin_addr = *ip4; > + } else if (nvlist_exists_binary(nvl_aips[i], "ipv6")) { > + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&ss; > + const struct in6_addr *ip6; > + > + ip6 = nvlist_get_binary(nvl_aips[i], "ipv6", &size); > + if (ip6 == NULL || cidr > 128) > + continue; > + sin6->sin6_len = sizeof(*sin6); > + sin6->sin6_family = AF_INET6; > + sin6->sin6_addr = *ip6; > + } else { > + continue; > + } > + > + family = ss.ss_family; > + getnameinfo((struct sockaddr *)&ss, ss.ss_len, addr_buf, > + INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); > + printf("%s/%d", addr_buf, cidr); > + if (i < aip_count - 1) > printf(", "); > } > printf("\n"); > @@ -334,36 +392,34 @@ dump_peer(const nvlist_t *nvl_peer) > static int > get_nvl_out_size(int sock, u_long op, size_t *size) > { > - struct ifdrv ifd; > + struct wg_data_io wgd; > int err; > > - memset(&ifd, 0, sizeof(ifd)); > + memset(&wgd, 0, sizeof(wgd)); > > - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > - ifd.ifd_cmd = op; > - ifd.ifd_len = 0; > - ifd.ifd_data = NULL; > + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); > + wgd.wgd_size = 0; > + wgd.wgd_data = NULL; > > - err = ioctl(sock, SIOCGDRVSPEC, &ifd); > + err = ioctl(sock, op, &wgd); > if (err) > return (err); > - *size = ifd.ifd_len; > + *size = wgd.wgd_size; > return (0); > } > > static int > do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) > { > - struct ifdrv ifd; > + struct wg_data_io wgd; > > - memset(&ifd, 0, sizeof(ifd)); > + memset(&wgd, 0, sizeof(wgd)); > > - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > - ifd.ifd_cmd = op; > - ifd.ifd_len = argsize; > - ifd.ifd_data = arg; > + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); > + wgd.wgd_size = argsize; > + wgd.wgd_data = arg; > > - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); > + return (ioctl(sock, op, &wgd)); > } > > static > @@ -371,62 +427,83 @@ DECL_CMD_FUNC(peerlist, val, d) > { > size_t size, peercount; > void *packed; > - const nvlist_t *nvl, *nvl_peer; > + const nvlist_t *nvl; > const nvlist_t *const *nvl_peerlist; > > - if (get_nvl_out_size(s, WGC_GET, &size)) > + if (get_nvl_out_size(s, SIOCGWG, &size)) > errx(1, "can't get peer list size"); > if ((packed = malloc(size)) == NULL) > errx(1, "malloc failed for peer list"); > - if (do_cmd(s, WGC_GET, packed, size, 0)) > + if (do_cmd(s, SIOCGWG, packed, size, 0)) > errx(1, "failed to obtain peer list"); > > nvl = nvlist_unpack(packed, size, 0); > - if (!nvlist_exists_nvlist_array(nvl, "peer-list")) > + if (!nvlist_exists_nvlist_array(nvl, "peers")) > return; > - nvl_peerlist = nvlist_get_nvlist_array(nvl, "peer-list", &peercount); > + nvl_peerlist = nvlist_get_nvlist_array(nvl, "peers", &peercount); > > for (int i = 0; i < peercount; i++, nvl_peerlist++) { > - nvl_peer = *nvl_peerlist; > - dump_peer(nvl_peer); > + dump_peer(*nvl_peerlist); > } > } > > static void > -peerfinish(int s, void *arg) > +wgfinish(int s, void *arg) > { > - nvlist_t *nvl, **nvl_array; > void *packed; > size_t size; > + static nvlist_t *nvl_dev; > + > + nvl_dev = nvl_device(); > + if (nvl_peer != NULL) { > + if (!nvlist_exists_binary(nvl_peer, "public-key")) > + errx(1, "must specify a public-key for adding peer"); > + if (allowed_ips_count != 0) { > + nvlist_add_nvlist_array(nvl_peer, "allowed-ips", > + (const nvlist_t * const *)allowed_ips, > + allowed_ips_count); > + for (size_t i = 0; i < allowed_ips_count; i++) { > + nvlist_destroy(allowed_ips[i]); > + } > + > + free(allowed_ips); > + } > + > + nvlist_add_nvlist_array(nvl_dev, "peers", > + (const nvlist_t * const *)&nvl_peer, 1); > + } > + > + packed = nvlist_pack(nvl_dev, &size); > > - if ((nvl = nvlist_create(0)) == NULL) > - errx(1, "failed to allocate nvlist"); > - if ((nvl_array = calloc(sizeof(void *), 1)) == NULL) > - errx(1, "failed to allocate nvl_array"); > - if (!nvlist_exists_binary(nvl_params, "public-key")) > - errx(1, "must specify a public-key for adding peer"); > - if (allowed_ips_count == 0) > - errx(1, "must specify at least one range of allowed-ips to add a peer"); > - > - nvl_array[0] = nvl_params; > - nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const *)nvl_array, 1); > - packed = nvlist_pack(nvl, &size); > - > - if (do_cmd(s, WGC_SET, packed, size, true)) > - errx(1, "failed to install peer"); > + if (do_cmd(s, SIOCSWG, packed, size, true)) > + errx(1, "failed to configure"); > } > > static > DECL_CMD_FUNC(peerstart, val, d) > { > - do_peer = true; > - callback_register(peerfinish, NULL); > - allowed_ips = malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); > + > + if (nvl_peer != NULL) > + errx(1, "cannot both add and remove a peer"); > + register_wgfinish(); > + nvl_peer = nvlist_create(0); > + allowed_ips = calloc(ALLOWEDIPS_START, sizeof(*allowed_ips)); > allowed_ips_max = ALLOWEDIPS_START; > if (allowed_ips == NULL) > errx(1, "failed to allocate array for allowedips"); > } > > +static > +DECL_CMD_FUNC(peerdel, val, d) > +{ > + > + if (nvl_peer != NULL) > + errx(1, "cannot both add and remove a peer"); > + register_wgfinish(); > + nvl_peer = nvlist_create(0); > + nvlist_add_bool(nvl_peer, "remove", true); > +} > + > static > DECL_CMD_FUNC(setwglistenport, val, d) > { > @@ -454,39 +531,53 @@ DECL_CMD_FUNC(setwglistenport, val, d) > errx(1, "unknown family"); > } > ul = ntohs((u_short)ul); > - nvlist_add_number(nvl_params, "listen-port", ul); > + nvlist_add_number(nvl_device(), "listen-port", ul); > } > > static > DECL_CMD_FUNC(setwgprivkey, val, d) > { > - uint8_t key[WG_KEY_LEN]; > + uint8_t key[WG_KEY_SIZE]; > > if (!key_from_base64(key, val)) > errx(1, "invalid key %s", val); > - nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); > + nvlist_add_binary(nvl_device(), "private-key", key, WG_KEY_SIZE); > } > > static > DECL_CMD_FUNC(setwgpubkey, val, d) > { > - uint8_t key[WG_KEY_LEN]; > + uint8_t key[WG_KEY_SIZE]; > > - if (!do_peer) > + if (nvl_peer == NULL) > errx(1, "setting public key only valid when adding peer"); > > if (!key_from_base64(key, val)) > errx(1, "invalid key %s", val); > - nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); > + nvlist_add_binary(nvl_peer, "public-key", key, WG_KEY_SIZE); > } > > +static > +DECL_CMD_FUNC(setwgpresharedkey, val, d) > +{ > + uint8_t key[WG_KEY_SIZE]; > + > + if (nvl_peer == NULL) > + errx(1, "setting preshared-key only valid when adding peer"); > + > + if (!key_from_base64(key, val)) > + errx(1, "invalid key %s", val); > + nvlist_add_binary(nvl_peer, "preshared-key", key, WG_KEY_SIZE); > +} > + > + > static > DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) > { > unsigned long persistent_keepalive; > char *endp; > > - if (!do_peer) > + if (nvl_peer == NULL) > errx(1, "setting persistent keepalive only valid when adding peer"); > > errno = 0; > @@ -496,7 +587,7 @@ DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) > if (persistent_keepalive > USHRT_MAX) > errx(1, "persistent-keepalive '%lu' too large", > persistent_keepalive); > - nvlist_add_number(nvl_params, "persistent-keepalive-interval", > + nvlist_add_number(nvl_peer, "persistent-keepalive-interval", > persistent_keepalive); > } > > @@ -506,45 +597,57 @@ DECL_CMD_FUNC(setallowedips, val, d) > char *base, *allowedip, *mask; > u_long ul; > char *endp; > - struct allowedip *aip; > + struct allowedip aip; > + nvlist_t *nvl_aip; > + uint16_t family; > > - if (!do_peer) > + if (nvl_peer == NULL) > errx(1, "setting allowed ip only valid when adding peer"); > if (allowed_ips_count == allowed_ips_max) { > - /* XXX grow array */ > + allowed_ips_max *= 2; > + allowed_ips = reallocarray(allowed_ips, allowed_ips_max, > + sizeof(*allowed_ips)); > + if (allowed_ips == NULL) > + errx(1, "failed to grow allowed ip array"); > } > - aip = &allowed_ips[allowed_ips_count]; > + > + allowed_ips[allowed_ips_count] = nvl_aip = nvlist_create(0); > + if (nvl_aip == NULL) > + errx(1, "failed to create new allowedip nvlist"); > + > base = allowedip = strdup(val); > mask = index(allowedip, '/'); > if (mask == NULL) > errx(1, "mask separator not found in allowedip %s", val); > *mask = '\0'; > mask++; > - parse_ip(aip, allowedip); > + > + parse_ip(&aip, &family, allowedip); > ul = strtoul(mask, &endp, 0); > if (*endp != '\0') > errx(1, "invalid value for allowedip mask"); > - bzero(&aip->a_mask, sizeof(aip->a_mask)); > - if (aip->a_addr.ss_family == AF_INET) > - in_len2mask((struct in_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); > - else if (aip->a_addr.ss_family == AF_INET6) > - in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); > - else > - errx(1, "invalid address family %d\n", aip->a_addr.ss_family); > + > + nvlist_add_number(nvl_aip, "cidr", ul); > + if (family == AF_INET) { > + nvlist_add_binary(nvl_aip, "ipv4", &aip.ip4, sizeof(aip.ip4)); > + } else if (family == AF_INET6) { > + nvlist_add_binary(nvl_aip, "ipv6", &aip.ip6, sizeof(aip.ip6)); > + } else { > + /* Shouldn't happen */ > + nvlist_destroy(nvl_aip); > + goto out; > + } > + > allowed_ips_count++; > - if (allowed_ips_count > 1) > - nvlist_free_binary(nvl_params, "allowed-ips"); > - nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, > - allowed_ips_count*sizeof(*aip)); > > - dump_peer(nvl_params); > +out: > free(base); > } > > static > DECL_CMD_FUNC(setendpoint, val, d) > { > - if (!do_peer) > + if (nvl_peer == NULL) > errx(1, "setting endpoint only valid when adding peer"); > parse_endpoint(val); > } > @@ -555,15 +658,15 @@ wireguard_status(int s) > size_t size; > void *packed; > nvlist_t *nvl; > - char buf[WG_KEY_LEN_BASE64]; > + char buf[WG_KEY_SIZE_BASE64]; > const void *key; > uint16_t listen_port; > > - if (get_nvl_out_size(s, WGC_GET, &size)) > + if (get_nvl_out_size(s, SIOCGWG, &size)) > return; > if ((packed = malloc(size)) == NULL) > return; > - if (do_cmd(s, WGC_GET, packed, size, 0)) > + if (do_cmd(s, SIOCGWG, packed, size, 0)) > return; > nvl = nvlist_unpack(packed, size, 0); > if (nvlist_exists_number(nvl, "listen-port")) { > @@ -583,10 +686,14 @@ wireguard_status(int s) > } > > static struct cmd wireguard_cmds[] = { > - DEF_CLONE_CMD_ARG("listen-port", setwglistenport), > - DEF_CLONE_CMD_ARG("private-key", setwgprivkey), > + DEF_CMD_ARG("listen-port", setwglistenport), > + DEF_CMD_ARG("private-key", setwgprivkey), > + /* XXX peer-list is deprecated. */ > DEF_CMD("peer-list", 0, peerlist), > + DEF_CMD("peers", 0, peerlist), > DEF_CMD("peer", 0, peerstart), > + DEF_CMD("-peer", 0, peerdel), > + DEF_CMD_ARG("preshared-key", setwgpresharedkey), > DEF_CMD_ARG("public-key", setwgpubkey), > DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), > DEF_CMD_ARG("allowed-ips", setallowedips), > @@ -602,27 +709,10 @@ static struct afswtch af_wireguard = { > static void > wg_create(int s, struct ifreq *ifr) > { > - struct iovec iov; > - void *packed; > - size_t size; > > setproctitle("ifconfig %s create ...\n", name); > - if (!nvlist_exists_number(nvl_params, "listen-port")) > - goto legacy; > - if (!nvlist_exists_binary(nvl_params, "private-key")) > - goto legacy; > - > - packed = nvlist_pack(nvl_params, &size); > - if (packed == NULL) > - errx(1, "failed to setup create request"); > - iov.iov_len = size; > - iov.iov_base = packed; > - ifr->ifr_data = (caddr_t)&iov; > - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) > - err(1, "SIOCIFCREATE2"); > - return; > -legacy: > - ifr->ifr_data == NULL; > + > + ifr->ifr_data = NULL; > if (ioctl(s, SIOCIFCREATE, ifr) < 0) > err(1, "SIOCIFCREATE"); > } > @@ -632,7 +722,6 @@ wireguard_ctor(void) > { > int i; > > - nvl_params = nvlist_create(0); > for (i = 0; i < nitems(wireguard_cmds); i++) > cmd_register(&wireguard_cmds[i]); > af_register(&af_wireguard); > diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 > index 335d3e70b64a..29215bd438ff 100644 > --- a/share/man/man4/wg.4 > +++ b/share/man/man4/wg.4 > @@ -23,7 +23,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd March 9, 2021 > +.Dd March 12, 2021 > .Dt WG 4 > .Os > .Sh NAME > @@ -68,7 +68,7 @@ interface. > The private key of the > .Nm > interface. > -.It Cm pre-shared-key > +.It Cm preshared-key > Defines a pre-shared key for the > .Nm > interface. > @@ -76,9 +76,9 @@ interface. > A list of allowed IP addresses. > .It Cm endpoint > The IP address of the WiredGuard to connect to. > -.It Cm peer-list > +.It Cm peers > A list of peering IP addresses to connect to. > -.It Cm persistent-keepalive > +.It Cm persistent-keepalive-interval > Interval, in seconds, at which to send persistent keepalive packets. > .El > .Pp > @@ -188,6 +188,11 @@ Connect to a specific endpoint using its public-key and set the allowed IP addre > .Bd -literal -offset indent > # ifconfig wg0 peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100:54321 allowed-ips 192.168.2.100/32 > .Ed > +.Pp > +Remove a peer > +.Bd -literal -offset indent > +# ifconfig wg0 -peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' > +.Ed > .Sh DIAGNOSTICS > The > .Nm > @@ -240,14 +245,11 @@ device driver first appeared in > .Sh AUTHORS > The > .Nm > -device driver was originally written for > -.Ox > -by > -.An Matt Dunwoodie Aq Mt ncon@nconroy.net > -and ported to > -.Fx > -by > -.An Matt Macy Aq Mt mmacy@FreeBSD.org . > +device driver written by > +.An Jason A. Donenfeld Aq Mt Jason@zx2c4.com , > +.An Matt Dunwoodie Aq Mt ncon@nconroy.net , > +and > +.An Kyle Evans Aq Mt kevans@FreeBSD.org . > .Pp > This manual page was written by > .An Gordon Bergling Aq Mt gbe@FreeBSD.org > diff --git a/sys/dev/if_wg/crypto.c b/sys/dev/if_wg/crypto.c > new file mode 100644 > index 000000000000..f28585429272 > --- /dev/null > +++ b/sys/dev/if_wg/crypto.c > @@ -0,0 +1,1705 @@ > +/* > + * Copyright (C) 2015-2021 Jason A. Donenfeld . All Rights Reserved. > + * > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +#include > +#include > +#include > + > +#include "crypto.h" > + > +#ifndef ARRAY_SIZE > +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) > +#endif > +#ifndef noinline > +#define noinline __attribute__((noinline)) > +#endif > +#ifndef __aligned > +#define __aligned(x) __attribute__((aligned(x))) > +#endif > +#ifndef DIV_ROUND_UP > +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) > +#endif > + > +#define le32_to_cpup(a) le32toh(*(a)) > +#define le64_to_cpup(a) le64toh(*(a)) > +#define cpu_to_le32(a) htole32(a) > +#define cpu_to_le64(a) htole64(a) > + > +static inline uint32_t get_unaligned_le32(const uint8_t *a) > +{ > + uint32_t l; > + __builtin_memcpy(&l, a, sizeof(l)); > + return le32_to_cpup(&l); > +} > +static inline uint64_t get_unaligned_le64(const uint8_t *a) > +{ > + uint64_t l; > + __builtin_memcpy(&l, a, sizeof(l)); > + return le64_to_cpup(&l); > +} > +static inline void put_unaligned_le32(uint32_t s, uint8_t *d) > +{ > + uint32_t l = cpu_to_le32(s); > + __builtin_memcpy(d, &l, sizeof(l)); > +} > +static inline void cpu_to_le32_array(uint32_t *buf, unsigned int words) > +{ > + while (words--) { > + *buf = cpu_to_le32(*buf); > + ++buf; > + } > +} > +static inline void le32_to_cpu_array(uint32_t *buf, unsigned int words) > +{ > + while (words--) { > + *buf = le32_to_cpup(buf); > + ++buf; > + } > +} > + > +static inline uint32_t rol32(uint32_t word, unsigned int shift) > +{ > + return (word << (shift & 31)) | (word >> ((-shift) & 31)); > +} > +static inline uint32_t ror32(uint32_t word, unsigned int shift) > +{ > + return (word >> (shift & 31)) | (word << ((-shift) & 31)); > +} > + > +static void xor_cpy(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, > + size_t len) > +{ > + size_t i; > + > + for (i = 0; i < len; ++i) > + dst[i] = src1[i] ^ src2[i]; > +} > + > +#define QUARTER_ROUND(x, a, b, c, d) ( \ > + x[a] += x[b], \ > *** 50620 LINES SKIPPED *** > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" From owner-dev-commits-src-main@freebsd.org Mon Mar 15 17:52:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E133C5AA92E; Mon, 15 Mar 2021 17:52:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzkXB65nLz3hWR; Mon, 15 Mar 2021 17:52:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4DC61500A; Mon, 15 Mar 2021 17:52:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FHqQnb082038; Mon, 15 Mar 2021 17:52:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FHqQ6H082037; Mon, 15 Mar 2021 17:52:26 GMT (envelope-from git) Date: Mon, 15 Mar 2021 17:52:26 GMT Message-Id: <202103151752.12FHqQ6H082037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 8ea35c45d520 - main - Include ccompile.h after opt_global.h. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ea35c45d5206ad57945ba160484f04450c88b75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 17:52:26 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea35c45d5206ad57945ba160484f04450c88b75 commit 8ea35c45d5206ad57945ba160484f04450c88b75 Author: Alexander Motin AuthorDate: 2021-03-15 17:48:50 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 17:52:23 +0000 Include ccompile.h after opt_global.h. This restores INVARIANTS enabling ZFS_DEBUG when built as module. Discussed with: freqlabs MFC after: 1 week --- sys/modules/zfs/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile index 0fab9f552314..983f0aa0e994 100644 --- a/sys/modules/zfs/Makefile +++ b/sys/modules/zfs/Makefile @@ -22,8 +22,6 @@ CFLAGS+= -I${INCDIR}/os/freebsd CFLAGS+= -I${INCDIR}/os/freebsd/spl CFLAGS+= -I${INCDIR}/os/freebsd/zfs CFLAGS+= -I${SRCDIR}/zstd/include -CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h -CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h CFLAGS+= -I${.CURDIR} CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS \ @@ -284,6 +282,8 @@ SRCS+= zfs_zstd.c \ .include CFLAGS+= -include ${SRCTOP}/sys/cddl/compat/opensolaris/sys/debug_compat.h +CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} From owner-dev-commits-src-main@freebsd.org Mon Mar 15 21:24:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D78F5AFDEA; Mon, 15 Mar 2021 21:24:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzqF10DVkz4T3d; Mon, 15 Mar 2021 21:24:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE32A17B8B; Mon, 15 Mar 2021 21:24:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FLOafb060655; Mon, 15 Mar 2021 21:24:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FLOaK1060654; Mon, 15 Mar 2021 21:24:36 GMT (envelope-from git) Date: Mon, 15 Mar 2021 21:24:36 GMT Message-Id: <202103152124.12FLOaK1060654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: e4ac3f746377 - main - Fix fib algo rebuild delay calculation. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4ac3f74637778981b2d89745188bb2a39e24e42 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 21:24:37 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=e4ac3f74637778981b2d89745188bb2a39e24e42 commit e4ac3f74637778981b2d89745188bb2a39e24e42 Author: Alexander V. Chernikov AuthorDate: 2021-03-15 21:09:07 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-15 21:09:07 +0000 Fix fib algo rebuild delay calculation. Submitted by: Marco Zec MFC after: 3 days --- sys/net/route/fib_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index b2aa2de087de..03c265d28d09 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -462,7 +462,7 @@ static void schedule_callout(struct fib_data *fd, int delay_ms) { - callout_reset_sbt(&fd->fd_callout, 0, SBT_1MS * delay_ms, + callout_reset_sbt(&fd->fd_callout, SBT_1MS * delay_ms, 0, rebuild_fd_callout, fd, 0); } From owner-dev-commits-src-main@freebsd.org Tue Mar 16 00:00:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34F0656C7EB; Tue, 16 Mar 2021 00:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DztjH02G7z4dbR; Tue, 16 Mar 2021 00:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E87721985D; Tue, 16 Mar 2021 00:00:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G00o8q068392; Tue, 16 Mar 2021 00:00:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G00omA068391; Tue, 16 Mar 2021 00:00:50 GMT (envelope-from git) Date: Tue, 16 Mar 2021 00:00:50 GMT Message-Id: <202103160000.12G00omA068391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 283352dd4f6a - main - Stop installing kernel-only crypto headers to /usr/include/crypto. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 00:00:51 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 commit 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 Author: John Baldwin AuthorDate: 2021-03-16 00:00:21 +0000 Commit: John Baldwin CommitDate: 2021-03-16 00:00:21 +0000 Stop installing kernel-only crypto headers to /usr/include/crypto. The only user-facing header from OCF is . PR: 254167 (exp-run) MFC after: 1 week Sponsored by: Chelsio Communications --- ObsoleteFiles.inc | 12 ++++++++++++ include/Makefile | 16 +--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 8f56ef29dad5..f111a2f83064 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,18 @@ # xargs -n1 | sort | uniq -d; # done +# 20210315: Remove kernel-only crypto headers from /usr/include +OLD_FILES+=usr/include/crypto/_cryptodev.h +OLD_FILES+=usr/include/crypto/cbc_mac.h +OLD_FILES+=usr/include/crypto/deflate.h +OLD_FILES+=usr/include/crypto/gfmult.h +OLD_FILES+=usr/include/crypto/gmac.h +OLD_FILES+=usr/include/crypto/rmd160.h +OLD_FILES+=usr/include/crypto/xform.h +OLD_FILES+=usr/include/crypto/xform_auth.h +OLD_FILES+=usr/include/crypto/xform_comp.h +OLD_FILES+=usr/include/crypto/xform_enc.h + # 20210305: removed Poly1305_* symbols OLD_FILES+=usr/include/crypto/xform_poly1305.h diff --git a/include/Makefile b/include/Makefile index 31e207f6b199..8ddfd7015918 100644 --- a/include/Makefile +++ b/include/Makefile @@ -84,10 +84,6 @@ FS9660= cd9660_mount.h \ iso_rrip.h FS9660DIR= ${INCLUDEDIR}/isofs/cd9660 -.PATH: ${SRCTOP}/sys/crypto -CRYPTO= rijndael/rijndael.h -CRYPTODIR= ${INCLUDEDIR}/crypto - .PATH: ${SRCTOP}/sys/dev/evdev EVDEV= input.h \ input-event-codes.h \ @@ -105,17 +101,7 @@ HYPERV= hv_snapshot.h \ HYPERVDIR= ${INCLUDEDIR}/dev/hyperv .PATH: ${SRCTOP}/sys/opencrypto -OPENCRYPTO= _cryptodev.h \ - cbc_mac.h \ - cryptodev.h \ - deflate.h \ - gfmult.h \ - gmac.h \ - rmd160.h \ - xform.h \ - xform_auth.h \ - xform_comp.h \ - xform_enc.h +OPENCRYPTO= cryptodev.h OPENCRYPTODIR= ${INCLUDEDIR}/crypto .PATH: ${SRCTOP}/sys/dev/pci From owner-dev-commits-src-main@freebsd.org Tue Mar 16 00:14:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2124056CD50; Tue, 16 Mar 2021 00:14:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dzv1P0PY3z4fk2; Tue, 16 Mar 2021 00:14:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 003601A00E; Tue, 16 Mar 2021 00:14:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G0EmvE086624; Tue, 16 Mar 2021 00:14:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G0Emgw086623; Tue, 16 Mar 2021 00:14:48 GMT (envelope-from git) Date: Tue, 16 Mar 2021 00:14:48 GMT Message-Id: <202103160014.12G0Emgw086623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: c2460d7cfe9f - main - factor out PT page allocation/freeing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2460d7cfe9fab30459ce495f08544a237a5baa3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 00:14:49 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=c2460d7cfe9fab30459ce495f08544a237a5baa3 commit c2460d7cfe9fab30459ce495f08544a237a5baa3 Author: Jason A. Harmening AuthorDate: 2021-03-01 16:42:05 +0000 Commit: Jason A. Harmening CommitDate: 2021-03-16 00:14:43 +0000 factor out PT page allocation/freeing As follow-on work to e4b8deb222278b2a, move page table page allocation and freeing into their own functions. Use these functions to provide separate kernel vs. user page table page accounting, and to wrap common tasks such as management of zero-filled page state. Requested by: markj, kib Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29151 --- sys/amd64/amd64/pmap.c | 201 +++++++++++++++++++++++++++---------------------- 1 file changed, 109 insertions(+), 92 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d153f937b888..57d7a42800a1 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -761,9 +762,15 @@ static COUNTER_U64_DEFINE_EARLY(pv_page_count); SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pv_page_count, CTLFLAG_RD, &pv_page_count, "Current number of allocated pv pages"); -static COUNTER_U64_DEFINE_EARLY(pt_page_count); -SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pt_page_count, CTLFLAG_RD, - &pt_page_count, "Current number of allocated page table pages"); +static COUNTER_U64_DEFINE_EARLY(user_pt_page_count); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, user_pt_page_count, CTLFLAG_RD, + &user_pt_page_count, + "Current number of allocated page table pages for userspace"); + +static COUNTER_U64_DEFINE_EARLY(kernel_pt_page_count); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, kernel_pt_page_count, CTLFLAG_RD, + &kernel_pt_page_count, + "Current number of allocated page table pages for the kernel"); #ifdef PV_STATS @@ -1290,6 +1297,9 @@ static void _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free); static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t, struct spglist *); +static vm_page_t pmap_alloc_pt_page(pmap_t, vm_pindex_t, int); +static void pmap_free_pt_page(pmap_t, vm_page_t, bool); + /********************/ /* Inline functions */ /********************/ @@ -1456,22 +1466,26 @@ pmap_pte(pmap_t pmap, vm_offset_t va) } static __inline void -pmap_resident_count_inc(pmap_t pmap, int count) +pmap_resident_count_adj(pmap_t pmap, int count) { PMAP_LOCK_ASSERT(pmap, MA_OWNED); + KASSERT(pmap->pm_stats.resident_count + count >= 0, + ("pmap %p resident count underflow %ld %d", pmap, + pmap->pm_stats.resident_count, count)); pmap->pm_stats.resident_count += count; } static __inline void -pmap_resident_count_dec(pmap_t pmap, int count) +pmap_pt_page_count_adj(pmap_t pmap, int count) { - - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - KASSERT(pmap->pm_stats.resident_count >= count, - ("pmap %p resident count underflow %ld %d", pmap, - pmap->pm_stats.resident_count, count)); - pmap->pm_stats.resident_count -= count; + if (pmap == kernel_pmap) + counter_u64_add(kernel_pt_page_count, count); + else { + if (pmap != NULL) + pmap_resident_count_adj(pmap, count); + counter_u64_add(user_pt_page_count, count); + } } PMAP_INLINE pt_entry_t * @@ -2138,6 +2152,7 @@ pmap_bootstrap_la57(void *arg __unused) kernel_pmap->pm_cr3 = KPML5phys; kernel_pmap->pm_pmltop = v_pml5; + pmap_pt_page_count_adj(kernel_pmap, 1); } SYSINIT(la57, SI_SUB_KMEM, SI_ORDER_ANY, pmap_bootstrap_la57, NULL); @@ -4003,7 +4018,6 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) pd = pmap_pde(pmap, va); *pd = 0; } - pmap_resident_count_dec(pmap, 1); if (m->pindex < NUPDE) { /* We just released a PT, unhold the matching PD */ pdpg = PHYS_TO_VM_PAGE(*pmap_pdpe(pmap, va) & PG_FRAME); @@ -4018,7 +4032,7 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) pmap_unwire_ptp(pmap, va, pml4pg, free); } - counter_u64_add(pt_page_count, -1); + pmap_pt_page_count_adj(pmap, -1); /* * Put page on a list so that it is released after @@ -4183,6 +4197,44 @@ pmap_pinit_pml5_pti(vm_page_t pml5pgu) pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, FALSE); } +/* Allocate a page table page and do related bookkeeping */ +static vm_page_t +pmap_alloc_pt_page(pmap_t pmap, vm_pindex_t pindex, int flags) +{ + vm_page_t m; + + m = vm_page_alloc(NULL, pindex, flags | VM_ALLOC_NOOBJ); + if (__predict_false(m == NULL)) + return (NULL); + + pmap_pt_page_count_adj(pmap, 1); + + if ((flags & VM_ALLOC_ZERO) != 0 && (m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + + return (m); +} + +static void +pmap_free_pt_page(pmap_t pmap, vm_page_t m, bool zerofilled) +{ + /* + * This function assumes the page will need to be unwired, + * even though the counterpart allocation in pmap_alloc_pt_page() + * doesn't enforce VM_ALLOC_WIRED. However, all current uses + * of pmap_free_pt_page() require unwiring. The case in which + * a PT page doesn't require unwiring because its ref_count has + * naturally reached 0 is handled through _pmap_unwire_ptp(). + */ + vm_page_unwire_noq(m); + if (zerofilled) + vm_page_free_zero(m); + else + vm_page_free(m); + + pmap_pt_page_count_adj(pmap, -1); +} + /* * Initialize a preallocated and zeroed pmap structure, * such as one in a vmspace structure. @@ -4197,11 +4249,9 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) /* * allocate the page directory page */ - pmltop_pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); - counter_u64_add(pt_page_count, 1); - pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); @@ -4214,8 +4264,6 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmap->pm_pmltopu = NULL; pmap->pm_type = pm_type; - if ((pmltop_pg->flags & PG_ZERO) == 0) - pagezero(pmap->pm_pmltop); /* * Do not install the host kernel mappings in the nested page @@ -4231,9 +4279,9 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) else pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { - pmltop_pgu = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_WAITOK); - counter_u64_add(pt_page_count, 1); + pmltop_pgu = pmap_alloc_pt_page(NULL, 0, + VM_ALLOC_WIRED | VM_ALLOC_NORMAL | + VM_ALLOC_WAITOK); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(pmltop_pgu)); if (pmap_is_la57(pmap)) @@ -4418,13 +4466,11 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) + m = pmap_alloc_pt_page(pmap, ptepindex, + VM_ALLOC_WIRED | VM_ALLOC_ZERO); + if (m == NULL) return (NULL); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - /* * Map the pagetable page into the process address space, if * it isn't already there. @@ -4451,8 +4497,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, /* Wire up a new PDPE page */ pml4 = pmap_allocpte_getpml4(pmap, lockp, va, true); if (pml4 == NULL) { - vm_page_unwire_noq(m); - vm_page_free_zero(m); + pmap_free_pt_page(pmap, m, true); return (NULL); } KASSERT((*pml4 & PG_V) == 0, @@ -4479,8 +4524,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, /* Wire up a new PDE page */ pdp = pmap_allocpte_getpdp(pmap, lockp, va, true); if (pdp == NULL) { - vm_page_unwire_noq(m); - vm_page_free_zero(m); + pmap_free_pt_page(pmap, m, true); return (NULL); } KASSERT((*pdp & PG_V) == 0, @@ -4490,8 +4534,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, /* Wire up a new PTE page */ pdp = pmap_allocpte_getpdp(pmap, lockp, va, false); if (pdp == NULL) { - vm_page_unwire_noq(m); - vm_page_free_zero(m); + pmap_free_pt_page(pmap, m, true); return (NULL); } if ((*pdp & PG_V) == 0) { @@ -4500,8 +4543,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, lockp, va) == NULL) { pmap_allocpte_free_unref(pmap, va, pmap_pml4e(pmap, va)); - vm_page_unwire_noq(m); - vm_page_free_zero(m); + pmap_free_pt_page(pmap, m, true); return (NULL); } } else { @@ -4518,9 +4560,6 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, *pd = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M; } - pmap_resident_count_inc(pmap, 1); - counter_u64_add(pt_page_count, 1); - return (m); } @@ -4681,16 +4720,12 @@ pmap_release(pmap_t pmap) pmap->pm_pmltop[LMSPML4I + i] = 0; } - vm_page_unwire_noq(m); - vm_page_free_zero(m); - counter_u64_add(pt_page_count, -1); + pmap_free_pt_page(NULL, m, true); if (pmap->pm_pmltopu != NULL) { m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap-> pm_pmltopu)); - vm_page_unwire_noq(m); - vm_page_free(m); - counter_u64_add(pt_page_count, -1); + pmap_free_pt_page(NULL, m, false); } if (pmap->pm_type == PT_X86 && (cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0) @@ -4799,14 +4834,11 @@ pmap_growkernel(vm_offset_t addr) pdpe = pmap_pdpe(kernel_pmap, kernel_vm_end); if ((*pdpe & X86_PG_V) == 0) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDPSHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + nkpg = pmap_alloc_pt_page(kernel_pmap, + kernel_vm_end >> PDPSHIFT, VM_ALLOC_WIRED | + VM_ALLOC_INTERRUPT | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); - counter_u64_add(pt_page_count, 1); paddr = VM_PAGE_TO_PHYS(nkpg); *pdpe = (pdp_entry_t)(paddr | X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M); @@ -4822,14 +4854,11 @@ pmap_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, pmap_pde_pindex(kernel_vm_end), - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); + nkpg = pmap_alloc_pt_page(kernel_pmap, + pmap_pde_pindex(kernel_vm_end), VM_ALLOC_WIRED | + VM_ALLOC_INTERRUPT | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); - counter_u64_add(pt_page_count, 1); paddr = VM_PAGE_TO_PHYS(nkpg); newpdir = paddr | X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M; pde_store(pde, newpdir); @@ -5070,7 +5099,7 @@ reclaim_pv_chunk_domain(pmap_t locked_pmap, struct rwlock **lockp, int domain) goto next_chunk; } /* Every freed mapping is for a 4 KB page. */ - pmap_resident_count_dec(pmap, freed); + pmap_resident_count_adj(pmap, -freed); PV_STAT(counter_u64_add(pv_entry_frees, freed)); PV_STAT(counter_u64_add(pv_entry_spare, freed)); PV_STAT(counter_u64_add(pv_entry_count, -freed)); @@ -5746,9 +5775,9 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, * priority (VM_ALLOC_INTERRUPT). Otherwise, the * priority is normal. */ - mpte = vm_page_alloc(NULL, pmap_pde_pindex(va), + mpte = pmap_alloc_pt_page(pmap, pmap_pde_pindex(va), (in_kernel ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + VM_ALLOC_WIRED); /* * If the allocation of the new page table page fails, @@ -5759,12 +5788,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, return (FALSE); } - counter_u64_add(pt_page_count, 1); - - if (!in_kernel) { + if (!in_kernel) mpte->ref_count = NPTEPG; - pmap_resident_count_inc(pmap, 1); - } } mptepa = VM_PAGE_TO_PHYS(mpte); firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa); @@ -5897,7 +5922,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE; if ((oldpde & PG_G) != 0) pmap_invalidate_pde_page(kernel_pmap, sva, oldpde); - pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_adj(pmap, -NBPDR / PAGE_SIZE); if (oldpde & PG_MANAGED) { CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, oldpde & PG_PS_FRAME); pvh = pa_to_pvh(oldpde & PG_PS_FRAME); @@ -5922,7 +5947,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, if (mpte != NULL) { KASSERT(mpte->valid == VM_PAGE_BITS_ALL, ("pmap_remove_pde: pte page not promoted")); - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); KASSERT(mpte->ref_count == NPTEPG, ("pmap_remove_pde: pte page ref count error")); mpte->ref_count = 0; @@ -5951,7 +5976,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va, oldpte = pte_load_clear(ptq); if (oldpte & PG_W) pmap->pm_stats.wired_count -= 1; - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); if (oldpte & PG_MANAGED) { m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME); if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) @@ -6121,7 +6146,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) MPASS((*pdpe & (PG_MANAGED | PG_G)) == 0); anyvalid = 1; *pdpe = 0; - pmap_resident_count_dec(pmap, NBPDP / PAGE_SIZE); + pmap_resident_count_adj(pmap, -NBPDP / PAGE_SIZE); mt = PHYS_TO_VM_PAGE(*pmap_pml4e(pmap, sva) & PG_FRAME); pmap_unwire_ptp(pmap, sva, mt, &free); continue; @@ -6258,7 +6283,7 @@ retry: PG_A = pmap_accessed_bit(pmap); PG_M = pmap_modified_bit(pmap); PG_RW = pmap_rw_bit(pmap); - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); pde = pmap_pde(pmap, pv->pv_va); KASSERT((*pde & PG_PS) == 0, ("pmap_remove_all: found" " a 2mpage in page %p's pv list", m)); @@ -6723,7 +6748,7 @@ restart: else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0) pmap->pm_stats.wired_count -= pagesizes[psind] / PAGE_SIZE; if ((origpte & PG_V) == 0) - pmap_resident_count_inc(pmap, pagesizes[psind] / PAGE_SIZE); + pmap_resident_count_adj(pmap, pagesizes[psind] / PAGE_SIZE); return (KERN_SUCCESS); @@ -6957,7 +6982,7 @@ retry: */ if ((newpte & PG_W) != 0) pmap->pm_stats.wired_count++; - pmap_resident_count_inc(pmap, 1); + pmap_resident_count_adj(pmap, 1); } /* @@ -7204,7 +7229,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, */ if ((newpde & PG_W) != 0) pmap->pm_stats.wired_count += NBPDR / PAGE_SIZE; - pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_adj(pmap, NBPDR / PAGE_SIZE); /* * Map the superpage. (This is not a promoted mapping; there will not @@ -7364,7 +7389,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, /* * Increment counters */ - pmap_resident_count_inc(pmap, 1); + pmap_resident_count_adj(pmap, 1); newpte = VM_PAGE_TO_PHYS(m) | PG_V | pmap_cache_bits(pmap, m->md.pat_mode, 0); @@ -7473,7 +7498,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, if ((*pde & PG_V) == 0) { pde_store(pde, pa | PG_PS | PG_M | PG_A | PG_U | PG_RW | PG_V); - pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_adj(pmap, NBPDR / PAGE_SIZE); counter_u64_add(pmap_pde_mappings, 1); } else { /* Continue on if the PDE is already valid. */ @@ -7677,7 +7702,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, "pdpe %#lx sva %#lx eva %#lx va_next %#lx", *pdpe, addr, end_addr, va_next)); *pdpe = srcptepaddr & ~PG_W; - pmap_resident_count_inc(dst_pmap, NBPDP / PAGE_SIZE); + pmap_resident_count_adj(dst_pmap, NBPDP / PAGE_SIZE); continue; } @@ -7700,7 +7725,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { *pde = srcptepaddr & ~PG_W; - pmap_resident_count_inc(dst_pmap, NBPDR / + pmap_resident_count_adj(dst_pmap, NBPDR / PAGE_SIZE); counter_u64_add(pmap_pde_mappings, 1); } else @@ -7747,7 +7772,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, * (referenced) bits during the copy. */ *dst_pte = ptetemp & ~(PG_W | PG_M | PG_A); - pmap_resident_count_inc(dst_pmap, 1); + pmap_resident_count_adj(dst_pmap, 1); } else { pmap_abort_ptp(dst_pmap, addr, dstmpte); goto out; @@ -8151,7 +8176,7 @@ pmap_remove_pages(pmap_t pmap) /* Mark free */ pc->pc_map[field] |= bitmask; if (superpage) { - pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_adj(pmap, -NBPDR / PAGE_SIZE); pvh = pa_to_pvh(tpte & PG_PS_FRAME); TAILQ_REMOVE(&pvh->pv_list, pv, pv_next); pvh->pv_gen++; @@ -8165,14 +8190,14 @@ pmap_remove_pages(pmap_t pmap) if (mpte != NULL) { KASSERT(mpte->valid == VM_PAGE_BITS_ALL, ("pmap_remove_pages: pte page not promoted")); - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); KASSERT(mpte->ref_count == NPTEPG, ("pmap_remove_pages: pte page reference count error")); mpte->ref_count = 0; pmap_add_delayed_free_list(mpte, &free, FALSE); } } else { - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; if ((m->a.flags & PGA_WRITEABLE) != 0 && @@ -9097,13 +9122,13 @@ pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va) oldpdpe = *pdpe; KASSERT((oldpdpe & (PG_PS | PG_V)) == (PG_PS | PG_V), ("pmap_demote_pdpe: oldpdpe is missing PG_PS and/or PG_V")); - if ((pdpg = vm_page_alloc(NULL, va >> PDPSHIFT, VM_ALLOC_INTERRUPT | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + pdpg = pmap_alloc_pt_page(pmap, va >> PDPSHIFT, + VM_ALLOC_WIRED | VM_ALLOC_INTERRUPT); + if (pdpg == NULL) { CTR2(KTR_PMAP, "pmap_demote_pdpe: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); } - counter_u64_add(pt_page_count, 1); pdpgpa = VM_PAGE_TO_PHYS(pdpg); firstpde = (pd_entry_t *)PHYS_TO_DMAP(pdpgpa); newpdpe = pdpgpa | PG_M | PG_A | (oldpdpe & PG_U) | PG_RW | PG_V; @@ -10115,16 +10140,8 @@ pmap_quick_remove_page(vm_offset_t addr) static vm_page_t pmap_large_map_getptp_unlocked(void) { - vm_page_t m; - - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_ZERO); - if (m != NULL) { - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - counter_u64_add(pt_page_count, 1); - } - return (m); + return (pmap_alloc_pt_page(kernel_pmap, 0, + VM_ALLOC_NORMAL | VM_ALLOC_ZERO)); } static vm_page_t From owner-dev-commits-src-main@freebsd.org Tue Mar 16 02:44:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B73A57493D; Tue, 16 Mar 2021 02:44:37 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzyLF275dz4sHQ; Tue, 16 Mar 2021 02:44:37 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1615862677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pVKqIpCHol5Q2V2RgMSjKCOIr7dnc3L4G8xm0kve/q4=; b=vDjfe7+IS3YS6P9zIxy8y3i3D6mDweWnN93dNWpDU0d62h409ZSfiVriPNg/Ft0G5Y0zKZ 1QeRnOmcdigc3xDOLWKJ4uRCZmM8zsK72FtcXgJ0XRqHefuY4nU3bRnMnIzdkC09ieBsJy Lv8w9IGCpVhhM15DzQR6YuFnYvzFF2c9srA3HAn7Rmaq9Hs8INRQa5QMfLGCyNr4JIUsZG KRYDnhLbWnLIFY7KOij9Gm966wUauzRSl8jk2oxRBbbU/gC+bA8b0HpnGEv7RZigOYADZ7 1olrNL7Q4HaS8YCAVv/qzGMHzFrDWYuDvr7Kv4o5RhDdKHnF+CmcvoGYTQu66A== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 36723F06A; Tue, 16 Mar 2021 02:44:37 +0000 (UTC) Date: Tue, 16 Mar 2021 02:44:37 +0000 From: Alexey Dokuchaev To: Scott Long Cc: Kyle Evans , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project Message-ID: <20210316024437.GA60113@FreeBSD.org> References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1615862677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pVKqIpCHol5Q2V2RgMSjKCOIr7dnc3L4G8xm0kve/q4=; b=m2ZHBEEBRYb6SaadBr95wIYeMVsqZn/fEPRvQ65DFy8lxLCHnpDzjaQ+O1jOAbjCeUS77O rOUHL/OAO3B4W0dgbw8BXFO3uaRpVOH/rQ1Ptwo9gTI0UWzOaH+uqa/BOiwoACvP+IIL5l m0OCQ5x3IGFbxb04PAB5fE2d5k5SS8TnnCM9KoaYZjPIflxZsKVMGj5eh6MmKNDpV2+XDF 6jvqK2VqV8OnNqlahC5dStYEzMqoGtuaTIszxbqK5HZpH3rmOQ4Zut3579a009DiHktnox 6vYY1QKuy8sYf4FiTAUSqr3GDm4cGUkAD0XBmb3EnMYgwl0HmtB0vUNtARqrRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1615862677; a=rsa-sha256; cv=none; b=tW1xF8EKVXMA1/Zupo93DP9Swthc2PEX22Kl4At8MFMxAAErEkJOHGHbOBPeGbO38ilpim /MWh3CpsfKTloF/sAH0b6UqxXc4aWXdeWhXh/jaXBeeaLB23nCMKKV80DVUHB1YSegVgyU u2QrrPJunbegw+AEh4XHk34Bd58FhvP7zK2Ln6cG6t0/cH7uLpivnbKBYPQh6kWdn9f02D /ljJXCXta1TUHXIyFl3EBxhv5DVj7mNRfejjwy6c3GQyDq8fBEtiiuitBUqMyRrX2HG2AT IneNZuxBmrLj4Nq8mfYq9AsLfedBgBs5OOYYpZuPt8aMsBZC24P7qG267Rh/nQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 02:44:37 -0000 On Mon, Mar 15, 2021 at 08:56:56AM -0600, Scott Long wrote: > Here is the response I sent to you and Donenfeld in private. I won't > include my direct conversation with you from Slack/IRC, but I made my > concerns and objections pretty clear. This commit is quite > disappointing. FWIW, original wireguard commit seemed more disappointing to me. > - The LKML wouldn't accept this kind of submission, they'd insist > that it be broken down into consumable pieces, and that bug fixes be > considered and provided that don't rely on massive re-writes. Didn't Linux folks also refuse to accept wireguard code until it was ported from some home-grown "hey, let's do crypto stuff ourselves!" implementation to their standard kernel APIs? > - An accusation was made, tonight, to me, that the code Netgate > sponsored was not reviewed and was shoved into the tree at the last > minute. This grossly ignores the actual history to the point of > weakening my tolerance for this entire discussion. It shows a > pretty irrational bias against mmacy [...] Slightly tangential note, but my questions to mmacy@ about original wireguard commit (and ZoL, FWIW) or Phabricator comments had not been answered; I also recall reviews being closed in "not accepted" state by him. While I appreciate the heavy-lifting, developers should be ready to explain and sometimes defend their work on public forums. > - The removal of the ASM crypto bits really confuses me. But addition of the new crypto code, bypassing our crypto framework in the first place did not? Anyway, I'm really happy to see Jason's work; looks like sanity is something FreeBSD can, once again, be known for. ;-) ./danfe From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CAB557822F; Tue, 16 Mar 2021 06:13:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02z21kW5z3JT2; Tue, 16 Mar 2021 06:13:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E7EB1E939; Tue, 16 Mar 2021 06:13:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DIIU061934; Tue, 16 Mar 2021 06:13:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DIub061933; Tue, 16 Mar 2021 06:13:18 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:18 GMT Message-Id: <202103160613.12G6DIub061933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b5fc9e350ce6 - main - pkgbase: Move libicp in utilities MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5fc9e350ce6e2a60d49cf84b83ce7c0383a65cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:18 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b5fc9e350ce6e2a60d49cf84b83ce7c0383a65cb commit b5fc9e350ce6e2a60d49cf84b83ce7c0383a65cb Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:40 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:40 +0000 pkgbase: Move libicp in utilities libicp is used by zdb zhack zinject zstream ztest libzpool.so.2 which are all in FreeBSD-utilities. Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D29164 MFC after: 2 weeks --- cddl/lib/libicp/Makefile | 2 +- cddl/lib/libicp_rescue/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cddl/lib/libicp/Makefile b/cddl/lib/libicp/Makefile index 36858338ac6b..253b252bc2d4 100644 --- a/cddl/lib/libicp/Makefile +++ b/cddl/lib/libicp/Makefile @@ -2,7 +2,7 @@ .PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp -PACKAGE= runtime +PACKAGE= utilities LIB= icp LIBADD= diff --git a/cddl/lib/libicp_rescue/Makefile b/cddl/lib/libicp_rescue/Makefile index 1ebe1b0ff649..a46fd6db3877 100644 --- a/cddl/lib/libicp_rescue/Makefile +++ b/cddl/lib/libicp_rescue/Makefile @@ -2,7 +2,7 @@ .PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp -PACKAGE= runtime +PACKAGE= utilities LIB= icp_rescue LIBADD= From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60D9D578231; Tue, 16 Mar 2021 06:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02z32KSFz3JT3; Tue, 16 Mar 2021 06:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 430631E93A; Tue, 16 Mar 2021 06:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DJIs061955; Tue, 16 Mar 2021 06:13:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DJlN061954; Tue, 16 Mar 2021 06:13:19 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:19 GMT Message-Id: <202103160613.12G6DJlN061954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 8c3eaf244a41 - main - pkgbase: Install all BSM includes with INCS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c3eaf244a417a4ee105834410a52144206102e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:19 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=8c3eaf244a417a4ee105834410a52144206102e5 commit 8c3eaf244a417a4ee105834410a52144206102e5 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:46 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:46 +0000 pkgbase: Install all BSM includes with INCS Now they are correctly taggued and put them into the libbsm package Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29165 MFC after: 2 weeks --- include/Makefile | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/include/Makefile b/include/Makefile index 8ddfd7015918..cf760359d2f5 100644 --- a/include/Makefile +++ b/include/Makefile @@ -38,7 +38,7 @@ PHDRS= sched.h _semaphore.h LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ syslog.h ucontext.h -LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ +LDIRS= cam geom net net80211 netgraph netinet netinet6 \ netipsec netsmb nfs nfsclient nfsserver sys vm LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ @@ -58,7 +58,6 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ netinet/cc \ netinet/netdump \ netinet/tcp_stacks \ - security/audit \ security/mac_biba security/mac_bsdextended security/mac_lomac \ security/mac_mls security/mac_partition \ security/mac_veriexec \ @@ -76,6 +75,25 @@ ACPICADIR= ${INCLUDEDIR}/dev/acpica AGP= agpreg.h AGPDIR= ${INCLUDEDIR}/dev/agp +.PATH: ${SRCTOP}/sys/bsm +BSM= audit.h \ + audit_errno.h \ + audit_internal.h \ + audit_record.h \ + audit_domain.h \ + audit_fcntl.h \ + audit_kevents.h \ + audit_socket_type.h +BSMPACKAGE= libbsm +BSMDIR= ${INCLUDEDIR}/bsm + +.PATH: ${SRCTOP}/sys/security/audit +SECAUDIT= audit.h \ + audit_ioctl.h \ + audit_private.h +SECAUDITPACKAGE= libbsm +SECAUDITDIR= ${INCLUDEDIR}/security/audit + .PATH: ${SRCTOP}/sys/fs/cd9660 FS9660= cd9660_mount.h \ cd9660_node.h \ @@ -175,6 +193,11 @@ INCSGROUPS= INCS \ VERIEXEC \ WG +.if ${MK_AUDIT} != "no" +INCSGROUPS+= BSM +INCSGROUPS+= SECAUDIT +.endif + .if ${MK_IPFILTER} != "no" INCSGROUPS+= IPFILTER .endif From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FC09577D5E; Tue, 16 Mar 2021 06:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02z45cJlz3J9K; Tue, 16 Mar 2021 06:13:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D61A1EB93; Tue, 16 Mar 2021 06:13:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DKVR061974; Tue, 16 Mar 2021 06:13:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DKSB061973; Tue, 16 Mar 2021 06:13:20 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:20 GMT Message-Id: <202103160613.12G6DKSB061973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 0594b2879588 - main - pkgbase: Install all cam includes with INCS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0594b28795883579e5300ffc3e57a1504cc43117 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:21 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0594b28795883579e5300ffc3e57a1504cc43117 commit 0594b28795883579e5300ffc3e57a1504cc43117 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:49 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:49 +0000 pkgbase: Install all cam includes with INCS Now they are correctly taggued and put into the -dev package Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29166 MFC after: 2 weeks --- include/Makefile | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/include/Makefile b/include/Makefile index cf760359d2f5..d47879e11c93 100644 --- a/include/Makefile +++ b/include/Makefile @@ -38,11 +38,10 @@ PHDRS= sched.h _semaphore.h LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ syslog.h ucontext.h -LDIRS= cam geom net net80211 netgraph netinet netinet6 \ +LDIRS= geom net net80211 netgraph netinet netinet6 \ netipsec netsmb nfs nfsclient nfsserver sys vm -LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ - dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ +LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ @@ -94,6 +93,53 @@ SECAUDIT= audit.h \ SECAUDITPACKAGE= libbsm SECAUDITDIR= ${INCLUDEDIR}/security/audit +.PATH: ${SRCTOP}/sys/cam +CAM= cam.h \ + cam_ccb.h \ + cam_compat.h \ + cam_debug.h \ + cam_iosched.h \ + cam_periph.h \ + cam_queue.h \ + cam_sim.h \ + cam_xpt.h \ + cam_xpt_internal.h \ + cam_xpt_periph.h \ + cam_xpt_sim.h +CAMDIR= ${INCLUDEDIR}/cam + +.PATH: ${SRCTOP}/sys/cam/ata +CAMATA= ata_all.h +CAMATADIR= ${INCLUDEDIR}/cam/ata + +.PATH: ${SRCTOP}/sys/cam/mmc +CAMMMC= mmc.h \ + mmc_bus.h \ + mmc_all.h +CAMMMCDIR= ${INCLUDEDIR}/cam/mmc + +.PATH: ${SRCTOP}/sys/cam/nvme +CAMNVME= nvme_all.h +CAMNVMEDIR= ${INCLUDEDIR}/cam/nvme + +.PATH: ${SRCTOP}/sys/cam/scsi +CAMSCSI= scsi_all.h \ + scsi_cd.h \ + scsi_ch.h \ + scsi_da.h \ + scsi_enc.h \ + scsi_enc_internal.h \ + scsi_iu.h \ + scsi_message.h \ + scsi_pass.h \ + scsi_pt.h \ + scsi_sa.h \ + scsi_ses.h \ + scsi_sg.h \ + scsi_targetio.h \ + smp_all.h +CAMSCSIDIR= ${INCLUDEDIR}/cam/scsi + .PATH: ${SRCTOP}/sys/fs/cd9660 FS9660= cd9660_mount.h \ cd9660_node.h \ @@ -181,6 +227,11 @@ WGDIR= ${INCLUDEDIR}/dev/if_wg INCSGROUPS= INCS \ ACPICA \ AGP \ + CAM \ + CAMATA \ + CAMMMC \ + CAMNVME \ + CAMSCSI \ CRYPTO \ EVDEV \ FS9660 \ From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBC35578480; Tue, 16 Mar 2021 06:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02z55lDxz3JBw; Tue, 16 Mar 2021 06:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A874C1EB94; Tue, 16 Mar 2021 06:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DLPR061996; Tue, 16 Mar 2021 06:13:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DLYL061995; Tue, 16 Mar 2021 06:13:21 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:21 GMT Message-Id: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 0006530aa14b - main - include: Remove symlink installation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0006530aa14b9df56f88df7d819fae89b115d865 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 commit 0006530aa14b9df56f88df7d819fae89b115d865 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:53 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:53 +0000 include: Remove symlink installation headers could be installed as symlink to the source tree instead of copies. Remove the possibility to do that. This make the makefile easier to read and to maintain and also don't duplicate code. While here remove some directories from LSBUDIRS as we already install them using the INCS stuff. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29167 MFC after: 2 weeks --- include/Makefile | 117 +++++-------------------------------------------------- 1 file changed, 9 insertions(+), 108 deletions(-) diff --git a/include/Makefile b/include/Makefile index d47879e11c93..e0df8571ae73 100644 --- a/include/Makefile +++ b/include/Makefile @@ -41,11 +41,11 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ LDIRS= geom net net80211 netgraph netinet netinet6 \ netipsec netsmb nfs nfsclient nfsserver sys vm -LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ - dev/hwpmc dev/hyperv \ - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ - dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ - dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ +LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ + dev/hwpmc \ + dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ + dev/smbus dev/speaker dev/tcp_log dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ @@ -295,13 +295,6 @@ LSUBDIRS+= dev/usb _dev_powermac_nvram= dev/powermac_nvram .endif -# Define SHARED to indicate whether you want symbolic links to the system -# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is -# probably only useful for developers and should be avoided if you do not -# wish to tie your /usr/include and /usr/src together. -#SHARED= symlinks -SHARED?= copies - INCS+= osreldate.h SYSDIR= ${SRCTOP}/sys @@ -332,25 +325,23 @@ _MARCHS= ${MACHINE_CPUARCH} _MARCHS+= x86 .endif -META_TARGETS+= compat -stage_includes: ${SHARED} +stage_includes: _installincludes SDESTDIR= ${SYSROOT:U${DESTDIR}} +_installincludes: # Take care of stale directory-level symlinks. # Note: The "|| true" after find is needed in case one of the directories does # not exist (yet). -compat: cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ -f ${SRCTOP}/etc/mtree/BSD.include.dist \ -p ${SDESTDIR}${INCLUDEDIR} > /dev/null -copies: .PHONY .META cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ -name "*.h" -print -delete || true -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i @@ -380,99 +371,9 @@ copies: .PHONY .META .endif .endfor -symlinks: .PHONY .META - @${ECHO} "Setting up symlinks to kernel source tree..." -.for i in ${LDIRS} - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i -.endfor -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i -.endfor - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ - ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ - ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; -.for i in ${LSUBSUBDIRS} - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i -.endfor -.if ${MK_IPFILTER} != "no" - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/netinet; -.endif -.if ${MK_PF} != "no" - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; -.endif - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/opencrypto/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/machine; -.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/machine/pc; -.endif -.for _MARCH in ${_MARCHS} -.if exists(${SRCTOP}/sys/${_MARCH}/include) - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; -.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; -.endif -.endif -.endfor - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ - ${SDESTDIR}${INCLUDEDIR}/rpc; - cd ${SRCTOP}/sys/rpc; -.if ${MK_CDDL} != "no" - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - ../../../sys/contrib/openzfs/include/sys/nvpair.h \ - ${SDESTDIR}${INCLUDEDIR}/sys -.endif -.if ${MK_MLX5TOOL} != "no" - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 -.endif - .include -installincludes: ${SHARED} -${SHARED}: compat +installincludes: _installincludes .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) # we're here because we are building a sysroot... From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9045B577D5F; Tue, 16 Mar 2021 06:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02z66TdPz3JTQ; Tue, 16 Mar 2021 06:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B11BA1ECF5; Tue, 16 Mar 2021 06:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DMHA062018; Tue, 16 Mar 2021 06:13:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DMgn062017; Tue, 16 Mar 2021 06:13:22 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:22 GMT Message-Id: <202103160613.12G6DMgn062017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: c76439da012f - main - pkgbase: Remove case for runtime and jail package ucl generation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c76439da012f626a83ede2988ddd690c2f95d05c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:25 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=c76439da012f626a83ede2988ddd690c2f95d05c commit c76439da012f626a83ede2988ddd690c2f95d05c Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:56 +0000 pkgbase: Remove case for runtime and jail package ucl generation They aren't needed and produce wrong package comments : We use to have "runtime-dev package" instead of "FreeBSD Base System (Development Files)" for example Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29168 MFC after: 2 weeks --- release/packages/generate-ucl.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/release/packages/generate-ucl.sh b/release/packages/generate-ucl.sh index b3d76eb4019d..e900f9991912 100755 --- a/release/packages/generate-ucl.sh +++ b/release/packages/generate-ucl.sh @@ -44,21 +44,6 @@ main() { runtime) outname="runtime" uclfile="${uclfile}" - ;; - runtime_manuals) - outname="${origname}" - pkgdeps="runtime" - ;; - runtime_*) - outname="${origname}" - uclfile="${outname##*}${uclfile}" - pkgdeps="runtime" - _descr="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESCR)" - ;; - jail_*) - outname="${origname}" - uclfile="${outname##*}${uclfile}" - pkgdeps="runtime" _descr="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESCR)" ;; *_lib32_dev) From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99CF7577D61; Tue, 16 Mar 2021 06:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02z90W8Tz3J9W; Tue, 16 Mar 2021 06:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D15511ED03; Tue, 16 Mar 2021 06:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DNnW062036; Tue, 16 Mar 2021 06:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DN5c062035; Tue, 16 Mar 2021 06:13:23 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:23 GMT Message-Id: <202103160613.12G6DN5c062035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 839fc8cdf9b6 - main - include: Tag directly the last headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 839fc8cdf9b6bafe120e7da8a4b78950ad7295c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:25 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=839fc8cdf9b6bafe120e7da8a4b78950ad7295c4 commit 839fc8cdf9b6bafe120e7da8a4b78950ad7295c4 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:13:00 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:13:00 +0000 include: Tag directly the last headers We cannot easily used the TAG here and we don't yet have something to install even .h from a diretory in bsd.prog.mk Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29170 MFC after: 2 weeks --- include/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/Makefile b/include/Makefile index e0df8571ae73..5618cfcacfa6 100644 --- a/include/Makefile +++ b/include/Makefile @@ -43,7 +43,7 @@ LDIRS= geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc \ - dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ @@ -343,29 +343,29 @@ _installincludes: -name "*.h" -print -delete || true .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i .endfor cd ${SRCTOP}/sys/${MACHINE}/include; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine .if exists(${SRCTOP}/sys/${MACHINE}/include/pc) cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine/pc .endif .for _MARCH in ${_MARCHS} .if exists(${SRCTOP}/sys/${_MARCH}/include) - ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${SRCTOP}/sys/${_MARCH}/include; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH} .if exists(${SRCTOP}/sys/${_MARCH}/include/pc) - ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc .endif .endif From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B66DB5782AE; Tue, 16 Mar 2021 06:13:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02zC1d8xz3JTk; Tue, 16 Mar 2021 06:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18D0E1ED05; Tue, 16 Mar 2021 06:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DPtt062080; Tue, 16 Mar 2021 06:13:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DPOE062079; Tue, 16 Mar 2021 06:13:25 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:25 GMT Message-Id: <202103160613.12G6DPOE062079@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 500f4659d7c8 - main - Convert libs with pc files to use PCFILES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 500f4659d7c8947082dba040a1d58e7d228f8d44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:30 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=500f4659d7c8947082dba040a1d58e7d228f8d44 commit 500f4659d7c8947082dba040a1d58e7d228f8d44 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:13:07 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:13:07 +0000 Convert libs with pc files to use PCFILES Now the .pc ends up in the correct package (-dev) Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D29172 MFC after: 2 weeks --- lib/liblzma/Makefile | 3 +-- lib/libmagic/Makefile | 3 +-- lib/libusb/Makefile | 3 +-- lib/libz/Makefile | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/liblzma/Makefile b/lib/liblzma/Makefile index 63424bd3dcc2..4f38ef391e4a 100644 --- a/lib/liblzma/Makefile +++ b/lib/liblzma/Makefile @@ -154,8 +154,7 @@ CFLAGS+= -DSYMBOL_VERSIONING CLEANFILES+= liblzma.pc -FILES= liblzma.pc -FILESDIR= ${LIBDATADIR}/pkgconfig +PCFILES= liblzma.pc liblzma.pc: liblzma.pc.in sed -e 's,@prefix@,/usr,g ; \ diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile index e390ff1261c6..5f967102fe02 100644 --- a/lib/libmagic/Makefile +++ b/lib/libmagic/Makefile @@ -86,7 +86,6 @@ ${inc}: ${inc}.in sed -e 's,X.YY,${FILEVER:S,",,g:S,.,,g},g' ${.ALLSRC} > ${.TARGET} .endfor -FILES+= libmagic.pc -FILESDIR_libmagic.pc= ${LIBDATADIR}/pkgconfig +PCFILES= libmagic.pc .include diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile index cf263b732c35..83c9f1ade075 100644 --- a/lib/libusb/Makefile +++ b/lib/libusb/Makefile @@ -38,8 +38,7 @@ SRCS+= libusb10_io.c CFLAGS+= -DCOMPAT_32BIT .endif -FILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc -FILESDIR= ${LIBDATADIR}/pkgconfig +PCFILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc # # Cross platform support diff --git a/lib/libz/Makefile b/lib/libz/Makefile index 48e57ccc2a1a..4ece3e3e059f 100644 --- a/lib/libz/Makefile +++ b/lib/libz/Makefile @@ -75,7 +75,6 @@ test: example minigzip (export LD_LIBRARY_PATH=. ; \ echo hello world | ./minigzip | ./minigzip -d ) -FILES= zlib.pc -FILESDIR= ${LIBDATADIR}/pkgconfig +PCFILES= zlib.pc .include From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E1585780B6; Tue, 16 Mar 2021 06:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02z91GX4z3JFP; Tue, 16 Mar 2021 06:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F19871ED04; Tue, 16 Mar 2021 06:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DOTw062058; Tue, 16 Mar 2021 06:13:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DO1B062057; Tue, 16 Mar 2021 06:13:24 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:24 GMT Message-Id: <202103160613.12G6DO1B062057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 8a84b3736be1 - main - bsd.lib.mk: Add a install target for .pc files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a84b3736be137fad05fa82441b8e5553b606966 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:27 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=8a84b3736be137fad05fa82441b8e5553b606966 commit 8a84b3736be137fad05fa82441b8e5553b606966 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:13:03 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:13:03 +0000 bsd.lib.mk: Add a install target for .pc files That way the files are correctly taggued for pkgbase Reviewed by: bapt, emaste (both earlier version) Differential Revision: https://reviews.freebsd.org/D29171 MFC after: 2 weeks --- share/mk/bsd.lib.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 9a31c72255f7..db54055b7ae0 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -449,8 +449,20 @@ _SHLINSTALLSYMLINKFLAGS:= ${SHLINSTALLSYMLINKFLAGS} _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} .endfor +.if defined(PCFILES) +.for pcfile in ${PCFILES} +installpcfiles: installpcfiles-${pcfile} + +installpcfiles-${pcfile}: ${pcfile} + ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${_INSTALLFLAGS} \ + ${.ALLSRC} ${DESTDIR}${LIBDATADIR}/pkgconfig +.endfor +.endif +installpcfiles: .PHONY + .if !defined(INTERNALLIB) -realinstall: _libinstall +realinstall: _libinstall installpcfiles .ORDER: beforeinstall _libinstall _libinstall: .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:13:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 297D7578068; Tue, 16 Mar 2021 06:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02zD0SXyz3JFT; Tue, 16 Mar 2021 06:13:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 321271E93B; Tue, 16 Mar 2021 06:13:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G6DR87062098; Tue, 16 Mar 2021 06:13:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DRql062097; Tue, 16 Mar 2021 06:13:27 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:27 GMT Message-Id: <202103160613.12G6DRql062097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: c7e6cb9e08d6 - main - pkgbase: Add an src.conf option for splitting man pages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7e6cb9e08d6b51e677a9f5546b8e36d678687d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:31 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=c7e6cb9e08d6b51e677a9f5546b8e36d678687d0 commit c7e6cb9e08d6b51e677a9f5546b8e36d678687d0 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:11:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:13:09 +0000 pkgbase: Add an src.conf option for splitting man pages Man pages can be big in total, add an options to split man pages in -man packages so we produce smaller packages. This is useful for small jails or mfsroot produced of pkgbase. The option is off by default. Reviewed by: bapt, Mina Galić Differential Revision: https://reviews.freebsd.org/D29169 MFC after: 2 weeks --- release/packages/generate-ucl.sh | 5 +++++ share/man/man5/src.conf.5 | 4 +++- share/mk/bsd.man.mk | 9 +++++++++ share/mk/src.opts.mk | 1 + tools/build/options/WITH_MANSPLITPKG | 2 ++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/release/packages/generate-ucl.sh b/release/packages/generate-ucl.sh index e900f9991912..67c10e485eb7 100755 --- a/release/packages/generate-ucl.sh +++ b/release/packages/generate-ucl.sh @@ -71,6 +71,11 @@ main() { _descr="Debugging Symbols" pkgdeps="${outname}" ;; + *_man) + outname="${outname%%_man}" + _descr="Manual Pages" + pkgdeps="${outname}" + ;; ${origname}) pkgdeps="runtime" ;; diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 5d211bc1cc31..98fcc427d608 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd March 2, 2021 +.Dd March 16, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1099,6 +1099,8 @@ is set explicitly) .It Va WITHOUT_MANCOMPRESS Set to not to install compressed man pages. Only the uncompressed versions will be installed. +.It Va WITH_MANSPLITPKG +Set to split man pages into their own packages during make package. .It Va WITHOUT_MAN_UTILS Set to not build utilities for manual pages, .Xr apropos 1 , diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index 1e67928a2754..21c5fe4f2424 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -50,7 +50,11 @@ .error bsd.man.mk cannot be included directly. .endif +.if ${MK_MANSPLITPKG} == "no" MINSTALL?= ${INSTALL} ${TAG_ARGS} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} +.else +MINSTALL?= ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},man} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} +.endif CATDIR= ${MANDIR:H:S/$/\/cat/} CATEXT= .cat @@ -226,8 +230,13 @@ maninstall: ${MAN} .endif # ${MK_MANCOMPRESS} == "no" .endif .for l t in ${_MANLINKS} +.if ${MK_MANSPLITPKG} == "no" rm -f ${DESTDIR}${t} ${DESTDIR}${t}${MCOMPRESS_EXT}; \ ${INSTALL_MANLINK} ${TAG_ARGS} ${DESTDIR}${l}${ZEXT} ${DESTDIR}${t}${ZEXT} +.else + rm -f ${DESTDIR}${t} ${DESTDIR}${t}${MCOMPRESS_EXT}; \ + ${INSTALL_MANLINK} ${TAG_ARGS:D${TAG_ARGS},man} ${DESTDIR}${l}${ZEXT} ${DESTDIR}${t}${ZEXT} +.endif .endfor manlint: diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 619aa8f4a1d8..949dfece43e4 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -207,6 +207,7 @@ __DEFAULT_NO_OPTIONS = \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ MALLOC_PRODUCTION \ + MANSPLITPKG \ OFED_EXTRA \ OPENLDAP \ REPRODUCIBLE_BUILD \ diff --git a/tools/build/options/WITH_MANSPLITPKG b/tools/build/options/WITH_MANSPLITPKG new file mode 100644 index 000000000000..122da24e0bb4 --- /dev/null +++ b/tools/build/options/WITH_MANSPLITPKG @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to split man pages into their own packages during make package. From owner-dev-commits-src-main@freebsd.org Tue Mar 16 06:52:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A620E5793AB; Tue, 16 Mar 2021 06:52:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F03r61nrGz3N1S; Tue, 16 Mar 2021 06:52:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 12G6q801080785 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 16 Mar 2021 08:52:11 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12G6q801080785 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12G6q7j1080784; Tue, 16 Mar 2021 08:52:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 16 Mar 2021 08:52:07 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-ID: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4F03r61nrGz3N1S X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:52:22 -0000 On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > Author: Emmanuel Vadot > AuthorDate: 2021-03-16 06:12:53 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-03-16 06:12:53 +0000 > > include: Remove symlink installation > > headers could be installed as symlink to the source tree instead of copies. > Remove the possibility to do that. > This make the makefile easier to read and to maintain and also don't duplicate > code. > > While here remove some directories from LSBUDIRS as we already install them using > the INCS stuff. This might make Makefiles easier to read, but also it makes practically very hard to develop rtld/libc/libthr. After any system header modification, full buildworld or at least kernel-toolchain run is required to get buildenv populated with the new headers. > > Reviewed by: bapt > Differential Revision: https://reviews.freebsd.org/D29167 > MFC after: 2 weeks > --- > include/Makefile | 117 +++++-------------------------------------------------- > 1 file changed, 9 insertions(+), 108 deletions(-) > > diff --git a/include/Makefile b/include/Makefile > index d47879e11c93..e0df8571ae73 100644 > --- a/include/Makefile > +++ b/include/Makefile > @@ -41,11 +41,11 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ > LDIRS= geom net net80211 netgraph netinet netinet6 \ > netipsec netsmb nfs nfsclient nfsserver sys vm > > -LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ > - dev/hwpmc dev/hyperv \ > - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ > - dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > - dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ > +LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ > + dev/hwpmc \ > + dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ > + dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > + dev/smbus dev/speaker dev/tcp_log dev/vkbd \ > fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ > fs/procfs fs/smbfs fs/udf fs/unionfs \ > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > @@ -295,13 +295,6 @@ LSUBDIRS+= dev/usb > _dev_powermac_nvram= dev/powermac_nvram > .endif > > -# Define SHARED to indicate whether you want symbolic links to the system > -# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is > -# probably only useful for developers and should be avoided if you do not > -# wish to tie your /usr/include and /usr/src together. > -#SHARED= symlinks > -SHARED?= copies > - > INCS+= osreldate.h > > SYSDIR= ${SRCTOP}/sys > @@ -332,25 +325,23 @@ _MARCHS= ${MACHINE_CPUARCH} > _MARCHS+= x86 > .endif > > -META_TARGETS+= compat > -stage_includes: ${SHARED} > +stage_includes: _installincludes > SDESTDIR= ${SYSROOT:U${DESTDIR}} > > +_installincludes: > # Take care of stale directory-level symlinks. > # Note: The "|| true" after find is needed in case one of the directories does > # not exist (yet). > -compat: > cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ > crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true > mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ > -f ${SRCTOP}/etc/mtree/BSD.include.dist \ > -p ${SDESTDIR}${INCLUDEDIR} > /dev/null > > -copies: .PHONY .META > cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ > machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ > -name "*.h" -print -delete || true > -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} > +.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} > cd ${SRCTOP}/sys; \ > ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ > ${SDESTDIR}${INCLUDEDIR}/$i > @@ -380,99 +371,9 @@ copies: .PHONY .META > .endif > .endfor > > -symlinks: .PHONY .META > - @${ECHO} "Setting up symlinks to kernel source tree..." > -.for i in ${LDIRS} > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > -.endfor > -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > -.endfor > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ > - ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ > - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ > - ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; > -.for i in ${LSUBSUBDIRS} > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > -.endfor > -.if ${MK_IPFILTER} != "no" > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/netinet; > -.endif > -.if ${MK_PF} != "no" > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; > -.endif > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ > - ${SDESTDIR}${INCLUDEDIR}/crypto; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/opencrypto/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/crypto; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/machine; > -.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/machine/pc; > -.endif > -.for _MARCH in ${_MARCHS} > -.if exists(${SRCTOP}/sys/${_MARCH}/include) > - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; > -.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) > - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; > -.endif > -.endif > -.endfor > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ > - ${SDESTDIR}${INCLUDEDIR}/rpc; > - cd ${SRCTOP}/sys/rpc; > -.if ${MK_CDDL} != "no" > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - ../../../sys/contrib/openzfs/include/sys/nvpair.h \ > - ${SDESTDIR}${INCLUDEDIR}/sys > -.endif > -.if ${MK_MLX5TOOL} != "no" > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 > -.endif > - > .include > > -installincludes: ${SHARED} > -${SHARED}: compat > +installincludes: _installincludes > > .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) > # we're here because we are building a sysroot... From owner-dev-commits-src-main@freebsd.org Tue Mar 16 07:12:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59E8C579C91; Tue, 16 Mar 2021 07:12:24 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F04HC6Dlhz3NgR; Tue, 16 Mar 2021 07:12:23 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1615878735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GlekNwgD7uv5TyJVnItGZl5P8UZUIPPiNduSlvkIB7s=; b=qvGYJyPjdXhlZ5Q9MnIy7X/LrCBoApbqqmBECeCa9OdhqaNA23EWUKhBsaAl5tLLiVErGu BN7Bshcb9l0DOhSfMo5wDVztkHbYDwIYv5DRs4+X4rRPy7id4J8xg7GxgAvP/t8Ka9x1kf Oosw1GiKCBsAW43YQ+sXC1HZ0AvC3Lo= Received: from amy (lfbn-idf2-1-644-4.w86-247.abo.wanadoo.fr [86.247.100.4]) by mx.blih.net (OpenSMTPD) with ESMTPSA id de9d1ed8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 16 Mar 2021 07:12:15 +0000 (UTC) Date: Tue, 16 Mar 2021 08:12:14 +0100 From: Emmanuel Vadot To: Konstantin Belousov Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-Id: <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> In-Reply-To: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4F04HC6Dlhz3NgR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:12:24 -0000 On Tue, 16 Mar 2021 08:52:07 +0200 Konstantin Belousov wrote: > On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > > The branch main has been updated by manu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > > Author: Emmanuel Vadot > > AuthorDate: 2021-03-16 06:12:53 +0000 > > Commit: Emmanuel Vadot > > CommitDate: 2021-03-16 06:12:53 +0000 > > > > include: Remove symlink installation > > > > headers could be installed as symlink to the source tree instead of copies. > > Remove the possibility to do that. > > This make the makefile easier to read and to maintain and also don't duplicate > > code. > > > > While here remove some directories from LSBUDIRS as we already install them using > > the INCS stuff. > > This might make Makefiles easier to read, but also it makes practically > very hard to develop rtld/libc/libthr. After any system header > modification, full buildworld or at least kernel-toolchain run is > required to get buildenv populated with the new headers. Can you share what you did before so I can cook a patch that restore this behavior in a better way than it was done before ? Thanks, > > > > Reviewed by: bapt > > Differential Revision: https://reviews.freebsd.org/D29167 > > MFC after: 2 weeks > > --- > > include/Makefile | 117 +++++-------------------------------------------------- > > 1 file changed, 9 insertions(+), 108 deletions(-) > > > > diff --git a/include/Makefile b/include/Makefile > > index d47879e11c93..e0df8571ae73 100644 > > --- a/include/Makefile > > +++ b/include/Makefile > > @@ -41,11 +41,11 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ > > LDIRS= geom net net80211 netgraph netinet netinet6 \ > > netipsec netsmb nfs nfsclient nfsserver sys vm > > > > -LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ > > - dev/hwpmc dev/hyperv \ > > - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ > > - dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > > - dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ > > +LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ > > + dev/hwpmc \ > > + dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ > > + dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > > + dev/smbus dev/speaker dev/tcp_log dev/vkbd \ > > fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ > > fs/procfs fs/smbfs fs/udf fs/unionfs \ > > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > > @@ -295,13 +295,6 @@ LSUBDIRS+= dev/usb > > _dev_powermac_nvram= dev/powermac_nvram > > .endif > > > > -# Define SHARED to indicate whether you want symbolic links to the system > > -# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is > > -# probably only useful for developers and should be avoided if you do not > > -# wish to tie your /usr/include and /usr/src together. > > -#SHARED= symlinks > > -SHARED?= copies > > - > > INCS+= osreldate.h > > > > SYSDIR= ${SRCTOP}/sys > > @@ -332,25 +325,23 @@ _MARCHS= ${MACHINE_CPUARCH} > > _MARCHS+= x86 > > .endif > > > > -META_TARGETS+= compat > > -stage_includes: ${SHARED} > > +stage_includes: _installincludes > > SDESTDIR= ${SYSROOT:U${DESTDIR}} > > > > +_installincludes: > > # Take care of stale directory-level symlinks. > > # Note: The "|| true" after find is needed in case one of the directories does > > # not exist (yet). > > -compat: > > cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ > > crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true > > mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ > > -f ${SRCTOP}/etc/mtree/BSD.include.dist \ > > -p ${SDESTDIR}${INCLUDEDIR} > /dev/null > > > > -copies: .PHONY .META > > cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ > > machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ > > -name "*.h" -print -delete || true > > -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} > > +.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} > > cd ${SRCTOP}/sys; \ > > ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ > > ${SDESTDIR}${INCLUDEDIR}/$i > > @@ -380,99 +371,9 @@ copies: .PHONY .META > > .endif > > .endfor > > > > -symlinks: .PHONY .META > > - @${ECHO} "Setting up symlinks to kernel source tree..." > > -.for i in ${LDIRS} > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > > -.endfor > > -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > > -.endfor > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; > > -.for i in ${LSUBSUBDIRS} > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > > -.endfor > > -.if ${MK_IPFILTER} != "no" > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/netinet; > > -.endif > > -.if ${MK_PF} != "no" > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; > > -.endif > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ > > - ${SDESTDIR}${INCLUDEDIR}/crypto; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/opencrypto/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/crypto; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/machine; > > -.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/machine/pc; > > -.endif > > -.for _MARCH in ${_MARCHS} > > -.if exists(${SRCTOP}/sys/${_MARCH}/include) > > - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ > > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; > > -.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) > > - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ > > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; > > -.endif > > -.endif > > -.endfor > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/rpc; > > - cd ${SRCTOP}/sys/rpc; > > -.if ${MK_CDDL} != "no" > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - ../../../sys/contrib/openzfs/include/sys/nvpair.h \ > > - ${SDESTDIR}${INCLUDEDIR}/sys > > -.endif > > -.if ${MK_MLX5TOOL} != "no" > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 > > -.endif > > - > > .include > > > > -installincludes: ${SHARED} > > -${SHARED}: compat > > +installincludes: _installincludes > > > > .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) > > # we're here because we are building a sysroot... -- Emmanuel Vadot From owner-dev-commits-src-main@freebsd.org Tue Mar 16 07:17:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 147F0579C35; Tue, 16 Mar 2021 07:17:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F04PR5GXbz3NyX; Tue, 16 Mar 2021 07:17:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 12G7HaLM086786 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 16 Mar 2021 09:17:39 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12G7HaLM086786 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12G7Ha7K086785; Tue, 16 Mar 2021 09:17:36 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 16 Mar 2021 09:17:36 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-ID: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4F04PR5GXbz3NyX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:17:48 -0000 On Tue, Mar 16, 2021 at 08:12:14AM +0100, Emmanuel Vadot wrote: > On Tue, 16 Mar 2021 08:52:07 +0200 > Konstantin Belousov wrote: > > > On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > > > The branch main has been updated by manu: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > > > > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > > > Author: Emmanuel Vadot > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > Commit: Emmanuel Vadot > > > CommitDate: 2021-03-16 06:12:53 +0000 > > > > > > include: Remove symlink installation > > > > > > headers could be installed as symlink to the source tree instead of copies. > > > Remove the possibility to do that. > > > This make the makefile easier to read and to maintain and also don't duplicate > > > code. > > > > > > While here remove some directories from LSBUDIRS as we already install them using > > > the INCS stuff. > > > > This might make Makefiles easier to read, but also it makes practically > > very hard to develop rtld/libc/libthr. After any system header > > modification, full buildworld or at least kernel-toolchain run is > > required to get buildenv populated with the new headers. > > Can you share what you did before so I can cook a patch that restore > this behavior in a better way than it was done before ? I did $ make buildworld <- this was done relatively irregularly $ make buildenv [Edit whatever I needed, typically in sys/sys and libexec/rtld-elf] $ cd libexec/rtld-elf $ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all [Check built ld-elf.so.1, more edits] $ make ... Now, if I modify anything in sys/, I have to repopuate staged headers in the obj directory of buildworld. From owner-dev-commits-src-main@freebsd.org Tue Mar 16 07:39:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6666457A4AA; Tue, 16 Mar 2021 07:39:59 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F04v26YMkz3QHm; Tue, 16 Mar 2021 07:39:58 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1615880397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v3BAIJ4GR2kRWqB6mNHE9q2IJwz6Gj3mgNxmUB/H9gk=; b=WQjRUQhiUnQgC/LvLQBTPG5ihL9Qorthbxs5yNVgm8XQEwsriGWWbQgHYQhuNRlAx5IFri hZzvqU6S1mPVA5w0i0DLMRXEUXboxckpPDbWsg1CSLR3Thx3p1HGOJsLnJmInh4fR/SUwB tbYLVU61pi/cTfy/w2bCoLXgEuDACeA= Received: from amy (lfbn-idf2-1-644-4.w86-247.abo.wanadoo.fr [86.247.100.4]) by mx.blih.net (OpenSMTPD) with ESMTPSA id edd5a809 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 16 Mar 2021 07:39:57 +0000 (UTC) Date: Tue, 16 Mar 2021 08:39:57 +0100 From: Emmanuel Vadot To: Konstantin Belousov Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-Id: <20210316083957.540d3978e5b0160db2104fa1@bidouilliste.com> In-Reply-To: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4F04v26YMkz3QHm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:39:59 -0000 On Tue, 16 Mar 2021 09:17:36 +0200 Konstantin Belousov wrote: > On Tue, Mar 16, 2021 at 08:12:14AM +0100, Emmanuel Vadot wrote: > > On Tue, 16 Mar 2021 08:52:07 +0200 > > Konstantin Belousov wrote: > > > > > On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > > > > The branch main has been updated by manu: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > > > > > > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > > > > Author: Emmanuel Vadot > > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > > Commit: Emmanuel Vadot > > > > CommitDate: 2021-03-16 06:12:53 +0000 > > > > > > > > include: Remove symlink installation > > > > > > > > headers could be installed as symlink to the source tree instead of copies. > > > > Remove the possibility to do that. > > > > This make the makefile easier to read and to maintain and also don't duplicate > > > > code. > > > > > > > > While here remove some directories from LSBUDIRS as we already install them using > > > > the INCS stuff. > > > > > > This might make Makefiles easier to read, but also it makes practically > > > very hard to develop rtld/libc/libthr. After any system header > > > modification, full buildworld or at least kernel-toolchain run is > > > required to get buildenv populated with the new headers. > > > > Can you share what you did before so I can cook a patch that restore > > this behavior in a better way than it was done before ? > > I did > $ make buildworld <- this was done relatively irregularly > $ make buildenv > [Edit whatever I needed, typically in sys/sys and libexec/rtld-elf] > $ cd libexec/rtld-elf > $ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all > [Check built ld-elf.so.1, more edits] > $ make ... > > Now, if I modify anything in sys/, I have to repopuate staged headers in > the obj directory of buildworld. Right ok, I've missed that SHARED=symlinks was used in Makefile.inc1, I'll revert and redo a better patch. -- Emmanuel Vadot From owner-dev-commits-src-main@freebsd.org Tue Mar 16 07:41:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61B4A57A5C0; Tue, 16 Mar 2021 07:41:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F04ws2Lwgz3QXT; Tue, 16 Mar 2021 07:41:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43A0A1FD91; Tue, 16 Mar 2021 07:41:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G7fXq1079646; Tue, 16 Mar 2021 07:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G7fXn7079645; Tue, 16 Mar 2021 07:41:33 GMT (envelope-from git) Date: Tue, 16 Mar 2021 07:41:33 GMT Message-Id: <202103160741.12G7fXn7079645@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 35b6d9b65e54 - main - Revert "include: Tag directly the last headers" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35b6d9b65e54ac4ce50c380d8e5915a0d2f32346 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:41:33 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=35b6d9b65e54ac4ce50c380d8e5915a0d2f32346 commit 35b6d9b65e54ac4ce50c380d8e5915a0d2f32346 Author: Emmanuel Vadot AuthorDate: 2021-03-16 07:40:54 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 07:40:54 +0000 Revert "include: Tag directly the last headers" This reverts commit 839fc8cdf9b6bafe120e7da8a4b78950ad7295c4. --- include/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/Makefile b/include/Makefile index 5618cfcacfa6..e0df8571ae73 100644 --- a/include/Makefile +++ b/include/Makefile @@ -43,7 +43,7 @@ LDIRS= geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc \ - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ @@ -343,29 +343,29 @@ _installincludes: -name "*.h" -print -delete || true .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i .endfor cd ${SRCTOP}/sys/${MACHINE}/include; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine .if exists(${SRCTOP}/sys/${MACHINE}/include/pc) cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine/pc .endif .for _MARCH in ${_MARCHS} .if exists(${SRCTOP}/sys/${_MARCH}/include) - ${INSTALL} -d -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${SRCTOP}/sys/${_MARCH}/include; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH} .if exists(${SRCTOP}/sys/${_MARCH}/include/pc) - ${INSTALL} -d -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc .endif .endif From owner-dev-commits-src-main@freebsd.org Tue Mar 16 07:41:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8437557A5C5; Tue, 16 Mar 2021 07:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F04wt3HH6z3QTx; Tue, 16 Mar 2021 07:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63FA21FBAF; Tue, 16 Mar 2021 07:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G7fYpt079665; Tue, 16 Mar 2021 07:41:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G7fYRH079664; Tue, 16 Mar 2021 07:41:34 GMT (envelope-from git) Date: Tue, 16 Mar 2021 07:41:34 GMT Message-Id: <202103160741.12G7fYRH079664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 060f0a17bbf5 - main - Revert "include: Remove symlink installation" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 060f0a17bbf5392c16fbb7be4c834d3f27f60ad0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:41:34 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=060f0a17bbf5392c16fbb7be4c834d3f27f60ad0 commit 060f0a17bbf5392c16fbb7be4c834d3f27f60ad0 Author: Emmanuel Vadot AuthorDate: 2021-03-16 07:40:59 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 07:40:59 +0000 Revert "include: Remove symlink installation" This reverts commit 0006530aa14b9df56f88df7d819fae89b115d865. --- include/Makefile | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 108 insertions(+), 9 deletions(-) diff --git a/include/Makefile b/include/Makefile index e0df8571ae73..d47879e11c93 100644 --- a/include/Makefile +++ b/include/Makefile @@ -41,11 +41,11 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ LDIRS= geom net net80211 netgraph netinet netinet6 \ netipsec netsmb nfs nfsclient nfsserver sys vm -LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ - dev/hwpmc \ - dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ - dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ - dev/smbus dev/speaker dev/tcp_log dev/vkbd \ +LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ + dev/hwpmc dev/hyperv \ + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ + dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ @@ -295,6 +295,13 @@ LSUBDIRS+= dev/usb _dev_powermac_nvram= dev/powermac_nvram .endif +# Define SHARED to indicate whether you want symbolic links to the system +# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is +# probably only useful for developers and should be avoided if you do not +# wish to tie your /usr/include and /usr/src together. +#SHARED= symlinks +SHARED?= copies + INCS+= osreldate.h SYSDIR= ${SRCTOP}/sys @@ -325,23 +332,25 @@ _MARCHS= ${MACHINE_CPUARCH} _MARCHS+= x86 .endif -stage_includes: _installincludes +META_TARGETS+= compat +stage_includes: ${SHARED} SDESTDIR= ${SYSROOT:U${DESTDIR}} -_installincludes: # Take care of stale directory-level symlinks. # Note: The "|| true" after find is needed in case one of the directories does # not exist (yet). +compat: cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ -f ${SRCTOP}/etc/mtree/BSD.include.dist \ -p ${SDESTDIR}${INCLUDEDIR} > /dev/null +copies: .PHONY .META cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ -name "*.h" -print -delete || true -.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i @@ -371,9 +380,99 @@ _installincludes: .endif .endfor +symlinks: .PHONY .META + @${ECHO} "Setting up symlinks to kernel source tree..." +.for i in ${LDIRS} + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i +.endfor +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i +.endfor + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ + ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ + ${SDESTDIR}${INCLUDEDIR}/dev/evdev; + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ + ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; +.for i in ${LSUBSUBDIRS} + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i +.endfor +.if ${MK_IPFILTER} != "no" + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/netinet; +.endif +.if ${MK_PF} != "no" + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; +.endif + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ + ${SDESTDIR}${INCLUDEDIR}/crypto; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/opencrypto/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/crypto; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/machine; +.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/machine/pc; +.endif +.for _MARCH in ${_MARCHS} +.if exists(${SRCTOP}/sys/${_MARCH}/include) + ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; +.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) + ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; +.endif +.endif +.endfor + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ + ${SDESTDIR}${INCLUDEDIR}/rpc; + cd ${SRCTOP}/sys/rpc; +.if ${MK_CDDL} != "no" + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + ../../../sys/contrib/openzfs/include/sys/nvpair.h \ + ${SDESTDIR}${INCLUDEDIR}/sys +.endif +.if ${MK_MLX5TOOL} != "no" + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 +.endif + .include -installincludes: _installincludes +installincludes: ${SHARED} +${SHARED}: compat .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) # we're here because we are building a sysroot... From owner-dev-commits-src-main@freebsd.org Tue Mar 16 07:43:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F9D857A98F; Tue, 16 Mar 2021 07:43:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F04zM6L7Nz3RCp; Tue, 16 Mar 2021 07:43:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 12G7hZrf092827 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 16 Mar 2021 09:43:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12G7hZrf092827 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12G7hZ5N092826; Tue, 16 Mar 2021 09:43:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 16 Mar 2021 09:43:35 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-ID: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> <20210316083957.540d3978e5b0160db2104fa1@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210316083957.540d3978e5b0160db2104fa1@bidouilliste.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4F04zM6L7Nz3RCp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:43:44 -0000 On Tue, Mar 16, 2021 at 08:39:57AM +0100, Emmanuel Vadot wrote: > On Tue, 16 Mar 2021 09:17:36 +0200 > Konstantin Belousov wrote: > > > On Tue, Mar 16, 2021 at 08:12:14AM +0100, Emmanuel Vadot wrote: > > > On Tue, 16 Mar 2021 08:52:07 +0200 > > > Konstantin Belousov wrote: > > > > > > > On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > > > > > The branch main has been updated by manu: > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > > > > > > > > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > > > > > Author: Emmanuel Vadot > > > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > > > Commit: Emmanuel Vadot > > > > > CommitDate: 2021-03-16 06:12:53 +0000 > > > > > > > > > > include: Remove symlink installation > > > > > > > > > > headers could be installed as symlink to the source tree instead of copies. > > > > > Remove the possibility to do that. > > > > > This make the makefile easier to read and to maintain and also don't duplicate > > > > > code. > > > > > > > > > > While here remove some directories from LSBUDIRS as we already install them using > > > > > the INCS stuff. > > > > > > > > This might make Makefiles easier to read, but also it makes practically > > > > very hard to develop rtld/libc/libthr. After any system header > > > > modification, full buildworld or at least kernel-toolchain run is > > > > required to get buildenv populated with the new headers. > > > > > > Can you share what you did before so I can cook a patch that restore > > > this behavior in a better way than it was done before ? > > > > I did > > $ make buildworld <- this was done relatively irregularly > > $ make buildenv > > [Edit whatever I needed, typically in sys/sys and libexec/rtld-elf] > > $ cd libexec/rtld-elf > > $ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all > > [Check built ld-elf.so.1, more edits] > > $ make ... > > > > Now, if I modify anything in sys/, I have to repopuate staged headers in > > the obj directory of buildworld. > > Right ok, I've missed that SHARED=symlinks was used in Makefile.inc1, > I'll revert and redo a better patch. Thank you. From owner-dev-commits-src-main@freebsd.org Tue Mar 16 10:11:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A25B057F4C9; Tue, 16 Mar 2021 10:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F08Fp4Dd8z3qQd; Tue, 16 Mar 2021 10:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8449D21CBF; Tue, 16 Mar 2021 10:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GABQg1075799; Tue, 16 Mar 2021 10:11:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GABQTG075798; Tue, 16 Mar 2021 10:11:26 GMT (envelope-from git) Date: Tue, 16 Mar 2021 10:11:26 GMT Message-Id: <202103161011.12GABQTG075798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 15b82e00a164 - main - pf: pool/kpool conversion code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15b82e00a1640d1b9a1d720c95f65e580be30187 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 10:11:26 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=15b82e00a1640d1b9a1d720c95f65e580be30187 commit 15b82e00a1640d1b9a1d720c95f65e580be30187 Author: Kristof Provost AuthorDate: 2021-03-11 10:37:05 +0000 Commit: Kristof Provost CommitDate: 2021-03-16 09:30:28 +0000 pf: pool/kpool conversion code stuct pf_pool and struct pf_kpool are different. We should not simply bcopy() them. Happily it turns out that their differences were all pointers, and the userspace provided pointers were overwritten by the kernel, so this did actually work correctly, but we should fix it anyway. Reviewed by: glebius MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29216 --- sys/netpfil/pf/pf_ioctl.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c930a67ecf80..ce889c8d797e 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1465,6 +1465,39 @@ pf_pooladdr_to_kpooladdr(const struct pf_pooladdr *pool, strlcpy(kpool->ifname, pool->ifname, sizeof(kpool->ifname)); } +static void +pf_kpool_to_pool(const struct pf_kpool *kpool, struct pf_pool *pool) +{ + bzero(pool, sizeof(*pool)); + + bcopy(&kpool->key, &pool->key, sizeof(pool->key)); + bcopy(&kpool->counter, &pool->counter, sizeof(pool->counter)); + + pool->tblidx = kpool->tblidx; + pool->proxy_port[0] = kpool->proxy_port[0]; + pool->proxy_port[1] = kpool->proxy_port[1]; + pool->opts = kpool->opts; +} + +static int +pf_pool_to_kpool(const struct pf_pool *pool, struct pf_kpool *kpool) +{ + _Static_assert(sizeof(pool->key) == sizeof(kpool->key), ""); + _Static_assert(sizeof(pool->counter) == sizeof(kpool->counter), ""); + + bzero(kpool, sizeof(*kpool)); + + bcopy(&pool->key, &kpool->key, sizeof(kpool->key)); + bcopy(&pool->counter, &kpool->counter, sizeof(kpool->counter)); + + kpool->tblidx = pool->tblidx; + kpool->proxy_port[0] = pool->proxy_port[0]; + kpool->proxy_port[1] = pool->proxy_port[1]; + kpool->opts = pool->opts; + + return (0); +} + static void pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) { @@ -1491,7 +1524,7 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) strlcpy(rule->overload_tblname, krule->overload_tblname, sizeof(rule->overload_tblname)); - bcopy(&krule->rpool, &rule->rpool, sizeof(krule->rpool)); + pf_kpool_to_pool(&krule->rpool, &rule->rpool); rule->evaluations = counter_u64_fetch(krule->evaluations); for (int i = 0; i < 2; i++) { @@ -1628,7 +1661,9 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) strlcpy(krule->overload_tblname, rule->overload_tblname, sizeof(rule->overload_tblname)); - bcopy(&rule->rpool, &krule->rpool, sizeof(krule->rpool)); + ret = pf_pool_to_kpool(&rule->rpool, &krule->rpool); + if (ret != 0) + return (ret); /* Don't allow userspace to set evaulations, packets or bytes. */ /* kif, anchor, overload_tbl are not copied over. */ From owner-dev-commits-src-main@freebsd.org Tue Mar 16 11:30:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37E845A94F2; Tue, 16 Mar 2021 11:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0B1N181wz4Qn5; Tue, 16 Mar 2021 11:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19EDA22AFD; Tue, 16 Mar 2021 11:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GBUmSD079950; Tue, 16 Mar 2021 11:30:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GBUm8Z079949; Tue, 16 Mar 2021 11:30:48 GMT (envelope-from git) Date: Tue, 16 Mar 2021 11:30:48 GMT Message-Id: <202103161130.12GBUm8Z079949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 54ac6f721efc - main - bhyve: virtio shares definitions between sys/dev/virtio MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 54ac6f721efccdba5a09aa9f38be0a1c4ef6cf14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 11:30:48 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=54ac6f721efccdba5a09aa9f38be0a1c4ef6cf14 commit 54ac6f721efccdba5a09aa9f38be0a1c4ef6cf14 Author: Ka Ho Ng AuthorDate: 2021-03-16 11:27:38 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-16 11:29:39 +0000 bhyve: virtio shares definitions between sys/dev/virtio Definitions inside usr.sbin/bhyve/virtio.h are thrown away. Definitions in sys/dev/virtio are used instead. This reduces code duplication. Sponsored by: The FreeBSD Foundation Reviewed by: grehan Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29084 --- sys/dev/virtio/virtio.h | 4 + sys/dev/virtio/virtio_endian.h | 3 + usr.sbin/bhyve/pci_virtio_9p.c | 2 +- usr.sbin/bhyve/pci_virtio_block.c | 2 +- usr.sbin/bhyve/pci_virtio_console.c | 2 +- usr.sbin/bhyve/pci_virtio_net.c | 2 +- usr.sbin/bhyve/pci_virtio_rnd.c | 2 +- usr.sbin/bhyve/pci_virtio_scsi.c | 2 +- usr.sbin/bhyve/virtio.c | 147 +++++++++++++++++------------------ usr.sbin/bhyve/virtio.h | 150 ++++++------------------------------ 10 files changed, 105 insertions(+), 211 deletions(-) diff --git a/sys/dev/virtio/virtio.h b/sys/dev/virtio/virtio.h index b22327351b43..8d32d5a8742f 100644 --- a/sys/dev/virtio/virtio.h +++ b/sys/dev/virtio/virtio.h @@ -35,6 +35,8 @@ #include #include +#ifdef _KERNEL + struct sbuf; struct vq_alloc_info; @@ -187,4 +189,6 @@ virtio_simple_probe(device_t dev, const struct virtio_pnp_match *match) return (BUS_PROBE_DEFAULT); } +#endif /* _KERNEL */ + #endif /* _VIRTIO_H_ */ diff --git a/sys/dev/virtio/virtio_endian.h b/sys/dev/virtio/virtio_endian.h index d0de299c7227..19d7fcc12079 100644 --- a/sys/dev/virtio/virtio_endian.h +++ b/sys/dev/virtio/virtio_endian.h @@ -32,6 +32,9 @@ #define _VIRTIO_ENDIAN_H_ #include +#ifndef _KERNEL +#include +#endif /* _KERNEL */ /* * VirtIO V1 (modern) uses little endian, while legacy VirtIO uses the guest's diff --git a/usr.sbin/bhyve/pci_virtio_9p.c b/usr.sbin/bhyve/pci_virtio_9p.c index 7e8542a46e05..4296ccd11c7f 100644 --- a/usr.sbin/bhyve/pci_virtio_9p.c +++ b/usr.sbin/bhyve/pci_virtio_9p.c @@ -325,7 +325,7 @@ pci_vt9p_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_9P); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_9P); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_9P); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c index 6be24ec8bcf1..00258d1993b0 100644 --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -533,7 +533,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_BLOCK); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_BLOCK); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_BLOCK); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vbsc_vs, 1, fbsdrun_virtio_msix())) { diff --git a/usr.sbin/bhyve/pci_virtio_console.c b/usr.sbin/bhyve/pci_virtio_console.c index 133902ccb129..1911210fa046 100644 --- a/usr.sbin/bhyve/pci_virtio_console.c +++ b/usr.sbin/bhyve/pci_virtio_console.c @@ -644,7 +644,7 @@ pci_vtcon_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_CONSOLE); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_SIMPLECOMM); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_CONSOLE); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_CONSOLE); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c index ac728b611c46..1c8af094b6dc 100644 --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -670,7 +670,7 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_NET); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_NETWORK); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); /* Link is up if we managed to open backend device. */ diff --git a/usr.sbin/bhyve/pci_virtio_rnd.c b/usr.sbin/bhyve/pci_virtio_rnd.c index 10ba9ddfbfaf..42feb7a2c4e0 100644 --- a/usr.sbin/bhyve/pci_virtio_rnd.c +++ b/usr.sbin/bhyve/pci_virtio_rnd.c @@ -190,7 +190,7 @@ pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_RANDOM); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_CRYPTO); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_ENTROPY); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_ENTROPY); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vrsc_vs, 1, fbsdrun_virtio_msix())) diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index 92a3311b6924..1dd7b6ebcf0b 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -720,7 +720,7 @@ pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_SCSI); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_SCSI); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_SCSI); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vss_vs, 1, fbsdrun_virtio_msix())) diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c index f3deb72b081c..078a74b759df 100644 --- a/usr.sbin/bhyve/virtio.c +++ b/usr.sbin/bhyve/virtio.c @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -127,10 +129,10 @@ vi_set_io_bar(struct virtio_softc *vs, int barnum) size_t size; /* - * ??? should we use CFG0 if MSI-X is disabled? + * ??? should we use VIRTIO_PCI_CONFIG_OFF(0) if MSI-X is disabled? * Existing code did not... */ - size = VTCFG_R_CFG1 + vs->vs_vc->vc_cfgsize; + size = VIRTIO_PCI_CONFIG_OFF(1) + vs->vs_vc->vc_cfgsize; pci_emul_alloc_bar(vs->vs_pi, barnum, PCIBAR_IO, size); } @@ -182,12 +184,12 @@ vi_vq_init(struct virtio_softc *vs, uint32_t pfn) vq = &vs->vs_queues[vs->vs_curq]; vq->vq_pfn = pfn; phys = (uint64_t)pfn << VRING_PFN; - size = vring_size(vq->vq_qsize); + size = vring_size_aligned(vq->vq_qsize); base = paddr_guest2host(vs->vs_pi->pi_vmctx, phys, size); /* First page(s) are descriptors... */ - vq->vq_desc = (struct virtio_desc *)base; - base += vq->vq_qsize * sizeof(struct virtio_desc); + vq->vq_desc = (struct vring_desc *)base; + base += vq->vq_qsize * sizeof(struct vring_desc); /* ... immediately followed by "avail" ring (entirely uint16_t's) */ vq->vq_avail = (struct vring_avail *)base; @@ -211,15 +213,15 @@ vi_vq_init(struct virtio_softc *vs, uint32_t pfn) * descriptor. */ static inline void -_vq_record(int i, volatile struct virtio_desc *vd, struct vmctx *ctx, +_vq_record(int i, volatile struct vring_desc *vd, struct vmctx *ctx, struct iovec *iov, int n_iov, uint16_t *flags) { if (i >= n_iov) return; - iov[i].iov_base = paddr_guest2host(ctx, vd->vd_addr, vd->vd_len); - iov[i].iov_len = vd->vd_len; + iov[i].iov_base = paddr_guest2host(ctx, vd->addr, vd->len); + iov[i].iov_len = vd->len; if (flags != NULL) - flags[i] = vd->vd_flags; + flags[i] = vd->flags; } #define VQ_MAX_DESCRIPTORS 512 /* see below */ @@ -236,7 +238,7 @@ _vq_record(int i, volatile struct virtio_desc *vd, struct vmctx *ctx, * i.e., we do not count the indirect descriptors, only the "real" * ones. * - * Basically, this vets the vd_flags and vd_next field of each + * Basically, this vets the "flags" and "next" field of each * descriptor and tells you how many are involved. Since some may * be indirect, this also needs the vmctx (in the pci_devinst * at vs->vs_pi) so that it can find indirect descriptors. @@ -253,7 +255,7 @@ _vq_record(int i, volatile struct virtio_desc *vd, struct vmctx *ctx, * * If you want to verify the WRITE flag on each descriptor, pass a * non-NULL "flags" pointer to an array of "uint16_t" of the same size - * as n_iov and we'll copy each vd_flags field after unwinding any + * as n_iov and we'll copy each "flags" field after unwinding any * indirects. * * If some descriptor(s) are invalid, this prints a diagnostic message @@ -269,7 +271,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, int i; u_int ndesc, n_indir; u_int idx, next; - volatile struct virtio_desc *vdir, *vindir, *vp; + volatile struct vring_desc *vdir, *vindir, *vp; struct vmctx *ctx; struct virtio_softc *vs; const char *name; @@ -279,11 +281,11 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, /* * Note: it's the responsibility of the guest not to - * update vq->vq_avail->va_idx until all of the descriptors + * update vq->vq_avail->idx until all of the descriptors * the guest has written are valid (including all their - * vd_next fields and vd_flags). + * "next" fields and "flags"). * - * Compute (va_idx - last_avail) in integers mod 2**16. This is + * Compute (vq_avail->idx - last_avail) in integers mod 2**16. This is * the number of descriptors the device has made available * since the last time we updated vq->vq_last_avail. * @@ -291,7 +293,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, * then trim off excess bits. */ idx = vq->vq_last_avail; - ndesc = (uint16_t)((u_int)vq->vq_avail->va_idx - idx); + ndesc = (uint16_t)((u_int)vq->vq_avail->idx - idx); if (ndesc == 0) return (0); if (ndesc > vq->vq_qsize) { @@ -311,9 +313,9 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, * index, but we just abort if the count gets excessive. */ ctx = vs->vs_pi->pi_vmctx; - *pidx = next = vq->vq_avail->va_ring[idx & (vq->vq_qsize - 1)]; + *pidx = next = vq->vq_avail->ring[idx & (vq->vq_qsize - 1)]; vq->vq_last_avail++; - for (i = 0; i < VQ_MAX_DESCRIPTORS; next = vdir->vd_next) { + for (i = 0; i < VQ_MAX_DESCRIPTORS; next = vdir->next) { if (next >= vq->vq_qsize) { EPRINTLN( "%s: descriptor index %u out of range, " @@ -322,7 +324,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, return (-1); } vdir = &vq->vq_desc[next]; - if ((vdir->vd_flags & VRING_DESC_F_INDIRECT) == 0) { + if ((vdir->flags & VRING_DESC_F_INDIRECT) == 0) { _vq_record(i, vdir, ctx, iov, n_iov, flags); i++; } else if ((vs->vs_vc->vc_hv_caps & @@ -333,16 +335,16 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, name); return (-1); } else { - n_indir = vdir->vd_len / 16; - if ((vdir->vd_len & 0xf) || n_indir == 0) { + n_indir = vdir->len / 16; + if ((vdir->len & 0xf) || n_indir == 0) { EPRINTLN( "%s: invalid indir len 0x%x, " "driver confused?", - name, (u_int)vdir->vd_len); + name, (u_int)vdir->len); return (-1); } vindir = paddr_guest2host(ctx, - vdir->vd_addr, vdir->vd_len); + vdir->addr, vdir->len); /* * Indirects start at the 0th, then follow * their own embedded "next"s until those run @@ -353,7 +355,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, next = 0; for (;;) { vp = &vindir[next]; - if (vp->vd_flags & VRING_DESC_F_INDIRECT) { + if (vp->flags & VRING_DESC_F_INDIRECT) { EPRINTLN( "%s: indirect desc has INDIR flag," " driver confused?", @@ -363,9 +365,9 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, _vq_record(i, vp, ctx, iov, n_iov, flags); if (++i > VQ_MAX_DESCRIPTORS) goto loopy; - if ((vp->vd_flags & VRING_DESC_F_NEXT) == 0) + if ((vp->flags & VRING_DESC_F_NEXT) == 0) break; - next = vp->vd_next; + next = vp->next; if (next >= n_indir) { EPRINTLN( "%s: invalid next %u > %u, " @@ -375,7 +377,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, } } } - if ((vdir->vd_flags & VRING_DESC_F_NEXT) == 0) + if ((vdir->flags & VRING_DESC_F_NEXT) == 0) return (i); } loopy: @@ -402,7 +404,7 @@ void vq_relchain_prepare(struct vqueue_info *vq, uint16_t idx, uint32_t iolen) { volatile struct vring_used *vuh; - volatile struct virtio_used *vue; + volatile struct vring_used_elem *vue; uint16_t mask; /* @@ -410,16 +412,13 @@ vq_relchain_prepare(struct vqueue_info *vq, uint16_t idx, uint32_t iolen) * - mask is N-1 where N is a power of 2 so computes x % N * - vuh points to the "used" data shared with guest * - vue points to the "used" ring entry we want to update - * - * (I apologize for the two fields named vu_idx; the - * virtio spec calls the one that vue points to, "id"...) */ mask = vq->vq_qsize - 1; vuh = vq->vq_used; - vue = &vuh->vu_ring[vq->vq_next_used++ & mask]; - vue->vu_idx = idx; - vue->vu_tlen = iolen; + vue = &vuh->ring[vq->vq_next_used++ & mask]; + vue->id = idx; + vue->len = iolen; } void @@ -431,7 +430,7 @@ vq_relchain_publish(struct vqueue_info *vq) * (and even on x86 to act as a compiler barrier). */ atomic_thread_fence_rel(); - vq->vq_used->vu_idx = vq->vq_next_used; + vq->vq_used->idx = vq->vq_next_used; } /* @@ -481,12 +480,12 @@ vq_endchains(struct vqueue_info *vq, int used_all_avail) */ vs = vq->vq_vs; old_idx = vq->vq_save_used; - vq->vq_save_used = new_idx = vq->vq_used->vu_idx; + vq->vq_save_used = new_idx = vq->vq_used->idx; /* - * Use full memory barrier between vu_idx store from preceding + * Use full memory barrier between "idx" store from preceding * vq_relchain() call and the loads from VQ_USED_EVENT_IDX() or - * va_flags below. + * "flags" field below. */ atomic_thread_fence_seq_cst(); if (used_all_avail && @@ -502,7 +501,7 @@ vq_endchains(struct vqueue_info *vq, int used_all_avail) (uint16_t)(new_idx - old_idx); } else { intr = new_idx != old_idx && - !(vq->vq_avail->va_flags & VRING_AVAIL_F_NO_INTERRUPT); + !(vq->vq_avail->flags & VRING_AVAIL_F_NO_INTERRUPT); } if (intr) vq_interrupt(vs, vq); @@ -515,16 +514,16 @@ static struct config_reg { uint8_t cr_ro; /* true => reg is read only */ const char *cr_name; /* name of reg */ } config_regs[] = { - { VTCFG_R_HOSTCAP, 4, 1, "HOSTCAP" }, - { VTCFG_R_GUESTCAP, 4, 0, "GUESTCAP" }, - { VTCFG_R_PFN, 4, 0, "PFN" }, - { VTCFG_R_QNUM, 2, 1, "QNUM" }, - { VTCFG_R_QSEL, 2, 0, "QSEL" }, - { VTCFG_R_QNOTIFY, 2, 0, "QNOTIFY" }, - { VTCFG_R_STATUS, 1, 0, "STATUS" }, - { VTCFG_R_ISR, 1, 0, "ISR" }, - { VTCFG_R_CFGVEC, 2, 0, "CFGVEC" }, - { VTCFG_R_QVEC, 2, 0, "QVEC" }, + { VIRTIO_PCI_HOST_FEATURES, 4, 1, "HOST_FEATURES" }, + { VIRTIO_PCI_GUEST_FEATURES, 4, 0, "GUEST_FEATURES" }, + { VIRTIO_PCI_QUEUE_PFN, 4, 0, "QUEUE_PFN" }, + { VIRTIO_PCI_QUEUE_NUM, 2, 1, "QUEUE_NUM" }, + { VIRTIO_PCI_QUEUE_SEL, 2, 0, "QUEUE_SEL" }, + { VIRTIO_PCI_QUEUE_NOTIFY, 2, 0, "QUEUE_NOTIFY" }, + { VIRTIO_PCI_STATUS, 1, 0, "STATUS" }, + { VIRTIO_PCI_ISR, 1, 0, "ISR" }, + { VIRTIO_MSI_CONFIG_VECTOR, 2, 0, "CONFIG_VECTOR" }, + { VIRTIO_MSI_QUEUE_VECTOR, 2, 0, "QUEUE_VECTOR" }, }; static inline struct config_reg * @@ -586,10 +585,7 @@ vi_pci_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, if (size != 1 && size != 2 && size != 4) goto bad; - if (pci_msix_enabled(pi)) - virtio_config_size = VTCFG_R_CFG1; - else - virtio_config_size = VTCFG_R_CFG0; + virtio_config_size = VIRTIO_PCI_CONFIG_OFF(pci_msix_enabled(pi)); if (offset >= virtio_config_size) { /* @@ -623,39 +619,39 @@ bad: } switch (offset) { - case VTCFG_R_HOSTCAP: + case VIRTIO_PCI_HOST_FEATURES: value = vc->vc_hv_caps; break; - case VTCFG_R_GUESTCAP: + case VIRTIO_PCI_GUEST_FEATURES: value = vs->vs_negotiated_caps; break; - case VTCFG_R_PFN: + case VIRTIO_PCI_QUEUE_PFN: if (vs->vs_curq < vc->vc_nvq) value = vs->vs_queues[vs->vs_curq].vq_pfn; break; - case VTCFG_R_QNUM: + case VIRTIO_PCI_QUEUE_NUM: value = vs->vs_curq < vc->vc_nvq ? vs->vs_queues[vs->vs_curq].vq_qsize : 0; break; - case VTCFG_R_QSEL: + case VIRTIO_PCI_QUEUE_SEL: value = vs->vs_curq; break; - case VTCFG_R_QNOTIFY: + case VIRTIO_PCI_QUEUE_NOTIFY: value = 0; /* XXX */ break; - case VTCFG_R_STATUS: + case VIRTIO_PCI_STATUS: value = vs->vs_status; break; - case VTCFG_R_ISR: + case VIRTIO_PCI_ISR: value = vs->vs_isr; vs->vs_isr = 0; /* a read clears this flag */ if (value) pci_lintr_deassert(pi); break; - case VTCFG_R_CFGVEC: + case VIRTIO_MSI_CONFIG_VECTOR: value = vs->vs_msix_cfg_idx; break; - case VTCFG_R_QVEC: + case VIRTIO_MSI_QUEUE_VECTOR: value = vs->vs_curq < vc->vc_nvq ? vs->vs_queues[vs->vs_curq].vq_msix_idx : VIRTIO_MSI_NO_VECTOR; @@ -706,10 +702,7 @@ vi_pci_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, if (size != 1 && size != 2 && size != 4) goto bad; - if (pci_msix_enabled(pi)) - virtio_config_size = VTCFG_R_CFG1; - else - virtio_config_size = VTCFG_R_CFG0; + virtio_config_size = VIRTIO_PCI_CONFIG_OFF(pci_msix_enabled(pi)); if (offset >= virtio_config_size) { /* @@ -747,18 +740,18 @@ bad: } switch (offset) { - case VTCFG_R_GUESTCAP: + case VIRTIO_PCI_GUEST_FEATURES: vs->vs_negotiated_caps = value & vc->vc_hv_caps; if (vc->vc_apply_features) (*vc->vc_apply_features)(DEV_SOFTC(vs), vs->vs_negotiated_caps); break; - case VTCFG_R_PFN: + case VIRTIO_PCI_QUEUE_PFN: if (vs->vs_curq >= vc->vc_nvq) goto bad_qindex; vi_vq_init(vs, value); break; - case VTCFG_R_QSEL: + case VIRTIO_PCI_QUEUE_SEL: /* * Note that the guest is allowed to select an * invalid queue; we just need to return a QNUM @@ -766,7 +759,7 @@ bad: */ vs->vs_curq = value; break; - case VTCFG_R_QNOTIFY: + case VIRTIO_PCI_QUEUE_NOTIFY: if (value >= vc->vc_nvq) { EPRINTLN("%s: queue %d notify out of range", name, (int)value); @@ -782,15 +775,15 @@ bad: "%s: qnotify queue %d: missing vq/vc notify", name, (int)value); break; - case VTCFG_R_STATUS: + case VIRTIO_PCI_STATUS: vs->vs_status = value; if (value == 0) (*vc->vc_reset)(DEV_SOFTC(vs)); break; - case VTCFG_R_CFGVEC: + case VIRTIO_MSI_CONFIG_VECTOR: vs->vs_msix_cfg_idx = value; break; - case VTCFG_R_QVEC: + case VIRTIO_MSI_QUEUE_VECTOR: if (vs->vs_curq >= vc->vc_nvq) goto bad_qindex; vq = &vs->vs_queues[vs->vs_curq]; @@ -896,7 +889,7 @@ vi_pci_snapshot_queues(struct virtio_softc *vs, struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(vq->vq_pfn, meta, ret, done); - addr_size = vq->vq_qsize * sizeof(struct virtio_desc); + addr_size = vq->vq_qsize * sizeof(struct vring_desc); SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(vq->vq_desc, addr_size, false, meta, ret, done); @@ -908,8 +901,8 @@ vi_pci_snapshot_queues(struct virtio_softc *vs, struct vm_snapshot_meta *meta) SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(vq->vq_used, addr_size, false, meta, ret, done); - SNAPSHOT_BUF_OR_LEAVE(vq->vq_desc, vring_size(vq->vq_qsize), - meta, ret, done); + SNAPSHOT_BUF_OR_LEAVE(vq->vq_desc, + vring_size_aligned(vq->vq_qsize), meta, ret, done); } done: diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index b055f0c35941..c5730f71000e 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -28,11 +28,15 @@ * $FreeBSD$ */ -#ifndef _VIRTIO_H_ -#define _VIRTIO_H_ +#ifndef _BHYVE_VIRTIO_H_ +#define _BHYVE_VIRTIO_H_ #include +#include +#include +#include + /* * These are derived from several virtio specifications. * @@ -125,39 +129,6 @@ */ #define VRING_ALIGN 4096 -#define VRING_DESC_F_NEXT (1 << 0) -#define VRING_DESC_F_WRITE (1 << 1) -#define VRING_DESC_F_INDIRECT (1 << 2) - -struct virtio_desc { /* AKA vring_desc */ - uint64_t vd_addr; /* guest physical address */ - uint32_t vd_len; /* length of scatter/gather seg */ - uint16_t vd_flags; /* VRING_F_DESC_* */ - uint16_t vd_next; /* next desc if F_NEXT */ -} __packed; - -struct virtio_used { /* AKA vring_used_elem */ - uint32_t vu_idx; /* head of used descriptor chain */ - uint32_t vu_tlen; /* length written-to */ -} __packed; - -#define VRING_AVAIL_F_NO_INTERRUPT 1 - -struct vring_avail { - uint16_t va_flags; /* VRING_AVAIL_F_* */ - uint16_t va_idx; /* counts to 65535, then cycles */ - uint16_t va_ring[]; /* size N, reported in QNUM value */ -/* uint16_t va_used_event; -- after N ring entries */ -} __packed; - -#define VRING_USED_F_NO_NOTIFY 1 -struct vring_used { - uint16_t vu_flags; /* VRING_USED_F_* */ - uint16_t vu_idx; /* counts to 65535, then cycles */ - struct virtio_used vu_ring[]; /* size N */ -/* uint16_t vu_avail_event; -- after N ring entries */ -} __packed; - /* * The address of any given virtual queue is determined by a single * Page Frame Number register. The guest writes the PFN into the @@ -190,23 +161,6 @@ struct vring_used { */ #define VRING_PFN 12 -/* - * Virtio device types - * - * XXX Should really be merged with defines - */ -#define VIRTIO_TYPE_NET 1 -#define VIRTIO_TYPE_BLOCK 2 -#define VIRTIO_TYPE_CONSOLE 3 -#define VIRTIO_TYPE_ENTROPY 4 -#define VIRTIO_TYPE_BALLOON 5 -#define VIRTIO_TYPE_IOMEMORY 6 -#define VIRTIO_TYPE_RPMSG 7 -#define VIRTIO_TYPE_SCSI 8 -#define VIRTIO_TYPE_9P 9 - -/* experimental IDs start at 65535 and work down */ - /* * PCI vendor/device IDs */ @@ -218,71 +172,11 @@ struct vring_used { #define VIRTIO_DEV_SCSI 0x1008 #define VIRTIO_DEV_9P 0x1009 -/* - * PCI config space constants. - * - * If MSI-X is enabled, the ISR register is generally not used, - * and the configuration vector and queue vector appear at offsets - * 20 and 22 with the remaining configuration registers at 24. - * If MSI-X is not enabled, those two registers disappear and - * the remaining configuration registers start at offset 20. - */ -#define VTCFG_R_HOSTCAP 0 -#define VTCFG_R_GUESTCAP 4 -#define VTCFG_R_PFN 8 -#define VTCFG_R_QNUM 12 -#define VTCFG_R_QSEL 14 -#define VTCFG_R_QNOTIFY 16 -#define VTCFG_R_STATUS 18 -#define VTCFG_R_ISR 19 -#define VTCFG_R_CFGVEC 20 -#define VTCFG_R_QVEC 22 -#define VTCFG_R_CFG0 20 /* No MSI-X */ -#define VTCFG_R_CFG1 24 /* With MSI-X */ -#define VTCFG_R_MSIX 20 - -/* - * Bits in VTCFG_R_STATUS. Guests need not actually set any of these, - * but a guest writing 0 to this register means "please reset". - */ -#define VTCFG_STATUS_ACK 0x01 /* guest OS has acknowledged dev */ -#define VTCFG_STATUS_DRIVER 0x02 /* guest OS driver is loaded */ -#define VTCFG_STATUS_DRIVER_OK 0x04 /* guest OS driver ready */ -#define VTCFG_STATUS_FAILED 0x80 /* guest has given up on this dev */ - -/* - * Bits in VTCFG_R_ISR. These apply only if not using MSI-X. - * - * (We don't [yet?] ever use CONF_CHANGED.) - */ -#define VTCFG_ISR_QUEUES 0x01 /* re-scan queues */ -#define VTCFG_ISR_CONF_CHANGED 0x80 /* configuration changed */ - -#define VIRTIO_MSI_NO_VECTOR 0xFFFF - -/* - * Feature flags. - * Note: bits 0 through 23 are reserved to each device type. - */ -#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24) -#define VIRTIO_RING_F_INDIRECT_DESC (1 << 28) -#define VIRTIO_RING_F_EVENT_IDX (1 << 29) - /* From section 2.3, "Virtqueue Configuration", of the virtio specification */ -static inline size_t -vring_size(u_int qsz) +static inline int +vring_size_aligned(u_int qsz) { - size_t size; - - /* constant 3 below = va_flags, va_idx, va_used_event */ - size = sizeof(struct virtio_desc) * qsz + sizeof(uint16_t) * (3 + qsz); - size = roundup2(size, VRING_ALIGN); - - /* constant 3 below = vu_flags, vu_idx, vu_avail_event */ - size += sizeof(uint16_t) * 3 + sizeof(struct virtio_used) * qsz; - size = roundup2(size, VRING_ALIGN); - - return (size); + return (roundup2(vring_size(qsz, VRING_ALIGN), VRING_ALIGN)); } struct vmctx; @@ -397,23 +291,23 @@ struct vqueue_info { uint16_t vq_num; /* we're the num'th queue in the softc */ uint16_t vq_flags; /* flags (see above) */ - uint16_t vq_last_avail; /* a recent value of vq_avail->va_idx */ + uint16_t vq_last_avail; /* a recent value of vq_avail->idx */ uint16_t vq_next_used; /* index of the next used slot to be filled */ - uint16_t vq_save_used; /* saved vq_used->vu_idx; see vq_endchains */ + uint16_t vq_save_used; /* saved vq_used->idx; see vq_endchains */ uint16_t vq_msix_idx; /* MSI-X index, or VIRTIO_MSI_NO_VECTOR */ uint32_t vq_pfn; /* PFN of virt queue (not shifted!) */ - volatile struct virtio_desc *vq_desc; /* descriptor array */ + volatile struct vring_desc *vq_desc; /* descriptor array */ volatile struct vring_avail *vq_avail; /* the "avail" ring */ volatile struct vring_used *vq_used; /* the "used" ring */ }; /* as noted above, these are sort of backwards, name-wise */ #define VQ_AVAIL_EVENT_IDX(vq) \ - (*(volatile uint16_t *)&(vq)->vq_used->vu_ring[(vq)->vq_qsize]) + (*(volatile uint16_t *)&(vq)->vq_used->ring[(vq)->vq_qsize]) #define VQ_USED_EVENT_IDX(vq) \ - ((vq)->vq_avail->va_ring[(vq)->vq_qsize]) + ((vq)->vq_avail->ring[(vq)->vq_qsize]) /* * Is this ring ready for I/O? @@ -434,7 +328,7 @@ vq_has_descs(struct vqueue_info *vq) { return (vq_ring_ready(vq) && vq->vq_last_avail != - vq->vq_avail->va_idx); + vq->vq_avail->idx); } /* @@ -449,7 +343,7 @@ vq_interrupt(struct virtio_softc *vs, struct vqueue_info *vq) pci_generate_msix(vs->vs_pi, vq->vq_msix_idx); else { VS_LOCK(vs); - vs->vs_isr |= VTCFG_ISR_QUEUES; + vs->vs_isr |= VIRTIO_PCI_ISR_INTR; pci_generate_msi(vs->vs_pi, 0); pci_lintr_assert(vs->vs_pi); VS_UNLOCK(vs); @@ -460,11 +354,11 @@ static inline void vq_kick_enable(struct vqueue_info *vq) { - vq->vq_used->vu_flags &= ~VRING_USED_F_NO_NOTIFY; + vq->vq_used->flags &= ~VRING_USED_F_NO_NOTIFY; /* - * Full memory barrier to make sure the store to vu_flags - * happens before the load from va_idx, which results from - * a subsequent call to vq_has_descs(). + * Full memory barrier to make sure the store to vq_used->flags + * happens before the load from vq_avail->idx, which results from a + * subsequent call to vq_has_descs(). */ atomic_thread_fence_seq_cst(); } @@ -473,7 +367,7 @@ static inline void vq_kick_disable(struct vqueue_info *vq) { - vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY; + vq->vq_used->flags |= VRING_USED_F_NO_NOTIFY; } struct iovec; @@ -502,4 +396,4 @@ int vi_pci_snapshot(struct vm_snapshot_meta *meta); int vi_pci_pause(struct vmctx *ctx, struct pci_devinst *pi); int vi_pci_resume(struct vmctx *ctx, struct pci_devinst *pi); #endif -#endif /* _VIRTIO_H_ */ +#endif /* _BHYVE_VIRTIO_H_ */ From owner-dev-commits-src-main@freebsd.org Tue Mar 16 15:20:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 010595B2B6D; Tue, 16 Mar 2021 15:20:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0H636dJMz4h3h; Tue, 16 Mar 2021 15:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D24E525E9B; Tue, 16 Mar 2021 15:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GFKBUn078712; Tue, 16 Mar 2021 15:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GFKBhg078704; Tue, 16 Mar 2021 15:20:11 GMT (envelope-from git) Date: Tue, 16 Mar 2021 15:20:11 GMT Message-Id: <202103161520.12GFKBhg078704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: c244b1d8a387 - main - pkg: settle the uniq extension to .pkg instead of .bsd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c244b1d8a38731041d0f3ff4191192a85dd8608b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 15:20:12 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c244b1d8a38731041d0f3ff4191192a85dd8608b commit c244b1d8a38731041d0f3ff4191192a85dd8608b Author: Baptiste Daroussin AuthorDate: 2021-03-16 15:18:48 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-16 15:19:52 +0000 pkg: settle the uniq extension to .pkg instead of .bsd Requested by: many --- usr.sbin/pkg/pkg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 48b92049b869..04232672ac39 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -85,7 +85,7 @@ struct fingerprint { }; static const char *bootstrap_names [] = { - "pkg.bsd", + "pkg.pkg", "pkg.txz", NULL }; From owner-dev-commits-src-main@freebsd.org Tue Mar 16 16:02:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A36985B3B93; Tue, 16 Mar 2021 16:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0J2K4KH1z4kM8; Tue, 16 Mar 2021 16:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8732A26662; Tue, 16 Mar 2021 16:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GG21CX040660; Tue, 16 Mar 2021 16:02:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GG21Xh040659; Tue, 16 Mar 2021 16:02:01 GMT (envelope-from git) Date: Tue, 16 Mar 2021 16:02:01 GMT Message-Id: <202103161602.12GG21Xh040659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: 0af8a2db34cf - main - release: do not set __MAKE_CONF and SRCCONF for the chroot build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0af8a2db34cff008d4f48f357da48b7379b18893 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 16:02:01 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=0af8a2db34cff008d4f48f357da48b7379b18893 commit 0af8a2db34cff008d4f48f357da48b7379b18893 Author: Glen Barber AuthorDate: 2021-03-16 16:01:48 +0000 Commit: Glen Barber CommitDate: 2021-03-16 16:01:48 +0000 release: do not set __MAKE_CONF and SRCCONF for the chroot build PR: 254319 Submitted by: truckman MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/release.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/release/release.sh b/release/release.sh index 3d7612ef6b80..aa2ef4e6b3da 100755 --- a/release/release.sh +++ b/release/release.sh @@ -171,6 +171,7 @@ env_check() { # this file, unless overridden by release.conf. In most cases, these # will not need to be changed. CONF_FILES="__MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF}" + NOCONF_FILES="__MAKE_CONF=/dev/null SRCCONF=/dev/null" if [ -n "${TARGET}" ] && [ -n "${TARGET_ARCH}" ]; then ARCH_FLAGS="TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" else @@ -194,9 +195,9 @@ env_check() { CHROOT_MAKEENV="${CHROOT_MAKEENV} \ MAKEOBJDIRPREFIX=${CHROOTDIR}/tmp/obj" - CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}" - CHROOT_IMAKEFLAGS="${WORLD_FLAGS} ${CONF_FILES}" - CHROOT_DMAKEFLAGS="${WORLD_FLAGS} ${CONF_FILES}" + CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${NOCONF_FILES}" + CHROOT_IMAKEFLAGS="${WORLD_FLAGS} ${NOCONF_FILES}" + CHROOT_DMAKEFLAGS="${WORLD_FLAGS} ${NOCONF_FILES}" RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} \ ${CONF_FILES}" RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} \ From owner-dev-commits-src-main@freebsd.org Tue Mar 16 18:03:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B90ED5B78FE; Tue, 16 Mar 2021 18:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0LkF4w8Tz4vGx; Tue, 16 Mar 2021 18:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B6292838D; Tue, 16 Mar 2021 18:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GI3Hvw098505; Tue, 16 Mar 2021 18:03:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GI3H2K098504; Tue, 16 Mar 2021 18:03:17 GMT (envelope-from git) Date: Tue, 16 Mar 2021 18:03:17 GMT Message-Id: <202103161803.12GI3H2K098504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 0b373f26bea1 - main - cxgbe(4): catch up with the latest cryptocaps. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b373f26bea17e4b569531b94df30e1af6a0327b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 18:03:17 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=0b373f26bea17e4b569531b94df30e1af6a0327b commit 0b373f26bea17e4b569531b94df30e1af6a0327b Author: Navdeep Parhar AuthorDate: 2021-03-15 19:54:34 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-16 17:53:52 +0000 cxgbe(4): catch up with the latest cryptocaps. There are two crypto capabilities that the driver didn't know about. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index f749fdd937d7..201a333aa431 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -6405,7 +6405,8 @@ static char *caps_decoder[] = { "\005INITIATOR_SSNOFLD\006TARGET_SSNOFLD" "\007T10DIF" "\010INITIATOR_CMDOFLD\011TARGET_CMDOFLD", - "\20\001LOOKASIDE\002TLSKEYS", /* 7: Crypto */ + "\20\001LOOKASIDE\002TLSKEYS\003IPSEC_INLINE" /* 7: Crypto */ + "\004TLS_HW", "\20\001INITIATOR\002TARGET\003CTRL_OFLD" /* 8: FCoE */ "\004PO_INITIATOR\005PO_TARGET", }; From owner-dev-commits-src-main@freebsd.org Tue Mar 16 18:30:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CDA05684B9; Tue, 16 Mar 2021 18:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0MKG0tt9z3Cgm; Tue, 16 Mar 2021 18:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 117B228811; Tue, 16 Mar 2021 18:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GIUAPp028051; Tue, 16 Mar 2021 18:30:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GIU97h028045; Tue, 16 Mar 2021 18:30:09 GMT (envelope-from git) Date: Tue, 16 Mar 2021 18:30:09 GMT Message-Id: <202103161830.12GIU97h028045@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: 6827435548d2 - main - pkgbase: Fix building out-of-tree manual pages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6827435548d257c672f934db5c6ff01012d96995 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 18:30:10 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=6827435548d257c672f934db5c6ff01012d96995 commit 6827435548d257c672f934db5c6ff01012d96995 Author: Jung-uk Kim AuthorDate: 2021-03-16 18:16:10 +0000 Commit: Jung-uk Kim CommitDate: 2021-03-16 18:29:48 +0000 pkgbase: Fix building out-of-tree manual pages c7e6cb9e08d6 introduced MK_MANSPLITPKG but it was not available for building out-of-tree manual pages. For example, x11/nvidia-driver fails with the following error: ===> doc (all) make[3]: "/usr/share/mk/bsd.man.mk" line 53: Malformed conditional (${MK_MANSPLITPKG} == "no") make[3]: Fatal errors encountered -- cannot continue Move the definition from src.opts.mk to bsd.opts.mk to make it visible. --- share/mk/bsd.opts.mk | 1 + share/mk/src.opts.mk | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 9f9889d0a0f0..33d843593427 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -75,6 +75,7 @@ __DEFAULT_NO_OPTIONS = \ INIT_ALL_PATTERN \ INIT_ALL_ZERO \ INSTALL_AS_USER \ + MANSPLITPKG \ RETPOLINE \ STALE_STAGED diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 949dfece43e4..619aa8f4a1d8 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -207,7 +207,6 @@ __DEFAULT_NO_OPTIONS = \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ MALLOC_PRODUCTION \ - MANSPLITPKG \ OFED_EXTRA \ OPENLDAP \ REPRODUCIBLE_BUILD \ From owner-dev-commits-src-main@freebsd.org Tue Mar 16 19:02:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 332E8569886; Tue, 16 Mar 2021 19:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0N2111c6z3GGs; Tue, 16 Mar 2021 19:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1667E28EA0; Tue, 16 Mar 2021 19:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GJ20Yv074221; Tue, 16 Mar 2021 19:02:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GJ20bt074220; Tue, 16 Mar 2021 19:02:00 GMT (envelope-from git) Date: Tue, 16 Mar 2021 19:02:00 GMT Message-Id: <202103161902.12GJ20bt074220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7b1b5aad95df - main - stand: Load INIT_ARRAY and FINI_ARRAY sections MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b1b5aad95df671aba3192f1669a8d96da481939 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 19:02:01 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7b1b5aad95df671aba3192f1669a8d96da481939 commit 7b1b5aad95df671aba3192f1669a8d96da481939 Author: Mark Johnston AuthorDate: 2021-03-16 19:01:41 +0000 Commit: Mark Johnston CommitDate: 2021-03-16 19:01:41 +0000 stand: Load INIT_ARRAY and FINI_ARRAY sections This is required for preloading modules into a KASAN-configured kernel. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- stand/common/load_elf_obj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c index 4bff74764922..78ece02433c6 100644 --- a/stand/common/load_elf_obj.c +++ b/stand/common/load_elf_obj.c @@ -264,6 +264,8 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) #if defined(__i386__) || defined(__amd64__) case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: + case SHT_FINI_ARRAY: if ((shdr[i].sh_flags & SHF_ALLOC) == 0) break; lastaddr = roundup(lastaddr, shdr[i].sh_addralign); From owner-dev-commits-src-main@freebsd.org Tue Mar 16 19:02:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 428415696C6; Tue, 16 Mar 2021 19:02:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0N201M3Yz3G3W; Tue, 16 Mar 2021 19:02:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA56628CBB; Tue, 16 Mar 2021 19:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GJ1xxs074203; Tue, 16 Mar 2021 19:01:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GJ1x0r074202; Tue, 16 Mar 2021 19:01:59 GMT (envelope-from git) Date: Tue, 16 Mar 2021 19:01:59 GMT Message-Id: <202103161901.12GJ1x0r074202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4aa157dd5b4e - main - link_elf_obj: Add a case missing from 5e6989ba4f26 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4aa157dd5b4e72b85dd07ce3c106b742ca371bca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 19:02:00 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4aa157dd5b4e72b85dd07ce3c106b742ca371bca commit 4aa157dd5b4e72b85dd07ce3c106b742ca371bca Author: Mark Johnston AuthorDate: 2021-03-16 19:01:41 +0000 Commit: Mark Johnston CommitDate: 2021-03-16 19:01:41 +0000 link_elf_obj: Add a case missing from 5e6989ba4f26 Fixes: 5e6989ba4f26 MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/kern/link_elf_obj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 337588bd5c00..65b997b513e3 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -472,6 +472,7 @@ link_elf_link_preload(linker_class_t cls, const char *filename, #ifdef __amd64__ case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: case SHT_FINI_ARRAY: if (shdr[i].sh_addr == 0) break; From owner-dev-commits-src-main@freebsd.org Tue Mar 16 19:21:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3257D56A306; Tue, 16 Mar 2021 19:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0NSY0zs8z3Hqc; Tue, 16 Mar 2021 19:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14A0C29506; Tue, 16 Mar 2021 19:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GJLXmS003942; Tue, 16 Mar 2021 19:21:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GJLWMc003941; Tue, 16 Mar 2021 19:21:32 GMT (envelope-from git) Date: Tue, 16 Mar 2021 19:21:32 GMT Message-Id: <202103161921.12GJLWMc003941@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Jeremy Subject: git: cdac5f398bf8 - main - nfs: Cleanup dead files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: peterj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cdac5f398bf8680677b71447465c32327767879b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 19:21:33 -0000 The branch main has been updated by peterj: URL: https://cgit.FreeBSD.org/src/commit/?id=cdac5f398bf8680677b71447465c32327767879b commit cdac5f398bf8680677b71447465c32327767879b Author: Peter Jeremy AuthorDate: 2021-03-16 19:16:31 +0000 Commit: Peter Jeremy CommitDate: 2021-03-16 19:16:31 +0000 nfs: Cleanup dead files These files are no longer used by the FreeBSD base system. They were being used by the amd port but that has also been deleted. Reviewed by: rmacklem Sponsored by: Google Differential Revision: https://reviews.freebsd.org/D29180 --- ObsoleteFiles.inc | 8 ++ sys/nfs/nfs_common.h | 137 --------------------------------- sys/nfsclient/nfsm_subs.h | 180 -------------------------------------------- sys/nfsclient/nlminfo.h | 44 ----------- sys/nfsserver/nfs_fha_old.h | 40 ---------- sys/nfsserver/nfsm_subs.h | 175 ------------------------------------------ sys/nfsserver/nfsrvcache.h | 49 ------------ 7 files changed, 8 insertions(+), 625 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index f111a2f83064..bb1a19ec5ceb 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,14 @@ # xargs -n1 | sort | uniq -d; # done +# 20210316: remove obsolete NFS headers +OLD_FILES+=usr/include/nfs/nfs_common.h +OLD_FILES+=usr/include/nfsclient/nfsm_subs.h +OLD_FILES+=usr/include/nfsclient/nlminfo.h +OLD_FILES+=usr/include/nfsserver/nfs_fha_old.h +OLD_FILES+=usr/include/nfsserver/nfsm_subs.h +OLD_FILES+=usr/include/nfsserver/nfsrvcache.h + # 20210315: Remove kernel-only crypto headers from /usr/include OLD_FILES+=usr/include/crypto/_cryptodev.h OLD_FILES+=usr/include/crypto/cbc_mac.h diff --git a/sys/nfs/nfs_common.h b/sys/nfs/nfs_common.h deleted file mode 100644 index a821934da0a2..000000000000 --- a/sys/nfs/nfs_common.h +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 - * $FreeBSD$ - */ - -#ifndef _NFS_NFS_COMMON_H_ -#define _NFS_NFS_COMMON_H_ - -extern enum vtype nv3tov_type[]; -extern nfstype nfsv3_type[]; - -#define vtonfsv2_mode(t, m) \ - txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : MAKEIMODE((t), (m))) - -#define nfsv3tov_type(a) nv3tov_type[fxdr_unsigned(u_int32_t,(a))&0x7] -#define vtonfsv3_type(a) txdr_unsigned(nfsv3_type[((int32_t)(a))]) - -int nfs_adv(struct mbuf **, caddr_t *, int, int); -void *nfsm_disct(struct mbuf **, caddr_t *, int, int, int); -int nfs_realign(struct mbuf **, int); - -/* ****************************** */ -/* Build request/reply phase macros */ - -void *nfsm_build_xx(int s, struct mbuf **mb, caddr_t *bpos); - -#define nfsm_build(c, s) \ - (c)nfsm_build_xx((s), &mb, &bpos) - -/* ****************************** */ -/* Interpretation phase macros */ - -void *nfsm_dissect_xx(int s, struct mbuf **md, caddr_t *dpos); -void *nfsm_dissect_xx_nonblock(int s, struct mbuf **md, caddr_t *dpos); -int nfsm_strsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); -int nfsm_adv_xx(int s, struct mbuf **md, caddr_t *dpos); - -/* Error check helpers */ -#define nfsm_dcheck(t1, mrep) \ -do { \ - if (t1 != 0) { \ - error = t1; \ - m_freem((mrep)); \ - (mrep) = NULL; \ - goto nfsmout; \ - } \ -} while (0) - -#define nfsm_dcheckp(retp, mrep) \ -do { \ - if (retp == NULL) { \ - error = EBADRPC; \ - m_freem((mrep)); \ - (mrep) = NULL; \ - goto nfsmout; \ - } \ -} while (0) - -#define nfsm_dissect(c, s) \ -({ \ - void *ret; \ - ret = nfsm_dissect_xx((s), &md, &dpos); \ - nfsm_dcheckp(ret, mrep); \ - (c)ret; \ -}) - -#define nfsm_dissect_nonblock(c, s) \ -({ \ - void *ret; \ - ret = nfsm_dissect_xx_nonblock((s), &md, &dpos); \ - nfsm_dcheckp(ret, mrep); \ - (c)ret; \ -}) - -#define nfsm_strsiz(s,m) \ -do { \ - int t1; \ - t1 = nfsm_strsiz_xx(&(s), (m), &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while(0) - -#define nfsm_mtouio(p,s) \ -do {\ - int32_t t1 = 0; \ - if ((s) > 0) \ - t1 = nfsm_mbuftouio(&md, (p), (s), &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_rndup(a) (((a)+3)&(~0x3)) - -#define nfsm_adv(s) \ -do { \ - int t1; \ - t1 = nfsm_adv_xx((s), &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#ifdef __NO_STRICT_ALIGNMENT -#define nfsm_aligned(p, t) 1 -#else -#define nfsm_aligned(p, t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0) -#endif - -#endif diff --git a/sys/nfsclient/nfsm_subs.h b/sys/nfsclient/nfsm_subs.h deleted file mode 100644 index b918e78ae728..000000000000 --- a/sys/nfsclient/nfsm_subs.h +++ /dev/null @@ -1,180 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 - * $FreeBSD$ - */ - -#ifndef _NFSCLIENT_NFSM_SUBS_H_ -#define _NFSCLIENT_NFSM_SUBS_H_ - -#include - -#define nfsv2tov_type(a) nv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7] - -struct ucred; -struct vnode; - -/* - * These macros do strange and peculiar things to mbuf chains for - * the assistance of the nfs code. To attempt to use them for any - * other purpose will be dangerous. (they make weird assumptions) - */ - -/* - * First define what the actual subs. return - */ -u_int32_t nfs_xid_gen(void); - -/* *********************************** */ -/* Request generation phase macros */ - -int nfsm_fhtom_xx(struct vnode *v, int v3, struct mbuf **mb, - caddr_t *bpos); -void nfsm_v3attrbuild_xx(struct vattr *va, int full, struct mbuf **mb, - caddr_t *bpos); -int nfsm_strtom_xx(const char *a, int s, int m, struct mbuf **mb, - caddr_t *bpos); - -#define nfsm_bcheck(t1, mreq) \ -do { \ - if (t1) { \ - error = t1; \ - m_freem(mreq); \ - goto nfsmout; \ - } \ -} while (0) - -#define nfsm_fhtom(v, v3) \ -do { \ - int32_t t1; \ - t1 = nfsm_fhtom_xx((v), (v3), &mb, &bpos); \ - nfsm_bcheck(t1, mreq); \ -} while (0) - -/* If full is true, set all fields, otherwise just set mode and time fields */ -#define nfsm_v3attrbuild(a, full) \ - nfsm_v3attrbuild_xx(a, full, &mb, &bpos) - -#define nfsm_uiotom(p, s) \ -do { \ - int t1; \ - t1 = nfsm_uiotombuf((p), &mb, (s), &bpos); \ - nfsm_bcheck(t1, mreq); \ -} while (0) - -#define nfsm_strtom(a, s, m) \ -do { \ - int t1; \ - t1 = nfsm_strtom_xx((a), (s), (m), &mb, &bpos); \ - nfsm_bcheck(t1, mreq); \ -} while (0) - -/* *********************************** */ -/* Send the request */ - -#define nfsm_request(v, t, p, c) \ -do { \ - sigset_t oldset; \ - nfs_set_sigmask(p, &oldset); \ - error = nfs_request((v), mreq, (t), (p), (c), &mrep, &md, &dpos); \ - nfs_restore_sigmask(p, &oldset); \ - if (error != 0) { \ - if (error & NFSERR_RETERR) \ - error &= ~NFSERR_RETERR; \ - else \ - goto nfsmout; \ - } \ -} while (0) - -/* *********************************** */ -/* Reply interpretation phase macros */ - -int nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f, - struct mbuf **md, caddr_t *dpos); -int nfsm_getfh_xx(nfsfh_t **f, int *s, int v3, struct mbuf **md, - caddr_t *dpos); -int nfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md, - caddr_t *dpos); -int nfsm_postop_attr_xx(struct vnode **v, int *f, struct vattr *va, - struct mbuf **md, caddr_t *dpos); -int nfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md, - caddr_t *dpos); - -#define nfsm_mtofh(d, v, v3, f) \ -do { \ - int32_t t1; \ - t1 = nfsm_mtofh_xx((d), &(v), (v3), &(f), &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_getfh(f, s, v3) \ -do { \ - int32_t t1; \ - t1 = nfsm_getfh_xx(&(f), &(s), (v3), &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_loadattr(v, a) \ -do { \ - int32_t t1; \ - t1 = nfsm_loadattr_xx(&v, a, &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_postop_attr(v, f) \ -do { \ - int32_t t1; \ - t1 = nfsm_postop_attr_xx(&v, &f, NULL, &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_postop_attr_va(v, f, va) \ -do { \ - int32_t t1; \ - t1 = nfsm_postop_attr_xx(&v, &f, va, &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -/* Used as (f) for nfsm_wcc_data() */ -#define NFSV3_WCCRATTR 0 -#define NFSV3_WCCCHK 1 - -#define nfsm_wcc_data(v, f) \ -do { \ - int32_t t1; \ - t1 = nfsm_wcc_data_xx(&v, &f, &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#endif diff --git a/sys/nfsclient/nlminfo.h b/sys/nfsclient/nlminfo.h deleted file mode 100644 index 340bdbe5faa2..000000000000 --- a/sys/nfsclient/nlminfo.h +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``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 BERKELEY SOFTWARE DESIGN INC 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. - * - * from BSDI nlminfo.h,v 2.1 1998/03/18 01:30:38 don Exp - * $FreeBSD$ - */ - -/* - * Misc NLM informationi, some needed for the master lockd process, and some - * needed by every process doing nlm based locking. - */ -struct nlminfo { - /* these are used by any process doing nlm locking */ - int msg_seq; /* sequence counter for lock requests */ - int retcode; /* return code for lock requests */ - int set_getlk_pid; - int getlk_pid; - struct timeval pid_start; /* process starting time */ -}; diff --git a/sys/nfsserver/nfs_fha_old.h b/sys/nfsserver/nfs_fha_old.h deleted file mode 100644 index c7845aca8157..000000000000 --- a/sys/nfsserver/nfs_fha_old.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ - * Copyright (c) 2013 Spectra Logic Corporation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $FreeBSD$ */ - -#ifndef _NFS_FHA_OLD_H -#define _NFS_FHA_OLD_H 1 - -#ifdef _KERNEL - -#define FHAOLD_SERVER_NAME "nfsrv" - -SVCTHREAD *fhaold_assign(SVCTHREAD *this_thread, struct svc_req *req); -#endif /* _KERNEL */ - -#endif /* _NFS_FHA_OLD_H */ diff --git a/sys/nfsserver/nfsm_subs.h b/sys/nfsserver/nfsm_subs.h deleted file mode 100644 index 10c34ba634ed..000000000000 --- a/sys/nfsserver/nfsm_subs.h +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 - * $FreeBSD$ - */ - -#ifndef _NFSSERVER_NFSM_SUBS_H_ -#define _NFSSERVER_NFSM_SUBS_H_ - -#include - -#define nfstov_mode(a) (fxdr_unsigned(u_int32_t, (a)) & ALLPERMS) - -/* - * These macros do strange and peculiar things to mbuf chains for - * the assistance of the nfs code. To attempt to use them for any - * other purpose will be dangerous. (they make weird assumptions) - */ - -/* - * Now for the macros that do the simple stuff and call the functions - * for the hard stuff. - * These macros use several vars. declared in nfsm_reqhead and these - * vars. must not be used elsewhere unless you are careful not to corrupt - * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries - * that may be used so long as the value is not expected to retained - * after a macro. - * I know, this is kind of dorkey, but it makes the actual op functions - * fairly clean and deals with the mess caused by the xdr discriminating - * unions. - */ - -/* ************************************* */ -/* Dissection phase macros */ - -int nfsm_srvstrsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); -int nfsm_srvnamesiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); -int nfsm_srvnamesiz0_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); -int nfsm_srvmtofh_xx(fhandle_t *f, int v3, struct mbuf **md, caddr_t *dpos); -int nfsm_srvsattr_xx(struct vattr *a, struct mbuf **md, caddr_t *dpos); - -#define nfsm_srvstrsiz(s, m) \ -do { \ - int t1; \ - t1 = nfsm_srvstrsiz_xx(&(s), (m), &md, &dpos); \ - if (t1) { \ - error = t1; \ - nfsm_reply(0); \ - } \ -} while (0) - -#define nfsm_srvnamesiz(s) \ -do { \ - int t1; \ - t1 = nfsm_srvnamesiz_xx(&(s), NFS_MAXNAMLEN, &md, &dpos); \ - if (t1) { \ - error = t1; \ - nfsm_reply(0); \ - } \ -} while (0) - -#define nfsm_srvpathsiz(s) \ -do { \ - int t1; \ - t1 = nfsm_srvnamesiz0_xx(&(s), NFS_MAXPATHLEN, &md, &dpos); \ - if (t1) { \ - error = t1; \ - nfsm_reply(0); \ - } \ -} while (0) - -#define nfsm_srvmtofh(f) \ -do { \ - int t1; \ - t1 = nfsm_srvmtofh_xx((f), nfsd->nd_flag & ND_NFSV3, &md, &dpos); \ - if (t1) { \ - error = t1; \ - nfsm_reply(0); \ - } \ -} while (0) - -/* XXX why is this different? */ -#define nfsm_srvsattr(a) \ -do { \ - int t1; \ - t1 = nfsm_srvsattr_xx((a), &md, &dpos); \ - if (t1) { \ - error = t1; \ - m_freem(mrep); \ - mrep = NULL; \ - goto nfsmout; \ - } \ -} while (0) - -/* ************************************* */ -/* Prepare the reply */ - -#define nfsm_reply(s) \ -do { \ - if (mrep != NULL) { \ - m_freem(mrep); \ - mrep = NULL; \ - } \ - mreq = nfs_rephead((s), nfsd, error, &mb, &bpos); \ - *mrq = mreq; \ - if (error == EBADRPC) { \ - error = 0; \ - goto nfsmout; \ - } \ -} while (0) - -#define nfsm_writereply(s) \ -do { \ - mreq = nfs_rephead((s), nfsd, error, &mb, &bpos); \ -} while(0) - -/* ************************************* */ -/* Reply phase macros - add additional reply info */ - -void nfsm_srvfhtom_xx(fhandle_t *f, int v3, struct mbuf **mb, - caddr_t *bpos); -void nfsm_srvpostop_fh_xx(fhandle_t *f, struct mbuf **mb, caddr_t *bpos); -void nfsm_clget_xx(u_int32_t **tl, struct mbuf *mb, struct mbuf **mp, - char **bp, char **be, caddr_t bpos); - -#define nfsm_srvfhtom(f, v3) \ - nfsm_srvfhtom_xx((f), (v3), &mb, &bpos) - -#define nfsm_srvpostop_fh(f) \ - nfsm_srvpostop_fh_xx((f), &mb, &bpos) - -#define nfsm_srvwcc_data(br, b, ar, a) \ - nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos) - -#define nfsm_srvpostop_attr(r, a) \ - nfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos) - -#define nfsm_srvfillattr(a, f) \ - nfsm_srvfattr(nfsd, (a), (f)) - -#define nfsm_clget \ - nfsm_clget_xx(&tl, mb, &mp, &bp, &be, bpos) - -#endif diff --git a/sys/nfsserver/nfsrvcache.h b/sys/nfsserver/nfsrvcache.h deleted file mode 100644 index 10dff78538cd..000000000000 --- a/sys/nfsserver/nfsrvcache.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nfsrvcache.h 8.3 (Berkeley) 3/30/95 - * $FreeBSD$ - */ - -#ifndef _NFSSERVER_NFSRVCACHE_H_ -#define _NFSSERVER_NFSRVCACHE_H_ - -#include - -/* - * Definitions for the server recent request cache - */ -#define NFSRVCACHE_MAX_SIZE 2048 -#define NFSRVCACHE_MIN_SIZE 64 - -#endif From owner-dev-commits-src-main@freebsd.org Tue Mar 16 20:29:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15CA256C595; Tue, 16 Mar 2021 20:29:43 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0PzC0D47z3MlV; Tue, 16 Mar 2021 20:29:43 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from mousie.catspoiler.org (unknown [76.212.85.177]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: truckman) by smtp.freebsd.org (Postfix) with ESMTPSA id EC2F8948E; Tue, 16 Mar 2021 20:29:41 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Date: Tue, 16 Mar 2021 13:29:39 -0700 (PDT) From: Don Lewis Subject: Re: git: 0af8a2db34cf - main - release: do not set __MAKE_CONF and SRCCONF for the chroot build To: Glen Barber cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org In-Reply-To: <202103161602.12GG21Xh040659@gitrepo.freebsd.org> Message-ID: References: <202103161602.12GG21Xh040659@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=us-ascii Content-Disposition: INLINE X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 20:29:43 -0000 On 16 Mar, Glen Barber wrote: > The branch main has been updated by gjb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0af8a2db34cff008d4f48f357da48b7379b18893 > > commit 0af8a2db34cff008d4f48f357da48b7379b18893 > Author: Glen Barber > AuthorDate: 2021-03-16 16:01:48 +0000 > Commit: Glen Barber > CommitDate: 2021-03-16 16:01:48 +0000 > > release: do not set __MAKE_CONF and SRCCONF for the chroot build > > PR: 254319 > Submitted by: truckman > MFC after: 1 week > Sponsored by: Rubicon Communications, LLC ("Netgate") Thanks! From owner-dev-commits-src-main@freebsd.org Tue Mar 16 21:43:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50A8F56F20C; Tue, 16 Mar 2021 21:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0RcP1qbQz3kgj; Tue, 16 Mar 2021 21:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31D1B2AFDD; Tue, 16 Mar 2021 21:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GLhXlx088434; Tue, 16 Mar 2021 21:43:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GLhXSe088433; Tue, 16 Mar 2021 21:43:33 GMT (envelope-from git) Date: Tue, 16 Mar 2021 21:43:33 GMT Message-Id: <202103162143.12GLhXSe088433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 096a84721670 - main - nlmrsa: Mark deprecated for 14. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 096a84721670d388e432a1f7399251e4b20714f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 21:43:33 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=096a84721670d388e432a1f7399251e4b20714f1 commit 096a84721670d388e432a1f7399251e4b20714f1 Author: John Baldwin AuthorDate: 2021-03-16 21:34:58 +0000 Commit: John Baldwin CommitDate: 2021-03-16 21:43:03 +0000 nlmrsa: Mark deprecated for 14. This is the only in-tree driver for the asymmetric crypto support in OCF that is already marked deprecated for 14. MFC after: 3 days Sponsored by: Chelsio Communications --- sys/mips/nlm/dev/sec/nlmrsa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/mips/nlm/dev/sec/nlmrsa.c b/sys/mips/nlm/dev/sec/nlmrsa.c index 3252ecbed9c9..42b904d22a64 100644 --- a/sys/mips/nlm/dev/sec/nlmrsa.c +++ b/sys/mips/nlm/dev/sec/nlmrsa.c @@ -296,6 +296,7 @@ xlp_rsa_attach(device_t dev) if (xlp_rsa_init(sc, node) != 0) goto error_exit; device_printf(dev, "RSA Initialization complete!\n"); + gone_in_dev(dev, 14, "Asymmetric crypto"); return (0); error_exit: From owner-dev-commits-src-main@freebsd.org Wed Mar 17 11:09:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDC715AA708; Wed, 17 Mar 2021 11:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0nTn6RHXz3Lrh; Wed, 17 Mar 2021 11:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF8DF58C3; Wed, 17 Mar 2021 11:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HB91Mq049483; Wed, 17 Mar 2021 11:09:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HB91Sb049482; Wed, 17 Mar 2021 11:09:01 GMT (envelope-from git) Date: Wed, 17 Mar 2021 11:09:01 GMT Message-Id: <202103171109.12HB91Sb049482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: c96151d33509 - main - Implement sndstat nvlist-based enumeration ioctls. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c96151d33509655efb7fb26768cb56a041c176f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 11:09:02 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=c96151d33509655efb7fb26768cb56a041c176f1 commit c96151d33509655efb7fb26768cb56a041c176f1 Author: Ka Ho Ng AuthorDate: 2021-03-17 10:51:58 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-17 11:05:43 +0000 Implement sndstat nvlist-based enumeration ioctls. These ioctl commands aim to provide easier ways for user space applications to enumerate existing audio devices and the node they can potentially use. The exchange of device lists between user space and kernel is done on nv(9). Some ioctl commands are added to /dev/sndstat node: - SNDSTAT_REFRESH_DEVS - SNDSTAT_GET_DEVS - SNDSTAT_ADD_USER_DEVS - SNDSTAT_FLUSH_USER_DEVS Bump __FreeBSD_version to reflect the addition of the ioctls. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D26884 --- share/man/man4/Makefile | 1 + share/man/man4/sndstat.4 | 259 ++++++++++++++++ sys/dev/sound/pcm/sndstat.c | 738 +++++++++++++++++++++++++++++++++++++++++++- sys/dev/sound/pcm/sound.h | 1 + sys/sys/param.h | 2 +- sys/sys/sndstat.h | 95 ++++++ 6 files changed, 1086 insertions(+), 10 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 686e86cf6897..54fd89fe7590 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -526,6 +526,7 @@ MAN= aac.4 \ snd_via8233.4 \ snd_via82c686.4 \ snd_vibes.4 \ + sndstat.4 \ snp.4 \ spigen.4 \ ${_spkr.4} \ diff --git a/share/man/man4/sndstat.4 b/share/man/man4/sndstat.4 new file mode 100644 index 000000000000..ad5f4a76ea7e --- /dev/null +++ b/share/man/man4/sndstat.4 @@ -0,0 +1,259 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" This software was developed by Ka Ho Ng +.\" under sponsorship from the FreeBSD Foundation. +.\" +.\" Copyright (c) 2020 The FreeBSD Foundation +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.\" Note: The date here should be updated whenever a non-trivial +.\" change is made to the manual page. +.Dd December 7, 2020 +.Dt SNDSTAT 4 +.Os +.Sh NAME +.Nm sndstat +.Nd "nvlist-based PCM audio device enumeration interface" +.Sh SYNOPSIS +To compile the driver into the kernel, +place the following lines in the +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device sound" +.Ed +.Sh DESCRIPTION +The ioctl interface provided by +.Pa /dev/sndstat +device allows callers to enumeration PCM audio devices available for use. +.Sh IOCTLS +For all ioctls requiring data exchange between the subsystem and callers, +the following structures are used to describe a serialized nvlist: +.Bd -literal -offset indent +struct sndstat_nvlbuf_arg { + size_t nbytes; + void *buf; +}; +.Ed +.Pp +Here is an example of an nvlist, with explanations of the common fields: +.Bd -literal -offset indent +dsps (NVLIST ARRAY): 1 + from_user (BOOL): FALSE + nameunit (STRING): [pcm0] + devnode (STRING): [dsp0] + desc (STRING): [Generic (0x8086) (Analog Line-out)] + pchan (NUMBER): 1 (1) (0x1) + rchan (NUMBER): 0 (0) (0x0) + pminrate (NUMBER): 48000 (48000) (0xbb80) + pmaxrate (NUMBER): 48000 (48000) (0xbb80) + pfmts (NUMBER): 2097168 (2097168) (0x200010) + provider_info (NVLIST): + unit (NUMBER): 0 (0) (0x0) + bitperfect (BOOL): FALSE + pvchan (NUMBER): 1 (1) (0x1) + rvchan (NUMBER): 0 (0) (0x0) + provider (STRING): [sound(4)] + , +.Ed +.Bl -tag -width ".Dv provider_info" +.It Dv from_user +Whether the PCM audio device node is created by in-kernel audio subsystem or +userspace providers. +.It Dv nameunit +The device identification in the form of subsystem plus a unit number. +.It Dv devnode +The PCM audio device node relative path in devfs. +.It Dv desc +The descripton of the PCM audio device. +.It Dv pchan +The number of playback channels supported by hardware. +This can be 0 if this PCM audio device does not support playback at all. +.It Dv rchan +The number of recording channels supported by hardware. +This can be 0 if this PCM audio device does not support recording at all. +.It Dv pminrate +The minimum supported playback direction sampling rate. +Only exists if pchan is greater than 0. +.It Dv pmaxrate +The maximum supported playback direction sampling rate. +Only exists if pchan is greater than 0. +.It Dv pfmts +The supported playback direction sample format. +Only exists if pchan is greater than 0. +.It Dv rminrate +The minimum supported recording direction sampling rate. +Only exists if rchan is greater than 0. +.It Dv rmaxrate +The maximum supported recording direction sampling rate. +Only exists if rchan is greater than 0. +.It Dv rfmts +The supported playback recording sample format. +Only exists if rchan is greater than 0. +.It Dv provider_info +Provider-specific fields. +This field may not exist if the PCM audio device is not provided by in-kernel +interface. +This field will not exist if the provider field is an empty string. +.It Dv provider +A string specifying the provider of the PCm audio device. +.El +.Pp +The following ioctls are providede for use: +.Bl -tag -width ".Dv SNDSTAT_FLUSH_USER_DEVS" +.It Dv SNDSTAT_REFRESH_DEVS +Drop any previously fetched PCM audio devices list snapshots. +This ioctl takes no arguments. +.It Dv SNDSTAT_GET_DEVS +Generate and/or return PCM audio devices list snapshots to callers. +This ioctl takes a pointer to +.Fa struct sndstat_nvlbuf_arg +as the first and the only argument. +Callers need to provide a sufficiently large buffer to hold a serialized +nvlist. +If there is no existing PCM audio device list snapshot available in the +internal structure of the opened sndstat. +.Fa fd , +a new PCM audio device list snapshot will be automatically generated. +Callers have to set +.Fa nbytes +to either 0 or the size of buffer provided. +In case +.Fa nbytes +is 0, the buffer size required to hold a serialized nvlist +stream of current snapshot will be returned in +.Fa nbytes , +and +.Fa buf +will be ignored. +Otherwise, if the buffer is not sufficiently large, +the ioctl returns success, and +.Fa nbytes +will be set to 0. +If the buffer provided is sufficiently large, +.Fa nbytes +will be set to the size of the serialized nvlist written to the provided buffer. +Once a PCM audio device list snapshot is returned to user-space successfully, +the snapshot stored in the subsystem's internal structure of the given +.Fa fd +will be freed. +.It Dv SNDSTAT_ADD_USER_DEVS +Add a list of PCM audio devices provided by callers to +.Pa /dev/sndstat +device. +This ioctl takes a pointer to +.Fa struct sndstat_nvlbuf_arg +as the first and the only argument. +Callers have to provide a buffer holding a serialized nvlist. +.Fa nbytes +should be set to the length in bytes of the serialized nvlist. +.Fa buf +should be pointed to a buffer storing the serialized nvlist. +Userspace-backed PCM audio device nodes should be listed inside the serialized +nvlist. +.It Dv SNDSTAT_FLUSH_USER_DEVS +Flush any PCM audio devices previously added by callers. +This ioctl takes no arguments. +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/sndstat" -compact +.It Pa /dev/sndstat +.El +.Sh EXAMPLES +The following code enumerates all available PCM audio devices: +.Bd -literal -offset indent +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int +main() +{ + int fd; + struct sndstat_nvlbuf_arg arg; + const nvlist_t * const *di; + size_t i, nitems; + nvlist_t *nvl; + + /* Open sndstat node in read-only first */ + fd = open("/dev/sndstat", O_RDONLY); + + if (ioctl(fd, SNDSTAT_REFRESH_DEVS, NULL)) + err(1, "ioctl(fd, SNDSTAT_REFRESH_DEVS, NULL)"); + + /* Get the size of snapshot, when nbytes = 0 */ + arg.nbytes = 0; + arg.buf = NULL; + if (ioctl(fd, SNDSTAT_GET_DEVS, &arg)) + err(1, "ioctl(fd, SNDSTAT_GET_DEVS, &arg)"); + + /* Get snapshot data */ + arg.buf = malloc(arg.nbytes); + if (arg.buf == NULL) + err(EX_OSERR, "malloc"); + if (ioctl(fd, SNDSTAT_GET_DEVS, &arg)) + err(1, "ioctl(fd, SNDSTAT_GET_DEVS, &arg)"); + + /* Deserialize the nvlist stream */ + nvl = nvlist_unpack(arg.buf, arg.nbytes, 0); + free(arg.buf); + + /* Get DSPs array */ + di = nvlist_get_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, &nitems); + for (i = 0; i < nitems; i++) { + const char *nameunit, *devnode, *desc; + + /* + * Examine each device nvlist item + */ + + nameunit = nvlist_get_string(di[i], SNDSTAT_LABEL_NAMEUNIT); + devnode = nvlist_get_string(di[i], SNDSTAT_LABEL_DEVNODE); + desc = nvlist_get_string(di[i], SNDSTAT_LABEL_DESC); + printf("Name unit: `%s`, Device node: `%s`, Description: `%s`\n", + nameunit, devnode, desc); + } + + nvlist_destroy(nvl); + return (0); +} +.Ed +.Sh SEE ALSO +.Xr sound 4 , +.Xr nv 9 +.Sh HISTORY +The nvlist-based ioctls support for +.Nm +device first appeared in +.Fx 13.0 . +.Sh AUTHORS +This manual page was written by +.An Ka Ho Ng Aq Mt khng@FreeBSD.org . diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 31c4a1b14a79..e89af772fe72 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -3,8 +3,12 @@ * * Copyright (c) 2005-2009 Ariff Abdullah * Copyright (c) 2001 Cameron Grant + * Copyright (c) 2020 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Ka Ho Ng + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -31,10 +35,20 @@ #include "opt_snd.h" #endif +#include +#include +#include +#include +#include +#include +#ifdef COMPAT_FREEBSD32 +#include +#endif + #include #include #include -#include + SND_DECLARE_FILE("$FreeBSD$"); @@ -47,12 +61,14 @@ static d_open_t sndstat_open; static void sndstat_close(void *); static d_read_t sndstat_read; static d_write_t sndstat_write; +static d_ioctl_t sndstat_ioctl; static struct cdevsw sndstat_cdevsw = { .d_version = D_VERSION, .d_open = sndstat_open, .d_read = sndstat_read, .d_write = sndstat_write, + .d_ioctl = sndstat_ioctl, .d_name = "sndstat", .d_flags = D_TRACKCLOSE, }; @@ -65,11 +81,33 @@ struct sndstat_entry { int type, unit; }; +struct sndstat_userdev { + TAILQ_ENTRY(sndstat_userdev) link; + char *provider; + char *nameunit; + char *devnode; + char *desc; + unsigned int pchan; + unsigned int rchan; + uint32_t pminrate; + uint32_t pmaxrate; + uint32_t rminrate; + uint32_t rmaxrate; + uint32_t pfmts; + uint32_t rfmts; + nvlist_t *provider_nvl; +}; + struct sndstat_file { TAILQ_ENTRY(sndstat_file) entry; struct sbuf sbuf; + struct sx lock; + void *devs_nvlbuf; /* (l) */ + size_t devs_nbytes; /* (l) */ + TAILQ_HEAD(, sndstat_userdev) userdev_list; /* (l) */ int out_offset; int in_offset; + int fflags; }; static struct sx sndstat_lock; @@ -84,6 +122,8 @@ static TAILQ_HEAD(, sndstat_file) sndstat_filelist = TAILQ_HEAD_INITIALIZER(snds int snd_verbose = 0; static int sndstat_prepare(struct sndstat_file *); +static struct sndstat_userdev * +sndstat_line2userdev(struct sndstat_file *, const char *, int); static int sysctl_hw_sndverbose(SYSCTL_HANDLER_ARGS) @@ -112,12 +152,16 @@ sndstat_open(struct cdev *i_dev, int flags, int mode, struct thread *td) pf = malloc(sizeof(*pf), M_DEVBUF, M_WAITOK | M_ZERO); - SNDSTAT_LOCK(); if (sbuf_new(&pf->sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) { - SNDSTAT_UNLOCK(); free(pf, M_DEVBUF); return (ENOMEM); } + + pf->fflags = flags; + TAILQ_INIT(&pf->userdev_list); + sx_init(&pf->lock, "sndstat_file"); + + SNDSTAT_LOCK(); TAILQ_INSERT_TAIL(&sndstat_filelist, pf, entry); SNDSTAT_UNLOCK(); @@ -126,6 +170,29 @@ sndstat_open(struct cdev *i_dev, int flags, int mode, struct thread *td) return (0); } +/* + * Should only be called either when: + * * Closing + * * pf->lock held + */ +static void +sndstat_remove_all_userdevs(struct sndstat_file *pf) +{ + struct sndstat_userdev *ud; + + KASSERT( + sx_xlocked(&pf->lock), ("%s: Called without pf->lock", __func__)); + while ((ud = TAILQ_FIRST(&pf->userdev_list)) != NULL) { + TAILQ_REMOVE(&pf->userdev_list, ud, link); + free(ud->provider, M_DEVBUF); + free(ud->desc, M_DEVBUF); + free(ud->devnode, M_DEVBUF); + free(ud->nameunit, M_DEVBUF); + nvlist_destroy(ud->provider_nvl); + free(ud, M_DEVBUF); + } +} + static void sndstat_close(void *sndstat_file) { @@ -136,6 +203,12 @@ sndstat_close(void *sndstat_file) TAILQ_REMOVE(&sndstat_filelist, pf, entry); SNDSTAT_UNLOCK(); + free(pf->devs_nvlbuf, M_NVLIST); + sx_xlock(&pf->lock); + sndstat_remove_all_userdevs(pf); + sx_xunlock(&pf->lock); + sx_destroy(&pf->lock); + free(pf, M_DEVBUF); } @@ -203,7 +276,10 @@ sndstat_write(struct cdev *i_dev, struct uio *buf, int flag) err = EINVAL; } else { /* only remember the last write - allows for updates */ - sbuf_clear(&pf->sbuf); + sx_xlock(&pf->lock); + sndstat_remove_all_userdevs(pf); + sx_xunlock(&pf->lock); + while (1) { len = sizeof(temp); if (len > buf->uio_resid) @@ -221,15 +297,647 @@ sndstat_write(struct cdev *i_dev, struct uio *buf, int flag) } } sbuf_finish(&pf->sbuf); - if (err == 0) + + if (err == 0) { + char *line, *str; + + str = sbuf_data(&pf->sbuf); + while ((line = strsep(&str, "\n")) != NULL) { + struct sndstat_userdev *ud; + + ud = sndstat_line2userdev(pf, line, strlen(line)); + if (ud == NULL) + continue; + + sx_xlock(&pf->lock); + TAILQ_INSERT_TAIL(&pf->userdev_list, ud, link); + sx_xunlock(&pf->lock); + } + pf->out_offset = sbuf_len(&pf->sbuf); - else + } else pf->out_offset = 0; + + sbuf_clear(&pf->sbuf); + } + SNDSTAT_UNLOCK(); + return (err); +} + +static void +sndstat_get_caps(struct snddev_info *d, bool play, uint32_t *min_rate, + uint32_t *max_rate, uint32_t *fmts) +{ + struct pcm_channel *c; + int dir; + + dir = play ? PCMDIR_PLAY : PCMDIR_REC; + *min_rate = 0; + *max_rate = 0; + *fmts = 0; + + if (play && d->pvchancount > 0) { + *min_rate = *max_rate = d->pvchanrate; + *fmts = d->pvchanformat; + return; + } else if (!play && d->rvchancount > 0) { + *min_rate = *max_rate = d->rvchanrate; + *fmts = d->rvchanformat; + return; + } + + CHN_FOREACH(c, d, channels.pcm) { + struct pcmchan_caps *caps; + + if (c->direction != dir || (c->flags & CHN_F_VIRTUAL) != 0) + continue; + + CHN_LOCK(c); + caps = chn_getcaps(c); + *min_rate = caps->minspeed; + *max_rate = caps->maxspeed; + *fmts = chn_getformats(c); + CHN_UNLOCK(c); + } +} + +static int +sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip) +{ + uint32_t maxrate, minrate, fmts; + nvlist_t *di = NULL, *sound4di = NULL; + int err; + + di = nvlist_create(0); + if (di == NULL) { + err = ENOMEM; + goto done; + } + sound4di = nvlist_create(0); + if (sound4di == NULL) { + err = ENOMEM; + goto done; + } + + nvlist_add_bool(di, SNDSTAT_LABEL_FROM_USER, false); + nvlist_add_stringf(di, SNDSTAT_LABEL_NAMEUNIT, "%s", + device_get_nameunit(d->dev)); + nvlist_add_stringf(di, SNDSTAT_LABEL_DEVNODE, "dsp%d", + device_get_unit(d->dev)); + nvlist_add_string( + di, SNDSTAT_LABEL_DESC, device_get_desc(d->dev)); + + PCM_ACQUIRE_QUICK(d); + nvlist_add_number(di, SNDSTAT_LABEL_PCHAN, d->playcount); + nvlist_add_number(di, SNDSTAT_LABEL_RCHAN, d->reccount); + if (d->playcount > 0) { + sndstat_get_caps(d, true, &minrate, &maxrate, &fmts); + nvlist_add_number(di, SNDSTAT_LABEL_PMINRATE, minrate); + nvlist_add_number(di, SNDSTAT_LABEL_PMAXRATE, maxrate); + nvlist_add_number(di, SNDSTAT_LABEL_PFMTS, fmts); + } + if (d->reccount > 0) { + sndstat_get_caps(d, false, &minrate, &maxrate, &fmts); + nvlist_add_number(di, SNDSTAT_LABEL_RMINRATE, minrate); + nvlist_add_number(di, SNDSTAT_LABEL_RMAXRATE, maxrate); + nvlist_add_number(di, SNDSTAT_LABEL_RFMTS, fmts); + } + + nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_UNIT, + device_get_unit(d->dev)); // XXX: I want signed integer here + nvlist_add_bool( + sound4di, SNDSTAT_LABEL_SOUND4_BITPERFECT, d->flags & SD_F_BITPERFECT); + nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_PVCHAN, d->pvchancount); + nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_RVCHAN, d->rvchancount); + nvlist_move_nvlist(di, SNDSTAT_LABEL_PROVIDER_INFO, sound4di); + sound4di = NULL; + PCM_RELEASE_QUICK(d); + nvlist_add_string(di, SNDSTAT_LABEL_PROVIDER, SNDSTAT_LABEL_SOUND4_PROVIDER); + + err = nvlist_error(di); + if (err) + goto done; + + *dip = di; + +done: + if (err) { + nvlist_destroy(sound4di); + nvlist_destroy(di); + } + return (err); +} + +static int +sndstat_build_userland_nvlist(struct sndstat_userdev *ud, nvlist_t **dip) +{ + nvlist_t *di; + int err; + + di = nvlist_create(0); + if (di == NULL) { + err = ENOMEM; + goto done; + } + + nvlist_add_bool(di, SNDSTAT_LABEL_FROM_USER, true); + nvlist_add_number(di, SNDSTAT_LABEL_PCHAN, ud->pchan); + nvlist_add_number(di, SNDSTAT_LABEL_RCHAN, ud->rchan); + nvlist_add_string(di, SNDSTAT_LABEL_NAMEUNIT, ud->nameunit); + nvlist_add_string( + di, SNDSTAT_LABEL_DEVNODE, ud->devnode); + nvlist_add_string(di, SNDSTAT_LABEL_DESC, ud->desc); + if (ud->pchan != 0) { + nvlist_add_number( + di, SNDSTAT_LABEL_PMINRATE, ud->pminrate); + nvlist_add_number( + di, SNDSTAT_LABEL_PMAXRATE, ud->pmaxrate); + nvlist_add_number( + di, SNDSTAT_LABEL_PFMTS, ud->pfmts); + } + if (ud->rchan != 0) { + nvlist_add_number( + di, SNDSTAT_LABEL_RMINRATE, ud->rminrate); + nvlist_add_number( + di, SNDSTAT_LABEL_RMAXRATE, ud->rmaxrate); + nvlist_add_number( + di, SNDSTAT_LABEL_RFMTS, ud->rfmts); + } + nvlist_add_string(di, SNDSTAT_LABEL_PROVIDER, + (ud->provider != NULL) ? ud->provider : ""); + if (ud->provider_nvl != NULL) + nvlist_add_nvlist( + di, SNDSTAT_LABEL_PROVIDER_INFO, ud->provider_nvl); + + err = nvlist_error(di); + if (err) + goto done; + + *dip = di; + +done: + if (err) + nvlist_destroy(di); + return (err); +} + +/* + * Should only be called with the following locks held: + * * sndstat_lock + */ +static int +sndstat_create_devs_nvlist(nvlist_t **nvlp) +{ + int err; + nvlist_t *nvl; + struct sndstat_entry *ent; + struct sndstat_file *pf; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (ENOMEM); + + TAILQ_FOREACH(ent, &sndstat_devlist, link) { + struct snddev_info *d; + nvlist_t *di; + + if (ent->dev == NULL) + continue; + d = device_get_softc(ent->dev); + if (!PCM_REGISTERED(d)) + continue; + + err = sndstat_build_sound4_nvlist(d, &di); + if (err) + goto done; + + nvlist_append_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, di); + nvlist_destroy(di); + err = nvlist_error(nvl); + if (err) + goto done; + } + + TAILQ_FOREACH(pf, &sndstat_filelist, entry) { + struct sndstat_userdev *ud; + + sx_xlock(&pf->lock); + + TAILQ_FOREACH(ud, &pf->userdev_list, link) { + nvlist_t *di; + + err = sndstat_build_userland_nvlist(ud, &di); + if (err != 0) { + sx_xunlock(&pf->lock); + goto done; + } + nvlist_append_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, di); + nvlist_destroy(di); + + err = nvlist_error(nvl); + if (err != 0) { + sx_xunlock(&pf->lock); + goto done; + } + } + + sx_xunlock(&pf->lock); + } + + *nvlp = nvl; + +done: + if (err != 0) + nvlist_destroy(nvl); + return (err); +} + +static int +sndstat_refresh_devs(struct sndstat_file *pf) +{ + sx_xlock(&pf->lock); + free(pf->devs_nvlbuf, M_NVLIST); + pf->devs_nvlbuf = NULL; + pf->devs_nbytes = 0; + sx_unlock(&pf->lock); + + return (0); +} + +static int +sndstat_get_devs(struct sndstat_file *pf, caddr_t data) +{ + int err; + struct sndstat_nvlbuf_arg *arg = (struct sndstat_nvlbuf_arg *)data; + + SNDSTAT_LOCK(); + sx_xlock(&pf->lock); + + if (pf->devs_nvlbuf == NULL) { + nvlist_t *nvl; + void *nvlbuf; + size_t nbytes; + int err; + + sx_xunlock(&pf->lock); + + err = sndstat_create_devs_nvlist(&nvl); + if (err) { + SNDSTAT_UNLOCK(); + return (err); + } + + sx_xlock(&pf->lock); + + nvlbuf = nvlist_pack(nvl, &nbytes); + err = nvlist_error(nvl); + nvlist_destroy(nvl); + if (nvlbuf == NULL || err != 0) { + SNDSTAT_UNLOCK(); + sx_xunlock(&pf->lock); + if (err == 0) + return (ENOMEM); + return (err); + } + + free(pf->devs_nvlbuf, M_NVLIST); + pf->devs_nvlbuf = nvlbuf; + pf->devs_nbytes = nbytes; } + SNDSTAT_UNLOCK(); + + if (!arg->nbytes) { + arg->nbytes = pf->devs_nbytes; + err = 0; + goto done; + } + if (arg->nbytes < pf->devs_nbytes) { + arg->nbytes = 0; + err = 0; + goto done; + } + + err = copyout(pf->devs_nvlbuf, arg->buf, pf->devs_nbytes); + if (err) + goto done; + + arg->nbytes = pf->devs_nbytes; + + free(pf->devs_nvlbuf, M_NVLIST); + pf->devs_nvlbuf = NULL; + pf->devs_nbytes = 0; + +done: + sx_unlock(&pf->lock); return (err); } +static int +sndstat_unpack_user_nvlbuf(const void *unvlbuf, size_t nbytes, nvlist_t **nvl) +{ + void *nvlbuf; + int err; + + nvlbuf = malloc(nbytes, M_DEVBUF, M_WAITOK); + err = copyin(unvlbuf, nvlbuf, nbytes); + if (err != 0) { + free(nvlbuf, M_DEVBUF); + return (err); + } + *nvl = nvlist_unpack(nvlbuf, nbytes, 0); + free(nvlbuf, M_DEVBUF); + if (nvl == NULL) { + return (EINVAL); + } + + return (0); +} + +static bool +sndstat_dsp_nvlist_is_sane(const nvlist_t *nvlist) +{ + if (!(nvlist_exists_string(nvlist, SNDSTAT_LABEL_DEVNODE) && + nvlist_exists_string(nvlist, SNDSTAT_LABEL_DESC) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_PCHAN) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_RCHAN))) + return (false); + + if (nvlist_get_number(nvlist, SNDSTAT_LABEL_PCHAN) > 0) + if (!(nvlist_exists_number(nvlist, SNDSTAT_LABEL_PMINRATE) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_PMAXRATE) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_PFMTS))) + return (false); + + if (nvlist_get_number(nvlist, SNDSTAT_LABEL_RCHAN) > 0) + if (!(nvlist_exists_number(nvlist, SNDSTAT_LABEL_RMINRATE) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_RMAXRATE) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_RFMTS))) + return (false); + + return (true); + +} + +static int +sndstat_dsp_unpack_nvlist(const nvlist_t *nvlist, struct sndstat_userdev *ud) +{ + const char *nameunit, *devnode, *desc; + unsigned int pchan, rchan; + uint32_t pminrate = 0, pmaxrate = 0; + uint32_t rminrate = 0, rmaxrate = 0; + uint32_t pfmts = 0, rfmts = 0; + nvlist_t *provider_nvl = NULL; + const char *provider; + + devnode = nvlist_get_string(nvlist, SNDSTAT_LABEL_DEVNODE); + if (nvlist_exists_string(nvlist, SNDSTAT_LABEL_NAMEUNIT)) + nameunit = nvlist_get_string(nvlist, SNDSTAT_LABEL_NAMEUNIT); + else + nameunit = devnode; + desc = nvlist_get_string(nvlist, SNDSTAT_LABEL_DESC); + pchan = nvlist_get_number(nvlist, SNDSTAT_LABEL_PCHAN); + rchan = nvlist_get_number(nvlist, SNDSTAT_LABEL_RCHAN); + if (pchan != 0) { + pminrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_PMINRATE); + pmaxrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_PMAXRATE); + pfmts = nvlist_get_number(nvlist, SNDSTAT_LABEL_PFMTS); + } + if (rchan != 0) { + rminrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_RMINRATE); + rmaxrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_RMAXRATE); + rfmts = nvlist_get_number(nvlist, SNDSTAT_LABEL_RFMTS); + } + + provider = dnvlist_get_string(nvlist, SNDSTAT_LABEL_PROVIDER, ""); + if (provider[0] == '\0') + provider = NULL; + + if (provider != NULL && + nvlist_exists_nvlist(nvlist, SNDSTAT_LABEL_PROVIDER_INFO)) { + provider_nvl = nvlist_clone( + nvlist_get_nvlist(nvlist, SNDSTAT_LABEL_PROVIDER_INFO)); + if (provider_nvl == NULL) + return (ENOMEM); + } + + ud->provider = (provider != NULL) ? strdup(provider, M_DEVBUF) : NULL; + ud->devnode = strdup(devnode, M_DEVBUF); + ud->nameunit = strdup(nameunit, M_DEVBUF); + ud->desc = strdup(desc, M_DEVBUF); + ud->pchan = pchan; + ud->rchan = rchan; + ud->pminrate = pminrate; + ud->pmaxrate = pmaxrate; + ud->rminrate = rminrate; + ud->rmaxrate = rmaxrate; + ud->pfmts = pfmts; + ud->rfmts = rfmts; + ud->provider_nvl = provider_nvl; + return (0); +} + +static int +sndstat_add_user_devs(struct sndstat_file *pf, caddr_t data) +{ + int err; + nvlist_t *nvl = NULL; + const nvlist_t * const *dsps; + size_t i, ndsps; + struct sndstat_nvlbuf_arg *arg = (struct sndstat_nvlbuf_arg *)data; + + if ((pf->fflags & FWRITE) == 0) { + err = EPERM; + goto done; + } + + err = sndstat_unpack_user_nvlbuf(arg->buf, arg->nbytes, &nvl); + if (err != 0) + goto done; + + if (!nvlist_exists_nvlist_array(nvl, SNDSTAT_LABEL_DSPS)) { + err = EINVAL; + goto done; + } + dsps = nvlist_get_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, &ndsps); + for (i = 0; i < ndsps; i++) { + if (!sndstat_dsp_nvlist_is_sane(dsps[i])) { + err = EINVAL; + goto done; + } + } + sx_xlock(&pf->lock); + for (i = 0; i < ndsps; i++) { + struct sndstat_userdev *ud = + malloc(sizeof(*ud), M_DEVBUF, M_WAITOK); + err = sndstat_dsp_unpack_nvlist(dsps[i], ud); + if (err) { + sx_unlock(&pf->lock); + goto done; + } + TAILQ_INSERT_TAIL(&pf->userdev_list, ud, link); + } + sx_unlock(&pf->lock); + +done: + nvlist_destroy(nvl); + return (err); +} + +static int +sndstat_flush_user_devs(struct sndstat_file *pf) +{ + if ((pf->fflags & FWRITE) == 0) + return (EPERM); + + sx_xlock(&pf->lock); + sndstat_remove_all_userdevs(pf); *** 305 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Mar 17 12:50:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 160D75ADBF1; Wed, 17 Mar 2021 12:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0qkl05HZz3k9d; Wed, 17 Mar 2021 12:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA66E711F; Wed, 17 Mar 2021 12:50:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HCoM0C088120; Wed, 17 Mar 2021 12:50:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HCoMaD088119; Wed, 17 Mar 2021 12:50:22 GMT (envelope-from git) Date: Wed, 17 Mar 2021 12:50:22 GMT Message-Id: <202103171250.12HCoMaD088119@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 1acf24a044aa - main - Implement pci_get_relaxed_ordering_enabled() helper function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1acf24a044aaa0391c61af4abe7e018c3bf8a37c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 12:50:23 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1acf24a044aaa0391c61af4abe7e018c3bf8a37c commit 1acf24a044aaa0391c61af4abe7e018c3bf8a37c Author: Hans Petter Selasky AuthorDate: 2021-03-16 15:06:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-17 12:48:04 +0000 Implement pci_get_relaxed_ordering_enabled() helper function. Discussed with: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/pci/pci.c | 15 +++++++++++++++ sys/dev/pci/pcivar.h | 1 + 2 files changed, 16 insertions(+) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 1ca128a48ad0..d85ce5baa7bc 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -2182,6 +2182,21 @@ pci_ht_map_msi(device_t dev, uint64_t addr) } } +int +pci_get_relaxed_ordering_enabled(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + int cap; + uint16_t val; + + cap = dinfo->cfg.pcie.pcie_location; + if (cap == 0) + return (0); + val = pci_read_config(dev, cap + PCIER_DEVICE_CTL, 2); + val &= PCIEM_CTL_RELAXED_ORD_ENABLE; + return (val != 0); +} + int pci_get_max_payload(device_t dev) { diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index 0f04ca8f623c..74aa704635f7 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -677,6 +677,7 @@ int pci_msix_device_blacklisted(device_t dev); void pci_ht_map_msi(device_t dev, uint64_t addr); device_t pci_find_pcie_root_port(device_t dev); +int pci_get_relaxed_ordering_enabled(device_t dev); int pci_get_max_payload(device_t dev); int pci_get_max_read_req(device_t dev); void pci_restore_state(device_t dev); From owner-dev-commits-src-main@freebsd.org Wed Mar 17 13:08:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F0CC5AE738; Wed, 17 Mar 2021 13:08:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0r7742TQz3llX; Wed, 17 Mar 2021 13:08:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D4E071E2; Wed, 17 Mar 2021 13:08:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HD83c5007706; Wed, 17 Mar 2021 13:08:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HD83S0007705; Wed, 17 Mar 2021 13:08:03 GMT (envelope-from git) Date: Wed, 17 Mar 2021 13:08:03 GMT Message-Id: <202103171308.12HD83S0007705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: eeb26cf52c4c - main - wpa: import fix for P2P provision discovery processing vulnerability MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eeb26cf52c4c51e1571253d57684c442aa79a98d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 13:08:03 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=eeb26cf52c4c51e1571253d57684c442aa79a98d commit eeb26cf52c4c51e1571253d57684c442aa79a98d Author: Cy Schubert AuthorDate: 2021-03-17 00:06:17 +0000 Commit: Cy Schubert CommitDate: 2021-03-17 13:06:55 +0000 wpa: import fix for P2P provision discovery processing vulnerability Latest version available from: https://w1.fi/security/2021-1/ Vulnerability A vulnerability was discovered in how wpa_supplicant processes P2P (Wi-Fi Direct) provision discovery requests. Under a corner case condition, an invalid Provision Discovery Request frame could end up reaching a state where the oldest peer entry needs to be removed. With a suitably constructed invalid frame, this could result in use (read+write) of freed memory. This can result in an attacker within radio range of the device running P2P discovery being able to cause unexpected behavior, including termination of the wpa_supplicant process and potentially code execution. Vulnerable versions/configurations wpa_supplicant v1.0-v2.9 with CONFIG_P2P build option enabled An attacker (or a system controlled by the attacker) needs to be within radio range of the vulnerable system to send a set of suitably constructed management frames that trigger the corner case to be reached in the management of the P2P peer table. Note: FreeBSD base does not enable P2P. --- contrib/wpa/src/p2p/p2p_pd.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/contrib/wpa/src/p2p/p2p_pd.c b/contrib/wpa/src/p2p/p2p_pd.c index 3994ec03f86b..05fd593494ef 100644 --- a/contrib/wpa/src/p2p/p2p_pd.c +++ b/contrib/wpa/src/p2p/p2p_pd.c @@ -595,14 +595,12 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa, goto out; } + dev = p2p_get_device(p2p, sa); if (!dev) { - dev = p2p_get_device(p2p, sa); - if (!dev) { - p2p_dbg(p2p, - "Provision Discovery device not found " - MACSTR, MAC2STR(sa)); - goto out; - } + p2p_dbg(p2p, + "Provision Discovery device not found " + MACSTR, MAC2STR(sa)); + goto out; } } else if (msg.wfd_subelems) { wpabuf_free(dev->info.wfd_subelems); From owner-dev-commits-src-main@freebsd.org Wed Mar 17 14:02:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5448C56923E; Wed, 17 Mar 2021 14:02:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0sL31tj1z3rt2; Wed, 17 Mar 2021 14:02:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33A0B10312; Wed, 17 Mar 2021 14:02:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HE2Zi7085450; Wed, 17 Mar 2021 14:02:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE2Zqs085449; Wed, 17 Mar 2021 14:02:35 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:02:35 GMT Message-Id: <202103171402.12HE2Zqs085449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 5bffdafd6c5f - main - Remove tmpfs size and properly format generated fstab for arm MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bffdafd6c5f2a8279a57172ab760ea66ed3d7d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:02:35 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5bffdafd6c5f2a8279a57172ab760ea66ed3d7d5 commit 5bffdafd6c5f2a8279a57172ab760ea66ed3d7d5 Author: Daniel Engerg AuthorDate: 2021-03-17 14:00:57 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-17 14:02:05 +0000 Remove tmpfs size and properly format generated fstab for arm Remove tmpfs size limitation, this breaks make installworld and installation of some packages Format generated fstab using tabs to make it consistent and readable MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29283 --- release/tools/arm.subr | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/release/tools/arm.subr b/release/tools/arm.subr index 2f91490c0859..811d6ddb402d 100644 --- a/release/tools/arm.subr +++ b/release/tools/arm.subr @@ -197,18 +197,18 @@ arm_install_base() { echo '# Custom /etc/fstab for FreeBSD embedded images' \ > ${CHROOTDIR}/${DESTDIR}/etc/fstab if [ "${PART_SCHEME}" == "GPT" ]; then - echo "/dev/ufs/rootfs / ufs rw 1 1" \ + echo "/dev/ufs/rootfs / ufs rw 1 1" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab - echo "/dev/msdosfs/EFI /boot/efi msdosfs rw,noatime 0 0" \ + echo "/dev/msdosfs/EFI /boot/efi msdosfs rw,noatime 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab fi if [ "${PART_SCHEME}" == "MBR" ]; then - echo "/dev/ufs/rootfs / ufs rw 1 1" \ + echo "/dev/ufs/rootfs / ufs rw 1 1" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab - echo "/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0" \ + echo "/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab fi - echo "tmpfs /tmp tmpfs rw,mode=1777,size=50m 0 0" \ + echo "tmpfs /tmp tmpfs rw,mode=1777 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab local hostname From owner-dev-commits-src-main@freebsd.org Wed Mar 17 14:15:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 653FF56A345; Wed, 17 Mar 2021 14:15:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0sd22Ndvz3vYD; Wed, 17 Mar 2021 14:15:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 445D3103F8; Wed, 17 Mar 2021 14:15:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HEFY9v099754; Wed, 17 Mar 2021 14:15:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HEFYAh099753; Wed, 17 Mar 2021 14:15:34 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:15:34 GMT Message-Id: <202103171415.12HEFYAh099753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f187d6dfbf63 - main - base: remove if_wg(4) and associated utilities, manpage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f187d6dfbf633665ba6740fe22742aec60ce02a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:15:34 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f187d6dfbf633665ba6740fe22742aec60ce02a2 commit f187d6dfbf633665ba6740fe22742aec60ce02a2 Author: Kyle Evans AuthorDate: 2021-03-16 02:38:23 +0000 Commit: Kyle Evans CommitDate: 2021-03-17 14:14:48 +0000 base: remove if_wg(4) and associated utilities, manpage After length decisions, we've decided that the if_wg(4) driver and related work is not yet ready to live in the tree. This driver has larger security implications than many, and thus will be held to more scrutiny than other drivers. Please also see the related message sent to the freebsd-hackers@ and freebsd-arch@ lists by Kyle Evans on 2021/03/16, with the subject line "Removing WireGuard Support From Base" for additional context. --- etc/mtree/BSD.include.dist | 2 - include/Makefile | 9 +- sbin/ifconfig/Makefile | 1 - sbin/ifconfig/ifwg.c | 731 --------- share/man/man4/Makefile | 2 - share/man/man4/wg.4 | 259 --- sys/dev/if_wg/crypto.c | 1705 ------------------- sys/dev/if_wg/crypto.h | 114 -- sys/dev/if_wg/if_wg.c | 3462 --------------------------------------- sys/dev/if_wg/if_wg.h | 36 - sys/dev/if_wg/support.h | 56 - sys/dev/if_wg/wg_cookie.c | 438 ----- sys/dev/if_wg/wg_cookie.h | 125 -- sys/dev/if_wg/wg_noise.c | 963 ----------- sys/dev/if_wg/wg_noise.h | 191 --- sys/kern/kern_jail.c | 1 - sys/kern/uipc_socket.c | 11 - sys/kern/uipc_syscalls.c | 4 +- sys/modules/Makefile | 1 - sys/modules/if_wg/Makefile | 12 - sys/net/if_types.h | 1 - sys/netinet6/nd6.c | 4 +- sys/sys/priv.h | 1 - sys/sys/socketvar.h | 1 - tests/sys/netinet/Makefile | 10 +- tests/sys/netinet/if_wg_test.sh | 188 --- 26 files changed, 8 insertions(+), 8320 deletions(-) diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index 0f85798815d5..e7784cbb0a47 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -64,8 +64,6 @@ .. iicbus .. - if_wg - .. io .. mfi diff --git a/include/Makefile b/include/Makefile index d47879e11c93..eebc7f0e121f 100644 --- a/include/Makefile +++ b/include/Makefile @@ -43,7 +43,7 @@ LDIRS= geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ @@ -220,10 +220,6 @@ NVPAIRDIR= ${INCLUDEDIR}/sys MLX5= mlx5io.h MLX5DIR= ${INCLUDEDIR}/dev/mlx5 -.PATH: ${SRCTOP}/sys/dev/if_wg -WG= if_wg.h -WGDIR= ${INCLUDEDIR}/dev/if_wg - INCSGROUPS= INCS \ ACPICA \ AGP \ @@ -241,8 +237,7 @@ INCSGROUPS= INCS \ PCI \ RPC \ TEKEN \ - VERIEXEC \ - WG + VERIEXEC .if ${MK_AUDIT} != "no" INCSGROUPS+= BSM diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index 61cb8ab933fd..b178dc0c7e6a 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -35,7 +35,6 @@ SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifipsec.c # IPsec VTI -SRCS+= ifwg.c # Wireguard SRCS+= sfp.c # SFP/SFP+ information LIBADD+= ifconfig m util diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c deleted file mode 100644 index a102f392cf80..000000000000 --- a/sbin/ifconfig/ifwg.c +++ /dev/null @@ -1,731 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 Rubicon Communications, LLC (Netgate) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#ifndef RESCUE -#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 /* NB: for offsetof */ -#include -#include -#include - -#include "ifconfig.h" - -static void wgfinish(int s, void *arg); - -static bool wgfinish_registered; - -static int allowed_ips_count; -static int allowed_ips_max; -static nvlist_t **allowed_ips, *nvl_peer; - -#define ALLOWEDIPS_START 16 -#define WG_KEY_SIZE_BASE64 ((((WG_KEY_SIZE) + 2) / 3) * 4 + 1) -#define WG_KEY_SIZE_HEX (WG_KEY_SIZE * 2 + 1) -#define WG_MAX_STRLEN 64 - -struct allowedip { - union { - struct in_addr ip4; - struct in6_addr ip6; - }; -}; - -static void -register_wgfinish(void) -{ - - if (wgfinish_registered) - return; - callback_register(wgfinish, NULL); - wgfinish_registered = true; -} - -static nvlist_t * -nvl_device(void) -{ - static nvlist_t *_nvl_device; - - if (_nvl_device == NULL) - _nvl_device = nvlist_create(0); - register_wgfinish(); - return (_nvl_device); -} - -static bool -key_from_base64(uint8_t key[static WG_KEY_SIZE], const char *base64) -{ - - if (strlen(base64) != WG_KEY_SIZE_BASE64 - 1) { - warnx("bad key len - need %d got %zu\n", WG_KEY_SIZE_BASE64 - 1, strlen(base64)); - return false; - } - if (base64[WG_KEY_SIZE_BASE64 - 2] != '=') { - warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_SIZE_BASE64 - 2]); - return false; - } - return (b64_pton(base64, key, WG_KEY_SIZE)); -} - -static void -parse_endpoint(const char *endpoint_) -{ - int err; - char *base, *endpoint, *port, *colon, *tmp; - struct addrinfo hints, *res; - - endpoint = base = strdup(endpoint_); - colon = rindex(endpoint, ':'); - if (colon == NULL) - errx(1, "bad endpoint format %s - no port delimiter found", endpoint); - *colon = '\0'; - port = colon + 1; - - /* [::]:<> */ - if (endpoint[0] == '[') { - endpoint++; - tmp = index(endpoint, ']'); - if (tmp == NULL) - errx(1, "bad endpoint format %s - '[' found with no matching ']'", endpoint); - *tmp = '\0'; - } - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - err = getaddrinfo(endpoint, port, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - nvlist_add_binary(nvl_peer, "endpoint", res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); - free(base); -} - -static void -in_len2mask(struct in_addr *mask, u_int len) -{ - u_int i; - u_char *p; - - p = (u_char *)mask; - memset(mask, 0, sizeof(*mask)); - for (i = 0; i < len / NBBY; i++) - p[i] = 0xff; - if (len % NBBY) - p[i] = (0xff00 >> (len % NBBY)) & 0xff; -} - -static u_int -in_mask2len(struct in_addr *mask) -{ - u_int x, y; - u_char *p; - - p = (u_char *)mask; - for (x = 0; x < sizeof(*mask); x++) { - if (p[x] != 0xff) - break; - } - y = 0; - if (x < sizeof(*mask)) { - for (y = 0; y < NBBY; y++) { - if ((p[x] & (0x80 >> y)) == 0) - break; - } - } - return x * NBBY + y; -} - -static void -in6_prefixlen2mask(struct in6_addr *maskp, int len) -{ - static const u_char maskarray[NBBY] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; - int bytelen, bitlen, i; - - /* sanity check */ - if (len < 0 || len > 128) { - errx(1, "in6_prefixlen2mask: invalid prefix length(%d)\n", - len); - return; - } - - memset(maskp, 0, sizeof(*maskp)); - bytelen = len / NBBY; - bitlen = len % NBBY; - for (i = 0; i < bytelen; i++) - maskp->s6_addr[i] = 0xff; - if (bitlen) - maskp->s6_addr[bytelen] = maskarray[bitlen - 1]; -} - -static int -in6_mask2len(struct in6_addr *mask, u_char *lim0) -{ - int x = 0, y; - u_char *lim = lim0, *p; - - /* ignore the scope_id part */ - if (lim0 == NULL || lim0 - (u_char *)mask > sizeof(*mask)) - lim = (u_char *)mask + sizeof(*mask); - for (p = (u_char *)mask; p < lim; x++, p++) { - if (*p != 0xff) - break; - } - y = 0; - if (p < lim) { - for (y = 0; y < NBBY; y++) { - if ((*p & (0x80 >> y)) == 0) - break; - } - } - - /* - * when the limit pointer is given, do a stricter check on the - * remaining bits. - */ - if (p < lim) { - if (y != 0 && (*p & (0x00ff >> y)) != 0) - return -1; - for (p = p + 1; p < lim; p++) - if (*p != 0) - return -1; - } - - return x * NBBY + y; -} - -static bool -parse_ip(struct allowedip *aip, uint16_t *family, const char *value) -{ - struct addrinfo hints, *res; - int err; - bool ret; - - ret = true; - bzero(aip, sizeof(*aip)); - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(value, NULL, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - - *family = res->ai_family; - if (res->ai_family == AF_INET) { - struct sockaddr_in *sin = (struct sockaddr_in *)res->ai_addr; - - aip->ip4 = sin->sin_addr; - } else if (res->ai_family == AF_INET6) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)res->ai_addr; - - aip->ip6 = sin6->sin6_addr; - } else { - ret = false; - } - - freeaddrinfo(res); - return (ret); -} - -static void -sa_ntop(const struct sockaddr *sa, char *buf, int *port) -{ - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - int err; - - err = getnameinfo(sa, sa->sa_len, buf, INET6_ADDRSTRLEN, NULL, - 0, NI_NUMERICHOST); - - if (sa->sa_family == AF_INET) { - sin = (const struct sockaddr_in *)sa; - if (port) - *port = sin->sin_port; - } else if (sa->sa_family == AF_INET6) { - sin6 = (const struct sockaddr_in6 *)sa; - if (port) - *port = sin6->sin6_port; - } - - if (err) - errx(1, "%s", gai_strerror(err)); -} - -static void -dump_peer(const nvlist_t *nvl_peer_cfg) -{ - const void *key; - const struct sockaddr *endpoint; - char outbuf[WG_MAX_STRLEN]; - char addr_buf[INET6_ADDRSTRLEN]; - size_t aip_count, size; - int port; - uint16_t persistent_keepalive; - const nvlist_t * const *nvl_aips; - - printf("[Peer]\n"); - if (nvlist_exists_binary(nvl_peer_cfg, "public-key")) { - key = nvlist_get_binary(nvl_peer_cfg, "public-key", &size); - b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); - printf("PublicKey = %s\n", outbuf); - } - if (nvlist_exists_binary(nvl_peer_cfg, "preshared-key")) { - key = nvlist_get_binary(nvl_peer_cfg, "preshared-key", &size); - b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); - printf("PresharedKey = %s\n", outbuf); - } - if (nvlist_exists_binary(nvl_peer_cfg, "endpoint")) { - endpoint = nvlist_get_binary(nvl_peer_cfg, "endpoint", &size); - sa_ntop(endpoint, addr_buf, &port); - printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); - } - if (nvlist_exists_number(nvl_peer_cfg, - "persistent-keepalive-interval")) { - persistent_keepalive = nvlist_get_number(nvl_peer_cfg, - "persistent-keepalive-interval"); - printf("PersistentKeepalive = %d\n", persistent_keepalive); - } - if (!nvlist_exists_nvlist_array(nvl_peer_cfg, "allowed-ips")) - return; - - nvl_aips = nvlist_get_nvlist_array(nvl_peer_cfg, "allowed-ips", &aip_count); - if (nvl_aips == NULL || aip_count == 0) - return; - - printf("AllowedIPs = "); - for (size_t i = 0; i < aip_count; i++) { - uint8_t cidr; - struct sockaddr_storage ss; - sa_family_t family; - - if (!nvlist_exists_number(nvl_aips[i], "cidr")) - continue; - cidr = nvlist_get_number(nvl_aips[i], "cidr"); - if (nvlist_exists_binary(nvl_aips[i], "ipv4")) { - struct sockaddr_in *sin = (struct sockaddr_in *)&ss; - const struct in_addr *ip4; - - ip4 = nvlist_get_binary(nvl_aips[i], "ipv4", &size); - if (ip4 == NULL || cidr > 32) - continue; - sin->sin_len = sizeof(*sin); - sin->sin_family = AF_INET; - sin->sin_addr = *ip4; - } else if (nvlist_exists_binary(nvl_aips[i], "ipv6")) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&ss; - const struct in6_addr *ip6; - - ip6 = nvlist_get_binary(nvl_aips[i], "ipv6", &size); - if (ip6 == NULL || cidr > 128) - continue; - sin6->sin6_len = sizeof(*sin6); - sin6->sin6_family = AF_INET6; - sin6->sin6_addr = *ip6; - } else { - continue; - } - - family = ss.ss_family; - getnameinfo((struct sockaddr *)&ss, ss.ss_len, addr_buf, - INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); - printf("%s/%d", addr_buf, cidr); - if (i < aip_count - 1) - printf(", "); - } - printf("\n"); -} - -static int -get_nvl_out_size(int sock, u_long op, size_t *size) -{ - struct wg_data_io wgd; - int err; - - memset(&wgd, 0, sizeof(wgd)); - - strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); - wgd.wgd_size = 0; - wgd.wgd_data = NULL; - - err = ioctl(sock, op, &wgd); - if (err) - return (err); - *size = wgd.wgd_size; - return (0); -} - -static int -do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) -{ - struct wg_data_io wgd; - - memset(&wgd, 0, sizeof(wgd)); - - strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); - wgd.wgd_size = argsize; - wgd.wgd_data = arg; - - return (ioctl(sock, op, &wgd)); -} - -static -DECL_CMD_FUNC(peerlist, val, d) -{ - size_t size, peercount; - void *packed; - const nvlist_t *nvl; - const nvlist_t *const *nvl_peerlist; - - if (get_nvl_out_size(s, SIOCGWG, &size)) - errx(1, "can't get peer list size"); - if ((packed = malloc(size)) == NULL) - errx(1, "malloc failed for peer list"); - if (do_cmd(s, SIOCGWG, packed, size, 0)) - errx(1, "failed to obtain peer list"); - - nvl = nvlist_unpack(packed, size, 0); - if (!nvlist_exists_nvlist_array(nvl, "peers")) - return; - nvl_peerlist = nvlist_get_nvlist_array(nvl, "peers", &peercount); - - for (int i = 0; i < peercount; i++, nvl_peerlist++) { - dump_peer(*nvl_peerlist); - } -} - -static void -wgfinish(int s, void *arg) -{ - void *packed; - size_t size; - static nvlist_t *nvl_dev; - - nvl_dev = nvl_device(); - if (nvl_peer != NULL) { - if (!nvlist_exists_binary(nvl_peer, "public-key")) - errx(1, "must specify a public-key for adding peer"); - if (allowed_ips_count != 0) { - nvlist_add_nvlist_array(nvl_peer, "allowed-ips", - (const nvlist_t * const *)allowed_ips, - allowed_ips_count); - for (size_t i = 0; i < allowed_ips_count; i++) { - nvlist_destroy(allowed_ips[i]); - } - - free(allowed_ips); - } - - nvlist_add_nvlist_array(nvl_dev, "peers", - (const nvlist_t * const *)&nvl_peer, 1); - } - - packed = nvlist_pack(nvl_dev, &size); - - if (do_cmd(s, SIOCSWG, packed, size, true)) - errx(1, "failed to configure"); -} - -static -DECL_CMD_FUNC(peerstart, val, d) -{ - - if (nvl_peer != NULL) - errx(1, "cannot both add and remove a peer"); - register_wgfinish(); - nvl_peer = nvlist_create(0); - allowed_ips = calloc(ALLOWEDIPS_START, sizeof(*allowed_ips)); - allowed_ips_max = ALLOWEDIPS_START; - if (allowed_ips == NULL) - errx(1, "failed to allocate array for allowedips"); -} - -static -DECL_CMD_FUNC(peerdel, val, d) -{ - - if (nvl_peer != NULL) - errx(1, "cannot both add and remove a peer"); - register_wgfinish(); - nvl_peer = nvlist_create(0); - nvlist_add_bool(nvl_peer, "remove", true); -} - -static -DECL_CMD_FUNC(setwglistenport, val, d) -{ - struct addrinfo hints, *res; - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - - u_long ul; - int err; - - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(NULL, val, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - - if (res->ai_family == AF_INET) { - sin = (struct sockaddr_in *)res->ai_addr; - ul = sin->sin_port; - } else if (res->ai_family == AF_INET6) { - sin6 = (struct sockaddr_in6 *)res->ai_addr; - ul = sin6->sin6_port; - } else { - errx(1, "unknown family"); - } - ul = ntohs((u_short)ul); - nvlist_add_number(nvl_device(), "listen-port", ul); -} - -static -DECL_CMD_FUNC(setwgprivkey, val, d) -{ - uint8_t key[WG_KEY_SIZE]; - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_device(), "private-key", key, WG_KEY_SIZE); -} - -static -DECL_CMD_FUNC(setwgpubkey, val, d) -{ - uint8_t key[WG_KEY_SIZE]; - - if (nvl_peer == NULL) - errx(1, "setting public key only valid when adding peer"); - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_peer, "public-key", key, WG_KEY_SIZE); -} - -static -DECL_CMD_FUNC(setwgpresharedkey, val, d) -{ - uint8_t key[WG_KEY_SIZE]; - - if (nvl_peer == NULL) - errx(1, "setting preshared-key only valid when adding peer"); - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_peer, "preshared-key", key, WG_KEY_SIZE); -} - - -static -DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) -{ - unsigned long persistent_keepalive; - char *endp; - - if (nvl_peer == NULL) - errx(1, "setting persistent keepalive only valid when adding peer"); - - errno = 0; - persistent_keepalive = strtoul(val, &endp, 0); - if (errno != 0 || *endp != '\0') - errx(1, "persistent-keepalive must be numeric (seconds)"); - if (persistent_keepalive > USHRT_MAX) - errx(1, "persistent-keepalive '%lu' too large", - persistent_keepalive); - nvlist_add_number(nvl_peer, "persistent-keepalive-interval", - persistent_keepalive); -} - -static -DECL_CMD_FUNC(setallowedips, val, d) -{ - char *base, *allowedip, *mask; - u_long ul; - char *endp; - struct allowedip aip; - nvlist_t *nvl_aip; - uint16_t family; - - if (nvl_peer == NULL) - errx(1, "setting allowed ip only valid when adding peer"); - if (allowed_ips_count == allowed_ips_max) { - allowed_ips_max *= 2; - allowed_ips = reallocarray(allowed_ips, allowed_ips_max, - sizeof(*allowed_ips)); - if (allowed_ips == NULL) - errx(1, "failed to grow allowed ip array"); - } - - allowed_ips[allowed_ips_count] = nvl_aip = nvlist_create(0); - if (nvl_aip == NULL) - errx(1, "failed to create new allowedip nvlist"); - - base = allowedip = strdup(val); - mask = index(allowedip, '/'); - if (mask == NULL) - errx(1, "mask separator not found in allowedip %s", val); - *mask = '\0'; - mask++; - - parse_ip(&aip, &family, allowedip); - ul = strtoul(mask, &endp, 0); - if (*endp != '\0') - errx(1, "invalid value for allowedip mask"); - - nvlist_add_number(nvl_aip, "cidr", ul); - if (family == AF_INET) { - nvlist_add_binary(nvl_aip, "ipv4", &aip.ip4, sizeof(aip.ip4)); - } else if (family == AF_INET6) { - nvlist_add_binary(nvl_aip, "ipv6", &aip.ip6, sizeof(aip.ip6)); - } else { - /* Shouldn't happen */ - nvlist_destroy(nvl_aip); - goto out; - } - - allowed_ips_count++; - -out: - free(base); -} - -static -DECL_CMD_FUNC(setendpoint, val, d) -{ - if (nvl_peer == NULL) - errx(1, "setting endpoint only valid when adding peer"); - parse_endpoint(val); -} - -static void -wireguard_status(int s) -{ - size_t size; - void *packed; - nvlist_t *nvl; - char buf[WG_KEY_SIZE_BASE64]; - const void *key; - uint16_t listen_port; - - if (get_nvl_out_size(s, SIOCGWG, &size)) - return; - if ((packed = malloc(size)) == NULL) - return; - if (do_cmd(s, SIOCGWG, packed, size, 0)) - return; - nvl = nvlist_unpack(packed, size, 0); - if (nvlist_exists_number(nvl, "listen-port")) { - listen_port = nvlist_get_number(nvl, "listen-port"); - printf("\tlisten-port: %d\n", listen_port); - } - if (nvlist_exists_binary(nvl, "private-key")) { - key = nvlist_get_binary(nvl, "private-key", &size); - b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); - printf("\tprivate-key: %s\n", buf); - } - if (nvlist_exists_binary(nvl, "public-key")) { - key = nvlist_get_binary(nvl, "public-key", &size); - b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); - printf("\tpublic-key: %s\n", buf); - } -} - -static struct cmd wireguard_cmds[] = { - DEF_CMD_ARG("listen-port", setwglistenport), - DEF_CMD_ARG("private-key", setwgprivkey), - /* XXX peer-list is deprecated. */ - DEF_CMD("peer-list", 0, peerlist), - DEF_CMD("peers", 0, peerlist), - DEF_CMD("peer", 0, peerstart), - DEF_CMD("-peer", 0, peerdel), - DEF_CMD_ARG("preshared-key", setwgpresharedkey), - DEF_CMD_ARG("public-key", setwgpubkey), - DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), - DEF_CMD_ARG("allowed-ips", setallowedips), - DEF_CMD_ARG("endpoint", setendpoint), -}; - -static struct afswtch af_wireguard = { - .af_name = "af_wireguard", - .af_af = AF_UNSPEC, - .af_other_status = wireguard_status, -}; - -static void -wg_create(int s, struct ifreq *ifr) -{ - - setproctitle("ifconfig %s create ...\n", name); - - ifr->ifr_data = NULL; - if (ioctl(s, SIOCIFCREATE, ifr) < 0) - err(1, "SIOCIFCREATE"); -} - -static __constructor void -wireguard_ctor(void) -{ - int i; - - for (i = 0; i < nitems(wireguard_cmds); i++) - cmd_register(&wireguard_cmds[i]); - af_register(&af_wireguard); - clone_setdefcallback_prefix("wg", wg_create); -} - -#endif diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 54fd89fe7590..c29bb80c7a58 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -585,7 +585,6 @@ MAN= aac.4 \ vtnet.4 \ watchdog.4 \ ${_wbwd.4} \ - wg.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ @@ -768,7 +767,6 @@ MLINKS+=vr.4 if_vr.4 MLINKS+=vte.4 if_vte.4 MLINKS+=vtnet.4 if_vtnet.4 MLINKS+=watchdog.4 SW_WATCHDOG.4 -MLINKS+=wg.4 if_wg.4 MLINKS+=${_wpi.4} ${_if_wpi.4} MLINKS+=xl.4 if_xl.4 diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 deleted file mode 100644 index 29215bd438ff..000000000000 --- a/share/man/man4/wg.4 +++ /dev/null @@ -1,259 +0,0 @@ -.\" Copyright (c) 2020 Gordon Bergling -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 12, 2021 -.Dt WG 4 -.Os -.Sh NAME -.Nm wg -.Nd "WireGuard - pseudo-device" -.Sh SYNOPSIS -To load the driver as a module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -if_wg_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -driver provides Virtual Private Network (VPN) interfaces for the secure -exchange of layer 3 traffic with other WireGuard peers using the WireGuard -protocol. -.Pp -A -.Nm -interface recognises one or more peers, establishes a secure tunnel with -each on demand, and tracks each peer's UDP endpoint for exchanging encrypted -traffic with. -.Pp -The interfaces can be created at runtime using the -.Ic ifconfig Cm wg Ns Ar N Cm create -command. -The interface itself can be configured with -.Xr ifconfig 8 . -.Pp -The following parameters are available: -.Bl -tag -width indent -.It Cm listen-port -The listing port of the -.Nm -interface. -.It Cm public-key -The public key of the -.Nm -interface. -.It Cm private-key -The private key of the -.Nm -interface. -.It Cm preshared-key -Defines a pre-shared key for the -.Nm -interface. -.It Cm allowed-ips -A list of allowed IP addresses. -.It Cm endpoint -The IP address of the WiredGuard to connect to. -.It Cm peers -A list of peering IP addresses to connect to. -.It Cm persistent-keepalive-interval -Interval, in seconds, at which to send persistent keepalive packets. -.El -.Pp -The -.Nm -interfaces support the following -.Xr ioctl 2 Ns s : -.Bl -tag -width Ds -offset indent -.It Dv SIOCSWG Fa "struct wg_device_io *" -Set the device configuration. -.It Dv SIOCGWG Fa "struct wg_device_io *" -Get the device configuration. -.El -.Pp -The following glossary provides a brief overview of WireGuard -terminology: -.Bl -tag -width indent -offset 3n -.It Peer -Peers exchange IPv4 or IPv6 traffic over secure tunnels. -Each -.Nm -interface may be configured to recognise one or more peers. -.It Key -Each peer uses its private key and corresponding public key to -identify itself to others. -A peer configures a -.Nm -interface with its own private key and with the public keys of its peers. -.It Pre-shared key -In addition to the public keys, each peer pair may be configured with a -unique pre-shared symmetric key. -This is used in their handshake to guard against future compromise of the -peers' encrypted tunnel if a quantum-computational attack on their -Diffie-Hellman exchange becomes feasible. *** 7633 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Mar 17 14:35:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A75156AF82; Wed, 17 Mar 2021 14:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0t4S0mC4z4RkC; Wed, 17 Mar 2021 14:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CEEA10A05; Wed, 17 Mar 2021 14:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HEZphP025806; Wed, 17 Mar 2021 14:35:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HEZppO025805; Wed, 17 Mar 2021 14:35:51 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:35:51 GMT Message-Id: <202103171435.12HEZppO025805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 4fbbe523653b - main - nvme: Replace potentially long DELAY() with pause(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4fbbe523653b6d2a0186aca38224efcab941deaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:35:52 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4fbbe523653b6d2a0186aca38224efcab941deaa commit 4fbbe523653b6d2a0186aca38224efcab941deaa Author: Alexander Motin AuthorDate: 2021-03-17 14:30:40 +0000 Commit: Alexander Motin CommitDate: 2021-03-17 14:35:49 +0000 nvme: Replace potentially long DELAY() with pause(). In some cases like broken hardware nvme(4) may wait minutes for controller response before timeout. Doing so in a tight spin loop made whole system unresponsive. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29309 Sponsored by: iXsystems, Inc. --- sys/dev/nvme/nvme_ctrlr.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 9e45c0e2d19e..b6befb2c88d0 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -255,10 +255,9 @@ nvme_ctrlr_fail_req_task(void *arg, int pending) static int nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) { - int ms_waited; + int timeout = ticks + (uint64_t)ctrlr->ready_timeout_in_ms * hz / 1000; uint32_t csts; - ms_waited = 0; while (1) { csts = nvme_mmio_read_4(ctrlr, csts); if (csts == NVME_GONE) /* Hot unplug. */ @@ -266,12 +265,12 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) if (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) == desired_val) break; - if (ms_waited++ > ctrlr->ready_timeout_in_ms) { + if (timeout - ticks < 0) { nvme_printf(ctrlr, "controller ready did not become %d " "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } - DELAY(1000); + pause("nvmerdy", 1); } return (0); @@ -410,7 +409,7 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr) nvme_ctrlr_disable_qpairs(ctrlr); - DELAY(100*1000); + pause("nvmehwreset", hz / 10); err = nvme_ctrlr_disable(ctrlr); if (err != 0) @@ -1536,27 +1535,26 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) { uint32_t cc; uint32_t csts; - int ticks = 0, timeout; + int timeout; cc = nvme_mmio_read_4(ctrlr, cc); cc &= ~(NVME_CC_REG_SHN_MASK << NVME_CC_REG_SHN_SHIFT); cc |= NVME_SHN_NORMAL << NVME_CC_REG_SHN_SHIFT; nvme_mmio_write_4(ctrlr, cc, cc); - timeout = ctrlr->cdata.rtd3e == 0 ? 5 * hz : - ((uint64_t)ctrlr->cdata.rtd3e * hz + 999999) / 1000000; + timeout = ticks + (ctrlr->cdata.rtd3e == 0 ? 5 * hz : + ((uint64_t)ctrlr->cdata.rtd3e * hz + 999999) / 1000000); while (1) { csts = nvme_mmio_read_4(ctrlr, csts); if (csts == NVME_GONE) /* Hot unplug. */ break; if (NVME_CSTS_GET_SHST(csts) == NVME_SHST_COMPLETE) break; - if (ticks++ > timeout) { - nvme_printf(ctrlr, "did not complete shutdown within" - " %d ticks of notification\n", timeout); + if (timeout - ticks < 0) { + nvme_printf(ctrlr, "shutdown timeout\n"); break; } - pause("nvme shn", 1); + pause("nvmeshut", 1); } } @@ -1633,7 +1631,7 @@ nvme_ctrlr_suspend(struct nvme_controller *ctrlr) */ nvme_ctrlr_delete_qpairs(ctrlr); nvme_ctrlr_disable_qpairs(ctrlr); - DELAY(100*1000); + pause("nvmesusp", hz / 10); nvme_ctrlr_shutdown(ctrlr); return (0); From owner-dev-commits-src-main@freebsd.org Wed Mar 17 14:57:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52ECE56B9BF; Wed, 17 Mar 2021 14:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0tYh1w4Xz4Tls; Wed, 17 Mar 2021 14:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3497010F02; Wed, 17 Mar 2021 14:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HEviU6052515; Wed, 17 Mar 2021 14:57:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HEviWL052514; Wed, 17 Mar 2021 14:57:44 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:57:44 GMT Message-Id: <202103171457.12HEviWL052514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: e5c6913a8d23 - main - release: sync 'git count' logic with newvers.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5c6913a8d23ebe49c9e8f95c5236c7a0d8dbac5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:57:44 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=e5c6913a8d23ebe49c9e8f95c5236c7a0d8dbac5 commit e5c6913a8d23ebe49c9e8f95c5236c7a0d8dbac5 Author: Glen Barber AuthorDate: 2021-03-17 14:57:32 +0000 Commit: Glen Barber CommitDate: 2021-03-17 14:57:32 +0000 release: sync 'git count' logic with newvers.sh Sync determining the git count with newvers.sh by adding the --first-parent argument. This ensures uname(1) reflects the file name for snapshots. Reported by: Mark Millard MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/Makefile.inc1 b/release/Makefile.inc1 index a97dee9994b6..99d61a45e700 100644 --- a/release/Makefile.inc1 +++ b/release/Makefile.inc1 @@ -22,7 +22,7 @@ GITREV!= ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || . export GITREV . endif . if !defined(GITCOUNT) || empty(GITCOUNT) -GITCOUNT!= ${GIT_CMD} -C ${.CURDIR} rev-list --count HEAD 2>/dev/null || true +GITCOUNT!= ${GIT_CMD} -C ${.CURDIR} rev-list --first-parent --count HEAD 2>/dev/null || true . export GITCOUNT . endif .else From owner-dev-commits-src-main@freebsd.org Wed Mar 17 16:44:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39638570535; Wed, 17 Mar 2021 16:44:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0wwQ18Szz4hkT; Wed, 17 Mar 2021 16:44:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A551126AB; Wed, 17 Mar 2021 16:44:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HGi5QU096800; Wed, 17 Mar 2021 16:44:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HGi5sB096799; Wed, 17 Mar 2021 16:44:05 GMT (envelope-from git) Date: Wed, 17 Mar 2021 16:44:05 GMT Message-Id: <202103171644.12HGi5sB096799@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: e9f029831fa5 - main - fix panic when rescue retransmission and FIN overlap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9f029831fa5747ae1b405f5716c52cb4ebf1e04 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 16:44:06 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=e9f029831fa5747ae1b405f5716c52cb4ebf1e04 commit e9f029831fa5747ae1b405f5716c52cb4ebf1e04 Author: Richard Scheffenegger AuthorDate: 2021-03-17 15:44:29 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-17 16:12:04 +0000 fix panic when rescue retransmission and FIN overlap PR: 254244 PR: 254309 Reviewed By: #transport, hselasky, tuexen MFC after: 3 days Sponsored By: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29315 --- sys/netinet/tcp_sack.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 37db30007580..f8d983da723b 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -831,8 +831,18 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) (tp->snd_recover == tp->snd_max) && TAILQ_EMPTY(&tp->snd_holes) && (tp->sackhint.delivered_data > 0)) { - struct sackhole *hole; - hole = tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, tp->snd_max - maxseg), tp->snd_max, NULL); + /* + * Exclude FIN sequence space in + * the hole for the rescue retransmission, + * and also don't create a hole, if only + * the ACK for a FIN is outstanding. + */ + tcp_seq highdata = tp->snd_max; + if (tp->t_flags & TF_SENTFIN) + highdata--; + if (th->th_ack != highdata) + (void)tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, + highdata - maxseg), highdata, NULL); } (void) tp->t_fb->tfb_tcp_output(tp); } From owner-dev-commits-src-main@freebsd.org Wed Mar 17 19:21:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE24E575BC2; Wed, 17 Mar 2021 19:21:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F10Py628tz3C3p; Wed, 17 Mar 2021 19:21:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1F86145D6; Wed, 17 Mar 2021 19:21:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HJLQxr007698; Wed, 17 Mar 2021 19:21:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HJLQNJ007697; Wed, 17 Mar 2021 19:21:26 GMT (envelope-from git) Date: Wed, 17 Mar 2021 19:21:26 GMT Message-Id: <202103171921.12HJLQNJ007697@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 9f2e5184173f - main - pfsync: Unconditionally push packets when requesting state updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f2e5184173f6af70306678b018270df9a9600f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 19:21:26 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9f2e5184173f6af70306678b018270df9a9600f2 commit 9f2e5184173f6af70306678b018270df9a9600f2 Author: Thomas Kurschel AuthorDate: 2021-03-15 13:28:52 +0000 Commit: Kristof Provost CommitDate: 2021-03-17 18:18:14 +0000 pfsync: Unconditionally push packets when requesting state updates When we request a bulk sync we need to ensure we actually send out that request, not just buffer it until we have enough data to send a full packet. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29271 --- sys/netpfil/pf/if_pfsync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index cf2ff2ef0926..06bad556e885 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1960,7 +1960,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) nlen += sizeof(struct pfsync_subheader); if (b->b_len + nlen > sc->sc_ifp->if_mtu) { - pfsync_sendout(1, 0); + pfsync_sendout(0, 0); nlen = sizeof(struct pfsync_subheader) + sizeof(struct pfsync_upd_req); @@ -1968,6 +1968,8 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) TAILQ_INSERT_TAIL(&b->b_upd_req_list, item, ur_entry); b->b_len += nlen; + + pfsync_push(b); } static bool From owner-dev-commits-src-main@freebsd.org Wed Mar 17 19:21:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DD165757F9; Wed, 17 Mar 2021 19:21:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F10Q00GCRz3Bsl; Wed, 17 Mar 2021 19:21:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E67AE145D7; Wed, 17 Mar 2021 19:21:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HJLRFW007719; Wed, 17 Mar 2021 19:21:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HJLRdF007718; Wed, 17 Mar 2021 19:21:27 GMT (envelope-from git) Date: Wed, 17 Mar 2021 19:21:27 GMT Message-Id: <202103171921.12HJLRdF007718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 8ad7d25dfc80 - main - pf tests: pfsync bulk update test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 19:21:28 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ad7d25dfc808ca00300f7553a9b28dfc0e99c18 commit 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18 Author: Kristof Provost AuthorDate: 2021-03-15 13:10:55 +0000 Commit: Kristof Provost CommitDate: 2021-03-17 18:18:14 +0000 pf tests: pfsync bulk update test Test that pfsync works as expected with bulk updates. That is, create some state before setting up the second firewall. Let that firewall request a bulk update so it can catch up, and check that it got the state which was created before it enable pfsync. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29272 --- tests/sys/netpfil/pf/pfsync.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index d8cb0a13efb7..a6fc7ec9f7e9 100644 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -112,8 +112,76 @@ defer_cleanup() pfsynct_cleanup } +atf_test_case "bulk" "cleanup" +bulk_head() +{ + atf_set descr 'Test bulk updates' + atf_set require.user root +} + +bulk_body() +{ + pfsynct_init + + epair_sync=$(vnet_mkepair) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail one ${epair_one}a ${epair_sync}a + vnet_mkjail two ${epair_two}a ${epair_sync}b + + # pfsync interface + jexec one ifconfig ${epair_sync}a 192.0.2.1/24 up + jexec one ifconfig ${epair_one}a 198.51.100.1/24 up + jexec one ifconfig pfsync0 \ + syncdev ${epair_sync}a \ + maxupd 1\ + up + jexec two ifconfig ${epair_two}a 198.51.100.2/24 up + jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up + + # Enable pf + jexec one pfctl -e + pft_set_rules one \ + "set skip on ${epair_sync}a" \ + "pass keep state" + jexec two pfctl -e + pft_set_rules two \ + "set skip on ${epair_sync}b" \ + "pass keep state" + + ifconfig ${epair_one}b 198.51.100.254/24 up + + # Create state prior to setting up pfsync + ping -c 1 -S 198.51.100.254 198.51.100.1 + + # Wait before setting up pfsync on two, so we don't accidentally catch + # the update anyway. + sleep 1 + + # Now set up pfsync in jail two + jexec two ifconfig pfsync0 \ + syncdev ${epair_sync}b \ + up + + # Give pfsync time to do its thing + sleep 2 + + jexec two pfctl -s states + if ! jexec two pfctl -s states | grep icmp | grep 198.51.100.1 | \ + grep 198.51.100.2 ; then + atf_fail "state not found on synced host" + fi +} + +bulk_cleanup() +{ + pfsynct_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" atf_add_test_case "defer" + atf_add_test_case "bulk" } From owner-dev-commits-src-main@freebsd.org Wed Mar 17 20:20:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DF19577D8C; Wed, 17 Mar 2021 20:20:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F11k11wPgz3H6k; Wed, 17 Mar 2021 20:20:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 307531503D; Wed, 17 Mar 2021 20:20:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HKKPQv082866; Wed, 17 Mar 2021 20:20:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HKKPB1082865; Wed, 17 Mar 2021 20:20:25 GMT (envelope-from git) Date: Wed, 17 Mar 2021 20:20:25 GMT Message-Id: <202103172020.12HKKPB1082865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 0723b409150a - main - aarch64: Clear TLS registers during exec(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0723b409150ae302eb021cbde86a5f77348a1bb4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 20:20:25 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0723b409150ae302eb021cbde86a5f77348a1bb4 commit 0723b409150ae302eb021cbde86a5f77348a1bb4 Author: John Baldwin AuthorDate: 2021-03-17 20:19:04 +0000 Commit: John Baldwin CommitDate: 2021-03-17 20:19:04 +0000 aarch64: Clear TLS registers during exec(). These are not stored in the trapframe so must be cleared explicitly. This is similar to one of the MIPS changes in 822d2d6ac94f. Reviewed by: andrew Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D28711 --- sys/arm64/arm64/machdep.c | 5 +++++ sys/arm64/linux/linux_sysvec.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 91f0a31ebe36..97f97392e43f 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -561,6 +561,11 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_lr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, pcb); #endif diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 67feacfa876b..df16db4040a7 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -365,6 +365,11 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, #endif regs->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, td->td_pcb); #endif From owner-dev-commits-src-main@freebsd.org Wed Mar 17 20:48:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9939578C94; Wed, 17 Mar 2021 20:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F12Ld453dz3KK1; Wed, 17 Mar 2021 20:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F39E15A06; Wed, 17 Mar 2021 20:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HKmf6o014645; Wed, 17 Mar 2021 20:48:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HKmfsJ014644; Wed, 17 Mar 2021 20:48:41 GMT (envelope-from git) Date: Wed, 17 Mar 2021 20:48:41 GMT Message-Id: <202103172048.12HKmfsJ014644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 5be27cbf16c8 - main - arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5be27cbf16c85ce95d21db57349f61494f851821 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 20:48:41 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5be27cbf16c85ce95d21db57349f61494f851821 commit 5be27cbf16c85ce95d21db57349f61494f851821 Author: Ed Maste AuthorDate: 2021-03-17 14:10:41 +0000 Commit: Ed Maste CommitDate: 2021-03-17 20:46:50 +0000 arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs On FreeBSD/arm fill_fpregs, fill_dbregs are stubs that zero the reg struct and return success. set_fpregs and set_dbregs do nothing and return success. Provide the same implementation for arm64 COMPAT_FREEBSD32. Reviewed by: andrew MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29314 --- sys/arm64/arm64/machdep.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 97f97392e43f..8a1e7520aacb 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -489,36 +489,35 @@ set_regs32(struct thread *td, struct reg32 *regs) return (0); } +/* XXX fill/set dbregs/fpregs are stubbed on 32-bit arm. */ int fill_fpregs32(struct thread *td, struct fpreg32 *regs) { - printf("ARM64TODO: fill_fpregs32"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + return (0); } int set_fpregs32(struct thread *td, struct fpreg32 *regs) { - printf("ARM64TODO: set_fpregs32"); - return (EDOOFUS); + return (0); } int fill_dbregs32(struct thread *td, struct dbreg32 *regs) { - printf("ARM64TODO: fill_dbregs32"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + return (0); } int set_dbregs32(struct thread *td, struct dbreg32 *regs) { - printf("ARM64TODO: set_dbregs32"); - return (EDOOFUS); + return (0); } #endif From owner-dev-commits-src-main@freebsd.org Wed Mar 17 22:30:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A647257B765; Wed, 17 Mar 2021 22:30:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F14br4KG2z3j77; Wed, 17 Mar 2021 22:30:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 873AD16E81; Wed, 17 Mar 2021 22:30:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HMUGte052839; Wed, 17 Mar 2021 22:30:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMUGQB052833; Wed, 17 Mar 2021 22:30:16 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:30:16 GMT Message-Id: <202103172230.12HMUGQB052833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: a771bf748f94 - main - Remove unused obj variable missed in r354870. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a771bf748f94acd53ce95a397f8b0733d8c5aa3d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:30:16 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=a771bf748f94acd53ce95a397f8b0733d8c5aa3d commit a771bf748f94acd53ce95a397f8b0733d8c5aa3d Author: Bryan Drewery AuthorDate: 2021-03-17 22:01:19 +0000 Commit: Bryan Drewery CommitDate: 2021-03-17 22:29:15 +0000 Remove unused obj variable missed in r354870. Sponsored by: Dell EMC --- sys/vm/vnode_pager.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index e75c6fb6b5d7..c33ffca4a700 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1476,12 +1476,10 @@ void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, off_t eof, int lpos) { - vm_object_t obj; int i, pos, pos_devb; if (written == 0 && eof >= lpos) return; - obj = ma[0]->object; for (i = 0, pos = 0; pos < written; i++, pos += PAGE_SIZE) { if (pos < trunc_page(written)) { rtvals[i] = VM_PAGER_OK; From owner-dev-commits-src-main@freebsd.org Thu Mar 18 00:31:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AFA957E387; Thu, 18 Mar 2021 00:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F17J71jFCz3qnm; Thu, 18 Mar 2021 00:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D63D1862B; Thu, 18 Mar 2021 00:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12I0VpKS014409; Thu, 18 Mar 2021 00:31:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12I0VpJY014408; Thu, 18 Mar 2021 00:31:51 GMT (envelope-from git) Date: Thu, 18 Mar 2021 00:31:51 GMT Message-Id: <202103180031.12I0VpJY014408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mike Karels Subject: git: 2bdcf6237744 - main - genet: Fix problem with forwarding some TCP/IPv6 packets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bdcf6237744b2d9d9707d623660d33931daeb52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 00:31:51 -0000 The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=2bdcf6237744b2d9d9707d623660d33931daeb52 commit 2bdcf6237744b2d9d9707d623660d33931daeb52 Author: Mike Karels AuthorDate: 2021-03-18 00:19:24 +0000 Commit: Mike Karels CommitDate: 2021-03-18 00:25:43 +0000 genet: Fix problem with forwarding some TCP/IPv6 packets TCP/IPv6 packets to be forwarded can be laid out with only the Ethernet header in the first mbuf, and these packets are lost. There was a previous hack to pullup ICMPv6 packets with such a layout for the same reason. Generalize, and pullup any IPv6 packets with only the Ethernet header in the first mbuf. Possibly this should also include IPv4, but that situation has not been observed to fail. PR: 254060 Reported by: denis at h3q.com MFC after: 3 days --- sys/arm64/broadcom/genet/if_genet.c | 46 +++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index 5f2dfcc40395..0fe9f80f4c21 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -76,10 +76,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define ICMPV6_HACK /* workaround for chip issue */ -#ifdef ICMPV6_HACK -#include -#endif #include "syscon_if.h" #include "miibus_if.h" @@ -955,6 +951,8 @@ gen_start_locked(struct gen_softc *sc) if (err != 0) { if (err == ENOBUFS) if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); + else if (m == NULL) + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (m != NULL) if_sendq_prepend(ifp, m); break; @@ -995,36 +993,34 @@ gen_encap(struct gen_softc *sc, struct mbuf **mp) q = &sc->tx_queue[DEF_TXQUEUE]; m = *mp; -#ifdef ICMPV6_HACK + /* * Reflected ICMPv6 packets, e.g. echo replies, tend to get laid * out with only the Ethernet header in the first mbuf, and this - * doesn't seem to work. + * doesn't seem to work. Forwarded TCP packets over IPv6 also + * fail if laid out with only the Ethernet header in the first mbuf. + * For now, pull up any IPv6 packet with that layout. Maybe IPv4 + * needs it but we haven't run into it. Pulling up the sizes of + * ether_header + ip6_header + icmp6_hdr seems to work for both + * ICMPv6 and TCP over IPv6. */ -#define ICMP6_LEN (sizeof(struct ether_header) + sizeof(struct ip6_hdr) + \ - sizeof(struct icmp6_hdr)) +#define IP6_PULLUP_LEN (sizeof(struct ether_header) + \ + sizeof(struct ip6_hdr) + 8) if (m->m_len == sizeof(struct ether_header)) { int ether_type = mtod(m, struct ether_header *)->ether_type; - if (ntohs(ether_type) == ETHERTYPE_IPV6 && - m->m_next->m_len >= sizeof(struct ip6_hdr)) { - struct ip6_hdr *ip6; - - ip6 = mtod(m->m_next, struct ip6_hdr *); - if (ip6->ip6_nxt == IPPROTO_ICMPV6) { - m = m_pullup(m, - MIN(m->m_pkthdr.len, ICMP6_LEN)); - if (m == NULL) { - if (sc->ifp->if_flags & IFF_DEBUG) - device_printf(sc->dev, - "ICMPV6 pullup fail\n"); - *mp = NULL; - return (ENOMEM); - } + if (ntohs(ether_type) == ETHERTYPE_IPV6) { + m = m_pullup(m, MIN(m->m_pkthdr.len, IP6_PULLUP_LEN)); + if (m == NULL) { + if (sc->ifp->if_flags & IFF_DEBUG) + device_printf(sc->dev, + "IPV6 pullup fail\n"); + *mp = NULL; + return (ENOMEM); } } } -#undef ICMP6_LEN -#endif +#undef IP6_PULLUP_LEN + if ((if_getcapenable(sc->ifp) & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) != 0) { csum_flags = m->m_pkthdr.csum_flags; From owner-dev-commits-src-main@freebsd.org Thu Mar 18 09:30:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A822A5B5173; Thu, 18 Mar 2021 09:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1MFV4N6Hz4tcD; Thu, 18 Mar 2021 09:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84A5F1F846; Thu, 18 Mar 2021 09:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12I9UMuX026248; Thu, 18 Mar 2021 09:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12I9UMgx026247; Thu, 18 Mar 2021 09:30:22 GMT (envelope-from git) Date: Thu, 18 Mar 2021 09:30:22 GMT Message-Id: <202103180930.12I9UMgx026247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: b75fb12b6827 - main - terminfo: add more path to lookup for the database MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b75fb12b6827e306936b338f06ddb906fd383f42 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 09:30:22 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=b75fb12b6827e306936b338f06ddb906fd383f42 commit b75fb12b6827e306936b338f06ddb906fd383f42 Author: Baptiste Daroussin AuthorDate: 2021-03-18 08:46:15 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-18 09:29:43 +0000 terminfo: add more path to lookup for the database In preparation for the move of the database out of base, add one more path to lookup Now the default lookup path is 1. base 2. localbase 3. localbase special site for custom terminfo (for ports adding custom terminfo and avoid potential collision with the general db) 4. termcap The plan is to allow the terminfo-db to be installed by end users via a package for people willing to have the support for features from this database provides. And keep the fallback on termcap for people who don't want to hear about the terminfo db or how to configure the terminal if it uses by default the features proposed in the definitions of the terminfo db. the first look up path is a window open for a proposal made by glebius@ consisting on creating a tool where the user at install time will select the feature it want for a given terminal and generate its configurations based on that. I won't work on it, but it is now posssible and there is a path where to store those definitions --- lib/ncurses/ncurses/ncurses_cfg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ncurses/ncurses/ncurses_cfg.h b/lib/ncurses/ncurses/ncurses_cfg.h index 2217eabd3580..259d5c656af7 100644 --- a/lib/ncurses/ncurses/ncurses_cfg.h +++ b/lib/ncurses/ncurses/ncurses_cfg.h @@ -65,7 +65,7 @@ #ifdef __FreeBSD__ #define USE_SYSMOUSE 1 #endif -#define TERMINFO_DIRS "/usr/share/terminfo:/usr/local/share/site-terminfo" +#define TERMINFO_DIRS "/usr/share/terminfo:/usr/local/share/terminfo:/usr/local/share/site-terminfo" #define TERMINFO "/usr/share/terminfo" #define HAVE_BIG_CORE 1 #define TERMPATH "/etc/termcap:/usr/share/misc/termcap" From owner-dev-commits-src-main@freebsd.org Thu Mar 18 10:10:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E79485B6426; Thu, 18 Mar 2021 10:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1N8F68Fwz3DFh; Thu, 18 Mar 2021 10:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5C721FF30; Thu, 18 Mar 2021 10:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IAAr7g079834; Thu, 18 Mar 2021 10:10:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IAArna079833; Thu, 18 Mar 2021 10:10:53 GMT (envelope-from git) Date: Thu, 18 Mar 2021 10:10:53 GMT Message-Id: <202103181010.12IAArna079833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 7a758a4cee23 - main - Revert "terminfo: add terminfo database" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a758a4cee238aefdf6f631a415100fec28b659a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 10:10:54 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=7a758a4cee238aefdf6f631a415100fec28b659a commit 7a758a4cee238aefdf6f631a415100fec28b659a Author: Baptiste Daroussin AuthorDate: 2021-03-18 09:57:23 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-18 09:57:23 +0000 Revert "terminfo: add terminfo database" This reverts commit 2a50a9de8340f08bd876e9e5993332ae14376f80. --- share/Makefile | 1 - share/terminfo/Makefile | 34 ---------------------------------- 2 files changed, 35 deletions(-) diff --git a/share/Makefile b/share/Makefile index d6854b230ae5..c4e12b05f7db 100644 --- a/share/Makefile +++ b/share/Makefile @@ -26,7 +26,6 @@ SUBDIR= ${_colldef} \ ${_syscons} \ tabset \ termcap \ - terminfo \ ${_timedef} \ ${_vt} \ ${_zoneinfo} diff --git a/share/terminfo/Makefile b/share/terminfo/Makefile deleted file mode 100644 index 7bb11f3fdf24..000000000000 --- a/share/terminfo/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -PACKAGE= runtime - -.PATH: ${SRCTOP}/contrib/ncurses/misc -TINFOBUILDDIR= ${.OBJDIR}/builddir -CLEANDIRS+= builddir - -.include - -.if !defined(_SKIP_BUILD) -all: terminfo -.endif -META_TARGETS+= terminfo install-terminfo - -terminfo: terminfo.src - mkdir -p ${TINFOBUILDDIR} - ${TIC_CMD} -x -o ${TINFOBUILDDIR} ${.ALLSRC} - -.if make(*install*) -TINFOS!= cd ${TINFOBUILDDIR} && find * -type f | LC_ALL=C sort -TINFOSDIRS= ${TINFOS:C/(.).*/\1/g:O:u} -.endif - -beforeinstall: install-terminfo -install-terminfo: - mkdir -p ${DESTDIR}/usr/share/terminfo - cd ${DESTDIR}/usr/share/terminfo; mkdir -p ${TINFOSDIRS} -.for f in ${TINFOS} - ${INSTALL} ${TAG_ARGS} \ - -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ - ${TINFOBUILDDIR}/${f} ${DESTDIR}/usr/share/terminfo/${f} -.endfor - -.include - From owner-dev-commits-src-main@freebsd.org Thu Mar 18 10:10:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C2905B6681; Thu, 18 Mar 2021 10:10:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1N8G6n5Bz3D58; Thu, 18 Mar 2021 10:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB88620203; Thu, 18 Mar 2021 10:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IAAs3D079857; Thu, 18 Mar 2021 10:10:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IAAsnP079856; Thu, 18 Mar 2021 10:10:54 GMT (envelope-from git) Date: Thu, 18 Mar 2021 10:10:54 GMT Message-Id: <202103181010.12IAAsnP079856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 16d3faad099a - main - terminfo db: add entries for the terminfo database removal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16d3faad099a36b36518364611ba808f4bda4ea8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 10:10:55 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=16d3faad099a36b36518364611ba808f4bda4ea8 commit 16d3faad099a36b36518364611ba808f4bda4ea8 Author: Baptiste Daroussin AuthorDate: 2021-03-18 10:04:32 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-18 10:04:32 +0000 terminfo db: add entries for the terminfo database removal --- ObsoleteFiles.inc | 2824 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2824 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index bb1a19ec5ceb..2d8113dd1cce 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,2830 @@ # xargs -n1 | sort | uniq -d; # done +# 20210318: remove the terminfo database +OLD_FILES+=usr/share/terminfo/1/1178 +OLD_FILES+=usr/share/terminfo/1/1730-lm +OLD_DIRS+=usr/share/terminfo/1 +OLD_FILES+=usr/share/terminfo/2/2621 +OLD_FILES+=usr/share/terminfo/2/2621-wl +OLD_FILES+=usr/share/terminfo/2/2621A +OLD_FILES+=usr/share/terminfo/2/2621a +OLD_DIRS+=usr/share/terminfo/2/ +OLD_FILES+=usr/share/terminfo/3/386at +OLD_FILES+=usr/share/terminfo/3/3b1 +OLD_DIRS+=usr/share/terminfo/3/ +OLD_FILES+=usr/share/terminfo/4/4025ex +OLD_FILES+=usr/share/terminfo/4/4027ex +OLD_FILES+=usr/share/terminfo/4/4410-w +OLD_DIRS+=usr/share/terminfo/4/ +OLD_FILES+=usr/share/terminfo/5/5051 +OLD_FILES+=usr/share/terminfo/5/5410-w +OLD_FILES+=usr/share/terminfo/5/5620 +OLD_FILES+=usr/share/terminfo/5/5630-24 +OLD_FILES+=usr/share/terminfo/5/5630DMD-24 +OLD_DIRS+=usr/share/terminfo/5/ +OLD_FILES+=usr/share/terminfo/6/6053 +OLD_FILES+=usr/share/terminfo/6/6053-dg +OLD_FILES+=usr/share/terminfo/6/605x +OLD_FILES+=usr/share/terminfo/6/605x-dg +OLD_FILES+=usr/share/terminfo/6/630-lm +OLD_FILES+=usr/share/terminfo/6/630MTG-24 +OLD_DIRS+=usr/share/terminfo/6/ +OLD_FILES+=usr/share/terminfo/7/730MTG-24 +OLD_FILES+=usr/share/terminfo/7/730MTG-41 +OLD_FILES+=usr/share/terminfo/7/730MTG-41r +OLD_FILES+=usr/share/terminfo/7/730MTGr +OLD_FILES+=usr/share/terminfo/7/730MTGr-24 +OLD_DIRS+=usr/share/terminfo/7/ +OLD_FILES+=usr/share/terminfo/8/8510 +OLD_DIRS+=usr/share/terminfo/8/ +OLD_FILES+=usr/share/terminfo/9/955-hb +OLD_FILES+=usr/share/terminfo/9/955-w +OLD_FILES+=usr/share/terminfo/9/9term +OLD_DIRS+=usr/share/terminfo/9/ +OLD_FILES+=usr/share/terminfo/A/Apple_Terminal +OLD_DIRS+=usr/share/terminfo/A/ +OLD_FILES+=usr/share/terminfo/E/Eterm +OLD_FILES+=usr/share/terminfo/E/Eterm-256color +OLD_FILES+=usr/share/terminfo/E/Eterm-88color +OLD_FILES+=usr/share/terminfo/E/Eterm-color +OLD_DIRS+=usr/share/terminfo/E/ +OLD_FILES+=usr/share/terminfo/L/LFT-PC850 +OLD_DIRS+=usr/share/terminfo/L/ +OLD_FILES+=usr/share/terminfo/M/MtxOrb +OLD_FILES+=usr/share/terminfo/M/MtxOrb162 +OLD_FILES+=usr/share/terminfo/M/MtxOrb204 +OLD_DIRS+=usr/share/terminfo/M/ +OLD_FILES+=usr/share/terminfo/N/NCR260VT300WPP +OLD_FILES+=usr/share/terminfo/N/NCRVT100WPP +OLD_DIRS+=usr/share/terminfo/N/ +OLD_FILES+=usr/share/terminfo/P/P12 +OLD_FILES+=usr/share/terminfo/P/P12-M +OLD_FILES+=usr/share/terminfo/P/P12-M-W +OLD_FILES+=usr/share/terminfo/P/P12-W +OLD_FILES+=usr/share/terminfo/P/P14 +OLD_FILES+=usr/share/terminfo/P/P14-M +OLD_FILES+=usr/share/terminfo/P/P14-M-W +OLD_FILES+=usr/share/terminfo/P/P14-W +OLD_FILES+=usr/share/terminfo/P/P4 +OLD_FILES+=usr/share/terminfo/P/P5 +OLD_FILES+=usr/share/terminfo/P/P7 +OLD_FILES+=usr/share/terminfo/P/P8 +OLD_FILES+=usr/share/terminfo/P/P8-W +OLD_FILES+=usr/share/terminfo/P/P9 +OLD_FILES+=usr/share/terminfo/P/P9-8 +OLD_FILES+=usr/share/terminfo/P/P9-8-W +OLD_FILES+=usr/share/terminfo/P/P9-W +OLD_DIRS+=usr/share/terminfo/P/ +OLD_FILES+=usr/share/terminfo/Q/Q306-8-pc +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-H +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-H-am +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-Hw +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-w +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-w-am +OLD_DIRS+=usr/share/terminfo/Q/ +OLD_FILES+=usr/share/terminfo/X/X-hpterm +OLD_DIRS+=usr/share/terminfo/X/ +OLD_FILES+=usr/share/terminfo/a/a210 +OLD_FILES+=usr/share/terminfo/a/a80 +OLD_FILES+=usr/share/terminfo/a/a980 +OLD_FILES+=usr/share/terminfo/a/aa4080 +OLD_FILES+=usr/share/terminfo/a/aaa +OLD_FILES+=usr/share/terminfo/a/aaa+dec +OLD_FILES+=usr/share/terminfo/a/aaa+rv +OLD_FILES+=usr/share/terminfo/a/aaa+unk +OLD_FILES+=usr/share/terminfo/a/aaa-18 +OLD_FILES+=usr/share/terminfo/a/aaa-18-rv +OLD_FILES+=usr/share/terminfo/a/aaa-20 +OLD_FILES+=usr/share/terminfo/a/aaa-22 +OLD_FILES+=usr/share/terminfo/a/aaa-24 +OLD_FILES+=usr/share/terminfo/a/aaa-24-rv +OLD_FILES+=usr/share/terminfo/a/aaa-26 +OLD_FILES+=usr/share/terminfo/a/aaa-28 +OLD_FILES+=usr/share/terminfo/a/aaa-30 +OLD_FILES+=usr/share/terminfo/a/aaa-30-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-30-rv +OLD_FILES+=usr/share/terminfo/a/aaa-30-rv-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-30-s +OLD_FILES+=usr/share/terminfo/a/aaa-30-s-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-30-s-rv +OLD_FILES+=usr/share/terminfo/a/aaa-30-s-rv-ct +OLD_FILES+=usr/share/terminfo/a/aaa-36 +OLD_FILES+=usr/share/terminfo/a/aaa-36-rv +OLD_FILES+=usr/share/terminfo/a/aaa-40 +OLD_FILES+=usr/share/terminfo/a/aaa-40-rv +OLD_FILES+=usr/share/terminfo/a/aaa-48 +OLD_FILES+=usr/share/terminfo/a/aaa-48-rv +OLD_FILES+=usr/share/terminfo/a/aaa-60 +OLD_FILES+=usr/share/terminfo/a/aaa-60-dec-rv +OLD_FILES+=usr/share/terminfo/a/aaa-60-rv +OLD_FILES+=usr/share/terminfo/a/aaa-60-s +OLD_FILES+=usr/share/terminfo/a/aaa-60-s-rv +OLD_FILES+=usr/share/terminfo/a/aaa-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-db +OLD_FILES+=usr/share/terminfo/a/aaa-rv +OLD_FILES+=usr/share/terminfo/a/aaa-rv-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-rv-unk +OLD_FILES+=usr/share/terminfo/a/aaa-s +OLD_FILES+=usr/share/terminfo/a/aaa-s-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-s-rv +OLD_FILES+=usr/share/terminfo/a/aaa-s-rv-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-unk +OLD_FILES+=usr/share/terminfo/a/aas1901 +OLD_FILES+=usr/share/terminfo/a/abm80 +OLD_FILES+=usr/share/terminfo/a/abm85 +OLD_FILES+=usr/share/terminfo/a/abm85e +OLD_FILES+=usr/share/terminfo/a/abm85h +OLD_FILES+=usr/share/terminfo/a/abm85h-old +OLD_FILES+=usr/share/terminfo/a/act4 +OLD_FILES+=usr/share/terminfo/a/act5 +OLD_FILES+=usr/share/terminfo/a/addrinfo +OLD_FILES+=usr/share/terminfo/a/adds200 +OLD_FILES+=usr/share/terminfo/a/adds980 +OLD_FILES+=usr/share/terminfo/a/addsviewpoint +OLD_FILES+=usr/share/terminfo/a/addsvp60 +OLD_FILES+=usr/share/terminfo/a/adm+sgr +OLD_FILES+=usr/share/terminfo/a/adm1 +OLD_FILES+=usr/share/terminfo/a/adm11 +OLD_FILES+=usr/share/terminfo/a/adm1178 +OLD_FILES+=usr/share/terminfo/a/adm12 +OLD_FILES+=usr/share/terminfo/a/adm1a +OLD_FILES+=usr/share/terminfo/a/adm2 +OLD_FILES+=usr/share/terminfo/a/adm20 +OLD_FILES+=usr/share/terminfo/a/adm21 +OLD_FILES+=usr/share/terminfo/a/adm22 +OLD_FILES+=usr/share/terminfo/a/adm3 +OLD_FILES+=usr/share/terminfo/a/adm31 +OLD_FILES+=usr/share/terminfo/a/adm31-old +OLD_FILES+=usr/share/terminfo/a/adm36 +OLD_FILES+=usr/share/terminfo/a/adm3a +OLD_FILES+=usr/share/terminfo/a/adm3a+ +OLD_FILES+=usr/share/terminfo/a/adm42 +OLD_FILES+=usr/share/terminfo/a/adm42-ns +OLD_FILES+=usr/share/terminfo/a/adm5 +OLD_FILES+=usr/share/terminfo/a/aepro +OLD_FILES+=usr/share/terminfo/a/aixterm +OLD_FILES+=usr/share/terminfo/a/aixterm-16color +OLD_FILES+=usr/share/terminfo/a/aixterm-m +OLD_FILES+=usr/share/terminfo/a/aixterm-m-old +OLD_FILES+=usr/share/terminfo/a/aj +OLD_FILES+=usr/share/terminfo/a/aj510 +OLD_FILES+=usr/share/terminfo/a/aj830 +OLD_FILES+=usr/share/terminfo/a/aj832 +OLD_FILES+=usr/share/terminfo/a/alacritty +OLD_FILES+=usr/share/terminfo/a/alacritty+common +OLD_FILES+=usr/share/terminfo/a/alacritty-direct +OLD_FILES+=usr/share/terminfo/a/alt2 +OLD_FILES+=usr/share/terminfo/a/alt3 +OLD_FILES+=usr/share/terminfo/a/alt4 +OLD_FILES+=usr/share/terminfo/a/alt5 +OLD_FILES+=usr/share/terminfo/a/alt7 +OLD_FILES+=usr/share/terminfo/a/alt7pc +OLD_FILES+=usr/share/terminfo/a/alto-h19 +OLD_FILES+=usr/share/terminfo/a/alto-heath +OLD_FILES+=usr/share/terminfo/a/altoh19 +OLD_FILES+=usr/share/terminfo/a/altoheath +OLD_FILES+=usr/share/terminfo/a/altos-2 +OLD_FILES+=usr/share/terminfo/a/altos-3 +OLD_FILES+=usr/share/terminfo/a/altos-4 +OLD_FILES+=usr/share/terminfo/a/altos-5 +OLD_FILES+=usr/share/terminfo/a/altos2 +OLD_FILES+=usr/share/terminfo/a/altos3 +OLD_FILES+=usr/share/terminfo/a/altos4 +OLD_FILES+=usr/share/terminfo/a/altos5 +OLD_FILES+=usr/share/terminfo/a/altos7 +OLD_FILES+=usr/share/terminfo/a/altos7pc +OLD_FILES+=usr/share/terminfo/a/ambas +OLD_FILES+=usr/share/terminfo/a/ambassador +OLD_FILES+=usr/share/terminfo/a/amiga +OLD_FILES+=usr/share/terminfo/a/amiga-8bit +OLD_FILES+=usr/share/terminfo/a/amiga-h +OLD_FILES+=usr/share/terminfo/a/amiga-vnc +OLD_FILES+=usr/share/terminfo/a/amp219 +OLD_FILES+=usr/share/terminfo/a/amp219w +OLD_FILES+=usr/share/terminfo/a/ampex-219 +OLD_FILES+=usr/share/terminfo/a/ampex-219w +OLD_FILES+=usr/share/terminfo/a/ampex-232 +OLD_FILES+=usr/share/terminfo/a/ampex175 +OLD_FILES+=usr/share/terminfo/a/ampex175-b +OLD_FILES+=usr/share/terminfo/a/ampex210 +OLD_FILES+=usr/share/terminfo/a/ampex219 +OLD_FILES+=usr/share/terminfo/a/ampex219w +OLD_FILES+=usr/share/terminfo/a/ampex232 +OLD_FILES+=usr/share/terminfo/a/ampex232w +OLD_FILES+=usr/share/terminfo/a/ampex80 +OLD_FILES+=usr/share/terminfo/a/annarbor4080 +OLD_FILES+=usr/share/terminfo/a/ansi +OLD_FILES+=usr/share/terminfo/a/ansi+arrows +OLD_FILES+=usr/share/terminfo/a/ansi+csr +OLD_FILES+=usr/share/terminfo/a/ansi+cup +OLD_FILES+=usr/share/terminfo/a/ansi+enq +OLD_FILES+=usr/share/terminfo/a/ansi+erase +OLD_FILES+=usr/share/terminfo/a/ansi+idc +OLD_FILES+=usr/share/terminfo/a/ansi+idc1 +OLD_FILES+=usr/share/terminfo/a/ansi+idl +OLD_FILES+=usr/share/terminfo/a/ansi+idl1 +OLD_FILES+=usr/share/terminfo/a/ansi+inittabs +OLD_FILES+=usr/share/terminfo/a/ansi+local +OLD_FILES+=usr/share/terminfo/a/ansi+local1 +OLD_FILES+=usr/share/terminfo/a/ansi+pp +OLD_FILES+=usr/share/terminfo/a/ansi+rca +OLD_FILES+=usr/share/terminfo/a/ansi+rep +OLD_FILES+=usr/share/terminfo/a/ansi+sgr +OLD_FILES+=usr/share/terminfo/a/ansi+sgrbold +OLD_FILES+=usr/share/terminfo/a/ansi+sgrdim +OLD_FILES+=usr/share/terminfo/a/ansi+sgrso +OLD_FILES+=usr/share/terminfo/a/ansi+sgrul +OLD_FILES+=usr/share/terminfo/a/ansi+tabs +OLD_FILES+=usr/share/terminfo/a/ansi-color-2-emx +OLD_FILES+=usr/share/terminfo/a/ansi-color-3-emx +OLD_FILES+=usr/share/terminfo/a/ansi-emx +OLD_FILES+=usr/share/terminfo/a/ansi-generic +OLD_FILES+=usr/share/terminfo/a/ansi-m +OLD_FILES+=usr/share/terminfo/a/ansi-mini +OLD_FILES+=usr/share/terminfo/a/ansi-mono +OLD_FILES+=usr/share/terminfo/a/ansi-mr +OLD_FILES+=usr/share/terminfo/a/ansi-mtabs +OLD_FILES+=usr/share/terminfo/a/ansi-nt +OLD_FILES+=usr/share/terminfo/a/ansi.sys +OLD_FILES+=usr/share/terminfo/a/ansi.sys-old +OLD_FILES+=usr/share/terminfo/a/ansi.sysk +OLD_FILES+=usr/share/terminfo/a/ansi43m +OLD_FILES+=usr/share/terminfo/a/ansi77 +OLD_FILES+=usr/share/terminfo/a/ansi80x25 +OLD_FILES+=usr/share/terminfo/a/ansi80x25-mono +OLD_FILES+=usr/share/terminfo/a/ansi80x25-raw +OLD_FILES+=usr/share/terminfo/a/ansi80x30 +OLD_FILES+=usr/share/terminfo/a/ansi80x30-mono +OLD_FILES+=usr/share/terminfo/a/ansi80x43 +OLD_FILES+=usr/share/terminfo/a/ansi80x43-mono +OLD_FILES+=usr/share/terminfo/a/ansi80x50 +OLD_FILES+=usr/share/terminfo/a/ansi80x50-mono +OLD_FILES+=usr/share/terminfo/a/ansi80x60 +OLD_FILES+=usr/share/terminfo/a/ansi80x60-mono +OLD_FILES+=usr/share/terminfo/a/ansil +OLD_FILES+=usr/share/terminfo/a/ansil-mono +OLD_FILES+=usr/share/terminfo/a/ansis +OLD_FILES+=usr/share/terminfo/a/ansis-mono +OLD_FILES+=usr/share/terminfo/a/ansisysk +OLD_FILES+=usr/share/terminfo/a/ansiterm +OLD_FILES+=usr/share/terminfo/a/ansiw +OLD_FILES+=usr/share/terminfo/a/ap-vm80 +OLD_FILES+=usr/share/terminfo/a/apl +OLD_FILES+=usr/share/terminfo/a/apollo +OLD_FILES+=usr/share/terminfo/a/apollo_15P +OLD_FILES+=usr/share/terminfo/a/apollo_19L +OLD_FILES+=usr/share/terminfo/a/apollo_color +OLD_FILES+=usr/share/terminfo/a/apple-80 +OLD_FILES+=usr/share/terminfo/a/apple-ae +OLD_FILES+=usr/share/terminfo/a/apple-soroc +OLD_FILES+=usr/share/terminfo/a/apple-uterm +OLD_FILES+=usr/share/terminfo/a/apple-uterm-vb +OLD_FILES+=usr/share/terminfo/a/apple-videx +OLD_FILES+=usr/share/terminfo/a/apple-videx2 +OLD_FILES+=usr/share/terminfo/a/apple-videx3 +OLD_FILES+=usr/share/terminfo/a/apple-vm80 +OLD_FILES+=usr/share/terminfo/a/apple2e +OLD_FILES+=usr/share/terminfo/a/apple2e-p +OLD_FILES+=usr/share/terminfo/a/apple80p +OLD_FILES+=usr/share/terminfo/a/appleII +OLD_FILES+=usr/share/terminfo/a/appleIIc +OLD_FILES+=usr/share/terminfo/a/appleIIe +OLD_FILES+=usr/share/terminfo/a/appleIIgs +OLD_FILES+=usr/share/terminfo/a/arm100 +OLD_FILES+=usr/share/terminfo/a/arm100-am +OLD_FILES+=usr/share/terminfo/a/arm100-w +OLD_FILES+=usr/share/terminfo/a/arm100-wam +OLD_FILES+=usr/share/terminfo/a/at +OLD_FILES+=usr/share/terminfo/a/at-color +OLD_FILES+=usr/share/terminfo/a/at-m +OLD_FILES+=usr/share/terminfo/a/at386 +OLD_FILES+=usr/share/terminfo/a/atari +OLD_FILES+=usr/share/terminfo/a/atari-color +OLD_FILES+=usr/share/terminfo/a/atari-m +OLD_FILES+=usr/share/terminfo/a/atari-old +OLD_FILES+=usr/share/terminfo/a/atari_st +OLD_FILES+=usr/share/terminfo/a/atari_st-color +OLD_FILES+=usr/share/terminfo/a/atarist-m +OLD_FILES+=usr/share/terminfo/a/aterm +OLD_FILES+=usr/share/terminfo/a/att2300 +OLD_FILES+=usr/share/terminfo/a/att2350 +OLD_FILES+=usr/share/terminfo/a/att4410 +OLD_FILES+=usr/share/terminfo/a/att4410-w +OLD_FILES+=usr/share/terminfo/a/att4410v1 +OLD_FILES+=usr/share/terminfo/a/att4410v1-w +OLD_FILES+=usr/share/terminfo/a/att4415 +OLD_FILES+=usr/share/terminfo/a/att4415+nl +OLD_FILES+=usr/share/terminfo/a/att4415-nl +OLD_FILES+=usr/share/terminfo/a/att4415-rv +OLD_FILES+=usr/share/terminfo/a/att4415-rv-nl +OLD_FILES+=usr/share/terminfo/a/att4415-w +OLD_FILES+=usr/share/terminfo/a/att4415-w-nl +OLD_FILES+=usr/share/terminfo/a/att4415-w-rv +OLD_FILES+=usr/share/terminfo/a/att4415-w-rv-n +OLD_FILES+=usr/share/terminfo/a/att4418 +OLD_FILES+=usr/share/terminfo/a/att4418-w +OLD_FILES+=usr/share/terminfo/a/att4420 +OLD_FILES+=usr/share/terminfo/a/att4424 +OLD_FILES+=usr/share/terminfo/a/att4424-1 +OLD_FILES+=usr/share/terminfo/a/att4424m +OLD_FILES+=usr/share/terminfo/a/att4425 +OLD_FILES+=usr/share/terminfo/a/att4425-nl +OLD_FILES+=usr/share/terminfo/a/att4425-w +OLD_FILES+=usr/share/terminfo/a/att4426 +OLD_FILES+=usr/share/terminfo/a/att500 +OLD_FILES+=usr/share/terminfo/a/att505 +OLD_FILES+=usr/share/terminfo/a/att505-24 +OLD_FILES+=usr/share/terminfo/a/att510a +OLD_FILES+=usr/share/terminfo/a/att510d +OLD_FILES+=usr/share/terminfo/a/att513 +OLD_FILES+=usr/share/terminfo/a/att5310 +OLD_FILES+=usr/share/terminfo/a/att5320 +OLD_FILES+=usr/share/terminfo/a/att5410 +OLD_FILES+=usr/share/terminfo/a/att5410-w +OLD_FILES+=usr/share/terminfo/a/att5410v1 +OLD_FILES+=usr/share/terminfo/a/att5410v1-w +OLD_FILES+=usr/share/terminfo/a/att5418 +OLD_FILES+=usr/share/terminfo/a/att5418-w +OLD_FILES+=usr/share/terminfo/a/att5420 +OLD_FILES+=usr/share/terminfo/a/att5420+nl +OLD_FILES+=usr/share/terminfo/a/att5420-nl +OLD_FILES+=usr/share/terminfo/a/att5420-rv +OLD_FILES+=usr/share/terminfo/a/att5420-rv-nl +OLD_FILES+=usr/share/terminfo/a/att5420-w +OLD_FILES+=usr/share/terminfo/a/att5420-w-nl +OLD_FILES+=usr/share/terminfo/a/att5420-w-rv +OLD_FILES+=usr/share/terminfo/a/att5420-w-rv-n +OLD_FILES+=usr/share/terminfo/a/att5420_2 +OLD_FILES+=usr/share/terminfo/a/att5420_2-w +OLD_FILES+=usr/share/terminfo/a/att5425 +OLD_FILES+=usr/share/terminfo/a/att5425-nl +OLD_FILES+=usr/share/terminfo/a/att5425-w +OLD_FILES+=usr/share/terminfo/a/att5430 +OLD_FILES+=usr/share/terminfo/a/att5620 +OLD_FILES+=usr/share/terminfo/a/att5620-1 +OLD_FILES+=usr/share/terminfo/a/att5620-24 +OLD_FILES+=usr/share/terminfo/a/att5620-34 +OLD_FILES+=usr/share/terminfo/a/att5620-s +OLD_FILES+=usr/share/terminfo/a/att605 +OLD_FILES+=usr/share/terminfo/a/att605-pc +OLD_FILES+=usr/share/terminfo/a/att605-w +OLD_FILES+=usr/share/terminfo/a/att610 +OLD_FILES+=usr/share/terminfo/a/att610-103k +OLD_FILES+=usr/share/terminfo/a/att610-103k-w +OLD_FILES+=usr/share/terminfo/a/att610-w +OLD_FILES+=usr/share/terminfo/a/att615 +OLD_FILES+=usr/share/terminfo/a/att615-103k +OLD_FILES+=usr/share/terminfo/a/att615-103k-w +OLD_FILES+=usr/share/terminfo/a/att615-w +OLD_FILES+=usr/share/terminfo/a/att620 +OLD_FILES+=usr/share/terminfo/a/att620-103k +OLD_FILES+=usr/share/terminfo/a/att620-103k-w +OLD_FILES+=usr/share/terminfo/a/att620-w +OLD_FILES+=usr/share/terminfo/a/att630 +OLD_FILES+=usr/share/terminfo/a/att630-24 +OLD_FILES+=usr/share/terminfo/a/att6386 +OLD_FILES+=usr/share/terminfo/a/att700 +OLD_FILES+=usr/share/terminfo/a/att730 +OLD_FILES+=usr/share/terminfo/a/att730-24 +OLD_FILES+=usr/share/terminfo/a/att730-41 +OLD_FILES+=usr/share/terminfo/a/att7300 +OLD_FILES+=usr/share/terminfo/a/att730r +OLD_FILES+=usr/share/terminfo/a/att730r-24 +OLD_FILES+=usr/share/terminfo/a/att730r-41 +OLD_FILES+=usr/share/terminfo/a/avatar +OLD_FILES+=usr/share/terminfo/a/avatar0 +OLD_FILES+=usr/share/terminfo/a/avatar0+ +OLD_FILES+=usr/share/terminfo/a/avatar1 +OLD_FILES+=usr/share/terminfo/a/avt +OLD_FILES+=usr/share/terminfo/a/avt+s +OLD_FILES+=usr/share/terminfo/a/avt-ns +OLD_FILES+=usr/share/terminfo/a/avt-rv +OLD_FILES+=usr/share/terminfo/a/avt-rv-ns +OLD_FILES+=usr/share/terminfo/a/avt-rv-s +OLD_FILES+=usr/share/terminfo/a/avt-s +OLD_FILES+=usr/share/terminfo/a/avt-w +OLD_FILES+=usr/share/terminfo/a/avt-w-ns +OLD_FILES+=usr/share/terminfo/a/avt-w-rv +OLD_FILES+=usr/share/terminfo/a/avt-w-rv-ns +OLD_FILES+=usr/share/terminfo/a/avt-w-rv-s +OLD_FILES+=usr/share/terminfo/a/avt-w-s +OLD_FILES+=usr/share/terminfo/a/aws +OLD_FILES+=usr/share/terminfo/a/awsc +OLD_DIRS+=usr/share/terminfo/a/ +OLD_FILES+=usr/share/terminfo/b/b-128 +OLD_FILES+=usr/share/terminfo/b/bantam +OLD_FILES+=usr/share/terminfo/b/basic4 +OLD_FILES+=usr/share/terminfo/b/basis +OLD_FILES+=usr/share/terminfo/b/bct510a +OLD_FILES+=usr/share/terminfo/b/bct510d +OLD_FILES+=usr/share/terminfo/b/beacon +OLD_FILES+=usr/share/terminfo/b/bee +OLD_FILES+=usr/share/terminfo/b/beehive +OLD_FILES+=usr/share/terminfo/b/beehive3 +OLD_FILES+=usr/share/terminfo/b/beehive4 +OLD_FILES+=usr/share/terminfo/b/beehiveIIIm +OLD_FILES+=usr/share/terminfo/b/beterm +OLD_FILES+=usr/share/terminfo/b/bg1.25 +OLD_FILES+=usr/share/terminfo/b/bg1.25nv +OLD_FILES+=usr/share/terminfo/b/bg1.25rv +OLD_FILES+=usr/share/terminfo/b/bg2.0 +OLD_FILES+=usr/share/terminfo/b/bg2.0nv +OLD_FILES+=usr/share/terminfo/b/bg2.0rv +OLD_FILES+=usr/share/terminfo/b/bg3.10 +OLD_FILES+=usr/share/terminfo/b/bg3.10nv +OLD_FILES+=usr/share/terminfo/b/bg3.10rv +OLD_FILES+=usr/share/terminfo/b/bh3m +OLD_FILES+=usr/share/terminfo/b/bh4 +OLD_FILES+=usr/share/terminfo/b/bitgraph +OLD_FILES+=usr/share/terminfo/b/blit +OLD_FILES+=usr/share/terminfo/b/bobcat +OLD_FILES+=usr/share/terminfo/b/bq300 +OLD_FILES+=usr/share/terminfo/b/bq300-8 +OLD_FILES+=usr/share/terminfo/b/bq300-8-pc +OLD_FILES+=usr/share/terminfo/b/bq300-8-pc-rv +OLD_FILES+=usr/share/terminfo/b/bq300-8-pc-w +OLD_FILES+=usr/share/terminfo/b/bq300-8-pc-w-rv +OLD_FILES+=usr/share/terminfo/b/bq300-8rv +OLD_FILES+=usr/share/terminfo/b/bq300-8w +OLD_FILES+=usr/share/terminfo/b/bq300-pc +OLD_FILES+=usr/share/terminfo/b/bq300-pc-rv +OLD_FILES+=usr/share/terminfo/b/bq300-pc-w +OLD_FILES+=usr/share/terminfo/b/bq300-pc-w-rv +OLD_FILES+=usr/share/terminfo/b/bq300-rv +OLD_FILES+=usr/share/terminfo/b/bq300-w +OLD_FILES+=usr/share/terminfo/b/bq300-w-8rv +OLD_FILES+=usr/share/terminfo/b/bq300-w-rv +OLD_FILES+=usr/share/terminfo/b/bsdos-pc +OLD_FILES+=usr/share/terminfo/b/bsdos-pc-m +OLD_FILES+=usr/share/terminfo/b/bsdos-pc-mono +OLD_FILES+=usr/share/terminfo/b/bsdos-pc-nobold +OLD_FILES+=usr/share/terminfo/b/bsdos-ppc +OLD_FILES+=usr/share/terminfo/b/bsdos-sparc +OLD_FILES+=usr/share/terminfo/b/bterm +OLD_DIRS+=usr/share/terminfo/b/ +OLD_FILES+=usr/share/terminfo/c/c100 +OLD_FILES+=usr/share/terminfo/c/c100-1p +OLD_FILES+=usr/share/terminfo/c/c100-4p +OLD_FILES+=usr/share/terminfo/c/c100-rv +OLD_FILES+=usr/share/terminfo/c/c100-rv-4p +OLD_FILES+=usr/share/terminfo/c/c104 +OLD_FILES+=usr/share/terminfo/c/c108 +OLD_FILES+=usr/share/terminfo/c/c108-4p +OLD_FILES+=usr/share/terminfo/c/c108-8p +OLD_FILES+=usr/share/terminfo/c/c108-rv +OLD_FILES+=usr/share/terminfo/c/c108-rv-4p +OLD_FILES+=usr/share/terminfo/c/c108-rv-8p +OLD_FILES+=usr/share/terminfo/c/c108-w +OLD_FILES+=usr/share/terminfo/c/c108-w-8p +OLD_FILES+=usr/share/terminfo/c/c300 +OLD_FILES+=usr/share/terminfo/c/c301 +OLD_FILES+=usr/share/terminfo/c/c321 +OLD_FILES+=usr/share/terminfo/c/ca22851 +OLD_FILES+=usr/share/terminfo/c/cad68-2 +OLD_FILES+=usr/share/terminfo/c/cad68-3 +OLD_FILES+=usr/share/terminfo/c/cbblit +OLD_FILES+=usr/share/terminfo/c/cbunix +OLD_FILES+=usr/share/terminfo/c/cci +OLD_FILES+=usr/share/terminfo/c/cci1 +OLD_FILES+=usr/share/terminfo/c/cdc456 +OLD_FILES+=usr/share/terminfo/c/cdc721 +OLD_FILES+=usr/share/terminfo/c/cdc721-esc +OLD_FILES+=usr/share/terminfo/c/cdc721ll +OLD_FILES+=usr/share/terminfo/c/cdc752 +OLD_FILES+=usr/share/terminfo/c/cdc756 +OLD_FILES+=usr/share/terminfo/c/cg7900 +OLD_FILES+=usr/share/terminfo/c/cgc2 +OLD_FILES+=usr/share/terminfo/c/cgc3 +OLD_FILES+=usr/share/terminfo/c/chromatics +OLD_FILES+=usr/share/terminfo/c/ci8510 +OLD_FILES+=usr/share/terminfo/c/cit-80 +OLD_FILES+=usr/share/terminfo/c/cit101 +OLD_FILES+=usr/share/terminfo/c/cit101e +OLD_FILES+=usr/share/terminfo/c/cit101e-132 +OLD_FILES+=usr/share/terminfo/c/cit101e-n +OLD_FILES+=usr/share/terminfo/c/cit101e-n132 +OLD_FILES+=usr/share/terminfo/c/cit101e-rv +OLD_FILES+=usr/share/terminfo/c/cit500 +OLD_FILES+=usr/share/terminfo/c/cit80 +OLD_FILES+=usr/share/terminfo/c/citc +OLD_FILES+=usr/share/terminfo/c/citoh +OLD_FILES+=usr/share/terminfo/c/citoh-6lpi +OLD_FILES+=usr/share/terminfo/c/citoh-8lpi +OLD_FILES+=usr/share/terminfo/c/citoh-comp +OLD_FILES+=usr/share/terminfo/c/citoh-elite +OLD_FILES+=usr/share/terminfo/c/citoh-pica +OLD_FILES+=usr/share/terminfo/c/citoh-prop +OLD_FILES+=usr/share/terminfo/c/citoh-ps +OLD_FILES+=usr/share/terminfo/c/coco3 +OLD_FILES+=usr/share/terminfo/c/coherent +OLD_FILES+=usr/share/terminfo/c/color_xterm +OLD_FILES+=usr/share/terminfo/c/colorscan +OLD_FILES+=usr/share/terminfo/c/commodore +OLD_FILES+=usr/share/terminfo/c/concept +OLD_FILES+=usr/share/terminfo/c/concept-avt +OLD_FILES+=usr/share/terminfo/c/concept100 +OLD_FILES+=usr/share/terminfo/c/concept100-rv +OLD_FILES+=usr/share/terminfo/c/concept108 +OLD_FILES+=usr/share/terminfo/c/concept108-4p +OLD_FILES+=usr/share/terminfo/c/concept108-8p +OLD_FILES+=usr/share/terminfo/c/concept108-w-8 +OLD_FILES+=usr/share/terminfo/c/concept108-w8p +OLD_FILES+=usr/share/terminfo/c/concept108rv4p +OLD_FILES+=usr/share/terminfo/c/cons25 +OLD_FILES+=usr/share/terminfo/c/cons25-debian +OLD_FILES+=usr/share/terminfo/c/cons25-iso-m +OLD_FILES+=usr/share/terminfo/c/cons25-iso8859 +OLD_FILES+=usr/share/terminfo/c/cons25-koi8-r +OLD_FILES+=usr/share/terminfo/c/cons25-koi8r-m +OLD_FILES+=usr/share/terminfo/c/cons25-m +OLD_FILES+=usr/share/terminfo/c/cons25l1 +OLD_FILES+=usr/share/terminfo/c/cons25l1-m +OLD_FILES+=usr/share/terminfo/c/cons25r +OLD_FILES+=usr/share/terminfo/c/cons25r-m +OLD_FILES+=usr/share/terminfo/c/cons25w +OLD_FILES+=usr/share/terminfo/c/cons30 +OLD_FILES+=usr/share/terminfo/c/cons30-m +OLD_FILES+=usr/share/terminfo/c/cons43 +OLD_FILES+=usr/share/terminfo/c/cons43-m +OLD_FILES+=usr/share/terminfo/c/cons50 +OLD_FILES+=usr/share/terminfo/c/cons50-iso-m +OLD_FILES+=usr/share/terminfo/c/cons50-iso8859 +OLD_FILES+=usr/share/terminfo/c/cons50-koi8r +OLD_FILES+=usr/share/terminfo/c/cons50-koi8r-m +OLD_FILES+=usr/share/terminfo/c/cons50-m +OLD_FILES+=usr/share/terminfo/c/cons50l1 +OLD_FILES+=usr/share/terminfo/c/cons50l1-m +OLD_FILES+=usr/share/terminfo/c/cons50r +OLD_FILES+=usr/share/terminfo/c/cons50r-m +OLD_FILES+=usr/share/terminfo/c/cons60 +OLD_FILES+=usr/share/terminfo/c/cons60-iso +OLD_FILES+=usr/share/terminfo/c/cons60-iso-m +OLD_FILES+=usr/share/terminfo/c/cons60-koi8r +OLD_FILES+=usr/share/terminfo/c/cons60-koi8r-m +OLD_FILES+=usr/share/terminfo/c/cons60-m +OLD_FILES+=usr/share/terminfo/c/cons60l1 +OLD_FILES+=usr/share/terminfo/c/cons60l1-m +OLD_FILES+=usr/share/terminfo/c/cons60r +OLD_FILES+=usr/share/terminfo/c/cons60r-m +OLD_FILES+=usr/share/terminfo/c/contel300 +OLD_FILES+=usr/share/terminfo/c/contel301 +OLD_FILES+=usr/share/terminfo/c/contel320 +OLD_FILES+=usr/share/terminfo/c/contel321 +OLD_FILES+=usr/share/terminfo/c/cops +OLD_FILES+=usr/share/terminfo/c/cops-10 +OLD_FILES+=usr/share/terminfo/c/cops10 +OLD_FILES+=usr/share/terminfo/c/crt +OLD_FILES+=usr/share/terminfo/c/crt-vt220 +OLD_FILES+=usr/share/terminfo/c/cs10 +OLD_FILES+=usr/share/terminfo/c/cs10-w +OLD_FILES+=usr/share/terminfo/c/ct82 +OLD_FILES+=usr/share/terminfo/c/ct8500 +OLD_FILES+=usr/share/terminfo/c/ctrm +OLD_FILES+=usr/share/terminfo/c/cx +OLD_FILES+=usr/share/terminfo/c/cx100 +OLD_FILES+=usr/share/terminfo/c/cyb110 +OLD_FILES+=usr/share/terminfo/c/cyb83 +OLD_FILES+=usr/share/terminfo/c/cygwin +OLD_FILES+=usr/share/terminfo/c/cygwinB19 +OLD_FILES+=usr/share/terminfo/c/cygwinDBG +OLD_DIRS+=usr/share/terminfo/c/ +OLD_FILES+=usr/share/terminfo/d/d132 +OLD_FILES+=usr/share/terminfo/d/d2 +OLD_FILES+=usr/share/terminfo/d/d2-dg +OLD_FILES+=usr/share/terminfo/d/d200 +OLD_FILES+=usr/share/terminfo/d/d200-dg +OLD_FILES+=usr/share/terminfo/d/d210 +OLD_FILES+=usr/share/terminfo/d/d210-dg +OLD_FILES+=usr/share/terminfo/d/d211 +OLD_FILES+=usr/share/terminfo/d/d211-7b +OLD_FILES+=usr/share/terminfo/d/d211-dg +OLD_FILES+=usr/share/terminfo/d/d214 +OLD_FILES+=usr/share/terminfo/d/d214-dg +OLD_FILES+=usr/share/terminfo/d/d215 +OLD_FILES+=usr/share/terminfo/d/d215-7b +OLD_FILES+=usr/share/terminfo/d/d215-dg +OLD_FILES+=usr/share/terminfo/d/d216+ +OLD_FILES+=usr/share/terminfo/d/d216+25 +OLD_FILES+=usr/share/terminfo/d/d216+dg +OLD_FILES+=usr/share/terminfo/d/d216-dg +OLD_FILES+=usr/share/terminfo/d/d216-unix +OLD_FILES+=usr/share/terminfo/d/d216-unix-25 +OLD_FILES+=usr/share/terminfo/d/d216e+ +OLD_FILES+=usr/share/terminfo/d/d216e+dg +OLD_FILES+=usr/share/terminfo/d/d216e-dg +OLD_FILES+=usr/share/terminfo/d/d216e-unix +OLD_FILES+=usr/share/terminfo/d/d217-dg +OLD_FILES+=usr/share/terminfo/d/d217-unix +OLD_FILES+=usr/share/terminfo/d/d217-unix-25 +OLD_FILES+=usr/share/terminfo/d/d220 +OLD_FILES+=usr/share/terminfo/d/d220-7b +OLD_FILES+=usr/share/terminfo/d/d220-dg +OLD_FILES+=usr/share/terminfo/d/d230 +OLD_FILES+=usr/share/terminfo/d/d230-dg +OLD_FILES+=usr/share/terminfo/d/d230c +OLD_FILES+=usr/share/terminfo/d/d230c-dg +OLD_FILES+=usr/share/terminfo/d/d400 +OLD_FILES+=usr/share/terminfo/d/d400-dg +OLD_FILES+=usr/share/terminfo/d/d410 +OLD_FILES+=usr/share/terminfo/d/d410-7b +OLD_FILES+=usr/share/terminfo/d/d410-7b-w +OLD_FILES+=usr/share/terminfo/d/d410-dg +OLD_FILES+=usr/share/terminfo/d/d410-w +OLD_FILES+=usr/share/terminfo/d/d411 +OLD_FILES+=usr/share/terminfo/d/d411-7b +OLD_FILES+=usr/share/terminfo/d/d411-7b-w +OLD_FILES+=usr/share/terminfo/d/d411-dg +OLD_FILES+=usr/share/terminfo/d/d411-w +OLD_FILES+=usr/share/terminfo/d/d412+ +OLD_FILES+=usr/share/terminfo/d/d412+25 +OLD_FILES+=usr/share/terminfo/d/d412+dg +OLD_FILES+=usr/share/terminfo/d/d412+s +OLD_FILES+=usr/share/terminfo/d/d412+sr +OLD_FILES+=usr/share/terminfo/d/d412+w +OLD_FILES+=usr/share/terminfo/d/d412-dg +OLD_FILES+=usr/share/terminfo/d/d412-unix +OLD_FILES+=usr/share/terminfo/d/d412-unix-25 +OLD_FILES+=usr/share/terminfo/d/d412-unix-s +OLD_FILES+=usr/share/terminfo/d/d412-unix-sr +OLD_FILES+=usr/share/terminfo/d/d412-unix-w +OLD_FILES+=usr/share/terminfo/d/d413-dg +OLD_FILES+=usr/share/terminfo/d/d413-unix +OLD_FILES+=usr/share/terminfo/d/d413-unix-25 +OLD_FILES+=usr/share/terminfo/d/d413-unix-s +OLD_FILES+=usr/share/terminfo/d/d413-unix-sr +OLD_FILES+=usr/share/terminfo/d/d413-unix-w +OLD_FILES+=usr/share/terminfo/d/d414-unix +OLD_FILES+=usr/share/terminfo/d/d414-unix-25 +OLD_FILES+=usr/share/terminfo/d/d414-unix-s +OLD_FILES+=usr/share/terminfo/d/d414-unix-sr +OLD_FILES+=usr/share/terminfo/d/d414-unix-w +OLD_FILES+=usr/share/terminfo/d/d430-dg +OLD_FILES+=usr/share/terminfo/d/d430-dg-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix +OLD_FILES+=usr/share/terminfo/d/d430-unix-25 +OLD_FILES+=usr/share/terminfo/d/d430-unix-25-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix-s +OLD_FILES+=usr/share/terminfo/d/d430-unix-s-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix-sr +OLD_FILES+=usr/share/terminfo/d/d430-unix-sr-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix-w +OLD_FILES+=usr/share/terminfo/d/d430-unix-w-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-dg +OLD_FILES+=usr/share/terminfo/d/d430c-dg-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix +OLD_FILES+=usr/share/terminfo/d/d430c-unix-25 +OLD_FILES+=usr/share/terminfo/d/d430c-unix-25-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix-s +OLD_FILES+=usr/share/terminfo/d/d430c-unix-s-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix-sr +OLD_FILES+=usr/share/terminfo/d/d430c-unix-sr-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix-w +OLD_FILES+=usr/share/terminfo/d/d430c-unix-w-ccc +OLD_FILES+=usr/share/terminfo/d/d450 +OLD_FILES+=usr/share/terminfo/d/d450-dg +OLD_FILES+=usr/share/terminfo/d/d460 +OLD_FILES+=usr/share/terminfo/d/d460-7b +OLD_FILES+=usr/share/terminfo/d/d460-7b-w +OLD_FILES+=usr/share/terminfo/d/d460-dg +OLD_FILES+=usr/share/terminfo/d/d460-w +OLD_FILES+=usr/share/terminfo/d/d461 +OLD_FILES+=usr/share/terminfo/d/d461-7b +OLD_FILES+=usr/share/terminfo/d/d461-7b-w +OLD_FILES+=usr/share/terminfo/d/d461-dg +OLD_FILES+=usr/share/terminfo/d/d461-w +OLD_FILES+=usr/share/terminfo/d/d462+ +OLD_FILES+=usr/share/terminfo/d/d462+25 +OLD_FILES+=usr/share/terminfo/d/d462+dg +OLD_FILES+=usr/share/terminfo/d/d462+s +OLD_FILES+=usr/share/terminfo/d/d462+sr +OLD_FILES+=usr/share/terminfo/d/d462+w +OLD_FILES+=usr/share/terminfo/d/d462-dg +OLD_FILES+=usr/share/terminfo/d/d462-unix +OLD_FILES+=usr/share/terminfo/d/d462-unix-25 +OLD_FILES+=usr/share/terminfo/d/d462-unix-s +OLD_FILES+=usr/share/terminfo/d/d462-unix-sr +OLD_FILES+=usr/share/terminfo/d/d462-unix-w +OLD_FILES+=usr/share/terminfo/d/d462e-dg +OLD_FILES+=usr/share/terminfo/d/d463-dg +OLD_FILES+=usr/share/terminfo/d/d463-unix +OLD_FILES+=usr/share/terminfo/d/d463-unix-25 +OLD_FILES+=usr/share/terminfo/d/d463-unix-s +OLD_FILES+=usr/share/terminfo/d/d463-unix-sr +OLD_FILES+=usr/share/terminfo/d/d463-unix-w +OLD_FILES+=usr/share/terminfo/d/d464-unix +OLD_FILES+=usr/share/terminfo/d/d464-unix-25 +OLD_FILES+=usr/share/terminfo/d/d464-unix-s +OLD_FILES+=usr/share/terminfo/d/d464-unix-sr +OLD_FILES+=usr/share/terminfo/d/d464-unix-w +OLD_FILES+=usr/share/terminfo/d/d470 +OLD_FILES+=usr/share/terminfo/d/d470-7b +OLD_FILES+=usr/share/terminfo/d/d470-dg +OLD_FILES+=usr/share/terminfo/d/d470c +OLD_FILES+=usr/share/terminfo/d/d470c-7b +OLD_FILES+=usr/share/terminfo/d/d470c-dg +OLD_FILES+=usr/share/terminfo/d/d555 +OLD_FILES+=usr/share/terminfo/d/d555-7b +OLD_FILES+=usr/share/terminfo/d/d555-7b-w +OLD_FILES+=usr/share/terminfo/d/d555-dg +OLD_FILES+=usr/share/terminfo/d/d555-w +OLD_FILES+=usr/share/terminfo/d/d577 +OLD_FILES+=usr/share/terminfo/d/d577-7b +OLD_FILES+=usr/share/terminfo/d/d577-7b-w +OLD_FILES+=usr/share/terminfo/d/d577-dg +OLD_FILES+=usr/share/terminfo/d/d577-w +OLD_FILES+=usr/share/terminfo/d/d578 +OLD_FILES+=usr/share/terminfo/d/d578-7b +OLD_FILES+=usr/share/terminfo/d/d578-dg +OLD_FILES+=usr/share/terminfo/d/d80 +OLD_FILES+=usr/share/terminfo/d/d800 +OLD_FILES+=usr/share/terminfo/d/darwin +OLD_FILES+=usr/share/terminfo/d/darwin-100x37 +OLD_FILES+=usr/share/terminfo/d/darwin-100x37-m +OLD_FILES+=usr/share/terminfo/d/darwin-112x37 +OLD_FILES+=usr/share/terminfo/d/darwin-112x37-m +OLD_FILES+=usr/share/terminfo/d/darwin-128x40 +OLD_FILES+=usr/share/terminfo/d/darwin-128x40-m +OLD_FILES+=usr/share/terminfo/d/darwin-128x48 +OLD_FILES+=usr/share/terminfo/d/darwin-128x48-m +OLD_FILES+=usr/share/terminfo/d/darwin-144x48 +OLD_FILES+=usr/share/terminfo/d/darwin-144x48-m +OLD_FILES+=usr/share/terminfo/d/darwin-160x64 +OLD_FILES+=usr/share/terminfo/d/darwin-160x64-m +OLD_FILES+=usr/share/terminfo/d/darwin-200x64 +OLD_FILES+=usr/share/terminfo/d/darwin-200x64-m +OLD_FILES+=usr/share/terminfo/d/darwin-200x75 +OLD_FILES+=usr/share/terminfo/d/darwin-200x75-m +OLD_FILES+=usr/share/terminfo/d/darwin-256x96 +OLD_FILES+=usr/share/terminfo/d/darwin-256x96-m +OLD_FILES+=usr/share/terminfo/d/darwin-80x25 +OLD_FILES+=usr/share/terminfo/d/darwin-80x25-m +OLD_FILES+=usr/share/terminfo/d/darwin-80x30 +OLD_FILES+=usr/share/terminfo/d/darwin-80x30-m +OLD_FILES+=usr/share/terminfo/d/darwin-90x30 +OLD_FILES+=usr/share/terminfo/d/darwin-90x30-m +OLD_FILES+=usr/share/terminfo/d/darwin-b +OLD_FILES+=usr/share/terminfo/d/darwin-f +OLD_FILES+=usr/share/terminfo/d/darwin-f2 +OLD_FILES+=usr/share/terminfo/d/darwin-m +OLD_FILES+=usr/share/terminfo/d/darwin-m-b +OLD_FILES+=usr/share/terminfo/d/darwin-m-f +OLD_FILES+=usr/share/terminfo/d/darwin-m-f2 +OLD_FILES+=usr/share/terminfo/d/datagraphix +OLD_FILES+=usr/share/terminfo/d/datamedia2500 +OLD_FILES+=usr/share/terminfo/d/datapoint +OLD_FILES+=usr/share/terminfo/d/dataspeed40 +OLD_FILES+=usr/share/terminfo/d/dd5000 +OLD_FILES+=usr/share/terminfo/d/ddr +OLD_FILES+=usr/share/terminfo/d/ddr3180 +OLD_FILES+=usr/share/terminfo/d/dec+pp +OLD_FILES+=usr/share/terminfo/d/dec+sl +OLD_FILES+=usr/share/terminfo/d/dec-vt100 +OLD_FILES+=usr/share/terminfo/d/dec-vt220 +OLD_FILES+=usr/share/terminfo/d/dec-vt330 +OLD_FILES+=usr/share/terminfo/d/dec-vt340 +OLD_FILES+=usr/share/terminfo/d/dec-vt400 +OLD_FILES+=usr/share/terminfo/d/decansi +OLD_FILES+=usr/share/terminfo/d/decpro +OLD_FILES+=usr/share/terminfo/d/decwriter +OLD_FILES+=usr/share/terminfo/d/delta +OLD_FILES+=usr/share/terminfo/d/dg+ccc +OLD_FILES+=usr/share/terminfo/d/dg+color +OLD_FILES+=usr/share/terminfo/d/dg+color8 +OLD_FILES+=usr/share/terminfo/d/dg+fixed +OLD_FILES+=usr/share/terminfo/d/dg-ansi +OLD_FILES+=usr/share/terminfo/d/dg-generic +OLD_FILES+=usr/share/terminfo/d/dg100 +OLD_FILES+=usr/share/terminfo/d/dg200 +OLD_FILES+=usr/share/terminfo/d/dg210 +OLD_FILES+=usr/share/terminfo/d/dg211 +OLD_FILES+=usr/share/terminfo/d/dg450 +OLD_FILES+=usr/share/terminfo/d/dg460-ansi +OLD_FILES+=usr/share/terminfo/d/dg6053 +OLD_FILES+=usr/share/terminfo/d/dg6053-old +OLD_FILES+=usr/share/terminfo/d/dg605x +OLD_FILES+=usr/share/terminfo/d/dg6134 +OLD_FILES+=usr/share/terminfo/d/dgkeys+11 +OLD_FILES+=usr/share/terminfo/d/dgkeys+15 +OLD_FILES+=usr/share/terminfo/d/dgkeys+7b +OLD_FILES+=usr/share/terminfo/d/dgkeys+8b +OLD_FILES+=usr/share/terminfo/d/dgmode+color +OLD_FILES+=usr/share/terminfo/d/dgmode+color8 +OLD_FILES+=usr/share/terminfo/d/dgunix+ccc +OLD_FILES+=usr/share/terminfo/d/dgunix+fixed +OLD_FILES+=usr/share/terminfo/d/diablo +OLD_FILES+=usr/share/terminfo/d/diablo-lm +OLD_FILES+=usr/share/terminfo/d/diablo1620 +OLD_FILES+=usr/share/terminfo/d/diablo1620-m8 +OLD_FILES+=usr/share/terminfo/d/diablo1640 +OLD_FILES+=usr/share/terminfo/d/diablo1640-lm +OLD_FILES+=usr/share/terminfo/d/diablo1640-m8 +OLD_FILES+=usr/share/terminfo/d/diablo1720 +OLD_FILES+=usr/share/terminfo/d/diablo1730 +OLD_FILES+=usr/share/terminfo/d/diablo1740 +OLD_FILES+=usr/share/terminfo/d/diablo1740-lm +OLD_FILES+=usr/share/terminfo/d/diablo450 +OLD_FILES+=usr/share/terminfo/d/diablo630 +OLD_FILES+=usr/share/terminfo/d/dialogue +OLD_FILES+=usr/share/terminfo/d/dialogue80 +OLD_FILES+=usr/share/terminfo/d/digilog +OLD_FILES+=usr/share/terminfo/d/djgpp +OLD_FILES+=usr/share/terminfo/d/djgpp203 +OLD_FILES+=usr/share/terminfo/d/djgpp204 +OLD_FILES+=usr/share/terminfo/d/dku7003 +OLD_FILES+=usr/share/terminfo/d/dku7003-dumb +OLD_FILES+=usr/share/terminfo/d/dku7102 +OLD_FILES+=usr/share/terminfo/d/dku7102-old +OLD_FILES+=usr/share/terminfo/d/dku7102-sna +OLD_FILES+=usr/share/terminfo/d/dku7103-sna +OLD_FILES+=usr/share/terminfo/d/dku7202 +OLD_FILES+=usr/share/terminfo/d/dm1520 +OLD_FILES+=usr/share/terminfo/d/dm1521 +OLD_FILES+=usr/share/terminfo/d/dm2500 +OLD_FILES+=usr/share/terminfo/d/dm3025 +OLD_FILES+=usr/share/terminfo/d/dm3045 +OLD_FILES+=usr/share/terminfo/d/dm80 +OLD_FILES+=usr/share/terminfo/d/dm80w +OLD_FILES+=usr/share/terminfo/d/dmchat +OLD_FILES+=usr/share/terminfo/d/dmd +OLD_FILES+=usr/share/terminfo/d/dmd-24 +OLD_FILES+=usr/share/terminfo/d/dmd-34 +OLD_FILES+=usr/share/terminfo/d/dmd1 +OLD_FILES+=usr/share/terminfo/d/dmdt80 +OLD_FILES+=usr/share/terminfo/d/dmdt80w +OLD_FILES+=usr/share/terminfo/d/dmterm +OLD_FILES+=usr/share/terminfo/d/domterm +OLD_FILES+=usr/share/terminfo/d/dp3360 +OLD_FILES+=usr/share/terminfo/d/dp8242 +OLD_FILES+=usr/share/terminfo/d/ds40 +OLD_FILES+=usr/share/terminfo/d/ds40-2 +OLD_FILES+=usr/share/terminfo/d/dt-100 +OLD_FILES+=usr/share/terminfo/d/dt-100w +OLD_FILES+=usr/share/terminfo/d/dt100 +OLD_FILES+=usr/share/terminfo/d/dt100w +OLD_FILES+=usr/share/terminfo/d/dt110 +OLD_FILES+=usr/share/terminfo/d/dt80 +OLD_FILES+=usr/share/terminfo/d/dt80-sas +OLD_FILES+=usr/share/terminfo/d/dt80w +OLD_FILES+=usr/share/terminfo/d/dtc300s +OLD_FILES+=usr/share/terminfo/d/dtc382 +OLD_FILES+=usr/share/terminfo/d/dtterm +OLD_FILES+=usr/share/terminfo/d/dumb +OLD_FILES+=usr/share/terminfo/d/dumb-emacs-ansi +OLD_FILES+=usr/share/terminfo/d/dvtm +OLD_FILES+=usr/share/terminfo/d/dvtm-256color +OLD_FILES+=usr/share/terminfo/d/dw +OLD_FILES+=usr/share/terminfo/d/dw1 +OLD_FILES+=usr/share/terminfo/d/dw2 +OLD_FILES+=usr/share/terminfo/d/dw3 +OLD_FILES+=usr/share/terminfo/d/dw4 +OLD_FILES+=usr/share/terminfo/d/dwk +OLD_FILES+=usr/share/terminfo/d/dwk-vt +OLD_DIRS+=usr/share/terminfo/d/ +OLD_FILES+=usr/share/terminfo/e/ecma+color +OLD_FILES+=usr/share/terminfo/e/ecma+index +OLD_FILES+=usr/share/terminfo/e/ecma+italics +OLD_FILES+=usr/share/terminfo/e/ecma+sgr +OLD_FILES+=usr/share/terminfo/e/ecma+strikeout +OLD_FILES+=usr/share/terminfo/e/elks +OLD_FILES+=usr/share/terminfo/e/elks-ansi +OLD_FILES+=usr/share/terminfo/e/elks-glasstty +OLD_FILES+=usr/share/terminfo/e/elks-vt52 +OLD_FILES+=usr/share/terminfo/e/emots +OLD_FILES+=usr/share/terminfo/e/emu +OLD_FILES+=usr/share/terminfo/e/emu-220 +OLD_FILES+=usr/share/terminfo/e/emx-base +OLD_FILES+=usr/share/terminfo/e/env230 +OLD_FILES+=usr/share/terminfo/e/envision230 +OLD_FILES+=usr/share/terminfo/e/ep40 +OLD_FILES+=usr/share/terminfo/e/ep4000 +OLD_FILES+=usr/share/terminfo/e/ep4080 +OLD_FILES+=usr/share/terminfo/e/ep48 +OLD_FILES+=usr/share/terminfo/e/ergo4000 +OLD_FILES+=usr/share/terminfo/e/esprit +OLD_FILES+=usr/share/terminfo/e/esprit-am +OLD_FILES+=usr/share/terminfo/e/eterm +OLD_FILES+=usr/share/terminfo/e/eterm-color +OLD_FILES+=usr/share/terminfo/e/ex155 +OLD_FILES+=usr/share/terminfo/e/excel62 +OLD_FILES+=usr/share/terminfo/e/excel62-rv +OLD_FILES+=usr/share/terminfo/e/excel62-w +OLD_FILES+=usr/share/terminfo/e/excel64 +OLD_FILES+=usr/share/terminfo/e/excel64-rv +OLD_FILES+=usr/share/terminfo/e/excel64-w +OLD_FILES+=usr/share/terminfo/e/exec80 +OLD_DIRS+=usr/share/terminfo/e/ +OLD_FILES+=usr/share/terminfo/f/f100 +OLD_FILES+=usr/share/terminfo/f/f100-rv +OLD_FILES+=usr/share/terminfo/f/f110 +OLD_FILES+=usr/share/terminfo/f/f110-14 +OLD_FILES+=usr/share/terminfo/f/f110-14w +OLD_FILES+=usr/share/terminfo/f/f110-w +OLD_FILES+=usr/share/terminfo/f/f1720 +OLD_FILES+=usr/share/terminfo/f/f1720a +OLD_FILES+=usr/share/terminfo/f/f200 +OLD_FILES+=usr/share/terminfo/f/f200-w +OLD_FILES+=usr/share/terminfo/f/f200vi +OLD_FILES+=usr/share/terminfo/f/f200vi-w +OLD_FILES+=usr/share/terminfo/f/falco +OLD_FILES+=usr/share/terminfo/f/falco-p +OLD_FILES+=usr/share/terminfo/f/fbterm +OLD_FILES+=usr/share/terminfo/f/fenix +OLD_FILES+=usr/share/terminfo/f/fenixw +OLD_FILES+=usr/share/terminfo/f/fixterm +OLD_FILES+=usr/share/terminfo/f/fortune +OLD_FILES+=usr/share/terminfo/f/fos +OLD_FILES+=usr/share/terminfo/f/fox +OLD_FILES+=usr/share/terminfo/f/freedom +OLD_FILES+=usr/share/terminfo/f/freedom-rv +OLD_FILES+=usr/share/terminfo/f/freedom100 +OLD_FILES+=usr/share/terminfo/f/freedom110 +OLD_FILES+=usr/share/terminfo/f/freedom200 +OLD_DIRS+=usr/share/terminfo/f/ +OLD_FILES+=usr/share/terminfo/g/gator +OLD_FILES+=usr/share/terminfo/g/gator-52 +OLD_FILES+=usr/share/terminfo/g/gator-52t +OLD_FILES+=usr/share/terminfo/g/gator-t +OLD_FILES+=usr/share/terminfo/g/gigi +OLD_FILES+=usr/share/terminfo/g/glasstty +OLD_FILES+=usr/share/terminfo/g/gnome +OLD_FILES+=usr/share/terminfo/g/gnome+pcfkeys +OLD_FILES+=usr/share/terminfo/g/gnome-2007 +OLD_FILES+=usr/share/terminfo/g/gnome-2008 +OLD_FILES+=usr/share/terminfo/g/gnome-2012 +OLD_FILES+=usr/share/terminfo/g/gnome-256color +OLD_FILES+=usr/share/terminfo/g/gnome-fc5 +OLD_FILES+=usr/share/terminfo/g/gnome-rh62 +OLD_FILES+=usr/share/terminfo/g/gnome-rh72 +OLD_FILES+=usr/share/terminfo/g/gnome-rh80 +OLD_FILES+=usr/share/terminfo/g/gnome-rh90 +OLD_FILES+=usr/share/terminfo/g/go-225 +OLD_FILES+=usr/share/terminfo/g/go140 +OLD_FILES+=usr/share/terminfo/g/go140w +OLD_FILES+=usr/share/terminfo/g/go225 +OLD_FILES+=usr/share/terminfo/g/graphos *** 1863 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Mar 18 10:55:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 108655B72AE; Thu, 18 Mar 2021 10:55:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1P7q6zMZz3H1q; Thu, 18 Mar 2021 10:55:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE3B5206CC; Thu, 18 Mar 2021 10:55:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IAtZgQ037710; Thu, 18 Mar 2021 10:55:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IAtZ3I037709; Thu, 18 Mar 2021 10:55:35 GMT (envelope-from git) Date: Thu, 18 Mar 2021 10:55:35 GMT Message-Id: <202103181055.12IAtZ3I037709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0209400ceaed - main - termios: add more speeds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0209400ceaed553a3f06a5f3759de992ddb58037 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 10:55:36 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0209400ceaed553a3f06a5f3759de992ddb58037 commit 0209400ceaed553a3f06a5f3759de992ddb58037 Author: Bjoern A. Zeeb AuthorDate: 2021-03-10 22:17:07 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-18 10:44:01 +0000 termios: add more speeds A lot of small arm64 gadgets are using 1500000 as console speed. While cu can perfectly deal with this some 3rd party software, e.g., comms/conserver-con add speeds based on B being defined. Having it defined here simplifies enhancing other software. Obtained-from: NetBSD sys/sys/termios.h 1.36 MFC-after: 2 weeks Reviewed-by: philip (,okayed by imp) Differential Revision: https://reviews.freebsd.org/D29209 --- sys/sys/_termios.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/sys/_termios.h b/sys/sys/_termios.h index edbda0a161fc..b9fe17881b3a 100644 --- a/sys/sys/_termios.h +++ b/sys/sys/_termios.h @@ -208,7 +208,15 @@ #define B115200 115200 #define B230400 230400 #define B460800 460800 +#define B500000 500000 #define B921600 921600 +#define B1000000 1000000U +#define B1500000 1500000U +#define B2000000 2000000U +#define B2500000 2500000U +#define B3000000 3000000U +#define B3500000 3500000U +#define B4000000 4000000U #define EXTA 19200 #define EXTB 38400 #endif From owner-dev-commits-src-main@freebsd.org Thu Mar 18 11:06:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15F3C5B7E44; Thu, 18 Mar 2021 11:06:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1PMy05NPz3HcH; Thu, 18 Mar 2021 11:06:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB93220B7E; Thu, 18 Mar 2021 11:06:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IB65Wj051555; Thu, 18 Mar 2021 11:06:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IB65dV051554; Thu, 18 Mar 2021 11:06:05 GMT (envelope-from git) Date: Thu, 18 Mar 2021 11:06:05 GMT Message-Id: <202103181106.12IB65dV051554@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0c7b75f12840 - main - LinuxKPI: add support for crc32_le() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c7b75f12840a31206ae24acca1f5ee35c8e341d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 11:06:06 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0c7b75f12840a31206ae24acca1f5ee35c8e341d commit 0c7b75f12840a31206ae24acca1f5ee35c8e341d Author: Bjoern A. Zeeb AuthorDate: 2021-03-10 15:01:10 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-18 10:56:22 +0000 LinuxKPI: add support for crc32_le() Add support for crc32_le() as a wrapper around crc32_raw(). Sponsored-by: The FreeBSD Foundation Obtained-from: bz_iwlwifi MFC-after: 2 weeks Reviewed-by: hselasky Differential Revision: https://reviews.freebsd.org/D29187 --- sys/compat/linuxkpi/common/include/linux/crc32.h | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/crc32.h b/sys/compat/linuxkpi/common/include/linux/crc32.h new file mode 100644 index 000000000000..6d43eb7b1859 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/crc32.h @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_CRC32_H +#define __LKPI_LINUX_CRC32_H + +#include + +static __inline uint32_t +crc32_le(uint32_t crc, const void *data, size_t len) +{ + + return (crc32_raw(data, len, crc)); +} + +#endif /* __LKPI_LINUX_CRC32_H */ From owner-dev-commits-src-main@freebsd.org Thu Mar 18 11:16:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BA095704A0; Thu, 18 Mar 2021 11:16:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1PbT1jrwz3JRg; Thu, 18 Mar 2021 11:16:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2843220879; Thu, 18 Mar 2021 11:16:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IBG59E064424; Thu, 18 Mar 2021 11:16:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IBG5FC064423; Thu, 18 Mar 2021 11:16:05 GMT (envelope-from git) Date: Thu, 18 Mar 2021 11:16:05 GMT Message-Id: <202103181116.12IBG5FC064423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: c338cf2c6d5e - main - net80211: split up ieee80211_probereq() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c338cf2c6d5eacdee813191d5976aa531d450ee7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 11:16:05 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c338cf2c6d5eacdee813191d5976aa531d450ee7 commit c338cf2c6d5eacdee813191d5976aa531d450ee7 Author: Bjoern A. Zeeb AuthorDate: 2021-03-06 21:05:43 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-18 11:02:45 +0000 net80211: split up ieee80211_probereq() Factor out ieee80211_probereq_ie() and ieee80211_probereq_ie_len() and make the length dynamic rather than static max. The latter is needed as our current fixed length was longer than some "hw scan", e.g. that of ath10k, will take. This way we can pass what we have. Should this not be sufficient in the future we might have to deal with filtering and much more error handling. This also removes a duplicate calculation for ieee80211_ie_wpa [1]. Repoprted-by: Martin Husemann [1] Sponsored-by: Rubicon Communications, LLC ("Netgate") Sponsored-by: The FreeBSD Foundation (update for alloc) Reviewed-by: adrian, martin NetBSD.org (earlier version) Reviewed-by: philip MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26545 --- sys/net80211/ieee80211_output.c | 171 +++++++++++++++++++++++++++------------- sys/net80211/ieee80211_proto.h | 2 + 2 files changed, 117 insertions(+), 56 deletions(-) diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index b67302b8d66f..07f7349461ac 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -2414,80 +2414,76 @@ ieee80211_add_qos(uint8_t *frm, const struct ieee80211_node *ni) } /* - * Send a probe request frame with the specified ssid - * and any optional information element data. + * ieee80211_send_probereq(): send a probe request frame with the specified ssid + * and any optional information element data; some helper functions as FW based + * HW scans need some of that information passed too. */ -int -ieee80211_send_probereq(struct ieee80211_node *ni, - const uint8_t sa[IEEE80211_ADDR_LEN], - const uint8_t da[IEEE80211_ADDR_LEN], - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t *ssid, size_t ssidlen) +static uint32_t +ieee80211_probereq_ie_len(struct ieee80211vap *vap, struct ieee80211com *ic) { - struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211com *ic = ni->ni_ic; - struct ieee80211_node *bss; - const struct ieee80211_txparam *tp; - struct ieee80211_bpf_params params; const struct ieee80211_rateset *rs; - struct mbuf *m; - uint8_t *frm; - int ret; - - bss = ieee80211_ref_node(vap->iv_bss); - if (vap->iv_state == IEEE80211_S_CAC) { - IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, - "block %s frame in CAC state", "probe request"); - vap->iv_stats.is_tx_badstate++; - ieee80211_free_node(bss); - return EIO; /* XXX */ - } - - /* - * Hold a reference on the node so it doesn't go away until after - * the xmit is complete all the way in the driver. On error we - * will remove our reference. - */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", - __func__, __LINE__, - ni, ether_sprintf(ni->ni_macaddr), - ieee80211_node_refcnt(ni)+1); - ieee80211_ref_node(ni); + rs = ieee80211_get_suprates(ic, ic->ic_curchan); /* * prreq frame format * [tlv] ssid * [tlv] supported rates * [tlv] RSN (optional) - * [tlv] extended supported rates + * [tlv] extended supported rates (if needed) * [tlv] HT cap (optional) * [tlv] VHT cap (optional) * [tlv] WPA (optional) * [tlv] user-specified ie's */ - m = ieee80211_getmgtframe(&frm, - ic->ic_headroom + sizeof(struct ieee80211_frame), - 2 + IEEE80211_NWID_LEN + return ( 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE - + sizeof(struct ieee80211_ie_htcap) - + sizeof(struct ieee80211_ie_vhtcap) + + ((vap->iv_flags & IEEE80211_F_WPA2 && vap->iv_rsn_ie != NULL) ? + vap->iv_rsn_ie[1] : 0) + + ((rs->rs_nrates > IEEE80211_RATE_SIZE) ? + 2 + (rs->rs_nrates - IEEE80211_RATE_SIZE) : 0) + + (((vap->iv_opmode == IEEE80211_M_IBSS) && + (vap->iv_flags_ht & IEEE80211_FHT_HT)) ? + sizeof(struct ieee80211_ie_htcap) : 0) +#ifdef notyet + sizeof(struct ieee80211_ie_htinfo) /* XXX not needed? */ - + sizeof(struct ieee80211_ie_wpa) - + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) - + sizeof(struct ieee80211_ie_wpa) + + sizeof(struct ieee80211_ie_vhtcap) +#endif + + ((vap->iv_flags & IEEE80211_F_WPA1 && vap->iv_wpa_ie != NULL) ? + vap->iv_wpa_ie[1] : 0) + (vap->iv_appie_probereq != NULL ? vap->iv_appie_probereq->ie_len : 0) ); - if (m == NULL) { - vap->iv_stats.is_tx_nobuf++; - ieee80211_free_node(ni); - ieee80211_free_node(bss); - return ENOMEM; - } +} + +int +ieee80211_probereq_ie(struct ieee80211vap *vap, struct ieee80211com *ic, + uint8_t **frmp, uint32_t *frmlen, const uint8_t *ssid, size_t ssidlen, + bool alloc) +{ + const struct ieee80211_rateset *rs; + uint8_t *frm; + uint32_t len; + + if (!alloc && (frmp == NULL || frmlen == NULL)) + return (EINVAL); - frm = ieee80211_add_ssid(frm, ssid, ssidlen); + len = ieee80211_probereq_ie_len(vap, ic); + if (!alloc && len > *frmlen) + return (ENOBUFS); + + if (alloc) { + frm = malloc(len, M_80211_VAP, M_WAITOK | M_ZERO); + *frmp = frm; + *frmlen = len; + } else + frm = *frmp; + + /* For HW scans we usually do not pass in the SSID as IE. */ + if (ssidlen == -1) + len -= (2 + IEEE80211_NWID_LEN); + else + frm = ieee80211_add_ssid(frm, ssid, ssidlen); rs = ieee80211_get_suprates(ic, ic->ic_curchan); frm = ieee80211_add_rates(frm, rs); frm = ieee80211_add_rsn(frm, vap); @@ -2517,8 +2513,8 @@ ieee80211_send_probereq(struct ieee80211_node *ni, * XXX TODO: need to figure out what/how to update the * VHT channel. */ -#if 0 - (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { +#ifdef notyet + if (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { struct ieee80211_channel *c; c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, @@ -2531,8 +2527,71 @@ ieee80211_send_probereq(struct ieee80211_node *ni, frm = ieee80211_add_wpa(frm, vap); if (vap->iv_appie_probereq != NULL) frm = add_appie(frm, vap->iv_appie_probereq); - m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); + if (!alloc) { + *frmp = frm; + *frmlen = len; + } + + return (0); +} + +int +ieee80211_send_probereq(struct ieee80211_node *ni, + const uint8_t sa[IEEE80211_ADDR_LEN], + const uint8_t da[IEEE80211_ADDR_LEN], + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t *ssid, size_t ssidlen) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_node *bss; + const struct ieee80211_txparam *tp; + struct ieee80211_bpf_params params; + struct mbuf *m; + uint8_t *frm; + uint32_t frmlen; + int ret; + + bss = ieee80211_ref_node(vap->iv_bss); + + if (vap->iv_state == IEEE80211_S_CAC) { + IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, + "block %s frame in CAC state", "probe request"); + vap->iv_stats.is_tx_badstate++; + ieee80211_free_node(bss); + return EIO; /* XXX */ + } + + /* + * Hold a reference on the node so it doesn't go away until after + * the xmit is complete all the way in the driver. On error we + * will remove our reference. + */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", + __func__, __LINE__, + ni, ether_sprintf(ni->ni_macaddr), + ieee80211_node_refcnt(ni)+1); + ieee80211_ref_node(ni); + + /* See comments above for entire frame format. */ + frmlen = ieee80211_probereq_ie_len(vap, ic); + m = ieee80211_getmgtframe(&frm, + ic->ic_headroom + sizeof(struct ieee80211_frame), frmlen); + if (m == NULL) { + vap->iv_stats.is_tx_nobuf++; + ieee80211_free_node(ni); + ieee80211_free_node(bss); + return ENOMEM; + } + + ret = ieee80211_probereq_ie(vap, ic, &frm, &frmlen, ssid, ssidlen, + false); + KASSERT(ret == 0, + ("%s: ieee80211_probereq_ie railed: %d\n", __func__, ret)); + + m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); KASSERT(M_LEADINGSPACE(m) >= sizeof(struct ieee80211_frame), ("leading space %zd", M_LEADINGSPACE(m))); M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); diff --git a/sys/net80211/ieee80211_proto.h b/sys/net80211/ieee80211_proto.h index fafedf46cab5..4b324caa694b 100644 --- a/sys/net80211/ieee80211_proto.h +++ b/sys/net80211/ieee80211_proto.h @@ -114,6 +114,8 @@ struct mbuf *ieee80211_encap(struct ieee80211vap *, struct ieee80211_node *, void ieee80211_free_mbuf(struct mbuf *); int ieee80211_send_mgmt(struct ieee80211_node *, int, int); struct ieee80211_appie; +int ieee80211_probereq_ie(struct ieee80211vap *, struct ieee80211com *, + uint8_t **, uint32_t *, const uint8_t *, size_t, bool); int ieee80211_send_probereq(struct ieee80211_node *ni, const uint8_t sa[IEEE80211_ADDR_LEN], const uint8_t da[IEEE80211_ADDR_LEN], From owner-dev-commits-src-main@freebsd.org Thu Mar 18 11:24:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 974FA57082E; Thu, 18 Mar 2021 11:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1Pmr3qzgz3JxZ; Thu, 18 Mar 2021 11:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76546210A7; Thu, 18 Mar 2021 11:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IBOCnp077123; Thu, 18 Mar 2021 11:24:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IBOCCH077122; Thu, 18 Mar 2021 11:24:12 GMT (envelope-from git) Date: Thu, 18 Mar 2021 11:24:12 GMT Message-Id: <202103181124.12IBOCCH077122@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 2ad93dade70a - main - lib80211: Start adding 11ac ETSI bits to regdomain.xml MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ad93dade70a9c98174fc87d0cd24fd54bd0d120 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 11:24:12 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2ad93dade70a9c98174fc87d0cd24fd54bd0d120 commit 2ad93dade70a9c98174fc87d0cd24fd54bd0d120 Author: Bjoern A. Zeeb AuthorDate: 2021-03-18 11:08:47 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-18 11:09:10 +0000 lib80211: Start adding 11ac ETSI bits to regdomain.xml Summary: This change currently (partially) duplicates AC1 freqbands as AC2 as they are not fully overlapping. It then adds the 11ac netband to the "etsi" domain including "indoor" and "dfs" flags, which we can deal with, as well as appropriate (round down) maxpower values. Comments are left for the actual frequency bands as we do use the centerfreq for the first/last (chansep sized) channel in the freqband and their "id" name, which can be confusing. Sponsored-by: Rubicon Communications, LLC ("Netgate") Reviewed-by: philip, adrian MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25999 --- lib/lib80211/regdomain.xml | 174 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 173 insertions(+), 1 deletion(-) diff --git a/lib/lib80211/regdomain.xml b/lib/lib80211/regdomain.xml index cad3039c3d3d..38ef48fa3b69 100644 --- a/lib/lib80211/regdomain.xml +++ b/lib/lib80211/regdomain.xml @@ -551,9 +551,112 @@ IEEE80211_CHAN_DFS + + + + + 23 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + INDOOR + + + + 23 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + INDOOR + + + + 23 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + INDOOR + + + + + + 20 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + INDOOR + + + + 20 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + INDOOR + + + + 20 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + INDOOR + + + + + + 26 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT160 + IEEE80211_CHAN_DFS + + + + + + 13 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + + + + 13 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + + + + 13 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + + - + ETSI2 @@ -1788,6 +1891,75 @@ 80 20 IEEE80211_CHAN_A + + + 5160 5240 + 20 20 + IEEE80211_CHAN_A + + + 5180 5240 + 40 20 + IEEE80211_CHAN_A + + + 5180 5240 + 80 20 + IEEE80211_CHAN_A + + + + 5260 5340 + 20 20 + IEEE80211_CHAN_A + + + 5260 5320 + 40 20 + IEEE80211_CHAN_A + + + 5260 5320 + 80 20 + IEEE80211_CHAN_A + + + + 5480 5700 + 20 20 + IEEE80211_CHAN_A + + + 5500 5680 + 40 20 + IEEE80211_CHAN_A + + + 5500 5640 + 80 20 + IEEE80211_CHAN_A + + + 5500 5640 + 160 20 + IEEE80211_CHAN_A + + + + 5745 5865 + 20 20 + IEEE80211_CHAN_A + + + 5745 5805 + 40 20 + IEEE80211_CHAN_A + + + 5745 5805 + 80 20 + IEEE80211_CHAN_A + 5180 5240 40 20 From owner-dev-commits-src-main@freebsd.org Thu Mar 18 14:21:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 459CD5769BA; Thu, 18 Mar 2021 14:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1TjT1BRpz3lcg; Thu, 18 Mar 2021 14:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BC64230EA; Thu, 18 Mar 2021 14:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IELXVd011934; Thu, 18 Mar 2021 14:21:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IELXJo011933; Thu, 18 Mar 2021 14:21:33 GMT (envelope-from git) Date: Thu, 18 Mar 2021 14:21:33 GMT Message-Id: <202103181421.12IELXJo011933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 21864048f392 - main - inetd.conf: Wordsmith recommendation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 21864048f3929192bd20f34145ba62cda6e1d4f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 14:21:33 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=21864048f3929192bd20f34145ba62cda6e1d4f9 commit 21864048f3929192bd20f34145ba62cda6e1d4f9 Author: Daniel Ebdrup Jensen AuthorDate: 2021-03-18 14:17:32 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-18 14:17:32 +0000 inetd.conf: Wordsmith recommendation Rather than recommend specific VTIs, it's better to give a general recommendation for where current and future suitable VTIs can be found. --- usr.sbin/inetd/inetd.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/inetd/inetd.conf b/usr.sbin/inetd/inetd.conf index 7f5f6783a038..82f68be7ab5d 100644 --- a/usr.sbin/inetd/inetd.conf +++ b/usr.sbin/inetd/inetd.conf @@ -121,7 +121,8 @@ #prom-sysctl stream tcp nowait nobody /usr/sbin/prometheus_sysctl_exporter prometheus_sysctl_exporter -dgh # # Example entry for insecure rsync server -# This is best combined with a VTI like if_ipsec(4) or wg(4) +# This is best combined with encrypted virtual tunnel interfaces, which can be +# found with: apropos if_ | grep tunnel #rsync stream tcp nowait root /usr/local/bin/rsyncd rsyncd --daemon # # Let the system respond to date requests via tcpmux From owner-dev-commits-src-main@freebsd.org Thu Mar 18 15:00:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3D06578665; Thu, 18 Mar 2021 15:00:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1VZ95Ystz3nxR; Thu, 18 Mar 2021 15:00:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1FDC23C26; Thu, 18 Mar 2021 15:00:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IF0Hah060711; Thu, 18 Mar 2021 15:00:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IF0H7B060705; Thu, 18 Mar 2021 15:00:17 GMT (envelope-from git) Date: Thu, 18 Mar 2021 15:00:17 GMT Message-Id: <202103181500.12IF0H7B060705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: e9272225e6be - main - vfs: fix vnlru marker handling for filtered/unfiltered cases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9272225e6bed840b00eef1c817b188c172338ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 15:00:17 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e9272225e6bed840b00eef1c817b188c172338ee commit e9272225e6bed840b00eef1c817b188c172338ee Author: Mateusz Guzik AuthorDate: 2021-03-17 21:33:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-03-18 14:59:03 +0000 vfs: fix vnlru marker handling for filtered/unfiltered cases The global list has a marker with an invariant that free vnodes are placed somewhere past that. A caller which performs filtering (like ZFS) can move said marker all the way to the end, across free vnodes which don't match. Then a caller which does not perform filtering will fail to find them. This makes vn_alloc_hard sleep for 1 second instead of reclaiming, resulting in significant stalls. Fix the problem by requiring an explicit marker by callers which do filtering. As a temporary measure extend vnlru_free to restart if it fails to reclaim anything. Big thanks go to the reporter for testing several iterations of the patch. Reported by: Yamagi Tested by: Yamagi Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29324 --- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 14 ++++- sys/kern/vfs_subr.c | 72 +++++++++++++++++++--- sys/sys/vnode.h | 3 + 3 files changed, 80 insertions(+), 9 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c index 4fc7468bfa47..0d5cffbe8d1e 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c @@ -51,6 +51,9 @@ #include #include +static struct sx arc_vnlru_lock; +static struct vnode *arc_vnlru_marker; + extern struct vfsops zfs_vfsops; uint_t zfs_arc_free_target = 0; @@ -157,7 +160,9 @@ arc_prune_task(void *arg) arc_reduce_target_size(ptob(nr_scan)); free(arg, M_TEMP); - vnlru_free(nr_scan, &zfs_vfsops); + sx_xlock(&arc_vnlru_lock); + vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); + sx_xunlock(&arc_vnlru_lock); } /* @@ -234,7 +239,8 @@ arc_lowmem_init(void) { arc_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, arc_lowmem, NULL, EVENTHANDLER_PRI_FIRST); - + arc_vnlru_marker = vnlru_alloc_marker(); + sx_init(&arc_vnlru_lock, "arc vnlru lock"); } void @@ -242,6 +248,10 @@ arc_lowmem_fini(void) { if (arc_event_lowmem != NULL) EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); + if (arc_vnlru_marker != NULL) { + vnlru_free_marker(arc_vnlru_marker); + sx_destroy(&arc_vnlru_lock); + } } void diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 37e713ee48ea..af12252e8a88 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1216,9 +1216,9 @@ SYSCTL_INT(_debug, OID_AUTO, max_vnlru_free, CTLFLAG_RW, &max_vnlru_free, * Attempt to reduce the free list by the requested amount. */ static int -vnlru_free_locked(int count, struct vfsops *mnt_op) +vnlru_free_impl(int count, struct vfsops *mnt_op, struct vnode *mvp) { - struct vnode *vp, *mvp; + struct vnode *vp; struct mount *mp; int ocount; @@ -1226,7 +1226,6 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) if (count > max_vnlru_free) count = max_vnlru_free; ocount = count; - mvp = vnode_list_free_marker; vp = mvp; for (;;) { if (count == 0) { @@ -1268,13 +1267,72 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) return (ocount - count); } +static int +vnlru_free_locked(int count) +{ + + mtx_assert(&vnode_list_mtx, MA_OWNED); + return (vnlru_free_impl(count, NULL, vnode_list_free_marker)); +} + +void +vnlru_free_vfsops(int count, struct vfsops *mnt_op, struct vnode *mvp) +{ + + MPASS(mnt_op != NULL); + MPASS(mvp != NULL); + VNPASS(mvp->v_type == VMARKER, mvp); + mtx_lock(&vnode_list_mtx); + vnlru_free_impl(count, mnt_op, mvp); + mtx_unlock(&vnode_list_mtx); +} + +/* + * Temporary binary compat, don't use. Call vnlru_free_vfsops instead. + */ void vnlru_free(int count, struct vfsops *mnt_op) { + struct vnode *mvp; + + if (count == 0) + return; + mtx_lock(&vnode_list_mtx); + mvp = vnode_list_free_marker; + if (vnlru_free_impl(count, mnt_op, mvp) == 0) { + /* + * It is possible the marker was moved over eligible vnodes by + * callers which filtered by different ops. If so, start from + * scratch. + */ + if (vnlru_read_freevnodes() > 0) { + TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); + TAILQ_INSERT_HEAD(&vnode_list, mvp, v_vnodelist); + } + vnlru_free_impl(count, mnt_op, mvp); + } + mtx_unlock(&vnode_list_mtx); +} + +struct vnode * +vnlru_alloc_marker(void) +{ + struct vnode *mvp; + mvp = vn_alloc_marker(NULL); + mtx_lock(&vnode_list_mtx); + TAILQ_INSERT_BEFORE(vnode_list_free_marker, mvp, v_vnodelist); + mtx_unlock(&vnode_list_mtx); + return (mvp); +} + +void +vnlru_free_marker(struct vnode *mvp) +{ mtx_lock(&vnode_list_mtx); - vnlru_free_locked(count, mnt_op); + TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); mtx_unlock(&vnode_list_mtx); + vn_free_marker(mvp); } static void @@ -1423,7 +1481,7 @@ vnlru_proc(void) * try to reduce it by discarding from the free list. */ if (rnumvnodes > desiredvnodes) { - vnlru_free_locked(rnumvnodes - desiredvnodes, NULL); + vnlru_free_locked(rnumvnodes - desiredvnodes); rnumvnodes = atomic_load_long(&numvnodes); } /* @@ -1615,7 +1673,7 @@ vn_alloc_hard(struct mount *mp) * should be chosen so that we never wait or even reclaim from * the free list to below its target minimum. */ - if (vnlru_free_locked(1, NULL) > 0) + if (vnlru_free_locked(1) > 0) goto alloc; if (mp == NULL || (mp->mnt_kern_flag & MNTK_SUSPEND) == 0) { /* @@ -1625,7 +1683,7 @@ vn_alloc_hard(struct mount *mp) msleep(&vnlruproc_sig, &vnode_list_mtx, PVFS, "vlruwk", hz); if (atomic_load_long(&numvnodes) + 1 > desiredvnodes && vnlru_read_freevnodes() > 1) - vnlru_free_locked(1, NULL); + vnlru_free_locked(1); } alloc: rnumvnodes = atomic_fetchadd_long(&numvnodes, 1) + 1; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 0e46bea14b64..f05b03c74c82 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -826,7 +826,10 @@ void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp, int flags); int vfs_write_suspend(struct mount *mp, int flags); int vfs_write_suspend_umnt(struct mount *mp); +struct vnode *vnlru_alloc_marker(void); +void vnlru_free_marker(struct vnode *); void vnlru_free(int, struct vfsops *); +void vnlru_free_vfsops(int, struct vfsops *, struct vnode *); int vop_stdbmap(struct vop_bmap_args *); int vop_stdfdatasync_buf(struct vop_fdatasync_args *); int vop_stdfsync(struct vop_fsync_args *); From owner-dev-commits-src-main@freebsd.org Thu Mar 18 15:05:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62B8C578473; Thu, 18 Mar 2021 15:05:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1VhQ2HLYz3pl9; Thu, 18 Mar 2021 15:05:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CD3223E14; Thu, 18 Mar 2021 15:05:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IF5g9T067216; Thu, 18 Mar 2021 15:05:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IF5gZ2067215; Thu, 18 Mar 2021 15:05:42 GMT (envelope-from git) Date: Thu, 18 Mar 2021 15:05:42 GMT Message-Id: <202103181505.12IF5gZ2067215@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 4a847a6ccdf2 - main - Revert "bootstrap: add tic to the bootstrap tools" Since we don't build and install the terminfo db anymore this is not needed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a847a6ccdf2ed583b8635103b36b76e153ffb62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 15:05:42 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4a847a6ccdf2ed583b8635103b36b76e153ffb62 commit 4a847a6ccdf2ed583b8635103b36b76e153ffb62 Author: Baptiste Daroussin AuthorDate: 2021-03-18 15:01:11 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-18 15:05:20 +0000 Revert "bootstrap: add tic to the bootstrap tools" Since we don't build and install the terminfo db anymore this is not needed This reverts commit b6a51d39e3a2e2f75d5b42a8c17a531063258a15. This reverts commit e5e4845959ac60110677df302a68c220dff75abe. This reverts commit 0af562d7e1850bbef230d30805c101b26588a3ed. --- Makefile.inc1 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 9b52372288f7..005d9d25afb3 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2479,7 +2479,6 @@ bootstrap-tools: ${_bt}-links .PHONY lib/libopenbsd \ usr.bin/mandoc \ usr.bin/rpcgen \ - lib/ncurses/ncurses \ ${_yacc} \ ${_m4} \ ${_lex} \ @@ -2494,7 +2493,6 @@ bootstrap-tools: ${_bt}-links .PHONY ${_nmtree} \ ${_vtfontcvt} \ ${_localedef} \ - usr.bin/ncurses \ ${LOCAL_BSTOOL_DIRS} ${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ @@ -2516,9 +2514,6 @@ ${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd ${_bt}-sbin/md5: ${_bt}-lib/libmd .endif -.if target(${_bt}-usr.bin/ncurses) -${_bt}-usr.bin/ncurses: ${_bt}-lib/ncurses/ncurses -.endif # # build-tools: Build special purpose build tools From owner-dev-commits-src-main@freebsd.org Thu Mar 18 17:40:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 845A357E81C; Thu, 18 Mar 2021 17:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1Z6k31Dfz4VcC; Thu, 18 Mar 2021 17:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A42625AD1; Thu, 18 Mar 2021 17:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IHeEQR069853; Thu, 18 Mar 2021 17:40:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IHeE44069846; Thu, 18 Mar 2021 17:40:14 GMT (envelope-from git) Date: Thu, 18 Mar 2021 17:40:14 GMT Message-Id: <202103181740.12IHeE44069846@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: c39dda81923a - main - rc.conf(5): Document the 'workstation' firewall_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c39dda81923a26116241fbe996351133c86ad97a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 17:40:14 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c39dda81923a26116241fbe996351133c86ad97a commit c39dda81923a26116241fbe996351133c86ad97a Author: Tobias Rehbein AuthorDate: 2021-03-18 17:01:09 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-18 17:39:24 +0000 rc.conf(5): Document the 'workstation' firewall_type Document the workstation ACL ruleset, which uses stateful rules. While here, add a note about where some of the undocumented variables can be found. This is not a perfect solution for bug 127359, but it at at least gives a place to go look, and can be used as a reference for when bug 127359 gets fixed properly. PR: 254358, 127359 --- share/man/man5/rc.conf.5 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index fef0f167d1a5..ddf4ea120df5 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -539,7 +539,7 @@ Valid selections from .Pa /etc/rc.firewall are: .Pp -.Bl -tag -width ".Li simple" -compact +.Bl -tag -width ".Li workstation" -compact .It Li open unrestricted IP access .It Li closed @@ -547,12 +547,18 @@ all IP services disabled, except via .Dq Li lo0 .It Li client basic protection for a workstation +.It Li workstation +basic protection for a workstation using stateful firewalling .It Li simple basic protection for a LAN. .El .Pp If a filename is specified, the full path must be given. +.Pp +Most of the predefined rulesets define additional configuration variables. +These are documented in +.Pa /etc/rc.firewall . .It Va firewall_quiet .Pq Vt bool Set to From owner-dev-commits-src-main@freebsd.org Thu Mar 18 19:16:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 409CF5A9B14; Thu, 18 Mar 2021 19:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1cFd1Nftz4cvv; Thu, 18 Mar 2021 19:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22A2A2713A; Thu, 18 Mar 2021 19:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IJGLPH096928; Thu, 18 Mar 2021 19:16:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IJGLVd096927; Thu, 18 Mar 2021 19:16:21 GMT (envelope-from git) Date: Thu, 18 Mar 2021 19:16:21 GMT Message-Id: <202103181916.12IJGLVd096927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a7883464fcc4 - main - x86: Reduce code duplication in cpu_fork() and cpu_copy_thread(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7883464fcc45b78e6aa01222682ae40f787a378 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 19:16:21 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a7883464fcc45b78e6aa01222682ae40f787a378 commit a7883464fcc45b78e6aa01222682ae40f787a378 Author: John Baldwin AuthorDate: 2021-03-18 19:13:17 +0000 Commit: John Baldwin CommitDate: 2021-03-18 19:13:17 +0000 x86: Reduce code duplication in cpu_fork() and cpu_copy_thread(). Add copy_thread() to hold shared code. Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29228 --- sys/amd64/amd64/vm_machdep.c | 167 +++++++++++++++------------------------ sys/i386/i386/vm_machdep.c | 184 +++++++++++++++++-------------------------- 2 files changed, 137 insertions(+), 214 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index a17ddd4ba6d8..0527ef95cf3b 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -136,6 +136,65 @@ alloc_fpusave(int flags) return (res); } +/* + * Common code shared between cpu_fork() and cpu_copy_thread() for + * initializing a thread. + */ +static void +copy_thread(struct thread *td1, struct thread *td2) +{ + struct pcb *pcb2; + + pcb2 = td2->td_pcb; + + /* Ensure that td1's pcb is up to date for user threads. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + fpuexit(td1); + update_pcb_bases(td1->td_pcb); + } + + /* Copy td1's pcb */ + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Properly initialize pcb_save */ + pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + + /* Kernel threads start with clean FPU and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ + pcb2->pcb_rbp = 0; + pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); + pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ + pcb2->pcb_rip = (register_t)fork_trampoline; + /*- + * pcb2->pcb_dr*: cloned above. + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_flags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_[fg]sbase: cloned above + */ + + /* Setup to release spin count in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; + pmap_thread_init_invl_gen(td2); +} + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -164,36 +223,13 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date for user processes. */ - if ((td2->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td1 == curthread); - fpuexit(td1); - update_pcb_bases(td1->td_pcb); - } - /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); td2->td_pcb = pcb2 = get_pcb_td(td2); - /* Copy td1's pcb */ - bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - - /* Properly initialize pcb_save */ - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + copy_thread(td1, td2); - /* Kernel processes start with clean FPU and segment bases. */ - if ((td2->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_fsbase = 0; - pcb2->pcb_gsbase = 0; - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU | PCB_KERNFPU_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); - } - - /* Point mdproc and then copy over td1's contents */ + /* Point mdproc and then copy over p1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); @@ -215,29 +251,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) */ td2->td_frame->tf_rflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ - pcb2->pcb_rbp = 0; - pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); - pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ - pcb2->pcb_rip = (register_t)fork_trampoline; - /*- - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_[fg]sbase: cloned above - */ - - /* Setup to release spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - pmap_thread_init_invl_gen(td2); - - /* As an i386, do not copy io permission bitmap. */ + /* As on i386, do not copy io permission bitmap. */ pcb2->pcb_tssp = NULL; /* New segment registers. */ @@ -275,7 +289,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) * pcb_rsp is loaded pointing to the cpu_switch() stack frame * containing the return address when exiting cpu_switch. * This will normally be to fork_trampoline(), which will have - * %ebx loaded with the new proc's pointer. fork_trampoline() + * %rbx loaded with the new proc's pointer. fork_trampoline() * will set up a stack to call fork_return(p, frame); to complete * the return to user-mode. */ @@ -571,38 +585,7 @@ cpu_set_syscall_retval(struct thread *td, int error) void cpu_copy_thread(struct thread *td, struct thread *td0) { - struct pcb *pcb2; - - pcb2 = td->td_pcb; - - /* Ensure that td0's pcb is up to date for user threads. */ - if ((td->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td0 == curthread); - fpuexit(td0); - update_pcb_bases(td0->td_pcb); - } - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel threads start with clean FPU and segment bases. */ - if ((td->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_fsbase = 0; - pcb2->pcb_gsbase = 0; - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU | PCB_KERNFPU_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); - } - set_pcb_flags_raw(pcb2, PCB_FULL_IRET); - + copy_thread(td0, td); /* * Copy user general-purpose registers. @@ -620,27 +603,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) */ td->td_frame->tf_rflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_r12 = (register_t)fork_return; /* trampoline arg */ - pcb2->pcb_rbp = 0; - pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *); /* trampoline arg */ - pcb2->pcb_rbx = (register_t)td; /* trampoline arg */ - pcb2->pcb_rip = (register_t)fork_trampoline; - /* - * If we didn't copy the pcb, we'd need to do the following registers: - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_[fg]sbase: cloned above - */ - - /* Setup to release spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - pmap_thread_init_invl_gen(td); + set_pcb_flags_raw(td->td_pcb, PCB_FULL_IRET); } /* diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 5947ae5a6d15..5bbdfdb77b2d 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -133,6 +133,74 @@ alloc_fpusave(int flags) } return (res); } + +/* + * Common code shared between cpu_fork() and cpu_copy_thread() for + * initializing a thread. + */ +static void +copy_thread(struct thread *td1, struct thread *td2) +{ + struct pcb *pcb2; + + pcb2 = td2->td_pcb; + + /* Ensure that td1's pcb is up to date for user threads. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + td1->td_pcb->pcb_gs = rgs(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td1) + npxsave(td1->td_pcb->pcb_save); + critical_exit(); + } + + /* Copy td1's pcb */ + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Properly initialize pcb_save */ + pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + + /* Kernel threads start with clean NPX and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td2, 0); + set_gsbase(td2, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_edi = 0; + pcb2->pcb_esi = (int)fork_return; /* trampoline arg */ + pcb2->pcb_ebp = 0; + pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); /* trampoline arg */ + pcb2->pcb_ebx = (int)td2; /* trampoline arg */ + pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; + /* + * If we didn't copy the pcb, we'd need to do the following registers: + * pcb2->pcb_cr3: cloned above. + * pcb2->pcb_dr*: cloned above. + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_flags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_gs: cloned above. + * pcb2->pcb_ext: cleared below. + */ + pcb2->pcb_ext = NULL; + + /* Setup to release spin count in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; +} + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -167,38 +235,11 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date for user processes. */ - if ((td2->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td1 == curthread); - td1->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td1) - npxsave(td1->td_pcb->pcb_save); - critical_exit(); - } - /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); td2->td_pcb = pcb2; - /* Copy td1's pcb */ - bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - - /* Properly initialize pcb_save */ - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel processes start with clean NPX and segment bases. */ - if ((td2->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_gs = _udatasel; - set_fsbase(td2, 0); - set_gsbase(td2, 0); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX | PCB_KERNNPX_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); - } + copy_thread(td1, td2); /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -225,30 +266,13 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) */ td2->td_frame->tf_eflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ + /* Set cr3 for the new process. */ pcb2->pcb_cr3 = pmap_get_cr3(vmspace_pmap(p2->p_vmspace)); - pcb2->pcb_edi = 0; - pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */ - pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); - pcb2->pcb_ebx = (int)td2; /* fork_trampoline argument */ - pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - /*- - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_gs: cloned above. - * pcb2->pcb_ext: cleared below. - */ /* * XXX don't copy the i/o pages. this should probably be fixed. */ - pcb2->pcb_ext = 0; + pcb2->pcb_ext = NULL; /* Copy the LDT, if necessary. */ mtx_lock_spin(&dt_lock); @@ -264,10 +288,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) } mtx_unlock_spin(&dt_lock); - /* Setup to release spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - /* * Now, cpu_switch() can schedule the new process. * pcb_esp is loaded pointing to the cpu_switch() stack frame @@ -435,41 +455,7 @@ cpu_set_syscall_retval(struct thread *td, int error) void cpu_copy_thread(struct thread *td, struct thread *td0) { - struct pcb *pcb2; - - /* Point the pcb to the top of the stack. */ - pcb2 = td->td_pcb; - - /* Ensure that td0's pcb is up to date for user threads. */ - if ((td->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td0 == curthread); - td0->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td0) - npxsave(td0->td_pcb->pcb_save); - critical_exit(); - } - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel threads start with clean NPX and segment bases. */ - if ((td->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_gs = _udatasel; - set_fsbase(td, 0); - set_gsbase(td, 0); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX | PCB_KERNNPX_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); - } + copy_thread(td0, td); /* * Copy user general-purpose registers. @@ -486,32 +472,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * instruction after returning to userland. */ td->td_frame->tf_eflags &= ~PSL_T; - - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_edi = 0; - pcb2->pcb_esi = (int)fork_return; /* trampoline arg */ - pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */ - pcb2->pcb_ebx = (int)td; /* trampoline arg */ - pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - /* - * If we didn't copy the pcb, we'd need to do the following registers: - * pcb2->pcb_cr3: cloned above. - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_gs: cloned above. - * pcb2->pcb_ext: cleared below. - */ - pcb2->pcb_ext = NULL; - - /* Setup to release spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; } /* From owner-dev-commits-src-main@freebsd.org Thu Mar 18 19:16:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D27EE5A999B; Thu, 18 Mar 2021 19:16:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1cFf39cRz4d4M; Thu, 18 Mar 2021 19:16:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CAFD27355; Thu, 18 Mar 2021 19:16:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IJGMSj096949; Thu, 18 Mar 2021 19:16:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IJGMvi096948; Thu, 18 Mar 2021 19:16:22 GMT (envelope-from git) Date: Thu, 18 Mar 2021 19:16:22 GMT Message-Id: <202103181916.12IJGMvi096948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 3b57ddb029da - main - Rename linux_set_upcall_kse() to linux_set_upcall(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b57ddb029daf225a8385dade491019269da82e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 19:16:22 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3b57ddb029daf225a8385dade491019269da82e8 commit 3b57ddb029daf225a8385dade491019269da82e8 Author: John Baldwin AuthorDate: 2021-03-18 19:14:34 +0000 Commit: John Baldwin CommitDate: 2021-03-18 19:14:34 +0000 Rename linux_set_upcall_kse() to linux_set_upcall(). This matches the rename of cpu_set_upcall_kse() in 5c2cf818454375536fda522ba83cf67c50929e6b. Reviewed by: kib, emaste MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29295 --- sys/amd64/amd64/vm_machdep.c | 2 +- sys/amd64/linux/linux_machdep.c | 2 +- sys/amd64/linux32/linux32_machdep.c | 2 +- sys/arm64/linux/linux_machdep.c | 8 ++++---- sys/compat/linux/linux_fork.c | 4 ++-- sys/compat/linux/linux_misc.h | 2 +- sys/i386/i386/vm_machdep.c | 2 +- sys/i386/linux/linux_machdep.c | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 0527ef95cf3b..f64259decbff 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -591,7 +591,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Copy user general-purpose registers. * * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall_kse(). + * and linux_set_upcall(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index 01b730c2b19c..a82ab411daa1 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -118,7 +118,7 @@ linux_execve(struct thread *td, struct linux_execve_args *args) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index fde180d74d73..8ae82f3df8ca 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -418,7 +418,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c index 512bf1cc3398..711ccb4fd63d 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /* DTrace probes */ -LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall_kse, todo); +LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_mmap2, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_rt_sigsuspend, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_sigaltstack, todo); @@ -84,12 +84,12 @@ linux_execve(struct thread *td, struct linux_execve_args *uap) return (error); } -/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall_kse */ +/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall */ int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { - LIN_SDT_PROBE0(machdep, linux_set_upcall_kse, todo); + LIN_SDT_PROBE0(machdep, linux_set_upcall, todo); return (EDOOFUS); } diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index 3ba40fc2705e..ed4adcf8a175 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -205,7 +205,7 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args) * stack. This is what normal fork() does, so we just keep tf_rsp arg * intact. */ - linux_set_upcall_kse(td2, PTROUT(args->stack)); + linux_set_upcall(td2, PTROUT(args->stack)); if (args->flags & LINUX_CLONE_SETTLS) linux_set_cloned_tls(td2, args->tls); @@ -304,7 +304,7 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args) cpu_thread_clean(newtd); - linux_set_upcall_kse(newtd, PTROUT(args->stack)); + linux_set_upcall(newtd, PTROUT(args->stack)); PROC_LOCK(p); p->p_flag |= P_HADTHREADS; diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index c7e4fa38682c..da76753e3d24 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -181,7 +181,7 @@ extern int stclohz; int linux_ptrace_status(struct thread *td, int pid, int status); #endif void linux_to_bsd_waitopts(int options, int *bsdopts); -int linux_set_upcall_kse(struct thread *td, register_t stack); +int linux_set_upcall(struct thread *td, register_t stack); int linux_set_cloned_tls(struct thread *td, void *desc); struct thread *linux_tdfind(struct thread *, lwpid_t, pid_t); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 5bbdfdb77b2d..c04fb57db4b1 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -461,7 +461,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Copy user general-purpose registers. * * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall_kse(). + * and linux_set_upcall(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index 624a6ef6ae87..d2d713d4776d 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -314,7 +314,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) From owner-dev-commits-src-main@freebsd.org Thu Mar 18 20:21:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C677A5ABB1E; Thu, 18 Mar 2021 20:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1djL4wgHz4jDw; Thu, 18 Mar 2021 20:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B9C427AF3; Thu, 18 Mar 2021 20:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IKLwmW088548; Thu, 18 Mar 2021 20:21:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKLw98088547; Thu, 18 Mar 2021 20:21:58 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:21:58 GMT Message-Id: <202103182021.12IKLw98088547@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: fd232a21bb35 - main - nfsv4 pnfs client: fix updating of the layout stateid.seqid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:21:58 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc Author: Rick Macklem AuthorDate: 2021-03-18 19:20:25 +0000 Commit: Rick Macklem CommitDate: 2021-03-18 19:20:25 +0000 nfsv4 pnfs client: fix updating of the layout stateid.seqid During a recent NFSv4 testing event a test server was replying NFSERR_OLDSTATEID for layout stateids presented to the server for LayoutReturn operations. Upon rereading RFC5661, it was apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not maintain the seqid field of the layout stateid correctly. This patch is believed to correct the problem. Tested against a FreeBSD pNFS server with diagnostics added to check the stateid's seqid did not indicate problems. Unfortunately, testing aginst this server will not happen in the near future, so the fix may not be correct yet. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index a1aa7c04e8a3..227d82a5f7f3 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3495,11 +3495,18 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) len, stateid.seqid, 0, 0, NULL, recallp); + if (error == 0 && + stateid.seqid > + lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = + stateid.seqid; recallp = NULL; wakeup(clp); NFSCL_DEBUG(4, - "aft layrcal=%d\n", - error); + "aft layrcal=%d " + "layseqid=%d\n", + error, + lyp->nfsly_stateid.seqid); } else error = NFSERR_NOMATCHLAYOUT; @@ -4881,6 +4888,8 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, } else { if (retonclose != 0) lyp->nfsly_flags |= NFSLY_RETONCLOSE; + if (stateidp->seqid > lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = stateidp->seqid; TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; @@ -4893,7 +4902,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, return (EPERM); } *lypp = lyp; - } else + } else if (stateidp->seqid > lyp->nfsly_stateid.seqid) lyp->nfsly_stateid.seqid = stateidp->seqid; /* Merge the new list of File Layouts into the list. */ From owner-dev-commits-src-main@freebsd.org Thu Mar 18 20:30:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7BC95ABF00; Thu, 18 Mar 2021 20:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1dvM48Lvz4jhZ; Thu, 18 Mar 2021 20:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81B5B27F7B; Thu, 18 Mar 2021 20:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IKUd4O097325; Thu, 18 Mar 2021 20:30:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKUdHa097324; Thu, 18 Mar 2021 20:30:39 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:30:39 GMT Message-Id: <202103182030.12IKUdHa097324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: e026f4243c5a - main - Fix the 'linux' rc script on aarch64. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e026f4243c5a65d19a63d98f55be17e8294a1e87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:30:39 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=e026f4243c5a65d19a63d98f55be17e8294a1e87 commit e026f4243c5a65d19a63d98f55be17e8294a1e87 Author: Edward Tomasz Napierala AuthorDate: 2021-03-16 16:48:13 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-18 20:30:21 +0000 Fix the 'linux' rc script on aarch64. Previously it would try to load linux.ko instead of linux64.ko and fail. While here, don't try to match 'linuxaout'; even if implemented, it's the same module as `linuxelf`. Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29288 --- libexec/rc/rc.d/linux | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index f44a9d02fc8d..c9c45ba8b338 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -19,11 +19,17 @@ linux_start() { local _emul_path _tmpdir - load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in + aarch64) + load_kld -e 'linux64elf' linux64 + ;; amd64) + load_kld -e 'linuxelf' linux load_kld -e 'linux64elf' linux64 ;; + i386) + load_kld -e 'linuxelf' linux + ;; esac _emul_path="$(sysctl -n compat.linux.emul_path)" From owner-dev-commits-src-main@freebsd.org Thu Mar 18 20:32:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC5F65ABED5; Thu, 18 Mar 2021 20:32:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1dxQ51xjz4k4P; Thu, 18 Mar 2021 20:32:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F683346; Thu, 18 Mar 2021 20:32:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IKWQQM001931; Thu, 18 Mar 2021 20:32:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKWQga001930; Thu, 18 Mar 2021 20:32:26 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:32:26 GMT Message-Id: <202103182032.12IKWQga001930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: d4697a6b5616 - main - vtnet: fix TSO for TCP/IPv6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4697a6b56168876fc0ffec1a0bb1b24d25b198e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:32:26 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=d4697a6b56168876fc0ffec1a0bb1b24d25b198e commit d4697a6b56168876fc0ffec1a0bb1b24d25b198e Author: Michael Tuexen AuthorDate: 2021-03-18 20:25:47 +0000 Commit: Michael Tuexen CommitDate: 2021-03-18 20:32:20 +0000 vtnet: fix TSO for TCP/IPv6 The decision whether a TCP packet is sent over IPv4 or IPv6 was based on ethertype, which works correctly. In D27926 the criteria was changed to checking if the CSUM_IP_TSO flag is set in the csum-flags and then considering it to be TCP/IPv4. However, the TCP stack sets the flag to CSUM_TSO for IPv4 and IPv6, where CSUM_TSO is defined as CSUM_IP_TSO|CSUM_IP6_TSO. Therefore TCP/IPv6 packets gets mis-classified as TCP/IPv4, which breaks TSO for TCP/IPv6. This patch bases the check again on the ethertype. This fix will be MFC instantly as discussed with re(gjb). MFC after: instantly PR: 254366 Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D29331 --- sys/dev/virtio/network/if_vtnet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 09110183c30f..3650d19fbe0e 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2389,7 +2389,7 @@ vtnet_txq_offload_ctx(struct vtnet_txq *txq, struct mbuf *m, int *etype, } static int -vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, +vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int eth_type, int offset, struct virtio_net_hdr *hdr) { static struct timeval lastecn; @@ -2407,8 +2407,8 @@ vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, hdr->hdr_len = vtnet_gtoh16(sc, offset + (tcp->th_off << 2)); hdr->gso_size = vtnet_gtoh16(sc, m->m_pkthdr.tso_segsz); - hdr->gso_type = (flags & CSUM_IP_TSO) ? - VIRTIO_NET_HDR_GSO_TCPV4 : VIRTIO_NET_HDR_GSO_TCPV6; + hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 : + VIRTIO_NET_HDR_GSO_TCPV6; if (__predict_false(tcp->th_flags & TH_CWR)) { /* @@ -2474,7 +2474,7 @@ vtnet_txq_offload(struct vtnet_txq *txq, struct mbuf *m, goto drop; } - error = vtnet_txq_offload_tso(txq, m, flags, csum_start, hdr); + error = vtnet_txq_offload_tso(txq, m, etype, csum_start, hdr); if (error) goto drop; } From owner-dev-commits-src-main@freebsd.org Thu Mar 18 20:34:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DFA25AC294; Thu, 18 Mar 2021 20:34:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1dzS0PY6z4k69; Thu, 18 Mar 2021 20:34:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00D8434C; Thu, 18 Mar 2021 20:34:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IKYBQ8002445; Thu, 18 Mar 2021 20:34:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKYBTH002444; Thu, 18 Mar 2021 20:34:11 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:34:11 GMT Message-Id: <202103182034.12IKYBTH002444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c853c53d024a - main - Add Chacha20+Poly1035 to the list of AEAD algorithms. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c853c53d024a3cc950854dfaade7f50303c5a022 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:34:12 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c853c53d024a3cc950854dfaade7f50303c5a022 commit c853c53d024a3cc950854dfaade7f50303c5a022 Author: John Baldwin AuthorDate: 2021-03-18 20:31:39 +0000 Commit: John Baldwin CommitDate: 2021-03-18 20:33:11 +0000 Add Chacha20+Poly1035 to the list of AEAD algorithms. Sponsored by: Netflix --- share/man/man9/crypto.9 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/man/man9/crypto.9 b/share/man/man9/crypto.9 index 0ea24356e975..69fe3339a757 100644 --- a/share/man/man9/crypto.9 +++ b/share/man/man9/crypto.9 @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 11, 2020 +.Dd March 18, 2021 .Dt CRYPTO 9 .Os .Sh NAME @@ -136,9 +136,10 @@ The following encryption algorithms are supported: The following authenticated encryption with additional data (AEAD) algorithms are supported: .Pp -.Bl -tag -offset indent -width CRYPTO_AES_NIST_GCM_16 -compact +.Bl -tag -offset indent -width CRYPTO_CHACHA20_POLY1305 -compact .It Dv CRYPTO_AES_CCM_16 .It Dv CRYPTO_AES_NIST_GCM_16 +.It Dv CRYPTO_CHACHA20_POLY1305 .El .Pp The following compression algorithms are supported: From owner-dev-commits-src-main@freebsd.org Thu Mar 18 20:53:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0156C5ACFB1; Thu, 18 Mar 2021 20:53:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1fPT6gVQz4m63; Thu, 18 Mar 2021 20:53:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7B858B1; Thu, 18 Mar 2021 20:53:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IKrHDw028326; Thu, 18 Mar 2021 20:53:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKrH04028325; Thu, 18 Mar 2021 20:53:17 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:53:17 GMT Message-Id: <202103182053.12IKrH04028325@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 6ceacebdf522 - main - Unbreak MSG_CMSG_CLOEXEC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ceacebdf5221133943ab3b6b56751c8b51c3e2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:53:18 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=6ceacebdf5221133943ab3b6b56751c8b51c3e2b commit 6ceacebdf5221133943ab3b6b56751c8b51c3e2b Author: Alex Richardson AuthorDate: 2021-03-18 20:52:20 +0000 Commit: Alex Richardson CommitDate: 2021-03-18 20:52:20 +0000 Unbreak MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC has not been working since 2015 (SVN r284380) because _finstall expects O_CLOEXEC and not UF_EXCLOSE as the flags argument. This was probably not noticed because we don't have a test for this flag so this commit adds one. I found this problem because one of the libwayland tests was failing. Fixes: ea31808c3b07 ("fd: move out actual fp installation to _finstall") MFC after: 3 days Reviewed By: mjg, kib Differential Revision: https://reviews.freebsd.org/D29328 --- sys/kern/uipc_usrreq.c | 2 +- tests/sys/kern/unix_passfd_test.c | 45 ++++++++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index ca23ccbdb05e..4466ae8822cd 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -2067,7 +2067,7 @@ unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags) } for (i = 0; i < newfds; i++, fdp++) { _finstall(fdesc, fdep[i]->fde_file, *fdp, - (flags & MSG_CMSG_CLOEXEC) != 0 ? UF_EXCLOSE : 0, + (flags & MSG_CMSG_CLOEXEC) != 0 ? O_CLOEXEC : 0, &fdep[i]->fde_caps); unp_externalize_fp(fdep[i]->fde_file); } diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c index 2fac0b3f1a0a..2b5cdde012c1 100644 --- a/tests/sys/kern/unix_passfd_test.c +++ b/tests/sys/kern/unix_passfd_test.c @@ -194,7 +194,7 @@ localcreds(int sockfd) static void recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, - size_t cmsgsz) + size_t cmsgsz, int recvmsg_flags) { struct cmsghdr *cmsghdr; struct msghdr msghdr; @@ -216,7 +216,7 @@ recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - len = recvmsg(sockfd, &msghdr, 0); + len = recvmsg(sockfd, &msghdr, recvmsg_flags); ATF_REQUIRE_MSG(len != -1, "recvmsg failed: %s", strerror(errno)); ATF_REQUIRE_MSG((size_t)len == buflen, "recvmsg: %zd bytes received; expected %zd", len, buflen); @@ -243,12 +243,12 @@ recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, } static void -recvfd(int sockfd, int *recv_fd) +recvfd(int sockfd, int *recv_fd, int flags) { char ch = 0; recvfd_payload(sockfd, recv_fd, &ch, sizeof(ch), - CMSG_SPACE(sizeof(int))); + CMSG_SPACE(sizeof(int)), flags); } /* @@ -266,9 +266,33 @@ ATF_TC_BODY(simple_send_fd, tc) tempfile(&putfd); dofstat(putfd, &putfd_stat); sendfd(fd[0], putfd); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); + dofstat(getfd, &getfd_stat); + samefile(&putfd_stat, &getfd_stat); + close(putfd); + close(getfd); + closesocketpair(fd); +} + +/* + * Like simple_send_fd but also sets MSG_CMSG_CLOEXEC and checks that the + * received file descriptor has the FD_CLOEXEC flag set. + */ +ATF_TC_WITHOUT_HEAD(simple_send_fd_msg_cmsg_cloexec); +ATF_TC_BODY(simple_send_fd_msg_cmsg_cloexec, tc) +{ + struct stat getfd_stat, putfd_stat; + int fd[2], getfd, putfd; + + domainsocketpair(fd); + tempfile(&putfd); + dofstat(putfd, &putfd_stat); + sendfd(fd[0], putfd); + recvfd(fd[1], &getfd, MSG_CMSG_CLOEXEC); dofstat(getfd, &getfd_stat); samefile(&putfd_stat, &getfd_stat); + ATF_REQUIRE_EQ_MSG(fcntl(getfd, F_GETFD) & FD_CLOEXEC, FD_CLOEXEC, + "FD_CLOEXEC not set on the received file descriptor"); close(putfd); close(getfd); closesocketpair(fd); @@ -289,7 +313,7 @@ ATF_TC_BODY(send_and_close, tc) dofstat(putfd, &putfd_stat); sendfd(fd[0], putfd); close(putfd); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); dofstat(getfd, &getfd_stat); samefile(&putfd_stat, &getfd_stat); close(getfd); @@ -331,8 +355,8 @@ ATF_TC_BODY(two_files, tc) sendfd(fd[0], putfd_2); close(putfd_1); close(putfd_2); - recvfd(fd[1], &getfd_1); - recvfd(fd[1], &getfd_2); + recvfd(fd[1], &getfd_1, 0); + recvfd(fd[1], &getfd_2, 0); dofstat(getfd_1, &getfd_1_stat); dofstat(getfd_2, &getfd_2_stat); samefile(&putfd_1_stat, &getfd_1_stat); @@ -355,7 +379,7 @@ ATF_TC_BODY(bundle, tc) sendfd(fd[0], fd[0]); close(fd[0]); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); close(getfd); close(fd[1]); } @@ -430,7 +454,7 @@ ATF_TC_BODY(rights_creds_payload, tc) len = sendfd_payload(fd[0], putfd, buf, sendspace); ATF_REQUIRE_MSG(len < sendspace, "sendmsg: %zu bytes sent", len); recvfd_payload(fd[1], &getfd, buf, len, - CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int))); + CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), 0); close(putfd); close(getfd); @@ -695,6 +719,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, simple_send_fd); + ATF_TP_ADD_TC(tp, simple_send_fd_msg_cmsg_cloexec); ATF_TP_ADD_TC(tp, send_and_close); ATF_TP_ADD_TC(tp, send_and_cancel); ATF_TP_ADD_TC(tp, two_files); From owner-dev-commits-src-main@freebsd.org Thu Mar 18 23:09:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A2675B0069; Thu, 18 Mar 2021 23:09:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1jR12dLfz4tl9; Thu, 18 Mar 2021 23:09:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48B4F224E; Thu, 18 Mar 2021 23:09:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IN9nJq002408; Thu, 18 Mar 2021 23:09:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IN9nXd002407; Thu, 18 Mar 2021 23:09:49 GMT (envelope-from git) Date: Thu, 18 Mar 2021 23:09:49 GMT Message-Id: <202103182309.12IN9nXd002407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 929acdb19acb - main - fusefs: fix two bugs regarding fcntl file locks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 929acdb19acb67cc0e6ee5439df98e28a84d4772 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 23:09:49 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=929acdb19acb67cc0e6ee5439df98e28a84d4772 commit 929acdb19acb67cc0e6ee5439df98e28a84d4772 Author: Alan Somers AuthorDate: 2021-03-18 20:27:27 +0000 Commit: Alan Somers CommitDate: 2021-03-18 23:09:10 +0000 fusefs: fix two bugs regarding fcntl file locks 1) F_SETLKW (blocking) operations would be sent to the FUSE server as F_SETLK (non-blocking). 2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply return EINVAL. PR: 253500 Reported by: John Millikin MFC after: 2 weeks --- sys/fs/fuse/fuse_vnops.c | 10 +++++++--- tests/sys/fs/fusefs/flush.cc | 12 ++++++++++- tests/sys/fs/fusefs/locks.cc | 45 +++++++++++++++++++++++++++++++++++++++++- tests/sys/fs/fusefs/release.cc | 12 ++++++++++- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 5bbde1e278c9..cdbc42f5adf4 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -437,10 +437,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) op = FUSE_GETLK; break; case F_SETLK: - op = FUSE_SETLK; + if (flags & F_WAIT) + op = FUSE_SETLKW; + else + op = FUSE_SETLK; break; - case F_SETLKW: - op = FUSE_SETLKW; + case F_UNLCK: + op = FUSE_SETLK; + flags |= F_UNLCK; break; default: return EINVAL; diff --git a/tests/sys/fs/fusefs/flush.cc b/tests/sys/fs/fusefs/flush.cc index 4d5a87bd66d5..d31a9fdaa386 100644 --- a/tests/sys/fs/fusefs/flush.cc +++ b/tests/sys/fs/fusefs/flush.cc @@ -210,6 +210,16 @@ TEST_F(FlushWithLocks, unlock_on_close) ResultOf([=](auto in) { return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && + in.body.setlk.lk.type == F_RDLCK && + in.body.setlk.fh == FH); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(0))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLK && + in.header.nodeid == ino && + in.body.setlk.lk.type == F_UNLCK && in.body.setlk.fh == FH); }, Eq(true)), _) @@ -224,7 +234,7 @@ TEST_F(FlushWithLocks, unlock_on_close) fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; - ASSERT_NE(-1, fcntl(fd, F_SETLKW, &fl)) << strerror(errno); + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); fd2 = open(FULLPATH, O_WRONLY); ASSERT_LE(0, fd2) << strerror(errno); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index f3f1d42637d9..49f495412259 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -72,6 +72,23 @@ void expect_setlk(uint64_t ino, pid_t pid, uint64_t start, uint64_t end, return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && in.body.setlk.fh == FH && + in.body.setlk.owner == (uint32_t)pid && + in.body.setlk.lk.start == start && + in.body.setlk.lk.end == end && + in.body.setlk.lk.type == type && + in.body.setlk.lk.pid == (uint64_t)pid); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(err))); +} +void expect_setlkw(uint64_t ino, pid_t pid, uint64_t start, uint64_t end, + uint32_t type, int err) +{ + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLKW && + in.header.nodeid == ino && + in.body.setlkw.fh == FH && in.body.setlkw.owner == (uint32_t)pid && in.body.setlkw.lk.start == start && in.body.setlkw.lk.end == end && @@ -343,6 +360,32 @@ TEST_F(SetlkFallback, local) leak(fd); } +/* Clear a lock with FUSE_SETLK */ +TEST_F(Setlk, clear) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + struct flock fl; + int fd; + pid_t pid = 1234; + + expect_lookup(RELPATH, ino); + expect_open(ino, 0, 1); + expect_setlk(ino, pid, 10, 1009, F_UNLCK, 0); + + fd = open(FULLPATH, O_RDWR); + ASSERT_LE(0, fd) << strerror(errno); + fl.l_start = 10; + fl.l_len = 1000; + fl.l_pid = pid; + fl.l_type = F_UNLCK; + fl.l_whence = SEEK_SET; + fl.l_sysid = 0; + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); + leak(fd); +} + /* Set a new lock with FUSE_SETLK */ TEST_F(Setlk, set) { @@ -465,7 +508,7 @@ TEST_F(Setlkw, set) expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); - expect_setlk(ino, pid, 10, 1009, F_RDLCK, 0); + expect_setlkw(ino, pid, 10, 1009, F_RDLCK, 0); fd = open(FULLPATH, O_RDWR); ASSERT_LE(0, fd) << strerror(errno); diff --git a/tests/sys/fs/fusefs/release.cc b/tests/sys/fs/fusefs/release.cc index 3caf8589352d..daa3ce39f573 100644 --- a/tests/sys/fs/fusefs/release.cc +++ b/tests/sys/fs/fusefs/release.cc @@ -206,6 +206,16 @@ TEST_F(ReleaseWithLocks, unlock_on_close) ResultOf([=](auto in) { return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && + in.body.setlk.lk.type == F_RDLCK && + in.body.setlk.fh == FH); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(0))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLK && + in.header.nodeid == ino && + in.body.setlk.lk.type == F_UNLCK && in.body.setlk.fh == FH); }, Eq(true)), _) @@ -221,7 +231,7 @@ TEST_F(ReleaseWithLocks, unlock_on_close) fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; - ASSERT_NE(-1, fcntl(fd, F_SETLKW, &fl)) << strerror(errno); + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); ASSERT_EQ(0, close(fd)) << strerror(errno); } From owner-dev-commits-src-main@freebsd.org Thu Mar 18 23:31:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E36975B06FC; Thu, 18 Mar 2021 23:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1jwM64pBz4vrS; Thu, 18 Mar 2021 23:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3B552B2E; Thu, 18 Mar 2021 23:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12INVl4G040336; Thu, 18 Mar 2021 23:31:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12INVllW040335; Thu, 18 Mar 2021 23:31:47 GMT (envelope-from git) Date: Thu, 18 Mar 2021 23:31:47 GMT Message-Id: <202103182331.12INVllW040335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 621b5090487d - main - Refactor configuration management in bhyve. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 621b5090487de9fed1b503769702a9a2a27cc7bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 23:31:48 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=621b5090487de9fed1b503769702a9a2a27cc7bb commit 621b5090487de9fed1b503769702a9a2a27cc7bb Author: John Baldwin AuthorDate: 2019-06-26 20:30:41 +0000 Commit: John Baldwin CommitDate: 2021-03-18 23:30:26 +0000 Refactor configuration management in bhyve. Replace the existing ad-hoc configuration via various global variables with a small database of key-value pairs. The database supports heirarchical keys using a MIB-like syntax to name the path to a given key. Values are always stored as strings. The API used to manage configuation values does include wrappers to handling boolean values. Other values use non-string types require parsing by consumers. The configuration values are stored in a tree using nvlists. Leaf nodes hold string values. Configuration values are permitted to reference other configuration values using '%(name)'. This permits constructing template configurations. All existing command line arguments now set configuration values. For devices, the "-s" option parses its option argument to generate a list of key-value pairs for the given device. A new '-o' command line option permits setting an individual configuration variable. The key name is always given as a full path of dot-separated components. A new '-k' command line option parses a simple configuration file. This configuration file holds a flat list of 'key=value' lines where the 'key' is the full path of a configuration variable. Lines starting with a '#' are comments. In general, bhyve starts by parsing command line options in sequence and applying those settings to configuration values. Once this is complete, bhyve then begins initializing its state based on the configuration values. This means that subsequent configuration options or files may override or supplement previously given settings. A special 'config.dump' configuration value can be set to true to help debug configuration issues. When this value is set, bhyve will print out the configuration variables as a flat list of 'key=value' lines. Most command line argments map to a single configuration variable, e.g. '-w' sets the 'x86.strictmsr' value to false. A few command line arguments have less obvious effects: - Multiple '-p' options append their values (as a comma-seperated list) to "vcpu.N.cpuset" values (where N is a decimal vcpu number). - For '-s' options, a pci... node is created. The first argument to '-s' (the device type) is used as the value of a "device" variable. Additional comma-separated arguments are then parsed into 'key=value' pairs and used to set additional variables under the device node. A PCI device emulation driver can provide its own hook to override the parsing of the additonal '-s' arguments after the device type. After the configuration phase as completed, the init_pci hook then walks the "pci..." nodes. It uses the "device" value to find the device model to use. The device model's init routine is passed a reference to its nvlist node in the configuration tree which it can query for specific variables. The result is that a lot of the string parsing is removed from the device models and centralized. In addition, adding a new variable just requires teaching the model to look for the new variable. - For '-l' options, a similar model is used where the string is parsed into values that are later read during initialization. One key note here is that the serial ports use the commonly used lowercase names from existing documentation and examples (e.g. "lpc.com1") instead of the uppercase names previously used internally in bhyve. Reviewed by: grehan MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D26035 --- usr.sbin/bhyve/Makefile | 5 +- usr.sbin/bhyve/bhyve.8 | 47 ++- usr.sbin/bhyve/bhyve_config.5 | 560 ++++++++++++++++++++++++++++++++++++ usr.sbin/bhyve/bhyverun.c | 485 ++++++++++++++++++++----------- usr.sbin/bhyve/bhyverun.h | 7 +- usr.sbin/bhyve/block_if.c | 98 ++++--- usr.sbin/bhyve/block_if.h | 4 +- usr.sbin/bhyve/config.c | 431 +++++++++++++++++++++++++++ usr.sbin/bhyve/config.h | 119 ++++++++ usr.sbin/bhyve/gdb.c | 12 + usr.sbin/bhyve/hda_codec.c | 6 +- usr.sbin/bhyve/inout.c | 6 +- usr.sbin/bhyve/inout.h | 3 +- usr.sbin/bhyve/mevent.c | 2 - usr.sbin/bhyve/mevent_test.c | 2 - usr.sbin/bhyve/net_backends.c | 106 +++---- usr.sbin/bhyve/net_backends.h | 3 +- usr.sbin/bhyve/net_utils.c | 5 +- usr.sbin/bhyve/net_utils.h | 2 +- usr.sbin/bhyve/pci_ahci.c | 283 ++++++++++-------- usr.sbin/bhyve/pci_e82545.c | 65 +---- usr.sbin/bhyve/pci_emul.c | 147 +++++++--- usr.sbin/bhyve/pci_emul.h | 7 +- usr.sbin/bhyve/pci_fbuf.c | 194 +++++++------ usr.sbin/bhyve/pci_hda.c | 95 ++---- usr.sbin/bhyve/pci_hda.h | 2 +- usr.sbin/bhyve/pci_hostbridge.c | 32 ++- usr.sbin/bhyve/pci_lpc.c | 60 ++-- usr.sbin/bhyve/pci_nvme.c | 164 +++++------ usr.sbin/bhyve/pci_passthru.c | 47 ++- usr.sbin/bhyve/pci_uart.c | 19 +- usr.sbin/bhyve/pci_virtio_9p.c | 80 +++--- usr.sbin/bhyve/pci_virtio_block.c | 15 +- usr.sbin/bhyve/pci_virtio_console.c | 131 +++++++-- usr.sbin/bhyve/pci_virtio_net.c | 97 +++---- usr.sbin/bhyve/pci_virtio_rnd.c | 2 +- usr.sbin/bhyve/pci_virtio_scsi.c | 49 ++-- usr.sbin/bhyve/pci_xhci.c | 220 +++++++++----- usr.sbin/bhyve/pctestdev.c | 9 - usr.sbin/bhyve/pctestdev.h | 1 - usr.sbin/bhyve/rtc.c | 9 +- usr.sbin/bhyve/rtc.h | 2 +- usr.sbin/bhyve/smbiostbl.c | 5 + usr.sbin/bhyve/uart_emul.c | 12 +- usr.sbin/bhyve/uart_emul.h | 2 +- usr.sbin/bhyve/usb_emul.c | 2 +- usr.sbin/bhyve/usb_emul.h | 5 +- usr.sbin/bhyve/usb_mouse.c | 5 +- 48 files changed, 2593 insertions(+), 1071 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index a4fc3deea77e..e35d528ab605 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -10,7 +10,7 @@ CFLAGS+=-I${SRCTOP}/sys PROG= bhyve PACKAGE= bhyve -MAN= bhyve.8 +MAN= bhyve.8 bhyve_config.5 BHYVE_SYSDIR?=${SRCTOP} @@ -22,6 +22,7 @@ SRCS= \ bhyverun.c \ block_if.c \ bootrom.c \ + config.c \ console.c \ ctl_util.c \ ctl_scsi_all.c \ @@ -83,7 +84,7 @@ CFLAGS.kernemu_dev.c+= -I${SRCTOP}/sys/amd64 .PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm SRCS+= vmm_instruction_emul.c -LIBADD= vmmapi md pthread z util sbuf cam 9p +LIBADD= vmmapi md nv pthread z util sbuf cam 9p .if ${MK_CASPER} != "no" LIBADD+= casper diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 115727a136a7..04e22302d9d7 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 18, 2021 +.Dd March 18, 2021 .Dt BHYVE 8 .Os .Sh NAME @@ -46,6 +46,7 @@ .Oc .Sm on .Op Fl G Ar port +.Op Fl k Ar file .Oo Fl l .Sm off .Cm help | Ar lpcdev Op Cm \&, Ar conf @@ -59,6 +60,7 @@ .Oc .Sm on .Oc +.Op Fl o Ar var Ns Cm = Ns Ar value .Op Fl p Ar vcpu Ns Cm \&: Ns Ar hostcpu .Op Fl r Ar file .Oo Fl s @@ -149,6 +151,17 @@ Print help message and exit. .It Fl H Yield the virtual CPU thread when a HLT instruction is detected. If this option is not specified, virtual CPUs will use 100% of a host CPU. +.It Fl k Ar file +Set configuration variables from a simple, key-value config file. +Each line of the config file is expected to consist of a config variable +name, an equals sign +.Pq Sq = , +and a value. +No spaces are permitted between the variable name, equals sign, or +value. +Blank lines and lines starting with +.Sq # +are ignored. .It Fl l Op Ar help|lpcdev Ns Op , Ns Ar conf Allow devices behind the LPC PCI-ISA bridge to be configured. The only supported devices are the TTY-class devices @@ -174,6 +187,11 @@ If no suffix is given, the value is assumed to be in megabytes. .Pp .Ar memsize defaults to 256M. +.It Fl o Ar var Ns Cm = Ns Ar value +Set the configuration variable +.Ar var +to +.Ar value . .It Fl p Ar vcpu:hostcpu Pin guest's virtual CPU .Em vcpu @@ -594,6 +612,32 @@ Alphanumeric name of the guest. This should be the same as that created by .Xr bhyveload 8 . .El +.Sh CONFIGURATION VARIABLES +.Nm +uses an internal tree of configuration variables to describe global and +per-device settings. +When +.Nm +starts, +it parses command line options (including config files) in the order given +on the command line. +Each command line option sets one or more configuration variables. +For example, +the +.Fl s +option creates a new tree node for a PCI device and sets one or more variables +under that node including the device model and device model-specific variables. +Variables may be set multiple times during this parsing stage with the final +value overriding previous values. +.Pp +Once all of the command line options have been processed, +the configuration values are frozen. +.Nm +then uses the value of configuration values to initialize device models +and global settings. +.Pp +More details on configuration variables can be found in +.Xr bhyve_config 5 . .Sh DEBUG SERVER The current debug server provides limited support for debuggers. .Ss Registers @@ -717,6 +761,7 @@ bhyve -c 2 -m 4G -w -H \\ .Xr ng_socket 4 , .Xr nmdm 4 , .Xr vmm 4 , +.Xr bhyve_config 5 , .Xr ethers 5 , .Xr bhyvectl 8 , .Xr bhyveload 8 diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 new file mode 100644 index 000000000000..4e200a779d50 --- /dev/null +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -0,0 +1,560 @@ +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2021 John H. Baldwin +.\" +.\" 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. +.\" +.Dd March 18, 2021 +.Dt BHYVE_CONFIG 5 +.Os +.Sh NAME +.Nm bhyve_config +.Nd "bhyve configuration variables" +.Sh DESCRIPTION +.Xr bhyve 8 +uses a hierarchical tree of configuration variables to describe global and +per-device settings. +Internal nodes in this tree do not have a value, +only leaf nodes have values. +This manual describes the configuration variables understood by +.Xr bhyve 8 . +If additional variables are defined, +.Xr bhyve 8 +will ignore them and will not emit errors for unknown variables. +However, these additional variables can be referenced by other +variables as described below. +.Sh VARIABLE VALUES +Configuration variable values are stored as strings. +A configuration variable value may refer to one or more other +configuration values by name. +Instances of the pattern +.Sq % Ns Pq Ar var +are replaced by the value of the configuration variable +.Va var . +To avoid unwanted expansion, +.Sq % +characters can be escaped by a leading +.Sq % . +For example, +if a configuration variable +.Va disk +uses the value +.Pa /dev/zvol/bhyve/%(name) , +then the final value of the +.Va disk +variable will be set to the path of a ZFS volume whose name matches +the name of the virtual machine on the pool +.Pa bhyve . +.Pp +Some configuration variables may be interpreted as a boolean value. +For those variables the following case-insensitive values may be used to +indicate true: +.Pp +.Bl -bullet -offset indent -compact +.It +true +.It +on +.It +yes +.It +1 +.El +.Pp +The following values may be used to indicate false: +.Pp +.Bl -bullet -offset indent -compact +.It +false +.It +off +.It +no +.It +0 +.El +.Pp +Some configuration variables may be interperted as an integer. +For those variables, +any syntax supported by +.Xr strtol 3 +may be used. +.Sh GLOBAL SETTINGS +.Ss Architecture Neutral Settings +.Bl -column "memory.guest_in_core" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va name Ta string Ta Ta +The name of the VM. +.It Va cpus Ta integer Ta 1 Ta +The total number of virtual CPUs. +.It Va cores Ta integer Ta 1 Ta +The number of virtual cores in each virtual socket. +.It Va threads Ta integer Ta 1 Ta +The number of virtual CPUs in each virtual core. +.It Va sockets Ta integer Ta 1 Ta +The number of virtual sockets. +.It Va memory.guest_in_core Ta bool Ta false Ta +Include guest memory in core file. +.It Va memory.size Ta string Ta 256M Ta +Guest physical memory size in bytes. +The value must be formatted as described in +.Xr expand_number 3 . +.It Va memory.wired Ta bool Ta false Ta +Wire guest memory. +.It Va acpi_tables Ta bool Ta false Ta +Generate ACPI tables. +.It Va destroy_on_poweroff Ta bool Ta false Ta +Destroy the VM on guest-initiated power-off. +.It Va gdb.port Ta integer Ta 0 Ta +TCP port number for the debug server. +If this is set to a non-zero value, a debug server +will listen for connections on this port. +.It Va gdb.wait Ta bool Ta false Ta +If the debug server is enabled, wait for a debugger to connect +before starting the guest. +.It Va rtc.use_localtime Ta bool Ta true Ta +The real time clock uses the local time of the host. +If this is set to false, the real time clock uses UTC. +.It Va uuid Ta string Ta Ta +The universally unique identifier (UUID) to use in the guest's +System Management BIOS System Information structure. +If an explicit value is not set, a valid UUID is generated from +the host's hostname and the VM name. +.It Va virtio_msix Ta bool Ta true Ta +Use MSI-X interrupts for PCI VirtIO devices. +If set to false, MSI interrupts are used instead. +.It Va config.dump Ta bool Ta false Ta +If this value is set to true, +then +.Xr bhyve 8 +will write all of its configuration variables to stdout and exit +after it has finished parsing command line options. +.El +.Ss x86-Specific Settings +.Bl -column "x86.vmexit_on_pause" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va x86.mptable Ta bool Ta true Ta +Generate an MPTable. +.It Va x86.x2apic Ta bool Ta false Ta +Configure guest's local APICs in x2APIC mode. +.It Va x86.strictio Ta bool Ta false Ta +Exit if a guest accesses an I/O port that is not emulated. +By default, writes are ignored and reads return all bits set. +.It Va x86.strictmsr Ta bool Ta true Ta +Inject a general protection fault if a guest accesses a Model Specific +Register (MSR) that is not emulated. +If this is false, writes are ignored and reads return zero. +.It Va x86.vmexit_on_hlt Ta bool Ta false Ta +Force a VM exit when a guest CPU executes the +.Dv HLT +instruction. +This allows idle guest CPUs to yield the host CPU. +.It Va x86.vmexit_on_pause Ta bool Ta false Ta +Force a VM exit when a guest CPU executes the +.Dv PAUSE +instruction. +.El +.Sh DEVICE SETTINGS +Device settings are stored under a device node. +The device node's name is set by the parent bus of the device. +.Ss PCI Device Settings +PCI devices are described by a device node named +.Dq pci Ns Ar bus . Ns Ar slot . Ns Ar function +where each of +.Ar bus , +.Ar slot , +and +.Ar function +are formatted as decimal values with no padding. +All PCI device nodes must contain a configuration variable named +.Dq device +which specifies the device model to use. +The following PCI device models are supported: +.Bl -tag -indent +.It Li hostbridge +Provide a simple PCI-Host bridge device. +This is usually configured at pci0:0:0 and is required by most guest +operating systems. +.It Li ahci +AHCI storage controller. +.It Li e1000 +Intel e82545 network interface. +.It Li fbuf +VGA framebuffer device attached to VNC server. +.It Li lpc +LPC PCI-ISA bridge with COM1-COM4 16550 serial ports, +a boot ROM, +and an optional debug/test device. +This device must be configured on bus 0. +.It Li hda +High Definition audio controller. +.It Li nvme +NVM Express (NVMe) controller. +.It Li passthru +PCI pass-through device. +.It Li uart +PCI 16550 serial device. +.It Li virtio-9p +VirtIO 9p (VirtFS) interface. +.It Li virtio-blk +VirtIO block storage interface. +.It Li virtio-console +VirtIO console interface. +.It Li virtio-net +VirtIO network interface. +.It Li virtio-rnd +VirtIO RNG interface. +.It Li virtio-scsi +VirtIO SCSI interface. +.It Li xhci +Extensible Host Controller Interface (XHCI) USB controller. +.El +.Ss USB Device Settings +USB controller devices contain zero or more child USB devices +attached to slots. +Each USB device stores its settings in a node named +.Dq slot. Ns Va N +under the controller's device node. +.Va N +is the number of the slot to which the USB device is attached. +Note that USB slot numbers begin at 1. +All USB device nodes must contain a configuration variable named +.Dq device +which specifies the device model to use. +The following USB device models are supported: +.Bl -tag -indent +.It Li tablet +A USB tablet device which provides precise cursor synchronization +when using VNC. +.El +.Ss Block Device Settings +Block devices use the following settings to configure their backing store. +These settings are stored in the configuration node of the respective device. +.Bl -column "sectorsize" "logical[/physical]" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It path Ta string Ta Ta +The path of the file or disk device to use as the backing store. +.It nocache Ta bool Ta false Ta +Disable caching on the backing file by opening the backing file with +.Dv O_DIRECT . +.It nodelete Ta bool Ta false Ta +Disable emulation of guest trim requests via +.Dv DIOCGDELETE +requests. +.It sync Ta bool Ta false Ta +Write changes to the backing file with synchronous writes. +.It direct Ta bool Ta false Ta +An alias for +.Va sync . +.It ro Ta bool Ta false Ta +Disable writes to the backing file. +.It sectorsize Ta Va logical Ns Op / Ns Va physical Ta Ta +Specify the logical and physical sector size of the emulated disk. +If the physical size is not specified, +it is equal to the logical size. +.El +.Ss Network Backend Settings +Network devices use the following settings to configure their backend. +The backend is responsible for passing packets between the device model +and a desired destination. +Configuring a backend requires setting the +.Va backend +variable to one of the following values: +.Bl -tag +.It tap Ns Va N +Use the named +.Xr tap 4 +interface as the backend. +.It vmnet Ns Va N +Use the named +.Xr vmnet 4 +interface as the backend. +.It netgraph +Use a +.Xr netgraph 4 +socket hook as the backend. +This backend uses the following additional variables: +.Bl -column "peerhook" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va path Ta string Ta Ta +The name of the +.Xr netgraph 4 +destination node. +.It Va peerhook Ta string Ta Ta +The name of the destination hook. +.It Va socket Ta string Ta Ta +The name of the created +.Xr ng_socket 4 +node. +.It Va hook Ta string Ta vmlink Ta +The name of the source hook on the created +.Xr ng_socket 4 +node. +.El +.It netmap: Ns Va interface +Use +.Xr netmap 4 +on a network interface as the backend. +.It vale Ns Va bridge : Ns Va port +Use a port on a +.Xr vale 4 +bridge as the backend. +.El +.Ss UART Device Settings +.Bl -column "Name" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va path Ta path Ta Ta +Backend device for the serial port. +Either the pathname of a character device or +.Dq stdio +to use standard input and output of the +.Xr bhyve 8 +process. +.El +.Ss Host Bridge Settings +.Bl -column "vendor" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va vendor Ta integer Ta 0x1275 Ta +PCI vendor ID. +.It Va device Ta integer Ta 0x1275 Ta +PCI device ID. +.El +.Ss AHCI Controller Settings +AHCI controller devices contain zero or more ports each of which +provides a storage device. +Each port stores its settings in a node named +.Dq port. Ns Va N +under the controller's device node. +The +.Va N +values are formatted as successive decimal values starting with 0. +In addition to the block device settings described above, each +port supports the following settings: +.Bl -column "model" "integer" "generated" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va type Ta string Ta Ta +The type of storage device to emulate. +Must be set to either +.Dq cd +or +.Dq hd . +.It Va nmrr Ta integer Ta 0 Ta +Nominal Media Rotation Rate, also known as RPM. +A value 1 of indicates a device with no rate such as a Solid State Disk. +.It Va ser Ta string Ta generated Ta +Serial number of up to twenty characters. +A default serial number is generated using a hash of the backing +store's pathname. +.It Va rev Ta string Ta 001 Ta +Revision number of up to eight characters. +.It Va model Ta string Ta Ta +Model number of up to forty characters. +Separate default model strings are used for +.Dq cd +and +.Dq hd +device types. +.El +.Ss e1000 Settings +In addition to the network backend settings, +Intel e82545 network interfaces support the following variables: +.Bl -column "Name" "MAC address" "generated" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va mac Ta MAC address Ta generated Ta +MAC address. +If an explicit address is not provided, +a MAC address is generated from a hash of the device's PCI address. +.El +.Ss Frame Buffer Settings +.Bl -column "password" "[IP:]port" "127.0.0.1:5900" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va wait Ta bool Ta false Ta +Wait for a remote connection before starting the VM. +.It Va rfb Ta Oo Ar IP Ns : Oc Ns Ar port Ta 127.0.0.1:5900 Ta +TCP address to listen on for remote connections. +The IP address must be given as a numeric address. +IPv6 addresses must be enclosed in square brackets and +support scoped identifiers as described in +.Xr getaddrinfo 3 . +A bare port number may be given in which case the IPv4 +localhost address is used. +.It Va vga Ta string Ta io Ta +VGA configuration. +More details are provided in +.Xr bhyve 8 . +.It Va w Ta integer Ta 1024 Ta +Frame buffer width in pixels. +.It Va h Ta integer Ta 768 Ta +Frame buffer height in pixels. +.It Va password Ta string Ta Ta +Password to use for VNC authentication. +This type of authentication is known to be cryptographically weak and is not +intended for use on untrusted networks. +.El +.Ss High Definition Audio Settings +.Bl -column "Name" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va play Ta path Ta Ta +Host playback device, +typically +.Pa /dev/dsp0 . +.It Va rec Ta path Ta Ta +Host recording device, +typically +.Pa /dev/dsp0 . +.El +.Ss LPC Device Settings +The LPC bridge stores its configuration under a top-level +.Va lpc +node rather than under the PCI LPC device's node. +The following nodes are available under +.Va lpc : +.Bl -column "pc-testdev" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va bootrom Ta path Ta Ta +Path to a boot ROM. +The contents of this file are copied into the guest's +memory ending just before the 4GB physical address. +If a boot ROM is present, a firmware interface device is +also enabled for use by the boot ROM. +.It Va com1 Ta node Ta Ta +Settings for the COM1 serial port device. +.It Va com2 Ta node Ta Ta +Settings for the COM2 serial port device. +.It Va com3 Ta node Ta Ta +Settings for the COM3 serial port device. +.It Va com4 Ta node Ta Ta +Settings for the COM4 serial port device. +.It Va pc-testdev Ta bool Ta false Ta +Enable the PC debug/test device. +.El +.Ss NVMe Controller Settings +Each NVMe controller supports a single storage device. +The device can be backed either by a memory disk described by the +.Va ram +variable, or a block device using the the block device settings described above. +In addition, each controller supports the following settings: +.Bl -column "ioslots" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va maxq Ta integer Ta 16 Ta +Maximum number of I/O submission and completion queue pairs. +.It Va qsz Ta integer Ta 2058 Ta +Number of elements in each I/O queue. +.It Va ioslots Ta integer Ta 8 Ta +Maximum number of concurrent I/O requests. +.It Va sectsz Ta integer Ta Ta +Sector size. +Can be one of 512, 4096, or 8192. +Devices backed by a memory disk use 4096 as the default. +Devices backed by a block device use the block device's sector size +as the default. +.It Va ser Ta string Ta Ta +Serial number of up to twenty characters. +A default serial number is generated using a hash of the device's PCI address. +.It Va eui64 Ta integer Ta Ta +IEEE Extended Unique Identifier. +If an EUI is not provided, a default is generated using a checksum of the +device's PCI address. +.It Va dsm Ta string Ta auto Ta +Whether or not to advertise DataSet Management support. +One of +.Dq auto , +.Dq enable , +or +.Dq disable . +The +.Dq auto +setting only advertises support if the backing store supports +resource freeing, for example via TRIM. +.It Va ram Ta integer Ta Ta +If set, allocate a memory disk as the backing store. +The value of this variable is the size of the memory disk in megabytes. +.El +.Ss PCI Passthrough Settings +.Bl -column "Name" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va bus Ta integer Ta Ta +Host PCI bus address of device to pass through. +.It Va slot Ta integer Ta Ta +Host PCI slot address of device to pass through. +.It Va func Ta integer Ta Ta +Host PCI function address of device to pass through. +.El +.Ss VirtIO 9p Settings +Each VirtIO 9p device exposes a single filesystem from a host path. +.Bl -column "sharename" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va sharename Ta string Ta Ta +The share name exposed to the guest. +.It Va path Ta path Ta Ta +The path of a directory on the host to export to the guest. +.It Va ro Ta bool Ta false Ta +If true, the guest filesystem is read-only. +.El +.Ss VirtIO Console Device Settings +Each VirtIO Console device contains one or more console ports. +Each port stores its settings in a node named +.Dq port. Ns Va N +under the controller's device node. +The +.Va N +values are formatted as successive decimal values starting with 0. +Each port supports the following settings: +.Bl -column "Name" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va name Ta string Ta Ta +The name of the port exposed to the guest. +.It Va path Ta path Ta Ta +The path of a UNIX domain socket providing the host connection for the port. +.El +.Ss VirtIO Network Interface Settings +In addition to the network backend settings, +VirtIO network interfaces support the following variables: +.Bl -column "Name" "MAC address" "generated" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va mac Ta MAC address Ta generated Ta +MAC address. +If an explicit address is not provided, +a MAC address is generated from a hash of the device's PCI address. +.It Va mtu Ta integer Ta 1500 Ta +The largest supported MTU advertised to the guest. +.El +.Ss VirtIO SCSI Settings +.Bl -column "Name" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va dev Ta path Ta Ta +The path of a CAM target layer (CTL) device to export: +.Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc . +.It Va iid Ta integer Ta 0 Ta +Initiator ID to use when sending requests to the CTL port. +.El +.Sh SEE ALSO +.Xr expand_number 3 , +.Xr getaddrinfo 3 , +.Xr strtol 3 , +.Xr netgraph 4 , +.Xr netmap 4 , +.Xr ng_socket 4 , +.Xr tap 4 , +.Xr vale 4 , +.Xr vmnet 4 , +.Xr bhyve 8 diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index aafab4af8d8c..a3e6ef3c4724 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include "acpi.h" #include "atkbdc.h" #include "bootrom.h" +#include "config.h" #include "inout.h" #include "debug.h" #include "fwctl.h" @@ -183,26 +184,11 @@ static const char * const vmx_exit_reason_desc[] = { typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu); extern int vmexit_task_switch(struct vmctx *, struct vm_exit *, int *vcpu); -const char *vmname; - int guest_ncpus; uint16_t cores, maxcpus, sockets, threads; -char *guest_uuid_str; - int raw_stdio = 0; -static int gdb_port = 0; -static int guest_vmexit_on_hlt, guest_vmexit_on_pause; -static int virtio_msix = 1; -static int x2apic_mode = 0; /* default is xAPIC */ -static int destroy_on_poweroff = 0; - -static int strictio; -static int strictmsr = 1; - -static int acpi; - static char *progname; static const int BSP = 0; @@ -238,8 +224,8 @@ usage(int code) fprintf(stderr, "Usage: %s [-aehuwxACDHPSWY]\n" " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" - " %*s [-l ]\n" - " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" + " %*s [-k ] [-l ] [-m mem] [-o =]\n" + " %*s [-p vcpu:hostcpu] [-s ] [-U uuid] []\n" " -a: local apic is in xAPIC mode (deprecated)\n" " -A: create ACPI tables\n" " -c: number of cpus and/or topology specification\n" @@ -248,13 +234,15 @@ usage(int code) " -e: exit on unhandled I/O access\n" " -h: help\n" " -H: vmexit from the guest on hlt\n" + " -k: key=value flat config file\n" " -l: LPC device configuration\n" " -m: memory size in MB\n" + " -o: set config 'var' to 'value'\n" + " -p: pin 'vcpu' to 'hostcpu'\n" + " -P: vmexit from the guest on pause\n" #ifdef BHYVE_SNAPSHOT " -r: path to checkpoint file\n" #endif - " -p: pin 'vcpu' to 'hostcpu'\n" - " -P: vmexit from the guest on pause\n" " -s: PCI slot config\n" " -S: guest memory cannot be swapped\n" " -u: RTC keeps UTC time\n" @@ -271,11 +259,8 @@ usage(int code) /* * XXX This parser is known to have the following issues: - * 1. It accepts null key=value tokens ",,". - * 2. It accepts whitespace after = and before value. - * 3. Values out of range of INT are silently wrapped. - * 4. It doesn't check non-final values. - * 5. The apparently bogus limits of UINT16_MAX are for future expansion. + * 1. It accepts null key=value tokens ",," as setting "cpus" to an + * empty string. * * The acceptance of a null specification ('-c ""') is by design to match the * manual page syntax specification, this results in a topology of 1 vCPU. @@ -283,83 +268,122 @@ usage(int code) static int topology_parse(const char *opt) { - uint64_t ncpus; - int c, chk, n, s, t, tmp; char *cp, *str; - bool ns, scts; - c = 1, n = 1, s = 1, t = 1; - ns = false, scts = false; + if (*opt == '\0') { + set_config_value("sockets", "1"); + set_config_value("cores", "1"); + set_config_value("threads", "1"); + set_config_value("cpus", "1"); + return (0); + } + str = strdup(opt); if (str == NULL) - goto out; + errx(4, "Failed to allocate memory"); while ((cp = strsep(&str, ",")) != NULL) { - if (sscanf(cp, "%i%n", &tmp, &chk) == 1) { - n = tmp; - ns = true; - } else if (sscanf(cp, "cpus=%i%n", &tmp, &chk) == 1) { - n = tmp; - ns = true; - } else if (sscanf(cp, "sockets=%i%n", &tmp, &chk) == 1) { - s = tmp; - scts = true; - } else if (sscanf(cp, "cores=%i%n", &tmp, &chk) == 1) { - c = tmp; - scts = true; - } else if (sscanf(cp, "threads=%i%n", &tmp, &chk) == 1) { - t = tmp; - scts = true; + if (strncmp(cp, "cpus=", strlen("cpus=")) == 0) + set_config_value("cpus", cp + strlen("cpus=")); + else if (strncmp(cp, "sockets=", strlen("sockets=")) == 0) + set_config_value("sockets", cp + strlen("sockets=")); + else if (strncmp(cp, "cores=", strlen("cores=")) == 0) + set_config_value("cores", cp + strlen("cores=")); + else if (strncmp(cp, "threads=", strlen("threads=")) == 0) + set_config_value("threads", cp + strlen("threads=")); #ifdef notyet /* Do not expose this until vmm.ko implements it */ - } else if (sscanf(cp, "maxcpus=%i%n", &tmp, &chk) == 1) { - m = tmp; + else if (strncmp(cp, "maxcpus=", strlen("maxcpus=")) == 0) + set_config_value("maxcpus", cp + strlen("maxcpus=")); #endif - /* Skip the empty argument case from -c "" */ - } else if (cp[0] == '\0') - continue; - else - goto out; - /* Any trailing garbage causes an error */ - if (cp[chk] != '\0') + else if (strchr(cp, '=') != NULL) goto out; + else + set_config_value("cpus", cp); } free(str); - str = NULL; - - /* - * Range check 1 <= n <= UINT16_MAX all values - */ - if (n < 1 || s < 1 || c < 1 || t < 1 || - n > UINT16_MAX || s > UINT16_MAX || c > UINT16_MAX || *** 4873 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Mar 19 03:05:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E59DD5B46EF; Fri, 19 Mar 2021 03:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1pfg5sLlz3N5T; Fri, 19 Mar 2021 03:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBD3558B5; Fri, 19 Mar 2021 03:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12J35FQR019391; Fri, 19 Mar 2021 03:05:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J35F44019390; Fri, 19 Mar 2021 03:05:15 GMT (envelope-from git) Date: Fri, 19 Mar 2021 03:05:15 GMT Message-Id: <202103190305.12J35F44019390@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: f8a6ec2d5727 - main - bhyve: support relocating fbuf and passthru data BARs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8a6ec2d572758da6cfd29fcb4ecf4430463661d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 03:05:16 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=f8a6ec2d572758da6cfd29fcb4ecf4430463661d commit f8a6ec2d572758da6cfd29fcb4ecf4430463661d Author: D Scott Phillips AuthorDate: 2021-03-18 16:08:52 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-19 03:04:36 +0000 bhyve: support relocating fbuf and passthru data BARs We want to allow the UEFI firmware to enumerate and assign addresses to PCI devices so we can boot from NVMe[1]. Address assignment of PCI BARs is properly handled by the PCI emulation code in general, but a few specific cases need additional support. fbuf and passthru map additional objects into the guest physical address space and so need to handle address updates. Here we add a callback to emulated PCI devices to inform them of a BAR configuration change. fbuf and passthru then watch for these BAR changes and relocate the frame buffer memory segment and passthru device mmio area respectively. We also add new VM_MUNMAP_MEMSEG and VM_UNMAP_PPTDEV_MMIO ioctls to vmm(4) to facilitate the unmapping needed for addres updates. [1]: https://github.com/freebsd/uefi-edk2/pull/9/ Originally by: scottph MFC After: 1 week Sponsored by: Intel Corporation Reviewed by: grehan Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D24066 --- lib/libvmmapi/vmmapi.c | 33 +++++++++++- lib/libvmmapi/vmmapi.h | 4 ++ sys/amd64/include/vmm.h | 1 + sys/amd64/include/vmm_dev.h | 11 ++++ sys/amd64/vmm/io/ppt.c | 30 ++++++++++- sys/amd64/vmm/io/ppt.h | 2 + sys/amd64/vmm/vmm.c | 18 +++++++ sys/amd64/vmm/vmm_dev.c | 12 +++++ usr.sbin/bhyve/pci_emul.c | 8 +++ usr.sbin/bhyve/pci_emul.h | 3 ++ usr.sbin/bhyve/pci_fbuf.c | 25 +++++++++ usr.sbin/bhyve/pci_passthru.c | 123 ++++++++++++++++++++++++++++++------------ 12 files changed, 232 insertions(+), 38 deletions(-) diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 7d46a85b1cd5..7faa2fc545ea 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -251,6 +251,19 @@ vm_get_guestmem_from_ctx(struct vmctx *ctx, char **guest_baseaddr, return (0); } +int +vm_munmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, size_t len) +{ + struct vm_munmap munmap; + int error; + + munmap.gpa = gpa; + munmap.len = len; + + error = ioctl(ctx->fd, VM_MUNMAP_MEMSEG, &munmap); + return (error); +} + int vm_mmap_getnext(struct vmctx *ctx, vm_paddr_t *gpa, int *segid, vm_ooffset_t *segoff, size_t *len, int *prot, int *flags) @@ -980,6 +993,22 @@ vm_map_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, return (ioctl(ctx->fd, VM_MAP_PPTDEV_MMIO, &pptmmio)); } +int +vm_unmap_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, + vm_paddr_t gpa, size_t len) +{ + struct vm_pptdev_mmio pptmmio; + + bzero(&pptmmio, sizeof(pptmmio)); + pptmmio.bus = bus; + pptmmio.slot = slot; + pptmmio.func = func; + pptmmio.gpa = gpa; + pptmmio.len = len; + + return (ioctl(ctx->fd, VM_UNMAP_PPTDEV_MMIO, &pptmmio)); +} + int vm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func, uint64_t addr, uint64_t msg, int numvec) @@ -1644,7 +1673,7 @@ vm_get_ioctls(size_t *len) /* keep in sync with machine/vmm_dev.h */ static const cap_ioctl_t vm_ioctl_cmds[] = { VM_RUN, VM_SUSPEND, VM_REINIT, VM_ALLOC_MEMSEG, VM_GET_MEMSEG, VM_MMAP_MEMSEG, VM_MMAP_MEMSEG, - VM_MMAP_GETNEXT, VM_SET_REGISTER, VM_GET_REGISTER, + VM_MMAP_GETNEXT, VM_MUNMAP_MEMSEG, VM_SET_REGISTER, VM_GET_REGISTER, VM_SET_SEGMENT_DESCRIPTOR, VM_GET_SEGMENT_DESCRIPTOR, VM_SET_REGISTER_SET, VM_GET_REGISTER_SET, VM_SET_KERNEMU_DEV, VM_GET_KERNEMU_DEV, @@ -1654,7 +1683,7 @@ vm_get_ioctls(size_t *len) VM_ISA_DEASSERT_IRQ, VM_ISA_PULSE_IRQ, VM_ISA_SET_IRQ_TRIGGER, VM_SET_CAPABILITY, VM_GET_CAPABILITY, VM_BIND_PPTDEV, VM_UNBIND_PPTDEV, VM_MAP_PPTDEV_MMIO, VM_PPTDEV_MSI, - VM_PPTDEV_MSIX, VM_PPTDEV_DISABLE_MSIX, + VM_PPTDEV_MSIX, VM_UNMAP_PPTDEV_MMIO, VM_PPTDEV_DISABLE_MSIX, VM_INJECT_NMI, VM_STATS, VM_STAT_DESC, VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE, VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 9dc44f391d2c..7e3d62b086aa 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -111,6 +111,8 @@ void *vm_create_devmem(struct vmctx *ctx, int segid, const char *name, int vm_mmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, int segid, vm_ooffset_t segoff, size_t len, int prot); +int vm_munmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, size_t len); + int vm_create(const char *name); int vm_get_device_fd(struct vmctx *ctx); struct vmctx *vm_open(const char *name); @@ -176,6 +178,8 @@ int vm_assign_pptdev(struct vmctx *ctx, int bus, int slot, int func); int vm_unassign_pptdev(struct vmctx *ctx, int bus, int slot, int func); int vm_map_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); +int vm_unmap_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, + vm_paddr_t gpa, size_t len); int vm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func, uint64_t addr, uint64_t msg, int numvec); int vm_setup_pptdev_msix(struct vmctx *ctx, int vcpu, int bus, int slot, diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h index 390d8f5699ac..f265237a5303 100644 --- a/sys/amd64/include/vmm.h +++ b/sys/amd64/include/vmm.h @@ -231,6 +231,7 @@ int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, */ int vm_mmap_memseg(struct vm *vm, vm_paddr_t gpa, int segid, vm_ooffset_t off, size_t len, int prot, int flags); +int vm_munmap_memseg(struct vm *vm, vm_paddr_t gpa, size_t len); int vm_alloc_memseg(struct vm *vm, int ident, size_t len, bool sysmem); void vm_free_memseg(struct vm *vm, int ident); int vm_map_mmio(struct vm *vm, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); diff --git a/sys/amd64/include/vmm_dev.h b/sys/amd64/include/vmm_dev.h index e4204e759bf6..a048e05d4b7c 100644 --- a/sys/amd64/include/vmm_dev.h +++ b/sys/amd64/include/vmm_dev.h @@ -49,6 +49,11 @@ struct vm_memmap { #define VM_MEMMAP_F_WIRED 0x01 #define VM_MEMMAP_F_IOMMU 0x02 +struct vm_munmap { + vm_paddr_t gpa; + size_t len; +}; + #define VM_MEMSEG_NAME(m) ((m)->name[0] != '\0' ? (m)->name : NULL) struct vm_memseg { int segid; @@ -270,6 +275,7 @@ enum { IOCNUM_MMAP_MEMSEG = 16, IOCNUM_MMAP_GETNEXT = 17, IOCNUM_GLA2GPA_NOFAULT = 18, + IOCNUM_MUNMAP_MEMSEG = 19, /* register/state accessors */ IOCNUM_SET_REGISTER = 20, @@ -302,6 +308,7 @@ enum { IOCNUM_PPTDEV_MSI = 43, IOCNUM_PPTDEV_MSIX = 44, IOCNUM_PPTDEV_DISABLE_MSIX = 45, + IOCNUM_UNMAP_PPTDEV_MMIO = 46, /* statistics */ IOCNUM_VM_STATS = 50, @@ -358,6 +365,8 @@ enum { _IOW('v', IOCNUM_MMAP_MEMSEG, struct vm_memmap) #define VM_MMAP_GETNEXT \ _IOWR('v', IOCNUM_MMAP_GETNEXT, struct vm_memmap) +#define VM_MUNMAP_MEMSEG \ + _IOW('v', IOCNUM_MUNMAP_MEMSEG, struct vm_munmap) #define VM_SET_REGISTER \ _IOW('v', IOCNUM_SET_REGISTER, struct vm_register) #define VM_GET_REGISTER \ @@ -416,6 +425,8 @@ enum { _IOW('v', IOCNUM_PPTDEV_MSIX, struct vm_pptdev_msix) #define VM_PPTDEV_DISABLE_MSIX \ _IOW('v', IOCNUM_PPTDEV_DISABLE_MSIX, struct vm_pptdev) +#define VM_UNMAP_PPTDEV_MMIO \ + _IOW('v', IOCNUM_UNMAP_PPTDEV_MMIO, struct vm_pptdev_mmio) #define VM_INJECT_NMI \ _IOW('v', IOCNUM_INJECT_NMI, struct vm_nmi) #define VM_STATS \ diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c index 22ad54093081..a936326e8df3 100644 --- a/sys/amd64/vmm/io/ppt.c +++ b/sys/amd64/vmm/io/ppt.c @@ -224,7 +224,7 @@ ppt_find(struct vm *vm, int bus, int slot, int func, struct pptdev **pptp) } static void -ppt_unmap_mmio(struct vm *vm, struct pptdev *ppt) +ppt_unmap_all_mmio(struct vm *vm, struct pptdev *ppt) { int i; struct pptseg *seg; @@ -412,7 +412,7 @@ ppt_unassign_device(struct vm *vm, int bus, int slot, int func) pci_save_state(ppt->dev); ppt_pci_reset(ppt->dev); pci_restore_state(ppt->dev); - ppt_unmap_mmio(vm, ppt); + ppt_unmap_all_mmio(vm, ppt); ppt_teardown_msi(ppt); ppt_teardown_msix(ppt); iommu_remove_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev)); @@ -466,6 +466,32 @@ ppt_map_mmio(struct vm *vm, int bus, int slot, int func, return (ENOSPC); } +int +ppt_unmap_mmio(struct vm *vm, int bus, int slot, int func, + vm_paddr_t gpa, size_t len) +{ + int i, error; + struct pptseg *seg; + struct pptdev *ppt; + + error = ppt_find(vm, bus, slot, func, &ppt); + if (error) + return (error); + + for (i = 0; i < MAX_MMIOSEGS; i++) { + seg = &ppt->mmio[i]; + if (seg->gpa == gpa && seg->len == len) { + error = vm_unmap_mmio(vm, seg->gpa, seg->len); + if (error == 0) { + seg->gpa = 0; + seg->len = 0; + } + return (error); + } + } + return (ENOENT); +} + static int pptintr(void *arg) { diff --git a/sys/amd64/vmm/io/ppt.h b/sys/amd64/vmm/io/ppt.h index 223afb343e8c..e6339f57b8ad 100644 --- a/sys/amd64/vmm/io/ppt.h +++ b/sys/amd64/vmm/io/ppt.h @@ -34,6 +34,8 @@ int ppt_unassign_all(struct vm *vm); int ppt_map_mmio(struct vm *vm, int bus, int slot, int func, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); +int ppt_unmap_mmio(struct vm *vm, int bus, int slot, int func, + vm_paddr_t gpa, size_t len); int ppt_setup_msi(struct vm *vm, int vcpu, int bus, int slot, int func, uint64_t addr, uint64_t msg, int numvec); int ppt_setup_msix(struct vm *vm, int vcpu, int bus, int slot, int func, diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 893c9626e67f..5c2a404f45a7 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -797,6 +797,24 @@ vm_mmap_memseg(struct vm *vm, vm_paddr_t gpa, int segid, vm_ooffset_t first, return (0); } +int +vm_munmap_memseg(struct vm *vm, vm_paddr_t gpa, size_t len) +{ + struct mem_map *m; + int i; + + for (i = 0; i < VM_MAX_MEMMAPS; i++) { + m = &vm->mem_maps[i]; + if (m->gpa == gpa && m->len == len && + (m->flags & VM_MEMMAP_F_IOMMU) == 0) { + vm_free_memmap(vm, i); + return (0); + } + } + + return (EINVAL); +} + int vm_mmap_getnext(struct vm *vm, vm_paddr_t *gpa, int *segid, vm_ooffset_t *segoff, size_t *len, int *prot, int *flags) diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c index da8c051016ec..2da6225fdddd 100644 --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -381,6 +381,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, struct vm_rtc_time *rtctime; struct vm_rtc_data *rtcdata; struct vm_memmap *mm; + struct vm_munmap *mu; struct vm_cpu_topology *topology; struct vm_readwrite_kernemu_device *kernemu; uint64_t *regvals; @@ -435,6 +436,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, break; case VM_MAP_PPTDEV_MMIO: + case VM_UNMAP_PPTDEV_MMIO: case VM_BIND_PPTDEV: case VM_UNBIND_PPTDEV: #ifdef COMPAT_FREEBSD12 @@ -442,6 +444,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, #endif case VM_ALLOC_MEMSEG: case VM_MMAP_MEMSEG: + case VM_MUNMAP_MEMSEG: case VM_REINIT: /* * ioctls that operate on the entire virtual machine must @@ -525,6 +528,11 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, pptmmio->func, pptmmio->gpa, pptmmio->len, pptmmio->hpa); break; + case VM_UNMAP_PPTDEV_MMIO: + pptmmio = (struct vm_pptdev_mmio *)data; + error = ppt_unmap_mmio(sc->vm, pptmmio->bus, pptmmio->slot, + pptmmio->func, pptmmio->gpa, pptmmio->len); + break; case VM_BIND_PPTDEV: pptdev = (struct vm_pptdev *)data; error = vm_assign_pptdev(sc->vm, pptdev->bus, pptdev->slot, @@ -643,6 +651,10 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, error = vm_mmap_memseg(sc->vm, mm->gpa, mm->segid, mm->segoff, mm->len, mm->prot, mm->flags); break; + case VM_MUNMAP_MEMSEG: + mu = (struct vm_munmap *)data; + error = vm_munmap_memseg(sc->vm, mu->gpa, mu->len); + break; #ifdef COMPAT_FREEBSD12 case VM_ALLOC_MEMSEG_FBSD12: error = alloc_memseg(sc, (struct vm_memseg *)data, diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index e498b14ef700..113ac5121238 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -506,10 +506,12 @@ pci_emul_alloc_resource(uint64_t *baseptr, uint64_t limit, uint64_t size, static void modify_bar_registration(struct pci_devinst *pi, int idx, int registration) { + struct pci_devemu *pe; int error; struct inout_port iop; struct mem_range mr; + pe = pi->pi_d; switch (pi->pi_bar[idx].type) { case PCIBAR_IO: bzero(&iop, sizeof(struct inout_port)); @@ -523,6 +525,9 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) error = register_inout(&iop); } else error = unregister_inout(&iop); + if (pe->pe_baraddr != NULL) + (*pe->pe_baraddr)(pi->pi_vmctx, pi, idx, registration, + pi->pi_bar[idx].addr); break; case PCIBAR_MEM32: case PCIBAR_MEM64: @@ -538,6 +543,9 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) error = register_mem(&mr); } else error = unregister_mem(&mr); + if (pe->pe_baraddr != NULL) + (*pe->pe_baraddr)(pi->pi_vmctx, pi, idx, registration, + pi->pi_bar[idx].addr); break; default: error = EINVAL; diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h index 2dbed07dfc14..031a6113fac4 100644 --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -76,6 +76,9 @@ struct pci_devemu { struct pci_devinst *pi, int baridx, uint64_t offset, int size); + void (*pe_baraddr)(struct vmctx *ctx, struct pci_devinst *pi, + int baridx, int enabled, uint64_t address); + /* Save/restore device state */ int (*pe_snapshot)(struct vm_snapshot_meta *meta); int (*pe_pause)(struct vmctx *ctx, struct pci_devinst *pi); diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c index 215ce742edfb..9c5dbd9c6a40 100644 --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -216,6 +216,30 @@ pci_fbuf_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, return (value); } +static void +pci_fbuf_baraddr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + int enabled, uint64_t address) +{ + struct pci_fbuf_softc *sc; + int prot; + + if (baridx != 1) + return; + + sc = pi->pi_arg; + if (!enabled && sc->fbaddr != 0) { + if (vm_munmap_memseg(ctx, sc->fbaddr, FB_SIZE) != 0) + EPRINTLN("pci_fbuf: munmap_memseg failed"); + sc->fbaddr = 0; + } else if (sc->fb_base != NULL && sc->fbaddr == 0) { + prot = PROT_READ | PROT_WRITE; + if (vm_mmap_memseg(ctx, address, VM_FRAMEBUFFER, 0, FB_SIZE, prot) != 0) + EPRINTLN("pci_fbuf: mmap_memseg failed"); + sc->fbaddr = address; + } +} + + static int pci_fbuf_parse_config(struct pci_fbuf_softc *sc, nvlist_t *nvl) { @@ -457,6 +481,7 @@ struct pci_devemu pci_fbuf = { .pe_init = pci_fbuf_init, .pe_barwrite = pci_fbuf_write, .pe_barread = pci_fbuf_read, + .pe_baraddr = pci_fbuf_baraddr, #ifdef BHYVE_SNAPSHOT .pe_snapshot = pci_fbuf_snapshot, #endif diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index f1d306b03959..9028369217d4 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -441,8 +441,8 @@ static int init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base) { int b, s, f; - int error, idx; - size_t len, remaining; + int idx; + size_t remaining; uint32_t table_size, table_offset; uint32_t pba_size, pba_offset; vm_paddr_t start; @@ -504,31 +504,6 @@ init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base) } } - /* Map everything before the MSI-X table */ - if (table_offset > 0) { - len = table_offset; - error = vm_map_pptdev_mmio(ctx, b, s, f, start, len, base); - if (error) - return (error); - - base += len; - start += len; - remaining -= len; - } - - /* Skip the MSI-X table */ - base += table_size; - start += table_size; - remaining -= table_size; - - /* Map everything beyond the end of the MSI-X table */ - if (remaining > 0) { - len = remaining; - error = vm_map_pptdev_mmio(ctx, b, s, f, start, len, base); - if (error) - return (error); - } - return (0); } @@ -595,13 +570,6 @@ cfginitbar(struct vmctx *ctx, struct passthru_softc *sc) error = init_msix_table(ctx, sc, base); if (error) return (-1); - } else if (bartype != PCIBAR_IO) { - /* Map the physical BAR in the guest MMIO space */ - error = vm_map_pptdev_mmio(ctx, sc->psc_sel.pc_bus, - sc->psc_sel.pc_dev, sc->psc_sel.pc_func, - pi->pi_bar[i].addr, pi->pi_bar[i].size, base); - if (error) - return (-1); } /* @@ -988,6 +956,92 @@ passthru_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, return (val); } +static void +passthru_msix_addr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + int enabled, uint64_t address) +{ + struct passthru_softc *sc; + size_t remaining; + uint32_t table_size, table_offset; + + sc = pi->pi_arg; + table_offset = rounddown2(pi->pi_msix.table_offset, 4096); + if (table_offset > 0) { + if (!enabled) { + if (vm_unmap_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + table_offset) != 0) + warnx("pci_passthru: unmap_pptdev_mmio failed"); + } else { + if (vm_map_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + table_offset, + sc->psc_bar[baridx].addr) != 0) + warnx("pci_passthru: map_pptdev_mmio failed"); + } + } + table_size = pi->pi_msix.table_offset - table_offset; + table_size += pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE; + table_size = roundup2(table_size, 4096); + remaining = pi->pi_bar[baridx].size - table_offset - table_size; + if (remaining > 0) { + address += table_offset + table_size; + if (!enabled) { + if (vm_unmap_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + remaining) != 0) + warnx("pci_passthru: unmap_pptdev_mmio failed"); + } else { + if (vm_map_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + remaining, + sc->psc_bar[baridx].addr + + table_offset + table_size) != 0) + warnx("pci_passthru: map_pptdev_mmio failed"); + } + } +} + +static void +passthru_mmio_addr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + int enabled, uint64_t address) +{ + struct passthru_softc *sc; + + sc = pi->pi_arg; + if (!enabled) { + if (vm_unmap_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + sc->psc_bar[baridx].size) != 0) + warnx("pci_passthru: unmap_pptdev_mmio failed"); + } else { + if (vm_map_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + sc->psc_bar[baridx].size, + sc->psc_bar[baridx].addr) != 0) + warnx("pci_passthru: map_pptdev_mmio failed"); + } +} + +static void +passthru_addr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + int enabled, uint64_t address) +{ + + if (pi->pi_bar[baridx].type == PCIBAR_IO) + return; + if (baridx == pci_msix_table_bar(pi)) + passthru_msix_addr(ctx, pi, baridx, enabled, address); + else + passthru_mmio_addr(ctx, pi, baridx, enabled, address); +} + struct pci_devemu passthru = { .pe_emu = "passthru", .pe_init = passthru_init, @@ -996,5 +1050,6 @@ struct pci_devemu passthru = { .pe_cfgread = passthru_cfgread, .pe_barwrite = passthru_write, .pe_barread = passthru_read, + .pe_baraddr = passthru_addr, }; PCI_EMUL_SET(passthru); From owner-dev-commits-src-main@freebsd.org Fri Mar 19 03:54:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FDBE5B6A14; Fri, 19 Mar 2021 03:54:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1qlt74m8z3RHk; Fri, 19 Mar 2021 03:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5F9464FB; Fri, 19 Mar 2021 03:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12J3so4G084686; Fri, 19 Mar 2021 03:54:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J3soGr084685; Fri, 19 Mar 2021 03:54:50 GMT (envelope-from git) Date: Fri, 19 Mar 2021 03:54:50 GMT Message-Id: <202103190354.12J3soGr084685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 794f9f43c8ab - main - rc.conf(5): Bump date on .Dd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 794f9f43c8ab6f217085713055cb4d76d77745a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 03:54:51 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=794f9f43c8ab6f217085713055cb4d76d77745a7 commit 794f9f43c8ab6f217085713055cb4d76d77745a7 Author: Daniel Ebdrup Jensen AuthorDate: 2021-03-19 03:52:26 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-19 03:52:26 +0000 rc.conf(5): Bump date on .Dd Pointy hat to: me Reported by: lwhsu --- share/man/man5/rc.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index ddf4ea120df5..c5261974b475 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2021 +.Dd March 19, 2021 .Dt RC.CONF 5 .Os .Sh NAME From owner-dev-commits-src-main@freebsd.org Fri Mar 19 08:49:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D65EC5BC826; Fri, 19 Mar 2021 08:49:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1yHr5kxFz4RvY; Fri, 19 Mar 2021 08:49:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B831911FD1; Fri, 19 Mar 2021 08:49:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12J8nSJ9069235; Fri, 19 Mar 2021 08:49:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J8nSoX069232; Fri, 19 Mar 2021 08:49:28 GMT (envelope-from git) Date: Fri, 19 Mar 2021 08:49:28 GMT Message-Id: <202103190849.12J8nSoX069232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan Eßer Subject: git: 9300e88039d4 - main - bc: upgrade to version 3.3.4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9300e88039d40a57cb4148e7de7a1808f8ca8d20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 08:49:28 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=9300e88039d40a57cb4148e7de7a1808f8ca8d20 commit 9300e88039d40a57cb4148e7de7a1808f8ca8d20 Merge: 794f9f43c8ab 893ecb52db5e Author: Stefan Eßer AuthorDate: 2021-03-19 08:46:12 +0000 Commit: Stefan Eßer CommitDate: 2021-03-19 08:46:12 +0000 bc: upgrade to version 3.3.4 This upgrade performs an implicit flush of the output if the script funcion read() is called, to make sure a prompt that does not end in a new-line is correctly displayed in line-buffered output mode. Merge commit '893ecb52db5ed47d6c1e8698334d34e0df651612' contrib/bc/Makefile.in | 2 +- contrib/bc/NEWS.md | 9 +++++++++ contrib/bc/README.md | 10 +--------- contrib/bc/src/program.c | 4 ++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --cc contrib/bc/README.md index 2f95e16ed246,000000000000..6a37a8bfb8da mode 100644,000000..100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@@ -1,348 -1,0 +1,340 @@@ +# `bc` + +[![Coverity Scan Build Status][17]][18] + +***WARNING: This project has moved to [https://git.yzena.com/][20] for [these +reasons][21], though GitHub will remain a mirror.*** + +This is an implementation of the [POSIX `bc` calculator][12] that implements +[GNU `bc`][1] extensions, as well as the period (`.`) extension for the BSD +flavor of `bc`. + +For more information, see this `bc`'s full manual. + +This `bc` also includes an implementation of `dc` in the same binary, accessible +via a symbolic link, which implements all FreeBSD and GNU extensions. (If a +standalone `dc` binary is desired, `bc` can be copied and renamed to `dc`.) The +`!` command is omitted; I believe this poses security concerns and that such +functionality is unnecessary. + +For more information, see the `dc`'s full manual. + +This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD +2-clause License. Full license text may be found in the [`LICENSE.md`][4] file. + +## Prerequisites + +This `bc` only requires a C99-compatible compiler and a (mostly) POSIX +2008-compatible system with the XSI (X/Open System Interfaces) option group. + +Since POSIX 2008 with XSI requires the existence of a C99 compiler as `c99`, any +POSIX and XSI-compatible system will have everything needed. + +Systems that are known to work: + +* Linux +* FreeBSD +* OpenBSD +* NetBSD +* Mac OSX +* Solaris* (as long as the Solaris version supports POSIX 2008) +* AIX +* HP-UX* (except for history) + +Please submit bug reports if this `bc` does not build out of the box on any - system besides Windows. If Windows binaries are needed, they can be found at - [xstatic][6]. ++system besides Windows. + +## Build + +This `bc` should build unmodified on any POSIX-compliant system. + +For more complex build requirements than the ones below, see the +[build manual][5]. + - ### Pre-built Binaries - - It is possible to download pre-compiled binaries for a wide list of platforms, - including Linux- and Windows-based systems, from [xstatic][6]. This link always - points to the latest release of `bc`. - +### Default + +For the default build with optimization, use the following commands in the root +directory: + +``` +./configure.sh -O3 +make +``` + +### One Calculator + +To only build `bc`, use the following commands: + +``` +./configure.sh --disable-dc +make +``` + +To only build `dc`, use the following commands: + +``` +./configure.sh --disable-bc +make +``` + +### Debug + +For debug builds, use the following commands in the root directory: + +``` +./configure.sh -g +make +``` + +### Install + +To install, use the following command: + +``` +make install +``` + +By default, `bc` and `dc` will be installed in `/usr/local`. For installing in +other locations, use the `PREFIX` environment variable when running +`configure.sh` or pass the `--prefix=` option to `configure.sh`. See the +[build manual][5], or run `./configure.sh --help`, for more details. + +### Library + +This `bc` does provide a way to build a math library with C bindings. This is +done by the `-a` or `--library` options to `configure.sh`: + +``` +./configure.sh -a +``` + +When building the library, the executables are not built. For more information, +see the [build manual][5]. + +The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the +library is installed. + +The library is built as `bin/libbcl.a`. + +### Package and Distro Maintainers + +#### Recommended Compiler + +When I ran benchmarks with my `bc` compiled under `clang`, it performed much +better than when compiled under `gcc`. I recommend compiling this `bc` with +`clang`. + +I also recommend building this `bc` with C11 if you can because `bc` will detect +a C11 compiler and add `_Noreturn` to any relevant function(s). + +#### Recommended Optimizations + +I wrote this `bc` with Separation of Concerns, which means that there are many +small functions that could be inlined. However, they are often called across +file boundaries, and the default optimizer can only look at the current file, +which means that they are not inlined. + +Thus, because of the way this `bc` is built, it will automatically be slower +than other `bc` implementations when running scripts with no math. (My `bc`'s +math is *much* faster, so any non-trivial script should run faster in my `bc`.) + +Some, or all, of the difference can be made up with the right optimizations. The +optimizations I recommend are: + +1. `-O3` +2. `-flto` (link-time optimization) + +in that order. + +Link-time optimization, in particular, speeds up the `bc` a lot. This is because +when link-time optimization is turned on, the optimizer can look across files +and inline *much* more heavily. + +However, I recommend ***NOT*** using `-march=native`. Doing so will reduce this +`bc`'s performance, at least when building with link-time optimization. See the +[benchmarks][19] for more details. + +#### Stripping Binaries + +By default, non-debug binaries are stripped, but stripping can be disabled with +the `-T` option to `configure.sh`. + +#### Using This `bc` as an Alternative + +If this `bc` is packaged as an alternative to an already existing `bc` package, +it is possible to rename it in the build to prevent name collision. To prepend +to the name, just run the following: + +``` +EXECPREFIX= ./configure.sh +``` + +To append to the name, just run the following: + +``` +EXECSUFFIX= ./configure.sh +``` + +If a package maintainer wishes to add both a prefix and a suffix, that is +allowed. + +**Note**: The suggested name (and package name) when `bc` is not available is +`bc-gh`. + +#### Karatsuba Number + +Package and distro maintainers have one tool at their disposal to build this +`bc` in the optimal configuration: `karatsuba.py`. + +This script is not a compile-time or runtime prerequisite; it is for package and +distro maintainers to run once when a package is being created. It finds the +optimal Karatsuba number (see the [algorithms manual][7] for more information) +for the machine that it is running on. + +The easiest way to run this script is with `make karatsuba`. + +If desired, maintainers can also skip running this script because there is a +sane default for the Karatsuba number. + +## Status + +This `bc` is robust. + +It is well-tested, fuzzed, and fully standards-compliant (though not certified) +with POSIX `bc`. The math has been tested with 40+ million random problems, so +it is as correct as I can make it. + +This `bc` can be used as a drop-in replacement for any existing `bc`. This `bc` +is also compatible with MinGW toolchains, though history is not supported on +Windows. + +In addition, this `bc` is considered complete; i.e., there will be no more +releases with additional features. However, it *is* actively maintained, so if +any bugs are found, they will be fixed in new releases. Also, additional +translations will also be added as they are provided. + +## Comparison to GNU `bc` + +This `bc` compares favorably to GNU `bc`. + +* It has more extensions, which make this `bc` more useful for scripting. +* This `bc` is a bit more POSIX compliant. +* It has a much less buggy parser. The GNU `bc` will give parse errors for what + is actually valid `bc` code, or should be. For example, putting an `else` on + a new line after a brace can cause GNU `bc` to give a parse error. +* This `bc` has fewer crashes. +* GNU `bc` calculates the wrong number of significant digits for `length(x)`. +* GNU `bc` will sometimes print numbers incorrectly. For example, when running + it on the file `tests/bc/power.txt` in this repo, GNU `bc` gets all the right + answers, but it fails to wrap the numbers at the proper place when outputting + to a file. +* This `bc` is faster. (See [Performance](#performance).) + +### Performance + +Because this `bc` packs more than `1` decimal digit per hardware integer, this +`bc` is faster than GNU `bc` and can be *much* faster. Full benchmarks can be +found at [manuals/benchmarks.md][19]. + +There is one instance where this `bc` is slower: if scripts are light on math. +This is because this `bc`'s intepreter is slightly slower than GNU `bc`, but +that is because it is more robust. See the [benchmarks][19]. + +## Algorithms + +To see what algorithms this `bc` uses, see the [algorithms manual][7]. + +## Locales + +Currently, this `bc` only has support for English (and US English), French, +German, Portuguese, Dutch, Polish, Russian, Japanese, and Chinese locales. +Patches are welcome for translations; use the existing `*.msg` files in +`locales/` as a starting point. + +In addition, patches for improvements are welcome; the last two messages in +Portuguese were made with Google Translate, and the Dutch, Polish, Russian, +Japanese, and Chinese locales were all generated with [DeepL][22]. + +The message files provided assume that locales apply to all regions where a +language is used, but this might not be true for, e.g., `fr_CA` and `fr_CH`. +Any corrections or a confirmation that the current texts are acceptable for +those regions would be appreciated, too. + +## Other Projects + +Other projects based on this bc are: + +* [busybox `bc`][8]. The busybox maintainers have made their own changes, so any + bugs in the busybox `bc` should be reported to them. + +* [toybox `bc`][9]. The maintainer has also made his own changes, so bugs in the + toybox `bc` should be reported there. + +* [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better + to [report bugs there][24], as well as [submit patches][25], and the + maintainers of the package will contact me if necessary. + +## Language + +This `bc` is written in pure ISO C99, using POSIX 2008 APIs. + +## Commit Messages + +This `bc` uses the commit message guidelines laid out in [this blog post][10]. + +## Semantic Versioning + +This `bc` uses [semantic versioning][11]. + +## Contents + +Items labeled with `(maintainer use only)` are not included in release source +tarballs. + +Files: + + .gitignore The git ignore file (maintainer use only). + configure A symlink to configure.sh to make packaging easier. + configure.sh The configure script. + functions.sh A script with functions used by other scripts. + install.sh Install script. + karatsuba.py Script to find the optimal Karatsuba number. + LICENSE.md A Markdown form of the BSD 2-clause License. + link.sh A script to link dc to bc. + locale_install.sh A script to install locales, if desired. + locale_uninstall.sh A script to uninstall locales. + Makefile.in The Makefile template. + manpage.sh Script to generate man pages from markdown files. + NOTICE.md List of contributors and copyright owners. + RELEASE.md A checklist for making a release (maintainer use only). + release.sh A script to test for release (maintainer use only). + safe-install.sh Safe install script from musl libc. + +Folders: + + gen The bc math library, help texts, and code to generate C source. + include All header files. + locales Locale files, in .msg format. Patches welcome for translations. + manuals Manuals for both programs. + src All source code. + tests All tests. + +[1]: https://www.gnu.org/software/bc/ +[4]: ./LICENSE.md +[5]: ./manuals/build.md - [6]: https://pkg.musl.cc/bc/ +[7]: ./manuals/algorithms.md +[8]: https://git.busybox.net/busybox/tree/miscutils/bc.c +[9]: https://github.com/landley/toybox/blob/master/toys/pending/bc.c +[10]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[11]: http://semver.org/ +[12]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html +[17]: https://img.shields.io/coverity/scan/16609.svg +[18]: https://scan.coverity.com/projects/gavinhoward-bc +[19]: ./manuals/benchmarks.md +[20]: https://git.yzena.com/gavin/bc +[21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/ +[22]: https://www.deepl.com/translator +[23]: https://cgit.freebsd.org/src/tree/contrib/bc +[24]: https://bugs.freebsd.org/ +[25]: https://reviews.freebsd.org/ +[26]: ./manuals/bcl.3.md From owner-dev-commits-src-main@freebsd.org Fri Mar 19 12:52:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8364D572666; Fri, 19 Mar 2021 12:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F23hp3K8Pz4jLX; Fri, 19 Mar 2021 12:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64DFB15743; Fri, 19 Mar 2021 12:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JCqwvf097386; Fri, 19 Mar 2021 12:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JCqwql097385; Fri, 19 Mar 2021 12:52:58 GMT (envelope-from git) Date: Fri, 19 Mar 2021 12:52:58 GMT Message-Id: <202103191252.12JCqwql097385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 8ef03ce6db33 - main - development(7): mention the Git mirror list in the manual page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ef03ce6db330fcc20e800c4d15a9f4915c56c43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 12:52:58 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=8ef03ce6db330fcc20e800c4d15a9f4915c56c43 commit 8ef03ce6db330fcc20e800c4d15a9f4915c56c43 Author: Evgeniy Khramtsov AuthorDate: 2021-03-19 12:52:21 +0000 Commit: Li-Wen Hsu CommitDate: 2021-03-19 12:52:21 +0000 development(7): mention the Git mirror list in the manual page MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29234 --- share/man/man7/development.7 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index 67f317b8ec26..6a2d872e506f 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 17, 2021 +.Dd March 19, 2021 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -67,9 +67,9 @@ The push URL is: .Pp .Lk ssh://git@gitrepo.FreeBSD.org/src.git .Pp -There is also a public, read-only GitHub mirror at: +There is also a list of public, read-only Git mirrors at: .Pp -.Lk https://github.com/freebsd/freebsd-src +.Lk https://docs.FreeBSD.org/en/books/handbook/mirrors/#_external_mirrors .Pp The .Ql main From owner-dev-commits-src-main@freebsd.org Fri Mar 19 13:46:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE8E0574DA6; Fri, 19 Mar 2021 13:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F24tT4yrxz4nhk; Fri, 19 Mar 2021 13:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9749216123; Fri, 19 Mar 2021 13:46:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JDkPXp063808; Fri, 19 Mar 2021 13:46:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JDkPZJ063807; Fri, 19 Mar 2021 13:46:25 GMT (envelope-from git) Date: Fri, 19 Mar 2021 13:46:25 GMT Message-Id: <202103191346.12JDkPZJ063807@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Nathan Whitehorn Subject: git: e8b4c5a6226b - main - Clarify that scripted installations don't require specification of boot partitions, as there seems to be widespread confusion on this point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nwhitehorn X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8b4c5a6226b6bde304380de51c347851680b7ed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 13:46:25 -0000 The branch main has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=e8b4c5a6226b6bde304380de51c347851680b7ed commit e8b4c5a6226b6bde304380de51c347851680b7ed Author: Nathan Whitehorn AuthorDate: 2021-03-19 13:44:30 +0000 Commit: Nathan Whitehorn CommitDate: 2021-03-19 13:45:58 +0000 Clarify that scripted installations don't require specification of boot partitions, as there seems to be widespread confusion on this point. MFC after: 1 day --- usr.sbin/bsdinstall/bsdinstall.8 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/bsdinstall/bsdinstall.8 b/usr.sbin/bsdinstall/bsdinstall.8 index 8048e41669ee..ba261ce7301d 100644 --- a/usr.sbin/bsdinstall/bsdinstall.8 +++ b/usr.sbin/bsdinstall/bsdinstall.8 @@ -199,6 +199,10 @@ As an example, a typical invocation looks like: .Pp bsdinstall scriptedpart ada0 { 20G freebsd-ufs /, 4G freebsd-swap, 20G freebsd-ufs /var, auto freebsd-ufs /usr } .Pp +Note that the list of partitions should +.Em not +include boot partitions (e.g. EFI system partitions), which will be created automatically on whatever disk includes /. +.Pp A shorter invocation to use the default partitioning (as .Cm autopart would have used) on the same disk: From owner-dev-commits-src-main@freebsd.org Fri Mar 19 13:56:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29A4C574EDA; Fri, 19 Mar 2021 13:56:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F255y0l8mz4p6D; Fri, 19 Mar 2021 13:56:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CC1616342; Fri, 19 Mar 2021 13:56:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JDuLDo077408; Fri, 19 Mar 2021 13:56:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JDuLN9077407; Fri, 19 Mar 2021 13:56:21 GMT (envelope-from git) Date: Fri, 19 Mar 2021 13:56:21 GMT Message-Id: <202103191356.12JDuLN9077407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: da45b4626641 - main - armv8crypto: note derivation in armv8_crypto_wrap.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da45b462664148ff6f8adbe59847c6c06f295391 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 13:56:22 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=da45b462664148ff6f8adbe59847c6c06f295391 commit da45b462664148ff6f8adbe59847c6c06f295391 Author: Mitchell Horne AuthorDate: 2021-03-15 13:46:03 +0000 Commit: Mitchell Horne CommitDate: 2021-03-19 13:53:49 +0000 armv8crypto: note derivation in armv8_crypto_wrap.c This file inherits some boilerplate and structure from the analogous file in aesni(4), aesni_wrap.c. Note the derivation and the copyright holders of that file. For example, the AES-XTS bits added in 4979620ece984 were ported from aesni(4). Requested by: jmg Reviewed by: imp, gnn MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29268 --- sys/crypto/armv8/armv8_crypto_wrap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/crypto/armv8/armv8_crypto_wrap.c b/sys/crypto/armv8/armv8_crypto_wrap.c index eb4a431d33e9..3c0223964ee4 100644 --- a/sys/crypto/armv8/armv8_crypto_wrap.c +++ b/sys/crypto/armv8/armv8_crypto_wrap.c @@ -26,6 +26,13 @@ * 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. + * + * This file is derived from aesni_wrap.c: + * Copyright (C) 2008 Damien Miller + * Copyright (c) 2010 Konstantin Belousov + * Copyright (c) 2010-2011 Pawel Jakub Dawidek + * Copyright 2012-2013 John-Mark Gurney + * Copyright (c) 2014 The FreeBSD Foundation */ /* From owner-dev-commits-src-main@freebsd.org Fri Mar 19 18:04:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07D7757D242; Fri, 19 Mar 2021 18:04:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2BcZ6gZfz3Njn; Fri, 19 Mar 2021 18:04:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7DA9194D3; Fri, 19 Mar 2021 18:04:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JI4kYv007641; Fri, 19 Mar 2021 18:04:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JI4kqa007640; Fri, 19 Mar 2021 18:04:46 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:04:46 GMT Message-Id: <202103191804.12JI4kqa007640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 473f6163e310 - main - cxgbe(4): use standard sysctl routines to deal with 16b values. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 473f6163e310b773dfd7e500e255d01d7328dd16 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:04:47 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=473f6163e310b773dfd7e500e255d01d7328dd16 commit 473f6163e310b773dfd7e500e255d01d7328dd16 Author: Navdeep Parhar AuthorDate: 2021-03-19 17:56:24 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-19 17:56:24 +0000 cxgbe(4): use standard sysctl routines to deal with 16b values. These routines to handle 8b and 16b types were added in r289773 5+ years ago. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 1 - sys/dev/cxgbe/t4_netmap.c | 30 ++++++++++++----------------- sys/dev/cxgbe/t4_sge.c | 49 ++++++++++++++++------------------------------- 3 files changed, 28 insertions(+), 52 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index be890f035635..82adfac63c91 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1272,7 +1272,6 @@ int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *, bus_addr_t *, void **); int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, void *); -int sysctl_uint16(SYSCTL_HANDLER_ARGS); int t4_setup_adapter_queues(struct adapter *); int t4_teardown_adapter_queues(struct adapter *); int t4_setup_vi_queues(struct vi_info *); diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 29284d76bdda..6078dd89829d 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -168,24 +168,20 @@ alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queue"); children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_abs_id, - 0, sysctl_uint16, "I", "absolute id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cntxt_id, - 0, sysctl_uint16, "I", "SGE context id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cidx, 0, - sysctl_uint16, "I", "consumer index"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "abs_id", CTLFLAG_RD, + &nm_rxq->iq_abs_id, 0, "absolute id of the queue"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &nm_rxq->iq_cntxt_id, 0, "SGE context id of the queue"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &nm_rxq->iq_cidx, 0, "consumer index"); children = SYSCTL_CHILDREN(oid); oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "freelist"); children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->fl_cntxt_id, - 0, sysctl_uint16, "I", "SGE context id of the freelist"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &nm_rxq->fl_cntxt_id, 0, "SGE context id of the freelist"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, &nm_rxq->fl_cidx, 0, "consumer index"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, @@ -252,12 +248,10 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx, SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, &nm_txq->cntxt_id, 0, "SGE context id of the queue"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->cidx, 0, - sysctl_uint16, "I", "consumer index"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->pidx, 0, - sysctl_uint16, "I", "producer index"); + SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &nm_txq->cidx, 0, "consumer index"); + SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &nm_txq->pidx, 0, "producer index"); return (rc); } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 741b1ec5ac86..1818673b5612 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -3737,15 +3737,12 @@ add_iq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, "bus address of descriptor ring"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, iq->qsize * IQ_ESIZE, "descriptor ring size in bytes"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &iq->abs_id, 0, - sysctl_uint16, "I", "absolute id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &iq->cntxt_id, 0, - sysctl_uint16, "I", "SGE context id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &iq->cidx, 0, - sysctl_uint16, "I", "consumer index"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "abs_id", CTLFLAG_RD, + &iq->abs_id, 0, "absolute id of the queue"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &iq->cntxt_id, 0, "SGE context id of the queue"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, &iq->cidx, + 0, "consumer index"); } static void @@ -3763,9 +3760,8 @@ add_fl_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx, SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, fl->sidx * EQ_ESIZE + sc->params.sge.spg_len, "desc ring size in bytes"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &fl->cntxt_id, 0, - sysctl_uint16, "I", "SGE context id of the freelist"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &fl->cntxt_id, 0, "SGE context id of the freelist"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "padding", CTLFLAG_RD, NULL, fl_pad ? 1 : 0, "padding enabled"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "packing", CTLFLAG_RD, NULL, @@ -4275,12 +4271,10 @@ alloc_wrq(struct adapter *sc, struct vi_info *vi, struct sge_wrq *wrq, "desc ring size in bytes"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, &wrq->eq.cntxt_id, 0, "SGE context id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &wrq->eq.cidx, 0, - sysctl_uint16, "I", "consumer index"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "pidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &wrq->eq.pidx, 0, - sysctl_uint16, "I", "producer index"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &wrq->eq.cidx, 0, "consumer index"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &wrq->eq.pidx, 0, "producer index"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "sidx", CTLFLAG_RD, NULL, wrq->eq.sidx, "status page index"); SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_direct", CTLFLAG_RD, @@ -4377,12 +4371,10 @@ alloc_txq(struct vi_info *vi, struct sge_txq *txq, int idx, &eq->abs_id, 0, "absolute id of the queue"); SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, &eq->cntxt_id, 0, "SGE context id of the queue"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &eq->cidx, 0, - sysctl_uint16, "I", "consumer index"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &eq->pidx, 0, - sysctl_uint16, "I", "producer index"); + SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &eq->cidx, 0, "consumer index"); + SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &eq->pidx, 0, "producer index"); SYSCTL_ADD_INT(&vi->ctx, children, OID_AUTO, "sidx", CTLFLAG_RD, NULL, eq->sidx, "status page index"); @@ -6033,15 +6025,6 @@ t4_handle_wrerr_rpl(struct adapter *adap, const __be64 *rpl) return (0); } -int -sysctl_uint16(SYSCTL_HANDLER_ARGS) -{ - uint16_t *id = arg1; - int i = *id; - - return sysctl_handle_int(oidp, &i, 0, req); -} - static inline bool bufidx_used(struct adapter *sc, int idx) { From owner-dev-commits-src-main@freebsd.org Fri Mar 19 18:21:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0860A57D7F4; Fri, 19 Mar 2021 18:21:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2BzN6rjYz3Pph; Fri, 19 Mar 2021 18:21:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDEEF194FD; Fri, 19 Mar 2021 18:21:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JIL4iG028912; Fri, 19 Mar 2021 18:21:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JIL4Ch028911; Fri, 19 Mar 2021 18:21:04 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:21:04 GMT Message-Id: <202103191821.12JIL4Ch028911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: d76f6b8e7389 - main - pfilctl: improve formatting of "hooks" and "heads" command output. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:21:05 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 commit d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 Author: Gleb Smirnoff AuthorDate: 2021-03-19 18:18:05 +0000 Commit: Gleb Smirnoff CommitDate: 2021-03-19 18:18:05 +0000 pfilctl: improve formatting of "hooks" and "heads" command output. In "heads" output just improve the header to describe all of the columns. In "hooks" print filter name and hook name delimited with colon, so that it matches "heads" output and also can be copy-and-pasted straight into the command line for future "link" command. --- sbin/pfilctl/pfilctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/pfilctl/pfilctl.c b/sbin/pfilctl/pfilctl.c index e360c73cb279..2a56009b35b8 100644 --- a/sbin/pfilctl/pfilctl.c +++ b/sbin/pfilctl/pfilctl.c @@ -132,8 +132,8 @@ retry: } #define FMTHD "%16s %8s\n" -#define FMTHK "%29s %16s %16s\n" - printf(FMTHD, "Intercept point", "Type"); +#define FMTHK "%29s %16s:%s\n" + printf("%16s %8s %3s %16s\n", "Intercept point", "Type", "Dir", "Hook"); for (i = 0, h = 0; i < plh.pio_nheads; i++) { printf(FMTHD, plh.pio_heads[i].pio_name, typenames[plh.pio_heads[i].pio_type]); @@ -170,9 +170,9 @@ retry: goto retry; } - printf("Available hooks:\n"); + printf("%16s %16s %8s\n", "Hook", "", "Type"); for (i = 0; i < plh.pio_nhooks; i++) { - printf("\t%s:%s %s\n", plh.pio_hooks[i].pio_module, + printf("%16s:%-16s %8s\n", plh.pio_hooks[i].pio_module, plh.pio_hooks[i].pio_ruleset, typenames[plh.pio_hooks[i].pio_type]); } From owner-dev-commits-src-main@freebsd.org Fri Mar 19 18:39:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8296957ECA6; Fri, 19 Mar 2021 18:39:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2CP13KKVz3RLn; Fri, 19 Mar 2021 18:39:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 650B219F54; Fri, 19 Mar 2021 18:39:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JIdnu9047825; Fri, 19 Mar 2021 18:39:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JIdnkk047824; Fri, 19 Mar 2021 18:39:49 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:39:49 GMT Message-Id: <202103191839.12JIdnkk047824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 7dd1f932c1f5 - main - tests/sys/netgraph: Further CI fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7dd1f932c1f51bfe10da7bc8875879cdcdd40821 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:39:49 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7dd1f932c1f51bfe10da7bc8875879cdcdd40821 commit 7dd1f932c1f51bfe10da7bc8875879cdcdd40821 Author: Alex Richardson AuthorDate: 2021-03-19 18:34:29 +0000 Commit: Alex Richardson CommitDate: 2021-03-19 18:34:30 +0000 tests/sys/netgraph: Further CI fixes I was trying to debug why this test is working locally but failing in CI. While doing so I made some small changes to allow running it with set -e. It turns out the problem is that find_iface does not return anything in Jenkins, so all following tests fail with obscure error messages. To handle this case exit early if $eth is empty. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D29340 --- tests/sys/netgraph/ng_macfilter_test.sh | 57 +++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/tests/sys/netgraph/ng_macfilter_test.sh b/tests/sys/netgraph/ng_macfilter_test.sh index 269de3e130aa..482f32e5d335 100755 --- a/tests/sys/netgraph/ng_macfilter_test.sh +++ b/tests/sys/netgraph/ng_macfilter_test.sh @@ -29,6 +29,8 @@ # # $FreeBSD$ +set -e + progname="$(basename $0 .sh)" entries_lst="/tmp/$progname.entries.lst" entries2_lst="/tmp/$progname.entries2.lst" @@ -124,7 +126,7 @@ test_not_ok () { local msg="$1" _test_next - _test_fails + _test_fail echo "not ok $TSTNR - $msg" return 1 @@ -183,9 +185,24 @@ test_ge () { test_not_ok "$v1 <= $v2 $msg" fi } -test_rc () { test_eq $? $1 "$2"; } -test_failure () { test_ne $? 0 "$1"; } -test_success () { test_eq $? 0 "$1"; } +test_failure () { + msg=$1 + shift + if ! "$@"; then + test_ok "$msg - \"$@\" failed as expected" + else + test_not_ok "$msg - expected \"$@\" to fail but succeeded" + fi +} +test_success () { + msg=$1 + shift + if ! "$@"; then + test_not_ok "$msg - \"$@\" failed unexpectedly" + else + test_ok "$msg - \"$@\" succeeded" + fi +} gethooks () { ngctl msg MF: 'gethooks' \ @@ -217,6 +234,13 @@ genmac () { test_title "Setting up system..." load_modules netgraph ng_socket ng_ether ng_macfilter ng_one2many eth=$(find_iface) +if [ -z "$eth" ]; then + echo "1..1" + echo "not ok 1 - Could not find a valid interface" + echo "Available interfaces:" + ifconfig + exit 1 +fi test_comment "Using $eth..." @@ -239,31 +263,23 @@ test_cnt 46 ################################################################################ test_title "Test: Duplicate default hook" -ngctl connect MF: O2M: default many99 2>/dev/null -test_failure "duplicate connect of default hook" - +test_failure "duplicate connect of default hook" ngctl connect MF: O2M: default many99 ################################################################################ test_title "Test: Add and remove hooks" -ngctl connect MF: O2M: xxx1 many$((HOOKS + 1)) -test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))" -ngctl connect MF: O2M: xxx2 many$((HOOKS + 2)) -test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))" -ngctl connect MF: O2M: xxx3 many$((HOOKS + 3)) -test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))" +test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))" ngctl connect MF: O2M: xxx1 many$((HOOKS + 1)) +test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))" ngctl connect MF: O2M: xxx2 many$((HOOKS + 2)) +test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))" ngctl connect MF: O2M: xxx3 many$((HOOKS + 3)) hooks=$(gethooks) test_eq $created_hooks:xxx1:xxx2:xxx3 $hooks 'hooks after adding xxx1-3' -ngctl rmhook MF: xxx1 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx1 hooks=$(gethooks) test_eq $created_hooks:xxx2:xxx3 $hooks 'hooks after removing xxx1' -ngctl rmhook MF: xxx2 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx2 hooks=$(gethooks) test_eq $created_hooks:xxx3 $hooks 'hooks after removing xxx2' -ngctl rmhook MF: xxx3 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx3 hooks=$(gethooks) test_eq $created_hooks $hooks 'hooks after removing xxx3' @@ -418,8 +434,7 @@ done ################################################################################ test_title "Test: Resetting macfilter..." -ngctl msg MF: reset -test_success "**** reset failed" +test_success "**** reset failed" ngctl msg MF: reset test_eq $(countmacs) 0 'MACs in table' test_bail_on_fail From owner-dev-commits-src-main@freebsd.org Fri Mar 19 18:39:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF75C57EB33; Fri, 19 Mar 2021 18:39:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2CP24MXrz3R42; Fri, 19 Mar 2021 18:39:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 876FA19D2B; Fri, 19 Mar 2021 18:39:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JIdoDF047848; Fri, 19 Mar 2021 18:39:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JIdoVr047847; Fri, 19 Mar 2021 18:39:50 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:39:50 GMT Message-Id: <202103191839.12JIdoVr047847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: ee231b27fff9 - main - Also skip sys/net/if_lagg_test:witness on non-i386 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee231b27fff9d6950bf36a9800c02f6474b53139 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:39:50 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ee231b27fff9d6950bf36a9800c02f6474b53139 commit ee231b27fff9d6950bf36a9800c02f6474b53139 Author: Alex Richardson AuthorDate: 2021-03-19 18:35:04 +0000 Commit: Alex Richardson CommitDate: 2021-03-19 18:35:06 +0000 Also skip sys/net/if_lagg_test:witness on non-i386 The LOR also happens on amd64 and other architectures. Ideally we would fix this. However, in order to get Jenkins green again to catch real regressions, we should skip this test for now. PR: 251726 Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D29341 --- tests/sys/net/if_lagg_test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/sys/net/if_lagg_test.sh b/tests/sys/net/if_lagg_test.sh index 8d06e761db53..5aed9fd7c61b 100755 --- a/tests/sys/net/if_lagg_test.sh +++ b/tests/sys/net/if_lagg_test.sh @@ -403,8 +403,7 @@ witness_head() witness_body() { if [ "$(atf_config_get ci false)" = "true" ] && \ - [ "$(uname -p)" = "i386" ]; then - atf_skip "https://bugs.freebsd.org/244163" + atf_skip "https://bugs.freebsd.org/244163 and https://bugs.freebsd.org/251726" fi if [ `sysctl -n debug.witness.watch` -ne 1 ]; then atf_skip "witness(4) is not enabled" From owner-dev-commits-src-main@freebsd.org Fri Mar 19 19:38:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD7305A8170; Fri, 19 Mar 2021 19:38:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2Dhd54Jrz3lwP; Fri, 19 Mar 2021 19:38:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C8D41AC8C; Fri, 19 Mar 2021 19:38:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JJcPrE027484; Fri, 19 Mar 2021 19:38:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JJcPBO027483; Fri, 19 Mar 2021 19:38:25 GMT (envelope-from git) Date: Fri, 19 Mar 2021 19:38:25 GMT Message-Id: <202103191938.12JJcPBO027483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: a1d803c16206 - main - cxgbe(4): make it safe to call setup_memwin repeatedly. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1d803c162067b6cd334fc8a44a89f26cc82d83b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 19:38:25 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=a1d803c162067b6cd334fc8a44a89f26cc82d83b commit a1d803c162067b6cd334fc8a44a89f26cc82d83b Author: Navdeep Parhar AuthorDate: 2021-03-19 19:30:57 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-19 19:37:44 +0000 cxgbe(4): make it safe to call setup_memwin repeatedly. A repeat call will recreate the memory windows in the hardware and move them to their last-known positions without repeating any of the software initialization. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 201a333aa431..a61110e99e34 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -3031,16 +3031,18 @@ setup_memwin(struct adapter *sc) } for (i = 0, mw = &sc->memwin[0]; i < NUM_MEMWIN; i++, mw_init++, mw++) { - rw_init(&mw->mw_lock, "memory window access"); - mw->mw_base = mw_init->base; - mw->mw_aperture = mw_init->aperture; - mw->mw_curpos = 0; + if (!rw_initialized(&mw->mw_lock)) { + rw_init(&mw->mw_lock, "memory window access"); + mw->mw_base = mw_init->base; + mw->mw_aperture = mw_init->aperture; + mw->mw_curpos = 0; + } t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, i), (mw->mw_base + bar0) | V_BIR(0) | V_WINDOW(ilog2(mw->mw_aperture) - 10)); rw_wlock(&mw->mw_lock); - position_memwin(sc, i, 0); + position_memwin(sc, i, mw->mw_curpos); rw_wunlock(&mw->mw_lock); } From owner-dev-commits-src-main@freebsd.org Fri Mar 19 19:52:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 340995A8F07; Fri, 19 Mar 2021 19:52:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2F0S13KQz3myT; Fri, 19 Mar 2021 19:52:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16EFE1AF09; Fri, 19 Mar 2021 19:52:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JJq8iV053943; Fri, 19 Mar 2021 19:52:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JJq8U3053942; Fri, 19 Mar 2021 19:52:08 GMT (envelope-from git) Date: Fri, 19 Mar 2021 19:52:08 GMT Message-Id: <202103191952.12JJq8U3053942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: c02c04f113fe - main - x86: consolidate hw watchpoint logic into new file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c02c04f113fe65001bc21363ae3ad08cf6c763eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 19:52:08 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c02c04f113fe65001bc21363ae3ad08cf6c763eb commit c02c04f113fe65001bc21363ae3ad08cf6c763eb Author: Mitchell Horne AuthorDate: 2021-03-19 19:39:12 +0000 Commit: Mitchell Horne CommitDate: 2021-03-19 19:51:52 +0000 x86: consolidate hw watchpoint logic into new file This is a prerequisite to using these functions outside of ddb, but also provides some cleanup and minor refactoring. This code is almost entirely duplicated between the two implementations, the only significant difference being the lack of dbreg synchronization on i386. Cleanups are: - demote some internal functions to static - use the constant NDBREGS instead of a '4' literal - remove K&R definitions - some added comments Reviewed by: kib, jhb Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29153 --- sys/amd64/amd64/db_trace.c | 216 +----------------------------------- sys/conf/files.x86 | 1 + sys/i386/i386/db_trace.c | 173 +---------------------------- sys/x86/include/x86_var.h | 3 + sys/x86/x86/dbreg.c | 267 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 281 insertions(+), 379 deletions(-) diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index 7d1544a5d0bc..5c1cd41cda15 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -128,11 +128,6 @@ static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *); static void db_print_stack_entry(const char *, db_addr_t, void *); static void decode_syscall(int, struct thread *); -static const char * watchtype_str(int type); -int amd64_set_watch(int watchnum, unsigned long watchaddr, int size, - int access, struct dbreg *d); -int amd64_clr_watch(int watchnum, struct dbreg *d); - static void db_print_stack_entry(const char *name, db_addr_t callpc, void *frame) { @@ -391,223 +386,22 @@ db_trace_thread(struct thread *thr, int count) } int -amd64_set_watch(watchnum, watchaddr, size, access, d) - int watchnum; - unsigned long watchaddr; - int size; - int access; - struct dbreg *d; -{ - int i, len; - - if (watchnum == -1) { - for (i = 0; i < 4; i++) - if (!DBREG_DR7_ENABLED(d->dr[7], i)) - break; - if (i < 4) - watchnum = i; - else - return (-1); - } - - switch (access) { - case DBREG_DR7_EXEC: - size = 1; /* size must be 1 for an execution breakpoint */ - /* fall through */ - case DBREG_DR7_WRONLY: - case DBREG_DR7_RDWR: - break; - default: - return (-1); - } - - /* - * we can watch a 1, 2, 4, or 8 byte sized location - */ - switch (size) { - case 1: - len = DBREG_DR7_LEN_1; - break; - case 2: - len = DBREG_DR7_LEN_2; - break; - case 4: - len = DBREG_DR7_LEN_4; - break; - case 8: - len = DBREG_DR7_LEN_8; - break; - default: - return (-1); - } - - /* clear the bits we are about to affect */ - d->dr[7] &= ~DBREG_DR7_MASK(watchnum); - - /* set drN register to the address, N=watchnum */ - DBREG_DRX(d, watchnum) = watchaddr; - - /* enable the watchpoint */ - d->dr[7] |= DBREG_DR7_SET(watchnum, len, access, - DBREG_DR7_GLOBAL_ENABLE); - - return (watchnum); -} - -int -amd64_clr_watch(watchnum, d) - int watchnum; - struct dbreg *d; -{ - - if (watchnum < 0 || watchnum >= 4) - return (-1); - - d->dr[7] &= ~DBREG_DR7_MASK(watchnum); - DBREG_DRX(d, watchnum) = 0; - - return (0); -} - -int -db_md_set_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; +db_md_set_watchpoint(db_expr_t addr, db_expr_t size) { - struct dbreg *d; - struct pcpu *pc; - int avail, c, cpu, i, wsize; - - d = (struct dbreg *)PCPU_PTR(dbreg); - cpu = PCPU_GET(cpuid); - fill_dbregs(NULL, d); - - avail = 0; - for (i = 0; i < 4; i++) { - if (!DBREG_DR7_ENABLED(d->dr[7], i)) - avail++; - } - - if (avail * 8 < size) - return (-1); - - for (i = 0; i < 4 && size > 0; i++) { - if (!DBREG_DR7_ENABLED(d->dr[7], i)) { - if (size >= 8 || (avail == 1 && size > 4)) - wsize = 8; - else if (size > 2) - wsize = 4; - else - wsize = size; - amd64_set_watch(i, addr, wsize, DBREG_DR7_WRONLY, d); - addr += wsize; - size -= wsize; - avail--; - } - } - - set_dbregs(NULL, d); - CPU_FOREACH(c) { - if (c == cpu) - continue; - pc = pcpu_find(c); - memcpy(pc->pc_dbreg, d, sizeof(*d)); - pc->pc_dbreg_cmd = PC_DBREG_CMD_LOAD; - } - return (0); + return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size)); } int -db_md_clr_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; +db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) { - struct dbreg *d; - struct pcpu *pc; - int i, c, cpu; - - d = (struct dbreg *)PCPU_PTR(dbreg); - cpu = PCPU_GET(cpuid); - fill_dbregs(NULL, d); - - for (i = 0; i < 4; i++) { - if (DBREG_DR7_ENABLED(d->dr[7], i)) { - if (DBREG_DRX((d), i) >= addr && - DBREG_DRX((d), i) < addr + size) - amd64_clr_watch(i, d); - } - } - - set_dbregs(NULL, d); - CPU_FOREACH(c) { - if (c == cpu) - continue; - pc = pcpu_find(c); - memcpy(pc->pc_dbreg, d, sizeof(*d)); - pc->pc_dbreg_cmd = PC_DBREG_CMD_LOAD; - } - return (0); -} - -static const char * -watchtype_str(type) - int type; -{ - switch (type) { - case DBREG_DR7_EXEC : return "execute"; break; - case DBREG_DR7_RDWR : return "read/write"; break; - case DBREG_DR7_WRONLY : return "write"; break; - default : return "invalid"; break; - } + return (dbreg_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size)); } void db_md_list_watchpoints(void) { - struct dbreg d; - int i, len, type; - - fill_dbregs(NULL, &d); - - db_printf("\nhardware watchpoints:\n"); - db_printf(" watch status type len address\n"); - db_printf(" ----- -------- ---------- --- ------------------\n"); - for (i = 0; i < 4; i++) { - if (DBREG_DR7_ENABLED(d.dr[7], i)) { - type = DBREG_DR7_ACCESS(d.dr[7], i); - len = DBREG_DR7_LEN(d.dr[7], i); - if (len == DBREG_DR7_LEN_8) - len = 8; - else - len++; - db_printf(" %-5d %-8s %10s %3d ", - i, "enabled", watchtype_str(type), len); - db_printsym((db_addr_t)DBREG_DRX(&d, i), DB_STGY_ANY); - db_printf("\n"); - } else { - db_printf(" %-5d disabled\n", i); - } - } - db_printf("\ndebug register values:\n"); - for (i = 0; i < 8; i++) - if (i != 4 && i != 5) - db_printf(" dr%d 0x%016lx\n", i, DBREG_DRX(&d, i)); - db_printf("\n"); -} - -void -amd64_db_resume_dbreg(void) -{ - struct dbreg *d; - - switch (PCPU_GET(dbreg_cmd)) { - case PC_DBREG_CMD_LOAD: - d = (struct dbreg *)PCPU_PTR(dbreg); - set_dbregs(NULL, d); - PCPU_SET(dbreg_cmd, PC_DBREG_CMD_NONE); - break; - } + dbreg_list_watchpoints(); } diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index 59ff39ca053d..fd31d95fa162 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -320,6 +320,7 @@ x86/x86/bus_machdep.c standard x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard x86/x86/cpu_machdep.c standard +x86/x86/dbreg.c optional ddb x86/x86/dump_machdep.c standard x86/x86/fdt_machdep.c optional fdt x86/x86/identcpu.c standard diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index 87229e74e70b..50fb1fa6355d 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -198,11 +198,6 @@ static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t, void *); static void decode_syscall(int, struct thread *); -static const char * watchtype_str(int type); -int i386_set_watch(int watchnum, unsigned int watchaddr, int size, int access, - struct dbreg *d); -int i386_clr_watch(int watchnum, struct dbreg *d); - /* * Figure out how many arguments were passed into the frame at "fp". */ @@ -618,180 +613,22 @@ db_trace_thread(struct thread *thr, int count) } int -i386_set_watch(watchnum, watchaddr, size, access, d) - int watchnum; - unsigned int watchaddr; - int size; - int access; - struct dbreg *d; +db_md_set_watchpoint(db_expr_t addr, db_expr_t size) { - int i, len; - - if (watchnum == -1) { - for (i = 0; i < 4; i++) - if (!DBREG_DR7_ENABLED(d->dr[7], i)) - break; - if (i < 4) - watchnum = i; - else - return (-1); - } - - switch (access) { - case DBREG_DR7_EXEC: - size = 1; /* size must be 1 for an execution breakpoint */ - /* fall through */ - case DBREG_DR7_WRONLY: - case DBREG_DR7_RDWR: - break; - default: - return (-1); - } - /* - * we can watch a 1, 2, or 4 byte sized location - */ - switch (size) { - case 1: - len = DBREG_DR7_LEN_1; - break; - case 2: - len = DBREG_DR7_LEN_2; - break; - case 4: - len = DBREG_DR7_LEN_4; - break; - default: - return (-1); - } - - /* clear the bits we are about to affect */ - d->dr[7] &= ~DBREG_DR7_MASK(watchnum); - - /* set drN register to the address, N=watchnum */ - DBREG_DRX(d, watchnum) = watchaddr; - - /* enable the watchpoint */ - d->dr[7] |= DBREG_DR7_SET(watchnum, len, access, - DBREG_DR7_GLOBAL_ENABLE); - - return (watchnum); + return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size)); } int -i386_clr_watch(watchnum, d) - int watchnum; - struct dbreg *d; +db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) { - if (watchnum < 0 || watchnum >= 4) - return (-1); - - d->dr[7] &= ~DBREG_DR7_MASK(watchnum); - DBREG_DRX(d, watchnum) = 0; - - return (0); -} - -int -db_md_set_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; -{ - struct dbreg d; - int avail, i, wsize; - - fill_dbregs(NULL, &d); - - avail = 0; - for(i = 0; i < 4; i++) { - if (!DBREG_DR7_ENABLED(d.dr[7], i)) - avail++; - } - - if (avail * 4 < size) - return (-1); - - for (i = 0; i < 4 && (size > 0); i++) { - if (!DBREG_DR7_ENABLED(d.dr[7], i)) { - if (size > 2) - wsize = 4; - else - wsize = size; - i386_set_watch(i, addr, wsize, - DBREG_DR7_WRONLY, &d); - addr += wsize; - size -= wsize; - } - } - - set_dbregs(NULL, &d); - - return(0); -} - -int -db_md_clr_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; -{ - struct dbreg d; - int i; - - fill_dbregs(NULL, &d); - - for(i = 0; i < 4; i++) { - if (DBREG_DR7_ENABLED(d.dr[7], i)) { - if ((DBREG_DRX((&d), i) >= addr) && - (DBREG_DRX((&d), i) < addr+size)) - i386_clr_watch(i, &d); - } - } - - set_dbregs(NULL, &d); - - return(0); -} - -static const char * -watchtype_str(type) - int type; -{ - switch (type) { - case DBREG_DR7_EXEC : return "execute"; break; - case DBREG_DR7_RDWR : return "read/write"; break; - case DBREG_DR7_WRONLY : return "write"; break; - default : return "invalid"; break; - } + return (dbreg_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size)); } void db_md_list_watchpoints(void) { - struct dbreg d; - int i, len, type; - - fill_dbregs(NULL, &d); - - db_printf("\nhardware watchpoints:\n"); - db_printf(" watch status type len address\n"); - db_printf(" ----- -------- ---------- --- ----------\n"); - for (i = 0; i < 4; i++) { - if (DBREG_DR7_ENABLED(d.dr[7], i)) { - type = DBREG_DR7_ACCESS(d.dr[7], i); - len = DBREG_DR7_LEN(d.dr[7], i); - db_printf(" %-5d %-8s %10s %3d ", - i, "enabled", watchtype_str(type), len + 1); - db_printsym((db_addr_t)DBREG_DRX(&d, i), DB_STGY_ANY); - db_printf("\n"); - } else { - db_printf(" %-5d disabled\n", i); - } - } - db_printf("\ndebug register values:\n"); - for (i = 0; i < 8; i++) - if (i != 4 && i != 5) - db_printf(" dr%d 0x%08x\n", i, DBREG_DRX(&d, i)); - db_printf("\n"); + dbreg_list_watchpoints(); } diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index f31dcd47fff5..d60b4b2acbd8 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -120,6 +120,9 @@ vm_paddr_t cpu_getmaxphyaddr(void); bool cpu_mwait_usable(void); void cpu_probe_amdc1e(void); void cpu_setregs(void); +int dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size); +int dbreg_clr_watchpoint(vm_offset_t addr, vm_size_t size); +void dbreg_list_watchpoints(void); bool disable_wp(void); void restore_wp(bool old_wp); void finishidentcpu(void); diff --git a/sys/x86/x86/dbreg.c b/sys/x86/x86/dbreg.c new file mode 100644 index 000000000000..0d28ef8dba38 --- /dev/null +++ b/sys/x86/x86/dbreg.c @@ -0,0 +1,267 @@ +/*- + * Mach Operating System + * Copyright (c) 1991,1990 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#include "opt_ddb.h" + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#define NDBREGS 4 +#ifdef __amd64__ +#define MAXWATCHSIZE 8 +#else +#define MAXWATCHSIZE 4 +#endif + +/* + * Set a watchpoint in the debug register denoted by 'watchnum'. + */ +static void +dbreg_set_watchreg(int watchnum, vm_offset_t watchaddr, vm_size_t size, + int access, struct dbreg *d) +{ + int len; + + MPASS(watchnum >= 0 && watchnum < NDBREGS); + + /* size must be 1 for an execution breakpoint */ + if (access == DBREG_DR7_EXEC) + size = 1; + + /* + * we can watch a 1, 2, or 4 byte sized location + */ + switch (size) { + case 1: + len = DBREG_DR7_LEN_1; + break; + case 2: + len = DBREG_DR7_LEN_2; + break; + case 4: + len = DBREG_DR7_LEN_4; + break; +#if MAXWATCHSIZE >= 8 + case 8: + len = DBREG_DR7_LEN_8; + break; +#endif + default: + return; + } + + /* clear the bits we are about to affect */ + d->dr[7] &= ~DBREG_DR7_MASK(watchnum); + + /* set drN register to the address, N=watchnum */ + DBREG_DRX(d, watchnum) = watchaddr; + + /* enable the watchpoint */ + d->dr[7] |= DBREG_DR7_SET(watchnum, len, access, + DBREG_DR7_GLOBAL_ENABLE); +} + +/* + * Remove a watchpoint from the debug register denoted by 'watchnum'. + */ +static void +dbreg_clr_watchreg(int watchnum, struct dbreg *d) +{ + MPASS(watchnum >= 0 && watchnum < NDBREGS); + + d->dr[7] &= ~DBREG_DR7_MASK(watchnum); + DBREG_DRX(d, watchnum) = 0; +} + +/* + * Sync the debug registers. Other cores will read these values from the PCPU + * area when they resume. See amd64_db_resume_dbreg() below. + */ +static void +dbreg_sync(struct dbreg *dp) +{ +#ifdef __amd64__ + struct pcpu *pc; + int cpu, c; + + cpu = PCPU_GET(cpuid); + CPU_FOREACH(c) { + if (c == cpu) + continue; + pc = pcpu_find(c); + memcpy(pc->pc_dbreg, dp, sizeof(*dp)); + pc->pc_dbreg_cmd = PC_DBREG_CMD_LOAD; + } +#endif +} + +int +dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size) +{ + struct dbreg *d; + int avail, i, wsize; + +#ifdef __amd64__ + d = (struct dbreg *)PCPU_PTR(dbreg); +#else + /* debug registers aren't stored in PCPU on i386. */ + struct dbreg d_temp; + d = &d_temp; +#endif + + fill_dbregs(NULL, d); + + /* + * Check if there are enough available registers to cover the desired + * area. + */ + avail = 0; + for (i = 0; i < NDBREGS; i++) { + if (!DBREG_DR7_ENABLED(d->dr[7], i)) + avail++; + } + + if (avail * MAXWATCHSIZE < size) + return (-1); + + for (i = 0; i < NDBREGS && size > 0; i++) { + if (!DBREG_DR7_ENABLED(d->dr[7], i)) { + if ((size >= 8 || (avail == 1 && size > 4)) && + MAXWATCHSIZE == 8) + wsize = 8; + else if (size > 2) + wsize = 4; + else + wsize = size; + dbreg_set_watchreg(i, addr, wsize, DBREG_DR7_WRONLY, d); + addr += wsize; + size -= wsize; + avail--; + } + } + + set_dbregs(NULL, d); + dbreg_sync(d); + + return (0); +} + +int +dbreg_clr_watchpoint(vm_offset_t addr, vm_size_t size) +{ + struct dbreg *d; + int i; + +#ifdef __amd64__ + d = (struct dbreg *)PCPU_PTR(dbreg); +#else + /* debug registers aren't stored in PCPU on i386. */ + struct dbreg d_temp; + d = &d_temp; +#endif + fill_dbregs(NULL, d); + + for (i = 0; i < NDBREGS; i++) { + if (DBREG_DR7_ENABLED(d->dr[7], i)) { + if (DBREG_DRX((d), i) >= addr && + DBREG_DRX((d), i) < addr + size) + dbreg_clr_watchreg(i, d); + } + } + + set_dbregs(NULL, d); + dbreg_sync(d); + + return (0); +} + +#ifdef DDB +static const char * +watchtype_str(int type) +{ + + switch (type) { + case DBREG_DR7_EXEC: + return ("execute"); + case DBREG_DR7_RDWR: + return ("read/write"); + case DBREG_DR7_WRONLY: + return ("write"); + default: + return ("invalid"); + } +} + +void +dbreg_list_watchpoints(void) +{ + struct dbreg d; + int i, len, type; + + fill_dbregs(NULL, &d); + + db_printf("\nhardware watchpoints:\n"); + db_printf(" watch status type len address\n"); + db_printf(" ----- -------- ---------- --- ----------\n"); + for (i = 0; i < NDBREGS; i++) { + if (DBREG_DR7_ENABLED(d.dr[7], i)) { + type = DBREG_DR7_ACCESS(d.dr[7], i); + len = DBREG_DR7_LEN(d.dr[7], i); + db_printf(" %-5d %-8s %10s %3d ", + i, "enabled", watchtype_str(type), len + 1); + db_printsym((db_addr_t)DBREG_DRX(&d, i), DB_STGY_ANY); + db_printf("\n"); + } else { + db_printf(" %-5d disabled\n", i); + } + } +} +#endif + +#ifdef __amd64__ +/* Sync debug registers when resuming from debugger. */ +void +amd64_db_resume_dbreg(void) +{ + struct dbreg *d; + + switch (PCPU_GET(dbreg_cmd)) { + case PC_DBREG_CMD_LOAD: + d = (struct dbreg *)PCPU_PTR(dbreg); + set_dbregs(NULL, d); + PCPU_SET(dbreg_cmd, PC_DBREG_CMD_NONE); + break; + } +} +#endif From owner-dev-commits-src-main@freebsd.org Fri Mar 19 20:45:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C0B95AAAF0; Fri, 19 Mar 2021 20:45:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2GBM28tMz3rkV; Fri, 19 Mar 2021 20:45:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CF361B851; Fri, 19 Mar 2021 20:45:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JKjlJi021196; Fri, 19 Mar 2021 20:45:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JKjlvk021195; Fri, 19 Mar 2021 20:45:47 GMT (envelope-from git) Date: Fri, 19 Mar 2021 20:45:47 GMT Message-Id: <202103192045.12JKjlvk021195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 3cc6f777befc - main - cxgbe(4): create a separate helper routine to write the global RSS key. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3cc6f777befc2e494b39a4c0dcd91aaf99267f40 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 20:45:47 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=3cc6f777befc2e494b39a4c0dcd91aaf99267f40 commit 3cc6f777befc2e494b39a4c0dcd91aaf99267f40 Author: Navdeep Parhar AuthorDate: 2021-03-19 20:28:11 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-19 20:35:30 +0000 cxgbe(4): create a separate helper routine to write the global RSS key. While here, make sure only the PF driver attempts to program the global RSS key (with options RSS). The VF driver doesn't have access to those device registers. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index a61110e99e34..12efa8042b64 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5810,14 +5810,28 @@ t4_setup_intr_handlers(struct adapter *sc) return (0); } -int -adapter_full_init(struct adapter *sc) +static void +write_global_rss_key(struct adapter *sc) { - int rc, i; #ifdef RSS + int i; uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; + + CTASSERT(RSS_KEYSIZE == 40); + + rss_getkey((void *)&raw_rss_key[0]); + for (i = 0; i < nitems(rss_key); i++) { + rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); + } + t4_write_rss_key(sc, &rss_key[0], -1, 1); #endif +} + +int +adapter_full_init(struct adapter *sc) +{ + int rc, i; ASSERT_SYNCHRONIZED_OP(sc); ADAPTER_LOCK_ASSERT_NOTOWNED(sc); @@ -5843,17 +5857,11 @@ adapter_full_init(struct adapter *sc) taskqueue_start_threads(&sc->tq[i], 1, PI_NET, "%s tq%d", device_get_nameunit(sc->dev), i); } -#ifdef RSS - MPASS(RSS_KEYSIZE == 40); - rss_getkey((void *)&raw_rss_key[0]); - for (i = 0; i < nitems(rss_key); i++) { - rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); - } - t4_write_rss_key(sc, &rss_key[0], -1, 1); -#endif - if (!(sc->flags & IS_VF)) + if (!(sc->flags & IS_VF)) { + write_global_rss_key(sc); t4_intr_enable(sc); + } #ifdef KERN_TLS if (sc->flags & KERN_TLS_OK) callout_reset_sbt(&sc->ktls_tick, SBT_1MS, 0, ktls_tick, sc, From owner-dev-commits-src-main@freebsd.org Fri Mar 19 20:53:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C7135AB149; Fri, 19 Mar 2021 20:53:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2GMH0k8cz3sPx; Fri, 19 Mar 2021 20:53:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 0B31FAA55; Fri, 19 Mar 2021 20:53:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f182.google.com with SMTP id r14so7848353qtt.7; Fri, 19 Mar 2021 13:53:31 -0700 (PDT) X-Gm-Message-State: AOAM5329ye1VThh4wyFolmcb6Gb8ymMQf2juTCmts/1e9Qu/jpYwbTve o3DB+/U/09vtHSTWMyI7LXcDSUAOdPWsGOpn30M= X-Google-Smtp-Source: ABdhPJyCGLgQuQDh6uhGsrKJOxOr9aZS36bJrSVnqfu/sdnf4tJOwKbS4U2a3Hw9wQY7Y6iDZJPK60c3urVsvu2EQJs= X-Received: by 2002:aed:2e62:: with SMTP id j89mr526036qtd.310.1616187210518; Fri, 19 Mar 2021 13:53:30 -0700 (PDT) MIME-Version: 1.0 References: <202103182309.12IN9nXd002407@gitrepo.freebsd.org> In-Reply-To: <202103182309.12IN9nXd002407@gitrepo.freebsd.org> From: Kyle Evans Date: Fri, 19 Mar 2021 15:53:16 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 929acdb19acb - main - fusefs: fix two bugs regarding fcntl file locks To: Alan Somers Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 20:53:31 -0000 On Thu, Mar 18, 2021 at 6:09 PM Alan Somers wrote: > > The branch main has been updated by asomers: > > URL: https://cgit.FreeBSD.org/src/commit/?id=929acdb19acb67cc0e6ee5439df98e28a84d4772 > > commit 929acdb19acb67cc0e6ee5439df98e28a84d4772 > Author: Alan Somers > AuthorDate: 2021-03-18 20:27:27 +0000 > Commit: Alan Somers > CommitDate: 2021-03-18 23:09:10 +0000 > > fusefs: fix two bugs regarding fcntl file locks > > 1) F_SETLKW (blocking) operations would be sent to the FUSE server as > F_SETLK (non-blocking). > > 2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply > return EINVAL. > > PR: 253500 > Reported by: John Millikin > MFC after: 2 weeks > --- > sys/fs/fuse/fuse_vnops.c | 10 +++++++--- > tests/sys/fs/fusefs/flush.cc | 12 ++++++++++- > tests/sys/fs/fusefs/locks.cc | 45 +++++++++++++++++++++++++++++++++++++++++- > tests/sys/fs/fusefs/release.cc | 12 ++++++++++- > 4 files changed, 73 insertions(+), 6 deletions(-) > > diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c > index 5bbde1e278c9..cdbc42f5adf4 100644 > --- a/sys/fs/fuse/fuse_vnops.c > +++ b/sys/fs/fuse/fuse_vnops.c > @@ -437,10 +437,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) > op = FUSE_GETLK; > break; > case F_SETLK: > - op = FUSE_SETLK; > + if (flags & F_WAIT) > + op = FUSE_SETLKW; > + else > + op = FUSE_SETLK; > break; > - case F_SETLKW: > - op = FUSE_SETLKW; > + case F_UNLCK: > + op = FUSE_SETLK; > + flags |= F_UNLCK; > break; > default: > return EINVAL; Hi, The committed version of this appears to have brought back the redundant assignment to `flags` Thanks, Kyle Evans From owner-dev-commits-src-main@freebsd.org Fri Mar 19 21:09:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D2AE5ABDA3; Fri, 19 Mar 2021 21:09:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2Gk425fPz3t9y; Fri, 19 Mar 2021 21:09:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f48.google.com with SMTP id k14-20020a9d7dce0000b02901b866632f29so9845069otn.1; Fri, 19 Mar 2021 14:09:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d5ZiwTAJbLlLPOXlze3R2EBCrjncavTjmPk2PByLESA=; b=T/DZ73jkccR5QddlfrcrOM9vcdYPu30Jq/JgMMAkl+ohPMkTkr1H/bF4c5WVYPen6N PnoRmr8Tq1OTYBmxEQ84Na7CwfxN981M1To4gCx/p2aq5fpbZqqW9NVLg+h1OJsJMZyF ZvAOcQQhWwDjNVis1sxSBHLHswHXABCHAN68XdVhjrx9LZXcIOobKvvX10Kmva+JMSUE +0g/Q8RzZo8XedvxVHjkaeDKUA8TTEJf87p5peNRxATWC7vJNlnNhty5D651ggKAZXsK oDtrTSTGUbZC3NCVQUWoFlOgObp4HA2+4uo9exYcZlov2+gefp/2RaWEsZSr35Fyz3OI 83eA== X-Gm-Message-State: AOAM530i69j3H5u0c5iVTGdJrDmSd+fGdQIcBNrog+BzuvwH84QJICl8 qAY21Ps4tD7QtzhgJRpl8/lqbwqH8xG1jq1Tg/Nimv6o X-Google-Smtp-Source: ABdhPJz9/nYmAagD8I2pKJjhdUaCplhnvCuxyUfwnLktddSYfhJK9p1GkOxsWIGQCqsiBQc00sg7cqkdlVZDn/UesMY= X-Received: by 2002:a05:6830:2318:: with SMTP id u24mr2488464ote.291.1616188187075; Fri, 19 Mar 2021 14:09:47 -0700 (PDT) MIME-Version: 1.0 References: <202103182309.12IN9nXd002407@gitrepo.freebsd.org> In-Reply-To: From: Alan Somers Date: Fri, 19 Mar 2021 15:09:36 -0600 Message-ID: Subject: Re: git: 929acdb19acb - main - fusefs: fix two bugs regarding fcntl file locks To: Kyle Evans Cc: src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4F2Gk425fPz3t9y X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 21:09:48 -0000 On Fri, Mar 19, 2021 at 2:53 PM Kyle Evans wrote: > On Thu, Mar 18, 2021 at 6:09 PM Alan Somers wrote: > > > > The branch main has been updated by asomers: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=929acdb19acb67cc0e6ee5439df98e28a84d4772 > > > > commit 929acdb19acb67cc0e6ee5439df98e28a84d4772 > > Author: Alan Somers > > AuthorDate: 2021-03-18 20:27:27 +0000 > > Commit: Alan Somers > > CommitDate: 2021-03-18 23:09:10 +0000 > > > > fusefs: fix two bugs regarding fcntl file locks > > > > 1) F_SETLKW (blocking) operations would be sent to the FUSE server as > > F_SETLK (non-blocking). > > > > 2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply > > return EINVAL. > > > > PR: 253500 > > Reported by: John Millikin > > MFC after: 2 weeks > > --- > > sys/fs/fuse/fuse_vnops.c | 10 +++++++--- > > tests/sys/fs/fusefs/flush.cc | 12 ++++++++++- > > tests/sys/fs/fusefs/locks.cc | 45 > +++++++++++++++++++++++++++++++++++++++++- > > tests/sys/fs/fusefs/release.cc | 12 ++++++++++- > > 4 files changed, 73 insertions(+), 6 deletions(-) > > > > diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c > > index 5bbde1e278c9..cdbc42f5adf4 100644 > > --- a/sys/fs/fuse/fuse_vnops.c > > +++ b/sys/fs/fuse/fuse_vnops.c > > @@ -437,10 +437,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) > > op = FUSE_GETLK; > > break; > > case F_SETLK: > > - op = FUSE_SETLK; > > + if (flags & F_WAIT) > > + op = FUSE_SETLKW; > > + else > > + op = FUSE_SETLK; > > break; > > - case F_SETLKW: > > - op = FUSE_SETLKW; > > + case F_UNLCK: > > + op = FUSE_SETLK; > > + flags |= F_UNLCK; > > break; > > default: > > return EINVAL; > > Hi, > > The committed version of this appears to have brought back the > redundant assignment to `flags` > > Thanks, > > Kyle Evans > Oh crap. That's what I get for working from multiple computers, I suppose. I'll fix it. Thanks for letting me know. -Alan From owner-dev-commits-src-main@freebsd.org Fri Mar 19 22:10:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EA395AE2C2; Fri, 19 Mar 2021 22:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2J4T3fP0z4SvV; Fri, 19 Mar 2021 22:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 700491CABF; Fri, 19 Mar 2021 22:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JMAnjf035118; Fri, 19 Mar 2021 22:10:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JMAnZL035117; Fri, 19 Mar 2021 22:10:49 GMT (envelope-from git) Date: Fri, 19 Mar 2021 22:10:49 GMT Message-Id: <202103192210.12JMAnZL035117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 5f742d3879de - main - nfsv4 client: fix forced dismount when sleeping on nfsv4lck MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 22:10:49 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=5f742d3879deb1f46f2d151d5ef84f49e8d6afe6 commit 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6 Author: Rick Macklem AuthorDate: 2021-03-19 21:09:33 +0000 Commit: Rick Macklem CommitDate: 2021-03-19 21:09:33 +0000 nfsv4 client: fix forced dismount when sleeping on nfsv4lck During a recent NFSv4 testing event a test server caused a hang where "umount -N" failed. The renew thread was sleeping on "nfsv4lck" and the "umount" was sleeping, waiting for the renew thread to terminate. This is the first of two patches that is hoped to fix the renew thread so that it will terminate when "umount -N" is done on the mount. nfsv4_lock() checks for forced dismount, but only after it wakes up from msleep(). Without this patch, a wakeup() call was required. This patch adds a 1second timeout on the msleep(), so that it will wake up and see the forced dismount flag. Normally a wakeup() will occur in less than 1second, but if a premature return from msleep() does occur, it will simply loop around and msleep() again. While here, replace the nfsmsleep() wrapper that was used for portability with the actual msleep() call and make the same change for nfsv4_getref(). MFC after: 2 weeks --- sys/fs/nfs/nfs_commonsubs.c | 10 ++++------ sys/fs/nfs/nfs_var.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index d44ff122a95c..e9b2af17d8b4 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2252,7 +2252,7 @@ nfsmout: */ int nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, - void *mutex, struct mount *mp) + struct mtx *mutex, struct mount *mp) { if (isleptp) @@ -2280,8 +2280,7 @@ nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4lck", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4lck", hz); if (iwantlock && !(lp->nfslock_lock & NFSV4LOCK_LOCK) && lp->nfslock_usecnt == 0) { lp->nfslock_lock &= ~NFSV4LOCK_LOCKWANTED; @@ -2331,7 +2330,7 @@ nfsv4_relref(struct nfsv4lock *lp) * return without getting a refcnt for that case. */ void -nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, +nfsv4_getref(struct nfsv4lock *lp, int *isleptp, struct mtx *mutex, struct mount *mp) { @@ -2347,8 +2346,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4gr", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4gr", hz); } if (mp != NULL && NFSCL_FORCEDISM(mp)) return; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 0a1fe3ce053d..aba5c5124e72 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -335,10 +335,10 @@ int nfsv4_loadattr(struct nfsrv_descript *, vnode_t, struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *, struct nfsfsinfo *, NFSACL_T *, int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *); -int nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *); +int nfsv4_lock(struct nfsv4lock *, int, int *, struct mtx *, struct mount *); void nfsv4_unlock(struct nfsv4lock *, int); void nfsv4_relref(struct nfsv4lock *); -void nfsv4_getref(struct nfsv4lock *, int *, void *, struct mount *); +void nfsv4_getref(struct nfsv4lock *, int *, struct mtx *, struct mount *); int nfsv4_getref_nonblock(struct nfsv4lock *); int nfsv4_testlock(struct nfsv4lock *); int nfsrv_mtostr(struct nfsrv_descript *, char *, int); From owner-dev-commits-src-main@freebsd.org Sat Mar 20 00:00:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B7605B0CFF; Sat, 20 Mar 2021 00:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2LWV2dMfz4Zxw; Sat, 20 Mar 2021 00:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D8741DF78; Sat, 20 Mar 2021 00:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K00stG080365; Sat, 20 Mar 2021 00:00:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K00sbn080364; Sat, 20 Mar 2021 00:00:54 GMT (envelope-from git) Date: Sat, 20 Mar 2021 00:00:54 GMT Message-Id: <202103200000.12K00sbn080364@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9946b2f4e0b4 - main - Remove /usr/include/crypto/rijndael.h as well. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9946b2f4e0b478de69ebd687e2132c318a4d7c21 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 00:00:54 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9946b2f4e0b478de69ebd687e2132c318a4d7c21 commit 9946b2f4e0b478de69ebd687e2132c318a4d7c21 Author: John Baldwin AuthorDate: 2021-03-19 23:31:53 +0000 Commit: John Baldwin CommitDate: 2021-03-19 23:31:53 +0000 Remove /usr/include/crypto/rijndael.h as well. I missed this in the earlier commit. MFC after: 1 week Fixes: 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 --- ObsoleteFiles.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 2d8113dd1cce..79ed21ec18ca 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2874,6 +2874,7 @@ OLD_FILES+=usr/include/crypto/cbc_mac.h OLD_FILES+=usr/include/crypto/deflate.h OLD_FILES+=usr/include/crypto/gfmult.h OLD_FILES+=usr/include/crypto/gmac.h +OLD_FILES+=usr/include/crypto/rijndael.h OLD_FILES+=usr/include/crypto/rmd160.h OLD_FILES+=usr/include/crypto/xform.h OLD_FILES+=usr/include/crypto/xform_auth.h From owner-dev-commits-src-main@freebsd.org Sat Mar 20 00:00:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A2345B09F3; Sat, 20 Mar 2021 00:00:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2LWW3YkDz4bGh; Sat, 20 Mar 2021 00:00:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CE921DF7A; Sat, 20 Mar 2021 00:00:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K00tDa080383; Sat, 20 Mar 2021 00:00:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K00tKV080382; Sat, 20 Mar 2021 00:00:55 GMT (envelope-from git) Date: Sat, 20 Mar 2021 00:00:55 GMT Message-Id: <202103200000.12K00tKV080382@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 7af04dff025d - main - Only symlink cryptodev.h into /usr/include/crypto/ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7af04dff025d98e2feff979756ecde8ef0ace390 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 00:00:55 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7af04dff025d98e2feff979756ecde8ef0ace390 commit 7af04dff025d98e2feff979756ecde8ef0ace390 Author: John Baldwin AuthorDate: 2021-03-19 23:59:44 +0000 Commit: John Baldwin CommitDate: 2021-03-19 23:59:44 +0000 Only symlink cryptodev.h into /usr/include/crypto/ I missed updating the symlink side in the earlier commit. Fixes: 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 MFC after: 1 week --- include/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/Makefile b/include/Makefile index eebc7f0e121f..8d50aeea864f 100644 --- a/include/Makefile +++ b/include/Makefile @@ -418,10 +418,7 @@ symlinks: .PHONY .META $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; .endif - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/opencrypto/*.h) \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/opencrypto/cryptodev.h \ ${SDESTDIR}${INCLUDEDIR}/crypto; \ cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ From owner-dev-commits-src-main@freebsd.org Sat Mar 20 01:42:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D0D75B5809; Sat, 20 Mar 2021 01:42:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2NmT3Vm5z4kY7; Sat, 20 Mar 2021 01:42:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B0071F937; Sat, 20 Mar 2021 01:42:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K1gHfH016002; Sat, 20 Mar 2021 01:42:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K1gHmv016001; Sat, 20 Mar 2021 01:42:17 GMT (envelope-from git) Date: Sat, 20 Mar 2021 01:42:17 GMT Message-Id: <202103200142.12K1gHmv016001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 9c5aac8f2e84 - main - fusefs: fix a dead store in fuse_vnop_advlock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c5aac8f2e84ca4bbdf82514302c08c0453ec59b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 01:42:17 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9c5aac8f2e84ca4bbdf82514302c08c0453ec59b commit 9c5aac8f2e84ca4bbdf82514302c08c0453ec59b Author: Alan Somers AuthorDate: 2021-03-20 01:38:57 +0000 Commit: Alan Somers CommitDate: 2021-03-20 01:38:57 +0000 fusefs: fix a dead store in fuse_vnop_advlock kevans actually caught this in the original review and I fixed it, but then I committed an older copy of the branch. Whoops. Reported by: kevans MFC after: 13 days MFC with: 929acdb19acb67cc0e6ee5439df98e28a84d4772 Differential Revision: https://reviews.freebsd.org/D29031 --- sys/fs/fuse/fuse_vnops.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index cdbc42f5adf4..a51c1b15e7f0 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -444,7 +444,6 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) break; case F_UNLCK: op = FUSE_SETLK; - flags |= F_UNLCK; break; default: return EINVAL; From owner-dev-commits-src-main@freebsd.org Sat Mar 20 07:46:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F8E7575C93; Sat, 20 Mar 2021 07:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2Xr92ySmz3LSh; Sat, 20 Mar 2021 07:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58644240B1; Sat, 20 Mar 2021 07:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K7k1e3092374; Sat, 20 Mar 2021 07:46:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K7k16W092373; Sat, 20 Mar 2021 07:46:01 GMT (envelope-from git) Date: Sat, 20 Mar 2021 07:46:01 GMT Message-Id: <202103200746.12K7k16W092373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: faf9a4e9142a - main - virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: faf9a4e9142a02c289ee543a6091bd4b925c6a63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 07:46:01 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=faf9a4e9142a02c289ee543a6091bd4b925c6a63 commit faf9a4e9142a02c289ee543a6091bd4b925c6a63 Author: Ka Ho Ng AuthorDate: 2021-03-20 07:40:52 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-20 07:45:34 +0000 virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap The MSI-X resource shouldn't be assumed to be always on BAR1. The Virtio v1.1 Spec did not specify that MSI-X table and PBA BAR has to be BAR1 either. Reported by: Yuan Rui MFC after: 2 weeks Reviewed by: bryanv, jhb Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D28817 --- sys/dev/virtio/pci/virtio_pci_legacy.c | 74 +++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 14 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index 22e369097e2e..d74983099110 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -60,7 +60,8 @@ struct vtpci_legacy_softc { device_t vtpci_dev; struct vtpci_common vtpci_common; struct resource *vtpci_res; - struct resource *vtpci_msix_res; + struct resource *vtpci_msix_table_res; + struct resource *vtpci_msix_pba_res; }; static int vtpci_legacy_probe(device_t); @@ -97,6 +98,8 @@ static void vtpci_legacy_notify_vq(device_t, uint16_t, bus_size_t); static void vtpci_legacy_read_dev_config(device_t, bus_size_t, void *, int); static void vtpci_legacy_write_dev_config(device_t, bus_size_t, void *, int); +static bool vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc); +static void vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc); static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *); static void vtpci_legacy_free_resources(struct vtpci_legacy_softc *); @@ -232,6 +235,13 @@ vtpci_legacy_attach(device_t dev) return (error); } + if (vtpci_is_msix_available(&sc->vtpci_common) && + !vtpci_legacy_setup_msix(sc)) { + device_printf(dev, "cannot setup MSI-x resources\n"); + error = ENXIO; + goto fail; + } + vtpci_legacy_reset(sc); /* Tell the host we've noticed this device. */ @@ -265,6 +275,7 @@ vtpci_legacy_detach(device_t dev) return (error); vtpci_legacy_reset(sc); + vtpci_legacy_teardown_msix(sc); vtpci_legacy_free_resources(sc); return (0); @@ -539,6 +550,54 @@ vtpci_legacy_write_dev_config(device_t dev, bus_size_t offset, } } +static bool +vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc) +{ + device_t dev; + int rid, table_rid; + + dev = sc->vtpci_dev; + + rid = table_rid = pci_msix_table_bar(dev); + if (rid != PCIR_BAR(0)) { + sc->vtpci_msix_table_res = bus_alloc_resource_any( + dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->vtpci_msix_table_res == NULL) + return (false); + } + + rid = pci_msix_pba_bar(dev); + if (rid != table_rid && rid != PCIR_BAR(0)) { + sc->vtpci_msix_pba_res = bus_alloc_resource_any( + dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->vtpci_msix_pba_res == NULL) + return (false); + } + + return (true); +} + +static void +vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc) +{ + device_t dev; + + dev = sc->vtpci_dev; + + if (sc->vtpci_msix_pba_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->vtpci_msix_pba_res), + sc->vtpci_msix_pba_res); + sc->vtpci_msix_pba_res = NULL; + } + if (sc->vtpci_msix_table_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->vtpci_msix_table_res), + sc->vtpci_msix_table_res); + sc->vtpci_msix_table_res = NULL; + } +} + static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) { @@ -552,13 +611,6 @@ vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) &rid, RF_ACTIVE)) == NULL) return (ENXIO); - if (vtpci_is_msix_available(&sc->vtpci_common)) { - rid = PCIR_BAR(1); - if ((sc->vtpci_msix_res = bus_alloc_resource_any(dev, - SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) - return (ENXIO); - } - return (0); } @@ -569,12 +621,6 @@ vtpci_legacy_free_resources(struct vtpci_legacy_softc *sc) dev = sc->vtpci_dev; - if (sc->vtpci_msix_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(1), - sc->vtpci_msix_res); - sc->vtpci_msix_res = NULL; - } - if (sc->vtpci_res != NULL) { bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), sc->vtpci_res); From owner-dev-commits-src-main@freebsd.org Sat Mar 20 07:46:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 957B6575D20; Sat, 20 Mar 2021 07:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2XrB3pjGz3LnB; Sat, 20 Mar 2021 07:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7638F24142; Sat, 20 Mar 2021 07:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K7k2oe092395; Sat, 20 Mar 2021 07:46:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K7k2rc092394; Sat, 20 Mar 2021 07:46:02 GMT (envelope-from git) Date: Sat, 20 Mar 2021 07:46:02 GMT Message-Id: <202103200746.12K7k2rc092394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: cf5d1112408d - main - virtio_pci_legacy: Allow memory space for configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf5d1112408ddef3fdff8212599727c49ba90fa4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 07:46:02 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=cf5d1112408ddef3fdff8212599727c49ba90fa4 commit cf5d1112408ddef3fdff8212599727c49ba90fa4 Author: Ka Ho Ng AuthorDate: 2021-03-20 07:40:55 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-20 07:45:34 +0000 virtio_pci_legacy: Allow memory space for configuration For guests running under some kind of VMMs, configuration structure is available in memory space but not I/O space. Reported by: Yuan Rui MFC after: 2 weeks Reviewed by: rpokala, bryanv, jhb Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D28818 --- sys/dev/virtio/pci/virtio_pci_legacy.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index d74983099110..a17dd22aa953 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); struct vtpci_legacy_softc { device_t vtpci_dev; struct vtpci_common vtpci_common; + int vtpci_res_type; struct resource *vtpci_res; struct resource *vtpci_msix_table_res; struct resource *vtpci_msix_pba_res; @@ -231,7 +232,7 @@ vtpci_legacy_attach(device_t dev) error = vtpci_legacy_alloc_resources(sc); if (error) { - device_printf(dev, "cannot map I/O space\n"); + device_printf(dev, "cannot map I/O space nor memory space\n"); return (error); } @@ -601,14 +602,25 @@ vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc) static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) { + const int res_types[] = { SYS_RES_IOPORT, SYS_RES_MEMORY }; device_t dev; - int rid; + int rid, i; dev = sc->vtpci_dev; - rid = PCIR_BAR(0); - if ((sc->vtpci_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &rid, RF_ACTIVE)) == NULL) + /* + * Most hypervisors export the common configuration structure in IO + * space, but some use memory space; try both. + */ + for (i = 0; nitems(res_types); i++) { + rid = PCIR_BAR(0); + sc->vtpci_res_type = res_types[i]; + sc->vtpci_res = bus_alloc_resource_any(dev, res_types[i], &rid, + RF_ACTIVE); + if (sc->vtpci_res != NULL) + break; + } + if (sc->vtpci_res == NULL) return (ENXIO); return (0); @@ -622,7 +634,7 @@ vtpci_legacy_free_resources(struct vtpci_legacy_softc *sc) dev = sc->vtpci_dev; if (sc->vtpci_res != NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), + bus_release_resource(dev, sc->vtpci_res_type, PCIR_BAR(0), sc->vtpci_res); sc->vtpci_res = NULL; } From owner-dev-commits-src-main@freebsd.org Sat Mar 20 13:02:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19BB457FD47; Sat, 20 Mar 2021 13:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2gsF08xRz4TG4; Sat, 20 Mar 2021 13:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECA1E27FFB; Sat, 20 Mar 2021 13:02:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12KD2OJh015271; Sat, 20 Mar 2021 13:02:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KD2OxK015270; Sat, 20 Mar 2021 13:02:24 GMT (envelope-from git) Date: Sat, 20 Mar 2021 13:02:24 GMT Message-Id: <202103201302.12KD2OxK015270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 8c9e45503fe4 - main - tools/build: Improve host-symlinks failure mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c9e45503fe41732f72e1a4cc9a231e63b4289ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 13:02:25 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8c9e45503fe41732f72e1a4cc9a231e63b4289ba commit 8c9e45503fe41732f72e1a4cc9a231e63b4289ba Author: Jessica Clarke AuthorDate: 2021-03-20 13:00:34 +0000 Commit: Jessica Clarke CommitDate: 2021-03-20 13:00:34 +0000 tools/build: Improve host-symlinks failure mode Since set -e is enabled by sys.mk, if the tool cannot be found in PATH then the entire shell command line fails, causing us to not print the error message below and instead silently (due to the @) fail, only getting the usual "Error code 1" print from bmake. Thus, provide a dummy default that will never exist (the same as is used by meta2deps.sh) if which fails so that we get the error message as intended. MFC after: 1 week --- tools/build/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index effe8b9cb31d..31d027f75ce2 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -301,7 +301,8 @@ _host_tools_to_symlink:=${_host_tools_to_symlink:Nsh} host-symlinks: @echo "Linking host tools into ${DESTDIR}/bin" .for _tool in ${_host_tools_to_symlink} - @export PATH=$${PATH}:/usr/local/bin; source_path=`which ${_tool}`; \ + @export PATH=$${PATH}:/usr/local/bin; \ + source_path=`which ${_tool} || echo /dev/null/no/such`; \ if [ ! -e "$${source_path}" ] ; then \ echo "Cannot find host tool '${_tool}' in PATH ($$PATH)." >&2; false; \ fi; \ From owner-dev-commits-src-main@freebsd.org Sat Mar 20 17:27:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFD8F5AF57D; Sat, 20 Mar 2021 17:27:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2nlY5b2Tz4n1M; Sat, 20 Mar 2021 17:27:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE28139E2; Sat, 20 Mar 2021 17:27:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12KHRrX1075134; Sat, 20 Mar 2021 17:27:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KHRrj8075133; Sat, 20 Mar 2021 17:27:53 GMT (envelope-from git) Date: Sat, 20 Mar 2021 17:27:53 GMT Message-Id: <202103201727.12KHRrj8075133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: ee7ffaa2e6e0 - main - netmap: fix issues in nm_os_extmem_create() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee7ffaa2e6e08b63efb4673610875d40964d5058 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 17:27:53 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=ee7ffaa2e6e08b63efb4673610875d40964d5058 commit ee7ffaa2e6e08b63efb4673610875d40964d5058 Author: Vincenzo Maffione AuthorDate: 2021-03-20 17:15:50 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-20 17:15:50 +0000 netmap: fix issues in nm_os_extmem_create() - Call vm_object_reference() before vm_map_lookup_done(). - Use vm_mmap_to_errno() to convert vm_map_* return values to errno. - Fix memory leak of e->obj. Reported by: markj Reviewed by: markj MFC after: 1 week --- sys/dev/netmap/netmap_freebsd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index e37815dc88d5..2cedea4440fe 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -664,6 +664,7 @@ nm_os_vi_detach(struct ifnet *ifp) #ifdef WITH_EXTMEM #include +#include #include struct nm_os_extmem { vm_object_t obj; @@ -726,17 +727,18 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pools_info *pi, int *perror) &obj, &index, &prot, &wired); if (rv != KERN_SUCCESS) { nm_prerr("address %lx not found", p); + error = vm_mmap_to_errno(rv); goto out_free; } + vm_object_reference(obj); + /* check that we are given the whole vm_object ? */ vm_map_lookup_done(map, entry); - // XXX can we really use obj after releasing the map lock? e->obj = obj; - vm_object_reference(obj); - /* wire the memory and add the vm_object to the kernel map, - * to make sure that it is not fred even if the processes that - * are mmap()ing it all exit + /* Wire the memory and add the vm_object to the kernel map, + * to make sure that it is not freed even if all the processes + * that are mmap()ing should munmap() it. */ e->kva = vm_map_min(kernel_map); e->size = obj->size << PAGE_SHIFT; @@ -745,12 +747,14 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pools_info *pi, int *perror) VM_PROT_READ | VM_PROT_WRITE, 0); if (rv != KERN_SUCCESS) { nm_prerr("vm_map_find(%zx) failed", (size_t)e->size); + error = vm_mmap_to_errno(rv); goto out_rel; } rv = vm_map_wire(kernel_map, e->kva, e->kva + e->size, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); if (rv != KERN_SUCCESS) { nm_prerr("vm_map_wire failed"); + error = vm_mmap_to_errno(rv); goto out_rem; } @@ -760,9 +764,9 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pools_info *pi, int *perror) out_rem: vm_map_remove(kernel_map, e->kva, e->kva + e->size); - e->obj = NULL; out_rel: vm_object_deallocate(e->obj); + e->obj = NULL; out_free: nm_os_free(e); out: From owner-dev-commits-src-main@freebsd.org Sat Mar 20 17:58:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 211E45B0736; Sat, 20 Mar 2021 17:58:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2pQq0VGfz4pVn; Sat, 20 Mar 2021 17:58:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03B5244EF; Sat, 20 Mar 2021 17:58:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12KHwQ32017138; Sat, 20 Mar 2021 17:58:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KHwQna017137; Sat, 20 Mar 2021 17:58:26 GMT (envelope-from git) Date: Sat, 20 Mar 2021 17:58:26 GMT Message-Id: <202103201758.12KHwQna017137@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 839fdcfc0c1d - main - elftoolchain: Support building on Arm-based Macs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 839fdcfc0c1dba34f728813d9756515ad82ff58a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 17:58:27 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=839fdcfc0c1dba34f728813d9756515ad82ff58a commit 839fdcfc0c1dba34f728813d9756515ad82ff58a Author: Jessica Clarke AuthorDate: 2021-03-20 17:58:10 +0000 Commit: Jessica Clarke CommitDate: 2021-03-20 17:58:10 +0000 elftoolchain: Support building on Arm-based Macs Currently macOS and DragonFlyBSD get their own special case and only handle x86. Since all the FreeBSD cases should be general enough for macOS and DragonFlyBSD (and the x86 ones are identical to the existing ones) we can just delete the special cases and reuse the FreeBSD ones. Note that upstream has since removed all the architecture-specific checks in this file, with the only code relevant to us being an endianness check that uses the generic compiler-provided macros. Thus this patch will not be upstreamed, and will be dropped in a future vendor import. Reviewed by: dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29352 --- contrib/elftoolchain/libelf/_libelf_config.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/contrib/elftoolchain/libelf/_libelf_config.h b/contrib/elftoolchain/libelf/_libelf_config.h index 05869757f663..0f16f3aefde5 100644 --- a/contrib/elftoolchain/libelf/_libelf_config.h +++ b/contrib/elftoolchain/libelf/_libelf_config.h @@ -26,25 +26,11 @@ * $Id: _libelf_config.h 3764 2019-06-28 21:44:46Z emaste $ */ -#if defined(__APPLE__) || defined(__DragonFly__) - -#if defined(__amd64__) -#define LIBELF_ARCH EM_X86_64 -#define LIBELF_BYTEORDER ELFDATA2LSB -#define LIBELF_CLASS ELFCLASS64 -#elif defined(__i386__) -#define LIBELF_ARCH EM_386 -#define LIBELF_BYTEORDER ELFDATA2LSB -#define LIBELF_CLASS ELFCLASS32 -#endif - -#endif /* __DragonFly__ */ - -#ifdef __FreeBSD__ +#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) /* * Define LIBELF_{ARCH,BYTEORDER,CLASS} based on the machine architecture. - * See also: . + * See also: on FreeBSD. */ #if defined(__amd64__) @@ -126,9 +112,9 @@ #define LIBELF_CLASS ELFCLASS64 #else -#error Unknown FreeBSD architecture. +#error Unknown architecture. #endif -#endif /* __FreeBSD__ */ +#endif /* defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) */ /* * Definitions for Minix3. From owner-dev-commits-src-main@freebsd.org Sat Mar 20 22:15:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CE4A5B5A38; Sat, 20 Mar 2021 22:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2w7r39Qsz3JV9; Sat, 20 Mar 2021 22:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F19C7993; Sat, 20 Mar 2021 22:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12KMFq7i081058; Sat, 20 Mar 2021 22:15:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KMFqvD081057; Sat, 20 Mar 2021 22:15:52 GMT (envelope-from git) Date: Sat, 20 Mar 2021 22:15:52 GMT Message-Id: <202103202215.12KMFqvD081057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 15deee52d6d5 - main - Move GH_BC ObsoleteFiles.inc section to OptionalObsoleteFiles.inc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15deee52d6d5ea7dd950116ff63aa2c33fcd47f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 22:15:52 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=15deee52d6d5ea7dd950116ff63aa2c33fcd47f5 commit 15deee52d6d5ea7dd950116ff63aa2c33fcd47f5 Author: Dimitry Andric AuthorDate: 2021-03-20 22:15:01 +0000 Commit: Dimitry Andric CommitDate: 2021-03-20 22:15:01 +0000 Move GH_BC ObsoleteFiles.inc section to OptionalObsoleteFiles.inc Optional features belong in the latter file, and should be tested using: .if ${MK_FEATURE} == no [...] .endif --- ObsoleteFiles.inc | 9 --------- tools/build/mk/OptionalObsoleteFiles.inc | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 79ed21ec18ca..2132dc4289b4 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2884,15 +2884,6 @@ OLD_FILES+=usr/include/crypto/xform_enc.h # 20210305: removed Poly1305_* symbols OLD_FILES+=usr/include/crypto/xform_poly1305.h -# 20210304: remove old bc and dc support and test files -.if !defined(WITHOUT_GH_BC) -OLD_FILES+=usr/share/misc/bc.library -OLD_FILES+=usr/tests/usr.bin/dc/Kyuafile -OLD_FILES+=usr/tests/usr.bin/dc/bcode -OLD_FILES+=usr/tests/usr.bin/dc/inout -OLD_DIRS+=usr/tests/usr.bin/dc -.endif - # 20210302: fmtree removed OLD_FILES+=usr/sbin/fmtree OLD_FILES+=usr/share/man/man8/fmtree.8.gz diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 44cd4a4281e7..5a534a91c057 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -2139,6 +2139,14 @@ OLD_FILES+=usr/share/man/man1/llvm-cov.1.gz OLD_FILES+=usr/share/man/man1/llvm-profdata.1.gz .endif +.if ${MK_GH_BC} == no +OLD_FILES+=usr/share/misc/bc.library +OLD_FILES+=usr/tests/usr.bin/dc/Kyuafile +OLD_FILES+=usr/tests/usr.bin/dc/bcode +OLD_FILES+=usr/tests/usr.bin/dc/inout +OLD_DIRS+=usr/tests/usr.bin/dc +.endif + .if ${MK_GOOGLETEST} == no OLD_FILES+=usr/include/gmock/gmock-actions.h OLD_FILES+=usr/include/gmock/gmock-cardinalities.h From owner-dev-commits-src-main@freebsd.org Sun Mar 21 00:10:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CC735B868F; Sun, 21 Mar 2021 00:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2yhB0rfjz3Q42; Sun, 21 Mar 2021 00:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1017A11486; Sun, 21 Mar 2021 00:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12L0AXPD043527; Sun, 21 Mar 2021 00:10:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L0AXhr043526; Sun, 21 Mar 2021 00:10:33 GMT (envelope-from git) Date: Sun, 21 Mar 2021 00:10:33 GMT Message-Id: <202103210010.12L0AXhr043526@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 815209920f1d - main - rc.conf(5): Remove left-over variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 815209920f1d024ca55270c106565a0b770a8c00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 00:10:34 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=815209920f1d024ca55270c106565a0b770a8c00 commit 815209920f1d024ca55270c106565a0b770a8c00 Author: Tobias Rehbein AuthorDate: 2021-03-21 00:01:31 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-21 00:08:36 +0000 rc.conf(5): Remove left-over variables ipv6_ipfilter_rules was obsoleted because of ipfilter was updated, and rc_parallel_start was reverted to undergo further refinement. PR: 254398 Fixes: e2ad10e84792, f61831d2e8bd --- share/man/man5/rc.conf.5 | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index c5261974b475..01c4a8436496 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2021 +.Dd March 21, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -140,14 +140,6 @@ If set to show .Dq Starting foo: when faststart is used (e.g., at boot time). -.It Va rc_parallel_start -.Pq Vt bool -If set to -.Dq Li YES , -enable parallel startup of services. -Care should be taken to ensure that no loops occur, by using -.Nm rcorder -.Fl p . .It Va early_late_divider .Pq Vt str The name of the script that should be used as the @@ -804,16 +796,6 @@ This variable contains the name of the filter rule definition file. The file is expected to be readable for the .Xr ipf 8 command to execute. -.\" ----- ipv6_ipfilter_rules setting --------------------------- -.It Va ipv6_ipfilter_rules -.Pq Vt str -Set to -.Pa /etc/ipf6.rules -by default. -This variable contains the IPv6 filter rule definition file. -The file is expected to be readable for the -.Xr ipf 8 -command to execute. .\" ----- ipfilter_flags setting -------------------------------- .It Va ipfilter_flags .Pq Vt str From owner-dev-commits-src-main@freebsd.org Sun Mar 21 01:25:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55FDD5B9EFE; Sun, 21 Mar 2021 01:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F30Ln1tsxz3kkJ; Sun, 21 Mar 2021 01:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 338F411D5D; Sun, 21 Mar 2021 01:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12L1Pb2Z046851; Sun, 21 Mar 2021 01:25:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L1PaZZ046850; Sun, 21 Mar 2021 01:25:36 GMT (envelope-from git) Date: Sun, 21 Mar 2021 01:25:36 GMT Message-Id: <202103210125.12L1PaZZ046850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: f9693bef8dc8 - main - zfs: merge OpenZFS master-891568c99 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9693bef8dc83284e7ac905adc346f7d866b5245 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 01:25:37 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=f9693bef8dc83284e7ac905adc346f7d866b5245 commit f9693bef8dc83284e7ac905adc346f7d866b5245 Merge: 815209920f1d 48a1c304e82e Author: Martin Matuska AuthorDate: 2021-03-21 00:46:08 +0000 Commit: Martin Matuska CommitDate: 2021-03-21 01:17:59 +0000 zfs: merge OpenZFS master-891568c99 Notable upstream pull request merges: #11652 Split dmu_zfetch() speculation and execution parts #11682 Fix zfs_get_data access to files with wrong generation #11735 Clean up RAIDZ/DRAID ereport code #11737 Initialize metaslab range trees in metaslab_init #11739 FreeBSD: make seqc asserts conditional on replay #11763 Allow setting bootfs property on pools with indirect vdevs #11767 FreeBSD: Fix memory leaks in kstats Obtained from: OpenZFS MFC after: 2 weeks sys/contrib/openzfs/README.md | 2 +- sys/contrib/openzfs/cmd/raidz_test/raidz_test.c | 2 - sys/contrib/openzfs/cmd/ztest/ztest.c | 4 +- sys/contrib/openzfs/config/kernel-bio_max_segs.m4 | 23 ++ .../openzfs/config/kernel-generic_fillattr.m4 | 28 +++ sys/contrib/openzfs/config/kernel-inode-create.m4 | 43 +++- sys/contrib/openzfs/config/kernel-inode-getattr.m4 | 63 ++++- .../openzfs/config/kernel-is_owner_or_cap.m4 | 23 +- sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 | 32 --- sys/contrib/openzfs/config/kernel-mkdir.m4 | 65 +++++ sys/contrib/openzfs/config/kernel-mknod.m4 | 30 +++ sys/contrib/openzfs/config/kernel-rename.m4 | 50 +++- .../openzfs/config/kernel-setattr-prepare.m4 | 45 +++- sys/contrib/openzfs/config/kernel-symlink.m4 | 30 +++ sys/contrib/openzfs/config/kernel-xattr-handler.m4 | 78 ++++-- sys/contrib/openzfs/config/kernel.m4 | 20 +- sys/contrib/openzfs/configure.ac | 1 + .../include/os/linux/kernel/linux/kmap_compat.h | 4 +- .../include/os/linux/kernel/linux/vfs_compat.h | 24 +- .../include/os/linux/kernel/linux/xattr_compat.h | 17 +- .../include/os/linux/zfs/sys/zfs_vnops_os.h | 3 +- .../include/os/linux/zfs/sys/zfs_znode_impl.h | 8 +- sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h | 18 ++ sys/contrib/openzfs/include/sys/dmu_zfetch.h | 23 +- sys/contrib/openzfs/include/sys/vdev_raidz.h | 2 + sys/contrib/openzfs/include/sys/vdev_raidz_impl.h | 7 +- sys/contrib/openzfs/include/sys/zil.h | 3 +- sys/contrib/openzfs/include/sys/zio.h | 10 +- sys/contrib/openzfs/include/sys/zvol_impl.h | 4 +- .../openzfs/man/man5/zfs-module-parameters.5 | 25 +- sys/contrib/openzfs/man/man8/zfs-allow.8 | 3 + sys/contrib/openzfs/man/man8/zgenhostid.8 | 4 +- sys/contrib/openzfs/man/man8/zpoolconcepts.8 | 17 ++ .../openzfs/module/os/freebsd/spl/spl_kstat.c | 11 +- .../openzfs/module/os/freebsd/zfs/sysctl_os.c | 6 - sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 10 +- sys/contrib/openzfs/module/os/linux/zfs/policy.c | 2 +- .../openzfs/module/os/linux/zfs/vdev_disk.c | 5 + .../openzfs/module/os/linux/zfs/zfs_ctldir.c | 3 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c | 4 +- .../openzfs/module/os/linux/zfs/zfs_vfsops.c | 6 +- .../openzfs/module/os/linux/zfs/zfs_vnops_os.c | 5 +- .../openzfs/module/os/linux/zfs/zpl_ctldir.c | 51 +++- sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 2 +- .../openzfs/module/os/linux/zfs/zpl_inode.c | 52 +++- .../openzfs/module/os/linux/zfs/zpl_xattr.c | 4 +- sys/contrib/openzfs/module/zfs/dbuf.c | 5 +- sys/contrib/openzfs/module/zfs/dmu.c | 35 ++- sys/contrib/openzfs/module/zfs/dmu_zfetch.c | 250 +++++++++++-------- sys/contrib/openzfs/module/zfs/metaslab.c | 149 +++++------- sys/contrib/openzfs/module/zfs/refcount.c | 10 +- sys/contrib/openzfs/module/zfs/vdev.c | 4 +- sys/contrib/openzfs/module/zfs/vdev_draid.c | 240 +------------------ sys/contrib/openzfs/module/zfs/vdev_indirect.c | 1 - sys/contrib/openzfs/module/zfs/vdev_mirror.c | 5 +- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 266 +++------------------ sys/contrib/openzfs/module/zfs/zfs_fm.c | 8 +- sys/contrib/openzfs/module/zfs/zfs_fuid.c | 4 - sys/contrib/openzfs/module/zfs/zfs_log.c | 5 + sys/contrib/openzfs/module/zfs/zfs_vnops.c | 14 +- sys/contrib/openzfs/module/zfs/zil.c | 3 +- sys/contrib/openzfs/module/zfs/zio.c | 4 +- sys/contrib/openzfs/module/zfs/zvol.c | 3 +- sys/contrib/openzfs/tests/runfiles/common.run | 8 +- sys/contrib/openzfs/tests/runfiles/freebsd.run | 4 + sys/contrib/openzfs/tests/runfiles/sanity.run | 4 + .../zfs-tests/tests/functional/acl/Makefile.am | 2 +- .../zfs-tests/tests/functional/acl/off/.gitignore | 1 + .../zfs-tests/tests/functional/acl/off/Makefile.am | 16 ++ .../zfs-tests/tests/functional/acl/off/cleanup.ksh | 33 +++ .../zfs-tests/tests/functional/acl/off/dosmode.ksh | 199 +++++++++++++++ .../functional/acl/off/dosmode_readonly_write.c | 61 +++++ .../tests/functional/acl/off/posixmode.ksh | 145 +++++++++++ .../zfs-tests/tests/functional/acl/off/setup.ksh | 44 ++++ .../tests/functional/redacted_send/Makefile.am | 1 + .../functional/redacted_send/redacted_panic.ksh | 44 ++++ sys/modules/zfs/zfs_config.h | 4 +- 77 files changed, 1561 insertions(+), 883 deletions(-) diff --cc sys/contrib/openzfs/README.md index 31d99386e90e,000000000000..d666df7af309 mode 100644,000000..100644 --- a/sys/contrib/openzfs/README.md +++ b/sys/contrib/openzfs/README.md @@@ -1,35 -1,0 +1,35 @@@ +![img](https://openzfs.github.io/openzfs-docs/_static/img/logo/480px-Open-ZFS-Secondary-Logo-Colour-halfsize.png) + +OpenZFS is an advanced file system and volume manager which was originally +developed for Solaris and is now maintained by the OpenZFS community. +This repository contains the code for running OpenZFS on Linux and FreeBSD. + +[![codecov](https://codecov.io/gh/openzfs/zfs/branch/master/graph/badge.svg)](https://codecov.io/gh/openzfs/zfs) +[![coverity](https://scan.coverity.com/projects/1973/badge.svg)](https://scan.coverity.com/projects/openzfs-zfs) + +# Official Resources + + * [Documentation](https://openzfs.github.io/openzfs-docs/) - for using and developing this repo + * [ZoL Site](https://zfsonlinux.org) - Linux release info & links + * [Mailing lists](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/Mailing%20Lists.html) + * [OpenZFS site](http://open-zfs.org/) - for conference videos and info on other platforms (illumos, OSX, Windows, etc) + +# Installation + +Full documentation for installing OpenZFS on your favorite operating system can +be found at the [Getting Started Page](https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html). + +# Contribute & Develop + +We have a separate document with [contribution guidelines](./.github/CONTRIBUTING.md). + +We have a [Code of Conduct](./CODE_OF_CONDUCT.md). + +# Release + +OpenZFS is released under a CDDL license. +For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197` + +# Supported Kernels + * The `META` file contains the officially recognized supported Linux kernel versions. - * Supported FreeBSD versions are 12-STABLE and 13-CURRENT. ++ * Supported FreeBSD versions are any supported branches and releases starting from 12.2-RELEASE. diff --cc sys/contrib/openzfs/config/kernel-bio_max_segs.m4 index 000000000000,a90d75455c13..a90d75455c13 mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 +++ b/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 diff --cc sys/contrib/openzfs/config/kernel-generic_fillattr.m4 index 000000000000,50c8031305b3..50c8031305b3 mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 +++ b/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 diff --cc sys/contrib/openzfs/config/kernel-mkdir.m4 index 000000000000,a162bcd880ff..a162bcd880ff mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-mkdir.m4 +++ b/sys/contrib/openzfs/config/kernel-mkdir.m4 diff --cc sys/contrib/openzfs/config/kernel-mknod.m4 index 000000000000,ffe45106003a..ffe45106003a mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-mknod.m4 +++ b/sys/contrib/openzfs/config/kernel-mknod.m4 diff --cc sys/contrib/openzfs/config/kernel-symlink.m4 index 000000000000,d90366d04b72..d90366d04b72 mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-symlink.m4 +++ b/sys/contrib/openzfs/config/kernel-symlink.m4 diff --cc sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c index 3b0f824115f8,000000000000..3e3fda20c72c mode 100644,000000..100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c @@@ -1,333 -1,0 +1,333 @@@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ +/* + * Copyright (c) 2015 by Chunwei Chen. All rights reserved. + */ + +#ifdef _KERNEL + +#include +#include +#include +#include +#include +#include + +/* + * Move "n" bytes at byte address "p"; "rw" indicates the direction + * of the move, and the I/O parameters are provided in "uio", which is + * update to reflect the data which was moved. Returns 0 on success or + * a non-zero errno on failure. + */ +static int +zfs_uiomove_iov(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) +{ + const struct iovec *iov = uio->uio_iov; + size_t skip = uio->uio_skip; + ulong_t cnt; + + while (n && uio->uio_resid) { + cnt = MIN(iov->iov_len - skip, n); + switch (uio->uio_segflg) { + case UIO_USERSPACE: + /* + * p = kernel data pointer + * iov->iov_base = user data pointer + */ + if (rw == UIO_READ) { + if (copy_to_user(iov->iov_base+skip, p, cnt)) + return (EFAULT); + } else { + unsigned long b_left = 0; + if (uio->uio_fault_disable) { + if (!zfs_access_ok(VERIFY_READ, + (iov->iov_base + skip), cnt)) { + return (EFAULT); + } + pagefault_disable(); + b_left = + __copy_from_user_inatomic(p, + (iov->iov_base + skip), cnt); + pagefault_enable(); + } else { + b_left = + copy_from_user(p, + (iov->iov_base + skip), cnt); + } + if (b_left > 0) { + unsigned long c_bytes = + cnt - b_left; + uio->uio_skip += c_bytes; + ASSERT3U(uio->uio_skip, <, + iov->iov_len); + uio->uio_resid -= c_bytes; + uio->uio_loffset += c_bytes; + return (EFAULT); + } + } + break; + case UIO_SYSSPACE: + if (rw == UIO_READ) + bcopy(p, iov->iov_base + skip, cnt); + else + bcopy(iov->iov_base + skip, p, cnt); + break; + default: + ASSERT(0); + } + skip += cnt; + if (skip == iov->iov_len) { + skip = 0; + uio->uio_iov = (++iov); + uio->uio_iovcnt--; + } + uio->uio_skip = skip; + uio->uio_resid -= cnt; + uio->uio_loffset += cnt; + p = (caddr_t)p + cnt; + n -= cnt; + } + return (0); +} + +static int +zfs_uiomove_bvec(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) +{ + const struct bio_vec *bv = uio->uio_bvec; + size_t skip = uio->uio_skip; + ulong_t cnt; + + while (n && uio->uio_resid) { + void *paddr; + cnt = MIN(bv->bv_len - skip, n); + - paddr = zfs_kmap_atomic(bv->bv_page, KM_USER1); ++ paddr = zfs_kmap_atomic(bv->bv_page); + if (rw == UIO_READ) + bcopy(p, paddr + bv->bv_offset + skip, cnt); + else + bcopy(paddr + bv->bv_offset + skip, p, cnt); - zfs_kunmap_atomic(paddr, KM_USER1); ++ zfs_kunmap_atomic(paddr); + + skip += cnt; + if (skip == bv->bv_len) { + skip = 0; + uio->uio_bvec = (++bv); + uio->uio_iovcnt--; + } + uio->uio_skip = skip; + uio->uio_resid -= cnt; + uio->uio_loffset += cnt; + p = (caddr_t)p + cnt; + n -= cnt; + } + return (0); +} + +#if defined(HAVE_VFS_IOV_ITER) +static int +zfs_uiomove_iter(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, + boolean_t revert) +{ + size_t cnt = MIN(n, uio->uio_resid); + + if (uio->uio_skip) + iov_iter_advance(uio->uio_iter, uio->uio_skip); + + if (rw == UIO_READ) + cnt = copy_to_iter(p, cnt, uio->uio_iter); + else + cnt = copy_from_iter(p, cnt, uio->uio_iter); + + /* + * When operating on a full pipe no bytes are processed. + * In which case return EFAULT which is converted to EAGAIN + * by the kernel's generic_file_splice_read() function. + */ + if (cnt == 0) + return (EFAULT); + + /* + * Revert advancing the uio_iter. This is set by zfs_uiocopy() + * to avoid consuming the uio and its iov_iter structure. + */ + if (revert) + iov_iter_revert(uio->uio_iter, cnt); + + uio->uio_resid -= cnt; + uio->uio_loffset += cnt; + + return (0); +} +#endif + +int +zfs_uiomove(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) +{ + if (uio->uio_segflg == UIO_BVEC) + return (zfs_uiomove_bvec(p, n, rw, uio)); +#if defined(HAVE_VFS_IOV_ITER) + else if (uio->uio_segflg == UIO_ITER) + return (zfs_uiomove_iter(p, n, rw, uio, B_FALSE)); +#endif + else + return (zfs_uiomove_iov(p, n, rw, uio)); +} +EXPORT_SYMBOL(zfs_uiomove); + +/* + * Fault in the pages of the first n bytes specified by the uio structure. + * 1 byte in each page is touched and the uio struct is unmodified. Any + * error will terminate the process as this is only a best attempt to get + * the pages resident. + */ +int +zfs_uio_prefaultpages(ssize_t n, zfs_uio_t *uio) +{ + if (uio->uio_segflg == UIO_SYSSPACE || uio->uio_segflg == UIO_BVEC) { + /* There's never a need to fault in kernel pages */ + return (0); +#if defined(HAVE_VFS_IOV_ITER) + } else if (uio->uio_segflg == UIO_ITER) { + /* + * At least a Linux 4.9 kernel, iov_iter_fault_in_readable() + * can be relied on to fault in user pages when referenced. + */ + if (iov_iter_fault_in_readable(uio->uio_iter, n)) + return (EFAULT); +#endif + } else { + /* Fault in all user pages */ + ASSERT3S(uio->uio_segflg, ==, UIO_USERSPACE); + const struct iovec *iov = uio->uio_iov; + int iovcnt = uio->uio_iovcnt; + size_t skip = uio->uio_skip; + uint8_t tmp; + caddr_t p; + + for (; n > 0 && iovcnt > 0; iov++, iovcnt--, skip = 0) { + ulong_t cnt = MIN(iov->iov_len - skip, n); + /* empty iov */ + if (cnt == 0) + continue; + n -= cnt; + /* touch each page in this segment. */ + p = iov->iov_base + skip; + while (cnt) { + if (get_user(tmp, (uint8_t *)p)) + return (EFAULT); + ulong_t incr = MIN(cnt, PAGESIZE); + p += incr; + cnt -= incr; + } + /* touch the last byte in case it straddles a page. */ + p--; + if (get_user(tmp, (uint8_t *)p)) + return (EFAULT); + } + } + + if (iterp && iov_iter_fault_in_readable(iterp, n)) + return (EFAULT); +#endif + return (0); +} +EXPORT_SYMBOL(zfs_uio_prefaultpages); + +/* + * The same as zfs_uiomove() but doesn't modify uio structure. + * return in cbytes how many bytes were copied. + */ +int +zfs_uiocopy(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, size_t *cbytes) +{ + zfs_uio_t uio_copy; + int ret; + + bcopy(uio, &uio_copy, sizeof (zfs_uio_t)); + + if (uio->uio_segflg == UIO_BVEC) + ret = zfs_uiomove_bvec(p, n, rw, &uio_copy); +#if defined(HAVE_VFS_IOV_ITER) + else if (uio->uio_segflg == UIO_ITER) + ret = zfs_uiomove_iter(p, n, rw, &uio_copy, B_TRUE); +#endif + else + ret = zfs_uiomove_iov(p, n, rw, &uio_copy); + + *cbytes = uio->uio_resid - uio_copy.uio_resid; + + return (ret); +} +EXPORT_SYMBOL(zfs_uiocopy); + +/* + * Drop the next n chars out of *uio. + */ +void +zfs_uioskip(zfs_uio_t *uio, size_t n) +{ + if (n > uio->uio_resid) + return; + + if (uio->uio_segflg == UIO_BVEC) { + uio->uio_skip += n; + while (uio->uio_iovcnt && + uio->uio_skip >= uio->uio_bvec->bv_len) { + uio->uio_skip -= uio->uio_bvec->bv_len; + uio->uio_bvec++; + uio->uio_iovcnt--; + } +#if defined(HAVE_VFS_IOV_ITER) + } else if (uio->uio_segflg == UIO_ITER) { + iov_iter_advance(uio->uio_iter, n); +#endif + } else { + uio->uio_skip += n; + while (uio->uio_iovcnt && + uio->uio_skip >= uio->uio_iov->iov_len) { + uio->uio_skip -= uio->uio_iov->iov_len; + uio->uio_iov++; + uio->uio_iovcnt--; + } + } + uio->uio_loffset += n; + uio->uio_resid -= n; +} +EXPORT_SYMBOL(zfs_uioskip); + +#endif /* _KERNEL */ diff --cc sys/contrib/openzfs/module/zfs/zio.c index 262ca24b1443,000000000000..a7820e75670b mode 100644,000000..100644 --- a/sys/contrib/openzfs/module/zfs/zio.c +++ b/sys/contrib/openzfs/module/zfs/zio.c @@@ -1,5036 -1,0 +1,5036 @@@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2020 by Delphix. All rights reserved. + * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2017, Intel Corporation. + * Copyright (c) 2019, Klara Inc. + * Copyright (c) 2019, Allan Jude + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * ========================================================================== + * I/O type descriptions + * ========================================================================== + */ +const char *zio_type_name[ZIO_TYPES] = { + /* + * Note: Linux kernel thread name length is limited + * so these names will differ from upstream open zfs. + */ + "z_null", "z_rd", "z_wr", "z_fr", "z_cl", "z_ioctl", "z_trim" +}; + +int zio_dva_throttle_enabled = B_TRUE; +int zio_deadman_log_all = B_FALSE; + +/* + * ========================================================================== + * I/O kmem caches + * ========================================================================== + */ +kmem_cache_t *zio_cache; +kmem_cache_t *zio_link_cache; +kmem_cache_t *zio_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +kmem_cache_t *zio_data_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +#if defined(ZFS_DEBUG) && !defined(_KERNEL) +uint64_t zio_buf_cache_allocs[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +uint64_t zio_buf_cache_frees[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +#endif + +/* Mark IOs as "slow" if they take longer than 30 seconds */ +int zio_slow_io_ms = (30 * MILLISEC); + +#define BP_SPANB(indblkshift, level) \ + (((uint64_t)1) << ((level) * ((indblkshift) - SPA_BLKPTRSHIFT))) +#define COMPARE_META_LEVEL 0x80000000ul +/* + * The following actions directly effect the spa's sync-to-convergence logic. + * The values below define the sync pass when we start performing the action. + * Care should be taken when changing these values as they directly impact + * spa_sync() performance. Tuning these values may introduce subtle performance + * pathologies and should only be done in the context of performance analysis. + * These tunables will eventually be removed and replaced with #defines once + * enough analysis has been done to determine optimal values. + * + * The 'zfs_sync_pass_deferred_free' pass must be greater than 1 to ensure that + * regular blocks are not deferred. + * + * Starting in sync pass 8 (zfs_sync_pass_dont_compress), we disable + * compression (including of metadata). In practice, we don't have this + * many sync passes, so this has no effect. + * + * The original intent was that disabling compression would help the sync + * passes to converge. However, in practice disabling compression increases + * the average number of sync passes, because when we turn compression off, a + * lot of block's size will change and thus we have to re-allocate (not + * overwrite) them. It also increases the number of 128KB allocations (e.g. + * for indirect blocks and spacemaps) because these will not be compressed. + * The 128K allocations are especially detrimental to performance on highly + * fragmented systems, which may have very few free segments of this size, + * and may need to load new metaslabs to satisfy 128K allocations. + */ +int zfs_sync_pass_deferred_free = 2; /* defer frees starting in this pass */ +int zfs_sync_pass_dont_compress = 8; /* don't compress starting in this pass */ +int zfs_sync_pass_rewrite = 2; /* rewrite new bps starting in this pass */ + +/* + * An allocating zio is one that either currently has the DVA allocate + * stage set or will have it later in its lifetime. + */ +#define IO_IS_ALLOCATING(zio) ((zio)->io_orig_pipeline & ZIO_STAGE_DVA_ALLOCATE) + +/* + * Enable smaller cores by excluding metadata + * allocations as well. + */ +int zio_exclude_metadata = 0; +int zio_requeue_io_start_cut_in_line = 1; + +#ifdef ZFS_DEBUG +int zio_buf_debug_limit = 16384; +#else +int zio_buf_debug_limit = 0; +#endif + +static inline void __zio_execute(zio_t *zio); + +static void zio_taskq_dispatch(zio_t *, zio_taskq_type_t, boolean_t); + +void +zio_init(void) +{ + size_t c; + + zio_cache = kmem_cache_create("zio_cache", + sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0); + zio_link_cache = kmem_cache_create("zio_link_cache", + sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0); + + /* + * For small buffers, we want a cache for each multiple of + * SPA_MINBLOCKSIZE. For larger buffers, we want a cache + * for each quarter-power of 2. + */ + for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) { + size_t size = (c + 1) << SPA_MINBLOCKSHIFT; + size_t p2 = size; + size_t align = 0; + size_t data_cflags, cflags; + + data_cflags = KMC_NODEBUG; + cflags = (zio_exclude_metadata || size > zio_buf_debug_limit) ? + KMC_NODEBUG : 0; + +#if defined(_ILP32) && defined(_KERNEL) + /* + * Cache size limited to 1M on 32-bit platforms until ARC + * buffers no longer require virtual address space. + */ + if (size > zfs_max_recordsize) + break; +#endif + + while (!ISP2(p2)) + p2 &= p2 - 1; + +#ifndef _KERNEL + /* + * If we are using watchpoints, put each buffer on its own page, + * to eliminate the performance overhead of trapping to the + * kernel when modifying a non-watched buffer that shares the + * page with a watched buffer. + */ + if (arc_watch && !IS_P2ALIGNED(size, PAGESIZE)) + continue; + /* + * Here's the problem - on 4K native devices in userland on + * Linux using O_DIRECT, buffers must be 4K aligned or I/O + * will fail with EINVAL, causing zdb (and others) to coredump. + * Since userland probably doesn't need optimized buffer caches, + * we just force 4K alignment on everything. + */ + align = 8 * SPA_MINBLOCKSIZE; +#else + if (size < PAGESIZE) { + align = SPA_MINBLOCKSIZE; + } else if (IS_P2ALIGNED(size, p2 >> 2)) { + align = PAGESIZE; + } +#endif + + if (align != 0) { + char name[36]; + if (cflags == data_cflags) { + /* + * Resulting kmem caches would be identical. + * Save memory by creating only one. + */ + (void) snprintf(name, sizeof (name), + "zio_buf_comb_%lu", (ulong_t)size); + zio_buf_cache[c] = kmem_cache_create(name, + size, align, NULL, NULL, NULL, NULL, NULL, + cflags); + zio_data_buf_cache[c] = zio_buf_cache[c]; + continue; + } + (void) snprintf(name, sizeof (name), "zio_buf_%lu", + (ulong_t)size); + zio_buf_cache[c] = kmem_cache_create(name, size, + align, NULL, NULL, NULL, NULL, NULL, cflags); + + (void) snprintf(name, sizeof (name), "zio_data_buf_%lu", + (ulong_t)size); + zio_data_buf_cache[c] = kmem_cache_create(name, size, + align, NULL, NULL, NULL, NULL, NULL, data_cflags); + } + } + + while (--c != 0) { + ASSERT(zio_buf_cache[c] != NULL); + if (zio_buf_cache[c - 1] == NULL) + zio_buf_cache[c - 1] = zio_buf_cache[c]; + + ASSERT(zio_data_buf_cache[c] != NULL); + if (zio_data_buf_cache[c - 1] == NULL) + zio_data_buf_cache[c - 1] = zio_data_buf_cache[c]; + } + + zio_inject_init(); + + lz4_init(); +} + +void +zio_fini(void) +{ + size_t i, j, n; + kmem_cache_t *cache; + + n = SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; + +#if defined(ZFS_DEBUG) && !defined(_KERNEL) + for (i = 0; i < n; i++) { + if (zio_buf_cache_allocs[i] != zio_buf_cache_frees[i]) + (void) printf("zio_fini: [%d] %llu != %llu\n", + (int)((i + 1) << SPA_MINBLOCKSHIFT), + (long long unsigned)zio_buf_cache_allocs[i], + (long long unsigned)zio_buf_cache_frees[i]); + } +#endif + + /* + * The same kmem cache can show up multiple times in both zio_buf_cache + * and zio_data_buf_cache. Do a wasteful but trivially correct scan to + * sort it out. + */ + for (i = 0; i < n; i++) { + cache = zio_buf_cache[i]; + if (cache == NULL) + continue; + for (j = i; j < n; j++) { + if (cache == zio_buf_cache[j]) + zio_buf_cache[j] = NULL; + if (cache == zio_data_buf_cache[j]) + zio_data_buf_cache[j] = NULL; + } + kmem_cache_destroy(cache); + } + + for (i = 0; i < n; i++) { + cache = zio_data_buf_cache[i]; + if (cache == NULL) + continue; + for (j = i; j < n; j++) { + if (cache == zio_data_buf_cache[j]) + zio_data_buf_cache[j] = NULL; + } + kmem_cache_destroy(cache); + } + + for (i = 0; i < n; i++) { + if (zio_buf_cache[i] != NULL) + panic("zio_fini: zio_buf_cache[%d] != NULL", (int)i); + if (zio_data_buf_cache[i] != NULL) + panic("zio_fini: zio_data_buf_cache[%d] != NULL", (int)i); + } + + kmem_cache_destroy(zio_link_cache); + kmem_cache_destroy(zio_cache); + + zio_inject_fini(); + + lz4_fini(); +} + +/* + * ========================================================================== + * Allocate and free I/O buffers + * ========================================================================== + */ + +/* + * Use zio_buf_alloc to allocate ZFS metadata. This data will appear in a + * crashdump if the kernel panics, so use it judiciously. Obviously, it's + * useful to inspect ZFS metadata, but if possible, we should avoid keeping + * excess / transient data in-core during a crashdump. + */ +void * +zio_buf_alloc(size_t size) +{ + size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); +#if defined(ZFS_DEBUG) && !defined(_KERNEL) + atomic_add_64(&zio_buf_cache_allocs[c], 1); +#endif + + return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE)); +} + +/* + * Use zio_data_buf_alloc to allocate data. The data will not appear in a + * crashdump if the kernel panics. This exists so that we will limit the amount + * of ZFS data that shows up in a kernel crashdump. (Thus reducing the amount + * of kernel heap dumped to disk when the kernel panics) + */ +void * +zio_data_buf_alloc(size_t size) +{ + size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); + + return (kmem_cache_alloc(zio_data_buf_cache[c], KM_PUSHPAGE)); +} + +void +zio_buf_free(void *buf, size_t size) +{ + size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); +#if defined(ZFS_DEBUG) && !defined(_KERNEL) + atomic_add_64(&zio_buf_cache_frees[c], 1); +#endif + + kmem_cache_free(zio_buf_cache[c], buf); +} + +void +zio_data_buf_free(void *buf, size_t size) +{ + size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); + + kmem_cache_free(zio_data_buf_cache[c], buf); +} + +static void +zio_abd_free(void *abd, size_t size) +{ + abd_free((abd_t *)abd); +} + +/* + * ========================================================================== + * Push and pop I/O transform buffers + * ========================================================================== + */ +void +zio_push_transform(zio_t *zio, abd_t *data, uint64_t size, uint64_t bufsize, + zio_transform_func_t *transform) +{ + zio_transform_t *zt = kmem_alloc(sizeof (zio_transform_t), KM_SLEEP); + + zt->zt_orig_abd = zio->io_abd; + zt->zt_orig_size = zio->io_size; + zt->zt_bufsize = bufsize; + zt->zt_transform = transform; + + zt->zt_next = zio->io_transform_stack; + zio->io_transform_stack = zt; + + zio->io_abd = data; + zio->io_size = size; +} + +void +zio_pop_transforms(zio_t *zio) +{ + zio_transform_t *zt; + + while ((zt = zio->io_transform_stack) != NULL) { + if (zt->zt_transform != NULL) + zt->zt_transform(zio, + zt->zt_orig_abd, zt->zt_orig_size); + + if (zt->zt_bufsize != 0) + abd_free(zio->io_abd); + + zio->io_abd = zt->zt_orig_abd; + zio->io_size = zt->zt_orig_size; + zio->io_transform_stack = zt->zt_next; + + kmem_free(zt, sizeof (zio_transform_t)); + } +} + +/* + * ========================================================================== + * I/O transform callbacks for subblocks, decompression, and decryption + * ========================================================================== + */ +static void +zio_subblock(zio_t *zio, abd_t *data, uint64_t size) +{ + ASSERT(zio->io_size > size); + + if (zio->io_type == ZIO_TYPE_READ) + abd_copy(data, zio->io_abd, size); +} + +static void +zio_decompress(zio_t *zio, abd_t *data, uint64_t size) +{ + if (zio->io_error == 0) { + void *tmp = abd_borrow_buf(data, size); + int ret = zio_decompress_data(BP_GET_COMPRESS(zio->io_bp), + zio->io_abd, tmp, zio->io_size, size, + &zio->io_prop.zp_complevel); + abd_return_buf_copy(data, tmp, size); + + if (zio_injection_enabled && ret == 0) + ret = zio_handle_fault_injection(zio, EINVAL); + + if (ret != 0) + zio->io_error = SET_ERROR(EIO); + } +} + +static void +zio_decrypt(zio_t *zio, abd_t *data, uint64_t size) +{ + int ret; + void *tmp; + blkptr_t *bp = zio->io_bp; + spa_t *spa = zio->io_spa; + uint64_t dsobj = zio->io_bookmark.zb_objset; + uint64_t lsize = BP_GET_LSIZE(bp); + dmu_object_type_t ot = BP_GET_TYPE(bp); + uint8_t salt[ZIO_DATA_SALT_LEN]; + uint8_t iv[ZIO_DATA_IV_LEN]; + uint8_t mac[ZIO_DATA_MAC_LEN]; + boolean_t no_crypt = B_FALSE; + *** 5391 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sun Mar 21 01:39:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 482405BA868; Sun, 21 Mar 2021 01:39:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F30fs1CwRz3krV; Sun, 21 Mar 2021 01:39:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id E0F92286D7; Sun, 21 Mar 2021 01:39:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 82C898D4A172; Sun, 21 Mar 2021 01:39:30 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 5E376E707B3; Sun, 21 Mar 2021 01:39:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id pS2M2cTz4FsG; Sun, 21 Mar 2021 01:39:27 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:4902:79d8:45c4:6b20:2cd]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 7B3BBE707AF; Sun, 21 Mar 2021 01:39:27 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Emmanuel Vadot" , "Dr Robert N. M. Watson" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8c3eaf244a41 - main - pkgbase: Install all BSM includes with INCS Date: Sun, 21 Mar 2021 01:39:24 +0000 X-Mailer: MailMate (2.0BETAr6151) Message-ID: <690AB8BF-69F3-465A-BB2F-F72145935195@FreeBSD.org> In-Reply-To: <202103160613.12G6DJlN061954@gitrepo.freebsd.org> References: <202103160613.12G6DJlN061954@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 01:39:33 -0000 On 16 Mar 2021, at 6:13, Emmanuel Vadot wrote: Hi manu, Cc: rwatson > The branch main has been updated by manu: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D8c3eaf244a417a4ee105834410a52= 144206102e5 > > commit 8c3eaf244a417a4ee105834410a52144206102e5 > Author: Emmanuel Vadot > AuthorDate: 2021-03-16 06:12:46 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-03-16 06:12:46 +0000 > > pkgbase: Install all BSM includes with INCS > > Now they are correctly taggued and put them into the libbsm = > package > > Reviewed by: bapt > Differential Revision: https://reviews.freebsd.org/D29165 > MFC after: 2 weeks > --- > include/Makefile | 27 +++++++++++++++++++++++++-- > 1 file changed, 25 insertions(+), 2 deletions(-) > > diff --git a/include/Makefile b/include/Makefile > index 8ddfd7015918..cf760359d2f5 100644 > --- a/include/Makefile > +++ b/include/Makefile =2E. > @@ -175,6 +193,11 @@ INCSGROUPS=3D INCS \ > VERIEXEC \ > WG > > +.if ${MK_AUDIT} !=3D "no" > +INCSGROUPS+=3D BSM > +INCSGROUPS+=3D SECAUDIT > +.endif > + > .if ${MK_IPFILTER} !=3D "no" > INCSGROUPS+=3D IPFILTER > .endif This breaks builds for WITHOUT_AUDIT=3D I believe. Files in libc = (gen/fstab.c) include sys/mount.h which includes sys/ucred.h which = unconditionally includes bsm/audit.h (and has been for a decade or more, = and so does sys/sysent.h) which now is not found anymore if audit is = turned off. I believe sys/ucred.h can be fixed: iff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index 6a9becb54c7..b23374f48c9 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -38,8 +38,8 @@ #if defined(_KERNEL) || defined(_WANT_UCRED) #include #include -#endif #include +#endif struct loginclass; Sadly this won=E2=80=99t fix lib/libkvm/kvm_proc.c and = lib/libprocstat/libprocstat.c which define _WANT_UCRED and at least = kvm_proc.c and probably kdump and rpcgen consumers rely on sysent and = whatever else I missed with a quick look again which are not as easily = fixed. How do we check in kernel header files for user space build options to = be set correctly? That would actually not fix the problem for sysent.h = as we=E2=80=99d have a missing type. And for ucred with the places actua= lly = asking for it as well. Given we cannot change the size of these structs = I believe we have to unconditionally install at least audit.h (for now)? /bz From owner-dev-commits-src-main@freebsd.org Sun Mar 21 02:29:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62C7A5BB4D7; Sun, 21 Mar 2021 02:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F31mp2PCRz3nBy; Sun, 21 Mar 2021 02:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4116A12F1A; Sun, 21 Mar 2021 02:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12L2Tk7E031122; Sun, 21 Mar 2021 02:29:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L2TkHY031121; Sun, 21 Mar 2021 02:29:46 GMT (envelope-from git) Date: Sun, 21 Mar 2021 02:29:46 GMT Message-Id: <202103210229.12L2TkHY031121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: d22883d71544 - main - Remove PCPU_INC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d22883d715440f743ab427396f0a87b72e724d18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 02:29:46 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=d22883d715440f743ab427396f0a87b72e724d18 commit d22883d715440f743ab427396f0a87b72e724d18 Author: Jason A. Harmening AuthorDate: 2021-03-10 04:43:01 +0000 Commit: Jason A. Harmening CommitDate: 2021-03-21 02:23:59 +0000 Remove PCPU_INC e4b8deb22227 removed the last in-tree uses of PCPU_INC(). Its potential benefit is also practically nonexistent. Non-x86 platforms already implement it as PCPU_ADD(..., 1), and according to [0] there are no recent x86 processors for which the 'inc' instruction provides a performance benefit over the equivalent memory-operand form of the 'add' instruction. The only remaining benefit of 'inc' is smaller instruction size, which in this case is inconsequential given the limited number of per-CPU data consumers. [0]: https://www.agner.org/optimize/instruction_tables.pdf Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29308 --- sys/amd64/include/pcpu.h | 29 ----------------------------- sys/arm/include/pcpu.h | 1 - sys/arm64/include/pcpu.h | 1 - sys/i386/include/pcpu.h | 24 ------------------------ sys/mips/include/pcpu.h | 1 - sys/powerpc/include/pcpu.h | 1 - sys/riscv/include/pcpu.h | 1 - 7 files changed, 58 deletions(-) diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h index 6326fbdae0be..dc99d4249bd2 100644 --- a/sys/amd64/include/pcpu.h +++ b/sys/amd64/include/pcpu.h @@ -179,34 +179,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); *__PCPU_PTR(name) += __val; \ } while (0) -/* - * Increments the value of the per-cpu counter name. The implementation - * must be atomic with respect to interrupts. - */ -#define __PCPU_INC(name) do { \ - CTASSERT(sizeof(__pcpu_type(name)) == 1 || \ - sizeof(__pcpu_type(name)) == 2 || \ - sizeof(__pcpu_type(name)) == 4 || \ - sizeof(__pcpu_type(name)) == 8); \ - if (sizeof(__pcpu_type(name)) == 1) { \ - __asm __volatile("incb %%gs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 2) { \ - __asm __volatile("incw %%gs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 4) { \ - __asm __volatile("incl %%gs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 8) { \ - __asm __volatile("incq %%gs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } \ -} while (0) - /* * Sets the value of the per-cpu variable name to value val. */ @@ -239,7 +211,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) -#define PCPU_INC(member) __PCPU_INC(pc_ ## member) #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) diff --git a/sys/arm/include/pcpu.h b/sys/arm/include/pcpu.h index 4d609b10bf73..2353b1d06b17 100644 --- a/sys/arm/include/pcpu.h +++ b/sys/arm/include/pcpu.h @@ -136,7 +136,6 @@ set_tls(void *tls) #define PCPU_GET(member) (get_pcpu()->pc_ ## member) #define PCPU_ADD(member, value) (get_pcpu()->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&get_pcpu()->pc_ ## member) #define PCPU_SET(member,value) (get_pcpu()->pc_ ## member = (value)) diff --git a/sys/arm64/include/pcpu.h b/sys/arm64/include/pcpu.h index ce4dc46e1609..09f6361c651c 100644 --- a/sys/arm64/include/pcpu.h +++ b/sys/arm64/include/pcpu.h @@ -73,7 +73,6 @@ get_curthread(void) #define PCPU_GET(member) (pcpup->pc_ ## member) #define PCPU_ADD(member, value) (pcpup->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&pcpup->pc_ ## member) #define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h index 9e65d179dc36..a4c7968ea85f 100644 --- a/sys/i386/include/pcpu.h +++ b/sys/i386/include/pcpu.h @@ -169,29 +169,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); *__PCPU_PTR(name) += __val; \ } while (0) -/* - * Increments the value of the per-cpu counter name. The implementation - * must be atomic with respect to interrupts. - */ -#define __PCPU_INC(name) do { \ - CTASSERT(sizeof(__pcpu_type(name)) == 1 || \ - sizeof(__pcpu_type(name)) == 2 || \ - sizeof(__pcpu_type(name)) == 4); \ - if (sizeof(__pcpu_type(name)) == 1) { \ - __asm __volatile("incb %%fs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 2) { \ - __asm __volatile("incw %%fs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 4) { \ - __asm __volatile("incl %%fs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } \ -} while (0) - /* * Sets the value of the per-cpu variable name to value val. */ @@ -224,7 +201,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) -#define PCPU_INC(member) __PCPU_INC(pc_ ## member) #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) diff --git a/sys/mips/include/pcpu.h b/sys/mips/include/pcpu.h index fea594729e90..879f2d8afb90 100644 --- a/sys/mips/include/pcpu.h +++ b/sys/mips/include/pcpu.h @@ -83,7 +83,6 @@ extern struct pcpu *pcpup; #define PCPU_ADD(member, value) (PCPUP->pc_ ## member += (value)) #define PCPU_GET(member) (PCPUP->pc_ ## member) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&PCPUP->pc_ ## member) #define PCPU_SET(member,value) (PCPUP->pc_ ## member = (value)) #define PCPU_LAZY_INC(member) (++PCPUP->pc_ ## member) diff --git a/sys/powerpc/include/pcpu.h b/sys/powerpc/include/pcpu.h index 31c4b2c47c70..288e12c1f2ab 100644 --- a/sys/powerpc/include/pcpu.h +++ b/sys/powerpc/include/pcpu.h @@ -168,7 +168,6 @@ __curthread(void) * with respect to preemption. */ #define PCPU_ADD(member, value) (pcpup->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&pcpup->pc_ ## member) #define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) diff --git a/sys/riscv/include/pcpu.h b/sys/riscv/include/pcpu.h index 5068596462fc..af5eb6fd5c41 100644 --- a/sys/riscv/include/pcpu.h +++ b/sys/riscv/include/pcpu.h @@ -79,7 +79,6 @@ get_curthread(void) #define PCPU_GET(member) (get_pcpu()->pc_ ## member) #define PCPU_ADD(member, value) (get_pcpu()->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&get_pcpu()->pc_ ## member) #define PCPU_SET(member,value) (get_pcpu()->pc_ ## member = (value)) From owner-dev-commits-src-main@freebsd.org Sun Mar 21 17:14:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE1E057CAC4; Sun, 21 Mar 2021 17:14:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3PPS5Klkz3QBs; Sun, 21 Mar 2021 17:14:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA4E51E893; Sun, 21 Mar 2021 17:14:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12LHEKka075873; Sun, 21 Mar 2021 17:14:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHEKkC075872; Sun, 21 Mar 2021 17:14:20 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:14:20 GMT Message-Id: <202103211714.12LHEKkC075872@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 6234a0bfc863 - main - usr.sbin/uefisign: prevent specifying certificate, key or output multiple times. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6234a0bfc8630fc556295812c15d72bde0f6427a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:14:20 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=6234a0bfc8630fc556295812c15d72bde0f6427a commit 6234a0bfc8630fc556295812c15d72bde0f6427a Author: Xin LI AuthorDate: 2021-03-21 17:12:34 +0000 Commit: Xin LI CommitDate: 2021-03-21 17:12:34 +0000 usr.sbin/uefisign: prevent specifying certificate, key or output multiple times. MFC after: 1 month --- usr.sbin/uefisign/uefisign.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/usr.sbin/uefisign/uefisign.c b/usr.sbin/uefisign/uefisign.c index aa2a7621998d..149e90ba0e67 100644 --- a/usr.sbin/uefisign/uefisign.c +++ b/usr.sbin/uefisign/uefisign.c @@ -350,13 +350,22 @@ main(int argc, char **argv) Vflag = true; break; case 'c': - certpath = checked_strdup(optarg); + if (certpath == NULL) + certpath = checked_strdup(optarg); + else + err(1, "-c can only be specified once"); break; case 'k': - keypath = checked_strdup(optarg); + if (keypath == NULL) + keypath = checked_strdup(optarg); + else + err(1, "-k can only be specified once"); break; case 'o': - outpath = checked_strdup(optarg); + if (outpath == NULL) + outpath = checked_strdup(optarg); + else + err(1, "-o can only be specified once"); break; case 'v': vflag = true; @@ -402,7 +411,7 @@ main(int argc, char **argv) err(1, "fork"); if (pid == 0) - return (child(inpath, outpath, pipefds[1], Vflag, vflag)); + exit(child(inpath, outpath, pipefds[1], Vflag, vflag)); if (!Vflag) { certfp = checked_fopen(certpath, "r"); @@ -422,5 +431,5 @@ main(int argc, char **argv) sign(cert, key, pipefds[0]); } - return (wait_for_child(pid)); + exit(wait_for_child(pid)); } From owner-dev-commits-src-main@freebsd.org Sun Mar 21 17:28:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EFBA57CFE8; Sun, 21 Mar 2021 17:28:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3Pk472bbz3RGb; Sun, 21 Mar 2021 17:28:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E47031EB80; Sun, 21 Mar 2021 17:28:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12LHSiI7090356; Sun, 21 Mar 2021 17:28:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHSigh090355; Sun, 21 Mar 2021 17:28:44 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:28:44 GMT Message-Id: <202103211728.12LHSigh090355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 57b9a062d147 - main - usr.sbin/services_mkdb: diff reduction against NetBSD. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57b9a062d147563ecda72227f0bb051f60eff608 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:28:45 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=57b9a062d147563ecda72227f0bb051f60eff608 commit 57b9a062d147563ecda72227f0bb051f60eff608 Author: Xin LI AuthorDate: 2021-03-21 17:22:50 +0000 Commit: Xin LI CommitDate: 2021-03-21 17:22:50 +0000 usr.sbin/services_mkdb: diff reduction against NetBSD. MFC after: 1 month --- usr.sbin/services_mkdb/uniq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/services_mkdb/uniq.c b/usr.sbin/services_mkdb/uniq.c index 74984468cbb5..330a09fc10e1 100644 --- a/usr.sbin/services_mkdb/uniq.c +++ b/usr.sbin/services_mkdb/uniq.c @@ -90,6 +90,7 @@ uniq(const char *fname) break; case -1: err(1, "put"); + /* NOTREACHED */ default: abort(); break; From owner-dev-commits-src-main@freebsd.org Sun Mar 21 18:17:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4A3857EF9F; Sun, 21 Mar 2021 18:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3QpF687nz3lGN; Sun, 21 Mar 2021 18:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C591D1F0F7; Sun, 21 Mar 2021 18:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12LIHPqI060849; Sun, 21 Mar 2021 18:17:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LIHP6m060848; Sun, 21 Mar 2021 18:17:25 GMT (envelope-from git) Date: Sun, 21 Mar 2021 18:17:25 GMT Message-Id: <202103211817.12LIHP6m060848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 2476178e6b09 - main - Fix kassert panic when inserting multipath routes from multiple threads. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2476178e6b09acc8d0fe6b1fb9c1b6f2981f766e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 18:17:26 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=2476178e6b09acc8d0fe6b1fb9c1b6f2981f766e commit 2476178e6b09acc8d0fe6b1fb9c1b6f2981f766e Author: Alexander V. Chernikov AuthorDate: 2021-03-21 18:15:29 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-21 18:15:29 +0000 Fix kassert panic when inserting multipath routes from multiple threads. Reported by: Marco Zec MFC after: immediately --- sys/net/route/nhgrp_ctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index c2119506370f..b329b907144f 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -488,7 +488,9 @@ get_nhgrp(struct nh_control *ctl, struct weightened_nhop *wn, int num_nhops, if (link_nhgrp(ctl, key) == 0) { /* Unable to allocate index? */ *perror = EAGAIN; - destroy_nhgrp(key); + free_nhgrp_nhops(key); + destroy_nhgrp_int(key); + return (NULL); } *perror = 0; return (key); From owner-dev-commits-src-main@freebsd.org Sun Mar 21 18:19:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7FD357ED79; Sun, 21 Mar 2021 18:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3Qs65K1Qz3lQk; Sun, 21 Mar 2021 18:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A93441F0F8; Sun, 21 Mar 2021 18:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12LIJsB7061323; Sun, 21 Mar 2021 18:19:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LIJsW3061321; Sun, 21 Mar 2021 18:19:54 GMT (envelope-from git) Date: Sun, 21 Mar 2021 18:19:54 GMT Message-Id: <202103211819.12LIJsW3061321@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1af332a7d8f8 - main - rtsold: Fix validation of RDNSS options MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1af332a7d8f86b6fcc1f0f575fe5b06021b54f4c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 18:19:54 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1af332a7d8f86b6fcc1f0f575fe5b06021b54f4c commit 1af332a7d8f86b6fcc1f0f575fe5b06021b54f4c Author: Mark Johnston AuthorDate: 2021-03-21 18:18:10 +0000 Commit: Mark Johnston CommitDate: 2021-03-21 18:19:42 +0000 rtsold: Fix validation of RDNSS options The header specifies the size of the option in multiples of eight bytes. The option consists of an eight-byte header followed by one or more IPv6 addresses, so the option is invalid if the size is not equal to 1+2n for some n>0. Check this. The bug can cause random stack data to be formatted as an IPv6 address and passed to resolvconf(8), but a host able to trigger the bug may also specify arbitrary addresses this way. Reported by: Q C Sponsored by: The FreeBSD Foundation MFC after: 3 days --- usr.sbin/rtsold/rtsol.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/usr.sbin/rtsold/rtsol.c b/usr.sbin/rtsold/rtsol.c index 30027fc65ac9..76756bfd8393 100644 --- a/usr.sbin/rtsold/rtsol.c +++ b/usr.sbin/rtsold/rtsol.c @@ -363,13 +363,19 @@ rtsol_input(int sock) case ND_OPT_RDNSS: rdnss = (struct nd_opt_rdnss *)raoptp; - /* Optlen sanity check (Section 5.3.1 in RFC 6106) */ - if (rdnss->nd_opt_rdnss_len < 3) { + /* + * The option header is 8 bytes long and each address + * occupies 16 bytes, so the option length must be + * greater than or equal to 24 bytes and an odd multiple + * of 8 bytes. See section 5.1 in RFC 6106. + */ + if (rdnss->nd_opt_rdnss_len < 3 || + rdnss->nd_opt_rdnss_len % 2 == 0) { warnmsg(LOG_INFO, __func__, - "too short RDNSS option" - "in RA from %s was ignored.", - inet_ntop(AF_INET6, &from.sin6_addr, - ntopbuf, sizeof(ntopbuf))); + "too short RDNSS option in RA from %s " + "was ignored.", + inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, + sizeof(ntopbuf))); break; } From owner-dev-commits-src-main@freebsd.org Sun Mar 21 18:56:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06EC05A83D0; Sun, 21 Mar 2021 18:56:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3Rfp6Xb8z3nl0; Sun, 21 Mar 2021 18:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D34171FCC4; Sun, 21 Mar 2021 18:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12LIu28M016225; Sun, 21 Mar 2021 18:56:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LIu2bP016224; Sun, 21 Mar 2021 18:56:02 GMT (envelope-from git) Date: Sun, 21 Mar 2021 18:56:02 GMT Message-Id: <202103211856.12LIu2bP016224@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 2595d78f3df2 - main - sys/ck.h: Add an include guard MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2595d78f3df2ca389aae259a291f93eb06ecad43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 18:56:03 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2595d78f3df2ca389aae259a291f93eb06ecad43 commit 2595d78f3df2ca389aae259a291f93eb06ecad43 Author: Kevin Bowling AuthorDate: 2021-03-21 18:50:30 +0000 Commit: Kevin Bowling CommitDate: 2021-03-21 18:55:52 +0000 sys/ck.h: Add an include guard Approved by: cognet MFC after: 1 week Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D29357 --- sys/sys/ck.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/sys/ck.h b/sys/sys/ck.h index 3bfce70c8d2c..b04fe67b476d 100644 --- a/sys/sys/ck.h +++ b/sys/sys/ck.h @@ -1,6 +1,9 @@ /* * $FreeBSD$ */ +#ifndef _SYS_CK_H_ +#define _SYS_CK_H_ + #ifdef _KERNEL #include #include @@ -11,3 +14,5 @@ #define CK_LIST_HEAD LIST_HEAD #define CK_LIST_ENTRY LIST_ENTRY #endif + +#endif /* !_SYS_CK_H_ */