Commit graph

2627 commits

Author SHA1 Message Date
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
Andriy Gapon
e7ca75cb75 rc.d: liberate powerd from ACPI dependency
For instance, many non-ACPI ARM systems have CPU power / frequency
levels.

(cherry picked from commit 20eb6bd8c5)
2021-06-16 13:46:21 +03:00
Konstantin Belousov
59a876238f rtld: Rename -t option to -u (ignore LD_ vars)
(cherry picked from commit e3149e0a02)
2021-06-04 03:32:50 +03:00
Konstantin Belousov
99e1896f20 rtld direct exec: add option to ignore LD_ variables
(cherry picked from commit d81f999ac2)
2021-06-04 03:32:50 +03:00
Konstantin Belousov
db4a2731e9 rtld: initialize default dlerror_seen_val as true
PR:	255698

(cherry picked from commit 529ab5a759)
2021-05-19 06:13:14 +03:00
Konstantin Belousov
29b896e67d rtld: preserve the 'seen' state of the dlerror message in errmsg_save()
PR:	255698

(cherry picked from commit 630caa95d4)
2021-05-19 06:13:14 +03:00
Lutz Donnerhacke
e0f2b8aaf1 service/ipfw: Silence warning on restart
Once the ipfw0 interface has been created, ifconfig(8) create will
throw a warning: "ifconfig: create: bad value" when trying to create
it again.

PR:		241013
Submitted by:	Jose Luis Duran
Approved by:	kp
Differential Revision: https://reviews.freebsd.org/D30083

(cherry picked from commit 5c4fe2ac81)
2021-05-17 08:08:41 +02:00
Kristof Provost
3711a14493 (t)ftp-proxy: use libpfctl
Reviewed by:	glebius
MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29641

(cherry picked from commit 95be9288f0)
2021-05-07 10:15:42 +02:00
Konstantin Belousov
13e0ef8230 rtld_lock.h: add some comments about versioning of struct RtldLockInfo
(cherry picked from commit 9b33518ada)
2021-04-23 14:14:08 +03:00
Konstantin Belousov
7bbfb5d959 rtld: make dlerror() thread-local
(cherry picked from commit 4d9128da54)
2021-04-23 14:14:08 +03:00
Konstantin Belousov
b75aa0eaf3 rtld: workaround for broken ABI
(cherry picked from commit 08bfbd4359)
2021-04-23 14:14:08 +03:00
Konstantin Belousov
fe86eb8f34 rtld: unstaticise lockinfo and obj_from_addr()
(cherry picked from commit 4d7f08c84b)
2021-04-23 14:14:08 +03:00
Konstantin Belousov
b26e7715b0 rtld: use _get_tp() in __tls_get_addr()
(cherry picked from commit e8b9c508b7)
2021-04-23 14:14:07 +03:00
Konstantin Belousov
e703bd6341 rtld: avoid recursing on rtld_bind_lock for write
(cherry picked from commit 7cb32a0d03)
2021-04-23 14:14:07 +03:00
Konstantin Belousov
ab34960582 rtld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked
(cherry picked from commit 8950804842)
2021-04-23 14:14:07 +03:00
Konstantin Belousov
127849157a rtld: style tls_get_addr_slow
(cherry picked from commit 85d846b369)
2021-04-23 14:14:07 +03:00
Konstantin Belousov
4bcc2e90a0 rtld: define TLS_DTV_OFFSET on all architectures
(cherry picked from commit 99c2ce7ef1)
2021-04-23 14:14:07 +03:00
Konstantin Belousov
520806c476 rtld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc
(cherry picked from commit 34ca6025dd)
2021-04-23 14:14:07 +03:00
Konstantin Belousov
d252df1e11 rtld/x86/reloc.c: style
(cherry picked from commit f61ecf60cf)
2021-04-23 14:14:06 +03:00
Konstantin Belousov
1bcab3da2b rtld_lock.h: remove tautological extern's
(cherry picked from commit 38e0610df7)
2021-04-23 14:14:06 +03:00
Konstantin Belousov
c3f97dd75a rtld dl_iterate_phdr(): dlpi_tls_data is wrong
(cherry picked from commit d36d681615)
2021-04-23 14:14:06 +03:00
Rick Macklem
85ad493677 mountd(8): generate a syslog message when the "V4:" line is missing
Daniel reported that NFSv4 mounts were not working despite having
set "nfsv4_server_enable=YES" in /etc/rc.conf.  Mountd was logging a
message that there was no /etc/exports file.
He noted that creating a /etc/exports file with a "V4:" line in it
was needed make NFSv4 mounts work.
At least one "V4:" line in one of the exports(5) file(s) is needed to
make NFSv4 mounts work. This patch fixes mountd.c so that it logs a
message indicting that there is no "V4:" line in any exports(5)
file when NFSv4 mounts are enabled.
To avoid this message being generated erroneously, /etc/rc.d/mountd
is updated to make sure vfs.nfsd.server_max_nfsvers is properly set
before mountd(8) is started.

PR:	253901

(cherry picked from commit 09673fc0f3)
2021-03-27 12:52:15 -07:00
Dag-Erling Smørgrav
c6aa83342e MFC: Fix post-start check when unbound.conf has moved.
On behalf of:	des
Reported by:	phk@
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 409388cfac)
2021-03-23 20:56:33 -04:00
Alex Richardson
e0b0299057 rc.d/auditd: set pidfile
auditd creates a pidfile so we should use it for status checks.
This also seems to speed up the frequent onestatus checks used in
tests/sys/audit.

Reviewed By:	asomers
Differential Revision: https://reviews.freebsd.org/D28389

