X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=security%2Fcommoncap.c;h=f035b84b3601a4d13b8e30a16396d5a85ab88a95;hb=0c268bf997b923a166381601380d2af36a66c189;hp=1832cf701c3d6d44d90adeb278bd04bca489d274;hpb=064ca93f7ab927c2752d86fc5727716e340d737c;p=firefly-linux-kernel-4.4.55.git diff --git a/security/commoncap.c b/security/commoncap.c index 1832cf701c3d..f035b84b3601 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -31,6 +31,10 @@ #include #include +#ifdef CONFIG_ANDROID_PARANOID_NETWORK +#include +#endif + /* * If a non-root user executes a setuid-root binary in * !secure(SECURE_NOROOT) mode, then we raise capabilities. @@ -73,6 +77,13 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns, { struct user_namespace *ns = targ_ns; +#ifdef CONFIG_ANDROID_PARANOID_NETWORK + if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW)) + return 0; + if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN)) + return 0; +#endif + /* See if cred has the capability in the target user namespace * by examining the target user namespace and all of the target * user namespace's parents.