Fix a mismerge from NetBSD in r162194 with `xdr_rpcb_entry_list_ptr(..)`
This fixes the potential NULL pointer dereference properly, and also fixes
memory leaks encountered in the process of iterating through `*rp`.
Found by: Valgrind
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Similar to r293704, fix theoretical leak of netconfig(3) resources in
__rpcbind_is_up(..) if getnetconfig(3) is partly successful in allocating
resources, but not completely successful by moving the endnetconfig(3) call
up before we return from the function if nconf == NULL.
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Fix theoretical leak of netconfig(3) resources in svcunix_create(..)
In the event that the getconfig(3) call in svcunix_create is partly successful,
some of the netconfig(3) resources allocated might be leaked if the call returns
NULL as endnetconfig(3) wasn't called explicitly in that case. Ensure that the
resources are fully cleaned up by going to the `done` label, which will call
endnetconfig(3) for us.
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
MFH (r285141): remove unused variable
MFH (r288217): correctly check return value from getaddrinfo(3)
MFH (r289419): fix bugs in HTTPS tunnelling
MFH (r289420): use fopen()'s "e" mode instead of fcntl for close-on-exec
MFH (r291453, r291461): use .netrc for http servers and proxies
MFH (r292330, r292332): reset bufpos to 0 after refilling in chunked mode
PR: 194483 199801 193740 204771
MFH (r271614): remove incorrect svn properties
MFH (r274145): cast-qual bugs in tests
MFH (r288070): restore correct module search path semantics
Also merge upstream r854, committed to head as part of r280031, which
fixes cast-qual bugs in libpam itself.
Zero out a local variable also when PURIFY is not defined.
This silence a warning brought up by valgrind whenever if_nametoindex
is used. This was already discussed in PR 166483, but the code
committed in r234329 guards the initilization with #ifdef PURIFY.
Therefore, valgrind still complains. Since this code is not performance
critical, always zero out the local variable to silence valgrind.
Update the __FreeBSD_version check in lib/libc/sys/futimens.c and
lib/libc/sys/utimensat.c. Before this, fallback code using
futimes/futimesat/lutimes was used except when running on a sufficiently
recent 11-current kernel.
Also, update the history section in the man page.
marking the official start of the code slush.
Set the default mdoc(7) version to 10.3, and update the
clang(1) TARGET_TRIPLE and BUILD_TRIPLE to reflect 10.3.
Approved by: re (implicit)
Fix hwpmc "stalled" behavior
Currently, there is a single pm_stalled flag that tracks whether a
performance monitor was "stalled" due to insufficent ring buffer
space for samples. However, because the same performance monitor
can run on multiple processes or threads at the same time, a single
pm_stalled flag that impacts them all seems insufficient.
In particular, you can hit corner cases where the code fails to stop
performance monitors during a context switch out, because it thinks
the performance monitor is already stopped. However, in reality,
it may be that only the monitor running on a different CPU was stalled.
This patch attempts to fix that behavior by tracking on a per-CPU basis
whether a PM desires to run and whether it is "stalled". This lets the
code make better decisions about when to stop PMs and when to try to
restart them. Ideally, we should avoid the case where the code fails
to stop a PM during a context switch out.
MFC r290813:
Optimizations to the way hwpmc gathers user callchains
Changes to the code to gather user stacks:
* Delay setting pmc_cpumask until we actually have the stack.
* When recording user stack traces, only walk the portion of the ring
that should have samples for us.
MFC r290929:
Change the driver stats to what they really are: unsigned values.
When pmcstat exits after some samples were dropped, give the user an
idea of how many were lost. (Granted, these are global numbers, but
they may still help quantify the scope of the loss.)
MFC r290930:
Improve accuracy of PMC sampling frequency
The code tracks a counter which is the number of events until the next
sample. On context switch in, it loads the saved counter. On context
switch out, it tries to calculate a new saved counter.
Problems:
1. The saved counter was shared by all threads in a process. However, this
means that all threads would be initially loaded with the same saved
counter. However, that could result in sampling more often than once every
X number of events.
2. The calculation to determine a new saved counter was backwards. It
added when it should have subtracted, and subtracted when it should have
added. Assume a single-threaded process with a reload count of 1000
events. Assuming the counter on context switch in was 100 and the counter
on context switch out was 50 (meaning the thread has "consumed" 50 more
events), the code would calculate a new saved counter of 150 (instead of
the proper 50).
Fix:
1. As soon as the saved counter is used to initialize a monitor for a
thread on context switch in, set the saved counter to the reload count.
That way, subsequent threads to use the saved counter will get the full
reload count, assuring we sample at least once every X number of events
(across all threads).
2. Change the calculation of the saved counter. Due to the change to the
saved counter in #1, we simply need to add (modulo the reload count) the
remaining counter time we retrieve from the CPU when a thread is context
switched out.
MFC r291016:
Support a wider history counter in pmcstat(8) gmon output
pmcstat(8) contains an option to output sampling data in a gmon format
compatible with gprof(1). Currently, it uses the default histcounter,
which is an (unsigned short). With large sets of sampling data, it
is possible to overflow the maximum value provided by an (unsigned
short).
This change adds the -e argument to pmcstat. If -e and -g are both
specified, pmcstat will use a histcounter type of uint64_t.
MFC r291017:
Fix the date on the pmcstat(8) man page from r291016.
Kernel part of reroot support - a way to change rootfs without reboot.
Note that the mountlist manipulations are somewhat fragile, and not very
pretty. The reason for this is to avoid changing vfs_mountroot(), which
is (obviously) rather mission-critical, but not very well documented,
and thus hard to test properly. It might be possible to rework it to use
its own simple root mount mechanism instead of vfs_mountroot().
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2698
Remove reboot.S (part of libc). It's not needed and was actually
broken - returning 0 from reboot(2) resulted in SIGBUS.
Sponsored by: The FreeBSD Foundation
Move fdopen() up near other resource allocation like malloc(); do proper
deallocation on failure later on in the function.
Approved by: jhb
Sponsored by: Panasas, Inc.
Integrate a number of testcases from tools/regression/lib/msun
into the FreeBSD test suite
There's no functional change with these testcases; they're purposely
being left in TAP format for the time being
Other testcases which crash on amd64/i386 as-is have not been
integrated yet (they need to be retested on a later version of
CURRENT, as I haven't used i386 in some time)
This includes the following revisions from head:
r258065,r258594,r259430,r260222,r261407,r261408,r263479,r264021,r266351,
r269603,r271026,r271027,r271028,r271241,r271578,r271579,r271847,r272102,
r272843,r273752,r277920,r277921,r277925,r277926,r277927,r279421,r279422,
r279423,r279424,r279425,r279426,r279427,r279428,r279429,r279430,r279431,
r279432,r279434,r279435,r279436,r279438,r279439,r279440,r279760,r282122,
r282254,r282257,r282304,r282312,r285339,r288340
This change reverts stable/10@r282122 and stable/10@r288340, and re-MFCs the
series again (r282122, r285339, and r288340).
More changes are pending to nv(9)/pci(4) after further review/work. Please see
the Phabricator review for more details (both https://reviews.freebsd.org/D4232
and https://reviews.freebsd.org/D4249 ).
- Tested with:
-- Booting VMware Fusion 8.1.0 running on a Haswell Apple Macbook Pro
-- Booting a Haswell machine with zfs and running some stress workloads with
VirtualBox guests
-- make tinderbox
-- kyua test -k /usr/tests/lib/libnv
Differential Revision: https://reviews.freebsd.org/D4249 (part of a larger diff)
Relnotes: yes
Reviewed by: oshogbo (implicit), sbruno (implicit)
Submitted by: Kevin Bowling <kevin.bowling@kev009.com>
Sponsored by: EMC / Isilon Storage Division
r292317:
Integrate tools/regression/lib/libc/resolv into the FreeBSD test suite as
lib/libc/tests/resolv
Convert the testcases to ATF
Sponsored by: EMC / Isilon Storage Division
r292318:
Add Makefile accidentally missed in r292317
Sponsored by: EMC / Isilon Storage Division
r292323:
Integrate tools/regression/lib/libc/nss into the FreeBSD test suite as
lib/libc/tests/nss
- Convert the testcases to ATF
- Do some style(9) cleanups:
-- Sort headers
-- Apply indentation fixes
-- Remove superfluous parentheses
- Explicitly print out debug printfs for use with `kyua {debug,report}`; for
items that were overly noisy, they've been put behind #ifdef DEBUG
conditionals
- Fix some format strings
Sponsored by: EMC / Isilon Storage Division
r292324:
Iterate down lib/libc/tests/nss...
Sponsored by: EMC / Isilon Storage Division
r292665:
Increase the timeout for resolv_test from the default (300 seconds) to
450 seconds
This is required on slower network connections, and on older releases
(stable/10 seems to be slower as far as name resolution goes.. not sure
why yet).
Remove an outdated comment in the Makefile from when I was working on
this code over a year ago on github
Sponsored by: EMC / Isilon Storage Division
Depending on system configuration and parameters, clock_gettime() and
gettimeofday() may not be system calls. If so, passing an invalid pointer
will cause a signal and not an [EFAULT] error.
From a standards perspective, this is OK since passing an invalid pointer is
undefined behaviour.
Do not regenerate and install liblzma.pc when only build libraries
aka do not regenerate while generating 32bits libs
Reported by: Shin-ichi Okano <s-okano__at__n08.itscom.net>
If a NIS server has long entries on its database that is bigger than
1024 specified on YPMAXRECORD the ypmatch can get in an infinite retry
loop when is requesting the information from the NIS server.
The ypmatch(1) will return an error until the command receives an
kill(1).
To avoid this problem, we check the MAX_RETRIES that is by default set
to 20 and avoid get in infinet loop at the client side.
NOTE: FreeBSD nis(8) server doesn't present this issue.
Submitted by: Ravi Pokala <rpokala at panasas.com>,
Lakshmi N. Sundararajan <lakshmi.n at msystechnologies.com>,
Lewis, Fred <flewis at panasas.com>,
Pushkar Kothavade <pushkar.kothavade at msystechnologies.com>
Add -static to CFLAGS to unbreak the tests by using a libc.a with
the xlocale private symbols exposed which aren't exposed publicly
via the DSO
PR: 191354
Sponsored by: EMC / Isilon Storage Division
resolver: automatically reload /etc/resolv.conf
On each resolver query, use stat(2) to see if the modification time
of /etc/resolv.conf has changed. If so, reload the file and reinitialize
the resolver library. However, only call stat(2) if at least two seconds
have passed since the last call to stat(2), since calling it on every
query could kill performance.
This new behavior is enabled by default. Add a "reload-period" option
to disable it or change the period of the test.
Document this behavior and option in resolv.conf(5).
Polish the man page just enough to appease igor.
Relnotes: yes
Sponsored by: Dell Inc.
resolver: abuse _res a little less
In the past, _res was a global variable. Now, it's multiple function calls.
Several functions in the resolver use _res multiple times and therefore
call the function(s) far more than necessary.
Fix those callers to store the result of _res in a local variable.
Add __noinline to the definition of res_init() to avoid the code bloat
that these changes would have otherwise incurred. Thanks to jilles
for noticing this.
Sponsored by: Dell Inc.
RFC 3493 requires ignoring the loopback address for AI_ADDRCONFIG.
Since it breaks certain jail setup, we ignore just 127.0.0.1
instead of whole loopback address range.
PR: 192014
Reviewed by: hrs
Allow users override `DEBUG` on the command line via DEBUG_FLAGS="-DDEBUG" with
lib/libc/resolv by conditionalizing its definition
Reviewed by: ume, vangyzen
Differential Revision: https://reviews.freebsd.org/D4519
The appropriate subdirectories are handled by lib/csu/Makefile. There's
no need to duplicate this logic in Makefile.inc1 and lib/Makefile.
Sponsored by: The FreeBSD Foundation
split.ih:
- Create automatically generated include header for split.c
main.c:
- Use function definitions from debug.ih and split.ih instead of externs
Sponsored by: EMC / Isilon Storage Division
r276737 (by imp):
Remove old ioctl use and support, once and for all.
r289369 (by emaste):
newfs_msdos: rework option parsing to match NetBSD
NetBSD split newfs_msdos in two so that they can reuse the file system
creation part in makefs. This change is a step on the path of bringing
that support to FreeBSD.
Reviewed by: kib, pfg
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3905
r289376 (by emaste):
newfs_msdos: move mkfs_msdos to separate file for later use in makefs
Sponsored by: The FreeBSD Foundation
r289424 (by emaste):
newfs_msdos: prefer snprintf to sprintf
Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation
r291219 (by emaste):
newfs_msdos: rework error handling for eventual use in makefs
Return -1 on errors from mkfs_msdos() instead of err()/errx(), to
allow different consumers to handle errors as appropriate.
Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation
r291382 (by emaste):
mkfs_msdos: sync with NetBSD
Add a sanity test and clean up whitespace.
Obtained from: NetBSD
r291385 (by emaste):
Use netbsd usage() implementation in newfs_msdos
In r289629 newfs_msdos option descriptions are available in
mkfs_msdos.h.
Obtained from: NetBSD
r291908:
Fix leak in mkfs_msdos(..) by initializing img to NULL and free'ing at the end
of the function
Differential Revision: https://reviews.freebsd.org/D4405
PR: 204943
Reviewed by: emaste, jilles
Reported by: David Binderman <dcb314@hotmail.com>
Sponsored by: EMC / Isilon Storage Division
r291832:
Fix -Wformat warnings by using the correct format qualifiers
Sponsored by: EMC / Isilon Storage Division
r291833:
- Use ANSI C function prototypes/definitions instead of K&R style ones
- Add a missing return type for main(..)
Sponsored by: EMC / Isilon Storage Division
r291834:
Add missing headers and sort #includes per style(9)
Sponsored by: EMC / Isilon Storage Division
r291835:
Use ANSI C function prototypes/definitions instead of K&R style ones
Sponsored by: EMC / Isilon Storage Division
r291836:
Use `==` instead of `=` in the function comment above split(..) so mkh -p
exposes split(..).
Sponsored by: EMC / Isilon Storage Division
r291838:
Fix -Wformat issues and minor whitespace issues in surrounding areas
Sponsored by: EMC / Isilon Storage Division
r290908:
Integrate contrib/netbsd-tests/lib/libcrypt/t_crypt.c in to the FreeBSD
test suite as lib/libcrypt/crypt_test
Sponsored by: EMC / Isilon Storage Division
r291615 (by rodrigc):
Hack test so that it works on FreeBSD.