3,804 questions
0
votes
1
answer
54
views
Can madvise(addr, size, MADV_DONTNEED) cause segfaults?
Is madvise(*, *, MADV_DONTNEED) supposed to be purely advisory? I tried scanning /proc/self/maps and calling madvise(addr, size, MADV_DONTNEED) on the entries:
#include <stdio.h>
#include <...
0
votes
1
answer
50
views
Can I dup and change the buffer behaviour of the new fd without changing the old one?
I want to create a new FILE* associated with stdout, using setvbuf() to change its buffer behaviour to _IONBF, but I don't want to change the behaviour of stdout, since the other part of the program ...
0
votes
2
answers
87
views
The `write` syscall in C writes to an unexpected position
I've written a simple C program.
It takes four command line parameters: file name, start position, length and byte value; opens the specified file for writing and, starting at the specified position, ...
0
votes
0
answers
40
views
Consequences of concurrent fsync on the same fd
What does happen if two threads call fsync on the same entity simultaneously? For example, they want to synchronize the same directory at the same time, when they create new files in it. I have ...
-1
votes
0
answers
32
views
Unexpected sbrk() syscall behavior [duplicate]
I faced unexpected sbrk behavior, I was expecting it to return previous break value on successful calls, so I made my functions to be like:
void* get_current_break_value(void){
void* ...
-1
votes
0
answers
96
views
Trouble with a 'EXECUTE_COMMAND_LINE' call in windows (probably due to 'cmd.exe' behavior)
I have commands that I want to run in succession to generate reports using Fortran. I'm having a problem getting Windows to properly execute the command via EXECUTE_COMMAND_LINE. A sample of the ...
0
votes
0
answers
32
views
What is the most "empty" Linux system call to benchmark against? [duplicate]
I want to benchmark some performance aspects of a Linux device driver (a loadable module). Specifically, how fast certain code paths are when they are invoked from userspace via system calls.
In ...
0
votes
2
answers
96
views
NtTerminateThread is returning STATUS_INVALID_HANDLE when terminating self
Hello I am trying to terminate the current thread using NtTerminateThread. I know that the function for the syscall takes 2 arguments which are the thread handle and the exit status but whenever I try ...
0
votes
1
answer
31
views
BPF program attached to `getname` won't get called when calling the `renameat2` syscall
I'm fiddling with a BPF program that needs to attach to the two "getname" functions that are being called from the renameat2 syscall, defined in linux/fs/namei.c as:
SYSCALL_DEFINE5(...
0
votes
1
answer
107
views
Creating a new thread with clone3 causes segfault
I'm experimenting with the Linux clone3() syscall (introduced in Linux 5.3) to create threads without using the standard library. While there are many examples of using the older clone() syscall, I ...
1
vote
0
answers
87
views
Application is leaking event handle after calling syscalls on Windows
I have a go application that calling the Windows Management Infrastructure (MI).
After some amount of time, I notice that the amount of handle is quite high. I inspect the process with the handles ...
4
votes
2
answers
107
views
What is a "slow" device in the context of I/O call?
In man 7 signal, it describes certain constraints regarding when the SA_RESTART flag takes effect.
read(2), readv(2), write(2), writev(2), and ioctl(2) calls on "slow" devices. A "...
0
votes
1
answer
121
views
The child process does not start with syscall(SYS_clone3, …) + CLONE_VM
Hello, everyone.
It is necessary that the calling process and the child process are in the same memory space.
Therefore, I use the CLONE_VM flag.
But the child process does not start.
It looks like ...
1
vote
1
answer
155
views
Modifying (stealing) Linux syscalls using kprobe
I am trying to steal the statx syscall on Linux 6.8 and to modify the returning arguments.
However, when attemp to load the module, I got a BUG about NULL pointer deference at line
r = ...
2
votes
1
answer
61
views
Invoke function pointer from go. (Windows Management Infrastructure client)
I develop go pure go client for Windows Management Infrastructure (MI). It's the successor of WMI.
While initialization works as indented
package main
import (
"unsafe"
"...