c - 如何允许子进程创建嵌套的用户命名空间?
问题描述
我使用以下代码在新的用户命名空间中创建子进程:
pid_t child = syscall (SYS_clone, SIGCHLD | CLONE_NEWNS | CLONE_NEWUSER, NULL, NULL, NULL);
在父进程中,我编写uid_map
andgid_map
并将当前的 uid 和 pid 映射到自身。
在子进程中,我将调用execvp
启动一个新进程,该进程可能会调用unshare
带有CLONE_NEWUSER
标志,在新用户命名空间中不允许该操作。
我的问题是,是否可以允许对unshare
由 启动的进程进行操作execvp
?
我按照user_namespace
和使用手册页中的示例pipe
来确保在调用uid_map
andgid_map
之前编写。execvp
解决方案
我猜你的映射不正确。从man 2 unshare
,看起来你正在打这个:
EPERM CLONE_NEWUSER was specified in flags, but either the effective
user ID or the effective group ID of the caller does not have a
mapping in the parent namespace (see user_namespaces(7)).
推荐阅读
- sentry - Sentry - 将 JSON 字段包含在引号中的设置
- mysql - SphinxQL 连接问题(守护进程正在监听时)
- avro - 如何在 Avro 模式中指定范围?
- javascript - 在 Angular 6 中动态调用索引组件
- node.js - Let's Encrypt 的证书无法与 node.js 一起使用
- angular - 在表之间添加动态行
- azure - Azure 中的安全存储服务是什么?
- azure - 在 Azure Function 中接收服务总线消息
- python - django,角度,csrf,rest_framework,403,
- c++ - 如何在 MFC 应用程序中添加文档菜单?