16003 Commits

Author SHA1 Message Date
jilles
9e91116bda MFC r300970: Remove non-history libkse references and fix typo
"PTHREAD_PROCESSES_PRIVATE".
2016-06-18 13:42:33 +00:00
mm
c11d326853 MFC r299529,r299540,r299576,r299896:
r299529,r299540:
Update libarchive to 3.2.0

New features:
- new bsdcat command-line utility
- LZ4 compression (in src only via external utility from ports)
- Warc format support
- 'Raw' format writer
- Zip: Support archives >4GB, entries >4GB
- Zip: Support encrypting and decrypting entries
- Zip: Support experimental streaming extension
- Identify encrypted entries in several formats
- New --clear-nochange-flags option to bsdtar tries to remove noschg and
  similar flags before deleting files
- New --ignore-zeros option to bsdtar to handle concatenated tar archives
- Use multi-threaded LZMA decompression if liblzma supports it
- Expose version info for libraries used by libarchive

r299576,r299896:
Fix broken cpio behavior.

Relnotes:	yes
2016-06-17 22:40:10 +00:00
truckman
ea478cdf17 MFC r301596
Don't leak olinep if malloc() fails.

If malloc() fails to allocate linep, then free olinep (if it exists)
before returning to avoid a memory leak.

Reported by:	Coverity
CID:		1016716
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D6755
2016-06-15 06:42:30 +00:00
truckman
f4be65f8e0 MFC r301592
Don't leak addrinfo if ai->ai_addrlen <= minsiz test fails.

If the ai->ai_addrlen <= minsiz test fails, then freeaddrinfo()
does not get called to free the memory just allocated by getaddrinfo().
Fix by moving ai->ai_addrlen <= minsiz to a separate nested if
block, and keep freeaddrinfo() in the outer block so that freeaddrinfo()
will be called whenever getaddrinfo() succeeds.

Reported by:	Coverity
CID:		1273652
Reviewed by:	ume
Differential Revision:	https://reviews.freebsd.org/D6756
2016-06-15 06:40:30 +00:00
jamie
bf0749f11a MFC r300983:
Mark jail(2), and the sysctls that it (and only it) uses as deprecated.
  jail(8) has long used jail_set(2), and those sysctl only cause confusion.
2016-06-15 01:49:01 +00:00
ngie
836f6cf130 MFC r301704:
Test for strchr(3) returning NULL, not 0
2016-06-11 01:37:59 +00:00
ngie
9d59ff8772 MFC r299511:
r299511 (by cem):

print_positional_test: Fix misuse of wchar APIs

These APIs take unit length, not byte length parameters.

CIDs:		1338543, 1338544, 1338545
2016-06-10 18:13:41 +00:00
ngie
a8c272ee05 MFC r299510:
r299510 (by cem):

libmp: Fix trivial buffer overrun

fgetln yields a non-NUL-terminated buffer and its length.  This routine
attempted to NUL-terminate it, but did not allocate space for the NUL.  So,
allocate space for the NUL.

CID:		1017457
2016-06-10 18:10:32 +00:00
ngie
121e04bca5 MFC r299502:
r299502 (by cem):

nss/gethostby_test: fix broken vector iteration of gethostbyaddr h_aliases

h_aliases is a NULL-terminated rather than fixed-length array.  nitems() is not
a valid way to determine its end; instead, check for NULL.

CID:		1346578
2016-06-10 15:42:17 +00:00
ngie
bbefcf038b MFC r300624:
Fix up r300385

I accidentally glossed over the fact that tmp is manipulated via strchr, so
if we tried to free `tmp` after r300385, it would have crashed.

Create a separate pointer (tmp2) to track the original allocation of `tmp`,
and free `tmp2` if `p->nc_lookups` can't be malloced

CID: 1356026
2016-06-08 18:46:10 +00:00
ngie
19b157a811 MFC r300385:
Don't leak `tmp` if `p->nc_lookups` can't be malloced
2016-06-08 18:41:49 +00:00
ngie
e55bbd6661 MFC r300386:
Don't leak `handle` if svc_tp_create(..) succeeds and allocating a new
struct xlist object fails

CID: 978277
2016-06-08 18:27:44 +00:00
ngie
07c4cea1bd MFC r299699:
Remove NO_WERROR from libbsnmp/Makefile.inc

This has been compiling without warnings with clang/gcc for a while now

Tested with: clang 3.8.0, gcc 4.2.x, gcc 5.x
2016-06-08 18:14:06 +00:00
ngie
47cb06bc0c MFC r300387,r300388,r300389:
r300387:

getnetid(..): consistently fclose fd at the end of the function

This mutes a false positive with cppcheck, but also helps eliminate future
potential issues with this variable

r300388:

Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
was NULL

This would theoretically happen if the netconfig protocol family and protocol
semantics were never matched.

CID: 978179

r300389:

nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)

If the buffer couldn't be adequately resized to accomodate an additional "\n",
it would leak resultbuf by breaking from the loop early

CID: 1016702
2016-06-08 14:18:47 +00:00
ngie
4d9deb28d5 MFC r300620,r300621:
r300620:

Use reallocf instead of malloc to fix leak with outbuf_pmap

The previous code overwrote outbuf_pmap's memory with malloc once per
loop iteration, which leaked its memory; use reallocf instead to ensure
that memory is properly free'd each loop iteration.

Add a outbuf_pmap = NULL in the failure case to avoid a double-free
at the bottom of the function.

CID: 1038776

r300621:

Remove redundant NULLing of outbuf_pmap

If reallocf ever failed, outbuf_pmap would already be NULL
2016-06-08 13:58:47 +00:00
grembo
7ef21bdc1b MFC r297052:
Update fetch.1 and fetch.3 to reflect libfetch's actual use of CA bundles
2016-06-06 11:08:05 +00:00
ache
704e666406 MFC: r301115
Don't use fixup for C99 and up, the compiler result is already correct.

Suggested by: bde
2016-06-05 18:11:52 +00:00
ache
1040e2abb6 MFC: r301448
Reflect error indication according to POSIX and what those functions
currently do.
2016-06-05 16:21:53 +00:00
ache
29301f8121 MFC: r300956
1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and makes
reading hard.

2) Instead of doing range transformation in each and every function here,
do it single time directly in do_rand(). One "mod" operation overhead is not
a big deal, but the code looks nicer and possible future functions additions
or PRNG change do not miss range transformations neither have unneeded ones.

3) Use POSIX argument types for visible functions (cosmetic).
2016-06-05 14:31:36 +00:00
ache
199f286057 Prepare for merge of r300956. One year old r288030 which fix prototypes
can't be merged without conflicts and require merging of other versions
too and I don't want to go deep in that unmerged commits chain.
2016-06-05 14:04:54 +00:00
ache
4ab0fcf85b MFC: r300953
1) Unifdef USE_WEAK_SEEDING it is too obsolete to support and makes reading
harder.

2) ACM paper require seed to be in [1, 2^31-2] range, so use the same range
shifting as already done for rand(3). Also protect srandomdev() + TYPE_0 case
(non default) from negative seeds.

3) Don't check for valid "type" range in setstate(), it is always valid as
calculated. Instead add a check that rear pointer not exceeed end pointer.

MFC: r300965

Micro optimize: C standard guarantees that right shift for unsigned value
fills left bits with zero, and we have exact 32bit unsigned value
(uint32_t), so there is no reason to add "& 0x7fffffff" here.
2016-06-05 13:39:31 +00:00
bdrewery
fe5c6c0b6d MFC r300341:
FTS: Remove stale reference to nfs4 fs which was removed in r192578.
2016-06-04 17:40:23 +00:00
ache
ea8615c303 For EILSEQ case in mbsnrtowcs() and wcsnrtombs() update src to point to
the character after the one this conversion stopped at.

PR:     209907
Submitted by:   Roel Standaert <roel@abittechnical.com> (partially)
2016-06-03 07:34:59 +00:00
truckman
10ba6fd1f4 MFC r300666
Call closedir() before returning from fetchListFile() to avoid a leak.

Reported by:	Coverity
CID:		1016697
2016-06-01 17:45:00 +00:00
truckman
49dc8a6f53 MFC r300665
Don't leak addrinfo in fetch_bind()

