Carnegie Mellon Virtual Memory of a Linux Process Process-specific data structs (ptables, Different for

Size: px
Start display at page:

Download "Carnegie Mellon Virtual Memory of a Linux Process Process-specific data structs (ptables, Different for"

Transcription

1 Outline CS 6V81-05: System Security and Malicious Code Analysis Understanding the Implementation of Virtual Memory 1 Zhiqiang Lin Department of Computer Science University of Texas at Dallas February 29 th, Implementation 3 Outline Virtual Memory of a Linux Virtual Memory of a Linux 1 2 Implementation Different for each process Identical for each process %esp -specific data structs (ptables, task and mm structs, kernel stack) Physical Kernel code and data User stack Kernel 3 brk Memory mapped region for shared libraries Runtime heap (malloc) 0x (32) 0x (64) 0 Uninitialized data (.bss) Initialized data (.data) Program text (.text) 37

2 ber of nice things. With, programs running on the system can allocate far more than is physically available; indeed, even a single process can have a address space larger than the system s physical. Virtual also allows playing a number of tricks with the process s address space, including mapping in device. Thus far, we have talked about and physical addresses, but a number of the details have been glossed over. The Linux system deals with several types of addresses, each with its own semantics. Unfortunately, the kernel code is not always very clear on exactly which type of address is being used in each situation, so the programmer must be careful. Address type in Linux user process high low kernel addresses Linux Organizes VM as Collection of Areas Linux Organizes VM as Collection of Areas vm_area_struct task_struct mm_struct mm pgd mmap Shared libraries Key user process physical address space page mapping Figur e Address types used in Linux kernel logical addresses The following is a list of address types used in Linux. Figure 13-1 shows how these address types relate to physical. User addresses These are the regular addresses seen by user-space programs. User addresses are either 32 or 64 bits in length, depending on the underlying hardware architecture, and each process has its own address space. i386+pae pgd: Page global directory address Points to L1 page table : Read/write permissions for this area Pages shared with other processes or private to this process x86_64 Data Text sources: sources:

3 Powerpc-4k Powerpc-64k sources: Simplifying Linking and Loading sources: Demand paging Linux Page Fault Handling vm_area_struct shared libraries data 1 read 3 read Segmentation fault: accessing a non-existing page Segmentation fault: accessing a non-existing page Normal page fault Normal page fault Key point: no pages are copied into physical until they are referenced! Known as demand paging Crucial for time and space efficiency text 2 write Protection exception: e.g., violating permission by writing to a read-only page (Linux reports as Segmentation fault) Protection exception: e.g., violating permission by writing to a read-only page 39 (Linux reports as Segmentation fault)

4 Implementation Implementation Shared Objects Copy-on-write Sharing Revisited: Shared ObjectsSharing Revisited: Shared Objects (COW) Objects Sharing Revisited: Sharing Revisited: Two processes Copy-on-write (COW) Objects Copy-on-write (COW 1 Physical 2 Physical maps the shared object Physical 1 maps the shared object. Notice how the addresses can be different. mapping a private copy-on-write (COW) object.1 Physical Two processes Area flagged as mapping a private private copy-on-write 22 maps the shared object. Notice how the copy-on-write addresses can area be different. Shared object Shared object copy-on-write object 43 Implementation Demand paging copy-on-write PTEs in private areas Copy-on-write (COW) object. are flagged as read-only Area flagged as private copy-oninstruction writing to private page triggers write protection fault. PTEs in private Handler creates new areas are flagged R/W page. as read-only Instruction restarts upon handler return. copy-on-write Copying deferred as object 44 long as possible! Implementation 45 The execve Function The execve Function Revisited VM and mapping explain how fork provides private address space for each process. To create address for new new process Create exact copies of current mm_struct, vm_area_struct, and page tables. Flag each page in both processes as read-only Flag each vm_area_struct in both processes as private COW User stack Shared, file-backed libc.so.data.text Memory mapped region for shared libraries On return, each process has exact copy of Subsequent writes create new pages using COW mechanism., demand-zero a.out Runtime heap (via malloc), demand-zero Uninitialized data (.bss), demand-zero Initialized data (.data).data.text Program text (.text) Programs and initialized Create vm_area_struct s data backed object files. and page tables for by new areas.bss and stack backed by Setanonymous PC to entry files. point in.text Linux will fault in code and 0 To load and run a new the current Toprogram load anda.out run ainnew processa.out using in execve: program the current process using Free vm_area_struct s and execve: page tables for old areas Free vm_area_struct s Create vm_area_struct s and and page tables for old areas page tables for new areas Programs and initialized data anonymous files. backed by object files..bss and stack backed by, file-backed 2 Set PC to entry point in.textdata pages as needed. Linux will fault in code and data pages as needed. 48 Write to pr copy-on-w page

5 User-Level Memory Mapping void *mmap(void *start, int len, int prot, int flags, int fd, int offset) User-Level Memory Mapping User-Level Memory Mapping void *mmap(void *start, int len, int prot, int flags, int fd, int offset) void *mmap(void *start, int len, int prot, int flags, int fd, int offset) Map len bytes starting at the offset of the file specified by file description fd, preferably at address start start: may be 0 for pick an address prot: PROT_READ, PROT_WRITE,... flags: MAP_ANON, MAP_PRIVATE, MAP_SHARED,... Return a pointer to start of mapped area (may not be start) len bytes offset (bytes) len bytes start (or address chosen by kernel) Outline 0 0 Disk file specified by file descriptor fd Memory Management 50 Memory management is the heart of operating systems; Each process in a multi-tasking OS runs in its address space. 1 2 Implementation 3 Credit:

6 How The Kernel Manages Memory paged out. If a region is backed by a file, its vm file field will be set. By traversing vm file f dentry d inode i mapping, the associated address space for the region may be obtained. The address space has all the filesystem specific information required to perform page-based operations on disk. The relationship between the different address space related structures is illustraed in Figure 4.2. A number of system calls are provided which affect the address Implementation space and regions. These are listed in Table 4.1. Relevant data structures in address space Credit: mm_struct Figure 4.2. Data Structures Implementation Related to the Address Space mm_struct struct mm_struct { struct mm_struct { [0] struct vm_area_struct *mmap; [120] long unsigned int total_vm; [4] struct rb_root mm_rb; [124] long unsigned int locked_vm; [8] struct vm_area_struct *mmap_cache; [128] long unsigned int shared_vm; [12] long unsigned int (*get_unmapped_area)(struct file *, long unsigned int, long unsigned int, long unsigned int, long unsigned int); [16] void (*unmap_area)(struct mm_struct *, long unsigned int); [20] long unsigned int mmap_base; [24] long unsigned int task_size; [28] long unsigned int cached_hole_size; [32] long unsigned int free_area_cache; [36] *pgd; [40] atomic_t mm_users; [44] atomic_t mm_count; [48] int map_count; [52] struct rw_semaphore mmap_sem; [80] spinlock_t page_table_lock; [96] struct list_head mmlist; [104] mm_counter_t _file_rss; [108] mm_counter_t _anon_rss; [112] long unsigned int hiwater_rss; [116] long unsigned int hiwater_vm; [132] long unsigned int exec_vm; [136] long unsigned int stack_vm; [140] long unsigned int reserved_vm; [144] long unsigned int def_flags; [148] long unsigned int nr_ptes; [152] long unsigned int start_code; [156] long unsigned int end_code; [160] long unsigned int start_data; [164] long unsigned int end_data; [168] long unsigned int start_brk; [172] long unsigned int brk; [176] long unsigned int start_stack; [180] long unsigned int arg_start; [184] long unsigned int arg_end; [188] long unsigned int env_start; [192] long unsigned int env_end;

7 mm_struct Page Directory Chapter 13: mmap and DMA struct mm_struct { [196] long unsigned int saved_auxv[44]; [372] unsigned int dumpable : 2; [376] cpumask_t cpu_vm_mask [380] mm_context_t context; [424] long unsigned int swap_token_time; [428] char recent_pagein; [432] int core_waiters; [436] struct completion *core_startup_done; [440] struct completion core_done; [468] rwlock_t ioctx_list_lock; [484] struct kioctx *ioctx_list; } SIZE: 488 struct mm_struct PGD Virtual Address (addr) PMD Software relationships pgd part pmd part pte part offset PTE pgd_offset(mm_struct, addr); pmd_offset(, addr); pte_offset(, addr); pte_page(); page. struct page physical page Hardware relationships pgd_val(pgd); pmd_val(pmd); pte_val(pte); Figur e The thr ee levels of Linux page tables vm_area_struct Credit: Page Table A page-aligned array of items, Implementation each of which is called a Page Table Entry. The kernel uses the type for the items. A contains the physical address of the data page. The types introduced in this list are defined in <asm/page.h>, which must be vm_area_struct included by every source file that plays with paging. The kernel doesn t need to worry about doing page-table lookups during normal program execution, because they are done by the hardware. Nonetheless, the kernel must arrange things so that the hardware can do its work. It must build the page tables and look them up whenever the processor reports a page fault, that is, struct vm_area_struct { [0] struct mm_struct *vm_mm; [4] long unsigned int ; [8] long unsigned int ; 376 [12] struct vm_area_struct *; [16] pgprot_t vm_page_prot; [20] long unsigned int ; [24] struct rb_node vm_rb; union { struct {...} vm_set; struct raw_prio_tree_node prio_tree_node; [36] } shared; [52] struct list_head anon_vma_node; [60] struct anon_vma *anon_vma; [64] struct vm_operations_struct *vm_ops; [68] long unsigned int vm_pgoff; [72] struct file *vm_file; [76] void *vm_private_data; [80] long unsigned int vm_truncate_count; } SIZE: 84

8 Page Fault 120 Noncontiguous Memory Allocation Chapter 7 Figure 7.3. Relationship Between vmalloc(), alloc page() and Page Faulting do_page_fault 7.3 Freeing a Noncontiguous Area The function vfree() is responsible for freeing a area as described in Table 7.2. It linearly searches the list of vm structs looking for the desired region and then calls vmfree area pages() on the region of to be freed, as shown in Figure 7.4. void vfree(void *addr) Frees a region of allocated with vmalloc(), vmalloc dma() or vmalloc 32() Table 7.2. Noncontiguous Memory Free API do_page_fault Outline do_page_fault expand_stack handle_mm_fault force_sig_info search_exception_table find_vma find_vma_prev pmd_alloc pte_alloc handle_pte_fault search_one_table do_no_page do_swap_page do_wp_page establish_pte do_anonymous_page alloc_page lru_cache_add Figure Call Graph: do page fault() 1 2 Implementation 4.6. Page Faulting 81 vmfree area pages() is the exact opposite of vmalloc area pages(). It walks the page tables and frees up the page table entries and associated pages for the region. 3

9 References Memory management is crucial Machine introspection Memory forensics Traversing kernel data structures to understand the Memory failures Exploits Dening BEFORE MEMORY WAS VIRTUAL Linux device drivers, Addison-wisely. f10/www/lectures/16-vm-systems.pdf Understanding Linux manager Understanding Linux kernel (3rd edition)

VM Architecture. Jun-Chiao Wang, 15 Apr. 2002 NCTU CIS Operating System lab. 2002 Linux kernel trace seminar

VM Architecture. Jun-Chiao Wang, 15 Apr. 2002 NCTU CIS Operating System lab. 2002 Linux kernel trace seminar VM Architecture Jun-Chiao Wang, 15 Apr. 2002 NCTU CIS Operating System lab. 2002 Linux kernel trace seminar Outline Introduction What is VM? Segmentation & Paging in Linux Memory Management Page Frame

More information

Intel P6 Systemprogrammering 2007 Föreläsning 5 P6/Linux Memory System

Intel P6 Systemprogrammering 2007 Föreläsning 5 P6/Linux Memory System Intel P6 Systemprogrammering 07 Föreläsning 5 P6/Linux ory System Topics P6 address translation Linux memory management Linux page fault handling memory mapping Internal Designation for Successor to Pentium

More information

Virtual Memory. How is it possible for each process to have contiguous addresses and so many of them? A System Using Virtual Addressing

Virtual Memory. How is it possible for each process to have contiguous addresses and so many of them? A System Using Virtual Addressing How is it possible for each process to have contiguous addresses and so many of them? Computer Systems Organization (Spring ) CSCI-UA, Section Instructor: Joanna Klukowska Teaching Assistants: Paige Connelly

More information

W4118 Operating Systems. Instructor: Junfeng Yang

W4118 Operating Systems. Instructor: Junfeng Yang W4118 Operating Systems Instructor: Junfeng Yang Outline x86 segmentation and paging hardware Linux address space translation Copy-on-write Linux page replacement algorithm Linux dynamic memory allocation

More information

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015 Linux/UNIX System Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2015 February 2015 Outline 22 POSIX Shared Memory 22-1 22.1 Overview 22-3 22.2 Creating and opening shared memory objects 22-10

More information

There s a kernel security researcher named Dan Rosenberg whose done a lot of linux kernel vulnerability research

There s a kernel security researcher named Dan Rosenberg whose done a lot of linux kernel vulnerability research 1 There s a kernel security researcher named Dan Rosenberg whose done a lot of linux kernel vulnerability research That s unavoidable, but the linux kernel developers don t do very much to make the situation

More information

CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont.

CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont. CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont. Instructors: Vladimir Stojanovic & Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/ 1 Bare 5-Stage Pipeline Physical Address PC Inst.

More information

Virtual Memory. Chapter 4

Virtual Memory. Chapter 4 Chapter 4 Virtual Memory Linux processes execute in a virtual environment that makes it appear as if each process had the entire address space of the CPU available to itself. This virtual address space

More information

NAVAL POSTGRADUATE SCHOOL THESIS

NAVAL POSTGRADUATE SCHOOL THESIS NAVAL POSTGRADUATE SCHOOL MONTEREY, CALIFORNIA THESIS AN ANALYSIS OF LINUX RAM FORENSICS by Jorge Mario Urrea March 2006 Thesis Advisor: Second Reader: Chris Eagle George Dinolt Approved for public release;

More information

CS5460: Operating Systems

CS5460: Operating Systems CS5460: Operating Systems Lecture 13: Memory Management (Chapter 8) Where are we? Basic OS structure, HW/SW interface, interrupts, scheduling Concurrency Memory management Storage management Other topics

More information

Shared Memory Introduction

Shared Memory Introduction 12 Shared Memory Introduction 12.1 Introduction Shared memory is the fastest form of IPC available. Once the memory is mapped into the address space of the processes that are sharing the memory region,

More information

Programmation Systèmes Cours 9 Memory Mapping

Programmation Systèmes Cours 9 Memory Mapping Programmation Systèmes Cours 9 Memory Mapping Stefano Zacchiroli zack@pps.jussieu.fr Laboratoire PPS, Université Paris Diderot - Paris 7 24 novembre 2011 URL http://upsilon.cc/zack/teaching/1112/progsyst/

More information

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc()

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() CS61: Systems Programming and Machine Organization Harvard University, Fall 2009 Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() Prof. Matt Welsh October 6, 2009 Topics for today Dynamic

More information

Memory Management CS 217. Two programs can t control all of memory simultaneously

Memory Management CS 217. Two programs can t control all of memory simultaneously Memory Management CS 217 Memory Management Problem 1: Two programs can t control all of memory simultaneously Problem 2: One program shouldn t be allowed to access/change the memory of another program

More information

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts

More information

6.828 Operating System Engineering: Fall 2003. Quiz II Solutions THIS IS AN OPEN BOOK, OPEN NOTES QUIZ.

6.828 Operating System Engineering: Fall 2003. Quiz II Solutions THIS IS AN OPEN BOOK, OPEN NOTES QUIZ. Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2003 Quiz II Solutions All problems are open-ended questions. In

More information

Linux kernel support to exploit phase change memory

Linux kernel support to exploit phase change memory Linux kernel support to exploit phase change memory Youngwoo Park, Sung Kyu Park and Kyu Ho Park Korea Advanced Institute of Science and Technology (KAIST) (ywpark,skpark)@core.kaist.ac.kr and kpark@ee.kaist.ac.kr

More information

Virtual vs Physical Addresses

Virtual vs Physical Addresses Virtual vs Physical Addresses Physical addresses refer to hardware addresses of physical memory. Virtual addresses refer to the virtual store viewed by the process. virtual addresses might be the same

More information

Linux Memory Analysis Workshop Session 1 Andrew Case

Linux Memory Analysis Workshop Session 1 Andrew Case Linux Memory Analysis Workshop Session 1 Andrew Case Who Am I? Security Analyst at Digital Forensics Solutions Also perform wide ranging forensics investigations Volatility Developer Former Blackhat, SOURCE,

More information

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015 Operating Systems 05. Threads Paul Krzyzanowski Rutgers University Spring 2015 February 9, 2015 2014-2015 Paul Krzyzanowski 1 Thread of execution Single sequence of instructions Pointed to by the program

More information

Linux kernen. Version 2.4.20, 2.5.59. 11 arch. DIKU Intel, SMP. . NEL, Kernel, 2003.2.5-1 -

Linux kernen. Version 2.4.20, 2.5.59. 11 arch. DIKU Intel, SMP. . NEL, Kernel, 2003.2.5-1 - Linux kernen Version 2.4.20, 2.5.59 11 arch. DIKU Intel, SMP.. NEL, Kernel, 2003.2.5-1 - Linux processer Processer User mode/kernel mode. Kernel threads Processer/tråde. fork(), clone(), shmem etc. Parent

More information

Chapter 6, The Operating System Machine Level

Chapter 6, The Operating System Machine Level Chapter 6, The Operating System Machine Level 6.1 Virtual Memory 6.2 Virtual I/O Instructions 6.3 Virtual Instructions For Parallel Processing 6.4 Example Operating Systems 6.5 Summary Virtual Memory General

More information

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1 Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1 Bob Matthews Red Hat, Inc. Kernel Development Team Norm Murray Red Hat, Inc. Client Engineering Team This is an explanation of the virtual memory

More information

How To Write To A Linux Memory Map On A Microsoft Zseries 2.2.2 (Amd64) On A Linux 2.3.2 2.4.2 3.5.2 4.5 (Amd32) (

How To Write To A Linux Memory Map On A Microsoft Zseries 2.2.2 (Amd64) On A Linux 2.3.2 2.4.2 3.5.2 4.5 (Amd32) ( Understanding Linux Memory Management SHARE 102 Session 9241 Dr. Ulrich Weigand Linux on zseries Development, IBM Lab Böblingen Ulrich.Weigand@de.ibm.com Linux Memory Management - A Mystery? What does

More information

Virtualization. Explain how today s virtualization movement is actually a reinvention

Virtualization. Explain how today s virtualization movement is actually a reinvention Virtualization Learning Objectives Explain how today s virtualization movement is actually a reinvention of the past. Explain how virtualization works. Discuss the technical challenges to virtualization.

More information

Bringing PowerPC Book E to Linux

Bringing PowerPC Book E to Linux Bringing PowerPC Book E to Linux Challenges in porting Linux to the first PowerPC Book E processor implementation Matthew D. Porter MontaVista Software, Inc. mporter@kernel.crashing.org mporter@mvista.com

More information

Virtualization in Linux KVM + QEMU

Virtualization in Linux KVM + QEMU CS695 Topics in Virtualization and Cloud Computing KVM + QEMU Senthil, Puru, Prateek and Shashank 1 Topics covered KVM and QEMU Architecture VTx support CPU virtualization in KMV Memory virtualization

More information

Xen and the Art of. Virtualization. Ian Pratt

Xen and the Art of. Virtualization. Ian Pratt Xen and the Art of Virtualization Ian Pratt Keir Fraser, Steve Hand, Christian Limpach, Dan Magenheimer (HP), Mike Wray (HP), R Neugebauer (Intel), M Williamson (Intel) Computer Laboratory Outline Virtualization

More information

W4118: segmentation and paging. Instructor: Junfeng Yang

W4118: segmentation and paging. Instructor: Junfeng Yang W4118: segmentation and paging Instructor: Junfeng Yang Outline Memory management goals Segmentation Paging TLB 1 Uni- v.s. multi-programming Simple uniprogramming with a single segment per process Uniprogramming

More information

Linux Kernel Architecture

Linux Kernel Architecture Linux Kernel Architecture Amir Hossein Payberah payberah@yahoo.com Contents What is Kernel? Kernel Architecture Overview User Space Kernel Space Kernel Functional Overview File System Process Management

More information

Software Vulnerabilities

Software Vulnerabilities Software Vulnerabilities -- stack overflow Code based security Code based security discusses typical vulnerabilities made by programmers that can be exploited by miscreants Implementing safe software in

More information

Module 20: The Linux System

Module 20: The Linux System Module 20: The Linux System History Design Principles Kernel Modules Process Management Scheduling Memory Management File Systems Input and Output Interprocess Communication Network Structure Security

More information

Lecture 25 Symbian OS

Lecture 25 Symbian OS CS 423 Operating Systems Design Lecture 25 Symbian OS Klara Nahrstedt Fall 2011 Based on slides from Andrew S. Tanenbaum textbook and other web-material (see acknowledgements) cs423 Fall 2011 1 Overview

More information

COS 318: Operating Systems. Virtual Memory and Address Translation

COS 318: Operating Systems. Virtual Memory and Address Translation COS 318: Operating Systems Virtual Memory and Address Translation Today s Topics Midterm Results Virtual Memory Virtualization Protection Address Translation Base and bound Segmentation Paging Translation

More information

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes Content Introduction and History File I/O The File System Shell Programming Standard Unix Files and Configuration Processes Programs are instruction sets stored on a permanent medium (e.g. harddisc). Processes

More information

Operating System Overview. Otto J. Anshus

Operating System Overview. Otto J. Anshus Operating System Overview Otto J. Anshus A Typical Computer CPU... CPU Memory Chipset I/O bus ROM Keyboard Network A Typical Computer System CPU. CPU Memory Application(s) Operating System ROM OS Apps

More information

Lecture 17: Virtual Memory II. Goals of virtual memory

Lecture 17: Virtual Memory II. Goals of virtual memory Lecture 17: Virtual Memory II Last Lecture: Introduction to virtual memory Today Review and continue virtual memory discussion Lecture 17 1 Goals of virtual memory Make it appear as if each process has:

More information

Linux Memory Analysis Workshop Session 1 Andrew Case

Linux Memory Analysis Workshop Session 1 Andrew Case Linux Memory Analysis Workshop Session 1 Andrew Case Who Am I? Security Analyst at Digital Forensics Solutions Also perform wide ranging forensics investigations Volatility Developer Former Blackhat, SOURCE,

More information

Memory Management under Linux: Issues in Linux VM development

Memory Management under Linux: Issues in Linux VM development Memory Management under Linux: Issues in Linux VM development Christoph Lameter, Ph.D. Technical Lead, Linux Kernel Software Silicon Graphics Inc. clameter@sgi.com 2008-03-12 2008 SGI Sunnyvale, California

More information

Free-Space Management

Free-Space Management 17 Free-Space Management In this chapter, we take a small detour from our discussion of virtualizing memory to discuss a fundamental aspect of any memory management system, whether it be a malloc library

More information

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005 Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2005 Quiz II Solutions Average 84, median 83, standard deviation

More information

Sistemi Operativi. Lezione 25: JOS processes (ENVS) Corso: Sistemi Operativi Danilo Bruschi A.A. 2015/2016

Sistemi Operativi. Lezione 25: JOS processes (ENVS) Corso: Sistemi Operativi Danilo Bruschi A.A. 2015/2016 Sistemi Operativi Lezione 25: JOS processes (ENVS) 1 JOS PCB (ENV) 2 env_status ENV_FREE: Indicates that the Env structure is inactive, and therefore on the env_free_list. ENV_RUNNABLE: Indicates that

More information

How To Write A Page Table

How To Write A Page Table 12 Paging: Introduction Remember our goal: to virtualize memory. Segmentation (a generalization of dynamic relocation) helped us do this, but has some problems; in particular, managing free space becomes

More information

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts

More information

The Linux Kernel Device Model

The Linux Kernel Device Model The Linux Kernel Device Model Patrick Mochel Open Source Development Lab mochel@osdl.org Abstract Linux kernel development follows a simple guideline that code should be only as complex as absolutely necessary.

More information

LINUX INTERNALS A LITTLE BIT OF HISTORY. Peter Chubb and Etienne Le Sueur. Ken Thompson and Dennis Ritchie in 1967 70. USG and BSD. John Lions 1976 95

LINUX INTERNALS A LITTLE BIT OF HISTORY. Peter Chubb and Etienne Le Sueur. Ken Thompson and Dennis Ritchie in 1967 70. USG and BSD. John Lions 1976 95 LINUX INTERNALS Peter Chubb and Etienne Le Sueur first.last@nicta.com.au The history of UNIX-like operating systems is a history of people being dissatisfied with what they have and wanting to do something

More information

System Calls and Standard I/O

System Calls and Standard I/O System Calls and Standard I/O Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Class System calls o How a user process contacts the Operating System o For advanced services

More information

The Linux Kernel: Process Management. CS591 (Spring 2001)

The Linux Kernel: Process Management. CS591 (Spring 2001) The Linux Kernel: Process Management Process Descriptors The kernel maintains info about each process in a process descriptor, of type task_struct. See include/linux/sched.h Each process descriptor contains

More information

Operating Systems. Design and Implementation. Andrew S. Tanenbaum Melanie Rieback Arno Bakker. Vrije Universiteit Amsterdam

Operating Systems. Design and Implementation. Andrew S. Tanenbaum Melanie Rieback Arno Bakker. Vrije Universiteit Amsterdam Operating Systems Design and Implementation Andrew S. Tanenbaum Melanie Rieback Arno Bakker Vrije Universiteit Amsterdam Operating Systems - Winter 2012 Outline Introduction What is an OS? Concepts Processes

More information

Outline. Operating Systems Design and Implementation. Chap 1 - Overview. What is an OS? 28/10/2014. Introduction

Outline. Operating Systems Design and Implementation. Chap 1 - Overview. What is an OS? 28/10/2014. Introduction Operating Systems Design and Implementation Andrew S. Tanenbaum Melanie Rieback Arno Bakker Outline Introduction What is an OS? Concepts Processes and Threads Memory Management File Systems Vrije Universiteit

More information

Using Linux as Hypervisor with KVM

Using Linux as Hypervisor with KVM Using Linux as Hypervisor with KVM Qumranet Inc. Andrea Arcangeli andrea@qumranet.com (some slides from Avi Kivity) CERN - Geneve 15 Sep 2008 Agenda Overview/feature list KVM design vs other virtualization

More information

Lecture 5. User-Mode Linux. Jeff Dike. November 7, 2012. Operating Systems Practical. OSP Lecture 5, UML 1/33

Lecture 5. User-Mode Linux. Jeff Dike. November 7, 2012. Operating Systems Practical. OSP Lecture 5, UML 1/33 Lecture 5 User-Mode Linux Jeff Dike Operating Systems Practical November 7, 2012 OSP Lecture 5, UML 1/33 Contents User-Mode Linux Keywords Resources Questions OSP Lecture 5, UML 2/33 Outline User-Mode

More information

Betriebssysteme KU Security

Betriebssysteme KU Security Betriebssysteme KU Security IAIK Graz University of Technology 1 1. Drivers 2. Security - The simple stuff 3. Code injection attacks 4. Side-channel attacks 2 1. Drivers 2. Security - The simple stuff

More information

Between Mutual Trust and Mutual Distrust: Practical Fine-grained Privilege Separation in Multithreaded Applications

Between Mutual Trust and Mutual Distrust: Practical Fine-grained Privilege Separation in Multithreaded Applications Between Mutual Trust and Mutual Distrust: Practical Fine-grained Privilege Separation in Multithreaded Applications Jun Wang, Xi Xiong, Peng Liu Penn State Cyber Security Lab 1 An inherent security limitation

More information

Making Linux Safe for Virtual Machines

Making Linux Safe for Virtual Machines Making Linux Safe for Virtual Machines Jeff Dike (jdike@karaya.com) Abstract User-mode Linux (UML) 1 is the port of Linux to Linux. It has demonstrated that the Linux system call interface is sufficiently

More information

Virtual Servers. Virtual machines. Virtualization. Design of IBM s VM. Virtual machine systems can give everyone the OS (and hardware) that they want.

Virtual Servers. Virtual machines. Virtualization. Design of IBM s VM. Virtual machine systems can give everyone the OS (and hardware) that they want. Virtual machines Virtual machine systems can give everyone the OS (and hardware) that they want. IBM s VM provided an exact copy of the hardware to the user. Virtual Servers Virtual machines are very widespread.

More information

Operating Systems and Networks

Operating Systems and Networks recap Operating Systems and Networks How OS manages multiple tasks Virtual memory Brief Linux demo Lecture 04: Introduction to OS-part 3 Behzad Bordbar 47 48 Contents Dual mode API to wrap system calls

More information

Programmation Systèmes Cours 6 Memory Mapping

Programmation Systèmes Cours 6 Memory Mapping Programmation Systèmes Cours 6 Memory Mapping Stefano Zacchiroli zack@pps.univ-paris-diderot.fr Laboratoire PPS, Université Paris Diderot 2013 2014 URL http://upsilon.cc/zack/teaching/1314/progsyst/ Copyright

More information

UNIX File Management (continued)

UNIX File Management (continued) UNIX File Management (continued) OS storage stack (recap) Application FD table OF table VFS FS Buffer cache Disk scheduler Device driver 2 Virtual File System (VFS) Application FD table OF table VFS FS

More information

Linux Driver Devices. Why, When, Which, How?

Linux Driver Devices. Why, When, Which, How? Bertrand Mermet Sylvain Ract Linux Driver Devices. Why, When, Which, How? Since its creation in the early 1990 s Linux has been installed on millions of computers or embedded systems. These systems may

More information

How To Protect Your Computer From Being Copied On A Microsoft X86 Microsoft Microsoft System (X86) On A Linux System (Amd) On An X86 2.2.2 (Amd2) (X64) (Amd

How To Protect Your Computer From Being Copied On A Microsoft X86 Microsoft Microsoft System (X86) On A Linux System (Amd) On An X86 2.2.2 (Amd2) (X64) (Amd Integrating segmentation and paging protection for safe, efficient and transparent software extensions Tzi-cker Chiueh Ganesh Venkitachalam Prashant Pradhan Computer Science Department State University

More information

Lab 2 : Basic File Server. Introduction

Lab 2 : Basic File Server. Introduction Lab 2 : Basic File Server Introduction In this lab, you will start your file system implementation by getting the following FUSE operations to work: CREATE/MKNOD, LOOKUP, and READDIR SETATTR, WRITE and

More information

A Study of Performance Monitoring Unit, perf and perf_events subsystem

A Study of Performance Monitoring Unit, perf and perf_events subsystem A Study of Performance Monitoring Unit, perf and perf_events subsystem Team Aman Singh Anup Buchke Mentor Dr. Yann-Hang Lee Summary Performance Monitoring Unit, or the PMU, is found in all high end processors

More information

ProTrack: A Simple Provenance-tracking Filesystem

ProTrack: A Simple Provenance-tracking Filesystem ProTrack: A Simple Provenance-tracking Filesystem Somak Das Department of Electrical Engineering and Computer Science Massachusetts Institute of Technology das@mit.edu Abstract Provenance describes a file

More information

Local and Remote Memory: Memory in a Linux/NUMA System

Local and Remote Memory: Memory in a Linux/NUMA System SGI 2006 Remote and Local Memory 1 Local and Remote Memory: Memory in a Linux/NUMA System Jun 20 th, 2006 by Christoph Lameter, Ph.D. christoph@lameter.com 2006 Silicon Graphics, Inc. Memory seems to be

More information

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study CS 377: Operating Systems Lecture 25 - Linux Case Study Guest Lecturer: Tim Wood Outline Linux History Design Principles System Overview Process Scheduling Memory Management File Systems A review of what

More information

Deduplication in VM Environments Frank Bellosa <bellosa@kit.edu> Konrad Miller <miller@kit.edu> Marc Rittinghaus <rittinghaus@kit.

Deduplication in VM Environments Frank Bellosa <bellosa@kit.edu> Konrad Miller <miller@kit.edu> Marc Rittinghaus <rittinghaus@kit. Deduplication in VM Environments Frank Bellosa Konrad Miller Marc Rittinghaus KARLSRUHE INSTITUTE OF TECHNOLOGY (KIT) - SYSTEM ARCHITECTURE GROUP

More information

A Design of Video Acquisition and Transmission Based on ARM. Ziqiang Hao a, Hongzuo Li b

A Design of Video Acquisition and Transmission Based on ARM. Ziqiang Hao a, Hongzuo Li b A Design of Video Acquisition and Transmission Based on ARM Ziqiang Hao a, Hongzuo Li b Changchun University of Science & Technology, Changchun, Jilin, China a shuil47@163.com, b lihongzuo@sohu.com Keywords:video

More information

Improving System Scalability of OpenMP Applications Using Large Page Support

Improving System Scalability of OpenMP Applications Using Large Page Support Improving Scalability of OpenMP Applications on Multi-core Systems Using Large Page Support Ranjit Noronha and Dhabaleswar K. Panda Network Based Computing Laboratory (NBCL) The Ohio State University Outline

More information

CS161: Operating Systems

CS161: Operating Systems CS161: Operating Systems Matt Welsh mdw@eecs.harvard.edu Lecture 2: OS Structure and System Calls February 6, 2007 1 Lecture Overview Protection Boundaries and Privilege Levels What makes the kernel different

More information

Have both hardware and software. Want to hide the details from the programmer (user).

Have both hardware and software. Want to hide the details from the programmer (user). Input/Output Devices Chapter 5 of Tanenbaum. Have both hardware and software. Want to hide the details from the programmer (user). Ideally have the same interface to all devices (device independence).

More information

Hardware Enforcement of Application Security Policies Using Tagged Memory

Hardware Enforcement of Application Security Policies Using Tagged Memory Hardware Enforcement of Application Security Policies Using Tagged Memory Nickolai Zeldovich, Hari Kannan, Michael Dalton, and Christos Kozyrakis MIT Stanford University ABSTRACT Computers are notoriously

More information

umps software development

umps software development Laboratorio di Sistemi Operativi Anno Accademico 2006-2007 Software Development with umps Part 2 Mauro Morsiani Software development with umps architecture: Assembly language development is cumbersome:

More information

Laboratorio di Sistemi Operativi Anno Accademico 2009-2010

Laboratorio di Sistemi Operativi Anno Accademico 2009-2010 Laboratorio di Sistemi Operativi Anno Accademico 2009-2010 Software Development with umps Part 2 Mauro Morsiani Copyright Permission is granted to copy, distribute and/or modify this document under the

More information

Jorix kernel: real-time scheduling

Jorix kernel: real-time scheduling Jorix kernel: real-time scheduling Joris Huizer Kwie Min Wong May 16, 2007 1 Introduction As a specialized part of the kernel, we implemented two real-time scheduling algorithms: RM (rate monotonic) and

More information

Introduction. General Course Information. Perspectives of the Computer. General Course Information (cont.)

Introduction. General Course Information. Perspectives of the Computer. General Course Information (cont.) Introduction CS 256/456 Dept. of Computer Science, University of Rochester General Course Information Course Web page: www.cs.rochester.edu/~kshen/csc256 Course-related announcement/correspondence: Broadcast

More information

Process Description and Control. 2004-2008 william stallings, maurizio pizzonia - sistemi operativi

Process Description and Control. 2004-2008 william stallings, maurizio pizzonia - sistemi operativi Process Description and Control 1 Process A program in execution (running) on a computer The entity that can be assigned to and executed on a processor A unit of activity characterized by a at least one

More information

Computer Engineering and Systems Group Electrical and Computer Engineering SCMFS: A File System for Storage Class Memory

Computer Engineering and Systems Group Electrical and Computer Engineering SCMFS: A File System for Storage Class Memory SCMFS: A File System for Storage Class Memory Xiaojian Wu, Narasimha Reddy Texas A&M University What is SCM? Storage Class Memory Byte-addressable, like DRAM Non-volatile, persistent storage Example: Phase

More information

tmpfs: A Virtual Memory File System

tmpfs: A Virtual Memory File System tmpfs: A Virtual Memory File System Peter Snyder Sun Microsystems Inc. 2550 Garcia Avenue Mountain View, CA 94043 ABSTRACT This paper describes tmpfs, a memory-based file system that uses resources and

More information

User Mode Linux Linux inside Linux inside Linux inside...

User Mode Linux Linux inside Linux inside Linux inside... User Mode Linux Linux inside Linux inside Linux inside... Muli Ben-Yehuda mulix@mulix.org IBM Haifa Research Labs Linux Study Group, HRL, Oct 2003 p.1/23 what is UML? User Mode Linux (UML, hereafter) is

More information

An Implementation Of Multiprocessor Linux

An Implementation Of Multiprocessor Linux An Implementation Of Multiprocessor Linux This document describes the implementation of a simple SMP Linux kernel extension and how to use this to develop SMP Linux kernels for architectures other than

More information

CSC 2405: Computer Systems II

CSC 2405: Computer Systems II CSC 2405: Computer Systems II Spring 2013 (TR 8:30-9:45 in G86) Mirela Damian http://www.csc.villanova.edu/~mdamian/csc2405/ Introductions Mirela Damian Room 167A in the Mendel Science Building mirela.damian@villanova.edu

More information

Safety measures in Linux

Safety measures in Linux S a f e t y m e a s u r e s i n L i n u x Safety measures in Linux Krzysztof Lichota lichota@mimuw.edu.pl A g e n d a Standard Unix security measures: permissions, capabilities, ACLs, chroot Linux kernel

More information

Security Overview of the Integrity Virtual Machines Architecture

Security Overview of the Integrity Virtual Machines Architecture Security Overview of the Integrity Virtual Machines Architecture Introduction... 2 Integrity Virtual Machines Architecture... 2 Virtual Machine Host System... 2 Virtual Machine Control... 2 Scheduling

More information

Leak Check Version 2.1 for Linux TM

Leak Check Version 2.1 for Linux TM Leak Check Version 2.1 for Linux TM User s Guide Including Leak Analyzer For x86 Servers Document Number DLC20-L-021-1 Copyright 2003-2009 Dynamic Memory Solutions LLC www.dynamic-memory.com Notices Information

More information

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2) RTOSes Part I Christopher Kenna September 24, 2010 POSIX Portable Operating System for UnIX Application portability at source-code level POSIX Family formally known as IEEE 1003 Originally 17 separate

More information

Monitoring Access to Shared Memory-Mapped Files

Monitoring Access to Shared Memory-Mapped Files Monitoring Access to Shared Memory-Mapped Files Christian G. Sarmoria, Steve J. Chapin Syracuse University Syracuse, NY 13244, USA {cgsarmor,chapin}@ecs.syr.edu Abstract The post-mortem state of a compromised

More information

KVM: Kernel-based Virtualization Driver

KVM: Kernel-based Virtualization Driver KVM: Kernel-based Virtualization Driver White Paper Overview The current interest in virtualization has led to the creation of several different hypervisors. Most of these, however, predate hardware-assisted

More information

Introduction. General Course Information. Perspectives of the Computer. General Course Information (cont.) Operating Systems 1/12/2005

Introduction. General Course Information. Perspectives of the Computer. General Course Information (cont.) Operating Systems 1/12/2005 Introduction CS 256/456 Dept. of Computer Science, University of Rochester General Course Information Instructor: Kai Shen (kshen@cs.rochester.edu) TA: Kirk Kelsey (kelsey@cs.rochester.edu) TA: Christopher

More information

Uses for Virtual Machines. Virtual Machines. There are several uses for virtual machines:

Uses for Virtual Machines. Virtual Machines. There are several uses for virtual machines: Virtual Machines Uses for Virtual Machines Virtual machine technology, often just called virtualization, makes one computer behave as several computers by sharing the resources of a single computer between

More information

ELEC 377. Operating Systems. Week 1 Class 3

ELEC 377. Operating Systems. Week 1 Class 3 Operating Systems Week 1 Class 3 Last Class! Computer System Structure, Controllers! Interrupts & Traps! I/O structure and device queues.! Storage Structure & Caching! Hardware Protection! Dual Mode Operation

More information

Jonathan Worthington Scarborough Linux User Group

Jonathan Worthington Scarborough Linux User Group Jonathan Worthington Scarborough Linux User Group Introduction What does a Virtual Machine do? Hides away the details of the hardware platform and operating system. Defines a common set of instructions.

More information

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine 7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change

More information

CHAPTER 6 TASK MANAGEMENT

CHAPTER 6 TASK MANAGEMENT CHAPTER 6 TASK MANAGEMENT This chapter describes the IA-32 architecture s task management facilities. These facilities are only available when the processor is running in protected mode. 6.1. TASK MANAGEMENT

More information

Introduction. What is an Operating System?

Introduction. What is an Operating System? Introduction What is an Operating System? 1 What is an Operating System? 2 Why is an Operating System Needed? 3 How Did They Develop? Historical Approach Affect of Architecture 4 Efficient Utilization

More information

Capability-Based Access Control

Capability-Based Access Control Lecture Notes (Syracuse University) Capability: 1 Capability-Based Access Control 1 An Analogy: Bank Analogy We would like to use an example to illustrate the need for capabilities. In the following bank

More information

Secure In-VM Monitoring Using Hardware Virtualization

Secure In-VM Monitoring Using Hardware Virtualization Secure In-VM Monitoring Using Hardware Virtualization Monirul Sharif Georgia Institute of Technology Atlanta, GA, USA msharif@cc.gatech.edu Wenke Lee Georgia Institute of Technology Atlanta, GA, USA wenke@cc.gatech.edu

More information

Research and Design of Universal and Open Software Development Platform for Digital Home

Research and Design of Universal and Open Software Development Platform for Digital Home Research and Design of Universal and Open Software Development Platform for Digital Home CaiFeng Cao School of Computer Wuyi University, Jiangmen 529020, China cfcao@126.com Abstract. With the development

More information

Multi-core Programming System Overview

Multi-core Programming System Overview Multi-core Programming System Overview Based on slides from Intel Software College and Multi-Core Programming increasing performance through software multi-threading by Shameem Akhter and Jason Roberts,

More information