sys: Remove $FreeBSD$: one-line sh patternRemove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
Move most of the contents of opt_compat.h to opt_global.h.opt_compat.h is mentioned in nearly 180 files. In-progress networkdriver compabibility improvements may add over 100 more so this isclose
Move most of the contents of opt_compat.h to opt_global.h.opt_compat.h is mentioned in nearly 180 files. In-progress networkdriver compabibility improvements may add over 100 more so this iscloser to "just about everywhere" than "only some files" per theguidance in sys/conf/options.Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset ofsys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.his created on all architectures.Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control theset of compiled files.Reviewed by: kib, cem, jhb, jtlSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D14941
show more ...
sys/modules: normalize .CURDIR-relative paths to SRCTOPThis simplifies make output/logicTested with: `cd sys/modules; make ALL_MODULES=` on amd64MFC after: 1 monthSponsored by: Dell EMC Isilon
Add missed dependency.Submitted by: gcooperMFC after: 1 week
Remove opt_mac.h generation for various kernel modules that no longerrequire it.Submitted by: pjd
Rework the lifetime management of the kernel implementation of POSIXsemaphores. Specifically, semaphores are now represented as new filedescriptor type that is set to close on exec. This removes
Rework the lifetime management of the kernel implementation of POSIXsemaphores. Specifically, semaphores are now represented as new filedescriptor type that is set to close on exec. This removes the need forall of the manual process reference counting (and fork, exec, and exitevent handlers) as the normal file descriptor operations handle all ofthat for us nicely. It is also suggested as one possible implementationin the spec and at least one other OS (OS X) uses this approach.Some bugs that were fixed as a result include:- References to a named semaphore whose name is removed still work after the sem_unlink() operation. Prior to this patch, if a semaphore's name was removed, valid handles from sem_open() would get EINVAL errors from sem_getvalue(), sem_post(), etc. This fixes that.- Unnamed semaphores created with sem_init() were not cleaned up when a process exited or exec'd. They were only cleaned up if the process did an explicit sem_destroy(). This could result in a leak of semaphore objects that could never be cleaned up.- On the other hand, if another process guessed the id (kernel pointer to 'struct ksem' of an unnamed semaphore (created via sem_init)) and had write access to the semaphore based on UID/GID checks, then that other process could manipulate the semaphore via sem_destroy(), sem_post(), sem_wait(), etc.- As part of the permission check (UID/GID), the umask of the proces creating the semaphore was not honored. Thus if your umask denied group read/write access but the explicit mode in the sem_init() call allowed it, the semaphore would be readable/writable by other users in the same group, for example. This includes access via the previous bug.- If the module refused to unload because there were active semaphores, then it might have deregistered one or more of the semaphore system calls before it noticed that there was a problem. I'm not sure if this actually happened as the order that modules are discovered by the kernel linker depends on how the actual .ko file is linked. One can make the order deterministic by using a single module with a mod_event handler that explicitly registers syscalls (and deregisters during unload after any checks). This also fixes a race where even if the sem_module unloaded first it would have destroyed locks that the syscalls might be trying to access if they are still executing when they are unloaded. XXX: By the way, deregistering system calls doesn't do any blocking to drain any threads from the calls.- Some minor fixes to errno values on error. For example, sem_init() isn't documented to return ENFILE or EMFILE if we run out of semaphores the way that sem_open() can. Instead, it should return ENOSPC in that case.Other changes:- Kernel semaphores now use a hash table to manage the namespace of named semaphores nearly in a similar fashion to the POSIX shared memory object file descriptors. Kernel semaphores can now also have names longer than 14 chars (up to MAXPATHLEN) and can include subdirectories in their pathname.- The UID/GID permission checks for access to a named semaphore are now done via vaccess() rather than a home-rolled set of checks.- Now that kernel semaphores have an associated file object, the various MAC checks for POSIX semaphores accept both a file credential and an active credential. There is also a new posixsem_check_stat() since it is possible to fstat() a semaphore file descriptor.- A small set of regression tests (using the ksem API directly) is present in src/tools/regression/posixsem.Reported by: kris (1)Tested by: krisReviewed by: rwatson (lightly)MFC after: 1 month
Introduce MAC Framework and MAC Policy entry points to label and controlaccess to POSIX Semaphores:mac_init_posix_sem() Initialize label for POSIX semaphoremac_create_posix_sem()
Introduce MAC Framework and MAC Policy entry points to label and controlaccess to POSIX Semaphores:mac_init_posix_sem() Initialize label for POSIX semaphoremac_create_posix_sem() Create POSIX semaphoremac_destroy_posix_sem() Destroy POSIX semaphoremac_check_posix_sem_destroy() Check whether semaphore may be destroyedmac_check_posix_sem_getvalue() Check whether semaphore may be queriedmac_check_possix_sem_open() Check whether semaphore may be openedmac_check_posix_sem_post() Check whether semaphore may be posted tomac_check_posix_sem_unlink() Check whether semaphore may be unlinkedmac_check_posix_sem_wait() Check whether may wait on semaphoreUpdate Biba, MLS, Stub, and Test policies to implement these entry points.For information flow policies, most semaphore operations are effectivelyread/write.Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>Sponsored by: DARPA, McAfee, SPARTAObtained from: TrustedBSD Project
Add the rest of the kernel support for the sem_ API in kern/uipc_sem.c.Option 'P1003_1B_SEMAPHORES' to compile them in, or load the "sem" moduleto activate them.Have kern/makesyscalls.sh emit an
Add the rest of the kernel support for the sem_ API in kern/uipc_sem.c.Option 'P1003_1B_SEMAPHORES' to compile them in, or load the "sem" moduleto activate them.Have kern/makesyscalls.sh emit an include for sys/_semaphore.h into sysproto.hto pull in the typedef for semid_t.Add the syscalls to the syscall table as module stubs.