Submitted by:	Coverity
CID:		1225038
2016-06-01 17:43:04 +00:00
truckman
aa1356cf24 MFC r300664
Fix Coverity CID 978183 Resource leak in rexec().

Close the socket if connect() fails to avoid leaking it.

Reported by:	Coverity
CID:		978183
2016-06-01 17:41:00 +00:00
truckman
fa7d0f23a5 MFC r300662
Fix Coverity CID 1016714 Resource leak in process_file_actions_entry()

Don't leak a file descriptor of _dup2() fails (shouldn't happen).

Reported by:	Coverity
CID:		1016714
2016-06-01 17:39:03 +00:00
truckman
c8f4518128 MFC r300660
Fix 1016718 Resource leak.

Don't leak a file descriptor if fchdir() fails.

Reported by:	Coverity
CID:		1016718
2016-06-01 17:37:16 +00:00
ian
0dfbd8e3cc MFC r297147, r297148, r297149, r297150, r297151:
Make both the loader and kernel use the interface-mtu option if the
  dhcp server provides it.  Made up of these (semi-)related changes...

  [kernel...] If the dhcp server provides an interface-mtu option, parse
  the value and set that mtu on the interface.

  [libstand...]

  Garbage collect the bswap routines from libstand, use sys/endian.h.

  If the dhcp server delivers an interface-mtu option, parse it and store
  the value in a new global intf_mtu for use by the application.

  [loader...]

  If the dhcp server provided an interface-mtu option, transcribe the value
  to the boot.netif.mtu env var, which will be picked up by pre-existing code
  in nfs_mountroot() and used to configure the interface accordingly.

PR:		187094
2016-05-31 17:01:54 +00:00
pfg
7465356524 MFC r300378:
libc/regex: fix two buffer underruns.

Fix some rather complex regex issues found on OpenBSD as part of some
ongoing work to fix a sed(1) bug.

Curiously the OpenBSD tests don't trigger segfaults on FreeBSD but the
bugs were confirmed by running a port of FreeBSD's regex under OpenBSD's
malloc. Huge thanks to Ingo for confirming the behavior.

Obtained from:	OpenBSD (CVS 1.20, 1.21)
2016-05-29 16:32:21 +00:00
jilles
8d3a984596 MFC r300420: vfork(2): Mention some risks of calling vfork() from
application code.
2016-05-29 12:16:58 +00:00
ache
c23d573f29 MFC: r300397
1) POSIX prohibits printing errors to stderr here and require
returning NULL:

"Upon successful completion, initstate() and setstate() shall return a
pointer to the previous state array; otherwise, a null pointer shall
be returned.

Although some implementations of random() have written messages to
standard error, such implementations do not conform to POSIX.1-2008."

2) Move error detections earlier to prevent state modifying.
2016-05-29 06:46:17 +00:00
delphij
91ba1b1e4e MFC r298192,299234,299238,299736:
file 5.27.
2016-05-28 06:17:35 +00:00
ken
b8b23f4368 MFC r300327:
------------------------------------------------------------------------
  r300327 | ken | 2016-05-20 13:30:52 -0600 (Fri, 20 May 2016) | 11 lines

  Add the density code for LTO-7 to libmt and the mt(1) man page.

  The density code and bits per mm values were obtained from an
  actual drive density report.

  The number of tracks were obtained from an LTO-7 hardware
  announcement on IBM's web site.
  ------------------------------------------------------------------------
Sponsored by:	Spectra Logic
2016-05-25 15:10:07 +00:00
truckman
eb959580b5 MFC r299948
Set retval in the empty password case to avoid a path through the
code that fails to set retval before falling through to the final
return().

Reported by:	emaste
Reported by:	Coverity
CID:		1018711
2016-05-23 05:14:26 +00:00
ngie
60eb189f71 MFC r299654:
Read the contents of the snapshot files properly

- Use fgetln instead of fgets; localize complexity related to fgetln(3)
  inside the loop.
- Skip over blank lines.
- Skip over lines (properly) that start with a "#"
2016-05-23 05:11:31 +00:00
truckman
b92c1d64bb MFC r299926
Hoist the getpwnam() call outside the first if/else block in
pam_sm_chauthtok().  Set user = getlogin() inside the true
branch so that it is initialized for the following PAM_LOG()
call.  This is how it is done in pam_sm_authenticate().

Reported by:	Coverity
CID:		272498
2016-05-23 05:11:08 +00:00
truckman
91fbd99e62 MFC r299922
Don't call free_addrselectpolicy(&policyhead) before policyhead has been
initialized.

Reported by:	Coverity
CID:		1018727
2016-05-23 05:07:13 +00:00
emaste
31e069a580 MFC r292000: Remove historical GNUC test
The requirement is for a GCC-compatible compiler and not necessarily
GCC itself. However, we currently expect any compiler used for building
the whole of FreeBSD to be GCC-compatible and many things will break if
not; there's no longer a need to have an explicit test for this in csu.
2016-05-20 19:14:15 +00:00
truckman
3e7c4636cf MFC r299879, r299880
r299879 | truckman | 2016-05-15 18:30:32 -0700 (Sun, 15 May 2016) | 7 lines

Likely a false positive ... but make sure that -1 can't be used as an
array index by splitting up a test.

r299880 | truckman | 2016-05-15 18:38:24 -0700 (Sun, 15 May 2016) | 8 lines

Since rdata is only used as an argument to the immediately following
call to res_nopt_rdata(), revert r299879 and fix CID 603941 by moving
	rdata = &buf[n];
inside the if block.

Reported by:	Coverity
CID:		603941
2016-05-20 07:18:33 +00:00
truckman
d47cdea453 MFC r299581
Use strlcpy() instead of strncpy() to ensure that qf->fsname is NUL
terminated.  Don't bother checking for truncation since the subsequent
stat() call should detect that and fail.

Reported by:	Coverity
CID:		1018189
2016-05-20 06:35:14 +00:00
bdrewery
e0e8a26b0e MFC r297947:
Build libpam modules in parallel.
2016-05-18 20:55:04 +00:00
kib
c3971ff45c MFC r298982:
Add EVFILT_VNODE open, read and close notifications.

MFC r298984:
Correct wording.
2016-05-16 02:42:53 +00:00
kib
ee7dae36d2 MFC r298922:
Issue NOTE_EXTEND when a directory entry is added to or removed from
the monitored directory as the result of rename(2) operation.  The
renames staying in the directory are not reported.
2016-05-16 02:23:58 +00:00
ngie
999fa1c6e0 MFC r298839:
Fix memory allocation edgecases in kvm_argv(..)

- Don't leak nbufp on realloc failure in kvm_argv
- Catch malloc errors with bufp
- Set buflen last in the "buflen == 0" case to ensure that
  bufp/nbufp is properly reallocated on the next go around
2016-05-13 09:52:39 +00:00
ngie
4b32d6fd17 MFC r298842:
Don't leak PML4 in _amd64_initvtop(..) if kvm_read2(..) fails

CID: 1341474
2016-05-13 09:49:52 +00:00
kib
4f8ce4509a MFC r299114:
Do not leak THR_FLAGS_SUSPENDED from the previous suspend/resume
cycle.

PR:	209233
2016-05-12 06:53:22 +00:00
delphij
474ac0fbf4 Revert r298920 until we have addressed all known regressions on head/ after
settle.  file is now downgraded to 5.25.

PR:		bin/209211
Requested by:	Tomoaki AOKI
Relnotes:	yes
2016-05-08 18:09:30 +00:00
kib
1e1c6951b0 MFC r298898:
Explain NOTE_LINK reporting for the directories.
2016-05-08 09:08:05 +00:00
bcr
344a285d78 MFC r298893:
Provide an example to the kqueue man page, showing
a basic usage example.  Although it is an
untypical example for the use of kqueue, it is
better than nothing and should get people started.

PR:		196844
Submitted by:	fernando.apesteguia@gmail.com
Reviewed by:	kib
Approved by:	kib
Differential Revision:  https://reviews.freebsd.org/D6082
2016-05-06 17:55:11 +00:00