Commit graph

21866 commits

Author SHA1 Message Date
Konstantin Belousov
066b09c2b1 libc: split scandir() into scandir_dirp() and proper scandir()
(cherry picked from commit cb6e97f4da)
2022-08-31 04:20:28 +03:00
Konstantin Belousov
628b801a8d Link scandir_b(3) to scandir(3)
(cherry picked from commit ea448a0a43)
2022-08-31 04:20:28 +03:00
Konstantin Belousov
c5b0a30c46 scandir.3: Use .Fo instead of .Fn for long args
(cherry picked from commit aa5e19a9b3)
2022-08-31 04:20:28 +03:00
Xin LI
09f390a215 arc4random(3): Reduce diff with OpenBSD.
The main change was v1.57 by djm@:

  Randomise the rekey interval a little. Previously, the chacha20
  instance would be rekeyed every 1.6MB. This makes it happen at a
  random point somewhere in the 1-2MB range.

Reviewed by:	csprng (markm, cem)
Differential Revision: https://reviews.freebsd.org/D36088

(cherry picked from commit e9a2e4d1d2)
2022-08-23 22:11:09 -07:00
Andrew Turner
8f736f867c Remove "All rights reserved" where I can in libc
These all have my copyright so can be removed. Some also have FreeBSD
Foundation copyright so drop from there as has been done for previous
files.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 101480e926)
2022-08-22 10:11:29 +01:00
Eugene Grosbein
2067574b27 MFC: syslog(3): unbreak log generation using fabricated PID
Recover application ability to supply fabricated PID
embedded into ident that was lost when libc switched
to generation of RFC 5424 log messages, for example:

logger -t "ident[$$]" -p user.notice "test"

It is essential for long running scripts.
Also, this change unbreaks matching resulted entries
by ident in syslog.conf:

!ident
*.* /var/log/ident.log

Without the fix, the log (and matching) was broken:

Aug  1 07:36:58 hostname ident[123][86483]: test

Now it works as expected and worked before breakage:

Aug  1 07:39:40 hostname ident[123]: test

Differential:	https://reviews.freebsd.org/D36005

(cherry picked from commit e9ae9fa937)
2022-08-22 09:30:32 +07:00
Dimitry Andric
70c0494320 Avoid using TARGET_ARCH in llvm.build.mk
Apparently the TARGET_ARCH macro is not supposed to be used outside of
the top-level Makefiles. Directly use MACHINE_ARCH instead.

Noticed by:	imp, jrtc27
MFC after:	1 week

(cherry picked from commit 8534e6be81)
2022-08-21 13:10:22 +02:00
Doug Rabson
f5bbed6217 pkgbase: split kerberos binaries and libs
Summary:
This allows installing packages that depend on kerberos libraries
without pulling in all the binaries. It also moves libgssapi to runtime
to allow installing kerbereos libraries without adding a dependancy on
the large utilities package. It makes sense to put libgssapi in runtime
rather than kerberos-lib since this is a plugin layer which is intended
to support any GSS-API mechanisms, not just kerberos.

A good example of a package which uses kerberos libraries without
needing the kerberos utilities is sshd. This uses the kerberos GSS-API
libraries to implement its GSSAPIAuthentication option.

MFC after: 2 weeks

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D36028

(cherry picked from commit 6e4dbb7fef)
2022-08-19 14:27:16 +01:00
Gordon Bergling
05e4f4a08c libutil: Fix mandoc warnings
- missing comma before name
- possible typo in section name: Sh CAVEAT instead of CAVEATS
- useless macro: Tn
- blank line in fill mode, using .sp
- no blank before trailing delimiter: Dv NULL?

(cherry picked from commit 816ca3d10f)
2022-08-10 14:23:27 +02:00
Gordon Bergling
f1dbcadb5a libpathconv: bump man page dates
- bump the man page dates to the date of mandoc fixes

Reported by:	rpokala
X-MFC with:	094517119c

(cherry picked from commit 948168c778)
2022-08-10 14:22:56 +02:00
Gordon Bergling
b83d5bf050 libpathconv: Fix mandoc warnings in abs2rel(3) and rel2abs(3)
- cannot parse date, using it verbatim: Dec 15, 1997"
- sections out of conventional order: Sh SEE ALSO
- possible typo in section name: Sh EXAMPLE instead of EXAMPLES
- AUTHORS section without An macro

(cherry picked from commit 094517119c)
2022-08-10 14:22:26 +02:00
Steve Kargl
9a0d922f57 [libm] Correct comments in s_cbrt[l].c
Damian McGuckin <damianm at esi dot com dot au> noted that the accuracy
claims in the code for cbrt(3) and cbrtl(3) were incorrect. Fix the
comments to more accurately describe the accuracies.

PR:		265603
MFC after:	3 days

(cherry picked from commit 369ea0520a)
2022-08-07 11:02:36 +02:00
Ed Maste
52c8052938 libc: ANSIfy div / ldiv function definitions
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a8a43edc0f)
2022-08-03 20:35:09 -04:00
Hans Petter Selasky
71c5394f68 cuse(3): Make some clarifications in the manual page.
Sponsored by:	NVIDIA Networking

(cherry picked from commit 280f34c37c)
2022-07-27 11:34:01 +02:00
Hans Petter Selasky
b95d9d3b86 cuse(3): Allow allocating a memory buffer of exactly 2 GBytes.
The manual page date will be bumped separately.

Sponsored by:	NVIDIA Networking

(cherry picked from commit 58a8f6e9ec)
2022-07-27 11:33:58 +02:00
Hans Petter Selasky
a96a9c689e cuse(3): Allow shared memory allocations up to, but excluding 2 GBytes.
Currently the cuse(3) mmap(2) offset is split into 128 banks of 16 Mbytes.
Allow cuse(3) to make allocations that span multiple banks at the expense
of any fragmentation issues that may arise. Typically mmap(2) buffers are
well below 16 Mbytes. This allows 8K video resolution to work using webcamd.

Reviewed by:	markj @
Differential Revision:	https://reviews.freebsd.org/D35830
Sponsored by:	NVIDIA Networking

(cherry picked from commit d14b53ee31)
2022-07-27 11:33:53 +02:00
Hans Petter Selasky
412b95f77d cuse(3): Make cuse_vmfree() NULL safe.
Sponsored by:	NVIDIA Networking

(cherry picked from commit 2ca43c3dba)
2022-07-27 11:33:51 +02:00
Hans Petter Selasky
cc876e9fa5 cuse(3): Remove PAGE_SIZE from libcuse.
To allow for a dynamic page size on arm64 remove the static value from libcuse.

Differential Revision:	https://reviews.freebsd.org/D35585
Sponsored by:	NVIDIA Networking

(cherry picked from commit 2c28cd09d9)
2022-07-27 11:33:36 +02:00
Xin LI
ec5b775403 libproc: replace home grown crc32 with zlib implementation.
Differential Revision: https://reviews.freebsd.org/D35766

(cherry picked from commit 0bbf270296)
2022-07-23 22:04:56 -07:00
Dimitry Andric
8432a5a4fa Remove unnecessary const and volatile qualifiers from __fp_type_select()
Since https://github.com/llvm/llvm-project/commit/ca75ac5f04f2, clang 15
has a new warning about _Generic selection expressions, such as used in
math.h:

    lib/libc/gdtoa/_ldtoa.c:82:10: error: due to lvalue conversion of the controlling expression, association of type 'volatile float' will never be selected because it is qualified [-Werror,-Wunreachable-code-generic-assoc]
            switch (fpclassify(u.e)) {
                    ^
    lib/msun/src/math.h:109:2: note: expanded from macro 'fpclassify'
            __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
            ^
    lib/msun/src/math.h:85:14: note: expanded from macro '__fp_type_select'
        volatile float: f(x),                                               \
                 ^

This is because the controlling expression always undergoes lvalue
conversion first, dropping any cv-qualifiers. The 'const', 'volatile',
and 'volatile const' associations will therefore never be used.

MFC after:	1 week
Reviewed by:	theraven
Differential Revision: https://reviews.freebsd.org/D35815

(cherry picked from commit e50027e38d)
2022-07-23 10:56:44 +02:00
Mark Johnston
b2e2412d15 geli: Add a chicken switch for unmapped I/O
We have a report of a panic in GELI that appears to go away when
unmapped I/O is disabled.  Add a tunable to make such investigations
easier in the future.  No functional change intended.

PR:		262894
Reviewed by:	asomers
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 081b4452a7)
2022-07-19 09:52:00 -04:00
Vitaliy Gusev
27f3d9f70d libvmm: add __BEGIN_DECLS/__END_DECLS for linking with c++ binaries
Reviewed by:	jhb, markj, imp
Sponsored by:	vStack

(cherry picked from commit 1228a047aa)
2022-07-18 09:07:25 -04:00
Xin LI
67c01d848b file: upgrade to 5.42.
(cherry picked from commit a4d6d3b891)
2022-07-17 17:32:23 -07:00
Xin LI
96e3ac4c09 libmagic: Remove support for older FreeBSD where xlocale was not available.
The MINIMUM_SUPPORTED_OSREL is 1002501 (FreeBSD 10.3), and xlocale is
supported there.

While I'm there, explicitly use config.h generated with --disable-bzlib
--disable-xzlib instead of deleting them manually.

(cherry picked from commit 9026652101)

file: Turns out we need xlocal.h protection

It turns out that we still need xlocal.h protection for when we're
cross building on Linux. Linux doesn't have this file, but os/x
does. Before, we'd assume we didn't have it, like old FreeBSD, when
cross compiling. After the latest update, all that code was removed so
cross compiling needs to be handled separaetly. Do so by defining
HAVE_XLOCALE_H only when we're not building on linux. This allows us
to build the mkmagic build tool needed to build file(1).

Sponsored by:		Netflix
Reviewed by:		jrtc27
Differential Revision:	https://reviews.freebsd.org/D33741

(cherry picked from commit f3d7ace4b2)
2022-07-17 17:31:09 -07:00
Yi Kong
7f753c0c33
msun: Rewrite function definitions with identifier lists
This syntax is removed in C2x proposal N2432.

Reviewed by:	pfg
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D35771

(cherry picked from commit 7e06f4708c)
2022-07-15 22:02:57 +08:00
Gordon Bergling
9de56faedb sockatmark(3): Add references to 4.4BSD IPC tutorials
Obtained from:	NetBSD

(cherry picked from commit 6cea3be922)
2022-07-08 04:24:32 +02:00
Gordon Bergling
46ca2d0ce9 pmc(3): Fix a common typo in a description
- s/transistioned/transitioned/

(cherry picked from commit a4adfaf712)
2022-07-08 04:24:12 +02:00
Mark Johnston
f05fe671d2 libsysdecode: Grab some more ioctl definitions from CAM
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ec014502ee)
2022-07-07 13:05:28 -04:00
Mark Johnston
af5ea5ccce wait.2: Remove sys/types.h from the list of required headers
wait.h is self-contained.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b8ec0ce5b4)
2022-07-07 13:05:18 -04:00
Dmitry Chagin
ea7ad1a716 libsysdecode: Fix a typo in my email
Reported by:		Mikaël Urankar
MFC after:		2 weeks

(cherry picked from commit ed366c37d8)
2022-07-06 14:02:15 +03:00
Dmitry Chagin
a511300006 libsysdecode: Decode Linux open() flags
MFC after:		2 weeks

(cherry picked from commit fde775bc53)
2022-07-06 14:02:14 +03:00
Dmitry Chagin
46ebfcb039 libsysdecode: Decode Linux *at() flags
MFC after:		2 weeks

(cherry picked from commit d2b3237eeb)
2022-07-06 14:02:14 +03:00
Dmitry Chagin
29ef2caa02 kdump: Decode Linux clock_nanosleep syscall
MFC after:		2 weeks

(cherry picked from commit 39de84b619)
2022-07-06 14:02:14 +03:00
Dmitry Chagin
4ec7625e66 kdump: Decode Linux sigprocmask how argument
MFC after:		2 weeks

(cherry picked from commit f587a2a765)
2022-07-06 14:02:14 +03:00
Dmitry Chagin
e104ac1c34 libsysdecode: Decode setitimer, getitimer which argument
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D35230
MFC after:		2 weeks

(cherry picked from commit 2fc3a51db1)
2022-07-06 14:02:13 +03:00
Dmitry Chagin
1705937d85 libsysdecode: Add method for decoding Linux signal names
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D35215
MFC after:		2 weeks

(cherry picked from commit f85848fc61)
2022-07-06 14:02:12 +03:00
Dmitry Chagin
b756b92a3a libsysdecode: Add preliminary support for decoding Linux syscalls
Differential revision:	https://reviews.freebsd.org/D35354
MFC after:		2 weeks

(cherry picked from commit b69ae1a34c)
2022-07-06 14:02:12 +03:00
Dmitry Chagin
aa54b10f05 libsysdecode: For future use extract common code to a separate files
Reviewed by:		jhb, emaste
Differential revision:	https://reviews.freebsd.org/D35353
MFC after:		2 weeks

(cherry picked from commit 9dac609629)
2022-07-06 14:02:12 +03:00
Wojciech Macek
0a53e381c0 pmc: intr pmc.soft(3) update
Obtained from:		Semihalf
Sponsored by:		Stormshield
Reviewed by:		mhorne
Differential revision:	https://reviews.freebsd.org/D32055

(cherry picked from commit 319b150003)
2022-07-05 12:53:47 -04:00
Alexander Motin
c4cafc24df libpmc: Prefer fixed counters in Intel event aliases.
It is recommended by Intel to use fixed counters when possible to
leave programmable ones for different events.

This fixes `pmc stat`, which tries to count 6 events same time, while
many Intel CPUs have only 4 programmable counters.

MFC after:	1 month

(cherry picked from commit e144cd92bb)
2022-07-04 13:48:10 -04:00
Alexander Motin
0cd1f9831c libpmc: Fix INVERT flag mapping for both Intel and AMD.
Looks like somebody's trivial copy/paste bug.

MFC after:	1 month

(cherry picked from commit 037dd0a967)
2022-07-04 13:48:09 -04:00
Alexander Motin
b120f6d625 libpmc: Disable hardcoding of Intel fixed counters.
Intel json's now have pretty reasonable fixed counters representation
via event=0 and umask.  Hardcoded values create more confusion than fix.

MFC after:	1 month

(cherry picked from commit 73b7b181e6)
2022-07-04 13:48:09 -04:00
Alexander Motin
cc2310bd2a libpmc: jevents: Sync with the latest Linux kernel.
commit f4df0dbbe62ee8e4405a57b27ccd54393971c773
Date:   Wed May 25 22:04:10 2022 +0800

MFC after:	1 month

(cherry picked from commit 62ff619dcc)
2022-07-04 13:48:09 -04:00
Alexander Motin
1b4b65dedf Revert "libpmc: jevents: Partial style(9) pass"
This file is shared with Linux.  Having local style patches does not
help with updating it.

This reverts commit 3ea691c261.

(cherry picked from commit 51f329660f)
2022-07-04 13:48:09 -04:00
Alexander Motin
e58ca5c09b libpmc: Another update of x86 event definitions.
MFC after:	1 month

(cherry picked from commit 18054d0220)
2022-07-04 13:48:08 -04:00
Alexander Motin
558e8b6adb amd64: Stop using REP MOVSB for backward memmove()s.
Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
REP MOVSB the fastest way to copy memory in most of cases. However
Intel Optimization Reference Manual says: "setting the DF to force
REP MOVSB to copy bytes from high towards low addresses will expe-
rience significant performance degradation". Measurements on Intel
Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.

This patch keeps ERMS use for forward ordered memory copies, but
removes it for backward overlapped moves where it does not work.

This is just a cosmetic sync with kernel, since libc does not use
ERMS at this time.

Reviewed by:    mjg
MFC after:	2 weeks

(cherry picked from commit f22068d91b)
2022-06-29 21:13:51 -04:00
Mark Johnston
5d6f9a7da2 kevent.2: Add an xref to listen.2
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 6405997f45)
2022-06-27 10:11:27 -04:00
Yan Ka Chiu
ea80848e1c pam_exec: fix segfault when authtok is null
According to pam_exec(8), the `expose_authtok` option should be ignored
when the service function is `pam_sm_setcred`. Currently `pam_exec` only
prevent prompt for anth token when `expose_authtok` is set on
`pam_sm_setcred`. This subsequently led to segfault when there isn't an
existing auth token available.

Bug reported on this: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263893

After reading https://reviews.freebsd.org/rS349556 I am not sure if the
default behaviour supposed to be simply not prompt for authentication
token, or is it to ignore the option entirely as stated in the man page.

This patch is therefore only adding an additional NULL check on the item
`pam_get_item` provide, and exit with `PAM_SYSTEM_ERR` when such item is
NULL.

MFC after:	1 week
Reviewed by:	des, khng
Differential Revision:	https://reviews.freebsd.org/D35169

(cherry picked from commit b75e0eed34)
2022-06-24 05:09:59 -04:00
Dmitry Chagin
59d1410b79 libsysdecode: Fix decoding of SCHED_ flags
Use sys/sched.h where SCHED_ flags are defined.

Reviewed by:		emaste
Differential revision:	https://reviews.freebsd.org/D35208
MFC after:		2 weeks

(cherry picked from commit 41068268ec)
2022-06-17 22:35:23 +03:00
Dmitry Chagin
8f384a0b9d kqueue: Fix kqueue(2) man page.
Remove bogus BUGS note about timeout limit to 24 hours, that's not true
since callouting project import.

Reviewed by:            mav
Differential revision:  https://reviews.freebsd.org/D35206
MFC after:              2 weeks

(cherry picked from commit 14c99b43ef)
2022-06-17 22:35:18 +03:00