Skip to content

Tag: system-calls

How to kill a process in a system call?

I found out that sys_kill can be used to kill process from a system call, but when i compile the following code, i get the following error: Answer It is often not possible to call the entry point of a system call from the kernel, since the API is for use from user space. Sometimes the functionality is provide…

gdb catch syscall condition and string comparisson

I would like to catch a system call (more specifically access) and set a condition on it based on string comparison (obviously for arguments that are strings). Specific example: when debugging ls I would like to catch access syscalls for specific pathnames (the 1st argument) int access(const char *pathname, i…

sys_ functions in syscalls.h are undefined

I’m just making a kernel module. And I meet this warnings: How can I fix this problem? This is my codes: And my workspace is Ubuntu 3.13.0-66-generic. I need to use file descriptor. So, I can’t use filp_ functions(like filp_open). Edit1: My Makefile: obj-m += NAME.o Answer Calling system calls(sys…

Accessing errno.h in assembly language

I want to access errno present in errno.h in assembly language in order to handle errors of write function call. I found somewhere that make call to _error in assembly language for this purpose but it is throwing errors as : My assembly code : ExitNewShell.asm How to access errno in assembly language? Answer …

system call open() creating executable

So my code creates and writes to the out_file properly. However, the file is an executable for some reason. I think the fault is in my open() call but I can’t seem to find why. Answer man 2 open explains why: So if you want a file that’s not executable, you can use: 0666 will suggest read/write fo…