Disable virtualization feature 95/244395/5 accepted/tizen/unified/20200923.024119 submit/tizen/20200922.102932
authorINSUN PYO <insun.pyo@samsung.com>
Fri, 18 Sep 2020 06:04:53 +0000 (15:04 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 22 Sep 2020 10:13:41 +0000 (10:13 +0000)
1. Tizen does not support continer and vm.

2. Resolving Smack error.
==========================================================================================
Jan 01 09:00:19 localhost audit[591]: AVC lsm=SMACK fn=smack_inode_permission action=denied subject="User" object="System::Privileged" requested=r pid=591 comm="systemd" name="sched" dev="proc" ino=12322
Jan 01 09:00:19 localhost audit[591]: AVC lsm=SMACK fn=smack_inode_permission action=denied subject="User" object="System::Privileged" requested=r pid=591 comm="systemd" name="sched" dev="proc" ino=12322
Jan 01 09:00:19 localhost audit[591]: AVC lsm=SMACK fn=smack_inode_permission action=denied subject="User" object="System::Privileged" requested=r pid=591 comm="systemd" name="sched" dev="proc" ino=12322

Jan 01 09:00:19 localhost audit[535]: AVC lsm=SMACK fn=smack_inode_permission action=denied subject="User" object="System::Privileged" requested=r pid=535 comm="tlm-sessiond" name="environ" dev="proc" ino=12572
Jan 01 09:00:19 localhost audit[535]: AVC lsm=SMACK fn=smack_inode_permission action=denied subject="User" object="System::Privileged" requested=r pid=535 comm="tlm-sessiond" name="sched" dev="proc" ino=12322

Jan 01 09:00:30 localhost audit[949]: AVC lsm=SMACK fn=smack_inode_permission action=denied subject="User" object="System::Privileged" requested=r pid=949 comm="systemctl" name="sched" dev="proc" ino=12322
==========================================================================================

Change-Id: I8b947a0de6c030fa7dd4f8d8b080b1f7783a4010

meson.build
meson_options.txt
packaging/systemd.spec
shell-completion/bash/meson.build
src/basic/virt.c

index 6cf1f56..06002d6 100644 (file)
@@ -1289,6 +1289,7 @@ conf.set10('ENABLE_REMOTE', have)
 
 foreach term : ['utmp',
                 'kdbus',
+                'virt',
                 'hibernate',
                 'environment-d',
                 'binfmt',
@@ -2427,13 +2428,15 @@ meson.add_install_script(meson_make_symlink,
                          join_paths(systemgeneratordir, exe_name),
                          join_paths(usergeneratordir, exe_name))
 
-exe = executable('systemd-detect-virt',
-                 'src/detect-virt/detect-virt.c',
-                 include_directories : includes,
-                 link_with : [libshared],
-                 install_rpath : rootlibexecdir,
-                 install : true)
-public_programs += exe
+if conf.get('ENABLE_VIRT') == 1
+        exe = executable('systemd-detect-virt',
+                         'src/detect-virt/detect-virt.c',
+                         include_directories : includes,
+                         link_with : [libshared],
+                         install_rpath : rootlibexecdir,
+                         install : true)
+        public_programs += exe
+endif
 
 exe = executable('systemd-delta',
                  'src/delta/delta.c',
@@ -3252,6 +3255,7 @@ foreach tuple : [
         ['blkid'],
         ['dbus'],
         ['kdbus'],
+        ['virt'],
         ['glib'],
         ['nss-myhostname'],
         ['nss-mymachines'],
index 0866630..76b145f 100644 (file)
@@ -318,6 +318,8 @@ option('tpm-pcrindex', type : 'integer', value : 8,
 
 option('kdbus', type : 'boolean', value : 'false',
        description : 'kdbus support')
+option('virt', type : 'boolean',
+       description : 'virtualization support')
 
 option('bashcompletiondir', type : 'string',
        description : 'directory for bash completion scripts ["no" disables]')
index 518ffd6..89b7c49 100644 (file)
@@ -12,6 +12,7 @@
 %define WITH_MACHINED 0
 %define WITH_DOC 0
 %define WITH_HOSTNAMED 0
+%define WITH_VIRT 0
 
 %define build_dir _build
 %define dbuspolicydir %{_datadir}/dbus-1
@@ -178,6 +179,9 @@ cp %{SOURCE9} .
 %define _vpath_builddir %{build_dir}
 %meson \
        -Dkdbus=true \
+%if ! %{?WITH_VIRT}
+       -Dvirt=false \
+%endif
 %if ! %{WITH_RANDOMSEED}
        -Drandomseed=false \
 %endif
@@ -420,12 +424,14 @@ chsmack %{_bindir}/systemd-cat -a "System::Tools"
 chsmack %{_bindir}/systemd-cgls -a "System::Tools"
 chsmack %{_bindir}/systemd-cgtop -a "System::Tools"
 chsmack %{_bindir}/systemd-delta -a "System::Tools"
-chsmack %{_bindir}/systemd-detect-virt -a "System::Tools"
 chsmack %{_bindir}/systemd-inhibit -a "System::Tools"
 chsmack %{_bindir}/udevadm -a "System::Tools"
 chsmack %{_bindir}/systemd-escape -a "System::Tools"
 chsmack %{_bindir}/systemd-path -a "System::Tools"
 chsmack %{_prefix}/lib/systemd/* -a "System::Tools"
+%if %{?WITH_VIRT}
+chsmack %{_bindir}/systemd-detect-virt -a "System::Tools"
+%endif
 
 %postun
 if [ $1 -ge 1 ] ; then
@@ -562,7 +568,6 @@ fi
 %{_bindir}/systemd-cgls
 %{_bindir}/systemd-cgtop
 %{_bindir}/systemd-delta
-%{_bindir}/systemd-detect-virt
 %{_bindir}/systemd-inhibit
 %{_bindir}/systemd-id128
 %{_bindir}/udevadm
@@ -573,6 +578,9 @@ fi
 %{_prefix}/lib/sysctl.d/*.conf
 %{_prefix}/lib/systemd/systemd
 %{_prefix}/lib/systemd/system
+%if %{?WITH_VIRT}
+%{_bindir}/systemd-detect-virt
+%endif
 
 %dir %{_prefix}/lib/systemd/system/basic.target.wants
 %dir %{_prefix}/lib/systemd/user
index 0d3022b..68872a7 100644 (file)
@@ -23,7 +23,7 @@ if bashcompletiondir != 'no'
                  ['systemd-cgls',        ''],
                  ['systemd-cgtop',       ''],
                  ['systemd-delta',       ''],
-                 ['systemd-detect-virt', ''],
+                 ['systemd-detect-virt', 'ENABLE_VIRT'],
                  ['systemd-nspawn',      ''],
                  ['systemd-path',        ''],
                  ['systemd-run',         ''],
index 6ba880d..cdb0480 100644 (file)
@@ -329,6 +329,7 @@ static int detect_vm_zvm(void) {
 
 /* Returns a short identifier for the various VM implementations */
 int detect_vm(void) {
+#if ENABLE_VIRT
         static thread_local int cached_found = _VIRTUALIZATION_INVALID;
         bool other = false;
         int r, dmi;
@@ -430,9 +431,13 @@ finish:
         cached_found = r;
         log_debug("Found VM virtualization %s", virtualization_to_string(r));
         return r;
+#else
+        return VIRTUALIZATION_NONE;
+#endif
 }
 
 int detect_container(void) {
+#if ENABLE_VIRT
         static const struct {
                 const char *value;
                 int id;
@@ -544,6 +549,9 @@ finish:
         log_debug("Found container virtualization %s.", virtualization_to_string(r));
         cached_found = r;
         return r;
+#else
+        return VIRTUALIZATION_NONE;
+#endif
 }
 
 int detect_virtualization(void) {