Udemy
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Development
Web Development Data Science Mobile Development Programming Languages Game Development Database Design & Development Software Testing Software Engineering Development Tools No-Code Development
Business
Entrepreneurship Communications Management Sales Business Strategy Operations Project Management Business Law Business Analytics & Intelligence Human Resources Industry E-Commerce Media Real Estate Other Business
Finance & Accounting
Accounting & Bookkeeping Compliance Cryptocurrency & Blockchain Economics Finance Finance Cert & Exam Prep Financial Modeling & Analysis Investing & Trading Money Management Tools Taxes Other Finance & Accounting
IT & Software
IT Certification Network & Security Hardware Operating Systems Other IT & Software
Office Productivity
Microsoft Apple Google SAP Oracle Other Office Productivity
Personal Development
Personal Transformation Personal Productivity Leadership Career Development Parenting & Relationships Happiness Esoteric Practices Religion & Spirituality Personal Brand Building Creativity Influence Self Esteem & Confidence Stress Management Memory & Study Skills Motivation Other Personal Development
Design
Web Design Graphic Design & Illustration Design Tools User Experience Design Game Design Design Thinking 3D & Animation Fashion Design Architectural Design Interior Design Other Design
Marketing
Digital Marketing Search Engine Optimization Social Media Marketing Branding Marketing Fundamentals Marketing Analytics & Automation Public Relations Advertising Video & Mobile Marketing Content Marketing Growth Hacking Affiliate Marketing Product Marketing Other Marketing
Lifestyle
Arts & Crafts Beauty & Makeup Esoteric Practices Food & Beverage Gaming Home Improvement Pet Care & Training Travel Other Lifestyle
Photography & Video
Digital Photography Photography Portrait Photography Photography Tools Commercial Photography Video Design Other Photography & Video
Health & Fitness
Fitness General Health Sports Nutrition Yoga Mental Health Dieting Self Defense Safety & First Aid Dance Meditation Other Health & Fitness
Music
Instruments Music Production Music Fundamentals Vocal Music Techniques Music Software Other Music
Teaching & Academics
Engineering Humanities Math Science Online Education Social Science Language Teacher Training Test Prep Other Teaching & Academics
AWS Certification Microsoft Certification AWS Certified Solutions Architect - Associate AWS Certified Cloud Practitioner CompTIA A+ Cisco CCNA Amazon AWS CompTIA Security+ Microsoft AZ-900
Graphic Design Photoshop Adobe Illustrator Drawing Digital Painting InDesign Character Design Canva Figure Drawing
Life Coach Training Neuro-Linguistic Programming Personal Development Mindfulness Personal Transformation Life Purpose Meditation CBT Emotional Intelligence
Web Development JavaScript React CSS Angular PHP Node.Js WordPress Vue JS
Google Flutter Android Development iOS Development React Native Swift Dart Programming Language Mobile Development Kotlin SwiftUI
Digital Marketing Google Ads (Adwords) Social Media Marketing Google Ads (AdWords) Certification Marketing Strategy Internet Marketing YouTube Marketing Email Marketing Retargeting
Microsoft Power BI SQL Tableau Business Analysis Data Modeling Business Intelligence MySQL Data Analysis Blockchain
Business Fundamentals Entrepreneurship Fundamentals Business Strategy Business Plan Startup Online Business Freelancing Blogging Home Business
Unity Game Development Fundamentals Unreal Engine C# 3D Game Development C++ 2D Game Development Unreal Engine Blueprints Blender
30-Day Money-Back Guarantee
IT & Software Operating Systems Linux Kernel

System Calls in deep

Linux Kernel Programming - System calls
Rating: 3.4 out of 53.4 (3 ratings)
47 students
Created by Linux Trainer
Last updated 12/2020
English
30-Day Money-Back Guarantee

What you'll learn

  • Basics of Inline Assembly
  • Writing examples for Inline Assembly
  • Various places where inline assembly is used
  • Adding a new system call to kernel
  • Updating system call table
  • VDSO and Virtual System Calls

Requirements

  • Should have a basic understanding of Linux Kernel modules
  • C language

Description

What will you learn from this course?

  • Basics of Inline Assembly

  • Types of Inline Assembly: Basic and Extended

  • GCC Assembly Syntax: AT&T

  • Constraint strings

  • Input and output operands

  • Clobbering

  • Various use cases of Inline assembly in Linux kernel: Interrupts, I/O Ports, Atomic operations, CPUID, Control Registers, Timestamp counters etc

  • Deep understanding of system calls: Various ways of switching from user space to kernel space (int $0x80, sysenter/sysexit, syscall/sysret)

  • VDSO

  • Adding a new system call which doesn't accept any arguments

  • Adding a system call which accept argument

  • Kernel Symbols and Kernel Symbol table

  • Writing a kernel module which overwrite the kernel symbol table

  • Writing a kernel module which sniffs the parameters passed to a system call

Examples covered in this course:

  • Add two numbers in inline assembly

  • Add three numbers in inline assembly

  • Subtract, divide, multiply in inline assembly

  • Can we disable/enable interrupts in user space

  • Checking whether interrupts are enabled and disabled in user space

  • Enabling/Disabling interrupts in user space

  • Implementing simple locking to avoid race conditions: Lock prefix, compare and exchange instructions

  • And many

Who this course is for:

  • Linux Kernel Developers interested in gaining deep knowledge on how system call works

Course content

6 sections • 99 lectures • 4h 56m total length

  • Preview02:28
  • Preview04:08
  • Preview01:38
  • GCC Basic Assembly Example
    03:07
  • GCC Assembly Syntax
    05:07
  • Preview02:36
  • Preview02:33
  • Constraint string
    08:04
  • Example of extended assembly
    02:25
  • Preview02:23
  • What if i only have input operands
    01:59
  • Debugging Inline assembly using gdb
    06:12
  • Inline assembly example for add,sub,mul and div
    02:39
  • Inline assembly example for accessing memory
    02:43
  • Immediate integer operand
    01:49
  • Example of immediate integer operand
    00:46
  • Example of printing stack pointer
    01:29
  • Matching constraints
    02:59
  • Clobberring
    03:04
  • Example of cloberring
    03:13
  • Special specifiers in clobbering section
    03:49
  • Immediate I
    01:10
  • More constraints
    00:56
  • More Example of Inline Assembly
    02:30

  • Implementation of enable and disable interrupt
    03:55
  • Implementation of irqs_disabled()
    03:05
  • Implementation of saving and restore flags
    02:54
  • Can we read EFLAGS register from userspace
    01:30
  • Can we enable disable interrupts from userspace
    01:47
  • Will cli disable interrupts on other processors
    01:18
  • Halt Instruction
    01:25
  • Instructions for accessing I/O Ports
    04:03
  • iopl
    01:06
  • What happens to flag register when we call iopl
    01:12
  • Enabling and disabling interrupts from userspace
    02:05
  • Atomic operations
    02:57
  • Atomic Increment and decrement
    02:26
  • Example and solution of race condition
    03:25
  • Locking technique for multiple instructions
    05:44
  • CPUID
    03:01
  • Processor Info and Feature bits
    04:06
  • Reading Timestamp counter
    04:31
  • Control Register 0
    03:03
  • Control Registers in Oops
    01:24
  • MSR
    03:42
  • CPU_RELAX
    01:24

  • What is System call
    01:25
  • What happens inside a system call
    01:32
  • Why do we need system calls
    01:23
  • Current Privilege Level
    03:37
  • Difference between system call and function call
    01:16
  • System call number and system call table
    02:53
  • Passing Parameters
    02:38
  • int $0x80
    03:58
  • entry_INT80_32
    02:13
  • Example of int $0x80
    02:19
  • Problem with int $0x80
    01:11
  • Fast System calls
    01:19
  • Sysenter and sysexit
    03:50
  • kernel_vsyscall
    06:58
  • ELF Auxiliary Vectors
    05:54
  • kernel_vsyscall from inline assembly
    04:01
  • 64-bit fast system calls
    03:25
  • dump_stack in module init
    01:03
  • syscall instruction from inline assembly
    01:05
  • How system call is executed in other architectures
    01:17
  • Return value of system call
    02:54
  • syscall library function
    03:00
  • What happens when we pass a system call number which is not implemented
    01:18

  • Introduction to VDSO
    02:35
  • Example of VDSO
    02:43
  • strace on vdso
    00:55
  • Where is linux-vdso.so present
    00:40
  • vsyscalls
    02:09

  • SYSCALL_DEFINEn
    03:40
  • Example of SYSCALL_DEFINEn
    03:13
  • asmlinkage
    02:45
  • How userspace reaches sys_read
    01:52
  • Adding a new system call
    10:53
  • Return value of system calls
    01:06
  • Adding a system call accepting argument
    11:55
  • What happens if i pass a different type of argument
    01:19
  • Generic System call table
    02:13
  • What happens when we compile user space app for 32 bit
    06:16
  • How is ia32_sys_hello map to x64_sys_hello
    02:04
  • System call Table
    04:52
  • Compatibility System calls
    01:29

  • Kernel Symbols and Kernel Symbol table
    01:54
  • How do you find out whether a function is static or global
    02:14
  • A peek inside LKM
    04:50
  • kallsyms_lookup_name
    02:37
  • Dynamically find the address at which the kernel is loaded
    03:15
  • kallsyms_on_each_symbol
    03:10
  • Finding the size of kernel function
    02:18
  • Use function pointer returned by kallsysms_lookup_name
    02:18
  • Can we access non exported symbols
    03:19
  • Can we update symbol address
    03:14
  • Updating system call table
    09:50
  • Access the parameters passed to system call
    04:23

Instructor

Linux Trainer
Trainer at Linux Weekend Learning
Linux Trainer
  • 4.1 Instructor Rating
  • 560 Reviews
  • 7,563 Students
  • 17 Courses

I have been working on Linux for more than 7 years. I have seen many people still lack their skills on Linux. So, i am working on courses for Linux which will make them Learn Linux in an easy way. The agenda of my courses will be more practical and less theoretical. Show more examples and you will easily grab the concepts.

Order of Learning

1. Learn Linux User Space Debugging

2. Learn Linux Kernel Programming

3. Character Device Drivers in Deep

4. Memory management in Linux Kernel

5. Synchronization in Linux Kernel Programming

6. Linux Kernel Development Model and Compilation

7. Linux Device Drivers - Communicating with Hardware

8. Interrupts and Bottom Halves in Linux Kernel

9. System calls in deep

10. Timing Subsystem in deep

11. Embedded Linux using Yocto

12. Embedded Linux using Yocto Part 2

13. Embedded Linux using Yocto Part 3

14. Embedded Linux using Yocto Part 4

15. Testing Linux Kernel

16. Debugging Linux kernel in deep - Part 1

17. Debugging Linux kernel in deep - Part 2

  • Udemy for Business
  • Teach on Udemy
  • Get the app
  • About us
  • Contact us
  • Careers
  • Blog
  • Help and Support
  • Affiliate
  • Impressum Kontakt
  • Terms
  • Privacy policy
  • Cookie settings
  • Sitemap
  • Featured courses
Udemy
© 2021 Udemy, Inc.