Commit graph

21559 commits

Author SHA1 Message Date
Felix Johnson
c834258459 uuid(3): Document return values
PR:		204449
Reported by:	Michael Cress <michael.cress@cress.us>

(cherry picked from commit f6842865d3)
2021-11-21 19:43:31 -05:00
Steve Kargl
4ac2d43111 Implementations of cexpl()
PR:	216862

(cherry picked from commit 046e2d5db1)
2021-11-10 21:36:20 +02:00
Dimitry Andric
188a951735 Partially revert ac76bc1145 because it is no longer necessary
In ac76bc1145, I added a few volatiles to work around ctrig_test
failures with {inf,inf}. This is not necessary anymore now, since in
3b00222f15 we added -fp-exception-behavior=maytrap for clang >= 10 in
libm's Makefile. (The flag tells clang to use stricter floating point
semantics, which libm depends on.)

PR:		244732, 254911
Fixes:		ac76bc1145

(cherry picked from commit e2157cd000)
2021-11-08 22:00:47 +01:00
Steve Kargl
ced974a7b0 cosl(): fix polynomial approximation coefficients for ld128 version
PR:	218514

(cherry picked from commit 6d04e1422e)
2021-11-08 03:49:45 +02:00
Konstantin Belousov
9de9a33050 fexecve(2): allow O_PATH file descriptors opened without O_EXEC
(cherry picked from commit be10c0a910)
2021-11-06 04:12:33 +02:00
Dimitry Andric
344691934f llvm BPF target: add missed source files
Otherwise, linking llvm binaries with this target enabled (which is not
the default) will fail with a number of undefined symbol errors:

  ld: error: undefined symbol: llvm::initializeBPFAdjustOptPass(llvm::PassRegistry&)
  ld: error: undefined symbol: llvm::initializeBPFCheckAndAdjustIRPass(llvm::PassRegistry&)
  ld: error: undefined symbol: llvm::createBPFCheckAndAdjustIR()
  ld: error: undefined symbol: llvm::createBPFAdjustOpt()
  ld: error: undefined symbol: llvm::BPFAdjustOptPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&)

Reported by:	Michael Dexter <editor@callfortesting.org>

(cherry picked from commit d30dc78f79)
2021-11-05 17:10:14 +01:00
Steve Kargl
5033d0b56f sinpi[fl] etc: Fix the ld128 implementations
PR:	218514

(cherry picked from commit 4f889260c3)
2021-11-02 03:16:29 +02:00
Steve Kargl
8b231404a1 sinpi,cospi,tanpi: float.h needed for week reference
PR:	218514

(cherry picked from commit 3bfc837685)
2021-11-02 03:16:29 +02:00
Steve Kargl
6207f135e9 lib/msun: Move the files to appropriate locations in the Makefile
(cherry picked from commit ca3d8cb087)
2021-11-02 03:16:29 +02:00
Konstantin Belousov
897800f8b6 lib/msun/ld128/s_tanpil.c: make it compile.
(cherry picked from commit 6312d14461)
2021-11-02 03:16:29 +02:00
Steve Kargl
a49617abb0 [LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl]
PR:	218514

(cherry picked from commit dce5f3abed)
2021-11-02 03:16:29 +02:00
Konstantin Belousov
cfccf3baca libutil: add kinfo_getswapvmobject(3)
(cherry picked from commit f2069331e5)
2021-11-01 02:44:51 +02:00
Konstantin Belousov
c802b970a5 procctl: actually require debug privileges over target
(cherry picked from commit f5bb6e5a6d)
2021-10-26 05:26:27 +03:00
Konstantin Belousov
2e69ba48b9 procctl(2): add consistent shortcut P_ID:0 as curproc
(cherry picked from commit f833ab9dd1)
2021-10-26 05:26:26 +03:00
Mark Johnston
589daa05be Revert "libc/locale: Fix races between localeconv(3) and setlocale(3)"
This reverts commit f89204d6b9.

I didn't intend to push this commit yet, pending discussion on PR
258360.

PR:	258360
2021-10-19 21:13:12 -04:00
Mark Johnston
f89204d6b9 libc/locale: Fix races between localeconv(3) and setlocale(3)
Each locale embeds a lazily initialized lconv which is populated by
localeconv(3) and localeconv_l(3).  When setlocale(3) updates the global
locale, the lconv needs to be (lazily) reinitialized.  To signal this,
we set flag variables in the locale structure.  There are two problems:

