Commit Graph

21788 Commits

Author SHA1 Message Date
Konstantin Belousov
794d3e8e63 fcntl(2): add F_KINFO operation
that returns struct kinfo_file for the given file descriptor.  Among
other data, it also returns kf_path, if file op was able to restore file
path.

Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33277
2021-12-06 22:18:09 +02:00
Jessica Clarke
8d5d329553 Bootstrap libz when cross-building from non-FreeBSD
This is needed now libdwarf depends on libz.

Fixes:		dbf05458e3 ("libdwarf: Support consumption of compressed ELF sections")
MFC after:	1 week
2021-12-06 19:16:28 +00:00
Robert Wing
5916ae1fb1 libnv: read entire datagram in nvlist_recv()
When SOCK_DGRAM is used, a portion of the datagram is discarded during
the initial recv() when getting the nvlist_header.

To workaround this, use MSG_PEEK for the initial recv() when using a
datagram socket.

Add tests for SOCK_DGRAM with nvlist_send()/nvlist_recv().

Differential Revision:	https://reviews.freebsd.org/D32722
2021-12-06 09:54:55 -09:00
Robert Wing
db158b9942 libnv: let nvlist_recv() pass flags to recv()
Differential Revision:	https://reviews.freebsd.org/D32721
2021-12-06 09:54:55 -09:00
Mark Johnston
dbf05458e3 libdwarf: Support consumption of compressed ELF sections
Automatically decompress zlib-compressed debug sections when loading
them.  This lets ctfcovert work on userland code after commit
c910570e75 ("Use compressed debug in standalone userland debug files
by default").

Reported by:	avg
Reviewed by:	avg, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33139
2021-12-06 10:37:49 -05:00
Baptiste Daroussin
f499134dd4 bsddialog: import snapshot 2021-12-05 2021-12-06 11:43:34 +01:00
Baptiste Daroussin
1b308d0631 bsddialog: vendor import 2021-12-05 2021-12-06 11:35:28 +01:00
Stefan Eßer
5e04571cf3 sys/bitset.h: reduce visibility of BIT_* macros
Add two underscore characters "__" to names of BIT_* and BITSET_*
macros to move them to the implementation name space and to prevent
a name space pollution due to BIT_* macros in 3rd party programs with
conflicting parameter signatures.

These prefixed macro names are used in kernel header files to define
macros in e.g. sched.h, sys/cpuset.h and sys/domainset.h.

If C programs are built with either -D_KERNEL (automatically passed
when building a kernel or kernel modules) or -D_WANT_FREENBSD_BITSET
(or this macros is defined in the source code before including the
bitset macros), then all macros are made visible with their previous
names, too. E.g., both __BIT_SET() and BIT_SET() are visible with
either of _KERNEL or _WANT_FREEBSD_BITSET defined.

The main reason for this change is that some 3rd party sources
including sched.h have been found to contain conflicting BIT_*
macros.

As a work-around, parts of shed.h have been made conditional and
depend on _WITH_CPU_SET_T being set when sched.h is included.
Ports that expect the full functionality provided by sched.h need
to be built with -D_WITH_CPU_SET_T. But this leads to conflicts if
BIT_* macros are defined in that program, too.

This patch set makes all of sched.h visible again without this
parameter being passed and without any name space pollution due
to BIT_* macros becoming visible when sched.h is included.

This patch set will be backported to the STABLE branches, but ports
will need to use -D_WITH_CPU_SET_T as long as there are supported
releases that do not contain these patches.

Reviewed by:	kib, markj
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D33235
2021-12-05 23:00:25 +01:00
Konstantin Belousov
79d650f262 swapoff(2): document extended syscall arguments
Reviewed by:	markj
Discussed with:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33165
2021-12-05 00:20:58 +02:00
Florian Walpen
bf2fa8d9d1 MAC/priority module for realtime privilege group
This is a MAC policy module that grants scheduling privileges based on
group membership.  Users or processes in the group realtime (gid 47) are
allowed to run threads and processes with realtime scheduling priority.
For timing-sensitive, low-latency software like audio/jack, running with
realtime priority helps to avoid stutter and gaps.

PR:	239125
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D33191
2021-12-04 20:19:25 +02:00
Chuck Silvers
dfd00261c9 librtld_db: Handle shlibs with discontiguous mappings.
Some shared libraries specify mappings that leave a gap (actually a
MAP_GUARD mapping) in between the file mappings (libcrypto.so was
the one I found), and this would cause rd_loadobj_iter() to report
the mapping info incorrectly, leaving out rdl_path and misreporting
rdl_offset for file mappings after the gap.  Fix rd_loadobj_iter()
to handle this situation.

Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32950
2021-12-03 11:07:30 -08:00
Konstantin Belousov
7a9423d6f3 procstat_getfiles_sysctl: do not require non-null ki_fd
ki_fd is legitimately NULL when 32bit process requests process data
from 64bit host kernel.  The field is not used by the code for sysctl
case;  procstat_getfiles_kvm() checks ki_fd.

PR:	260174
Reported by:	Damjan Jovanovic <damjan.jov@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-12-03 00:52:49 +02:00
Konstantin Belousov
0ea3e4a27b Style
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-12-03 00:52:49 +02:00
Cy Schubert
db0ac6ded6 Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"
This reverts commit 266f97b5e9, reversing
changes made to a10253cffe.

A mismerge of a merge to catch up to main resulted in files being
committed which should not have been.
2021-12-02 14:45:04 -08:00
Cy Schubert
266f97b5e9 wpa: Import wpa_supplicant/hostapd commit 14ab4a816
This is the November update to vendor/wpa committed upstream 2021-11-26.

MFC after:      1 month
2021-12-02 13:35:14 -08:00
Michael Tuexen
83a103ec42 libc sctp: improve conformance of sctp_getpaddrs()
When there is no association, don't return -1 and indicate ENOENT,
but return 0 instead. This is specified in RFC 6458.

PR:		260117
MFC after:	1 week
2021-12-01 19:50:26 +01:00
Michael Tuexen
071966e874 libc sctp: fix sctp_getladdrs() when reporting no addresses
Section 9.5 of RFC 6458 (SCTP Socket API) requires that
sctp_getladdrs() returns 0 in case the socket is unbound. This
is the cause of reporting 0 addresses. So don't indicate an
error, just report this case as required.

PR:		260117
MFC after:	1 week
2021-12-01 16:25:01 +01:00
Michael Tuexen
6e9309bd3b libc sctp: improve error reporting of sctp_getladdrs()
Do not hide errno from getsockopt() called internally.

MFC after:	1 week
2021-12-01 11:14:36 +01:00
Michael Tuexen
dabd8bf914 libc sctp: fix sctp_getladdrs() for 64-bit BE platforms
When calling getsockopt() with SCTP_GET_LOCAL_ADDR_SIZE, use a
pointer to a 32-bit variable, since this is what the kernel
expects.
While there, do some cleanups.

MFC after:	1 week
2021-12-01 10:13:20 +01:00
Alan Somers
943c446629 Revert "libc: Some enhancements to syslog(3)"
This reverts commit 2886c93d1b.
The original commit has two problems:

* It sets SO_SNDBUF to be as large as MAXLINE.  But for unix domain
  sockets, the send buffer is bypassed.  Packets go directly to the
  peer's receive buffer, so setting and querying SO_SNDBUF is
  ineffective.  To ensure that the socket can accept messages of a
  certain size, it would be necessary to add a SO_PEERRCVBUF socket
  option that could query the connected peer's receive buffer size.

* It sets MAXLINE to 8 kB, which is larger than the default sockbuf size
  of 4 kB.  That's ok for the builtin syslogd, which sets its recvbuf
  to 80 kB, but not ok for alternative sysloggers, like rsyslogd, which
  use the default size.

As a consequence, writing messages of more than 4 kB with syslog() as a
non-root user while running rsyslogd would cause the logging application
to spin indefinitely within syslog().

PR:		260126
MFC:		2 weeks
Sponsored by:	Axcient
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D33199
2021-11-30 11:11:43 -07:00
Konstantin Belousov
78963d796d Document posix_spawn_file_actions_addclosefrom_np(3)
Reviewed by:    kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov
a18ddf7757 posix_spawn: add closefrom non-portable action
Namely posix_spawn_file_actions_addclosefrom_np, in the form it is
provided by glibc.

Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov
bd44dce5b3 Document posix_spawn_file_actions_addchdir_np(3)
Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov
25cda42a49 posix_spawn: add chdir-related non-portable actions
Namely posix_spawn_file_actions_addchdir_np and
posix_spawn_file_actions_addfchdir_np.

Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov
8ed1e4a5c1 posix_spawn(3), posix_spawn_file_actions_addopen(3): use .Fo/.Fc
to wrap too long lines with function prototypes.

Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov
b239cc204a posix_spawn: style, use return ()
Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Konstantin Belousov
adbaf1b443 posix_spawn.c: format fae_action anon enum more stylish
Reviewed by:	kevans, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33143
2021-11-30 03:43:54 +02:00
Mark Johnston
9ff084f0fa libelf: Link gelf_getchdr.3 to the build
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-11-29 13:57:24 -05:00
Konstantin Belousov
181751a8b6 citrus_prop.c: do not ignore sign
In _citrus_prop_read_TYPE_func_ generated functions, do not ignore parsed
'-' sign, negate the value as appropriate.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33146
2021-11-29 17:39:54 +02:00
Konstantin Belousov
a64a3b7988 libc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used
It receives the malloc() result, and we do not want the malloc() call
to be optimized out, which is allowed for hosted compiler.  Use dummy
for actual write though.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov
c8a4a49d58 libc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only 2021-11-29 17:39:51 +02:00
Konstantin Belousov
4b6f4db341 libc/x86/__vdso_gettc.c::tsc_selector_idx(): cpu_id is calculated but not used
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov
959c7ab51e acl_delete_entry(): remove write-only variable
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov
412fd7a34c setproctitle_internal(): remove kbuf local, it is write-only
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:51 +02:00
Konstantin Belousov
16b238b740 libc/rpc/getrpcent.c: Mark write-only variables as unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov
0e00befcaf libc/net/nscachedcli.c: remove write-only variables
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov
346eaa41f8 libc/net/getservent.c: Mark write-only variables as unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov
f6d403743c libc/net/getprotoent.c: Mark write-only variables as unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov
1c4f305d21 libc/net/getnetnamadr.c: Mark write-only variables as unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov
024547c9bd libc/net/gethostnamadr.c: mark write-only variables as __unused
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov
701473ef94 libc/gen/getpwent.c: plug warnings about write-only variables
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Konstantin Belousov
075fa5a9a8 libc/gen/getgrent.c: plug warnings about write-only variables
The variables clang13 complains about take the results of var_arg() calls.
I decided to kept variables around, annotating their definitions with
__unused, to keep clear expected types of the varargs.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-29 17:39:50 +02:00
Alexander Motin
52d973f52c libpmc: Update some x86 event definitions.
MFC after:	1 month
2021-11-25 11:19:26 -05:00
Baptiste Daroussin
5abafe4aa0 bsddialog, mark the lib as dependent on ncurses 2021-11-24 16:48:44 +01:00
Baptiste Daroussin
848ee2a3a8 bsddialog: actually add directories 2021-11-24 12:13:45 +01:00
Baptiste Daroussin
37d0601f42 bsddialog: import new TUI widget and utility
bsddialog is an attempt to write in permissive license a replacement for
libdialog.

While it is still in early stage it is good enough to already be used in
many areas, it is imported as private lib until it matures enough to be
considered as having a stable ABI
2021-11-24 11:03:31 +01:00
Baptiste Daroussin
fde3fc69cd ncurses: to not create a libncursesw.a in the OBJDIR
It breaks intree partial builds for every library depending on ncurses
because ncursesw.a (built without PIC) will be the first the library
path for the linker to resolve -lncursesw
2021-11-24 11:02:22 +01:00
Baptiste Daroussin
857c66bb5f bsddialog: import snapshot as of 2021-11-24 2021-11-24 09:46:56 +01:00
Christos Margiolis
ce74223a36 mixer: make .Dt tags uppercase
The document title should be uppercase in man pages.

Reviewed by:	imp, gbe
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D33027
2021-11-20 08:58:36 +01:00
Andrew Turner
b2e843161d Use a builtin where possible in msun
Some of the functions in msun can be implemented using a compiler
builtin function to generate a small number of instructions. Implement
this support in fma, fmax, fmin, and sqrt on arm64.

Care must be taken as the builtin can be implemented as a function
call on some architectures that lack direct support. In these cases
we need to use the original code path.

As we don't set errno on failure build with -fno-math-errno so the
toolchain doesn't convert a builtin into a function call when it
detects a failure, e.g. gcc will add a call to sqrt when the input
is negative leading to an infinite loop.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32801
2021-11-19 11:40:46 +00:00