Commit graph

2995 commits

Author SHA1 Message Date
Franco Fichtner
03c1257577 Revert "Use 115200 bps by default for serial communication"
This reverts commit 4722ceb7d5.
2024-09-09 21:50:14 +02:00
Franco Fichtner
238178fa38 rc: also run NAME_setup on NAME_reload
Reload is used for service reconfiguration as well
and lacks a NAME_prepend-like mechanism so it makes
sense to extend the NAME_reload hook into this
action.

precmd may use configuration checks and blocks setup
from doing its designated work (e.g. nginx). In moving
the invoke of the setup script in front allows us to
provide custom scripts for config file generation and
fixing prior to precmd checking configuration integrity.

Also introduce _run_rc_setup to separate the launcher
from the main one. Let it run correctly in the case
of restart_precmd and block further execution as
would be the case in start due to the internal plumbing
of restart being split into calling stop and start
afterwards.

PR: https://reviews.freebsd.org/D36259
2024-06-03 11:06:53 +02:00
Franco Fichtner
953fdd3ae5 tty: patch in 3wire autologin support
PR: https://github.com/opnsense/core/issues/3921
2024-06-03 11:06:53 +02:00
Jeremy Collin
3b9c88fa99 fix (nuageinit): SSH keys are not handled in metadata but in userdata
MFC After: 1 day
Approved by:	re (cperciva)

(cherry picked from commit 48edad2edf)
(cherry picked from commit 5601feb720)
2024-05-23 09:50:01 +02:00
Baptiste Daroussin
d31c10fca3 nuageinit: by default to not enable nuageinit
MFC After:	1 day
Reported by:	karels@
Approved by:	re (cperciva)

(cherry picked from commit 5681636ead)
(cherry picked from commit 2c5c85cbcf)
2024-05-23 09:49:46 +02:00
Allan Jude
207e8cef0b ftpd: stop using -g flag for /bin/ls
In 3bfbb521 the behaviour of ls was changed such that -g was no longer
a noop for compatibility with BSD 4.3, but instead changed the output
of long mode to exclude the owner of the file and display only the
group.

Update how FTPd invokes ls to restore the previous behaviour

Reported-by:	Andrew Fengler <andrew.fengler@scaleengine.com>
Reviewed-by:	jrtc27, des, imp
Approved by:	re (cperciva)
MFC after:	3 days
Sponsored-by:	ScaleEngine Inc.
Fixes:		3bfbb521fe ("ls: Improve POSIX compatibility for -g and -n.")

(cherry picked from commit 5af3225e0448be6af7f0312e10d2a1dfbe150c25)
(cherry picked from commit e5fadc41b4)
2024-05-22 17:18:07 +00:00
Fernando Apesteguía
8930e7d8ea save-entropy: Add manual page
Succinct manual page for save-entropy(8).

PR:			223998
Reported by:		AJ Jordan <alex+freebsd@strugee.net>
Reviewed by:		carlavilla@, delphij@, lwhsu@, pauamma_gundo.com
Approved by:		delphi, lwhsu (src)
Differential Revision:	https://reviews.freebsd.org/D41768

(cherry picked from commit 8dc9b10e38)
(cherry picked from commit 227f81c8bd)

Approved by:	re (cperciva)
2024-05-16 14:24:30 -03:00
Olivier Certner
2beba7b456
Remove remnants of portsnap(8)
This was prompted by noticing that '/var/db/portsnap' still exists on
newly-installed machines.

With this change, all mentions of portsnap(8) in the tree are gone,
except for the historical note in the AUTHORS section of manpage
phttpget(8).

locate(1) will thus start indexing again '/var/db/portsnap' on machines
where this directory still exists, which may be a good way to push
administrators to delete it.

Reviewed by:            cperciva
Approved by:            emaste (mentor)
MFC after:              3 days
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45023

(cherry picked from commit 9b30b96c1f)

ObsoleteFiles.inc: Remove /var/db/portsnap

This is a followup to commit "Remove remnants of portsnap(8)"
(9b30b96c1f).  I wasn't aware of OLD_DIRS.

Approved by:            markj (mentor)
MFC after:              1 day
MFC with:               9b30b96c1f
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45023

(cherry picked from commit 54bbcc09a7)

Approved by:            markj (mentor)

(cherry picked from commit 9f06e6c990)

Approved by:            markj (mentor)
Approved by:            re (cperciva)
2024-05-09 17:18:53 +09:00
Konstantin Belousov
44debee9fc rtld snprintf: do not erronously skip a char at the buffer boundary
(cherry picked from commit 56ee5fc43c)
2024-05-03 03:25:33 +03:00
Dag-Erling Smørgrav
986cceda16 tftpd: Use size_t where appropriate.
* Limit the use of `ssize_t` to only where it's needed.
* Correct one case of `int` being used for a length.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D44954

(cherry picked from commit 1ed44fcc44)

tftpd: Clean up the tests.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D44955

(cherry picked from commit 7ab7ecfcfe)

tftpd: Check the server status after each test.

* In the setup phase, wait for the server to start (or fail to start)
  before proceeding with the test.  This makes it possible to write test
  cases that don't expect a response from the server without ending up
  in a race over the server PID file.
* After running each test, wait up to 30 seconds for the server to exit
  and check that the exit status matches what the test case says to
  expect (usually 0).
* We still kill and collect the server in the cleanup phase, in case the
  test ended early.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D44956

(cherry picked from commit 83a6e984ac)

tftpd: Immediately reject any request shorter than 4 bytes.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D44957

(cherry picked from commit 9f231af307)

tftpd: Untangle a conditional.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45026

(cherry picked from commit 21b5829d28)
2024-05-02 11:02:21 +02:00
Baptiste Daroussin
93b11fe0a1 nuageinit: start the script after zfs
It prevents the home directory for the new users to be hidden
by late mount of the home directory

(cherry picked from commit b6a4776008)
2024-05-02 09:49:41 +02:00
Cy Schubert
abc4b30889 kdc: Add restart option
Add a new kdc_restart rc variable that manages kdc (or krb5kdc) under
daemon(8). This automatically restarts the kdc should it fail, i.e.
when it's configured to use LDAP as a backend and cannot connect to its
LDAP directory.

Set kdc_restart="YES" to auto restart kdc on abnormal termination.

Set kdc_restart_delay="N" to the number of seconds to delay before
restarting the kdc. The daemon(8) default seconds applies when not set.

Reported by:		Lexi Winter <lexi.freebsd@le-fay.org>
PR:			278395
Differential Revision:	https://reviews.freebsd.org/D44898

(cherry picked from commit 9e248b7f64)
2024-04-29 05:50:19 -07:00
Konstantin Belousov
2cd1939e2e rtld(1): minor clarification for LD_STATIC_TLS_EXTRA
(cherry picked from commit 8d74737035)
2024-04-23 03:32:21 +03:00
Stephen J. Kiernan
0b56acfc49 rtld: introduce STATIC_TLS_EXTRA
(cherry picked from commit 95335dd3c1)
2024-04-20 16:52:16 +03:00
Baptiste Daroussin
16a6da44e2 nuageinit: add basic support for cloudinit.
this is a very early script to support cloudinit, it does not intend to
be a full featured cloudinit client, but will support a good enough
subset to be viable in most case.

It support nocloud and openstack config-2 config drive mode (iso9660 or
msdosfs)

The following features are currently supported:
- adding users (including a default user named 'freebsd' with password
  'freebsd'
- adding groups
- adding ssh keys
- static ipv4, static ipv6, dynamic ipv4

With this one is able to use the 'bring your own image feature" out of
box.

It is expected that the script grows the support of other clouds
supporting cloud-init, contributions are welcomed.

It is designed to be only run once via the firstboot mecanism.

Sponsored by:	OVHCloud
Differential Revision:	https://reviews.freebsd.org/D44141

(cherry picked from commit a42d6f7601)
(cherry picked from commit c051f22bce)
(cherry picked from commit b8c053c9a6)
(cherry picked from commit 9eae9233fd)
2024-04-11 13:52:52 +02:00
Mikael Urankar
bedc8daace dma.conf: Fix typo
Pull Request: https://github.com/freebsd/freebsd-src/pull/1150

(cherry picked from commit c92400a6f6)
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 bb4116576f)
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 7b77d37a56)

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 173953182a)

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:		7b77d37a56 ("rtld-elf: support either byte-order of hints")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44472

(cherry picked from commit da2d6e2815)

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 c44bf7d2e9)
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
968a18975a ("rtld: ignore load_filtees() calls if we already [...]")

Reviewed by:	kib

(cherry picked from commit c5796f1572)
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 5db5c6c87a)
2024-03-07 02:34:34 +02:00
Konstantin Belousov
5a98473132 rtld: unconditionally generate map file during build
(cherry picked from commit 799940154c)
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 452c5e9995)
2024-02-29 02:24:06 +02:00
Konstantin Belousov
0a246310f7 rtld: remove pointless "extern"
(cherry picked from commit 180df764c4)
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 5270cc9757)
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 968a18975a)
2024-02-18 12:01:47 +02:00
Konstantin Belousov
e43855c6f1 rtld load_filtees(): reindent and reduce block nesting
(cherry picked from commit 30b5f6b33b)
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 9ea864b54b)
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 e7951d0b04)
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 2524b7dfb0)
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 11da791920)
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 91f78c32be)
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 d04df66477)
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 93b7818226
 and from commit a04ca1c229)
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 1809089a96)
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 5f4c09dd85)
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 4a3cf5f329)
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 b1c95af454)
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 d9c543b6b0)
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 9daf6cd0f4)
2023-12-07 02:27:19 +02:00
Cy Schubert
3d845d94ea rc.d/ldconfig: Remove stray ;;
(cherry picked from commit ac910ad995)
2023-11-28 13:40:07 +02:00
Konstantin Belousov
98f8057eaa ldconfig: only configure compat32 when kernel supports it
(cherry picked from commit 73902ed85a)
2023-11-28 13:40:07 +02:00
Konstantin Belousov
81a5b2389d ldconfig: filter out non-existing directories from default path
(cherry picked from commit 806e4e3273)
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 99132daf6f)
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 eba230afba)
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 a2440348ee)
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 ba793728a8)
2023-09-24 09:17:43 -04:00
Konstantin Belousov
3f3c631da0 rtld: output rtld errors into the dbg channel
(cherry picked from commit 72d97e1dd9)
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:		98b98ec1bc ("ftpd: add deprecation notice")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 01d8215102)
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 98b98ec1bc)
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 03a7c36ddb)
2023-09-09 11:26:33 +03:00