Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

9.9. Exercises

  1. Assume in each of the following cases that the initial set of process user IDs is real=1000 effective=0 saved=0 file-system=0. What would be the state of the user IDs after the following calls?

    1. setuid(2000);

    2. setreuid(-1, 2000);

    3. seteuid(2000);

    4. setfsuid(2000);

    5. setresuid(-1, 2000, 3000);

  2. Is a process with the following user IDs privileged? Explain your answer.

    real=0 effective=1000 saved=1000 file-system=1000

  3. Implement initgroups() using setgroups() and library functions for retrieving information from the password and group files (Section 8.4). Remember that a process must be privileged in order to be able to call setgroups().

  4. If a process whose user IDs all have the value X executes a set-user-ID program whose user ID, Y, is nonzero, then the process credentials are set as follows:

    real=X effective=Y saved=Y

    (We ignore the file-system user ID, since it tracks the effective user ID.) Show the setuid(), seteuid(), setreuid(), and setresuid() calls, respectively, that would be used to perform the following operations:

    1. Suspend and resume the set-user-ID identity (i.e., switch the effective user ID to the value of the real user ID and then back to the saved set-user-ID).

    2. Permanently drop the set-user-ID identity (i.e., ensure that the effective user ID and the saved set-user-ID are set to the value of the real user ID).

    (This exercise also requires the use of getuid() and geteuid() to retrieve the process’s real and effective user IDs.) Note that for certain of the system calls listed above, some of these operations can’t be performed.

  5. Repeat the previous exercise for a process executing a set-user-ID-root program, which has the following initial set of process credentials:

    real=X effective=0 saved=0


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial