Commit graph

21841 commits

Author SHA1 Message Date
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
Dmitry Chagin
46be698d0f Fixed the value returned by sched_getaffinity().
On success gnu libc sched_getaffinity() should return 0, unlike underlying
Linux syscall which returns the size of CPU mask copied to user.

PR:		263939
MFC after:	2 weeks

(cherry picked from commit 3e11d3f61a)
2022-06-17 22:35:16 +03:00
Dmitry Chagin
72bc1e6806 cpuset: Byte swap cpuset for compat32 on big endian architectures
Summary:
BITSET uses long as its basic underlying type, which is dependent on the
compile type, meaning on 32-bit builds the basic type is 32 bits, but on
64-bit builds it's 64 bits.  On little endian architectures this doesn't
matter, because the LSB is always at the low bit, so the words get
effectively concatenated moving between 32-bit and 64-bit, but on
big-endian architectures it throws a wrench in, as setting bit 0 in
32-bit mode is equivalent to setting bit 32 in 64-bit mode.  To
demonstrate:

32-bit mode:

BIT_SET(foo, 0):        0x00000001

64-bit sees: 0x0000000100000000

cpuset is the only system interface that uses bitsets, so solve this
by swapping the integer sub-components at the copyin/copyout points.

Reviewed by:    kib
Sponsored by:   Juniper Networks, Inc.
Differential Revision:  https://reviews.freebsd.org/D35225

(cherry picked from commit 47a57144af)

Fix the build after 47a57144

(cherry picked from commit 89737eb829)

cpuset: Fix the KASAN and KMSAN builds

Rename the "copyin" and "copyout" fields of struct cpuset_copy_cb to
something less generic, since sanitizers define interceptors for
copyin() and copyout() using #define.

Reported by:    syzbot+2db5d644097fc698fb6f@syzkaller.appspotmail.com
Fixes:  47a57144af ("cpuset: Byte swap cpuset for compat32 on big endian architectures")
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 4a3e51335e)

Use Linux semantics for the thread affinity syscalls.

Linux has more tolerant checks of the user supplied cpuset_t's.

Minimum cpuset_t size that the Linux kernel permits in case of
getaffinity() is the maximum CPU id, present in the system / NBBY,
the maximum size is not limited.
For setaffinity(), Linux does not limit the size of the user-provided
cpuset_t, internally using only the meaningful part of the set, where
the upper bound is the maximum CPU id, present in the system, no larger
than the size of the kernel cpuset_t.
Unlike FreeBSD, Linux ignores high bits if set in the setaffinity(),
so clear it in the sched_setaffinity() and Linuxulator itself.

Reviewed by:            Pau Amma (man pages)
In collaboration with:  jhb
Differential revision:  https://reviews.freebsd.org/D34849
MFC after:              2 weeks

(cherry picked from commit f35093f8d6)
2022-06-17 22:35:14 +03:00
Dmitry Chagin
f482354a86 Fix sigtimedwait manpage.
Historically, sigtimedwait() blocks indefinitely if timeout is NULL.

Reviewed by:		jilles, imp
Differential Revision:	https://reviews.freebsd.org/D34985
MFC after:		2 weeks

(cherry picked from commit 89ecdff2c3)
2022-06-17 22:33:53 +03:00
Dmitry Chagin
07701dd858 Bump Dd in getdirentries.2 after c6487446.
MFC after:	1 week

(cherry picked from commit 45a4c44299)
2022-06-17 22:33:53 +03:00
Dmitry Chagin
85575b7e0c getdirentries: return ENOENT for unlinked but still open directory.
To be more compatible to IEEE Std 1003.1-2008 (“POSIX.1”).

Reviewed by:            mjg, Pau Amma (doc)
Differential revision:  https://reviews.freebsd.org/D34680
MFC after:              2 weeks

(cherry picked from commit c6487446d7)
2022-06-17 22:33:51 +03:00
Thomas Munro
5fac6f1687 poll(2): Add POLLRDHUP.
Teach poll(2) to support Linux-style POLLRDHUP events for sockets, if
requested.  Triggered when the remote peer shuts down writing or closes
its end.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29757

(cherry picked from commit 3aaaa2efde)
2022-06-17 22:22:13 +03:00
Ed Maste
94da8ba11d getpagesize(3): add .Xr to sysconf(3)
POSIX deprecated getpagesize(3).  The portable way to obtain the page
size is `sysconf(_SC_PAGESIZE)`.

Reviewed by:	cperciva (earlier), imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35352

(cherry picked from commit 49c937e704)
2022-06-16 08:50:00 -04:00
Dimitry Andric
862668c487 Merge llvm-project release/14.x llvmorg-14.0.5-0-gc12386ae247c
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.5-0-gc12386ae247c, aka 14.0.5 release.

PR:		261742
MFC after:	3 days

(cherry picked from commit 56f451bb3b)
2022-06-15 22:45:08 +02:00
Dimitry Andric
7db7448a10 Also define THR_PAGE_SIZE_MIN for mips
Commit 6173c7833b, which cherry-picked commit c7904405a8 ("Remove
PAGE_SIZE from libthr") to stable/13 resulted in build errors on mips:

/usr/src/lib/libthr/thread/thr_barrier.c:40:50: error: use of undeclared identifier 'THR_PAGE_SIZE_MIN'
_Static_assert(sizeof(struct pthread_barrier) <= THR_PAGE_SIZE_MIN,
                                                 ^

This is because c7904405a8 defined THR_PAGE_SIZE_MIN for all supported
architectures in main/14-CURRENT, but that list no longer includes mips.
Add a similar define for mips, so libthr can build successfully again.

Direct commit to stable/13, since main no longer has mips.

Fixes:		6173c7833b
2022-06-13 20:55:23 +02:00
Gordon Bergling
bac9985f83 ipsec(4): Fix a typo in a source code comment
- s/formated/formatted/

(cherry picked from commit 7a33c6bf52)
2022-06-10 14:33:00 +02:00
Gordon Bergling
98227aff13 usbhid(3): Fix a typo in the manual page
- s/layed/laid/

(cherry picked from commit 9b15c51b05)
2022-06-10 14:30:31 +02:00
Gordon Bergling
634412571c nlist(3): Fix a common typo in a source code comment
- s/independant/independent/

(cherry picked from commit 565405095b)
2022-06-10 14:25:39 +02:00
Gordon Bergling
c79946df83 libgssapi: Fix a common typo in a source code comment
- s/independant/independent/

(cherry picked from commit 9e75b06f93)
2022-06-10 14:23:10 +02:00
Dimitry Andric
40bbef56c9 Merge llvm-project release/14.x llvmorg-14.0.4-0-g29f1039a7285
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.4-0-g29f1039a7285, aka 14.0.4 release.

PR:		261742
MFC after:	3 days

(cherry picked from commit 2a66634d1b)

Bump versions llvm-project release/14.x llvmorg-14.0.4-0-g29f1039a7285

Somehow git rebase made this squashed commit disappear. Restore it.

PR:		261742
MFC after:	3 days

(cherry picked from commit ab9d54731f)

Update rest of llvm-project build glue for 14.0.4

I completely forgot about updating the generated llvm-project config
files, which also contain version numbers, etc. Sorry for the churn.

PR:		261742
Fixes:		ab9d54731f
MFC after:	3 days

(cherry picked from commit 809922b010)

Add more old clang files to (Optional)ObsoleteFiles.inc

There were a few more libclang_rt libraries added recently, but not yet
listed in the ObsoleteFiles.inc lists.

MFC after:	3 days

(cherry picked from commit 5e383e3603)
2022-06-09 20:14:08 +02:00
Andrew Turner
6173c7833b Remove PAGE_SIZE from libthr
In libthr we use PAGE_SIZE when allocating memory with mmap and to check
various structs will fit into a single page so we can use this allocator
for them.

Ask the kernel for the page size on init for use by the page allcator
and add a new machine dependent macro to hold the smallest page size
the architecture supports to check the structure is small enough.

This allows us to use the same libthr on arm64 with either 4k or 16k
pages.

Reviewed by:	kib, markj, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34984

(cherry picked from commit c7904405a8)
2022-06-07 15:20:18 +01:00
Andrew Turner
152c34e2dd Use the existing page size in libthr
Rather than calling getpagesize() twice use the value saved after the
first call to size a mmap allocation.

Reviewed by:	kib, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34983

(cherry picked from commit 86c500937c)
2022-06-07 15:20:18 +01:00
Cy Schubert
9900b20c79 lib/libgssapi: Trailing whitespace cleanup
Clean up trailing whitespace (trailing spaces and trailing tabs).

(cherry picked from commit efbe2af2ce)
2022-06-06 11:29:49 -07:00
Dimitry Andric
9bc98563bf llvm MIPS target: add missed source file
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::initializeMipsMulMulBugFixPass(llvm::PassRegistry&)
  ld: error: undefined symbol: llvm::createMipsMulMulBugPass()

MFC after:	3 days

(cherry picked from commit 4b1174e27a)
2022-06-04 14:00:23 +02:00
Dimitry Andric
36c1a99ff4 Add several sanitizer ignore lists under /usr/lib/clang
Some of the sanitizers from compiler-rt can use ignore lists, which are
loosely modeled on valgrind's example. Upstream provides default lists
for AddressSanitizer, CFI, and MemorySanitizer, so install these in the
expected location, /usr/lib/clang/14.0.3/share.

Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D35338

(cherry picked from commit 7b6f5ebef6)
2022-06-04 14:00:20 +02:00
Dimitry Andric
a13b6fc619 Merge llvm-project release/14.x llvmorg-14.0.3-0-g1f9140064dfb
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.3-0-g1f9140064dfb.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 3a9a9c0ca4)
2022-06-04 14:00:08 +02:00
Dimitry Andric
d3978dca08 Apply libc++ fix for <ranges> not compiling at all
Merge commit 44cdca37c01a from llvm git (by Arthur O'Dwyer):

  [libc++] Define `namespace views` in its own detail header.

  Discovered in the comments on D118748: we would like this namespace
  to exist anytime Ranges exists, regardless of whether concepts syntax
  is supported. Also, we'd like to fully granularize the <ranges> header,
  which means not putting any loose declarations at the top level.

  Differential Revision: https://reviews.llvm.org/D118809

(cherry picked from commit 53683b95ef)
2022-06-04 14:00:04 +02:00
Dimitry Andric
3b668af44d Merge llvm-project release/14.x llvmorg-14.0.0-2-g3f43d803382d
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-2-g3f43d803382d.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit dbc822f3bc)
2022-06-04 14:00:01 +02:00
Dimitry Andric
3e9cb41400 Merge llvm-project release/14.x llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit fb03ea46eb)
2022-06-04 13:59:57 +02:00
Dimitry Andric
25ab46a314 Merge llvm-project release/14.x llvmorg-14.0.0-rc2-12-g09546e1b5103
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc2-12-g09546e1b5103.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit d781ede639)
2022-06-04 13:59:49 +02:00
Dimitry Andric
26ebd6ad3b Merge llvm-project release/14.x llvmorg-14.0.0-rc1-74-g4dc3cb8e3255
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc1-74-g4dc3cb8e3255.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit d56accc7c3)
2022-06-04 13:59:42 +02:00