Explore the core architecture of the operating system, including the kernel, memory management, and process scheduling.

Posts under Core OS subtopic

Post

Replies

Boosts

Views

Activity

Core OS Resources
General: DevForums subtopic: App & System Services > Core OS Core OS is a catch-all subtopic for low-level APIs that don’t fall into one of these more specific areas: Processes & Concurrency Resources Files and Storage Resources Networking Resources Network Extension Resources Security Resources Virtualization Resources Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com"
0
0
1.7k
Aug ’25
More vCPUs, lower build performance (macOS VMs)
Hi everyone, We're running Xcode/Swift CI builds inside macOS VMs (Tart / Apple Virtualization Framework) on a 32-core Apple Silicon host. While investigating VM build performance, we noticed a consistent pattern: assigning 24 vCPUs to the VM produces faster overall build times than assigning 26-30 vCPUs, despite the host still showing idle CPU capacity. With higher vCPU allocations, the build starts by utilizing the CPUs well, but later stages show a noticeable drop in CPU utilization and overall build throughput. In contrast, the 24-vCPU configuration maintains more stable CPU usage and completes the workload faster. This was observed repeatedly with the same Xcode/Swift workload. The result seems counterintuitive because the VM is not exhausting the available host CPU resources. Our testing identified 24 vCPUs as the current sweet spot, even though the host provides 32 physical cores. Has anyone observed similar behavior? Some questions I have: Do Xcode builds stop scaling efficiently beyond a certain vCPU count? Are there known scheduler or virtualization effects when assigning nearly all host cores to a macOS VM? Is there a commonly recommended practice to leave a number of host cores unassigned, even when the host appears mostly idle?
1
0
46
19h
Best practices for handling nw_connection_state_waiting in Transparent Proxy
I am working on a Network Extension (Transparent Proxy) which is used by a DLP to prevent data leaks over the network. For each incoming NEAppProxyTCPFlow, the extension instantiates a custom wrapper object that creates an outbound nw_connection_t to the target host and port using Network framework. When a client application connects to unreachable or blocked ports (e.g., 5222), our extension proxies this connection. As the destination is unreachable, the newly created connection transitions into nw_connection_state_waiting in Network Extension. Since macOS keeps nw_connection_t in the nw_connection_state_waiting state indefinitely, such connections cause system resource leaks. Over time, this leads to: exhaustion of system file descriptors and sockets. system-wide network unavailability until the extension process is killed. Could you provide best-practice recommendations for handling nw_connection_state_waiting in a Network Extension to prevent such resource leaks?
0
0
39
22h
User created via VZMacGuestProvisioningOptions is not returned by CSIdentityQueryExecute()
This post applies to Apple Virtualization framework feature to setup a user account during VM setup (VZMacGuestProvisioningOptions) introduced in macOS 27: Issue: Creating a user via VZMacGuestProvisioningOptions during VM setup, results in a user which is not returned by CSidentityQueryExecute(). Same code executed on a macOS 26 VM or a macOS 27 VM where the user was created by hand within the VM (so without VZMacGuestProvisioningOptions) returns the user. How to reproduce: Create an VM via the Apple Virtualization framework and use the VZMacGuestProvisioningOptions to create the user during VM setup. I actually used Virtual Buddy and Tart to do this. Then run the following code: internal enum MyLogger { static let info = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "Utils-\(getuid())") } public struct Identity { public let posixUID: id_t public let posixName: String init?(posixUID: id_t, posixName: String) { self.posixUID = posixUID self.posixName = posixName } } class Utils { public static func userIdentities() -> [Identity] { let defaultAuthority = CSGetLocalIdentityAuthority().takeUnretainedValue() let query = CSIdentityQueryCreate(nil, kCSIdentityClassUser, defaultAuthority).takeRetainedValue() guard CSIdentityQueryExecute(query, 0, nil), let identities = CSIdentityQueryCopyResults(query).takeRetainedValue() as? [CSIdentity] else { return [] } for ident in identities { MyLogger.info.log("CSIdentity: \(ident.hashValue, privacy: .public)") } let idents = identities .compactMap { Identity( posixUID: CSIdentityGetPosixID($0), posixName: CSIdentityGetPosixName($0).takeUnretainedValue() as String ) } .sorted { $0.posixName.localizedStandardCompare($1.posixName) == .orderedAscending } for ident in idents { MyLogger.info.log("Identity: \(ident.posixName, privacy: .public), \(ident.posixUID, privacy: .public)") } return idents } } Expected behavior: The code returns the user account created via VZMacGuestProvisioningOptions. Actual behavior: I get no user account When you test the same on a macOS 27 VM where the user is created via the traditional way (Setup assistant), the app shows the account. This also applies to all additional user accounts created after VM setup via System Settings.app. The bug also still exists on a VM created with macOS 27 beta 4. Is anybody having the same issue? Is that a bug in macOS 27? I already created a Feedback for this: FB23716201
4
0
620
1d
Title: PackageKit install fails with PKInstallErrorDomain Code=120 and NSPOSIXErrorDomain Code=1 during _relinkFile operation Body: We are investigating an intermittent package installation failure on macOS Tahoe 26.5 and are trying to understand
We are investigating an intermittent package installation failure on macOS Tahoe 26.5 and are trying to understand the conditions under which PackageKit may return the following errors during an upgrade installation: PKInstallErrorDomain Code=120 NSPOSIXErrorDomain Code=1 ("Operation not permitted") The package successfully passes validation and authorization, and pre-install scripts complete successfully. The failure occurs during the final PackageKit commit phase when PackageKit attempts to move/relink content from the installer sandbox to the destination volume. Relevant log snippets: PackageKit: Shoving /Root to / Error relinking file (primary): .../Contents/_CodeSignature/CodeResources failed _relinkFile(...) Operation not permitted PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=120 NSUnderlyingError: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" The issue is intermittent and only affects a subset of systems. The same package installs successfully on many machines running the same macOS version. Has anyone encountered similar _relinkFile / CodeResources failures during package upgrades? In particular, we are interested in understanding: Common causes of NSPOSIXErrorDomain Code=1 during PackageKit relink operations. Whether existing signed application bundle metadata (CodeResources) can cause relink failures during upgrades. Any Installer or PackageKit changes in recent Tahoe releases that could affect bundle replacement during package installation. Any insights would be appreciated.
5
0
297
1d
FileProvider & FSKit compatability
I've been trying to mount an FSKit volume at the location where FileProvider saves files: ~/Library/CloudStorage . I've discovered that FileProvider attempts to call setAttributes in order to assign a value for an access control list (ACL). This call fails, because FSKit does not support this attribute, and causes FileProvider to stop working. FileProvider refuses to continue beyond creating it's domain folder when this occurs. Do you believe this constitutes a valid enhancement request for FSKit and/or FileProvider?
1
0
120
2d
Is it possible to run macOS VM (Virtualization API) under a launchd daemon?
Hi, I was trying to run a macOS VM under a launchd daemon as part of a requirement. The parent daemon spawns a macOS VM under root user. Sometimes this is fine, but sometimes I'm getting a security error from VZ library : Unable to access security information. The virtual machine encountered a security error. In system logs, I was able to see this : ctkd: unable to generate key: error e00002e2 for com.apple.Virtualization.VirtualMachine with SepKey ACL I think this indicates Virtualization.framework asked CryptoTokenKit/Secure Enclave to create a key, and the security subsystem rejected it in the current execution context. Is it possible to run VM this way ? If yes, what am I missing ?
1
0
90
3d
Pinpointing dandling pointers in 3rd party KEXTs
I'm debugging the following kernel panic to do with my custom filesystem KEXT: panic(cpu 0 caller 0xfffffe004cae3e24): [kalloc.type.var4.128]: element modified after free (off:96, val:0x00000000ffffffff, sz:128, ptr:0xfffffe2e7c639600) My reading of this is that somewhere in my KEXT I'm holding a reference 0xfffffe2e7c639600 to a 128 byte zone that wrote 0x00000000ffffffff at offset 96 after that particular chunk of memory had been released and zeroed out by the kernel. The panic itself is emitted when my KEXT requests the memory chunk that's been tempered with via the following set of calls. zalloc_uaf_panic() __abortlike static void zalloc_uaf_panic(zone_t z, uintptr_t elem, size_t size) { ... (panic)("[%s%s]: element modified after free " "(off:%d, val:0x%016lx, sz:%d, ptr:%p)%s", zone_heap_name(z), zone_name(z), first_offs, first_bits, esize, (void *)elem, buf); ... } zalloc_validate_element() static void zalloc_validate_element( zone_t zone, vm_offset_t elem, vm_size_t size, zalloc_flags_t flags) { ... if (memcmp_zero_ptr_aligned((void *)elem, size)) { zalloc_uaf_panic(zone, elem, size); } ... } The panic is triggered if memcmp_zero_ptr_aligned(), which is implemented in assembly, detects that an n-sized chunk of memory has been written after being free'd. /* memcmp_zero_ptr_aligned() checks string s of n bytes contains all zeros. * Address and size of the string s must be pointer-aligned. * Return 0 if true, 1 otherwise. Also return 0 if n is 0. */ extern int memcmp_zero_ptr_aligned(const void *s, size_t n); Normally, KASAN would be resorted to to aid with that. The KDK README states that KASAN kernels won't load on Apple Silicon. Attempting to follow the instructions given in the README for Intel-based machines does result in a failure for me on Apple Silicon. I stumbled on the Pishi project. But the custom boot kernel collection that gets created doesn't have any of the KEXTs that were specified to kmutil(8) via the --explicit-only flag, so it can't be instrumented in Ghidra. Which is confirmed as well by running: % kmutil inspect -B boot.kc.kasan boot kernel collection at /Users/user/boot.kc.kasan (AEB8F757-E770-8195-458D-B87CADCAB062): Extension Information: I'd appreciate any pointers on how to tackle UAFs in kernel space.
12
0
1.6k
3d
蓝牙设备是否可以在不同应用状态(后台、锁屏、应用被终止)下唤醒 App?
大家好, 我们正在开发一款基于 CoreBluetooth 的 iOS 应用,希望确认 iOS 在不同应用生命周期状态下的预期行为。 我们主要关注以下几种常见场景: App 在后台运行(未被终止); iPhone 处于锁屏状态,App 在后台运行; iPhone 处于锁屏状态,App 已被系统终止; iPhone 处于锁屏状态,App 已被用户从后台上滑关闭(Force Quit)。 当 BLE Peripheral 发生与该 App 相关的广播、连接或其他蓝牙事件时,我们想确认: 在上述不同场景下,BLE 设备是否能够触发 iOS 唤醒、启动或重新启动 App? 如果可以,不同场景分别需要满足哪些条件(例如 CoreBluetooth Background Modes、State Restoration、连接事件等)? 如果 App 已被用户 Force Quit,是否仍存在任何可以重新启动 App 的官方支持方式? 锁屏状态是否会对上述行为产生额外限制? 我们的目标是了解 iOS 官方支持的能力边界,以及不同应用状态下 BLE 与 App 生命周期的交互行为,而不是具体的实现细节。 感谢大家!
5
0
753
3d
Monterey:Network System Extension OSSystemExtensionRequest.deactivationRequest fails with authorizationRequired = 13
Hello, On Mac OS monterey, OSSystemExtensionRequest.deactivationRequest is failing with deactivation request for com.xxxxxx.networkextensionapp.netextension failed authorization check, error: Error Domain=OSSystemExtensionErrorDomain Code=13 "(null)" Even after providing the correct credentials for authorisation when prompted for.
4
0
1.8k
4d
Kernel Sandbox/System Policy intermittently denies ALL file access (not just mount syscall) on NFS mounts
I'm seeing a recurring issue on macOS 26.5.2 (build 25F84) where the kernel's Sandbox/System Policy layer intermittently denies file access on NFS mount points from local network servers. Posting here in case anyone recognizes this pattern or has a workaround, and flagging it since I've also filed a Feedback Assistant report (with a live-captured sysdiagnose) for the same issue. WHAT HAPPENS Two independent NFS mounts to two separate, unrelated servers on my LAN start failing simultaneously with "Operation not permitted." The kernel log shows: kernel: (Sandbox) System Policy: mount_nfs(PID) deny(1) file-mount /path/to/mount Critically, it's not limited to the mount syscall - within the same few-second window, System Policy also denies ls, perl, diskutil, and even umount -f on the exact same path, for otherwise unrelated processes. So it looks like a transient, path-scoped kernel decision rather than something specific to NFS or the mount syscall. It self-heals anywhere from seconds to ~30 minutes later, then recurs - documented 30-80+ occurrences/day via a background watchdog script. WHAT I'VE RULED OUT Server-side cause: two independent servers on different hardware fail identically at the same instant. Network issue: checked network logs in the same window, no correlated connectivity event. Third-party kext conflict: kextstat shows zero third-party kexts loaded. syspolicyd database corruption: no "ASP: Validation category" signature present. TCC/Full Disk Access: already granted; the denying layer is kernel Sandbox "System Policy," not TCC. QUESTION Has anyone else run into System Policy denying file-mount/file-read-data/file-unmount on network volume paths intermittently like this? Is there any userland way to inspect or reset whatever internal state drives this decision (I haven't found one - no spctl/tccutil/sysctl lever that touches it)? Happy to share more log excerpts if useful.
18
0
1.1k
4d
Does the Channel Sounding have regional restrictions by country?
I'm trying to get the new Bluetooth Channel Sounding distance measurement working between an iPhone 17 running iOS 27 Beta4 and a Nordic nRF54L15DK board. I enabled bonding in the latest ipt_reflector sample from Nordic. Someone get the sample working with iOS 27 beta1. I paired the board with AccessorySetupKit. I suspect that the Channel Sounding feature is subject to regional restrictions by country (China). Here's the code to check if CS is available on my iPhone func centralManagerDidUpdateState(_ central: CBCentralManager) { switch central.state { case .poweredOn: print("central update") if CBCentralManager.supports(.channelSounding) { print("Supports channel sounding - YES") } else { print("Supports channel sounding - NO") } if let id = pendingPeripheralIdentifier, let name = pendingPeripheralName { pendingPeripheralIdentifier = nil pendingPeripheralName = nil retrieveAndConnect(identifier: id, name: name) } case .poweredOff: connectionState = .bluetoothOff case .unauthorized: connectionState = .error("Bluetooth not authorized — check Settings") case .unsupported: connectionState = .error("BLE not supported on this device") default: break } } The console log shows [ASK] Session activated — accessories: 1 central update Supports channel sounding - NO [CS] startChannelSounding skipped — channelSounding not supported Please also check the topic. it's very similar.
1
0
449
4d
Apple Silicon prevents execution of wine for Windows ARM64 binaries due to JIT/W^X restrictions and x18 register reservation
I am porting Wine to macOS to run Windows on ARM (WOA) binaries. Windows PE files place .text and .data in the same page, which macOS’s JIT/W^X model cannot handle. pthread_jit_write_protect_np() cannot be used for foreign ARM64 code. Apple Silicon reserves x18, breaking the Windows ARM64 ABI. Wine also must reserve 0x7FFE0000 for the Windows TEB, but macOS cannot guarantee this address. These issues make it impossible for Wine to load or execute WOA binaries. I am requesting mechanisms to safely execute foreign ARM64 code, support mixed W/X pages, emulate x18, and reserve the Windows TEB region. Branch is here: https://github.com/trcrsired/wine/tree/apple-silicon-mac-woa
1
0
118
4d
Possible change in sysctlbyname() / oldlenp behavior on iOS and iPadOS 27
I am investigating an issue involving sysctlbyname("hw.machine", ...) that became observable after moving to iOS/iPadOS 27. The affected legacy code is essentially the following: void getPlatform(unsigned char machine[]) { size_t size; sysctlbyname("hw.machine", machine, &size, NULL, 0); for (int i = 0; i < size; i++) { if (machine[i] == ',') { machine[i] = '.'; } } } The caller provides a zero-initialized fixed-size buffer: unsigned char machine[20] = {0}; getPlatform(machine); I understand that this implementation is incorrect because size is not initialized. When oldp is non-NULL, oldlenp must provide the available size of the buffer. A correct implementation would therefore initialize it, for example: void getPlatform(unsigned char *machine, size_t capacity) { size_t size = capacity; if (sysctlbyname("hw.machine", machine, &size, NULL, 0) != 0) return; for (size_t i = 0; i < size; i++) { if (machine[i] == ',') machine[i] = '.'; } } with: unsigned char machine[20] = {0}; getPlatform(machine, sizeof(machine)); The question is not whether the original implementation is valid. It clearly relies on an uninitialized value and should be corrected. What I am trying to understand is why the issue became observable specifically on iOS/iPadOS 27, and whether there has been any related implementation or documentation change. Using LLDB, I inspected the arguments at the entry to: sysctlbyname("hw.machine", machine, &size, NULL, 0); Because size is uninitialized, the value referenced by oldlenp varies depending on the contents of the stack location. For example, I observed a call where: *oldlenp = 0 The call then returned: return = -1 errno = 12 (ENOMEM) and the output buffer remained empty. In another execution, the same uninitialized stack location happened to contain a very large value. In that case sysctlbyname() succeeded and returned the expected hardware identifier: iPhone18,2 Adding unrelated code such as printf() can also change whether the original implementation succeeds, which is consistent with the uninitialized value being affected by changes in stack/register layout. There is also a second issue I would like clarification on regarding the documented behavior of oldlenp. The current documentation states that when the amount of data is greater than the value supplied through oldlenp, the function updates it to the required size and returns ENOMEM. It also states: The function doesn’t modify the value if it’s larger than or equal to the amount of available data. However, this does not match what I observed at runtime. For example, in one successful call I observed: Before sysctlbyname(): *oldlenp = 4301365248 The value was clearly much larger than required. After the call returned successfully: return = 0 machine = "iPhone18,2" *oldlenp = actual returned data length In other words, oldlenp was modified on a successful call even though the input value was already much larger than the amount of data being returned. I would appreciate clarification on the following: Was there any implementation change to sysctlbyname(), sysctl(), or the handling of oldlenp in iOS/iPadOS 27? Have there been changes in compiler/runtime behavior on iOS/iPadOS 27 that could make this type of existing uninitialized-variable bug surface more consistently? Is the documented statement that oldlenp is not modified when the supplied value is sufficiently large still accurate for sysctlbyname() on current iOS versions? Has the documentation or intended contract for oldlenp changed recently? Have other developers observed ENOMEM from existing sysctlbyname() code after updating to iOS/iPadOS 27? Again, I understand that the original code is incorrect and should initialize oldlenp before calling sysctlbyname(). The part I am trying to clarify is whether iOS/iPadOS 27 introduced any behavioral change that exposed this latent bug, and whether the currently documented successful-call behavior of oldlenp matches the actual implementation.
2
0
167
4d
Behavior of cblas_zgemv when array contains nan.
In NumPy (actually originally in SciPy), we found a case where multiplying a complex matrix that contains inf+nanj by a complex vector could result in nan in the output vector in positions where the corresponding rows of the inputs did not contain nan. I have a C++ program and data to demonstrate this at https://github.com/WarrenWeckesser/experiments/tree/main/c%2B%2B/accelerate-zgemv-bug. When the full matrix CC is multiplied with the vector weights, the output at element 17 is nan. When just row 17 of CC is multiplied with weights, the result is not nan. The matrix CC does have some occurrences of inf+nanj, but not in the row that produces element 17 of the output. Is this a bug? Is there some way that the value inf+nanj in the input matrix can "contaminate" the output in a position that should give a non-nan value?
3
0
314
1w
Managed Apple ID works for iMessage on bare metal, but fails in macOS VM (same hardware)
Hi all, I'm running 2 macOS VMs on a bare-metal Mac (host is also macOS). I'm seeing inconsistent iMessage sign-in behavior depending on the Apple ID type and whether it's bare metal or virtualized: Managed Apple ID (ABM-issued): signs into iMessage fine on the bare-metal host. Same Managed Apple ID: fails to sign into iMessage inside the VM on the same physical machine. Personal/basic Apple ID: signs in fine in the VM without issue. Has anyone run into this specific combination — MAID working on bare metal but not inside a VM, while a personal ID works fine in both?
2
0
343
1w
Using AppKit and Core Graphics within a CUPS filter context on macOS
Hello, I am currently developing a printed data security feature for a cross-platform DLP system. On other platforms, this functionality relies on a cross-platform third-party library. On macOS, this library depends on the Core Graphics and AppKit frameworks. So, such dependency makes it impossible to use the code within a launch daemon, which is where this mechanism needs to run. As an alternative approach, I am considering implementing the necessary functionality inside a CUPS filter. However, I have some doubts regarding the execution context of the CUPS filter process. Is it safe to use AppKit within a CUPS filter? Thank you in advance.
0
0
171
1w
Core OS Resources
General: DevForums subtopic: App & System Services > Core OS Core OS is a catch-all subtopic for low-level APIs that don’t fall into one of these more specific areas: Processes & Concurrency Resources Files and Storage Resources Networking Resources Network Extension Resources Security Resources Virtualization Resources Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com"
Replies
0
Boosts
0
Views
1.7k
Activity
Aug ’25
Are deeplinks to Apple apps acceptable?
I see online theres list of urls app can use to deeplink to Apple apps: https://github.com/bhagyas/app-urls#references-and-additional-resources are these acceptable by Apple? Apps just want to redirect the user so they can take some appropriate action.
Replies
0
Boosts
0
Views
28
Activity
18h
More vCPUs, lower build performance (macOS VMs)
Hi everyone, We're running Xcode/Swift CI builds inside macOS VMs (Tart / Apple Virtualization Framework) on a 32-core Apple Silicon host. While investigating VM build performance, we noticed a consistent pattern: assigning 24 vCPUs to the VM produces faster overall build times than assigning 26-30 vCPUs, despite the host still showing idle CPU capacity. With higher vCPU allocations, the build starts by utilizing the CPUs well, but later stages show a noticeable drop in CPU utilization and overall build throughput. In contrast, the 24-vCPU configuration maintains more stable CPU usage and completes the workload faster. This was observed repeatedly with the same Xcode/Swift workload. The result seems counterintuitive because the VM is not exhausting the available host CPU resources. Our testing identified 24 vCPUs as the current sweet spot, even though the host provides 32 physical cores. Has anyone observed similar behavior? Some questions I have: Do Xcode builds stop scaling efficiently beyond a certain vCPU count? Are there known scheduler or virtualization effects when assigning nearly all host cores to a macOS VM? Is there a commonly recommended practice to leave a number of host cores unassigned, even when the host appears mostly idle?
Replies
1
Boosts
0
Views
46
Activity
19h
Best practices for handling nw_connection_state_waiting in Transparent Proxy
I am working on a Network Extension (Transparent Proxy) which is used by a DLP to prevent data leaks over the network. For each incoming NEAppProxyTCPFlow, the extension instantiates a custom wrapper object that creates an outbound nw_connection_t to the target host and port using Network framework. When a client application connects to unreachable or blocked ports (e.g., 5222), our extension proxies this connection. As the destination is unreachable, the newly created connection transitions into nw_connection_state_waiting in Network Extension. Since macOS keeps nw_connection_t in the nw_connection_state_waiting state indefinitely, such connections cause system resource leaks. Over time, this leads to: exhaustion of system file descriptors and sockets. system-wide network unavailability until the extension process is killed. Could you provide best-practice recommendations for handling nw_connection_state_waiting in a Network Extension to prevent such resource leaks?
Replies
0
Boosts
0
Views
39
Activity
22h
Vision OS Mac intel
Can I use Vision OS, on Mac with intel(2019) ? If yes with what version of Xcode?
Replies
5
Boosts
0
Views
1.3k
Activity
23h
User created via VZMacGuestProvisioningOptions is not returned by CSIdentityQueryExecute()
This post applies to Apple Virtualization framework feature to setup a user account during VM setup (VZMacGuestProvisioningOptions) introduced in macOS 27: Issue: Creating a user via VZMacGuestProvisioningOptions during VM setup, results in a user which is not returned by CSidentityQueryExecute(). Same code executed on a macOS 26 VM or a macOS 27 VM where the user was created by hand within the VM (so without VZMacGuestProvisioningOptions) returns the user. How to reproduce: Create an VM via the Apple Virtualization framework and use the VZMacGuestProvisioningOptions to create the user during VM setup. I actually used Virtual Buddy and Tart to do this. Then run the following code: internal enum MyLogger { static let info = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "Utils-\(getuid())") } public struct Identity { public let posixUID: id_t public let posixName: String init?(posixUID: id_t, posixName: String) { self.posixUID = posixUID self.posixName = posixName } } class Utils { public static func userIdentities() -> [Identity] { let defaultAuthority = CSGetLocalIdentityAuthority().takeUnretainedValue() let query = CSIdentityQueryCreate(nil, kCSIdentityClassUser, defaultAuthority).takeRetainedValue() guard CSIdentityQueryExecute(query, 0, nil), let identities = CSIdentityQueryCopyResults(query).takeRetainedValue() as? [CSIdentity] else { return [] } for ident in identities { MyLogger.info.log("CSIdentity: \(ident.hashValue, privacy: .public)") } let idents = identities .compactMap { Identity( posixUID: CSIdentityGetPosixID($0), posixName: CSIdentityGetPosixName($0).takeUnretainedValue() as String ) } .sorted { $0.posixName.localizedStandardCompare($1.posixName) == .orderedAscending } for ident in idents { MyLogger.info.log("Identity: \(ident.posixName, privacy: .public), \(ident.posixUID, privacy: .public)") } return idents } } Expected behavior: The code returns the user account created via VZMacGuestProvisioningOptions. Actual behavior: I get no user account When you test the same on a macOS 27 VM where the user is created via the traditional way (Setup assistant), the app shows the account. This also applies to all additional user accounts created after VM setup via System Settings.app. The bug also still exists on a VM created with macOS 27 beta 4. Is anybody having the same issue? Is that a bug in macOS 27? I already created a Feedback for this: FB23716201
Replies
4
Boosts
0
Views
620
Activity
1d
Title: PackageKit install fails with PKInstallErrorDomain Code=120 and NSPOSIXErrorDomain Code=1 during _relinkFile operation Body: We are investigating an intermittent package installation failure on macOS Tahoe 26.5 and are trying to understand
We are investigating an intermittent package installation failure on macOS Tahoe 26.5 and are trying to understand the conditions under which PackageKit may return the following errors during an upgrade installation: PKInstallErrorDomain Code=120 NSPOSIXErrorDomain Code=1 ("Operation not permitted") The package successfully passes validation and authorization, and pre-install scripts complete successfully. The failure occurs during the final PackageKit commit phase when PackageKit attempts to move/relink content from the installer sandbox to the destination volume. Relevant log snippets: PackageKit: Shoving /Root to / Error relinking file (primary): .../Contents/_CodeSignature/CodeResources failed _relinkFile(...) Operation not permitted PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=120 NSUnderlyingError: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" The issue is intermittent and only affects a subset of systems. The same package installs successfully on many machines running the same macOS version. Has anyone encountered similar _relinkFile / CodeResources failures during package upgrades? In particular, we are interested in understanding: Common causes of NSPOSIXErrorDomain Code=1 during PackageKit relink operations. Whether existing signed application bundle metadata (CodeResources) can cause relink failures during upgrades. Any Installer or PackageKit changes in recent Tahoe releases that could affect bundle replacement during package installation. Any insights would be appreciated.
Replies
5
Boosts
0
Views
297
Activity
1d
Launch Transparent Proxy Network Extension in machine login window on macOS
Hi, Is there a way on macOS to launch Transparent Proxy Network Extension in machine login window? on-demand rule doesn't help. I have this use case that after reboot machine, I want to launch Transparent Proxy Network Extension in machine login window before user log into machine.
Replies
2
Boosts
0
Views
78
Activity
2d
FileProvider & FSKit compatability
I've been trying to mount an FSKit volume at the location where FileProvider saves files: ~/Library/CloudStorage . I've discovered that FileProvider attempts to call setAttributes in order to assign a value for an access control list (ACL). This call fails, because FSKit does not support this attribute, and causes FileProvider to stop working. FileProvider refuses to continue beyond creating it's domain folder when this occurs. Do you believe this constitutes a valid enhancement request for FSKit and/or FileProvider?
Replies
1
Boosts
0
Views
120
Activity
2d
Is it possible to run macOS VM (Virtualization API) under a launchd daemon?
Hi, I was trying to run a macOS VM under a launchd daemon as part of a requirement. The parent daemon spawns a macOS VM under root user. Sometimes this is fine, but sometimes I'm getting a security error from VZ library : Unable to access security information. The virtual machine encountered a security error. In system logs, I was able to see this : ctkd: unable to generate key: error e00002e2 for com.apple.Virtualization.VirtualMachine with SepKey ACL I think this indicates Virtualization.framework asked CryptoTokenKit/Secure Enclave to create a key, and the security subsystem rejected it in the current execution context. Is it possible to run VM this way ? If yes, what am I missing ?
Replies
1
Boosts
0
Views
90
Activity
3d
Pinpointing dandling pointers in 3rd party KEXTs
I'm debugging the following kernel panic to do with my custom filesystem KEXT: panic(cpu 0 caller 0xfffffe004cae3e24): [kalloc.type.var4.128]: element modified after free (off:96, val:0x00000000ffffffff, sz:128, ptr:0xfffffe2e7c639600) My reading of this is that somewhere in my KEXT I'm holding a reference 0xfffffe2e7c639600 to a 128 byte zone that wrote 0x00000000ffffffff at offset 96 after that particular chunk of memory had been released and zeroed out by the kernel. The panic itself is emitted when my KEXT requests the memory chunk that's been tempered with via the following set of calls. zalloc_uaf_panic() __abortlike static void zalloc_uaf_panic(zone_t z, uintptr_t elem, size_t size) { ... (panic)("[%s%s]: element modified after free " "(off:%d, val:0x%016lx, sz:%d, ptr:%p)%s", zone_heap_name(z), zone_name(z), first_offs, first_bits, esize, (void *)elem, buf); ... } zalloc_validate_element() static void zalloc_validate_element( zone_t zone, vm_offset_t elem, vm_size_t size, zalloc_flags_t flags) { ... if (memcmp_zero_ptr_aligned((void *)elem, size)) { zalloc_uaf_panic(zone, elem, size); } ... } The panic is triggered if memcmp_zero_ptr_aligned(), which is implemented in assembly, detects that an n-sized chunk of memory has been written after being free'd. /* memcmp_zero_ptr_aligned() checks string s of n bytes contains all zeros. * Address and size of the string s must be pointer-aligned. * Return 0 if true, 1 otherwise. Also return 0 if n is 0. */ extern int memcmp_zero_ptr_aligned(const void *s, size_t n); Normally, KASAN would be resorted to to aid with that. The KDK README states that KASAN kernels won't load on Apple Silicon. Attempting to follow the instructions given in the README for Intel-based machines does result in a failure for me on Apple Silicon. I stumbled on the Pishi project. But the custom boot kernel collection that gets created doesn't have any of the KEXTs that were specified to kmutil(8) via the --explicit-only flag, so it can't be instrumented in Ghidra. Which is confirmed as well by running: % kmutil inspect -B boot.kc.kasan boot kernel collection at /Users/user/boot.kc.kasan (AEB8F757-E770-8195-458D-B87CADCAB062): Extension Information: I'd appreciate any pointers on how to tackle UAFs in kernel space.
Replies
12
Boosts
0
Views
1.6k
Activity
3d
蓝牙设备是否可以在不同应用状态(后台、锁屏、应用被终止)下唤醒 App?
大家好, 我们正在开发一款基于 CoreBluetooth 的 iOS 应用,希望确认 iOS 在不同应用生命周期状态下的预期行为。 我们主要关注以下几种常见场景: App 在后台运行(未被终止); iPhone 处于锁屏状态,App 在后台运行; iPhone 处于锁屏状态,App 已被系统终止; iPhone 处于锁屏状态,App 已被用户从后台上滑关闭(Force Quit)。 当 BLE Peripheral 发生与该 App 相关的广播、连接或其他蓝牙事件时,我们想确认: 在上述不同场景下,BLE 设备是否能够触发 iOS 唤醒、启动或重新启动 App? 如果可以,不同场景分别需要满足哪些条件(例如 CoreBluetooth Background Modes、State Restoration、连接事件等)? 如果 App 已被用户 Force Quit,是否仍存在任何可以重新启动 App 的官方支持方式? 锁屏状态是否会对上述行为产生额外限制? 我们的目标是了解 iOS 官方支持的能力边界,以及不同应用状态下 BLE 与 App 生命周期的交互行为,而不是具体的实现细节。 感谢大家!
Replies
5
Boosts
0
Views
753
Activity
3d
Monterey:Network System Extension OSSystemExtensionRequest.deactivationRequest fails with authorizationRequired = 13
Hello, On Mac OS monterey, OSSystemExtensionRequest.deactivationRequest is failing with deactivation request for com.xxxxxx.networkextensionapp.netextension failed authorization check, error: Error Domain=OSSystemExtensionErrorDomain Code=13 "(null)" Even after providing the correct credentials for authorisation when prompted for.
Replies
4
Boosts
0
Views
1.8k
Activity
4d
Kernel Sandbox/System Policy intermittently denies ALL file access (not just mount syscall) on NFS mounts
I'm seeing a recurring issue on macOS 26.5.2 (build 25F84) where the kernel's Sandbox/System Policy layer intermittently denies file access on NFS mount points from local network servers. Posting here in case anyone recognizes this pattern or has a workaround, and flagging it since I've also filed a Feedback Assistant report (with a live-captured sysdiagnose) for the same issue. WHAT HAPPENS Two independent NFS mounts to two separate, unrelated servers on my LAN start failing simultaneously with "Operation not permitted." The kernel log shows: kernel: (Sandbox) System Policy: mount_nfs(PID) deny(1) file-mount /path/to/mount Critically, it's not limited to the mount syscall - within the same few-second window, System Policy also denies ls, perl, diskutil, and even umount -f on the exact same path, for otherwise unrelated processes. So it looks like a transient, path-scoped kernel decision rather than something specific to NFS or the mount syscall. It self-heals anywhere from seconds to ~30 minutes later, then recurs - documented 30-80+ occurrences/day via a background watchdog script. WHAT I'VE RULED OUT Server-side cause: two independent servers on different hardware fail identically at the same instant. Network issue: checked network logs in the same window, no correlated connectivity event. Third-party kext conflict: kextstat shows zero third-party kexts loaded. syspolicyd database corruption: no "ASP: Validation category" signature present. TCC/Full Disk Access: already granted; the denying layer is kernel Sandbox "System Policy," not TCC. QUESTION Has anyone else run into System Policy denying file-mount/file-read-data/file-unmount on network volume paths intermittently like this? Is there any userland way to inspect or reset whatever internal state drives this decision (I haven't found one - no spctl/tccutil/sysctl lever that touches it)? Happy to share more log excerpts if useful.
Replies
18
Boosts
0
Views
1.1k
Activity
4d
Does the Channel Sounding have regional restrictions by country?
I'm trying to get the new Bluetooth Channel Sounding distance measurement working between an iPhone 17 running iOS 27 Beta4 and a Nordic nRF54L15DK board. I enabled bonding in the latest ipt_reflector sample from Nordic. Someone get the sample working with iOS 27 beta1. I paired the board with AccessorySetupKit. I suspect that the Channel Sounding feature is subject to regional restrictions by country (China). Here's the code to check if CS is available on my iPhone func centralManagerDidUpdateState(_ central: CBCentralManager) { switch central.state { case .poweredOn: print("central update") if CBCentralManager.supports(.channelSounding) { print("Supports channel sounding - YES") } else { print("Supports channel sounding - NO") } if let id = pendingPeripheralIdentifier, let name = pendingPeripheralName { pendingPeripheralIdentifier = nil pendingPeripheralName = nil retrieveAndConnect(identifier: id, name: name) } case .poweredOff: connectionState = .bluetoothOff case .unauthorized: connectionState = .error("Bluetooth not authorized — check Settings") case .unsupported: connectionState = .error("BLE not supported on this device") default: break } } The console log shows [ASK] Session activated — accessories: 1 central update Supports channel sounding - NO [CS] startChannelSounding skipped — channelSounding not supported Please also check the topic. it's very similar.
Replies
1
Boosts
0
Views
449
Activity
4d
Apple Silicon prevents execution of wine for Windows ARM64 binaries due to JIT/W^X restrictions and x18 register reservation
I am porting Wine to macOS to run Windows on ARM (WOA) binaries. Windows PE files place .text and .data in the same page, which macOS’s JIT/W^X model cannot handle. pthread_jit_write_protect_np() cannot be used for foreign ARM64 code. Apple Silicon reserves x18, breaking the Windows ARM64 ABI. Wine also must reserve 0x7FFE0000 for the Windows TEB, but macOS cannot guarantee this address. These issues make it impossible for Wine to load or execute WOA binaries. I am requesting mechanisms to safely execute foreign ARM64 code, support mixed W/X pages, emulate x18, and reserve the Windows TEB region. Branch is here: https://github.com/trcrsired/wine/tree/apple-silicon-mac-woa
Replies
1
Boosts
0
Views
118
Activity
4d
Possible change in sysctlbyname() / oldlenp behavior on iOS and iPadOS 27
I am investigating an issue involving sysctlbyname("hw.machine", ...) that became observable after moving to iOS/iPadOS 27. The affected legacy code is essentially the following: void getPlatform(unsigned char machine[]) { size_t size; sysctlbyname("hw.machine", machine, &size, NULL, 0); for (int i = 0; i < size; i++) { if (machine[i] == ',') { machine[i] = '.'; } } } The caller provides a zero-initialized fixed-size buffer: unsigned char machine[20] = {0}; getPlatform(machine); I understand that this implementation is incorrect because size is not initialized. When oldp is non-NULL, oldlenp must provide the available size of the buffer. A correct implementation would therefore initialize it, for example: void getPlatform(unsigned char *machine, size_t capacity) { size_t size = capacity; if (sysctlbyname("hw.machine", machine, &size, NULL, 0) != 0) return; for (size_t i = 0; i < size; i++) { if (machine[i] == ',') machine[i] = '.'; } } with: unsigned char machine[20] = {0}; getPlatform(machine, sizeof(machine)); The question is not whether the original implementation is valid. It clearly relies on an uninitialized value and should be corrected. What I am trying to understand is why the issue became observable specifically on iOS/iPadOS 27, and whether there has been any related implementation or documentation change. Using LLDB, I inspected the arguments at the entry to: sysctlbyname("hw.machine", machine, &size, NULL, 0); Because size is uninitialized, the value referenced by oldlenp varies depending on the contents of the stack location. For example, I observed a call where: *oldlenp = 0 The call then returned: return = -1 errno = 12 (ENOMEM) and the output buffer remained empty. In another execution, the same uninitialized stack location happened to contain a very large value. In that case sysctlbyname() succeeded and returned the expected hardware identifier: iPhone18,2 Adding unrelated code such as printf() can also change whether the original implementation succeeds, which is consistent with the uninitialized value being affected by changes in stack/register layout. There is also a second issue I would like clarification on regarding the documented behavior of oldlenp. The current documentation states that when the amount of data is greater than the value supplied through oldlenp, the function updates it to the required size and returns ENOMEM. It also states: The function doesn’t modify the value if it’s larger than or equal to the amount of available data. However, this does not match what I observed at runtime. For example, in one successful call I observed: Before sysctlbyname(): *oldlenp = 4301365248 The value was clearly much larger than required. After the call returned successfully: return = 0 machine = "iPhone18,2" *oldlenp = actual returned data length In other words, oldlenp was modified on a successful call even though the input value was already much larger than the amount of data being returned. I would appreciate clarification on the following: Was there any implementation change to sysctlbyname(), sysctl(), or the handling of oldlenp in iOS/iPadOS 27? Have there been changes in compiler/runtime behavior on iOS/iPadOS 27 that could make this type of existing uninitialized-variable bug surface more consistently? Is the documented statement that oldlenp is not modified when the supplied value is sufficiently large still accurate for sysctlbyname() on current iOS versions? Has the documentation or intended contract for oldlenp changed recently? Have other developers observed ENOMEM from existing sysctlbyname() code after updating to iOS/iPadOS 27? Again, I understand that the original code is incorrect and should initialize oldlenp before calling sysctlbyname(). The part I am trying to clarify is whether iOS/iPadOS 27 introduced any behavioral change that exposed this latent bug, and whether the currently documented successful-call behavior of oldlenp matches the actual implementation.
Replies
2
Boosts
0
Views
167
Activity
4d
Behavior of cblas_zgemv when array contains nan.
In NumPy (actually originally in SciPy), we found a case where multiplying a complex matrix that contains inf+nanj by a complex vector could result in nan in the output vector in positions where the corresponding rows of the inputs did not contain nan. I have a C++ program and data to demonstrate this at https://github.com/WarrenWeckesser/experiments/tree/main/c%2B%2B/accelerate-zgemv-bug. When the full matrix CC is multiplied with the vector weights, the output at element 17 is nan. When just row 17 of CC is multiplied with weights, the result is not nan. The matrix CC does have some occurrences of inf+nanj, but not in the row that produces element 17 of the output. Is this a bug? Is there some way that the value inf+nanj in the input matrix can "contaminate" the output in a position that should give a non-nan value?
Replies
3
Boosts
0
Views
314
Activity
1w
Managed Apple ID works for iMessage on bare metal, but fails in macOS VM (same hardware)
Hi all, I'm running 2 macOS VMs on a bare-metal Mac (host is also macOS). I'm seeing inconsistent iMessage sign-in behavior depending on the Apple ID type and whether it's bare metal or virtualized: Managed Apple ID (ABM-issued): signs into iMessage fine on the bare-metal host. Same Managed Apple ID: fails to sign into iMessage inside the VM on the same physical machine. Personal/basic Apple ID: signs in fine in the VM without issue. Has anyone run into this specific combination — MAID working on bare metal but not inside a VM, while a personal ID works fine in both?
Replies
2
Boosts
0
Views
343
Activity
1w
Using AppKit and Core Graphics within a CUPS filter context on macOS
Hello, I am currently developing a printed data security feature for a cross-platform DLP system. On other platforms, this functionality relies on a cross-platform third-party library. On macOS, this library depends on the Core Graphics and AppKit frameworks. So, such dependency makes it impossible to use the code within a launch daemon, which is where this mechanism needs to run. As an alternative approach, I am considering implementing the necessary functionality inside a CUPS filter. However, I have some doubts regarding the execution context of the CUPS filter process. Is it safe to use AppKit within a CUPS filter? Thank you in advance.
Replies
0
Boosts
0
Views
171
Activity
1w
Should SDK developers use UserDefaults?
UserDefaults store app-related settings, and I am just worried that if an SDK also writes to the UserDefaults, that there could be potentially some key collisions between the host app and the SDK. Is the concern just in my head or does it have merit?
Replies
3
Boosts
0
Views
262
Activity
1w