The processes in an operating system must be protected from one another’s



tải về 252.86 Kb.
Chế độ xem pdf
trang27/34
Chuyển đổi dữ liệu13.12.2022
Kích252.86 Kb.
#53970
1   ...   23   24   25   26   27   28   29   30   ...   34
Abraham Silberschatz-Operating System Concepts (9th,2012.12)-trang-649-679

URL
loader
protection domain, which is
permitted to
open()
sessions to sites in the
lucent.com
domain, in particular
a proxy server
proxy.lucent.com
for retrieving
URL
s. For this reason, the
untrusted applet’s
get()
invocation will succeed: the
checkPermissions()
call in the networking library encounters the stack frame of the
get()
method, which performed its
open()
in a
doPrivileged
block. However,
the untrusted applet’s
open()
invocation will result in an exception, because
the
checkPermissions()
call finds no
doPrivileged
annotation before
encountering the stack frame of the
gui()
method.


14.10
Summary
649
untrusted
applet
protection
domain:
socket
permission:
class:
none
gui:

get(url);
open(addr);

networking
any
open(Addr a):

checkPermission
(a, connect);
connect (a);

get(URL u):

doPrivileged {
open(‘proxy.lucent.com:80’);
}
(request u from proxy)

*.lucent.com:80, connect
URL loader
Figure 14.9 Stack inspection.
Of course, for stack inspection to work, a program must be unable to
modify the annotations on its own stack frame or to otherwise manipulate
stack inspection. This is one of the most important differences between Java
and many other languages (including C++). A Java program cannot directly
access memory; it can manipulate only an object for which it has a reference.
References cannot be forged, and manipulations are made only through well-
defined interfaces. Compliance is enforced through a sophisticated collection of
load-time and run-time checks. As a result, an object cannot manipulate its run-
time stack, because it cannot get a reference to the stack or other components
of the protection system.
More generally, Java’s load-time and run-time checks enforce
type safety
of
Java classes. Type safety ensures that classes cannot treat integers as pointers,
write past the end of an array, or otherwise access memory in arbitrary ways.
Rather, a program can access an object only via the methods defined on that
object by its class. This is the foundation of Java protection, since it enables a
class to effectively
encapsulate
and protect its data and methods from other
classes loaded in the same
JVM
. For example, a variable can be defined as
private
so that only the class that contains it can access it or
protected
so
that it can be accessed only by the class that contains it, subclasses of that class,
or classes in the same package. Type safety ensures that these restrictions can
be enforced.
14.10
Summary
Computer systems contain many objects, and they need to be protected from
misuse. Objects may be hardware (such as memory,
CPU
time, and
I/O
devices)
or software (such as files, programs, and semaphores). An access right is
permission to perform an operation on an object. A domain is a set of access
rights. Processes execute in domains and may use any of the access rights in
the domain to access and manipulate objects. During its lifetime, a process may
be either bound to a protection domain or allowed to switch from one domain
to another.



tải về 252.86 Kb.

Chia sẻ với bạn bè của bạn:
1   ...   23   24   25   26   27   28   29   30   ...   34




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương