Navid Malekghaini's Personal Blog

My personal weblog for sharing and storing some of my activities related to computer science over the internet

Navid Malekghaini's Personal Blog

My personal weblog for sharing and storing some of my activities related to computer science over the internet

Navid Malekghaini's Personal Blog

Navid Malekghaini

Software Engineer @ Intelligent Cloud Infrastructure Laboratory
Prev. ML Researcher @ University of Waterloo x Orange Telecom

University of Waterloo
Department of computer science
200 University Ave W, Waterloo, ON N2L 3G1, Canada
cs.uwaterloo.ca

contact me
navidmalekedu (AT) gmail (DOT) com [ Primary Email ]
nmalekgh (AT) uwaterloo (DOT) ca

۳ مطلب با کلمه‌ی کلیدی «linux source» ثبت شده است

The main project that me and my colleague designed for Operating Systems course ( Spring 2018 ) - TA of OS

Project Description ( summary ):

The goal of this project is to gather information about incoming and outgoing packets in system. ( some kind of packet capturing )

The desired informations are :

  • Lenght of packet
  • Protocols of packet ( in all available layers of network except application layer, for example Ethernet,IP,TCP )
  • Hash value of packet
  • Total Processing time of packet


Phase one :

  1. implement a systemcall with a single integer input indicating what information you desire from packets and single output buffer to copy the data from kernel space to user space.
  2. an interactive user space program that talks to the user and systemcall call above ( clean input and output for user ).

    Phase two :
    1. implement a kernel module with a single proc entry file for input indicating what information you desire from packets and single proc entry file for output and to copy the data from kernel space to user space.
    2. an interactive user space program that talks to the user and kernel module and proc entry files above ( clean input and output for user ).

    Phase three :

    Performance comparsion of kernel module and system call ( the first two phases ).


    DOWNLOAD PROJECT DESCRIPTIONS IN DETAIL

    Approach Taken for answer:

    All of the desired informations are in sk_buff data structure.
    my approach was to clone sk_buff from driver, right before the driver ( here : e1000 ) wants to pass the packet to the next network layer handler ( application or the NIC ). with this approach i will have a clone for each packet.
    now that i have the information the rest is easy, just copy the desired information from the sk_buff to the output buffer and copy from there to user space.




    note: for the LKM you should use extern and export symbol.



    the idea for this approach was from here



    DOWNLOAD THE IMPLEMENTATION OF THIS APPROACH WITH DOCUMENTATION IN PERSIAN FROM STUDENTS ( WITH MY HELP )


    Second approach:

    second approach i believe is based on this idea from IBM.

    Download the Implementation of Second Approach From a Student With Document

موافقین ۰ مخالفین ۰ 27 January 19 ، 02:14

Part 2.1

Implementation of Simple “hello world” Module and Run


 

TO GET THE FULL TUTORIAL CLICK HERE

Every module structure have two major functions:

  1. init

  • executed when the module is loaded into kernel

  1. cleanup

  • executed when the module is removed from kernel

the simple module implementation is here:



TO GET THE FULL TUTORIAL CLICK HERE

موافقین ۰ مخالفین ۰ 29 September 17 ، 04:00

Part 1.1

Adding simple system call to kernel from scratch


 

DOWNLOAD FULL TUTORIAL WITH IMAGES FROM HERE

First create a directory named linuxSRC to download linux source, and Change directory to the folder:

console:

mkdir /linuxSRC
cd linuxSRC

 

after that you should first download the linux source, inorder to download every source on the package repository of ubuntu you should go to your package list ,You need to uncomment the deb-src lines in the main file /etc/apt/sources.list not the extra files in/etc/apt/sources.list.d:
open software & updates
go to ubuntu software tab
check source code
save and exit

 

after that you should get your current version linux kernel and build dependencies:

console:

 

mkdir newKernel
cd newKernel

 

now download the linux source and decompress it:

console:

 

sudo apt-get install linux source
tar xjvf /usr/src/linux-source-<yourversion>tar.bz2

now go to the specified folder bellow :

 

/home/nubuntu/linuxSRC/linux-source-4.4.0/arch/x86/entry/syscalls

now open syscall_64.tbl or syscall_32.tbl (based on your system)(i use 64)

at the end add your hello syscall after the last number (here 333), with the following format, save and exit.
 

from here the tutorial have images, so I've created a nice PDF document with screen shots to download.

DOWNLOAD FULL TUTORIAL WITH IMAGES FROM HERE

 
موافقین ۰ مخالفین ۰ 11 July 17 ، 06:42