Questions tagged [system-calls]

A system call is used by programs to request services from the operating system's kernel.

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

System call "syscall" instruction in the MIPS architecture

Today I would like to ask you a question. Namely, as a beginner assembly language programmer (and not only that), I would like to ask about the "syscall" instructions in the MIPS ...
Piotrek Bąk's user avatar
0 votes
0 answers
18 views

Syscall.Statfs is blocked for nfs stop [closed]

On the Linux machine, I have a remote nfs mounted in my local directory. If my nfs stops serving, Syscall.Statfs will be blocked forever and I cannot obtain the disk information of any mount point. ...
Simons's user avatar
  • 1
0 votes
1 answer
70 views

C inline assmebly write syscall prints only 4 characters but only when using "=a" as output register [duplicate]

As a uni task I wrote a very simple wrapper for write syscall. It is for i386. Code gets compiled with: gcc -ffreestanding -fno-stack-protector -nostdlib -nostdinc -static -m32 -Wall -g -O2 I am ...
TryingToPassCompSci's user avatar
1 vote
1 answer
92 views

How does a computer perform any instruction without making a system call

I am learning about Operating Systems and trying to get a deep understanding about the fundamentals about how a program works. I have a simple C++ program When I look at the basic architecture of ...
theMyth's user avatar
  • 141
0 votes
1 answer
36 views

How to bpf_probe_read_str all ctx->argv elements in kernel space and forward it to the userspace?

I am new to eBPF and currently trying to send all the executed commands with arguments in the userspace using a perf map. I manage to send most of my data, but not the one accessed with ...
Sathi's user avatar
  • 1
0 votes
1 answer
24 views

when does nodejs use epoll_pwait and when it uses epoll_wait

I have noticed that when calling a simple code given below strace node -e 'setTimeout(()=>{console.log("hola")},10000)' on arm instance (graviton c7g.2xlarge and Ubuntu 20.04.3 LTS ) ...
palash kulshreshtha's user avatar
1 vote
0 answers
45 views

asmlinkage for Linux system calls

The excellent article on the anatomy of a Linux system call describes them as having asmlinkage. However, the answer here which references the expansion of the SYSCALL_DEFINE3() macro does not ...
user3882729's user avatar
  • 1,415
-1 votes
0 answers
40 views

Catchpoint inside gdb does not break at syscall call

I'm debugging a simple "Hello World" on Linux 4.15 & gcc 7.5.0 built as gcc main.c -o main I want to catch the syscall to execve() to load the ELF executable into process' virtual ...
Carlo C's user avatar
  • 81
0 votes
0 answers
25 views

Tcpdump captured traffic for GRE reassembled packets

Suppose there is a GRE tunnel logical interface (e.g. gre0) configured on Linux 4.6 kernel. sudo ip tunnel add gre0 mode gre remote 10.10.10.1 local 172.168.1.1 Execute tcpdump as follows tcpdump -i ...
Carlo C's user avatar
  • 81
0 votes
0 answers
44 views

Why is RISC-V GCC breaking my code when optimizations are enabled? [duplicate]

