kernel

How can I read a UDP segment in Kernel Space?

Hello everyone. I create a module in kernel space that send a UPD segment using socket RAW, but my problem is read the UDP segment from kernel space. I can read the UDP segment from user space, but when I prove to use "sock_recvmsg" from kernel space, I obtain as result -512 Please, help me! ...

Unable to write in kernel memory via Linux kernel module (Ubuntu)

Hey I'm trying to overwrite certain pieces in kernel memory (Linux 2.6.31, Ubuntu 9.10) in a virtual machine (using VirtualBox) via a kernel module. Whenever I'm doing this I get this error [27154.303726] BUG: unable to handle kernel paging request at 0xc05769bc My code: unsigned char *p = (unsigned char *) c05769bc; p[1] = (add...

What does "do { ... } while (0)" do exactly in kernel code?

Possible Duplicates: Whats the use of do while(0) when we define a macro? Why are there sometimes meaningless do/while and if/else statements in C/C++ macros? C multi-line macro: do/while(0) vs scope block I have seen a lot of usages like this, previously I though that the programmer wanted to break out of a block of code...

Linux kernel scheduling

Hi, I wish to know how Old Linux scheduling algorithm SJF (shortest job first) calculates the process runtime ? ...

Custom types in OpenCL kernel

Is it possible to use custom types in OpenCL kernel like gmp types (mpz_t, mpq_t, …) ? To have something like this (this kernel doesn't build just because of #include <gmp.h>) : #include <gmp.h> __kernel square( __global mpz_t* input, __global mpz_t number, __global int* output, const unsigned int count) { int i = get_g...

Linux Kernel Threads - scheduler

Hi People, Is Linux Kernel scheduler a part of init process? My understanding is that it is part of Kernel threads managed internally not visible to user by either top or ps. Please correct my understanding. Is it possible to view standard kernel threads through any kernel debugger to see how standard threads occupy cpu activity? -Kar...

Is OSCompareAndSwap (Mac OS X) equivalent to CMPXCHG8B?

Is OSCompareAndSwap (Mac OS X) equivalent to CMPXCHG8B? ...

Is OSCompareAndSwap is immune to ABA problem like CMPXCHG8B?

Is OSCompareAndSwap is immune to ABA problem like CMPXCHG8B? ...

nested page-faulting of user-space address in Linux

Hi, I would like to know if it is functionally wrong to page-fault a user-space address when kernel is running fault-handler to bring in a user-page. OS is Linux 2.6.30 Assume that both user-addresses are valid ( falling within vma , rw permission ) for the task. When I check the kernel code, i find that the kernel does not mind...

Implementations of Mobile IP on linux

Are there any standard implementations of Mobile IP for Linux? If I want to support mobile IP for a network, what all needs to be done? If I have to write code from scratch, is it likely that a kernel module will suffice or I would have to make changes to the kernel code. I just need a bit of headstart to know where to begin. ...

Order of the [BITS 16] and [ORG 0x0000] directives

I am beginning some experimentation in writing a kernel and having fun doing it. I have the basic boot-loader done and the following directives: [BITS 16] [ORG 0x0000] In the kernel tutorial, however, it starts with: [ORG 0x0000] [BITS 16] I was wondering if the order in which these directives are given makes a difference? I am...

User Mode Linux - Installing a module error

I am trying to run 'make' on a module in User Mode Linux to install a simple makefile. Here is my make file: obj-m := hello.o KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules When I run this in User Mode Linux I get the following error: make[1]: Enterin...

System Calls in windows & Native API?

Recently I've been using lot of Assembly language in *NIX operating systems. I was wondering about the windows domain. Calling convention in linux: mov $SYS_Call_NUM, %eax mov $param1 , %ebx mov $param2 , %ecx int $0x80 Thats it. That is how we should make a system call in linux. Reference of all system calls in linux: Regarding...

"STI", in the protected mode,CPU will restart.

INTEL X86 Platform. My programme run start at 2M absolute address in protected mode,everything seems ok, but when i enable interrupt with "sti", the CPU will restart. Why? is there any necessary initialization before "enbale interrupt"? i have setup the idtptr, but it seems no work. ...

Kernel panic when altering system_call in entry.S

I'm trying to implement a system call counter, and as a result I included an int value in task_struct, and a function that increments it in a separate file. This function is supposed to be called from system_call right before it actually calls the required sys_call (I have my reasons to call it before and not after). However, if I place ...

Can we use any feature of linux in our app?

Since Android is built on Linux Kernel.Are there any functionality of Linux which we can use in our application? ...

Problem with bootstrap loader and kernel

We are working on a project to learn how to write a kernel and learn the ins and outs. We have a bootstrap loader written and it appears to work. However we are having a problem with the kernel loading. I'll start with the first part: bootloader.asm: [BITS 16] [ORG 0x0000] ; ; all the stuff in between ; ; the bottom of ...

Interpreting segfault messages

What is the correct interpretation of the following segfault messages? segfault at 10 ip 00007f9bebcca90d sp 00007fffb62705f0 error 4 in libQtWebKit.so.4.5.2[7f9beb83a000+f6f000] segfault at 10 ip 00007fa44d78890d sp 00007fff43f6b720 error 4 in libQtWebKit.so.4.5.2[7fa44d2f8000+f6f000] segfault at 11 ip 00007f2b0022acee sp 00007fff368ea...

Does it make sense to have more than one UDP Datagram socket on standby? Are "simultaneous" packets dropped or queued by the kernel?

I'm coding a networking application on Android. I'm thinking of having a single UDP port and Datagram socket that receives all the datagrams that are sent to it and then have different processing queues for these messages. I'm doubting if I should have a second or third UDP socket on standby. Some messages will be very short (100bytes ...

What are the first operations that the Linux Kernel executes on boot?

After the boot loader hands execution over to the kernel, what happens? I know assembler, so what are the first few instructions that a kernel must make? Or is there a C function that does this? What is the startup sequence before the kernel can execute an arbitrary binary? ...