P3: File Systems
You work for a top-secret shadow government organization dedicated to the rise of the Silurian overlords. You, as a faithful member of the Lizard Legion, are part of the team charged with improving data storage and handling, particularly tracking metadata – that is, data about data – within the system. You have been tasked adding a classification attribute to the file system used by the organization. Naturally, the organization uses the superior Reptilian operating system distribution.
In this project, you will implement two system calls in Reptilian along with two static library functions that allow the system calls to be invoked from a C API. These custom system calls will retrieve and set a custom file attribute you will create to track a file’s classification for use within the Lizard Legion organization. We, as your benevolent lizard overlords, will provide a program that exercises and demonstrates the new calls. You create a short video to demonstrate your code. (Our masters will be most pleased.) You’ll submit the project via Canvas so as not to invite suspicion.
NOTE: Take Snapshots in VirtualBox! You will most likely brick your machine at some point during this or other projects, and you will not want to start from scratch. No, seriously – take snapshots!
The project is broken into three main parts:
- Create a custom classification attribute for all
- Create system calls that allows a process to get or set the classification of a
- Create static library functions that allow the system calls to be invoked via a C
While exact implementation may vary, the library functions must match the signatures laid out in this document, and the system calls must apply the security model properly.
Each file in the modified file system will have a classification. The rules for this system will be as follows:
- All files should be initializedwith a classification level of zero (0).
- Files existing before addition of classification should be interpreted as having classification of zero(0).
- A process running as the superusermay read and write the classification of any
- A user’s read and write access for a file is determined by the standard Linux file
NOTE: The system calls will be called using syscall(call_number, parameter1, parameter2). Your system call must be limited to no more than two parameters! In addition, the classification of files must be stored persistently; as such, you will need to modify the file system to add it.
You will create a static library in a directory named classification to invoke the system calls. This will be composed of a header with name classification.h and a static library file named libclassification.a. You will also need to provide a Makefile for this library in the directory. All other sources must be contained within the classification directory. Please note, the names of these files must match exactly!
You will need to create a tarred gzip file of the classification directory with name classification.tar.gz. When testing your code, we will decompress the archive, enter the classification directory, and build. All functions enumerated below must be made available by including “classification.h“. See Submission for details.
These functions are to be used by programs.
int set_classification (const char *filename, int new_class)
Invokes system call which attempts to change the file identified by filename to classification new_class. Returns new_class on success, and -1 otherwise.
int get_classification (const char *filename)
Invokes system call which reads the classification of the process identified by filename. Returns the access level on success, and -1 otherwise.
You will submit the following at the end of this project:
- Report onCanvas
- Screencast onCanvas
- Kernel Patch File (lastname_firstname-p3.diff) onCanvas
- Compressed tar archive (tar.gz) for classificationlibrary on Canvas
Your report will explain how you implemented the new system calls, including what changes were made to which files and why each change was made. It must include an explanation of the structures that were changed. It will include description of how testing was performed along with any known bugs. The report may be in Portable Document Format (pdf) or plain-text (txt) and should be no more than a page. It should cover all relevant aspects of the project and be organized and formatted professionally – this is not a memo!
In addition to the written text report, you should submit a screencast (with audio) walking through the changes you make to the operating system to enable the system calls (~5 minutes).
The patch file will include all changes to all files in a single patch. Applying the patches and remaking the necessary parts of Reptilian, then rebooting and then building the test code (which we will also copy over) should compile the test program.
Your project will be tested by applying the patch by switching to /usr/rep/src/kernel and running:
$ git apply lastname_firstname-p3.diff
$ make && sudo make install && sudo make modules_install
Compressed Archive (classification.tar.gz)
Your compressed tar file should have the following directory/file structure:
To build the library, we will execute these commands:
$ tar zxvf classification.tar.gz
$ cd classification
$ cd ..
To link against the library, we will execute this command:
$ cc -o program_name sourcefile.c -L ./classification -lclassification
Please test your library build and linking before submission! If your library does not compile it will result in
zero credit (0, none, goose-egg) for the library/system call portion of the project.
You may find the following resources helpful when reading about how to add the classification system: