Capability-Based Addressing Is Course, to Some Scheme for Preserving the Integrity of the Discussed
Total Page:16
File Type:pdf, Size:1020Kb
Introduction The idea of a capability which acts like a ticket au- thorizing the use of some object was developed by Dennis and Van Horn [15] as a generalization of ad- dressing and protection schemes such as the codewords of the Rice computer [28], the descriptors of the Bur- roughs machines [6, 7], and the segment and page tables Capability-Based in computers such as the GE-645 and IBM 360/67 [1, 14]. Dennis and Van Horn extended the earlier schemes to Addressing include not just memory but all systems objects--mem- R.S. Fabry ory, processes, input/output devices, and so on--and to University of California. allow the explicit manipulation of access control by non- system programs. The idea is that a capability is a special kind of address for an object, that these addresses can be created only by the system, and that, in order to use any object, one must address it via one of these addresses. The use of capabilities as a protection mechanism has been the subject of considerable interest [24, 29, 32, 43]. It is assumed that the reader is familiar with the use of capabilities for protection; a different aspect of capa- Various addressing schemes making use of segment bilities is developed here. tables are examined. The inadequacies of these schemes It is argued below that there is an advantage in using when dealing with shared addresses are explained. These capabilities as a basic component of the address of every inadequacies are traced to the lack of an efficient absolute object (except for objects associated with the processor address for objects in these systems. The direct use of a such as its registers). In order to accomplish this, user capability as an address is shown to overcome these programs must be able to store capabilities freely into difficulties because it provides the needed absolute ad- various permanent user data structures (subject, of dress. Implementation of capability-based addressing is course, to some scheme for preserving the integrity of the discussed. It is predicted that the use of tags to identify representation of capabilities). Not all schemes which capabilities will dominate. A hardware address translation use capabilities actually allow capabilities to be used as scheme which never requires the modification of the permanent addresses in this way. For example, the representation of capabilities is suggested. The scheme original Dennis and Van Horn scheme did not because uses a main memory hash table for obtaining a segment's it insisted that capabilities be stored only in C-lists asso- location in main memory given its unique code. The hash ciated with computations. table is avoided for recently accessed segments by means of a set of associative registers. A computer using capa- bility-based addressing may be substantially superior to Context-Independent Addresses present systems on the basis of protection, simplicity of programming conventions, and efficient implementation. The advantage of a capability used as an address is Key Words and Phrases: addressing, capabilities, that its interpretation is context independent. It provides addressing hardware, protection, protection hardware, an absolute address for an object. This fact is more im- shared addresses, information sharing, operating systems, portant than it may at first appear. computer utility, segmentation, tagged architecture Before the use of address relocation--such as base CR Categories: 4.30, 4.32, 4.34, 6.21 and limit registers, paging, and segmentation--jobs were allocated fixed areas of physical memory. Addresses within the jobs were relocated at load time, and a job was not moved once it had started running. The lack of Copyright (~) 1974, Association for Computing Machinery, Inc. the ability to dynamically relocate resulted in under- General permission to republish, but not for profit, all or part utilized computers. To avoid this underutilization, ad- of this material is granted provided that ACM's copyright notice is given and that reference is made to the publication, to its date dress relocation was introduced. But in doing so, a new of issue, and to the fact that reprinting privileges were granted problem was also introduced. Consider two jobs which by permission of the Association for Computing Machinery. need to interact with each other. In a system without This is a revised version of a paper presented at the Fourth ACM Symposium on Operating Systems Principles, IBM Thomas relocation, jobs share an address space and can be al- J. Watson Research Center, Yorktown Heights, New York, Oc- lowed to interact freely, sharing data structures and ad- tober 15-17, 1973, under the title "The Case for Capability-Based dresses as easily as if they were a single job. With address Computers." Author's address: Computer Science Division, Evans Hall, relocation, however, the meaning of an address becomes University of California, Berkeley, CA 94720. context dependent; each job has its own address space, 403 Communications July 1974 of Volume 17 the ACM Number 7 or perhaps several. This fact is generally interpreted as Fig. 1. Segment addresses. an advantage: base and limit registers, paging, and seg- mentation, by virtue of their address relocation, allow users to be isolated from each other, thus providing pro- ? tection of one job from another. On the other hand, the jPC sharing of addresses becomes more difficult, and this side effect is generally ignored. This effect is particulaly ironic for those systems which stress their usefulness for 1 RE I CALL 1 cooperating users who want to work together, sharing 2 programs and data. ACCESS 2 Although a capability functions as an absolute ad- SEGMENT TABLE dress, the use of capabilities does not prevent a system from using address relocation. A capability is an abso- lute address for a virtual object; the system is free to relocate the virtual object so long as it maintains the correspondence between the object and its capabilities. The Problem of Shared Segment References Various addressing schemes making use of segment tables have been implemented in present day systems. Fig. 2. Shared segment addresses. Although the inadequacies of these schemes when deal- ing with shared segment addresses may be apparent to users of the systems, the inadequacies have not (with rare exception) been explained in sysfem descriptions, nor does there exist a systematic comparison of the F problems which arise with each of the schemes. As an example of the problems encountered in these systems, consider a particular structure, a set of inter- acting subprograms. Figure 1 shows a process which has three segments: a data segment, a main program, and a I CALL ? ACCESS ? subroutine. The segment table translates integer segment addresses into references to the appropriate segments SEGMENTTABLE I FOR PROCESS1 and specifies the permitted types of access. R means reading is allowed, W means writing is allowed, and E SUB means executing is allowed. The entries in the segment table can be thought of as descriptors, capabilities, code- words, or pointers; for our purposes these are the same. The main program in Figure 1 contains two segment references, a call on the subroutine, coded as CALL 1, and RE an access of the data segment, coded as ACCESS 2. The RW PC register associated with the process contains the seg- ment number of the segment which the program counter addresses. In an actual system, the location of a word SEGMENTTABLE within a segment is also important. For simplicity, the FOR PROCESS2 word number components of addresses are omitted. Figure 2 shows the case in which the program and the segment references which it contains are shared. As- sume for the moment that the correspondence between integers and segments is constructed independently for each process. Then, as in the figure, a segment may be referred to by different integers in different processes. How can the segment references in the shared main pro- gram be coded? For process 1, the references should be coded CALL 1 and ACCESS 2. For process 2, however, they should be coded CALL 0 and ACCESS 1. Four different solutions to this problem of shared segment references are presented below. 404 Communications July 1974 of Volume 17 the ACM Number 7 Fig. 3. Uniform address solution. Fig. 4. Indirect evaluation solution. LINKAGE SEGMENT FOR PROCESS I 0 RW DATA FOR FOR MAIN I RE 2 RE ] LINKAGE SEGMENT l FOR PROCESS I 4 , R FOR SUB 2 I ACCEBS21 SEGMENT TABLE FOR PROCESS SEGMENT TABLE FOR PROCESS l LINKAGE SEGMENT FOR PROCESS 2 FOR MAIN OR 1 R l RE 0 2E LINKAGE SEGMENT 3 RE 2 FOR PROCESS 2 FOR SUB 4 RW SEGMENT TABLE FOR PROCESS 2 SEGMENT TABLE FOR PROCESS 2 Uniform Address Solution at once (except for certain standard system-wide sub- The uniform address solution is shown in Figure 3. routines). Thus the compiler can allocate the integer This solution requires that a shared integer segment ad- segment addresses at compile time and embed them in dress be interpreted in a functionally equivalent manner the code. The Program Reference Table of the B5700 for all processes sharing the address. A shared address functions exactly as the segment table in Figure 3 does is said to receive a functionally equivalent interpretation [6, 7, 351. for a set of processes if the objects referred to by the address are used in the same way by each process. For Indirect Evaluation Solution example, in Figure 3, the segment address 2 refers to the The indirect evaluation solution is shown in Figure 4. data segment used by the process making the reference, A shared integer segment address is treated as an index while the segment address 1 refers to the segment con- of a position within a linkage segment and the linkage taining the subroutine called by the main program in a segment contains segment table indexes.