Project Hints - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Project Hints

Description:

Project Hints. 2. Project Hints. Changes to entry.S ... 2. eax register gives the system call number and is passed as a parameter to the ... – PowerPoint PPT presentation

Number of Views:113
Avg rating:3.0/5.0
Slides: 12
Provided by: marily179
Category:
Tags: hints | project

less

Transcript and Presenter's Notes

Title: Project Hints


1
Project Hints
2
Project Hints
  • Changes to entry.S1. Modify the entry.S to pass
    control a 'C' function that logs the system call
    2. eax register gives the system call number and
    is passed as a parameter to the logging
    function3. Important step - pop the passed
    parameter from stack after returning from C
    function - common reason for kernel panics
  • Getting PID1. Use of "current" pointer that
    points to task_struct of current process.. 2.
    Imp - include asm/uaccess.h and linux/sched.h to
    get the data in current pointer.
  • Writing to log fileThere has been lot of
    discussion and almost everybody on net says that
    this would be the last thing to do in kernel
    space. It was a fun and a good exercise for us to
    understand how things work in actual flow.
    http//www.cs.utexas.edu/users/ygz/378-03S/14.pd
    f  and actual browsing of the the implementation
    of write system call i.e. ( sys_write) gives a
    clear idea of all the steps that are required to
    write to file from kernel space.
  • Our ApproachSince we are linking our logger
    statically with the kernel image, we have a great
    advantage of using the implementations of these
    system calls as normal functions, Advantage of
    doing so includes     - avoids necessity of
    locking the global data structures and file
    locks    - Not required to install your file
    descriptor (fd) obtained from filp_open (not
    flip_open)    - writing using sys_write instead
    of vfs_write avoids handling for position file
    pointer. As a result, we implemented the logger
    using the standard system call implementation
    functions for sys_open, sys_write and
    sys_closeImportant Hint - You need to change the
    DS to KERNEL_DS so that kernel space buffers
    could be used to write to the file and then
    original DS should be restored after file
    operations.
  • For Module WritersWe also tried addressing the
    problems for module writers. sys_write is the
    only required function that is not exported from
    kernel and so we used vfs_write and required
    calls to write to file. ( We did not implement
    the module, but made sure that all the calls in
    our logger were exported and so could be easily
    written in module). A very nice and interesting
    article for writing to files in module could be
    found in LinuxJournal at http//www.linuxjournal.c
    om/article/8110
  • Controlling the logger To meet one of the
    important requirement of not logging all the
    system calls, we are controlling the logger with
    start and stop commands implemented using system
    calls. Log file name is passed as an argument to
    the start logging call.
  • Locks / Synchronization Though our
    implementation does not have any handling for
    synchronized access to the log file, we would
    surely expect students to do this. It was also
    part of project 2 and should not be a difficult
    task for  them.
  • TestingI have written a good and bad echo
    servers in Python - (Ubuntu's default
    installation has Python). Students can easily add
    more calls to these process to see variations.
    Bad echo server tries to connect back to client
    on some port  ( currently defined as a constant
    in the file )
  • AnalysisAnalyzer could be written in any
    language and will be user level program that will
    calculate hamming distance and according to some
    threshold generate the alarms if required. Alarm
    could as simple as a print statement )

3
Chapter 8 15 Summary
  • Filip Perich

4
Chapter 8 Main Memory
  • CPU interacts with the rest of the system through
    main memory
  • Address binding
  • Compile time, load time, execution time
  • Logical vs. physical address space
  • Hardware support
  • Dynamic loading, linking, shared libraries
  • Swapping
  • Contiguous memory allocation
  • Memory mapping, protection, MMU
  • Memory allocation
  • First, best, worst fit
  • Fragmentation
  • Internal, external
  • Frame table
  • Paging
  • Pages, page tables, page-table base register,
    translation look-aside buffer
  • Protection valid-invalid bit
  • Structure
  • Hierarchical paging

5
Chapter 9 Virtual Memory
  • Virtual memory vs physical memory vs logical
    memory
  • Virtual address space
  • Demand paging
  • Lazy swapper (pager)
  • Valid-invalid bit
  • Page fault
  • Performance
  • Page replacement algorithms
  • Basic find a victim
  • FIFO, optimal, LRU, MRU, counting algorithms
    (LFU, MFU)
  • Frame allocation and trashing
  • Fixed allocation, priority
  • Global vs. local
  • Memory-mapped files
  • Kernel memory
  • Allocating, buddy system allocator, slub
    allocator
  • Other issues
  • Prepaging, page size, TLB reach, program
    structure, I/O interlock,

6
Chapter 10 File-System Interface
  • File
  • Attributes name, id, type, location, size,
    protection, time, date, etc.
  • Operations create, write, read, reposition
    within, delete, truncate
  • Pointer, file-open count, disk location, access
    rights
  • Types
  • Structure
  • Mac resource and data fork
  • Others one pointer
  • Internal fragmentation
  • Access methods
  • Sequential vs. direct
  • Directory structure
  • Storage structure
  • Single vs. multi-level vs. tree-structured vs.
    acyclic vs. general directories
  • File-system mounting
  • File sharing
  • Multiple users, remote file systems
    (client-server, peer-to-peer)
  • Consistency semantics
  • Unix, session, immutable-shared-files semantics

7
Chapter 11 File System Impl.
  • File system structure
  • Implementation
  • Boot control block, volume control block
  • File tables
  • System vs. per-process open-file table
  • Partition, mounting, in-memory, virtual FS
  • Directory implementation
  • Allocation methods
  • Contiguous vs. linked vs. indexed allocation
  • Extent-based systems
  • Free space management
  • Caching
  • Recovery
  • Consistency check, backup, restore
  • Log-structure file systems (transactions)
  • NFS

8
Chapter 12 Mass-Storage Systems
  • Magnetic disks, magnetic tapes, stable storage,
    tertiary storage
  • Disk structure
  • Disk attachment
  • Host-attached storage, network-attached storage,
    storage-area network
  • Disk scheduling
  • FCFS, SSTF, SCAN (from one end to the other and
    back), C-SCAN, LOOK, C-LOOK
  • Disk management
  • Formatting low-level (physical), logical
    formatting, boot block, bad blocks (sector
    sparing vs. slipping)
  • Swap-space management
  • Swap-space use, location, UNIX example
  • RAID
  • Reliability via redundancy
  • Performance via parallelism
  • Levels
  • 0 non-redundant stripping
  • 1 mirrored disks
  • 2 memory-style ECC
  • 3 bit-interleaved parity
  • 4 block-interleaved parity

9
Chapter 13 I/O Systems
  • I/O Hardware
  • Port, bus, expansion bus, controller, host
    adapter, memory-mapped i/o
  • Polling vs. interrupts
  • Direct memory access
  • Application I/O interface
  • Character-stream vs. block
  • Sequential vs. random access
  • Synchronous vs. asynchronous (response times)
  • Sharable vs. dedicated
  • Speed of operation
  • Read-write, read-only, write-only
  • Blocking vs. non-blocking access
  • Clocks, timers
  • Kernel I/O subsystem
  • I/O scheduling, buffering, caching, spooling and
    device reservation, error handling, i/o
    protection, kernel data structures
  • I/O requests to hardware operations
  • Performance challenges
  • Example STREAMS

10
Chapter 14 Protection
  • Key guiding principle
  • Principle of least privilege
  • Protection Domain
  • Specifies membership
  • User, process, procedure
  • UNIX user id, user, group, everyone
  • MULTICS levels / rings
  • Rei - rules
  • Specifies access rights
  • Read, write, execute, share
  • Copy, transfer, limited copy of rights
  • Access Matrix
  • Rows access rights per domain
  • Columns access rights per object
  • Implementation
  • Global table
  • Access list for objects
  • Capability lists for domains (Hydra, Cambridge
    CAP system)
  • Lock-key mechanism

11
Chapter 15 Security
  • System is secure if
  • Its resources are used and accessed as intended
    under all circumstances
  • Threads and attacks
  • Breach of confidentiality, breach of integrity,
    breach of availability, theft of service, denial
    of service
  • Masquerading (e.g., authentication and reply
    attacks), Man-in-the-middle attack (e.g., session
    hijacking)
  • Threads
  • Program Trojan horses, trap door, logic bomb,
    stack and buffer overflow, viruses
  • Network Worms, port scanning, denial of service
  • Security measures
  • Cryptography
  • Encryption
  • Symmetric same key for encrypting and
    decrypting DES, AES
  • Asymmetric different keys PKI
  • Authentication
  • Key distribution
  • Out-of-band, key ring
  • Digital certificates
  • User authentication
  • Passwords, encrypted passwords, one-time
    passwords (paired passwords with challenges),
    biometrics
Write a Comment
User Comments (0)
About PowerShow.com