Homework 6
W4118 Fall 2000
DUE: Monday, 12/11/2000 at the beginning of class
W4118 Fall 2000 - Homework 6
Submission Instructions:
All non-programming problems in this assignment are to be done by yourself.
All group programming problems in this assignment are to be done in
your assigned groups. Each of you should turn in one hardcopy for the
non-programming problems. Each group should turn in one hardcopy for
the programming problems. Both hardcopies should have your name and
email address clearly written on the first page.
Programming problems are to be done in your assigned groups using the
VM that has been assigned to your group. For all programming problems
you will be required to submit source code, a README file documenting
your files and code, and a test run of your programs. For source code
submissions, you only need to submit new source code files that you
created and kernel source code files that you changed. You should
clearly indicate your names, email addresses, and assigned group
number on your submission. Each group is required to submit one
writeup for the programming assignment using the SUBMIT program.
Refer to the homework submission page on the class web site for
additional submission instructions.
Non-Programming Problems:
Exercise numbers refer to the course textbook. Each problem is
worth 4 points unless otherwise indicated.
- Exercise 11.3
- Exercise 11.8
- Exercise 11.9
- Exercise 11.14
- Exercise 11.19
- Exercise 11.24
- Exercise 12.5
- Exercise 13.2
- Exercise 13.12
- Exercise 13.16
Programming Problems:
The standard unix filesystem permission scheme is very crude. It
breaks the entire world into three parts: a file's owner, a file's
group, and everything else. Each one of these parts has three bits
signifying whether they can read, write, or execute a specific file.
A sample file listing would be something like:
-rwxr-xr-x 1 root root 574704 May 2 2000 vi
The rwx
at the beginning indicates that the owner of the
program vi
(root in this case) has the ability to read,
write and execute the file. The middle set of r-x
indicates that members of the owning group (also root) have the
ability to read and execute this file. The final r-x
indicates that any other users have the ability to read and execute
this file.
For this assignment, you are to implement a more flexible access
control list scheme, where an additional set of permissions, for
additional users and groups, are checked upon file access. This
assignment will demonstrate Linux's filesystem behavior, show you how to access files from kernel-space, and teach you how to implement a commonly-used security method. Two documents to start you on your way are Chapter 3 of Linux Kernel Internals and Chapter 9 of The Linux Kernel.
- (30 pts) Implement a system call that takes a filename, a user-id, a
permission set, and a mode. The specified user-id is then added to an
access-control list, along with its permissions regarding this file.
This permission set is checked ahead of the standard permission scheme
(i.e. owner, group, other) whenever a file is opened for reading or
writing, or executed.
The prototype for this system call is:
int acl_perms(char * filename, int id, int permission, int mode);
permission
should be some combination of the values 4 for
read, 2 for write, and 1 for execute. If the value of
mode
is 1, that signifies that id
is a user
id (a uid
). If the value of mode
is 2, that signifies
that id
represents a group id (a gid
).
mode
s of -1 and -2 specify that the identified user or
group are to be removed from the access-control list.
In order to make your changes persistent, the kernel is to save this infomation to a file named .acl within the directory in which your acl protected files reside.
- (20 pts)Modify the kernel so all appropriate file accesses check these permissions from the correct .acl file (if one exists). The user-ids in the acl list are the first permissions checked. If they either grant or deny access to the user seeking file access, then their decision is final. Next, the group-ids are checked. If they do not provide an answer, the default linux permissioning scheme has the final word. Also, your acl implementation should not be portable; it should only work for the ext2 filesystem.
- (10 pts)Add to the system three users with ids of 501, 502, and 503.
Through a test program, have each one granted read, write and execute
permissions respectively for a specific file. Demonstrate that each
process only has its specified permissions. Repeat this procedure
with different group ids.