ONLamp.com: Secure Programming Techniques

Size: px
Start display at page:

Download "ONLamp.com: Secure Programming Techniques"

Transcription

1 Page 1 of 11 Published on ONLamp.com ( See this if you're having trouble printing code examples O'Reilly Book Excerpts: Practical Unix & Internet Security, 3rd Edition Secure Programming Techniques by Gene Spafford, Simson Garfinkel, Alan Schwartz Editor's note: In this first installment in a multipart series of excerpts from Practical Unix & Internet Security, 3rd Edition, you'll find tips and general design principles to code by that will help you avoid security-related bugs. Over the next few weeks, we'll offer additional tips on topics ranging from writing network programs to writing SUID/SGID programs to using passwords to generating random numbers; all from Chapter 16 on "Secure Programming Techniques." Related Reading Tips on Avoiding Security-Related Bugs Software engineers define errors as mistakes made by humans when designing and coding software. Faults are manifestations of errors in programs that may result in failures. Failures are deviations from program specifications. In common usage, faults are called bugs. Why do we bother to explain these formal terms? For three reasons: 1. To remind you that although bugs (faults) may be present in the code, they aren't necessarily a problem until they trigger a failure. Testing is designed to trigger such a failure before the program becomes operational...and results in damage. Practical Unix & Internet Security, 3rd Edition By Simson Garfinkel, Gene Spafford, Alan Schwartz Table of Contents Index Sample Chapter Read Online--Safari Search this book on Safari: Only This Book gfedc Code Fragments only 2. Bugs don't suddenly appear in code. They are there because some person made a mistake--from ignorance, from haste, from carelessness, or from some other reason. Ultimately, unintentional flaws that allow someone to compromise your system were caused by people who made errors.

2 Page 2 of Almost every piece of Unix software (as well as software for several other widely used operating systems) has been developed without comprehensive specifications. As a result, you cannot easily tell when a program has actually failed. Indeed, what appears to be a bug to users of the program might be a feature that was intentionally planned by the program's authors.[9] When you write a program that will run as superuser or in some other critical context, you must try to make the program as bug-free as possible because a bug in a program that runs as superuser can leave your entire computer system wide open. Even when your program will run as an unprivileged user, it's important to design and implement it carefully, especially if it will be accessed by anonymous or untrusted others. Bugs become vulnerabilities through privilege escalation; an untrusted remote user exploits a bug in a network daemon to gain access as an ordinary local user, and then uses that access to exploit bugs that allow him to act as a privileged user, or even as the superuser. Of course, no program can be guaranteed to be perfect. A library routine can be faulty, or a stray gamma ray may flip a bit in memory to cause your program to misbehave. Nevertheless, there are a variety of techniques that you can employ when writing programs that will tend to minimize the security implications of any bugs that may be present. You can also program defensively to try to counter any problems that you can't anticipate now. Here are some general rules to code by. Design Principles 1. Carefully design the program before you start. Be certain that you understand what you are trying to build. Carefully consider the environment in which it will run, the input and output behavior, files used, arguments recognized, signals caught, and other aspects of behavior. Try to list all of the errors that might occur, and how you will deal with them. Remember: you will need to design your program. Either you will design the program before you start writing it, or you will design it while you are writing it. You might as well design as much of the program before you write the code. That way, if you decide to change your design in the process, there will be less code to change. 2. Document your program before you start writing the code. Write a theory-ofoperation document for your code, describing what it will do and how it will do it. Outline the major modules. Most importantly, revise this document while you write your program. If you can't or won't do that, at least consider writing documentation

3 Page 3 of 11 that includes a complete manual page before you write any code. Doing so can serve as a valuable exercise to focus your thoughts on the code and its intended behavior. 3. Make the critical portion of your program as small and as simple as possible. 4. Resist adding new features simply because you can. Add features and options only when there is an identified need that cannot be met by combining programs (one of the strengths of Unix).[10] The less code you write, the less likely you are to introduce bugs, and the more likely you are to understand how the code actually works. 5. Resist rewriting standard functions. Although bugs have been found in standard library functions and system calls, you are much more likely to introduce newer and more dangerous bugs in your versions than in the standard versions. 6. Be aware of race conditions. These can manifest themselves as a deadlock, or as failure of two calls to execute in close sequence. Deadlock conditions Remember: more than one copy of your program may be running at the same time. Consider using file locking for any files that you modify. Provide a way to recover the locks in the event that the program crashes while a lock is held. Avoid deadlocks or "deadly embraces," which can occur when one program attempts to lock file A and then file B, while another program already holds a lock for file B and then attempts to lock file A. Sequence conditions Be aware that your program does not execute atomically. That is, the program can be interrupted between any two operations to let another program run for a while-- including one that is trying to abuse yours. Thus, check your code carefully for any pair of operations that might fail if arbitrary code is executed between them. In particular, when you are performing a series of operations on a file, such as changing its owner, stating the file, or changing its mode, first open the file and then use the fchown( ), fstat( ), or fchmod( ) system calls. Doing so will prevent the file from being replaced while your program is running (a possible race condition). Also avoid the use of the access( ) function to determine your ability to access a file: using the access( ) function followed by an open( ) is a race condition, and almost always a bug. Write for clarity and correctness before optimizing the code. Trying to write clever shortcuts may be a stimulating challenge, but it is a place where errors often creep in. In practice, most optimizations have little visible effect unless the code is executed in time-

4 Page 4 of 11 critical places (e.g., interrupt handling) or is invoked tens of thousands of times per day. Meanwhile, the penalties for writing dense, difficult-to-understand code can include longer testing time, increased maintenance effort, and more lurking bugs. Spending two days of hacking to save 100 instruction cycles per day is also a very poor return on investment.[11] When Good Calls Fail You may not believe that system calls can fail for a program that is running as root. For instance, you might not believe that a chdir( ) call could fail, as root has permission to change into any directory. However, if the directory in question is mounted via NFS, root usually has no special privileges. The directory might not exist, again causing the chdir( ) call to fail. If the target program is started in the wrong directory and you fail to check the return codes, the results will not be what you expected when you wrote the code. Also consider the open( ) call. It can fail for root, too. For example, you can't open a file on a CD-ROM for writing because CD-ROM is a read-only media. Or consider someone creating several thousand zero-length files to use up all the inodes on the disk. Even root can't create a file if all the free inodes are gone. The fork( ) system call may fail if the process table is full, exec( ) may fail if the swap space is exhausted, and sbrk( ) (the call that allocates memory for malloc( )) may fail if a process has already allocated the maximum amount of memory allowed by process limits. An attacker can easily arrange for these cases to occur. The difference between a safe and an unsafe program may be how that program deals with these situations. If you don't like to type explicit checks for each call, then consider writing a set of macros to "wrap" the calls and do it for you. You will need one macro for calls that return -1 on failure, and another for calls that return 0 on failure. Here are some macros that you may find helpful: #include <assert.h> #define Call0(s) assert((s)!= 0) #define Call1(s) assert((s) >= 0) Here is how to use them: Call0(fd = open("foo", O_RDWR, 0666)); Note, however, that these simply cause the program to terminate without any cleanup. You may prefer to change the macros to call some common routine first to do cleanup and logging.

5 Page 5 of 11 Coding Standards 1. Check all of your input arguments. An astonishing number of security-related bugs arise because an attacker sends an unexpected argument or an argument with an unanticipated format to a program or a function within a program. A simple way to avoid these kinds of problems is by having your program always check all of its arguments. Argument checking will not noticeably slow down most programs, but it will make them less susceptible to hostile users. As an added benefit, argument checking and error reporting will make the process of catching non-security-related bugs easier. 2. When you are checking arguments in your program, pay extra attention to the following: Check arguments passed to your program on the command line. Check to make sure that each command-line argument is properly formed and bounded. Check arguments that you pass to Unix system functions. Even though your program is calling the system function, you should check the arguments to be sure that they are what you expect them to be. For example, if you think that your program is opening a file in the current directory, you might want to use the index( ) function to see if the filename contains a slash character (/). If the filename contains the slash, and it shouldn't, the program should not open the file. Check arguments passed to your program via environment variables, including general environment variables (e.g., HOME) and such variables as the LESS argument. Do bounds checking on every variable. If you only define an option as valid from 1 to 5, be sure that no one tries to set it to 0, 6, -1, 32767, or If string arguments are supposed to be 16 bytes or less, check the length before you copy them into a local buffer (and don't forget the room required for the terminating null byte). If you are supposed to have three arguments, be sure you have three. 3. Check all return codes from system calls. Practically every single Unix operating system call has a return code. Check them! Even system calls that you think cannot fail, such as write( ), chdir( ), and chown( ), can fail under exceptional circumstances and return appropriate return codes. When the calls fail, check the errno variable to determine why they failed. Have your program log the unexpected value and then cleanly terminate if the system call fails for any unexpected reason. This approach will be a great help in tracking down problems later on. If you think that a system call should not fail and it does, do something appropriate. If you can't think of anything appropriate to do, then have your program delete all of

6 Page 6 of 11 its temporary files and exit. 4. Have internal consistency-checking code. Use the assert macro if you are programming in C. If you have a variable that you know should be either a 1 or a 2, then your program should not be running if the variable is anything else. Editor's note: Be aware that the assert() macro is nullified when you compile with the NDEBUG flag enabled. This is a common release optimization. Please read man assert for more details. 5. Include lots of logging. You are almost always better off having too much logging rather than too little. Report your log information into a dedicated log file. Or consider using the syslog facility so that logs can be redirected to users or files, piped to programs, and/or sent to other machines. And remember to do bounds checking on arguments passed to syslog( ) to avoid buffer overflows. Here is specific information that you might wish to log: The time that the program was run. The UID and effective UID of the process. The GID and effective GID of the process. The terminal from which it was run. The process number (PID). If you log with syslog, including the LOG_PID option in the openlog( ) call will do this automatically. Command-line arguments. Invalid arguments, or failures in consistency checking. The host from which the request came (in the case of network servers). The result of an ident lookup on that remote host. 6. Always use full pathnames for any filename argument, for both commands and data files. 7. Check anything supplied by the user for shell metacharacters if the user-supplied input is passed on to another program, written into a file, or used as a filename. In general, checking for good characters is safer than checking for a set of "bad characters" and is not that restrictive in most situations. 8. If you are expecting to create a new file with the open call, then use the O_EXCL O_CREAT flags to cause the routine to fail if the file exists. If you expect the file to be there, be sure to omit the O_CREAT flag so that the routine will fail if the file is not there.[12] 9. If you think that a file should be a file, use lstat( ) to make sure that it is not a link. However, remember that what you check may change before you can get around to

7 Page 7 of 11 opening it if it is in a public directory. 10. If you need to create a temporary file, consider using the tmpfile( ) or mkstemp( ) functions. tmpfile( ) creates a temporary file, opens the file, deletes the file, and returns a file handle. The open file can be passed to a subprocess created with fork( ) and exec( ), but the contents of the file cannot be read by any other program on the system. The space associated with the file will automatically be returned to the operating system when your program exits. If possible, create the temporary file in a closed directory, such as /tmp/root/. mkstemp( ) does not delete the file and provides its name as well as its file handle, and thus is suitable for files that need more persistence. WARNING: Older versions of mkstemp( ) could create world-writable files. Make sure yours doesn't. Never use the mktemp( ) or tmpnam( ) library calls if they exist on your system--they are not safe in programs running with extra privilege. The code as provided on most older versions of Unix had a race condition between a file test and a file open. This condition is a well-known problem and is relatively easy to exploit. 11. Make good use of available tools. If you are using C and have an ANSI C compiler available, use it, and use prototypes for calls. If you don't have an ANSI C compiler, then be sure to use the -Wall option to your C compiler (if supported) or the lint program to check for common mistakes. Use bounds checkers, memory testers, and any other commercial tools to which you have access. Things to Avoid 1. Don't use routines that fail to check buffer boundaries when manipulating strings of arbitrary length. In the C programming language in particular, note the following: Avoid Use instead gets( ) fget( ) strcpy( ) strncpy( ) strcat( ) strncat( ) sprintf( ) snprintf( ) vsprintf( ) vsnprintf( ) 2. Use the following library calls with great care--they can overflow either a

8 Page 8 of 11 destination buffer or an internal, static buffer on some systems if the input is "cooked" to do so: [13] fscanf( ) scanf( ), sscanf( ), realpath( ), getopt( ), getpass( ), streadd( ), strecpy( ), and strtrns( ). Check to make sure that you have the version of the syslog( ) library that checks the length of its arguments. There may be other routines in libraries on your system of which you should be somewhat cautious. Note carefully if a copy or transformation is performed into a string argument without benefit of a length parameter to delimit it. Also note if the documentation for a function says that the routine returns a pointer to a result in static storage (e.g., strtok( )). If an attacker can provide the necessary input to overflow these buffers, you may have a major problem. 3. Don't design your program to depend on Unix environment variables. The simplest way to write a secure program is to make absolutely no assumptions about your environment and to set everything explicitly (e.g., signals, umask, current directory, environment variables). A common way of attacking programs is to make changes in the runtime environment that the programmer did not anticipate. Thus, you should make certain that your program environment is in a known state. Here are some of the things you may want to do: If you absolutely must pass information to the program in its environment, then have your program test for the necessary environment variables and then erase the environment completely. Otherwise, wipe the environment clean of all but the most essential variables. On most systems, this is the TZ variable that specifies the local time zone, and possibly some variables to indicate locale. Cleaning the environment avoids any possible interactions between it and the Unix system libraries. You might also consider constructing a new envp and passing it to exec( ), rather than using even a scrubbed original envp. Doing so is safer because you explicitly create the environment rather than try to clean it. Make sure that the file descriptors that you expect to be open are open, and that the file descriptors you expect to be closed are closed. Consider what you'll do if stdin, stdout, or stderr is closed when your program starts (a safe option is usually to connect them to /dev/null.) For example, components of Wietse Venema's Postfix mailer often include this C snippet: for (fd = 0; fd < 3; fd++) if(fstat(fd, &st) == -1 && (close(fd), open("/dev/null", O_RDWR msg_fatal("open /dev/null: %m"); Ensure that your signals are set to a sensible state.

9 Page 9 of 11 Set your umask appropriately. Explicitly chdir ( ) to an appropriate directory when the program starts. 4. Do not provide shell escapes in interactive programs (they are not needed). 5. Never use system( ) or popen( ) calls. Both invoke the shell, and can have unexpected results when they are passed arguments with funny characters, or in cases where environment variables have peculiar definitions. 6. Do not create files in world-writable directories. 7. Don't have your program dump core except during your testing. Core files can fill up a filesystem and contain confidential information. In some cases, an attacker can actually use the fact that a program dumps core to break into a system. Instead of dumping core, have your program log the appropriate problem and exit. Use the setrlimit( ) function or equivalent to limit the size of the core file to 0. While you're at it, consider setting limits on the number of files and stack size to appropriate values if they might not be appropriate at the start of the program. Before You Finish 1. Read through your code. After you have written your program, think of how you might attack it yourself. What happens if the program gets unexpected input? What happens if you are able to delay the program between two system calls? 2. Test it carefully for assumptions about the operating environments. For example: If you assume that the program is always run by somebody who is not root, what happens if the program is run by root? (Many programs designed to be run as daemon or bin can cause security problems when run as root, for instance.) If you assume that the program will be run by root, what happens if it is not run as root? If you assume that the program always runs in the /tmp or /tmp/root [14] directory, what happens if it is run somewhere else? What if /tmp/root is a symlink? What if it doesn't exist? 3. Test your program thoroughly. If you have a system based on SVR4, consider using (at the least) tcov, a statement-coverage tester (and if your system uses GNU tools, try gcov). Consider using commercial products, such as Centerline's CodeCenter and Rational's PurifyPlus (from personal experience, we can tell you that these programs are very useful). Remember that finding a bug in testing is better than letting some anonymous attacker find it for you!

10 Page 10 of Have your code reviewed by another competent programmer (or two, or more). After she has reviewed it, "walk through" the code with her and explain what each part does. We have found that such reviews are a surefire way to discover logic errors. Trying to explain why something is done a certain way often results in an exclamation of "Wait a moment... why did I do that?" TIP: Simply making your code available for download is not the same as having a focused review! The majority of code published on the Web and via FTP is not carefully examined by competent reviewers with training in security and code review. In most cases, the people who download your code are more interested in using it, or porting it to run on their toaster than they are in providing meaningful code review. Keep this in mind about code you download, too--especially if someone claims that the code must be correct because it has had thousands of downloads. 5. If you need to use a shell as part of your program, don't use the C shell. Many versions have known flaws that can be exploited, and nearly every version performs an implicit eval $TERM on startup, enabling all sorts of attacks. We recommend the use of ksh (used for some of the shell scripts in this book). It is well-designed, fast, powerful, and well-documented (see Appendix C). Alternatively, you could write your scripts in Perl, which has good security for many system-related tasks. Remember: many security bugs are actually programming bugs, which is good news for programmers. When you make your program more secure, you simultaneously make it more reliable. Be sure to check back to this space next week for tips on writing network programs. Footnotes [9] "It's not a bug, it's a feature!" [10] For some reason, people writing new software for Unix (and especially Linux) have forgotten this basic principle of Unix. [11] Donald Knuth said: "Premature optimization is the root of all evil." Although "all evil" may be a bit extreme, it does seem to be at the root of a great number of programming errors. [12] Note that on some systems, if the pathname in the open( ) call refers to a symbolic link that names a file that does not exist, the call may not behave as you expect. This scenario should be tested on your system so you know what to expect. [13] Not all of these are available under every version of Unix. [14] We use /tmp/root with the understanding that you have a directory /tmp/root automatically created by your startup scripts, and that this directory has a mode of Your /tmp directory should have mode 1777, which prevents ordinary users from deleting the /tmp/root directory. Related Reading Practical Unix & Internet Security, 3rd Edition By Simson Garfinkel,

