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

Add end-to-end test for #875 #879

Merged
merged 1 commit into from
Oct 31, 2024
Merged

Conversation

danielocfb
Copy link
Collaborator

Add an end-to-end test for the fix provided by pull request #875. The test basically normalizes an address in a specially crafted binary and symbolizes the resulting file offset. It fails without commit 1a4e107 ("Use file size in file offset -> virtual offset translation"), because then the file offset to virtual offset translation produces a virtual offset that can't be symbolized to the expected _start function.

Add an end-to-end test for the fix provided by pull request libbpf#875. The
test basically normalizes an address in a specially crafted binary and
symbolizes the resulting file offset. It fails without commit
1a4e107 ("Use file size in file offset -> virtual offset
translation"), because then the file offset to virtual offset
translation produces a virtual offset that can't be symbolized to the
expected _start function.

For the record, the binary looks roughly as follows:

  $ readelf --segments --wide test-block.bin
  > Program Headers:
  >   Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  >   LOAD           0x000000 0x00000000000ff000 0x00000000000ff000 0x0001c8 0x301000 RW  0x1000
  >   LOAD           0x0001c8 0x00000000004001c8 0x00000000004001c8 0x000030 0x000030 R   0x1000
  >   LOAD           0x001000 0x0000000000401000 0x0000000000401000 0x00005b 0x00005b R E 0x1000
  >   LOAD           0x002000 0x0000000000402000 0x0000000000402000 0x000038 0x000038 R   0x1000
  >   [...]

Signed-off-by: Daniel Müller <[email protected]>
@danielocfb danielocfb force-pushed the topic/file-size-e2e branch 4 times, most recently from ab0e157 to ecde9ab Compare October 31, 2024 21:00
@danielocfb danielocfb merged commit cfd540c into libbpf:main Oct 31, 2024
37 checks passed
@danielocfb danielocfb deleted the topic/file-size-e2e branch October 31, 2024 21:06
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@1155849). Learn more about missing BASE report.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #879   +/-   ##
=======================================
  Coverage        ?   95.39%           
=======================================
  Files           ?       55           
  Lines           ?    10523           
  Branches        ?        0           
=======================================
  Hits            ?    10038           
  Misses          ?      485           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

2 participants