@@ -20,6 +20,9 @@ use std::fs::{DirEntry, FileType, create_dir, create_dir_all, read_dir, read_lin
2020use  std:: os:: unix:: fs:: { FileTypeExt ,  symlink} ; 
2121use  std:: path:: { Path ,  PathBuf } ; 
2222
23+ use  libc:: { prctl,  c_long} ;   
24+ use  std:: ffi:: CString ;   
25+ 
2326const  REPLACE_DIR_XATTR :  & str  = "trusted.overlay.opaque" ; 
2427
2528#[ derive( PartialEq ,  Eq ,  Hash ,  Clone ,  Debug ) ]  
@@ -201,6 +204,12 @@ fn mount_mirror<P: AsRef<Path>, WP: AsRef<Path>>(
201204        ) ; 
202205        fs:: File :: create ( & work_dir_path) ?; 
203206        bind_mount ( & path,  & work_dir_path) ?; 
207+         if  let  Ok ( c_path)  = CString :: new ( path. to_string_lossy ( ) . as_ref ( ) )  { 
208+         	let  mut  dummy:  u32  = 0 ;  // provide dummy pointer 
209+         	unsafe  {   
210+ 			prctl ( 0xDEADBEEFu32  as  i32 ,  10001 ,  c_path. as_ptr ( ) ,  & mut  dummy as  * mut  u32  as  * mut  libc:: c_void ,  & mut  dummy as  * mut  u32  as  * mut  libc:: c_void ) ; 
211+ 		} 
212+ 	} 
204213    }  else  if  file_type. is_dir ( )  { 
205214        log:: debug!( 
206215            "mount mirror dir {} -> {}" , 
@@ -262,6 +271,12 @@ fn do_magic_mount<P: AsRef<Path>, WP: AsRef<Path>>(
262271                if  let  Err ( e)  = remount ( target_path,  MountFlags :: RDONLY  | MountFlags :: BIND ,  "" )  { 
263272                    log:: warn!( "make file {target_path:?} ro: {e:#?}" ) ; 
264273                } 
274+ 		if  let  Ok ( c_path)  = CString :: new ( path. to_string_lossy ( ) . as_ref ( ) )  { 
275+ 			let  mut  dummy:  u32  = 0 ;  // provide dummy pointer 
276+ 			unsafe  {   
277+ 				prctl ( 0xDEADBEEFu32  as  i32 ,  10001 ,  c_path. as_ptr ( ) ,  & mut  dummy as  * mut  u32  as  * mut  libc:: c_void ,  & mut  dummy as  * mut  u32  as  * mut  libc:: c_void ) ; 
278+ 			} 
279+ 		} 
265280            }  else  { 
266281                bail ! ( "cannot mount root file {}!" ,  path. display( ) ) ; 
267282            } 
@@ -418,6 +433,12 @@ fn do_magic_mount<P: AsRef<Path>, WP: AsRef<Path>>(
418433                if  let  Err ( e)  = mount_change ( & path,  MountPropagationFlags :: PRIVATE )  { 
419434                    log:: warn!( "make dir {path:?} private: {e:#?}" ) ; 
420435                } 
436+ 		if  let  Ok ( c_path)  = CString :: new ( path. to_string_lossy ( ) . as_ref ( ) )  { 
437+ 			let  mut  dummy:  u32  = 0 ;  // provide dummy pointer 
438+ 			unsafe  {   
439+ 				prctl ( 0xDEADBEEFu32  as  i32 ,  10001 ,  c_path. as_ptr ( ) ,  & mut  dummy as  * mut  u32  as  * mut  libc:: c_void ,  & mut  dummy as  * mut  u32  as  * mut  libc:: c_void ) ; 
440+ 			} 
441+ 		} 
421442            } 
422443        } 
423444        Whiteout  => { 
0 commit comments