A system call is used by programs to request services from the operating system's kernel.
Questions tagged [system-calls]
3690 questions
1
vote
1 answer
The difference between `entry_SYSCALL64_slow_path` and `entry_SYSCALL64_fast_path`
We know that system call will call the function entry_SYSCALL_64 in entry_64.S. When I read the source code, I find there are two different types of call after the prepartion of registers, one is entry_SYSCALL64_slow_path and the other is…

tyChen
- 1,404
- 8
- 27
1
vote
0 answers
Should I include a memory barrier before / after issuing the clone syscall?
I know that when I use pthread_create() an appropriate memory barrier is automatically issued so the new thread is guaranteed to see all the writes made by the parent thread up until its creation.
However, what if I use clone() manually on Linux?…

ilstam
- 1,473
- 4
- 18
- 32
1
vote
1 answer
Writing issue in crosscompiled program(Linux -> Windows)
The program works correctly in Linux, but I get extra characters after the end of file when running in Windows or through Wine. Not garbage but repeated text that was already written. The issue persists whether I write to stdout or a file, but…

GlorifiedBum
- 39
- 5
1
vote
1 answer
How to call gettimeofday syscall in inline assembly in FreeBSD?
I am trying to get the current time using syscalls and inline assembly in FreeBSD 5.2.1 32-bit.
My problem is that I struggle to pass needed structs as arguments to the function resulting in error:
error: impossible register constraint in `asm'
My…

mikro45
- 63
- 1
- 1
- 9
1
vote
1 answer
How are parameters passed to Linux system call ? Via register or stack?
I trying to understand the internals of the Linux kernel by reading Robert Love's Linux Kernel Development.
On page 74 he says the easiest way to pass arguments to a syscall is via :
Somehow, user-space must relay the parameters to the kernel…

ng.newbie
- 2,807
- 3
- 23
- 57
1
vote
1 answer
is there such thing as a getcwd() syscall on macos
I am wondering if there is a getcwd system call on macos. I can't seem to find any leads on the code for getcwd apart from https://www.informatik.htw-dresden.de/~beck/ASM/syscall_list.html. However, the code it gives does not function. I have tried…

a_random_programmer
- 148
- 1
- 12
1
vote
1 answer
Passing an array (argv) to a syscall in assembly x64
I am learning to create shellcode and having a great time. I mostly understand what to do. I can create asm code that will actually generate the shell. However, I was going to verify my ability by trying another syscall, namely cat .
I am using the…

twodox
- 155
- 8
1
vote
2 answers
Using sigaction without SA_RESTART and preventing an infinte loop
I have the following code:
struct sigaction act = {{0}};
act.sa_handler = handler;
sigaction(SIGINT, &act, nullptr);
while (true)
{
std::cout << "input:";
std::getline(std::cin, line);
// Handle line
}
When I receive SIGINT, the…

shroz
- 13
- 5
1
vote
1 answer
Hello, world in assembly language with Linux system calls?
I know that int 0x80 is making interrupt in linux. But, I don't understand how this code works. Does it returning something?
What $ - msg standing for?
global _start
section .data
msg db "Hello, world!", 0x0a
len equ $ - msg
section…

Jokerjh777
- 61
- 1
- 2
- 6
1
vote
1 answer
How can I swap contents of two text files with kernel system calls
Here is my poor attempt:
//open:
#include
#include
#include
//raad, write, exit:
#include
#include
//renameat2:
#include
int main(){
int fd1, fd2;
//do I need those…

fastAlgo
- 83
- 6
1
vote
1 answer
Destination and Source file don't match - C
I've been trying to find out why my tester is failing, it says that destination and source file don't match. link for testers:…

Yuki1112
- 365
- 2
- 12
1
vote
1 answer
elf intel 32 output does not print
Hello I'm very new to assembly and I'm currently trying to make my own calculator. I figured out how to make the operations and it seems to work but I have some problems with the "resultat" part of the code.
Depending on what operation I choose to…

Pancake
- 11
- 1
1
vote
0 answers
Why can't strace or ltrace intercept the rand function
I'm using the following C program as an example ::
#include
#include
#include
int main(int argc, char const *argv[]) {
srand(time(NULL));
printf("%d\n", rand());
}
Neither strace nor ltrace can detect the…

Sumit Ghosh
- 1,033
- 10
- 29
1
vote
2 answers
Write to file descriptor and immediately read from it
Today I have encountered some weird looking code that at first glance it's not apparent to me what it does.
send(file_desc,"Input \'y\' to continue.\t",0x18,0);
read(file_desc,buffer,100);
iVar1 = strcmp("y",(char *)buffer);
if (iVar1 == 0)…

Galaxy
- 2,363
- 2
- 25
- 59
1
vote
1 answer
Cannot use set_memory_rw in Linux kernel on ARM64
I am trying to develop a kernel module that hooks the read() system call. for some reason the set_memory_rw() function does not seem to work.
I saw another question of this sort but I didn't really understand what to do.
I am working on Kali 4.19.93…

o bd
- 21
- 7