Assignment 5, due Mar 2

Part of the homework for 22C:169, Spring 2006
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated, and unless there is what insurance companies call "an act of God" - something outside your control; the only exceptions to this rule will be by advance arrangement.

  1. In UNIX, application programs can attach handlers to operating system signals using the signal() kernel call (actually, the kernel call is sigaction(), but that call is so ornate and difficult to use that programmers are advised not to even try to use it. See the UNIX man pages and the on-line tutorial:

    http://users.actcom.co.il/~choo/lupg/tutorials/signals/

    The signals-programming tutorial is good, and the get-passwd program is an interesting solution to part of the previous programming assignment.

    a) What does sigaction() let you do that signal() does not.

    b) Given what you know about trap handlers (from Chapter 5 in the text) and what you know about signals, from UNIX, what must the trap handler for the hardware bus-trap condition do in order to send a SIGBUS signal to the application program (indicating an illegal memory address). Note that the keyboard input handler does much the same in order to send a SIGINT signal when it sees a control-C character, and the illegal instruction trap handler does much the same to send a SIGILL trap.

    c) What are the dangerous security consequences that would result if UNIX allowed application programs to handle all signals -- that is, what security problem led the designers of UNIX to provide uncatchable signals as well as the normal catchable ones. Consider, for example, the difference between SIGINT and SIGKILL.

  2. Do exercise 5.4 from the text.

  3. Do exercise 5.6 from the text.