-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
reader.readAllAlloc crash on Ampere a1 CPU when given a much larger max_size parameter than the actual file size #20714
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
Could not reproduce with details
The following lines from the original report seem to indicate a syscall gave the OS an unexpected value.
Linux's manpage for @WeijieH, could you please do the following:
$ zig build-exe repro.zig
$ strace --trace=munmap,mmap ./repro
$ getconf PAGE_SIZE |
Very strongly suspect this is a duplicate of #16331, or closely related. |
Here is the result of strace:
PAGE_SIZE is 65536 system OS is oracle linux 8 |
Closing as duplicate of #16331, which also has a workaround. |
Zig Version
0.14.0-dev.367+a57479afc
Steps to Reproduce and Observed Behavior
Example zig code:
And crash.txt with only 5 letters:
And run
$ zig run example.zig
will result in a crash:To avoid crash, I can either change
const buffer = try reader.readAllAlloc(allocator, 10240);
toconst buffer = try reader.readAllAlloc(allocator, 1024);
or read a different file with more text in it. For example, the same text file but with with 999 lines of 'crash'
I only observed this behavior on my Oracle Cloud Ampere A1 CPU machines. I don't have other aarch64 machines to test so I'm not sure if this is Ampere A1 CPU only.
Same code will run on x64 windows and x64 linux without any problems.
Expected Behavior
readAllAlloc should read the file without crash
The text was updated successfully, but these errors were encountered: