UNIT- 2 OS Security
UNIT- 2 OS Security
An active program which running now on the Operating System is known as the
process. The Process is the base of all computing things. Although process is
relatively similar to the computer code but, the method is not the same as computer
code. A process is a "active" entity, in contrast to the program, which is sometimes
thought of as some sort of "passive" entity. The properties that the process holds
include the state of the hardware, the RAM, the CPU, and other attributes.
The OS is responsible for managing the start, stop, and scheduling of processes,
which are programs running on the system. The operating system uses a number of
methods to prevent deadlocks, facilitate inter-process communication, and
synchronize processes. Efficient resource allocation, conflict-free process
execution, and optimal system performance are all guaranteed by competent
process management. This essential component of an operating system enables the
execution of numerous applications at once, enhancing system utilization and
responsiveness.
How Does a Process Look Like in Memory?
A process in memory is divided into several distinct sections, each serving a
different purpose. Here’s how a process typically looks in memory:
Text Section: A Process, sometimes known as the Text Section, also includes
the current activity represented by the value of the Program Counter.
Stack: The stack contains temporary data, such as function parameters, returns
addresses, and local variables.
Data Section: Contains the global variable.
Heap Section: Dynamically memory allocated to process during its run time.
Characteristics of a Process
A process has the following attributes.
Process Id: A unique identifier assigned by the operating system.
Process State: Can be ready, running, etc.
CPU Registers: Like the Program Counter (CPU registers must be saved and
restored when a process is swapped in and out of the CPU)
Accounts Information: Amount of CPU used for process execution, time
limits, execution ID, etc
I/O Status Information: For example, devices allocated to the process, open
files, etc
CPU Scheduling Information: For example, Priority (Different processes
may have different priorities, for example, a shorter process assigned high
priority in the shortest job first scheduling)
States of Process
A process is in one of the following states:
New: Newly Created Process (or) being-created process.
Ready: After the creation process moves to the Ready state, i.e. the process is
ready for execution.
Running: Currently running process in CPU (only one process at a time can
be under execution in a single processor).
Wait (or Block): When a process requests I/O access.
Complete (or Terminated): The process completed its execution.
Suspended Ready: When the ready queue becomes full, some processes are
moved to a suspended ready state
Suspended Block: When the waiting queue becomes full
Process Operations
Process operations in an operating system refer to the various activities the OS
performs to manage processes. These operations include process creation, process
scheduling, execution and killing the process. Here are the key process operations:
Types of Signals
SIGHUP- This signal indicates that the controlling terminal has been killed.
HUP is an abbreviation meaning “hang up.” Locate the terminal to be
controlled or hang up on the control process’s demise. This signal is obtained
when the process is performed from the terminal and that terminal abruptly
terminates.
SIGINT- This is the signal generated when a user presses Ctrl + C from the
keyboard.
SIGQUIT- This is the signal generated when a user presses Ctrl + D from the
keyboard.
SIGILL- Signal for illegal instruction. This is an exception signal provided by
the operating system to your application when it detects unlawful instruction
within your program. For example, if some code is not understandable by your
machine or if your program’s executable file is corrupted. Another possibility
is that your program loads a corrupted dynamic library.
SIGABRT- Abort signal indicates that you used the abort() API within your
program. It is used to end a program. abort() generates the SIGABRT signal,
which terminates your program (unless handled by your custom handler).
SIGFPE- Exception for floating point numbers. Another exception signal is
generated by the operating system when your program causes an exception.
SIGPIPE- Broken pipe. When there is nothing to read on the other end, write
to the pipe.
SIGCOUNT – for continue any stop signal
SIGSTOP – for stop any running signal
SIGTERM – for permanent terminating signal
Categories of Scheduling
Scheduling falls into one of two categories:
Non-Preemptive: In this case, a process’s resource cannot be taken before the
process has finished running. When a running process finishes and transitions
to a waiting state, resources are switched.
Execution
Executed in kernel mode Executed in user mode
Mode
Threats in OS
1. Virus:
An infamous threat, known most widely. It is a self-replicating and malicious
thread that attaches itself to a system file and then rapidly replicates itself,
modifying and destroying essential files leading to a system breakdown.
Further, Types of computer viruses can be described briefly as follows:
– file/parasitic – appends itself to a file
– boot/memory – infects the boot sector
– macro – written in a high-level language like VB and affects MS Office
files
– source code – searches and modifies source codes
– polymorphic – changes in copying each time
– encrypted – encrypted virus + decrypting code
– stealth – avoids detection by modifying parts of the system that can be used
to detect it, like the read system
call
– tunneling – installs itself in the interrupt service routines and device drivers
– multipartite – infects multiple parts of the system
2. Trojan Horse:
A code segment that misuses its environment is called a Trojan Horse. They
seem to be attractive and harmless cover programs but are really harmful
hidden programs that can be used as the virus carrier. In one of the versions of
Trojan, the User is fooled to enter confidential login details on an application.
Those details are stolen by a login emulator and can be further used as a way
of information breaches. One of the major as well as a serious threat or
consequences of the Trojan horse is that it will actually perform proper
damage once installed or run on the computer’s system but at first, a glance
will appear to be useful software and later turns out to be maliciously
unwanted one.
Another variance is Spyware, Spyware accompanies a program that the user
has chosen to install and download ads to display on the user’s system,
thereby creating pop-up browser windows and when certain sites are visited
by the user, it captures essential information and sends it over to the remote
server. Such attacks are also known as Convert Channels.
3. Trap Door:
The designer of a program or system might leave a hole in the software that
only he is capable of using, the Trap Door works on similar principles. Trap
Doors are quite difficult to detect as to analyze them, one needs to go through
the source code of all the components of the system. In other words, if we may
have to define a trap door then it would be like, a trap door is actually a kind
of a secret entry point into a running or static program that actually allows
anyone to gain access to any system without going through the usual security
access procedures.
4. Logic Bomb:
A program that initiates a security attack only under a specific situation. To be
very precise, a logic bomb is actually the most malicious program which is
inserted intentionally into the computer system and that is triggered or
functions when specific conditions have been met for it to work.
5. Worm:
A computer worm is a type of
malware that replicates itself and infects other computers while remaining
active on affected systems. A computer worm replicates itself in order to
infect machines that aren’t already infested. It frequently accomplishes this by
taking advantage of components of an operating system that are automatic and
unnoticed by the user. Worms are frequently overlooked until their
uncontrolled replication depletes system resources, slowing or stopping other
activities.
Types of System Threats –
Aside from the program threats, various system threats are also endangering the
security of our system:
1. Worm:
An infection program that spreads through networks. Unlike a virus, they target
mainly LANs. A computer affected by a worm attacks the target system and
writes a small program “hook” on it. This hook is further used to copy the worm
to the target computer. This process repeats recursively, and soon enough all the
systems of the LAN are affected. It uses the spawn mechanism to duplicate itself.
The worm spawns copies of itself, using up a majority of system resources and
also locking out all other processes.
Processes can coordinate and interact with one another using a method called inter-
process communication (IPC) . Through facilitating process collaboration, it
significantly contributes to improving the effectiveness, modularity, and ease of
software systems.
Types of Process
Independent process
Co-operating process
An independent process is not affected by the execution of other processes while a
co-operating process can be affected by other executing processes. Though one can
think that those processes, which are running independently, will execute very
efficiently, in reality, there are many situations when cooperative nature can be
utilized for increasing computational speed, convenience, and modularity. Inter-
process communication (IPC) is a mechanism that allows processes to communicate
with each other and synchronize their actions. The communication between these
processes can be seen as a method of cooperation between them. Processes can
communicate with each other through both:
Methods of IPC
Shared Memory
Message Passing