Pranav Ram Joshi's Technical Notes and Documentation

website·Indexed 29 days ago

https://www.pranavramjoshi.me

A collection of personal reference notes, exercise solutions, and project work focused on low-level programming, C programming fundamentals, and UNIX network programming. The documentation covers topics such as kernel observability, BPF packet capture, OSI model internetworking, TTY line discipline, and system-level concepts like virtual memory management and use-after-free vulnerabilities.

Tokens
66.2K
Snippets
296
Records
505
Agent score
48%

What's inside Pranav Ram Joshi

  1. Overview of XNU Kernel Architecture

    XNU is the kernel used by the Darwin operating system (the basis for macOS and iOS). It is a hybrid kernel that incorporates the Mach microkernel and a BSD layer. While Mach provides fundamental low-level functionalities such as memory management, CPU scheduling, and inter-process communication (IPC), the BSD layer provides the higher-level interfaces common to operating systems. In the XNU source tree, Mach-specific components are located in the osfmk/ directory, and BSD kernel components are located in the bsd/ directory.
  2. Overview of GNU Autotools components

    GNU Autotools is a suite of programs used to configure projects based on the target system's capabilities and generate Makefiles. The primary tools include:

    • autoconf: Generates the configure shell script.
    • automake: Generates Makefile.in files from Makefile.am.
    • aclocal: Scans configure.ac to generate aclocal.m4.
    • autoheader: Creates a template header for the configure script.
    • libtool: Provides generalized library-building support.
    • autoreconf: Updates generated configuration files.
    • autoscan: Scans the project directory to suggest useful macros for portability.
  3. Overview of Classic BPF (cBPF) vs eBPF

    Classic BPF (cBPF) is an instruction set specifically designed for packet filtering. It uses a Control Flow Graph (CFG) model, which maps naturally to register machines. This is distinct from extended BPF (eBPF), which is a more recent, general-purpose evolution that allows the Linux kernel to run mini-programs on various system and application events (e.g., disk I/O) beyond just packet filtering.
  4. Overview of Kerberos Authentication System

    Kerberos is a trusted third-party authentication service designed to provide secure identification in environments where workstations are not considered trustworthy. It ensures that users identify themselves to services without sending passwords in cleartext across the network.

    Key security guidelines followed by Kerberos:

    • Single Sign-On: Users identify themselves once at the start of a workstation session (typically via the UNIX login command).
    • Encryption: Passwords are never sent or stored in cleartext; they are always encrypted.
    • Password Management: Every user and every service has a password. Only the central authentication server knows all passwords and is kept under strict physical security.
  5. Overview of the OSI Model layers

    The OSI (Open Systems Interconnection) model organizes network communication protocols into seven layers to manage complexity. The layers, from highest to lowest, are: 7. Application 6. Presentation 5. Session 4. Transport 3. Network 2. Data Link

    1. Physical
            +--------------+  
          7 | Application  |
            +--------------+  
          6 | Presentation |
            +--------------+  
          5 | Session      |
            +--------------+  
          4 | Transport    |
            +--------------+  
          3 | Network      |
            +--------------+  
          2 | Data Link    |
            +--------------+  
          1 | Physical     |
            +--------------+  
  6. Understand the difference between Packet Capture and Packet Filtering

    Packet filtering and packet capture are distinct concepts:

    • Packet Filtering: The process of deciding whether a packet should be sent to userspace or discarded based on a set of rules (effectively a boolean function where true = copy to application, false = ignore).
    • Packet Capture: Uses the mechanism of packet filtering for the purpose of logging network traffic.
  7. Understand network types and scales

    Computer networks are categorized by their geographic scale and purpose:

    • LAN (Local Area Network): Connects systems close together (e.g., within a building). Common technologies include Ethernet, Token Ring, and FDDI. High speeds (10 Mbps to 100 Mbps).
    • MAN (Metropolitan Area Network): Covers a city or metropolitan area. Often uses coaxial cable or microwave and operates at LAN speeds.
    • WAN (Wide Area Network / Long Haul Network): Connects computers across different cities or countries. Often uses leased telephone lines (9600 bps to 1.544 Mbps).
    • Internet (Internetwork): The connection of two or more distinct networks to allow communication between hosts on different networks, hiding the physical differences to function as a coordinated unit.
  8. Understand the C compilation pipeline

    The transformation of a C source file into an executable follows a four-stage pipeline:

    1. Preprocessor: Processes directives (e.g., #include, #define) and produces modified C code (typically a .i file).
    2. Compiler: Translates the preprocessed C code into assembly code (typically a .s file).
    3. Assembler: Converts assembly code into object code (typically a .o file).
    4. Linker: Arranges object files, resolves missing symbols, and conforms to the system's Application Binary Interface (ABI) to produce the final executable (e.g., a.out).
    Source file -> C preprocessor (.i) -> Compiler (.s) -> Assembler (.o) -> Linker -> Executable
  9. Use fixed-width integer types via stdint.h

    For precise control over integer widths across different platforms, use the <stdint.h> header introduced in C99. This provides fixed-width integer types that ensure the same bit-width regardless of the architecture.
    #include <stdint.h>
    // Use types like int32_t, uint64_t, etc.
  10. Implement client-server data transfer using shared memory and semaphores

    To transfer data from an input file to an output file using a client-server architecture with shared memory, follow this workflow:

    1. The server acquires access to a shared memory segment using a semaphore.
    2. The server reads data from the input file directly into the shared memory segment (the second argument of the read system call points to the shared memory address).
    3. Once the read is complete, the server notifies the client via a semaphore.
    4. The client reads the data from the shared memory segment and writes it to the output file.
  11. Understand UNIX terminal (TTY) device characteristics

    In UNIX-like systems, a terminal is a character special device managed by the kernel via a dedicated tty device driver. These devices are located in the /dev directory. They provide the standard I/O streams for programs executed interactively through a shell. Programmatic control of these devices is typically handled via ioctl(2) commands (e.g., ioctl_tty(2) on GNU/Linux) to configure terminal attributes and line discipline.