- The flags are set before the locale is fully updated, so a concurrent
  localeconv() call can observe partially initialized locale data.
- No barriers ensure that localeconv() observes a fully initialized
  locale if a flag is set.

So, move the flag update appropriately, and use acq/rel barriers to
provide some synchronization.  Note that this is inadequate in the face
of multiple concurrent calls to setlocale(3), but this is not expected
to work regardless.

Thanks to Henry Hu <henry.hu.sh@gmail.com> for providing a test case
demonstrating the race.

PR:		258360
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7eb138a9e5)
2021-10-19 20:53:33 -04:00
John Baldwin
e9b5d2443f sysdecode_enum.3: Fix a typo: SIGBTRAP -> SIGTRAP.
Sponsored by:	DARPA

(cherry picked from commit 680d70b59e)
2021-10-19 16:53:35 -07:00
Greg V
1625e2db22 O_PATH: allow vfs_extattr syscalls
(cherry picked from commit 98dae405de)
2021-10-16 16:01:47 +03:00
Mitchell Horne
3c01f74150 libpmc: add some AMD pmu counter aliases
Make it mostly compatible with what's defined for Intel. Except where
noted, these are defined for all of amdzen(1|2|3).

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32162

(cherry picked from commit a20c10893e)
2021-10-15 12:21:36 -03:00
Mitchell Horne
89f1b82a85 libpmc: fix the 'cycles' event alias on x86
Looking for "tsc-tsc" in the pmu tables will fail every time. Instead,
make this an alias for the static TSC event defined in pmc_events.h.
This fixes 'pmcstat -s cycles' on Intel and AMD.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32197

(cherry picked from commit 937539e0a3)
2021-10-15 12:21:35 -03:00
Felix Johnson
a9077f3e0c login.conf.5: Mark passwordtime as implemented
login.conf.5 listed passwordtime in RESERVED CAPABILITIES, which is a
section for capabilities not implemented in the base system. However,
passwordtime has been implemented in the base for several years now.

PR:		246099
Reported by:	avg
Reviewed by:	0mp
MFC after:	3 days

(cherry picked from commit e7f8f3b95e)
2021-10-15 15:14:53 +02:00
Jessica Clarke
94bbe32a44 libgcc_s: Export 64-bit int to 128-bit float functions
The corresponding 32-bit int and 128-bit int functions were added in
790a6be5a1, as were all combinations of the float to int functions,
but these two were overlooked. __floatditf is needed to build curl for
riscv as there's a signed 64-bit int to 128-bit float conversion in
lib/progress.c's trspeed as of 7.77.0.

Reviewed by:	dim
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31997

(cherry picked from commit 7047568821)
2021-10-10 14:36:52 +01:00
Jessica Clarke
d7b3f3c84e libc: Fix build on case-insensitive file systems
On case-insensitive file systems (most likely to be seen on macOS, where
it is the default), _Fork.o for the new POSIX _Fork function conflicts
with _fork.o for the PSEUDO file. This results in non-determinsitic
behaviour in terms of which ends up being present; if _Fork.o wins then
the build fails to link libc.so due to missing __sys_fork, and if
_fork.o wins then libc silently fails to include the implementation of
_Fork. A similar issue occurred in the past for C99's _Exit conflicting
with exit(2) and was fixed in cb1cb6a2a8, so this adds a fix based on
that.

As a longer-term solution it might be better to instead make the
generated files use a different prefix that's less likely to conflict
with other things (such as __sys_foo.o given they always contain that)
but that's a rather more invasive change.

Fixes:	49ad342cc1 ("Add _Fork()")
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31895

(cherry picked from commit 877175a17a)
2021-10-10 14:33:52 +01:00
Konstantin Belousov
156db35573 readlinkat(2): allow O_PATH fd
PR:	258856

(cherry picked from commit 5fb54d2fc8)
2021-10-10 12:22:58 +03:00
Konstantin Belousov
8c384596a8 Fix mistakes in link(2) and shm_open(2)
PR:	258957

(cherry picked from commit 8d3cd7767a)
2021-10-10 12:21:18 +03:00
Adam Fenn
2524e9bd82 libc: vDSO timekeeping: Add pvclock support
(cherry picked from commit a3d932dfef)
2021-10-10 12:21:17 +03:00
Konstantin Belousov
8e915bdea5 libthr(3): explain some internals of the locks implementation
(cherry picked from commit f5b9747075)
2021-10-08 03:42:38 +03:00
Kristof Provost
c5a340e864 pfctl: userspace adaptive syncookies configration
Hook up the userspace bits to configure syncookies in adaptive mode.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32136

