1avc_open(3)                SELinux API documentation               avc_open(3)
2
3
4

NAME

6       avc_open,  avc_destroy,  avc_reset, avc_cleanup - userspace SELinux AVC
7       setup and teardown.
8

SYNOPSIS

10       #include <selinux/selinux.h>
11
12       #include <selinux/avc.h>
13
14       int avc_open(struct selinux_opt *options, unsigned nopt);
15
16       void avc_destroy(void);
17
18       int avc_reset(void);
19
20       void avc_cleanup(void);
21

DESCRIPTION

23       avc_open initializes the userspace AVC and must be  called  before  any
24       other AVC operation can be performed.
25
26       avc_destroy  destroys  the  userspace  AVC, freeing all internal memory
27       structures.  After this call has been made,  avc_open  must  be  called
28       again before any AVC operations can be performed.
29
30       avc_reset  flushes  the  userspace AVC, causing it to forget any cached
31       access decisions.  The userspace AVC normally calls this function auto‐
32       matically when needed, see NETLINK NOTIFICATION below.
33
34       avc_cleanup  attempts  to  free unused memory within the userspace AVC,
35       but does not flush any cached access decisions.   Under  normal  opera‐
36       tion, calling this function should not be necessary.
37
38

OPTIONS

40       The  userspace  AVC obeys callbacks set via selinux_set_callback(3), in
41       particular the logging and audit callbacks.
42
43       The options which may be passed to avc_open include the following:
44
45
46       AVC_OPT_SETENFORCE
47              This option forces the userspace AVC into enforcing mode if  the
48              option value is non-NULL; permissive mode otherwise.  The system
49              enforcing mode will be ignored.
50
51
53       Beginning with version 2.6.4, the Linux kernel supports SELinux  status
54       change  notification  via  netlink.   Two  message  types are currently
55       implemented, indicating changes to the enforcing mode and to the loaded
56       policy  in  the  kernel,  respectively.   The userspace AVC listens for
57       these messages and takes the appropriate action, modifying the behavior
58       of  avc_has_perm(3)  to reflect the current enforcing mode and flushing
59       the cache on receipt of a policy load notification.  Audit messages are
60       produced when netlink notifications are processed.
61
62

RETURN VALUE

64       Functions  with a return value return zero on success.  On error, -1 is
65       returned and errno is set appropriately.
66
67

AUTHOR

69       Eamon Walsh <ewalsh@tycho.nsa.gov>
70
71

SEE ALSO

73       selinux(8), avc_has_perm(3), avc_context_to_sid(3), avc_cache_stats(3),
74       avc_add_callback(3), selinux_set_callback(3), security_compute_av(3)
75
76
77
78
79                                  12 Jun 2008                      avc_open(3)
Impressum