Skip to content
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

[aarch64_wheel] Fix readdir crash #1574

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions aarch64_linux/aarch64_wheel_ci_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def parse_arguments():
# work around to fix Raspberry pie crash
print("Applying mkl-dnn patch to fix Raspberry pie crash")
os.system(f"cd /pytorch/third_party/ideep/mkl-dnn && patch -p1 < /builder/mkldnn_fix/aarch64-fix-default-build-flags-to-armv8-a.patch")
print("Applying mkl-dnn patch to fix readdir crash")
os.system("cd /pytorch/third_party/ideep/mkl-dnn && patch -p1 < /builder/mkldnn_fix/aarch64-fix-readdir-crash.patch")
os.system(f"cd /pytorch; {build_vars} python3 setup.py bdist_wheel")
pytorch_wheel_name = complete_wheel("pytorch")
print(f"Build Compelete. Created {pytorch_wheel_name}..")
14 changes: 14 additions & 0 deletions mkldnn_fix/aarch64-fix-readdir-crash.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/src/cpu/aarch64/xbyak_aarch64/src/util_impl.cpp b/src/cpu/aarch64/xbyak_aarch64/src/util_impl.cpp
index cb800b2509..5516373b90 100644
--- a/src/cpu/aarch64/xbyak_aarch64/src/util_impl.cpp
+++ b/src/cpu/aarch64/xbyak_aarch64/src/util_impl.cpp
@@ -170,6 +170,8 @@ int Cpu::getFilePathMaxTailNumPlus1(const char *path) {
fflush(stdout);

DIR *dir = opendir(dir_path);
+ if (dir == NULL)
+ return 0;
struct dirent *dp;

dp = readdir(dir);