1getkeycreatecon(3) SELinux API documentation getkeycreatecon(3)
2
3
4
6 getkeycreatecon, setkeycreatecon - get or set the SELinux security con‐
7 text used for creating a new kernel keyrings.
8
9
11 #include <selinux/selinux.h>
12
13 int getkeycreatecon(security_context_t *con);
14
15 int setkeycreatecon(security_context_t context);
16
17
19 getkeycreatecon retrieves the context used for creating a new kernel
20 keyring. This returned context should be freed with freecon if non-
21 NULL. getkeycreatecon sets *con to NULL if no keycreate context has
22 been explicitly set by the program (i.e. using the default policy
23 behavior).
24
25 setkeycreatecon sets the context used for creating a new kernel
26 keyring. NULL can be passed to setkeycreatecon to reset to the default
27 policy behavior. The keycreate context is automatically reset after
28 the next execve, so a program doesn't need to explicitly sanitize it
29 upon startup.
30
31 setkeycreatecon can be applied prior to library functions that inter‐
32 nally perform an file creation, in order to set an file context on the
33 objects.
34
35
36 Note: Signal handlers that perform an setkeycreate must take care to
37 save, reset, and restore the keycreate context to avoid unexpected
38 behavior.
39
41 On error -1 is returned. On success 0 is returned.
42
43
45 selinux(8), freecon(3), getcon(3), getexeccon(3)
46
47
48
49dwalsh@redhat.com from russell@c9okSeerp.tceommb.earu2008 getkeycreatecon(3)