# Saagar Jha

Saagar Jha's website.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Wiring Your House for Networking

DevFeed: [Wiring Your House for Networking](<https://devfeed.tech/articles/wiring-your-house-for-networking-27362.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2024/04/12/wiring-your-house-for-networking/>)

Published: 2024-04-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [networking](<https://devfeed.tech/topics/networking.md>), [Ethernet](<https://devfeed.tech/topics/ethernet.md>)

Tags: [ethernet](<https://devfeed.tech/tags/ethernet.md>), [networking](<https://devfeed.tech/tags/networking.md>), [wireless](<https://devfeed.tech/tags/wireless.md>)

### AI overview

A practical guide to wiring a home network with Cat6 and other Ethernet cables. It explains why wired connections generally provide better speed than wireless connections and discusses cable choices and network equipment.

### Source excerpt

You won't know it from reading my about page, but I no longer live in Cupertino. I haven't updated that for years-I don't spend much time in Southern California anymore either. I should probably get around to changing it someday.

## AttributeGraph and SwiftUI's Dependency Tracking

DevFeed: [AttributeGraph and SwiftUI's Dependency Tracking](<https://devfeed.tech/articles/making-friends-with-attributegraph-27361.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2024/02/27/making-friends-with-attributegraph/>)

Published: 2024-02-27T00:00:00Z

Content type: article

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [SwiftUI](<https://devfeed.tech/topics/swiftui.md>), [Graphs](<https://devfeed.tech/topics/graphs.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [ui](<https://devfeed.tech/topics/ui.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [graph](<https://devfeed.tech/tags/graph.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [swift](<https://devfeed.tech/tags/swift.md>), [swiftui](<https://devfeed.tech/tags/swiftui.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

The article examines AttributeGraph, a private C++ framework underlying SwiftUI, and explains how its attribute graph tracks data dependencies and helps determine when app updates are needed. It focuses on understanding SwiftUI's behavior through testable implementation hypotheses rather than using private APIs directly.

### Source excerpt

If you've used SwiftUI for long enough, you've probably noticed that the public Swift APIs it provides are really only half the story. Normally inconspicuous unless something goes exceedingly wrong, the private framework called AttributeGraph tracks almost every single aspect of your app from behind the scenes to make decisions on when things need to be updated. It would not be much of an exaggeration to suggest that this C++ library is actually what runs the show, with SwiftUI just being a thin veneer on top to draw some platform-appropriate controls and provide a stable interface to program against. True to its name, AttributeGraph provides the foundation of what a declarative UI framework needs: a graph of attributes that tracks data dependencies.

## Swift Concurrency Waits for No One

DevFeed: [Swift Concurrency Waits for No One](<https://devfeed.tech/articles/swift-concurrency-waits-for-no-one-27360.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2023/12/22/swift-concurrency-waits-for-no-one/>)

Published: 2023-12-22T00:00:00Z

Content type: article

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Code](<https://devfeed.tech/topics/code.md>), [API](<https://devfeed.tech/topics/api.md>), [POSIX](<https://devfeed.tech/topics/posix.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [code](<https://devfeed.tech/tags/code.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrent-programming](<https://devfeed.tech/tags/concurrent-programming.md>), [posix](<https://devfeed.tech/tags/posix.md>), [swift](<https://devfeed.tech/tags/swift.md>), [threads](<https://devfeed.tech/tags/threads.md>)

### AI overview

The article explains why Swift Concurrency requires careful handling when asynchronous work must be invoked from synchronous code and then awaited. It uses the example of spawning a Task and blocking with a semaphore to illustrate the complexity of preserving task forward progress, while contrasting Swift Concurrency with older concurrency APIs.

### Source excerpt

There was once a master engineer who lived by herself in a mystical, far off place, where nourishment flowed freely and the dirt beneath your feet was more valuable than gold. Inaccessible even by foot, only very few could make the trip for a chance at receiving her wisdom. A novice programmer, enthusiastic but still wet behind the ears, visited her one day. "I have read your code," he began, "and I can only describe it as sublime. But, I've been learning a lot about Swift Concurrency and I see that you don't use it all the time. Why is that?" The master engineer replied promptly with a question of her own: "Tell me, how would an asynchronous program call synchronous code?" "That's easy," he replied. "You can just call it directly." "Now, how would one invoke asynchronous code from a synchronous context?" "Spawn a Task, obviously!" replied the novice engineer, glad that his studies had come in handy. The master engineer smiled. "Very good. But now, imagine waiting for the work to complete before proceeding. What then? The API, naturally, is provided by the system and cannot be redesigned." This troubled the novice, and he furrowed his brow in concentration for some time. Finally, a half-forgotten memory came back to him: "DispatchSemaphore! I can use a semaphore to wait for the asynchronous work!" "Swift Concurrency requires tasks to make forward progress", responded the master engineer. Then she fell silent. After a while, the novice was enlightened.

## Apple's App Store Section 2.5.2 and Restrictions on Runtime Code Downloads

DevFeed: [Apple's App Store Section 2.5.2 and Restrictions on Runtime Code Downloads](<https://devfeed.tech/articles/fixing-section-2-5-2-27359.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2020/11/08/fixing-section-2-5-2/>)

Published: 2020-11-08T00:00:00Z

Content type: opinion

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [iOS](<https://devfeed.tech/topics/ios.md>), [App](<https://devfeed.tech/topics/app.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [apple](<https://devfeed.tech/tags/apple.md>), [apps](<https://devfeed.tech/tags/apps.md>), [code](<https://devfeed.tech/tags/code.md>), [ios](<https://devfeed.tech/tags/ios.md>), [review](<https://devfeed.tech/tags/review.md>)

### AI overview

The article examines Apple's App Review restrictions on downloading additional code at runtime, focusing on section 2.5.2 and its earlier formulation as section 2.7. It explains that the rule supports the premise of reviewing an app's behavior on a submitted build.

### Source excerpt

From its inception, applications that wished to make themselves available on the iOS App Store--the de-facto mechanism of third-party software distribution on the platform--have been required to conform to a set of guidelines laid out and enforced by Apple's App Review process. Apple's list of guidelines have expanded and been amended through the years, but the focus has largely remained the same: preventing the distribution of applications that are fraudulent, malicious, contain questionable or illegal content, or undermine Apple's business interests. Much has already been said about the review process as a whole or Apple's choice of guidelines, but we are going to focus on one guideline that may be one of the most important of them all: the rule that dictates restrictions on downloading additional code at runtime. For the last couple years, this rule has lived in section 2.5.2 of the guidelines, and this is the name that we will be using to refer to it.

## Mac App Store Sandbox Escape

DevFeed: [Mac App Store Sandbox Escape](<https://devfeed.tech/articles/mac-app-store-sandbox-escape-27358.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2020/05/20/mac-app-store-sandbox-escape/>)

Published: 2020-05-20T00:00:00Z

Content type: article

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [Security](<https://devfeed.tech/topics/security.md>), [macOS](<https://devfeed.tech/topics/macos.md>), [Access Control](<https://devfeed.tech/topics/access-control.md>), [Unix](<https://devfeed.tech/topics/unix.md>), [iOS](<https://devfeed.tech/topics/ios.md>)

Tags: [access-control](<https://devfeed.tech/tags/access-control.md>), [app-store](<https://devfeed.tech/tags/app-store.md>), [apple](<https://devfeed.tech/tags/apple.md>), [embedded-devices](<https://devfeed.tech/tags/embedded-devices.md>), [ios](<https://devfeed.tech/tags/ios.md>), [macos](<https://devfeed.tech/tags/macos.md>), [sandboxing](<https://devfeed.tech/tags/sandboxing.md>), [security](<https://devfeed.tech/tags/security.md>), [spi](<https://devfeed.tech/tags/spi.md>), [unix](<https://devfeed.tech/tags/unix.md>)

### AI overview

This article explains macOS App Sandbox architecture and reports a flaw in sandbox initialization that allowed malicious Mac App Store applications to bypass restrictions and perform unauthorized operations, including accessing sensitive user data. It states that Apple changed the Mac App Store and that the described technique should no longer work.

### Source excerpt

The App Sandbox, originally introduced in Mac OS X Leopard as "the Seatbelt", is a macOS security feature modeled after FreeBSD's Mandatory Access Control (left unabbreviated for clarity) that serves as a way to restrict the abilities of an application beyond the usual user- and permission-based systems that UNIX offers. The full extent of the capabilities the sandbox manages is fairly broad, ranging from file operations to Mach calls, and is specified in a custom Scheme implementation called the Sandbox Profile Language (SBPL). The sandbox profiles that macOS ships with can be found in /System/Library/Sandbox/Profiles, and while their format is technically SPI (as the header comment on them will tell you) there is fairly extensive third-party documentation. The implementation details of sandboxing are not intended to be accessed by third-party developers, but applications on Apple's platforms can request (and in some cases, such as new applications distributed on the Mac App Store and all applications for Apple's embedded platforms, must function in) a sandbox specified by a fixed, system-defined profile (on macOS, application.sb). Barring a few exceptions (which usually require additional review and justification for their use) this system-provided sandbox provide an effective way to prevent applications from accessing user data without consent or performing undesired system modifications.

## Reasons a company considers replacing its backend technology stack

DevFeed: [Reasons a company considers replacing its backend technology stack](<https://devfeed.tech/articles/why-we-at-famous-company-switched-to-hyped-technology-27357.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2020/05/10/why-we-at-famous-company-switched-to-hyped-technology/>)

Published: 2020-05-10T00:00:00Z

Content type: opinion

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [Back end](<https://devfeed.tech/topics/backend.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [garbage-collection](<https://devfeed.tech/tags/garbage-collection.md>), [latency](<https://devfeed.tech/tags/latency.md>), [rewrite](<https://devfeed.tech/tags/rewrite.md>)

### AI overview

A company describes considering a replacement for its backend technology stack. The stated concerns include latency spikes associated with garbage collection and difficulty hiring developers for its existing language.

### Source excerpt

When $FAMOUS_COMPANY launched in 2010, it ran on a single server in $TECHBRO_FOUNDER's garage. Since then, we've experienced explosive VC-funded growth and today we have hundreds of millions of daily active users (DAUs) from all around the globe accessing our products from our mobile apps and on $famouscompany.com. We've since made a couple of panic-induced changes to our backend to manage our technical debt (usually right after a high-profile outage) to keep our servers from keeling over. Our existing technology stack has served us well for all these years, but as we seek to grow further it's clear that a complete rewrite of our application is something which will somehow prevent us from losing two billion dollars a year on customer acquisition.

## Debugging Python Operator Precedence With MacsBug

DevFeed: [Debugging Python Operator Precedence With MacsBug](<https://devfeed.tech/articles/debugging-python-operator-precedence-with-macsbug-27356.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2020/04/22/debugging-python-operator-precedence-with-macsbug/>)

Published: 2020-04-22T00:00:00Z

Content type: article

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [ctf](<https://devfeed.tech/topics/ctf.md>), [debugging](<https://devfeed.tech/topics/debugging.md>)

Tags: [ctf](<https://devfeed.tech/tags/ctf.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [mac](<https://devfeed.tech/tags/mac.md>), [mac-os](<https://devfeed.tech/tags/mac-os.md>)

### AI overview

The article recounts solving challenges in PlaidCTF 2020, focusing on The Watness 2 reversing challenge. It describes identifying the challenge as related to a prior WebAssembly-based puzzle and opening its StuffIt archive using The Unarchiver.

### Source excerpt

I'm a Capture the Flag (CTF) player with Shellphish, and last weekend our team participated in PlaidCTF 2020, an event organized by the Plaid Parliament of Pwning (PPP). As a pre-qualifier for the DEF CON CTF 2020, it's historically been a fairly challenging competition-this year our team only managed to place 17th, slightly below our usual performance, as many of our team members were preoccupied with inconveniently-placed project deadlines. However, the rest of us had a great time working on the challenges; I helped solve two, golf.so and The Watness 2. golf.so was released early in the CTF and asked teams to create small shared libraries that would call execve("/bin/sh", ["/bin/sh"], ...) when LD_PRELOADed in to /bin/true; a number of us worked together to solve this fairly quickly, getting under 194 bytes (the requirement for the full 500 points) with some aggressive but straightforward segment overlapping, careful trimming of "required" but leniently checked fields, and stuffing of code into the remaining header bytes that were required but could be set to fairly arbitrary values. Some teams golfed it further to 136 bytes, although I'm not sure how (or why, beside bragging rights) they did so. The Watness 2 took longer and in my opinion was a bit more interesting, and this is the one we'll be talking about here.

## Designing a Better \`strcpy\`

DevFeed: [Designing a Better \`strcpy\`](<https://devfeed.tech/articles/designing-a-better-strcpy-27355.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2020/04/12/designing-a-better-strcpy/>)

Published: 2020-04-12T00:00:00Z

Content type: article

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [C](<https://devfeed.tech/topics/c.md>), [Security](<https://devfeed.tech/topics/security.md>), [POSIX](<https://devfeed.tech/topics/posix.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [function](<https://devfeed.tech/tags/function.md>), [memory](<https://devfeed.tech/tags/memory.md>), [security](<https://devfeed.tech/tags/security.md>)

### AI overview

This article examines the design of a safer and more efficient C string-copying function intended to preserve null termination, report truncation or overflow, minimize unnecessary memory access, support vectorization, and comply with portable standards such as ISO C or POSIX.

### Source excerpt

Like them or not, null-terminated strings are essential to C, and working with them is necessary in all but the most trivial programs. While C-style strings are a fundamental part of using the language, manipulating them is a common source of security bugs and lost performance. One of the most common operations is copying a string from one buffer to another, and there are a variety of string functions that claim to do this in C. Anecdotally, however, there is much confusion about what they actually do, and many people desire a string copying function with the following properties:

## Jailed Just-in-Time Compilation on iOS

DevFeed: [Jailed Just-in-Time Compilation on iOS](<https://devfeed.tech/articles/jailed-just-in-time-compilation-on-ios-27354.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2020/02/23/jailed-just-in-time-compilation-on-ios/>)

Published: 2020-02-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [JIT](<https://devfeed.tech/topics/jit.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [Security](<https://devfeed.tech/topics/security.md>), [virtual machines](<https://devfeed.tech/topics/virtual-machines.md>)

Tags: [ios](<https://devfeed.tech/tags/ios.md>), [jit](<https://devfeed.tech/tags/jit.md>), [security](<https://devfeed.tech/tags/security.md>), [virtual-machines](<https://devfeed.tech/tags/virtual-machines.md>), [writing](<https://devfeed.tech/tags/writing.md>)

### AI overview

This article explains how just-in-time compilation can work on iOS without a jailbreak despite the platform's dynamic-codesigning restrictions. It describes W^X permission switching and dual memory mappings that provide separate writable and executable views of the same physical page.

### Source excerpt

Just-in-time compilation on iOS normally requires applications to possess the dynamic-codesigning entitlement, a privilege that Apple uniquely awards to system processes that require the high-performance tiers of JavaScriptCore. "True" just-in-time compilers require the ability to generate executable pages with an invalid code signature, a practice that is usually prohibited on iOS for third-party apps because it sidesteps code validation guarantees that Apple would like to enforce. While these applications cannot use mmap's MAP_JIT without this entitlement (the usual way to create a RWX region for JIT purposes), there is a method that does work on devices without a jailbreak, though its combination of being unfit for the App Store and really only being useful for speeding up virtual machines makes it seemingly unknown outside of the emulation community. The technique relies on a somewhat arcane side effect of how debugging works on iOS to enable a slightly more limited JIT.

## AppKit in Swift Playgrounds

DevFeed: [AppKit in Swift Playgrounds](<https://devfeed.tech/articles/appkit-in-swift-playgrounds-27353.md>)

Original publisher: [Read original article](<https://saagarjha.com/blog/2020/02/11/appkit-in-swift-playgrounds/>)

Published: 2020-02-11T00:00:00Z

Content type: article

Language: en

Sources: [Saagar Jha](<https://devfeed.tech/sources/saagar-jha.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [macOS](<https://devfeed.tech/topics/macos.md>), [SDK](<https://devfeed.tech/topics/sdk.md>), [Code](<https://devfeed.tech/topics/code.md>), [Objective-C](<https://devfeed.tech/topics/objective-c.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [macos](<https://devfeed.tech/tags/macos.md>), [objective-c](<https://devfeed.tech/tags/objective-c.md>), [sdk](<https://devfeed.tech/tags/sdk.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

The article examines how Swift Playgrounds on macOS can import AppKit in a Mac Catalyst application, despite most Cocoa APIs being unavailable. It describes using the Objective-C runtime to create a native window and notes that official support may come in a future release.

### Source excerpt

A Catalyst version of the Swift Playgrounds app launched for macOS earlier today, with support for the Mac Catalyst platform SDK. While it's usually impractical to import AppKit in a Catalyst application, this is apparently now possible in Swift Playgrounds. Most Cocoa APIs have been marked as unavailable, but import AppKit does cause the image to actually end up being loaded so it only takes a little bit of work to be able to use them: