Skip to content
Advertisement

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 provided in

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, int mode); So far, I have succeeded in manually inspecting the

When should syscall function be used instead of glibc wrapper?

man page of syscall says, “it is useful when there is no wrapper function in c library”. If wrapper function is available, Is it always better to use wrapper function ? If not, when should prefer syscall over it? Answer Never. The only situation where you should ever consider using syscall() is to invoke a system call that doesn’t have

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_* functions) from the kernel code is not a good idea.

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 You’re making x86 Linux syscalls from

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 for all (equivalent

System calls : difference between sys_exit(), SYS_exit and exit()

What is the difference between SYS_exit, sys_exit() and exit()? What I understand : The linux kernel provides system calls, which are listed in man 2 syscalls. There are wrapper functions of those syscalls provided by glibc which have mostly similar names as the syscalls. My question : In man 2 syscalls, there is no mention of SYS_exit and sys_exit(), for

Advertisement