(cherry picked from commit 5062afff9d)
2021-10-06 10:46:54 +02:00
Kyle Evans
a663c839ff libc: ssp: sprinkle around some __dead2
This is consistent with, e.g., NetBSD's implementation, which declares
these as noreturn in ssp/ssp.h.

(cherry picked from commit 5487294d79)
2021-10-06 02:14:42 -05:00
Kyle Evans
188c088fe3 jail(3lua): add jail.attach()/jail.remove() methods
These aren't a part of or use libjail(3), but rather are direct
syscalls.  Still, they seem like good additions, allowing us to attach
to already-running jails.

(cherry picked from commit a6499c56ab)
2021-10-06 02:13:27 -05:00
Kyle Evans
44175ec8ce jail(3lua): add a jail.list() method
This is implemented as an iterator, reusing parts of the earlier logic
to populate jailparams from a passed in table.

The user may request any number of parameters to pull in while we're
searching, but we'll force jid and name to appear at a minimum.

(cherry picked from commit 6a7647eccd)
2021-10-06 02:13:23 -05:00
Kyle Evans
b7e90b290a kqueue: document how timers with low/past timeouts are handled
(cherry picked from commit 4b5554cebb)
2021-10-06 02:04:00 -05:00
Konstantin Belousov
288a478401 pidfile test: guarantee nul termination of the read pid string
PR:	258701

(cherry picked from commit 364790beaf)
2021-10-01 03:32:22 +03:00
Andrew Turner
c30a7ae638 Add arm64 ifunc support in static binaries
Add support for the R_AARCH64_IRELATIVE relocation type in static
binaries on arm64. This is based on the powerpc code, updating it to
use the arm64 resolver ABI, and use the arm64 relocation type.

Tested by:	brd
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31641

(cherry picked from commit bc5304a006)
2021-09-27 10:55:16 +01:00
Vincenzo Maffione
5faf08808d libnetmap: reset errno in nmreq_register_decode()
The reset is necessary at the beginning of the function, because of
the errno logic in the error path (set errno to EINVAL if not set).
If errno is already set when calling the function, and the function
fails, the previous errno value will be inherited.

(cherry picked from commit ab639bb287)
2021-09-26 14:11:59 +00:00
Konstantin Belousov
d4a478c270 procctl(2): Add PROC_WXMAP_CTL/STATUS
(cherry picked from commit 796a8e1ad1)
2021-09-24 03:26:59 +03:00
Edward Tomasz Napierala
e79a18dadf procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS
(cherry picked from commit db8d680ebe)
2021-09-24 03:26:59 +03:00
Daniel Kolesa
037c2f4fe3 libfetch: use more portable getline() interface
this is for better portability in order to avoid using a function
which is BSD-only or available via libbsd

(cherry picked from commit ee3ca711a8)
(cherry picked from commit 635eb7ac79)
2021-09-22 11:57:35 +02:00
Dimitry Andric
b2cfac207d compiler-rt: add aarch64 init function for LSE atomics
As reported by Ronald, adding the out-of-line LSE atomics helpers for
aarch64 to compiler-rt was not sufficient to link programs using these,
as they also require a __aarch64_have_lse_atomics global. This is
initialized in compiler-rt's lib/builtins/cpu_model.c, roughly similar
to the x86 CPU model and feature detection in that file.

Since upstream does not yet have a FreeBSD specific implementation for
getting the required information, add a simple one that should work for
now, while I try to get it sorted with the LLVM people.

Reported by:	Ronald Klop <ronald-lists@klop.ws>
Fixes:		cc55ee8009
PR:		257392

(cherry picked from commit efe67f33c3)
2021-09-21 20:17:05 +02:00
Ed Maste
f8c4000ca6 libprocstat: extend zfs_defs hack for .pieo
By default _pie.a archives are built only for INTERNALLIBs, so there is
usually no need for zfs_defs.pieo to exist.  However, some experimental
work builds _pie.a archives for everything.  Extend the existing set of
zfs_defs hacks to build zfs_defs.pieo as well.

Reviewed by:	arichardson
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31924

