system-calls

Assembly, hello world question

£可爱£侵袭症+ 提交于 2019-12-04 12:14:15
问题 I'm learning asm on Linux (noobuntu 10.04) I got the following code off of: http://asm.sourceforge.net/intro/hello.html section .text global _start ;must be declared for linker (ld) _start: ;tell linker entry point mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db 'Hello, world!',0xa ;our dear string len

Get Sleep/Hibernate and Resume/Wakeup events in Visual Basic.NET

*爱你&永不变心* 提交于 2019-12-04 11:39:01
问题 I have VB.NET app that communicates with some external server (maintains login sessions via Intranet), and I want to listen for Sleep/Hibernate events such that when it happens, I want to logout an existing session system before computer goes to sleep, while my app will remain running in the background but won't do anything. And vice versa, when computer is resumed from Hibernate or Woke up from sleep, I want to immediately login to the server. How can I grab those events and execute my code?

How to hook system calls of my android app (non rooted device)

╄→гoц情女王★ 提交于 2019-12-04 10:41:41
问题 I am trying to intercept all system calls made by my Android app on a non rooted device. So every time my app writes/reads a file, I want to intercept the system call and encrypt/decrypt the stream for security purposes. The encryption part is no problem, but how do I intercept the system calls? Because parts of the app are modules developed by third party providers of which I can not change the source code, there is no other way to make sure that data is stored securely. Since I do not have

do system calls execute inside a software interrupt handler in entirety?

拜拜、爱过 提交于 2019-12-04 09:06:46
Do system calls execute in the context of a software interrupt handler in entirety? I mean, some system calls like read() could take a long time to return, against the policy that ISR should be very short in execution time. Are system calls offloaded to other threads? How does that work? [A reference to any kernel is fine] Benoit The syscalls run on most kernels inside an ISR . Take a quick glance at a former release of Linux and you will notice the int $Ox80 to invoke the kernel. This solution which is probably the simplest from a kernel development point of view, has a strong drawback: as

How to trace a process for system calls?

穿精又带淫゛_ 提交于 2019-12-04 08:44:03
问题 I am trying to code a program that traces itself for system calls. I am having a difficult time making this work. I tried calling a fork() to create an instance of itself (the code), then monitor the resulting child process. The goal is for the parent process to return the index of every system call made by the child process and output it to the screen. Somehow it is not working as planned. Here is the code: #include <unistd.h> /* for read(), write(), close(), fork() */ #include <fcntl.h> /*

Creating a System Call in Linux

南笙酒味 提交于 2019-12-04 08:22:20
问题 We just got a midterm project today for my "operating systems" course, we are requested to implement a system call (and I guess I assume we'll have to write a piece of code to call it). I understand I'll need to update the table of the system calls (can't remember the name, but no biggie), as well as create a kernel module that the table will point to, but does this mean I'll have to recompile the whole kernel, so the kernel knows about my module? I have seen that it's possible to hijack a

C and resource protection in memory

北城以北 提交于 2019-12-04 08:03:54
When we compile a C program, it just generates some machine-understandable code. This code can directly run on the hardware, telling from this question . So my questions are: If a C program can directly run on the hardware, how can the kernel handle the resource allocation for this program? If the executable generated from the compiler is in pure machine-understandable form, then how do the privileged and non-privileged modes work? How does the kernel manage the permission of hardware resources if a program can directly run on the hardware not through the kernel? If a C program can directly

How do system calls work?

梦想的初衷 提交于 2019-12-04 07:25:01
问题 I understand that a user can own a process and each process has an address space (which contains valid memory locations, this process can reference). I know that a process can call a system call and pass parameters to it, just like any other library function. This seems to suggest that all system calls are in a process address space by sharing memory, etc. But perhaps, this is only an illusion created by the fact that in high level programming language, system calls look like any other

execlp() system call error in output

≡放荡痞女 提交于 2019-12-04 06:37:59
问题 This very simple example of exec() system call. Here, I am trying to call execlp() twice. But, I am not getting excepted output. It shows output only for first call with current directory. #include <stdio.h> #include <unistd.h> int main() { int ret1,ret2; ret1 = execlp( "pwd", "pwd", (char *) 0); ret2 = execlp( "date", "date", (char *) 0); return 0; } OUTPUT : /home/aniket Here, I can't see output for date. Can anyone please explain why is this happening? 回答1: execlp() replaces the current

How to determine values saved on the stack?

匆匆过客 提交于 2019-12-04 06:35:26
I'm doing some experimenting and would like to be able to see what is saved on the stack during a system call (the saved state of the user land process). According to http://lxr.linux.no/#linux+v2.6.30.1/arch/x86/kernel/entry_32.S it shows that the various values of registers are saved at those particular offsets to the stack pointer. Here is the code I have been trying to use to examine what is saved on the stack (this is in a custom system call I have created): asm("movl 0x1C(%esp), %ecx"); asm("movl %%ecx, %0" : "=r" (value)); where value is an unsigned long. As of right now, this value is