11 Page 11 of 11 Gene Spafford, Alan Schwartz Table of Contents Index Sample Chapter Read Online--Safari Search this book on Safari: Only This Book gfedc Code Fragments only Return to ONLamp.com. Copyright 2004 O'Reilly Media, Inc.

Secure Software Programming and Vulnerability Analysis

Secure Software Programming and Vulnerability Analysis Secure Software Programming and Vulnerability Analysis Christopher Kruegel chris@auto.tuwien.ac.at http://www.auto.tuwien.ac.at/~chris Race Conditions Secure Software Programming 2 Overview Parallel execution

More information

I m paranoid, but am I paranoid enough? Steven M. Bellovin February 20,

I m paranoid, but am I paranoid enough? Steven M. Bellovin February 20, I m paranoid, but am I paranoid enough? Steven M. Bellovin February 20, 2007 1 Special Techniques for Secure Programs Buffer overflows are bad in any case Some problems are only a risk for secure programs

More information

Software and Web Security 1. Root Cause Analysis. Abstractions Assumptions Trust. sws1 1

Software and Web Security 1. Root Cause Analysis. Abstractions Assumptions Trust. sws1 1 Software and Web Security 1 Reflections on using C(++) Root Cause Analysis Abstractions Assumptions Trust sws1 1 There are only two kinds of programming languages: the ones people complain about and the

More information

I m paranoid, but am I paranoid enough? Steven M. Bellovin October 2,

I m paranoid, but am I paranoid enough? Steven M. Bellovin October 2, I m paranoid, but am I paranoid enough? Steven M. Bellovin October 2, 2008 1 Special Techniques for Secure Programs Buffer overflows are bad in any case Some problems are only a risk for secure programs

More information

Secure Programming II. Steven M. Bellovin September 29,

Secure Programming II. Steven M. Bellovin September 29, Secure Programming II Steven M. Bellovin September 29, 2014 1 I m paranoid, but am I paranoid enough? Steven M. Bellovin September 29, 2014 2 Special Techniques for Secure Programs Buffer overflows are

More information

CHAPTER 2. Troubleshooting CGI Scripts

CHAPTER 2. Troubleshooting CGI Scripts CHAPTER 2 Troubleshooting CGI Scripts OVERVIEW Web servers and their CGI environment can be set up in a variety of ways. Chapter 1 covered the basics of the installation and configuration of scripts. However,

More information

ECS 153 Discussion Section. April 6, 2015

ECS 153 Discussion Section. April 6, 2015 ECS 153 Discussion Section April 6, 2015 1 What We ll Cover Goal: To discuss buffer overflows in detail Stack- based buffer overflows Smashing the stack : execution from the stack ARC (or return- to- libc)

More information

SysSec. Aurélien Francillon

SysSec. Aurélien Francillon SysSec Aurélien Francillon francill@eurecom.fr https://www.krackattacks.com/ https://arstechnica.com/information-technology/2017/10/crypto-failure-cripples-millions-ofhigh-security-keys-750k-estonian-ids/

More information

Secure Programming I. Steven M. Bellovin September 28,

Secure Programming I. Steven M. Bellovin September 28, Secure Programming I Steven M. Bellovin September 28, 2014 1 If our software is buggy, what does that say about its security? Robert H. Morris Steven M. Bellovin September 28, 2014 2 The Heart of the Problem

More information

Programmer s Points to Remember:

Programmer s Points to Remember: Programmer s Points to Remember: Always do bounds checking on arrays. Always do bounds checking on pointer arithmetic. Before you copy to, format, or send input to a buffer make sure it is big enough to

More information

Program Structure I. Steven M. Bellovin November 14,

Program Structure I. Steven M. Bellovin November 14, Program Structure I Steven M. Bellovin November 14, 2010 1 Program Structure We ve seen that program bugs are a major contributor to security problems We can t build bug-free software Can we build bug-resistant

More information

(Refer Slide Time: 1:26)

(Refer Slide Time: 1:26) Information Security-3 Prof. V Kamakoti Department of Computer science and Engineering Indian Institute of Technology Madras Basics of Unix and Network Administration Operating Systems Introduction Mod01,

More information

Writing Safe Setuid Programs. Theme

Writing Safe Setuid Programs. Theme Writing Safe Setuid Programs Department of Computer Science Davis, CA 95616-8562 phone (916) 752-8060 email bishop@cs.ucdavis.edu Slide # 1 Theme Using standard robust programming techniques can greatly

More information

CYSE 411/AIT681 Secure Software Engineering Topic #12. Secure Coding: Formatted Output

CYSE 411/AIT681 Secure Software Engineering Topic #12. Secure Coding: Formatted Output CYSE 411/AIT681 Secure Software Engineering Topic #12. Secure Coding: Formatted Output Instructor: Dr. Kun Sun 1 This lecture: [Seacord]: Chapter 6 Readings 2 Secure Coding String management Pointer Subterfuge

More information

2/9/18. CYSE 411/AIT681 Secure Software Engineering. Readings. Secure Coding. This lecture: String management Pointer Subterfuge

2/9/18. CYSE 411/AIT681 Secure Software Engineering. Readings. Secure Coding. This lecture: String management Pointer Subterfuge CYSE 411/AIT681 Secure Software Engineering Topic #12. Secure Coding: Formatted Output Instructor: Dr. Kun Sun 1 This lecture: [Seacord]: Chapter 6 Readings 2 String management Pointer Subterfuge Secure

More information

Program Structure. Steven M. Bellovin April 3,

Program Structure. Steven M. Bellovin April 3, Program Structure We ve seen that program bugs are a major contributor to security problems We can t build bug-free software Can we build bug-resistant software? Let s look at a few examples, good and

