avc_open - Online Linux Manual PageSection : 3
Updated : 12 Jun 2008
Source :
Note : SELinux API documentation

NAMEavc_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);

DESCRIPTIONavc_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_destroy() also closes the SELinux status page, which might have been opened manually by selinux_status_open(3). 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 operation, calling this function should not be necessary.

OPTIONSThe 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.

KERNEL STATUS PAGELinux kernel version 2.6.37 supports the SELinux kernel status page, enabling userspace applications to mmap(2) SELinux status state in read-only mode to avoid system calls during the cache hit code path. avc_open() calls selinux_status_open(3) to initialize the selinux status state. avc_has_perm(3) and selinux_check_access(3) both check for status updates through calls to selinux_status_updated(3) at the start of each permission query and take the appropriate action. Two status types are currently implemented. setenforce events will change the effective enforcing state used within the AVC, and policyload events will result in a cache flush.

NETLINK NOTIFICATIONIn the event that the kernel status page is not successfully mmap(2)'ed the AVC will default to the netlink fallback mechanism, which opens a netlink socket for receiving status updates. setenforce and policyload events will have the same results as for the status page implementation, but all status update checks will now require a system call.

RETURN VALUEFunctions with a return value return zero on success. On error, −1 is returned and errno is set appropriately.

AUTHOREamon Walsh <ewalsh@tycho.nsa.gov>

SEE ALSOselinux(8), selinux_check_access(3), avc_has_perm(3), avc_context_to_sid(3), avc_cache_stats(3), avc_add_callback(3), selinux_status_open(3), selinux_status_updated(3), selinux_set_callback(3), security_compute_av(3)
0
Johanes Gumabo
Data Size   :   10,194 byte
man-avc_open.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 181,430
Visitor ID   :     :  
Visitor IP   :   18.116.118.214   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.