(cherry picked from commit b9df18d6e8)
2021-09-19 21:28:26 -04:00
Alexander Motin
c8f2af5f5d geli(8): Do not report error on resize to the same size.
Just validate the old metadata and exit.  Originally the check was
added to not thash the only copy of metadata, but we can achieve the
same just by skipping the writing/trashing.  The metadata validation
should protect user from wrongly specifying new size instead of old.

MFC after:	1 month
Sponsored by:	iXsystems, Inc.

(cherry picked from commit c7cf100aaf)
2021-09-16 21:39:07 -04:00
Mark Johnston
ad9f3a91d5 libc: Use the initial-exec TLS model
This permits more efficient accesses of thread-local variables, which
are heavily used at least by jemalloc and locale-aware code.  Note that
on amd64 and i386, jemalloc's thread-local variables already have their
TLS model overridden by defining JEMALLOC_TLS_MODEL.

For now the change is applied only to tested platforms, but should in
principle be enabled everywhere.

PR:		255840
Suggested by:	jrtc27
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9c97062b62)
2021-09-14 08:50:53 -04:00
Mark Johnston
603c9bb029 kqueue.2: Document the fact that EVFILT_READ can be used on kqueues
Reviewed by:	bcr, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f756c91168)
2021-09-14 08:50:31 -04:00
Warner Losh
5918f48652 clock_gettime: Add Linux aliases for CLOCK_*
Linux standardized what we call CLOCK_{REALTIME,MONOTONIC}_FAST as
CLOCK_{REALTIME,MONOTONIC}_COARSE. In addition, Linux spells
CLOCK_UPTIME as CLOCK_BOOTTIME.

Add aliases to time.h and document these new aliases in
clock_gettime(2).

Reviewed by:		vangyzen, kib (prior), dchagin (prior)
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30988

(cherry picked from commit 155f15118a)
2021-09-12 09:56:16 -06:00
Martin Matuska
aef1ff87fe libarchive: import changes from upstream
Libarchive 3.5.2

New features:
  PR #1502: Support for PWB and v7 binary cpio formats
  PR #1509: Support of deflate algorithm in symbolic link decompression
            for ZIP archives

Important bugfixes:
  IS #1044: fix extraction of hardlinks to symlinks
  PR #1480: Fix truncation of size values during 7zip archive
            extraction on 32bit architectures
  PR #1504: fix rar header skiming
  PR #1514: ZIP excessive disk read - fix location of central directory
  PR #1520: fix double-free in CAB reader
  PR #1521: Fixed leak of rar before ending with error
  PR #1530: Handle short writes from archive_write_callback
  PR #1532: 7zip: Use compression settings from file also for file header
  IS #1566: do not follow symlinks when processing the fixup list

Relnotes:	yes

(cherry picked from commit ddce862ad8)
2021-09-10 10:24:13 +02:00
Jessica Clarke
b20eb96fe8 clang: Build with -fno-strict-aliasing when using GCC
Somewhat ironically, there are strict aliasing violations in Clang,
which can result in the following assertion failure:

  Assertion `*(NamedDecl **)&Data == ND && "PointerUnion mangles the NamedDecl pointer!"' failed.

Upstream's clang/CMakeLists.txt specifically (not LLVM as a whole)
passes -fno-strict-aliasing if the compiler is not Clang, and this fixes
the above issue.

This was seen when cross-building from Linux using a bootstrap
compiler, but likely also affects worlds built with a new enough
external GCC toolchain.

MFC after:	1 week
Reviewed by:	dim
Differential Revision:	https://reviews.freebsd.org/D31533

(cherry picked from commit c1f7d8dd23)
2021-09-07 13:08:19 +01:00
Jessica Clarke
5ef9ae5c6d clang: Fix inverted condition in llvm.build.mk
Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week

(cherry picked from commit 5ff5d1177b)
2021-09-07 13:08:17 +01:00
Jessica Clarke
c69a739379 riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep
PR:	256905
Reviewed by:	arichardson, mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30963

(cherry picked from commit 348c41d181)
2021-09-07 13:06:44 +01:00
Kristof Provost
d1d99d7575 libpfctl: Implement DIOCGETSTATUS wrappers
MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31696

(cherry picked from commit 46fb68b1de)
2021-09-06 10:06:33 +02:00
Kristof Provost
6f85e21674 libpfctl: fix double free
Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31695

(cherry picked from commit b0ccc2e277)
2021-09-06 10:06:29 +02:00