More information

Program Structure I. Steven M. Bellovin November 8,

Program Structure I. Steven M. Bellovin November 8, Program Structure I Steven M. Bellovin November 8, 2016 1 Program Structure We ve seen that program bugs are a major contributor to security problems We can t build bug-free software Can we build bug-resistant

More information

Security Architecture

Security Architecture Security Architecture We ve been looking at how particular applications are secured We need to secure not just a few particular applications, but many applications, running on separate machines We need

More information

Outline. Classic races: files in /tmp. Race conditions. TOCTTOU example. TOCTTOU gaps. Vulnerabilities in OS interaction

Outline. Classic races: files in /tmp. Race conditions. TOCTTOU example. TOCTTOU gaps. Vulnerabilities in OS interaction Outline CSci 5271 Introduction to Computer Security Day 3: Low-level vulnerabilities Stephen McCamant University of Minnesota, Computer Science & Engineering Race conditions Classic races: files in /tmp

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #47. File Handling

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #47. File Handling Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #47 File Handling In this video, we will look at a few basic things about file handling in C. This is a vast

More information

File System Basics. Farmer & Venema. Mississippi State University Digital Forensics 1

File System Basics. Farmer & Venema. Mississippi State University Digital Forensics 1 File System Basics Farmer & Venema 1 Alphabet Soup of File Systems More file systems than operating systems Microsoft has had several: FAT16, FAT32, HPFS, NTFS, NTFS2 UNIX certainly has its share, in typical

More information

CNIT 127: Exploit Development. Ch 18: Source Code Auditing. Updated

CNIT 127: Exploit Development. Ch 18: Source Code Auditing. Updated CNIT 127: Exploit Development Ch 18: Source Code Auditing Updated 4-10-17 Why Audit Source Code? Best way to discover vulnerabilities Can be done with just source code and grep Specialized tools make it

More information

Reflections on using C(++) Root Cause Analysis

Reflections on using C(++) Root Cause Analysis Hacking in C Reflections on using C(++) Root Cause Analysis Abstractions Complexity Assumptions Trust hic 1 There are only two kinds of programming languages: the ones people complain about and the ones

More information

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration Who am I? I m a python developer who has been working on OpenStack since 2011. I currently work for Aptira, who do OpenStack, SDN, and orchestration consulting. I m here today to help you learn from my

More information

Software Security Buffer Overflows more countermeasures. Erik Poll. Digital Security Radboud University Nijmegen

Software Security Buffer Overflows more countermeasures. Erik Poll. Digital Security Radboud University Nijmegen Software Security Buffer Overflows more countermeasures Erik Poll Digital Security Radboud University Nijmegen Recap last week Recurring security problems in C(++) code buffer overflows bugs with pointers

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files ... and systems programming C basic syntax functions arrays structs

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs. CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files... and systems programming C basic syntax functions arrays structs

More information

CS140 Operating Systems Final December 12, 2007 OPEN BOOK, OPEN NOTES

CS140 Operating Systems Final December 12, 2007 OPEN BOOK, OPEN NOTES CS140 Operating Systems Final December 12, 2007 OPEN BOOK, OPEN NOTES Your name: SUNet ID: In accordance with both the letter and the spirit of the Stanford Honor Code, I did not cheat on this exam. Furthermore,

More information

Advanced Systems Security: Ordinary Operating Systems

Advanced Systems Security: Ordinary Operating Systems Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

Advanced System Security: Vulnerabilities

Advanced System Security: Vulnerabilities Advanced System Security: Vulnerabilities Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department Pennsylvania State University CSE544 -Advanced

More information

It was a dark and stormy night. Seriously. There was a rain storm in Wisconsin, and the line noise dialing into the Unix machines was bad enough to

It was a dark and stormy night. Seriously. There was a rain storm in Wisconsin, and the line noise dialing into the Unix machines was bad enough to 1 2 It was a dark and stormy night. Seriously. There was a rain storm in Wisconsin, and the line noise dialing into the Unix machines was bad enough to keep putting garbage characters into the command

More information

How to Break Software by James Whittaker

How to Break Software by James Whittaker How to Break Software by James Whittaker CS 470 Practical Guide to Testing Consider the system as a whole and their interactions File System, Operating System API Application Under Test UI Human invokes

More information

CSC209 Review. Yeah! We made it!

CSC209 Review. Yeah! We made it! CSC209 Review Yeah! We made it! 1 CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files 2 ... and C programming... C basic syntax functions

More information

PROCESS CONTROL: PROCESS CREATION: UNIT-VI PROCESS CONTROL III-II R

PROCESS CONTROL: PROCESS CREATION: UNIT-VI PROCESS CONTROL III-II R PROCESS CONTROL: This will describe the use and implementation of the system calls that control the process context. The fork system call creates a new process, the exit call terminates process execution,

More information

Play with FILE Structure Yet Another Binary Exploitation Technique. Abstract

Play with FILE Structure Yet Another Binary Exploitation Technique. Abstract Play with FILE Structure Yet Another Binary Exploitation Technique An-Jie Yang (Angelboy) angelboy@chroot.org Abstract To fight against prevalent cyber threat, more mechanisms to protect operating systems

More information

Agenda. Security and Standard C Libraries. Martyn Lovell Visual C++ Libraries Microsoft Corporation

Agenda. Security and Standard C Libraries. Martyn Lovell Visual C++ Libraries Microsoft Corporation Security and Standard C Libraries Visual C++ Libraries Microsoft Corporation 2003.04.17 1 Agenda Current Situation Security Problems Library impact Proposed Changes Related C++ issues Summary Q&A 2003.04.17

More information

Inline Reference Monitoring Techniques

Inline Reference Monitoring Techniques Inline Reference Monitoring Techniques In the last lecture, we started talking about Inline Reference Monitors. The idea is that the policy enforcement code runs with the same address space as the code

More information

Symlink attacks. Do not assume that symlinks are trustworthy: Example 1

Symlink attacks. Do not assume that symlinks are trustworthy: Example 1 Symlink attacks Do not assume that symlinks are trustworthy: Example 1 Application A creates a file for writing in /tmp. It assumes that since the file name is unusual, or because it encodes A's name or

More information

(In columns, of course.)

(In columns, of course.) CPS 310 first midterm exam, 10/9/2013 Your name please: Part 1. Fun with forks (a) What is the output generated by this program? In fact the output is not uniquely defined, i.e., it is not always the same.

More information

Linux shell scripting Getting started *

Linux shell scripting Getting started * Linux shell scripting Getting started * David Morgan *based on chapter by the same name in Classic Shell Scripting by Robbins and Beebe What s s a script? text file containing commands executed as a unit

More information

Software Security Buffer Overflows more countermeasures. Erik Poll. Digital Security Radboud University Nijmegen

Software Security Buffer Overflows more countermeasures. Erik Poll. Digital Security Radboud University Nijmegen Software Security Buffer Overflows more countermeasures Erik Poll Digital Security Radboud University Nijmegen Recap last week Recurring security problems in C(++) code memory corruption, due to buffer

More information

Securing Unix Filesystems - When Good Permissions Go Bad

Securing Unix Filesystems - When Good Permissions Go Bad Securing Unix Filesystems - When Good Permissions Go Bad Introduction Unix has a very elegant and flexible permission system at the heart of its filesystem security. These permissions allow and/or disallow

More information

Paranoid Penguin rsync, Part I

Paranoid Penguin rsync, Part I Paranoid Penguin rsync, Part I rsync makes efficient use of the network by only transferring the parts of files that are different from one host to the next. Here's how to use it securely. by Mick Bauer

More information

C and C++ Secure Coding 4-day course. Syllabus

C and C++ Secure Coding 4-day course. Syllabus C and C++ Secure Coding 4-day course Syllabus C and C++ Secure Coding 4-Day Course Course description Secure Programming is the last line of defense against attacks targeted toward our systems. This course

More information

CS 167 Final Exam Solutions

CS 167 Final Exam Solutions CS 167 Final Exam Solutions Spring 2016 Do all questions. 1. The implementation given of thread_switch in class is as follows: void thread_switch() { thread_t NextThread, OldCurrent; } NextThread = dequeue(runqueue);

More information

Recitation: C Review. TA s 20 Feb 2017

Recitation: C Review. TA s 20 Feb 2017 15-213 Recitation: C Review TA s 20 Feb 2017 Agenda Logistics Attack Lab Conclusion C Assessment C Programming Style C Exercise Cache Lab Overview Appendix: Valgrind Clang / LLVM Cache Structure Logistics

More information

CSE543 - Introduction to Computer and Network Security

CSE543 - Introduction to Computer and Network Security CSE543 - Introduction to Computer and Network Security Module: Software Vulnerabilities Professor Trent Jaeger 1 Programming Why do we write programs? Function What functions do we enable via our programs?

More information

11/3/71 SYS BREAK (II)

11/3/71 SYS BREAK (II) 11/3/71 SYS BREAK (II) break -- set program break SYNOPSIS sys break; addr / break = 17. break sets the system s idea of the highest location used by the program to addr. Locations greater than addr and

More information

OS security mechanisms:

OS security mechanisms: OS security mechanisms: Memory Protection: One of the important aspects of Operating system security is Memory Protection. Memory provides powerful indirect way for an attacker to circumvent security mechanism,

More information

Logical disks. Bach 2.2.1

Logical disks. Bach 2.2.1 Logical disks Bach 2.2.1 Physical disk is divided into partitions or logical disks Logical disk linear sequence of fixed size, randomly accessible, blocks disk device driver maps underlying physical storage

More information

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring 2009 Topic Notes: C and Unix Overview This course is about computer organization, but since most of our programming is

More information

Sandboxing. (1) Motivation. (2) Sandboxing Approaches. (3) Chroot

Sandboxing. (1) Motivation. (2) Sandboxing Approaches. (3) Chroot Sandboxing (1) Motivation Depending on operating system to do access control is not enough. For example: download software, virus or Trojan horse, how to run it safely? Risks: Unauthorized access to files,

More information

Homework 3 CS161 Computer Security, Fall 2008 Assigned 10/07/08 Due 10/13/08

Homework 3 CS161 Computer Security, Fall 2008 Assigned 10/07/08 Due 10/13/08 Homework 3 CS161 Computer Security, Fall 2008 Assigned 10/07/08 Due 10/13/08 For your solutions you should submit a hard copy; either hand written pages stapled together or a print out of a typeset document

More information

CS 241 Honors Memory

CS 241 Honors Memory CS 241 Honors Memory Ben Kurtovic Atul Sandur Bhuvan Venkatesh Brian Zhou Kevin Hong University of Illinois Urbana Champaign February 20, 2018 CS 241 Course Staff (UIUC) Memory February 20, 2018 1 / 35

More information

Files (review) and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

Files (review) and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1 Files (review) and Regular Expressions Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 midterms (Feb 11 and April 1) Files and Permissions Regular Expressions 2 Sobel, Chapter 6 160_pathnames.html

More information

CptS 360 (System Programming) Unit 6: Files and Directories

CptS 360 (System Programming) Unit 6: Files and Directories CptS 360 (System Programming) Bob Lewis School of Engineering and Applied Sciences Washington State University Spring, 2019 Motivation Need to know your way around a filesystem. A properly organized filesystem

More information

Confinement (Running Untrusted Programs)

Confinement (Running Untrusted Programs) Confinement (Running Untrusted Programs) Chester Rebeiro Indian Institute of Technology Madras Untrusted Programs Untrusted Application Entire Application untrusted Part of application untrusted Modules

More information

* What are the different states for a task in an OS?

* What are the different states for a task in an OS? * Kernel, Services, Libraries, Application: define the 4 terms, and their roles. The kernel is a computer program that manages input/output requests from software, and translates them into data processing

More information

CS 161 Computer Security. Security Throughout the Software Development Process

CS 161 Computer Security. Security Throughout the Software Development Process Popa & Wagner Spring 2016 CS 161 Computer Security 1/25 Security Throughout the Software Development Process Generally speaking, we should think of security is an ongoing process. For best results, it

More information

Shellbased Wargaming

Shellbased Wargaming Shellbased Wargaming Abstract Wargaming is a hands-on way to learn about computer security and common programming mistakes. This document is intended for readers new to the subject and who are interested

More information

Buffer overflow background

Buffer overflow background and heap buffer background Comp Sci 3600 Security Heap Outline and heap buffer Heap 1 and heap 2 3 buffer 4 5 Heap Outline and heap buffer Heap 1 and heap 2 3 buffer 4 5 Heap Address Space and heap buffer

More information

Boot Camp. Dave Eckhardt Bruce Maggs

Boot Camp. Dave Eckhardt Bruce Maggs Boot Camp Dave Eckhardt de0u@andrew.cmu.edu Bruce Maggs bmm@cs.cmu.edu 1 This Is a Hard Class Traditional hazards 410 letter grade one lower than other classes All other classes this semester: one grade

More information

Design Overview of the FreeBSD Kernel CIS 657

Design Overview of the FreeBSD Kernel CIS 657 Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler (2%

More information

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent? Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler

More information

Chp1 Introduction. Introduction. Objective. Logging In. Shell. Briefly describe services provided by various versions of the UNIX operating system.

Chp1 Introduction. Introduction. Objective. Logging In. Shell. Briefly describe services provided by various versions of the UNIX operating system. Chp1 Objective Briefly describe services provided by various versions of the UNIX operating system. Logging In /etc/passwd local machine or NIS DB root:x:0:1:super-user:/root:/bin/tcsh Login-name, encrypted

More information

Analyzing Systems. Steven M. Bellovin November 26,

Analyzing Systems. Steven M. Bellovin November 26, Analyzing Systems When presented with a system, how do you know it s secure? Often, you re called upon to analyze a system you didn t design application architects and programmers build it; security people

More information

CSE 565 Computer Security Fall 2018

CSE 565 Computer Security Fall 2018 CSE 565 Computer Security Fall 2018 Lecture 16: Building Secure Software Department of Computer Science and Engineering University at Buffalo 1 Review A large number of software vulnerabilities various

More information

COP4342 UNIX Tools Assignment #3: A Simple Unix Shell. Instructor: Dr. Robert Van Engelen Teaching Assistant: Imran Chowdhury Spring 2018

COP4342 UNIX Tools Assignment #3: A Simple Unix Shell. Instructor: Dr. Robert Van Engelen Teaching Assistant: Imran Chowdhury Spring 2018 Total Points: 100 COP4342 UNIX Tools Assignment #3: A Simple Unix Shell Instructor: Dr. Robert Van Engelen Teaching Assistant: Imran Chowdhury Spring 2018 Description: The bash shell utility on UNIX and

More information

Possible Defects in TR Randy Meyers N1261

Possible Defects in TR Randy Meyers N1261 1. Possible Defects in TR 24731-1 Since the last meeting, I have received email pointing out possible defects in the Boundschecking TR. This paper summarizes those issues. 2. Typos 2.1 scanf family 6.5.3.*,

More information

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc. Appendix A GLOSSARY SYS-ED/ Computer Education Techniques, Inc. $# Number of arguments passed to a script. $@ Holds the arguments; unlike $* it has the capability for separating the arguments. $* Holds

More information

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall 2008.

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall 2008. Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Fall 2008 Quiz II Solutions 1 I File System Consistency Ben is writing software that stores data in

More information

Keys and Passwords. Steven M. Bellovin October 17,

Keys and Passwords. Steven M. Bellovin October 17, Keys and Passwords Steven M. Bellovin October 17, 2010 1 Handling Long-Term Keys Where do cryptographic keys come from? How should they be handled? What are the risks? As always, there are tradeoffs Steven

More information

STING: Finding Name Resolution Vulnerabilities in Programs

STING: Finding Name Resolution Vulnerabilities in Programs STING: Finding Name Resolution ulnerabilities in Programs Hayawardh ijayakumar, Joshua Schiffman, Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department

More information

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017 ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 The Operating System (OS) Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke)

More information

B a s h s c r i p t i n g

B a s h s c r i p t i n g 8 Bash Scripting Any self-respecting hacker must be able to write scripts. For that matter, any selfrespecting Linux administrator must be able to script. Hackers often need to automate commands, sometimes

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST - 2 Date : 20/09/2016 Max Marks : 0 Subject & Code : Unix Shell Programming (15CS36) Section : 3 rd Sem ISE/CSE Name of faculty : Prof Ajoy Time : 11:30am to 1:00pm SOLUTIONS 1

More information

CSE 565 Computer Security Fall 2018

CSE 565 Computer Security Fall 2018 CSE 565 Computer Security Fall 2018 Lecture 15: Software Security II Department of Computer Science and Engineering University at Buffalo 1 Software Vulnerabilities Buffer overflow vulnerabilities account

More information

CS2028 -UNIX INTERNALS

CS2028 -UNIX INTERNALS DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY,SIRUVACHUR-621113. CS2028 -UNIX INTERNALS PART B UNIT 1 1. Explain briefly details about History of UNIX operating system? In 1965, Bell Telephone

More information

CS61 Scribe Notes Date: Topic: Fork, Advanced Virtual Memory. Scribes: Mitchel Cole Emily Lawton Jefferson Lee Wentao Xu

CS61 Scribe Notes Date: Topic: Fork, Advanced Virtual Memory. Scribes: Mitchel Cole Emily Lawton Jefferson Lee Wentao Xu CS61 Scribe Notes Date: 11.6.14 Topic: Fork, Advanced Virtual Memory Scribes: Mitchel Cole Emily Lawton Jefferson Lee Wentao Xu Administrivia: Final likely less of a time constraint What can we do during

More information

ADVANCED OPERATING SYSTEMS

ADVANCED OPERATING SYSTEMS ADVANCED OPERATING SYSTEMS UNIT I INTRODUCTION TO UNIX/LINUX KERNEL BY MR.PRASAD SAWANT Prof.Prasad Sawant,Assitiant Professor,Dept. Of CS PCCCS PREREQUISITES: 1. Working knowledge of C programming. 2.

More information

(a) Which of these two conditions (high or low) is considered more serious? Justify your answer.

(a) Which of these two conditions (high or low) is considered more serious? Justify your answer. CS140 Winter 2006 Final Exam Solutions (1) In class we talked about the link count in the inode of the Unix file system being incorrect after a crash. The reference count can either be either too high

More information

Introduction to OS. File Management. MOS Ch. 4. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

Introduction to OS. File Management. MOS Ch. 4. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1 Introduction to OS File Management MOS Ch. 4 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 File Management Objectives Provide I/O support for a variety of storage device

More information

Processes are subjects.

Processes are subjects. Identification and Authentication Access Control Other security related things: Devices, mounting filesystems Search path TCP wrappers Race conditions NOTE: filenames may differ between OS/distributions

More information

Outline. Security as an economic good. Risk budgeting with ALE. Failure: Risk compensation. Failure: Displacement activity

Outline. Security as an economic good. Risk budgeting with ALE. Failure: Risk compensation. Failure: Displacement activity CSci 5271 Introduction to Computer Security Day 2: Intro to Software and OS Security Stephen McCamant University of Minnesota, Computer Science & Engineering Security as an economic good Security is a

More information

By default, optional warnings are disabled, so any legacy code that doesn't attempt to control the warnings will work unchanged.

By default, optional warnings are disabled, so any legacy code that doesn't attempt to control the warnings will work unchanged. SYNOPSIS use warnings; no warnings; use warnings "all"; no warnings "all"; use warnings::register; if (warnings::enabled()) warnings::warn("some warning"); if (warnings::enabled("void")) warnings::warn("void",

More information

CS61 Scribe Notes Lecture 18 11/6/14 Fork, Advanced Virtual Memory

CS61 Scribe Notes Lecture 18 11/6/14 Fork, Advanced Virtual Memory CS61 Scribe Notes Lecture 18 11/6/14 Fork, Advanced Virtual Memory Roger, Ali, and Tochi Topics: exploits fork shell programming rest of course announcements/ending (for later info) final (not as time

More information

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical

More information

Other array problems. Integer overflow. Outline. Integer overflow example. Signed and unsigned

Other array problems. Integer overflow. Outline. Integer overflow example. Signed and unsigned Other array problems CSci 5271 Introduction to Computer Security Day 4: Low-level attacks Stephen McCamant University of Minnesota, Computer Science & Engineering Missing/wrong bounds check One unsigned

More information

War Industries Presents: An Introduction to Programming for Hackers Part III - Advanced Variables & Flow Control.

War Industries Presents: An Introduction to Programming for Hackers Part III - Advanced Variables & Flow Control. War Industries Presents: An Introduction to Programming for Hackers Part III - Advanced Variables & Flow Control By Lovepump, 2004 Visit: www.warindustries.com Part II Programs 101 Goals: At the end of

More information

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so!

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other electronic devices

More information

Topics in Software Security Vulnerability

Topics in Software Security Vulnerability Topics in Software Security Vulnerability Software vulnerability What are software vulnerabilities? Types of vulnerabilities E.g., Buffer Overflows How to find these vulnerabilities and prevent them? Classes

More information

4 Files. 4.1 Directories B16 SOFTWARE ENGINEERING: OPERATING SYSTEMS 31

4 Files. 4.1 Directories B16 SOFTWARE ENGINEERING: OPERATING SYSTEMS 31 B16 SOFTWARE ENGINEERING: OPERATING SYSTEMS 31 4 Files Persistent file stores allow for more data than will fit into the address space of a process; for data to survive the termination of the process;

More information

mywbut.com UNIX Operating System

mywbut.com UNIX Operating System UNIX Operating System 1 Lecture Notes Overview Unlike many operating systems, UNIX is not limited to specific computers using a particular microprocessor as a CPU. Instead, UNIX systems run on all sizes

More information

CS 326: Operating Systems. Process Execution. Lecture 5

CS 326: Operating Systems. Process Execution. Lecture 5 CS 326: Operating Systems Process Execution Lecture 5 Today s Schedule Process Creation Threads Limited Direct Execution Basic Scheduling 2/5/18 CS 326: Operating Systems 2 Today s Schedule Process Creation

More information

Here's how you declare a function that returns a pointer to a character:

Here's how you declare a function that returns a pointer to a character: 23 of 40 3/28/2013 10:35 PM Violets are blue Roses are red C has been around, But it is new to you! ANALYSIS: Lines 32 and 33 in main() prompt the user for the desired sort order. The value entered is

More information

Basic File Attributes

Basic File Attributes Basic File Attributes The UNIX file system allows the user to access other files not belonging to them and without infringing on security. A file has a number of attributes (properties) that are stored

More information

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand File Systems Basics Nima Honarmand File and inode File: user-level abstraction of storage (and other) devices Sequence of bytes inode: internal OS data structure representing a file inode stands for index

More information

Reliable programming

Reliable programming Reliable programming How to write programs that work Think about reliability during design and implementation Test systematically When things break, fix them correctly Make sure everything stays fixed

More information

Week - 01 Lecture - 04 Downloading and installing Python

Week - 01 Lecture - 04 Downloading and installing Python Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and

More information

CS 385 Operating Systems Fall 2011 Homework Assignment 5 Process Synchronization and Communications

CS 385 Operating Systems Fall 2011 Homework Assignment 5 Process Synchronization and Communications CS 385 Operating Systems Fall 2011 Homework Assignment 5 Process Synchronization and Communications Due: Friday December 2 at 8:00 P.M. via Blackboard Overall Assignment Man Pages For this assignment,

More information