svn commit: r355700 - head/usr.sbin/ntp
Author: cem Date: Fri Dec 13 05:54:38 2019 New Revision: 355700 URL: https://svnweb.freebsd.org/changeset/base/355700 Log: ntpd(8): Don't use OpenSSL's RAND API The !USE_OPENSSL_CRYPTO_RAND path uses arc4random_buf() correctly. In general, we should prefer to avoid things OpenSSL does poorly when a good alternative exists in libc. Modified: head/usr.sbin/ntp/Makefile.inc Modified: head/usr.sbin/ntp/Makefile.inc == --- head/usr.sbin/ntp/Makefile.inc Fri Dec 13 05:42:57 2019 (r355699) +++ head/usr.sbin/ntp/Makefile.inc Fri Dec 13 05:54:38 2019 (r355700) @@ -11,7 +11,7 @@ NTPDEFS= -DSYS_FREEBSD CFLAGS+= ${NTPDEFS} ${DEFS_LOCAL} ${CLOCKDEFS} .if ${MK_OPENSSL} != "no" -CFLAGS+= -DOPENSSL -DUSE_OPENSSL_CRYPTO_RAND -DAUTOKEY +CFLAGS+= -DOPENSSL -DAUTOKEY .endif WARNS?=0 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355699 - head/contrib/telnet/libtelnet
Author: cem Date: Fri Dec 13 05:42:57 2019 New Revision: 355699 URL: https://svnweb.freebsd.org/changeset/base/355699 Log: libtelnet: Replace bogus use of srandomdev + random to generate "public key pair" I'm pretty skeptical that any crypto in telnet is worth using, but if we're ostensibly generating keys, arc4random is strictly better than the previous construct. Modified: head/contrib/telnet/libtelnet/pk.c Modified: head/contrib/telnet/libtelnet/pk.c == --- head/contrib/telnet/libtelnet/pk.c Fri Dec 13 05:29:26 2019 (r355698) +++ head/contrib/telnet/libtelnet/pk.c Fri Dec 13 05:42:57 2019 (r355699) @@ -142,12 +142,7 @@ common_key(char *xsecret, char *xpublic, IdeaData *ide static void getseed(char *seed, int seedsize) { - int i; - - srandomdev(); - for (i = 0; i < seedsize; i++) { - seed[i] = random() & 0xff; - } + arc4random_buf(seed, seedsize); } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355696 - head/lib/libtacplus
On Thu, Dec 12, 2019 at 9:11 PM Conrad Meyer wrote: > Author: cem > Date: Fri Dec 13 05:11:34 2019 > New Revision: 355696 > URL: https://svnweb.freebsd.org/changeset/base/355696 > > Log: > libtacplus: Remove bogus srandomdev+random > > Replace with arc4random. > > TACAS+ is a 1993 Cisco extension to the 1984 TACAS. Is this something > we want > in base still? The directory has been substantively unmaintained since > 2002, > at least. > > It's not as dead as that makes it sound -- https://datatracker.ietf.org/doc/draft-ietf-opsawg-tacacs/ is on its way to becoming an RFC. -Ben ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355697 - head/contrib/bsnmp/snmpd
Author: cem Date: Fri Dec 13 05:13:25 2019 New Revision: 355697 URL: https://svnweb.freebsd.org/changeset/base/355697 Log: bsnmpd(1): Replace dubious srandomdev+random(3) with arc4random(3) Modified: head/contrib/bsnmp/snmpd/main.c Modified: head/contrib/bsnmp/snmpd/main.c == --- head/contrib/bsnmp/snmpd/main.c Fri Dec 13 05:11:34 2019 (r355696) +++ head/contrib/bsnmp/snmpd/main.c Fri Dec 13 05:13:25 2019 (r355697) @@ -1615,9 +1615,7 @@ main(int argc, char *argv[]) progargs = argv; nprogargs = argc; - srandomdev(); - - snmp_serial_no = random(); + snmp_serial_no = arc4random(); #ifdef USE_TCPWRAPPERS /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355696 - head/lib/libtacplus
Author: cem Date: Fri Dec 13 05:11:34 2019 New Revision: 355696 URL: https://svnweb.freebsd.org/changeset/base/355696 Log: libtacplus: Remove bogus srandomdev+random Replace with arc4random. TACAS+ is a 1993 Cisco extension to the 1984 TACAS. Is this something we want in base still? The directory has been substantively unmaintained since 2002, at least. Modified: head/lib/libtacplus/taclib.c Modified: head/lib/libtacplus/taclib.c == --- head/lib/libtacplus/taclib.cFri Dec 13 04:55:17 2019 (r355695) +++ head/lib/libtacplus/taclib.cFri Dec 13 05:11:34 2019 (r355696) @@ -429,10 +429,10 @@ gen_session_id(struct tac_msg *msg) { int r; - r = random(); + r = arc4random(); msg->session_id[0] = r >> 8; msg->session_id[1] = r; - r = random(); + r = arc4random(); msg->session_id[2] = r >> 8; msg->session_id[3] = r; } @@ -1051,7 +1051,6 @@ tac_open(void) } init_srvr_str(>srvr_msg); init_srvr_str(>srvr_data); - srandomdev(); } return h; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355695 - head/lib/libradius
Author: cem Date: Fri Dec 13 04:55:17 2019 New Revision: 355695 URL: https://svnweb.freebsd.org/changeset/base/355695 Log: libradius: Rip out dubious use of srandomdev(3)+random(3) These functions appear to intend to produce unpredictable results. Just use arc4random. While here, use an explicit_bzero instead of memset where the intent is clearly to zero out a secret (clear_passphrase). Modified: head/lib/libradius/radlib.c Modified: head/lib/libradius/radlib.c == --- head/lib/libradius/radlib.c Fri Dec 13 04:48:20 2019(r355694) +++ head/lib/libradius/radlib.c Fri Dec 13 04:55:17 2019(r355695) @@ -79,7 +79,7 @@ static void clear_password(struct rad_handle *h) { if (h->pass_len != 0) { - memset(h->pass, 0, h->pass_len); + explicit_bzero(h->pass, h->pass_len); h->pass_len = 0; } h->pass_pos = 0; @@ -852,8 +852,8 @@ rad_create_request(struct rad_handle *h, int code) if (code == RAD_ACCESS_REQUEST) { /* Create a random authenticator */ for (i = 0; i < LEN_AUTH; i += 2) { - long r; - r = random(); + uint32_t r; + r = arc4random(); h->out[POS_AUTH+i] = (u_char)r; h->out[POS_AUTH+i+1] = (u_char)(r >> 8); } @@ -1051,10 +1051,9 @@ rad_auth_open(void) h = (struct rad_handle *)malloc(sizeof(struct rad_handle)); if (h != NULL) { - srandomdev(); h->fd = -1; h->num_servers = 0; - h->ident = random(); + h->ident = arc4random(); h->errmsg[0] = '\0'; memset(h->pass, 0, sizeof h->pass); h->pass_len = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355694 - head/sys/kern
Author: cem Date: Fri Dec 13 04:48:20 2019 New Revision: 355694 URL: https://svnweb.freebsd.org/changeset/base/355694 Log: kern/subr_unit: Rip srandomdev, random(3) out of dead code The simulation cannot be reproduced, so the value of using a deterministic PRNG like random(3) is dubious. The number of repitions used in the sample isn't a problem for the Chacha implementation of arc4random we have today. (Also, no one actually runs this code; it was provided as an example of the work the author did validating the implementation. It's not even test code.) Modified: head/sys/kern/subr_unit.c Modified: head/sys/kern/subr_unit.c == --- head/sys/kern/subr_unit.c Fri Dec 13 04:37:39 2019(r355693) +++ head/sys/kern/subr_unit.c Fri Dec 13 04:48:20 2019(r355694) @@ -1021,7 +1021,7 @@ main(int argc, char **argv) long count = 1; /* Number of unrs to test */ long reps = 1, m; int ch; - u_int i, j; + u_int i; verbose = false; @@ -1055,20 +1055,18 @@ main(int argc, char **argv) a = calloc(count, sizeof(char)); if (a == NULL) err(1, "calloc failed"); - srandomdev(); printf("sizeof(struct unr) %zu\n", sizeof(struct unr)); printf("sizeof(struct unrb) %zu\n", sizeof(struct unrb)); printf("sizeof(struct unrhdr) %zu\n", sizeof(struct unrhdr)); printf("NBITS %lu\n", (unsigned long)NBITS); for (m = 0; m < count * reps; m++) { - j = random(); - i = (j >> 1) % count; + i = arc4random_uniform(count); #if 0 if (a[i] && (j & 1)) continue; #endif - if ((random() & 1) != 0) + if ((arc4random() & 1) != 0) test_alloc_unr(uh, i, a); else test_alloc_unr_specific(uh, i, a); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355693 - head/usr.bin/random
Author: cem Date: Fri Dec 13 04:37:39 2019 New Revision: 355693 URL: https://svnweb.freebsd.org/changeset/base/355693 Log: random(6): produce random results This program is trash and there's no reason to keep it in base. But as long as we're shipping a silly program named 'random', let's actually make it random. Modified: head/usr.bin/random/random.6 head/usr.bin/random/random.c head/usr.bin/random/randomize_fd.c head/usr.bin/random/randomize_fd.h Modified: head/usr.bin/random/random.6 == --- head/usr.bin/random/random.6Fri Dec 13 04:12:13 2019 (r355692) +++ head/usr.bin/random/random.6Fri Dec 13 04:37:39 2019 (r355693) @@ -28,7 +28,7 @@ .\" @(#)random.6 8.2 (Berkeley) 3/31/94 .\" $FreeBSD$ .\" -.Dd February 8, 2003 +.Dd December 12, 2019 .Dt RANDOM 6 .Os .Sh NAME @@ -62,9 +62,7 @@ space characters as determined by The default .Ar denominator for this mode of operation is 1, which gives each line a chance to be -displayed, but in a -.Xr random 3 -order. +displayed, but in a random order. .Pp The options are as follows: .Bl -tag -width Ds @@ -112,7 +110,6 @@ Randomize words separated by instead of newlines. .El .Sh SEE ALSO -.Xr random 3 , .Xr fortune 6 .Sh HISTORY The Modified: head/usr.bin/random/random.c == --- head/usr.bin/random/random.cFri Dec 13 04:12:13 2019 (r355692) +++ head/usr.bin/random/random.cFri Dec 13 04:37:39 2019 (r355693) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -135,8 +136,6 @@ main(int argc, char *argv[]) /* NOTREACHED */ } - srandomdev(); - /* * Act as a filter, randomly choosing lines of the standard input * to write to the standard output. @@ -158,7 +157,7 @@ main(int argc, char *argv[]) /* Compute a random exit status between 0 and denom - 1. */ if (random_exit) - return (int)(denom * random() / RANDOM_MAX_PLUS1); + return (arc4random_uniform(denom)); /* * Select whether to print the first line. (Prime the pump.) @@ -166,7 +165,7 @@ main(int argc, char *argv[]) * 0 (which has a 1 / denom chance of being true), we select the * line. */ - selected = (int)(denom * random() / RANDOM_MAX_PLUS1) == 0; + selected = (arc4random_uniform(denom) == 0); while ((ch = getchar()) != EOF) { if (selected) (void)putchar(ch); @@ -176,8 +175,7 @@ main(int argc, char *argv[]) err(2, "stdout"); /* Now see if the next line is to be printed. */ - selected = (int)(denom * random() / - RANDOM_MAX_PLUS1) == 0; + selected = (arc4random_uniform(denom) == 0); } } if (ferror(stdin)) Modified: head/usr.bin/random/randomize_fd.c == --- head/usr.bin/random/randomize_fd.c Fri Dec 13 04:12:13 2019 (r355692) +++ head/usr.bin/random/randomize_fd.c Fri Dec 13 04:37:39 2019 (r355693) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -175,7 +176,7 @@ randomize_fd(int fd, int type, int unique, double deno (type == RANDOM_TYPE_WORDS && isspace(buf[i])) || (eof && i == buflen - 1)) { make_token: - if (numnode == RANDOM_MAX_PLUS1) { + if (numnode == UINT32_MAX - 1) { errno = EFBIG; err(1, "too many delimiters"); } @@ -210,15 +211,14 @@ make_token: free(buf); for (i = numnode; i > 0; i--) { - selected = random() % numnode; + selected = arc4random_uniform(numnode + 1); for (j = 0, prev = n = rand_root; n != NULL; j++, prev = n, n = n->next) { if (j == selected) { if (n->cp == NULL) break; - if ((int)(denom * random() / - RANDOM_MAX_PLUS1) == 0) { + if (arc4random_uniform(denom) == 0) { ret = printf("%.*s", (int)n->len - 1, n->cp); if (ret < 0) Modified: head/usr.bin/random/randomize_fd.h
svn commit: r355692 - head/sbin/fsirand
Author: cem Date: Fri Dec 13 04:12:13 2019 New Revision: 355692 URL: https://svnweb.freebsd.org/changeset/base/355692 Log: fsirand(8): Just use arc4random(3) Remove single use of dubious srandomdev(3) + random(3) and replace with arc4random(3), as is used already in this program. Follow-up question: Do we really need this program anymore? In base? Modified: head/sbin/fsirand/fsirand.c Modified: head/sbin/fsirand/fsirand.c == --- head/sbin/fsirand/fsirand.c Fri Dec 13 04:03:05 2019(r355691) +++ head/sbin/fsirand/fsirand.c Fri Dec 13 04:12:13 2019(r355692) @@ -83,8 +83,6 @@ main(int argc, char *argv[]) if (argc - optind < 1) usage(); - srandomdev(); - /* Increase our data size to the max */ if (getrlimit(RLIMIT_DATA, ) == 0) { rl.rlim_cur = rl.rlim_max; @@ -167,7 +165,7 @@ fsirand(char *device) if (!printonly) { /* Randomize fs_id and write out new sblock and backups */ sblock->fs_id[0] = (u_int32_t)time(NULL); - sblock->fs_id[1] = random(); + sblock->fs_id[1] = arc4random(); if (sbput(devfd, sblock, sblock->fs_ncg) != 0) { warn("could not write updated superblock"); return (1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355691 - head/usr.sbin/keyserv
Author: cem Date: Fri Dec 13 04:03:05 2019 New Revision: 355691 URL: https://svnweb.freebsd.org/changeset/base/355691 Log: keyserv(8): unifdef out __FreeBSD__ and KEYSERV_RANDOM This doesn't appear to have some active upstream (and it's a steaming pile of bad 90s crypto design). Rip out the completely horrible bits and leave the only mildly less horrible bits. The whole thing should probably be deleted; to the extent it purports to provide a security feature: it doesn't. Modified: head/usr.sbin/keyserv/Makefile head/usr.sbin/keyserv/keyserv.c Modified: head/usr.sbin/keyserv/Makefile == --- head/usr.sbin/keyserv/Makefile Fri Dec 13 04:03:03 2019 (r355690) +++ head/usr.sbin/keyserv/Makefile Fri Dec 13 04:03:05 2019 (r355691) @@ -4,7 +4,7 @@ PROG= keyserv MAN= keyserv.8 SRCS= keyserv.c setkey.c crypt_svc.c crypt_server.c crypt.h -CFLAGS+= -DKEYSERV_RANDOM -DBROKEN_DES -I. +CFLAGS+= -DBROKEN_DES -I. LIBADD=mp rpcsvc Modified: head/usr.sbin/keyserv/keyserv.c == --- head/usr.sbin/keyserv/keyserv.c Fri Dec 13 04:03:03 2019 (r355690) +++ head/usr.sbin/keyserv/keyserv.c Fri Dec 13 04:03:05 2019 (r355691) @@ -224,38 +224,8 @@ static void randomize(master) des_block *master; { -#ifndef __FreeBSD__ - int i; - int seed; - struct timeval tv; - int shift; - - seed = 0; - for (i = 0; i < 1024; i++) { - (void)gettimeofday(, NULL); - shift = i % 8 * sizeof (int); - seed ^= (tv.tv_usec << shift) | (tv.tv_usec >> (32 - shift)); - } -#endif -#ifdef KEYSERV_RANDOM -#ifdef __FreeBSD__ master->key.low = arc4random(); master->key.high = arc4random(); -#else - srandom(seed); - master->key.low = random(); - master->key.high = random(); -#endif -#else - /* use stupid dangerous bad rand() */ -#ifdef __FreeBSD__ - sranddev(); -#else - srand(seed); -#endif - master->key.low = rand(); - master->key.high = rand(); -#endif } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355688 - head/sys/dev/iicbus
Author: ian Date: Fri Dec 13 02:20:26 2019 New Revision: 355688 URL: https://svnweb.freebsd.org/changeset/base/355688 Log: If device_delete_children() returns an error, bail on the rest of the detach work and return the error. Especially don't call iicbus_reset() since the most likely cause of failing to detach children is that one of them has IO in progress. Modified: head/sys/dev/iicbus/iicbus.c Modified: head/sys/dev/iicbus/iicbus.c == --- head/sys/dev/iicbus/iicbus.cFri Dec 13 02:18:44 2019 (r355687) +++ head/sys/dev/iicbus/iicbus.cFri Dec 13 02:20:26 2019 (r355688) @@ -134,10 +134,11 @@ static int iicbus_detach(device_t dev) { struct iicbus_softc *sc = IICBUS_SOFTC(dev); + int err; + if ((err = device_delete_children(dev)) != 0) + return (err); iicbus_reset(dev, IIC_FASTEST, 0, NULL); - bus_generic_detach(dev); - device_delete_children(dev); mtx_destroy(>lock); return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355687 - head/usr.sbin/bhyve
Author: jhb Date: Fri Dec 13 02:18:44 2019 New Revision: 355687 URL: https://svnweb.freebsd.org/changeset/base/355687 Log: Document that the debug server supports writing to guest memory. This was added in r348212. Modified: head/usr.sbin/bhyve/bhyve.8 Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Fri Dec 13 02:15:34 2019(r355686) +++ head/usr.sbin/bhyve/bhyve.8 Fri Dec 13 02:18:44 2019(r355687) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 24, 2019 +.Dd December 12, 2019 .Dt BHYVE 8 .Os .Sh NAME @@ -521,8 +521,7 @@ Each virtual CPU is exposed to the debugger as a threa General purpose registers can be queried for each virtual CPU, but other registers such as floating-point and system registers cannot be queried. .Ss Memory -Memory (including memory mapped I/O regions) can be read by the debugger, -but not written. +Memory (including memory mapped I/O regions) can be read and written by the debugger. Memory operations use virtual addresses that are resolved to physical addresses via the current virtual CPU's active address translation. .Ss Control ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355686 - head/usr.sbin/bhyve
Author: jhb Date: Fri Dec 13 02:15:34 2019 New Revision: 355686 URL: https://svnweb.freebsd.org/changeset/base/355686 Log: Fix a mismerge in r355683 and remove the local gdb_port from main. Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Fri Dec 13 01:38:48 2019 (r355685) +++ head/usr.sbin/bhyve/bhyverun.c Fri Dec 13 02:15:34 2019 (r355686) @@ -984,7 +984,7 @@ do_open(const char *vmname) int main(int argc, char *argv[]) { - int c, error, dbg_port, gdb_port, err, bvmcons; + int c, error, dbg_port, err, bvmcons; int max_vcpus, mptgen, memflags; int rtc_localtime; bool gdb_stop; @@ -996,7 +996,6 @@ main(int argc, char *argv[]) bvmcons = 0; progname = basename(argv[0]); dbg_port = 0; - gdb_port = 0; gdb_stop = false; guest_ncpus = 1; sockets = cores = threads = 1; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355685 - head/sys/dev/iicbus
Author: ian Date: Fri Dec 13 01:38:48 2019 New Revision: 355685 URL: https://svnweb.freebsd.org/changeset/base/355685 Log: Clean up some of my copyrights; add SPDX tag and remove All rights reserved. Modified: head/sys/dev/iicbus/ads111x.c head/sys/dev/iicbus/ds13rtc.c head/sys/dev/iicbus/iic_recover_bus.c head/sys/dev/iicbus/iic_recover_bus.h head/sys/dev/iicbus/isl12xx.c head/sys/dev/iicbus/nxprtc.c head/sys/dev/iicbus/rtc8583.c Modified: head/sys/dev/iicbus/ads111x.c == --- head/sys/dev/iicbus/ads111x.c Fri Dec 13 01:34:25 2019 (r355684) +++ head/sys/dev/iicbus/ads111x.c Fri Dec 13 01:38:48 2019 (r355685) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2019 Ian Lepore. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/iicbus/ds13rtc.c == --- head/sys/dev/iicbus/ds13rtc.c Fri Dec 13 01:34:25 2019 (r355684) +++ head/sys/dev/iicbus/ds13rtc.c Fri Dec 13 01:38:48 2019 (r355685) @@ -1,6 +1,7 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Ian Lepore - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/iicbus/iic_recover_bus.c == --- head/sys/dev/iicbus/iic_recover_bus.c Fri Dec 13 01:34:25 2019 (r355684) +++ head/sys/dev/iicbus/iic_recover_bus.c Fri Dec 13 01:38:48 2019 (r355685) @@ -1,6 +1,7 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Ian Lepore - * All rights reserved. * * Development sponsored by Microsemi, Inc. * Modified: head/sys/dev/iicbus/iic_recover_bus.h == --- head/sys/dev/iicbus/iic_recover_bus.h Fri Dec 13 01:34:25 2019 (r355684) +++ head/sys/dev/iicbus/iic_recover_bus.h Fri Dec 13 01:38:48 2019 (r355685) @@ -1,6 +1,7 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Ian Lepore - * All rights reserved. * * Development sponsored by Microsemi, Inc. * Modified: head/sys/dev/iicbus/isl12xx.c == --- head/sys/dev/iicbus/isl12xx.c Fri Dec 13 01:34:25 2019 (r355684) +++ head/sys/dev/iicbus/isl12xx.c Fri Dec 13 01:38:48 2019 (r355685) @@ -1,5 +1,7 @@ /*- - * Copyright (c) 2017 Ian Lepore. All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2017 Ian Lepore. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/iicbus/nxprtc.c == --- head/sys/dev/iicbus/nxprtc.cFri Dec 13 01:34:25 2019 (r355684) +++ head/sys/dev/iicbus/nxprtc.cFri Dec 13 01:38:48 2019 (r355685) @@ -1,6 +1,7 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Ian Lepore - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/iicbus/rtc8583.c == --- head/sys/dev/iicbus/rtc8583.c Fri Dec 13 01:34:25 2019 (r355684) +++ head/sys/dev/iicbus/rtc8583.c Fri Dec 13 01:38:48 2019 (r355685) @@ -1,6 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Hiroki Mori. All rights reserved. - * Copyright (c) 2017 Ian Lepore. All rights reserved. + * Copyright (c) 2017 Ian Lepore. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355684 - in head/sys/fs: nfsclient nfsserver
Author: rmacklem Date: Fri Dec 13 01:34:25 2019 New Revision: 355684 URL: https://svnweb.freebsd.org/changeset/base/355684 Log: Add some more initializations to quiet riscv build. The one case in nfs_copy_file_range() was a legitimate case, although it would probably never occur in practice. Modified: head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c == --- head/sys/fs/nfsclient/nfs_clvnops.c Fri Dec 13 01:17:20 2019 (r355683) +++ head/sys/fs/nfsclient/nfs_clvnops.c Fri Dec 13 01:34:25 2019 (r355684) @@ -3639,6 +3639,7 @@ nfs_copy_file_range(struct vop_copy_file_range_args *a off_t inoff, outoff; bool consecutive, must_commit, tryoutcred; + ret = ret2 = 0; nmp = VFSTONFS(invp->v_mount); mtx_lock(>nm_mtx); /* NFSv4.2 Copy is not permitted for infile == outfile. */ Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cFri Dec 13 01:17:20 2019 (r355683) +++ head/sys/fs/nfsserver/nfs_nfsdport.cFri Dec 13 01:34:25 2019 (r355684) @@ -5155,7 +5155,7 @@ nfsrv_writedsrpc(fhandle_t *fhp, off_t off, int len, s NFSPROC_T *p, struct vnode *vp, struct nfsmount **nmpp, int mirrorcnt, struct mbuf **mpp, char *cp, int *failposp) { - struct nfsrvwritedsdorpc *drpc, *tdrpc; + struct nfsrvwritedsdorpc *drpc, *tdrpc = NULL; struct nfsvattr na; struct mbuf *m; int error, i, offs, ret, timo; @@ -5322,7 +5322,7 @@ nfsrv_allocatedsrpc(fhandle_t *fhp, off_t off, off_t l NFSPROC_T *p, struct vnode *vp, struct nfsmount **nmpp, int mirrorcnt, int *failposp) { - struct nfsrvallocatedsdorpc *drpc, *tdrpc; + struct nfsrvallocatedsdorpc *drpc, *tdrpc = NULL; struct nfsvattr na; int error, i, ret, timo; @@ -5506,7 +5506,7 @@ nfsrv_setattrdsrpc(fhandle_t *fhp, struct ucred *cred, struct vnode *vp, struct nfsmount **nmpp, int mirrorcnt, struct nfsvattr *nap, int *failposp) { - struct nfsrvsetattrdsdorpc *drpc, *tdrpc; + struct nfsrvsetattrdsdorpc *drpc, *tdrpc = NULL; struct nfsvattr na; int error, i, ret, timo; @@ -5655,7 +5655,7 @@ nfsrv_setacldsrpc(fhandle_t *fhp, struct ucred *cred, struct vnode *vp, struct nfsmount **nmpp, int mirrorcnt, struct acl *aclp, int *failposp) { - struct nfsrvsetacldsdorpc *drpc, *tdrpc; + struct nfsrvsetacldsdorpc *drpc, *tdrpc = NULL; int error, i, ret, timo; NFSD_DEBUG(4, "in nfsrv_setacldsrpc\n"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355683 - head/usr.sbin/bhyve
Author: jhb Date: Fri Dec 13 01:17:20 2019 New Revision: 355683 URL: https://svnweb.freebsd.org/changeset/base/355683 Log: Don't call into the debug server if it isn't configured. Reviewed by: markj (as part of a larger diff) MFC after:1 month Differential Revision:https://reviews.freebsd.org/D20309 Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Fri Dec 13 00:45:14 2019 (r355682) +++ head/usr.sbin/bhyve/bhyverun.c Fri Dec 13 01:17:20 2019 (r355683) @@ -167,6 +167,7 @@ uint16_t cores, maxcpus, sockets, threads; char *guest_uuid_str; +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 */ @@ -416,7 +417,8 @@ fbsdrun_start_thread(void *param) snprintf(tname, sizeof(tname), "vcpu %d", vcpu); pthread_set_name_np(mtp->mt_thr, tname); - gdb_cpu_add(vcpu); + if (gdb_port != 0) + gdb_cpu_add(vcpu); vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip); @@ -690,8 +692,11 @@ vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit stats.vmexit_mtrap++; + if (gdb_port == 0) { + fprintf(stderr, "vm_loop: unexpected VMEXIT_MTRAP\n"); + exit(4); + } gdb_cpu_mtrap(*pvcpu); - return (VMEXIT_CONTINUE); } @@ -770,6 +775,10 @@ static int vmexit_debug(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { + if (gdb_port == 0) { + fprintf(stderr, "vm_loop: unexpected VMEXIT_DEBUG\n"); + exit(4); + } gdb_cpu_suspend(*pvcpu); return (VMEXIT_CONTINUE); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355682 - head/sys/fs/nfsserver
Author: rmacklem Date: Fri Dec 13 00:45:14 2019 New Revision: 355682 URL: https://svnweb.freebsd.org/changeset/base/355682 Log: Fix the build for MAC not defined and a couple of might not be initialized. r355677 broke the build for the not MAC defined case and a couple of might not be initialized warnings were generated for riscv. Others seem to be erroneous. Hopefully there won't be too many more build errors. Pointy hat goes on me. Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cFri Dec 13 00:14:12 2019 (r355681) +++ head/sys/fs/nfsserver/nfs_nfsdport.cFri Dec 13 00:45:14 2019 (r355682) @@ -3980,7 +3980,7 @@ static void nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, struct ucred *cred, NFSPROC_T *p) { - struct nfsrvdscreate *dsc, *tdsc; + struct nfsrvdscreate *dsc, *tdsc = NULL; struct nfsdevice *ds, *tds, *fds; struct mount *mp; struct pnfsdsfile *pf, *tpf; @@ -5890,7 +5890,7 @@ nfsrv_pnfssetfh(struct vnode *vp, struct pnfsdsfile *p char *fnamep, struct vnode *nvp, NFSPROC_T *p) { struct nfsnode *np; - int ret; + int ret = 0; np = VTONFS(nvp); NFSBCOPY(np->n_fhp->nfh_fh, >dsf_fh, NFSX_MYFH); @@ -6210,12 +6210,13 @@ nfsvno_setxattr(struct vnode *vp, char *name, int len, struct uio uio, *uiop = int cnt, error; + error = 0; #ifdef MAC error = mac_vnode_check_setextattr(cred, vp, EXTATTR_NAMESPACE_USER, name); +#endif if (error != 0) goto out; -#endif uiop->uio_rw = UIO_WRITE; uiop->uio_segflg = UIO_SYSSPACE; @@ -6263,9 +6264,7 @@ nfsvno_rmxattr(struct nfsrv_descript *nd, struct vnode if (error == EOPNOTSUPP) error = VOP_SETEXTATTR(vp, EXTATTR_NAMESPACE_USER, name, NULL, cred, p); -#ifdef MAC out: -#endif NFSEXITCODE(error); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355681 - in head/sys: kern sys
Author: rmacklem Date: Fri Dec 13 00:14:12 2019 New Revision: 355681 URL: https://svnweb.freebsd.org/changeset/base/355681 Log: r355677 requires that vop_stdioctl() be global so it can be called from NFS. r355677 modified the NFS client so that it does lseek(SEEK_DATA/SEEK_HOLE) for NFSv4.2, but calls vop_stdioctl() otherwise. As such, vop_stdioctl() needs to be a global function. Missed during the code merge for r355677. Modified: head/sys/kern/vfs_default.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_default.c == --- head/sys/kern/vfs_default.c Thu Dec 12 23:55:34 2019(r355680) +++ head/sys/kern/vfs_default.c Fri Dec 13 00:14:12 2019(r355681) @@ -87,7 +87,6 @@ static int vop_stdadd_writecount(struct vop_add_writec static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap); static int vop_stdfdatasync(struct vop_fdatasync_args *ap); static int vop_stdgetpages_async(struct vop_getpages_async_args *ap); -static int vop_stdioctl(struct vop_ioctl_args *ap); /* * This vnode table stores what we want to do if the filesystem doesn't @@ -1249,7 +1248,7 @@ vop_stdneed_inactive(struct vop_need_inactive_args *ap return (1); } -static int +int vop_stdioctl(struct vop_ioctl_args *ap) { struct vnode *vp; Modified: head/sys/sys/vnode.h == --- head/sys/sys/vnode.hThu Dec 12 23:55:34 2019(r355680) +++ head/sys/sys/vnode.hFri Dec 13 00:14:12 2019(r355681) @@ -760,6 +760,7 @@ int vop_stdfsync(struct vop_fsync_args *); intvop_stdgetwritemount(struct vop_getwritemount_args *); intvop_stdgetpages(struct vop_getpages_args *); intvop_stdinactive(struct vop_inactive_args *); +intvop_stdioctl(struct vop_ioctl_args *); intvop_stdneed_inactive(struct vop_need_inactive_args *); intvop_stdkqfilter(struct vop_kqfilter_args *); intvop_stdlock(struct vop_lock1_args *); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355680 - head/sys/vm
Author: markj Date: Thu Dec 12 23:55:34 2019 New Revision: 355680 URL: https://svnweb.freebsd.org/changeset/base/355680 Log: Avoid relying on silent type casting in the native atomic_load_32. Reported by: np Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h == --- head/sys/vm/vm_page.h Thu Dec 12 23:37:04 2019(r355679) +++ head/sys/vm/vm_page.h Thu Dec 12 23:55:34 2019(r355680) @@ -766,7 +766,7 @@ vm_page_astate_load(vm_page_t m) { vm_page_astate_t a; - a._bits = atomic_load_32(>a); + a._bits = atomic_load_32(>a._bits); return (a); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355609 - head
On 12/11/2019 6:54 AM, Ed Maste wrote: > Author: emaste > Date: Wed Dec 11 14:54:29 2019 > New Revision: 355609 > URL: https://svnweb.freebsd.org/changeset/base/355609 > > Log: > Make NOCLEAN an error instead of a warning > > The warning was added in r289728 (over four years ago) and at that time > NO_CLEAN was already the correct spelling for over a decade. > > Make NOCLEAN an error as the next step to removing these backward > compatibility shims. > > Modified: > head/Makefile.inc1 > > Modified: head/Makefile.inc1 > == > --- head/Makefile.inc1Wed Dec 11 14:28:13 2019(r355608) > +++ head/Makefile.inc1Wed Dec 11 14:54:29 2019(r355609) > @@ -458,8 +458,7 @@ SUBDIR+=etc > .endif # !empty(SUBDIR_OVERRIDE) > > .if defined(NOCLEAN) > -.warning NOCLEAN option is deprecated. Use NO_CLEAN instead. > -NO_CLEAN=${NOCLEAN} > +.error NOCLEAN option is deprecated. Use NO_CLEAN instead. > .endif > .if defined(NO_CLEANDIR) > CLEANDIR=clean cleandepend > What ever happened to POLA? Name 1 good reason this should be an .error?! Or even a .warning for that matter. The argument I keep hearing is "we have to maintain these 3 lines of code", ok, well now it's just an annoyance to maintain with no benefit to the user. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
svn commit: r355679 - head/sys/sys
Author: rmacklem Date: Thu Dec 12 23:37:04 2019 New Revision: 355679 URL: https://svnweb.freebsd.org/changeset/base/355679 Log: Bump __FreeBSD_version since r355677 changes the internal interface between the NFS modules such that they all need to be upgraded to post r355677 simultaneously. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hThu Dec 12 23:33:32 2019(r355678) +++ head/sys/sys/param.hThu Dec 12 23:37:04 2019(r355679) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300065 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300066 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355678 - head
Author: rmacklem Date: Thu Dec 12 23:33:32 2019 New Revision: 355678 URL: https://svnweb.freebsd.org/changeset/base/355678 Log: Add an entry to UPDATING for r355677. Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Thu Dec 12 23:22:55 2019(r355677) +++ head/UPDATING Thu Dec 12 23:33:32 2019(r355678) @@ -26,6 +26,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191212: + r355677 has modified the internal interface used between the + NFS modules in the kernel. As such, they must all be upgraded + simultaneously. I will do a version bump for this. + 20191205: The root certificates of the Mozilla CA Certificate Store have been imported into the base system and can be managed with the certctl(8) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355677 - in head/sys/fs: nfs nfsclient nfsserver
Author: rmacklem Date: Thu Dec 12 23:22:55 2019 New Revision: 355677 URL: https://svnweb.freebsd.org/changeset/base/355677 Log: Add support for NFSv4.2 to the NFS client and server. This patch adds support for NFSv4.2 (RFC-7862) and Extended Attributes (RFC-8276) to the NFS client and server. NFSv4.2 is comprised of several optional features that can be supported in addition to NFSv4.1. This patch adds the following optional features: - posix_fadvise(POSIX_FADV_WILLNEED/POSIX_FADV_DONTNEED) - posix_fallocate() - intra server file range copying via the copy_file_range(2) syscall --> Avoiding data tranfer over the wire to/from the NFS client. - lseek(SEEK_DATA/SEEK_HOLE) - Extended attribute syscalls for "user" namespace attributes as defined by RFC-8276. Although this patch is fairly large, it should not affect support for the other versions of NFS. However it does add two new sysctls that allow a sysadmin to limit which minor versions of NFSv4 a server supports, allowing a sysadmin to disable NFSv4.2. Unfortunately, when the NFS stats structure was last revised, it was assumed that there would be no additional operations added beyond what was specified in RFC-7862. However RFC-8276 did add additional operations, forcing the NFS stats structure to revised again. It now has extra unused entries in all arrays, so that future extensions to NFSv4.2 can be accomodated without revising this structure again. A future commit will update nfsstat(1) to report counts for the new NFSv4.2 specific operations/procedures. This patch affects the internal interface between the nfscommon, nfscl and nfsd modules and, as such, they all must be upgraded simultaneously. I will do a version bump (although arguably not needed), due to this. This code has survived a "make universe" but has not been built with a recent GCC. If you encounter build problems, please email me. Relnotes: yes Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsclstate.h head/sys/fs/nfs/nfsport.h head/sys/fs/nfs/nfsproto.h head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clstate.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsclient/nfsmount.h head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdsocket.c head/sys/fs/nfsserver/nfs_nfsdstate.c head/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: head/sys/fs/nfs/nfs.h == --- head/sys/fs/nfs/nfs.h Thu Dec 12 22:59:22 2019(r355676) +++ head/sys/fs/nfs/nfs.h Thu Dec 12 23:22:55 2019(r355677) @@ -668,6 +668,8 @@ struct nfsrv_descript { uint32_t*nd_sequence; /* Sequence Op. ptr */ nfsv4stateid_t nd_curstateid; /* Current StateID */ nfsv4stateid_t nd_savedcurstateid; /* Saved Current StateID */ + uint32_tnd_maxreq; /* Max. request (session). */ + uint32_tnd_maxresp; /* Max. reply (session). */ }; #definend_princlen nd_gssnamelen Modified: head/sys/fs/nfs/nfs_commonport.c == --- head/sys/fs/nfs/nfs_commonport.cThu Dec 12 22:59:22 2019 (r355676) +++ head/sys/fs/nfs/nfs_commonport.cThu Dec 12 23:22:55 2019 (r355677) @@ -80,6 +80,7 @@ int nfs_pnfsio(task_fn_t *, void *); static int nfs_realign_test; static int nfs_realign_count; static struct ext_nfsstats oldnfsstats; +static struct nfsstatsov1 nfsstatsov1; SYSCTL_NODE(_vfs, OID_AUTO, nfs, CTLFLAG_RW, 0, "NFS filesystem"); SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RW, _realign_test, @@ -580,11 +581,143 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, } else { error = copyin(uap->argp, , sizeof(nfsstatver)); - if (error == 0 && nfsstatver.vers != NFSSTATS_V1) - error = EPERM; - if (error == 0) - error = copyout(, uap->argp, - sizeof (nfsstatsv1)); + if (error == 0) { + if (nfsstatver.vers == NFSSTATS_OV1) { + /* Copy nfsstatsv1 to nfsstatsov1. */ + nfsstatsov1.attrcache_hits = + nfsstatsv1.attrcache_hits; + nfsstatsov1.attrcache_misses = + nfsstatsv1.attrcache_misses; +
svn commit: r355676 - head/libexec/rtld-elf
Author: kib Date: Thu Dec 12 22:59:22 2019 New Revision: 355676 URL: https://svnweb.freebsd.org/changeset/base/355676 Log: rtld: make checks for mmap(2) failures compliant with documentation. On error, mmap(2) returns MAP_FAILED. There is no need to use its definition or to cast. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/libexec/rtld-elf/map_object.c Modified: head/libexec/rtld-elf/map_object.c == --- head/libexec/rtld-elf/map_object.c Thu Dec 12 22:36:47 2019 (r355675) +++ head/libexec/rtld-elf/map_object.c Thu Dec 12 22:59:22 2019 (r355676) @@ -209,7 +209,7 @@ map_object(int fd, const char *path, const struct stat base_flags |= MAP_FIXED | MAP_EXCL; mapbase = mmap(base_addr, mapsize, PROT_NONE, base_flags, -1, 0); -if (mapbase == (caddr_t) -1) { +if (mapbase == MAP_FAILED) { _rtld_error("%s: mmap of entire address space failed: %s", path, rtld_strerror(errno)); goto error; @@ -266,7 +266,7 @@ map_object(int fd, const char *path, const struct stat bss_addr = mapbase + (bss_vaddr - base_vaddr); if (bss_vlimit > bss_vaddr) { /* There is something to do */ if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot, - data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) { + data_flags | MAP_ANON, -1, 0) == MAP_FAILED) { _rtld_error("%s: mmap of bss failed: %s", path, rtld_strerror(errno)); goto error1; @@ -348,7 +348,7 @@ get_elf_header(int fd, const char *path, const struct hdr = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_PREFAULT_READ, fd, 0); - if (hdr == (Elf_Ehdr *)MAP_FAILED) { + if (hdr == MAP_FAILED) { _rtld_error("%s: read error: %s", path, rtld_strerror(errno)); return (NULL); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355673 - head/sys/dev/cxgbe
Author: np Date: Thu Dec 12 21:33:00 2019 New Revision: 355673 URL: https://svnweb.freebsd.org/changeset/base/355673 Log: cxgbe(4): Never use hardware checksumming in netmap tx. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Thu Dec 12 21:13:20 2019 (r355672) +++ head/sys/dev/cxgbe/t4_netmap.c Thu Dec 12 21:33:00 2019 (r355673) @@ -659,7 +659,7 @@ ring_nm_txq_db(struct adapter *sc, struct sge_nm_txq * */ static void cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_txq, -struct netmap_kring *kring, int npkt, int npkt_remaining, int txcsum) +struct netmap_kring *kring, int npkt, int npkt_remaining) { struct netmap_ring *ring = kring->ring; struct netmap_slot *slot; @@ -695,13 +695,9 @@ cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_ * netmap(4) says "netmap does not use features such as * checksum offloading, TCP segmentation offloading, * encryption, VLAN encapsulation/decapsulation, etc." -* -* So the ncxl interfaces have tx hardware checksumming -* disabled by default. But you can override netmap by -* enabling IFCAP_TXCSUM on the interface manully. */ - cpl->ctrl1 = txcsum ? 0 : - htobe64(F_TXPKT_IPCSUM_DIS | F_TXPKT_L4CSUM_DIS); + cpl->ctrl1 = htobe64(F_TXPKT_IPCSUM_DIS | + F_TXPKT_L4CSUM_DIS); usgl = (void *)(cpl + 1); usgl->cmd_nsge = htobe32(V_ULPTX_CMD(ULP_TX_SC_DSGL) | @@ -815,7 +811,7 @@ cxgbe_netmap_txsync(struct netmap_kring *kring, int fl struct sge_nm_txq *nm_txq = >sge.nm_txq[vi->first_nm_txq + kring->ring_id]; const u_int head = kring->rhead; u_int reclaimed = 0; - int n, d, npkt_remaining, ndesc_remaining, txcsum; + int n, d, npkt_remaining, ndesc_remaining; /* * Tx was at kring->nr_hwcur last time around and now we need to advance @@ -826,7 +822,6 @@ cxgbe_netmap_txsync(struct netmap_kring *kring, int fl npkt_remaining = head >= kring->nr_hwcur ? head - kring->nr_hwcur : kring->nkr_num_slots - kring->nr_hwcur + head; - txcsum = ifp->if_capenable & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6); while (npkt_remaining) { reclaimed += reclaim_nm_tx_desc(nm_txq); ndesc_remaining = contiguous_ndesc_available(nm_txq); @@ -850,7 +845,7 @@ cxgbe_netmap_txsync(struct netmap_kring *kring, int fl /* Send n packets and update nm_txq->pidx and kring->nr_hwcur */ npkt_remaining -= n; - cxgbe_nm_tx(sc, nm_txq, kring, n, npkt_remaining, txcsum); + cxgbe_nm_tx(sc, nm_txq, kring, n, npkt_remaining); } MPASS(npkt_remaining == 0); MPASS(kring->nr_hwcur == head); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355672 - head/sys/vm
Author: markj Date: Thu Dec 12 21:13:20 2019 New Revision: 355672 URL: https://svnweb.freebsd.org/changeset/base/355672 Log: Implement atomic state updates using the new vm_page_astate_t structure. Introduce primitives vm_page_astate_load() and vm_page_astate_fcmpset() to operate on the 32-bit per-page atomic state. Modify vm_page_pqstate_fcmpset() to use them. No functional change intended. Introduce PGA_QUEUE_OP_MASK, a subset of PGA_QUEUE_STATE_MASK that only includes queue operation flags. This will be used in subsequent patches. Reviewed by: alc, jeff, kib Sponsored by: Netflix, Intel Differential Revision:https://reviews.freebsd.org/D22753 Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h == --- head/sys/vm/vm_page.h Thu Dec 12 20:55:43 2019(r355671) +++ head/sys/vm/vm_page.h Thu Dec 12 21:13:20 2019(r355672) @@ -439,8 +439,8 @@ extern struct mtx_padalign pa_lock[]; #definePGA_REQUEUE_HEAD 0x0040 /* page requeue should bypass LRU */ #definePGA_NOSYNC 0x0080 /* do not collect for syncer */ -#definePGA_QUEUE_STATE_MASK(PGA_ENQUEUED | PGA_DEQUEUE | PGA_REQUEUE | \ - PGA_REQUEUE_HEAD) +#definePGA_QUEUE_OP_MASK (PGA_DEQUEUE | PGA_REQUEUE | PGA_REQUEUE_HEAD) +#definePGA_QUEUE_STATE_MASK(PGA_ENQUEUED | PGA_QUEUE_OP_MASK) /* * Page flags. If changed at any other time than page allocation or @@ -756,36 +756,37 @@ void vm_page_assert_pga_writeable(vm_page_t m, uint16_ #defineVM_PAGE_ASSERT_PGA_WRITEABLE(m, bits) (void)0 #endif +#defineVM_PAGE_AFLAG_SHIFT (__offsetof(vm_page_astate_t, flags) * NBBY) + /* - * We want to use atomic updates for the aflags field, which is 8 bits wide. - * However, not all architectures support atomic operations on 8-bit - * destinations. In order that we can easily use a 32-bit operation, we - * require that the aflags field be 32-bit aligned. + * Load a snapshot of a page's 32-bit atomic state. */ -_Static_assert(offsetof(struct vm_page, a.flags) % sizeof(uint32_t) == 0, -"aflags field is not 32-bit aligned"); +static inline vm_page_astate_t +vm_page_astate_load(vm_page_t m) +{ + vm_page_astate_t a; + a._bits = atomic_load_32(>a); + return (a); +} + /* - * We want to be able to update the aflags and queue fields atomically in - * the same operation. + * Atomically compare and set a page's atomic state. */ -_Static_assert(offsetof(struct vm_page, a.flags) / sizeof(uint32_t) == -offsetof(struct vm_page, a.queue) / sizeof(uint32_t), -"aflags and queue fields do not belong to the same 32-bit word"); -_Static_assert(offsetof(struct vm_page, a.queue) % sizeof(uint32_t) == 2, -"queue field is at an unexpected offset"); -_Static_assert(sizeof(((struct vm_page *)NULL)->a.queue) == 1, -"queue field has an unexpected size"); +static inline bool +vm_page_astate_fcmpset(vm_page_t m, vm_page_astate_t *old, vm_page_astate_t new) +{ -#if BYTE_ORDER == LITTLE_ENDIAN -#defineVM_PAGE_AFLAG_SHIFT 0 -#defineVM_PAGE_QUEUE_SHIFT 16 -#else -#defineVM_PAGE_AFLAG_SHIFT 16 -#defineVM_PAGE_QUEUE_SHIFT 8 -#endif -#defineVM_PAGE_QUEUE_MASK (0xff << VM_PAGE_QUEUE_SHIFT) + KASSERT(new.queue == PQ_INACTIVE || (new.flags & PGA_REQUEUE_HEAD) == 0, + ("%s: invalid head requeue request for page %p", __func__, m)); + KASSERT((new.flags & PGA_ENQUEUED) == 0 || new.queue != PQ_NONE, + ("%s: setting PGA_ENQUEUED with PQ_NONE in page %p", __func__, m)); + KASSERT(new._bits != old->_bits, + ("%s: bits are unchanged", __func__)); + return (atomic_fcmpset_32(>a._bits, >_bits, new._bits) != 0); +} + /* * Clear the given bits in the specified page. */ @@ -805,7 +806,7 @@ vm_page_aflag_clear(vm_page_t m, uint16_t bits) * atomic update. Parallel non-atomic updates to the other fields * within this word are handled properly by the atomic update. */ - addr = (void *)>a.flags; + addr = (void *)>a; val = bits << VM_PAGE_AFLAG_SHIFT; atomic_clear_32(addr, val); } @@ -825,7 +826,7 @@ vm_page_aflag_set(vm_page_t m, uint16_t bits) * atomic update. Parallel non-atomic updates to the other fields * within this word are handled properly by the atomic update. */ - addr = (void *)>a.flags; + addr = (void *)>a; val = bits << VM_PAGE_AFLAG_SHIFT; atomic_set_32(addr, val); } @@ -841,24 +842,16 @@ static inline bool vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uint32_t newq, uint32_t fflags, uint32_t nflags) { - uint32_t *addr, nval, oval, qsmask; + vm_page_astate_t new, old; - fflags <<= VM_PAGE_AFLAG_SHIFT; -
svn commit: r355671 - head/lib/libpmc/pmu-events
Author: emaste Date: Thu Dec 12 20:55:43 2019 New Revision: 355671 URL: https://svnweb.freebsd.org/changeset/base/355671 Log: libpmc: add MIT SPDX tag to header file The jevents tool includes a copy of the jsmn json parser which is MIT licensed. Upstream the MIT license appears in the jsmn.c source and a standalone LICENSE file, but the latter is not included in the copy contained in libpmc and the jsmn.h header carried no license information. Add an SPDX tag to clarify the situation. Modified: head/lib/libpmc/pmu-events/jsmn.h Modified: head/lib/libpmc/pmu-events/jsmn.h == --- head/lib/libpmc/pmu-events/jsmn.h Thu Dec 12 20:44:49 2019 (r355670) +++ head/lib/libpmc/pmu-events/jsmn.h Thu Dec 12 20:55:43 2019 (r355671) @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: MIT */ /* $FreeBSD$ */ #ifndef __JSMN_H_ #define __JSMN_H_ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355669 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Thu Dec 12 20:44:46 2019 New Revision: 355669 URL: https://svnweb.freebsd.org/changeset/base/355669 Log: in6_cksum() returns zero when checksums are good. PR: 203275 Reported by: Frank Volf MFC after:3 days Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c == --- head/sys/contrib/ipfilter/netinet/fil.c Thu Dec 12 19:37:10 2019 (r355668) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Dec 12 20:44:46 2019 (r355669) @@ -6744,7 +6744,7 @@ ipf_checkl4sum(fin) #endif DT3(l4sums, u_short, hdrsum, u_short, sum, fr_info_t *, fin); #ifdef USE_INET6 - if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { + if (hdrsum == sum || (sum == 0 && IP_V(fin->fin_ip) == 6)) { #else if (hdrsum == sum) { #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355670 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Thu Dec 12 20:44:49 2019 New Revision: 355670 URL: https://svnweb.freebsd.org/changeset/base/355670 Log: Rather than pass the address of the packet information control block to ipf_pcksum6(), directly pass the adddress of the mbuf to it. This reduces one pointer dereference. ipf_pcksum6() doesn't use the packet information control block except to obtain the mbuf address. MFC after:3 days Modified: head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_fil.h head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/fil.c == --- head/sys/contrib/ipfilter/netinet/fil.c Thu Dec 12 20:44:46 2019 (r355669) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Dec 12 20:44:49 2019 (r355670) @@ -3436,7 +3436,7 @@ fr_cksum(fin, ip, l4proto, l4hdr) ip6 = (ip6_t *)ip; off = ((caddr_t)ip6 - m->m_data) + sizeof(struct ip6_hdr); int len = ntohs(ip6->ip6_plen) - (off - sizeof(*ip6)); - return(ipf_pcksum6(fin, ip6, off, len)); + return(ipf_pcksum6(m, ip6, off, len)); } else { return 0x; } Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h == --- head/sys/contrib/ipfilter/netinet/ip_fil.h Thu Dec 12 20:44:46 2019 (r355669) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Thu Dec 12 20:44:49 2019 (r355670) @@ -1840,7 +1840,7 @@ externint ipf_matchicmpqueryreply __P((int, icmpinfo extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); #ifdef USE_INET6 -extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, +extern u_int ipf_pcksum6 __P((struct mbuf *, ip6_t *, u_int32_t, u_int32_t)); #endif extern voidipf_rule_expire __P((ipf_main_softc_t *)); Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c == --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec 12 20:44:46 2019(r355669) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec 12 20:44:49 2019(r355670) @@ -1456,17 +1456,15 @@ ipf_pcksum(fin, hlen, sum) #ifdef USE_INET6 u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; +ipf_pcksum6(m, ip6, off, len) + struct mbuf *m; ip6_t *ip6; u_int32_t off; u_int32_t len; { #ifdef _KERNEL - struct mbuf *m; int sum; - m = fin->fin_m; if (m->m_len < sizeof(struct ip6_hdr)) { return 0x; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355668 - in head/lib/libpmc/pmu-events/arch/s390: cf_z10 cf_z13 cf_z14 cf_z196 cf_zec12
Author: emaste Date: Thu Dec 12 19:37:10 2019 New Revision: 355668 URL: https://svnweb.freebsd.org/changeset/base/355668 Log: libpmc: convert s390 events data to proper json Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z10/basic.json head/lib/libpmc/pmu-events/arch/s390/cf_z10/crypto.json head/lib/libpmc/pmu-events/arch/s390/cf_z10/extended.json head/lib/libpmc/pmu-events/arch/s390/cf_z13/basic.json head/lib/libpmc/pmu-events/arch/s390/cf_z13/crypto.json head/lib/libpmc/pmu-events/arch/s390/cf_z13/extended.json head/lib/libpmc/pmu-events/arch/s390/cf_z14/basic.json head/lib/libpmc/pmu-events/arch/s390/cf_z14/crypto.json head/lib/libpmc/pmu-events/arch/s390/cf_z14/extended.json head/lib/libpmc/pmu-events/arch/s390/cf_z196/basic.json head/lib/libpmc/pmu-events/arch/s390/cf_z196/crypto.json head/lib/libpmc/pmu-events/arch/s390/cf_z196/extended.json head/lib/libpmc/pmu-events/arch/s390/cf_zec12/basic.json head/lib/libpmc/pmu-events/arch/s390/cf_zec12/crypto.json head/lib/libpmc/pmu-events/arch/s390/cf_zec12/extended.json Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z10/basic.json == --- head/lib/libpmc/pmu-events/arch/s390/cf_z10/basic.json Thu Dec 12 19:33:16 2019(r355667) +++ head/lib/libpmc/pmu-events/arch/s390/cf_z10/basic.json Thu Dec 12 19:37:10 2019(r355668) @@ -70,5 +70,5 @@ "EventName": "PROBLEM_STATE_L1D_PENALTY_CYCLES", "BriefDescription": "Problem-State L1D Penalty Cycles", "PublicDescription": "Problem-State Level-1 D-Cache Penalty Cycle Count" - }, + } ] Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z10/crypto.json == --- head/lib/libpmc/pmu-events/arch/s390/cf_z10/crypto.json Thu Dec 12 19:33:16 2019(r355667) +++ head/lib/libpmc/pmu-events/arch/s390/cf_z10/crypto.json Thu Dec 12 19:37:10 2019(r355668) @@ -94,5 +94,5 @@ "EventName": "AES_BLOCKED_CYCLES", "BriefDescription": "AES Blocked Cycles", "PublicDescription": "Total number of CPU cycles blocked for the AES functions issued by the CPU because the DEA/AES coprocessor is busy performing a function issued by another CPU" - }, + } ] Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z10/extended.json == --- head/lib/libpmc/pmu-events/arch/s390/cf_z10/extended.json Thu Dec 12 19:33:16 2019(r355667) +++ head/lib/libpmc/pmu-events/arch/s390/cf_z10/extended.json Thu Dec 12 19:37:10 2019(r355668) @@ -106,5 +106,5 @@ "EventName": "L2C_STORES_SENT", "BriefDescription": "L2C Stores Sent", "PublicDescription": "Incremented by one for every store sent to Level-2 (L1.5) cache" - }, + } ] Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z13/basic.json == --- head/lib/libpmc/pmu-events/arch/s390/cf_z13/basic.json Thu Dec 12 19:33:16 2019(r355667) +++ head/lib/libpmc/pmu-events/arch/s390/cf_z13/basic.json Thu Dec 12 19:37:10 2019(r355668) @@ -70,5 +70,5 @@ "EventName": "PROBLEM_STATE_L1D_PENALTY_CYCLES", "BriefDescription": "Problem-State L1D Penalty Cycles", "PublicDescription": "Problem-State Level-1 D-Cache Penalty Cycle Count" - }, + } ] Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z13/crypto.json == --- head/lib/libpmc/pmu-events/arch/s390/cf_z13/crypto.json Thu Dec 12 19:33:16 2019(r355667) +++ head/lib/libpmc/pmu-events/arch/s390/cf_z13/crypto.json Thu Dec 12 19:37:10 2019(r355668) @@ -94,5 +94,5 @@ "EventName": "AES_BLOCKED_CYCLES", "BriefDescription": "AES Blocked Cycles", "PublicDescription": "Total number of CPU cycles blocked for the AES functions issued by the CPU because the DEA/AES coprocessor is busy performing a function issued by another CPU" - }, + } ] Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z13/extended.json == --- head/lib/libpmc/pmu-events/arch/s390/cf_z13/extended.json Thu Dec 12 19:33:16 2019(r355667) +++ head/lib/libpmc/pmu-events/arch/s390/cf_z13/extended.json Thu Dec 12 19:37:10 2019(r355668) @@ -334,5 +334,5 @@ "EventName": "MT_DIAG_CYCLES_TWO_THR_ACTIVE", "BriefDescription": "Cycle count with two threads active", "PublicDescription": "Cycle count with two threads active" - }, + } ] Modified:
svn commit: r355667 - in head/lib/libpmc/pmu-events/arch/powerpc: power8 power9
Author: emaste Date: Thu Dec 12 19:33:16 2019 New Revision: 355667 URL: https://svnweb.freebsd.org/changeset/base/355667 Log: libpmc: convert powerpc event files to proper json Modified: head/lib/libpmc/pmu-events/arch/powerpc/power8/cache.json head/lib/libpmc/pmu-events/arch/powerpc/power8/floating-point.json head/lib/libpmc/pmu-events/arch/powerpc/power8/frontend.json head/lib/libpmc/pmu-events/arch/powerpc/power8/marked.json head/lib/libpmc/pmu-events/arch/powerpc/power8/memory.json head/lib/libpmc/pmu-events/arch/powerpc/power8/other.json head/lib/libpmc/pmu-events/arch/powerpc/power8/pipeline.json head/lib/libpmc/pmu-events/arch/powerpc/power8/pmc.json head/lib/libpmc/pmu-events/arch/powerpc/power8/translation.json head/lib/libpmc/pmu-events/arch/powerpc/power9/cache.json head/lib/libpmc/pmu-events/arch/powerpc/power9/floating-point.json head/lib/libpmc/pmu-events/arch/powerpc/power9/frontend.json head/lib/libpmc/pmu-events/arch/powerpc/power9/marked.json head/lib/libpmc/pmu-events/arch/powerpc/power9/memory.json head/lib/libpmc/pmu-events/arch/powerpc/power9/other.json head/lib/libpmc/pmu-events/arch/powerpc/power9/pipeline.json head/lib/libpmc/pmu-events/arch/powerpc/power9/pmc.json head/lib/libpmc/pmu-events/arch/powerpc/power9/translation.json Modified: head/lib/libpmc/pmu-events/arch/powerpc/power8/cache.json == --- head/lib/libpmc/pmu-events/arch/powerpc/power8/cache.json Thu Dec 12 19:23:38 2019(r355666) +++ head/lib/libpmc/pmu-events/arch/powerpc/power8/cache.json Thu Dec 12 19:33:16 2019(r355667) @@ -1,176 +1,176 @@ [ - {, + { "EventCode": "0x4c048", "EventName": "PM_DATA_FROM_DL2L3_MOD", "BriefDescription": "The processor's data cache was reloaded with Modified (M) data from another chip's L2 or L3 on a different Node or Group (Distant), as this chip due to a demand load", "PublicDescription": "The processor's data cache was reloaded with Modified (M) data from another chip's L2 or L3 on a different Node or Group (Distant), as this chip due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x3c048", "EventName": "PM_DATA_FROM_DL2L3_SHR", "BriefDescription": "The processor's data cache was reloaded with Shared (S) data from another chip's L2 or L3 on a different Node or Group (Distant), as this chip due to a demand load", "PublicDescription": "The processor's data cache was reloaded with Shared (S) data from another chip's L2 or L3 on a different Node or Group (Distant), as this chip due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x3c04c", "EventName": "PM_DATA_FROM_DL4", "BriefDescription": "The processor's data cache was reloaded from another chip's L4 on a different Node or Group (Distant) due to a demand load", "PublicDescription": "The processor's data cache was reloaded from another chip's L4 on a different Node or Group (Distant) due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x1c042", "EventName": "PM_DATA_FROM_L2", "BriefDescription": "The processor's data cache was reloaded from local core's L2 due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L2 due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x200fe", "EventName": "PM_DATA_FROM_L2MISS", "BriefDescription": "Demand LD - L2 Miss (not L2 hit)", "PublicDescription": "" }, - {, + { "EventCode": "0x1c04e", "EventName": "PM_DATA_FROM_L2MISS_MOD", "BriefDescription": "The processor's data cache was reloaded from a localtion other than the local core's L2 due to a demand load", "PublicDescription": "The processor's data cache was reloaded from a localtion other than the local core's L2 due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x3c040", "EventName": "PM_DATA_FROM_L2_DISP_CONFLICT_LDHITST", "BriefDescription": "The processor's data cache was reloaded from local core's L2 with load hit store conflict due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L2 with load hit store conflict due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x4c040", "EventName": "PM_DATA_FROM_L2_DISP_CONFLICT_OTHER", "BriefDescription": "The processor's data cache was reloaded from local core's L2 with dispatch conflict due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L2 with dispatch conflict due
svn commit: r355666 - head/lib/libpmc/pmu-events/arch/x86/amdfam17h
Author: emaste Date: Thu Dec 12 19:23:38 2019 New Revision: 355666 URL: https://svnweb.freebsd.org/changeset/base/355666 Log: libpmc: sort some amdfam17h entries to make valid json Modified: head/lib/libpmc/pmu-events/arch/x86/amdfam17h/core.json head/lib/libpmc/pmu-events/arch/x86/amdfam17h/memory.json Modified: head/lib/libpmc/pmu-events/arch/x86/amdfam17h/core.json == --- head/lib/libpmc/pmu-events/arch/x86/amdfam17h/core.json Thu Dec 12 19:21:16 2019(r355665) +++ head/lib/libpmc/pmu-events/arch/x86/amdfam17h/core.json Thu Dec 12 19:23:38 2019(r355666) @@ -2,20 +2,20 @@ { "EventName": "ex_ret_instr", "EventCode": "0xc0", + "SampleAfterValue": "203", "BriefDescription": "Retired Instructions." - "SampleAfterValue": "203", }, { "EventName": "ex_ret_cops", "EventCode": "0xc1", + "SampleAfterValue": "203", "BriefDescription": "The number of uOps retired. This includes all processor activity (instructions, exceptions, interrupts, microcode assists, etc.). The number of events logged per cycle can vary from 0 to 4." - "SampleAfterValue": "203", }, { "EventName": "ex_ret_brn", "EventCode": "0xc2", + "SampleAfterValue": "203", "BriefDescription": "The number of branch instructions retired. This includes all types of architectural control flow changes, including exceptions and interrupts." - "SampleAfterValue": "203", }, { "EventName": "ex_ret_brn_misp", Modified: head/lib/libpmc/pmu-events/arch/x86/amdfam17h/memory.json == --- head/lib/libpmc/pmu-events/arch/x86/amdfam17h/memory.json Thu Dec 12 19:21:16 2019(r355665) +++ head/lib/libpmc/pmu-events/arch/x86/amdfam17h/memory.json Thu Dec 12 19:23:38 2019(r355666) @@ -220,7 +220,7 @@ { "EventName": "ls_not_halted_cyc", "EventCode": "0x76", - "BriefDescription": "Cycles not in Halt." "SampleAfterValue": "203", + "BriefDescription": "Cycles not in Halt." } ] ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355660 - in head/sys: kern sys
Author: trasz Date: Thu Dec 12 18:45:31 2019 New Revision: 355660 URL: https://svnweb.freebsd.org/changeset/base/355660 Log: Add kern_sync(9), and make kernel code call it instead of going via sys_sync(2). Minor cleanup, no functional changes. Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D19366 Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_syscalls.c head/sys/sys/syscallsubr.h Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Thu Dec 12 18:27:54 2019(r355659) +++ head/sys/kern/vfs_bio.c Thu Dec 12 18:45:31 2019(r355660) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include @@ -1342,7 +1342,7 @@ bufshutdown(int show_busybufs) * Sync filesystems for shutdown */ wdog_kern_pat(WD_LASTVAL); - sys_sync(curthread, NULL); + kern_sync(curthread); /* * With soft updates, some buffers that are @@ -1369,7 +1369,7 @@ bufshutdown(int show_busybufs) pbusy = nbusy; wdog_kern_pat(WD_LASTVAL); - sys_sync(curthread, NULL); + kern_sync(curthread); #ifdef PREEMPTION /* Modified: head/sys/kern/vfs_syscalls.c == --- head/sys/kern/vfs_syscalls.cThu Dec 12 18:27:54 2019 (r355659) +++ head/sys/kern/vfs_syscalls.cThu Dec 12 18:45:31 2019 (r355660) @@ -114,17 +114,8 @@ static int kern_readlink_vp(struct vnode *vp, char *bu static int kern_linkat_vp(struct thread *td, struct vnode *vp, int fd, const char *path, enum uio_seg segflag); -/* - * Sync each mounted filesystem. - */ -#ifndef _SYS_SYSPROTO_H_ -struct sync_args { - int dummy; -}; -#endif -/* ARGSUSED */ int -sys_sync(struct thread *td, struct sync_args *uap) +kern_sync(struct thread *td) { struct mount *mp, *nmp; int save; @@ -149,6 +140,22 @@ sys_sync(struct thread *td, struct sync_args *uap) } mtx_unlock(_mtx); return (0); +} + +/* + * Sync each mounted filesystem. + */ +#ifndef _SYS_SYSPROTO_H_ +struct sync_args { + int dummy; +}; +#endif +/* ARGSUSED */ +int +sys_sync(struct thread *td, struct sync_args *uap) +{ + + return (kern_sync(td)); } /* Modified: head/sys/sys/syscallsubr.h == --- head/sys/sys/syscallsubr.h Thu Dec 12 18:27:54 2019(r355659) +++ head/sys/sys/syscallsubr.h Thu Dec 12 18:45:31 2019(r355660) @@ -276,6 +276,7 @@ int kern_statfs(struct thread *td, const char *path, e struct statfs *buf); intkern_symlinkat(struct thread *td, const char *path1, int fd, const char *path2, enum uio_seg segflg); +intkern_sync(struct thread *td); intkern_ktimer_create(struct thread *td, clockid_t clock_id, struct sigevent *evp, int *timerid, int preset_id); intkern_ktimer_delete(struct thread *, int); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355659 - in head/sys/arm64: arm64 include
Author: andrew Date: Thu Dec 12 18:27:54 2019 New Revision: 355659 URL: https://svnweb.freebsd.org/changeset/base/355659 Log: Add comments and macros to the tcr_el1 setting code to help understand it. This code is non-obvious when reading for the first time. To help with understanding of it add comments explaining what it's doing. While here use macros from armreg.h rather than magic numbers. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/locore.S head/sys/arm64/include/armreg.h Modified: head/sys/arm64/arm64/locore.S == --- head/sys/arm64/arm64/locore.S Thu Dec 12 18:16:32 2019 (r355658) +++ head/sys/arm64/arm64/locore.S Thu Dec 12 18:27:54 2019 (r355659) @@ -688,14 +688,23 @@ start_mmu: */ ldr x2, tcr mrs x3, id_aa64mmfr0_el1 - bfi x2, x3, #32, #3 - and x3, x3, #0xF0 - cmp x3, #0x20 + + /* Copy the bottom 3 bits from id_aa64mmfr0_el1 into TCR.IPS */ + bfi x2, x3, #(TCR_IPS_SHIFT), #(TCR_IPS_WIDTH) + and x3, x3, #(ID_AA64MMFR0_ASIDBits_MASK) + + /* Check if the HW supports 16 bit ASIDS */ + cmp x3, #(ID_AA64MMFR0_ASIDBits_16) + /* If so x3 == 1, else x3 == 0 */ csetx3, eq - bfi x2, x3, #36, #1 + /* Set TCR.AS with x3 */ + bfi x2, x3, #(TCR_ASID_SHIFT), #(TCR_ASID_WIDTH) + msr tcr_el1, x2 - /* Setup SCTLR */ + /* +* Setup SCTLR. +*/ ldr x2, sctlr_set ldr x3, sctlr_clear mrs x1, sctlr_el1 Modified: head/sys/arm64/include/armreg.h == --- head/sys/arm64/include/armreg.h Thu Dec 12 18:16:32 2019 (r355658) +++ head/sys/arm64/include/armreg.h Thu Dec 12 18:27:54 2019 (r355659) @@ -619,9 +619,12 @@ #definePSR_FLAGS 0xf000 /* TCR_EL1 - Translation Control Register */ -#defineTCR_ASID_16 (0x1UL << 36) +#defineTCR_ASID_SHIFT 36 +#defineTCR_ASID_WIDTH 1 +#defineTCR_ASID_16 (0x1UL << TCR_ASID_SHIFT) #defineTCR_IPS_SHIFT 32 +#defineTCR_IPS_WIDTH 3 #defineTCR_IPS_32BIT (0 << TCR_IPS_SHIFT) #defineTCR_IPS_36BIT (1 << TCR_IPS_SHIFT) #defineTCR_IPS_40BIT (2 << TCR_IPS_SHIFT) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355657 - head/libexec/rtld-elf
Author: bdragon Date: Thu Dec 12 17:40:32 2019 New Revision: 355657 URL: https://svnweb.freebsd.org/changeset/base/355657 Log: rtld: do not try to mmap a zero-sized PT_LOAD When a PT_LOAD segment has a zero p_filesz, skip the data mmap, as mmapping zero bytes from a file is an error. A PT_LOAD with zero p_filesz is legal (but somewhat uncommon due to segment merging in modern linkers, as it is more efficient to merge .data and .bss by just extending p_memsz in the previous segment, assuming compatible page protection.) This was seen on ports/graphics/glew on a powerpc64 ELFv2 experimental build. Submitted by: Alfredo Dal'Ava Junior Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D22634 Modified: head/libexec/rtld-elf/map_object.c Modified: head/libexec/rtld-elf/map_object.c == --- head/libexec/rtld-elf/map_object.c Thu Dec 12 17:12:18 2019 (r355656) +++ head/libexec/rtld-elf/map_object.c Thu Dec 12 17:40:32 2019 (r355657) @@ -228,11 +228,12 @@ map_object(int fd, const char *path, const struct stat data_addr = mapbase + (data_vaddr - base_vaddr); data_prot = convert_prot(segs[i]->p_flags); data_flags = convert_flags(segs[i]->p_flags) | MAP_FIXED; - if (mmap(data_addr, data_vlimit - data_vaddr, data_prot, - data_flags | MAP_PREFAULT_READ, fd, data_offset) == (caddr_t) -1) { - _rtld_error("%s: mmap of data failed: %s", path, - rtld_strerror(errno)); - goto error1; + if (data_vlimit != data_vaddr && + mmap(data_addr, data_vlimit - data_vaddr, data_prot, + data_flags | MAP_PREFAULT_READ, fd, data_offset) == MAP_FAILED) { + _rtld_error("%s: mmap of data failed: %s", path, + rtld_strerror(errno)); + goto error1; } /* Do BSS setup */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355656 - in head: lib/libc/powerpcspe/gen lib/msun/powerpc sys/powerpc/booke
Author: bdragon Date: Thu Dec 12 17:12:18 2019 New Revision: 355656 URL: https://svnweb.freebsd.org/changeset/base/355656 Log: [PowerPC] Fix SPE floating point environment manipulation Fix multiple problems in the powerpcspe floating point code. * Endianness handling of the SPEFSCR in fenv.h was completely broken. * Ensure SPEFSCR synchronization requirements are being met. The __r.__d -> __r transformations were written by jhibbits. Reviewed by: jhibbits Differential Revision:https://reviews.freebsd.org/D22526 Modified: head/lib/libc/powerpcspe/gen/fpsetmask.c head/lib/libc/powerpcspe/gen/fpsetround.c head/lib/msun/powerpc/fenv.h head/sys/powerpc/booke/spe.c Modified: head/lib/libc/powerpcspe/gen/fpsetmask.c == --- head/lib/libc/powerpcspe/gen/fpsetmask.cThu Dec 12 16:49:55 2019 (r355655) +++ head/lib/libc/powerpcspe/gen/fpsetmask.cThu Dec 12 17:12:18 2019 (r355656) @@ -47,7 +47,7 @@ fpsetmask(fp_except_t mask) __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR)); old = (fp_rnd_t)((fpscr >> 2) & 0x1f); fpscr = (fpscr & 0xff83) | (mask << 2); - __asm__ __volatile("mtspr %1,%0" :: "r"(fpscr), "K"(SPR_SPEFSCR)); + __asm__ __volatile("mtspr %1,%0;isync" :: "r"(fpscr), "K"(SPR_SPEFSCR)); return (old); } #endif Modified: head/lib/libc/powerpcspe/gen/fpsetround.c == --- head/lib/libc/powerpcspe/gen/fpsetround.c Thu Dec 12 16:49:55 2019 (r355655) +++ head/lib/libc/powerpcspe/gen/fpsetround.c Thu Dec 12 17:12:18 2019 (r355656) @@ -47,7 +47,7 @@ fpsetround(fp_rnd_t rnd_dir) __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR) ); old = (fp_rnd_t)(fpscr & 0x3); fpscr = (fpscr & 0xfffc) | rnd_dir; - __asm__ __volatile("mtspr %1, %0" :: "r"(fpscr), "K"(SPR_SPEFSCR)); + __asm__ __volatile("mtspr %1, %0;isync" :: "r"(fpscr), "K"(SPR_SPEFSCR)); return (old); } #endif Modified: head/lib/msun/powerpc/fenv.h == --- head/lib/msun/powerpc/fenv.hThu Dec 12 16:49:55 2019 (r355655) +++ head/lib/msun/powerpc/fenv.hThu Dec 12 17:12:18 2019 (r355656) @@ -32,6 +32,7 @@ #define_FENV_H_ #include +#include #ifndef__fenv_static #define__fenv_static static @@ -90,11 +91,15 @@ extern const fenv_t __fe_dfl_env; #ifndef _SOFT_FLOAT #ifdef __SPE__ -#define__mffs(__env) __asm __volatile("mfspr %0, 512" : "=r" (*(__env))) -#define__mtfsf(__env) __asm __volatile("mtspr 512,%0" : : "r" (__env)) +#define__mffs(__env) \ + __asm __volatile("mfspr %0, 512" : "=r" ((__env)->__bits.__reg)) +#define__mtfsf(__env) \ + __asm __volatile("mtspr 512,%0;isync" :: "r" ((__env).__bits.__reg)) #else -#define__mffs(__env) __asm __volatile("mffs %0" : "=f" (*(__env))) -#define__mtfsf(__env) __asm __volatile("mtfsf 255,%0" : : "f" (__env)) +#define__mffs(__env) \ + __asm __volatile("mffs %0" : "=f" ((__env)->__d)) +#define__mtfsf(__env) \ + __asm __volatile("mtfsf 255,%0" :: "f" ((__env).__d)) #endif #else #define__mffs(__env) @@ -121,9 +126,9 @@ feclearexcept(int __excepts) if (__excepts & FE_INVALID) __excepts |= FE_ALL_INVALID; - __mffs(&__r.__d); + __mffs(&__r); __r.__bits.__reg &= ~__excepts; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -132,7 +137,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); *__flagp = __r.__bits.__reg & __excepts; return (0); } @@ -144,10 +149,10 @@ fesetexceptflag(const fexcept_t *__flagp, int __except if (__excepts & FE_INVALID) __excepts |= FE_ALL_EXCEPT; - __mffs(&__r.__d); + __mffs(&__r); __r.__bits.__reg &= ~__excepts; __r.__bits.__reg |= *__flagp & __excepts; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -158,9 +163,9 @@ feraiseexcept(int __excepts) if (__excepts & FE_INVALID) __excepts |= FE_VXSOFT; - __mffs(&__r.__d); + __mffs(&__r); __r.__bits.__reg |= __excepts; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -169,7 +174,7 @@ fetestexcept(int __excepts) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); return (__r.__bits.__reg & __excepts); } @@ -178,7 +183,7 @@ fegetround(void) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); return (__r.__bits.__reg & _ROUND_MASK); } @@ -189,10 +194,10 @@
svn commit: r355655 - head/sys/powerpc/aim
Author: bdragon Date: Thu Dec 12 16:49:55 2019 New Revision: 355655 URL: https://svnweb.freebsd.org/changeset/base/355655 Log: [PowerPC] Fix powerpc 32 bit build in mmu_oea64.c Due to ppc32 building mmu_oea64.c (for use when in bridge mode on a G5), we need to guard the new moea64_page_array_startup code behind __powerpc64__ to avoid a compile error, since vm_offset_t is not 64-bit on ppc32. Reviewed by: jhibbits Differential Revision:https://reviews.freebsd.org/D22782 Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c == --- head/sys/powerpc/aim/mmu_oea64.cThu Dec 12 14:52:37 2019 (r355654) +++ head/sys/powerpc/aim/mmu_oea64.cThu Dec 12 16:49:55 2019 (r355655) @@ -309,7 +309,9 @@ static int moea64_decode_kernel_ptr(mmu_t mmu, vm_offs int *is_user, vm_offset_t *decoded_addr); static size_t moea64_scan_pmap(mmu_t mmu); static void *moea64_dump_pmap_init(mmu_t mmu, unsigned blkpgs); +#ifdef __powerpc64__ static void moea64_page_array_startup(mmu_t, long); +#endif static mmu_method_t moea64_methods[] = { @@ -349,7 +351,9 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_page_set_memattr, moea64_page_set_memattr), MMUMETHOD(mmu_quick_enter_page, moea64_quick_enter_page), MMUMETHOD(mmu_quick_remove_page, moea64_quick_remove_page), +#ifdef __powerpc64__ MMUMETHOD(mmu_page_array_startup, moea64_page_array_startup), +#endif /* Internal interfaces */ MMUMETHOD(mmu_mapdev, moea64_mapdev), @@ -3026,6 +3030,7 @@ moea64_dump_pmap_init(mmu_t mmu, unsigned blkpgs) #endif +#ifdef __powerpc64__ static void moea64_map_range(mmu_t mmu, vm_offset_t va, vm_paddr_t pa, vm_size_t npages) { @@ -3119,3 +3124,4 @@ moea64_page_array_startup(mmu_t mmu, long pages) vm_page_array = (vm_page_t)vm_page_base; vm_page_array_size = pages; } +#endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355654 - in head/lib/libpmc/pmu-events/arch/s390: cf_z13 cf_z14
Author: emaste Date: Thu Dec 12 14:52:37 2019 New Revision: 355654 URL: https://svnweb.freebsd.org/changeset/base/355654 Log: libpmc: remove undesired prefix from two s390 counters Two counters included a prefix 'Counter:###\tName:XXX' in their descriptions that appears to be a leftover from some conversion process. Remove them. Found because a json validator tripped over the tab in the description. Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z13/extended.json head/lib/libpmc/pmu-events/arch/s390/cf_z14/extended.json Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z13/extended.json == --- head/lib/libpmc/pmu-events/arch/s390/cf_z13/extended.json Thu Dec 12 13:48:23 2019(r355653) +++ head/lib/libpmc/pmu-events/arch/s390/cf_z13/extended.json Thu Dec 12 14:52:37 2019(r355654) @@ -27,7 +27,7 @@ "EventCode": "132", "EventName": "DTLB1_GPAGE_WRITES", "BriefDescription": "DTLB1 Two-Gigabyte Page Writes", - "PublicDescription": "Counter:132 Name:DTLB1_GPAGE_WRITES A translation entry has been written to the Level-1 Data Translation Lookaside Buffer for a two-gigabyte page." + "PublicDescription": "A translation entry has been written to the Level-1 Data Translation Lookaside Buffer for a two-gigabyte page." }, { "EventCode": "133", Modified: head/lib/libpmc/pmu-events/arch/s390/cf_z14/extended.json == --- head/lib/libpmc/pmu-events/arch/s390/cf_z14/extended.json Thu Dec 12 13:48:23 2019(r355653) +++ head/lib/libpmc/pmu-events/arch/s390/cf_z14/extended.json Thu Dec 12 14:52:37 2019(r355654) @@ -3,7 +3,7 @@ "EventCode": "128", "EventName": "L1D_RO_EXCL_WRITES", "BriefDescription": "L1D Read-only Exclusive Writes", - "PublicDescription": "Counter:128 Name:L1D_RO_EXCL_WRITES A directory write to the Level-1 Data cache where the line was originally in a Read-Only state in the cache but has been updated to be in the Exclusive state that allows stores to the cache line" + "PublicDescription": "A directory write to the Level-1 Data cache where the line was originally in a Read-Only state in the cache but has been updated to be in the Exclusive state that allows stores to the cache line" }, { "EventCode": "129", ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355650 - in head/sys: modules/ipfw_nat64 netpfil/ipfw/nat64
Author: ae Date: Thu Dec 12 13:28:46 2019 New Revision: 355650 URL: https://svnweb.freebsd.org/changeset/base/355650 Log: Follow RFC 4443 p2.2 and always use own addresses for reflected ICMPv6 datagrams. Previously destination address from original datagram was used. That looked confusing, especially in the traceroute6 output. Also honor IPSTEALTH kernel option and do TTL/HLIM decrementing only when stealth mode is disabled. Reported by: Marco van Tol Reviewed by: melifaro MFC after:2 weeks Sponsored by: Yandex LLC Differential Revision:https://reviews.freebsd.org/D22631 Modified: head/sys/modules/ipfw_nat64/Makefile head/sys/netpfil/ipfw/nat64/nat64_translate.c Modified: head/sys/modules/ipfw_nat64/Makefile == --- head/sys/modules/ipfw_nat64/MakefileThu Dec 12 13:21:43 2019 (r355649) +++ head/sys/modules/ipfw_nat64/MakefileThu Dec 12 13:28:46 2019 (r355650) @@ -7,6 +7,7 @@ SRCS= ip_fw_nat64.c nat64_translate.c SRCS+= nat64clat.c nat64clat_control.c SRCS+= nat64lsn.c nat64lsn_control.c SRCS+= nat64stl.c nat64stl_control.c +SRCS+= opt_ipstealth.h CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.c == --- head/sys/netpfil/ipfw/nat64/nat64_translate.c Thu Dec 12 13:21:43 2019(r355649) +++ head/sys/netpfil/ipfw/nat64/nat64_translate.c Thu Dec 12 13:28:46 2019(r355650) @@ -29,6 +29,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ipstealth.h" + #include #include #include @@ -101,14 +103,39 @@ static const struct nat64_methods nat64_direct = { .output = nat64_direct_output, .output_one = nat64_direct_output_one }; -VNET_DEFINE_STATIC(const struct nat64_methods *, nat64out) = _netisr; -#defineV_nat64out VNET(nat64out) +/* These variables should be initialized explicitly on module loading */ +VNET_DEFINE_STATIC(const struct nat64_methods *, nat64out); +VNET_DEFINE_STATIC(const int *, nat64ipstealth); +VNET_DEFINE_STATIC(const int *, nat64ip6stealth); +#defineV_nat64out VNET(nat64out) +#defineV_nat64ipstealthVNET(nat64ipstealth) +#defineV_nat64ip6stealth VNET(nat64ip6stealth) + +static const int stealth_on = 1; +#ifndef IPSTEALTH +static const int stealth_off = 0; +#endif + void nat64_set_output_method(int direct) { - V_nat64out = direct != 0 ? _direct: _netisr; + if (direct != 0) { + V_nat64out = _direct; +#ifdef IPSTEALTH + /* Honor corresponding variables, if IPSTEALTH is defined */ + V_nat64ipstealth = _ipstealth; + V_nat64ip6stealth = _ip6stealth; +#else + /* otherwise we need to decrement HLIM/TTL for direct case */ + V_nat64ipstealth = V_nat64ip6stealth = _off; +#endif + } else { + V_nat64out = _netisr; + /* Leave TTL/HLIM decrementing to forwarding code */ + V_nat64ipstealth = V_nat64ip6stealth = _on; + } } int @@ -486,8 +513,7 @@ nat64_init_ip4hdr(const struct ip6_hdr *ip6, const str ip->ip_tos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; ip->ip_len = htons(sizeof(*ip) + plen); ip->ip_ttl = ip6->ip6_hlim; - /* Forwarding code will decrement TTL for netisr based output. */ - if (V_nat64out == _direct) + if (*V_nat64ip6stealth == 0) ip->ip_ttl -= IPV6_HLIMDEC; ip->ip_sum = 0; ip->ip_p = (proto == IPPROTO_ICMPV6) ? IPPROTO_ICMP: proto; @@ -623,18 +649,18 @@ nat64_icmp6_reflect(struct mbuf *m, uint8_t type, uint struct icmp6_hdr *icmp6; struct ip6_hdr *ip6, *oip6; struct mbuf *n; - int len, plen; + int len, plen, proto; len = 0; - plen = nat64_getlasthdr(m, ); - if (plen < 0) { + proto = nat64_getlasthdr(m, ); + if (proto < 0) { DPRINTF(DP_DROPS, "mbuf isn't contigious"); goto freeit; } /* * Do not send ICMPv6 in reply to ICMPv6 errors. */ - if (plen == IPPROTO_ICMPV6) { + if (proto == IPPROTO_ICMPV6) { if (m->m_len < len + sizeof(*icmp6)) { DPRINTF(DP_DROPS, "mbuf isn't contigious"); goto freeit; @@ -646,6 +672,21 @@ nat64_icmp6_reflect(struct mbuf *m, uint8_t type, uint "ICMPv6 errors"); goto freeit; } + /* +* If there are extra headers between IPv6 and ICMPv6, +* strip off them. +*/ + if (len > sizeof(struct ip6_hdr)) { + /* +* NOTE: ipfw_chk already did m_pullup() and it is +
svn commit: r355649 - head/sys/arm64/rockchip
Author: manu Date: Thu Dec 12 13:21:43 2019 New Revision: 355649 URL: https://svnweb.freebsd.org/changeset/base/355649 Log: arm64: rockchip: rk_pinctrl: Fix parse_bias for RK3399 Only bank 0 and bank 2 are different than other rockchip SoC, fix this. While here remove some debug printfs that where added in r355648 MFC after:3 days X-MFC-With: r355648 Modified: head/sys/arm64/rockchip/rk_pinctrl.c Modified: head/sys/arm64/rockchip/rk_pinctrl.c == --- head/sys/arm64/rockchip/rk_pinctrl.cThu Dec 12 13:02:22 2019 (r355648) +++ head/sys/arm64/rockchip/rk_pinctrl.cThu Dec 12 13:21:43 2019 (r355649) @@ -100,7 +100,7 @@ struct rk_pinctrl_conf { uint32_tngpio_bank; uint32_t(*get_pd_offset)(struct rk_pinctrl_softc *, uint32_t); struct syscon *(*get_syscon)(struct rk_pinctrl_softc *, uint32_t); - int (*parse_bias)(phandle_t node); + int (*parse_bias)(phandle_t, int); }; struct rk_pinctrl_softc { @@ -372,7 +372,7 @@ rk3288_get_syscon(struct rk_pinctrl_softc *sc, uint32_ } static int -rk3288_parse_bias(phandle_t node) +rk3288_parse_bias(phandle_t node, int bank) { if (OF_hasprop(node, "bias-disable")) return (0); @@ -627,24 +627,38 @@ rk3399_get_pd_offset(struct rk_pinctrl_softc *sc, uint static struct syscon * rk3399_get_syscon(struct rk_pinctrl_softc *sc, uint32_t bank) { - if (bank < 2) { - device_printf(sc->dev, "%s: Using PMU GRF\n", __func__); + if (bank < 2) return (sc->pmu); - } - device_printf(sc->dev, "%s: Using GRF\n", __func__); return (sc->grf); } static int -rk3399_parse_bias(phandle_t node) +rk3399_parse_bias(phandle_t node, int bank) { + int pullup, pulldown; + if (OF_hasprop(node, "bias-disable")) return (0); + + switch (bank) { + case 0: + case 2: + pullup = 3; + pulldown = 1; + break; + case 1: + case 3: + case 4: + pullup = 1; + pulldown = 2; + break; + } + if (OF_hasprop(node, "bias-pull-up")) - return (3); + return (pullup); if (OF_hasprop(node, "bias-pull-down")) - return (1); + return (pulldown); return (-1); } @@ -862,7 +876,7 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, SYSCON_MODIFY_4(syscon, reg, mask, function << bit | (mask << 16)); /* Pull-Up/Down */ - bias = sc->conf->parse_bias(pin_conf); + bias = sc->conf->parse_bias(pin_conf, bank); if (bias >= 0) { reg = sc->conf->get_pd_offset(sc, bank); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355648 - head/sys/arm64/rockchip
Author: manu Date: Thu Dec 12 13:02:22 2019 New Revision: 355648 URL: https://svnweb.freebsd.org/changeset/base/355648 Log: arm64: rockchip: rk_pinctrl: Add bias parsing based on the SoC type Not all rockchip have the same value for pullup/pulldown so add a function per SoC and call the right one to have the proper value. MFC after:3 days Modified: head/sys/arm64/rockchip/rk_pinctrl.c Modified: head/sys/arm64/rockchip/rk_pinctrl.c == --- head/sys/arm64/rockchip/rk_pinctrl.cThu Dec 12 05:11:53 2019 (r355647) +++ head/sys/arm64/rockchip/rk_pinctrl.cThu Dec 12 13:02:22 2019 (r355648) @@ -100,6 +100,7 @@ struct rk_pinctrl_conf { uint32_tngpio_bank; uint32_t(*get_pd_offset)(struct rk_pinctrl_softc *, uint32_t); struct syscon *(*get_syscon)(struct rk_pinctrl_softc *, uint32_t); + int (*parse_bias)(phandle_t node); }; struct rk_pinctrl_softc { @@ -370,6 +371,19 @@ rk3288_get_syscon(struct rk_pinctrl_softc *sc, uint32_ return (sc->grf); } +static int +rk3288_parse_bias(phandle_t node) +{ + if (OF_hasprop(node, "bias-disable")) + return (0); + if (OF_hasprop(node, "bias-pull-up")) + return (1); + if (OF_hasprop(node, "bias-pull-down")) + return (2); + + return (-1); +} + struct rk_pinctrl_conf rk3288_conf = { .iomux_conf = rk3288_iomux_bank, .iomux_nbanks = nitems(rk3288_iomux_bank), @@ -381,6 +395,7 @@ struct rk_pinctrl_conf rk3288_conf = { .ngpio_bank = nitems(rk3288_gpio_bank), .get_pd_offset = rk3288_get_pd_offset, .get_syscon = rk3288_get_syscon, + .parse_bias = rk3288_parse_bias, }; static struct rk_pinctrl_gpio rk3328_gpio_bank[] = { @@ -524,6 +539,7 @@ struct rk_pinctrl_conf rk3328_conf = { .ngpio_bank = nitems(rk3328_gpio_bank), .get_pd_offset = rk3328_get_pd_offset, .get_syscon = rk3328_get_syscon, + .parse_bias = rk3288_parse_bias, }; static struct rk_pinctrl_gpio rk3399_gpio_bank[] = { @@ -611,12 +627,28 @@ rk3399_get_pd_offset(struct rk_pinctrl_softc *sc, uint static struct syscon * rk3399_get_syscon(struct rk_pinctrl_softc *sc, uint32_t bank) { - if (bank < 2) + if (bank < 2) { + device_printf(sc->dev, "%s: Using PMU GRF\n", __func__); return (sc->pmu); + } + device_printf(sc->dev, "%s: Using GRF\n", __func__); return (sc->grf); } +static int +rk3399_parse_bias(phandle_t node) +{ + if (OF_hasprop(node, "bias-disable")) + return (0); + if (OF_hasprop(node, "bias-pull-up")) + return (3); + if (OF_hasprop(node, "bias-pull-down")) + return (1); + + return (-1); +} + struct rk_pinctrl_conf rk3399_conf = { .iomux_conf = rk3399_iomux_bank, .iomux_nbanks = nitems(rk3399_iomux_bank), @@ -628,6 +660,7 @@ struct rk_pinctrl_conf rk3399_conf = { .ngpio_bank = nitems(rk3399_gpio_bank), .get_pd_offset = rk3399_get_pd_offset, .get_syscon = rk3399_get_syscon, + .parse_bias = rk3399_parse_bias, }; static struct ofw_compat_data compat_data[] = { @@ -638,19 +671,6 @@ static struct ofw_compat_data compat_data[] = { }; static int -rk_pinctrl_parse_bias(phandle_t node) -{ - if (OF_hasprop(node, "bias-disable")) - return (0); - if (OF_hasprop(node, "bias-pull-up")) - return (1); - if (OF_hasprop(node, "bias-pull-down")) - return (2); - - return (-1); -} - -static int rk_pinctrl_parse_drive(struct rk_pinctrl_softc *sc, phandle_t node, uint32_t bank, uint32_t subbank, uint32_t *drive, uint32_t *offset) { @@ -842,7 +862,7 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, SYSCON_MODIFY_4(syscon, reg, mask, function << bit | (mask << 16)); /* Pull-Up/Down */ - bias = rk_pinctrl_parse_bias(pin_conf); + bias = sc->conf->parse_bias(pin_conf); if (bias >= 0) { reg = sc->conf->get_pd_offset(sc, bank); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"