UNSAFE(2)

NAME
unsafe - detect potential file security violations

SYNOPSIS
#include <sys/types.h>

unsafe(nfd, readfds, writefds)
fd_set *readfds, *writefds;

DESCRIPTION
Unsafe examines file descriptors 0 through nfd-1 and sets the corresponding bits of the masks in readfds and writefds to indicate files that are not known to be safe (i.e. to satisfy security label rules) for reading or writing respectively. The bit masks are indexed and manipulated as described in select(2).

At the same time, if the process has capability T_NOCHK (see getplab(2)), all file descriptors indicated by ones among the first nfd bits of the previous values of readfds and writefds are marked safe to read or write respectively.

Potentially unsafe situations arise from changes in file label caused by this or other processes, changes in process label, and file opening.

To prevent unintended violations of security policy, programs with capability NOCHK must monitor label changes. For this purpose the process label may be frozen (see getplab(2)) to prevent unintended automatic label changes. SIGLAB may be used to detect changes in file labels (see signal(2)), and unsafe to pinpoint them.

DIAGNOSTICS
EFAULT

SEE ALSO
getflab(2), getplab(2), signal(2), select(2)