Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Memory Management & Program Loading

Size: px
Start display at page:

Download "Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Memory Management & Program Loading"

Transcription

1 Faculty of Computer Science Institute for System Architecture, Operating Systems Group Memory Management & Program Loading

2 Course Goal Pong Server Paddle Client 1 Paddle Client 2 Keyboard Driver Memory Manager Loader File System Console Name Server RootServer Sigma0 Fiasco Kernel TU Dresden Slide 2

3 Course Goal Starting L4 tasks (e.g. several pong clients) Memory management Interpreting ELF binaries TU Dresden Slide 3

4 Starting L4 Tasks l4_task_new (task_id, mcp, esp, eip, pager_id) Clans & Chiefs: Obsolete security mechanism to restrict IPC Chief creates tasks belonging to his clan Initially RootServer is the chief of all tasks... Task Task Clan Creator (Chief) Task Task Fiasco Kernel TU Dresden Slide 4

5 Starting L4 Tasks (RootServer) Allocate Tasks at RootServer See:l4/kpr/root-server/examples/task_alloc, l4/kpr/base/include/task_alloc.h, l4/kpr/base/include/task.h L4::Task_alloc alloc = L4::Info_page::info_page() ->task_alloc(); get task allocator L4::Task L4::Task_alloc::alloc() transfer task ownership from RootServer to calling task int L4::Task_alloc::free(L4::Task t) kill the task and transfer ownership of task back to RootServer Start Tasks L4::Task::start(ip, sp, pager) start thread 0 of the task at ip with stack at sp and the given pager. L4::Task::kill() stop/kill task TU Dresden Slide 5

6 Possible Variants Single-Server Multi-Server New Task New Task Loader: Create task Pager Memory server ELF interpreter Loader: Create task ELF interpreter Pager Memory Server RootServer Sigma0 RootServer Sigma0 Fiasco Kernel Fiasco Kernel TU Dresden Slide 6

7 Memory Basics Reserve memory from RootServer See:l4/kpr/root-server/examples/allocator, l4/kpr/base/include/allocator.h, l4/kpr/base/include/memory.h L4::Allocator alloc = L4::Info_page::info_page() ->allocator(); get memory allocator interface L4::Memory L4::Allocator::alloc(size) allocate size bytes of memory (must be multiple of 4Kbyte) int L4::Allocator::free(L4::Memory mem) free the given memory object Attach the allocated memory to local address space as shown for I/O memory (Keyboard Driver & Pong Client, Slide 7) using the region mapper. TU Dresden Slide 7

8 Single-Server All components in one address space Loader creates L4 task Loader is ELF interpreter Interprets modules associated with loader Loader is Pager Manages region list (region = piece of virtual memory of a specific task) Translates a page fault of a task to a region Loader is memory server Reserves memory at RootServer (See Memory Basics) Creates memory regions for started user programs TU Dresden Slide 8

9 Multi-Server I All components in separate address spaces Loader Creates L4 tasks ELF interpreter Provides memory objects for read-only ELF segments Allocates memory from memory server for writable ELF segments Uses memory server and pager interfaces Pager Manages region list Translates page-fault IPC to memory object requests (to memory server and loader) TU Dresden Slide 9

10 Multi-Server II Memory server Reserves memory at RootServer Clients may allocate a chunk of memory of a specific size and get a unique ID Clients may request the memory server to map a memory chunk named by its ID Loader must implement this map interface for the read-only program sections too Special hint: Use a common base class for remote objects consisting of: Thread ID of the server providing the object Object ID of the specific object (local to the server) TU Dresden Slide 10

11 IPC Framework Flexpages Sender side (Server) Use l4_snd_fpage_t to send flexpages via IPC streams Receiver side (Client) Set receive flexpage/window before IPC: L4::Ipc_buf<128> msg(0,0); L4::Ipc_client io(&msg, L4_OPCODE(1)); msg.rcv_fpage(l4_fpage(vaddr, size, write, 0)); TU Dresden Slide 11

12 Support for malloc() Provide a morecore function: #include <l4/sigma0/sigma0.h> /* This function must return a pointer to a piece of * free memory. The size must be at least *size bytes, * however it can be more. The size of the memory block * must be returned in *size. A return value of 0 means * 'out of memory'. */ void *morecore(unsigned long *size) {... } Link against libuc_be_morecore.a (-luc_be_morecore.a) TU Dresden Slide 12

13 Program Segment n Program Segment 2 Program Segment 1 ELF Header Interpreting ELF binaries typedef struct { // read-only, read-write,... Elf32_Word p_type; // offset of segment in program image Elf32_Off p_offset; // virtual address of program segment Elf32_Addr p_vaddr; Elf32_Addr p_paddr; // size of segment in program image Elf32_Word p_filesz; // size of segment in memory Elf32_Word p_memsz;... } Elf32_Phdr; typedef struct {... // entry of program (EIP for startup) Elf32_Addr e_entry; // offset of program headers (in file) Elf32_Off e_phoff;... // number of program headers/segments Elf32_Half e_phnum; } Elf32_Ehdr; TU Dresden Slide 13

14 Interpreting ELF binaries Check the ELF Header Elf32_Ehdr *e = (Elf32_Ehdr*)image; Check the ELF Magic ID e_ident[ei_mag0] == ELFMAG0 && e_ident[ei_mag1] == ELFMAG1 && e_ident[ei_mag2] == ELFMAG2 && e_ident[ei_mag3] == ELFMAG3 Check the ELF class e_ident[ei_class] == ELFCLASS32 e_ident[ei_data] == ELFDATA2LSB e_ident[ei_osabi] == ELFOSABI_SYSV Check the ELF architecture e_type == ET_EXEC && e_machine == EM_386 && e_version == EV_CURRENT NOTE: Use header file: l4/util/elf.h TU Dresden Slide 14

15 Interpreting ELF binaries Load the ELF program segements Elf32_Phdr *p = (Elf32_phdr*)(image + e->e_phoff); for (i=0; i<e->e_phnum; i++) { if (p[i].p_type!= PT_LOAD p[i].p_memsz == 0) continue; // segement occupies no memory if (p[i].p_vaddr + p[i].p_memsz >= 0xC ) return 0; // binary exceeds userland if (p[i].p_filesz > p[i].p_memsz) return 0; // corrupt binary if (p[i].p_flags & PF_W) p[i].p_filesz < p[i].p_memsz) { // writable segment } else { // read-only segment } } TU Dresden Slide 15

The Darker Sides of Assembly

The Darker Sides of Assembly The Darker Sides of Assembly We've seen it. Alex Radocea, Andrew Zonenberg Moments in History Thompson's Compiler Backdoor http://cm.bell-labs.com/who/ken/trust.html I am a programmer. On my 1040 form,

More information

Study and Analysis of ELF Vulnerabilities in Linux

Study and Analysis of ELF Vulnerabilities in Linux Study and Analysis of ELF Vulnerabilities in Linux Biswajit Sarma Assistant professor, Department of Computer Science and Engineering, Jorhat Engineering College, Srishti Dasgupta Final year student, Department

More information

Teensy Tiny ELF Programs

Teensy Tiny ELF Programs Teensy Tiny ELF Programs inspired by Brian Raiter Roland Hieber Stratum 0 e. V. March 15, 2013 1 / 14 Hello World # include int main ( int argc, char ** argv ) { printf (" Hello World!\n"); return

More information

Assembler CS 217. translates high-level language to assembly language. translates assembly language to machine language

Assembler CS 217. translates high-level language to assembly language. translates assembly language to machine language Assembler CS 217 Compilation Pipeline Compiler (gcc):.c.s translates high-level language to assembly language Assembler (as):.s.o translates assembly language to machine language Archiver (ar):.o.a collects

More information

This specification defines the ARM-specific features of Executable and Linking Format (ELF). Name Function Name Function

This specification defines the ARM-specific features of Executable and Linking Format (ELF). Name Function Name Function ARM ELF Development Systems Business Unit Engineering Software Group Document number: SWS ESPC 0003 A-06 Date of Issue: 05 November, 1998 Author: - Authorized by: Copyright ARM Limited 1998. All rights

More information

18-349: Introduction to Embedded Real-Time Systems. Lecture 7: Profiling and Optimization

18-349: Introduction to Embedded Real-Time Systems. Lecture 7: Profiling and Optimization 18-349: Introduction to Embedded Real-Time Systems Lecture 7: Profiling and Optimization Anthony Rowe Electrical and Computer Engineering Carnegie Mellon University Lecture Overview System Profiling Speed

More information

This specification defines the ARM-specific features of Executable and Linking Format (ELF). Name Function Name Function

This specification defines the ARM-specific features of Executable and Linking Format (ELF). Name Function Name Function ARM ELF Development Systems Business Unit Engineering Software Group Document number: SWS ESPC 0003 B-02 Date of Issue: 8 June, 2001 Author: - Authorized by: Copyright ARM Limited 1998, 2000. All rights

More information

Assembler CS 217. translates high-level language to assembly language. translates assembly language to machine language

Assembler CS 217. translates high-level language to assembly language. translates assembly language to machine language Assembler CS 217 Compilation Pipeline Compiler (gcc):.c.s translates high-level language to assembly language Assembler (as):.s.o translates assembly language to machine language Archiver (ar):.o.a collects

More information

ELF (1A) Young Won Lim 3/24/16

ELF (1A) Young Won Lim 3/24/16 ELF (1A) Copyright (c) 21-216 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Alexander Warg. Complex Lab Operating System 2007 Winter Term. Introduction

Alexander Warg. Complex Lab Operating System 2007 Winter Term. Introduction Faculty of Computer Science Institute for System Architecture, Operating Systems Group Alexander Warg Complex Lab Operating System 2007 Winter Term Introduction Requirements Basic Operating Systems Know-How

More information

Systems Design and Implementation I.6 Threads and Scheduling

Systems Design and Implementation I.6 Threads and Scheduling Systems Design and Implementation I.6 Threads and Scheduling System, SS 2009 University of Karlsruhe June 2, 2009 Jan Stoess University of Karlsruhe Overview Motivation Threads and Processes Thread and

More information

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Complex Lab Operating Systems 2016 Winter Term.

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Complex Lab Operating Systems 2016 Winter Term. Faculty of Computer Science Institute for System Architecture, Operating Systems Group Complex Lab Operating Systems 2016 Winter Term Introduction Requirements Basic Operating Systems Know-How Virtual

More information

Basic Information. CS318 Project #1. OS Bootup Process. Reboot. Bootup Mechanism

Basic Information. CS318 Project #1. OS Bootup Process. Reboot. Bootup Mechanism Basic Information CS318 Project #1 Bootup Mechanism Lab is in 010 Friend Center Use your OIT username/password If you get the error unable to mount /u/username contact me, (most student should have it

More information

get.c get.o extern int a[]; int get_a(int i) { return a[i]; }

get.c get.o extern int a[]; int get_a(int i) { return a[i]; } get.c get.o extern int a[]; int get_a(int i) { return a[i]; } get.o get get.o get.so ELF ELF segments sections https://en.wikipedia.org/wiki/executable_and_linkable_format ELF https://en.wikipedia.org/wiki/executable_and_linkable_format

More information

VIEWCORE PROJECT - FALL 2003 Independent Study on Core Dumps by Atanas Mitkov Dimitrov

VIEWCORE PROJECT - FALL 2003 Independent Study on Core Dumps by Atanas Mitkov Dimitrov VIEWCORE PROJECT - FALL 2003 Independent Study on Core Dumps by Atanas Mitkov Dimitrov Email: atanas_dimitrov@bobcat.gcsu.edu Project URL: http://turing.gcsu.edu/~adimitro/viewcore TABLE OF CONTENTS: I.

More information

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Memory. Björn Döbel. Dresden,

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Memory. Björn Döbel. Dresden, Faculty of Computer Science Institute for System Architecture, Operating Systems Group Memory Björn Döbel Dresden, 2013-11-05 So far... Introduction Monolithic vs. microkernels L4 concepts: Threads and

More information

The golden age of hacking

The golden age of hacking The golden age of hacking Malware analysis Pen-test methods http://en.wikipedia.org/wiki/portal:computer_security Malware analysis template http://www.counterhack.net/malware_template.html LAB 6.5/6.6

More information

Question 2 has four parts. Answer any three of the four parts of question 2.

Question 2 has four parts. Answer any three of the four parts of question 2. Name: 1 CS372H: Spring 2008 Midterm 1 Instructions This midterm is closed book and notes. If a question is unclear, write down the point you find ambiguous, make a reasonable interpretation, write down

More information

TASKING C166 ELF/DWARF APPLICATION BINARY INTERFACE

TASKING C166 ELF/DWARF APPLICATION BINARY INTERFACE C166: elf_dwarf_abi 1 of 11 Last updated: 2006-12-07 14:33 TASKING C166 ELF/DWARF APPLICATION BINARY INTERFACE Document ID 119-EDABI Status Released Version 1.2 Date 2006-12-07 C166: elf_dwarf_abi 2 of

More information

Complex Lab Operating Systems 2015/16 Winter Term. Sessions & Dynamic Memory

Complex Lab Operating Systems 2015/16 Winter Term. Sessions & Dynamic Memory Faculty of Computer Science Institute for System Architecture, Operating Systems Group Complex Lab Operating Systems 2015/16 Winter Term Sessions & Dynamic Memory 1 st Assignment General Coding Style use

More information

TASKING C166 ELF/DWARF APPLICATION BINARY INTERFACE

TASKING C166 ELF/DWARF APPLICATION BINARY INTERFACE C166: elf_dwarf_abi 1 of 13 Last updated: 2007-02-26 11:54 TASKING C166 ELF/DWARF APPLICATION BINARY INTERFACE Document ID 119-EDABI Status Released Version 1.3 Date 2007-02-26 C166: elf_dwarf_abi 2 of

More information

Richard Johnson

Richard Johnson x86 Disassembler Internals Toorcon 7 September 2005 Richard Johnson rjohnson@idefense.com Welcome Who am I? Richard Johnson Senior Security Engineer, idefense Labs Other Research: nologin.org / uninformed.org

More information

MICROKERNEL CONSTRUCTION 2014

MICROKERNEL CONSTRUCTION 2014 MICROKERNEL CONSTRUCTION 2014 THE FIASCO.OC MICROKERNEL Alexander Warg MICROKERNEL CONSTRUCTION 1 FIASCO.OC IN ONE SLIDE CAPABILITY-BASED MICROKERNEL API single system call invoke capability MULTI-PROCESSOR

More information

Decoding ELF Format Files. Decoding ELF Format Files

Decoding ELF Format Files. Decoding ELF Format Files Decoding ELF Format Files i Decoding ELF Format Files Decoding ELF Format Files ii Copyright 2013 G. Andrew Mangogna This software is copyrighted 2013 by G. Andrew Mangogna. The following terms apply to

More information

Decoding ELF Format Files. Decoding ELF Format Files

Decoding ELF Format Files. Decoding ELF Format Files Decoding ELF Format Files i Decoding ELF Format Files Decoding ELF Format Files ii Copyright 2013 G. Andrew Mangogna This software is copyrighted 2013 by G. Andrew Mangogna. The following terms apply to

More information

µ-kernel Construction (12)

µ-kernel Construction (12) µ-kernel Construction (12) Review 1 Threading Thread state must be saved/restored on thread switch We need a Thread Control Block (TCB) per thread TCBs must be kernel objects TCBs implement threads We

More information

Microkernel Construction. Introduction. Michael Hohmuth. Lars Reuther. TU Dresden Operating Systems Group

Microkernel Construction. Introduction. Michael Hohmuth. Lars Reuther. TU Dresden Operating Systems Group Introduction Lecture Goals Provide deeper understanding of OS mechanisms Make all of you enthusiastic kernel hackers Illustrate alternative system design concepts Promote OS research at 2 Administration

More information

Microkernel-based Operating Systems - Introduction

Microkernel-based Operating Systems - Introduction Faculty of Computer Science Institute for System Architecture, Operating Systems Group Microkernel-based Operating Systems - Introduction Björn Döbel Dresden, Oct 14 th 2008 Lecture Goals Provide deeper

More information

Memory, IPC, and L4Re

Memory, IPC, and L4Re Faculty of Computer Science Institute for System Architecture, Operating Systems Group Memory, IPC, and L4Re Björn Döbel What we talked about so far Microkernels Fiasco.OC Threads in Fiasco.OC Lecture

More information

Operating System Labs. Yuanbin Wu

Operating System Labs. Yuanbin Wu Operating System Labs Yuanbin Wu CS@ECNU Operating System Labs Project 2 Due 21:00, Oct. 24 Project 3 Group of 3 If you can not find a partner, drop us an email You now have 3 late days, but start early!

More information

Assignment 1 Board Configuration, Compiling, Debugging, and Executable Files CSE 325, Fall 2010

Assignment 1 Board Configuration, Compiling, Debugging, and Executable Files CSE 325, Fall 2010 Assignment 1 Board Configuration, Compiling, Debugging, and Executable Files CSE 325, Fall 2010 Assignment Objectives 1. To learn how to configure the M5211DEMO board for downloading and running code.

More information

SPPEXA TEACHLET: GETTING STARTED WITH L4RE CARSTEN WEINHOLD

SPPEXA TEACHLET: GETTING STARTED WITH L4RE CARSTEN WEINHOLD Faculty of Computer Science Institute of System Architecture, Operating Systems Group SPPEXA TEACHLET: GETTING STARTED WITH L4RE CARSTEN WEINHOLD AGENDA first contact with a microkernel OS getting to know

More information

Processes and Tasks What comprises the state of a running program (a process or task)?

Processes and Tasks What comprises the state of a running program (a process or task)? Processes and Tasks What comprises the state of a running program (a process or task)? Microprocessor Address bus Control DRAM OS code and data special caches code/data cache EAXEBP EIP DS EBXESP EFlags

More information

Virtual Memory 1. Virtual Memory

Virtual Memory 1. Virtual Memory Virtual Memory 1 Virtual Memory key concepts virtual memory, physical memory, address translation, MMU, TLB, relocation, paging, segmentation, executable file, swapping, page fault, locality, page replacement

More information

Virtual Memory 1. Virtual Memory

Virtual Memory 1. Virtual Memory Virtual Memory 1 Virtual Memory key concepts virtual memory, physical memory, address translation, MMU, TLB, relocation, paging, segmentation, executable file, swapping, page fault, locality, page replacement

More information

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) !

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) ! Memory Questions? CSCI [4 6]730 Operating Systems Main Memory! What is main memory?! How does multiple processes share memory space?» Key is how do they refer to memory addresses?! What is static and dynamic

More information

seculoader Implementation of a secure loader extending the libdetox framework

seculoader Implementation of a secure loader extending the libdetox framework Bachelor Thesis seculoader Implementation of a secure loader extending the libdetox framework Tobias Hartmann Mathias Payer Responsible assistant Prof. Thomas R. Gross Laboratory for Software Technology

More information

Reminder: compiling & linking

Reminder: compiling & linking Reminder: compiling & linking source file 1 object file 1 source file 2 compilation object file 2 library object file 1 linking (relocation + linking) load file source file N object file N library object

More information

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. MKC Exercise 2. Nils Asmussen

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. MKC Exercise 2. Nils Asmussen Faculty of Computer Science Institute for System Architecture, Operating Systems Group MKC Exercise 2 Nils Asmussen 2018-05-31 Roadmap start.s and linker script Multiboot Header Map physical memory ELF

More information

4. The Abstraction: The Process

4. The Abstraction: The Process 4. The Abstraction: The Process Operating System: Three Easy Pieces AOS@UC 1 How to provide the illusion of many CPUs? p CPU virtualizing w The OS can promote the illusion that many virtual CPUs exist.

More information

Low-Level C Programming. Memory map Pointers Arrays Structures

Low-Level C Programming. Memory map Pointers Arrays Structures Low-Level C Programming Memory map Pointers Arrays Structures Memory Map 0x7FFF_FFFF Binaries load at 0x20000 by default Stack start set by binary when started Stack grows downwards You will need one stack

