Commit Graph

20422 Commits

Author SHA1 Message Date
Baptiste Daroussin
d567f909ef Add native support for zstd to libarchive
Note that old pkg will failed to build after this. A recent ports tree (one
providing pkg 1.12+) is required to build. Older already built pkg, should
continue working as expected

PR:		238797
Exp run by:	antoine
Reviewed by:	cem
Approved by:	cem
Differential Revision:	https://reviews.freebsd.org/D20752
2019-09-18 07:57:56 +00:00
Konstantin Belousov
55894117b1 Return EISDIR when directory is opened with O_CREAT without O_DIRECTORY.
Reviewed by:	bcr (man page), emaste (previous version)
PR:	240452
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
DIfferential revision:	https://reviews.freebsd.org/D21634
2019-09-17 18:32:18 +00:00
Andriy Gapon
8569a95e76 fixup up fallout from r352447 in libbe
I totally forgot that we now have another in-tree consumer of libzfs.

MFC after:	3 days
X-MFC with:	r352447
2019-09-17 14:15:48 +00:00
Konstantin Belousov
505a58ec45 Increase the size of the send and receive buffers for YP client rpc
calls to max allowed UDP datagram size.

Since max allowed size both for keys and values where increased, the
old sizes of around 1K cause ypmatch(3) failures, while plain maps
fetches work.

The buffers were reduced in r34146 from default UDP rpcclient values
to 1024/2304 due to the key and value size being 1K.

Reviewed by:	slavash
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D21586
2019-09-16 06:42:01 +00:00
Li-Wen Hsu
5d1f74b63d Improve the description of big5(5)
- Fix the statement that big5 is a de facto standard of Traditional Chinese
  text [1]
- Add a BUGS section describes the problem of big5 and suggests use utf8

PR:		189095
Submitted by:	Brennan Vincent <brennan@umanwizard.com> [1]
Reviewed by:	Ting-Wei Lan <lantw44@gmail.com>
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21622
2019-09-14 08:15:16 +00:00
Chuck Silvers
090a3ea3c2 Add a "count_until_fail" option to gnop, which says to start failing
I/O requests after the given number have been allowed though.

Approved by:    imp (mentor)
Reviewed by:    rpokala kib 0mp mckusick
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D21593
2019-09-13 23:03:56 +00:00
Baptiste Daroussin
8156570000 Update libedit to a snapshot from 2019-09-10
This version bring many fixes regarding unicode support
It also adds proper support for filename completion (we do not need our custom
patches anymore)
Improves the libreadline compatibility

Note that the same work was done by Yuichiro Naito in
https://reviews.freebsd.org/D21196 the main difference is in this case we have
reimported libedit in contrib to fix a long standing mess in the previous merges
which prevented a proper update workflow. (discussed long ago with pfg@)

The only difference with upstream libedit is we have added a compatibility shim
for the _elf_fn_sh_complete function which we previously added to support quoting
in filename completion and is not needed anymore.
This was added to continue supported old /bin/sh binaries and not break backward
compatibility (as discussed with jilles@)

Reviewed by:	Yuichiro Naito <naito.yuichiro_gmail.com>
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D21584
2019-09-13 06:50:02 +00:00
Leandro Lupori
52b05d6607 [PPC64] Add ifunc support in libcsu
When ifuncs are used in statically linked binaries, the C runtime
must perform the needed dynamic relocations, to make calls to ifuncs
work correctly.

Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D21070
2019-09-12 16:45:07 +00:00
Alan Somers
8d910a4282 getsockopt.2: clarify that SO_TIMESTAMP is not 100% reliable
When SO_TIMESTAMP is set, the kernel will attempt to attach a timestamp as
ancillary data to each IP datagram that is received on the socket. However,
it may fail, for example due to insufficient memory. In that case the
packet will still be received but not timestamp will be attached.

Reviewed by:	kib
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21607
2019-09-11 19:48:32 +00:00
Brooks Davis
1b0711bd7f Avoid the use of the non-portable -D argument to ls.
This was used to store the mtime of the source file in a commment in a
generated header file.  This is of little-to-no diagnostic value and
the result doesn't even end up in the source tree.

Reported by:	arichardson
Reviewed by:	arichardson
MFC after:	1 days
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21605
2019-09-11 17:01:31 +00:00
Mariusz Zaborski
a0ddf79987 gnop: Fix initial value for the wdelayprob
Reported by:	Chuck Silvers <chuq@chuq.com>
2019-09-10 20:27:44 +00:00
Leandro Lupori
8024ba45db Add powerpc support to libkvm probe function
PowerPC kernels are of DYN type, instead of EXEC.

Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D21583
2019-09-10 18:46:32 +00:00
Baptiste Daroussin
b3f9b73820 In FreeBSD 11 localedef(1) has replaced the mklocale(1) and colldef(1)
tools to generate the locales data. state it in the libc manpages.

MFC after:	3 days
2019-09-10 07:47:52 +00:00
Kristof Provost
d4402ecd3b csu: Add the riscv .init call sequence
Reviewed by:	br
Sponsored by:	Axiado
Differential Revision:	https://reviews.freebsd.org/D21537
2019-09-09 16:25:09 +00:00
Mitchell Horne
d1bc2d79f2 Fix cpuwhich_t column width
Not bumping .Dd since this is purely a format change.

Approved by:	markj (mentor)
2019-09-08 21:37:52 +00:00
Cy Schubert
4effc02129 Bounds check again after advancing cp, otherwise we have a possible
heap buffer overflow. This was discovered by a Google fuzzer test.
This can lead to remote denial of service. User interaction and
execution privileges are not a prerequisite for exploitation.

Reported by:	enh at Google, to FreeBSD by maya@NetBSD.org
Obtained from:	enh at Google
See also:	NetBSD ns_name.c r1.12
Reviewed by:	delphij, ume
MFC after:	3 days
	https://android-review.googlesource.com/c/platform/bionic/+/1093130
Differential Revision:	https://reviews.freebsd.org/D21523
2019-09-05 19:35:30 +00:00
Adrian Chadd
7e7c290154 [lib80211] add initial VHT (11ac) channel ranges for FCC.
This is a simple set of VHT channels and flags for the FCC (US) regulatory
domain.  This needs to be researched and done for the rest of the
regulatory domains, but this should at least unblock some more ath10k
testing.
2019-09-05 15:55:24 +00:00
Emmanuel Vadot
4c1a82cea5 pkgbase: Create a FreeBSD-utilities package and make it the default one
The default package use to be FreeBSD-runtime but it should only contain
binaries and libs enough to boot to single user and repair the system, it
is also very handy to have a package that can be tranform to a small mfsroot.
So create a new package named FreeBSD-utilities and make it the default one.
Also move a few binaries and lib into this package when it make sense.
Reviewed by:	bapt, gjb
Differential Revision:	https://reviews.freebsd.org/D21506
2019-09-05 14:15:47 +00:00
Emmanuel Vadot
a7b5a3d486 pkgbase: Put a lot of binaries and lib in FreeBSD-runtime
All of them are needed to be able to boot to single user and be able
to repair a existing FreeBSD installation so put them directly into
FreeBSD-runtime.

Reviewed by:    bapt, gjb
Differential Revision:  https://reviews.freebsd.org/D21503
2019-09-05 14:13:08 +00:00
Emmanuel Vadot
df347c8a2e pkgbase: Put libbluetooth in the bluetooth package
It make sense to have everything bluetooth related in the same package.
Reviewed by:	bapt, gjb
Differential Revision:	https://reviews.freebsd.org/D21502
2019-09-05 14:11:16 +00:00
Emmanuel Vadot
724fad3ad0 pkgbase: Move libcap_ to FreeBSD-runtime
A lot of binaries present in FreeBSD-runtime depend on it so move
the libs there.

Reviewed by:	bapt, gjb
Differential Revision:	https://reviews.freebsd.org/D21501
2019-09-05 14:10:26 +00:00
Emmanuel Vadot
034a4717aa pkgbase: Tag passwd related file to be in FreeBSD-runtime package.
Reviewed by:	bapt, gjb
Differential Revision:	https://reviews.freebsd.org/D21500
2019-09-05 14:09:33 +00:00
Emmanuel Vadot
8d250cb461 pkgbase: lib80211 is needed by ifconfig(8) so put it in FreeBSD-runtime
Reviewed by:	bapt, gjb
Differential Revision:	https://reviews.freebsd.org/D21497
2019-09-05 14:06:48 +00:00
Sevan Janiyan
08509077b3 Adjust history, info source from v1's manuals
https://www.bell-labs.com/usr/dmr/www/1stEdman.html

MFC after:	5 days
2019-09-04 13:44:46 +00:00
Kyle Evans
ef03f57dd2 Allow more nesting of GEOM partitioning schemes
GEOM is supposed to be topology-agnostic, but the GPT and BSD partition code
has arbitrary restrictions on nesting that are annoying in cases such as
running VMs on raw partitions (since the VM's partitioning scheme is not
visible to the host).

This patch adds sysctls to disable the restrictions except in the case of
BSD label (and similar) partitions with offset 0 (where we need to avoid
recursively recognizing the label).

Submitted by:	Andrew Gierth
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21350
2019-09-03 20:57:20 +00:00
Konstantin Belousov
fe69291ff4 Add procctl(PROC_STACKGAP_CTL)
It allows a process to request that stack gap was not applied to its
stacks, retroactively.  Also it is possible to control the gaps in the
process after exec.

PR:	239894
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D21352
2019-09-03 18:56:25 +00:00
Mateusz Guzik
d05b53e0ba Add sysctlbyname system call
Previously userspace would issue one syscall to resolve the sysctl and then
another one to actually use it. Do it all in one trip.

Fallback is provided in case newer libc happens to be running on an older
kernel.

Submitted by:	Pawel Biernacki
Reported by:	kib, brooks
Differential Revision:	https://reviews.freebsd.org/D17282
2019-09-03 04:16:30 +00:00
Ed Maste
6b62f42434 libc: Use musl's optimized memchr
Parentheses added to HASZERO macro to avoid a GCC warning.

Reviewed by:	kib, mjg
Obtained from:	musl (snapshot at commit 4d0a82170a)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17631
2019-09-02 13:56:44 +00:00
Mateusz Guzik
ebea9e6d8f libutil: remove SIGSYS handling from setusercontext
It was a workaround for cases where the kernel lacks setloginclass(2),
added in the 9.x era.

Submitted by:	Pawel Biernacki
2019-09-02 13:55:31 +00:00
Kyle Evans
4b3b82a756 mips: fix some mcount nits
The symbol version for _mcount was removed 12 years ago in r169525 from
gmon/Symbol.map, to be added to the per-arch Symbol.map. mips was overlooked
in this, so _mcount has no symver. Add it back to where it should have been,
rather than where it would go if it were added today, since we're correcting
a historical mistake.

Additionally, _mcount is getting thrown into .mdebug.abi32 in the llvm80/90
world as it's not getting explicitly thrown into .text, so do this now. This
fixes the libc build that was previously failing due to relocations in
.mdebug.abi32. This is specifically due to the way clang's integrated AS
works and that they emit the .mdebug.abiNN section early in the process. An
LLVM bug has been submitted[0] and an agreement has been made that the
mips backend should switch to .text following .mdebug.abiNN for
compatibility.

[0] https://bugs.llvm.org/show_bug.cgi?id=43119

Reviewed by:	imp, arichardson
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21435
2019-09-02 01:55:55 +00:00
Mark Johnston
08cfa56ea3 Extend uma_reclaim() to permit different reclamation targets.
The page daemon periodically invokes uma_reclaim() to reclaim cached
items from each zone when the system is under memory pressure.  This
is important since the size of these caches is unbounded by default.
However it also results in bursts of high latency when allocating from
heavily used zones as threads miss in the per-CPU caches and must
access the keg in order to allocate new items.

