elastic / elastic-agent-system-metrics

Apache License 2.0
0 stars 22 forks source link

error checks when reading `/proc/[pid]/exe` don't account for kernel processes or docker permissions shenanigans #135

Closed fearful-symmetry closed 5 months ago

fearful-symmetry commented 6 months ago

Right now, under Linux we check to see if we have a permission denied error when we resolve the symlink for exe: https://github.com/elastic/elastic-agent-system-metrics/blob/8a02eaa6c02e7972cc8d0adc90c1c13db836e273/metric/system/process/process_linux_common.go#L209

We do this so we can skip any errors related to permissions issues. However, this doesn't work under two cases:

  1. For kernel processes, the exe symlink is non-existent
  2. Under docker, we'll get either Permission deined or file not found depending on the permissions docker is running with.

The permissions check in process_linux_common.go should check for both permission errors, and file not found errors.

pierrehilbert commented 6 months ago

Blocked as required https://github.com/elastic/beats/issues/38241 first