Hello community, here is the log from the commit of package hwinfo for openSUSE:Factory checked in at 2018-09-20 11:38:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hwinfo (Old) and /work/SRC/openSUSE:Factory/.hwinfo.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hwinfo" Thu Sep 20 11:38:32 2018 rev:162 rq:636169 version:21.57 Changes: -------- --- /work/SRC/openSUSE:Factory/hwinfo/hwinfo.changes 2018-07-04 23:53:33.407996362 +0200 +++ /work/SRC/openSUSE:Factory/.hwinfo.new/hwinfo.changes 2018-09-20 11:38:39.564955245 +0200 @@ -1,0 +2,7 @@ +Mon Sep 17 11:59:38 UTC 2018 - [email protected] + +- merge gh#openSUSE/hwinfo#69 +- check for vmware only when running in a vm (bsc#1105003) +- 21.57 + +-------------------------------------------------------------------- Old: ---- hwinfo-21.56.tar.xz New: ---- hwinfo-21.57.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hwinfo.spec ++++++ --- /var/tmp/diff_new_pack.B2OPwp/_old 2018-09-20 11:38:40.528954677 +0200 +++ /var/tmp/diff_new_pack.B2OPwp/_new 2018-09-20 11:38:40.532954674 +0200 @@ -36,7 +36,7 @@ License: GPL-2.0+ Group: Hardware/Other Url: http://gitorious.org/opensuse/hwinfo -Version: 21.56 +Version: 21.57 Release: 0 Source: %{name}-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ hwinfo-21.56.tar.xz -> hwinfo-21.57.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hwinfo-21.56/VERSION new/hwinfo-21.57/VERSION --- old/hwinfo-21.56/VERSION 2018-06-28 09:12:46.000000000 +0200 +++ new/hwinfo-21.57/VERSION 2018-09-17 13:59:38.000000000 +0200 @@ -1 +1 @@ -21.56 +21.57 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hwinfo-21.56/changelog new/hwinfo-21.57/changelog --- old/hwinfo-21.56/changelog 2018-06-28 09:12:46.000000000 +0200 +++ new/hwinfo-21.57/changelog 2018-09-17 13:59:38.000000000 +0200 @@ -1,3 +1,6 @@ +2018-09-17: 21.57 + - check for vmware only when running in a vm (bsc #1105003) + 2018-06-26: 21.56 - Add support for RISC-V diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hwinfo-21.56/src/hd/hd.h new/hwinfo-21.57/src/hd/hd.h --- old/hwinfo-21.56/src/hd/hd.h 2018-06-28 09:12:46.000000000 +0200 +++ new/hwinfo-21.57/src/hd/hd.h 2018-09-17 13:59:38.000000000 +0200 @@ -20,7 +20,7 @@ /** Interface version */ #define HD_VERSION 21 -#define HD_MINOR_VERSION 56 +#define HD_MINOR_VERSION 57 #define HD_FULL_VERSION (HD_VERSION * 1000 + HD_MINOR_VERSION) /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hwinfo-21.56/src/hd/sys.c new/hwinfo-21.57/src/hd/sys.c --- old/hwinfo-21.56/src/hd/sys.c 2018-06-28 09:12:46.000000000 +0200 +++ new/hwinfo-21.57/src/hd/sys.c 2018-09-17 13:59:38.000000000 +0200 @@ -28,6 +28,7 @@ static void sigsegv_handler(int signum); static int vmware_mouse(int set_iopl); static void chk_vmware(hd_data_t *hd_data, sys_info_t *st); +static int chk_hypervisor(hd_data_t *hd_data); #endif #if defined(__i386__) || defined(__x86_64__) @@ -214,8 +215,13 @@ static int is_vmware = -1, has_vmware_mouse = -1; /* check only once */ if(is_vmware < 0) { - vm_1 = vmware_mouse(0); - vm_2 = vmware_mouse(1); + if(chk_hypervisor(hd_data)) { + vm_1 = vmware_mouse(0); + vm_2 = vmware_mouse(1); + } + else { + vm_1 = vm_2 = 0; + } is_vmware = vm_1 > 0 ? 1 : 0; has_vmware_mouse = is_vmware || vm_2 > 0 ? 1 : 0; @@ -318,6 +324,35 @@ return st->model ? 1 : 0; } + +/* + * Check if we're running under a hypervisor (in a virtual machine). + * + * Return 1 if yes, else 0. + * + * The purpose if this check is to minimize chances the vmware check will + * have negative side effects (see bsc#1105003). + */ +int chk_hypervisor(hd_data_t *hd_data) +{ + int vm = 0; + str_list_t *sl; + + for(sl = hd_data->cpu; sl; sl = sl->next) { + if( + !strncmp(sl->str, "flags\t", sizeof "flags\t" - 1) && + strstr(sl->str, " hypervisor") + ) { + vm = 1; + break; + } + } + + ADD2LOG(" hypervisor check: %d\n", vm); + + return vm; +} + #endif /* __i386__ || __x86_64__ */ /** @} */