More information

Paging, and segmentation

Paging, and segmentation Paging, and segmentation Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as many processes into memory as possible 2 Big Picture

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

COSC345 Software Engineering. The Heap And Dynamic Memory Allocation

COSC345 Software Engineering. The Heap And Dynamic Memory Allocation COSC345 Software Engineering The Heap And Dynamic Memory Allocation Outline Revision The programmer s view of memory Simple array-based memory allocation C memory allocation routines Virtual memory Swapping

More information

CSE506: Operating Systems CSE 506: Operating Systems

CSE506: Operating Systems CSE 506: Operating Systems CSE 506: Operating Systems What Software Expects of the OS What Software Expects of the OS Shell Memory Address Space for Process System Calls System Services Launching Program Executables Shell Gives

More information

Practical Exercise Inter-Process Communication

Practical Exercise Inter-Process Communication Faculty of Computer Science Institute for System Architecture, Operating Systems Group Practical Exercise Inter-Process Communication Björn Döbel Dresden, 2008-12-16 Exercise Outline IPC Recap & Implementation

More information

CSC 1600 Memory Layout for Unix Processes"

CSC 1600 Memory Layout for Unix Processes CSC 16 Memory Layout for Unix Processes" 1 Lecture Goals" Behind the scenes of running a program" Code, executable, and process" Memory layout for UNIX processes, and relationship to C" : code and constant

More information

ECE 598 Advanced Operating Systems Lecture 10

ECE 598 Advanced Operating Systems Lecture 10 ECE 598 Advanced Operating Systems Lecture 10 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 22 February 2018 Announcements Homework #5 will be posted 1 Blocking vs Nonblocking

More information

Defeat Exploit Mitigation Heap Attacks. compass-security.com 1

Defeat Exploit Mitigation Heap Attacks. compass-security.com 1 Defeat Exploit Mitigation Heap Attacks compass-security.com 1 ASCII Armor Arbitrary Write Overflow Local Vars Exploit Mitigations Stack Canary ASLR PIE Heap Overflows Brute Force Partial RIP Overwrite

More information

Processes. Johan Montelius KTH

Processes. Johan Montelius KTH Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other

More information

CSE506: Operating Systems CSE 506: Operating Systems

CSE506: Operating Systems CSE 506: Operating Systems CSE 506: Operating Systems What Software Expects of the OS What Software Expects of the OS Memory System Calls System Services Launching Program Executables Shell Memory Abstraction CSE506: Operating Systems

More information

A process. the stack

A process. the stack A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes

More information

The elf in ELF. use 0-day(s) to cheat all disassemblers 1. 1

The elf in ELF. use 0-day(s) to cheat all disassemblers 1. 1 The elf in ELF use 0-day(s) to cheat all disassemblers david942j @ HITCON CMT 2018 1. 1 david942j Who Am I Linux 2. 1 This talk 3 tricks to cheat disassemblers objdump, IDA Pro, etc. 3. 1 IDA Pro's bug

More information

Name: 1. CS372H: Spring 2009 Midterm 1

Name: 1. CS372H: Spring 2009 Midterm 1 Name: 1 Instructions CS372H: Spring 2009 Midterm 1 This midterm is closed book and notes with one exception: you may bring and refer to a 1-sided 8.5x11-inch piece of paper printed with a 10-point or larger

More information

CPEG421/621 Tutorial

CPEG421/621 Tutorial CPEG421/621 Tutorial Compiler data representation system call interface calling convention Assembler object file format object code model Linker program initialization exception handling relocation model

More information

Memory and C/C++ modules

Memory and C/C++ modules Memory and C/C++ modules From Reading #5 and mostly #6 More OOP topics (templates; libraries) as time permits later Program building l Have: source code human readable instructions l Need: machine language

More information

Operating Systems CMPSC 473. Process Management January 29, Lecture 4 Instructor: Trent Jaeger

Operating Systems CMPSC 473. Process Management January 29, Lecture 4 Instructor: Trent Jaeger Operating Systems CMPSC 473 Process Management January 29, 2008 - Lecture 4 Instructor: Trent Jaeger Last class: Operating system structure and basics Today: Process Management Why Processes? We have programs,

More information

Section - Computer Science

Section - Computer Science Section - Computer Science 1. With respect to the C++ programming language, which is the parameter that is added to every non-static member function when it is called? (i) this pointer (ii) that pointer

More information

412-S12 (shankar) Exam 2 SOLUTION Page 1 of 5. 5 problems. 50 points total. Closed book, closed notes, no electronic devices. Write your name above.

412-S12 (shankar) Exam 2 SOLUTION Page 1 of 5. 5 problems. 50 points total. Closed book, closed notes, no electronic devices. Write your name above. 42-S2 (shankar) Exam 2 SOLUTION Page of 5 5 problems. 50 points total. Closed book, closed notes, no electronic devices. Write your name above.. [0 points] In GeekOS project 4, if a user thread makes a

More information

Memory Management II

Memory Management II Memory Management II an OS view Dr Alun Moon Computing, Engineering and Information Sciences 1st November 2011 Dr Alun Moon (ceis:nu) Memory Management II 1st November 2011 1 / 16 Processes in memory Memory

More information

Memory and C/C++ modules

Memory and C/C++ modules Memory and C/C++ modules From Reading #6 Will return to OOP topics (templates and library tools) soon Compilation/linking revisited source file 1 object file 1 source file 2 compilation object file 2 library

More information

Compilation/linking revisited. Memory and C/C++ modules. Layout of C/C++ programs. A sample C program demo.c. A possible structure of demo.

Compilation/linking revisited. Memory and C/C++ modules. Layout of C/C++ programs. A sample C program demo.c. A possible structure of demo. Memory and C/C++ modules From Reading #6 Compilation/linking revisited source file 1 file 1 source file 2 compilation file 2 library linking (relocation + linking) load file file 1 source file N file N

More information

CSCI 237 Sample Final Exam

CSCI 237 Sample Final Exam Problem 1. (12 points): Multiple choice. Write the correct answer for each question in the following table: 1. What kind of process can be reaped? (a) Exited (b) Running (c) Stopped (d) Both (a) and (c)

More information

L4 Nucleus Version X Reference Manual. x86

L4 Nucleus Version X Reference Manual. x86 L4 Nucleus Version X Reference Manual x86 Version X.0 Jochen Liedtke Universität Karlsruhe liedtke@ira.uka.de September 3, 1999 Under Construction How To Read This Manual This reference manual consists

More information

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed Process Management CS 537 Lecture 4: Processes Today: processes and process management what are the OS units of execution? how are they represented inside the OS? how is the CPU scheduled across processes?

More information

Transport Protocol (IEX-TP)

Transport Protocol (IEX-TP) Transport Protocol (IEX-TP) Please contact IEX Market Operations at 646.568.2330 or marketops@iextrading.com, or your IEX onboarding contact with any questions. Version: 1.1 Updated: December 22, 2014

More information

Processes, Address Spaces, and Memory Management. CS449 Spring 2016

Processes, Address Spaces, and Memory Management. CS449 Spring 2016 Processes, Address Spaces, and Memory Management CS449 Spring 2016 Process A running program and its associated data Process s Address Space 0x7fffffff Stack Data (Heap) Data (Heap) Globals Text (Code)

More information

Microkernel-based Operating Systems - Introduction

Microkernel-based Operating Systems - Introduction Faculty of Computer Science Institute for System Architecture, Operating Systems Group Microkernel-based Operating Systems - Introduction Nils Asmussen Dresden, Oct 09 2018 Lecture Goals Provide deeper

More information

User Programs. Computer Systems Laboratory Sungkyunkwan University

User Programs. Computer Systems Laboratory Sungkyunkwan University Project 2: User Programs Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Supporting User Programs What should be done to run user programs? 1. Provide

More information

Name: 1. CS372H: Spring 2009 Midterm 1

Name: 1. CS372H: Spring 2009 Midterm 1 Name: 1 Instructions CS372H: Spring 2009 Midterm 1 This midterm is closed book and notes with one exception: you may bring and refer to a 1-sided 8.5x11-inch piece of paper printed with a 10-point or larger

More information

Microkernel-based Operating Systems - Introduction

Microkernel-based Operating Systems - Introduction Faculty of Computer Science Institute for System Architecture, Operating Systems Group Microkernel-based Operating Systems - Introduction Carsten Weinhold Dresden, Oct 09 th 2012 Lecture Goals Provide

More information

CS 550 Operating Systems Spring Process II

CS 550 Operating Systems Spring Process II CS 550 Operating Systems Spring 2018 Process II 1 Recap: Process Informal definition: A process is a program in execution. Process is not the same as a program. Program is a passive entity stored in the

More information

Linux ELF sections: the past, the present and the future

Linux ELF sections: the past, the present and the future Linux ELF sections: the past, the present and the future Luis R. Rodriguez SUSE Labs mcgrof@suse.com, mcgrof@kernel.org Abstract The Linux kernel has historically made wide use of custom ELF sections.

More information

Midterm Exam #2 April 20, 2016 CS162 Operating Systems

Midterm Exam #2 April 20, 2016 CS162 Operating Systems University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2016 Anthony D. Joseph Midterm Exam #2 April 20, 2016 CS162 Operating Systems Your Name: SID AND 162 Login:

More information

CPS 310 midterm exam #1, 2/19/2018

CPS 310 midterm exam #1, 2/19/2018 CPS 310 midterm exam #1, 2/19/2018 Your name please: NetID: Sign for your honor: Answer all questions. Please attempt to confine your answers to the boxes provided. If you don t know the answer to a question,

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Memory. What is memory? How is memory organized? Storage for variables, data, code etc. Text (Code) Data (Constants) BSS (Global and static variables)

Memory. What is memory? How is memory organized? Storage for variables, data, code etc. Text (Code) Data (Constants) BSS (Global and static variables) Memory Allocation Memory What is memory? Storage for variables, data, code etc. How is memory organized? Text (Code) Data (Constants) BSS (Global and static variables) Text Data BSS Heap Stack (Local variables)

More information

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18 PROCESS VIRTUAL MEMORY CS124 Operating Systems Winter 2015-2016, Lecture 18 2 Programs and Memory Programs perform many interactions with memory Accessing variables stored at specific memory locations

More information

System V Application Binary Interface. VE Architecture Processor Supplement

System V Application Binary Interface. VE Architecture Processor Supplement System V Application Binary Interface VE Architecture Processor Supplement ontents ontents hapter1 Introduction... 1 hapter2 Software Installation... 2 hapter3 Low Level System Information... 3 3.1 Machine

More information

Linking. Explain what ELF format is. Explain what an executable is and how it got that way. With huge thanks to Steve Chong for his notes from CS61.

Linking. Explain what ELF format is. Explain what an executable is and how it got that way. With huge thanks to Steve Chong for his notes from CS61. Linking Topics How do you transform a collection of object files into an executable? How is an executable structured? Why is an executable structured as it is? Learning Objectives: Explain what ELF format

More information

143A: Principles of Operating Systems. Lecture 7: System boot. Anton Burtsev January, 2017

143A: Principles of Operating Systems. Lecture 7: System boot. Anton Burtsev January, 2017 143A: Principles of Operating Systems Lecture 7: System boot Anton Burtsev January, 2017 Bootloader starts Bootloader starts 9111 start: 9112 cli # BIOS enabled interrupts; disable 9113 9114 # Zero data

More information

Virtual Memory Paging

Virtual Memory Paging Virtual Memory Paging An important task of a virtual-memory system is to relocate pages from physical memory out to disk Early UNIX systems swapped out the entire process at once Modern UNIX systems relay

More information

PROGRAMMING IN C++ KAUSIK DATTA 18-Oct-2017

PROGRAMMING IN C++ KAUSIK DATTA 18-Oct-2017 PROGRAMMING IN C++ KAUSIK DATTA 18-Oct-2017 Objectives Recap C Differences between C and C++ IO Variable Declaration Standard Library Introduction of C++ Feature : Class Programming in C++ 2 Recap C Built

More information

Faculty of Computer Science, Operating Systems Group. The L4Re Microkernel. Adam Lackorzynski. July 2017

Faculty of Computer Science, Operating Systems Group. The L4Re Microkernel. Adam Lackorzynski. July 2017 Faculty of Computer Science, Operating Systems Group The L4Re Microkernel Adam Lackorzynski July 2017 2 Agenda Plan What is L4Re? History The L4Re Microkernel / Hypervisor Fiasco Interfaces SMP Virtualization...

More information

CS 31: Intro to Systems Pointers and Memory. Kevin Webb Swarthmore College October 2, 2018

CS 31: Intro to Systems Pointers and Memory. Kevin Webb Swarthmore College October 2, 2018 CS 31: Intro to Systems Pointers and Memory Kevin Webb Swarthmore College October 2, 2018 Overview How to reference the location of a variable in memory Where variables are placed in memory How to make

More information

Inter-Process Communication

Inter-Process Communication Faculty of Computer Science Institute for System Architecture, Operating Systems Group Inter-Process Communication Björn Döbel Dresden, So far... Microkernels Basic resources in an operating system Tasks

More information

Assist. Prof. Dr. Caner ÖZCAN

Assist. Prof. Dr. Caner ÖZCAN Assist. Prof. Dr. Caner ÖZCAN Memory Structure When a variable defined it is stored somewhere in memory. Memory can be thought as block consist of cells. When a variable defined, required number of cell

More information

IMPLEMENTATION OF SIGNAL HANDLING. CS124 Operating Systems Fall , Lecture 15

IMPLEMENTATION OF SIGNAL HANDLING. CS124 Operating Systems Fall , Lecture 15 IMPLEMENTATION OF SIGNAL HANDLING CS124 Operating Systems Fall 2017-2018, Lecture 15 2 Signal Handling UNIX operating systems allow es to register for and handle signals Provides exceptional control flow

More information

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1 Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 CPU management Roadmap Process, thread, synchronization, scheduling Memory management Virtual memory Disk

More information

Runtime Defenses against Memory Corruption

Runtime Defenses against Memory Corruption CS 380S Runtime Defenses against Memory Corruption Vitaly Shmatikov slide 1 Reading Assignment Cowan et al. Buffer overflows: Attacks and defenses for the vulnerability of the decade (DISCEX 2000). Avijit,

More information

Pentium/Linux Memory System March 17, 2005

Pentium/Linux Memory System March 17, 2005 15-213 The course that gives CMU its Zip! Topics Pentium/Linux Memory System March 17, 2005 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping 17-linuxmem.ppt

More information

Beyond Stack Smashing: Recent Advances in Exploiting. Jonathan Pincus(MSR) and Brandon Baker (MS)

Beyond Stack Smashing: Recent Advances in Exploiting. Jonathan Pincus(MSR) and Brandon Baker (MS) Beyond Stack Smashing: Recent Advances in Exploiting Buffer Overruns Jonathan Pincus(MSR) and Brandon Baker (MS) Buffer Overflows and How they Occur Buffer is a contiguous segment of memory of a fixed

More information

CNIT 127: Exploit Development. Ch 3: Shellcode. Updated

CNIT 127: Exploit Development. Ch 3: Shellcode. Updated CNIT 127: Exploit Development Ch 3: Shellcode Updated 1-30-17 Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object files strace System Call Tracer Removing

More information

Sicurezza Informatica

Sicurezza Informatica Sicurezza Informatica Lez. 2 Formato file e Assembler (II parte) Avviso Causa sovrapposizione orario lezione con Consiglio di Dipartimento si propone di anticipare la lezione del 14/10 al 13/10 aula ALFA

More information

SPU Application Binary Interface Specification. Version 1.3

SPU Application Binary Interface Specification. Version 1.3 SPU Application Binary Interface Specification Version 1.3 CBEA JSRE Series Cell Broadband Engine Architecture Joint Software Reference Environment Series August 1, 2005 Copyright International Business

More information

CS5460/6460: Operating Systems. Lecture 9: Finishing system boot, and system init. Anton Burtsev January, 2014

CS5460/6460: Operating Systems. Lecture 9: Finishing system boot, and system init. Anton Burtsev January, 2014 CS5460/6460: Operating Systems Lecture 9: Finishing system boot, and system init Anton Burtsev January, 2014 First stack Invoke first C function 9166 movl $start, %esp 9167 call bootmain xv6/bootasm.s

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

When you add a number to a pointer, that number is added, but first it is multiplied by the sizeof the type the pointer points to.

When you add a number to a pointer, that number is added, but first it is multiplied by the sizeof the type the pointer points to. Refresher When you add a number to a pointer, that number is added, but first it is multiplied by the sizeof the type the pointer points to. i.e. char *ptr1 = malloc(1); ptr1 + 1; // adds 1 to pointer

More information

Process Address Spaces and Binary Formats

Process Address Spaces and Binary Formats Process Address Spaces and Binary Formats Don Porter Background We ve talked some about processes This lecture: discuss overall virtual memory organizafon Key abstracfon: Address space We will learn about

More information