-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PAL] Enforce that device files are in the list of
sgx.allowed_files
Previously, device files (like `dev:/dev/zero`) were mounted in Gramine via the FS-mounts syntax in manifest: fs.mounts = [ {path = "/dev/zero", uri = "dev:/dev/zero"} ] However, devices are pass-through; Gramine doesn't add any protections to the app-to-device communication. Therefore, a careless usage of `write(device_fd)` may lead to data leaks and `read(device_fd)` may expose app's vulnerable parsing logic to the attacker or lead to trusting untrusted data. To make it more pronounced that Gramine doesn't provide any security guarantees to the device communication, this commit forces to specify devices as `sgx.allowed_files`. This is similar to how Gramine forces to specify device IOCTLs as `sys.allowed_ioctls`. **This is a breaking change!** At the PAL level, this requires normalizing the device pathname and finding it in the list of allowed files. The device pathname must also be checkpointed and restored in the child processes. Finally, this commit also introduces previously-missing device operations like `unlink` (delete) and `ftruncate` (setlength). Co-authored-by: Li, Xun <xun.li@intel.com> Signed-off-by: Li, Xun <xun.li@intel.com> Signed-off-by: Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
- Loading branch information
Showing
15 changed files
with
242 additions
and
88 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,7 @@ typedef struct { | |
|
||
struct { | ||
PAL_IDX fd; | ||
char* realpath; | ||
bool nonblocking; | ||
} dev; | ||
|
||
|
Oops, something went wrong.