[CRIU] [PATCH 1/4] mount: convert uid and gid properties according with userns
Pavel Emelyanov
xemul at parallels.com
Fri Aug 7 04:43:45 PDT 2015
> @@ -889,7 +893,15 @@ static int do_opt2flag(char *opt, unsigned *flags,
> break;
> }
>
> - if (opts[i].opt == NULL) {
> + if (sscanf(opt, "gid=%d", &id) == 1) {
> + uoff += sprintf(unknown + uoff, "gid=%d", userns_gid(id));
> + unknown[uoff] = ',';
> + uoff++;
> + } else if (sscanf(opt, "uid=%d", &id) == 1) {
> + uoff += sprintf(unknown + uoff, "uid=%d", userns_uid(id));
> + unknown[uoff] = ',';
> + uoff++;
> + } else if (opts[i].opt == NULL) {
First of all, the uid/gid options should be scanned for sb opts only, this
code start scanning them for mnt ones too.
Second, the sscanf()-s should both go under the if (opts[i].opt == NULL) check.
> if (!unknown) {
> pr_err("Unknown option [%s]\n", opt);
> return -1;
>
-- Pavel
More information about the CRIU
mailing list