有没有办法不将 seccomp 过滤器继承给子进程?

问题描述

假设我有一个这样的简单程序:

#include <seccomp.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

int main(void) {
    scmp_filter_ctx ctx;
    int ret = 0;

    ctx = seccomp_init(SCMP_ACT_ALLOW);
    ret |= seccomp_rule_add(ctx,SCMP_ACT_KILL,SCMP_SYS(write),0);
    ret |= seccomp_load(ctx);

    if (ret) {
        exit(ret);
    }

    // some more stuff

    execve("/bin/sh",NULL,NULL);
}

是否可以不继承对 execve 产生的进程的限制? (我们说的是配置,我不想在 execve 调用之前再调用任何与 seccomp 相关的东西)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)