Unverified Commit dcc035de by Serge Hallyn Committed by Christian Brauner

define am_guest_unpriv

Sometimes we want to know whether we are privileged wrt our namespaces, and sometimes we want to know whether we are priv wrt init_user_ns. Signed-off-by: 's avatarSerge Hallyn <shallyn@cisco.com>
parent 5370a921
...@@ -423,9 +423,15 @@ extern void *lxc_strmmap(void *addr, size_t length, int prot, int flags, int fd, ...@@ -423,9 +423,15 @@ extern void *lxc_strmmap(void *addr, size_t length, int prot, int flags, int fd,
/* munmap() wrapper. Use it to free memory mmap()ed with lxc_strmmap(). */ /* munmap() wrapper. Use it to free memory mmap()ed with lxc_strmmap(). */
extern int lxc_strmunmap(void *addr, size_t length); extern int lxc_strmunmap(void *addr, size_t length);
//initialize rand with urandom /* initialize rand with urandom */
extern int randseed(bool); extern int randseed(bool);
/* are we unprivileged with respect to our namespaces */
inline static bool am_guest_unpriv(void) {
return geteuid() != 0;
}
/* are we unprivileged with respect to init_user_ns */
inline static bool am_unpriv(void) inline static bool am_unpriv(void)
{ {
FILE *f; FILE *f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment