mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	update libcontainer,gocapability,cadvisor
This commit is contained in:
		
							
								
								
									
										21
									
								
								vendor/github.com/opencontainers/runc/libcontainer/rootfs_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/github.com/opencontainers/runc/libcontainer/rootfs_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -50,7 +50,7 @@ func setupRootfs(config *configs.Config, console *linuxConsole, pipe io.ReadWrit
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if err := mountToRootfs(m, config.Rootfs, config.MountLabel); err != nil {
 | 
			
		||||
			return newSystemErrorWithCausef(err, "mounting %q to rootfs %q", m.Destination, config.Rootfs)
 | 
			
		||||
			return newSystemErrorWithCausef(err, "mounting %q to rootfs %q at %q", m.Source, config.Rootfs, m.Destination)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		for _, postcmd := range m.PostmountCmds {
 | 
			
		||||
@@ -270,7 +270,7 @@ func mountToRootfs(m *configs.Mount, rootfs, mountLabel string) error {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getCgroupMounts(m *configs.Mount) ([]*configs.Mount, error) {
 | 
			
		||||
	mounts, err := cgroups.GetCgroupMounts()
 | 
			
		||||
	mounts, err := cgroups.GetCgroupMounts(false)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
@@ -306,9 +306,6 @@ func getCgroupMounts(m *configs.Mount) ([]*configs.Mount, error) {
 | 
			
		||||
// checkMountDestination checks to ensure that the mount destination is not over the top of /proc.
 | 
			
		||||
// dest is required to be an abs path and have any symlinks resolved before calling this function.
 | 
			
		||||
func checkMountDestination(rootfs, dest string) error {
 | 
			
		||||
	if libcontainerUtils.CleanPath(rootfs) == libcontainerUtils.CleanPath(dest) {
 | 
			
		||||
		return fmt.Errorf("mounting into / is prohibited")
 | 
			
		||||
	}
 | 
			
		||||
	invalidDestinations := []string{
 | 
			
		||||
		"/proc",
 | 
			
		||||
	}
 | 
			
		||||
@@ -320,6 +317,8 @@ func checkMountDestination(rootfs, dest string) error {
 | 
			
		||||
		"/proc/diskstats",
 | 
			
		||||
		"/proc/meminfo",
 | 
			
		||||
		"/proc/stat",
 | 
			
		||||
		"/proc/swaps",
 | 
			
		||||
		"/proc/uptime",
 | 
			
		||||
		"/proc/net/dev",
 | 
			
		||||
	}
 | 
			
		||||
	for _, valid := range validDestinations {
 | 
			
		||||
@@ -663,10 +662,16 @@ func remountReadonly(path string) error {
 | 
			
		||||
	return fmt.Errorf("unable to mount %s as readonly max retries reached", path)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// maskFile bind mounts /dev/null over the top of the specified path inside a container
 | 
			
		||||
// to avoid security issues from processes reading information from non-namespace aware mounts ( proc/kcore ).
 | 
			
		||||
func maskFile(path string) error {
 | 
			
		||||
// maskPath masks the top of the specified path inside a container to avoid
 | 
			
		||||
// security issues from processes reading information from non-namespace aware
 | 
			
		||||
// mounts ( proc/kcore ).
 | 
			
		||||
// For files, maskPath bind mounts /dev/null over the top of the specified path.
 | 
			
		||||
// For directories, maskPath mounts read-only tmpfs over the top of the specified path.
 | 
			
		||||
func maskPath(path string) error {
 | 
			
		||||
	if err := syscall.Mount("/dev/null", path, "", syscall.MS_BIND, ""); err != nil && !os.IsNotExist(err) {
 | 
			
		||||
		if err == syscall.ENOTDIR {
 | 
			
		||||
			return syscall.Mount("tmpfs", path, "tmpfs", syscall.MS_RDONLY, "")
 | 
			
		||||
		}
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user