Skip to content

[RISC-V/Linux] Return EBADF for invalid fstatfs descriptors - #1698

Open
carlosqwqqwq wants to merge 1 commit into
qilingframework:devfrom
carlosqwqqwq:fix/riscv-fstatfs-invalid-fd-1688
Open

carlosqwqqwq wants to merge 1 commit into
qilingframework:devfrom
carlosqwqqwq:fix/riscv-fstatfs-invalid-fd-1688

Conversation

@carlosqwqqwq

Copy link
Copy Markdown

Fixes #1688.

Linux's fstatfs path returns EBADF when the descriptor is not open (kernel implementation). Normalize the guest descriptor to the syscall ABI width, then reject out-of-range or empty slots before writing the result. Valid descriptors keep the existing result path.

Tests:

  • python3 -B -m unittest -v test_fstatfs
  • python3 -B -m unittest -v test_posix.FstatfsTest

Checklist

  • This PR only contains minor fixes.
  • The new code follows the project's naming convention.
  • Imports are arranged properly.
  • Essential comments are included.
  • The Linux implementation reference is provided above.
  • Tests have been added.
  • Changelog has been updated.
  • The target branch is dev.
  • I have read the contribution guide.

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 this pull request may close these issues.

1 participant