Commit 1bd9ace
authored
Fix bug with resolving relative symlinks during linux header detection (#2038)
Summary: Fix bug with resolving relative symlinks during linux header
detection
Please see linked issue for details
Relevant Issues: Closes #2037
Type of change: /kind bugfix
Test Plan: Verified the following
- [x] Confirmed with user that reported the issue that this works for
openSUSE's MicroOS linux headers
- [x] Verified on Ubuntu that using an absolute symlink works (upstream
package, no modification)
```
ddelnano@dev-vm:/lib/modules/6.8.0-1015-gcp$ ls -l build
lrwxrwxrwx 1 root root 37 Sep 2 14:42 build -> /usr/src/linux-headers-6.8.0-1015-gcp
# Verify custom built stirling_wrapper identifies absolute headers
$ sudo docker run -v /:/host -v /sys:/sys -v /var/lib/docker:/var/lib/docker --pid=host --cgroupns host --env "PL_HOST_PATH=/host" bazel/src/stirling/binaries:stirling_wrapper_image
I20241011 21:32:38.893605 395713 linux_headers.cc:257] Looking for host Linux headers at /host/lib/modules/6.8.0-1015-gcp/build.
I20241011 21:32:38.893646 395713 linux_headers.cc:237] Symlink target is an absolute path. Converting that to host path: /usr/src/linux-headers-6.8.0-1015-gcp -> /host/usr/src/linux-headers-6.8.0-1015-gcp.
I20241011 21:32:38.893750 395713 linux_headers.cc:261] Linked host headers at /host/usr/src/linux-headers-6.8.0-1015-gcp to symlink in pem namespace at /lib/modules/6.8.0-1015-gcp/build.
I20241011 21:32:38.893783 395713 linux_headers.cc:257] Looking for host Linux headers at /host/lib/modules/6.8.0-1015-gcp/source.
```
- [x] Verified on Ubuntu that using a relative symlink (modified by hand
with reproduction steps in #2037)
```
# Verify build is a relative symlink and resolves outside a container
ddelnano@dev-vm:/lib/modules/6.8.0-1015-gcp$ ls -l
total 1480
lrwxrwxrwx 1 root root 48 Oct 11 20:39 build -> ../../../../usr/src/linux-headers-6.8.0-1015-gcp
# Verify custom built stirling_wrapper identifies relative headers
$ sudo docker run -v /:/host -v /sys:/sys -v /var/lib/docker:/var/lib/docker --pid=host --cgroupns host --env "PL_HOST_PATH=/host" bazel/src/stirling/binaries:stirling_wrapper_image
I20241011 21:30:16.825937 395471 linux_headers.cc:257] Looking for host Linux headers at /host/lib/modules/6.8.0-1015-gcp/build.
I20241011 21:30:16.825973 395471 linux_headers.cc:242] Symlink target is a relative path. Concatenating it to parent directory: /host/lib/modules/6.8.0-1015-gcp/../../../../usr/src/linux-headers-6.8.0-1015-gcp
I20241011 21:30:16.826067 395471 linux_headers.cc:261] Linked host headers at /host/lib/modules/6.8.0-1015-gcp/../../../../usr/src/linux-headers-6.8.0-1015-gcp to symlink in pem namespace at /lib/modules/6.8.0-1015-gcp/build.
```
Changelog Message: Fixed an issue where certain linux upstream distro's
header packages would fail to be identified
---------
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>1 parent 738111f commit 1bd9ace
1 file changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
233 | 247 | | |
234 | 248 | | |
235 | 249 | | |
| |||
0 commit comments