Latest / CyberSecurity Summary / Android Internals::Power User's View
Transcript
- 0:00Speaker 1: Have you ever peered beyond the apps and the sleek
- 0:03Speaker 1: interface of your Android phone and wondered what truly makes
- 0:06Speaker 1: it tick? Today, we're not just scratching the surface. We're
- 0:11Speaker 1: taking a deep dive into Android's core internals.
- 0:14Speaker 2: Yeah, getting into the nuts and bolts exactly.
- 0:16Speaker 1: We're going straight to the source with insights from Jonathan
- 0:19Speaker 1: Levin's Android Internals, a Confectioner's cookbook, Volume one. And this
- 0:25Speaker 1: book it's written specifically for you, the power user, right.
- 0:28Speaker 2: And what's truly fascinating about this source, I think is
- 0:31Speaker 2: that it's not some dry technical manual just for developers,
- 0:35Speaker 2: not at all. No, it's more of a conceptual journey.
- 0:37Speaker 2: It's rich with illustrations, and it's really designed to give
- 0:41Speaker 2: you a profound understanding without getting totally lost and lines
- 0:44Speaker 2: and lines of code. Okay, So our mission here is
- 0:47Speaker 2: to distill those essential nuggets of knowledge, basically offer you
- 0:51Speaker 2: a shortcut to mastering the very foundations of well, the
- 0:55Speaker 2: world's most popular operating system.
- 0:57Speaker 1: And what a mission it is. So, whether you're maybe
- 1:00Speaker 1: brushing up for a meeting, exploring a new field, or
- 1:03Speaker 1: just driven by insatiable curiosity, prepare for some genuine aha
- 1:09Speaker 1: moments will navigate Androids a unique design. It's sophisticated file system,
- 1:14Speaker 1: the intricate boot process, and those silent services that keep
- 1:19Speaker 1: it all running smoothly, always with its Linux foundations in mind.
- 1:22Speaker 2: Of course, Absolutely, you're.
- 1:23Speaker 1: About to gain a thorough understanding, hopefully without the information overload.
- 1:28Speaker 2: Yeah, that's the plan.
- 1:29Speaker 1: So to begin, let's consider the unique lens we're getting here.
- 1:33Speaker 1: Jonathan Lovin, our author, He brings a remarkable journey to
- 1:36Speaker 1: this book. We're talking Unix, Linux, Windows, OSX and deep
- 1:40Speaker 1: into security, right, a broad background, and he recognized that
- 1:43Speaker 1: understanding security is and I quote largely a projection of internals,
- 1:48Speaker 1: which is well a profound insight when you think about it,
- 1:51Speaker 1: it really is.
- 1:52Speaker 2: It shapes how you look at security problems.
- 1:54Speaker 1: He's tackled Apple's operating systems before, but this Android book
- 1:58Speaker 1: it's his first self published work, and it's crafted specifically
- 2:01Speaker 1: to give you the power user, this deeper conceptual understanding.
- 2:07Speaker 1: It's a perspective rooted in like decades of hands on
- 2:10Speaker 1: system analysis.
- 2:12Speaker 2: That background is so crucial because it immediately helps us
- 2:16Speaker 2: tackle a common misconception when people say Android is built
- 2:20Speaker 2: on Linux. I mean, how true is that really question.
- 2:24Speaker 2: Levin makes it super clear, it's not just another Linux distribution.
- 2:27Speaker 1: Okay.
- 2:28Speaker 2: Well, the kernel, the absolute core of the OS, it
- 2:30Speaker 2: shares a lot with standard Linux, yes, But the user
- 2:32Speaker 2: mode side, so everything above the kernel, that's where it
- 2:34Speaker 2: diverges significantly. Well, we see two entirely new components that
- 2:40Speaker 2: are pure androidisms, as he calls them. First the Delphic runtime,
- 2:44Speaker 2: which has since evolved into art the Android runtime, and
- 2:47Speaker 2: second the hardware distraction layer usually called the HL. It
- 2:51Speaker 2: basically provides a uniform interface to all the different device
- 2:54Speaker 2: hardware out there.
- 2:55Speaker 1: Like a translator between the software and the specific chips exactly.
- 2:59Speaker 2: And on top of that, Android uses a custom in
- 3:02Speaker 2: it process, not the traditional Linux one, and the BIONICC
- 3:05Speaker 2: library instead of the standard glib. These aren't just minor tweaks.
- 3:09Speaker 1: All sounds fundamental they are.
- 3:10Speaker 2: They're fundamental architectural choices that make Android distinct and uniquely
- 3:16Speaker 2: optimized for the constraints of mobile devices. I think battery
- 3:20Speaker 2: life memory limits.
- 3:21Speaker 1: That distinction Linux foundation, but with its own unique, highly
- 3:26Speaker 1: specialized architecture that's really key. It makes you wonder how
- 3:29Speaker 1: did these early architectural choices shape androids incredibly rapid evolution.
- 3:34Speaker 2: Yeah, it's been fast.
- 3:35Speaker 1: I mean we've seen a dozen major versions, twenty one
- 3:38Speaker 1: API levels in just what seven years since it started?
- 3:41Speaker 1: From a power users standpoint? What were some of those
- 3:44Speaker 1: pivotal system level changes that really made a difference?
- 3:47Speaker 2: Okay, yeah, we connect this to Android's bigger story. Several
- 3:50Speaker 2: versions definitely stand out. They introduce core innovations that fundamentally
- 3:54Speaker 2: altered how Android worked and well how we interact with it.
- 3:58Speaker 2: Which ones Let's start with Froyo twenty ten. This release
- 4:02Speaker 2: wasn't just about giving users more space by letting them
- 4:05Speaker 2: install apps on sd cards tho.
- 4:07Speaker 1: That was big at the time, it.
- 4:08Speaker 2: Was huge, but it was also a critical response to
- 4:11Speaker 2: the exploding app ecosystem, and crucially, it introduced Android Secure
- 4:15Speaker 2: Containers accacs.
- 4:17Speaker 1: Yeah.
- 4:17Speaker 2: I think of ATC as like a secure encrypted vault
- 4:20Speaker 2: for those app files, especially when they're on typically less
- 4:24Speaker 2: secure removable storage. It helped mitigate the new security risks
- 4:28Speaker 2: that came with that flexibility.
- 4:30Speaker 1: Ah, okay, makes sense. What came next?
- 4:32Speaker 2: Then you have Jellybean around twenty twelve twenty thirteen. This
- 4:36Speaker 2: brought multi user support, initially just for tablets, but it
- 4:39Speaker 2: was a massive.
- 4:40Speaker 1: Shift like different logins on one device, exactly.
- 4:42Speaker 2: Separate user interfaces, isolated data just on a desktop. And
- 4:46Speaker 2: for security, it also introduced selnicx to Android. That's a
- 4:48Speaker 2: mandatory access control framework.
- 4:50Speaker 1: Mandatory access control. How's that different from regular permissions?
- 4:54Speaker 2: Well, unlike traditional Linux permissions which are kind of voluntary,
- 4:58Speaker 2: selinicx proactively forces a really strict policy. It's like an
- 5:02Speaker 2: omnipresent security guard, making sure every process only does exactly
- 5:06Speaker 2: what it's explicitly allowed to do, no exceptions.
- 5:09Speaker 1: Wow, okay, sounds strict.
- 5:11Speaker 2: It is and very effective. Jellybean also closed a significant
- 5:16Speaker 2: USB debugging hole by forcing authentication over ADB, another security.
- 5:21Speaker 1: Plus good move. What about KitKat twenty thirteen?
- 5:24Speaker 2: KitKat brought some really clever under the hood optimizations focus
- 5:28Speaker 2: squarely on.
- 5:28Speaker 1: Battery life, always important on mobile definitely.
- 5:31Speaker 2: The implemented timer coalescing and sensor batching. These are intelligent
- 5:35Speaker 2: strategies to basically group together multiple small system events or
- 5:39Speaker 2: sensor readings into single, less frequent operations.
- 5:41Speaker 1: So waking the phone up less.
- 5:43Speaker 2: Often, precisely, instead of waking the system constantly for individual
- 5:46Speaker 2: little updates. Yeah, it would collect them and process them
- 5:48Speaker 2: all at once. Saved significant power Kitcat also introduced dm verity.
- 5:52Speaker 2: Dm verity Yeah, it provides cryptographic integrity checking for the
- 5:55Speaker 2: system partition. It's essentially a digital fingerprint that ensures the
- 5:59Speaker 2: core operating system hasn't been tampered.
- 6:01Speaker 1: With, So checking if the OS files are still the
- 6:04Speaker 1: original trusted.
- 6:05Speaker 2: Ones exactly a really important security feature, okay.
- 6:08Speaker 1: And then Lollipop in twenty fourteen that felt like a huge.
- 6:11Speaker 2: Overhaul, monumental visually, yes, it was material design, but internally
- 6:16Speaker 2: the big news was it fully adopted the Android Run
- 6:19Speaker 2: Time RT, replacing delvic correct and RT was a huge shift.
- 6:25Speaker 2: It compiles application code ahead of time AOT, meaning meaning
- 6:29Speaker 2: it translates the app's code into native machine instructions before
- 6:32Speaker 2: the app even runs, usually during installation.
- 6:34Speaker 1: Ah okay, not just in time like Delva right.
- 6:38Speaker 2: This results in significantly faster application launch times and much
- 6:41Speaker 2: smoother performance overall, especially when paired with its new sixty
- 6:44Speaker 2: four bit architecture support. Lollipop also launched Project.
- 6:48Speaker 1: Volta Volta Battery Improvements again.
- 6:50Speaker 2: Yep, the whole set of improvements for better battery life,
- 6:53Speaker 2: plus more detailed power monitoring tools so you can get
- 6:56Speaker 2: more insight into what's draining your device useful.
- 6:59Speaker 1: And finally, the M Preview in twenty fifteen, M, which.
- 7:03Speaker 2: Became Marshmallow, built further on power management. It introduced dose mode.
- 7:08Speaker 1: Dose.
- 7:08Speaker 2: Yeah, this clever feature detects when your device has been
- 7:11Speaker 2: idle for a long time, like sitting on your nightstand overnight.
- 7:14Speaker 2: It puts it into a much deeper sleep state. Okay,
- 7:17Speaker 2: it only allows brief periodic wakeups for really essential app sinking,
- 7:21Speaker 2: dramatically improving battery life during those long idle periods. M
- 7:25Speaker 2: also extended full data encryption to external storage, boosting overall
- 7:30Speaker 2: data security.
- 7:31Speaker 1: That's a fascinating evolution. You can really see it being
- 7:34Speaker 1: driven by both user demands like more storage and better battery,
- 7:37Speaker 1: and also the unique constraints of mobile computing.
- 7:40Speaker 2: Absolutely, it's a constant balancing act.
- 7:42Speaker 1: So with all these unique components RTHL, the specialized services
- 7:45Speaker 1: and the apps we install, where do they actually live
- 7:48Speaker 1: on the device? Let's crack open? Metaphorically speaking, Android's internal
- 7:52Speaker 1: filing system you said is far more sophisticated than a
- 7:55Speaker 1: simple desktop OS.
- 7:56Speaker 2: It really is. Android uses a complex moultipartition storage scheme.
- 8:01Speaker 2: The specifics might vary a bit between manufacturers or even devices.
- 8:05Speaker 2: But you will primarily encounter three critical partitions.
- 8:08Speaker 1: Okay, what are they?
- 8:09Speaker 2: First, there's system. This is the heart of Android. It's
- 8:13Speaker 2: home to the core OS, all the Google supplied binaries,
- 8:16Speaker 2: the core frameworks, everything that makes Android androids right. Crucially,
- 8:20Speaker 2: it's designed to be mounted read only for security.
- 8:23Speaker 1: So apps can't just change core OS file exactly.
- 8:26Speaker 2: And as we mentioned with KitKat, dm verity, which is
- 8:29Speaker 2: actually a feature of the Linux device map or subsystem,
- 8:32Speaker 2: acts like that, cryptographic checks them. It ensures the system
- 8:35Speaker 2: partition hasn't been tampered with. It's a significant defense and
- 8:38Speaker 2: depth measure.
- 8:39Speaker 1: Okay, system is the read only OS core. What else?
- 8:41Speaker 2: Then? You have data. This is your space. It houses
- 8:44Speaker 2: all your user data, your installed applications, their private data settings, everything.
- 8:48Speaker 1: My photos, my app settings.
- 8:49Speaker 2: All that stuff. And within data data, each app gets
- 8:52Speaker 2: its own unique reverse DNS name subdirectory like comm dot
- 8:56Speaker 2: example dot myapp. This provides script isolation between app.
- 9:00Speaker 1: So one app can't easily peek into another's private files.
- 9:03Speaker 2: Not easily, No, that's the point. And to protect your
- 9:06Speaker 2: privacy further, this entire data partition can be encrypted. This
- 9:10Speaker 2: feature was enabled by default starting with Lollipop using another
- 9:14Speaker 2: device mapp or mechanism called dmcrypt. It encrypts data before
- 9:18Speaker 2: it's even written to the physical.
- 9:20Speaker 1: Storage, so even if someone physically gets the storage chip,
- 9:24Speaker 1: the data is scrambled pretty much.
- 9:26Speaker 2: Yes, without the key, it's just.
- 9:28Speaker 1: Noise, okay, system data. What's through one.
- 9:30Speaker 2: The third main one is cash. It's often overlooked, but
- 9:33Speaker 2: it's vital for things like over the air or OTA
- 9:37Speaker 2: updates and system recovery. It's where validated update packages are
- 9:41Speaker 2: temporarily stored before they get installed.
- 9:43Speaker 1: Ah, temporary storage for updates.
- 9:45Speaker 2: Right and beyond these main partitions, we also have something
- 9:48Speaker 2: called opaque binary blobs or obb's.
- 9:51Speaker 1: OBB sounds mysterious, ah a little.
- 9:54Speaker 2: They weren't true partitions themselves. They basically allow developers to
- 9:58Speaker 2: package up large amounts of additional data up to two
- 10:01Speaker 2: GB for their apps. Think big game assets, high res maps,
- 10:04Speaker 2: multimedia files.
- 10:05Speaker 1: Stuff that doesn't fit easily in the main app package exactly.
- 10:09Speaker 2: These are typically encrypted vfat filesystem images. They get mounted
- 10:13Speaker 2: on demand by a background service, a demon called vold,
- 10:17Speaker 2: again leveraging the kernel's device mapper. It all happens pretty
- 10:20Speaker 2: transparently to the application itself.
- 10:22Speaker 1: Interesting. So we have these real storage partitions backed by
- 10:26Speaker 1: physical flash memory. But you also mentioned pseudo filesystems. That
- 10:30Speaker 1: sounds different. What exactly are those and what vital role
- 10:35Speaker 1: do they play.
- 10:35Speaker 2: Pseudo filesystems are indeed fascinating and really important for understanding
- 10:40Speaker 2: how Android works under the hood. Unlike system or data,
- 10:44Speaker 2: they aren't backed by physical storage at all.
- 10:46Speaker 1: No files on a chip somewhere, nope.
- 10:48Speaker 2: Instead, they're maintained dynamically directly by the kernel using in
- 10:52Speaker 2: memory data structures and special functions called callbacks. Think of
- 10:55Speaker 2: them as dynamic windows into the kernel's live operations in
- 10:58Speaker 2: current state, like a live That's a great analogy. For instance,
- 11:02Speaker 2: prof SIMS. The process file system is essential for tools
- 11:05Speaker 2: like top or profits. It gives you a live view
- 11:07Speaker 2: and all the running processes and threads, their memory usage,
- 11:10Speaker 2: CPU time, et cetera. Then there's CYFTS. This allows userspace programs,
- 11:15Speaker 2: even simple shell commands, to directly query and sometimes interact
- 11:19Speaker 2: with hardware devices managed by the kernel like how well.
- 11:22Speaker 2: For example, you could potentially control your device's vibrator by
- 11:26Speaker 2: simply writing a millisecond value to a specific file within CIFTS.
- 11:31Speaker 2: Maybe something like cysclass dons output vibrator or noble.
- 11:34Speaker 1: Seriously, you can just write to a file to make
- 11:36Speaker 1: the phone.
- 11:37Speaker 2: Vibrate in many cases. Yes. Other important ones include debugs
- 11:41Speaker 2: for debugging kernel features and selenics for interacting with the
- 11:44Speaker 2: Selenic security subsystem. The key thing is these file systems
- 11:48Speaker 2: always reflect the most up to date data from the kernel,
- 11:51Speaker 2: and changes made to writeable files here often take effect immediately,
- 11:55Speaker 2: though they usually don't persist across reboots.
- 11:58Speaker 1: So wow, we have these distinct partitions for the OS
- 12:00Speaker 1: and user data, physical storage obbs for extra app data
- 12:04Speaker 1: in these dynamic pseudo filesystems, reflecting the live kernel state
- 12:08Speaker 1: with all its complexity. How does an Android device even
- 12:10Speaker 1: begin to start up? It sounds like an incredibly intricate
- 12:13Speaker 1: dance to bring the whole system online.
- 12:15Speaker 2: It truly is an intricate choreography, as Levin puts it,
- 12:19Speaker 2: and it starts long before you even see the Android
- 12:21Speaker 2: logo pop.
- 12:22Speaker 1: Up, Before Android itself.
- 12:23Speaker 2: Yeah, the process begins deep down to the device's firmware.
- 12:27Speaker 2: This is somewhat like a PC's BIOS or U e
- 12:30Speaker 2: fi on modern system on chip or soaky devices. This
- 12:34Speaker 2: initial phase is actually quite complex. It involves various specialized
- 12:38Speaker 2: subprocessors working together like Qualcom's RPM create cores, Adrino GPU,
- 12:44Speaker 2: Hexagon DSP, each managing critical hardware tasks, making sure the
- 12:48Speaker 2: basic system is stable and ready before the main Android
- 12:51Speaker 2: bootloader even gets loaded.
- 12:53Speaker 1: So the chip itself has its own little startup sequence exactly.
- 12:56Speaker 2: This initial firmware then loads a secondary bootloader, which eventually
- 13:00Speaker 2: control off to Android's own bootloader.
- 13:02Speaker 1: Okay, now we're getting closer to Android.
- 13:04Speaker 2: Right, and most Android bootloaders support the fast boot protocol.
- 13:08Speaker 2: This is a simple text based mechanism that works over
- 13:10Speaker 2: a USB connection.
- 13:11Speaker 1: Ah, I've heard a fast boot for flashing realms and stuff.
- 13:14Speaker 2: Precisely, it's how power users can flash new system images,
- 13:18Speaker 2: update individual components like the radio, firmware, or even oma,
- 13:21Speaker 2: unlock their device.
- 13:22Speaker 1: Unlocking the bootloader.
- 13:23Speaker 2: Kiss and it's important to remember while unlocking, freeze your
- 13:26Speaker 2: phone to load custom firmware and allows for all sorts
- 13:29Speaker 2: of modifications. It also completely wipes your data.
- 13:32Speaker 1: Partition wipes everything wire.
- 13:34Speaker 2: For security, it prevents an attacker from just unlocking your
- 13:37Speaker 2: device to bypass your PI or password and then copying
- 13:40Speaker 2: off all your personal data from data. It's a critical safeguard.
- 13:43Speaker 1: Makes sense so after the bootloader does its thing.
- 13:46Speaker 2: After its work, the bootloader loads the boot image. This
- 13:49Speaker 2: series typically contains two key things, right, the Linux kernel
- 13:52Speaker 2: itself and an initial RAM disc or any tramps.
- 13:56Speaker 1: Any tramps like a temporary file.
- 13:58Speaker 2: System sort of. But unlike traditional Linux, where the an
- 14:01Speaker 2: TRAMS is usually discarded after the real root file system
- 14:04Speaker 2: is mounted, Android keeps this inny trams resident in memory.
- 14:07Speaker 2: It actually provides the initial root file system environment. Okay,
- 14:11Speaker 2: And from within this inne trams environment, the kernel then
- 14:14Speaker 2: launches the pivotal INNY process. This process gets process ID
- 14:18Speaker 2: one or PID one.
- 14:19Speaker 1: PID one the first one.
- 14:21Speaker 2: The very first user space process started by the kernel.
- 14:25Speaker 2: It's responsible for launching basically everything else in the user
- 14:27Speaker 2: mode world, and famously in Unix like systems, PID one
- 14:32Speaker 2: is special. You can't kill it. This marks that critical
- 14:36Speaker 2: transition from kernel mode operation to user mode operation.
- 14:39Speaker 1: Right, that transition from kernel to user mode orchestrated by
- 14:43Speaker 1: in knit as PID one, that's where the Android system
- 14:45Speaker 1: we actually interact with really begins to take shape. You
- 14:49Speaker 1: called it the progenitor of all other processes. What are
- 14:52Speaker 1: the core responsibilities of this innit process? Why is it
- 14:55Speaker 1: so foundational?
- 14:56Speaker 2: In it is absolutely foundational, I mean just like it's
- 14:58Speaker 2: Unix namesake. Its primary job is to bring the rest
- 15:02Speaker 2: of the system up in user mode.
- 15:03Speaker 1: How does it know what to do?
- 15:04Speaker 2: It achieves this by parsing its configuration files. These are
- 15:08Speaker 2: known as dot rc files, typically found in the root
- 15:10Speaker 2: directory and system mets in it. These files are essentially scripts.
- 15:13Speaker 2: They contain commands and declarations that tell an in which
- 15:16Speaker 2: services to start, which filesystems mounting, system read only and
- 15:20Speaker 2: data read write, and what permissions and ownership to set
- 15:23Speaker 2: on various files and device nodes.
- 15:24Speaker 1: So it's like the master script for booting Android pretty much.
- 15:28Speaker 2: Yeah. It also manages system properties. These are dynamic configuration
- 15:32Speaker 2: values kind of like global variables for the system. They
- 15:35Speaker 2: get read initially from files like default dot prop and
- 15:39Speaker 2: system build dot prop. That build dot prop file contains
- 15:42Speaker 2: tons of info about your specific device bill okay and
- 15:46Speaker 2: beyond just starting things, and it takes on additional critical roles.
- 15:49Speaker 2: It acts as evented listening for kernel events, signaling hardware
- 15:53Speaker 2: changes like when you plug in headphones or a USB drive,
- 15:56Speaker 2: and takes appropriate action. It also incorporates watchdog functionality to
- 16:00Speaker 2: monitor system health and potentially reboot if things get stuck.
- 16:03Speaker 1: So it starts everything, manages configuration, and keeps an eye
- 16:07Speaker 1: on hardware and system health.
- 16:09Speaker 2: In essence, yes, and it dictates how the entire Android
- 16:12Speaker 2: system starts up and ensures that vital services are launched
- 16:15Speaker 2: and maintained. It's designed to be incredibly robust, and importantly,
- 16:19Speaker 2: its operation can't be easily altered from user space. Once
- 16:22Speaker 2: the system is running, any significant modification usually requires flashing
- 16:26Speaker 2: a new, properly signed boot image.
- 16:28Speaker 1: Okay, so in it is the grand conductor for the
- 16:31Speaker 1: whole startup orchestra. But beyond that initial orchestrator, Android runs
- 16:37Speaker 1: countless background services. These demons that handle everything from network
- 16:42Speaker 1: connections to crash reports. Let's maybe highlight a few of
- 16:45Speaker 1: the most critical ones that keep your phone running seamlessly
- 16:48Speaker 1: behind the scenes.
- 16:49Speaker 2: Absolutely, these demons are the silent workhourses. You're right, They
- 16:53Speaker 2: operate tirelessly in the background, and you often only notice
- 16:56Speaker 2: them well when something goes wrong.
- 16:58Speaker 1: Which ones are essential?
- 16:59Speaker 2: Okay? First up service manager. Think of this as Android's
- 17:03Speaker 2: central phone book or directory for almost all other operating
- 17:07Speaker 2: system services. The phone book, Yeah, any application or system
- 17:10Speaker 2: component that needs to interact with another core service. Say
- 17:13Speaker 2: asking the location manager for GPS data, or telling the
- 17:16Speaker 2: window manager to draw something, or accessing the camera service,
- 17:20Speaker 2: it must first consult Service Manager. It asks service manager
- 17:24Speaker 2: for a reference like a handle to that specific service,
- 17:27Speaker 2: so it connects everything. It's the central hub for finding services. Yes,
- 17:31Speaker 2: Without it, interprocess communication or IPC would be severely crippled.
- 17:36Speaker 2: Services couldn't even register their presence within the system for
- 17:39Speaker 2: others to find them. Its actual code is surprisingly small,
- 17:43Speaker 2: but its importance to the entire Android framework is immense.
- 17:46Speaker 1: Okay, service Manager is the connector what else next?
- 17:50Speaker 2: Zygote. This is one of Android's most unique and highly
- 17:53Speaker 2: optimized innovations, specifically for launching applications quickly.
- 17:57Speaker 1: Zygote like the biological.
- 17:59Speaker 2: Term exactly because it forks. Instead of each app starting
- 18:03Speaker 2: its own full Java virtual machine from scratch, which would
- 18:06Speaker 2: be slow in memory intensive, Zygote preloads the core libraries
- 18:11Speaker 2: it starts up early in the boat process, initializes a
- 18:14Speaker 2: Dalvic VM or now IRT, and preloads all the common
- 18:17Speaker 2: Android framework classes and resources into.
- 18:19Speaker 1: Memory, so it gets everything ready beforehand.
- 18:22Speaker 2: Precisely, when you tap an app icon to launch it,
- 18:24Speaker 2: the system doesn't start a new VM. Instead it tells
- 18:27Speaker 2: Zygot to fork itself. Forking creates a near instant copy
- 18:30Speaker 2: of the zydote process, inheriting all that preloaded goodness. This
- 18:34Speaker 2: new process then specializes itself into the app you wanted
- 18:36Speaker 2: to run.
- 18:37Speaker 1: Ah, so it's like having a runner already warmed up
- 18:40Speaker 1: and waiting right at the finish line.
- 18:41Speaker 2: That's a perfect analogy. Camping by the finish line. It
- 18:45Speaker 2: dramatically decreases application startup time by maximizing shared memory. This
- 18:49Speaker 2: makes Android incredibly efficient, especially considering its application layer is
- 18:53Speaker 2: largely Java based, and modern Android with sixty four bit
- 18:57Speaker 2: support actually maintains both thirty two and sixty four bit
- 19:01Speaker 2: Zygo instances for compatibility with all the different apps out there.
- 19:04Speaker 1: Oh that's clever. Okay, service manager's zygot. What about when
- 19:08Speaker 1: things go wrong?
- 19:10Speaker 2: Apps crash sometimes inevitably, Yes, yeah, and that's where debugger
- 19:13Speaker 2: comes in. This is androids building crash reporting mechanism. Conceptually,
- 19:17Speaker 2: it's similar to crash reporter on iOS.
- 19:19Speaker 1: Or macOS, so it catches crashes.
- 19:21Speaker 2: Yeah. When an application receives a fatal signal like a
- 19:24Speaker 2: segmentation fault where it tries to access memory it shouldn't,
- 19:28Speaker 2: or an the illegal instruction. Debuggered automatically steps in. It
- 19:31Speaker 2: attaches to the feeling process, inspects its memory state, gathers
- 19:35Speaker 2: information about the threads, registers and the call stack leading
- 19:37Speaker 2: up to the crash. Okay, and then it generates a tombstone.
- 19:40Speaker 1: At tombstone morbid name a.
- 19:43Speaker 2: Little yeah, but it's basically a compact crash report. It
- 19:47Speaker 2: gets saved in a specific directory, usually dated tombstones. It
- 19:50Speaker 2: provides essential autopsy services what went wrong, where and maybe why,
- 19:54Speaker 2: without needing to generate huge, multi megabyte core dump files,
- 19:58Speaker 2: which just aren't practic on mobile devices with limited storage.
- 20:02Speaker 1: So a quick summary of the crash scene.
- 20:04Speaker 2: Exactly, very useful for developers and sometimes for power users
- 20:07Speaker 2: trying to diagnose issues.
- 20:08Speaker 1: Okay, one more critical demon.
- 20:11Speaker 2: Let's talk about Installed. This demon is responsible for the
- 20:15Speaker 2: rather intricate process of installing and removing application packages the
- 20:19Speaker 2: APK files.
- 20:21Speaker 1: You mean it just copies the APK file.
- 20:23Speaker 2: Oh, it's much more than that. Installed sets up and
- 20:25Speaker 2: maintains the complex directory structure needed for each app. For example,
- 20:30Speaker 2: it creates the apps private data directory under data data,
- 20:33Speaker 2: sets the correct Linux user ID and group ID ownership,
- 20:36Speaker 2: and applies the right file permissions. It also handles placing
- 20:40Speaker 2: the ATK itself maybe in data app and managing private
- 20:43Speaker 2: app libraries.
- 20:44Speaker 1: So it sets up the apps home directory and permissions right,
- 20:48Speaker 1: and it.
- 20:48Speaker 2: Even handles more complex tasks like migrating directory structures when
- 20:52Speaker 2: features like multi user support were introduced back in Jellybean.
- 20:56Speaker 2: A key principle Intalled follows is least privilege, meaning meaning
- 21:00Speaker 2: it starts with high privileges, maybe even root to do
- 21:03Speaker 2: things like create directories owned by specific app UIDs, but
- 21:07Speaker 2: as soon as those tasks are done, it drops those
- 21:10Speaker 2: extra privileges, minimizing the potential attack surface if it were
- 21:13Speaker 2: ever compromised.
- 21:14Speaker 1: Smart Okay, it's clear that Android is this incredibly complex,
- 21:18Speaker 1: finely tuned machine. But with so many moving parts, so
- 21:22Speaker 1: many demons and apps interacting, security has to be paramount.
- 21:26Speaker 1: Android has certainly faced its share of challenges over the years.
- 21:30Speaker 1: So how is androids security model actually structured? Starting from
- 21:33Speaker 1: those Linux foundations we talked about and building.
- 21:35Speaker 2: Up That's right, security is woven in at multiple layers.
- 21:38Speaker 2: Android takes the standard Linux security model user IDs, group IDs,
- 21:42Speaker 2: file permissions and gives it a really novel interpretation, especially
- 21:45Speaker 2: for its time. Instead of Linux users mapping directly to
- 21:48Speaker 2: human users sitting at the device. Android assigns unique users,
- 21:52Speaker 2: specifically application IDs aids to individual applications.
- 21:57Speaker 1: So each app is its own user essentially.
- 22:00Speaker 2: Yes, When an app is installed, the package manager service
- 22:04Speaker 2: working with installed assigns at a unique AID, typically in
- 22:07Speaker 2: arrange like ten thousand to maybe ninety thousand. This automatically
- 22:11Speaker 2: isolates applications from each other at the kernel level.
- 22:14Speaker 1: How does that isolate them?
- 22:16Speaker 2: Because the kernel enforces standard Linux file permissions based on
- 22:19Speaker 2: these aids. By default, an app running with eight one
- 22:22Speaker 2: seven fifty cannot access files owned by eight one seven
- 22:26Speaker 2: five to one unless permissions are explicitly granted somehow. It's
- 22:30Speaker 2: the same principle that keeps different human users separated on
- 22:32Speaker 2: a traditional uniax server, but applied to apps.
- 22:35Speaker 1: Okay, that's the basic Linux level isolation.
- 22:37Speaker 2: What else beyond the foundation? We have selinicx, the mandatory
- 22:40Speaker 2: access control framework which touched on earlier, introduced properly in
- 22:43Speaker 2: Jellybean and made enforcing in later versions.
- 22:45Speaker 1: The strict security guard exactly.
- 22:47Speaker 2: Selenicx operates alongside the traditional permissions, but adds a much
- 22:51Speaker 2: stricter layer. It enforces a system wide policy that dictates
- 22:55Speaker 2: exactly what operations each process or domain in SELinux terms
- 22:59Speaker 2: is allowed to perform on which types of objects like files, sockets,
- 23:03Speaker 2: or other processes, even if traditional permissions would allow an action.
- 23:08Speaker 2: If the CYLINICX policy forbids it, it's blocked.
- 23:10Speaker 1: So it prevents even privileged processes from misbehaving.
- 23:13Speaker 2: Precisely, it prevents processes from operating outside their strictly defined bounds,
- 23:18Speaker 2: even if they somehow get compromised. Samsung's k and Ox platform,
- 23:22Speaker 2: for example, relies heavily on selnics for its enhanced security features.
- 23:26Speaker 1: Okay, user IDs for apps, selnics anything.
- 23:29Speaker 2: Else capabilities are also critical in the Linux kernel. These
- 23:33Speaker 2: break down the traditional all powerful root user privilege into smaller,
- 23:36Speaker 2: more distinct chunks.
- 23:38Speaker 1: Like specific superpowers instead of one big one kind.
- 23:40Speaker 2: Of yeah, so a process like installed doesn't need full
- 23:44Speaker 2: root access all the time. It might only need the
- 23:46Speaker 2: capability to change file ownership cap shen or bypass directory
- 23:51Speaker 2: permissions captain cover ride for specific tasks. By only granting
- 23:56Speaker 2: the necessary capabilities, the potential damage if that process is
- 23:59Speaker 2: compromised is significantly reduced. It adheres to that principle of
- 24:03Speaker 2: least privilege.
- 24:04Speaker 1: Got it, minimize power where possible.
- 24:07Speaker 2: And finally, for data at rest, the data sitting on
- 24:10Speaker 2: your phone storage, Android offers robust encryption. We mentioned dmcrypt,
- 24:15Speaker 2: using the device mapper to encrypt the entire data partition,
- 24:18Speaker 2: which became default and Lollipop and dm verity insures the
- 24:21Speaker 2: system partitions integrity, preventing malicious modification of the OS itself.
- 24:25Speaker 2: These ensure that even if someone bypasses the lock screen
- 24:28Speaker 2: or gets physical access to the storage chips, your data
- 24:31Speaker 2: remains confidential and the OS integrity is maintained.
- 24:34Speaker 1: That's a pretty comprehensive security stack, layers upon layers. But
- 24:38Speaker 1: what about rooting. We hear about that all the time,
- 24:40Speaker 1: power users, enthusiasts, motters often root their devices. How does
- 24:44Speaker 1: that fit into this intricate security picture you just described.
- 24:47Speaker 2: Ah, rooting, It's truly a double edged sword, no question
- 24:50Speaker 2: about it. Also well for power users, for moters, for
- 24:55Speaker 2: security researchers. Rooting unlocks tremendous advantages. It gives you complete
- 25:00Speaker 2: unrestricted control over the entire system. You can install custom
- 25:03Speaker 2: operating systems ROMs, use advanced diagnostic tools, perform specialized security
- 25:08Speaker 2: audits block ads at the system level, install apps that
- 25:11Speaker 2: require deep system access for things like backup or firewalling,
- 25:14Speaker 2: things far beyond what stock Android permits, so.
- 25:17Speaker 1: Lots of power and flexibility, immense power.
- 25:20Speaker 2: However, from a security standpoint, rooting as leven states essentially
- 25:25Speaker 2: entirely compromises the device's security as it was designed by
- 25:28Speaker 2: Google and the manufacturers entirely compromises.
- 25:31Speaker 1: That sounds bad.
- 25:32Speaker 2: It means that the fundamental security model based on app
- 25:35Speaker 2: isolation and restricted privileges is bypassed. If an adversary, maybe
- 25:39Speaker 2: through a malicious app you install after routing, gains root access,
- 25:42Speaker 2: they can do anything. They can bypass PNS. They can
- 25:45Speaker 2: read data from any app, they can copy the entire
- 25:47Speaker 2: data partition, install keyloggers, spyware, you name it, so.
- 25:51Speaker 1: The walls between apps crumble completely.
- 25:54Speaker 2: We've seen real world exploits over the years, like Geohat's
- 25:58Speaker 2: famous tow root exploit, which cleverly used a bug in
- 26:01Speaker 2: the Linux kernel specifically CVE twenty fourteen three one five
- 26:05Speaker 2: three to gain root access on many devices with just
- 26:09Speaker 2: a tab, or the fake ID vulnerability, which wasn't about
- 26:13Speaker 2: getting root, but allowed malicious apps to essentially forge credentials
- 26:16Speaker 2: and impersonate trusted applications, so these vulnerabilities pop up, they do,
- 26:20Speaker 2: and while Google works tirelessly to patch these vulnerabilities through
- 26:23Speaker 2: security updates, the act of choosing to root fundamentally changes
- 26:27Speaker 2: the device's security posture. It makes it inherently more vulnerable,
- 26:31Speaker 2: especially if the root access method itself isn't from an
- 26:33Speaker 2: absolutely trusted source, or if the user isn't careful about
- 26:36Speaker 2: what they grant root privileges too. Afterwards. It really highlights
- 26:40Speaker 2: that constant tension and Android between its open, flexible, customizable
- 26:43Speaker 2: nature and the need for robust, reliable security for everyone.
- 26:47Speaker 1: It's a very delicate balance indeed. And you know, if
- 26:50Speaker 1: we connect this back to the broader picture of Android's
- 26:53Speaker 1: internal workings, thinking about Zygo, sharing memory or optimizing code,
- 26:58Speaker 1: it sounds like the system is in this constant battle
- 27:00Speaker 1: for efficiency, especially when it comes to memory, particularly given
- 27:05Speaker 1: its general lack of traditional swap space like a desktop
- 27:08Speaker 1: OS might have.
- 27:09Speaker 2: You've hit on a really crucial point there. Android's design,
- 27:12Speaker 2: especially with Delvic and later art, places a huge emphasis
- 27:15Speaker 2: on maximizing shared memory. This is absolutely vital on devices
- 27:19Speaker 2: with constrained rams.
- 27:20Speaker 1: Zigo is key there.
- 27:21Speaker 2: So I go to central yes by pre loading all
- 27:24Speaker 2: those common framework classes and resources. It ensures that the
- 27:27Speaker 2: vast majority of the memory used by the core Android
- 27:30Speaker 2: system is shared across all running apps. Tools leven mentions
- 27:34Speaker 2: like pro crank or a librank can actually show you this.
- 27:36Speaker 2: They distinguish between an app's total memory usage RSS residence
- 27:41Speaker 2: set size and its unique usage USS unique set side, and.
- 27:44Speaker 1: The unique part is small.
- 27:45Speaker 2: Often yes, you might see that the unique footprint the
- 27:49Speaker 2: USS of many apps is just a few megabytes, maybe
- 27:53Speaker 2: eighty five percent, ninety percent or even more of their
- 27:56Speaker 2: total RSS is actually shared memory pages shared thanks to Zygote,
- 28:00Speaker 2: shared thanks to precompiled art files like boot dot oat
- 28:03Speaker 2: that contained framework code, and even shared things to a
- 28:06Speaker 2: Linux kernel feature called Kernel sain Page Merging or KSM KSM.
- 28:10Speaker 1: What does that do?
- 28:11Speaker 2: KSM is a kernel demon that periodically scans physical memory
- 28:14Speaker 2: looking for identical pages. If it finds two or more
- 28:17Speaker 2: identical pages, it merges them into a single physical page,
- 28:20Speaker 2: marks it as copy on right, and frees up the duplicates.
- 28:23Speaker 2: It happens transparently to the.
- 28:24Speaker 1: Applications, so more automatic memory saving.
- 28:27Speaker 2: Exactly all these mechanisms work together to make Android remarkably
- 28:31Speaker 2: memory efficient. However, you're right about the swap space.
- 28:34Speaker 1: Most Android devices don't use it.
- 28:36Speaker 2: Traditionally no using flash memory the type of storage and
- 28:39Speaker 2: phones for frequent swap operations. Writing memory pages out to
- 28:42Speaker 2: DISC when RAM gets full would drastically reduce this lifespan.
- 28:46Speaker 2: Flash memory has a limited number of right cycles.
- 28:48Speaker 1: Okay, so no swap cushion. What happens when memory runs
- 28:51Speaker 1: out right without swap?
- 28:52Speaker 2: Out of memory or OHAM conditions become a much more
- 28:55Speaker 2: immediate threat. If the system truly runs out of available RAM,
- 28:59Speaker 2: the pernel might start randomly killing processes, or the whole
- 29:03Speaker 2: system could become unstable and crash or reboot. Not good,
- 29:06Speaker 2: definitely not good for user experience. To prevent this worst
- 29:09Speaker 2: case scenario, Android emplays another one of those specific androidisms,
- 29:14Speaker 2: the LMANKD or low memory killer demon.
- 29:17Speaker 1: Low memory killer sounds ominous.
- 29:19Speaker 2: It does. The ALMINKD runs as a kernel module or
- 29:22Speaker 2: demon and continuously monitors the system's memory pressure based on
- 29:26Speaker 2: predefined thresholds and the omscore edge value assigned to each
- 29:29Speaker 2: running process, which indicates its importance. The elman kady preemptively
- 29:32Speaker 2: kills less important background processes before the system hits a
- 29:35Speaker 2: critical om state.
- 29:37Speaker 1: So it sacrifices background apps to save the foreground app
- 29:40Speaker 1: and the system.
- 29:41Speaker 2: That's the idea. It's a pragmatic, sometimes aggressive approach. Users
- 29:45Speaker 2: might notice apps they haven't used recently need to reload
- 29:48Speaker 2: fully when they switch back, but it's deemed necessary to
- 29:51Speaker 2: keep the currently active app responsive and prevent the entire
- 29:54Speaker 2: system from grinding to a halt or crashing due to
- 29:57Speaker 2: memory starvation. It really reflects the practical rea of managing
- 30:01Speaker 2: limited resources on mobile devices.
- 30:03Speaker 1: Wow, what an incredible journey we've taken. Guided by Jonathan
- 30:07Speaker 1: Levin's unique perspective and Android internals, We've really taken a
- 30:11Speaker 1: deep dive, haven't we?
- 30:12Speaker 2: We really have.
- 30:13Speaker 1: We went from Android's Linux foundations, traced its rapid evolution
- 30:17Speaker 1: through pivotal versions like Lollipop and kit Kat with all
- 30:20Speaker 1: those neat features like artt and Doze.
- 30:24Speaker 2: The filesys details.
- 30:25Speaker 1: Yeah, explored the intricate dance of its filesys system data,
- 30:29Speaker 1: those pseudo filesystems, and that complex boot process starting way
- 30:33Speaker 1: down in the firmware, and.
- 30:34Speaker 2: The demons in its Zygote service manager installed the unsung.
- 30:39Speaker 1: Heroes exactly unveiled the critical roles of Inausley and those
- 30:43Speaker 1: essential demons and navigated the complex layers of security UIDs
- 30:47Speaker 1: so Linux capabilities, encryption, and finally the constant battle for
- 30:52Speaker 1: memory management that orchestrates it all.
- 30:54Speaker 2: And if we connect all that back to the bigger picture,
- 30:57Speaker 2: hopefully you now possess a far richer understanding of of
- 31:00Speaker 2: the frankly ingenious engineering that's humming away inside the device,
- 31:04Speaker 2: likely in your hand or pocket right now. Yeah, this
- 31:08Speaker 2: deep dive, I hope, has illuminated how Android meticulously balances
- 31:12Speaker 2: its open source nature, that flexibility with an unyielding need
- 31:16Speaker 2: for robust security, and how it constantly optimizes resources to
- 31:20Speaker 2: deliver the seamless powerful experience you've come to expect, all
- 31:23Speaker 2: without needing to weidhe through millions of lines of course
- 31:26Speaker 2: code yourself.
- 31:27Speaker 1: So what does this all mean for you listening right now? Android? Yeah,
- 31:30Speaker 1: it's an open source system, But how many people can
- 31:32Speaker 1: really sit down and sift through those millions of lines
- 31:35Speaker 1: of Java, c C plus plus XML all the rest
- 31:38Speaker 1: to figure out how it actually works, let alone connect
- 31:40Speaker 1: those intricate details back to their daily experience with their phone.
- 31:43Speaker 2: It's a huge undertaking, it is.
- 31:45Speaker 1: We hope this deep dive has revealed some of that
- 31:48Speaker 1: hitting complexity, maybe some surprising facts that make Android so powerful,
- 31:53Speaker 1: so adaptable, and also so resilient despite the challenges. The
- 31:56Speaker 1: real question is armed with this new found understanding of
- 31:59Speaker 1: its depths, what aspect of androids hidden world will you
- 32:02Speaker 1: explore next