Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

avc_open(3) [debian man page]

avc_open(3)						     SELinux API documentation						       avc_open(3)

NAME
avc_open, avc_destroy, avc_reset, avc_cleanup - userspace SELinux AVC setup and teardown. SYNOPSIS
#include <selinux/selinux.h> #include <selinux/avc.h> int avc_open(struct selinux_opt *options, unsigned nopt); void avc_destroy(void); int avc_reset(void); void avc_cleanup(void); DESCRIPTION
avc_open initializes the userspace AVC and must be called before any other AVC operation can be performed. avc_destroy destroys the userspace AVC, freeing all internal memory structures. After this call has been made, avc_open must be called again before any AVC operations can be performed. avc_reset flushes the userspace AVC, causing it to forget any cached access decisions. The userspace AVC normally calls this function automatically when needed, see NETLINK NOTIFICATION below. avc_cleanup attempts to free unused memory within the userspace AVC, but does not flush any cached access decisions. Under normal opera- tion, calling this function should not be necessary. OPTIONS
The userspace AVC obeys callbacks set via selinux_set_callback(3), in particular the logging and audit callbacks. The options which may be passed to avc_open include the following: AVC_OPT_SETENFORCE This option forces the userspace AVC into enforcing mode if the option value is non-NULL; permissive mode otherwise. The system enforcing mode will be ignored. NETLINK NOTIFICATION
Beginning with version 2.6.4, the Linux kernel supports SELinux status change notification via netlink. Two message types are currently implemented, indicating changes to the enforcing mode and to the loaded policy in the kernel, respectively. The userspace AVC listens for these messages and takes the appropriate action, modifying the behavior of avc_has_perm(3) to reflect the current enforcing mode and flush- ing the cache on receipt of a policy load notification. Audit messages are produced when netlink notifications are processed. RETURN VALUE
Functions with a return value return zero on success. On error, -1 is returned and errno is set appropriately. AUTHOR
Eamon Walsh <ewalsh@tycho.nsa.gov> SEE ALSO
selinux(8), avc_has_perm(3), avc_context_to_sid(3), avc_cache_stats(3), avc_add_callback(3), selinux_set_callback(3), security_com- pute_av(3) 12 Jun 2008 avc_open(3)

Check Out this Related Man Page

avc_netlink_loop(3)					     SELinux API documentation					       avc_netlink_loop(3)

NAME
avc_netlink_open, avc_netlink_close, avc_netlink_acquire_fd, avc_netlink_release_fd, avc_netlink_check_nb, avc_netlink_loop - SELinux netlink processing SYNOPSIS
#include <selinux/selinux.h> #include <selinux/avc.h> int avc_netlink_open(int blocking); void avc_netlink_close(void); int avc_netlink_acquire_fd(void); void avc_netlink_release_fd(void); void avc_netlink_loop(void); int avc_netlink_check_nb(void); DESCRIPTION
These functions enable applications to handle notification of SELinux events via netlink. The userspace AVC normally checks for netlink messages on each call to avc_has_perm(3). Applications may wish to override this behavior and check for notification separately, for exam- ple in a select(2) loop. These functions also permit netlink monitoring without requiring a call to avc_open(3). avc_netlink_open() opens a netlink socket to receive SELinux notifications. The socket descriptor is stored internally; use avc_netlink_acquire_fd(3) to take ownership of it in application code. The blocking argument controls whether the O_NONBLOCK flag is set on the socket descriptor. avc_open(3) calls this function internally, specifying non-blocking behavior. avc_netlink_close() closes the netlink socket. This function is called automatically by avc_destroy(3). avc_netlink_acquire_fd() returns the netlink socket descriptor number and informs the userspace AVC not to check the socket descriptor automatically on calls to avc_has_perm(3). avc_netlink_release_fd() returns control of the netlink socket to the userspace AVC, re-enabling automatic processing of notifications. avc_netlink_check_nb() checks the netlink socket for pending messages and processes them. Callbacks for policyload and enforcing changes will be called; see selinux_set_callback(3). This function does not block. avc_netlink_loop() enters a loop blocking on the netlink socket and processing messages as they are received. This function will not return unless an error occurs on the socket, in which case the socket is closed. RETURN VALUE
avc_netlink_acquire_fd() returns a non-negative file descriptor number on success. Other functions with a return value return zero on suc- cess. On error, -1 is returned and errno is set appropriately. SEE ALSO
avc_open(3), selinux_set_callback(3), selinux(8) 30 Mar 2009 avc_netlink_loop(3)
Man Page