Revision tags: release/14.2.0, release/13.4.0 |
|
#
ddb3eb4e |
| 18-Jul-2024 |
Olivier Certner <olce@FreeBSD.org> |
New setcred() system call and associated MAC hooks
This new system call allows to set all necessary credentials of a process in one go: Effective, real and saved UIDs, effective, real and saved GIDs
New setcred() system call and associated MAC hooks
This new system call allows to set all necessary credentials of a process in one go: Effective, real and saved UIDs, effective, real and saved GIDs, supplementary groups and the MAC label. Its advantage over standard credential-setting system calls (such as setuid(), seteuid(), etc.) is that it enables MAC modules, such as MAC/do, to restrict the set of credentials some process may gain in a fine-grained manner.
Traditionally, credential changes rely on setuid binaries that call multiple credential system calls and in a specific order (setuid() must be last, so as to remain root for all other credential-setting calls, which would otherwise fail with insufficient privileges). This piecewise approach causes the process to transiently hold credentials that are neither the original nor the final ones. For the kernel to enforce that only certain transitions of credentials are allowed, either these possibly non-compliant transient states have to disappear (by setting all relevant attributes in one go), or the kernel must delay setting or checking the new credentials. Delaying setting credentials could be done, e.g., by having some mode where the standard system calls contribute to building new credentials but without committing them. It could be started and ended by a special system call. Delaying checking could mean that, e.g., the kernel only verifies the credentials transition at the next non-credential-setting system call (we just mention this possibility for completeness, but are certainly not endorsing it).
We chose the simpler approach of a new system call, as we don't expect the set of credentials one can set to change often. It has the advantages that the traditional system calls' code doesn't have to be changed and that we can establish a special MAC protocol for it, by having some cleanup function called just before returning (this is a requirement for MAC/do), without disturbing the existing ones.
The mac_cred_check_setcred() hook is passed the flags received by setcred() (including the version) and both the old and new kernel's 'struct ucred' instead of 'struct setcred' as this should simplify evolving existing hooks as the 'struct setcred' structure evolves. The mac_cred_setcred_enter() and mac_cred_setcred_exit() hooks are always called by pairs around potential calls to mac_cred_check_setcred(). They allow MAC modules to allocate/free data they may need in their mac_cred_check_setcred() hook, as the latter is called under the current process' lock, rendering sleepable allocations impossible. MAC/do is going to leverage these in a subsequent commit. A scheme where mac_cred_check_setcred() could return ERESTART was considered but is incompatible with proper composition of MAC modules.
While here, add missing includes and declarations for standalone inclusion of <sys/ucred.h> both from kernel and userspace (for the latter, it has been working thanks to <bsm/audit.h> already including <sys/types.h>).
Reviewed by: brooks Approved by: markj (mentor) Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47618
show more ...
|
Revision tags: release/14.1.0 |
|
#
5d88a2aa |
| 15-Apr-2024 |
Brooks Davis <brooks@FreeBSD.org> |
sysproto.h: sys/acl.h -> sys/types.h
In sysproto.h, stop including sys/acl.h as syscall defintions now use __acl* types from sys/_types.h. Add sys/types.h to provide types previously provided by sy
sysproto.h: sys/acl.h -> sys/types.h
In sysproto.h, stop including sys/acl.h as syscall defintions now use __acl* types from sys/_types.h. Add sys/types.h to provide types previously provided by sys/param.h (via sys/acl.h).
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D44467
show more ...
|
#
e07d37c7 |
| 19-Mar-2024 |
Brooks Davis <brooks@FreeBSD.org> |
sysent: regen
|
Revision tags: release/13.3.0 |
|
#
ab89c5f7 |
| 01-Dec-2023 |
Brooks Davis <brooks@FreeBSD.org> |
sysproto.h: regen after c1c8afd04e34d
|
Revision tags: release/14.0.0 |
|
#
af93fea7 |
| 24-Aug-2023 |
Jake Freeland <jfree@freebsd.org> |
timerfd: Move implementation from linux compat to sys/kern
Move the timerfd impelemntation from linux compat code to sys/kern. Use it to implement the new system calls for timerfd. Add a hook to ker
timerfd: Move implementation from linux compat to sys/kern
Move the timerfd impelemntation from linux compat code to sys/kern. Use it to implement the new system calls for timerfd. Add a hook to kern_tc to allow timerfd to know when the system time has stepped. Add kqueue support to timerfd. Adjust a few names to be less Linux centric.
RelNotes: YES Reviewed by: markj (on irc), imp, kib (with reservations), jhb (slack) Differential Revision: https://reviews.freebsd.org/D38459
show more ...
|
#
9121945d |
| 09-Jun-2023 |
Warner Losh <imp@FreeBSD.org> |
Regenerate sysent stuff after $FreeBSD$ removal
Sponsored by: Netflix
|
Revision tags: release/13.2.0, release/12.4.0, release/13.1.0 |
|
#
8601fca7 |
| 28-Mar-2022 |
Brooks Davis <brooks@FreeBSD.org> |
sysent: regen for syscallarg_t
|
#
0910a41e |
| 13-Jan-2022 |
Brooks Davis <brooks@FreeBSD.org> |
Revert "syscallarg_t: Add a type for system call arguments"
Missed issues in truss on at least armv7 and powerpcspe need to be resolved before recommit.
This reverts commit 3889fb8af0b611e3126dc250
Revert "syscallarg_t: Add a type for system call arguments"
Missed issues in truss on at least armv7 and powerpcspe need to be resolved before recommit.
This reverts commit 3889fb8af0b611e3126dc250ebffb01805152104. This reverts commit 1544e0f5d1f1e3b8c10a64cb899a936976ca7ea4.
show more ...
|
#
3889fb8a |
| 12-Jan-2022 |
Brooks Davis <brooks@FreeBSD.org> |
sysent: regen for syscallarg_t
|
#
b7c55487 |
| 08-Dec-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
Regen
|
Revision tags: release/12.3.0 |
|
#
0e765d9b |
| 29-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
syscalls: regen
|
#
b92f4ae5 |
| 22-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
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
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.
show more ...
|
#
30bc335a |
| 22-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: regen
|
#
bcd07aaa |
| 22-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: regen
|
#
8460d3e9 |
| 22-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: regen
|
#
fea4a9af |
| 18-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
fspacectl: remove unneeded freebsd32 wrapper
fspacectl(2) does not require special handling on freebsd32. The presence of off_t in a struct does not cause it's size to change between the native ABI
fspacectl: remove unneeded freebsd32 wrapper
fspacectl(2) does not require special handling on freebsd32. The presence of off_t in a struct does not cause it's size to change between the native ABI and the 32-bit ABI supported by freebsd32 because off_t is always int64_t on BSD systems. Further, byte order only requires handling for paired argument or return registers.
(32-byte alignment of 64-bit objects on i386 can require special handling, but that situtation does not apply here.)
Reviewed by: kib, khng, emaste, delphij Differential Revision: https://reviews.freebsd.org/D32994
show more ...
|
#
572be9c8 |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: sync some audit types with default ABI
Reviewed by: kevans
|
#
265a4b83 |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: semid_t -> int32_t
semid_t is historically an intptr_t so it should be an int32_t.
Reviewed by: kevans
|
#
a016320d |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: rename 32-bit compat pads to _pad
Some 32-bit architectures pass 64-bit values in aligned register pairs (a0,a1), (a2,a3) etc. In freebsd32 we add these pads explicitly from compat code.
freebsd32: rename 32-bit compat pads to _pad
Some 32-bit architectures pass 64-bit values in aligned register pairs (a0,a1), (a2,a3) etc. In freebsd32 we add these pads explicitly from compat code. We also sometimes add pads in the default ABI. Differentiate the two by making the freebsd32 ones int _pad. In a future commit the 32-bit ones will be automatically generated.
Reviewed by: kevans
show more ...
|
#
158dcd73 |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: have sigqueue take a void *
This matches the default ABI and we work around issues with union sigval by extracting the bottom 32-bits in a manual handler.
Reviewed by: kevans
|
#
2b9d052d |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: fix getfsstat sign extension bugs
Add freebsd32 versions of getfsstat and freebsd11_getfsstat so that bufsize is properly sign-extended if a negative value is passed. Reject negative valu
freebsd32: fix getfsstat sign extension bugs
Add freebsd32 versions of getfsstat and freebsd11_getfsstat so that bufsize is properly sign-extended if a negative value is passed. Reject negative values before passing to kern_getfsstat as a size_t.
Reviewed by: kevans
show more ...
|
#
f19e3fd2 |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: signed long corrections
Syscalls that take signed longs need to treat the 32-bit versions as signed int so that sign extension happens correctly. Improve decleration quality and add a fe
freebsd32: signed long corrections
Syscalls that take signed longs need to treat the 32-bit versions as signed int so that sign extension happens correctly. Improve decleration quality and add a few minimal syscall implementations.
Reviewed by: kevans
show more ...
|
#
d257e57d |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: add missing pads to preadv and pwritev
Reviewed by: kevans
|
#
f089a2f3 |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: add stubs for ofreebsd32_(send|recv)msg
The upcoming change to generate freebsd32 generated files from sys/kern/syscalls.master doesn't have a way to handle disabling this one without dis
freebsd32: add stubs for ofreebsd32_(send|recv)msg
The upcoming change to generate freebsd32 generated files from sys/kern/syscalls.master doesn't have a way to handle disabling this one without disabling the non-COMPAT counterpart so just add a stub for now.
Reviewed by: kevans
show more ...
|
#
e02f64d9 |
| 17-Nov-2021 |
Brooks Davis <brooks@FreeBSD.org> |
freebsd32: add real abort2
Previously, the code would copy twice as many pointers as specified and print pairs of them a single 64-bit pointer.
abort2 doesn't return so make the return type void
f
freebsd32: add real abort2
Previously, the code would copy twice as many pointers as specified and print pairs of them a single 64-bit pointer.
abort2 doesn't return so make the return type void
freebsd32_abort2 is in it's own file with a 2-clause BSD license based on a discussion with Wojciech many years ago.
Reviewed by: kevans
show more ...
|