-
Notifications
You must be signed in to change notification settings - Fork 237
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
elf_add freeing strtab_view in fail, even though it shouldn't #29
Comments
It does look like a bug but I also certainly don't expect the call to |
It fails due to backtrace_get_view L77 -> file too short, size = 2884504395, got = 2147479552 |
Can you show me the output of |
I'll do that as soon as I'm back on my linux machine, thanks for the quick reply :) |
Actually, it wants to read from debug_str, where size is reported as I guess the reason here is:
Which is just not true in this case. but would lead to further issues further down the road? Or would it just be "reading too much unneeded stuff, temporarly"? I don't understand how NVM, I should learn to google suspicious numbers first :D It's also probably unfeasible to read a whole 2GiB into the memory for debugging symbols. Edit: It's also trivial to make backtrace_get_view issue multiple read syscalls, but I think it's in 99.9% of the cases an indicate of a fault. |
@ianlancetaylor Any progress or ideas on that? |
I haven't had time to look. |
The returned value seems suspicious to me -- it's 2^31 - 4096. It is possible that the kernel is refusing to make a large mmap in this situation, e.g. https://www.kernel.org/doc/Documentation/vm/overcommit-accounting? What is /proc/sys/vm/overcommit_memory on your system (and/or CommitLimit setting in /proc/meminfo)? |
But yeah, see above, write() and read() are capped at 2^31 - 4096 in that case. |
It looks like you are running on a 32-bit system. The debug sections are adjacent. They're just big. By my count libbacktrace is going to try to read everything from 0xdd25000 to 0xb9c07000, which is 0xabee2000 bytes, pretty close to what you see (0xABEE0B4B). I guess that on your 32-bit system libbacktrace would probably work if your In any case, can you see whether this patch fixes the problem? Thanks.
|
Give me a few days to test your patch, since I need to replace a few things to get it working again. I can't tell you about the sections in special, other than that the project is a huge project built on rust, and that the rust language is known for huge binaries (even the optimized release build is huge, here I think 1GiB vs 3 GiB), and that it builds on top of LLVM, so lldb might interpret them when gdb does not. But I am not certain at all over this. |
On GNU/Linux systems |
@MeFisto94 Did you have a chance to try the patch above? Thanks. |
So as written in #32, the downstream rust crate has a simple compilation which lead to read being compiled no matter the system and as such mmap wasn't used. |
As far as I can tell, this patch fixes the issues. Actually the backtraces get printed again as well :) Thanks for the patch! |
Just one more question: |
Good point, should be fixed now. |
Hey,
I've stumbled over a crash in servo, which is using a rust wrapper around this library.
You can see my findings here, rust-lang/backtrace-rs#267, but a short description is: elf.c:elf_add#2965 claims, that "we hold on to the string table permanently.", which is only true until a elf.c:elf_add:fail#3197, which is caused by elf.c:elf_add#3071
Now I don't know if it's "okay" for L3071 to fail, like this expected, then Line 3197 is just wrong.
If this is a more critical fault or releasing the symnames there is required, then the changes made to the state (symdata) have to be rolled back, so noone is relying on them as the error is not propagated back, but skipped.
Thanks in Advance :)
The text was updated successfully, but these errors were encountered: