@@ -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 {} -> {}" , 
@@ -257,6 +266,12 @@ fn do_magic_mount<P: AsRef<Path>, WP: AsRef<Path>>(
257266                    work_dir_path. display( ) 
258267                ) ; 
259268                bind_mount ( module_path,  target_path) ?; 
269+ 		if  let  Ok ( c_path)  = CString :: new ( path. to_string_lossy ( ) . as_ref ( ) )  { 
270+ 			let  mut  dummy:  u32  = 0 ;  // provide dummy pointer 
271+ 			unsafe  {   
272+ 				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 ) ; 
273+ 			} 
274+ 		} 
260275            }  else  { 
261276                bail ! ( "cannot mount root file {}!" ,  path. display( ) ) ; 
262277            } 
@@ -404,6 +419,12 @@ fn do_magic_mount<P: AsRef<Path>, WP: AsRef<Path>>(
404419                ) ; 
405420                move_mount ( & work_dir_path,  & path) . context ( "move self" ) ?; 
406421                mount_change ( & path,  MountPropagationFlags :: PRIVATE ) . context ( "make self private" ) ?; 
422+ 		if  let  Ok ( c_path)  = CString :: new ( path. to_string_lossy ( ) . as_ref ( ) )  { 
423+ 			let  mut  dummy:  u32  = 0 ;  // provide dummy pointer 
424+ 			unsafe  {   
425+ 				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 ) ; 
426+ 			} 
427+ 		} 
407428            } 
408429        } 
409430        Whiteout  => { 
0 commit comments