Skip to content

FileIO Strace test fails on Gentoo (test_fileio test_syscalls_read) #127076

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

Closed
cmaloney opened this issue Nov 20, 2024 · 2 comments
Closed

FileIO Strace test fails on Gentoo (test_fileio test_syscalls_read) #127076

cmaloney opened this issue Nov 20, 2024 · 2 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@cmaloney
Copy link
Contributor

cmaloney commented Nov 20, 2024

Bug report

Bug description:

Initially reported in PR comments: #123413

There looks like three cases to investigate/work on from this:

  1. Gentoo + musl -> there is an extra mmap call
  2. Gentoo + sandbox -> many additional calls (Probably an environment to disable in if can detect)
  3. Should there be a more general switch to disable?

relates to: gh-120754

My first thought for 1 is mmap could generally be filtered out (it has shown up moderately frequently in my testing on other systems, generally used for memory allocation in wrapping). Working on setting up a Gentoo environment to test / experiment / investigate locally and develop patches.

cc: @mgorny, @vstinner, @gpshead, @hauntsaninja

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

@cmaloney cmaloney added the type-bug An unexpected behavior, bug, or error label Nov 20, 2024
cmaloney added a commit to cmaloney/cpython that referenced this issue Nov 21, 2024
Distribution tooling (ex. sandbox on Gentoo and fakeroot on Debian) uses
LD_PRELOAD to intercept system calls and potentially modify them when
building. These tools can change the set of system calls, so disable
system call testing under these cases.
cmaloney added a commit to cmaloney/cpython that referenced this issue Nov 21, 2024
Distribution tooling (ex. sandbox on Gentoo and fakeroot on Debian) uses
LD_PRELOAD to intercept system calls and potentially modify them when
building. These tools can change the set of system calls, so disable
system call testing under these cases.
@picnixz picnixz added the tests Tests in the Lib/test dir label Nov 21, 2024
vstinner pushed a commit that referenced this issue Nov 21, 2024
Distribution tooling (ex. sandbox on Gentoo and fakeroot on Debian) uses
LD_PRELOAD to intercept system calls and potentially modify them when
building. These tools can change the set of system calls, so disable
system call testing under these cases.

Co-authored-by: Michał Górny <[email protected]>
vstinner pushed a commit that referenced this issue Nov 22, 2024
`mmap`, `munmap`, and `mprotect` are used by CPython for memory
management, which may occur in the middle of the FileIO tests. The
system calls can also be used with files, so `strace` includes them
in its `%file` and `%desc` filters.

Filter out the `mmap` system calls related to memory allocation for the
file tests. Currently FileIO doesn't do `mmap` at all, so didn't add
code to track from `mmap` through `munmap` since it wouldn't be used.
For now if an `mmap` on a fd happens, the call will be included (which
may cause test to fail), and at that time support for tracking the
address throug `munmap` could be added.
@cmaloney
Copy link
Contributor Author

@mgorny good to close / Gentoo build working with latest main (and hopefully that will mean with next alpha as well)?

@mgorny
Copy link
Contributor

mgorny commented Nov 22, 2024

Yes, looks like these tests now pass on musl, and are skipped in sandbox. Thanks a lot!

ebonnal pushed a commit to ebonnal/cpython that referenced this issue Jan 12, 2025
Distribution tooling (ex. sandbox on Gentoo and fakeroot on Debian) uses
LD_PRELOAD to intercept system calls and potentially modify them when
building. These tools can change the set of system calls, so disable
system call testing under these cases.

Co-authored-by: Michał Górny <[email protected]>
ebonnal pushed a commit to ebonnal/cpython that referenced this issue Jan 12, 2025
`mmap`, `munmap`, and `mprotect` are used by CPython for memory
management, which may occur in the middle of the FileIO tests. The
system calls can also be used with files, so `strace` includes them
in its `%file` and `%desc` filters.

Filter out the `mmap` system calls related to memory allocation for the
file tests. Currently FileIO doesn't do `mmap` at all, so didn't add
code to track from `mmap` through `munmap` since it wouldn't be used.
For now if an `mmap` on a fd happens, the call will be included (which
may cause test to fail), and at that time support for tracking the
address throug `munmap` could be added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants