Commit Graph

270125 Commits

Author SHA1 Message Date
Kristof Provost
76fe9df7a4 RELNOTES: mention 6rd support in if_stf
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33088
2021-11-23 16:49:12 +01:00
Kristof Provost
90c55481b2 pf: fix netpfil.common.dummynet:pf_nat test
This test failed if ipfw was loaded (as well as pf). pf used the same
tag as dummynet to indicate a packet had already gone through dummynet.
However, ipfw removes this tag, so pf didn't realise the packet had
already gone through dummynet.

Introduce a separate flag, in the existing pf mtag rather than re-using
the ipfw tag. There were no free flag bits, but PF_TAG_FRAGCACHE is no
longer used so its bit can be re-purposed.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33087
2021-11-23 16:46:35 +01:00
Kristof Provost
18d04cd2d4 pf: align IPv6 dummynet handling with IPv4
In e5c4987e3f we fixed issues with nat and dummynet, but only changed
the IPv4 code. Make the same change for IPv6 as well.

Reviewed by:	glebius
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33086
2021-11-23 16:46:15 +01:00
Kristof Provost
c36f90417b pf: remove unused variables
No functional change intended.

Reviewed by:	glebius
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33085
2021-11-23 16:44:37 +01:00
Andrew Turner
44ca369051 Move the arm64 identify_cpu SYSINIT earlier
It is used by late ifunc resolvers so needs to be at an earlier stage
of the boot. Previously it was at the same stage so may not have run
before the ifunc resolvers.

Sponsored by:	The FreeBSD Foundation
2021-11-23 15:03:51 +00:00
Mateusz Piotrowski
ee7485bef5 os-release.5: Fix quoting of dots
Dots needs to escaped with \& to be places inside Ql quotes.

MFC after:	3 days
2021-11-23 11:37:03 +01:00
Gleb Smirnoff
3bc40f39fd if_free: add a comment explaining why ifindex_free() is performed here 2021-11-22 19:59:27 -08:00
Gleb Smirnoff
fe499a8452 ifnet: merge if_destroy() and if_free_internal() into one
New function has more meaningful name if_free_deferred() and has
its header comment fixed to reflect reality.  NFC
2021-11-22 19:53:12 -08:00
Gleb Smirnoff
4787572d05 ifnet: make if_alloc_domain() never fail
The last consumer of if_com_alloc() is firewire.  It never fails
to allocate.  Most likely the if_com_alloc() KPI will go away
together with if_fwip(), less likely new consumers of if_com_alloc()
will be added, but they would need to follow the no fail KPI.
2021-11-22 19:49:57 -08:00
Gleb Smirnoff
1e3ca25d92 ifnet: make if_alloc_domain() static 2021-11-22 19:49:57 -08:00
Gleb Smirnoff
ce40632a31 ifnet: append if_debug.c to if.c
With this change if_index can become static.  There is nothing
that if_debug.c would want to isolate from if.c.  Potentially
if.c wants to share everything with if_debug.c.

Move Bjoern's copyright to if.c.

Reviewed by:	bz
2021-11-22 19:49:57 -08:00
Gleb Smirnoff
8a6f38c8ac ifnet: garbage collect drbr_*_drv().
They were left in 62d76917b8 but after years proved not to be useful.
2021-11-22 19:49:57 -08:00
Brooks Davis
b92f4ae58a freebsd32: regen
There there are two changes here. First, ofreebsd32_sigreturn
is declared to take a struct osigcontext rather than a struct
ia32_sigcontext3. This type is incorrect, but harmlessly so.
Second, the name of the unimplemented ogetkerninfo changes in
freebsd32_syscallnames.
2021-11-22 22:36:58 +00:00
Brooks Davis
be67ea40c5 freebsd32: generate from sys/kern/syscalls.master
This avoids the need to keep a freebsd32-specific syscalls.master
in sync with the default ABI.  As evidenced by the number of commits
required to sync the two, it is extremely easy for them to get out
of sync due to misunderstandings and user errors.

Reviewed by:	kevans, kib
2021-11-22 22:36:58 +00:00
Brooks Davis
799ce8b8d2 syscalls: annotate args pointing to long, pointer, or time_t
Add _Contains_ annotations indicating that the data pointed to by a
pointer argument contains types that vary between FreeBSD ABIs. The
supported set is long (including size_t), pointer (including
intptr_t), and time_t.  The first two vary between 32- and 64-bit
ABIs.  The laste betwen i386 and everything else.

These will be used to detect which syscalls require handling on
particular ABIs.

Reviewed by:	kevans, kib
2021-11-22 22:36:58 +00:00
Brooks Davis
f260a69dec makesyscalls: strip _Contains_ argument annotations
Reviewed by:	kevans
2021-11-22 22:36:58 +00:00
Brooks Davis
64cc9803ab makesyscalls: add override of ABI change detection
While we can detect most ABI changes through analysis of
syscalls.master with suitable annotations, to cases are handled
in the core implementation and others have changes that can not be
infered.  Add two new config variables syscall_abi_change and
syscall_no_abi_change which override the detected value.  Both are
space-seperated lists of syscall names.

Reviewed by:	kevans
2021-11-22 22:36:58 +00:00
Brooks Davis
988e8db3c0 makesyscalls: automate detection of ABI changes
Use pattern matching including matches of _Contains_*_ argument
annotations to (mostly) determine which system calls require
ABI-specific handling.  Automatically treat syscalls as NOPROTO
if no ABI changes are present.

Reviewed by:	kevans
2021-11-22 22:36:58 +00:00
Brooks Davis
804a84fbf2 makesyscalls.lua: Add the ABI function prefix reliably.
The previous code mostly worked, but ended up adding bogus sys_<foo>()
declerations.

Reviewed by:	kevans
2021-11-22 22:36:58 +00:00
Brooks Davis
5e70931184 makesyscalls: allow config to force OBSOL and UNIMPL
The obsol and unimpl config variables are space-seperated lists of
syscalls that should treated as being declared OBSOL and UNIMPL.

The allows an ABI to exclude select system calls listed in
syscalls.master.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
30bc335a05 freebsd32: regen 2021-11-22 22:36:57 +00:00
Brooks Davis
faa67c2b20 freebsd32: generate splits of 64-bit arguments
This eliminates the need for ifdefs in syscalls.master and contains the
largest set of diff to generated files on the way to switching to using
the default ABI's syscalls.master.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
6b7c23a026 syscalls: regen 2021-11-22 22:36:57 +00:00
Brooks Davis
64007b000a makesyscalls: handle 64-bit args on 32-bit
On 32-bit architectures, 64-bit arguments are passed in pairs of
registers. On non-x86 architectures these arguments must be in evenly
aligned registers which necessiciates inserting a pad register into the
argument list. This has historically been supported by adding ifdefs
around padded and unpadded syscall defintions in syscalls.master.

In order to enable generation of 32-bit support files from the base
syscalls.master, pull this support in to makesyscalls.lua enabled by
adding pair_64bit to abi_flags.

The changes to sys_proto.h simply add #ifdef PAD64_REQUIRED
around pad arguments in struct <syscall>_args. In systrace_args(),
replace static syscall index values with post-incremented indexs
allowing a simple ifdef around the argument. Under -O1 or higher
code generation is identical. systrace_entry_setargdesc() is a bit
more complicated as we switch on argument indices.  Solve this
with some use of define/undef pairs to compute the correct indices.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
79634eb90b makesyscalls: handle arrays of pointers
When the config variable abi_intptr_t is not "", transform arrays of
pointers to arrays of abi_intptr_t.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
0a4e16446b makesyscalls: handle longs in ABI compat
Replace long-derived types with their abi equivalent where
required by the target ABI. There are two cases:
 - All pointers to types that go from 64-bit to 32-bit between the
   default ABI and the target ABI.
 - Signed arguments that go from 64-bit to 32-bit (these require
   sign-extension before passing to general kernel ABIs).

This adds four new config variables: abi_long, semid_t, abi_size_t,
and abi_u_long which default to long, size_t, and u_long respectively.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
b85fb39047 makesyscalls.lua: Allow translation of intptr_t arguments
Translate instances of intptr_t to the config value abi_intptr_t
(defaults to "intptr_t").  Used in CheriABI to translate intptr_t
to intcap_t for hybrid kernels.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
f0cfbffc36 syscalls: regen 2021-11-22 22:36:56 +00:00
Brooks Davis
37b425bd05 makesyscalls: intptr_t arguments are pointers
Match intptr_t arguments as pointers.  Currently this is a no-op
change to systrace_args.c.

Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
3f8f46a0ae makesyscalls: Add a way to include per-ABI headers
When the string %%ABI_HEADERS%% is found in syscalls.master, replace
it with the contents of the abi_headers config variable.  This allows
an ABI-specific syscalls.conf to add lines like:

	#include <compat/freebsd32/freebsd32.h>

when working from a shared syscalls.master.

Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
ed8a4423fb makesyscalls: allow multiple expressions for each abi change
Limitations in lua patterns means we need to be able to match more
than one possible expression.

Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
818aa9543d makesyscalls: Fix expression for time_t_size
Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
5203efead7 makesyscalls: Remove _native suffix handling
This supported a hack we used in CheriBSD which has been removed.

Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
97fdcfcaf7 freebsd32: remove unnecessicary headers
Reviewed by:	kib
2021-11-22 22:36:56 +00:00
Brooks Davis
bcd07aaa4e freebsd32: regen 2021-11-22 22:36:56 +00:00
Brooks Davis
6eefabd4ca syscalls: improve nstat, nfstat, nlstat
Optionally return errors when truncating dev_t, ino_t, and nlink_t.
In the interest of code reuse, use freebsd11_cvtstat() to perform the
truncation and error handling and then convert the resulting struct
freebsd11_stat to struct nstat.

Add missing freebsd32 compat syscalls. These syscalls require
translation because struct nstat contains four instances of struct
timespec which in turn contains a time_t and a long.

Reviewed by:	kib
2021-11-22 22:36:56 +00:00
Brooks Davis
8460d3e9e6 freebsd32: regen 2021-11-22 22:36:55 +00:00
Brooks Davis
151ddfec6f freebsd32: add _'s to _umtx_(un)lock
This aligns with the default ABI's configuration.

Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
b2be098e52 freebsd32: enable orecvfrom
It requires no translation, just a correct decleration.

Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
2d691434d5 freebsd32: declare ogetsockname correctly
Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
6f5eb383bd freebsd32: sync some osig* audit flags with default ABI
Discussed with:	rwatson

Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
802280ada8 freebsd32: sctp syscalls take struct iovec32
Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
06759303ec freebsd32: aio_cancel takes a struct aiocb32
Strictly speaking, it takes a virtual address and doesn't touch the
object directly, but this is consistant with other aio_*() syscalls.

Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
e11f2743ff freebsd32: [gs]etgroups take an int gidsetsize
Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
e54a870e35 freebsd32: make semsys take int arguments
This matches the default ABI.

Reviewed by:	kib
2021-11-22 22:36:54 +00:00
Brooks Davis
1eacca4397 freebsd32: make fcntl's arg argument int32_t
It's a long in the default ABI so this is consistant with other caes.

Reviewed by:	kib
2021-11-22 22:36:54 +00:00
Brooks Davis
d330857439 syscalls: regen 2021-11-22 22:36:54 +00:00
Brooks Davis
00e0a4c0d7 syscalls: abort2 doesn't return so declare as void
Reviewed by:	kib
2021-11-22 22:36:54 +00:00
Brooks Davis
4b2e1f1480 syscalls: umask returns a mode_t
Reviewed by:	kib
2021-11-22 22:36:54 +00:00
Brooks Davis
27f5b514a0 syscalls: update a few return types to ssize_t
Reviewed by:	kib
2021-11-22 22:36:54 +00:00