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

ncp11 .​note.​go.​buildid isn't reproducible #57

Closed
JeremyRand opened this issue Sep 10, 2019 · 1 comment · Fixed by #82
Closed

ncp11 .​note.​go.​buildid isn't reproducible #57

JeremyRand opened this issue Sep 10, 2019 · 1 comment · Fixed by #82

Comments

@JeremyRand
Copy link
Member

JeremyRand commented Sep 10, 2019

Steps to reproduce

  1. Apply the rbm patch from https://trac.torproject.org/projects/tor/ticket/31264 , which fixes an unrelated reproducibility bug.
  2. Run the following twice: ./rbm/rbm build ncp11 --target release --target ncdns-linux-x86_64
  3. Compare the outputs in diffoscope.

Expected results

Files should be identical.

Observed results

--- a/ncp11-0.0.1-linux-x86_64-7197ac.tar.gz
+++ b/ncp11-0.0.1-linux-x86_64-7197ac.tar.gz
├── ncp11-0.0.1-linux-x86_64-7197ac.tar
│ ├── ./libncp11.so
│ │ ├── readelf --wide --notes {}
│ │ │ @@ -1,8 +1,8 @@
│ │ │  
│ │ │  Displaying notes found in: .note.go.buildid
│ │ │    Owner                 Data size	Description
│ │ │ -  Go                   0x00000053	Unknown note type: (0x00000004)	   description data: 78 72 67 71 62 7a 62 2d 4d 45 6d 2d 31 37 69 4b 50 57 66 75 2f 6f 76 46 63 4e 48 6a 32 46 6d 4d 55 71 44 66 52 4a 57 55 4f 2f 4f 32 39 39 57 30 76 4f 4c 47 2d 66 53 61 77 55 62 6d 36 39 2f 68 53 77 6a 4a 6f 70 72 51 4f 30 34 43 69 41 48 4b 78 4c 47 
│ │ │ +  Go                   0x00000053	Unknown note type: (0x00000004)	   description data: 78 72 67 71 62 7a 62 2d 4d 45 6d 2d 31 37 69 4b 50 57 66 75 2f 6f 76 46 63 4e 48 6a 32 46 6d 4d 55 71 44 66 52 4a 57 55 4f 2f 4f 32 39 39 57 30 76 4f 4c 47 2d 66 53 61 77 55 62 6d 36 39 2f 30 37 5a 55 44 54 4b 44 75 6d 55 6b 31 54 6e 36 38 64 4c 6a 
│ │ │  
│ │ │  Displaying notes found in: .note.gnu.gold-version
│ │ │    Owner                 Data size	Description
│ │ │    GNU                  0x00000009	NT_GNU_GOLD_VERSION (gold version)	    Version: gold 1.16
│ │ ├── readelf --wide --version-info {}
│ │ │ @@ -84,15 +84,15 @@
│ │ │    140:   1 (*global*)      1 (*global*)      1 (*global*)      1 (*global*)   
│ │ │    144:   1 (*global*)      1 (*global*)      1 (*global*)      1 (*global*)   
│ │ │    148:   1 (*global*)      1 (*global*)      1 (*global*)      1 (*global*)   
│ │ │    14c:   1 (*global*)      1 (*global*)   
│ │ │  
│ │ │  Version definition section '.gnu.version_d' contains 1 entry:
│ │ │    Addr: 0x0000000000005330  Offset: 0x005330  Link: 3 (.dynstr)
│ │ │ -  000000: Rev: 1  Flags: BASE  Index: 1  Cnt: 1  Name: /tmp/go-build832923583/b001/exe/a.out
│ │ │ +  000000: Rev: 1  Flags: BASE  Index: 1  Cnt: 1  Name: /tmp/go-build272286888/b001/exe/a.out
│ │ │  
│ │ │  Version needs section '.gnu.version_r' contains 3 entries:
│ │ │   Addr: 0x000000000000534c  Offset: 0x00534c  Link: 3 (.dynstr)
│ │ │    000000: Version: 1  File: libc.so.6  Cnt: 3
│ │ │    0x0010:   Name: GLIBC_2.2.5  Flags: none  Version: 2
│ │ │    0x0020:   Name: GLIBC_2.3.4  Flags: none  Version: 3
│ │ │    0x0030:   Name: GLIBC_2.4  Flags: none  Version: 4
│ │ ├── readelf --wide --decompress --hex-dump=.dynstr {}
│ │ │ @@ -1,15 +1,15 @@
│ │ │  
│ │ │  Hex dump of section '.dynstr':
│ │ │    0x000021f0 0072756e 74696d65 2e746c73 67005f5f .runtime.tlsg.__
│ │ │    0x00002200 676d6f6e 5f737461 72745f5f 00736967 gmon_start__.sig
│ │ │    0x00002210 69736d65 6d626572 00474c49 42435f32 ismember.GLIBC_2
│ │ │    0x00002220 2e322e35 006c6962 632e736f 2e36002f .2.5.libc.so.6./
│ │ │ -  0x00002230 746d702f 676f2d62 75696c64 38333239 tmp/go-build8329
│ │ │ -  0x00002240 32333538 332f6230 30312f65 78652f61 23583/b001/exe/a
│ │ │ +  0x00002230 746d702f 676f2d62 75696c64 32373232 tmp/go-build2722
│ │ │ +  0x00002240 38363838 382f6230 30312f65 78652f61 86888/b001/exe/a
│ │ │    0x00002250 2e6f7574 005f696e 69740073 69676164 .out._init.sigad
│ │ │    0x00002260 64736574 005f6669 6e690073 69676163 dset._fini.sigac
│ │ │    0x00002270 74696f6e 006c6962 70746872 6561642e tion.libpthread.
│ │ │    0x00002280 736f2e30 00756e73 6574656e 76005f49 so.0.unsetenv._I
│ │ │    0x00002290 544d5f64 65726567 69737465 72544d43 TM_deregisterTMC
│ │ │    0x000022a0 6c6f6e65 5461626c 65007369 67656d70 loneTable.sigemp
│ │ │    0x000022b0 74797365 74005f49 544d5f72 65676973 tyset._ITM_regis

Other info

This seems to be caused by golang/go#33772 . The recommendation in that issue is to pass -ldflags=-buildid= to go build.

@JeremyRand
Copy link
Member Author

Filed bug with Tor at http://ea5faa5po25cf7fb.onion/projects/tor/ticket/31691

JeremyRand added a commit that referenced this issue Nov 18, 2019
81f0dcd Set static build ID in Go linker flags (JeremyRand)

Pull request description:

  This improves build reproducibility.

  Fixes #57
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 a pull request may close this issue.

1 participant