Extra Credit 1

Due: October 9, 2023
Points: 20

The goal of this exercise is to determine whether the system enforces the Principle of Complete Mediation. To start, create a readable text file, called testfile. Write a short program that does the following:

  1. Open testfile for reading;
  2. Use either chmod(2) or (preferably) fchmod(2) to turn off read permissions for testfile; and
  3. Use read(2) and write(2) to copy the contents of the file to the standard output (file descriptor 1).

Then run the program. Do you see the contents of the file? If so, after you run your program, try to display the contents of the file using cat(1), less(1), or some similar program. What happens?

Turn in the source code to your program and your answers to the questions in the preceding paragraph. To turn in your source code, please create a .tar file, put the source in there, and submit it. In order to receive credit, please be sure the source code compiles correctly and executes correctly on the CSIF.

Note: If you run your program a second time, be sure testfile is still readable; otherwise, your program will fail.


UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 235A, Computer and Information Security
Version of September 27, 2023 at 11:30AM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh