CS 695
Topics in Virtualization and Cloud Computing
Spring 2019


Exercise #2

due date: 30th January 2019.

The aim of this exercise is to familiarize with implementation of Linux loadable kernel modules and system calls.

  • Part A
    In this first part, we will implement a new system call and write a loadable kernel module. Both these tasks require changes to be made in a specific manner and to specific set of files.
    Make sure that both the system call and kernel module print a simple message using the printk kernel function. Understand implications of the first parameter of the function. Note that the system call should be invoked from a user-level process.

  • Part B
    As part of the system call implementation, a hook function should be called. The hook function should be declared in the kernel, along with the system call implementedion, as an external function.
    The hook function should be defined in a kernel module and should be loaded along with the module.
    On user-level invocation of the system call the hook function should be invoked if it is available or a default message should appear. A special case has to be handled when the kernel module is removed (to handle later system call invocations).

  • Part C
    Implement the following two functionalities as part of the hook function.
    1. Print/return the process ids of all process executing on the system. Compare with ps to check results.
    2. Assuming the system call is invoked with a pid, print the virtual memory areas/regions of the process and also the physicall pages allocated to the process.