I have the following C code for 32-bit RISC-V: static void test(uint32_t key, uint32_t chr, uint32_t state) { char s[2]; if(state != KEYSTATE_PRESSED) { return; } if(!isprint(chr)) { ...
anton-tchekov's user avatar
0 votes
2 answers
28 views

Do systemcalls context switch to some kernel-space thread/process, or elevate the privilages of the calling thread/process?

This is probably a newbie question, please correct me if I understood something wrongly When talking about syscalls, I always hear "we enter kernel-space temporarily and then go back to user-...
Roee Toledano's user avatar
0 votes
1 answer
30 views

syscall-template.S not found

I am trying to debug my program for a project. I have to use breakpoints to point out blocking functions within my code. When i started the debugger and clicked on "Step into" i got the &...
Rz_iSuck's user avatar
0 votes
0 answers
16 views

Virtual memory mapping reported by pmap -X does not come from mmap system call

I have a problem with excessive memory consumption of the process and tried to catch system calls and stack traces with strace to get a grasp on who mapped the memory. So runnin strace -f myapp I got ...
Some Name's user avatar
  • 8,772
0 votes
0 answers
62 views

Error while programming a custom system call in the Linux kernel version 6.2.1

While writing a custom system call, I encountered the following problem: error: 'struct thread_info' has no member named 'pcb' The problem occurs when the make command is executed to build the kernel. ...
IndianMax's user avatar
0 votes
1 answer
59 views

Why does a minimal binary call exit_group instead of exit?

Content of app.c: void main() {} I execute gcc app.c -o app -static -O3 && lurk ./app to get: execve("", "", "") = 0 arch_prctl(12289, 0x7FFFFFFFD430) = -22 brk(...
Mario Ishac's user avatar
  • 5,258
0 votes
0 answers
60 views

Working with Linux directories with file descriptors [duplicate]

Is it possible to work with directories using file descriptors? I'm trying to open a certain directory and get all of the files/other directories in it. The files and directories in it are dynamic and ...
Roee Toledano's user avatar
0 votes
0 answers
56 views

What is the best QNX alternatve to Linux strace

I used to analyze the system calls produced by a program in Linux using the strace tool which is quite useful. We can clearly see all the four categories presented by Modern Operating Systems(...
Maf's user avatar
  • 681
0 votes
0 answers
16 views

when call syscall.NetlinkRIB , fd = 0

call net.InterfaceByName method, but stuck, and the Recvfrom method recelve args , include fd is 0 expect when create socket success , fd not equal 0 , and sometime when call net.InterfaceByName fd ...
sangfor-yunfei's user avatar
0 votes
1 answer
83 views

Null pointer dereference when hooking system call with kprobe

I've been trying to hook the connect() system-call on Debian (kernel version 5.10.0-20-amd64). Though the kprobe itself succeeds, I can't retrieve the sockaddr from the pt_regs structs. My code looks ...
GeoMldr's user avatar
  • 50
0 votes
1 answer
31 views

Is the user/kernel space copy in Linux read(2)/write(2) a general design in operating systems?

I have a multi-part question about Linux's read(2)/write(2) system calls: 1.Where exactly is the copy behavior, as described in the title, stated? I've tried looking through the Linux Manual Page(2) ...
Xavier Z.'s user avatar
  • 179
0 votes
1 answer
55 views

Execute python file in cpp

I want to execute a python file in cpp, to make it a process that can communicate with my other child process. But when I use execl("python3", "python3", "python/a1.py"); ...
Brian's user avatar
  • 11
1 vote
0 answers
92 views

statfs attempting large write causing stack overflow

I'm currently using statfs to get some information about a path and I'm getting a runtime stack overflow error: ==33949==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x000103d3d970 at pc ...
AbsoluteBeginner's user avatar
1 vote
1 answer
25 views

Is there a safeunlink syscall in Unix?

There is an unlink syscall in Unix, which takes a path as argument, and unlinks that path from inode. Suppose this case. I will open a file, access the contents, and then decide that it should be ...
Sourav Kannantha B's user avatar
1 vote
1 answer
48 views

Does sbrk(0) also allocate memory behind the scenes?

I am learning how sbrk, brk, mmap etc work and what they offer. I am writing a very basic code like this int main(int argc, char* argv[]) { void* f1 = sbrk(0); int* newarr = (int*)f1; for(int i=0;...
Shivanshu Arora's user avatar
-1 votes
1 answer
39 views

Unexpected mount syscalls when running sudo command

I'm working on a program that monitors for mount and unmount syscalls and prints the various arguments of the calls to the terminal. It works ok but I noticed some behaviour that I don't understand ...
incubus's user avatar
  • 719
0 votes
0 answers
46 views

Difference between sysproc.c and proc.c

I’m doing a project for class that includes implementing a lottery scheduler in xv6. I have to implement two system calls settickets() and getpinfo(). I added the system calls to syscall.c, syscall.h, ...
GuavaJava's user avatar
0 votes
0 answers
169 views

Linux: Using "clone3" and "waitid"

I'm trying to learn about forking/cloning processes using the "clone3" system call. I have read the manual pages to understand it. Other than the manual pages, I was able to find only ONE ...
rempas's user avatar
  • 1
0 votes
0 answers
18 views

Is it beneficial to perform disk-IO concurrently?

I have a misunderstanding and I can't really be sure about it, firstly, just to be clear, I talk about an environment where we have an async-runtime that can run "user-level" threads/co-...
EpsilonCode's user avatar
0 votes
0 answers
40 views

File is cleared after preventing writing to it by hooking sys_write

I want to create a kernel module which prevents even root from writing to a specific file(as long as he doesn't know about the kernel module preventing it). So what I am doing is I hook sys_write via ...
Compi's user avatar
  • 1
-1 votes
1 answer
46 views

How many processes does this program make?

#include <stdlib.h> int main(int argc, char* arg[]) { fork(); if (fork()) { fork(); } else { char* argv[2] = { "/bin/ls", NULL }; execv(...
Jihoon's user avatar
  • 1
0 votes
0 answers
25 views

I want to create a function that prints a message 5 times in assembly language, but my code is running infinitely, so how can I fix it? [duplicate]

This is my code: global _start section .text _start: mov rbx, 5 func: mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, msglen syscall dec rbx call func mov rax, 60 mov rdi, 0 syscall section .rodata ...
Zahraa Alqassab's user avatar
1 vote
0 answers
53 views

How to create a veth pair without ip command in c

Is there a way to use syscalls like ioctl or netlink to create a veth pair. Generally the common way for veth pair creation is using ip command - ip link add dev veth1 type veth peer name veth2 How ...
Shriram S's user avatar
0 votes
1 answer
124 views

Can libc be faster than syscall?

I am working on heavily optimizing some code (thankfully no platform independence - Linux only). I created a very simple framework for measuring time passed (in clock cycles). An idea I had early was ...
CasseroleBoi's user avatar
1 vote
1 answer
56 views

Cannot find arch/arm/kernel/calls.S in raspberry pi kernel

So I'm having trouble with enrolling my systemcall to raspberry pi. https://github.com/raspberrypi/linux You can check above link to ensure that calls.S is missing in raspberry pi kenrel. So, where ...
kwonryul's user avatar
  • 503
0 votes
1 answer
92 views

Process terminating with default action of signal 13 (SIGPIPE)

I am trying to read the entire data written from the user in a buffer to process it inside my own shell "called hsh" but the process is terminated with signal 13: Here is command that I ...
Mohammed Ahmed's user avatar
0 votes
0 answers
15 views

Executing a Minix kernel call

I have followed this tutorial - https://wiki.minix3.org/doku.php?id=developersguide:newkernelcall to add a new kernel call, but how do I invoke it from a userspace program? I understand I should be ...
David Foster's user avatar
-3 votes
1 answer
62 views

Are PowerPoint, Google Chrome, Visual Studio Code, Photoshop or a C program I write are all examples of Applications/User programs?

In the context of a modern PC : Is it correct to say that these programs are all examples of Application/User programs that need system calls to request OS services for performing privileged ...
alessio solari's user avatar
2 votes
1 answer
221 views

Are the system calls the only way an Application/User program can request OS services for performing privileged operations? [closed]

I'm in a Linux environment even though I know this topic has a much broader scope Let's say I'm writing a simple C program and I want to write "Hello" to the terminal. The obvious way is to ...
alessio solari's user avatar
0 votes
0 answers
35 views

Trapping System Calls with seccomp

As a proof of concept, I wrote a simple wrapper that traps a specific system call (e.g., mmap) from the wrapped program using seccomp: #include <csignal> #include <cstdio> #include <...
crottyan's user avatar
1 vote
0 answers
36 views

Get file descriptor output in resumed syscall using strace

I am using command: sudo strace --trace=sendto,recvfrom,read,write,ipc -yy -s 10000 -fp $pid 2>&1 where pid is the the process id I want to trace. When i get outputs, there are some unfinished ...
Sandeep Acharya's user avatar
1 vote
0 answers
159 views

Implementing a simple version of readdir with system call

I am reading the following famous book. B. W. Kernighan, and D. M. Ritchie, The C Programming Language, 2nd Edition, Prentice Hall, 1988. In the last chapter, section 8.6, authors give an example of ...
Hosein Rahnama's user avatar
3 votes
1 answer
78 views

How does an int instruction know which registers to use when it runs?

I'm a student studying the Assembly Language(NASM) and I need some clarification on how the interrupt "function" or int knows which registers to "run". I have figured out that a ...
Guffar07's user avatar
0 votes
1 answer
65 views

Why do I get a "stack smashing detected" error unless I store the file descriptors?

I'm playing around with a few I/O system calls: Read 2 bytes from an existing file, place them in a buffer, and then write those bytes to another empty, existing file. // read_write.c int open(char *...
uzluisf's user avatar
  • 2,653
0 votes
0 answers
37 views

Identify the performance bottleneck that is causing slowdowns when making numerous read and write system calls

I've developed an application that frequently utilizes pread and pwrite for reading and writing to a network devices. The operation typically takes around 7 minutes to complete. However, when I ...
Itay Avraham's user avatar
2 votes
1 answer
204 views

how can I find systemcall on windows?

I'm beginner on assembly code. I never used at windows assembly code, so I really confused. I try to catch system call when I run printf("hello world!\n") in windows 11, visual studio 2022. ...
Yang's user avatar
  • 191
0 votes
1 answer
50 views

ARM64 SVE registers not preserved when issuing a syscall, why does Linux discard SVE registers with sve_user_discard()?

In the Linux 5.10 AArch64 syscall.c source code, there is a function sve_user_discard(), which can make the SVE registers' [max:128] bits being zeroed. Here's the code. I cannot understand the usage ...
aisv's user avatar
  • 13
0 votes
2 answers
225 views

eBPF: Loading and attaching an eBPF program to sys_enter_execve using only system calls

Context: I am attempting to introduce mutation to eBPF bytecode. As such I'd like to load eBPF bytecode from a simple object file, not from an ELF (as is required by libbpf to my knowledge). I have a ...
vykt's user avatar
  • 13
2 votes
0 answers
61 views

mremap C call does not match syscall

I have the following code snippet printf("mremap(%p, 4096, 4096, MREMAP_MAYMOVE | MREMAP_FIXED, %p);\n", shadow, original); void *result = mremap(shadow, 4096, ...
asdfldsfdfjjfddjf's user avatar
0 votes
1 answer
99 views

Add a new system call in Linux ARM64 system - link error

I am trying to add a new system call to a Debian 11 ARM64 Linux system. Kernel version 5.10.191. The system is running on a UTM virtual machine on Mac M2 laptop. I am able to compile the kernel, ...
Lei Qian's user avatar
1 vote
0 answers
107 views

Should I use syscall or glibc wrapper calls in assembly? [closed]

In the past, I used the glibc wrappers fopen, fread, fwrite, fclose for file management in assembly (I use NASM 64). But I want to know whether I should use syscalls instead, and what the performance ...
RTC222's user avatar
  • 2,125

1
2 3 4 5
75