SlideShare a Scribd company logo
1
Linker Namespace Insight
2
Agenda
• Target & Behavior
• Implementation
3
Target & Behavior
Target
• Reduce the possibility that 3rd APK call non-
public NDK API
Behavior
• Non-system app will fail on N device if it uses
non-public APIs.
• Preloaded system app is allowed to use non-
public APIs.
4
Namespace Creation– Daemon process
Only Default namespace
Run native
executable file
Bionic
execve
Kernel
Sys_exec
ve
StartLoad
er
/system/bin
/linker
Create a default
Namespace and put all
so into the namespace
5
Namespace Creation – Java App
Add Name Space in Linker
• Default namespace
• Anonymous namespace
• Class-loader namespace
Run Java APK
Framework
Fork
zygote
Load Dex
file
Create JIT
Get default
Namespace
libart-compiler.so
libvixl.so
Load *.classes.dexunder
default namespace
Get
Classloader for
apk
Create Anonymous
Namespace
Create classloader
Namespace
System.load to
load a lib
Loaded in classloader
namespace
Anonymous
Namespace
Default
Namespace
classloader
Namespace
6
Implementation – Name space
Namespace Directory
Default default_library_paths: System/lib Vendor/lib
permitted_paths_: none
Anonymous default_library_paths_: Same as default_library_paths of
class-loader namespace.
permitted_paths_: none
It is used by JIT when JIT tries to load a lib.
Class-loader default_library_paths: /data/app/com.eXXX-
1/lib/arm(x86);XXXX
permitted_paths_: /data;XXXX
7
Check Name space before library is loaded
Caller belongs
to Default
namespace?
Load so
Whether so is
in public name
space list?
Can be
loaded
No
Yes
Check whether *.so in
the dedicated directory
contained by
namespace
Yes
No
Yes
Can not be
loaded
No
8
Why we need it
• Different constrictions on library is required for
different caller.
• Different constrictions on library is required for
different stage for a process.

More Related Content

PPTX
Introduction of Android Architecture
PPT
Introduction to Git for developers
PDF
Golang workshop
PPTX
A Skeptic's Guide to Docker
PDF
Toward dynamic analysis of obfuscated android malware
PDF
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
PPTX
Ci with jenkins docker and mssql belgium
PDF
How to build a tool for operating Flink on Kubernetes
Introduction of Android Architecture
Introduction to Git for developers
Golang workshop
A Skeptic's Guide to Docker
Toward dynamic analysis of obfuscated android malware
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
Ci with jenkins docker and mssql belgium
How to build a tool for operating Flink on Kubernetes

What's hot (20)

PPTX
Continuous Integration With Jenkins Docker SQL Server
PPTX
Essential Tools for Modern PHP
KEY
Travis CI
PDF
(CISC 2013) Real-Time Record and Replay on Android for Malware Analysis
PDF
Create a PHP Library the right way
PDF
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
PDF
Acceptance testing plone sites and add ons with robot framework and selenium
PDF
From Android NDK To AOSP
PDF
How to fail at docker
PDF
ProbeDroid - Crafting Your Own Dynamic Instrument Tool on Android for App Beh...
PDF
JUC Europe 2015: The Famous Cows of Cambridge: A Non-Standard Use Case for Je...
PPTX
Continuous integration ( jen kins travis ci)
PDF
JUC Europe 2015: Jenkins Pipeline for Continuous Delivery of Big Data Projects
PDF
Network Protocol Testing Using Robot Framework
PPTX
Jenkins pipeline as code
PPTX
Tugbot - Testing Framework for Docker Containers
ODP
2017 DevSecCon ZAP Scripting Workshop
PPTX
Devops.pptx
PPT
FTP Commando to Git Hero - WordCamp Denver 2013
PDF
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
Continuous Integration With Jenkins Docker SQL Server
Essential Tools for Modern PHP
Travis CI
(CISC 2013) Real-Time Record and Replay on Android for Malware Analysis
Create a PHP Library the right way
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
Acceptance testing plone sites and add ons with robot framework and selenium
From Android NDK To AOSP
How to fail at docker
ProbeDroid - Crafting Your Own Dynamic Instrument Tool on Android for App Beh...
JUC Europe 2015: The Famous Cows of Cambridge: A Non-Standard Use Case for Je...
Continuous integration ( jen kins travis ci)
JUC Europe 2015: Jenkins Pipeline for Continuous Delivery of Big Data Projects
Network Protocol Testing Using Robot Framework
Jenkins pipeline as code
Tugbot - Testing Framework for Docker Containers
2017 DevSecCon ZAP Scripting Workshop
Devops.pptx
FTP Commando to Git Hero - WordCamp Denver 2013
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
Ad

More from Bin Yang (7)

PPTX
Introduction of android treble
PPTX
New features in android m upload
PPTX
Android ressource and overlay upload
PPTX
Android secuirty permission - upload
PPTX
Linker and loader upload
PPTX
Update from android kk to android l
PPTX
Google IO 2014 overview
Introduction of android treble
New features in android m upload
Android ressource and overlay upload
Android secuirty permission - upload
Linker and loader upload
Update from android kk to android l
Google IO 2014 overview
Ad

Recently uploaded (20)

PPT
introduction to datamining and warehousing
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PDF
PPT on Performance Review to get promotions
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Digital Logic Computer Design lecture notes
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
Project quality management in manufacturing
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Construction Project Organization Group 2.pptx
PPTX
Geodesy 1.pptx...............................................
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
introduction to datamining and warehousing
CH1 Production IntroductoryConcepts.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
OOP with Java - Java Introduction (Basics)
Operating System & Kernel Study Guide-1 - converted.pdf
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPT on Performance Review to get promotions
UNIT-1 - COAL BASED THERMAL POWER PLANTS
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Digital Logic Computer Design lecture notes
bas. eng. economics group 4 presentation 1.pptx
Project quality management in manufacturing
UNIT 4 Total Quality Management .pptx
Foundation to blockchain - A guide to Blockchain Tech
Construction Project Organization Group 2.pptx
Geodesy 1.pptx...............................................
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx

Linker namespace upload

  • 2. 2 Agenda • Target & Behavior • Implementation
  • 3. 3 Target & Behavior Target • Reduce the possibility that 3rd APK call non- public NDK API Behavior • Non-system app will fail on N device if it uses non-public APIs. • Preloaded system app is allowed to use non- public APIs.
  • 4. 4 Namespace Creation– Daemon process Only Default namespace Run native executable file Bionic execve Kernel Sys_exec ve StartLoad er /system/bin /linker Create a default Namespace and put all so into the namespace
  • 5. 5 Namespace Creation – Java App Add Name Space in Linker • Default namespace • Anonymous namespace • Class-loader namespace Run Java APK Framework Fork zygote Load Dex file Create JIT Get default Namespace libart-compiler.so libvixl.so Load *.classes.dexunder default namespace Get Classloader for apk Create Anonymous Namespace Create classloader Namespace System.load to load a lib Loaded in classloader namespace Anonymous Namespace Default Namespace classloader Namespace
  • 6. 6 Implementation – Name space Namespace Directory Default default_library_paths: System/lib Vendor/lib permitted_paths_: none Anonymous default_library_paths_: Same as default_library_paths of class-loader namespace. permitted_paths_: none It is used by JIT when JIT tries to load a lib. Class-loader default_library_paths: /data/app/com.eXXX- 1/lib/arm(x86);XXXX permitted_paths_: /data;XXXX
  • 7. 7 Check Name space before library is loaded Caller belongs to Default namespace? Load so Whether so is in public name space list? Can be loaded No Yes Check whether *.so in the dedicated directory contained by namespace Yes No Yes Can not be loaded No
  • 8. 8 Why we need it • Different constrictions on library is required for different caller. • Different constrictions on library is required for different stage for a process.