-
Notifications
You must be signed in to change notification settings - Fork 18k
syscall: darwin arm{,64} libSystem syscalls are not compliant with the App Store submissions #28984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Because it is a regression, I took the liberty and made this issue a release blocker. |
According to the macOS stat(2) man page, platforms released after widening inodes to 64-bit do not have the *64 variants available, and the non-postfixed system calls are already 64-bit compliant: "Platforms that were released after these updates only have the newer variants available to them. These platforms have the macro _DARWIN_FEATURE_ONLY_64_BIT_INODE defined." I checked with a simple Xcode project that _DARWIN_FEATURE_ONLY_64_BIT_INODE is indeed defined for iOS builds, but not for macOS builds. The fix for fstat, lstat, stat seems to be to drop the "64" postfix on iOS. Getdirentries is more complicated. According to its man page, "As of Mac OS X 10.6, getdirentries() is deprecated, and it is recommended that applications use readdir(3) rather than using Since _DARWIN_NO_64_BIT_INODE must be defined to access getdirentries, and since iOS has _DARWIN_FEATURE_ONLY_64_BIT_INODE defined, it is likely that getdirentries is not (supposed to be) available on iOS in any form. So it seems that getdirentries has to be replaced, at least on iOS. I don't know whether that's realistic. Perhaps getdirentries could be removed from package syscall on iOS altogether, even though it breaks the Go compatibility guarantee. |
I worked a bit on this; removing the "64" postfixes was easy, but getdirentries is a central system call for directory listing, and I couldn't think of a straightforward replacement for it. The man pages suggest the (fd)opendir/readdir/closedir API but those calls operate on directory stream pointers, not file descriptors. I'm leaving this for more capable hands. |
@eliasnaur Want to send the fixes you have? After we get those in, changing |
Change https://golang.org/cl/151938 mentions this issue: |
The stat(2) man page contain this comment about the 64-bit versions of the system file functions: "Platforms that were released after these updates only have the newer variants available to them. These platforms have the macro _DARWIN_FEATURE_ONLY_64_BIT_INODE defined." It turns out that on iOS the _DARWIN_FEATURE_ONLY_64_BIT_INODE is defined and that even though the "64"-postfixed versions are accessible they are deemed private. Apps that refer to private API are not admissible on App Store, and after the Go runtime started using libSystem instead of direct syscalls, the App Store submission checks reject apps built with Go tip. The fix is simple: use the non-postfixed versions on iOS. getdirentries(2) is not changed; it is not available at all on iOS and needs replacement. Updates #28984 Change-Id: Icb8d44e271456acaa1913ba486fcf5b569722fa9 Reviewed-on: https://go-review.googlesource.com/c/151938 Run-TryBot: Elias Naur <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Keith Randall <[email protected]>
Change https://golang.org/cl/153338 mentions this issue: |
@s-s, can you please verify that the issue is fixed in go tip (or the beta release that is imminent)? |
@eliasnaur, checked with tip version - everything is ok now! Thank you! |
Change https://golang.org/cl/154658 mentions this issue: |
Change https://golang.org/cl/154659 mentions this issue: |
Parallel to CL 151938 for package x/sys/unix instead of syscall. iOS needs to use these functions without the "64" postfix. (The functions do exist, but the App Store bans their use.) Updates golang/go#28984 Change-Id: I6b82950700cc8a1afca612844b05fa007574e008 Reviewed-on: https://go-review.googlesource.com/c/154658 Reviewed-by: Brad Fitzpatrick <[email protected]>
This system call doesn't exist on iOS. Update golang/go#28984 Change-Id: I92eb6fd3eb263863a31338bc18c9826a2242434b Reviewed-on: https://go-review.googlesource.com/c/154659 Reviewed-by: Brad Fitzpatrick <[email protected]>
Change https://golang.org/cl/168479 mentions this issue: |
Getdirentries is implemented with the __getdirentries64 function in libSystem.dylib. That function works, but it's on Apple's can't-be-used-in-an-app-store-application list. Implement Getdirentries using the underlying fdopendir/readdir_r/closedir. The simulation isn't faithful, and could be slow, but it should handle common cases. Don't use Getdirentries in the stdlib, use fdopendir/readdir_r/closedir instead (via (*os.File).readdirnames). Fixes #30933 Update #28984 RELNOTE=yes Change-Id: Ia6b5d003e5bfe43ba54b1e1d9cfa792cc6511717 Reviewed-on: https://go-review.googlesource.com/c/go/+/168479 Reviewed-by: Emmanuel Odeke <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Emmanuel Odeke <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
Change https://golang.org/cl/170640 mentions this issue: |
Getdirentries is implemented with the __getdirentries64 function in libSystem.dylib. That function works, but it's on Apple's can't-be-used-in-an-app-store-application list. Implement Getdirentries using the underlying fdopendir/readdir_r/closedir. The simulation isn't faithful, and could be slow, but it should handle common cases. Don't use Getdirentries in the stdlib, use fdopendir/readdir_r/closedir instead (via (*os.File).readdirnames). (Incorporates CL 170837 and CL 170698, which were small fixes to the original tip CL.) Fixes #31244 Update #28984 RELNOTE=yes Change-Id: Ia6b5d003e5bfe43ba54b1e1d9cfa792cc6511717 Reviewed-on: https://go-review.googlesource.com/c/go/+/168479 Reviewed-by: Emmanuel Odeke <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Emmanuel Odeke <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> (cherry picked from commit 9da6530) Reviewed-on: https://go-review.googlesource.com/c/go/+/170640 Run-TryBot: Brad Fitzpatrick <[email protected]>
@eliasnaur does this need a corresponding commit in x/sys? |
Do you mean https://golang.org/cl/154659 or something else? |
@eliasnaur That CL is for iOS-only, right? The syscall change later got ported to macOS (x86, amd64) too, due to similar appstore restrictions there. But I don't see a corresponding x/sys change for macOS. |
On Thu Sep 19, 2019 at 3:12 AM Jason A. Donenfeld wrote:
@eliasnaur That CL is for iOS-only, right? The syscall change later got ported to macOS (x86, amd64) too, due to similar appstore restrictions there. But I don't see a corresponding x/sys change for macOS.
I see. Then yes, I suppose a x/sys port is needed.
|
What version of Go are you using (
go version
)?go version devel +bf870f3d54 Tue Nov 27 18:04:27 2018 +0300 darwin/amd64
Does this issue reproduce with the latest release?
Only master branch affected, go 1.11.2 and 1.10.5 are fine (as they use bare Syscall functions).
What operating system and processor architecture are you using (
go env
)?go env
OutputActually, I'm using gomobile, so GOARCHs are arm, arm64 (and 386, amd64 for simulator).
What did you do?
I'm building an iOS framework using gomobile and Go from master branch. Then I submit an app with this framework to the App Store Connect. After submission some (unknown) post processing happens on Apple's side.
What did you expect to see?
Binary should be processed successfully. (It is for go 1.11.2 and 1.10.5)
What did you see instead?
Binary is rejected for "Non-public API usage" - The app references non-public symbols: ___getdirentries64, _fstat64, _lstat64, _stat64
This happens because of these changes: a3b0144, c9762b8 in master branch
PS: I've solved it by patching syscall/mksyscall.pl - reverting back bare Syscall usage for mentioned symbols and generating updated zsyscall_darwin_{arm,arm64,386,amd64}.{go,s} using syscall/mksyscall.pl and syscall/mkasm_darwin.go.
The text was updated successfully, but these errors were encountered: