Commit graph

2980 commits

Author SHA1 Message Date
Mikael Urankar
bedc8daace dma.conf: Fix typo
Pull Request: https://github.com/freebsd/freebsd-src/pull/1150

(cherry picked from commit c92400a6f690a82ab84eb0b97cc8bf169e44e4e8)
2024-04-07 12:34:04 -04:00
Jose Luis Duran
df4a9902ea rc.initdiskless: Disable soft-updates in mdmfs (again)
Re-apply the -S switch to disable soft-updates in memory disks (commit
8b1292ac52). This might be beneficial when tmpfs(5) is not present in
the kernel, as this can cause mdmfs(8)'s auto keyword to fallback to
using md(4).

PR:		85558
MFC after:	1 week
Reviewed by:	imp, emaste, brooks
Differential Revision:	https://reviews.freebsd.org/D43242

(cherry picked from commit bb4116576f2edf466ada3885cf851599ce7a4792)
2024-03-29 09:53:54 -04:00
Stefan Eßer
32364f99e1 rtld-elf: support either byte-order of hints file
Accept either little-endian or big-endian representation of the ELF
hints magic number in the header of a hints file and convert the
parameters to the native byte-order of the repsective system.

This is a pre-requisite for a planned change to always write the byte
order in little-endian format on all architectures. The only relvant
architecture that uses big-endian data is powerpc64, and it is not
likely that new architectures will choose that representation of data
in memory.

When all supported architectures use little-endian data in the hints
file, the byte swap logic can be enabled for big-endian CPUs at
compile time. Up to that point, there is a very small run-time penalty
that is paid on all systems to check the byte-order of the hints file
and to provide the option to byte-swap the parameters read from the
hints file header.

This commit contains the changes from review D44080 (which had been
split off from this patch for easier review),

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

(cherry picked from commit 7b77d37a561b47db093a2528b8032dbfe5791698)

rtld-elf: add some debug print statements

The byte-order independent code has been reported to fail on powerpc64.
Add some more debug statements to help identify the parametrs used and
to verify the correct operation of the byte-swap macros used..

(cherry picked from commit 173953182af060dcab43990e179ee91e9f2d1e54)

rtld: fix check for endianess of elf hints file

Don't check if the elf hints file is in host byte order, but check
if it is in little endian by looking at the magic number.
This fixes rtld on big endian platforms.

Reviewed by:	se, kib (prior version of the patch)
Fixes:		7b77d37a561b ("rtld-elf: support either byte-order of hints")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44472

(cherry picked from commit da2d6e2815d7694e3ccbd561508074c547b02dd6)

rtld: reduce debug messages after fix on big-endian hosts

Remove a debug message that had been added to support the debugging
of a mis-detection of the hint files endianness on powerpc64.

MFC after:	3 days

(cherry picked from commit c44bf7d2e9d2292867f2e23f291266af26762354)
2024-03-29 07:34:44 +01:00
Kyle Evans
a7b90458a2 rtld: add some dlopen tests
dlopen_basic just tests that libthr.so can be dlopen()ed, which will
just serve as a sanity check that "libthr.so" is a thing that can be
dlopened in case we get a weird failure in dlopen_recursing.

dlopen_recursing tests a regression reported after the libsys split,
where some dlopen() may cause infinite recursion and a resulting crash.
This case is inspired by bdrewery's description of what seemed to be
causing his issue.

The corresponding fix landed in commit
968a18975ad ("rtld: ignore load_filtees() calls if we already [...]")

Reviewed by:	kib

(cherry picked from commit c5796f1572c82b88e8b6a2810c92f30e5ac3e118)
2024-03-18 10:52:57 -05:00
Konstantin Belousov
3cce838c60 rtld: use generated map file to check for some leaks from libc into rtld
(cherry picked from commit 5db5c6c87a75f8b1871f021726fc4697253ae5cf)
2024-03-07 02:34:34 +02:00
Konstantin Belousov
5a98473132 rtld: unconditionally generate map file during build
(cherry picked from commit 799940154c70597a46627deb4d0b98e174b27b98)
2024-03-07 02:34:34 +02:00
Konstantin Belousov
11137153ab fdlopen(3): do not create a new object mapping if already loaded
PR:	277169

(cherry picked from commit 452c5e9995ab4cd6c7ea230cffe0c53bfa65c1ab)
2024-02-29 02:24:06 +02:00
Konstantin Belousov
0a246310f7 rtld: remove pointless "extern"
(cherry picked from commit 180df764c4ee570850deb4a910a11780ec3316df)
2024-02-29 02:24:06 +02:00
Andrew Turner
d416325740 rtld: Teach rtld about the BTI elf note
Add the Branch Target Identification (BTI) note to libc assembly
sources. As all obect files need the note for rtld to have it we need
to insert it in all asm files.

Reviewed by:	markj, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42228

(cherry picked from commit 5270cc9757fb4e0c1303ec44c2602b75acf3806d)
2024-02-19 13:12:18 +00:00
Konstantin Belousov
25bd875397 rtld: ignore load_filtees() calls if we already loading filtees for the obj
(cherry picked from commit 968a18975adc9c2a619bb52aa2f009de99fc9e24)
2024-02-18 12:01:47 +02:00
Konstantin Belousov
e43855c6f1 rtld load_filtees(): reindent and reduce block nesting
(cherry picked from commit 30b5f6b33b35623e6b6aa1d27a78311e199fa602)
2024-02-18 12:01:47 +02:00
Konstantin Belousov
c6d4339208 rtld symlook_obj: move common code to check filtees into helper
(cherry picked from commit 9ea864b54b57f2d0125860fb923f8db52b20eac2)
2024-02-18 12:01:46 +02:00
Mark Johnston
323226829a rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls
In order to atomically upgrade the rtld bind lock, load_filtees() may
trigger a longjmp back to _rtld_bind() so that the binding can be done
with the write lock held.  However, the write lock is only needed when
filtee objects haven't already been loaded, so move the
lock_restart_for_upgrade() call to avoid unnecessary lock upgrades when
a filtee is defined.

Reviewed by:	kib
Tested by:	brooks
MFC after:	1 week
Sponsored by:	Innovate UK

(cherry picked from commit e7951d0b04e6464b37264b8166b1e9ce368a9f1d)
2024-02-09 09:55:56 -05:00
Mark Johnston
0a2fa7bb9c crashinfo: Print stack traces for all on-CPU threads
Add a python script which implements the bulk of this functionality.
Over time, this would ideally evolve into a library of python routines
which can be used to inspect kernel data structures and automate some
debugging tasks, similar to jhb's out-of-tree scripts, but written in a
somewhat nicer language and with better integration into the kgdb
command prompt.

Note that kgdb currently won't auto-load scripts in this directory.
This should perhaps change in the future.  It probably also makes more
sense to have a crashinfo.py which provides all the kgdb output that we
want to include in core.txt, rather than having crashinfo.sh pipe in
several commands.

Reviewed by:	avg, imp
Discussed with:	jhb
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33817

(cherry picked from commit 2524b7dfb0df7e37ea9651559ce6c027b006e2a9)
2024-02-09 09:55:45 -05:00
Warner Losh
ded562d4af leapseconds: Update to the canonical place.
IERS is the source of truth for leap seconds. Their leapsecond file is
updated most quickly and is always right (unlike the IANA one which
often lags). IERS operates this public service for the express purpose
of random people downloading it. Their terms of service are compatible
with open source (we could include this in our release). Rather than
fighting with questions around this because the IANA one changed
locations or the auto update script broken, just use this.

This is in preference to the NIST ftp copy. NIST is in the process of
retiring their FTP services.

Sponsored by:		Netflix
Reviewed by:		philip, delphij, cy
Differential Revision:	https://reviews.freebsd.org/D43752

(cherry picked from commit 11da791920ba285f0832f09cb504ac81e35ff8d1)
2024-02-07 22:14:35 -07:00
Cy Schubert
83ab4d6cc5 rc.d/kdc: Support start of MIT krb5kdc
Some users wishing to use the MIT krb5kdc have discovered the
kdc script workaround applied to the MIT krb5 ports is insufficient.
Let's build into this rc script the smarts to determine whether
base or ports Hiemdal kdc is being invoked or the MIT krb5kdc.

While at it, remove kdc_start_precmd(). This will simplify a future
jail patch.

Suggested by:		netchild
Original patch:		netchild
Reviewed by:		emaste, netchild
Differential Revision:	https://reviews.freebsd.org/D43523

(cherry picked from commit 91f78c32befa08bf4010db7afd4407277a3e585f)
2024-01-28 16:26:05 -08:00
Gordon Bergling
8ec7f15c1d bootpd(8): Fix a typo in a source code comment
- s/adddress/address/

(cherry picked from commit d04df664776b436f712051520d48f84be93ab269)
2024-01-25 07:45:24 +01:00
Cheng Cui
404b91dac4
libexec/rc/rc.initdiskless: make tar's path flexible
PR:		274977

(cherry picked from commit 93b7818226cf5270646725805b4a8c17a1ad3761
 and from commit a04ca1c229195c7089b878a94fbe76505ea693b5)
2024-01-19 05:45:28 -05:00
Mark Johnston
c7c7faa614 rc.d: Process autobridge_* in vnet jails
Reviewed by:	kp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43316

(cherry picked from commit 1809089a9613c6ebdb6861ee142fba90d6a20c45)
2024-01-18 10:52:15 -05:00
Ed Maste
53a984a36f Track upstream project rename in contrib/blocklistd
Upstream is now https://github.com/zoulasc/blocklist/.  Rename the
contrib directory and update Makefiles to match, in advance of the next
vendor branch update.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5f4c09dd85bff675e0ca63c55ea3c517e0fddfcc)
2024-01-07 14:31:11 -05:00
John Baldwin
a697425ccc Stop #defining FREEBSD_ELF
This was originally used (along with FREEBSD_AOUT) to prefer the use
of ELF in various tools instead of a.out as part of the a.out to ELF
transition in the 3.x days.  The last use of it was removed from
<link.h> in commit 66422f5b7a back in
2002, but various files still #define it.

Reviewed by:	kevans, imp, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42964

(cherry picked from commit 4a3cf5f329d69076aa9d093d596eb0ee82d917f5)
2024-01-04 16:28:48 -08:00
Philip Paeps
163c434238 rc.conf: correct $ntp_leapfile_sources
IETF is no longer serving leap-seconds.list.  Point at IANA instead.

This fixes "service ntpd fetch".

(cherry picked from commit b1c95af45488bef649e9a84890e2414ff80b3a00)
2023-12-16 10:31:41 +08:00
Kyle Evans
2ef9079ece rtld: add a test for RTLD_DEEPBIND
This tests that with RTLD_DEEPBIND, symbols are looked up in all of the
object's needed objects before the global object.

PR:		275393
Reviewed by:	kib
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.

(cherry picked from commit d9c543b6b0cabea6e6679d70b4e701018e7eab80)
2023-12-14 18:58:36 -06:00
Konstantin Belousov
8d0740e8b9 RTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGs
PR:	275393

(cherry picked from commit 9daf6cd0f46416d9c6eb0411ea6042cd42b8a9bc)
2023-12-07 02:27:19 +02:00
Cy Schubert
3d845d94ea rc.d/ldconfig: Remove stray ;;
(cherry picked from commit ac910ad9951a52743389a47fa4a3feabe9021aaa)
2023-11-28 13:40:07 +02:00
Konstantin Belousov
98f8057eaa ldconfig: only configure compat32 when kernel supports it
(cherry picked from commit 73902ed85ab73d455d4be8c77336c88a07512230)
2023-11-28 13:40:07 +02:00
Konstantin Belousov
81a5b2389d ldconfig: filter out non-existing directories from default path
(cherry picked from commit 806e4e3273bee2e3a12ffc2e74db5c912fbd7aa9)
2023-11-28 13:39:39 +02:00
John W. O'Brien
5dba91f557 rc.d/ldconfig: Prepend rtld stdlib paths to ldconfig(32)_paths
PR:			275031

(cherry picked from commit 99132daf6f70cb0cc969c555d3612547fa3cf1db)
2023-11-28 13:39:39 +02:00
John Baldwin
260bab9f1e Purge more stray embedded $FreeBSD$ strings
These do not use __FBSDID but instead use bare char arrays.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41957

(cherry picked from commit eba230afba4932f02a1ca44efc797cf7499a5cb0)
2023-10-24 10:10:12 -07:00
Jamie Gritton
c96d5c97bb MFC jail: avoid a clash with /etc/jail.conf.d between rc and jail(8)
Since 13.1, /etc/rc.d/jail has looked for a per-jail config file in
/etc/jail.conf.d. For RELENG 14, the ".include" directive was added to
jail(8), with a sample line in the jail.conf(5) man page that includes
"/etc/jail.conf.d/*.conf".

These two use cases don't work together. When the jail.conf.d files
are included from a master jail.conf, the files in jail.conf.d are
likely to hold only partial configurations, and shouldn't be directly
loaded by rc.d/jail. But there are existing configurations that depend
on the current rc.d behavior. While users could be advised not to
include from /etc/jail.conf.d, it's the natural choice even if not
mentioned in jail.conf.5.

The workaround is for rc.d/jail to continue to load the individual
files, but only when /etc/jail.conf doesn't include from that
directory (via a simple grep test), This allows the current use
while not breaking the previous use.

Reported by:	antranigv at freebsd.am
Differential Revision:	https://reviews.freebsd.org/D41962

(cherry picked from commit a2440348eed75bb7682579af0905b652747fd016)
2023-09-27 21:39:00 -07:00
Daniel Tameling
f701d9da1d rc.subr: don't require service to be enabled for status
For a service that sets an rcvar, there is a check whether it has been
enabled before the actual command is executed. If the check fails, one
gets a message to enable it and the returned exit status is 0.
However, this is usually undesirable for the status command, which is
a) supposed to check whether the service is running anyway and
b) returns a non-zero exit code if that is not the case.
Thus, skip the check for the status command.

PR:		272282
Reviewed by:	emaste

(cherry picked from commit ba793728a840041e93e38bcbff4a7233dc63b722)
2023-09-24 09:17:43 -04:00
Konstantin Belousov
3f3c631da0 rtld: output rtld errors into the dbg channel
(cherry picked from commit 72d97e1dd9cc72a2acb96e35e56db6f3f51bca7d)
2023-09-19 11:31:24 +03:00
Ed Maste
3ea83e94cd ftpd: correct deprecation notice markup
Also bump .Dd for the original change.

Reported by:	karels
Fixes:		98b98ec1bc7e ("ftpd: add deprecation notice")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 01d82151022cb1383e83c331708a787f1907b00f)
2023-09-13 22:42:00 +01:00
Ed Maste
cc9347cc79 ftpd: add deprecation notice
Approved by:	gordon
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26447

(cherry picked from commit 98b98ec1bc7e961c3d3468b0e481080580c902cf)
2023-09-13 13:19:49 -04:00
Konstantin Belousov
cbf1bbe5c8 __crt_aligned_alloc_offset(): fix ov_index for backing allocation address
(cherry picked from commit 03a7c36ddbc0ddb1063d2c8a37c64d83e1519c55)
2023-09-09 11:26:33 +03:00
Glen Barber
29a16ce065 release: update stable/14 following branching from main
Approved by:	re (implicit)
Sponsored by:	GoFundMe https://www.gofundme.com/f/gjbbsd
Sponsored by:	PayPal https://paypal.me/gjbbsd
2023-08-24 19:07:33 -04:00
Konstantin Belousov
feaae6ba1a rtld: switch from malloc_aligned() to __crt_aligned_alloc()
Use regular free(), since it works now.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41150
2023-08-21 17:16:42 +03:00
Konstantin Belousov
c29ee08204 rtld_malloc: add __crt_aligned_alloc_offset()
It is modelled after aligned_alloc(3).  Most importantly, to free the
allocation, __crt_free() can be used.  Additionally, caller may specify
offset into the aligned allocation, so that we return offset-ed from
alignment pointer.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41150
2023-08-21 17:16:42 +03:00
Konstantin Belousov
d60130bf32 rtld_malloc: increase overhead index to uint16
Reorder it with magic, to keep alignment.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41150
2023-08-21 17:16:42 +03:00
Konstantin Belousov
6bb7f05850 rtld_malloc.c: change return type of cp2op() to void
for it to be useful to return unaligned pointer.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41150
2023-08-21 17:16:42 +03:00
Konstantin Belousov
b1d3e2b771 rtld: unlock bind lock when calling into crt __pthread_distribute_static_tls method
The method might require resolving and binding symbols, which means
recursing on the bind lock. It is safe to unlock the bind lock,
since we operate on the private object list, and user attempting to
unload an object from the list of not yet fully loaded objects caused
self-inflicted race.

It is similar to how we treat user' init/fini methods.

Reported by:	stevek
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-08-20 15:30:13 +03:00
Ed Maste
4722ceb7d5 Use 115200 bps by default for serial communication
9600 was a standard baud rate decades ago, but 115200 is now more common
so choose defaults that are useful to the largest number of users.

Note that boot0sio does not support rates above 9600 so it remains
unchanged.

Reviewed by:	bz, imp, manu
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36295
2023-08-17 13:31:38 -04:00
Warner Losh
ddb5480ec6 Fix partially removed comment by removing the rest
Fixes: 2a63c3be15
2023-08-16 14:17:33 -06:00
Warner Losh
05248206f7 Remove $FreeBSD$: one-line bare tag
Remove /^\s*\$FreeBSD\$$\n/
2023-08-16 11:55:20 -06:00
Warner Losh
b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh
fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh
2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Warner Losh
42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00