-
Notifications
You must be signed in to change notification settings - Fork 18k
debug/elf: suport files with >= 65280 (0xff00) sections #55295
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
Conversation
The spec https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html states: 1. e_shnum: If the number of sections is greater than or equal to SHN_LORESERVE (0xff00), this member has the value zero and the actual number of section header table entries is contained in the sh_size field of the section header at index 0. 2. e_shstrndx: If the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00), this member has the value SHN_XINDEX (0xffff) and the actual index of the section name string table section is contained in the sh_link field of the section header at index 0. This CL makes these changes to support files with >= 0xff00 sections: 1. if shoff > 0 && shnum == 0, read sh_size from the initial section header entry as shnum. 2. if shstrndx == SHN_XINDEX, read sh_link from the initial section header entry as shstrndx. It returns an error if the type of the initial section is not SHT_NULL. A file with >= 0xff00 sections is too big to include in the repository, so the test case constructs one on the fly, with some of the sections zeroed out.
This PR (HEAD: bc70ef6) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/432255 to see it. Tip: You can toggle comments from me using the |
Message from Dan Kortschak: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Zeke Lu: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Dan Kortschak: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Ian Lance Taylor: Patch Set 1: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Dan Kortschak: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Dan Kortschak: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
This PR (HEAD: 1ba5da5) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/432255 to see it. Tip: You can toggle comments from me using the |
Message from Zeke Lu: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Ian Lance Taylor: Patch Set 2: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
This PR (HEAD: 797c164) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/432255 to see it. Tip: You can toggle comments from me using the |
Message from Zeke Lu: Patch Set 3: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Ian Lance Taylor: Patch Set 4: Run-TryBot+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Gopher Robot: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Gopher Robot: Patch Set 4: TryBot-Result+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
Message from Ian Lance Taylor: Patch Set 4: Run-TryBot+1 Auto-Submit+1 Code-Review+2 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/432255. |
The spec https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html states: 1. e_shnum: If the number of sections is greater than or equal to SHN_LORESERVE (0xff00), this member has the value zero and the actual number of section header table entries is contained in the sh_size field of the section header at index 0. 2. e_shstrndx: If the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00), this member has the value SHN_XINDEX (0xffff) and the actual index of the section name string table section is contained in the sh_link field of the section header at index 0. This CL makes these changes to support files with >= 0xff00 sections: 1. if shoff > 0 && shnum == 0, read sh_size from the initial section header entry as shnum. 2. if shstrndx == SHN_XINDEX, read sh_link from the initial section header entry as shstrndx. It returns an error if the type of the initial section is not SHT_NULL. A file with >= 0xff00 sections is too big to include in the repository, so the test case constructs one on the fly, with some of the sections zeroed out. While here, remove the unnecessary use of reflect.DeepEqual in the test. Fixes #55294. Change-Id: I15ec43612c7cce6e8decfe4e81da3a5b16de47f7 GitHub-Last-Rev: 797c164 GitHub-Pull-Request: #55295 Reviewed-on: https://go-review.googlesource.com/c/go/+/432255 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]>
This PR is being closed because golang.org/cl/432255 has been merged. |
The spec https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
states:
e_shnum: If the number of sections is greater than or equal to
SHN_LORESERVE (0xff00), this member has the value zero and the actual
number of section header table entries is contained in the sh_size
field of the section header at index 0.
e_shstrndx: If the section name string table section index is
greater than or equal to SHN_LORESERVE (0xff00), this member has the
value SHN_XINDEX (0xffff) and the actual index of the section name
string table section is contained in the sh_link field of the section
header at index 0.
This CL makes these changes to support files with >= 0xff00 sections:
header entry as shnum.
header entry as shstrndx.
It returns an error if the type of the initial section is not SHT_NULL.
A file with >= 0xff00 sections is too big to include in the repository,
so the test case constructs one on the fly, with some of the sections
zeroed out.
While here, remove the unnecessary use of reflect.DeepEqual in the test.
Fixes #55294.