This is the website for a prior semester's offering of CS 3330.

Memory Safety Lab

In this lab, you will diagnose and fix memory errors in a simple program. To do this, we will be using a debugging tool intended to help identify memory errors. This tool is built-in into the C compiler installed on the lab machines.

Your Task

  1. Download asanlab.tar and extract it. This contains an example broken implementation of a circular doubly-linked list library and a test program for it.

  2. Run make in the root directory the given program.

  3. Run make test to run our test program under a memory error detector called AddressSanitizer.

  4. Modify ll.c so make test reports no errors. (This includes errors from the test program itself and from AddressSanitizer.)

  5. Submit your fixed ll.c to archimedes. You may work with other students in your lab, but each student must submit an ll.c.

Troubleshooting

  1. If you run into trouble with not getting line numbers in stack traces, try doing the lab on a lab machine, such by SSH’ing into labunix01, labunix02, or labunix03, and running “make clean” followed by “make” to force everything to be recompiled and linked on those machines.

Hints

Files in the Archive

Understanding AddressSanitizer

The Shadow Memory

Interpreting Output

Invalid reads and writes

Memory leaks

General debugging advice