github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/runc/libcontainer/configs/device_defaults.go (about)

     1  // +build linux freebsd
     2  
     3  package configs
     4  
     5  var (
     6  	// DefaultSimpleDevices are devices that are to be both allowed and created.
     7  	DefaultSimpleDevices = []*Device{
     8  		// /dev/null and zero
     9  		{
    10  			Path:        "/dev/null",
    11  			Type:        'c',
    12  			Major:       1,
    13  			Minor:       3,
    14  			Permissions: "rwm",
    15  			FileMode:    0666,
    16  		},
    17  		{
    18  			Path:        "/dev/zero",
    19  			Type:        'c',
    20  			Major:       1,
    21  			Minor:       5,
    22  			Permissions: "rwm",
    23  			FileMode:    0666,
    24  		},
    25  
    26  		{
    27  			Path:        "/dev/full",
    28  			Type:        'c',
    29  			Major:       1,
    30  			Minor:       7,
    31  			Permissions: "rwm",
    32  			FileMode:    0666,
    33  		},
    34  
    35  		// consoles and ttys
    36  		{
    37  			Path:        "/dev/tty",
    38  			Type:        'c',
    39  			Major:       5,
    40  			Minor:       0,
    41  			Permissions: "rwm",
    42  			FileMode:    0666,
    43  		},
    44  
    45  		// /dev/urandom,/dev/random
    46  		{
    47  			Path:        "/dev/urandom",
    48  			Type:        'c',
    49  			Major:       1,
    50  			Minor:       9,
    51  			Permissions: "rwm",
    52  			FileMode:    0666,
    53  		},
    54  		{
    55  			Path:        "/dev/random",
    56  			Type:        'c',
    57  			Major:       1,
    58  			Minor:       8,
    59  			Permissions: "rwm",
    60  			FileMode:    0666,
    61  		},
    62  	}
    63  	DefaultAllowedDevices = append([]*Device{
    64  		// allow mknod for any device
    65  		{
    66  			Type:        'c',
    67  			Major:       Wildcard,
    68  			Minor:       Wildcard,
    69  			Permissions: "m",
    70  		},
    71  		{
    72  			Type:        'b',
    73  			Major:       Wildcard,
    74  			Minor:       Wildcard,
    75  			Permissions: "m",
    76  		},
    77  
    78  		{
    79  			Path:        "/dev/console",
    80  			Type:        'c',
    81  			Major:       5,
    82  			Minor:       1,
    83  			Permissions: "rwm",
    84  		},
    85  		// /dev/pts/ - pts namespaces are "coming soon"
    86  		{
    87  			Path:        "",
    88  			Type:        'c',
    89  			Major:       136,
    90  			Minor:       Wildcard,
    91  			Permissions: "rwm",
    92  		},
    93  		{
    94  			Path:        "",
    95  			Type:        'c',
    96  			Major:       5,
    97  			Minor:       2,
    98  			Permissions: "rwm",
    99  		},
   100  
   101  		// tuntap
   102  		{
   103  			Path:        "",
   104  			Type:        'c',
   105  			Major:       10,
   106  			Minor:       200,
   107  			Permissions: "rwm",
   108  		},
   109  	}, DefaultSimpleDevices...)
   110  	DefaultAutoCreatedDevices = append([]*Device{}, DefaultSimpleDevices...)
   111  )