Subject: Supported fail-closed ACL absence verification on macOS 27.0.1 / APFS
Environment: macOS 27.0.1, build 26A434; APFS; installed macOS 27.0 SDK.
We need a supported, documented way to determine whether an existing filesystem object has no effective ACL entries, while rejecting genuine retrieval failures and unsupported or unavailable ACL evidence. We are seeking clarification of the public interface contract, not alleging an Apple defect.
For existing directory and regular-file fixtures, pathname metadata and descriptor metadata identify the same object. Errno is cleared immediately before each native call and captured immediately afterward. ACL retrieval uses ACL_TYPE_EXTENDED:
- acl_get_file(path, ACL_TYPE_EXTENDED)
- acl_get_fd_np(fd, ACL_TYPE_EXTENDED)
On fresh objects, both return NULL with ENOENT. Explicit one-entry fixture ACLs are retrieved successfully. Explicit zero-entry fixture ACLs can also yield NULL/ENOENT, while attribute queries return a serialized zero-entry ACL.
The attribute queries use getattrlist() and descriptor-bound fgetattrlist(), requesting ATTR_CMN_RETURNED_ATTRS | ATTR_CMN_EXTENDED_SECURITY, with FSOPT_NOFOLLOW | FSOPT_REPORT_FULLSIZE and WITHOUT FSOPT_PACK_INVAL_ATTRS. Buffer lengths, variable-reference bounds and returned-attribute validity are checked. For the existing directories of interest, both calls succeed but omit the ATTR_CMN_EXTENDED_SECURITY returned bit. Explicit populated and zero-entry fixture records do set the bit. APFS reports valid VOL_CAP_INT_EXTENDED_SECURITY support; we do not assume that volume capability proves per-object ACL availability.
On macOS 27.0.1, build 26A434, using APFS, which supported interface and documented conditions allow software to distinguish an absent ACL from unavailable or unsupported ACL evidence when descriptor-bound attribute queries succeed but omit ATTR_CMN_EXTENDED_SECURITY and native ACL getters return ENOENT for an existing object?
Please clarify:
- Whether ENOENT has a supported ACL-absence interpretation, and under exactly which checked conditions.
- Whether an omitted extended-security attribute can establish ACL absence, rather than unavailable or unsupported evidence.
- How explicit zero-entry ACLs differ from absent ACL records through supported interfaces.
- How KAUTH_FILESEC_NOACL should be interpreted through supported APIs.
- How genuine retrieval failures, including permission, I/O, allocation and unsupported-operation errors, must remain distinguishable.
- Whether a supported descriptor-bound verification method exists that preserves fail-closed security checks and object identity binding; please identify its guarantees and limitations regarding pathname/ancestor changes and later operations.
- Whether relevant behavior is specific to this macOS/APFS version.
Please identify the applicable public documentation or supported verification sequence. We do not want to modify permissions, synthesize ACLs on target objects, treat invalid-attribute defaults as real evidence, or accept ambiguous omission/ENOENT as success. Existing ownership, mode and confinement checks must remain separate mandatory checks. If no public API can make this distinction reliably, please state that limitation.
A bit of context on why I asked about read failures. I was looking at the error handling in
statx1in Apple’s public Libc source. In our tests on macOS 26.5 (build 25F71, arm64, APFS),acl_get_fd_npreturned the expected entries for both the ALLOW and DENY cases. We haven’t observed a read failure that returned NULL with ENOENT.
So, in general, none of the code in Libc should be "relevant" from a security perspective. For example, there isn't any case where the kernel returns data which Libc then chooses NOT to return for "security reasons". The issue here is that the code in Libc runs inside the app's process (like any other library), which means it's possible for the app to influence/control code flow. Libc does return its own error codes, but—as in statx1's implementation—those are typically for higher-level errors like memory allocation failures. I haven't traced the flow in detail, but if you do, I think you'll find that the ONLY error code Libc itself returns for acl_get_fd_np is ENOMEM—every other error code comes from the kernel, as that's where all of the actual implementation lives.
Do you happen to know whether that statx1 code is relevant to acl_get_fd_np on this build?
I'm not sure what you actually mean here, but the Libc implementations of acl_get_fd_np(posix1e/acl_file.c) and statx1(sys/statx_np.c) have not changed AT ALL since at least[1] macOS 15.0.
One related question came up when we started inspecting ACLs that do have entries. If we keep the returned acl_t unchanged and walk it from ACL_FIRST_ENTRY, can we treat -1 with EINVAL from ACL_NEXT_ENTRY as the end of the list when we don’t know the entry count up front?
Yes. FYI, that's exactly what copyfile does here and here. Frankly, the "point" of acl_get_fd_np / acl_get_entry(..., ACL_NEXT_ENTRY, ...) is to let you retrieve every ACL entry on a file without requiring any specific advance knowledge of what's "there".
The man page also lists EINVAL for invalid input.
Yes, but that's what covers garbage input. There's no situation where acl_get_fd_np would initially succeed (because the input was valid) and then acl_get_entry would start failing because the ACL suddenly became invalid[2].
Is there a supported way to get the count first or otherwise confirm we’ve seen every entry?
See above.
[1] They've likely been stable MUCH longer than that, but this was the earliest version I could compare to the current release with minimal effort.
[2] Ignoring obvious issues like memory corruption within your process, which are outside the syscall's/library's scope.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware