Commit Graph

15899 Commits

Author SHA1 Message Date
ngie
95e3008df9 MFC r293715:
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>
2016-01-19 01:30:22 +00:00
ngie
2af193e575 MFC r292497:
Integrate the remaining tools/regression/lib/msun testcases into the
FreeBSD test suite under lib/msun/tests
2016-01-18 03:55:40 +00:00
ngie
6391e71761 MFC r293705:
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>
2016-01-18 03:49:57 +00:00
ngie
2e97bc7968 MFC r293704:
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>
2016-01-18 03:47:46 +00:00
des
70d47d449e MFH (r280630): remove all traces of SSLv2 support
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
2016-01-16 20:24:02 +00:00
des
5e1cc08a89 MFH (r262530): fix is_upper() predicate (almost two years late...)
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.
2016-01-16 19:48:03 +00:00
tuexen
bc1e3287c3 MFC r287619:
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.
2016-01-16 14:56:30 +00:00
jilles
53a08c47dc MFC r293783: futimens/utimensat: Use the new system calls.
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.
2016-01-15 20:55:44 +00:00
marius
d65287a84a Update stable/10 from 10.2-STABLE to 10.3-PRERELEASE,
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)
2016-01-15 00:05:58 +00:00
jtl
5c4bf04e87 MFC r290811:
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.
2016-01-14 22:02:21 +00:00
trasz
355c35a189 MFC r287964:
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
2016-01-12 10:11:29 +00:00
trasz
51adb09baa MFC r285240:
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
2016-01-12 09:58:00 +00:00
dteske
fdecbaeff5 MFC SVN revisions 293340, 293379
r293340: Increase maximum buffer size for `-x cmd' value
r293379: Bump copyright
2016-01-09 23:44:41 +00:00
dteske
cac8f39a78 MFC r290275: Make figpar(3) types/macros [more] unique (s/fp_/figpar_/gi) 2016-01-09 23:33:44 +00:00
dchagin
6aeea6cc62 MFC r277610 (by jillies):
Add futimens and utimensat system calls.
2016-01-09 14:20:23 +00:00
rpokala
d5fe9e0efa MFC r291114: popen() requires check for fdopen() failure
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.
2016-01-09 05:05:15 +00:00
stas
060003c8c0 MFC r292047: RPC: populate local address for rendezvous transporter. 2016-01-08 00:21:55 +00:00
bdrewery
012c5f2da9 MFC r291941:
Replace unneeded manual dependency on header by adding it to SRCS.
2016-01-07 23:26:16 +00:00
ngie
d42686c8e0 MFC r292328:
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)
2016-01-06 20:21:40 +00:00
brueffer
144eea3874 MFH: 292432,r292433,r292434
- Merge OpenBSM 1.2 alpha 4.
- Regenerate config.h for OpenBSM 1.2 alpha 4.
- Add au_notify.2 and MLINKs (added in OpenBSM 1.2 alpha 4).

Relnotes:	yes
2016-01-04 16:32:21 +00:00
ume
17e0b17961 MFC r292719:
Remove _gethostbynisname() and _gethostbynisaddr().  These functions
  used to be called from getipnodebyname().
2016-01-01 00:35:06 +00:00
ngie
fded02003e MFC nv(3) and part of nv(9) to stable/10
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
2015-12-31 03:28:14 +00:00
ume
8dfa514cac MFC r292550, r292595:
Simplify _map_v4v6_address().
  We don't need to use a temporary buffer, here.
2015-12-29 00:42:35 +00:00
ngie
938f5957c2 MFC r292317,r292318,r292323,r292324,r292665:
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
2015-12-28 23:05:13 +00:00
ume
b20f90aa79 MFC r292445, r292554:
Use _map_v4v6_address().
2015-12-28 03:37:13 +00:00
ume
98e3a0ddfe MFC r292539:
If we end up following a CNAME chain that does not find
  any data return that instead of internal error.

PR:		156684
2015-12-28 03:26:16 +00:00
jilles
a0fabd0e1a MFC r292513: clock_gettime(2),gettimeofday(2): Remove [EFAULT] error.
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.
2015-12-27 15:30:13 +00:00
kib
07bab8ce9f MFC r292510:
Fix lockf(3) cancellation behaviour.
2015-12-27 00:42:13 +00:00
ume
6885269fd5 MFC r292514:
addrinfo.ai_family is an address family, not a protocol family.

PR:		162434
2015-12-27 00:37:04 +00:00
ume
ea7b0bc9d3 MFC 276962:
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>
2015-12-26 12:06:52 +00:00
ume
55621219f5 Add AI_V4MAPPED and AI_ALL support for getaddrinfo(3).
PR:		198092
2015-12-25 11:17:21 +00:00
delphij
897a072717 MFC: xz 5.2.2.
Relnotes:	yes
2015-12-22 08:03:23 +00:00
araujo
d0682c6d12 MFC: r291073
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>
2015-12-21 14:32:29 +00:00
jilles
c5949fa695 MFC r292130: exec(3): Fix COMPATIBILITY section: default path does not
contain cwd.
2015-12-20 13:41:06 +00:00
ngie
4b0edd2775 MFC r292153:
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
2015-12-20 00:40:33 +00:00
vangyzen
b6f246520d MFC r289315, r292216
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.
2015-12-19 02:41:31 +00:00
vangyzen
ec40565958 MFC r289837
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.
2015-12-19 02:35:32 +00:00
ume
b186dc0928 MFC r292129:
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
2015-12-19 01:21:28 +00:00
ngie
75b1bfea2e MFC r292250:
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
2015-12-18 06:58:44 +00:00
ume
9e838a130f MFC r292059:
The calls to RES_SET_H_ERRNO() macro on error paths wind up
  dereferencing an uninitialized res.

PR:		202142
Submitted by:	Sean Boudreau
2015-12-17 16:08:28 +00:00
emaste
fa6577ca64 MFC r282821: Remove redundant csu subdir logic
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
2015-12-16 16:40:45 +00:00
ngie
e999176b6b MFC r291837:
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
2015-12-13 21:15:03 +00:00
ngie
1299d77d50 Revert r292168 -- I used the wrong commit message by accident 2015-12-13 21:14:04 +00:00
ngie
4380394990 MFC r276737,r289369,r289376,r289424,r291219,r291382,r291385,r291908:
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
2015-12-13 21:09:46 +00:00
ngie
8dd9ca5e2a MFC r291980,r291981:
r291980:

Add missing va_ends for corresponding va_starts to clean up variable arguments
initialized in _test_fmt(..)

Reported by: cppcheck
Sponsored by: EMC / Isilon Storage Division

r291981:

Delete bogus freeing of uninitialized data

Reported by: cppcheck
Sponsored by: EMC / Isilon Storage Division
2015-12-13 04:29:09 +00:00
ngie
2b74a3bca0 MFC r292013:
Use stdint.h instead of inttypes.h as the latter pollutes namespace more

Submitted by: bde
Sponsored by: EMC / Isilon Storage Division
2015-12-13 04:24:15 +00:00
ngie
3a31045230 MFC r291832,r291833,r291834,r291835,r291836,r291838:
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
2015-12-13 03:51:49 +00:00
ngie
e640864a77 MFC r292004:
Fix compilation when -DDEBUG is defined by adding inttypes.h #include
for intmax_t

Differential Revision: https://reviews.freebsd.org/D4434
Reported by: cppcheck
Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
2015-12-13 03:40:43 +00:00
ngie
4cb2700406 MFC r291979:
Unbreak compiling getnetgrent.c with -DDEBUG after r236402 by adding a
missing "}"

Sponsored by: EMC / Isilon Storage Division
2015-12-13 03:37:29 +00:00
ngie
7fb13df4f3 MFC r290908,r291615:
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.
2015-12-05 22:44:07 +00:00