cider - columbia universitycdall/pubs/cider-asplos-2014-clean.pdfcider : architecture cider linux...

29
ASPLOS 2014, Salt Lake City, UT March 4, 2014 Cider Native Execution of iOS Apps on Android Jeremy Andrus ([email protected]) Columbia University In the City of New York Alexander Van't Hof, Naser AlDuaij, Christoffer Dall, Nicolas Viennot, Jason Nieh 1

Upload: others

Post on 03-Jun-2020

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

ASPLOS 2014, Salt Lake City, UTMarch 4, 2014

Cider

Native Execution of iOS Apps on Android

Jeremy Andrus ([email protected])

Columbia University In the City of New York

Alexander Van't Hof, Naser AlDuaij, Christoffer Dall, Nicolas Viennot, Jason Nieh

!1

Page 2: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Page 3: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

The Goal

!3

Motivation

Page 4: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Virtualization

!4

Motivation

Page 5: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Binary Compatibility

Wine

!5

Motivation

API Reimplementation

✤ immense implementation!

✤ 20 years later: still incomplete

Page 6: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Binary Compatibility

BSD Linux Compatibility

✤ missing kernel subsystem!

✤ opaque driver interfaces

!6

Motivation

Kernel ABI Compatibility

Overview

Page 7: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Cider : OS CompatibilityMotivation

✤ Direct execution of unmodified iOS apps"✤ Reuse existing libraries"✤ Reuse existing open source kernel code"✤ iOS apps can use Android libraries

!7

Overview

Page 8: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Cider : OS CompatibilityMotivation

✤ Personas"➡ distinguish iOS and Linux threads"

✤ Duct Tape"➡ XNU code in the Linux kernel"

✤ Diplomats"➡ iOS apps use Android libraries

!8

Overview Duct Tape DiplomatsPersonas Evaluation

iOS Android

Page 9: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Overview

Cider Linux KernelMach-O Loader

XNU syscall Interface

Linux syscall Interface

!9

Cider : OS CompatibilityMotivation Duct Tape Diplomats Evaluation

iOS Android

Personas

Page 10: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Overview

Cider Linux KernelMach-O Loader

XNU syscall Interface

Linux syscall Interface

Persona Management

!10

Per-Thread PersonasMotivation Duct Tape DiplomatsPersonas Evaluation

iOS Android

Page 11: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Personas

Cider : OS CompatibilityOverview

Cider Linux KernelMach-O Loader

XNU syscall Interface

Linux syscall Interface

Persona Management

!11

Motivation Duct Tape Diplomats Evaluation

XNU Source

Mach IPC

iOS Android

Page 12: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Personas

Duct tapeOverview

Cider Linux KernelMach-O Loader

XNU syscall Interface

Linux syscall Interface

Persona Management

!12

Motivation Duct Tape Diplomats Evaluation

XNU Source

Mach IPC

Duct Tape

iOS Android

Page 13: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

XNU Source

Mach IPC

Domestic Zone

Foreign Zone

Duct Tape Zone

Duct Tape

!13

Personas

Duct tapeOverviewMotivation Duct Tape Diplomats Evaluation

iOS Android

Page 14: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

XNU Source

Mach IPC

Mach Semantics

Synchronization, List MgmtDuct Tape

Mach IPC syscall stubskmalloc,

spinlock, list…

Linux kernel"memory, synch,"

list management, etc.

!14

Personas

Duct tapeOverviewMotivation Duct Tape Diplomats Evaluation

lck_mtx_lock() ➡ mutex_lock() lck_mtx_t ➡ struct mutex

iOS Android

Page 15: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Cider"Linux"Kernel

XNU Source

Mach IPC

Mach IPC syscall stubs

Synchronization, List Mgmt

Mach Semantics

!15

Personas

Duct tapeOverviewMotivation Duct Tape Diplomats Evaluation

kmalloc, spinlock, list…

iOS Android

Page 16: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Duct Tape

Cider Linux KernelMach-O Loader

XNU Source

Mach IPC

XNU syscall Interface

Linux syscall Interface

Persona ManagementDuct Tape

!16

iOSOpenGL

Apple GPU?!

Personas

Cider : OS CompatibilityOverviewMotivation Diplomats Evaluation

iOS Android

Page 17: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Cider Linux KernelMach-O Loader

XNU Source

Mach IPC

XNU syscall Interface

Linux syscall Interface

Persona ManagementDuct Tape

!17

Android OpenGL

Duct TapePersonas

Cider : OS CompatibilityOverviewMotivation Diplomats Evaluation

ELF??

??

iOS Android

Page 18: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

??

Cider Linux KernelMach-O Loader

XNU Source

Mach IPC

XNU syscall Interface

Linux syscall Interface

Persona ManagementDuct Tape

!18

Duct TapePersonas

Cider : OS CompatibilityOverviewMotivation Diplomats Evaluation

Android OpenGL

iOS Android

Page 19: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Cider Linux KernelMach-O Loader

XNU syscall Interface

Linux syscall Interface

Persona Management

diplomats

Android Libraries

!19

Duct TapePersonas

DiplomatsOverviewMotivation Diplomats Evaluation

iOS Android

XNU Source

Mach IPC

Duct Tape

Page 20: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

DiplomatsiOS App links against

diplomats - not iOS symbols!

Cider Linux Kernel

Linux syscall Interface

diplomats

XNU syscall Interface

Android Libraries

Persona Management

aFunc()

!20

Duct TapePersonasOverviewMotivation Diplomats Evaluation

iOS Android

Page 21: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Cider : Architecture

Cider Linux KernelMach-O Loader

XNU syscall Interface

Linux syscall Interface

iOS Mach"IPC Services

…launchd

configd

Persona Management

Android Libraries

!21

Duct TapePersonasOverviewMotivation Diplomats Evaluation

diplomats

iOS Android

XNU Source

Mach IPC

Duct Tape

Page 22: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Diplomats

Cider: Prototype

!22

✤ Nexus 7 (Tegra)"➡ Integrated iOS app

launch

Duct TapePersonasOverviewMotivation Evaluation

iOS Apps!

Android Apps!

Page 23: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Diplomats

Cider: Prototype

!23

✤ Nexus 7 (Tegra)"➡ Full multi-touch

support"➡ OpenGL for 2D/3D

graphics

Duct TapePersonasOverviewMotivation Evaluation

Page 24: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

Diplomats

Cider: Experimental Results

!24

✤ PassMark benchmark application"✤ Android App"

➡ Stock Nexus 7"➡ Cider"

✤ iOS App"➡ Cider"➡ iPad mini

Duct TapePersonasOverviewMotivation Evaluation

Page 25: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus !25

Cider: Experimental ResultsPassMark Benchmark

0!

1!

2!

3!

4!0!

5!

10!

15!

20!

Integer!

Floating Point!

Find Primes!

Random St

ring So

rt!

Data Encry

ption!

Data C

ompressio

n!

Storag

e Writ

e!

Storag

e Rea

d!

Memory W

rite!

Memory Rea

d!

Cider Android! Cider iOS! iOS!

DiplomatsDuct TapePersonasOverviewMotivation Evaluation

Norm

alized Performance

Nor

mal

ized

Per

form

ance

Page 26: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

0.0!

0.5!

1.0!

1.5!

2.0!

Solid

Vectors!

Transp

arent V

ectors!

Complex Vect

ors!

Imag

e Ren

dering!

Imag

e Filte

rs!

Simple

3D Te

st!

Complex 3D

Test!

Cider Android! Cider iOS! iOS!

Cider: Experimental ResultsPassMark Benchmark

0!

1!

2!

3!

4!0!

5!

10!

15!

20!

Integer!

Floating Point!

Find Primes!

Random St

ring So

rt!

Data Encry

ption!

Data C

ompressio

n!

Storag

e Writ

e!

Storag

e Rea

d!

Memory W

rite!

Memory Rea

d!

Cider Android! Cider iOS! iOS!

54

DiplomatsDuct TapePersonasOverviewMotivation Evaluation

Page 27: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus !27

Cider: Experimental ResultsPassMark Benchmark

0.0!

0.5!

1.0!

1.5!

2.0!

Solid

Vectors!

Transp

arent V

ectors!

Complex Vect

ors!

Imag

e Ren

dering!

Imag

e Filte

rs!

Simple

3D Te

st!

Complex 3D

Test!

Cider Android! Cider iOS! iOS!

DiplomatsDuct TapePersonasOverviewMotivation Evaluation

Page 28: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus

✤ Direct execution of unmodified iOS apps"➡ Per-thread Personas"➡ Duct Tape"➡ Diplomats

Evaluation

!28

ConclusionDiplomatsDuct TapePersonasOverviewMotivation

Page 29: Cider - Columbia Universitycdall/pubs/Cider-ASPLOS-2014-clean.pdfCider : Architecture Cider Linux Kernel Mach-O Loader XNU syscall Interface Linux syscall Interface iOS Mach" IPC Services

Presentation © 2014, Jeremy C. Andrus !29

Cider

Thank You

http://systems.cs.columbia.edu/projects/cider

Logo design by: Steve Lovelace (http://steve-lovelace.com/)

EvaluationDiplomatsDuct TapePersonasOverviewMotivation