小编MCH*_*MCH的帖子

seccomp ---如何EXIT_SUCCESS?

设置严格模式seccomp后如何EXIT_SUCCESS.这是正确的做法,syscall(SYS_exit, EXIT_SUCCESS);在主要结束时打电话?

#include <stdlib.h>
#include <unistd.h> 
#include <sys/prctl.h>     
#include <linux/seccomp.h> 
#include <sys/syscall.h>

int main(int argc, char **argv) {
  prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT);

  //return EXIT_SUCCESS; // does not work
  //_exit(EXIT_SUCCESS); // does not work
  // syscall(__NR_exit, EXIT_SUCCESS); // (EDIT) This works! Is this the ultimate answer and the right way to exit success from seccomp-ed programs?
  syscall(SYS_exit, EXIT_SUCCESS); // (EDIT) works; SYS_exit equals __NR_exit
}

// gcc seccomp.c -o seccomp && ./seccomp; echo "${?}" # I want 0
Run Code Online (Sandbox Code Playgroud)

c linux sandbox exit-code seccomp

20
推荐指数
2
解决办法
988
查看次数

CRC-32哈希的唯一性是否足以唯一地标识包含文件名的字符串?

我已经将连接到字符串的文件名列表排序,并希望通过唯一的校验和来标识每个这样的字符串.

这些字符串的大小至少为100个字节,最多为4000个字节,平均为1000个字节.字符串的总数可以是任何值,但更可能是在ca.的范围内.10000.

CRC-32适用于此目的吗?

例如,我需要以下每个字符串具有不同的固定长度(最好是短)校验和:

"/some/path/to/something/some/other/path"
"/some/path/to/something/another/path"
"/some/path"
...
# these strings can get __very__ long (very long strings are the norm)
Run Code Online (Sandbox Code Playgroud)

CRC-32哈希的唯一性是否因输入长度而增加?

为此目的,是否有更好的校验和选择?

hash crc32 hash-code-uniqueness

4
推荐指数
1
解决办法
3235
查看次数

标签 统计

c ×1

crc32 ×1

exit-code ×1

hash ×1

hash-code-uniqueness ×1

linux ×1

sandbox ×1

seccomp ×1