Skip to content

Conversation

paveljanik
Copy link
Contributor

This is a followup to #8105.

More trivial changes merged into one PR.

@maflcko
Copy link
Member

maflcko commented Sep 4, 2016

Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits

Also, I was wondering how much is left until we can enable Wshadow

@paveljanik
Copy link
Contributor Author

I can squash when the review is finished, no problem. I think it is much easier reviewing separately.

@maflcko
Copy link
Member

maflcko commented Sep 4, 2016

@paveljanik The diff is just 20 lines and I think trying to compile before/after and compare the objdump is sufficient to review. (Maybe skim over the diff once)
This is achieved easily when there is only one commit.

@paveljanik paveljanik force-pushed the 20160902_Wshadow_trivials branch from a023a05 to d3eff19 Compare September 5, 2016 05:09
@paveljanik
Copy link
Contributor Author

Squashed.

@paveljanik
Copy link
Contributor Author

Please review.

@@ -13,7 +13,7 @@ class reverse_lock
{
public:

explicit reverse_lock(Lock& lock) : lock(lock) {
explicit reverse_lock(Lock& _lock) : lock(_lock) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this patch changes the binaries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I do not see why it should change binaries, but will investigate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wladimir investigated in #8793. It changes the binaries.

Technically it can be done by changing lock to _lock in the body of the function. But we decided that it is wrong to do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well in the case of the GUI that was the decision, as an exception.

As I said there, for the consensus code I would require the binaries to be the same. This is much closer to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK then, going to add squashme commit fixing this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I don't want to redo the check a third time when you squash.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Though, it seems I still don't get identical binaries. Could you try to create a pull with a single commit and combine #8655 + #8808 with all the changes that don't change the binary? Then we could evaluate the remaining (problematic) hunks separate from those.

Copy link
Contributor Author

@paveljanik paveljanik Sep 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laanwj Can ask you to do your different-binary-function analysis on this PR? Or better: can you publish your tool? ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look. Aand maybe release the script, though it's a Chthonic monstriosity with tentacles spreading to other unpublished tools, so I have to figure out what to collect along the way.

@paveljanik
Copy link
Contributor Author

pagelocker going to be removed in #8753...

@paveljanik paveljanik force-pushed the 20160902_Wshadow_trivials branch 2 times, most recently from 93dd3c7 to ca6bf63 Compare September 23, 2016 14:09
@paveljanik paveljanik force-pushed the 20160902_Wshadow_trivials branch from 89df412 to a413d9d Compare September 26, 2016 15:07
@paveljanik
Copy link
Contributor Author

Squashed.

@laanwj
Copy link
Member

laanwj commented Sep 27, 2016

Two functions differ:

LockedPageManagerBase<MemoryPageLocker>::LockedPageManagerBase(unsigned long)
TorController::TorController(event_base*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

From a quick look at the assembly differences it looks like the same problem as before.

@paveljanik
Copy link
Contributor Author

The first one is clear (page_size in the body to _page_size). The second one target -> _target.
Both are stupid to be done IMO 8)

@paveljanik paveljanik force-pushed the 20160902_Wshadow_trivials branch from a413d9d to 4731cab Compare September 27, 2016 07:25
@paveljanik
Copy link
Contributor Author

paveljanik commented Sep 27, 2016

But done... And squashed. The diff is a bit longer now.

@maflcko
Copy link
Member

maflcko commented Sep 27, 2016

Identical binaries ACK 4731cab

@fanquake
Copy link
Member

@MarcoFalke What tool are you using to generate the identical binary results?

@laanwj
Copy link
Member

laanwj commented Sep 27, 2016

I've put up my script here: https://github.com/laanwj/bitcoin-maintainer-tools

BTW: I don't get identical bitcoind binaries for 2f71490 and 4731cab but don't see any function-level differences, will investigate further.

@laanwj
Copy link
Member

laanwj commented Sep 27, 2016

OK, found the reason:

-2f71490.o/src/support/libbitcoin_util_a-pagelocker.o:     file format elf64-x86-64
+4731cab.o/src/support/libbitcoin_util_a-pagelocker.o:     file format elf64-x86-64

 Contents of section .group:
  0000 01000000 57000000                    ....W...        
@@ -314,9 +314,9 @@
  0000 626f6f73 743a3a20 6d757465 7820636f  boost:: mutex co
  0010 6e737472 7563746f 72206661 696c6564  nstructor failed
  0020 20696e20 70746872 6561645f 6d757465   in pthread_mute
- 0030 785f696e 69740000 21287061 67655f73  x_init..!(page_s
- 0040 697a6520 26202870 6167655f 73697a65  ize & (page_size
- 0050 202d2031 292900                       - 1)).         
+ 0030 785f696e 69740000 21285f70 6167655f  x_init..!(_page_
+ 0040 73697a65 20262028 5f706167 655f7369  size & (_page_si
+ 0050 7a65202d 20312929 00                 ze - 1)).       

This is a string emitted by an assertion. You're never going to get this right.
(building without assertions would get identical binaries though, that's probably what @MarcoFalke did)
I can also confirm binaries are identical w/out assertions.

ACK 4731cab

@laanwj laanwj merged commit 4731cab into bitcoin:master Sep 27, 2016
laanwj added a commit that referenced this pull request Sep 27, 2016
4731cab Do not shadow variables (Pavel Janík)
@maflcko
Copy link
Member

maflcko commented Sep 27, 2016

Huh, I did not disable assertions. Just building as usual and making sure that the clientversion does not influence the binaries. Then calling objdump -d and diff the output.

@laanwj
Copy link
Member

laanwj commented Sep 27, 2016

Then calling objdump -d and diff the output.

Ok, that explains it, because that doesn't detect changes in data sections. I always diff the assembly as well as comparing sha256sums of the stripped executables just in case.

@laanwj laanwj mentioned this pull request Dec 2, 2016
codablock pushed a commit to codablock/dash that referenced this pull request Jan 11, 2018
4731cab Do not shadow variables (Pavel Janík)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
4731cab Do not shadow variables (Pavel Janík)
zkbot added a commit to zcash/zcash that referenced this pull request Mar 5, 2021
Backport bloom filter improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7113
- bitcoin/bitcoin#7818
  - Only the second commit (to resolve conflicts).
- bitcoin/bitcoin#7934
- bitcoin/bitcoin#8655
  - Partial backport to help resolve conflicts.
- bitcoin/bitcoin#9060
- bitcoin/bitcoin#9223
- bitcoin/bitcoin#9644
  - Partial backport to help resolve conflicts.
- bitcoin/bitcoin#9916
- bitcoin/bitcoin#9750
- bitcoin/bitcoin#13176
- bitcoin/bitcoin#13948
- bitcoin/bitcoin#16073
- bitcoin/bitcoin#18670
- bitcoin/bitcoin#18806
  - Reveals upstream's covert fix for CVE-2013-5700.
- bitcoin/bitcoin#19968
zkbot added a commit to zcash/zcash that referenced this pull request Apr 15, 2021
Backport bloom filter improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7113
- bitcoin/bitcoin#7818
  - Only the second commit (to resolve conflicts).
- bitcoin/bitcoin#7934
- bitcoin/bitcoin#8655
  - Partial backport to help resolve conflicts.
- bitcoin/bitcoin#9060
- bitcoin/bitcoin#9223
- bitcoin/bitcoin#9644
  - Partial backport to help resolve conflicts.
- bitcoin/bitcoin#9916
- bitcoin/bitcoin#9750
- bitcoin/bitcoin#13176
- bitcoin/bitcoin#13948
- bitcoin/bitcoin#16073
- bitcoin/bitcoin#18670
- bitcoin/bitcoin#18806
  - Reveals upstream's covert fix for CVE-2013-5700.
- bitcoin/bitcoin#19968
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants