system-calls

Why does the sys_read system call end when it detects a new line?

我们两清 提交于 2021-02-20 05:56:48
问题 I'm a beginner in assembly (using nasm). I'm learning assembly through a college course. I'm trying to understand the behavior of the sys_read linux system call when it's invoked. Specifically, sys_read stops when it reads a new line or line feed . According to what I've been taught, this is true. This online tutorial article also affirms the fact/claim. When sys_read detects a linefeed, control returns to the program and the users input is located at the memory address you passed in ECX. I

Why does the sys_read system call end when it detects a new line?

徘徊边缘 提交于 2021-02-20 05:56:46
问题 I'm a beginner in assembly (using nasm). I'm learning assembly through a college course. I'm trying to understand the behavior of the sys_read linux system call when it's invoked. Specifically, sys_read stops when it reads a new line or line feed . According to what I've been taught, this is true. This online tutorial article also affirms the fact/claim. When sys_read detects a linefeed, control returns to the program and the users input is located at the memory address you passed in ECX. I

Why does the sys_read system call end when it detects a new line?

蹲街弑〆低调 提交于 2021-02-20 05:55:00
问题 I'm a beginner in assembly (using nasm). I'm learning assembly through a college course. I'm trying to understand the behavior of the sys_read linux system call when it's invoked. Specifically, sys_read stops when it reads a new line or line feed . According to what I've been taught, this is true. This online tutorial article also affirms the fact/claim. When sys_read detects a linefeed, control returns to the program and the users input is located at the memory address you passed in ECX. I

Why does the Linux Open system call not need a buffer size parameter for the path?

柔情痞子 提交于 2021-02-17 06:25:26
问题 Why does the open system call not need a buffer size parameter like the write system call does? How do these two system calls treat their string parameters differently? Does the open system call assume a zero-terminated string for the path parameter while the write system call does not? If so why the inconsistency? Why not make all (or none) of the system calls that use strings / arrays require a size parameter? 回答1: UNIX was developed as an operating system for programs written in assembly,

Linux system calls vs C lib functions

六月ゝ 毕业季﹏ 提交于 2021-02-16 13:25:58
问题 I have bit bit of confusion regarding these two so here are my questions; The Linux man-pages project lists all these functions: https://www.kernel.org/doc/man-pages/ Looking at recvfrom as an example, this function exists both as a Linux system call as well as a C library function. Their documentation seems different but they are both reachable using #include <sys/socket.h> . I don't understand their difference? I also thought systems calls are defined using hex values which can be

Passing linked list via copy_from_user

若如初见. 提交于 2021-02-11 16:43:38
问题 I'm working on a linux project. I need to pass a linked list to the kernel from a userspace program. I have used the kernel way of implementing linked lists in userspace. I have defined a structure as follows: struct time{ int val; struct list_head* list; }; The variable for this strucure would be: struct time mylist; I have given the input data and used list_add function found in linux/include/list.h to link the structures. This mylist is a part of another structure: struct params{ int data1

Passing linked list via copy_from_user

人盡茶涼 提交于 2021-02-11 16:43:26
问题 I'm working on a linux project. I need to pass a linked list to the kernel from a userspace program. I have used the kernel way of implementing linked lists in userspace. I have defined a structure as follows: struct time{ int val; struct list_head* list; }; The variable for this strucure would be: struct time mylist; I have given the input data and used list_add function found in linux/include/list.h to link the structures. This mylist is a part of another structure: struct params{ int data1

Passing linked list via copy_from_user

自古美人都是妖i 提交于 2021-02-11 16:43:20
问题 I'm working on a linux project. I need to pass a linked list to the kernel from a userspace program. I have used the kernel way of implementing linked lists in userspace. I have defined a structure as follows: struct time{ int val; struct list_head* list; }; The variable for this strucure would be: struct time mylist; I have given the input data and used list_add function found in linux/include/list.h to link the structures. This mylist is a part of another structure: struct params{ int data1

Cannot use set_memory_rw in Linux kernel on ARM64

元气小坏坏 提交于 2021-02-11 07:04:41
问题 I am trying to develop a kernel module that hooks the read() system call. for some reason the set_memory_rw() function does not seem to work. I saw another question of this sort but I didn't really understand what to do. I am working on Kali 4.19.93 with Raspberry-pi 4 My code: #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/moduleparam.h> #include <linux/syscalls.h> #include <linux/kallsyms.h> #include <linux/slab.h> #include <linux/kern_levels.h>

Cannot use set_memory_rw in Linux kernel on ARM64

老子叫甜甜 提交于 2021-02-11 07:03:17
问题 I am trying to develop a kernel module that hooks the read() system call. for some reason the set_memory_rw() function does not seem to work. I saw another question of this sort but I didn't really understand what to do. I am working on Kali 4.19.93 with Raspberry-pi 4 My code: #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/moduleparam.h> #include <linux/syscalls.h> #include <linux/kallsyms.h> #include <linux/slab.h> #include <linux/kern_levels.h>