Design and Implementation of the Log-based File I/O Library for Sandboxing CSE 542 Operating Systems Fall 2005 Qi Liao and Xuwen Yu.

Slides:



Advertisements
Similar presentations
More on File Management
Advertisements

File and I/O system calls int open(const char* path, int flags, mode_t modes) int creat(const char *path, mode_t mode) ssize_t read(int fd, void *buf,
Ext2/Ext3 Linux File System Reporter: Po-Liang, Wu.
File Management Chapter 12. File Management A file is a named entity used to save results from a program or provide data to a program. Access control.
Chapter 11: File System Implementation
File System Implementation
File System Implementation
Files. System Calls for File System Accessing files –Open, read, write, lseek, close Creating files –Create, mknod.
Chapter 12: File System Implementation
CS 311 – Lecture 10 Outline Review open() and close() Difference between fopen() and open() File management system calls – read() – write() – lseek() –
METU Department of Computer Eng Ceng 302 Introduction to DBMS Disk Storage, Basic File Structures, and Hashing by Pinar Senkul resources: mostly froom.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Part B Part A:  Index Definition in SQL  Ordered Indices  Index Sequential.
1.1 CAS CS 460/660 Introduction to Database Systems File Organization Slides from UC Berkeley.
File System Implementation
1 Course Outline Processes & Threads CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Networks, Protection and Security.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
1 Project: File System Textbook: pages Lubomir Bic.
POSIX: Files Introduction to Operating Systems: Discussion 1 Read Solaris System Interface Guide: Ch. 5.1 Basic File I/O.
SIMULATED UNIX FILE SYSTEM Implementation in C Tarek Youssef Bipanjit Sihra.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
File Systems Long-term Information Storage Store large amounts of information Information must survive the termination of the process using it Multiple.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
File System Review bottomupcs.com J. Kubiatowicz, UC Berkeley.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
CS252: Systems Programming Ninghui Li Based on Slides by Prof. Gustavo Rodriguez-Rivera Topic 8: Opening Files and Starting Processes.
1 File Systems: Consistency Issues. 2 File Systems: Consistency Issues File systems maintains many data structures  Free list/bit vector  Directories.
1 Comp 104: Operating Systems Concepts Files and Filestore Allocation.
Page 111/15/2015 CSE 30341: Operating Systems Principles Chapter 11: File System Implementation  Overview  Allocation methods: Contiguous, Linked, Indexed,
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
File System Implementation
Module 4.0: File Systems File is a contiguous logical address space.
Files & File system. A Possible File System Layout Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
12.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 12: File System Implementation Chapter 12: File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File System Implementation Chapter.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo1 Files and file allocation.
Linux File system Implementations
File Systems cs550 Operating Systems David Monismith.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Tarek Abdelzaher Vikram Adve CS241 Systems Programming System Calls and I/O.
File I/O open close lseek read and write – unbuffered I/O dup and dup2.
File Systems - Part I CS Introduction to Operating Systems.
Race conditions and synchronization issues Exploiting UNIX.
1 Data Structures CSCI 132, Spring 2014 Lecture 33 Hash Tables.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez-Martínez Electrical and Computer Engineering Department Lecture 7 – Buffer Management.
File Systems.  Issues for OS  Organize files  Directories structure  File types based on different accesses  Sequential, indexed sequential, indexed.
Chapter 5 Record Storage and Primary File Organizations
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
Files. FILE * u In C, we use a FILE * data type to access files. u FILE * is defined in /usr/include/stdio.h u An example: #include int main() { FILE.
File table: a list of opened files Each entry contains: – Index: file descriptors – Pointer to the file in memory – Access mode File descriptor is a positive.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
File-System Management
Chapter 12: File System Implementation
Today topics: File System Implementation
Chapter 11: File System Implementation
File System Implementation
Chapter 11: File System Implementation
Chapter 12: File System Implementation
Chapter 11: File System Implementation
Unix Directories unix etc home pro dev motd snt unix ... slide1 slide2
Chapter 11: File System Implementation
Introduction to Database Systems
Outline Allocation Free space management Memory mapped files
Chapter 11: File System Implementation
Overview: File system implementation (cont)
File-System Structure
FILE I/O File Descriptors I/O Efficiency File Sharing
Chapter 11: File System Implementation
Unix Directories unix etc home pro dev motd snt unix ... slide1 slide2
Presentation transcript:

Design and Implementation of the Log-based File I/O Library for Sandboxing CSE 542 Operating Systems Fall 2005 Qi Liao and Xuwen Yu

Introduction What is sandboxing? Create confined execution environment Confine the activities of untrusted program in a limited domain Related Work: The sandboxing tech. often prevent unwanted access by simply denying actions that are not permitted. …… However, sometimes it is not clear if an action is desirable without looking at all of a program's actions together. So, how to keep the system secure and at the same time not influence the sandboxed process?

What we need to do? At the first step,we design a file I/O library to redirect the file I/O operations to the log file. It is secure and will not influence the sandboxed process Log file can also be examined to see the overall effect of a program. Log file can be committed and replayed If acceptable: the log can be played to modify the file system the log even can be played on another host to modify its file system. ( as patches generation) Next step is to apply the log-based file I/O library to a sandbox such as Parrot for further testing and improvement.

System Design  Design  Strictly sequential operations;  One operation followed by data if data writing is involved.  Data structure  Main log table design  Auxiliary table design  Procedures  I/O requirement  Record the operation  Check the table and record the return value;(success or fail)  Modify the table; record the data; Open file1 * Open file2 * Write file1 ( fd1, buff, length) ** Modification data of file1 Write file2 ( fd1, buff, length) ** Modification data of file2 Entry filena me fdfd in_log _bit Live/dead bit status_bitcur_offset

Main Lookup Table Entry 0 — in FS 0 — dead 0 — close 0 — beginning of file 1 — in Log 1 — live 1 — open for read file.size() — append flag 2 — open for write others 3 — open for r/w Hash table (hash filename  int % big prime) External linked list for collision handling File nameFdIn_log_bitLive/dead bit Status bitCur_offsetCacheable bit Pointer to read cache

Log Operations: Open, Close  Open:int pfs_log_open(string filename,int flags,mode_t mode);  Close:void pfs_log_close(int fd);  set the open status bit of the file’s entry to be 0.  If open a new file and no live entry in table: add the entry; else return error;  If open an existing file : if in log: already opened or deleted: return -1, otherwise :modify open status bits in entry; if not in log: check real file system: if the file exists,add an entry to table, otherwise return -1

Log Operations: Read, Write, Lseek, Remove  Read:void pfs_log_read(int fd,char * buf, unsigned int length);  Write:void pfs_log_write(int fd, const void * buf, unsigned int length);  Check if the file is created in log or in the real file system - if in real system, need to read original file;  Scan through the log and read all the modification data  Read relative data to the buffer  Update the length field in the entry.  Append actual written data to the log.  Lseek: void pfs_log_lseek(int fd, off_t offset, int whence);  Remove: int pfs_log_remove(const char * filename);

Log Operations: Write and Read Table Write and Read Log Table void pfs_log_write_table(); void pfs_log_read_table(); Write and read table entries between memory and disk.

Log Operations: Replay Log Replay void pfs_log_play(); Parse Table for Read Operation and Log Play Operation

Experimental Results and Optimization of Prototype 1.Auxiliary Table Problem: most of the search operations in the write and read calls require search based on the file descriptor while the key of the main table is the filename. Solution: maintain another auxiliary table which is indexed by the file descriptor. Performance Comparison of Write Operations between With and Without Auxiliary Table as Table Size Increases. (concurrently opened 50 files and randomly write 1000 times)

Experimental Results and Optimization of Prototype 2.Cached File for Read Operation Problem: Read Operation is the bottleneck. Must be efficient enough to make logging practical. Observation: Most files are not modified from previous read. No need to scan the whole log over and over. Solution: Cache the file in memory and set cache flag in table. Any write void cache. Comparison between cached and no-cached reading of 1 byte for 1000 times after a random lseek operation.

Experimental Results: Open, Close, Write, Read, Lseek Open (create new files) and Close Operation Time in Unix and Log Comparison of Read and Write Operations between Unix Standalone File System and Logging Process (Unit: Milliseconds)

Conclusion Log-based file I/O library can be used in existing sandboxes to record and handle the interposed I/O system calls. Table structures and careful design of log operations are necessary to provide a consistent view of system state to sandboxed processes. Performance can be dramatically improved by optimizing data structures and caching policies. Logging is feasible and desirable in sandboxing.

Future Work Efficiency Improvement read, write, log play Connect to Parrot Support more functions More system calls, directories, etc. Grid Computing Remote I/O operations