]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/proc/root.c
procfs: add hidepid= and gid= mount options
[karo-tx-linux.git] / fs / proc / root.c
index 165a0d1e75cb8039303edbafaf52c480380b02fd..73af7b2acd938944570c532e2b9d24697c1f1a41 100644 (file)
@@ -38,10 +38,12 @@ static int proc_set_super(struct super_block *sb, void *data)
 }
 
 enum {
-       Opt_err,
+       Opt_gid, Opt_hidepid, Opt_err,
 };
 
 static const match_table_t tokens = {
+       {Opt_hidepid, "hidepid=%u"},
+       {Opt_gid, "gid=%u"},
        {Opt_err, NULL},
 };
 
@@ -49,6 +51,7 @@ static int proc_parse_options(char *options, struct pid_namespace *pid)
 {
        char *p;
        substring_t args[MAX_OPT_ARGS];
+       int option;
 
        pr_debug("proc: options = %s\n", options);
 
@@ -63,6 +66,20 @@ static int proc_parse_options(char *options, struct pid_namespace *pid)
                args[0].to = args[0].from = 0;
                token = match_token(p, tokens, args);
                switch (token) {
+               case Opt_gid:
+                       if (match_int(&args[0], &option))
+                               return 0;
+                       pid->pid_gid = option;
+                       break;
+               case Opt_hidepid:
+                       if (match_int(&args[0], &option))
+                               return 0;
+                       if (option < 0 || option > 2) {
+                               pr_err("proc: hidepid value must be between 0 and 2.\n");
+                               return 0;
+                       }
+                       pid->hide_pid = option;
+                       break;
                default:
                        pr_err("proc: unrecognized mount option \"%s\" "
                               "or missing value\n", p);