We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#include <stdio.h> #include <unistd.h> #include <syscall.h> #include <sys/wait.h> int main(int argc, char *argv[]) { printf("p getpid()=%d gettid()=%d\n", getpid(), gettid()); int pid = fork(); if (pid == 0) { printf("getpid()=%d gettid()=%d NR_getpid=%ld NR_gettid=%ld\n", getpid(), gettid(), syscall(__NR_getpid), syscall(__NR_gettid)); } else if (pid > 0) { waitpid(pid, nullptr, 0); } return 0; }
release build and exec
p getpid()=22023 gettid()=22023 getpid()=22024 gettid()=22023 NR_getpid=22024 NR_gettid=22024
decompile
__int64 sub_888() { unsigned int v0; // w20 unsigned int v1; // w19 int v2; // w0 unsigned int v3; // w20 __int64 v4; // x21 __int64 v5; // x0 v0 = getpid(); v1 = gettid(); printf("p getpid()=%d gettid()=%d\n", v0, v1); v2 = fork(); if ( v2 ) { if ( v2 >= 1 ) waitpid(v2, 0LL, 0); } else { v3 = getpid(); v4 = syscall(172LL); v5 = syscall(178LL); printf("getpid()=%d gettid()=%d NR_getpid=%ld NR_gettid=%ld\n", v3, v1, v4, v5); } return 0LL; }
r27
No response
Windows
Windows10
arm64-v8a
ndk-build
23
34
The text was updated successfully, but these errors were encountered:
yeah, the __attribute__((__const__)) on gettid() is unsafe in any function that calls fork() or equivalent. fixed by https://android-review.googlesource.com/c/platform/bionic/+/3106497.
__attribute__((__const__))
Sorry, something went wrong.
Since I still need to pull an updated toolchain for r27 RC 1, I'll do another sysroot update to grab this as well.
Fix gettid() in functions that call fork() or equivalent.
c8ea872
Bug: android/ndk#2024 Change-Id: Ia264ce219fac99e8823e60c4a2e0607af8518056
enh-google
No branches or pull requests
Description
release build and exec
decompile
Affected versions
r27
Canary version
No response
Host OS
Windows
Host OS version
Windows10
Affected ABIs
arm64-v8a
Build system
ndk-build
Other build system
No response
minSdkVersion
23
Device API level
34
The text was updated successfully, but these errors were encountered: