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

proc_self_status fails on second invocation #994

Closed
niluxv opened this issue Jan 16, 2024 · 1 comment · Fixed by #995
Closed

proc_self_status fails on second invocation #994

niluxv opened this issue Jan 16, 2024 · 1 comment · Fixed by #995

Comments

@niluxv
Copy link
Contributor

niluxv commented Jan 16, 2024

When calling proc_self_status a twice, it errors the second time with error

Os { code: 95, kind: Uncategorized, message: "Operation not supported" }

reliably on both back-ends (testing on linux).

This seems to have regressed from rustix version 0.38.14 to 0.38.15. Maybe related to #859?

proc_self_maps and proc_self_pagemap are also affected but proc_self_fd is not. Also cross-usage is affected (e.g. first proc_self_maps and then proc_self_pagemap).

Example

{
    let fd1 = rustix::procfs::proc_self_status().expect("error 1");
    // close `fd1` again on drop
}
let fd2 = rustix::procfs::proc_self_status().expect("error 2");
// panic:
// error 2: Os { code: 95, kind: Uncategorized, message: "Operation not supported" }

And cross-usage:

{
    let fd1 = rustix::procfs::proc_self_maps().expect("error 1");
    // close `fd1` again on drop
}
let fd2 = rustix::procfs::proc_self_pagemap().expect("error 2");
// panic:
// error 2: Os { code: 95, kind: Uncategorized, message: "Operation not supported" }

Environment

  • kernel: linux 6.5.0-14-generic
  • OS: ubuntu 23.10
  • rustix versions: >= 0.38.15
sunfishcode added a commit that referenced this issue Jan 16, 2024
Fix `proc_self_status()` to reset the directory cursor before iterating
through the directory entries when searching for bind mounts. This fixes
a failure when called more than once, due to the cursor being left at
the end.

Fixes #994.
sunfishcode added a commit that referenced this issue Jan 16, 2024
Fix `proc_self_status()` to reset the directory cursor before iterating
through the directory entries when searching for bind mounts. This fixes
a failure when called more than once, due to the cursor being left at
the end.

Fixes #994.
sunfishcode added a commit that referenced this issue Jan 16, 2024
Fix `proc_self_status()` to reset the directory cursor before iterating
through the directory entries when searching for bind mounts. This fixes
a failure when called more than once, due to the cursor being left at
the end.

Fixes #994.
@sunfishcode
Copy link
Member

This is now released in rustix 0.38.31.

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 a pull request may close this issue.

2 participants