【kernel/cpumemset.c】
409 cmshandle_t
410 cmsGetHandlePid(int choice, pid_t pid, int do_check_perm)
411 {
:
425 if (pid &.&.
426 do_check_perm &.&.
427 (current->euid ^ p->suid) &.&.
428 (current->euid ^ p->uid) &.&.
429 (current->uid ^ p->suid) &.&.
430 (current->uid ^ p->uid) &.&.
431 !capable(CAP_SYS_ADMIN))
432 han.error = -EPERM.
:
442 }
【kernel/cpumemset.c】
1478 /*
1479 * Unless you have CAP_SYS_ADMIN capability, you can only shrink cmm.
1480 */
1481
1482 static int
1483 cmm_restrict_checking(cpumemmap_t *oldmap, cpumemmap_t *newmap)
1484 {
1485 int i.
1486
1487 if (capable(CAP_SYS_ADMIN))
1488 return 0.
1489
1490 /* newmap must be a subset of oldmap */
1491 for (i = 0. i < newmap->nr_cpus. i )
1492 if (!foundin (newmap->cpus[i], oldmap->cpus, oldmap->nr_cpus))
1493 return -EINVAL.
1494 for (i = 0. i < newmap->nr_mems. i )
1495 if (!foundin (newmap->mems[i], oldmap->mems, oldmap->nr_mems))
1496 return -EINVAL.
1497 return 0.
1498 } |