Commit Graph

2 Commits

Author SHA1 Message Date
intrigus-lgtm f7cb2f9cb9
Bringt back Archlinux CI. Fixes #1772, closes #1783 (#1800)
* Only run arch for testing

* Remove outdated arch repo

* Actually build the docker image

* Do not include site packages in sys.path

* Ignore `.relr.dyn` section; skip lines w/o spaces

Newer binaries can contain a `.relr.dyn` section to compress `R_X86_64_RELATIVE` relocation entries.
These binaries can be found for example on archlinux but also on Debian 12 for example.
`readelf` prints the content of the section similarly to this:
```
Relocation section '.relr.dyn' at offset 0x25220 contains 35 entries:
  1198 offsets
00000000001ce8d0
00000000001ce8e0
```
Compared to `00000000001d2000  0000000000000025 R_X86_64_IRELATIVE                        9f330` for
`.rela.plt`.

Pwndbg now chokes on the new format because it expects a space seperator where there is none.
It might be, that this is actually an upstream problem with binutils, because llvm-readelf prints this:
```
Relocation section '.relr.dyn' at offset 0x25220 contains 1198 entries:
    Offset             Info             Type               Symbol's Value  Symbol's Name
00000000001ce8d0  0000000000000008 R_X86_64_RELATIVE
00000000001ce8e0  0000000000000008 R_X86_64_RELATIVE
```

Nevertheless, we aren't actually interested in `R_X86_64_RELATIVE` relocations so I guess it's fine to
just skip all lines that contain no spaces at all.

`.relr.dyn` can only containt `R_X86_64_RELATIVE` relocations as far as I understand
https://maskray.me/blog/2021-10-30-relative-relocations-and-relr

* Accept Full RELRO in test

Archlinux has libc and ld with Full RELRO.
We now just accept Partial and Full RELRO.

* Do not copy binaries from host to docker

The `Dockerfile` copies the whole pwndbg folder to the image.
If we have built binaries on the host before, these binaries will contain references to
the host system and *copied*  to the image.
If we now run `context code` (inside docker) to have a look at the source code this will
fail, because we will try to refer to a path on the host system.

* Do not use loop index after loop

Do not use loop index after the loop. The tests assumed that the loop in line 186
would run at least once, thereby *resetting* `i` to zero. If we never enter the
loop, `i` will *continue* to have the value it had at the end of line 172.
This will cause the test to fail in mysterious ways because `i` is now not reset
to zero but still has the value `31` for example.

The solution is to never use `i` outside of a loop.

* Re-enable archlinux and temporarily disabled ones
2023-07-16 21:51:41 +02:00
intrigus-lgtm c54d040f06
Fix/ignore venv restrict bind mount (#1796)
* Ignore .venv files in git and docker

* Only bind mount cwd for `main`

Bind mounting `.` in every case would interfere with .dockerignore
We want to ignore `.venv` so that the venv of the built docker image
is used. Otherwise we would use the venv of the host inside docker.
This would negate the whole point of testing in a docker container.

Bind mounting `.` is however useful if one wants to use docker just
for "sandboxing" while running the tests on the local machine.

---------

Co-authored-by: intrigus <abc123zeus@live.de>
2023-07-13 11:27:40 +02:00