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

Update libbacktrace #30908

Merged
merged 2 commits into from
Jan 16, 2016
Merged

Update libbacktrace #30908

merged 2 commits into from
Jan 16, 2016

Conversation

petrochenkov
Copy link
Contributor

@dhuseby @semarie Please, confirm that all Rust-specific changes in the second commit are still required.
(It would be ideal to have an unpatched copy of libbacktrace straight from the gcc repo.)

Fixes #28447

r? @alexcrichton

@dhuseby
Copy link

dhuseby commented Jan 14, 2016

@petrochenkov those are still necessary since none of the Bitrig changes have been upstreamed.

I'm surprised about the OpenBSD shared library part of the patch. @semarie is that still necessary?

@alexcrichton
Copy link
Member

@bors: r+ 0ef8afdf05556840c48d8c9c71b8ac149259624f

bors added a commit that referenced this pull request Jan 15, 2016
New:
Fix for rust-lang#28447

Merged:
openbsd support: rust-lang@fcb30a0
bitrig integration: rust-lang@cd8f317

Not merged:
rust-lang@d4fc3ec
@Diggsey says this change was unintended (rust-lang#30666 (comment))
@petrochenkov
Copy link
Contributor Author

Updated with a fix for #28447

The reason was a pretty silly mistake in pecoff.c

4-byte length of COFF string table was read like this:

// uninitialized
size_t str_size;
// initialize str_size by copying 4 bytes from some localion
memcpy (&str_size, syms_view.data + syms_size, 4); 

After this initialization half of str_size could be filled with trash on 64-bit machines.

@alexcrichton
Copy link
Member

@bors: r+ 55e2b7e

Nifty! I wonder if we'll get better backtraces on GNU windows as a result then?

@petrochenkov
Copy link
Contributor Author

@alexcrichton
Yes, functions in backtraces have proper names instead of <unknown> after this fix.
Edit: Not always, lol. But sometimes.

@alexcrichton
Copy link
Member

Nice!

bors added a commit that referenced this pull request Jan 16, 2016
@dhuseby @semarie Please, confirm that all Rust-specific changes in the second commit are still required.
(It would be ideal to have an unpatched copy of libbacktrace straight from the gcc repo.)

Fixes #28447

r? @alexcrichton
@bors
Copy link
Contributor

bors commented Jan 16, 2016

⌛ Testing commit 55e2b7e with merge 3c49053...

@bors bors merged commit 55e2b7e into rust-lang:master Jan 16, 2016
@Diggsey
Copy link
Contributor

Diggsey commented Jan 16, 2016

If only it had been written in rust...

@ranma42
Copy link
Contributor

ranma42 commented Jan 16, 2016

@petrochenkov
Copy link
Contributor Author

@ranma42
Thanks, I intend to submit the patch upstream, but I'm not familiar with the process.

@petrochenkov petrochenkov deleted the backtrace branch September 21, 2016 19:47
alexcrichton added a commit to alexcrichton/libbacktrace that referenced this pull request Jul 25, 2017
This updates the local declaration of `str_size` to always be 4 bytes instead of
platform-dependent as its initialization later on only fills in 4 bytes instead
of all the bytes of `size_t`.

Originally reported as rust-lang/rust#28447 this was fixed in
rust-lang/rust#30908
bors added a commit that referenced this pull request May 30, 2018
Update libbacktrace

We haven't updated libbacktrace in two years. This is just blindly updating to the latest HEAD; I'd like to see what travis says. It at least builds on my machine, running some tests...

This perpetuates the patches from #30908
dscho pushed a commit to dscho/libbacktrace that referenced this pull request Jul 18, 2022
This updates the local declaration of `str_size` to always be 4 bytes instead of
platform-dependent as its initialization later on only fills in 4 bytes instead
of all the bytes of `size_t`.

Originally reported as rust-lang/rust#28447 this was fixed in
rust-lang/rust#30908
johnsonjh added a commit to johnsonjh/libbacktrace that referenced this pull request Oct 18, 2022
… of uninitialized bytes in pecoff.c; 3) Fix a use of undefined memory in pecoff.c

1) Note: as we target MINGW here, we still want to look up the symbols via
the DWARF method (the native Windows way would be to call the
SymFromAddr() function, but that would require .pdb files which MINGW
does not produce).
Signed-off-by: Johannes Schindelin <[email protected]>

2) This updates the local declaration of `str_size` to always be 4 bytes instead of
platform-dependent as its initialization later on only fills in 4 bytes instead
of all the bytes of `size_t`.
Originally reported as rust-lang/rust#28447 this was fixed in
rust-lang/rust#30908

3) In rust-lang/rust#39468 it was discovered that this could cause a crash in
libbacktrace due to freeing uninitialized memory, and this specific instance was
fixed in rust-lang/rust#39509
dscho pushed a commit to dscho/libbacktrace that referenced this pull request Apr 8, 2024
This updates the local declaration of `str_size` to always be 4 bytes instead of
platform-dependent as its initialization later on only fills in 4 bytes instead
of all the bytes of `size_t`.

Originally reported as rust-lang/rust#28447 this was fixed in
rust-lang/rust#30908
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants