Context switch in Linux. Gabriel Kliot, Technion 1 Context switch in Linux OS course



Similar documents
Assembly Language: Function Calls" Jennifer Rexford!

CHAPTER 6 TASK MANAGEMENT

Buffer Overflows. Security 2011

Off-by-One exploitation tutorial

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

Under The Hood: The System Call

Systems Design & Programming Data Movement Instructions. Intel Assembly

64-Bit NASM Notes. Invoking 64-Bit NASM

Understanding a Simple Operating System

W4118 Operating Systems. Junfeng Yang

Intel 8086 architecture

The Plan Today... System Calls and API's Basics of OS design Virtual Machines

CS61: Systems Programing and Machine Organization

Abysssec Research. 1) Advisory information. 2) Vulnerable version

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z)

Return-oriented programming without returns

Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail

OS Virtualization Frank Hofmann

Stack Overflows. Mitchell Adair

W4118: segmentation and paging. Instructor: Junfeng Yang

Phoenix Technologies Ltd.

Instruction Set Architecture

Software Vulnerabilities

Chapter 1. Bootstrap. Hardware

PC Assembly Language. Paul A. Carter

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

CS:APP Chapter 4 Computer Architecture Instruction Set Architecture. CS:APP2e

Programming from the Ground Up

Introduction. What is an Operating System?

Encryption Wrapper. on OSX

TECHNICAL BULLETIN [ 1 / 5 ]

CS 695 Topics in Virtualization and Cloud Computing. More Introduction + Processor Virtualization

Operating Systems. Lecture 03. February 11, 2013

Programming from the Ground Up. Jonathan Bartlett

5. Calling conventions for different C++ compilers and operating systems

Programming from the Ground Up

Andreas Herrmann. AMD Operating System Research Center

Stitching the Gadgets On the Ineffectiveness of Coarse-Grained Control-Flow Integrity Protection

Computer Organization and Architecture

Hotpatching and the Rise of Third-Party Patches

Jorix kernel: real-time scheduling

ò Paper reading assigned for next Thursday ò Lab 2 due next Friday ò What is cooperative multitasking? ò What is preemptive multitasking?

Computer Architectures

Operating Systems II BS degree in Computer Engineering Sapienza University of Rome Lecturer: Francesco Quaglia


TODAY, FEW PROGRAMMERS USE ASSEMBLY LANGUAGE. Higher-level languages such

BUG: unable to handle kernel NULL pointer dereference at virtual address c printing eip: c01e41ee *pde = Oops: 0000 [#1] SMP Modules

>

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD

Hacking the Preboot execution Environment

Outline. Outline. Why virtualization? Why not virtualize? Today s data center. Cloud computing. Virtual resource pool

W4118 Operating Systems. Instructor: Junfeng Yang

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

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

ELEC 377. Operating Systems. Week 1 Class 3

Betriebssysteme KU Security

Intel Virtualization Technology Overview Yu Ke

«Как найти 0-day в браузере» Бажанюк

Machine-Level Programming II: Arithmetic & Control

A Tiny Guide to Programming in 32-bit x86 Assembly Language

COS 318: Operating Systems

Computer Organization and Assembly Language

For a 64-bit system. I - Presentation Of The Shellcode

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

Assembly Language Tutorial

Chapter 2. Processes. Address Spaces

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

x64 Cheat Sheet Fall 2015

The Beast is Resting in Your Memory On Return-Oriented Programming Attacks and Mitigation Techniques To appear at USENIX Security & BlackHat USA, 2014

PROGRAMMING CONCEPTS AND EMBEDDED PROGRAMMING IN C, C++ and JAVA: Lesson-4: Data Structures: Stacks

PCI BIOS SPECIFICATION. Revision 2.1

Lecture 27 C and Assembly

Computer Organization and Components

Syscall Proxying - Simulating remote execution Maximiliano Caceres <maximiliano.caceres@corest.com> Copyright 2002 CORE SECURITY TECHNOLOGIES

Visualizing gem5 via ARM DS-5 Streamline. Dam Sunwoo ARM R&D December 2012

The IA-32 processor architecture

Software Fingerprinting for Automated Malicious Code Analysis

NetVault Bare Metal Recovery (VaultDR) Supported Platforms

Embedded x86 Programming: Protected Mode

esrever gnireenigne tfosorcim seiranib

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

A Study of Performance Monitoring Unit, perf and perf_events subsystem

Attacking x86 Windows Binaries by Jump Oriented Programming

Virtualization Technologies

The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology

Intel Assembler. Project administration. Non-standard project. Project administration: Repository

Virtual Machines. COMP 3361: Operating Systems I Winter

Using fuzzing to detect security vulnerabilities

CSC 2405: Computer Systems II

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Faculty of Engineering Student Number:

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

CYRIX Cx486SLC'" MICROPROCESSOR

Transcription:

Context switch in Linux Gabriel Kliot, Technion 1 Context switch in Linux OS course

Memory layout general picture Stack Stack Stack Process X user memory Process Y user memory Process Z user memory Stack Stack Stack of CPU i Process X kernel stack and Process Y kernel stack and Process Z kernel stack and Kernel memory Gabriel Kliot, Technion 2 Context switch in Linux OS course

#1 kernel stack after any system call, before context switch Schedule() function frame Gabriel Kliot, Technion 3 Context switch in Linux OS course ss eflags cs eip orig_eax es ds eax ebp edi esi edx ecx ebx User Stack User Code Saved on the kernel stack during a transition to kernel mode by a jump to interrupt and by SAVE_ALL macro

#2 stack of before switch_to macro in schedule() func Gabriel Kliot, Technion 4 Context switch in Linux OS course

#3 switch_to: save esi, edi, ebp on the stack of Gabriel Kliot, Technion 5 Context switch in Linux OS course

#4 switch_to: save in -> Gabriel Kliot, Technion 6 Context switch in Linux OS course

#5 switch_to: load next-> into next Gabriel Kliot, Technion 7 Context switch in Linux OS course

#6 switch_to: save return address in the -> next Gabriel Kliot, Technion 8 Context switch in Linux OS course

#7 switch_to: save return address on the stack of next next Gabriel Kliot, Technion 9 Context switch in Linux OS course

#8 switch_to func: save the base of next s s stack in next Gabriel Kliot, Technion 10 Context switch in Linux OS course

#9 back in switch_to: eip points to instruction label next eip 1: Gabriel Kliot, Technion 11 Context switch in Linux OS course

#10 switch_to: restore esi, edi, ebp from the stack of next next Gabriel Kliot, Technion 12 Context switch in Linux OS course