Project 6 - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Project 6

Description:

Superuser (uid 0) always has all rights (independent of ACL) ... if uid already in acl list update. if permissions == 0 erase rights for uid ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 12
Provided by: csU101
Learn more at: https://www.cs.umd.edu
Category:
Tags: acl | project

less

Transcript and Presenter's Notes

Title: Project 6


1
Project 6
  • Requires working project 5
  • Three main parts
  • Message passing
  • Input/Output redirection
  • Users/Permissions

2
Message Passing
  • Create with MessageQueueCreate(char name)
  • If no message queue with name, create
  • Otherwise, grant access to existing
  • Use existing Read/Write/Close (new filesystem
    FS_TYPE_IPC)
  • vfs.c Read example
  • If (PFAT) do what it does now
  • Else If (GOSFS) GOSFS_Read()
  • Else if (IPC) Message_Queue_Read()
  • You implement Message_Queue_Read
  • Read from empty blocks a process
  • Write to full blocks a process

3
Message Passing
  • size 4
  • Implement as circular queue

4
Input/Output Redirection
  • Change Spawn_Program(char program) to
    Spawn_Program(char program, int stdin, int
    stdout)
  • For every process file descriptor 0 is input
  • For every process file descriptor 1 is output
  • Make sure supplied file descriptors are valid

5
FS_TYPE_CONSOLE
  • Console is a new file type in vsf
  • vfs.c Read
  • If (CONSOLE) Get_Key
  • vsf.c Write
  • If (CONSOLE) Print()
  • Modify Print_String to call Write(1)
  • Allows output redirection automatically

6
Redirection Example
  • Parent process
  • int fd Open(/d/output)
  • Spawn_Program(/c/a.exe, 0, fd)
  • Close(fd)
  • Child process (a.exe)
  • Write(1, string) // writes to file fd
  • Printf(string) // writes to file fd

7
Permissions
  • Each UserContext has a new field called uid
  • Indicates user running this process
  • Superuser is uid 0
  • Used to test for GOSFS operations
  • Open checks permissions requested versus existing
  • Creating file requires write on parent directory
  • CreateDirectory requires write on parent
    directory
  • Delete requires write to access file/directory
  • SetAcl requires write access to file/directory
  • Read, Write, Seek, Stat, and Close do not check
    rights (checked in Open)
  • Superuser (uid 0) always has all rights
    (independent of ACL)
  • Used to pass permissions to spawned process
  • More on this later

8
Modifying UID
  • SetEffectiveUid(int uid)
  • Sets the uid to supplied uid for current process
  • Only sets if current user is superuser (uid 0)
  • int GetUid()
  • Returns current process uid

9
Spawn Modification
  • New elf.c can spawn a process off GOSFS drive
  • /d/a.exe will work
  • How to set spawned process uid?
  • Copy uid from parent process?
  • Some processes need more rights than parent
  • passwd command in UNIX
  • Use setUid bit in GOSFSFileNode
  • If setUid bit is 0
  • Copy uid from parent process
  • If setUid bit is 1
  • Use acl0.uid as the process uid

10
GOSFSFileNode Enhancements
  • aclEntry acl4
  • Table of aclEntries
  • Each entry contains a uid and permissions
  • acl0 is the owner
  • Set when the file/directory is created set to
    have full rights
  • setUid1
  • Indicates whether program should run with
    permissions of parent process or of file owner

11
SetAcl
  • SYS_SET_ACL
  • SetAcl(char name, int uid, int permissions)
  • Permissions can be
  • O_READ, O_WRITE, O_READ O_WRITE, 0
  • Find file by name
  • Store permissions for supplied uid
  • if uid already in acl list update
  • if permissions 0 erase rights for uid
Write a Comment
User Comments (0)
About PowerShow.com