With r340405 we maintain an estimate of each zone's usage of its
(per-NUMA domain) cache of full buckets.  Start making use of this
estimate to avoid reclaiming the entire cache when under memory
pressure.  In particular, introduce TRIM, DRAIN and DRAIN_CPU
verbs for uma_reclaim() and uma_zone_reclaim().  When trimming, only
items in excess of the estimate are reclaimed.  Draining a zone
reclaims all of the cached full buckets (the previous behaviour of
uma_reclaim()), and may further drain the per-CPU caches in extreme
cases.

Now, when under memory pressure, the page daemon will trim zones
rather than draining them.  As a result, heavily used zones do not incur
bursts of bucket cache misses following reclamation, but large, unused
caches will be reclaimed as before.

Reviewed by:	jeff
Tested by:	pho (an earlier version)
MFC after:	2 months
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D16667
2019-09-01 22:22:43 +00:00
Ed Maste
7381dcc9ee libc: remove gets
gets is unsafe and shouldn't be used (for many years now).  Leave it in
the existing symbol version so anything that previously linked aginst it
still runs, but do not allow new software to link against it.

(The compatability/legacy implementation must not be static so that
the symbol and in particular the compat sym gets@FBSD_1.0 make it
into libc.)

PR:		222796 (exp-run)
Reported by:	Paul Vixie
Reviewed by:	allanjude, cy, eadler, gnn, jhb, kib, ngie (some earlier)
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12298
2019-09-01 16:12:05 +00:00
Li-Wen Hsu
24612bfd1f Unskip test cases from netbsd-tests by defining __HAVE_FENV
This unskips:
  - lib.libc.stdlib.strtod_test.strtod_round
  - lib.msun.fe_round_test.t_nofe_round

In lib/msun/tests/Makefile only define on fe_round_test.c because
lib.msun.ilogb_test.ilogb will get wrong results and needs more examination.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-08-31 20:45:45 +00:00
Mark Johnston
f4e05cc55d Document fetchReqHTTP().
Submitted by:	Farhan Khan <khanzf@gmail.com>
Reviewed by:	0mp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18788
2019-08-28 17:01:28 +00:00
Edward Tomasz Napierala
5a38af1fb8 Introduce <sys/qmath.h>, a fixed-point math library from Netflix.
This makes it possible to perform mathematical operations
on
fractional values without using floating point. It operates on Q
numbers, which are integer-sized, opaque structures initialized
to hold a chosen number of integer and fractional
bits.


For a general description of the Q number system, see the "Fixed Point
Representation & Fractional Math" whitepaper[1]; for the actual
API see the qmath(3) man page.

This is one of dependencies for the upcoming stats(3) framework[2]
that will be applied to the TCP stack in a later commit.

1. https://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf
2. https://reviews.freebsd.org/D20477

Reviewed by:	bcr (man pages, earlier version), sef (earlier version)
Discussed with:	cem, dteske, imp, lstewart
Sponsored By:	Klara Inc, Netflix
Obtained from:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20116
2019-08-27 11:46:22 +00:00
Li-Wen Hsu
877b6cbba1 lib.libc.gen.getmntinfo_test.getmntinfo_test is unstable since 8/20, skip it
in CI env temporarily for more offline diagnosis

PR:		240049
Sponsored by:	The FreeBSD Foundation
2019-08-23 05:25:21 +00:00
Kyle Evans
e21f96a811 mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUM
machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via
machine/reg.h. Many of the regnum definitions are too short and too generic
to be exposing to any userland application including one of these two
headers. Moreover, these actively cause build failures in googletest
(template <typename T1 ...> expanding to template <typename 9 ...>).

Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of
the userland consumers to define as needed.

Discussed with:	imp, jhb
Reviewed by:	imp, jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21330
2019-08-22 21:43:21 +00:00
Kyle Evans
e3c148ee94 libc: mips: remove unused longjmp.c
Reviewed by:	imp, jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21330
2019-08-22 21:40:56 +00:00
Konstantin Belousov
65174f684c Fix _pthread_cancel_enter() and _pthread_cancel_leave() jmptable entries.
PR:	240022
Reported by:	Andrew Gierth <andrew@tao11.riddles.org.uk>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2019-08-21 19:53:50 +00:00
Bryan Drewery
dc89d06976 Rework r339635 to fix .depend.tables.h handling.
Avoid touching the tables.h file unless it has changed to avoid unneeded
rebuilds.

Also revert r350301's explicit dependencies.

Reviewed by:	emaste
MFC after:	2 weeks
X-MFC-With:	r339635 (kevans request)
PR:		238828
Sponsored by:	DellEMC
Differential Revision:	https://reviews.freebsd.org/D21295
2019-08-16 22:34:10 +00:00
Ed Maste
3afdc7303c Add @generated tag to libc syscall asm wrappers
Although libc syscall wrappers do not get checked in this can aid in
finding the source of generated files when spelunking in the objdir.

Multiple tools use @generated to identify generated files (for example,
in a review Phabricator will by default hide diffs in generated files).
For consistency use the @generated tag in makesyscalls.sh as we've done
for other generated files, even though these wrappers aren't checked in
to the tree.
2019-08-16 14:14:57 +00:00
Matt Macy
86b5e013ed pmc: restore "unhalted-cycles" alias
Reported by:	mav@
2019-08-15 21:51:11 +00:00
Kyle Evans
a78c1027d7 Revert r351078, r351085: stand/quad.h eviction
It did not go well; further examination is required...
2019-08-15 17:15:32 +00:00
Kyle Evans
14a286867e libc quad.h: one last _STANDALONE correction 2019-08-15 16:28:05 +00:00
Kyle Evans
7ddaee2559 stand: kick out quad.h
Use quad.h from libc instead for the time being. This reduces the number of
nearly-identical-quad.h we have in tree to two with only minor changes.

Prototypes for some *sh*di3 have been added to match the copy in libkern.
The differences between the two are likely few enough that they can perhaps
be merged with little additional effort to bring us down to 1.

MFC after:	3 days
2019-08-15 15:47:48 +00:00
Ed Maste
ea0a30b145 compiler-rt: enable __bswapsi2/__bswapdi2 for RISC-V
As with other archs the compiler may emit calls to the byte swap routines
under certain conditions.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-08-14 18:41:28 +00:00
Konstantin Belousov
6b462d2762 Increase YPMAXRECORD to 16M to be compatible with Linux.
Since YP protocol definition uses the constant to declare
variable-size opaque byte strings, the change should be binary
compatible with existing installations which do not expose keys or
values larger than 1024 bytes.

All uses of local variables with YPMAXRECORD sizes were removed to
avoid insane stack use.  On the other hand, variables with static
lifetime should be fine and only result in increased VA use.

Glibc made same change, increasing the allowed length for keys and
values in YP to 16M, in 2013.

Reviewed by:	markj
Discussed with:	ian
Sponsored by:	Mellanox Technologies
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D20900
2019-08-12 20:27:33 +00:00
Konstantin Belousov
a60c863ced wait(2): clarify reparenting of children of the exiting process.
Point to the existence of reapers and mention that init is the default
reaper.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2019-08-11 15:47:48 +00:00
Konstantin Belousov
cd6a6b772d wait(2): split long line by using .Fo/.Fa instead of .Ft.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2019-08-11 15:44:36 +00:00
Brandon Bergren
bdccf0bbac Implement _umtx_op_err.S on powerpc / powerpc64.
As per r177853, we need to avoid using errno inside user mutex code, since
 signal handlers can interfere with it and mess up libthr internal state.

So, implement _umtx_op_err() instead, which makes a raw syscall and
returns the error value directly instead of using errno.

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D20946
2019-08-09 20:16:38 +00:00