Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
System Calls in deep
Rating: 4.1 out of 5(32 ratings)
612 students

System Calls in deep

Linux Kernel Programming - System calls
Created byLinux Trainer
Last updated 4/2021
English

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

Course content

7 sections100 lectures4h 56m total length
  • Introduction to Inline Assembly2:28

    Learn how inline assembly allows embedding assembly in C/C++ to optimize performance and access architecture-specific instructions. Discover how it enables synchronization techniques and seamless system calls.

  • Example of speed with Inline Assembly4:08
  • x86_64 Registers1:38
  • GCC Basic Assembly Example3:07

    Explore basic and extended assembly forms, demonstrate a basic example with instruction strings, and explain how volatile behavior and side effects arise from the compiler.

  • GCC Assembly Syntax5:07

    Explore gcc assembly syntax, covering move instructions with source and destination operands, register and immediate notation, in-line assembly, and memory addressing with parentheses and offsets.

  • Extended Format2:36

    Explore the extended format of assembly, detailing how indexes, operands, and multiple instructions are described and separated by colons and commas.

  • Output operand2:33
  • Constraint string8:04

    Explain how the constraint string and constant stream specify memory, control flow, and operations in a system, using assembly instructions, registers, and stores to illustrate value movement and storage.

  • Example of extended assembly2:25
  • Example of extended assembly 22:23

    Explains using constraint capabilities and constraint strings in assembly, showing how to extend the constant stream, apply context-based constraints, and predict outcomes across scenes.

  • What if i only have input operands1:59

    Learn how to handle system calls with only input operands by calling a function, reading input values, and storing the function's value in the next apcs, with two consecutive columns.

  • Debugging Inline assembly using gdb6:12
  • Inline assembly example for add,sub,mul and div2:39

    Examine an inline assembly example for add, sub, mul, and div, showing how arithmetic instructions process inputs and compute results within a deep system calls context.

  • Inline assembly example for accessing memory2:43

    See inline assembly techniques to access memory by moving values from the stack into registers and performing operations, highlighting memory and register usage in a C++ context.

  • Immediate integer operand1:49

    Explain the immediate integer operand in assembly and show three ways of accessing values, including immediate access and memory access, to illustrate how values are retrieved.

  • Example of immediate integer operand0:46

    Explore an example of an immediate integer operand within system calls, explain a media component constraint, and emphasize simple, easy-to-understand methods to study and improve value.

  • Example of printing stack pointer1:29
  • Matching constraints2:59
  • Clobberring3:04

    Learn how the C and C++ compiler treats inline assembly as opaque, and how to use clobbering to declare modified registers and memory, saving and restoring values when moving data.

  • Example of cloberring3:13
  • Special specifiers in clobbering section3:49
  • Immediate I1:10

    Examine how 64-bit configurations affect constraints and numerical calculations, and how smaller companies capitalize on these patterns in deep system call contexts.

  • More constraints0:56
  • More Example of Inline Assembly2:30

    Explore more examples of inline assembly, manipulating local variables and operands, and observe how compiler behavior shapes value moves and expected outcomes.

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