previous next 06/18/2000shanghai jiaotong univ. computer science & engineering dept. c+j...

22
06/18/ 2000 Shanghai Jiaotong Univ. Computer Science & En gineering Dept. Previo us Next C+J Software C+J Software Architecture Architecture Shanghai Jiaotong University Shanghai Jiaotong University Author: Author: Lu, Fei Lu, Fei Advisor: Yu, Yong Advisor: Yu, Yong

Upload: geoffrey-noel-simpson

Post on 26-Dec-2015

221 views

Category:

Documents


1 download

TRANSCRIPT

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

C+J Software ArchitectureC+J Software Architecture

Shanghai Jiaotong UniversityShanghai Jiaotong University

Author: Author: Lu, FeiLu, Fei

Advisor: Yu, Yong Advisor: Yu, Yong

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Motivation

C+J portable library

Distribution and Execution Mechanism

Contribution and future work

Table of ContentsTable of Contents

C+J Software ArchitectureC+J Software Architecture

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

RRuntime overhead is untime overhead is significant even using significant even using JITJIT

Space efficiency Space efficiency degrades greatly when degrades greatly when heap allocations is heap allocations is universal and frequentuniversal and frequent

Heap allocation is slower Heap allocation is slower than stack allocation by than stack allocation by two significant orderstwo significant orders 0%

20%

40%

60%

80%

100%

1 5 9 13 17 21 25 29 33 37 41

ReferenceOverhead %

Objectoverhead %

Space in Use %

Motivation

Shortfalls of Java ArchitectureShortfalls of Java Architecture

16 bytes 32 bytes

Space for Reference

4 bytesSpace for Object (20 bytes)

Space efficiency as individual object size(X-axis) grows assuming there are no memory fragments, which is in an ideal case

Heapallocations allocate more space than you want (see malloc.c)

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

DDigital signature on igital signature on ActiveX ActiveX only guarantees only guarantees its source, not its runtime security;its source, not its runtime security; ActiveX ActiveX does not work on other platforms.does not work on other platforms.

Need a more general and flexible architecture Need a more general and flexible architecture while maintaining high performancewhile maintaining high performance

Motivation

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Advantages of C+J libraryAdvantages of C+J library

C+J applications can run on different OS without recompilation

C+J applets can run in Web browsers

High performance, suitable for less powerful mobile devices

C++ is the most widely used programming language

C+J library is well designed; it has two layers in order to be portable

C+J portable library

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Structure of C+J Library

C+J portable library

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Usage: C+J compared with Java

Java package vs. C++ namespace

Class and Interface

Exception

Keyword: synchronized

C+J portable library

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Java package vs. C++ namespace

cpp - cpp::lang

- cpp::awt

- cpp::awt::Graphics

- ...

- cpp::io

- cpp::net

cpp::util

java - java.lang

- java.awt

- java.awt.Graphics

- ...

- java.io

- java.net

java.util

C+J portable library

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

interface Shape{public int getArea();public void draw();

}

class Rect implements Shape{...public int getArea(){

return a*b;};public void draw(){

...};

}

class Shape{public:

virtual int getArea()=0;virtual void draw()=0;

};class Rect : public Shape,

public Object{public:...

virtual int getArea();virtual void draw();

...};int Rect::getArea(){

return a*b;}void Rect::draw(){

...}...

C+J portable library

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

#define throws(Exception) // trick: I currently define it to be emptyclass Socket : public Object {

Socket(char* host, int port) throws(UnknownHostException | IOException);… // this annotation can be utilized by pre-processor

};

Socket(char* host, int port) throw (UnknownHostException, IOException);

ANSI C++ standard usage

C+J portable library

Exception

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Keyword synchronized

Function(){ ... synchronized(Obj){ ... } ...}

Function(){ ... { Synchronize belowWith(Obj); ... } ...}

Using Java Using C+J lib

C+J portable library

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Flexible Distribution Format

Share binaries among different operating systems

Can be compiled into intermediate code

Distribution & Execution Mechanism

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Share executable of local application

C+J Application

C+J Dynamic Link LibFor Windows

x86

Abstract layer for OS

Distribution & Execution Mechanism

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

C+J Application

C+J Dynamic Link LibFor Linux

x86

Distribution & Execution Mechanism

Share executable of local application

Abstract layer for OS

Same binary

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Compile to Intermediate Code

Source Code

IntermediateCode

compile

Download

Translator

NativeMachine

code

Finalexecutable

Insert SFI

protection

Client Browser

Distribution & Execution Mechanism

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Software-based Fault Isolation(SFI)

Security issues in machine instruction level

Privileged Instructions

Memory Access

Control Flow

Solutions :Static check for instruction and immediate address

Runtime protection(code inserted )

Runtime Overhead: about 10%

R/W/Jump address

AND, OR operations

Control Flow restricted in

protected region

Distribution & Execution Mechanism

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Hidden Execution Sequence Attack

call ebx

Hidden Execution Sequence

Normal Execution Sequence

Hidden JMP instruction, jump out of restricted

region

Distribution & Execution Mechanism

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

SFI on x86

No need to reserve 5 registers

No need to use hash table to verify the correctness of function entry

No need for stack extension

call ebxf1:

ret

ret_id

func_id

Globle Table 1: ret_id ->address

Distribution & Execution Mechanism

Globle Table 2: func_id ->address

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Runtime overhead: C+J Applet vs Java Applet

C+J Dynamic Lib

C+J Applet

Time:100%(no overhead)

Space:100%(no

overhead)

Time:110% (SFI overhead)

Space:100% (no overhead) Java class library

Time:???%

Space:300%-400% +

Java AppletTime:???%

Space:300%-400% +

C+J Applet

Distribution & Execution Mechanism

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Contribution

Clean C+J library designC+J core library developmentInnovative cross-platform Architecture

Share binaries among OSes, cross-platform developmentRun C+J Applet in Web browser

A new SFI approach for CISC processors

Conclusion

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

Future

Conclusion

Provides an ideal software architecture for mobile devices

High performance

Cross-platform development

Flexible cross-platform distribution

06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.Previous Next

The End

C+J Based Software ArchitectureC+J Based Software Architecture

Thank you