GETPLAB(2)

NAME
getplab, setplab - get or set process security label and privilege

SYNOPSIS
#include <sys/label.h>

getplab(labp, ceilp)
struct label *labp, *ceilp;

setplab(labp, ceilp)
struct label *labp, *ceilp;

DESCRIPTION
Getplab copies the security label and the ceiling label, usually simply called `the ceiling', of the current process into the structures pointed to by labp and ceilp. No copy happens for a zero pointer. The structure and meaning of labels are described in getflab(2). The ceiling is a security lid; the process can only access files with labels dominated by the ceiling.

A process may have special security `capabilities', in which case it is called `trusted'. The capabilities are obtained from the file it is executing, usually as `licensed' from its parent process; see exec(2). The capabilities and corresponding licenses are given by bits in the fields labp->lb_t and labp->lb_u respectively. The bits are defined by the masks

T_SETPRIV
    The process can change the privileges of files; see getflab(2).

T_SETLIC
    The process can increase its own licenses; see below.

T_EXTERN
    The process can bring new data sources into view by mounting file systems or setting labels of (open) special files; see getflab(2).

T_NOCHK
    Ordinary checks and changes of lattice values are not made when reading or writing files or inodes or when setting the process label.

T_UAREA
    The process can change certain information that may be accessed by descendent processes without label checks; see setuid(2) and stream(4).

T_LOG
    The process can change logging status; see syslog(2).

Setplab copies the structures pointed to by labp and ceilp into the process label and the ceiling label. Unless the process has capability T_NOCHK, the new lattice value of the process label must dominate the old and the old lattice value of the ceiling must dominate the new.

The new label flag must be L_BITS, and the lattice value of the new ceiling label must dominate the lattice value of the new process label.

Capabilities may not increase. Licenses may increase only if the process has capability T_SETLIC.

The fixity, lb_fix, of a process may be set only to F_LOOSE or F_FROZEN. In the latter case the process label can not change as a side effect of label checking.

The bits of the ceiling pointer are themselves labeled as if they were a minifile. When the ceiling is set by setplab, the minifile label is set to the old value of the process label, unless the process has capability T_SETLIC, in which the minifile label is set to bottom. When the ceiling is read by getplab, the minifile label is checked as if read by read(2).

DIAGNOSTICS
EFAULT, ELAB, EPRIV
If getplab cannot raise the process label to dominate the minifile label, the requested labels are filled in, with the ceiling being censored to flag L_NO , and ELAB is returned.

SEE ALSO
getflab(2), unsafe(2), exec(2), session(1), setlab(8)