@@ -64,6 +64,7 @@ typedef enum MountMode {
6464 EXEC ,
6565 TMPFS ,
6666 EXTENSION_IMAGES , /* Mounted outside the root directory, and used by subsequent mounts */
67+ MQUEUEFS ,
6768 READWRITE_IMPLICIT , /* Should have the lowest priority. */
6869 _MOUNT_MODE_MAX ,
6970} MountMode ;
@@ -228,6 +229,7 @@ static const char * const mount_mode_table[_MOUNT_MODE_MAX] = {
228229 [READWRITE_IMPLICIT ] = "rw-implicit" ,
229230 [EXEC ] = "exec" ,
230231 [NOEXEC ] = "noexec" ,
232+ [MQUEUEFS ] = "mqueuefs" ,
231233};
232234
233235DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING (mount_mode , MountMode );
@@ -1113,6 +1115,24 @@ static int mount_run(const MountEntry *m) {
11131115 return mount_tmpfs (m );
11141116}
11151117
1118+ static int mount_mqueuefs (const MountEntry * m ) {
1119+ int r ;
1120+ const char * entry_path ;
1121+
1122+ assert (m );
1123+
1124+ entry_path = mount_entry_path (m );
1125+
1126+ (void ) mkdir_p_label (entry_path , 0755 );
1127+ (void ) umount_recursive (entry_path , 0 );
1128+
1129+ r = mount_nofollow_verbose (LOG_DEBUG , "mqueue" , entry_path , "mqueue" , m -> flags , mount_entry_options (m ));
1130+ if (r < 0 )
1131+ return r ;
1132+
1133+ return 0 ;
1134+ }
1135+
11161136static int mount_image (const MountEntry * m , const char * root_directory ) {
11171137
11181138 _cleanup_free_ char * host_os_release_id = NULL , * host_os_release_version_id = NULL ,
@@ -1317,6 +1337,9 @@ static int apply_one_mount(
13171337 case RUN :
13181338 return mount_run (m );
13191339
1340+ case MQUEUEFS :
1341+ return mount_mqueuefs (m );
1342+
13201343 case MOUNT_IMAGES :
13211344 return mount_image (m , NULL );
13221345
@@ -1516,7 +1539,8 @@ static size_t namespace_calculate_mounts(
15161539 (creds_path ? 2 : 1 ) +
15171540 !!log_namespace +
15181541 setup_propagate + /* /run/systemd/incoming */
1519- !!notify_socket ;
1542+ !!notify_socket +
1543+ ns_info -> private_ipc ; /* /dev/mqueue */
15201544}
15211545
15221546static void normalize_mounts (const char * root_directory , MountEntry * mounts , size_t * n_mounts ) {
@@ -2027,6 +2051,14 @@ int setup_namespace(
20272051 };
20282052 }
20292053
2054+ if (ns_info -> private_ipc ) {
2055+ * (m ++ ) = (MountEntry ) {
2056+ .path_const = "/dev/mqueue" ,
2057+ .mode = MQUEUEFS ,
2058+ .flags = MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_RELATIME ,
2059+ };
2060+ }
2061+
20302062 if (creds_path ) {
20312063 /* If our service has a credentials store configured, then bind that one in, but hide
20322064 * everything else. */
0 commit comments