File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ dstack-types.workspace = true
2121dstack-mr.workspace = true
2222fuser.workspace = true
2323libc.workspace = true
24+ nix = { workspace = true , features = [" mount" ] }
2425sd-notify.workspace = true
2526sha2.workspace = true
2627tracing.workspace = true
Original file line number Diff line number Diff line change 66//! template and certificate NV indices consumed by `tpm-attest`.
77
88use std:: {
9- ffi:: CString ,
109 io:: { Read , Write } ,
1110 os:: {
1211 fd:: { AsRawFd , FromRawFd } ,
@@ -225,23 +224,17 @@ fn install_fixture_event_log() -> Result<()> {
225224 // securityfs does not permit userspace to create a synthetic TPM event
226225 // log hierarchy. Shadow it in this development-only guest before
227226 // publishing the fixture that was replayed into the simulated PCRs.
228- let source = CString :: new ( "dstack-tee-simulator" ) ?;
229- let target = CString :: new ( "/sys/kernel/security" ) ?;
230- let fstype = CString :: new ( "tmpfs" ) ?;
231- let data = CString :: new ( "mode=0755" ) ?;
232- let rc = unsafe {
233- libc:: mount (
234- source. as_ptr ( ) ,
235- target. as_ptr ( ) ,
236- fstype. as_ptr ( ) ,
237- libc:: MS_NOSUID | libc:: MS_NODEV | libc:: MS_NOEXEC ,
238- data. as_ptr ( ) . cast ( ) ,
239- )
240- } ;
241- if rc != 0 {
242- return Err ( std:: io:: Error :: last_os_error ( ) )
243- . context ( "failed to mount simulated securityfs shadow" ) ;
244- }
227+ let flags = nix:: mount:: MsFlags :: MS_NOSUID
228+ | nix:: mount:: MsFlags :: MS_NODEV
229+ | nix:: mount:: MsFlags :: MS_NOEXEC ;
230+ nix:: mount:: mount (
231+ Some ( "dstack-tee-simulator" ) ,
232+ security_root,
233+ Some ( "tmpfs" ) ,
234+ flags,
235+ Some ( "mode=0755" ) ,
236+ )
237+ . context ( "failed to mount simulated securityfs shadow" ) ?;
245238 fs_err:: create_dir_all ( tpm_dir)
246239 . context ( "failed to create TPM event-log directory in securityfs shadow" ) ?;
247240 fs_err:: write (
You can’t perform that action at this time.
0 commit comments