Skip to content

Support fstat on pipes#3361

Merged
stevenengler merged 4 commits intoshadow:mainfrom
stevenengler:pipe-fstat
Jul 8, 2024
Merged

Support fstat on pipes#3361
stevenengler merged 4 commits intoshadow:mainfrom
stevenengler:pipe-fstat

Conversation

@stevenengler
Copy link
Copy Markdown
Contributor

@stevenengler stevenengler commented Jul 2, 2024

This adds support for the fstat syscall on pipe fds. Not all of the fields of struct stat are set properly (for example the access time field, inode field, etc), but it is enough for python's subprocess.run() to work correctly. Shadow logs a warning in any case.

Linux installs two different struct stat structures, one in "asm/stat.h" and the other in "asm-generic/stat.h". I think "asm/stat.h" is the right one.

Closes #3319.

processes:
- path: python3
  args: -c 'import subprocess; print(subprocess.run(["ls", "-l", "/dev/null"], capture_output=True).stdout)'
  start_time: 1
b'crw-rw-rw-. 1 nobody nobody 1, 3 Jun 23  2024 /dev/null\n'

@stevenengler stevenengler added this to the Support missing syscalls milestone Jul 2, 2024
@stevenengler stevenengler self-assigned this Jul 2, 2024
@github-actions github-actions bot added Component: Libraries Support functions like LD_PRELOAD and logging Component: Testing Unit and integration tests and frameworks Component: Main Composing the core Shadow executable Component: Build Build/install tools and dependencies labels Jul 2, 2024
@stevenengler stevenengler requested a review from sporksmith July 2, 2024 00:48
Copy link
Copy Markdown
Contributor

@sporksmith sporksmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@stevenengler stevenengler merged commit 5eaf3a5 into shadow:main Jul 8, 2024
@stevenengler stevenengler deleted the pipe-fstat branch July 8, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Build Build/install tools and dependencies Component: Libraries Support functions like LD_PRELOAD and logging Component: Main Composing the core Shadow executable Component: Testing Unit and integration tests and frameworks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support fstat on pipes

2 participants