Resolve writable shadow_fd destination in sendfile#65
Open
ChuWeiChang wants to merge 1 commit intosysprog21:mainfrom
Open
Resolve writable shadow_fd destination in sendfile#65ChuWeiChang wants to merge 1 commit intosysprog21:mainfrom
ChuWeiChang wants to merge 1 commit intosysprog21:mainfrom
Conversation
When intercepting sendfile with out_fd as shadow_fd, forward_sendfile mistakenly treat it as host_fd instead of shadow_sp. Fix this by explicitly querying the out_fd's FD table entry. If shadow_writeback is enabled, extract and write to shadow_sp instead. Change-Id: Ifbe431c557f8d10cb2f4ab221176da336e35e067
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #64 and also help with test gap 5 in #38
Overview
There is a routing bug in
forward_sendfileinseccomp_dispatch.cwhere destination shadow FDs were bypassing the virtual kernel (shadow_sp) and writing directly to the underlying physical host_fd.What this PR does
fd_table_entrylookup for the destinationout_fdprior to the emulation loop.test/guest/sendfile-test.cSummary by cubic
Fixes sendfile routing when the destination fd has a writeback shadow. Writes now go to the
shadow_spinstead of the host fd, ensuring correct sync and data visibility.out_fdvia the fd table and, whenshadow_writebackis set, write toshadow_spinsideforward_sendfile.sendfile-testto verify data is written through the shadow path and enable it inrun-tests.sh.Written for commit 00006c0. Summary will update on new commits.