(cherry picked from commit bcc5b24456)
2021-03-17 09:53:17 +00:00
Rick Macklem
59f6f5e23c nfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd
Add rc.d scripts that control the recently committed rpc.tlsclntd(8)
and rpc.tlsservd(8) daemons.

(cherry picked from commit 2f48313ab2)
2021-03-05 13:55:44 -08:00
Edward Tomasz Napierala
5dc2e1bcf4 Don't check compat.linux.emul_path before loading linux(4)
Fix e40787f900 to make libexec/rc/rc.d/linux retrieve the sysctl
after loading the kernel module which provides it, not before.

Reported By:	jkim
Sponsored By:	The FreeBSD Foundation

(cherry picked from commit 07cac176fb)
2021-03-02 18:43:26 +00:00
Edward Tomasz Napierala
1b2802ed4e Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux
In /etc/rc.d/linux the mounting paths of procfs, sysfs and devfs
are hardcoded to "/compat/linux".  Switching to the content of
compat.linux.emul_path sysctl would allow to switch linuxulator
to different place.

Submitted by:	freebsdnewbie_freenet.de
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27807

(cherry picked from commit e40787f900)
2021-03-02 18:43:26 +00:00
Chris Rees
ce94bedf47 Create dhclient pid directory if it doesn't exist
- Upgrading from older FreeBSD versions can result in errors

 - /var/run can be a tmpfs, and this should be handled correctly

Approved by:	markj
Differential:	https://reviews.freebsd.org/D28843
MFC after:	2 weeks
2021-03-02 18:12:34 +00:00
David Chisnall
7d9e00cd8b rtld: Fix null-pointer dereference
(cherry picked from commit 43d44842ae)
2021-02-09 06:14:48 +02:00
Kyle Evans
13de72571e stand: lua: enhance lfs.dir() to speed up kernels_autodetect
This eliminates a lot of stat() calls that happen when lualoader renders the
menu with the default settings, and greatly speeds up rendering on my
laptop.

ftype is nil if loader/loader.efi hasn't been updated yet, falling back to
lfs.attributes() to test.

This is technically incompatible with lfs, but not in a particularly
terrible way.

(cherry picked from commit e25ee296c9)
2021-02-03 00:55:47 -06:00
Glen Barber
bfd1570515 Create the stable/13 branch
Prune *-NODEBUG kernels.
Turn off debug options.
Bump to ALPHA2.

Approved by:	re (implicit)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-01-21 19:08:57 -05:00
Stefan Eßer
24f44a445c Remove dependency on files in /usr/bin
In order to reduce the pre-requisites of this file, implement the
pattern matching and creation of a temporary test directory without
use of grep respectively mktemp.

The new version makes it possible to provide a writable /tmp in any
case and independently of other local or remote file systems (except /
and /dev) being mounted.

The use of "dd if=/dev/random" has the same dependency on /dev/random
being operational as the previous version that used "mktemp". If this
is found to be an issue on platforms that do not have gathered
sufficient entropy at the time when this scriot is run, I suggest to
replace the "dd" command with "ps lauxww" to get a somewhat random
test directory name.

Approved by:	rgrimes, glebius, cy
MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D28209
2021-01-19 12:56:23 +01:00
Marius Strobl
33b486472e bluetooth: remove support for bt3c(4)
The latter has been removed in 23e124c78b.
2021-01-16 23:53:13 +01:00
Gleb Smirnoff
4f48fd7c56 Add 'tmp' to the list of FILESYSTEMS dependencies. Some scripts that
depend on FILESYSTEMS run mktemp(1).  For systems that have read-only
root this is broken until memory disk based /tmp is instantiated.  At
least 'os-release' and 'motd' are subject to this problem.

Reviewed by:		ngie
Differential Revision:	https://reviews.freebsd.org/D28097
2021-01-15 12:44:06 -08:00
Gleb Smirnoff
7e4eca7136 Revert 97ec6eba65. There shouldn't be a dependency of 'tmp' on
remote filesystems.  Discussed this with Brooks and he can't find
evidence that provoked the change in 2005.  If anything gets broken
I will fix it in a different way, not via rc sequence change.

Discussed with:		brooks
Reviewed by:		ngie
Differential Revision:	https://reviews.freebsd.org/D28097
2021-01-15 12:44:06 -08:00
Gleb Smirnoff
425f68e6ce Follow-up on 51da4b19be. When booting a system with WITHOUT_IPFILTER
the following warning printed at boot time:

  rcorder: requirement `ipfs' in file `/etc/rc.d/netif' has no providers.

Close that using BEFORE rather than REQUIRE for writing down
dependencies of optional components.
2021-01-11 12:36:54 -08:00
Gleb Smirnoff
2903606b60 Add missing rcvar name for os-release. 2021-01-11 08:36:37 -08:00
Ed Maste
10cc3e39d6 Retire obsolete a.out rtld
This was disconnected from the build in 2001 in commit 66422f5b7a
with a comment that it was long overdue even then.

Sponsored by:	The FreeBSD Foundation
2021-01-07 18:50:01 -05:00
Ed Maste
613a08cfa2 rtld: map without PROT_EXEC for relocation
This makes text segment relocation work under W^X.

Submitted by:	Greg V <greg@unrelenting.technology> (original version)
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27953
2021-01-05 10:57:14 -05:00
Emmanuel Vadot
e3ff9a1f2e pkgbase: Put the last rc files in the rc package
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D27718
2021-01-04 16:21:13 +01:00
Emmanuel Vadot
066a8c691e pkgbase: Install atf and kyua in the tests package
While here make sure that all tests dirs are taggued correctly.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D27714
2021-01-04 16:20:47 +01:00