Posts

Showing posts with the label system-calls

What is full name of fcntl Unix/Linux system call

What is full name of fcntl Unix/Linux system call Man page of fcntl tell its used for manipulating file descriptors. But this name is not easy to remember. Knowing its full name will help in remember this system call name and its use. I tried to find on internet but could not get anything except man pages. fcntl Please someone tell what is full name or origin of name of fcntl. 1 Answer 1 From POSIX, it is F ile C o nt ro l : NAME      fcntl - f ile c o nt ro l fcntl There is a related system call, ioctl , i.e. I nput- O utput C on t ro l . The difference between the 2 is that fcntl modifies the file descriptor / file description, whereas ioctl controls behaviour of the input/output device behind the file description. ioctl fcntl ioctl Now, you just have to remember if it's fcntl , fctl or fctrl :p – ikegami Nov 27 '17 at 1...

How can I find all syscalls that have to be whitelisted for seccomp?

How can I find all syscalls that have to be whitelisted for seccomp? I have an existing program that I would like to sandbox using seccomp (v2). How can I find what seccomp rules I need to allow for the program? I've tried adding seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(…), 0) for all syscalls printed by strace -xfc a.out , but apparently that wasn't enough, since I'm still getting "SIGSYS, Bad system call" when I run the program with seccomp. seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(…), 0) strace -xfc a.out 1 Answer 1 Probably the most reliable way is to switch your seccomp filter to return SECCOMP_RET_TRAP ("send catchable SIGSYS on error") rather than SECCOMP_RET_KILL ("kill the process with an uncatchable SIGSYS "), then print the siginfo_t from the signal handler, then commit suicide. SECCOMP_RET_TRAP SIGSYS SECCOMP_RET_KILL SIGSYS sigi...