Commit graph

2691 commits

Author SHA1 Message Date
Edward Tomasz Napierala
099b125337 rc: improve dependencies for growfs
Previously it depended on sysctl, which itself has no dependencies,
so rcorder(8) had a bit too much flexibility when choosing when to run
it.  Make sure it runs just between 'fsck' and 'root'.

Reviewed By:	jmg, imp
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29748

(cherry picked from commit b68e656922)
2022-02-17 00:09:25 +00:00
Mateusz Piotrowski
0bf6e572bd rc.d/linux: Attempt to mount only if necessary
Currently, if the linux service is run twice, mount(8) fails with:

    mount: linprocfs: Device busy
    mount: linsysfs: Device busy
    mount: devfs: Device busy
    mount: fdescfs: Device busy
    mount: tmpfs: Device busy

It is a bit more user-friendly if before running mount(8) the service
checks if there are any file systems left to be mounted. This patch
implements this behavior.

Also, while here, create mount points directories (as suggested by
otis).

Reviewed by:	trasz
Approved by:	trasz (src)
Differential Revision:	https://reviews.freebsd.org/D32463

(cherry picked from commit 5690261858)
2022-02-16 23:54:44 +00:00
Rick Macklem
cc6f50fc37 gssd: Modify /etc/rc.d/gssd so that it starts after NETWORKING
Arno Tuber reported via email that he needed to restart the gssd daemon
after booting, to get his Kerberized NFS mount to work.

Without this patch, rcorder shows that the gssd starts before NETWORKING
and kdc. The gssd will need NETWORKING to connect to the KDC and, if
the kdc is running on the same system, it does not make sense to start it
before the kdc.  This fixed the problem for Arno.

While here, I also added a "# BEFORE: mountcritremote".
It does not affect ordering at this time, but I felt
it should be added, since the gssd needs to be running
when remote NFS mounts are done.

PR:	261939

(cherry picked from commit 0f5e9425e7)
2022-02-21 16:40:10 -08:00
Robert Wing
73f55c5a38 etc/defaults/rc.conf: set default of zfskeys_enable to NO
This addresses the following boot message:
    /etc/rc: WARNING: $zfskeys_enable is not set properly - see rc.conf(5).

Reported by:    Mark Millard
Sponsored by:   Modirum MDPay
Sponsored by:   Klara Inc.
Fixes: bfb7a31b6a ("rc: Hook zfskeys to the build")
Fixes: 33ff39796f ("Add zfskeys rc.d script for auto-loading encryption keys")

(cherry picked from commit 6596f19daa)
2022-02-20 16:53:27 +01:00
Konstantin Belousov
6914c8ff5d rtld: Add ${TOKEN} aliases to $TOKEN
(cherry picked from commit b1b5174123)
2022-02-18 04:01:24 +02:00
Konstantin Belousov
1bce4afb06 rtld: make token substitution table-driven
(cherry picked from commit 55abf23dd3)
2022-02-18 04:01:24 +02:00
Edward Tomasz Napierala
2ffd6857cc rc: make the 'linux' script explicitly load filesystem modules
This removes a minor annoyance with Linux jails, where you often
want linux_mounts_enable="NO", yet you want those filesystems
available for mounting in jails; normally mount(8) would result
in kernel automatically loading the KLD, but this doesn't work
inside jails or chroots.

PR:		242955
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29725

(cherry picked from commit 45aec46246)
2022-02-13 23:20:29 +00:00
Thomas Steen Rasmussen
fae2a8cad3 pf: fallback if $pf_rules fails to load
Support loading a default pf ruleset in case of invalid pf.conf.

If no pf rules are loaded pf will pass/allow all traffic, assuming the
kernel is compiled without PF_DEFAULT_TO_DROP, as is the case in
GENERIC.

In other words: if there's a typo in the main pf_rules we would allow
all traffic. The new default rules minimise the impact of this.

If $pf_program (i.e. pfctl) fails to set $pf_fules and
$pf_fallback_rules_enable is YES we will load $pf_fallback_rules_file if
set, or $pf_fallback_rules.

$pf_fallback_rules can include multiple rules, for example to permit
traffic on a management interface.

$pf_fallback_rules_enable defaults to "NO", preserving historic behaviour.

man page changes by ceri@.

PR:		256410
Reviewed by:	donner, kp
Sponsored by:	semaphor.dk
Differential Revision:	https://reviews.freebsd.org/D30791

(cherry picked from commit 28f47a199c)
2022-01-24 21:11:02 +01:00
Cy Schubert
bb66b7c06e rc.d/ntp: Ensure ntpd.leap-seconds.list is readable by ntpd
When a use sets umask in login.conf(5) to 027 or 077 a subsequently
fetched /var/db/ntpd.leap-seconds.list will inherit the permissions
allowed by the umask, resulting in a file that may not be readable
ntpd running under the ntp account. This patch adds a umask command
to preempt the umask in login.conf(5) prior to fetching a new copy
of the leap-seconds file.

PR:		261298
Reported by:	Martin Waschbusch <martin@waschbuesch.de>

(cherry picked from commit c6806434e7)
2022-01-23 12:23:08 -08:00
Edward Tomasz Napierala
c0163f4abe rc: make ctld depend on NETWORKING
This fixes a problem where ctld(8) would refuse to start on boot
with a specific IP address to listen on configured in ctl.conf(5).
It also fixes a problem where ctld(8) would fail to start with
some network interfaces which require a sysctl.conf(5) tweak
to configure them, eg to switch them from InfiniBand to IP mode.

PR:		232397

(cherry picked from commit 015351de04)
2022-01-21 09:45:20 +02:00
Emmanuel Vadot
3c49f0f9af Fix gssd rc.d installation
CONFGROUPS needs to be in CAPS

Fixes: a30235a4c3 ("pkgbase: Create a FreeBSD-kerberos package")
Reported by:	    kp

(cherry picked from commit 860ee1792a)
2022-01-14 14:43:40 +01:00
Emmanuel Vadot
12f4976f48 pkgbase: Create a FreeBSD-ftpd package
And put ftpd into it.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33453

(cherry picked from commit 20cd6e315e)
2022-01-05 18:23:52 +01:00
Emmanuel Vadot
d9a4b7b7bd pkgbase: Create a FreeBSD-tcpd package
And put the tcp-wrapper utilities in it.

Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33439

(cherry picked from commit 078b764da3)
2022-01-05 18:23:52 +01:00
Emmanuel Vadot
b2d245a0b0 pkgbase: Put more binaries/lib in runtime
Move some needed binaries/libs from FreeBSD-utilities to FreeBSD_runtime.
This is everything needed to boot to multiuser with FreeBSD-rc installed.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33435

(cherry picked from commit 93c4369096)
2022-01-05 18:23:51 +01:00
Emmanuel Vadot
26c7445164 pkgbase: Put yellow pages programs to its own package
YP is less and less used, split them to users have the choice to not
install them.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33441

(cherry picked from commit 5abb10faa1)
2022-01-05 18:23:51 +01:00
Emmanuel Vadot
d71c2dfc78 pkgbase: Create a FreeBSD-hyperv package
Put all hyperv utilities in it.

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

(cherry picked from commit db953e8b97)
2022-01-05 18:23:50 +01:00
Emmanuel Vadot
f5ab36c2e1 pkgbase: Create a FreeBSD-kerberos package
This allows users to install or not kerberos related utilities
and libs.

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

(cherry picked from commit a30235a4c3)
2022-01-05 18:23:50 +01:00
Emmanuel Vadot
872aa9c8a6 pkgbase: Create a FreeBSD-telnet package
both telnet and telnetd aren't that useful nowadays but some
might want them.
Create a FreeBSD-telnet package so users have a choice to have
them or not.

Differential Revision:	https://reviews.freebsd.org/D31791
Reviewed by: emaste

(cherry picked from commit c7fd29f0f2)
2022-01-05 18:23:49 +01:00
Konstantin Belousov
1a28d9343c rtld: load preloaded vdso
(cherry picked from commit c210ef1347)
2022-01-02 18:43:01 +02:00
Konstantin Belousov
d00ebd9b9c Pass vdso address to userspace
(cherry picked from commit 01c77a436e)
2022-01-02 18:43:01 +02:00
Bjoern A. Zeeb
1a30549073 rc: network.subr improve network6_getladdr()
In network6_getladdr() we are iterating over inet6 lines and are not
interested in any others.  So tell ifconfig to limit output to "inet6"
as much as possible.
This is probably a micro-optimisation but was noticed while looking
at other IPv6-related boot-time improvements.

(cherry picked from commit e448ff6f0e)
2021-12-29 16:01:46 +00:00
Cy Schubert
704945b0e0 hostapd: Fix wlan interfaces not UP/RUNNING
Like wpa_supplicant, hostapd does not automatically UP the interface
when configured. The fix is similar to 5fcdc19a81.

Reported by:	avg
Tested by:	avg

(cherry picked from commit 0da2c91e64)
2021-12-21 15:34:39 -08:00
Konstantin Belousov
ba839bc9d3 rtld: extract header validation into new helper check_elf_headers()
(cherry picked from commit 63fc4e820c)
2021-12-13 02:58:22 +02:00
Ed Maste
bf4a70bb40 libc: Use musl's optimized strchr and strchrnul
Parentheses added to HASZERO macro to avoid a GCC warning, and formatted
with clang-format as we have adopted these and don't consider them
'contrib' code.

Obtained from:	musl (snapshot at commit 4d0a82170a25)
Reviewed by:	kib (libc integration), mjg (both earlier)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17630

(cherry picked from commit 7f72497ef7)
2021-12-12 17:32:33 -05:00
Colin Percival
8056b73ea1 etc/defaults/rc.conf: Add -i flag to rtsol/rtsold
This disables the random (between zero and one seconds) delay before
rtsol and rtsold send a a Router Solicitation packet.  This delay is
specified as a SHOULD by RFC 4861 for avoidance of network congestion,
but network speeds have increased enough in the 25 years since this
first appeared (in RFC 1970) that it seems unnecessary as a default
at this point.

This speeds up the FreeBSD boot process by an average of 500 ms.

Reviewed by:	kp
Relnotes:	yes
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D33089

(cherry picked from commit e29711da23)
2021-12-05 10:27:37 -08:00
Mateusz Piotrowski
c88c1274ca rc: Hook zfskeys to the build
Reviewed by:	allanjude
Approved by:	allanjude (src)
MFC after:	3 days
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D33230

(cherry picked from commit bfb7a31b6a)
2021-12-05 18:07:41 +01:00
Mateusz Piotrowski
c180637708 os-release: Quote variables as documented in the manual
Variables must be quoted if they contain non-alphanumeric characters.

Warner noted in the review that the lack of quoting causing problems
here is rather an edge case. I believe that it's worth adding the quotes
here anyway because this is what the specification says and there is no
good reason not to follow it.

Reviewed by:	imp
Approved by:	imp (src)
MFC after:	7 days

(cherry picked from commit 169e06fa78)
2021-12-05 17:44:09 +01:00
Rick Macklem
2cd26a286a nfsd: Add a new rc variable nfs_server_maxio
Since vfs.nfsd.srvmaxio can only be set when nfsd.ko
is loaded, but nfsd is not running, setting it in
/etc/sysctl.conf is not feasible when "options NFSD"
was not specified for the kernel.

This patch adds a new rc variable nfs_server_maxio,
which sets vfs.nfsd.srvmaxio at the correct time.

rc.conf.5 will be patched separately.

(cherry picked from commit 5509bad74e)
2021-12-01 14:01:57 -08:00
Konstantin Belousov
a95dbfaa3d rtld_paths.h: Provide _PATH_ELF32_HINTS string, unconditionally
(cherry picked from commit f340188625)
2021-12-01 03:07:19 +02:00
Eugene Grosbein
f085bb0e62 rc.d/rctl: unbreak for distinct /usr filesystem
Both rctl and used xargs utility live in /usr/bin
so add REQUIRE: FILESYSTEMS

Reported by:	Peter <pmc@citylink.dinoex.sub.org>

(cherry picked from commit 0c54fe172a)
2021-11-23 15:29:41 +07:00
Konstantin Belousov
b26ac07d6c rtld dump_auxv: be pedantic and distiguish between auxv union members based on format
(cherry picked from commit b61bce17f3)
2021-11-19 06:25:27 +02:00
Konstantin Belousov
f363b08c6d rtld dump_auxv: consistently use long modifier for non-pointer auxv vals
(cherry picked from commit 3a902ef253)
2021-11-19 06:25:27 +02:00
Konstantin Belousov
8ade0046f6 rtld: Implement LD_SHOW_AUXV
(cherry picked from commit 64ba1f4cf3)
2021-11-19 06:25:27 +02:00
Konstantin Belousov
ec3bd288b6 rtld: add rtld_fdprintfx()
(cherry picked from commit 77c088ab21)
2021-11-19 06:25:27 +02:00
Konstantin Belousov
7647baa1e8 rtld: style adjustments
(cherry picked from commit 74aec9618f)
2021-11-10 21:36:20 +02:00
Konstantin Belousov
1d6fd007eb rtld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag
(cherry picked from commit c5637b8be8)
2021-11-10 21:36:20 +02:00
Konstantin Belousov
514a095250 rtld: fix dangerous_ld_env calculation for ld_dynamic_weak
(cherry picked from commit 8363963a8f)
2021-11-09 06:49:26 +02:00
Emmanuel Vadot
b6b9176030 rtld: Do not install libmap.conf when installing the COMPAT32 version
This has the effect of installing the same file twice at the same location
and confuse pkgbase as we add this file twice in the package config part.

MFC after:  1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit d0f0e0bd74)
2021-11-06 16:03:06 +01:00
Cy Schubert
33b73d010d wpa: Address CTRL-EVENT-SCAN-FAILED
5fcdc19a81 didn't fully resolve the issue. There remains a report
that an ifconfig wlan0 up by itself is insufficient. Ifconfig down
must precede it.

Reported by:	Filipe da Silva Santos <contact _ shiori_com_br>
Fixes:		5fcdc19a81

(cherry picked from commit d06d7eb091)
2021-11-04 11:30:25 -07:00
Cy Schubert
f9d2cbc6a5 wpa: Address CTRL-EVENT-SCAN-FAILED
Some installations may experience CTRL-EVENT-SCAN-FAILED when
associating to an AP. Installations that specify
ifconfig_wlan0="WPA ... up" in rc.conf do not experience
the problem whereas those which specify ifconfig_wlan0="WPA" without
the "up" will experience CTRL-EVENT-SCAN_FAILED.

However those that specify "up" in ifconfig_wlan0 will be able to
reproduce this problem by service netif stop wlan0;
service netif start wlan0. Interestingly The service netif stop/start
problem is reproducible on the older wpa 2.9 as well.

Reported by:	dhw
Reported by:	"Oleg V. Nauman" <oleg _ theweb_org_ua>
Reported by:	Filipe da Silva Santos <contact _ shiori_com_br>
Reported by:	Jakob Alvermark <jakob _ alvermark_net>

(cherry picked from commit 5fcdc19a81)
2021-11-04 11:30:25 -07:00
Konstantin Belousov
57dc5bdc12 rtld: Print currently configured search path for libraries for -v
(cherry picked from commit 40ddde6ef9)
2021-10-28 03:35:53 +03:00
Konstantin Belousov
a3876ab1eb rtld-elf/paths.h: Make it usable outside rtld
(cherry picked from commit 33dba3bb0e)
2021-10-23 02:32:27 +03:00
Fangrui Song
c99fa2c634 rtld: Support DT_RELR relative relocation format
(cherry picked from commit a7d137fcbc)
2021-10-23 02:32:27 +03:00
Konstantin Belousov
00df149452 crt_malloc: more accurate handling of mmap(2) failure
PR:	259076

(cherry picked from commit 73dddffc31)
2021-10-23 02:32:27 +03:00
Konstantin Belousov
e5a8b8152a crt_malloc: Be more persistent when handling mmap() failure
PR:	259076

(cherry picked from commit 19e008e7f7)
2021-10-23 02:32:27 +03:00
Konstantin Belousov
cf12f7ba97 crt_malloc: use uintptr_t instead of long for arithmetic on addresses
(cherry picked from commit 0b72d2965d)
2021-10-23 02:32:27 +03:00
Konstantin Belousov
5aebce3790 rtld direct exec: add -d option
(cherry picked from commit ba7f9c1b61)
2021-10-20 03:42:25 +03:00
Tom Hukins
0cd2f8f6ab Remove obsolete amd(8) rc.conf configuration
The script that used these was removed in 13f7dbe822 along with amd
itself.

Fixes:		13f7dbe822 ("retire amd(8)")
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/548

(cherry picked from commit 70ffa69e1b)
2021-10-11 20:38:06 -04:00
Kyle Evans
d330c24cc0 bootp: remove the USE_BFUNCS knob
We'd likely be better served by converting these to the equivalent mem*
calls, but just kill the knob for now. The b* macros being defined get
in the way of _FORTIFY_SOURCE.

(cherry picked from commit cfb9be5062)
2021-10-06 02:14:39 -05:00
Dan Langille
606d2063db Enable rc.d/jail within jails
Jails with jails is a supported. This change allows the script to run
upon startup with a jail. Without this, jails are not automatically
started within jails.

(cherry picked from commit 35cf9fecbd)
2021-08-29 09:37:13 +02:00