Skip to content

Commit

Permalink
needs-restarting: "Regular files" are often on 00:xx devices
Browse files Browse the repository at this point in the history
needs-restarting currently checks the major:minor device of each mmapped
file and ignores files from devices with major version 0, considering
them "not regular files". According to the kernel docs [1], a major
version of 0 is for "unnamed devices, e.g. non-device mounts".

But ignoring files on 00:xx devices seems to not be a valid strategy. From my
testing, in containers and in virtual machines especially, "regular files"
managed by DNF are often on these devices. For example:

```
docker run -it --rm fedora:40 stat /usr/bin/sleep
  File: /usr/bin/sleep
  Size: 36864     	Blocks: 72         IO Block: 4096   regular file
Device: 0,100	Inode: 2403790     Links: 1
...
```

This patch removes this filter so that we just check that a file has a
corresponding file path. There are files that have (something that looks
like) a file path but are not "regular files", for example:
7283/maps:7f7f3f0d2000-7f7f3f0e0000 rw-s 00000000 00:01 7224                       /memfd:mozilla-ipc (deleted)
We should be able to ignore these since they would not be in the RPM database
anyway.

[1] https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
  • Loading branch information
evan-goode authored and kontura committed Oct 14, 2024
1 parent f685c89 commit ddb906f
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions plugins/needs_restarting.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ def smap2opened_file(pid, line):
slash = line.find('/')
if slash < 0:
return None
if line.find('00:') >= 0:
# not a regular file
return None
fn = line[slash:].strip()
suffix_index = fn.rfind(' (deleted)')
if suffix_index < 0:
Expand Down

0 comments on commit ddb906f

Please sign in to comment.