Operating Systems 2018F: Assignment 3: Difference between revisions

From Soma-notes
Created page with "'''This assignment is not yet finalized.''' Please submit the answers to the following questions via CULearn by 2:30 PM on Wednesday, November 7, 2018. There are ?? points in..."
 
Line 10: Line 10:


==Questions==
==Questions==
'''THESE QUESTIONS ARE FROM LAST YEAR, THEY ARE BEING CHANGED'''


# [1] If you erase the first few blocks of a filesystem, it will become unmountable; however, fsck will generally be able to recover the filesystem. What extra information stored in the filesystem allows fsck to do the repair?
# [1] If you destroy all of the superblocks in a filesystem, will fsck be able to recover the filesystem? Explain.
# [1] Sometimes the kernel will refuse to unmount a filesystem (when the requesting user has sufficient privileges). What is one important reason why this happens?
# [1] When would you expect to find files in the lost+found directory?
# [2] Why can't you use printf() in Linux kernel modules, but you can use similar C library functions such as snprintf()More generally, why is only some some of the standard C library available to kernel code?
# [1] Why should you unmount a usb drive before removing it? What kind of problems could occur?
# [2] When you load a kernel module, are you creating a new processWhy or why not?
# [2] Are man pages a good documentation source when when developing kernel modules?  Why or why not?
# [2] Is a running Linux system that is generating multiple "Oops" messages at risk of doing something bad, like corrupting data or crashing? Explain.
# [2] When you load a kernel module, what code is guaranteed to runWith what privileges will this code run?
# [2] Why does newgetpid.c use put_user() in newgetpid_read(), rather than just writing directly to buf? Explain briefly.
# [4] You attach a new USB webcam to your computer that is running Linux.  The webcam is recognized and works properly.
# [2] How can the logical size of a filesystem be larger than the physical sizeHow can the logical size be smaller than the physical size?
#* How could you find out what kernel module(s) were loaded, if any, when you attached the webcam?
# [2] What type is "current" normally in Linux source code?  What does "current" refer to?
#* What is a simple way you could prevent those modules from being loaded in the future?
#* What sort of problems could the webcam drivers (modules) cause if they sometimes use dynamically allocated memory improperly (say, by using a buffer after it had been freed)?
# [2] When first connecting to a remote host via ssh, you will normally get a message saying something similar to this: "The authenticity of host 'access.scs.carleton.ca (134.117.29.72)' can't be established.  RSA key fingerprint is SHA256:MexEKZF0Os0Vl6VTObN70lRf2DFsGfD8DTQ7FKKqVJ4.  Are you sure you want to continue connecting (yes/no)?"
#* Why is this question important?
#* What is the "fingerprint" for?
# [2] As user student (uid=1000), you run "sshfs <scs-username>@access.scs.carleton.ca:. scs-files", where <scs-username> is your username. 
#* Will the files in scs-files have a uid=1000Why or why not?
#* Assume a file in scs-files is marked as being readable only by the owner.  Will you be able to read the contents of this file?  Why or why not?
# [2] How do you safely access userspace memory from a kernel module?  Give an example of where we do this in a kernel module covered in class.
# [1] How can you make a file that is 20 GB in size (you can read 20 GB of information from it) but takes up essentially no space on disk?
# [2] What line(s) in newgetpid.c sets the name of the device file (i.e. making it /dev/newgetpid rather than /dev/ones)?  How did you verify that your answer was correct?
# [2] What line(s) in newgetpid.c sets the name of the device file (i.e. making it /dev/newgetpid rather than /dev/ones)?  How did you verify that your answer was correct?
# [2] What changes need to be made to newgetpid.c to allow it to respond to write requests?  Hint: How does newgetpid.c respond to read requests?
# [2] What changes need to be made to newgetpid.c to allow it to respond to write requests?  Hint: How does newgetpid.c respond to read requests?

Revision as of 15:43, 30 October 2018

This assignment is not yet finalized.

Please submit the answers to the following questions via CULearn by 2:30 PM on Wednesday, November 7, 2018. There are ?? points in ?? questions.

Submit your answers as a single text file named "<username>-comp3000-assign3.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 3", your name, student number, and the date of submission. You may wish to format your answers in Markdown to improve their appearance.

No other formats will be accepted. Submitting in another format will likely result in your assignment not being graded and you receiving no marks for this assignment. In particular do not submit an MS Word or OpenOffice file as your answers document!

Don't forget to include what outside resources you used to complete each of your answers, including other students, man pages, and web resources. You do not need to list help from the instructor, TA, or information found in the textbook.

Questions

  1. [1] If you destroy all of the superblocks in a filesystem, will fsck be able to recover the filesystem? Explain.
  2. [1] When would you expect to find files in the lost+found directory?
  3. [1] Why should you unmount a usb drive before removing it? What kind of problems could occur?
  4. [2] Are man pages a good documentation source when when developing kernel modules? Why or why not?
  5. [2] When you load a kernel module, what code is guaranteed to run? With what privileges will this code run?
  6. [4] You attach a new USB webcam to your computer that is running Linux. The webcam is recognized and works properly.
    • How could you find out what kernel module(s) were loaded, if any, when you attached the webcam?
    • What is a simple way you could prevent those modules from being loaded in the future?
    • What sort of problems could the webcam drivers (modules) cause if they sometimes use dynamically allocated memory improperly (say, by using a buffer after it had been freed)?
  7. [2] When first connecting to a remote host via ssh, you will normally get a message saying something similar to this: "The authenticity of host 'access.scs.carleton.ca (134.117.29.72)' can't be established. RSA key fingerprint is SHA256:MexEKZF0Os0Vl6VTObN70lRf2DFsGfD8DTQ7FKKqVJ4. Are you sure you want to continue connecting (yes/no)?"
    • Why is this question important?
    • What is the "fingerprint" for?
  8. [2] As user student (uid=1000), you run "sshfs <scs-username>@access.scs.carleton.ca:. scs-files", where <scs-username> is your username.
    • Will the files in scs-files have a uid=1000? Why or why not?
    • Assume a file in scs-files is marked as being readable only by the owner. Will you be able to read the contents of this file? Why or why not?
  9. [2] How do you safely access userspace memory from a kernel module? Give an example of where we do this in a kernel module covered in class.
  10. [1] How can you make a file that is 20 GB in size (you can read 20 GB of information from it) but takes up essentially no space on disk?
  11. [2] What line(s) in newgetpid.c sets the name of the device file (i.e. making it /dev/newgetpid rather than /dev/ones)? How did you verify that your answer was correct?
  12. [2] What changes need to be made to newgetpid.c to allow it to respond to write requests? Hint: How does newgetpid.c respond to read requests?