Commit graph

2667 commits

Author SHA1 Message Date
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
Konstantin Belousov
2c0233d2a0 rtld: constify most variables holding references to the environment values
(cherry picked from commit aa68b3bb2e)
2021-08-23 12:20:56 +03:00
Konstantin Belousov
2b5ccf507a rtld: provide private getenv(3)
(cherry picked from commit b4b2748891)
2021-08-23 12:20:56 +03:00
Konstantin Belousov
f2f2f23ad7 rtld: avoid use of of getenv(3) for evaluating rtld env vars (LD_XXX)
(cherry picked from commit bfd4c875a1)
2021-08-23 12:20:56 +03:00
Konstantin Belousov
2395d5ddbf rtld: rework how environment variables are named
(cherry picked from commit 451dc2b7cc)
2021-08-23 12:20:56 +03:00
Fangrui Song
edb509a026 rtld: Switch to the standard symbol lookup behavior if LD_DYNAMIC_WEAK is set
(cherry picked from commit 7da378f9de)
2021-08-23 12:20:56 +03:00
Fangrui Song
2aa761055c rtld: Remove calculate_tls_end
(cherry picked from commit 8f63fa78e8)
2021-08-23 12:20:56 +03:00
Fangrui Song
a3c0eaa3c2 rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0
(cherry picked from commit e6c7696203)
2021-08-23 12:20:56 +03:00
Alan Somers
2e6862b12b ftpd: delete dead code
Delete code killed by SVN r13139 in 1996.  Little chance that it would
still compile today.

PR:		257317
Reported by:	Alan Shearer <sakison@gmail.com>
Sponsored by:	Axcient

(cherry picked from commit 674400eb20)
2021-08-22 21:25:29 +00:00
Eirik Øverby
e81b2348d2 Add zfskeys rc.d script for auto-loading encryption keys
ZFS in 13 supports encryption, but for the use case where keys are
available in plaintext on disk there is no mechanism for automatically
loading keys on startup.

This script will, by default, look for any dataset with encryption and
keylocation prefixed with file://. It will attempt to unlock, timing
out after 10 seconds for each dataset found.
User can optionally specify explicitly which datasets to attempt to
unlock.

Also supports (optionally by force) unmounting filesystems and unloading
associated keys.

Sponsored by:	Modirum
Differential Revision:	https://reviews.freebsd.org/D30015

(cherry picked from commit 33ff39796f)
2021-08-22 14:53:21 +00:00
Konstantin Belousov
02e46073bd rtld: Round down relro_size
(cherry picked from commit c9f833abf1)
2021-08-20 12:31:46 +03:00
Mariusz Zaborski
98ef339d44 rtld: fix the man page
(cherry picked from commit e086aff91c)
2021-08-20 12:31:46 +03:00
Mariusz Zaborski
7b845dc144 rtld: introduce PRELOAD_FDS
(cherry picked from commit f90218886f)
2021-08-20 12:31:46 +03:00
Mariusz Zaborski
a90bcfbadd rtld: style nits
(cherry picked from commit 852a88a1d9)
2021-08-20 12:31:46 +03:00
Mark Johnston
61acafc6c6 rtld/arm64: Remove checks for undefined symbols when processing TPREL64
lld emits several GOT relocations referencing the null sumbol in libc.so
when compiled with -ftls-model=initial-exec.  This symbol is specified
to be undefined.

We generally do not handle dynamic TLS relocations against weak,
undefined symbols, so avoid printing a warning here.  This makes it
possible to compile libc.so using the initial-exec TLS model on arm64.

Reviewed by:	jrtc27, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f238ebd142)
2021-07-29 20:32:58 -04:00
Edward Tomasz Napierala
933cb282b6 Fix the 'linux' rc script on aarch64.
Previously it would try to load linux.ko instead of linux64.ko
and fail.  While here, don't try to match 'linuxaout'; even if
implemented, it's the same module as `linuxelf`.

Reviewed By:	emaste
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29288

(cherry picked from commit e026f4243c)
2021-07-27 15:57:55 -04:00
Warner Losh
00ed9aa54b devmatch: don't announce autoloading so much
devmatch rc script would announce it was loading a module multiple
times. It used kldload -n so it really wasn't loading it that many
times, but the message is confusing. Use kldstat to see if we need to
load the module before saying we do. This fixes the vast majority of the
problems. It may be possible to race devmatch with a user invocation and
devd, though quite hard. In that case we'll announce things twice, but
still only load it once. No attempt is made to fix this.

PR:			232782
MFC After:		2 weeks
Sponsored by:		Netflix

(cherry picked from commit 5549c6a62f)
2021-07-16 12:28:44 -06:00
Warner Losh
a4ce800b58 devmatch: Be tolerant of .ko being present.
We document that we did not need .ko on the module names in
devmatch_blocklist, but we really needed them. Keep the documentation
the same, but strip the .ko when we need to use the names so you can
specify either.

PR:			256240
MFC After:		2 weeks
Sponsored by:		Netflix

(cherry picked from commit b29ebb9c65)
2021-07-16 12:28:43 -06:00
Helge Oldach
1466c6253e devmatch: defer until after kld
devmatch loads a number of things automatically. Allow the list of
things to load to happen first in case those drivers affect what would
be loaded. Normally, this will produce the same results, but there's
some special cases that may not when drivers are loaded that report
other drivers missing, like virtio_pci.

PR:		253287
Reviewed by:	imp
MFC After:	2 weeks

(cherry picked from commit f68e3ea831)
2021-07-16 12:28:43 -06:00
Eugene Grosbein
5cc84f7ae5 rc.d: connect sysctl_lastload
Add recently added sysctl_lastload.

(cherry picked from commit 20eb969793)
2021-07-16 13:45:33 +07:00
Eugene Grosbein
c403205e55 ipfw: reload sysctl.conf variables if needed
Currently ipfw has multiple components that are not parts
of GENERIC kernel like dummynet etc. They can bring in important
sysctls if enabled with rc.conf(5) and loaded with ipfw startup script
by means of "required_modules" after initial consult
with /etc/sysctl.conf at boot time. Here is an example of one
increasing limit for dummynet hold queues that defaults to 100:

net.inet.ip.dummynet.pipe_slot_limit=1000

This makes it possible to use ipfw/dummynet rules such as:

ipfw pipe 1 config bw 50Mbit/s queue 1000

Such rule is rejected unless above sysctl is applied.
Another example is a group of net.inet.ip.alias.* sysctls
created after libalias.ko loaded as dependency of ipfw_nat.

This is not a problem if corresponding code compiled in custom kernel
so sysctls exist when sysctl.conf is read early or kernel modules
loaded with a loader. This change makes it work also for GENERIC
and modules loaded by means of rc.conf(5) settings.

(cherry picked from commit f5b5de1a32)
2021-07-16 13:40:39 +07:00
Eugene Grosbein
4ee2bcb486 rc.d: unbreak sysctl lastload
/etc/rc.d/securelevel is supposed to run /etc/rc.d/sysctl lastload
late at boot time to apply /etc/sysctl.conf settings that fail
to apply early. However, this does not work in default configuration
because of kern_securelevel_enable="NO" by default.

Add new script /etc/rc.d/sysctl_lastload that starts unconditionally.

Reported by:	Marek Zarychta

(cherry picked from commit f4b38c360e)
2021-07-16 13:35:11 +07:00
Ceri Davies
f00dd44f0a devmatch: improve naming of devmatch config variable
Accept the old rc.conf variable if the new one is not present for
compatability.

Approved by:	imp
Differential Revision:	https://reviews.freebsd.org/D30806

(cherry picked from commit c43b0081fa)
2021-07-08 16:14:07 -06:00
Alex Richardson
58137266b6 rtld-elf: Check the return value of obj_enforce_relro()
The mprotect() call was failing on CheriBSD when changing rtld's relro
page permissions due to missing CHERI capability permissions on the
mprotect() argument but did not report an error since the return value
was being ignored. It should never fail on any supported FreeBSD
architecture, but checking the return value seems like a good
sanity check to me.

Reviewed By:	kib, imp
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30820

(cherry picked from commit e3be51b2bc)
2021-07-05 10:46:12 +01:00
Emmanuel Vadot
624d52af5b pkgbase: Create a FreeBSD-nfs package
And move all the nfs related commands there.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D30754
Sponsored by:	Diablotin Systems
2021-06-30 09:24:32 +02:00